|
@@ -48,15 +48,18 @@ class DispatchService extends Service
|
|
|
list($status,$msg) = $this->orderRule($data);
|
|
|
if(!$status) return [$status,$msg];
|
|
|
|
|
|
+ $dispatch_no = $this->setOrderNO();
|
|
|
+ if(empty($dispatch_no)) return [false,'单据号生成失败!'];
|
|
|
+
|
|
|
try{
|
|
|
DB::beginTransaction();
|
|
|
|
|
|
if($data['is_split']){
|
|
|
foreach ($msg as $value){
|
|
|
- $this->insertDispatch([$value],$data,$user);
|
|
|
+ $this->insertDispatch([$value],$data,$user,$dispatch_no);
|
|
|
}
|
|
|
}else{
|
|
|
- $this->insertDispatch($msg,$data,$user);
|
|
|
+ $this->insertDispatch($msg,$data,$user,$dispatch_no);
|
|
|
}
|
|
|
|
|
|
//反写已派工数量
|
|
@@ -145,12 +148,11 @@ class DispatchService extends Service
|
|
|
return $arr;
|
|
|
}
|
|
|
|
|
|
- public function insertDispatch($msg, $data, $user){
|
|
|
+ public function insertDispatch($msg, $data, $user,$dispatch_no){
|
|
|
//生产数据的源数据
|
|
|
$result = $msg;
|
|
|
$time = time();
|
|
|
|
|
|
- $dispatch_no = $this->setOrderNO();
|
|
|
//主表
|
|
|
Dispatch::insert(['dispatch_no' => $dispatch_no,'crt_time' => $time]);
|
|
|
|