|
@@ -243,7 +243,13 @@ class FyyOrderService extends Service
|
|
|
DB::beginTransaction();
|
|
|
Box::whereIn('order_no',$data['order_no'])->update([
|
|
|
'state' => 2,
|
|
|
+ 'shipment_order_no' => $data['shipment_code'],//发货单号
|
|
|
]);
|
|
|
+ $box = new BoxDetail(['channel'=>$data['top_order_no']]);
|
|
|
+ $box->where('order_no',$data['order_no'])->update([
|
|
|
+ 'shipment_order_no' => $data['shipment_code']//发货单号
|
|
|
+ ]);
|
|
|
+
|
|
|
foreach ($data['box_data'] as $value){
|
|
|
SaleOrdersProduct::where('id',$data['top_id'])->update([
|
|
|
'shipment_num' => DB::raw("shipment_num + {$value['num']}"),
|
|
@@ -259,10 +265,12 @@ class FyyOrderService extends Service
|
|
|
}
|
|
|
|
|
|
public function orderOutRule($data){
|
|
|
- if(empty($data['order_number'])) return [false,'销售订单号不能为空!'];
|
|
|
if(empty($data['order_no'])) return [false,'包装单号不能为空!'];
|
|
|
+ if(empty($data['order_number'])) return [false,'销售订单号不能为空!'];
|
|
|
if(empty($data['post'])) return [false,'发货单数据不能为空!'];
|
|
|
if(empty($data['box_data'])) return [false,'包装单数据不能为空!'];
|
|
|
+ if(empty($data['top_order_no'])) return [false,'顶部订单号不能为空!'];
|
|
|
+ if(empty($data['shipment_code'])) return [false,'发货单订单号不能为空!'];
|
|
|
|
|
|
$boxList = Box::whereIn('order_no',$data['order_no'])->get()->toArray();
|
|
|
if(empty($boxList)) return [false,'包装单不存在!'];
|
|
@@ -288,16 +296,15 @@ class FyyOrderService extends Service
|
|
|
->get()->toArray();
|
|
|
$key_list = [];
|
|
|
foreach ($list as $v){
|
|
|
- $customer_name = $v['customer_name'];
|
|
|
- if(!isset($key_list[$customer_name])) $key_list[$customer_name] = [
|
|
|
+ $customer_name = trim($v['customer_name']);
|
|
|
+ if(! isset($key_list[$customer_name])) $key_list[$customer_name] = [
|
|
|
'customer_name' => $customer_name,
|
|
|
'list' => [],
|
|
|
];
|
|
|
-// unset($v['customer_name']);
|
|
|
$key_list[$customer_name]['list'][] = $v;
|
|
|
- sort($key_list);
|
|
|
- $list = $key_list;
|
|
|
}
|
|
|
+ sort($key_list);
|
|
|
+ $list = $key_list;
|
|
|
}elseif($data['type'] == 2){
|
|
|
$list = SaleOrdersProduct::where('del_time',0)
|
|
|
->select('order_no','out_order_no','customer_name')
|
|
@@ -315,11 +322,10 @@ class FyyOrderService extends Service
|
|
|
'customer_name' => $customer_name,
|
|
|
'list' => [],
|
|
|
];
|
|
|
-// unset($v['customer_name']);
|
|
|
$key_list[$customer_name]['list'][] = $v;
|
|
|
- sort($key_list);
|
|
|
- $list = $key_list;
|
|
|
}
|
|
|
+ sort($key_list);
|
|
|
+ $list = $key_list;
|
|
|
}
|
|
|
|
|
|
return [true, $list];
|
|
@@ -332,7 +338,7 @@ class FyyOrderService extends Service
|
|
|
if($sqlServerModel->error) return [false,$sqlServerModel->error];
|
|
|
|
|
|
$result = $sqlServerModel->getDataFromDispatchList($data);
|
|
|
- $return = [];
|
|
|
+ $return = $shipment_code = [];
|
|
|
if(! empty($result)){
|
|
|
foreach ($result as $value){
|
|
|
$cfree1 = $value['cfree1'] ?? '';
|
|
@@ -351,11 +357,17 @@ class FyyOrderService extends Service
|
|
|
'num' => $n,
|
|
|
];
|
|
|
}
|
|
|
+
|
|
|
+ if(! isset($shipment_code[$value['cdlcode']])){
|
|
|
+ $shipment_code[$value['cdlcode']] = [
|
|
|
+ 'shipment_code' => $value['cdlcode'],
|
|
|
+ 'order_no' => $value['csocode'],
|
|
|
+ 'customer_name' => $value['customer_name']
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $shipment_code = array_values(array_unique(array_column($result,'cdlcode')));
|
|
|
-
|
|
|
- return [true,['shipment_code'=>$shipment_code ,'show'=>array_values($return), 'post'=>$result]];
|
|
|
+ return [true,['shipment_code'=>array_values($shipment_code), 'show'=>array_values($return), 'post'=>$result]];
|
|
|
}
|
|
|
}
|