Selaa lähdekoodia

Merge branch 'master' of ssh://47.103.131.176:10022/var/git/bswas

zhouzhendong 4 vuotta sitten
vanhempi
commit
d6e4d56a04

+ 48 - 23
app/Http/Controllers/ReceivingTaskController.php

@@ -5,34 +5,33 @@ namespace App\Http\Controllers;
 use App\DeliveryAppointmentCar;
 use App\DeliveryAppointmentCar;
 use App\Filters\ReceivingTaskFilters;
 use App\Filters\ReceivingTaskFilters;
 use App\Http\Requests\Api\ReceivingTaskRequest;
 use App\Http\Requests\Api\ReceivingTaskRequest;
-use App\Owner;
 use App\ReceivingTask;
 use App\ReceivingTask;
 use App\Services\OwnerService;
 use App\Services\OwnerService;
 use App\Services\ReceivingTaskService;
 use App\Services\ReceivingTaskService;
 use App\Warehouse;
 use App\Warehouse;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Gate;
-use Illuminate\Support\Facades\Request;
+use Illuminate\Http\Request;
 
 
 class ReceivingTaskController extends Controller
 class ReceivingTaskController extends Controller
 {
 {
     public $service;
     public $service;
     public $ownerService;
     public $ownerService;
 
 
-    public function __construct(ReceivingTaskService $service,OwnerService  $ownerService)
+    public function __construct(ReceivingTaskService $service, OwnerService $ownerService)
     {
     {
         $this->service = $service;
         $this->service = $service;
         $this->ownerService = $ownerService;
         $this->ownerService = $ownerService;
     }
     }
 
 
-    public function index(Request $request,ReceivingTaskFilters $filter)
+    public function index(Request $request, ReceivingTaskFilters $filter)
     {
     {
         if (Gate::denies('入库管理-开单入库-查询')) {
         if (Gate::denies('入库管理-开单入库-查询')) {
             return redirect('/');
             return redirect('/');
         }
         }
-        $receivingTasks = ReceivingTask::query()->with(['items','owner','wareHouse','file','deliveryAppointmentCar'])->filter($filter)->orderByDesc('created_at')->paginate(50);
-        $owners = $this->ownerService->getQuery()->select('id','name')->get();
-        $warehouses  = Warehouse::query()->get();
-        return view("store.receivingTasks.index",compact('receivingTasks','owners','warehouses'));
+        $receivingTasks = ReceivingTask::query()->with(['items', 'owner', 'wareHouse', 'file', 'deliveryAppointmentCar'])->filter($filter)->orderByDesc('created_at')->paginate(50);
+        $owners = $this->ownerService->getQuery()->select('id', 'name')->get();
+        $warehouses = Warehouse::query()->get();
+        return view("store.receivingTasks.index", compact('receivingTasks', 'owners', 'warehouses'));
     }
     }
 
 
 
 
@@ -42,40 +41,66 @@ class ReceivingTaskController extends Controller
             return redirect('/');
             return redirect('/');
         }
         }
         $wareHouse = Warehouse::query()->get();
         $wareHouse = Warehouse::query()->get();
