Переглянути джерело

Merge branch 'master' into haozi

# Conflicts:
#	app/Http/Controllers/TestController.php
eric2h 4 роки тому
батько
коміт
f1c5799600
50 змінених файлів з 2427 додано та 463 видалено
  1. 47 0
      app/Console/Commands/EndReceivingTask.php
  2. 3 0
      app/Console/Kernel.php
  3. 86 0
      app/Filters/ReceivingTaskFilters.php
  4. 30 4
      app/Filters/WorkOrderFilters.php
  5. 1 1
      app/Http/ApiControllers/WaybillController.php
  6. 39 0
      app/Http/Controllers/OracleDOCAsnHeaderController.php
  7. 84 0
      app/Http/Controllers/ReceivingTaskController.php
  8. 85 0
      app/Http/Controllers/ReceivingTaskItemController.php
  9. 26 11
      app/Http/Controllers/RejectedController.php
  10. 9 0
      app/Http/Controllers/StationController.php
  11. 10 244
      app/Http/Controllers/TestController.php
  12. 5 4
      app/Http/Controllers/api/thirdPart/flux/WaybillController.php
  13. 61 0
      app/Http/Requests/Api/ReceivingTaskRequest.php
  14. 2 17
      app/Jobs/PackageCollectingAllocation.php
  15. 0 79
      app/Observers/WaybillObserver.php
  16. 1 1
      app/OracleDOCASNDetail.php
  17. 11 3
      app/OracleDOCASNHeader.php
  18. 0 12
      app/OrderPackage.php
  19. 5 3
      app/Providers/AppServiceProvider.php
  20. 69 0
      app/ReceivingTask.php
  21. 27 0
      app/ReceivingTaskItem.php
  22. 7 0
      app/Services/AuthorityService.php
  23. 14 0
      app/Services/BatchService.php
  24. 2 6
      app/Services/DbOpenService.php
  25. 4 0
      app/Services/OracleDocAsnDetailService.php
  26. 23 2
      app/Services/OracleDocAsnHerderService.php
  27. 6 5
      app/Services/OrderService.php
  28. 1 1
      app/Services/OwnerService.php
  29. 27 0
      app/Services/ReceivingTaskItemService.php
  30. 135 0
      app/Services/ReceivingTaskService.php
  31. 1 1
      app/Services/RejectedBillService.php
  32. 60 0
      app/Services/WaybillService.php
  33. 44 0
      app/Utils/IdCreate.php
  34. 0 1
      app/WorkOrder.php
  35. 12 0
      database/factories/ReceivingTaskFactory.php
  36. 11 0
      database/factories/ReceivingTaskItemFactory.php
  37. 49 0
      database/migrations/2021_12_22_153152_create_receiving_tasks_table.php
  38. 33 0
      database/migrations/2021_12_22_163154_create_receiving_task_items_table.php
  39. 32 0
      database/migrations/2021_12_31_092206_receiving_task_add_user_id.php
  40. 16 0
      database/seeds/ReceivingTaskItemSeeder.php
  41. 16 0
      database/seeds/ReceivingTaskSeeder.php
  42. 1 49
      resources/views/order/issue/index.blade.php
  43. 34 16
      resources/views/order/workOrder/index.blade.php
  44. 30 3
      resources/views/station/monitor/visual.blade.php
  45. 18 0
      resources/views/store/receivingTasks/_clodop_print.blade.php
  46. 55 0
      resources/views/store/receivingTasks/_receiving_task_print.blade.php
  47. 814 0
      resources/views/store/receivingTasks/create.blade.php
  48. 359 0
      resources/views/store/receivingTasks/index.blade.php
  49. 13 0
      routes/apiLocal.php
  50. 9 0
      routes/web.php

+ 47 - 0
app/Console/Commands/EndReceivingTask.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Services\ReceivingTaskService;
+use Carbon\Carbon;
+use Illuminate\Console\Command;
+
+class EndReceivingTask extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'receivingTask:batch end';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = '延时完结 入库开单任务';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle(): int
+    {
+        /** @var ReceivingTaskService $service */
+        $service = app(ReceivingTaskService::class);
+        $service->overtimeToCompleteTask();
+        return 1;
+    }
+}

+ 3 - 0
app/Console/Kernel.php

@@ -6,6 +6,7 @@ use App\Console\Commands\BeforeCreateOwnerReport;
 use App\Console\Commands\ClearCancelledOrderTask;
 use App\Console\Commands\CreateProcurementTotalBill;
 use App\Console\Commands\CreateWeightStatistic;
+use App\Console\Commands\EndReceivingTask;
 use App\Console\Commands\FluxOrderFix;
 use App\Console\Commands\InventoryDailyLoggingOwner;
 use App\Console\Commands\LogExpireDelete;
@@ -55,6 +56,7 @@ class  Kernel extends ConsoleKernel
         CreateProcurementTotalBill::class,
         SyncCarrier::class,
         ReceiveRecord::class,
+        EndReceivingTask::class,
     ];
 
     /**
@@ -95,6 +97,7 @@ class  Kernel extends ConsoleKernel
         $schedule->job(new CalculationArrivedManNumJob(now()->subDays(2)->startOfDay()))->dailyAt('01:01')->runInBackground();//生成实际到岗人数数据
 
         $schedule->command("record:scan")->hourlyAt(1);//退件信息标记
+        $schedule->command("receivingTask:batchEnd")->dailyAt('0:15')->runInBackground();   //批量完成入库单任务
     }
 
     /**

+ 86 - 0
app/Filters/ReceivingTaskFilters.php

@@ -0,0 +1,86 @@
+<?php
+
+
+namespace App\Filters;
+
+use App\DeliveryAppointmentCar;
+use App\Traits\ModelSearchWay;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Http\Request;
+
+class ReceivingTaskFilters{
+    use ModelSearchWay;
+
+
+    protected $request;
+    protected $queryBuilder;
+    protected $deliveryAppointmentCarQuery;
+    protected $receiving;
+    protected $filters = [
+        'id','owner_id','warehouse_id','appointment_number','created_at_start','created_at_end','number'
+    ];
+    protected $params = [];
+
+    public function __construct(Request $request)
+    {
+        $this->request = $request;
+        $this->params = $request->all();
+    }
+
+    public function apply($builder)
+    {
+        $this->queryBuilder = $builder;
+        $filters = array_filter($this->request->only($this->filters));
+
+        foreach ($filters as $filter => $value) {
+            if (method_exists($this, $filter)) {
+                $this->$filter($value, $this->queryBuilder);
+            }
+        }
+        $this->afterApply();
+        return $this->queryBuilder;
+    }
+
+    public function getDeliveryAppointmentCarQuery(): Builder
+    {
+        if (!$this->deliveryAppointmentCarQuery){
+            $this->deliveryAppointmentCarQuery = DeliveryAppointmentCar::query()->select('id');
+        }
+        return $this->deliveryAppointmentCarQuery;
+    }
+
+    public function afterApply(){
+        if ($this->deliveryAppointmentCarQuery){
+            $this->queryBuilder->whereIn('delivery_appointment_car_id',$this->deliveryAppointmentCarQuery);
+        }
+    }
+
+    public function id($ids){
+        $this->searchWay($this->queryBuilder,$ids,'id');
+    }
+
+    public function owner_id($owner_id){
+        $this->searchWay($this->queryBuilder,$owner_id,'owner_id');
+    }
+
+    public function warehouse_id($warehouse_id){
+        $this->searchWay($this->queryBuilder,$warehouse_id,'warehouse_id');
+    }
+
+    public function appointment_number($appointment_number){
+        $this->searchWay($this->getDeliveryAppointmentCarQuery(),$appointment_number,'appointment_number');
+    }
+
+    public function number($number){
+        $this->searchWay($this->queryBuilder,$number,'number');
+    }
+
+    public function created_at_start($created_at_start){
+        $this->queryBuilder->where('created_at','>=',$created_at_start." 00:00:00");
+    }
+
+    public function created_at_end($created_at_end){
+        $this->queryBuilder->where('created_at','<=',$created_at_end." 23:59:59");
+    }
+
+}

+ 30 - 4
app/Filters/WorkOrderFilters.php

@@ -43,7 +43,8 @@ class WorkOrderFilters
         'is_end',
         'status',
         'process_progress',
-        'order_issue_log'
+        'order_issue_log',
+        'log_content'
     ];
     protected $array_filter;
     protected $params = [];
@@ -53,6 +54,7 @@ class WorkOrderFilters
     protected $orderPackageQuery;
     protected $issueTypeQuery;
     protected $orderIssueLogQuery;
+    protected $orderIssueQuery;
 
 
 
@@ -147,9 +149,9 @@ class WorkOrderFilters
     public function afterFileIssueType()
     {
         if (Gate::allows('订单管理-工单处理-客服编辑') || Gate::allows('订单管理-工单处理-货主编辑')) {
-            $this->getOrderIssueQuery()->whereIn('name', ['拦截','取消拦截', '信息更改', '其他', '快递异常', '错漏发', '破损', '快递丢件']);
+            $this->getOrderIssueTypeQuery()->whereIn('name', ['拦截','取消拦截', '信息更改', '其他', '快递异常', '错漏发', '破损', '快递丢件']);
         } else if (Gate::allows('订单管理-工单处理-承运商编辑')) {
-            $this->getOrderIssueQuery()->whereIn('name', ['拦截','取消拦截', '信息更改', '破损', '快递丢件', '快递异常']);
+            $this->getOrderIssueTypeQuery()->whereIn('name', ['拦截','取消拦截', '信息更改', '破损', '快递丢件', '快递异常']);
         }
     }
 
@@ -166,6 +168,10 @@ class WorkOrderFilters
         if ($this->issueTypeQuery) {
             $this->queryBuilder->whereIn('order_issue_type_id', $this->issueTypeQuery);
         }
+
+        if ($this->orderIssueQuery){
+            $this->queryBuilder->whereIn('work_orders.order_id', $this->orderIssueQuery);
+        }
         $this->orderByTag();
     }
 
@@ -198,7 +204,7 @@ class WorkOrderFilters
         return $this->orderPackageQuery;
     }
 
-    public function getOrderIssueQuery(): Builder
+    public function getOrderIssueTypeQuery(): Builder
     {
         if (!$this->issueTypeQuery) {
             $this->issueTypeQuery = OrderIssueType::query()->select('id');
@@ -206,6 +212,15 @@ class WorkOrderFilters
         return $this->issueTypeQuery;
     }
 
+
+    public function getOrderIssueQuery(): Builder
+    {
+        if (!$this->orderIssueQuery) {
+            $this->orderIssueQuery = OrderIssue::query()->select('order_issues.order_id');
+        }
+        return $this->orderIssueQuery;
+    }
+
     public function getOrderIssueLogQuery(): Builder
     {
         if (!$this->orderIssueLogQuery) {
@@ -320,6 +335,17 @@ class WorkOrderFilters
         $this->queryBuilder->whereIn('order_id',$order_issue_query);
     }
 
+    public function log_content($log_content)
+    {
+        $order_issue_process_log_query = OrderIssueProcessLog::query()->selectRaw('order_issue_id')->where('content', 'like', $log_content);
+        if (!array_key_exists('addtime',$this->params) ) {
+            $order_issue_process_log_query->where('created_at', '>=', Carbon::now()->subDays(31));
+        } else {
+            $order_issue_process_log_query->where('created_at', '>=', Carbon::now()->subDays($this->params['addtime']));
+        }
+        $this->getOrderIssueQuery()->whereIn('id',$order_issue_process_log_query);
+    }
+
     public function status($status){
         $status_list = [];
         if ($status == '承运商处理'){

+ 1 - 1
app/Http/ApiControllers/WaybillController.php

@@ -149,7 +149,7 @@ sql;
         if (!$deliverAt || !$fee || !is_numeric($fee) || !$fee<0)
             $this->response(false,400,"非法参数或不满足需求");
         $param=array('screenDate'=>$deliverAt,'billing'=>$fee);
-        $waybills=app('waybillService')->dailyBilling($param,true);
+        $waybills=app('WaybillService')->dailyBilling($param,true);
         if ($waybills===0 || $waybills===1 || !isset($waybills)) $this->response(false);
         $this->response(true);
     }

+ 39 - 0
app/Http/Controllers/OracleDOCAsnHeaderController.php

@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Services\OracleDocAsnHerderService;
+use App\Services\OwnerService;
+use Illuminate\Http\Request;
+
+class OracleDOCAsnHeaderController extends Controller
+{
+
+    /**
+     * @var OracleDocAsnHerderService $service
+     * @var OwnerService $ownerService
+     */
+    private $service;
+    private $ownerService;
+
+    public function __construct()
+    {
+        $this->service = app(OracleDocAsnHerderService::class);
+        $this->ownerService = app(OwnerService::class);
+    }
+
+    public function getToBeProcessAsnHeaderDetailsApi(Request $request): array
+    {
+        $customer_id = $request->input('customer_id',null);
+        if (!$customer_id){
+            return ['success'=> false,'message' => '参数错误'];
+        }
+        $page = $request->input('page',0);
+        $prePage = $request->input('prePage',20);
+        $data = $this->service->getToBeProcessAsnDetailsByCustomId($customer_id,$page,$prePage);
+        $total= $this->service->getToBeProcessAsnCountByCustomId($customer_id);
+        $page_count = ceil($total / $prePage);
+        return ['success' => true,'data' => $data,'total' => $total,'current_page'=>$page ,'page_count' => $page_count];
+    }
+
+}

+ 84 - 0
app/Http/Controllers/ReceivingTaskController.php

@@ -0,0 +1,84 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\DeliveryAppointmentCar;
+use App\Filters\ReceivingTaskFilters;
+use App\Http\Requests\Api\ReceivingTaskRequest;
+use App\ReceivingTask;
+use App\Services\OwnerService;
+use App\Services\ReceivingTaskService;
+use App\Warehouse;
+use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Request;
+
+class ReceivingTaskController extends Controller
+{
+    /**
+     * @var ReceivingTaskService $service
+     * @var OwnerService $ownerService
+     */
+    private $service;
+    private $ownerService;
+
+    public function __construct()
+    {
+        $this->service = app(ReceivingTaskService::class);
+        $this->ownerService = app(OwnerService::class);
+    }
+
+    public function index(Request $request,ReceivingTaskFilters $filter)
+    {
+        if (Gate::denies('入库管理-开单入库-查询')) {
+            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'));
+    }
+
+
+    public function create()
+    {
+        if (Gate::denies('入库管理-开单入库-创建')) {
+            return redirect('/');
+        }
+        $wareHouse = Warehouse::query()->get();
+        $owners = $this->ownerService->getQuery()->select("id","code","name")->get();
+        return view("store.receivingTasks.create",compact('wareHouse','owners'));
+    }
+
+
+    public function storeApi(ReceivingTaskRequest $request): array
+    {
+        if(Gate::denies('入库管理-开单入库-创建')){
+            return ['success' => false,'message' => '没有对应权限'];
+        }
+        $appointment_number = $request->input('appointment_number',null);
+
+        $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->deliveryAppointment){
+            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' => ['预约号已有对应的任务']]];
+        }
+        try {
+            $receiving_task = $this->service->createReceivingTask($delivery_appointment_car, $request->all());
+            if (!$receiving_task->id) return ['success' => false, 'message' => '生成入库单任务失败,请重新尝试'];
+            $receiving_task->loadMissing(['wareHouse','owner','deliveryAppointmentCar']);
+            return ['success' => true, 'data' => $receiving_task];
+        } catch (\Exception $e) {
+            return ['success' => false, 'message' => '生成入库单任务失败,请重新尝试'];
+        }
+    }
+}

