|
@@ -31,6 +31,7 @@ use App\Model\SeeRange;
|
|
|
use App\Model\Storehouse;
|
|
|
use Carbon\Carbon;
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
+use Illuminate\Support\Arr;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
//use Barryvdh\DomPDF\Facade as PDF;
|
|
|
use Barryvdh\DomPDF\PDF;
|
|
@@ -41,6 +42,52 @@ use Barryvdh\DomPDF\PDF;
|
|
|
*/
|
|
|
class ConstructionService extends Service
|
|
|
{
|
|
|
+ //小程序端编辑车架号 备注
|
|
|
+ public function constructionEditOther($data,$user){
|
|
|
+ list($status,$msg) = $this->constructionEditOtherRule($data, $user);
|
|
|
+ if(!$status) return [$status, $msg];
|
|
|
+
|
|
|
+ $params = $this->getDataFile($data);
|
|
|
+ (new OperationLogService())->setOperationList($params,$user,2);
|
|
|
+
|
|
|
+ try {
|
|
|
+ DB::beginTransaction();
|
|
|
+
|
|
|
+ $update = [
|
|
|
+ 'mark' => $data['mark'] ?? '',
|
|
|
+ 'vin_no' => $data['vin_no'] ?? '',
|
|
|
+ ];
|
|
|
+
|
|
|
+ Construction::where('id', $data['id'])->update($update);
|
|
|
+
|
|
|
+ DB::commit();
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ DB::rollBack();
|
|
|
+ return [false,$exception->getMessage()];
|
|
|
+ }
|
|
|
+
|
|
|
+ return [true, ''];
|
|
|
+ }
|
|
|
+
|
|
|
+ public function constructionEditOtherRule(&$data, $user){
|
|
|
+ if(empty($data['id'])) return [false,'ID不能为空'];
|
|
|
+ $construction = Construction::where('del_time',0)
|
|
|
+ ->where('id',$data['id'])
|
|
|
+ ->first();
|
|
|
+ if(empty($construction)) return [false, '施工单不存在或已被删除'];
|
|
|
+ $construction = $construction->toArray();
|
|
|
+ $data['order_number'] = $construction['order_number'];
|
|
|
+
|
|
|
+ if(! Arr::has($data,'mark') && ! Arr::has($data,'vin_no')) return [false, '更新字段不能为空'];
|
|
|
+
|
|
|
+ //订单编辑提交限制
|
|
|
+// $current_top_depart_id = $this->getMyTopDepart($user);
|
|
|
+// list($status, $msg) = $this->returnOrderEditErrorCommon($current_top_depart_id, $construction['top_depart_id']);
|
|
|
+// if(! $status) return [false, $msg];
|
|
|
+
|
|
|
+ return [true, ''];
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 施工订单编辑
|
|
|
* @param $data
|