-        $owners = $this->ownerService->getQuery()->select("id","code","name")->get();
-        return view("store.receivingTasks.create",compact('wareHouse','owners'));
+        $owners = $this->ownerService->getQuery()->select("id", "code", "name")->get();
+        return view("store.receivingTasks.create", compact('wareHouse', 'owners'));
     }
     }
 
 
 
 
     public function storeApi(ReceivingTaskRequest $request): array
     public function storeApi(ReceivingTaskRequest $request): array
     {
     {
-        if(Gate::denies('入库管理-开单入库-创建')){
-            return ['success' => false,'message' => '没有对应权限'];
+        if (Gate::denies('入库管理-开单入库-创建')) {
+            return ['success' => false, 'message' => '没有对应权限'];
         }
         }
-        $appointment_number = $request->input('appointment_number',null);
+        $appointment_number = $request->input('appointment_number', null);
 
 
-        $delivery_appointment_car = DeliveryAppointmentCar::query()->with('deliveryAppointment')->where('appointment_number',$appointment_number)->first();
+        $delivery_appointment_car = DeliveryAppointmentCar::query()->with('deliveryAppointment')->where('appointment_number', $appointment_number)->first();
 
 
-        if (!$delivery_appointment_car){
-            return ['success' => false,'errors' =>['appointment_number' => ['对应预约号未找到']]];
+        if (!$delivery_appointment_car || !$delivery_appointment_car->deliveryAppointment) {
+            return ['success' => false, 'errors' => ['appointment_number' => ['对应预约号未找到']]];
         }
         }
-        if (!$delivery_appointment_car->deliveryAppointment){
-            return ['success' => false,'errors' =>['appointment_number' => ['对应预约号未找到']]];
+
+        $ans_number_string = $delivery_appointment_car->deliveryAppointment->asn_number ?? '';
+        $ans_numbers = array_filter(preg_split('/[,, ]+/is', $ans_number_string));
+
+        if (count($ans_numbers) === 0 && count($request->input('asn_no',[])) == 0) {
+            return ['success' => false, 'errors' => ['appointment_number' => ['预约号没有对应的Asn号']]];
         }
         }
 
 
-        if ($delivery_appointment_car->deliveryAppointment->owner_id != $request->input('owner_id')){
-            return ['success' => false,'errors' =>['appointment_number' => ['预约号与货主未对应']]];
+        if ($delivery_appointment_car->deliveryAppointment->owner_id != $request->input('owner_id')) {
+            return ['success' => false, 'errors' => ['appointment_number' => ['预约号与货主未对应']]];
         }
         }
-        if (ReceivingTask::query()->where('delivery_appointment_car_id',$delivery_appointment_car->id)->exists()){
-            return ['success' => false, 'errors' =>['appointment_number' => ['预约号已有对应的任务']]];
+
+        if (ReceivingTask::query()->where('delivery_appointment_car_id', $delivery_appointment_car->id)->exists()) {
+            return ['success' => false, 'errors' => ['appointment_number' => ['预约号已有对应的任务']]];
         }
         }
+
         try {
         try {
             $receiving_task = $this->service->createReceivingTask($delivery_appointment_car, $request->all());
             $receiving_task = $this->service->createReceivingTask($delivery_appointment_car, $request->all());
             if (!$receiving_task->id) return ['success' => false, 'message' => '生成入库单任务失败,请重新尝试'];
             if (!$receiving_task->id) return ['success' => false, 'message' => '生成入库单任务失败,请重新尝试'];
-            $receiving_task->loadMissing(['wareHouse','owner','deliveryAppointmentCar']);
+            $receiving_task->loadMissing(['wareHouse', 'owner', 'deliveryAppointmentCar']);
             return ['success' => true, 'data' => $receiving_task];
             return ['success' => true, 'data' => $receiving_task];
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             return ['success' => false, 'message' => '生成入库单任务失败,请重新尝试'];
             return ['success' => false, 'message' => '生成入库单任务失败,请重新尝试'];
         }
         }
     }
     }
+
+    /**
+     * 根据预约号获取Asn单号
+     * @param Request $request
+     * @return array
+     */
+    public function getAsnByAppointmentNumberApi(Request $request): array
+    {
+        $appointment_number = $request->input('appointment_number');
+        if (!$appointment_number) {
+            return ['success' => false, 'errors' => ['appointment_number' => '预约号不能为空']];
+        }
+        $delivery_appointment_car = DeliveryAppointmentCar::query()->with('deliveryAppointment')->where('appointment_number', $appointment_number)->first();
+        if (ReceivingTask::query()->where('delivery_appointment_car_id', $delivery_appointment_car->id)->exists()) {
+            return ['success' => false, 'errors' => ['appointment_number' => ['预约号已有对应的任务']]];
+        }
+        $ans_number_string = $delivery_appointment_car->deliveryAppointment->asn_number ?? '';
+        $ans_numbers = array_filter(preg_split('/[,, ]+/is', $ans_number_string));
+        return ['success' => true, 'data' => $ans_numbers];
+    }
 }
 }