+ 85 - 0
app/Http/Controllers/ReceivingTaskItemController.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\ReceivingTaskItem;
+use Illuminate\Http\Request;
+
+class ReceivingTaskItemController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function index()
+    {
+        //
+    }
+
+    /**
+     * Show the form for creating a new resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function create()
+    {
+        //
+    }
+
+    /**
+     * Store a newly created resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function store(Request $request)
+    {
+        //
+    }
+
+    /**
+     * Display the specified resource.
+     *
+     * @param  \App\ReceivingTaskItem  $receivingTaskItem
+     * @return \Illuminate\Http\Response
+     */
+    public function show(ReceivingTaskItem $receivingTaskItem)
+    {
+        //
+    }
+
+    /**
+     * Show the form for editing the specified resource.
+     *
+     * @param  \App\ReceivingTaskItem  $receivingTaskItem
+     * @return \Illuminate\Http\Response
+     */
+    public function edit(ReceivingTaskItem $receivingTaskItem)
+    {
+        //
+    }
+
+    /**
+     * Update the specified resource in storage.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \App\ReceivingTaskItem  $receivingTaskItem
+     * @return \Illuminate\Http\Response
+     */
+    public function update(Request $request, ReceivingTaskItem $receivingTaskItem)
+    {
+        //
+    }
+
+    /**
+     * Remove the specified resource from storage.
+     *
+     * @param  \App\ReceivingTaskItem  $receivingTaskItem
+     * @return \Illuminate\Http\Response
+     */
+    public function destroy(ReceivingTaskItem $receivingTaskItem)
+    {
+        //
+    }
+}

+ 26 - 11
app/Http/Controllers/RejectedController.php

@@ -23,6 +23,7 @@ use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Routing\Redirector;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Validation\ValidationException;
@@ -500,17 +501,31 @@ class RejectedController extends Controller
     public function exportAnalyze(Request $request){
         $searchParams = $this->getAnalyzeSearchParams($request);
         $sql = RejectedAnalyzeOwner::getQuerySQL($searchParams);
-
-        $e = new Export();
-        $e->setMysqlConnection(config('database.connections.mysql.host'),
-            config('database.connections.mysql.port'),config('database.connections.mysql.database')
-            ,config('database.connections.mysql.username'),config('database.connections.mysql.password'));
-        $e->setFileName("退货统计记录单");
-        return $e->sql($sql,[
-            "owner_name"=>"货主名","bounce_amount"=>"退件单数",
-            "check_amount"=>"审核单数","uncheck_amount"=>"未审核单数",
-            "in_storage_count"=>"入库单数","not_in_storage_count"=>"未入库单数",
-        ])->direct();
+        $result_array = DB::select($sql);
+        $row = ['货主名','退件单数','审核单数','未审核单数','入库单数','未入库单数'];
+        $json = [];
+        foreach ($result_array as $result){
+            $json[] = [
+                $result->owner_name,
+                $result->bounce_amount,
+                $result->check_amount,
+                $result->bounce_amount-$result->check_amount,
+                $result->in_storage_count,
+                $result->not_in_storage_count,
+            ];
+        }
+        return Export::make($row,$json,"退货统计记录单");
+//        dd($json);
+//        $e = new Export();
+//        $e->setMysqlConnection(config('database.connections.mysql.host'),
+//            config('database.connections.mysql.port'),config('database.connections.mysql.database')
+//            ,config('database.connections.mysql.username'),config('database.connections.mysql.password'));
+//        $e->setFileName("退货统计记录单");
+//        return $e->sql($sql,[
+//            "owner_name"=>"货主名","bounce_amount"=>"退件单数",
+//            "check_amount"=>"审核单数","uncheck_amount"=>"未审核单数",
+//            "in_storage_count"=>"入库单数","not_in_storage_count"=>"未入库单数",
+//        ])->direct();
     }
 
     public function apiGetRejectedByLogisticNumberReturn(Request $request){

+ 9 - 0
app/Http/Controllers/StationController.php

@@ -101,4 +101,13 @@ SQL;
         Cache::tags("loadBoxMonitor")->put($cacheKey,$locations,1800);
         $this->success($locations);
     }
+
+    public function getBoxes()
+    {
+        $arr = \request("arr");
+        if (!$arr)$this->error("无可用箱");
+        $ks = DB::connection("mysql_haiRobotics")->table("ks_bin")->select("ks_bin_code")
+            ->whereIn("ks_bin_space_code",$arr)->pluck("ks_bin_code")->toArray();
+        $this->success(implode(" ",$ks));
+    }
 }

+ 10 - 244
app/Http/Controllers/TestController.php

@@ -2,159 +2,17 @@
 
 namespace App\Http\Controllers;
 
-use App\Authority;
-use App\Batch;
-use App\Commodity;
-use App\CommodityBarcode;
-use App\CommodityMaterialBoxModel;
 use App\Components\AsyncResponse;
 use App\Components\Database;
 use App\Components\ErrorPush;
-use App\ErrorTemp;
-use App\Feature;
-use App\Http\ApiControllers\LoginController;
-use App\Http\Controllers\api\thirdPart\haochuang\SortingController;
-use App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeCell;
-use App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeRelation;
-use App\Http\Controllers\api\thirdPart\syrius\beans\Task;
-use App\Http\Controllers\api\thirdPart\syrius\beans\TaskItem;
-use App\Http\Controllers\api\thirdPart\syrius\producer\StorageTypeController;
-use App\Http\Controllers\api\thirdPart\syrius\units\Signature;
-use App\Http\Controllers\api\thirdPart\syrius\units\StorageTypeAttribute;
-use App\Http\Requests\AndroidGateRequest;
-use App\Http\Requests\OrderDelivering;
-use App\InventoryAccount;
-use App\InventoryAccountMission;
-use App\Jobs\BatchTaskJob;
-use App\Jobs\BroadcastBatchToZhengCangJob;
-use App\Jobs\CacheShelfTaskJob;
-use App\Jobs\OrderCreateInstantBill;
-use App\Jobs\OrderCreateWaybill;
-use App\Jobs\SettlementBillReportJob;
-use App\Jobs\StoreCreateInstantBill;
-use App\Jobs\TestJob;
-use App\Jobs\WeightUpdateInstantBill;
-use App\LaborCompanyDispatch;
-use App\LaborReport;
-use App\LaborReportStatus;
-use App\Logistic;
 use App\MaterialBox;
 use App\MaterialBoxModel;
-use App\Notifications\RoutineNotification;
-use App\Observers\WaybillObserver;
-use App\OracleDOCASNDetail;
-use App\OracleDOCASNHeader;
-use App\OracleDOCOrderHeader;
-use App\OracleDocOrderPackingSummary;
-use App\OracleDOCWaveDetails;
-use App\Order;
-use App\OrderBin;
-use App\OrderCommodity;
-use App\OrderIssue;
-use App\OrderIssueProcessLog;
-use App\OrderIssueType;
-use App\OrderPackage;
-use App\Owner;
-use App\OwnerAreaReport;
-use App\OwnerBillReport;
-use App\OwnerFeeDetail;
-use App\OwnerFeeDetailLogistic;
-use App\OwnerFeeExpress;
-use App\OwnerFeeLogistic;
-use App\OwnerFeeOperation;
-use App\OwnerFeeOperationDetail;
-use App\OwnerFeeStorage;
-use App\OwnerPriceExpress;
-use App\OwnerPriceOperation;
-use App\OrderPackageCountingRecord;
-use App\OwnerReport;
-use App\ProcurementCheckSheet;
-use App\ProcurementDeliverie;
-use App\ReceiveRecord;
-use App\RejectedBill;
-use App\SeeLog;
-use App\Services\AndroidInventoryService;
-use App\Services\AuthorityService;
-use App\Services\BatchService;
-use App\Services\CacheShelfService;
-use App\Services\common\BatchUpdateService;
-use App\Services\ForeignHaiRoboticsService;
-use App\Services\ForeignZhenCangService;
-use App\Services\LogisticService;
-use App\Services\LogService;
-use App\Services\MenuService;
-use App\Services\NotificationService;
-use App\Services\OracleDOCOrderHeaderService;
-use App\Services\OrderPackageCommoditiesService;
-use App\Services\OrderPackageReceivedSyncService;
-use App\Services\OrderPackageService;
-use App\Services\OrderService;
-use App\Services\OrderTrackingService;
-use App\Services\OwnerFeeTotalService;
-use App\Services\OwnerLogisticFeeReportService;
-use App\Services\OwnerPriceOperationService;
-use App\Services\OwnerService;
-use App\Services\OwnerStoreFeeReportService;
-use App\Services\OwnerStoreOutFeeReportService;
-use App\Services\ReplenishmentService;
-use App\Services\ReviewService;
-use App\Services\StationService;
-use App\Services\StorageService;
-use App\Services\StoreItemService;
-use App\Services\StoreService;
-use App\Services\SyriusTaskService;
-use App\Services\UserService;
-use App\Services\WorkOrderService;
-use App\SortingStation;
-use App\Station;
-use App\StationTask;
-use App\StationTaskMaterialBox;
-use App\Store;
-use App\StoreItem;
-use App\TaskTransaction;
-use App\Unit;
+use App\Services\RejectedService;
 use App\User;
-use App\UserDetail;
-use App\UserDutyCheck;
-use App\ValueStore;
 use App\Waybill;
-use App\WorkOrder;
-use App\WorkOrderCommodities;
-use App\WorkOrderDetail;
-use App\WorkOrderImage;
-use App\WorkOrderLog;
-use Carbon\Carbon;
-use Carbon\CarbonPeriod;
-use Decimal\Decimal;
-use Doctrine\DBAL\Driver\AbstractDB2Driver;
-use Doctrine\DBAL\Exception;
-use Firebase\JWT\ExpiredException;
-use Firebase\JWT\JWT;
-use Illuminate\Database\Eloquent\Builder;
-use Illuminate\Database\Eloquent\Collection;
-use Illuminate\Database\Eloquent\HigherOrderBuilderProxy;
-use Illuminate\Database\QueryException;
-use Illuminate\Foundation\Http\FormRequest;
 use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Broadcast;
-use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\Cookie;
 use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Log;
-use Illuminate\Support\Facades\Notification;
-use Illuminate\Support\Facades\URL;
-use Illuminate\Support\Facades\Validator;
-use Illuminate\Support\Str;
-use Laravel\Horizon\Events\JobFailed;
-use Monolog\Handler\IFTTTHandler;
-use phpDocumentor\Reflection\Types\Resource_;
-use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
-use PhpParser\Node\Stmt\DeclareDeclare;
-use Ramsey\Uuid\Uuid;
-use Symfony\Component\ErrorHandler\Error\FatalError;
 
 class TestController extends Controller
 {
@@ -175,11 +33,14 @@ class TestController extends Controller
             dd("方法不存在");
         }
     }
-
-    public function test1(\Closure $c,string $a){
-        dd($c($a));
+    public function test(Request $request)
+    {
+        dd(1);
+        Log::error(json_encode($request->header(),JSON_UNESCAPED_UNICODE));
+        return json_encode($request->header(),JSON_UNESCAPED_UNICODE);
     }
-    private function paramDefault(&$waybill):array
+
+    private function paramDefault($waybill):array
     {
         $update = [];
         if (!$waybill->order_type){
@@ -200,7 +61,7 @@ class TestController extends Controller
         if (!$waybill->package_service){
             $update["package_service"] = $waybill->package_service = '托膜';
         }
-        if (!$waybill->deliveryType){
+        if (!$waybill->deliveryType_id){
             $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
         }
         if (!$waybill->pay_type){
@@ -209,102 +70,7 @@ class TestController extends Controller
         if (!$waybill->back_sign_bill){
             $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
         }
-        return $update;
+        return array($update,$waybill);
     }
-    public function test(Request $request)
-    {
-        $s = new AuthorityService();$s->removeAdminAuth();
-        dd(1);
-        $c = "test";
-        $a = function ($b)use($c){
-            return $b.$c;
-        };
-        $this->test1($a,"a");
-        dd(2);
-        $w = Waybill::query()->get();
-        foreach ($w->chunk(50) as $a){
-            dd($a);
-        }
-        $path = '';
-        $id = 252;
-
-        $file = fopen($path, "r");
-        $user=array();
-        $i=0;
-        //输出文本中所有的行,直到文件结束为止。
-        while(! feof($file)){
-            $user[$i]= trim(fgets($file));//fgets()函数从文件指针中读取一行
-            $i++;
-        }
-        fclose($file);
-        foreach ($user as $item){
-            $arr = explode(",",$item);
-            if (count($arr)!=2){
-                dump($item);
-                continue;
-            }
-            DB::table("details")->insert([
-                "name" => $arr[0],
-                "size" => $arr[1],
-                "created_at" => date("Y-m-d H:i:s"),
-                "updated_at" => date("Y-m-d H:i:s"),
-                "header_id" => $id
-            ]);
-        }
-    }
-
-    public function test123(){
-        $rejected_bill = RejectedBill::query()->find(2);
-        $service = new WorkOrderService();
-        $service->syncWorkOrder($rejected_bill);
-    }
-
-
-    public function assignBatch($code)
-    {
-        $batches = Batch::query()->where("code",$code)->get();
-        if (!$batches->count()){
-            $wave = DB::connection("oracle")->selectOne(DB::raw("select * from DOC_WAVE_HEADER where WAVENO = ?"),[$code]);
-            if (!$wave){
-                dd("FLUX无波次");
-            }
-            $owner = app("OwnerService")->codeGetOwner($wave->customerid);
-            $obj = [
-                "wms_status" => $this->wms_status($wave),
-                "wms_type"=>$wave->descr,
-                "created_at"=>date("Y-m-d H:i:s"),
-                "wms_created_at"=>$wave->addtime,
-                "updated_at"=>$wave->edittime,
-                "owner_id"=>$owner->id,
-            ];
-            $wave = Batch::query()->where("code",$code)->first();
-            if (!$wave){
-                $obj["code"] = $code;
-                $wave = Batch::query()->create($obj);
-            }else{
-                Batch::query()->where("code",$code)->update($obj);
-            }
-            $ordernos = array_column(DB::connection("oracle")->select(DB::raw("select orderno from DOC_WAVE_DETAILS where WAVENO = ?"),[$code]),"orderno");
-            Order::query()->whereIn("code",$ordernos)->update([
-                "batch_id"=>$wave->id
-            ]);
-            Order::query()->with(["batch","bin"])->whereIn("code",$ordernos)->get()->each(function ($order){
-                if (!$order->bin){
-                    $bin = DB::connection("oracle")->selectOne(DB::raw("select seqno from DOC_WAVE_DETAILS where waveno = ? and orderno = ?"),[$order->batch->code,$order->code]);
-                    if ($bin){
-                        OrderBin::query()->create([
-                            'order_id' => $order->id,
-                            'number' => $bin->seqno,
-                        ]);
-                    }
-                }
-            });
-            $batches = Batch::query()->where("code",$code)->get();
-        }
-        app("BatchService")->assignTasks($batches);
-    }
-
-
-
 }
 

+ 5 - 4
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -98,13 +98,16 @@ class WaybillController extends Controller
                 $unit=Unit::query()->where('name','kg')->first();
                 if ($unit)$waybill->warehouse_weight_unit_id_other=$unit->id;
             }
+            $waybill->save();
             if ($waybill->wms_bill_number){
                 $notes = DB::connection("oracle")->selectOne(DB::raw("SELECT notes FROM DOC_ORDER_HEADER WHERE ORDERNO = ?"),[$waybill->wms_bill_number]);
                 if ($notes)$waybill->ordering_remark = $notes->notes;
                 $order = app("OrderService")->first(["code"=>$waybill->wms_bill_number]);
-                if ($order)$waybill->order_id = $order->id;
+                if ($order){
+                    $waybill->order_id = $order->id;
+                    app("WaybillService")->autoGetDBBill($waybill);
+                }
             }
-            $waybill->save();
             WaybillAuditLog::query()->create([
                 'waybill_id'=>$waybill->id,
                 'audit_stage'=>'创建',
@@ -130,8 +133,6 @@ class WaybillController extends Controller
         }
         return response()->json(['response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000','returnDesc'=>'正确接收','resultInfo'=>'']]])
             ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
-
-
     }
 
     protected function validatorForNew(array $data)

