|
@@ -275,6 +275,10 @@ class DispatchService extends Service
|
|
|
if(empty($data['detail'])) return [false, '派工明细数据不能为空!'];
|
|
|
$id = [];
|
|
|
$detail_map = $detail_2 = [];
|
|
|
+
|
|
|
+ $device_map = Equipment::where('del_time',0)
|
|
|
+ ->pluck('title','id')
|
|
|
+ ->toArray();
|
|
|
foreach ($data['detail'] as $value){
|
|
|
if(empty($value['id'])) return [false,'请选择派工数据!'];
|
|
|
if(empty($value['process_id'])) return [false,'工序不能为空!'];
|
|
@@ -292,6 +296,7 @@ class DispatchService extends Service
|
|
|
}else{
|
|
|
$detail_2[$value['id']][$value['process_id']] = $value['quantity'];
|
|
|
}
|
|
|
+ if(! empty($value['device_id']) && ! isset($device_map[$value['device_id']])) return [false, '设备不存在或已被删除'];
|
|
|
}
|
|
|
|
|
|
$result = OrdersProduct::whereIn('id',$id)
|
|
@@ -614,8 +619,8 @@ class DispatchService extends Service
|
|
|
}
|
|
|
|
|
|
$return['product_num'] = count($data);
|
|
|
- $return['finished_num'] = array_sum(array_column($data, 'finished_num'));
|
|
|
- $return['un_finished_quantity'] = array_sum(array_column($data, 'un_finished_quantity'));
|
|
|
+ $return['finished_num'] = $this->getTotal($data,'finished_num');
|
|
|
+ $return['un_finished_quantity'] = $this->getTotal($data,'un_finished_quantity');
|
|
|
$return['data'] = $data;
|
|
|
unset($data);
|
|
|
|