+ 2 - 1
app/Http/Controllers/WorkOrderLossController.php

@@ -62,8 +62,9 @@ class WorkOrderLossController extends Controller
         $detail = WorkOrderDetail::query()->with('workOrder')->find($request->input('detail_id'));
         $detail = WorkOrderDetail::query()->with('workOrder')->find($request->input('detail_id'));
         $workOrder = $detail->workOrder;
         $workOrder = $detail->workOrder;
         if (!$detail||!$workOrder) return ['success' => false, 'message' => '参数异常'];
         if (!$detail||!$workOrder) return ['success' => false, 'message' => '参数异常'];
+        if($workOrder->status  === '待货主完结') return ['success' => false, 'message' => '工单当前状态为`待货主完成`,请刷新页面重试'];
         $this->service->baoShiReview($detail,$request->all());
         $this->service->baoShiReview($detail,$request->all());
-        $data = WorkOrder::query()->defaultWith()->find($request->input('detail_id'));
+        $data = $this->service->getDefaultWith($detail->work_order_id);
         return ['success' => true,'data' => $data];
         return ['success' => true,'data' => $data];
     }
     }
 }
 }

+ 1 - 2
app/Http/Requests/Api/ReceivingTaskRequest.php

@@ -36,7 +36,7 @@ class ReceivingTaskRequest extends FormRequest
             'provide_list' => 'required',
             'provide_list' => 'required',
             'receiving_type' => 'required',
             'receiving_type' => 'required',
             'driving_license_image' => 'required|image',
             'driving_license_image' => 'required|image',
-            'asn_nos' => 'required|array'
+            'asn_nos' => 'array'
         ];
         ];
     }
     }
 
 
@@ -54,7 +54,6 @@ class ReceivingTaskRequest extends FormRequest
             'receiving_type.required' => "收货类型为必选项",
             'receiving_type.required' => "收货类型为必选项",
             'driving_license_image.required' => "驾驶证扫描件不能为空",
             'driving_license_image.required' => "驾驶证扫描件不能为空",
             'driving_license_image.image' => "驾驶证扫描件格式错误",
             'driving_license_image.image' => "驾驶证扫描件格式错误",
-            'asn_nos.required' => "勾选入库单",
             'asn_nos.array' => "入库单号参数类型错误"
             'asn_nos.array' => "入库单号参数类型错误"
         ];
         ];
     }
     }

+ 4 - 1
app/Services/OracleDocAsnHerderService.php

@@ -43,7 +43,8 @@ class OracleDocAsnHerderService
                 $query->with(['lineStatus', 'qualityStatus', 'basSku']);
                 $query->with(['lineStatus', 'qualityStatus', 'basSku']);
             }])
             }])
             ->whereIn("AsnStatus", ['00', '30'])
             ->whereIn("AsnStatus", ['00', '30'])
-            ->where('CustomerId', $customId)->orderByDesc('addtime')->forPage($page,$perGage)->get();
+            ->whereIn('asnType',['B2BRK','CGRK','CSKC','DBRK','F10','F21','F31','F32','HHRK','QTRK'])
+            ->where('CustomerId', $customId)->orderByDesc('addTime')->forPage($page,$perGage)->get();
     }
     }
 
 
     public function getToBeProcessAsnCountByCustomId($customId): int
     public function getToBeProcessAsnCountByCustomId($customId): int