+ 61 - 0
app/Http/Requests/Api/ReceivingTaskRequest.php

@@ -0,0 +1,61 @@
+<?php
+
+namespace App\Http\Requests\Api;
+
+use App\Traits\RequestApiFormValidation;
+use Illuminate\Foundation\Http\FormRequest;
+
+class ReceivingTaskRequest extends FormRequest
+{
+    use RequestApiFormValidation;
+
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+            'warehouse_id' => 'required',
+            'owner_id' => 'required',
+            'appointment_number' => ['required'],
+            'driver_name' => 'required',
+            'driver_phone' => 'required',
+            'for_single_member' => 'required',
+            'provide_list' => 'required',
+            'receiving_type' => 'required',
+            'driving_license_image' => 'required|image',
+            'asn_nos' => 'required|array'
+        ];
+    }
+
+    public function messages(): array
+    {
+        return [
+            'warehouse_id.required' => "仓库为必选项",
+            'owner_id.required' => "货主为必选",
+            'appointment_number.exists' => "预约单号不存在",
+            'appointment_number.required' => "预约单号不能为空",
+            'driver_name.required' => "司机不能为空",
+            'driver_phone.required' => "司机联系号码不能为空",
+            'for_single_member.required' => "投单员不能为空",
+            'provide_list.required' => "选择是否提供清单",
+            'receiving_type.required' => "收货类型为必选项",
+            'driving_license_image.required' => "驾驶证扫描件不能为空",
+            'driving_license_image.image' => "驾驶证扫描件格式错误",
+            'asn_nos.required' => "勾选入库单",
+            'asn_nos.array' => "入库单号参数类型错误"
+        ];
+    }
+}

+ 2 - 17
app/Jobs/PackageCollectingAllocation.php

@@ -37,23 +37,8 @@ class PackageCollectingAllocation implements ShouldQueue
     {
         /** @var OrderPackageService $orderPackageService */
         $orderPackageService = app('OrderPackageService');
-        DB::beginTransaction();
-        try {
-            $result = OrderPackage::query()->where("id",$this->orderPackage->id)
-                ->where("collecting_status",0)->update(["collecting_status"=>1]);
-            if ($result==1){
-                $result = $orderPackageService->collectUpload([$this->orderPackage->logistic_number]);
-                if (!$result["success"]){
-                    DB::rollBack();
-                    Log::warning("自动揽收失败",["message"=>$result["message"],"param"=>$this->orderPackage->logistic_number]);
-                    return;
-                }
-            }else Log::warning("自动揽收异常",["message"=>"未能成功修改揽收标记","param"=>["id"=>$this->orderPackage->id,
-                "number"=>$this->orderPackage->logistic_number],"line"=>$result]);
-            DB::commit();
-        }catch (\Exception $e){
-            DB::rollBack();
-            Log::warning("自动揽收错误",["param"=>$this->orderPackage->toJson()]);
+        if (OrderPackage::query()->selectRaw('1')->where('logistic_number',$this->orderPackage->logistic_number)->where('collecting_status',0)->first()){
+            $orderPackageService->collectUpload([$this->orderPackage->logistic_number]);
         }
     }
 }

+ 0 - 79
app/Observers/WaybillObserver.php

@@ -1,79 +0,0 @@
-<?php
-
-namespace App\Observers;
-
-use App\Waybill;
-use Illuminate\Support\Facades\Log;
-
-class WaybillObserver
-{
-    /**
-     * 监听插入事件
-     *
-     * @param Waybill|\stdClass $waybill
-     * @return void
-     */
-    public function created(Waybill $waybill)
-    {
-        if(config('app.env')!='production')return;
-        if ($waybill->type=='德邦物流'){
-            if ($waybill->carrier_bill)return;
-            $waybill->load("order");
-            if (!$waybill->order){
-                Log::error("德邦单号获取失败",["no"=>$waybill->waybill_number,"info"=>"运单无绑定订单"]);
-                return;
-            }
-            $update = $this->paramDefault($waybill);
-            $waybill->update($update);
-            $bill = app('DbOpenService')->getDbOrderNo($waybill);
-            if (!$bill || $bill["result"]=="false"){
-                Log::error("德邦单号获取失败",["no"=>$waybill->toArray(),"info"=>$bill]);
-                return;
-            }
-            $waybill->update([
-                "carrier_bill"=>$bill['mailNo'],
-                "waybill_number"=>$bill['mailNo'],
-                "station_no"=>$bill['stationNo'],
-                "arrived_org_simple_name"=>$bill['arrivedOrgSimpleName'],
-                "much_higher_delivery"=>$bill['muchHigherDelivery'],
-            ]);
-            if (!app("WaybillService")->notifyFlux($waybill)){
-                Log::error("德邦单号回传FLUX失败",["no"=>$waybill->waybill_number,"info"=>$bill]);
-                return;
-            }
-        }
-    }
-
-    private function paramDefault(&$waybill):array
-    {
-        $update = [];
-        if (!$waybill->order_type){
-            $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT;
-        }
-        if (!$waybill->transport_type){
-            $update["transport_type"] = $waybill->transport_type = "JZKH";
-        }
-        if (!$waybill->cargo_name){
-            $update["cargo_name"] = $waybill->cargo_name = "补货";
-        }
-        if (!$waybill->total_number){
-            $update["total_number"] = $waybill->total_number = 1;
-        }
-        if (!$waybill->total_weight){
-            $update["total_weight"] = $waybill->total_weight = 1;
-        }
-        if (!$waybill->package_service){
-            $update["package_service"] = $waybill->package_service = '托膜';
-        }
-        if (!$waybill->deliveryType){
-            $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
-        }
-        if (!$waybill->pay_type){
-            $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT;
-        }
-        if (!$waybill->back_sign_bill){
-            $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
-        }
-        return $update;
-    }
-}

+ 1 - 1
app/OracleDOCASNDetail.php

@@ -33,7 +33,7 @@ class OracleDOCASNDetail extends Model
     public function basSku()
     {
         return $this->hasOne(OracleBasSKU::class,['customerid','sku'],['customerid','sku'])
-            ->select('customerid','sku','lotid','alternate_sku1','alternate_sku2','alternate_sku3');
+            ->select('customerid','sku','lotid','alternate_sku1','alternate_sku2','alternate_sku3','descr_c');
 
     }
 }

+ 11 - 3
app/OracleDOCASNHeader.php

@@ -5,6 +5,8 @@ namespace App;
 use App\Traits\ModelTimeFormat;
 use Illuminate\Database\Eloquent\Model;
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Database\Eloquent\Relations\HasOne;
 
 class OracleDOCASNHeader extends Model
 {
@@ -14,19 +16,25 @@ class OracleDOCASNHeader extends Model
     protected $connection="oracle";
     protected $table="Doc_ASN_Header";
 
-    public function asnType()
+    public function asnType(): HasOne
     {
         return $this->hasOne(OracleBasCode::class,'code','asntype')
             ->where('codeid','ASN_TYP');
     }
 
-    public function asnStatus()
+    public function asnStatus(): HasOne
     {
         return $this->hasOne(OracleBasCode::class,'code','asnstatus')
             ->where('codeid','ASN_STS');
     }
 
-    public function asnDetails()
+    public function basCustomer(): HasOne
+    {
+        return $this->hasOne(OracleBasCustomer::class,'customerid','customerid')
+            ->where('customer_type','OW');
+    }
+
+    public function asnDetails(): HasMany
     {
         return $this->hasMany(OracleDOCASNDetail::class,'asnno','asnno')
             ->select('asnno','asnlineno','customerid','sku','skudescrc','linestatus','lotatt08','lotatt05','receivedqty','receivedqty_each','expectedqty','addtime','edittime');

+ 0 - 12
app/OrderPackage.php

@@ -216,21 +216,12 @@ class OrderPackage extends Model
     public function fetchAllFromOracle()
     {
         if (empty($this->oracleInfo)) return null;
-        /*        $this->fetchOwnerFromOracle();
-                $this->fetchLogisticFromOracle();*/
-        /*        $this['recipient'] = $this->oracleInfo['consigneename'];
-                $this['order_code'] = $this->oracleInfo['orderno'];*/
         $this['batch_rule'] = $this->oracleInfo['descr'];
-        /*        $this['recipient_mobile'] = $this->oracleInfo['c_tel2']??$this->oracleInfo['c_tel1'];
-                if(!$this['logistic_number']&&$this->oracleInfo['soreference5'])
-                    $this['logistic_number'] = $this->oracleInfo['soreference5'];*/
         $this['batch_number'] = $this->oracleInfo['waveno'] ?? null;
     }
 
     static public function createPackagesFromBatchCode($batchCode, $weight)
     {
-
-
         $queryBuilder = OracleDOCOrderHeader::query()->select(self::$oracleOrderHeaderFields);
         $queryBuilder->where('doc_order_header.waveno', $batchCode);
         $queryBuilder->leftJoin('act_allocation_details', 'act_allocation_details.orderno', 'doc_order_header.orderno');
@@ -281,9 +272,6 @@ class OrderPackage extends Model
         DB::transaction(function () use ($newPackages) {
             OrderPackage::query()->insert($newPackages);
         });
-
-
-        app('LogService')->log(__METHOD__, "批量录入包裹成功", json_encode($packages), Auth::user()['id']);
     }
 
     public function unifyThisMeasureUnderSameBatch()

+ 5 - 3
app/Providers/AppServiceProvider.php

@@ -9,7 +9,6 @@ use App\Observers\AuthorityObserver;
 use App\Observers\MenuObserver;
 use App\Observers\OwnerObserver;
 use App\Observers\UserWorkGroupObserver;
-use App\Observers\WaybillObserver;
 use App\Owner;
 use App\Services\AuthorityService;
 use App\Services\BatchService;
@@ -205,6 +204,8 @@ use App\Services\WorkOrderDamageService;
 use App\Services\WorkOrderLossService;
 use App\Services\AndroidInventoryService;
 use App\Services\WorkOrderCancelInterceptService;
+use App\Services\ReceivingTaskService;
+use App\Services\ReceivingTaskItemService;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -233,7 +234,6 @@ class AppServiceProvider extends ServiceProvider
 
     private function loadingService(){
         app()->singleton('AllInventoryService',AllInventoryService::class);
-        app()->singleton('InventoryAccountService',InventoryAccountService::class);
         app()->singleton('AndroidInventoryService',AndroidInventoryService::class);
         app()->singleton('AuthorityService',AuthorityService::class);
         app()->singleton('BatchService',BatchService::class);
@@ -269,6 +269,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('HengLiWeightService',HengLiWeightService::class);
         app()->singleton('InventoryAccountMissionService', InventoryAccountMissionService::class);
         app()->singleton('InventoryAccountMissionService',InventoryAccountMissionService::class);
+        app()->singleton('InventoryAccountService',InventoryAccountService::class);
         app()->singleton('InventoryCompareService', InventoryCompareService::class);
         app()->singleton('InventoryDailyLogService', InventoryDailyLogService::class);
         app()->singleton('JDDeliveryService',JDDeliveryService::class);
@@ -360,6 +361,8 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('ProcurementWeiXinSendMessageService', ProcurementWeiXinSendMessageService::class);
         app()->singleton('ProvinceService', ProvinceService::class);
         app()->singleton('RealtimePendingOrdersService', RealtimePendingOrdersService::class);
+        app()->singleton('ReceivingTaskItemService',ReceivingTaskItemService::class);
+        app()->singleton('ReceivingTaskService',ReceivingTaskService::class);
         app()->singleton('RegionService', RegionService::class);
         app()->singleton('RejectedBillItemService', RejectedBillItemService::class);
         app()->singleton('RejectedBillService', RejectedBillService::class);
@@ -424,7 +427,6 @@ class AppServiceProvider extends ServiceProvider
     private function registerObserver()
     {
         Owner::observe(OwnerObserver::class);
-        Waybill::observe(WaybillObserver::class);
         UserWorkgroup::observe(UserWorkGroupObserver::class);
         Menu::observe(MenuObserver::class);
         Authority::observe(AuthorityObserver::class);

+ 69 - 0
app/ReceivingTask.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Database\Eloquent\Relations\HasOne;
+
+class ReceivingTask extends Model
+{
+    use ModelTimeFormat;
+
+    protected $fillable = [
+        'number',
+        'warehouse_id',
+        'owner_id',
+        'delivery_appointment_car_id',
+        'user_id',
+        'driver_name',
+        'driver_phone',
+        "for_single_member",
+        'plate_number',
+        'driving_license_no',
+        'logistics_single_number',
+        'provide_list',
+        'receiving_type',
+        'status',
+    ];
+
+    public function scopeFilter($query, $filters)
+    {
+        return $filters->apply($query);
+    }
+
+    public function wareHouse(): BelongsTo
+    {
+        return $this->belongsTo(Warehouse::class,'warehouse_id','id');
+    }
+
+    public function owner(): BelongsTo
+    {
+        return $this->belongsTo(Owner::class);
+    }
+
+    public function user(): BelongsTo
+    {
+        return $this->belongsTo(User::class);
+    }
+
+    public function deliveryAppointmentCar(): BelongsTo
+    {
+        return $this->belongsTo(DeliveryAppointmentCar::class);
+    }
+
+    public function items(): HasMany
+    {
+        return $this->hasMany(ReceivingTaskItem::class);
+    }
+
+    public function file(): HasOne
+    {
+        return $this->hasOne(UploadFile::class,'table_id','id')->where('table_name','receiving_tasks');
+    }
+
+
+}

+ 27 - 0
app/ReceivingTaskItem.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasOne;
+
+class ReceivingTaskItem extends Model
+{
+
+    protected $fillable = [
+        'receiving_task_id','asn_no',
+    ];
+
+    public function receivingTask(): BelongsTo
+    {
+        return $this->belongsTo(ReceivingTask::class);
+    }
+
+    public function docASNHeader(): HasOne
+    {
+        return $this->hasOne(OracleDOCASNHeader::class,'asn_no','asnno');
+    }
+
+}

+ 7 - 0
app/Services/AuthorityService.php

@@ -12,6 +12,8 @@ use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use App\Traits\ServiceAppAop;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Gate;
+
 
 
 class AuthorityService
@@ -149,4 +151,9 @@ class AuthorityService
             });
         })->orWhereIn("name",config("users.superAdmin"))->get();
     }
+
+    public function checkAllOwner(): bool
+    {
+        return Gate::allows("货主-可见全部");
+    }
 }

+ 14 - 0
app/Services/BatchService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 use App\Batch;
 use App\Events\BroadcastToStation;
 use App\Exceptions\ErrorException;
+use App\Http\Controllers\api\thirdPart\haochuang\SortingController;
 use App\Jobs\BatchTaskJob;
 use App\OracleActAllocationDetails;
 use App\Order;
@@ -184,4 +185,17 @@ class BatchService
         }
         return true;
     }
+
+    public function assignBatch($code)
+    {
+        $batches = Batch::query()->where("code",$code)->get();
+        if (!$batches->count()){
+            $s = new SortingController();
+            $s->syncOrderBin($code);
+            $batches = Batch::query()->where("code",$code)->get();
+        }
+        if ($batches->count()>0){
+            app("BatchService")->assignTasks($batches);
+        }
+    }
 }

+ 2 - 6
app/Services/DbOpenService.php

