添加出库单、入库单
This commit is contained in:
parent
95d8016567
commit
6a4f087bc0
@ -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 {
|
||||
|
22
app/common/model/OutboundOrder.php
Normal file
22
app/common/model/OutboundOrder.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundOrder模型
|
||||
* Class OutboundOrder
|
||||
* @package app\common\model
|
||||
*/
|
||||
class OutboundOrder extends BaseModel
|
||||
{
|
||||
|
||||
protected $name = 'psi_outbound_order';
|
||||
|
||||
|
||||
|
||||
}
|
22
app/common/model/OutboundProduct.php
Normal file
22
app/common/model/OutboundProduct.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundProduct模型
|
||||
* Class OutboundProduct
|
||||
* @package app\common\model
|
||||
*/
|
||||
class OutboundProduct extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'psi_outbound_product';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
22
app/common/model/WarehouseOrder.php
Normal file
22
app/common/model/WarehouseOrder.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseOrder模型
|
||||
* Class WarehouseOrder
|
||||
* @package app\common\model
|
||||
*/
|
||||
class WarehouseOrder extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'psi_warehouse_order';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
22
app/common/model/WarehouseProduct.php
Normal file
22
app/common/model/WarehouseProduct.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseProduct模型
|
||||
* Class WarehouseProduct
|
||||
* @package app\common\model
|
||||
*/
|
||||
class WarehouseProduct extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'psi_warehouse_product';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\psi\warehouse_storege;
|
||||
namespace app\common\model\psi\warehouse_storage;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
@ -8,13 +8,13 @@ use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* 仓库存储
|
||||
* Class WarehouseStorege
|
||||
* @package app\common\model\psi\warehouse_storege
|
||||
* Class WarehouseStorage
|
||||
* @package app\common\model\psi\warehouse_storage
|
||||
*/
|
||||
class WarehouseStorege extends BaseModel
|
||||
class WarehouseStorage extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'psi_warehouse_storege';
|
||||
protected $name = 'psi_warehouse_storage';
|
||||
protected $deleteTime = 'delete_time';
|
||||
public $ignoreLogFields = [
|
||||
'price',
|
95
app/psi/controller/OutboundOrderController.php
Normal file
95
app/psi/controller/OutboundOrderController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\controller;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\psi\lists\OutboundOrderLists;
|
||||
use app\psi\logic\OutboundOrderLogic;
|
||||
use app\psi\validate\OutboundOrderValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundOrder控制器
|
||||
* Class OutboundOrderController
|
||||
* @package app\psi\controller
|
||||
*/
|
||||
class OutboundOrderController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->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);
|
||||
}
|
||||
|
||||
|
||||
}
|
95
app/psi/controller/OutboundProductController.php
Normal file
95
app/psi/controller/OutboundProductController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\controller;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\psi\lists\OutboundProductLists;
|
||||
use app\psi\logic\OutboundProductLogic;
|
||||
use app\psi\validate\OutboundProductValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundProduct控制器
|
||||
* Class OutboundProductController
|
||||
* @package app\psi\controller
|
||||
*/
|
||||
class OutboundProductController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->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);
|
||||
}
|
||||
|
||||
|
||||
}
|
95
app/psi/controller/WarehouseOrderController.php
Normal file
95
app/psi/controller/WarehouseOrderController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\controller;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\psi\lists\WarehouseOrderLists;
|
||||
use app\psi\logic\WarehouseOrderLogic;
|
||||
use app\psi\validate\WarehouseOrderValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseOrder控制器
|
||||
* Class WarehouseOrderController
|
||||
* @package app\psi\controller
|
||||
*/
|
||||
class WarehouseOrderController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->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);
|
||||
}
|
||||
|
||||
|
||||
}
|
95
app/psi/controller/WarehouseProductController.php
Normal file
95
app/psi/controller/WarehouseProductController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\controller;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\psi\lists\WarehouseProductLists;
|
||||
use app\psi\logic\WarehouseProductLogic;
|
||||
use app\psi\validate\WarehouseProductValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseProduct控制器
|
||||
* Class WarehouseProductController
|
||||
* @package app\psi\controller
|
||||
*/
|
||||
class WarehouseProductController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\controller\warehouse_storage;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\common\model\psi\warehouse_storage\WarehouseStorage;
|
||||
use app\psi\lists\warehouse_storage\WarehouseStorageLists;
|
||||
use app\psi\logic\warehouse_storage\WarehouseStorageLogic;
|
||||
|
||||
/**
|
||||
* PsiWarehouseStorage控制器
|
||||
* Class WarehouseStorageController
|
||||
* @package app\psi\controller\warehouse_storage
|
||||
*/
|
||||
class WarehouseStorageController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2025/03/03 11:07
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->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);
|
||||
}
|
||||
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\controller\warehouse_storege;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\common\model\psi\warehouse_storege\WarehouseStorege;
|
||||
use app\psi\lists\warehouse_storege\WarehouseStoregeLists;
|
||||
use app\psi\logic\warehouse_storege\WarehouseStoregeLogic;
|
||||
|
||||
/**
|
||||
* PsiWarehouseStorege控制器
|
||||
* Class WarehouseStoregeController
|
||||
* @package app\psi\controller\warehouse_storege
|
||||
*/
|
||||
class WarehouseStoregeController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2025/03/03 11:07
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->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);
|
||||
}
|
||||
|
||||
}
|
66
app/psi/lists/OutboundOrderLists.php
Normal file
66
app/psi/lists/OutboundOrderLists.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\lists;
|
||||
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\model\OutboundOrder;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundOrder列表
|
||||
* Class OutboundOrderLists
|
||||
* @package app\psi\lists
|
||||
*/
|
||||
class OutboundOrderLists extends BaseDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['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();
|
||||
}
|
||||
|
||||
}
|
66
app/psi/lists/OutboundProductLists.php
Normal file
66
app/psi/lists/OutboundProductLists.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\lists;
|
||||
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\model\OutboundProduct;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundProduct列表
|
||||
* Class OutboundProductLists
|
||||
* @package app\psi\lists
|
||||
*/
|
||||
class OutboundProductLists extends BaseDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['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();
|
||||
}
|
||||
|
||||
}
|
66
app/psi/lists/WarehouseOrderLists.php
Normal file
66
app/psi/lists/WarehouseOrderLists.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\lists;
|
||||
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\model\WarehouseOrder;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseOrder列表
|
||||
* Class WarehouseOrderLists
|
||||
* @package app\psi\lists
|
||||
*/
|
||||
class WarehouseOrderLists extends BaseDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['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();
|
||||
}
|
||||
|
||||
}
|
66
app/psi/lists/WarehouseProductLists.php
Normal file
66
app/psi/lists/WarehouseProductLists.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\lists;
|
||||
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\model\WarehouseProduct;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseProduct列表
|
||||
* Class WarehouseProductLists
|
||||
* @package app\psi\lists
|
||||
*/
|
||||
class WarehouseProductLists extends BaseDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['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();
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\lists\warehouse_storege;
|
||||
namespace app\psi\lists\warehouse_storage;
|
||||
|
||||
|
||||
use app\common\lists\BaseDataLists;
|
||||
use app\common\model\psi\warehouse_storege\WarehouseStorege;
|
||||
use app\common\model\psi\warehouse_storage\WarehouseStorage;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseStorege列表
|
||||
* Class WarehouseStoregeLists
|
||||
* @package app\psi\listswarehouse_storege
|
||||
* PsiWarehouseStorage列表
|
||||
* Class WarehouseStorageLists
|
||||
* @package app\psi\listswarehouse_storage
|
||||
*/
|
||||
class WarehouseStoregeLists extends BaseDataLists implements ListsSearchInterface
|
||||
class WarehouseStorageLists extends BaseDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class WarehouseStoregeLists extends BaseDataLists implements ListsSearchInterfac
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return WarehouseStorege::where($this->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();
|
||||
}
|
||||
|
||||
}
|
123
app/psi/logic/OutboundOrderLogic.php
Normal file
123
app/psi/logic/OutboundOrderLogic.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\logic;
|
||||
|
||||
|
||||
use app\common\model\OutboundOrder;
|
||||
use app\common\logic\BaseLogic;
|
||||
use Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundOrder逻辑
|
||||
* Class OutboundOrderLogic
|
||||
* @package app\psi\logic
|
||||
*/
|
||||
class OutboundOrderLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OutboundOrder::create([
|
||||
'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 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();
|
||||
}
|
||||
}
|
145
app/psi/logic/OutboundProductLogic.php
Normal file
145
app/psi/logic/OutboundProductLogic.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\logic;
|
||||
|
||||
|
||||
use app\common\model\OutboundProduct;
|
||||
use app\common\logic\BaseLogic;
|
||||
use Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundProduct逻辑
|
||||
* Class OutboundProductLogic
|
||||
* @package app\psi\logic
|
||||
*/
|
||||
class OutboundProductLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
OutboundProduct::create([
|
||||
'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 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();
|
||||
}
|
||||
}
|
121
app/psi/logic/WarehouseOrderLogic.php
Normal file
121
app/psi/logic/WarehouseOrderLogic.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\logic;
|
||||
|
||||
|
||||
use app\common\model\WarehouseOrder;
|
||||
use app\common\logic\BaseLogic;
|
||||
use Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseOrder逻辑
|
||||
* Class WarehouseOrderLogic
|
||||
* @package app\psi\logic
|
||||
*/
|
||||
class WarehouseOrderLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WarehouseOrder::create([
|
||||
'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 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();
|
||||
}
|
||||
}
|
145
app/psi/logic/WarehouseProductLogic.php
Normal file
145
app/psi/logic/WarehouseProductLogic.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\logic;
|
||||
|
||||
|
||||
use app\common\model\WarehouseProduct;
|
||||
use app\common\logic\BaseLogic;
|
||||
use Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseProduct逻辑
|
||||
* Class WarehouseProductLogic
|
||||
* @package app\psi\logic
|
||||
*/
|
||||
class WarehouseProductLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author admin
|
||||
* @date 2025/03/10 11:08
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WarehouseProduct::create([
|
||||
'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 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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\logic\warehouse_storege;
|
||||
namespace app\psi\logic\warehouse_storage;
|
||||
|
||||
|
||||
use app\common\model\psi\warehouse_storege\WarehouseStorege;
|
||||
use app\common\model\psi\warehouse_storage\WarehouseStorage;
|
||||
use app\common\logic\BaseLogic;
|
||||
use Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseStorege逻辑
|
||||
* Class WarehouseStoregeLogic
|
||||
* @package app\psi\logic\warehouse_storege
|
||||
* PsiWarehouseStorage逻辑
|
||||
* Class WarehouseStorageLogic
|
||||
* @package app\psi\logic\warehouse_storage
|
||||
*/
|
||||
class WarehouseStoregeLogic extends BaseLogic
|
||||
class WarehouseStorageLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ class WarehouseStoregeLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
WarehouseStorege::create([
|
||||
WarehouseStorage::create([
|
||||
'warehouse_id' => $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();
|
||||
}
|
||||
}
|
84
app/psi/validate/OutboundOrderValidate.php
Normal file
84
app/psi/validate/OutboundOrderValidate.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundOrder验证器
|
||||
* Class OutboundOrderValidate
|
||||
* @package app\psi\validate
|
||||
*/
|
||||
class OutboundOrderValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => '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']);
|
||||
}
|
||||
|
||||
}
|
96
app/psi/validate/OutboundProductValidate.php
Normal file
96
app/psi/validate/OutboundProductValidate.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiOutboundProduct验证器
|
||||
* Class OutboundProductValidate
|
||||
* @package app\psi\validate
|
||||
*/
|
||||
class OutboundProductValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => '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']);
|
||||
}
|
||||
|
||||
}
|
90
app/psi/validate/WarehouseOrderValidate.php
Normal file
90
app/psi/validate/WarehouseOrderValidate.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseOrder验证器
|
||||
* Class WarehouseOrderValidate
|
||||
* @package app\psi\validate
|
||||
*/
|
||||
class WarehouseOrderValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => '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']);
|
||||
}
|
||||
|
||||
}
|
96
app/psi/validate/WarehouseProductValidate.php
Normal file
96
app/psi/validate/WarehouseProductValidate.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace app\psi\validate;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* PsiWarehouseProduct验证器
|
||||
* Class WarehouseProductValidate
|
||||
* @package app\psi\validate
|
||||
*/
|
||||
class WarehouseProductValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => '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']);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user