From 6a4f087bc0215718c634ad760168068b863046ec Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Mon, 10 Mar 2025 11:31:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E3=80=81=E5=85=A5=E5=BA=93=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/store_product/StoreProductLists.php | 4 +- app/common/model/OutboundOrder.php | 22 +++ app/common/model/OutboundProduct.php | 22 +++ app/common/model/WarehouseOrder.php | 22 +++ app/common/model/WarehouseProduct.php | 22 +++ .../WarehouseStorage.php} | 10 +- .../controller/OutboundOrderController.php | 95 ++++++++++++ .../controller/OutboundProductController.php | 95 ++++++++++++ .../controller/WarehouseOrderController.php | 95 ++++++++++++ .../controller/WarehouseProductController.php | 95 ++++++++++++ .../WarehouseStorageController.php | 45 ++++++ .../WarehouseStoregeController.php | 45 ------ app/psi/lists/OutboundOrderLists.php | 66 ++++++++ app/psi/lists/OutboundProductLists.php | 66 ++++++++ app/psi/lists/WarehouseOrderLists.php | 66 ++++++++ app/psi/lists/WarehouseProductLists.php | 66 ++++++++ .../WarehouseStorageLists.php} | 16 +- app/psi/logic/OutboundOrderLogic.php | 123 +++++++++++++++ app/psi/logic/OutboundProductLogic.php | 145 ++++++++++++++++++ app/psi/logic/WarehouseOrderLogic.php | 121 +++++++++++++++ app/psi/logic/WarehouseProductLogic.php | 145 ++++++++++++++++++ .../purchase_product/PurchaseProductLogic.php | 14 +- .../WarehouseStorageLogic.php} | 20 +-- app/psi/validate/OutboundOrderValidate.php | 84 ++++++++++ app/psi/validate/OutboundProductValidate.php | 96 ++++++++++++ app/psi/validate/WarehouseOrderValidate.php | 90 +++++++++++ app/psi/validate/WarehouseProductValidate.php | 96 ++++++++++++ 27 files changed, 1709 insertions(+), 77 deletions(-) create mode 100644 app/common/model/OutboundOrder.php create mode 100644 app/common/model/OutboundProduct.php create mode 100644 app/common/model/WarehouseOrder.php create mode 100644 app/common/model/WarehouseProduct.php rename app/common/model/psi/{warehouse_storege/WarehouseStorege.php => warehouse_storage/WarehouseStorage.php} (53%) create mode 100644 app/psi/controller/OutboundOrderController.php create mode 100644 app/psi/controller/OutboundProductController.php create mode 100644 app/psi/controller/WarehouseOrderController.php create mode 100644 app/psi/controller/WarehouseProductController.php create mode 100644 app/psi/controller/warehouse_storage/WarehouseStorageController.php delete mode 100644 app/psi/controller/warehouse_storege/WarehouseStoregeController.php create mode 100644 app/psi/lists/OutboundOrderLists.php create mode 100644 app/psi/lists/OutboundProductLists.php create mode 100644 app/psi/lists/WarehouseOrderLists.php create mode 100644 app/psi/lists/WarehouseProductLists.php rename app/psi/lists/{warehouse_storege/WarehouseStoregeLists.php => warehouse_storage/WarehouseStorageLists.php} (74%) create mode 100644 app/psi/logic/OutboundOrderLogic.php create mode 100644 app/psi/logic/OutboundProductLogic.php create mode 100644 app/psi/logic/WarehouseOrderLogic.php create mode 100644 app/psi/logic/WarehouseProductLogic.php rename app/psi/logic/{warehouse_storege/WarehouseStoregeLogic.php => warehouse_storage/WarehouseStorageLogic.php} (80%) create mode 100644 app/psi/validate/OutboundOrderValidate.php create mode 100644 app/psi/validate/OutboundProductValidate.php create mode 100644 app/psi/validate/WarehouseOrderValidate.php create mode 100644 app/psi/validate/WarehouseProductValidate.php diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index e4f0267..111bdc1 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -16,7 +16,7 @@ use app\common\model\system_store\SystemStore; use app\common\model\user\User; use app\common\model\warehouse_product_storege\WarehouseProductStorege; use app\common\lists\ListsExcelInterface; -use app\common\model\psi\warehouse_storege\WarehouseStorege; +use app\common\model\psi\warehouse_storage\WarehouseStorage; /** * 商品列表列表 @@ -105,7 +105,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa $item['unit_name'] = StoreProductUnit::where('id', $item['unit'])->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); - $item['stock'] = WarehouseStorege::where('product_id', $item['id'])->sum('nums'); + $item['stock'] = WarehouseStorage::where('product_id', $item['id'])->sum('nums'); if ($item['is_show'] == 1) { $item['status_msg'] = '上架|常用'; } else { diff --git a/app/common/model/OutboundOrder.php b/app/common/model/OutboundOrder.php new file mode 100644 index 0000000..7caa082 --- /dev/null +++ b/app/common/model/OutboundOrder.php @@ -0,0 +1,22 @@ +dataLists(new OutboundOrderLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function add() + { + $params = (new OutboundOrderValidate())->post()->goCheck('add'); + $result = OutboundOrderLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(OutboundOrderLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function edit() + { + $params = (new OutboundOrderValidate())->post()->goCheck('edit'); + $result = OutboundOrderLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(OutboundOrderLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function delete() + { + $params = (new OutboundOrderValidate())->post()->goCheck('delete'); + OutboundOrderLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function detail() + { + $params = (new OutboundOrderValidate())->goCheck('detail'); + $result = OutboundOrderLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/psi/controller/OutboundProductController.php b/app/psi/controller/OutboundProductController.php new file mode 100644 index 0000000..b2b6894 --- /dev/null +++ b/app/psi/controller/OutboundProductController.php @@ -0,0 +1,95 @@ +dataLists(new OutboundProductLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function add() + { + $params = (new OutboundProductValidate())->post()->goCheck('add'); + $result = OutboundProductLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(OutboundProductLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function edit() + { + $params = (new OutboundProductValidate())->post()->goCheck('edit'); + $result = OutboundProductLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(OutboundProductLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function delete() + { + $params = (new OutboundProductValidate())->post()->goCheck('delete'); + OutboundProductLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function detail() + { + $params = (new OutboundProductValidate())->goCheck('detail'); + $result = OutboundProductLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/psi/controller/WarehouseOrderController.php b/app/psi/controller/WarehouseOrderController.php new file mode 100644 index 0000000..15e086f --- /dev/null +++ b/app/psi/controller/WarehouseOrderController.php @@ -0,0 +1,95 @@ +dataLists(new WarehouseOrderLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function add() + { + $params = (new WarehouseOrderValidate())->post()->goCheck('add'); + $result = WarehouseOrderLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(WarehouseOrderLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function edit() + { + $params = (new WarehouseOrderValidate())->post()->goCheck('edit'); + $result = WarehouseOrderLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(WarehouseOrderLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function delete() + { + $params = (new WarehouseOrderValidate())->post()->goCheck('delete'); + WarehouseOrderLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function detail() + { + $params = (new WarehouseOrderValidate())->goCheck('detail'); + $result = WarehouseOrderLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/psi/controller/WarehouseProductController.php b/app/psi/controller/WarehouseProductController.php new file mode 100644 index 0000000..2d9499f --- /dev/null +++ b/app/psi/controller/WarehouseProductController.php @@ -0,0 +1,95 @@ +dataLists(new WarehouseProductLists()); + } + + + /** + * @notes 添加 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function add() + { + $params = (new WarehouseProductValidate())->post()->goCheck('add'); + $result = WarehouseProductLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(WarehouseProductLogic::getError()); + } + + + /** + * @notes 编辑 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function edit() + { + $params = (new WarehouseProductValidate())->post()->goCheck('edit'); + $result = WarehouseProductLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(WarehouseProductLogic::getError()); + } + + + /** + * @notes 删除 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function delete() + { + $params = (new WarehouseProductValidate())->post()->goCheck('delete'); + WarehouseProductLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取详情 + * @return \think\response\Json + * @author admin + * @date 2025/03/10 11:08 + */ + public function detail() + { + $params = (new WarehouseProductValidate())->goCheck('detail'); + $result = WarehouseProductLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/psi/controller/warehouse_storage/WarehouseStorageController.php b/app/psi/controller/warehouse_storage/WarehouseStorageController.php new file mode 100644 index 0000000..1aab220 --- /dev/null +++ b/app/psi/controller/warehouse_storage/WarehouseStorageController.php @@ -0,0 +1,45 @@ +dataLists(new WarehouseStorageLists()); + } + public function edit() + { + $params = $this->request->post(); + $result = WarehouseStorageLogic::edit($params,$this->adminId); + return $this->success('编辑成功', [], 1, 1); + + } + + + public function verify(){ + $params=$this->request->post(); + WarehouseStorage::where('id',$params['id'])->update(['is_verify'=>$params['is_verify']]); + return $this->success('操作成功',[],1,1); + } + +} \ No newline at end of file diff --git a/app/psi/controller/warehouse_storege/WarehouseStoregeController.php b/app/psi/controller/warehouse_storege/WarehouseStoregeController.php deleted file mode 100644 index e56db92..0000000 --- a/app/psi/controller/warehouse_storege/WarehouseStoregeController.php +++ /dev/null @@ -1,45 +0,0 @@ -dataLists(new WarehouseStoregeLists()); - } - public function edit() - { - $params = $this->request->post(); - $result = WarehouseStoregeLogic::edit($params,$this->adminId); - return $this->success('编辑成功', [], 1, 1); - - } - - - public function verify(){ - $params=$this->request->post(); - WarehouseStorege::where('id',$params['id'])->update(['is_verify'=>$params['is_verify']]); - return $this->success('操作成功',[],1,1); - } - -} \ No newline at end of file diff --git a/app/psi/lists/OutboundOrderLists.php b/app/psi/lists/OutboundOrderLists.php new file mode 100644 index 0000000..f264e70 --- /dev/null +++ b/app/psi/lists/OutboundOrderLists.php @@ -0,0 +1,66 @@ + ['warehouse_id', 'supplier_id', 'store_id', 'type', 'oid', 'order_type', 'code', 'status'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2025/03/10 11:08 + */ + public function lists(): array + { + return OutboundOrder::where($this->searchWhere) + ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'type', 'oid', 'order_type', 'code', 'mark', 'nums', 'purchase', 'total_price', 'completed_amount', 'outstanding_amount', 'status', 'create_time']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author admin + * @date 2025/03/10 11:08 + */ + public function count(): int + { + return OutboundOrder::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/psi/lists/OutboundProductLists.php b/app/psi/lists/OutboundProductLists.php new file mode 100644 index 0000000..adabdfb --- /dev/null +++ b/app/psi/lists/OutboundProductLists.php @@ -0,0 +1,66 @@ + ['warehouse_id', 'supplier_id', 'store_id', 'order_type', 'product_id', 'oid', 'code', 'pay_type', 'status'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2025/03/10 11:08 + */ + public function lists(): array + { + return OutboundProduct::where($this->searchWhere) + ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'order_type', 'product_id', 'oid', 'code', 'nums', 'refund_nums', 'before_nums', 'after_nums', 'mark', 'total_price', 'purchase', 'is_pay', 'pay_type', 'status']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author admin + * @date 2025/03/10 11:08 + */ + public function count(): int + { + return OutboundProduct::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/psi/lists/WarehouseOrderLists.php b/app/psi/lists/WarehouseOrderLists.php new file mode 100644 index 0000000..e1c2a33 --- /dev/null +++ b/app/psi/lists/WarehouseOrderLists.php @@ -0,0 +1,66 @@ + ['warehouse_id', 'store_id', 'oid', 'order_type', 'code', 'status', 'create_time'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2025/03/10 11:08 + */ + public function lists(): array + { + return WarehouseOrder::where($this->searchWhere) + ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'oid', 'order_type', 'code', 'mark', 'nums', 'purchase', 'total_price', 'completed_amount', 'outstanding_amount', 'status']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author admin + * @date 2025/03/10 11:08 + */ + public function count(): int + { + return WarehouseOrder::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/psi/lists/WarehouseProductLists.php b/app/psi/lists/WarehouseProductLists.php new file mode 100644 index 0000000..9e9c3b8 --- /dev/null +++ b/app/psi/lists/WarehouseProductLists.php @@ -0,0 +1,66 @@ + ['warehouse_id', 'supplier_id', 'store_id', 'order_type', 'product_id', 'oid', 'code', 'pay_type', 'status'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author admin + * @date 2025/03/10 11:08 + */ + public function lists(): array + { + return WarehouseProduct::where($this->searchWhere) + ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'order_type', 'product_id', 'unit', 'oid', 'code', 'nums', 'refund_nums', 'before_nums', 'after_nums', 'mark', 'total_price', 'purchase', 'pay_type', 'status']) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author admin + * @date 2025/03/10 11:08 + */ + public function count(): int + { + return WarehouseProduct::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/psi/lists/warehouse_storege/WarehouseStoregeLists.php b/app/psi/lists/warehouse_storage/WarehouseStorageLists.php similarity index 74% rename from app/psi/lists/warehouse_storege/WarehouseStoregeLists.php rename to app/psi/lists/warehouse_storage/WarehouseStorageLists.php index c4bf54b..3eb5b47 100644 --- a/app/psi/lists/warehouse_storege/WarehouseStoregeLists.php +++ b/app/psi/lists/warehouse_storage/WarehouseStorageLists.php @@ -1,19 +1,19 @@ searchWhere) + return WarehouseStorage::where($this->searchWhere) ->field(['id', 'warehouse_id', 'product_id', 'nums', 'is_verify', 'price']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) @@ -59,7 +59,7 @@ class WarehouseStoregeLists extends BaseDataLists implements ListsSearchInterfac */ public function count(): int { - return WarehouseStorege::where($this->searchWhere)->count(); + return WarehouseStorage::where($this->searchWhere)->count(); } } \ No newline at end of file diff --git a/app/psi/logic/OutboundOrderLogic.php b/app/psi/logic/OutboundOrderLogic.php new file mode 100644 index 0000000..689f25b --- /dev/null +++ b/app/psi/logic/OutboundOrderLogic.php @@ -0,0 +1,123 @@ + $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'type' => $params['type'], + 'oid' => $params['oid'], + 'order_type' => $params['order_type'], + 'code' => $params['code'], + 'admin_id' => $params['admin_id'], + 'batch' => $params['batch'], + 'mark' => $params['mark'], + 'nums' => $params['nums'], + 'purchase' => $params['purchase'], + 'total_price' => $params['total_price'], + 'completed_amount' => $params['completed_amount'], + 'outstanding_amount' => $params['outstanding_amount'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + OutboundOrder::where('id', $params['id'])->update([ + 'warehouse_id' => $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'type' => $params['type'], + 'oid' => $params['oid'], + 'order_type' => $params['order_type'], + 'code' => $params['code'], + 'admin_id' => $params['admin_id'], + 'batch' => $params['batch'], + 'mark' => $params['mark'], + 'nums' => $params['nums'], + 'purchase' => $params['purchase'], + 'total_price' => $params['total_price'], + 'completed_amount' => $params['completed_amount'], + 'outstanding_amount' => $params['outstanding_amount'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function delete(array $params): bool + { + return OutboundOrder::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author admin + * @date 2025/03/10 11:08 + */ + public static function detail($params): array + { + return OutboundOrder::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/psi/logic/OutboundProductLogic.php b/app/psi/logic/OutboundProductLogic.php new file mode 100644 index 0000000..164977d --- /dev/null +++ b/app/psi/logic/OutboundProductLogic.php @@ -0,0 +1,145 @@ + $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'order_type' => $params['order_type'], + 'product_id' => $params['product_id'], + 'unit' => $params['unit'], + 'oid' => $params['oid'], + 'code' => $params['code'], + 'manufacture' => $params['manufacture'], + 'expiration_date' => $params['expiration_date'], + 'admin_id' => $params['admin_id'], + 'enter_admin_id' => $params['enter_admin_id'], + 'staff_id' => $params['staff_id'], + 'batch' => $params['batch'], + 'nums' => $params['nums'], + 'refund_nums' => $params['refund_nums'], + 'before_nums' => $params['before_nums'], + 'after_nums' => $params['after_nums'], + 'mark' => $params['mark'], + 'price' => $params['price'], + 'total_price' => $params['total_price'], + 'purchase' => $params['purchase'], + 'cost' => $params['cost'], + 'vip_price' => $params['vip_price'], + 'is_pay' => $params['is_pay'], + 'pay_type' => $params['pay_type'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + OutboundProduct::where('id', $params['id'])->update([ + 'warehouse_id' => $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'order_type' => $params['order_type'], + 'product_id' => $params['product_id'], + 'unit' => $params['unit'], + 'oid' => $params['oid'], + 'code' => $params['code'], + 'manufacture' => $params['manufacture'], + 'expiration_date' => $params['expiration_date'], + 'admin_id' => $params['admin_id'], + 'enter_admin_id' => $params['enter_admin_id'], + 'staff_id' => $params['staff_id'], + 'batch' => $params['batch'], + 'nums' => $params['nums'], + 'refund_nums' => $params['refund_nums'], + 'before_nums' => $params['before_nums'], + 'after_nums' => $params['after_nums'], + 'mark' => $params['mark'], + 'price' => $params['price'], + 'total_price' => $params['total_price'], + 'purchase' => $params['purchase'], + 'cost' => $params['cost'], + 'vip_price' => $params['vip_price'], + 'is_pay' => $params['is_pay'], + 'pay_type' => $params['pay_type'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function delete(array $params): bool + { + return OutboundProduct::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author admin + * @date 2025/03/10 11:08 + */ + public static function detail($params): array + { + return OutboundProduct::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/psi/logic/WarehouseOrderLogic.php b/app/psi/logic/WarehouseOrderLogic.php new file mode 100644 index 0000000..54a58cd --- /dev/null +++ b/app/psi/logic/WarehouseOrderLogic.php @@ -0,0 +1,121 @@ + $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'oid' => $params['oid'], + 'order_type' => $params['order_type'], + 'code' => $params['code'], + 'admin_id' => $params['admin_id'], + 'batch' => $params['batch'], + 'mark' => $params['mark'], + 'nums' => $params['nums'], + 'purchase' => $params['purchase'], + 'total_price' => $params['total_price'], + 'completed_amount' => $params['completed_amount'], + 'outstanding_amount' => $params['outstanding_amount'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + WarehouseOrder::where('id', $params['id'])->update([ + 'warehouse_id' => $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'oid' => $params['oid'], + 'order_type' => $params['order_type'], + 'code' => $params['code'], + 'admin_id' => $params['admin_id'], + 'batch' => $params['batch'], + 'mark' => $params['mark'], + 'nums' => $params['nums'], + 'purchase' => $params['purchase'], + 'total_price' => $params['total_price'], + 'completed_amount' => $params['completed_amount'], + 'outstanding_amount' => $params['outstanding_amount'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function delete(array $params): bool + { + return WarehouseOrder::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author admin + * @date 2025/03/10 11:08 + */ + public static function detail($params): array + { + return WarehouseOrder::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/psi/logic/WarehouseProductLogic.php b/app/psi/logic/WarehouseProductLogic.php new file mode 100644 index 0000000..4a95b2a --- /dev/null +++ b/app/psi/logic/WarehouseProductLogic.php @@ -0,0 +1,145 @@ + $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'order_type' => $params['order_type'], + 'product_id' => $params['product_id'], + 'unit' => $params['unit'], + 'oid' => $params['oid'], + 'code' => $params['code'], + 'manufacture' => $params['manufacture'], + 'expiration_date' => $params['expiration_date'], + 'admin_id' => $params['admin_id'], + 'enter_admin_id' => $params['enter_admin_id'], + 'staff_id' => $params['staff_id'], + 'batch' => $params['batch'], + 'nums' => $params['nums'], + 'refund_nums' => $params['refund_nums'], + 'before_nums' => $params['before_nums'], + 'after_nums' => $params['after_nums'], + 'mark' => $params['mark'], + 'price' => $params['price'], + 'total_price' => $params['total_price'], + 'purchase' => $params['purchase'], + 'cost' => $params['cost'], + 'vip_price' => $params['vip_price'], + 'is_pay' => $params['is_pay'], + 'pay_type' => $params['pay_type'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 编辑 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + WarehouseProduct::where('id', $params['id'])->update([ + 'warehouse_id' => $params['warehouse_id'], + 'supplier_id' => $params['supplier_id'], + 'store_id' => $params['store_id'], + 'order_type' => $params['order_type'], + 'product_id' => $params['product_id'], + 'unit' => $params['unit'], + 'oid' => $params['oid'], + 'code' => $params['code'], + 'manufacture' => $params['manufacture'], + 'expiration_date' => $params['expiration_date'], + 'admin_id' => $params['admin_id'], + 'enter_admin_id' => $params['enter_admin_id'], + 'staff_id' => $params['staff_id'], + 'batch' => $params['batch'], + 'nums' => $params['nums'], + 'refund_nums' => $params['refund_nums'], + 'before_nums' => $params['before_nums'], + 'after_nums' => $params['after_nums'], + 'mark' => $params['mark'], + 'price' => $params['price'], + 'total_price' => $params['total_price'], + 'purchase' => $params['purchase'], + 'cost' => $params['cost'], + 'vip_price' => $params['vip_price'], + 'is_pay' => $params['is_pay'], + 'pay_type' => $params['pay_type'], + 'status' => $params['status'], + ]); + + Db::commit(); + return true; + } catch (\Throwable $e) { + Db::rollback(); + throw new Exception($e->getMessage()); + } + } + + + /** + * @notes 删除 + * @param array $params + * @return bool + * @author admin + * @date 2025/03/10 11:08 + */ + public static function delete(array $params): bool + { + return WarehouseProduct::destroy($params['id']); + } + + + /** + * @notes 获取详情 + * @param $params + * @return array + * @author admin + * @date 2025/03/10 11:08 + */ + public static function detail($params): array + { + return WarehouseProduct::findOrEmpty($params['id'])->toArray(); + } +} \ No newline at end of file diff --git a/app/psi/logic/purchase_product/PurchaseProductLogic.php b/app/psi/logic/purchase_product/PurchaseProductLogic.php index 7f76b31..3992f29 100644 --- a/app/psi/logic/purchase_product/PurchaseProductLogic.php +++ b/app/psi/logic/purchase_product/PurchaseProductLogic.php @@ -6,7 +6,7 @@ use app\common\model\warehouse_product\WarehouseProduct; use app\common\logic\BaseLogic; use app\common\model\psi\purchase_order\PurchaseOrder; use app\common\model\psi\purchase_product\PurchaseProduct; -use app\common\model\psi\warehouse_storege\WarehouseStorege; +use app\common\model\psi\warehouse_storage\WarehouseStorage; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_product\StoreProduct; use app\common\model\system_store_storage\SystemStoreStorage; @@ -39,7 +39,7 @@ class PurchaseProductLogic extends BaseLogic try { $after_nums = 0; if (!in_array($params['order_type'], [6, 9])) { - $storege = WarehouseStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find(); + $storege = WarehouseStorage::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find(); if ($storege) { $after_nums = $storege['nums'] + $params['nums']; if ($type == 1) { @@ -52,7 +52,7 @@ class PurchaseProductLogic extends BaseLogic } else { $total_price = bcmul($after_nums, $storeProduct['purchase'], 2); } - WarehouseStorege::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]); + WarehouseStorage::update(['nums' => $after_nums, 'total_price' => $total_price], ['id' => $storege['id']]); // SqlChannelLog('WarehouseProductStorege', $storege['id'], $after_nums, 1, Request()->url(),$admin_id); } @@ -76,7 +76,7 @@ class PurchaseProductLogic extends BaseLogic if ($params['financial_pm'] == 0) { $data['nums'] = -$params['nums']; } - $storege = WarehouseStorege::create($data); + $storege = WarehouseStorage::create($data); // SqlChannelLog('WarehouseProductStorege', $storege['id'], -$params['nums'], 1, Request()->url(),$admin_id); } @@ -126,7 +126,7 @@ class PurchaseProductLogic extends BaseLogic if ($find) { $res = PurchaseProduct::where('id', $params['id'])->find(); if ($res['is_warehouse'] == 1) { - WarehouseStorege::where('warehouse_id', $res['warehouse_id'])->where('product_id', $res['product_id'])->update([ + WarehouseStorage::where('warehouse_id', $res['warehouse_id'])->where('product_id', $res['product_id'])->update([ 'nums' => bcsub($res['nums'], $params['nums'], 2) ]); } @@ -340,7 +340,7 @@ class PurchaseProductLogic extends BaseLogic if ($find) { $data = ['is_warehouse' => 1, 'nums' => $params['nums'], 'price' => bcdiv($find['total_price'], $params['nums'], 2)]; PurchaseProduct::where('id', $params['id'])->update($data); - $res = WarehouseStorege::where('warehouse_id', $find['warehouse_id'])->where('product_id', $find['product_id'])->find(); + $res = WarehouseStorage::where('warehouse_id', $find['warehouse_id'])->where('product_id', $find['product_id'])->find(); $total_price=PurchaseProduct::where('oid',$find['oid'])->sum('total_price'); PurchaseOrder::where('id',$find['oid'])->update(['total_price'=>$total_price]); if ($res) { @@ -353,7 +353,7 @@ class PurchaseProductLogic extends BaseLogic 'nums' => $params['nums'], 'price' => bcdiv($find['total_price'], $params['nums'], 2) ]; - WarehouseStorege::create($data); + WarehouseStorage::create($data); } } Db::commit(); diff --git a/app/psi/logic/warehouse_storege/WarehouseStoregeLogic.php b/app/psi/logic/warehouse_storage/WarehouseStorageLogic.php similarity index 80% rename from app/psi/logic/warehouse_storege/WarehouseStoregeLogic.php rename to app/psi/logic/warehouse_storage/WarehouseStorageLogic.php index 3b14c8b..31ec16a 100644 --- a/app/psi/logic/warehouse_storege/WarehouseStoregeLogic.php +++ b/app/psi/logic/warehouse_storage/WarehouseStorageLogic.php @@ -1,20 +1,20 @@ $params['warehouse_id'], 'product_id' => $params['product_id'], 'nums' => $params['nums'], @@ -60,7 +60,7 @@ class WarehouseStoregeLogic extends BaseLogic } Db::startTrans(); try { - $find=WarehouseStorege::where('id',$params['id'])->find(); + $find=WarehouseStorage::where('id',$params['id'])->find(); if($find){ $find->save(['nums'=>$params['nums']]); // SqlChannelLog('WarehouseProductStorege', $params['id'], $params['nums'], 0,Request()->url(),$admin_id, $params['remark']); @@ -85,7 +85,7 @@ class WarehouseStoregeLogic extends BaseLogic */ public static function delete(array $params): bool { - return WarehouseStorege::destroy($params['id']); + return WarehouseStorage::destroy($params['id']); } @@ -98,6 +98,6 @@ class WarehouseStoregeLogic extends BaseLogic */ public static function detail($params): array { - return WarehouseStorege::findOrEmpty($params['id'])->toArray(); + return WarehouseStorage::findOrEmpty($params['id'])->toArray(); } } \ No newline at end of file diff --git a/app/psi/validate/OutboundOrderValidate.php b/app/psi/validate/OutboundOrderValidate.php new file mode 100644 index 0000000..bbff5ec --- /dev/null +++ b/app/psi/validate/OutboundOrderValidate.php @@ -0,0 +1,84 @@ + 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + + ]; + + + /** + * @notes 添加场景 + * @return OutboundOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneAdd() + { + return $this->remove('id', true); + } + + + /** + * @notes 编辑场景 + * @return OutboundOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneEdit() + { + return $this->only(['id']); + } + + + /** + * @notes 删除场景 + * @return OutboundOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return OutboundOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/psi/validate/OutboundProductValidate.php b/app/psi/validate/OutboundProductValidate.php new file mode 100644 index 0000000..90db07b --- /dev/null +++ b/app/psi/validate/OutboundProductValidate.php @@ -0,0 +1,96 @@ + 'require', + 'product_id' => 'require', + 'batch' => 'require', + 'nums' => 'require', + 'price' => 'require', + 'total_price' => 'require', + 'status' => 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'product_id' => '商品', + 'batch' => '批次', + 'nums' => '数量', + 'price' => '零售价格', + 'total_price' => '总价格', + 'status' => '状态', + + ]; + + + /** + * @notes 添加场景 + * @return OutboundProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneAdd() + { + return $this->only(['product_id','batch','nums','price','total_price','status']); + } + + + /** + * @notes 编辑场景 + * @return OutboundProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneEdit() + { + return $this->only(['id','product_id','batch','nums','price','total_price','status']); + } + + + /** + * @notes 删除场景 + * @return OutboundProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return OutboundProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/psi/validate/WarehouseOrderValidate.php b/app/psi/validate/WarehouseOrderValidate.php new file mode 100644 index 0000000..6e0a6dd --- /dev/null +++ b/app/psi/validate/WarehouseOrderValidate.php @@ -0,0 +1,90 @@ + 'require', + 'batch' => 'require', + 'total_price' => 'require', + 'status' => 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'batch' => '批次', + 'total_price' => '总价格', + 'status' => '状态', + + ]; + + + /** + * @notes 添加场景 + * @return WarehouseOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneAdd() + { + return $this->only(['batch','total_price','status']); + } + + + /** + * @notes 编辑场景 + * @return WarehouseOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneEdit() + { + return $this->only(['id','batch','total_price','status']); + } + + + /** + * @notes 删除场景 + * @return WarehouseOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return WarehouseOrderValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file diff --git a/app/psi/validate/WarehouseProductValidate.php b/app/psi/validate/WarehouseProductValidate.php new file mode 100644 index 0000000..7009fdf --- /dev/null +++ b/app/psi/validate/WarehouseProductValidate.php @@ -0,0 +1,96 @@ + 'require', + 'product_id' => 'require', + 'batch' => 'require', + 'nums' => 'require', + 'price' => 'require', + 'total_price' => 'require', + 'status' => 'require', + + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'product_id' => '商品', + 'batch' => '批次', + 'nums' => '数量', + 'price' => '零售价格', + 'total_price' => '总价格', + 'status' => '状态', + + ]; + + + /** + * @notes 添加场景 + * @return WarehouseProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneAdd() + { + return $this->only(['product_id','batch','nums','price','total_price','status']); + } + + + /** + * @notes 编辑场景 + * @return WarehouseProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneEdit() + { + return $this->only(['id','product_id','batch','nums','price','total_price','status']); + } + + + /** + * @notes 删除场景 + * @return WarehouseProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return WarehouseProductValidate + * @author admin + * @date 2025/03/10 11:08 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file