@@ -22,10 +22,6 @@ class DbOpenService
      */
     public function getDbOrderNo($waybill):?array
     {
-        $waybill->loadCount(["waybillAuditLogs"=>function($query){
-            $query->where("audit_stage","发起德邦调度");
-        }]);
-        if ($waybill->waybill_audit_logs_count>0)return null;
         $header = [
             'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8',
             "Accept" => "application/json"
@@ -75,7 +71,7 @@ class DbOpenService
     private function formatWaybillData($waybill):array
     {
         $waybill->loadMissing([
-            "order.shop","owner","order.warehouse.province","order.warehouse.city","order.warehouse.county","deliveryType"
+            "order.shop","owner","order.warehouse.province","order.warehouse.city","order.warehouse.county"
         ]);
         $date = date('Y-m-d H:i:s', $waybill->deliver_at ? strtotime($waybill->deliver_at) : now()->getTimestamp());
         $data =  [
@@ -116,7 +112,7 @@ class DbOpenService
                 'totalWeight'       => $waybill->total_weight ?? '',
                 'totalVolume'       => '',
                 'packageService'    => $waybill->package_service ?? '',
-                'deliveryType'      => $waybill->deliveryType->id ?? ''
+                'deliveryType'      => $waybill->deliveryType_id,
             ],
             'gmtCommit'     =>  $date,
             'payType'       =>  $waybill->pay_type,

+ 4 - 0
app/Services/OracleDocAsnDetailService.php

@@ -3,7 +3,9 @@
 namespace App\Services;
 
 use App\OracleDOCASNDetail;
+use App\OracleDOCASNHeader;
 use App\Traits\ServiceAppAop;
+use Illuminate\Database\Eloquent\Builder;
 
 
 class OracleDocAsnDetailService
@@ -40,4 +42,6 @@ class OracleDocAsnDetailService
         }
         return $query->get();
     }
+
+
 }

+ 23 - 2
app/Services/OracleDocAsnHerderService.php

@@ -9,6 +9,7 @@ use App\Traits\ServiceAppAop;
 class OracleDocAsnHerderService
 {
     use ServiceAppAop;
+
 //    protected $modelClass=OracleDocAsnHerder::class;
 
     public function getWmsAsnOnStartDateCreate($startDate)
@@ -16,7 +17,7 @@ class OracleDocAsnHerderService
         if (!$startDate) return null;
         return OracleDOCASNHeader::query()
             ->with(['asnType', 'asnStatus'])
-            ->select('asnno','asnstatus','asntype','addtime','edittime','customerid','notes','warehouseid','asnreference3','asnreference2')
+            ->select('asnno', 'asnstatus', 'asntype', 'addtime', 'edittime', 'customerid', 'notes', 'warehouseid', 'asnreference3', 'asnreference2')
             ->where('addTime', '>=', $startDate)
             ->whereColumn('edittime', '=', 'addTime')
             ->orderByDesc('addtime')
@@ -28,11 +29,31 @@ class OracleDocAsnHerderService
         if (!$startDate) return null;
         return OracleDOCASNHeader::query()
             ->with(['asnType', 'asnStatus'])
-            ->select('asnno','asnstatus','asntype','addtime','edittime','customerid','notes','warehouseid','asnreference3','asnreference2')
+            ->select('asnno', 'asnstatus', 'asntype', 'addtime', 'edittime', 'customerid', 'notes', 'warehouseid', 'asnreference3', 'asnreference2')
             ->where('EditTime', '>=', $startDate)
             ->whereColumn('EditTime', '<>', 'addTime')
             ->orderByDesc('EditTime')
             ->get();
     }
 
+    public function getToBeProcessAsnDetailsByCustomId($customId,$page = 1, $perGage= 20)
+    {
+        return OracleDOCASNHeader::query()
+            ->with(['asnType', 'asnStatus', 'basCustomer','asnDetails' => function ($query) {
+                $query->with(['lineStatus', 'qualityStatus', 'basSku']);
+            }])
+            ->whereIn("AsnStatus", ['00', '30'])
+            ->where('CustomerId', $customId)->orderByDesc('addtime')->forPage($page,$perGage)->get();
+    }
+
+    public function getToBeProcessAsnCountByCustomId($customId): int
+    {
+        return OracleDOCASNHeader::query()
+            ->with(['asnType', 'asnStatus', 'basCustomer','asnDetails' => function ($query) {
+                $query->with(['lineStatus', 'qualityStatus', 'basSku']);
+            }])
+            ->whereIn("AsnStatus", ['00', '30'])
+            ->where('CustomerId', $customId)->count();
+    }
+
 }

+ 6 - 5
app/Services/OrderService.php

@@ -327,19 +327,19 @@ SQL;
             else return null;
         }
         $sql = "SELECT * FROM (select ACT_ALLOCATION_DETAILS.CHECKTIME,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.MANUALFLAG,DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,DOC_ORDER_HEADER.CustomerID as header_customer_id
-        ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.IssuePartyName,DOC_ORDER_HEADER.EDIREMARKS2,
+        ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,logistic.descr_c as CarrierName,DOC_ORDER_HEADER.IssuePartyName,DOC_ORDER_HEADER.EDIREMARKS2,
        DOC_ORDER_HEADER.WaveNo,DOC_ORDER_HEADER.SOReference1, DOC_ORDER_HEADER.SOREFERENCE5 as code5
         ,NVL(ACT_ALLOCATION_DETAILS.PICKTOTRACEID,DOC_ORDER_HEADER.soreference5) as soreference5,DOC_ORDER_HEADER.EDISENDFLAG2,DOC_ORDER_HEADER.EDISendTime2,DOC_ORDER_HEADER.Notes,DOC_ORDER_HEADER.ERPCANCELFLAG,
        DOC_ORDER_HEADER.Picking_Print_Flag,DOC_ORDER_HEADER.EDISENDFLAG
         ,DOC_ORDER_HEADER.ReleaseStatus,DOC_ORDER_HEADER.C_Address1,DOC_ORDER_HEADER.OrderTime,DOC_Order_Details.CustomerID,
        DOC_Order_Details.SKU,DOC_Order_Details.QtyOrdered,DOC_Order_Details.LOTNUM,DOC_Order_Details.LineStatus,DOC_Order_Details.OrderLineNo,order_code.codename_c as orderCodeName,
-       order_detail_code.codename_c as orderDetailCodeName,BAS_Customer.descr_c as customer_descr_c,
+       order_detail_code.codename_c as orderDetailCodeName,owner.descr_c as customer_descr_c,
        BAS_SKU.Alternate_SKU1,BAS_SKU.Descr_C,(select count(*) from DOC_ORDER_HEADER WHERE 1=1";
         $sql = $this->preciseQuery($params, $sql);;
         $sql .= " ) as counted from (";
         if ($paginate && $page) $sql .= " select * from (";
         $sql .= " select ROWNUM as rn,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.MANUALFLAG,DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,DOC_ORDER_HEADER.CustomerID
-                          ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.IssuePartyName,
+                          ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.USERDEFINE1,DOC_ORDER_HEADER.IssuePartyName,
                          DOC_ORDER_HEADER.WaveNo,DOC_ORDER_HEADER.SOReference1
                           ,DOC_ORDER_HEADER.soreference5,nvl( DOC_ORDER_HEADER.EDISENDFLAG2, DOC_ORDER_HEADER.edisendflag3 ) as EDISENDFLAG2,nvl( DOC_ORDER_HEADER.EDISendTime2, DOC_ORDER_HEADER.EDISENDTIME3 ) EDISendTime2,DOC_ORDER_HEADER.Notes,DOC_ORDER_HEADER.ERPCANCELFLAG,
                          DOC_ORDER_HEADER.Picking_Print_Flag,DOC_ORDER_HEADER.EDISENDFLAG
@@ -365,7 +365,8 @@ SQL;
         $sql .= ")DOC_ORDER_HEADER left join DOC_ORDER_DETAILS on DOC_ORDER_DETAILS.ORDERNO=DOC_ORDER_HEADER.ORDERNO
                       left join BAS_CODES  order_code on order_code.CODE=DOC_ORDER_HEADER.sostatus and order_code.codeid='SO_STS'
                       left join BAS_CODES  order_detail_code on order_detail_code.CODE=DOC_ORDER_DETAILS.linestatus and order_detail_code.codeid='SO_STS'
-                      left join BAS_Customer on BAS_Customer.customerid=DOC_ORDER_HEADER.customerid
+                      left join BAS_Customer owner on owner.customerid=DOC_ORDER_HEADER.customerid
+                      left join BAS_Customer logistic on logistic.customerid=DOC_ORDER_HEADER.USERDEFINE1
                       left join  BAS_SKU on DOC_Order_Details.CustomerID=BAS_SKU.CustomerID and DOC_Order_Details.SKU=BAS_SKU.SKU
                       left join  ACT_ALLOCATION_DETAILS on DOC_Order_Details.orderno = ACT_ALLOCATION_DETAILS.orderno
                       and DOC_Order_Details.ORDERLINENO = ACT_ALLOCATION_DETAILS.ORDERLINENO
@@ -376,7 +377,7 @@ SQL;
                       DOC_ORDER_HEADER.EDISENDFLAG2,DOC_ORDER_HEADER.EDISendTime2,DOC_ORDER_HEADER.Notes,DOC_ORDER_HEADER.ERPCANCELFLAG,
                       DOC_ORDER_HEADER.Picking_Print_Flag,DOC_ORDER_HEADER.EDISENDFLAG,DOC_ORDER_HEADER.ReleaseStatus,DOC_ORDER_HEADER.C_Address1,
                       DOC_ORDER_HEADER.OrderTime,DOC_Order_Details.CustomerID,DOC_Order_Details.SKU,DOC_Order_Details.QtyOrdered,DOC_Order_Details.LOTNUM,
-                      DOC_Order_Details.LineStatus,DOC_Order_Details.OrderLineNo,order_code.codename_c,order_detail_code.codename_c,BAS_Customer.descr_c,
+                      DOC_Order_Details.LineStatus,DOC_Order_Details.OrderLineNo,order_code.codename_c,order_detail_code.codename_c,owner.descr_c,logistic.descr_c,
                       BAS_SKU.Alternate_SKU1,BAS_SKU.Descr_C ORDER BY DOC_ORDER_HEADER.ADDTIME desc)";
         return $sql;
 

+ 1 - 1
app/Services/OwnerService.php

