From 8889b0198999ed0192b1b9fed7b645dd4ae4aff4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 19 Nov 2024 16:36:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(warehouse=5Forder):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E6=9F=A5=E8=AF=A2=E5=92=8C=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 WarehouseOrderController 中使用 withTrashed() 方法查询产品,以包含软删除的产品 - 修改 StoreProductLists 中的分类名称显示逻辑,显示完整的分类路径 --- .../warehouse_order/WarehouseOrderController.php | 8 ++++---- app/admin/lists/store_product/StoreProductLists.php | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/admin/controller/warehouse_order/WarehouseOrderController.php b/app/admin/controller/warehouse_order/WarehouseOrderController.php index 190a18e3f..122672579 100644 --- a/app/admin/controller/warehouse_order/WarehouseOrderController.php +++ b/app/admin/controller/warehouse_order/WarehouseOrderController.php @@ -203,7 +203,7 @@ class WarehouseOrderController extends BaseAdminController $credit_pay = 0; $cash_pay = 0; foreach ($data as $key => &$value) { - $find = StoreProduct::where('id', $value->product_id)->find(); + $find = StoreProduct::where('id', $value->product_id)->withTrashed()->find(); $value->store_name = $find['store_name'] ?? ''; $value->store_info = $find['store_info'] ?? ''; if (!empty($find['unit'])) { @@ -248,9 +248,9 @@ class WarehouseOrderController extends BaseAdminController $total_price=0; foreach ($data as $key => &$value) { if(in_array($order['store_id'],[17,18])){ - $find = StoreBranchProduct::where('product_id', $value->product_id)->where('store_id',$order['store_id'])->find(); + $find = StoreBranchProduct::where('product_id', $value->product_id)->where('store_id',$order['store_id'])->withTrashed()->find(); }else{ - $find = StoreProduct::where('id', $value->product_id)->find(); + $find = StoreProduct::where('id', $value->product_id)->withTrashed()->find(); } $value->store_name = $find['store_name'] ?? ''; $value->store_info = $find['store_info'] ?? ''; @@ -311,7 +311,7 @@ class WarehouseOrderController extends BaseAdminController $system_store = SystemStore::where('id', $warehouseOrder['store_id'])->value('introduction'); $data = WarehouseProduct::where('oid', $id)->where('financial_pm',0)->field('oid,product_id,nums')->select() ->each(function ($item) use ($system_store,$warehouseOrder) { - $find = StoreProduct::where('id', $item['product_id'])->field('store_name,unit')->find(); + $find = StoreProduct::where('id', $item['product_id'])->field('store_name,unit')->withTrashed()->find(); $unit_name = StoreProductUnit::where('id', $find['unit'])->value('name'); $item['system_store'] = $system_store; $item['subtitle'] = $item['oid'].' '.convertStringToNumber($item['nums']).'/'.$unit_name; diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index cae8c5759..7af3427e6 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -100,7 +100,8 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa } $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->value('name'); $stock = StoreBranchProduct::where('store_id', '<>', '4')->where('product_id', $item['id'])->sum('stock'); - $item['cate_name'] = StoreCategory::where('id', $item['cate_id'])->value('name'); + $category = StoreCategory::where('id','in',[$item['top_cate_id'],$item['two_cate_id'],$item['cate_id']])->column('name'); + $item['cate_name'] =implode('/', $category); if($is_warehouse==1){ $item['stock'] = WarehouseProductStorege::where('product_id', $item['id'])->sum('nums'); }else{