@@ -53,6 +54,8 @@ class OracleDocAsnHerderService
                 $query->with(['lineStatus', 'qualityStatus', 'basSku']);
                 $query->with(['lineStatus', 'qualityStatus', 'basSku']);
             }])
             }])
             ->whereIn("AsnStatus", ['00', '30'])
             ->whereIn("AsnStatus", ['00', '30'])
+
+            ->whereIn('asnType',['B2BRK','CGRK','CSKC','DBRK','F10','F21','F31','F32','HHRK','QTRK'])
             ->where('CustomerId', $customId)->count();
             ->where('CustomerId', $customId)->count();
     }
     }
 
 

+ 1 - 1
app/Services/ReceivingTaskService.php

@@ -59,7 +59,7 @@ class ReceivingTaskService
         DB::transaction(function () use ($deliveryAppointmentCar, $params, &$receivingTask) {
         DB::transaction(function () use ($deliveryAppointmentCar, $params, &$receivingTask) {
             $receivingTask->save();
             $receivingTask->save();
             if ($receivingTask->id) {
             if ($receivingTask->id) {
-                $ans_number_string = $deliveryAppointmentCar->deliveryAppointment->asn_number ?? [];
+                $ans_number_string = $deliveryAppointmentCar->deliveryAppointment->asn_number ?? '';
                 $ans_numbers = array_filter(preg_split('/[,, ]+/is', $ans_number_string));
                 $ans_numbers = array_filter(preg_split('/[,, ]+/is', $ans_number_string));
                 $ans_numbers = array_merge($ans_numbers, $params['asn_nos'] ?? []);
                 $ans_numbers = array_merge($ans_numbers, $params['asn_nos'] ?? []);
                 $this->itemService->createItems($receivingTask, $ans_numbers);
                 $this->itemService->createItems($receivingTask, $ans_numbers);

+ 1 - 2
app/Utils/helpers.php

@@ -111,7 +111,7 @@ function getMacAddr($type = PHP_OS):string
     return $mac_addr;
     return $mac_addr;
 }
 }
 
 
-//2021-09-03 oracle 链接
+//2021-09-03 oracle 链接+
 function getOciConnect()
 function getOciConnect()
 {
 {
     $username = config('database.connections.oracle.username');
     $username = config('database.connections.oracle.username');
@@ -121,4 +121,3 @@ function getOciConnect()
     $charset = config('database.connections.oracle.charset');
     $charset = config('database.connections.oracle.charset');
     return oci_connect($username,$password,$host.'/'.$service_name,$charset);
     return oci_connect($username,$password,$host.'/'.$service_name,$charset);
 }
 }
-

+ 16 - 0
config/octane.php

@@ -0,0 +1,16 @@
+<?php
+return [
+    'workerman' => [
+        'transport' => 'tcp',
+        'context' => [],
+        'name' => env('APP_NAME', 'laravel-octane-workerman'),
+        'count' => cpu_count() * 2,
+        'user' => '',
+        'group' => '',
+        'reuse_port' => true,
+        'pid_file' => storage_path('logs/webman.pid'),
+        'stdout_file' => storage_path('logs/stdout.log'),
+        'log_file' => storage_path('logs/workerman.log'),
+        'max_package_size' => 10 * 1024 * 1024,
+    ]
+];

+ 1 - 1
resources/views/order/workOrder/index.blade.php

@@ -69,7 +69,6 @@
                                               class="badge badge-danger bg-warning text-break"
                                               class="badge badge-danger bg-warning text-break"
                                               @click="showStoreProcessLog(item,i)">滞</span>
                                               @click="showStoreProcessLog(item,i)">滞</span>
                                     @elsecan('订单管理-工单处理-承运商编辑')
                                     @elsecan('订单管理-工单处理-承运商编辑')
-                                    @else
                                         <span v-show="isStrandWorkOrder(item)"
                                         <span v-show="isStrandWorkOrder(item)"
                                               class="badge badge-danger bg-warning text-break">滞</span>
                                               class="badge badge-danger bg-warning text-break">滞</span>
                                     @endcan
                                     @endcan
@@ -2802,6 +2801,7 @@
                 },
                 },
                 isStrandWorkOrder(item) {
                 isStrandWorkOrder(item) {
                     let {logistic_tag, bao_shi_tag, owner_tag} = item;
                     let {logistic_tag, bao_shi_tag, owner_tag} = item;
+                    console.log(this.isLogistic);
                     if (this.isBaoShi) {
                     if (this.isBaoShi) {
                         return `${bao_shi_tag}` === '2'
                         return `${bao_shi_tag}` === '2'
                     } else if (this.isLogistic) {
                     } else if (this.isLogistic) {

+ 19 - 1
resources/views/store/receivingTasks/create.blade.php

@@ -115,6 +115,7 @@
                                     <input type="text" class="form-control form-control-sm col-12" placeholder=""
                                     <input type="text" class="form-control form-control-sm col-12" placeholder=""
                                            name="appointment_number" id="appointment_number"
                                            name="appointment_number" id="appointment_number"
                                            :class="{'is-invalid':errors.appointment_number}"
                                            :class="{'is-invalid':errors.appointment_number}"
+{{--                                           @keydown.enter="getAnsNo"--}}
                                            @change="clearError('appointment_number')"
                                            @change="clearError('appointment_number')"
                                            v-model="receiving_task.appointment_number">
                                            v-model="receiving_task.appointment_number">
                                     <div id="validation-delivery-appointment-number" class="invalid-feedback"
                                     <div id="validation-delivery-appointment-number" class="invalid-feedback"
@@ -462,7 +463,8 @@
                 printerList: [],
                 printerList: [],
                 print_setting: {
                 print_setting: {
                     printer_index: 0,
                     printer_index: 0,
-                }
+                },
+                appointment_number_asn_nos:[], // 预约号对应的ans号
             },
             },
             mounted() {
             mounted() {
                 $("#list").removeClass('d-none');
                 $("#list").removeClass('d-none');
@@ -567,6 +569,22 @@
                         this.errorTempTip(err);
                         this.errorTempTip(err);
                     });
                     });
                 },
                 },
