|
|
@@ -51,6 +51,7 @@ use app\common\model\master_worker\MasterWorkerRetentionMoneyLog;
|
|
|
use app\common\model\master_commission\MasterWorkerCommissionRatio;
|
|
|
use app\common\model\master_commission\MasterWorkerCommissionConfig;
|
|
|
use app\common\model\service_area\ServiceArea;
|
|
|
+use app\common\model\works\ServiceWorkSpareAudit;
|
|
|
|
|
|
/**
|
|
|
* ServiceWork逻辑
|
|
|
@@ -407,6 +408,40 @@ class ServiceWorkLogic extends BaseLogic
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 工程师修改自选配件的图片
|
|
|
+ * @param $params
|
|
|
+ * @return false|void
|
|
|
+ */
|
|
|
+ public static function selfSparePart($params)
|
|
|
+ {
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ $work = ServiceWork::where(['master_worker_id'=>$params['user_id'],'work_sn'=>$params['work_sn']])->findOrEmpty();
|
|
|
+ if($work->isEmpty()){
|
|
|
+ throw new Exception('工单不存在');
|
|
|
+ }
|
|
|
+ $audit = ServiceWorkSpareAudit::where(['service_work_id'=>$work['id']])->findOrEmpty();
|
|
|
+ if($audit->isEmpty()){
|
|
|
+ throw new Exception('当前工单不存在配件审核信息');
|
|
|
+ }
|
|
|
+ if($audit['status']!=2){
|
|
|
+ throw new Exception('当前工单配件不允许修改');
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($params['self_spare_parts'] as $item){
|
|
|
+ //修改
|
|
|
+ ServiceWorkSpare::where("id",$item['id'])->where('service_worker_id', $work['id'])->update(['spare_image' => $item['spare_image']]);
|
|
|
+ }
|
|
|
+ Db::commit();
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ self::setError($e->getMessage());
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 工程师确认服务完成
|
|
|
* @param $params
|