2024-08-13 18:00:08 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\admin\logic\inventory_transfer;
|
|
|
|
|
2024-08-18 17:02:40 +08:00
|
|
|
use app\admin\logic\warehouse_product\WarehouseProductLogic;
|
2024-08-13 18:00:08 +08:00
|
|
|
use app\common\model\inventory_transfer\InventoryTransfer;
|
|
|
|
use app\common\logic\BaseLogic;
|
|
|
|
use app\common\model\store_branch_product\StoreBranchProduct;
|
2025-01-11 16:15:52 +08:00
|
|
|
use app\common\model\store_product\StoreProduct;
|
2024-08-13 18:00:08 +08:00
|
|
|
use app\common\model\warehouse_product_storege\WarehouseProductStorege;
|
2024-08-27 20:46:44 +08:00
|
|
|
use support\exception\BusinessException;
|
2024-08-13 18:00:08 +08:00
|
|
|
use think\facade\Db;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商品调拨逻辑
|
|
|
|
* Class InventoryTransferLogic
|
|
|
|
* @package app\admin\logic\inventory_transfer
|
|
|
|
*/
|
|
|
|
class InventoryTransferLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @notes 添加商品调拨
|
|
|
|
* @param array $params
|
|
|
|
* @return bool
|
|
|
|
* @author admin
|
|
|
|
* @date 2024/08/13 16:18
|
|
|
|
*/
|
2025-01-06 12:04:18 +08:00
|
|
|
public static function add(array $params,$admin_id=0): bool
|
2024-08-13 18:00:08 +08:00
|
|
|
{
|
2025-01-24 13:48:28 +08:00
|
|
|
return true;
|
2024-08-13 18:00:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @notes 编辑商品调拨
|
|
|
|
* @param array $params
|
|
|
|
* @return bool
|
|
|
|
* @author admin
|
|
|
|
* @date 2024/08/13 16:18
|
|
|
|
*/
|
|
|
|
public static function edit(array $params): bool
|
|
|
|
{
|
|
|
|
Db::startTrans();
|
|
|
|
try {
|
|
|
|
InventoryTransfer::where('id', $params['id'])->update([
|
|
|
|
'product_id' => $params['product_id'],
|
|
|
|
'nums' => $params['nums'],
|
|
|
|
'before_nums' => $params['before_nums'],
|
|
|
|
'after_nums' => $params['after_nums'],
|
|
|
|
'type' => $params['type'],
|
|
|
|
'one_id' => $params['one_id'],
|
|
|
|
'two_id' => $params['two_id']
|
|
|
|
]);
|
|
|
|
|
|
|
|
Db::commit();
|
|
|
|
return true;
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
Db::rollback();
|
2024-08-27 20:46:44 +08:00
|
|
|
throw new BusinessException($e->getMessage());
|
2024-08-13 18:00:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @notes 删除商品调拨
|
|
|
|
* @param array $params
|
|
|
|
* @return bool
|
|
|
|
* @author admin
|
|
|
|
* @date 2024/08/13 16:18
|
|
|
|
*/
|
|
|
|
public static function delete(array $params): bool
|
|
|
|
{
|
|
|
|
return InventoryTransfer::destroy($params['id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @notes 获取商品调拨详情
|
|
|
|
* @param $params
|
|
|
|
* @return array
|
|
|
|
* @author admin
|
|
|
|
* @date 2024/08/13 16:18
|
|
|
|
*/
|
|
|
|
public static function detail($params): array
|
|
|
|
{
|
|
|
|
return InventoryTransfer::findOrEmpty($params['id'])->toArray();
|
|
|
|
}
|
|
|
|
}
|