+                getAnsNo(){
+                    let url = "{{route('store.receivingMask.getAsnNumberApi')}}";
+                    this.appointment_number_asn_nos = [];
+                    let data = {
+                        'appointment_number':this.receiving_task.appointment_number,
+                    };
+                    window.axios.post(url,data).then(res => {
+                        if (res.data.success) {
+                            this.appointment_number_asn_nos = res.data.data;
+                            return;
+                        }
+                        this.errorTempTip(res.data.message ? res.data.message : '校验预约号出现异常');
+                    }).catch(err => {
+                        this.errorTempTip(err);
+                    });
+                },
                 formatAsnHeaderDetails(asnHeaderDetails) {
                 formatAsnHeaderDetails(asnHeaderDetails) {
                     return asnHeaderDetails.map(e => this.formatAsnHeaderDetail(e));
                     return asnHeaderDetails.map(e => this.formatAsnHeaderDetail(e));
                 },
                 },

+ 2 - 0
routes/apiLocal.php

@@ -66,6 +66,8 @@ Route::group(['prefix' => 'personnel'], function () {
 Route::prefix('store')->group(function(){
 Route::prefix('store')->group(function(){
     Route::prefix('receivingMask')->group(function(){
     Route::prefix('receivingMask')->group(function(){
         Route::post("/createApi","ReceivingTaskController@storeApi")->name("store.receivingMask.storeApi");
         Route::post("/createApi","ReceivingTaskController@storeApi")->name("store.receivingMask.storeApi");
+        Route::post('/deliveryAppointment/asnNumber','ReceivingTaskController@getAsnByAppointmentNumberApi')
+            ->name('store.receivingMask.getAsnNumberApi');
     });
     });
 });
 });
 Route::prefix('oracle')->group(function(){
 Route::prefix('oracle')->group(function(){