修改预订单商品退库
This commit is contained in:
parent
c19efa176a
commit
3d47bb1b5d
@ -224,7 +224,7 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
$res = WarehouseProduct::where('id', $params['id'])->withTrashed()->find();
|
$res = WarehouseProduct::where('id', $params['id'])->withTrashed()->find();
|
||||||
$updateNums = bcsub($params['nums'], $res['nums'],2);
|
$updateNums = bcsub($params['nums'], $res['nums'],2);
|
||||||
if ($updateNums != 0) {
|
if ($updateNums != 0) {
|
||||||
if ($res['status'] == 1) {
|
if ($res['status'] == 1 && $res['store_id'] > 0) {
|
||||||
throw new BusinessException('门店已确认入库,不能修改数量');
|
throw new BusinessException('门店已确认入库,不能修改数量');
|
||||||
}
|
}
|
||||||
$storageNum = $res['financial_pm'] == 0 ? -$updateNums : $updateNums;
|
$storageNum = $res['financial_pm'] == 0 ? -$updateNums : $updateNums;
|
||||||
|
@ -113,13 +113,8 @@ class WarehouseProductReturnLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
$find->save(['nums' => $nums, 'total_price' => $total_price]);
|
$find->save(['nums' => $nums, 'total_price' => $total_price]);
|
||||||
$total_price = WarehouseProduct::where('oid', $find['oid'])->sum('total_price');
|
$total_price = WarehouseProduct::where('oid', $find['oid'])->sum('total_price');
|
||||||
if ($nums > 0) {
|
|
||||||
WarehouseOrder::where(['id' => $find['oid']])->update(['total_price' => $total_price]);
|
WarehouseOrder::where(['id' => $find['oid']])->update(['total_price' => $total_price]);
|
||||||
BeforehandOrder::update(['pay_price' => $total_price], ['id' => $params['bhoid']]);
|
BeforehandOrder::update(['pay_price' => $total_price, 'total_price' => $total_price], ['id' => $params['bhoid']]);
|
||||||
} elseif ($nums == 0) {
|
|
||||||
WarehouseOrder::where(['id' => $find['oid']])->update(['total_price' => $total_price]);
|
|
||||||
BeforehandOrder::update(['pay_price' => $total_price], ['id' => $params['bhoid']]);
|
|
||||||
}
|
|
||||||
$res=WarehouseProductStorege::where(['product_id' => $find['product_id'], 'warehouse_id' => $find['warehouse_id']])->find();
|
$res=WarehouseProductStorege::where(['product_id' => $find['product_id'], 'warehouse_id' => $find['warehouse_id']])->find();
|
||||||
$res->save(['nums' =>bcadd( $res['nums'],$params['nums'],2)]);
|
$res->save(['nums' =>bcadd( $res['nums'],$params['nums'],2)]);
|
||||||
SqlChannelLog('WarehouseProductStorege', $res['id'], $params['nums'], 1, Request()->url(),$params['admin_id']);
|
SqlChannelLog('WarehouseProductStorege', $res['id'], $params['nums'], 1, Request()->url(),$params['admin_id']);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user