diff --git a/app/admin/lists/inventory_store/InventoryStoreLists.php b/app/admin/lists/inventory_store/InventoryStoreLists.php index aede20268..dfeb044a6 100644 --- a/app/admin/lists/inventory_store/InventoryStoreLists.php +++ b/app/admin/lists/inventory_store/InventoryStoreLists.php @@ -6,7 +6,10 @@ namespace app\admin\lists\inventory_store; use app\admin\lists\BaseAdminDataLists; use app\common\model\inventory_store\InventoryStore; use app\common\lists\ListsSearchInterface; - +use app\common\model\auth\Admin; +use app\common\model\store_product\StoreProduct; +use app\common\model\system_store\SystemStore; +use app\common\model\system_store\SystemStoreStaff; /** * 门店盘存列表 @@ -53,6 +56,18 @@ class InventoryStoreLists extends BaseAdminDataLists implements ListsSearchInter 2 => '盘点完成', default => '未知', }; + if($item->admin_id){ + $item->admin_name = Admin::where('id',$item->admin_id)->value('name'); + } + if($item->staff_id){ + $item->staff_name = SystemStoreStaff::where('id',$item->staff_id)->value('staff_name'); + } + if($item->store_id){ + $item->store_name = SystemStore::where('id',$item->store_id)->value('name'); + } + if($item->product_id){ + $item->product_name = StoreProduct::where('id',$item->product_id)->withTrashed()->value('store_name'); + } }) ->toArray(); } diff --git a/app/admin/logic/inventory_store/InventoryStoreLogic.php b/app/admin/logic/inventory_store/InventoryStoreLogic.php index a30f7bc88..836c0dabf 100644 --- a/app/admin/logic/inventory_store/InventoryStoreLogic.php +++ b/app/admin/logic/inventory_store/InventoryStoreLogic.php @@ -30,7 +30,11 @@ class InventoryStoreLogic extends BaseLogic { Db::startTrans(); try { - $arr=(new StoreBranchProduct())->field('product_id,store_id,stock as nums')->select()->toArray(); + $find=InventoryStore::where('store_id', $params['store_id'])->whereDay('create_time')->find(); + if($find){ + throw new BusinessException('今日数据已生成'); + } + $arr=StoreBranchProduct::where('store_id',$params['store_id'])->field('product_id,store_id,stock as nums')->select()->toArray(); (new InventoryStore())->saveAll($arr); Db::commit(); return true; @@ -99,16 +103,4 @@ class InventoryStoreLogic extends BaseLogic return InventoryStore::destroy($params['id']); } - - /** - * @notes 获取门店盘存详情 - * @param $params - * @return array - * @author admin - * @date 2025/02/14 11:46 - */ - public static function detail($params): array - { - return InventoryStore::findOrEmpty($params['id'])->toArray(); - } } \ No newline at end of file