From 10557af2d3ea3eff07f6a06b9442c5e0c1b4bbda Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 16 Aug 2024 13:48:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(warehouse=5Fproduct):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=87=BA=E5=85=A5=E5=BA=93=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store_product/StoreProductController.php | 17 +++++++++++++++-- .../SystemStoreStorageController.php | 2 ++ .../WarehouseProductController.php | 2 +- .../warehouse_product/WarehouseProductLogic.php | 1 + app/api/controller/user/UserController.php | 15 ++++++++++++++- .../SystemStoreStorageController.php | 2 ++ 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/admin/controller/store_product/StoreProductController.php b/app/admin/controller/store_product/StoreProductController.php index 4c152363..005b9e93 100644 --- a/app/admin/controller/store_product/StoreProductController.php +++ b/app/admin/controller/store_product/StoreProductController.php @@ -130,7 +130,14 @@ class StoreProductController extends BaseAdminController StoreProductLogic::ordinary($arr, $store_id, $this->adminId, $find, $warehouse_id); } else { WarehouseProductLogic::add($data); - StoreBranchProduct::where('product_id', $arr['id'])->where('store_id', $store_id)->inc('stock', $arr['stock'])->update(); + $find = StoreBranchProduct::where('product_id', $arr['id'])->where('store_id', $store_id)->find(); + if ($find) { + StoreBranchProduct::where('id', $find['id'])->inc('stock', $arr['stock'])->update(); + } else { + $find = StoreProduct::where('id', $arr['id'])->findOrEmpty()->toArray(); + StoreProductLogic::ordinary($arr, $store_id, $this->adminId, $find, $warehouse_id); + StoreBranchProduct::where('product_id', $arr['id'])->where('store_id', $store_id)->inc('stock', $arr['stock'])->update(); + } } // StoreProductLogic::ordinary($arr, $store_id, $this->adminId, $find, $warehouse_id); @@ -154,7 +161,13 @@ class StoreProductController extends BaseAdminController StoreProductLogic::ordinary($arr, $store_id, $this->adminId, $find, $warehouse_id); } else { WarehouseProductLogic::add($data); - StoreBranchProduct::where('product_id', $arr['id'])->where('store_id', $store_id)->inc('stock', $arr['stock'])->update(); + $find = StoreBranchProduct::where('product_id', $arr['id'])->where('store_id', $store_id)->find(); + if ($find) { + StoreBranchProduct::where('id', $find['id'])->inc('stock', $arr['stock'])->update(); + } else { + StoreProductLogic::ordinary($arr, $store_id, $this->adminId, $find, $warehouse_id); + StoreBranchProduct::where('product_id', $arr['id'])->where('store_id', $store_id)->inc('stock', $arr['stock'])->update(); + } } // $find = StoreProduct::where('id', $arr['id'])->findOrEmpty()->toArray(); diff --git a/app/admin/controller/system_store_storage/SystemStoreStorageController.php b/app/admin/controller/system_store_storage/SystemStoreStorageController.php index d04d3784..475cd5f8 100644 --- a/app/admin/controller/system_store_storage/SystemStoreStorageController.php +++ b/app/admin/controller/system_store_storage/SystemStoreStorageController.php @@ -56,6 +56,8 @@ class SystemStoreStorageController extends BaseAdminController */ public function edit() { + return $this->fail('暂不支持入库操作'); + // $params = (new SystemStoreStorageValidate())->post()->goCheck('edit'); // $params['admin_id']=$this->adminId; // $result = SystemStoreStorageLogic::edit($params); diff --git a/app/admin/controller/warehouse_product/WarehouseProductController.php b/app/admin/controller/warehouse_product/WarehouseProductController.php index a552f941..83751d08 100644 --- a/app/admin/controller/warehouse_product/WarehouseProductController.php +++ b/app/admin/controller/warehouse_product/WarehouseProductController.php @@ -31,7 +31,7 @@ class WarehouseProductController extends BaseAdminController /** - * @notes 添加商品仓储信息 + * @notes 添加商品出入库信息 * @return \think\response\Json * @author admin * @date 2024/07/31 16:55 diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index 0dd50725..4ef96aa8 100644 --- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php +++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php @@ -86,6 +86,7 @@ class WarehouseProductLogic extends BaseLogic } $res = WarehouseProduct::create($data); + //更改采购订单状态 if(isset($params['purchase_product_offer_id']) &&$params['purchase_product_offer_id']!=''){ PurchaseProductOffer::where('id',$params['purchase_product_offer_id'])->update(['is_storage'=>1,'supplier_id'=>$params['supplier_id']??0]); } diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index 744a3d57..00bb2b9f 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -293,8 +293,9 @@ class UserController extends BaseApiController */ public function cash_info() { - $info = User::where('id', $this->userId)->field('id,now_money')->find(); + $info = User::where('id', $this->userId)->field('id,now_money,id_card')->find(); $info['notes'] = '提现金额需大于1元,提现到微信零钱,并财务审核,审核通过后,提现金额将自动到账'; + $info['extract_price'] =StoreExtract::where('uid',$this->userId)->sum('extract_price'); return $this->data($info); } @@ -352,4 +353,16 @@ class UserController extends BaseApiController })->toArray(); return $this->data($list); } + + /** + * 更新身份证号 + */ + public function update_id_card(){ + $id_card = $this->request->post('id_card'); + if($id_card){ + User::where('id',$this->userId)->update(['id_card'=>$id_card]); + return $this->success('设置成功'); + } + return $this->fail('请输入身份证号'); + } } diff --git a/app/store/controller/system_store_storage/SystemStoreStorageController.php b/app/store/controller/system_store_storage/SystemStoreStorageController.php index be310492..2f87b038 100644 --- a/app/store/controller/system_store_storage/SystemStoreStorageController.php +++ b/app/store/controller/system_store_storage/SystemStoreStorageController.php @@ -34,6 +34,8 @@ class SystemStoreStorageController extends BaseAdminController public function edit() { + return $this->fail('暂不支持入库操作'); + $id = $this->request->post('id',0); if($id==0){ return $this->fail('参数错误');