|
|
@@ -314,7 +314,8 @@ class ServiceWorkLogic extends BaseLogic
|
|
|
'original_price' => 0,
|
|
|
'spare_number' => $item['spare_number'],
|
|
|
'spare_part_id' => 0,
|
|
|
- 'brand' => $item['brand']
|
|
|
+ 'brand' => $item['brand'],
|
|
|
+ 'status' => 0,
|
|
|
];
|
|
|
if (current($spare_parts_ids)) {
|
|
|
//修改
|
|
|
@@ -433,18 +434,17 @@ class ServiceWorkLogic extends BaseLogic
|
|
|
if($work->isEmpty()){
|
|
|
throw new Exception('工单不存在');
|
|
|
}
|
|
|
- $audit = ServiceWorkSpareAudit::where(['service_work_id'=>$work['id']])->findOrEmpty();
|
|
|
+ $audit = ServiceWorkSpare::where(['id' => $params['id'],'service_work_id'=>$work['id']])->findOrEmpty();
|
|
|
if(!$audit->isEmpty() && ($audit['status']!=0 && $audit['status']!=2) ){
|
|
|
throw new Exception('当前工单配件不允许修改');
|
|
|
}
|
|
|
|
|
|
- foreach ($params['self_spare_parts'] as $item){
|
|
|
- if (empty($item['spare_image'])){
|
|
|
- throw new Exception('请上传配件图片');
|
|
|
- }
|
|
|
- //修改
|
|
|
- ServiceWorkSpare::where("id",$item['id'])->where('service_worker_id', $work['id'])->update(['spare_image' => $item['spare_image']]);
|
|
|
+ if (empty($params['spare_image'])){
|
|
|
+ throw new Exception('请上传配件图片');
|
|
|
}
|
|
|
+ //修改
|
|
|
+ ServiceWorkSpare::where("id",$params['id'])->where('service_worker_id', $work['id'])->update(['spare_image' => $params['spare_image']]);
|
|
|
+
|
|
|
Db::commit();
|
|
|
return true;
|
|
|
} catch (\Exception $e) {
|