|
@@ -213,14 +213,11 @@ class ProductionOrderService extends Service
|
|
|
public function orderRule(&$data){
|
|
|
if($this->isEmpty($data,'process_id')) return [false, '工序不能为空!'];
|
|
|
//工序
|
|
|
- $process = Process::whereIn('id', $data['process_id'])->get()->toArray();
|
|
|
+ $process = Process::whereIn('id', $data['process_id'])->where("del_time",0)->pluck("title","id")->toArray();
|
|
|
if(empty($process)) return [false,'工序不存在或已被删除!'];
|
|
|
- $process_id = [];
|
|
|
- foreach ($process as $value){
|
|
|
- if($value['del_time'] > 0) return [false, '工序:' . $value['title'] . '不存在或已被删除!'];
|
|
|
- $process_id[] = $value['id'];
|
|
|
+ foreach ($data['process_id'] as $value){
|
|
|
+ if(! isset($process[$value])) return [false, "工序不存在或已被删除"];
|
|
|
}
|
|
|
- $data['process_id'] = $process_id;
|
|
|
if($this->isEmpty($data,'id')) return [false,'请选择数据!'];
|
|
|
if($this->isEmpty($data,'quantity')) return [false,'数量不能为空!'];
|
|
|
$quantities = array_map('floatval', $data['quantity']);
|