@@ -582,7 +582,7 @@ sql;
     {
         if (!$userId)$userId = Auth::id();
         $query = Owner::query()->select("owners.id");
-        if (!app("UserService")->checkAdminIdentity($userId)){
+        if (!app("UserService")->checkAdminIdentity($userId) && !app("AuthorityService")->checkAllOwner()){
             $query->whereHas("roles",function ($query)use($userId){
                 $query->whereHas("users",function ($query)use($userId){
                     $query->where("users.id",$userId);

+ 27 - 0
app/Services/ReceivingTaskItemService.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Services;
+
+use App\ReceivingTask;
+use App\Traits\ServiceAppAop;
+use App\ReceivingTaskItem;
+
+class ReceivingTaskItemService
+{
+    use ServiceAppAop;
+
+    protected $modelClass = ReceivingTaskItem::class;
+
+    public function createItems($task, $asn_nos)
+    {
+        if (is_array($asn_nos)) {
+            foreach ($asn_nos as $no) {
+                $task->items()->create(['asn_no' => $no]);
+            }
+        } else if (is_string($asn_nos)){
+            $task->items()->create(['asn_no' => $asn_nos]);
+        }
+
+    }
+
+}

+ 135 - 0
app/Services/ReceivingTaskService.php

@@ -0,0 +1,135 @@
+<?php
+
+namespace App\Services;
+
+use App\DeliveryAppointmentCar;
+use App\Traits\ServiceAppAop;
+use App\ReceivingTask;
+use App\Utils\IdCreate;
+use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
+use Ramsey\Uuid\Uuid;
+
+class ReceivingTaskService
+{
+    use ServiceAppAop;
+
+    protected $modelClass = ReceivingTask::class;
+
+    private $itemService;
+
+    public function __construct()
+    {
+        $this->itemService =app(ReceivingTaskItemService::class);
+    }
+
+    // 完结工单
+    public function endTask($receivingTaskNumber)
+    {
+        ReceivingTask::query()->where('number', $receivingTaskNumber)->update(['status' => '完成','end_at' => now()]);
+    }
+
+    // 延时完成
+    public function overtimeToComplete($receivingTaskNumber)
+    {
+        ReceivingTask::query()->where('number', $receivingTaskNumber)->update(['status' => '延时完结']);
+    }
+
+    // 标记任务进行中
+    public function executionTask($receivingTaskNumber)
+    {
+        ReceivingTask::query()->where('number', $receivingTaskNumber)->update(['status' => '进行中']);
+    }
+
+    /**
+     * 生成入库任务号
+     * @param DeliveryAppointmentCar $deliveryAppointmentCar
+     * @param $params
+     * @return ReceivingTask
+     */
+    public function createReceivingTask(DeliveryAppointmentCar $deliveryAppointmentCar, $params): ReceivingTask
+    {
+        // 生成入库任务号
+        $task_number = $this->buildTaskNumber();
+        $params['number'] = $task_number;
+        $params['delivery_appointment_car_id'] = $deliveryAppointmentCar->id;         // 预约号
+        $params['user_id'] = Auth::user()->id;
+        $receivingTask = new ReceivingTask($params);
+        DB::transaction(function () use ($deliveryAppointmentCar, $params, &$receivingTask) {
+            $receivingTask->save();
+            if ($receivingTask->id) {
+                try {
+                    $this->itemService->createItems($receivingTask,$params['asn_nos'] ?? []);
+                    $this->saveImage($receivingTask, $params['driving_license_image']);
+                    DB::commit();
+                } catch (\Exception $e) {
+                    DB::rollBack();
+                }
+            }
+        });
+        return $receivingTask;
+    }
+
+    // 保存图片
+    public function saveImage(ReceivingTask $receivingTask, $image): bool
+    {
+        if (!$this->checkImage($image)) return false;
+        $tmpFile = $image->getRealPath();
+        $fileSuffix = $image->getClientOriginalExtension();
+        $dirPath = $this->getStorageDirPath();
+        $fileName = date('ymd') . '-' . Uuid::uuid1();
+        $pathName = $dirPath . $fileName . '.' . $fileSuffix;
+        $result = move_uploaded_file($tmpFile, $pathName);
+        if (!$result) return false;
+        $receivingTask->file()->create(
+            ['url' => '/files/receivingTask/' . $fileName, 'type' => $fileSuffix, 'table_name' => $receivingTask->getTable()]
+        );
+        return true;
+    }
+
+
+    public function checkImage($image): bool
+    {
+        $tmpFile = $image->getRealPath();
+        $fileSuffix = $image->getClientOriginalExtension();
+        if (!is_uploaded_file($tmpFile)) return false;
+        if ($image->getSize() > 5 * 1024 * 1024) return false;
+        if (!in_array($fileSuffix, ['gif', 'image', 'jpeg', 'jpg', 'png', 'svg'])) return false;
+        return true;
+    }
+
+
+    public function getStorageDirPath(): string
+    {
+        $path = ['app', 'public', 'files', 'receivingTask'];
+        $path = join(DIRECTORY_SEPARATOR, $path);
+        $dirPath = storage_path($path);
+        if (!file_exists($dirPath)) {
+            mkdir($dirPath);
+        }
+        return $dirPath . DIRECTORY_SEPARATOR;
+    }
+
+    /**
+     * 雪花算法生成任务号
+     * @return string
+     */
+    public function buildTaskNumber(): string
+    {
+        return 'SH'.IdCreate::createOnlyId();
+    }
+
+    /**
+     * 延时完成昨天未完成的工单
+     */
+    public function overtimeToCompleteTask(){
+        $yesterday = Carbon::now()->subDays(1)->format("Y-m-d");
+        ReceivingTask::query()
+            ->where('created_at', '>=', $yesterday . ' 00:00:00')
+            ->where('created_at', '<=', $yesterday . ' 23.59.59')
+            ->whereIn('status',['创建','进行中'])
+            ->update(['status'=>'延时完成']);
+
+    }
+}

+ 1 - 1
app/Services/RejectedBillService.php

@@ -354,7 +354,7 @@ class RejectedBillService
         $service = app("OwnerPriceOperationService");
         foreach ($stores as $store){
             $GLOBALS["FEE_INFO"] = [];
-            list($id,$money,$taxFee) = $service->matching($store, Feature::MAPPING["store"], $store->owner_id, "入库",0);
+            list($id,$money,$taxFee) = $service->matching(substr($rejectedBill->updated_at,0,7),$store, Feature::MAPPING["store"], $store->owner_id, "入库",0);
             $bill = OwnerFeeDetail::query()->where("outer_id",$store->id)->where("outer_table_name","stores")->first();
             if ($bill)app("StoreService")->clearFeeInfo($store->asn_code);
             if ($bill) $bill->update([

+ 60 - 0
app/Services/WaybillService.php

@@ -394,4 +394,64 @@ SQL;
                ->orWhereIn("logistic_id",app("LogisticService")->getQuery());
         })->whereNotNull("deliver_at")->whereIn("status",["已审核","待终审"]);
     }
+
+    public function autoGetDBBill(Waybill $waybill){
+        if ($waybill->type=='德邦物流'){
+            if ($waybill->carrier_bill)return;
+            $waybill->load("order");
+            if (!$waybill->order){
+                Log::error("德邦单号获取失败",["no"=>$waybill->waybill_number,"info"=>"运单无绑定订单"]);
+                return;
+            }
+            list($update,$waybill) = $this->paramDefault($waybill);
+            $bill = app('DbOpenService')->getDbOrderNo($waybill);
+            if (!$bill || $bill["result"]=="false"){
+                Log::error("德邦单号获取失败",["no"=>$waybill->toArray(),"info"=>$bill]);
+                return;
+            }
+            $update["carrier_bill"] = $bill['mailNo'];
+            $update["waybill_number"] = $bill['mailNo'];
+            $update["station_no"] = $bill['stationNo'];
+            $update["arrived_org_simple_name"] = $bill['arrivedOrgSimpleName'];
+            $update["much_higher_delivery"] = $bill['muchHigherDelivery'];
+            $waybill->update($update);
+            if (!app("WaybillService")->notifyFlux($waybill)){
+                Log::error("德邦单号回传FLUX失败",["no"=>$waybill->waybill_number,"info"=>$bill]);
+                return;
+            }
+        }
+    }
+
+    private function paramDefault($waybill):array
+    {
+        $update = [];
+        if (!$waybill->order_type){
+            $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT;
+        }
+        if (!$waybill->transport_type){
+            $update["transport_type"] = $waybill->transport_type = "JZKH";
+        }
+        if (!$waybill->cargo_name){
+            $update["cargo_name"] = $waybill->cargo_name = "补货";
+        }
+        if (!$waybill->total_number){
+            $update["total_number"] = $waybill->total_number = 1;
+        }
+        if (!$waybill->total_weight){
+            $update["total_weight"] = $waybill->total_weight = 1;
+        }
+        if (!$waybill->package_service){
+            $update["package_service"] = $waybill->package_service = '托膜';
+        }
+        if (!$waybill->deliveryType_id){
+            $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
+        }
+        if (!$waybill->pay_type){
+            $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT;
+        }
+        if (!$waybill->back_sign_bill){
+            $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
+        }
+        return array($update,$waybill);
+    }
 }

+ 44 - 0
app/Utils/IdCreate.php

@@ -0,0 +1,44 @@
+<?php
+
+namespace App\Utils;
+
+/**
+ * Class IdCreate
+ * @package App\Utils
+ * 雪花算法 生成 id
+ */
+class IdCreate
+{
+    const EPOCH = 1479533469598;    //开始时间,固定一个小于当前时间的毫秒数
+    const max12bit = 4095;
+    const max41bit = 1099511627775;
+
+    static $machineId = null;      // 机器id
+
+    public static function machineId($mId = 0)
+    {
+        self::$machineId = $mId;
+    }
+
+    public static function createOnlyId()
+    {
+        // 时间戳 42字节
+        $time = floor(microtime(true) * 1000);
+        // 当前时间 与 开始时间 差值
+        $time -= self::EPOCH;
+        // 二进制的 毫秒级时间戳
+        $base = decbin(self::max41bit + $time);
+        // 机器id  10 字节
+        if (!self::$machineId) {
+            $machineid = self::$machineId;
+        } else {
+            $machineid = str_pad(decbin(self::$machineId), 10, "0", STR_PAD_LEFT);
+        }
+        // 序列数 12字节
+        $random = str_pad(decbin(mt_rand(0, self::max12bit)), 12, "0", STR_PAD_LEFT);
+        // 拼接
+        $base = $base . $machineid . $random;
+        // 转化为 十进制 返回
+        return bindec($base);
+    }
+}

+ 0 - 1
app/WorkOrder.php

@@ -178,7 +178,6 @@ class WorkOrder extends Model
         return $this->belongsTo(User::class, 'reviewer_id');
     }
 
-
     // 生成问题件类型
     public function issueType(): BelongsTo
     {

+ 12 - 0
database/factories/ReceivingTaskFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\ReceivingTask;
+use Faker\Generator as Faker;
+
+$factory->define(ReceivingTask::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 11 - 0
database/factories/ReceivingTaskItemFactory.php

@@ -0,0 +1,11 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\ReceivingTaskItem;
+use Faker\Generator as Faker;
+
+$factory->define(ReceivingTaskItem::class, function (Faker $faker) {
+    return [
+    ];
+});

+ 49 - 0
database/migrations/2021_12_22_153152_create_receiving_tasks_table.php

@@ -0,0 +1,49 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateReceivingTasksTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('receiving_tasks', function (Blueprint $table) {
+            $table->id();
+            $table->String('number')->unique()->comment('收货任务清单');
+            $table->integer('warehouse_id')->index()->comment('仓库');
+            $table->integer('owner_id')->index()->comment('货主');
+            $table->String("for_single_member")->comment('投单员');
+            $table->integer('delivery_appointment_car_id')->unique()->comment('预约号');
+
+            $table->String('driver_name')->comment('司机姓名');
+            $table->String('driver_phone')->comment('司机号码');
+
+            $table->String('plate_number')->comment('车牌号');
+            $table->String('driving_license_no')->comment('驾驶证号');
+            $table->String('logistics_single_number')->comment('物流单号');
+
+            $table->enum('provide_list',['是','否'])->comment("是否提供清单");
+            $table->enum('receiving_type',['正常','盲收'])->comment("收货类型");
+            $table->enum('status',['创建','进行中','完成','超时完成'])->comment('状态');
+
+            $table->dateTime('end_at')->comment('完结时间');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('receiving_tasks');
+    }
+}

+ 33 - 0
database/migrations/2021_12_22_163154_create_receiving_task_items_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateReceivingTaskItemsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('receiving_task_items', function (Blueprint $table) {
+            $table->id();
+            $table->integer('receiving_task_id')->index()->comment('收货任务');
+            $table->String('asn_no')->comment('asn单号');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('receiving_task_items');
+    }
+}

+ 32 - 0
database/migrations/2021_12_31_092206_receiving_task_add_user_id.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ReceivingTaskAddUserId extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('receiving_tasks', function (Blueprint $table) {
+            $table->integer('user_id')->comment('创建人');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('receiving_tasks', function (Blueprint $table) {
+            $table->dropColumn('user_id');
+        });
+    }
+}

+ 16 - 0
database/seeds/ReceivingTaskItemSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class ReceivingTaskItemSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+    }
+}

+ 16 - 0
database/seeds/ReceivingTaskSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class ReceivingTaskSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+    }
+}

+ 1 - 49
resources/views/order/issue/index.blade.php

@@ -189,10 +189,6 @@
                         <th class="three-layer bg-whit  align-middle" rowspan="2" style="min-width: 180px">情况说明</th>
                         <th class="three-layer align-middle" rowspan="2" style="min-width: 115px">问题类别</th>
                         <th class="three-layer align-middle" colspan="4" style="min-width: 155px">处理结果</th>
-
-                        <th class="three-layer align-middle " rowspan="2"
-                            style="max-width: 500px;min-width: 400px;">快递路由
-                        </th>
                         @cannot('订单管理-问题件-客户不可见')
                             <th class="three-layer  align-middle" rowspan="2"
                                 style="width:50px">@{{ isShowSecondOrderInfo ? '隐藏':'展开' }}
@@ -716,33 +712,7 @@
                         {{--情况说明 结束--}}
 
                         {{--客户编辑 开启--}}
-                        <td>
-                            <div class="alert alert-light " v-for="(item,i) in orderIssue.order.packages">
-                                <div class="text-left">
-                                    <span v-text="item.logistic_number"></span>
-                                    <span class="float-right" v-if="item['transfer_status'].length === 0">暂无路由信息</span>
-                                    <button type="button" class="btn btn-sm btn-outline-primary float-right" v-if="item['transfer_status'].length > 0 && selectOrderPackage!==item.id" @click="selectOrderPackage = item.id">展开</button>
-                                    <button type="button" class="btn btn-sm btn-outline-primary float-right" v-if="selectOrderPackage === item.id" @click="selectOrderPackage = null">收起</button>
-                                </div>
-                                <div class="text-left" v-if="selectOrderPackage === item.id">
-                                    <div v-for="transfer in item['transfer_status']">
-                                        <div >
-                                            <hr>
-                                            <span class="mr-1 text-monospace">时间:</span>
-                                            <span v-text="transfer['accept_time']"></span>
-                                        </div>
-                                        <div>
-                                            <span class="mr-1 text-monospace">到达地:</span>
-                                            <span v-text="transfer['accept_address']"></span>
-                                        </div>
-                                        <div>
-                                            <span class="mr-1 text-monospace">详情:</span>
-                                            <span v-text="transfer['remark']"></span>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </td>
+
                     @cannot('订单管理-问题件-客户不可见')
                             <td class="p-0 m-0 child-layer-3" style="min-width:50px;"
                                 v-if="index===0"
@@ -1247,7 +1217,6 @@
                     orderIssue: {id: null, showId: ''},
                 },
                 toggleBtnHeight: null,
-                selectOrderPackage: null,
             },
             created() {
                 let _this = this;
@@ -1529,29 +1498,12 @@
                     this.isShowRejectedBill = false;
                     this.isShowSecondOrderInfo = false;
                 },
-                sortTransferStatus(item){
-                    item.isShowTransferStatus = false;
-                    item.isShowRemark = false;
-                    if (item['transfer_status'] == null) {
-                        item['transfer_status'] = [];
-                        return;
-                    }
-                    if (item['transfer_status'].length === 0) return;
-                    item['transfer_status'].sort((item1,item2)=>{
-                        let date1 = new Date(item1['accept_time']);
-                        let date2 = new Date(item2['accept_time']);
-                        if (date1 - date2 > 0) return -1;
-                        if (date1 - date2 < 0) return 1;
-                        return 0;
-                    });
-                },
                 regroupOrder(order) {
                     if (!order) return;
                     let amounts = 0; // 商品总数
                     let type_numbers = 0; // 商品类型数量
                     let _this = this;
                     $.each(order.packages, function (i, item) {
-                        _this.sortTransferStatus(item);
                         $.each(item.commodities, function (i, commodity) {
                             type_numbers++;
                             amounts += Number(commodity.amount);

+ 34 - 16
resources/views/order/workOrder/index.blade.php

@@ -447,6 +447,10 @@
                     $(".up").slideUp();
                     $(".tooltipTarget").tooltip({'trigger': 'hover'});
                     $("#list").removeClass('d-none');
+                    let log_content_range = [{name: '15', value: '15天内'}, {name: '31', value: '近一月'}, {
+                        name: '92',
+                        value: '近三月'
+                    }, {name: '183', value: '近半年'}, {name: '366', value: '近一年'}, {name: '0', value: '不限'},];
                     let data = [[
                         {name: 'created_at_start', type: 'time', tip: ['工单创建开始日期', '时间']},
                         {name: 'created_at_end', type: 'time', tip: ['工单创建结束日期', '时间']},
@@ -526,6 +530,21 @@
                         {name: 'is_end', type: 'checkbox', tip: '是否已拦截', data: [{name: 'ture', value: '已完成'}]},
                     ], [
                         {name: 'order_issue_log', type: 'input', placeholder: '问题件处理日志'},
+                        {
+                            name: ['log_content', 'addtime'],
+                            type: 'input_select',
+                            tip: ['处理结果:前或后加 百分号为单个模糊搜索,否则为多条件精确搜索', '查询范围越短,搜索速度越快'],
+                            placeholder: ['处理结果', ''],
+                            data: log_content_range,
+                            rules: [{
+                                son: {
+                                    addtime: {
+                                        default: '31',
+                                        required_without_all_if: ['created_at_start', 'created_at_end']
+                                    }
+                                }
+                            }]
+                        },
                     ]];
                     this.form = new query({
                         el: '#form_div',
@@ -737,7 +756,6 @@
                         workOrder.orderno = workOrder.order ? workOrder.order.code : '';
                     },
                     groupPendingDetail(workOrder) {
-
                         let details = workOrder.details.filter(item => {
                             return !['完成', '标记'].includes(item.tag);
                         }).sort((prev, curr) => {
@@ -747,21 +765,21 @@
                         let detail = details.find(e => true);
                         return {
                             id: workOrder.id,
-                            detail_id: detail.id,
-                            commodities: detail.commodities,
-                            issue_type_name: detail.issue_type ? detail.issue_type.name : '',
-                            status: detail.status,
-                            reissue_logistic_number: detail.reissue_logistic_number,
-                            logistic_number: detail.logistic_number,
-                            price: detail.price,
-                            return_logistic_number: detail.return_logistic_number,
-                            remark: detail.remark,
-                            tag: detail.tag,
-                            return_address: detail.return_address,
-                            return_phone: detail.return_phone,
-                            return_name: detail.return_name,
-                            images: detail.images,
-                            logistic_handle_tag: detail.logistic_handle_tag,
+                            detail_id: detail ? detail.id : '',
+                            commodities: detail ? detail.commodities : '',
+                            issue_type_name: detail ? detail.issue_type.name : '',
+                            status: detail ? detail.status : '',
+                            reissue_logistic_number:detail ? detail.reissue_logistic_number : '',
+                            logistic_number: detail ? detail.logistic_number : '',
+                            price: detail ? detail.price : '',
+                            return_logistic_number: detail ? detail.return_logistic_number : '',
+                            remark: detail ? detail.remark : '',
+                            tag: detail ? detail.tag : '',
+                            return_address: detail ? detail.return_address : '',
+                            return_phone: detail ? detail.return_phone : '',
+                            return_name: detail ? detail.return_name : '',
+                            images: detail ? detail.images : '',
+                            logistic_handle_tag: detail ? detail.logistic_handle_tag  : '',
                         };
                     },
                     groupCommodities(workOrder, isCurrent = true) {

+ 30 - 3
resources/views/station/monitor/visual.blade.php

@@ -18,7 +18,7 @@
                 <div class="col-1">非空</div>
                 <div class="col-1 bg-warning offset-2 text-dark font-weight-bold">@{{ this.statistic.number2 }}</div>
                 <div class="col-1">空架</div>
-                <div class="col-1 bg-success offset-2 text-white  font-weight-bold">@{{ this.statistic.number3 }}</div>
+                <div class="col-1 bg-success offset-2 text-white  font-weight-bold cursor-pointer" @click="getBoxes()">@{{ this.statistic.number3 }}</div>
                 <div class="col-1">空箱</div>
             </div>
         </div>
@@ -44,7 +44,7 @@
 
 @section('lastScript')
     <script>
-        new Vue({
+        let vue = new Vue({
             el:"#container",
             data:{
                 rowSize:8, //单排大小:X列
@@ -217,7 +217,7 @@
                     n=(r1>=r2)?r1:r2;
                     return ((arg1*m-arg2*m)/m).toFixed(n);
                 },
-                 accDivCoupon(arg1,arg2){
+                accDivCoupon(arg1,arg2){
                     let t1=0,t2=0,r1,r2;
                     try{t1=arg1.toString().split(".")[1].length;}catch(e){}
                     try{t2=arg2.toString().split(".")[1].length;}catch(e){}
@@ -227,6 +227,33 @@
                         return Math.round((r1/r2)*pow(10,t2-t1)*10000)/100;
                     }
                 },
+                getBoxes(){
+                    console.warn("稍等下......");
+                    $("#modal").hide();
+                    for (let i=0;i<vue.data.length;i++){
+                        for (let j=0;j<vue.data[i].length;j++){
+                            if (vue.data[i][j][2]>0){
+                                vue.loadDetail(i,j);
+                            }
+                        }
+                    }
+                    setTimeout(()=>{
+                        let loc = [];
+                        for (let key in vue.details){
+                            for (let i=0;i<vue.details[key].length;i++){
+                                for (let j=0;j<vue.details[key][i].length;j++){
+                                    let obj = vue.details[key][i][j];
+                                    if (obj.status===false){
+                                        loc.push(obj.location);
+                                    }
+                                }
+                            }
+                        }
+                        window.tempTip.postBasicRequest("{{url('station/monitor/visual/getBoxes')}}",{arr:loc},res=>{
+                            console.log(res);
+                        });
+                    },3000)
+                }
             },
             filters:{
                 reduce(val){

+ 18 - 0
resources/views/store/receivingTasks/_clodop_print.blade.php

@@ -0,0 +1,18 @@
+<el-dialog
+    title="打印"
+    :visible.sync="clodopPrintDialogVisible"
+    width="45%"
+    center>
+    <el-form ref="form" :model="print_setting" label-width="80px" class="demo-form-inline" size="small">
+        <el-form-item label="打印机" size="small">
+            <el-select v-model="print_setting.printer_index" placeholder="请选择打印机" >
+                <el-option v-for="printer in printerList" :label="printer.name" :value="printer.value"></el-option>
+            </el-select>
+        </el-form-item>
+    </el-form>
+
+    <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogShowOrderWorkVisible = false">关 闭</el-button>
+        <el-button type="primary" @click="clodopPrint">打 印</el-button>
+    </span>
+</el-dialog>

+ 55 - 0
resources/views/store/receivingTasks/_receiving_task_print.blade.php

@@ -0,0 +1,55 @@
+{{--<div id="print-receiving-task" class=" container print"--}}
+{{--     style="min-height: 450px;min-width: 750px;max-height: 450px;max-width: 750px">--}}
+{{--    <div id="receiving-task-print" class="d-none print" style="min-height: 100mm;min-width: 170mm;max-height: 100mm;max-width: 170mm">--}}
+{{--        <table class="table table-sm table-bordered text-center print" style="min-height: 100mm;min-width: 170mm;max-height: 100mm;max-width: 170mm">--}}
+{{--            <tr>--}}
+{{--                <td rowspan="2" colspan="4" class="">--}}
+{{--                    <div style="min-width: 100mm;min-height: 25mm">--}}
+{{--                        <svg id="receiving-task-print-code" style="width: 100%;height: 100%" preserveAspectRatio="none">--}}
+{{--                        </svg>--}}
+{{--                    </div>--}}
+
+{{--                </td>--}}
+{{--            </tr>--}}
+{{--            <tr></tr>--}}
+{{--            <tr>--}}
+{{--                <td style="max-width: 120px;width:120px">收货任务号</td>--}}
+{{--                <td colspan="3" rowspan="1" v-text="receiving_task_print.number" class="text-left"></td>--}}
+{{--            </tr>--}}
+
+{{--            <tr>--}}
+{{--                <td style="max-width: 120px;width:120px">仓库</td>--}}
+{{--                <td v-text="receiving_task_print.warehouse" class="text-left" class="text-left"></td>--}}
+{{--                <td style="max-width: 120px;width:120px">投单员</td>--}}
+{{--                <td v-text="receiving_task_print.for_single_member" class="text-left" class="text-left"></td>--}}
+{{--            </tr>--}}
+{{--            <tr>--}}
+{{--                <td style="max-width: 120px;width:120px">司机姓名</td>--}}
+{{--                <td v-text="receiving_task_print.driver_name" class="text-left" class="text-left"></td>--}}
+{{--                <td style="max-width: 120px;width:120px">司机电话</td>--}}
+{{--                <td v-text="receiving_task_print.driver_phone" class="text-left" class="text-left"></td>--}}
+{{--            </tr>--}}
+{{--            <tr>--}}
+{{--                <td style="max-width: 120px;width:120px">车号牌</td>--}}
+{{--                <td v-text="receiving_task_print.plate_number" class="text-left"></td>--}}
+{{--                <td style="max-width: 120px;width:120px">驾驶证号</td>--}}
+{{--                <td v-text="receiving_task_print.driving_license_no" class="text-left"></td>--}}
+{{--            </tr>--}}
+{{--            <tr>--}}
+{{--                <td style="max-width: 120px;width:120px">是否提供清单</td>--}}
+{{--                <td v-text="receiving_task_print.provide_list" class="text-left"></td>--}}
+{{--                <td style="max-width: 120px;width:120px">收货类型</td>--}}
+{{--                <td v-text="receiving_task_print.receiving_type" class="text-left"></td>--}}
+{{--            </tr>--}}
+{{--            <tr>--}}
+{{--                <td style="max-width: 120px;width:120px">货主</td>--}}
+{{--                <td v-text="receiving_task_print.owner" class="text-left"></td>--}}
+{{--                <td style="max-width: 120px;width:120px">预约号</td>--}}
+{{--                <td v-text="receiving_task_print.appointment_number" class="text-left"></td>--}}
+{{--            </tr>--}}
+{{--        </table>--}}
+{{--    </div>--}}
+{{--    <div style="width: 100%;height: 100%;" class="d-none" id="receiving-task-print-image">--}}
+{{--        <img src="" alt="">--}}
+{{--    </div>--}}
+{{--</div>--}}

+ 814 - 0
resources/views/store/receivingTasks/create.blade.php

@@ -0,0 +1,814 @@
+@extends('layouts.app')
+@section('title')开单入库-创建@endsection
+@section('head')
+    <link href="{{ mix('css/element-ui.css') }}" rel="stylesheet">
+    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
+@endsection
+
+@section('content')
+    <div id="list" class="d-none">
+        <div class="container-fluid ">
+            <div class="card">
+                <div class="card-body">
+                    <form name="receiving-task-form" id="receiving-task-form">
+                        <div class="form-group row">
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="warehouse_id">
+                                    <span class="text-danger">*</span>
+                                    仓库
+                                </label>
+                                <div class="form-inline col-8">
+                                    <select class="form-control form-control-sm col-12" name="warehouse_id"
+                                            @change="clearError('warehouse_id')"
+                                            id="warehouse_id"
+                                            :class="{'is-invalid':errors.warehouse_id}"
+                                            v-model="receiving_task.warehouse_id">
+                                        <option v-for="item in ware_house"
+                                                :value="item.value"
+                                                v-text="item.name"></option>
+                                    </select>
+                                    <div id="validation-warehouse" class="invalid-feedback"
+                                         v-show="errors.warehouse_id">
+                                        <span v-text="errors.warehouse_id"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="for_single_member">
+                                    <span class="text-danger">*</span>
+                                    投单员</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           id="for_single_member" name="for_single_member"
+                                           :class="{'is-invalid':errors.for_single_member}"
+                                           @change="clearError('for_single_member')"
+                                           v-model="receiving_task.for_single_member">
+                                    <div id="validation-for-single-member" class="invalid-feedback"
+                                         v-show="errors.for_single_member">
+                                        <span v-text="errors.for_single_member"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="owner_id">
+                                    <span class="text-danger">*</span>
+                                    货主</label>
+                                <div class="form-inline col-8">
+                                    <select class="form-control form-control-sm col-12" name="owner_id" id="owner_id"
+                                            :class="{'is-invalid':errors.owner_id}"
+                                            @change="getASNDetails"
+                                            @input="clearError('owner_id')"
+                                            v-model="receiving_task.owner_id">
+                                        <option v-for="item in owners" :value="item.id" v-text="item.name"></option>
+                                    </select>
+                                    <div id="validation-owner-id" class="invalid-feedback" v-show="errors.owner_id">
+                                        <span v-text="errors.owner_id"></span>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="form-group row">
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="driver_name">
+                                    <span class="text-danger">*</span>
+                                    司机姓名</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           name="driver_name" id="driver_name"
+                                           :class="{'is-invalid':errors.driver_name}"
+                                           @change="clearError('driver_name')"
+                                           v-model="receiving_task.driver_name">
+                                    <div id="validation-driver-name" class="invalid-feedback"
+                                         v-show="errors.driver_name">
+                                        <span v-text="errors.driver_name"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="driver-phone">
+                                    <span class="text-danger">*</span>
+                                    司机电话</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           name="driver_phone" id="driver-phone"
+                                           :class="{'is-invalid':errors.driver_phone}"
+                                           @change="clearError('driver_phone')"
+                                           v-model="receiving_task.driver_phone">
+                                    <div id="validation-driver-phone" class="invalid-feedback"
+                                         v-show="errors.driver_name">
+                                        <span v-text="errors.driver_phone"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="appointment_number">
+                                    <span class="text-danger">*</span>
+                                    预约单号</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           name="appointment_number" id="appointment_number"
+                                           :class="{'is-invalid':errors.appointment_number}"
+                                           @change="clearError('appointment_number')"
+                                           v-model="receiving_task.appointment_number">
+                                    <div id="validation-delivery-appointment-number" class="invalid-feedback"
+                                         v-show="errors.appointment_number">
+                                        <span v-text="errors.appointment_number"></span>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="form-group row">
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right d-inline-block" for="plate_number">
+                                    <span class="text-danger">*</span>
+                                    车牌号</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           name="plate_number" id="plate_number"
+                                           :class="{'is-invalid':errors.plate_number}"
+                                           @change="clearError('plate_number')"
+                                           :disabled="receiving_task.logistics_single_number"
+                                           v-model="receiving_task.plate_number">
+                                    <div id="validation-plate-number" class="invalid-feedback"
+                                         v-show="errors.plate_number">
+                                        <span v-text="errors.plate_number"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right d-inline-block" for="driving_license_no">
+                                    <span class="text-danger">*</span>
+                                    驾驶证号</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           name="driving_license_no" id="driving_license_no"
+                                           :class="{'is-invalid':errors.driving_license_no}"
+                                           @change="clearError('driving_license_no')"
+                                           :disabled="receiving_task.logistics_single_number"
+                                           v-model="receiving_task.driving_license_no">
+                                    <div id="validation-driving-license-no" class="invalid-feedback"
+                                         v-show="errors.driving_license_no">
+                                        <span v-text="errors.driving_license_no"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right d-inline-block"
+                                       for="logistics_single_number">
+                                    <span class="text-danger">*</span>
+                                    物流单号</label>
+                                <div class="form-inline col-8">
+                                    <input type="text" class="form-control form-control-sm col-12" placeholder=""
+                                           name="logistics_single_number" id="logistics_single_number"
+                                           :class="{'is-invalid':errors.logistics_single_number}"
+                                           @change="clearError('logistics_single_number')"
+                                           :disabled="checkLogisticsSingleIsWrite()"
+                                           v-model="receiving_task.logistics_single_number">
+                                    <div id="validation-driving-license-no" class="invalid-feedback"
+                                         v-show="errors.logistics_single_number">
+                                        <span v-text="errors.logistics_single_number"></span>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="form-group row">
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right d-inline-block text-primary"
+                                       for="plate_number">
+                                    <span class="text-danger">*</span>
+                                    是否提供清单</label>
+                                <div class="form-inline col-8">
+                                    <select name="provide_list" id="provide_list"
+                                            class="form-control form-control-sm col-12"
+                                            :class="{'is-invalid':errors.provide_list}"
+                                            @change="clearError('provide_list')"
+                                            v-model="receiving_task.provide_list">
+                                        <option v-for="item in provide_lists" :value="item" v-text="item"></option>
+                                    </select>
+                                    <div id="validation-provide_list" class="invalid-feedback"
+                                         v-show="errors.provide_list">
+                                        <span v-text="errors.provide_list"></span>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right  d-inline-block  text-primary"
+                                       for="receiving_type">
+                                    <span class="text-danger">*</span>
+                                    收货类型</label>
+                                <div class="form-inline col-8">
+                                    <select name="receiving_type" id="receiving_type"
+                                            class="form-control form-control-sm col-12"
+                                            :class="{'is-invalid':errors.receiving_type}"
+                                            @change="clearError('provide_list')"
+                                            v-model="receiving_task.receiving_type">
+                                        <option v-for="item in receiving_types" :value="item" v-text="item"></option>
+                                    </select>
+                                    <div id="validation-receiving-type" class="invalid-feedback"
+                                         v-show="errors.receiving_type">
+                                        <span v-text="errors.receiving_type"></span>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div class="form-group row">
+                            <div class="form-inline col-4 row">
+                                <label class="col-4 col-form-label text-right d-inline-block text-primary"
+                                       for="driving_license_image">
+                                    <span class="text-danger">*</span>
+                                    驾驶证扫描件</label>
+                                <div class="form-inline col-8">
+                                    <input type="file" class="form-control form-control-file col-12" placeholder=""
+                                           name="driving_license_image" id="driving_license_image">
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+                </div>
+
+                <div class="card-body mb-0 pt-0 pm-0">
+                    <el-table
+                        :key="asn_headers_table_key"
+                        size="small"
+                        highlight-current-row
+                        ref="asn_headers_table"
+                        :data="asn_headers"
+                        height="350"
+                        border
+                        @row-click="showAsnDetails"
+                        row-key="asn_no"
+                        @selection-change="handleSelectionChange"
+                        style="width: 100%">
+
+                        <el-table-column
+                            type="selection"
+                            width="55">
+                        </el-table-column>
+
+                        <el-table-column
+                            prop="customer_id" label="货主">
+                        </el-table-column>
+
+                        <el-table-column
+                            sortable
+                            prop="asn_no" label="ASN号">
+                        </el-table-column>
+
+                        <el-table-column
+                            prop="asn_type" label="ASN类型">
+                        </el-table-column>
+
+                        <el-table-column
+                            sortable
+                            prop="asn_status" label="订单状态">
+                        </el-table-column>
+
+                        <el-table-column
+                            prop="up_stream_number"
+                            label="上游单号">
+                        </el-table-column>
+                        <el-table-column
+                            prop="anticipated_sum_number"
+                            label="预期总数">
+                        </el-table-column>
+                        <el-table-column
+                            prop="number1"
+                            label="参考编号1"
+                        >
+                        </el-table-column>
+                        <el-table-column
+                            prop="number2"
+                            label="参考编号2">
+                        </el-table-column>
+                        <el-table-column
+                            prop="number3"
+                            label="参考编号3">
+                        </el-table-column>
+                        <el-table-column
+                            sortable
+                            prop="receiving_time"
+                            label="接收时间">
+                        </el-table-column>
+                    </el-table>
+
+                    <div class="block">
+                        <el-pagination
+                            @size-change="handleSizeChange"
+                            @current-change="handleCurrentChange"
+                            :current-page="current_page"
+                            :page-sizes="['50',100, 200, 300, 400]"
+                            :page-size="50"
+                            layout="total, sizes, prev, pager, next, jumper"
+                            :total="total">
+                        </el-pagination>
+                    </div>
+                </div>
+                <div class="card-body mt-0 pt-0 pm-0">
+                    <el-table
+                        ref="asn_details_table"
+                        size="small"
+                        border
+                        :data="asn_details"
+                        style="width: 100%"
+                        height="300">
+
+                        <el-table-column
+                            prop="line_status"
+                            label="行状态"
+                            width="180">
+                        </el-table-column>
+                        <el-table-column
+                            prop="name"
+                            label="产品名称">
+                        </el-table-column>
+                        <el-table-column
+                            prop="code1"
+                            label="条码1"
+                            width="180">
+                        </el-table-column>
+                        <el-table-column
+                            prop="code2"
+                            label="条码2"
+                            width="180">
+                        </el-table-column>
+                        <el-table-column
+                            prop="code3"
+                            label="条码3">
+                        </el-table-column>
+                        <el-table-column
+                            prop="anticipated_number"
+                            label="预期数量"
+                            width="180">
+                        </el-table-column>
+                        <el-table-column
+                            prop="number"
+                            label="已收取"
+                            width="180">
+                        </el-table-column>
+                    </el-table>
+                </div>
+                <div class="form-group">
+                    <el-button type="primary" class="col-12" @click="submit" v-if="!submit_loading">提 交</el-button>
+                    <el-button type="primary" class="col-12" :loading="true" v-if="submit_loading">提 交 中</el-button>
+                </div>
+                <div class="form-group">
+                    @can('入库管理-开单入库-打印任务单')
+                        <el-button type="primary" class="col-12" @click="printLodop"
+                                   v-show="receiving_task_print.number">
+                            <span v-text="receiving_task_print.number + '打  印'"></span>
+                        </el-button>
+                    @endcan
+                </div>
+                @include("store.receivingTasks._receiving_task_print")
+                @include("store.receivingTasks._clodop_print")
+            </div>
+        </div>
+
+    </div>
+@endsection
+@section('lastScript')
+
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{ mix('js/element-ui.js') }}"></script>
+    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
+    <script type="text/javascript" src="{{mix('js/lodop/LodopFuncs.js')}}"></script>
+
+    <script src='http://localhost:18000/CLodopfuncs.js?name=CLODOPA'></script>
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                receiving_task: {
+                    warehouse_id: null,
+                    owner_id: null,
+                    appointment_number: null,
+                    driver_name: null,
+                    driver_phone: null,
+                    for_single_member: '{{ Auth::user()->name }}',
+                    plate_number: null,
+                    driving_license_no: null,
+                    logistics_single_number: null,
+                    provide_list: null,
+                    receiving_type: null,
+                },
+                provide_lists: ['是', '否'],
+                receiving_types: ['正常', '盲收'],
+                owners: [
+                        @foreach($owners as $owner)
+                    {
+                        name: '{{$owner->name}}', value: '{{$owner->code}}', id: '{{$owner->id}}'
+                    },
+                    @endforeach
+                ],
+                ware_house: [
+                        @foreach($wareHouse as $item)
+                    {
+                        name: '{{$item->name}}', value: '{{$item->id}}'
+                    },
+                    @endforeach
+                ],
+                driving_license_image: null,
+                page_size: 20,
+                pager_count: 0,
+                current_page: 0,
+                total: 0,
+                asn_headers: [],
+                asn_details: [],
+                asn_detail: [],
+                loading_tag: false,
+                not_found_tag: false,
+                asn_headers_table_key: 1,
+                errors: {
+                    warehouse_id: '',
+                    owner_id: '',
+                    appointment_number: '',
+                    driver_name: '',
+                    driver_phone: '',
+                    for_single_member: '',
+                    plate_number: '',
+                    driving_license_no: '',
+                    logistics_single_number: '',
+                    provide_list: '',
+                    receiving_type: '',
+                },
+                error_message: null,
+                selected_asn_nos: [],
+                submit_loading: false,
+                receiving_task_print: {
+                    number: null,               // 收货任务号
+                    warehouse: null,             // 仓库
+                    for_single_member: null,    // 投单员
+                    driver_name: null,          // 司机姓名
+                    driver_phone: null,         // 司机电话
+                    plate_number: null,          // 车号牌
+                    driving_license_no: null,    // 驾驶证号
+                    provide_list: null,         // 是否提供清单
+                    receiving_type: null,       // 收货类型
+                    owner: null,                // 货主
+                    appointment_number: null, // 预约号
+                },
+                clodop: null,
+                clodopPrintDialogVisible: false,
+                printerList: [],
+                print_setting: {
+                    printer_index: 0,
+                }
+            },
+            mounted() {
+                $("#list").removeClass('d-none');
+            },
+            methods: {
+                waitingTempTip(message) {
+                    window.tempTip.setIndex(2005);
+                    window.tempTip.waitingTip(message);
+                },
+                successTempTip(message) {
+                    window.tempTip.setDuration(1500);
+                    window.tempTip.setIndex(2005);
+                    window.tempTip.showSuccess(message);
+                },
+                errorTempTip(message) {
+                    window.tempTip.setDuration(2000);
+                    window.tempTip.setIndex(2005);
+                    window.tempTip.show(message);
+                },
+                submit() {
+                    let result = this.checkSubmitData();
+                    if (!result.success) {
+                        this.error_message = result.message;
+                        this.errors[result.field] = result.message;
+                        this.errorTempTip(result.message);
+                        this.scrollToTop();
+                        return;
+                    }
+                    let url = "{{route("store.receivingMask.storeApi")}}";
+                    let form = document.getElementById("receiving-task-form");
+                    let formData = new FormData(form);
+                    this.selected_asn_nos.forEach(e => {
+                        if (e) formData.append('asn_nos[]', e);
+                    });
+                    this.submit_loading = true;
+                    window.axios.post(url, formData, {
+                        'Content-Type': 'multipart/form-data'
+                    }).then(res => {
+                        this.submit_loading = false;
+                        if (res.data.success) {
+                            this.successTempTip("创建成功");
+                            this.conversion(res.data.data);
+                        } else {
+                            if (res.data.errors) {
+                                let error = null;
+                                for (const key in res.data.errors) {
+                                    this.errors[key] = res.data.errors[key].find(e => e);
+                                    if (!error) error = res.data.errors[key].find(e => e);
+                                }
+                                this.errorTempTip(error ? error : "创建异常请检查后提交");
+                                this.scrollToTop();
+                            } else if (res.data.message) {
+                                this.errorTempTip(res.data.message ? res.data.message : '提交异常,请刷新重试');
+                            }
+                        }
+                    }).catch(err => {
+                        this.errorTempTip(err);
+                        this.submit_loading = false;
+                    })
+                },
+                nextPage() {
+                    this.getASNDetails(false,this.current_page + 1,this.pager_count);
+                },
+                prevPage(){
+                    this.getASNDetails(false,this.current_page - 1,this.pager_count);
+                },
+                handleSizeChange(val){
+                    this.getASNDetails(false,0,val);
+                },
+                handleCurrentChange(val){
+                    this.getASNDetails(false,val,this.pager_count);
+                },
+                changeCurrent(val){
+                    this.getASNDetails(false,val,this.pager_count);
+                },
+                getASNDetails(isChange,page, prePage) {
+                    let {owner_id} = this.receiving_task;
+                    let owner = this.owners.filter(e => e.id === owner_id).find(e => e);
+                    if (!owner) return;
+                    let url = '{{route('oracle.asn.getToBeProcessApi')}}';
+                    page = page ? page : this.current_page;
+                    prePage = prePage ? prePage : this.prevPage;
+                    if (isChange){
+                        this.current_page = 0;
+                        this.pager_count = 20;
+                        this.sum = 0;
+                    }
+                    let data = {
+                        customer_id: owner.value,
+                        page: page,
+                        prePage: prePage
+                    };
+                    window.axios.post(url, data).then(res => {
+                        if (res.data.success) {
+                            this.total = res.data.total;
+                            this.pager_count = res.data.pager_count;
+                            this.current_page = res.data.current_page;
+                            this.asn_headers = this.formatAsnHeaderDetails(res.data.data);
+                            this.selected_asn_nos = [];
+                        }
+                    }).catch(err => {
+                        this.errorTempTip(err);
+                    });
+                },
+                formatAsnHeaderDetails(asnHeaderDetails) {
+                    return asnHeaderDetails.map(e => this.formatAsnHeaderDetail(e));
+                },
+                formatAsnHeaderDetail(asnHeaderDetail) {
+                    let asn_details = asnHeaderDetail.asn_details ? asnHeaderDetail.asn_details : [];
+                    let anticipated_sum_number = this.getAnticipatedSumNumber(asn_details);
+                    return {
+                        customer_id: asnHeaderDetail.bas_customer ? asnHeaderDetail.bas_customer.descr_c : '',
+                        asn_no: asnHeaderDetail.asnno ? asnHeaderDetail.asnno : '',
+                        asn_type: asnHeaderDetail.asn_type ? asnHeaderDetail.asn_type.codename_c : '',
+                        asn_status: asnHeaderDetail.asn_status ? asnHeaderDetail.asn_status.codename_c : '',
+                        up_stream_number: asnHeaderDetail.asnreference1 ? asnHeaderDetail.asnreference1 : '',
+                        anticipated_sum_number: anticipated_sum_number,
+                        number1: asnHeaderDetail.asnreference1 ? asnHeaderDetail.asnreference1 : '',
+                        number2: asnHeaderDetail.asnreference2 ? asnHeaderDetail.asnreference2 : '',
+                        number3: asnHeaderDetail.asnreference3 ? asnHeaderDetail.asnreference3 : '',
+                        receiving_time: asnHeaderDetail.asncreationtime ? asnHeaderDetail.asncreationtime : '',
+                        details: this.formatAsnDetails(asn_details),
+                    };
+                },
+                formatAsnDetails(asnDetails) {
+                    return asnDetails.map(e => this.formatAsnDetail(e));
+                },
+                formatAsnDetail(asnDetail) {
+                    return {
+                        line_status: asnDetail.line_status ? asnDetail.line_status.codename_c : '',
+                        name: asnDetail.bas_sku ? asnDetail.bas_sku.descr_c : '',
+                        code1: asnDetail.bas_sku ? asnDetail.bas_sku.alternate_sku1 : '',
+                        code2: asnDetail.bas_sku ? asnDetail.bas_sku.alternate_sku2 : '',
+                        code3: asnDetail.bas_sku ? asnDetail.bas_sku.alternate_sku3 : '',
+                        anticipated_number: asnDetail.expectedqty ? asnDetail.expectedqty : '',
+                        number: asnDetail.receivedqty ? asnDetail.receivedqty : 0,
+                    }
+                },
+                getAnticipatedSumNumber(asnDetails) {
+                    if (asnDetails.length === 0) return 0;
+                    let sum = asnDetails.reduce((total, e) => {
+                        return total + Number(e.expectedqty);
+                    }, 0);
+                    return sum ? sum : 0;
+                },
+                showAsnDetails(row, column, event) {
+                    this.$refs.asn_headers_table.setCurrentRow(row);
+                    this.asn_details = row.details;
+                },
+                handleSelectionChange(val) {
+                    this.selected_asn_nos = val.map(e => e.asn_no);
+                },
+                checkSubmitData() {
+                    let result = {success: true, message: '', field: '',};
+                    let {
+                        warehouse_id, owner_id,
+                        driver_name, driver_phone, for_single_member,
+                        plate_number, driving_license_no, logistics_single_number,
+                        provide_list, receiving_type, appointment_number
+                    } = this.receiving_task;
+
+                    if (!warehouse_id) {
+                        result = {success: false, message: "仓库为必选项", field: 'warehouse_id'};
+                    } else if (!for_single_member) {
+                        result = {success: false, message: "投单员不能为空", field: 'for_single_member'};
+                    } else if (!owner_id) {
+                        result = {success: false, message: "货主为必选项", field: 'owner_id'};
+                    } else if (!driver_name) {
+                        result = {success: false, message: "司机姓名不能为空", field: 'driver_name'};
+                    } else if (!driver_phone) {
+                        result = {success: false, message: "司机电话不能为空", field: 'driver_phone'};
+                    } else if (!appointment_number) {
+                        result = {success: false, message: "预约单号不能为空", field: 'appointment_number'};
+                    }
+                    if (!result.success) return result;
+                    if (!logistics_single_number) {
+                        if (!plate_number) {
+                            result = {success: false, message: "车牌号不能为空", field: 'plate_number'};
+                        } else if (!driving_license_no) {
+                            result = {success: false, message: "驾驶证号", field: 'driving_license_no'};
+                        }
+                    }
+                    if (!result.success) return result;
+                    if (!provide_list) {
+                        result = {success: false, message: "是否提供清单为必填项", field: 'provide_list'};
+                    } else if (!receiving_type) {
+                        result = {success: false, message: "收货类型不能为空", field: 'provide_list'};
+                    }
+
+                    return result;
+                },
+                clearError(field) {
+                    this.errors[field] ? this.errors[field] = '' : null;
+                },
+                checkLogisticsSingleIsWrite() {
+                    if (this.receiving_task.plate_number) return true;
+                    else if (this.receiving_task.driving_license_no) return true;
+                    return false;
+                },
+                checkLogisticsSingleNumber() {
+                    if (this.receiving_task.plate_number) return true;
+                    else if (this.receiving_task.driving_license_no) return true;
+                    return false;
+                },
+                scrollToTop() {
+                    const c = document.documentElement.scrollTop || document.body.scrollTop;
+                    if (c > 0) {
+                        window.requestAnimationFrame(this.scrollToTop);
+                        window.scrollTo(0, c - c / 8);
+                    }
+                },
+                conversion(receivingTask) {
+                    this.receiving_task_print = {
+                        number: receivingTask.number,
+                        warehouse: receivingTask.warehouse ? receivingTask.warehouse.name : '',
+                        for_single_member: receivingTask.for_single_member,
+                        driver_name: receivingTask.driver_name,
+                        driver_phone: receivingTask.driver_phone,
+                        plate_number: receivingTask.plate_number,
+                        driving_license_no: receivingTask.driving_license_no,
+                        provide_list: receivingTask.provide_list,
+                        receiving_type: receivingTask.receiving_type,
+                        owner: receivingTask.owner ? receivingTask.owner.name : '',
+                        appointment_number: receivingTask.delivery_appointment_car ? receivingTask.delivery_appointment_car.appointment_number : ''
+                    };
+                },
+                printLodop() {
+                    this.clodop = null;
+                    try {
+                        this.clodop = getLodop();
+                        if ((this.clodop != null) && (typeof (this.clodop.VERSION) != "undefined")) {
+                            this.showPrintDialog();
+                        } else {
+                            this.downloadClodopConfirm();
+                        }
+                    } catch (err) {
+                        this.errorTempTip('getLodop error');
+                    }
+                },
+                downloadClodopConfirm() {
+                    this.$confirm('打印组件不存在,是否下载?', '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        // 下载
+                        this.downloadLodop();
+                    }).catch(() => {
+                        // 取消下载
+                    });
+                },
+                downloadLodop() {
+                    let url = "{{mix('/js/lodop/CLodop_Setup_for_Win32NT.exe')}}"
+                    window.open(url, '_target');
+                },
+                showPrintDialog() { //
+                    this.getPrinterList();
+                    this.clodopPrintDialogVisible = true;
+                },
+                getPrinterList() {  // 获取打印机列表
+                    this.printerList = [];
+                    let count = this.clodop.GET_PRINTER_COUNT();
+                    for (let i = 0; i < count; i++) {
+                        this.printerList.push({
+                            name: this.clodop.GET_PRINTER_NAME(i),
+                            value: i,
+                        });
+                    }
+                },
+                clodopPrint() {
+                    let {
+                        number,               // 收货任务号
+                        warehouse,             // 仓库
+                        for_single_member,    // 投单员
+                        driver_name,          // 司机姓名
+                        driver_phone,         // 司机电话
+                        plate_number,          // 车号牌
+                        driving_license_no,    // 驾驶证号
+                        provide_list,         // 是否提供清单
+                        receiving_type,       // 收货类型
+                        owner,                // 货主
+                        appointment_number, // 预约号
+                    } = this.receiving_task_print;
+                    this.clodop.PRINT_INITA(2, 0, 0, 0, "");
+                    this.clodop.SET_PRINT_PAGESIZE(2, '76mm', '130mm');
+                    this.clodop.ADD_PRINT_BARCODE(20, 70, 350, 50, "Code39", number);
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.ADD_PRINT_TEXT(100, 15, 100, 20, "收货任务号");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 15, 100, 20, "仓库");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(160, 15, 100, 20, "司机姓名");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(190, 15, 100, 20, "车牌号");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(220, 15, 100, 20, "是否提供清单");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(250, 15, 100, 20, "货主");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 245, 100, 20, "投单员");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(160, 245, 100, 20, "司机电话");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(190, 245, 100, 20, "驾驶证号");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(220, 245, 100, 20, "收货类型");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(250, 245, 100, 20, "预约号");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(100, 115, 250, 20, number); // number
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 115, 130, 20, warehouse);  // warehouse
+                    this.clodop.ADD_PRINT_TEXT(160, 115, 100, 20, driver_name); //driver_name
+                    this.clodop.ADD_PRINT_TEXT(190, 115, 130, 20, plate_number);  //plate_number
+                    this.clodop.ADD_PRINT_TEXT(220, 115, 100, 20, provide_list); //provide_list
+                    this.clodop.ADD_PRINT_TEXT(250, 115, 130, 20, owner);  // owner
+                    this.clodop.ADD_PRINT_TEXT(130, 345, 100, 20, for_single_member);  // for_single_member
+                    this.clodop.ADD_PRINT_TEXT(160, 345, 140, 20, driver_phone); // driver_phone
+                    this.clodop.ADD_PRINT_TEXT(190, 345, 140, 20, driving_license_no); // driving_license_no
+                    this.clodop.ADD_PRINT_TEXT(220, 345, 100, 20, receiving_type);  // receiving_type
+                    this.clodop.ADD_PRINT_TEXT(250, 345, 140, 20, appointment_number); //appointment_number
+                    this.clodop.PREVIEW();
+                }
+            }
+        })
+    </script>
+    <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
+        <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
+    </object>
+@endsection

+ 359 - 0
resources/views/store/receivingTasks/index.blade.php

@@ -0,0 +1,359 @@
+@extends('layouts.app')
+@section('title')开单入库-查询@endsection
+@section('head')
+    <link href="{{ mix('css/element-ui.css') }}" rel="stylesheet">
+    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
+@endsection
+
+
+@section('content')
+    <div id="list" class="container-fluid d-none">
+        <div>
+            <div id="form_div" style="min-width: 1220px;"></div>
+            <div class="ml-3 form-inline" id="btn">
+                @can('入库管理-开单入库-打印任务单')
+                    <button type="button"
+                            class="ml-2 btn btn-sm btn-outline-success "
+                            @click="printReceivingTask">打印任务清单
+                    </button>
+                @endcan
+            </div>
+            <div>
+                <table class="table table-sm table-striped table-hover table-bordered" id="table">
+                    <tbody>
+                    <tr v-for="(item,i) in receiving_tasks"
+                        @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
+                        <td>
+                            <input type="checkbox" class="checkItem" :value="item.id">
+                        </td>
+                        <td v-text="i+1"></td>
+                        <td v-text="item.number"></td>
+                        <td v-text="item.status"></td>
+                        <td>
+                            <template v-for="(asn_no,i) in item.asn_nos">
+                                <div>
+                                    <span v-text="asn_no"></span>
+                                </div>
+                            </template>
+                        </td>
+                        <td v-text="item.created_at"></td>
+                        <td v-text="item.warehouse"></td>
+                        <td v-text="item.appointment_number"></td>
+                        <td v-text="item.driving_license_no"></td>
+                        <td v-text="item.receiving_type"></td>
+                    </tr>
+                    </tbody>
+                </table>
+                <div class="text-info h5 btn btn">{{$receivingTasks->count()}}/@{{ total }}</div>
+                {{ $receivingTasks->withQueryString()->links() }}
+            </div>
+        </div>
+        @include('store.receivingTasks._clodop_print')
+    </div>
+@endsection
+@section('lastScript')
+    <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
+    <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
+    <script type="text/javascript" src="{{mix('js/element-ui.js') }}"></script>
+    <script type="text/javascript" src="{{mix('js/lodop/LodopFuncs.js')}}"></script>
+
+    <script type="text/javascript" src='http://localhost:18000/CLodopfuncs.js?name=CLODOPA'></script>
+
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                receiving_tasks: [],
+                total: 0,
+                selectTr: 0,
+                owners: [
+                        @foreach($owners as $owner)
+                    {
+                        name: '{{$owner->id}}', value: '{{$owner->name}}'
+                    },
+                    @endforeach
+                ],
+                warehouses: [
+                        @foreach($warehouses as $warehouse)
+                    {
+                        name: '{{$warehouse->id}}', value: '{{$warehouse->name}}'
+                    },
+                    @endforeach
+                ],
+                receiving_task_print: {
+                    number: null,
+                    warehouse: null,
+                    for_single_member: null,
+                    driver_name: null,
+                    driver_phone: null,
+                    plate_number: null,
+                    driving_license_no: null,
+                    provide_list: null,
+                    receiving_type: null,
+                    owner: null,
+                    appointment_number: null,
+                },
+                clodop: null,
+                clodopPrintDialogVisible: false,
+                printerList: [],
+                print_setting: {
+                    printer_index: 0,
+                }
+            },
+            created() {
+            },
+            mounted() {
+                let receiving_tasks = {!! $receivingTasks->toJson() !!}['data'];
+                this.receiving_tasks = this.sortReceivingTasks(receiving_tasks);
+                this.total = {!! $receivingTasks->toJson() !!}['total'];
+                $("#list").removeClass('d-none');
+                let data = [[
+                    {name: 'created_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间', placeholder: ''},
+                    {name: 'created_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间', placeholder: ''},
+                    {name: 'number', type: 'input', tip: '任务号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '任务号'},
+                    {name: 'appointment_number', type: 'input', tip: '预约号:如模糊搜索需要在条件前后输入%号,回车提交', placeholder: '预约号'},
+                ], [
+                    {
+                        name: 'owner_id',
+                        type: 'select_multiple_select',
+                        data: this.owners,
+                        tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的货主'],
+                        placeholder: ['货主', '定位或多选货主']
+                    },
+                    {
+                        name: 'warehouse_id',
+                        type: 'select_multiple_select',
+                        data: this.warehouses,
+                        tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的仓库'],
+                        placeholder: ['仓库', '定位或多选仓库']
+                    },
+                ]];
+                this.form = new query({
+                    el: '#form_div',
+                    condition: data,
+                });
+                this.form.init();
+
+                let column = [
+                    {name: 'id', value: '序号', neglect: true},
+                    {name: 'number', value: '收货任务号'},
+                    {name: 'status', value: '状态', neglect: true},
+                    {name: 'asn_nos', value: 'ASN单号', neglect: true},
+                    {name: 'created_at', value: '投单时间'},
+                    {name: 'warehouse', value: '仓库'},
+                    {name: 'appointment_number', value: '预约号'},
+                    {name: 'driving_license_no', value: '驾驶证号'},
+                    {name: 'receiving_type', value: '收货类型'},
+                ];
+                let init = new Header({
+                    el: "table",
+                    name: "receiving_tasks",
+                    column: column,
+                    data: this.receiving_tasks,
+                    restorationColumn: 'id',
+                    fixedTop: ($('#form_div').height()) + ($('#btn').height()) + 1,
+                });
+                setTimeout(()=>{
+                    init.init();
+                },300);
+            },
+            methods: {
+                waitingTempTip(message) {
+                    window.tempTip.setIndex(2005);
+                    window.tempTip.waitingTip(message);
+                },
+                successTempTip(message) {
+                    window.tempTip.setDuration(1500);
+                    window.tempTip.setIndex(2005);
+                    window.tempTip.showSuccess(message);
+                },
+                errorTempTip(message) {
+                    window.tempTip.setDuration(2000);
+                    window.tempTip.setIndex(2005);
+                    window.tempTip.show(message);
+                },
+                sortReceivingTasks(tasks) {
+                    return tasks.map(e => this.sortReceivingTask(e));
+                },
+                sortReceivingTask(task) {
+                    let asn_nos = this.sortAsnNos(task);
+                    let driving_license_no = this.getDrivingLicenseNo(task);
+                    let appointment_number = this.getAppointmentNumber(task);
+                    let warehouse = this.getWarehouseName(task);
+                    let owner = this.getOwnerName(task);
+                    return {
+                        id: task.id,
+                        number: task.number,
+                        status: task.status,
+                        asn_nos: asn_nos,
+                        created_at: task.created_at,
+                        warehouse: warehouse,
+                        for_single_member: task.for_single_member,
+                        driver_name: task.driver_name,
+                        driver_phone: task.driver_phone,
+                        plate_number: task.plate_number,
+                        provide_list: task.provide_list,
+                        owner: owner,
+                        appointment_number: appointment_number,
+                        driving_license_no: driving_license_no,
+                        receiving_type: task.receiving_type,
+                    };
+                },
+                sortAsnNos(task) {
+                    let items = task.items;
+                    return items.map(e => e.asn_no);
+                },
+                getDrivingLicenseNo(task) {
+                    let {delivery_appointment_car, driving_license_no} = task;
+                    let license_plate_number = delivery_appointment_car ? delivery_appointment_car.license_plate_number : '';
+                    return driving_license_no ? driving_license_no : license_plate_number;
+                },
+                getAppointmentNumber(task) {
+                    let {delivery_appointment_car} = task;
+                    return delivery_appointment_car ? delivery_appointment_car.appointment_number : '';
+                },
+                getWarehouseName(task) {
+                    let {ware_house} = task;
+                    return ware_house ? ware_house.name : '';
+                },
+                getOwnerName(task) {
+                    let {owner} = task;
+                    return owner ? owner.name : '';
+                },
+                printReceivingTask() {
+                    let message = null;
+                    if (checkData.length > 1) {
+                        message = '进行单个任务打印';
+                    } else if (checkData.length < 1) {
+                        message = '请勾选收货任务';
+                    }
+                    if (message) {
+                        this.errorTempTip(message);
+                        return;
+                    }
+                    let id = checkData[0];
+                    this.receiving_task_print = this.receiving_tasks.find(e => e.id.toString() === id);
+                    this.printLodop();
+                },
+                printLodop() {
+                    this.clodop = null;
+                    try {
+                        this.clodop = getLodop();
+                        if ((this.clodop != null) && (typeof (this.clodop.VERSION) != "undefined")) {
+                            this.showPrintDialog();
+                        } else {
+                            this.downloadClodopConfirm();
+                        }
+                    } catch (err) {
+                        this.errorTempTip('getLodop error');
+                    }
+                },
+                downloadClodopConfirm() {
+                    this.$confirm('打印组件不存在,是否下载?', '提示', {
+                        confirmButtonText: '确定',
+                        cancelButtonText: '取消',
+                        type: 'warning'
+                    }).then(() => {
+                        // 下载
+                        this.downloadLodop();
+                    }).catch(() => {
+                        // 取消下载
+                    });
+                },
+                downloadLodop() {
+                    let url = "{{mix('/js/lodop/CLodop_Setup_for_Win32NT.exe')}}"
+                    window.open(url, '_target');
+                },
+                showPrintDialog() { //
+                    this.getPrinterList();
+                    this.clodopPrintDialogVisible = true;
+                },
+                getPrinterList() {  // 获取打印机列表
+                    this.printerList = [];
+                    let count = this.clodop.GET_PRINTER_COUNT();
+                    for (let i = 0; i < count; i++) {
+                        this.printerList.push({
+                            name: this.clodop.GET_PRINTER_NAME(i),
+                            value: i,
+                        });
+                    }
+                },
+                clodopPrint() {
+                    let {
+                        number,               // 收货任务号
+                        warehouse,             // 仓库
+                        for_single_member,    // 投单员
+                        driver_name,          // 司机姓名
+                        driver_phone,         // 司机电话
+                        plate_number,          // 车号牌
+                        driving_license_no,    // 驾驶证号
+                        provide_list,         // 是否提供清单
+                        receiving_type,       // 收货类型
+                        owner,                // 货主
+                        appointment_number, // 预约号
+                    } = this.receiving_task_print;
+
+                    this.clodop.PRINT_INITA(2, 0, 0, 0, "");
+                    this.clodop.SET_PRINT_PAGESIZE(2, '76mm', '130mm');
+                    this.clodop.ADD_PRINT_BARCODE(20, 70, 350, 50, "Code39", number);
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.ADD_PRINT_TEXT(100, 15, 100, 20, "收货任务号");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 15, 100, 20, "仓库");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(160, 15, 100, 20, "司机姓名");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(190, 15, 100, 20, "车牌号");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(220, 15, 100, 20, "是否提供清单");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(250, 15, 100, 20, "货主");
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 245, 100, 20, "投单员");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(160, 245, 100, 20, "司机电话");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(190, 245, 100, 20, "驾驶证号");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(220, 245, 100, 20, "收货类型");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(250, 245, 100, 20, "预约号");
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(100, 115, 250, 20, number); // number
+                    this.clodop.SET_PRINT_STYLEA(0, "FontSize", 10);
+                    this.clodop.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    this.clodop.SET_PRINT_STYLEA(0, "Bold", 1);
+                    this.clodop.ADD_PRINT_TEXT(130, 115, 130, 20, warehouse);  // warehouse
+                    this.clodop.ADD_PRINT_TEXT(160, 115, 100, 20, driver_name); //driver_name
+                    this.clodop.ADD_PRINT_TEXT(190, 115, 130, 20, plate_number);  //plate_number
+                    this.clodop.ADD_PRINT_TEXT(220, 115, 100, 20, provide_list); //provide_list
+                    this.clodop.ADD_PRINT_TEXT(250, 115, 130, 20, owner);  // owner
+                    this.clodop.ADD_PRINT_TEXT(130, 345, 100, 20, for_single_member);  // for_single_member
+                    this.clodop.ADD_PRINT_TEXT(160, 345, 140, 20, driver_phone); // driver_phone
+                    this.clodop.ADD_PRINT_TEXT(190, 345, 140, 20, driving_license_no); // driving_license_no
+                    this.clodop.ADD_PRINT_TEXT(220, 345, 100, 20, receiving_type);  // receiving_type
+                    this.clodop.ADD_PRINT_TEXT(250, 345, 140, 20, appointment_number); //appointment_number
+                    this.clodop.PREVIEW();
+                    this.clodopPrintDialogVisible = false;
+                }
+            },
+        })
+    </script>
+@endsection

+ 13 - 0
routes/apiLocal.php

@@ -62,6 +62,19 @@ Route::group(['prefix' => 'personnel'], function () {
         });
     });
 });
