|
|
@@ -62,6 +62,15 @@ class SortingController extends Controller
|
|
|
$token = trim($request->input('token'));
|
|
|
$station_id = $request->input('station_id');
|
|
|
$batch_id = $request->input('batch_id');
|
|
|
+
|
|
|
+ $childIndex = null;
|
|
|
+ $arr = explode('-',$batch_id);
|
|
|
+ if (count($arr)==2){
|
|
|
+ $batch_id = $arr[0];
|
|
|
+ $childIndex = (int)$arr[1];
|
|
|
+ $request->offsetSet("batch_id",$batch_id);
|
|
|
+ }
|
|
|
+
|
|
|
$errors=$this->processValidator($request->all())->errors();
|
|
|
if(count($errors)>0){
|
|
|
app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, json_encode($request->all()).'|'.json_encode($errors));
|
|
|
@@ -70,12 +79,6 @@ class SortingController extends Controller
|
|
|
// if(!UserToken::getUser($token)){
|
|
|
// return ['result'=>'unauthority','fail_info'=>'无效令牌或令牌过期'];
|
|
|
// }
|
|
|
- $childIndex = null;
|
|
|
- $arr = explode('-',$batch_id);
|
|
|
- if (count($arr)==2){
|
|
|
- $batch_id = $arr[0];
|
|
|
- $childIndex = (int)$arr[1];
|
|
|
- }
|
|
|
|
|
|
// 同步orderCommodity
|
|
|
$this->syncOrder($batch_id);
|
|
|
@@ -105,21 +108,21 @@ SQL;
|
|
|
$ordersSorted=$orders->sortBy(function(Order $order){
|
|
|
return $order->bin()->first()['number'];
|
|
|
});
|
|
|
- $ordersSorted->each(function(Order $order)use(&$data,$request){
|
|
|
+ $ordersSorted->each(function(Order $order)use(&$data,$request,$childIndex,$batch){
|
|
|
if($order['status']=='取消')return;
|
|
|
$orderData=[
|
|
|
'order_id'=>$order['code'],
|
|
|
'owner'=>$order->owner()->first()['code'],
|
|
|
'status'=>$order['status']=='未处理'?'available':$order['status'],
|
|
|
'created_at'=>$order['created_at']->toDateTimeString(),
|
|
|
- 'bin'=>(function()use($order){
|
|
|
+ 'bin'=>(function()use($order,$childIndex,$batch){
|
|
|
$bin=$order->bin()->first()['number']??'';
|
|
|
if(!$bin){
|
|
|
$bin=OracleDOCWaveDetails::query()->where('orderno', 'SO201230003574')->get('seqno')->first()['seqno']??'';
|
|
|
LogService::log(__METHOD__,__FUNCTION__,'bin缺失补查:'.$bin.'. order:'.$order->toJson());
|
|
|
- return $bin;
|
|
|
+ return $childIndex!==null ? $bin-(($childIndex-1)*$batch->split_size) : $bin;
|
|
|
}
|
|
|
- return $bin;
|
|
|
+ return $childIndex!==null ? $bin-(($childIndex-1)*$batch->split_size) : $bin;
|
|
|
})(),
|
|
|
'barcodes'=>[]
|
|
|
];
|