修改出库单商品详情
This commit is contained in:
parent
60ae388d9f
commit
a9ae0ede08
@ -255,6 +255,7 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
$datas['expiration_date'] = strtotime($params['expiration_date']);
|
$datas['expiration_date'] = strtotime($params['expiration_date']);
|
||||||
}
|
}
|
||||||
$res->save($datas);
|
$res->save($datas);
|
||||||
|
self::updateWarehouseOrder($res['oid']);
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
return $res;
|
return $res;
|
||||||
@ -281,6 +282,7 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
$productNum = -$res['nums'];
|
$productNum = -$res['nums'];
|
||||||
self::updateWarehouseProduct($res, $storageNum, $productNum);
|
self::updateWarehouseProduct($res, $storageNum, $productNum);
|
||||||
$res->delete();
|
$res->delete();
|
||||||
|
self::updateWarehouseOrder($res['oid']);
|
||||||
$types = $res['financial_pm'] == 1 ? ProductSourceLinkInfo::TypeIn : ProductSourceLinkInfo::TypeOut;
|
$types = $res['financial_pm'] == 1 ? ProductSourceLinkInfo::TypeIn : ProductSourceLinkInfo::TypeOut;
|
||||||
ProductSourceLinkInfoLogic::deleteByLinkId($res['id'], $types);
|
ProductSourceLinkInfoLogic::deleteByLinkId($res['id'], $types);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
@ -347,6 +349,7 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
$warehouseProduct->save($datas);
|
$warehouseProduct->save($datas);
|
||||||
|
self::updateWarehouseOrder($warehouseProduct['oid']);
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
@ -478,14 +481,26 @@ class WarehouseProductLogic extends BaseLogic
|
|||||||
WarehouseProduct::where('id',$warehouseProduct['id'])->update($update);
|
WarehouseProduct::where('id',$warehouseProduct['id'])->update($update);
|
||||||
SqlChannelLog('WarehouseProduct', $warehouseProduct['id'], $productNum, $productNum > 0 ? 1 : -1, Request()->url());
|
SqlChannelLog('WarehouseProduct', $warehouseProduct['id'], $productNum, $productNum > 0 ? 1 : -1, Request()->url());
|
||||||
|
|
||||||
$find = WarehouseProduct::where('oid', $warehouseProduct['oid'])->field('sum(nums) as nums,sum(total_price) as total_price')->find();
|
self::updateStoreStorage2($warehouseProduct, $productNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新订单数量和总价
|
||||||
|
* @param $oid
|
||||||
|
* @return void
|
||||||
|
* @throws DataNotFoundException
|
||||||
|
* @throws DbException
|
||||||
|
* @throws ModelNotFoundException
|
||||||
|
*/
|
||||||
|
public static function updateWarehouseOrder($oid)
|
||||||
|
{
|
||||||
|
$find = WarehouseProduct::where('oid', $oid)->field('sum(nums) as nums,sum(total_price) as total_price')->find();
|
||||||
if ($find) {
|
if ($find) {
|
||||||
WarehouseOrder::where('id', $warehouseProduct['oid'])->update([
|
WarehouseOrder::where('id', $oid)->update([
|
||||||
'nums' => $find['nums'],
|
'nums' => $find['nums'],
|
||||||
'total_price' => $find['total_price']
|
'total_price' => $find['total_price']
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
self::updateStoreStorage2($warehouseProduct, $productNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user