+// 开单入库
+Route::prefix('store')->group(function(){
+    Route::prefix('receivingMask')->group(function(){
+        Route::post("/createApi","ReceivingTaskController@storeApi")->name("store.receivingMask.storeApi");
+    });
+});
+Route::prefix('oracle')->group(function(){
+    Route::prefix('asn')->group(function(){
+        Route::post("/toBeProcess/CustomerId","OracleDOCAsnHeaderController@getToBeProcessAsnHeaderDetailsApi")
+            ->name("oracle.asn.getToBeProcessApi");
+    });
+});
+
 
 Route::group(['prefix' => 'order'], function () {
     Route::group(['prefix'=>'issue'],function(){

+ 9 - 0
routes/web.php

@@ -32,6 +32,14 @@ Route::post('package/weigh/measureMonitor/data', 'MeasureMonitorController@data'
 Route::get('package/measureMonitor', 'MeasureMonitorController@index');
 Route::get('package/weigh/measureMonitor', 'MeasureMonitorController@index');
 
+// 开单入库
+Route::prefix('store')->group(function(){
+    Route::prefix('receivingTask')->group(function(){
+        Route::get("/index","ReceivingTaskController@index");
+        Route::get("/create","ReceivingTaskController@create");
+    });
+});
+
 //入库预约终端
 Route::get('store/deliveryAppointment/exhibition', 'DeliveryAppointmentController@exhibition');
 //入库预约预约码输入
@@ -1096,6 +1104,7 @@ Route::group(['middleware' => 'auth'], function ($route) {
                     return view("station.monitor.visual");
                 });
                 Route::post('getData', 'StationController@getVisual');
+                Route::post('getBoxes', 'StationController@getBoxes');
                 Route::post('getDetail', 'StationController@getDetail');
             });
         });