|
|
@@ -51,7 +51,7 @@ class SpecService{
|
|
|
//结算周期
|
|
|
$settlement_data = SpecService::getDeliverySettlement($customer, $data['ship_date']);
|
|
|
foreach ($data['variety'] as $item) {
|
|
|
- if(count($item) != 5 || empty(floatval($item['num']))) throw new \Exception('参数有误!');
|
|
|
+ if(count($item) != 9 || empty(floatval($item['num']))) throw new \Exception('参数有误!');
|
|
|
$specsWeight = ProductConfig::where('id', $item['spec_id'])->value('weight');
|
|
|
//if(!$specs) throw new \Exception('参数有误!');
|
|
|
$weight = bcmul((string)$specsWeight, $item['num'], 2);
|
|
|
@@ -62,6 +62,8 @@ class SpecService{
|
|
|
'plat_id' => $data['plat_id'],
|
|
|
'variety_id' => $item['variety_id'],
|
|
|
'spec_id' => $item['spec_id'],
|
|
|
+ 'box_id' => $item['box_id'],
|
|
|
+ 'fast_mail' => $item['fast_mail'],
|
|
|
'num' => $item['num'],
|
|
|
'weigh' => $weight,
|
|
|
'price' => $item['price'],
|
|
|
@@ -82,14 +84,13 @@ class SpecService{
|
|
|
'remark' => '录入出库'
|
|
|
];
|
|
|
//根据规格扣除包装箱
|
|
|
- $box_id = CustomerSpec::where('customer_id', $customer->id)->where('type_id', $item['variety_id'])->where('product_id', $item['spec_id'])->value('box_id');
|
|
|
- if($box_id){
|
|
|
- $boxNum = StockDetail::setStockConfigNum($box_id, (string)-$item['num'], StockConfig::PackingBox);
|
|
|
+ if($item['box_id']){
|
|
|
+ $boxNum = StockDetail::setStockConfigNum($item['box_id'], (string)-$item['num'], StockConfig::PackingBox);
|
|
|
$stockData[] = [
|
|
|
'user_id' => $uid,
|
|
|
'type_id' => StockConfig::PackingBox,
|
|
|
'type' => 1,
|
|
|
- 'variety_id' => $box_id,
|
|
|
+ 'variety_id' => $item['box_id'],
|
|
|
'change' => -$item['num'],
|
|
|
'after' => $boxNum,
|
|
|
'remark' => '录入出库'
|
|
|
@@ -120,9 +121,8 @@ class SpecService{
|
|
|
StockDetail::setStockConfigNum($delivery->variety_id, bcsub($delivery->weigh, $weight, 2), StockConfig::VarietyName);
|
|
|
|
|
|
//根据规格扣除包装箱
|
|
|
- $box_id = CustomerSpec::where('customer_id', $delivery->customer_id)->where('type_id', $delivery['variety_id'])->where('product_id', $delivery->spec_id)->value('box_id');
|
|
|
- if($box_id){
|
|
|
- StockDetail::setStockConfigNum($box_id, bcsub((string)$delivery->num, $data['num'], 2), StockConfig::PackingBox);
|
|
|
+ if($delivery->box_id){
|
|
|
+ StockDetail::setStockConfigNum($delivery->box_id, bcsub((string)$delivery->num, $data['num'], 2), StockConfig::PackingBox);
|
|
|
}
|
|
|
//修改数量
|
|
|
$price = bcdiv($delivery->total_price, (string)$delivery->num, 2); //单价
|