Ver Fonte

Merge branch 'master' into zengjun

ajun há 5 anos atrás
pai
commit
b4ecf3dcff
100 ficheiros alterados com 2656 adições e 572 exclusões
  1. 45 0
      app/Console/Commands/UpdateOrderPackageExceptionTypeCountingRecordTask.php
  2. 2 0
      app/Console/Kernel.php
  3. 16 0
      app/Events/DeliveryAppointmentEvent.php
  4. 41 0
      app/Events/UpdateOrderPackageExceptionListenerEvent.php
  5. 6 1
      app/Feature.php
  6. 9 1
      app/Filters/OrderPackageFilters.php
  7. 5 3
      app/Filters/ProcurementCheckSheetFilters.php
  8. 3 5
      app/Http/Controllers/CarTypesController.php
  9. 15 1
      app/Http/Controllers/ControlPanelController.php
  10. 2 1
      app/Http/Controllers/CustomerController.php
  11. 40 12
      app/Http/Controllers/DeliveryAppointmentController.php
  12. 19 6
      app/Http/Controllers/PackageLogisticController.php
  13. 39 7
      app/Http/Controllers/ProcurementController.php
  14. 8 0
      app/Http/Controllers/StoreController.php
  15. 71 7
      app/Http/Controllers/TestController.php
  16. 11 0
      app/Http/Controllers/WaybillController.php
  17. 76 76
      app/Http/Controllers/api/thirdPart/flux/SortingController.php
  18. 2 0
      app/Http/Kernel.php
  19. 1 0
      app/Http/Middleware/Authenticate.php
  20. 21 0
      app/Http/Middleware/CheckCsrfToken.php
  21. 1 0
      app/Http/Middleware/VerifyCsrfToken.php
  22. 132 0
      app/Imports/RejectedImport.php
  23. 1 1
      app/Jobs/DeliveryAppointmentCheck.php
  24. 57 0
      app/Jobs/LogisticYDSync.php
  25. 7 159
      app/Jobs/LogisticZopSync.php
  26. 1 1
      app/Jobs/ResetInstantBill.php
  27. 5 1
      app/Listeners/AddOrUpdateOrderIssuesListener.php
  28. 5 1
      app/Listeners/UpdateOrderPackageExceptionListener.php
  29. 42 0
      app/Listeners/UpdateOrderPackageExceptionTypeCountingRecordListener.php
  30. 1 1
      app/Logistic.php
  31. 28 1
      app/MaterialBox.php
  32. 1 0
      app/OrderIssueRejectedBill.php
  33. 17 0
      app/OrderPackageExceptionTypeCountingRecord.php
  34. 6 2
      app/ProcurementTotalBill.php
  35. 4 0
      app/Providers/AppServiceProvider.php
  36. 0 4
      app/Providers/AuthServiceProvider.php
  37. 7 4
      app/Providers/EventServiceProvider.php
  38. 1 1
      app/Services/BatchService.php
  39. 2 2
      app/Services/ForeignHaiRoboticsService.php
  40. 8 0
      app/Services/LaborReportService.php
  41. 134 120
      app/Services/LogisticSFService.php
  42. 178 0
      app/Services/LogisticYDService.php
  43. 71 0
      app/Services/OrderPackageExceptionTypeCountingRecordService.php
  44. 192 12
      app/Services/OrderPackageReceivedSyncService.php
  45. 3 3
      app/Services/OwnerPriceExpressService.php
  46. 17 7
      app/Services/OwnerPriceOperationService.php
  47. 18 13
      app/Services/OwnerService.php
  48. 12 0
      app/Services/PackageService.php
  49. 134 2
      app/Services/StoreService.php
  50. 42 0
      app/Services/WaybillService.php
  51. 1 1
      app/Warehouse.php
  52. 1 1
      app/library/baidu-api-speech/lib/2a7552bdd1b678c303ad53645baeafce
  53. 10 11
      app/library/zop/ZopClient.php
  54. 29 7
      config/api_logistic.php
  55. 1 1
      database/factories/OracleBasCustomerFactory.php
  56. 12 0
      database/factories/OrderPackageExceptionTypeCountingRecordFactory.php
  57. 24 1
      database/factories/OrderPackageFactory.php
  58. 1 1
      database/factories/OwnerBillReportFactory.php
  59. 0 1
      database/factories/OwnerReportFactory.php
  60. 13 0
      database/factories/TaxRateFactory.php
  61. 3 1
      database/factories/WarehouseFactory.php
  62. 32 0
      database/migrations/2021_05_07_141019_add_index_exception_type_sent_at_owner_id_order_packages_table.php
  63. 35 0
      database/migrations/2021_05_07_141912_create_order_package_exception_type_counting_records_table.php
  64. 36 0
      database/migrations/2021_05_14_100303_change_warehouses_table_add_column_address_column.php
  65. 35 0
      database/migrations/2021_05_18_093618_add_authorities_wabill.php
  66. 30 0
      database/migrations/2021_05_18_151348_add_authority_order_package_remark.php
  67. 32 0
      database/migrations/2021_05_19_154807_change_logistics_table_add_english_name_column.php
  68. 32 0
      database/migrations/2021_05_19_173442_add_materialBoxes_field_status.php
  69. 16 0
      database/seeds/OrderPackageExceptionTypeCountingRecordSeeder.php
  70. 180 0
      horizon.conf
  71. BIN
      public/images/QRCodeIMG/1.png
  72. 25 4
      public/t.php
  73. 6 5
      resources/js/queryForm/header.js
  74. 8 6
      resources/js/queryForm/queryForm.js
  75. 93 0
      resources/views/control/panel.blade.php
  76. 13 6
      resources/views/customer/project/create.blade.php
  77. 2 1
      resources/views/customer/project/part/_operation.blade.php
  78. 1 0
      resources/views/customer/project/part/_three.blade.php
  79. 1 1
      resources/views/inventory/statement/changeInventory.blade.php
  80. 7 0
      resources/views/maintenance/logistic/create.blade.php
  81. 9 2
      resources/views/maintenance/logistic/edit.blade.php
  82. 2 0
      resources/views/maintenance/logistic/index.blade.php
  83. 1 0
      resources/views/maintenance/role/index.blade.php
  84. 2 1
      resources/views/maintenance/user/index.blade.php
  85. 36 0
      resources/views/maintenance/warehouse/create.blade.php
  86. 37 1
      resources/views/maintenance/warehouse/edit.blade.php
  87. 9 0
      resources/views/maintenance/warehouse/index.blade.php
  88. 0 1
      resources/views/order/index/delivering.blade.php
  89. 56 18
      resources/views/package/logistic/index.blade.php
  90. 17 22
      resources/views/package/measureMonitor/index.blade.php
  91. 1 1
      resources/views/personnel/checking-in/createReplenishClock.blade.php
  92. 1 1
      resources/views/personnel/discharge/facilitator/index.blade.php
  93. 1 1
      resources/views/process/index.blade.php
  94. 5 4
      resources/views/procurement/finance/checkBill.blade.php
  95. 4 4
      resources/views/procurement/finance/menu.blade.php
  96. 141 8
      resources/views/procurement/finance/monthlyBillReport.blade.php
  97. 1 1
      resources/views/procurement/finance/procurementBill.blade.php
  98. 0 2
      resources/views/rejected/recycle.blade.php
  99. 0 2
      resources/views/rejected/search/general.blade.php
  100. 95 0
      resources/views/store/deliveryAppointment/_printBody.blade.php

+ 45 - 0
app/Console/Commands/UpdateOrderPackageExceptionTypeCountingRecordTask.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Services\LogService;
+use Illuminate\Console\Command;
+
+class UpdateOrderPackageExceptionTypeCountingRecordTask extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'updateOrderPackageExceptionTypeCountingRecordTask';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = '更新order_package_exception_type_counting_records';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        LogService::log(__CLASS__,"更新order_package_exception_type_counting_records",'');
+        ini_set('memory_limit','2226M');
+        app('OrderPackageExceptionTypeCountingRecordService')->updateOrCreate(7);
+    }
+}

+ 2 - 0
app/Console/Kernel.php

@@ -72,6 +72,8 @@ class  Kernel extends ConsoleKernel
         $schedule->command('sync:batch')->everyMinute();
         $schedule->command('sync:batch')->everyMinute();
         $schedule->command('sync:order')->everyMinute();
         $schedule->command('sync:order')->everyMinute();
         $schedule->command('syncOrderPackageLogisticRouteTask')->dailyAt('1:20');//同步快递信息到orderPackage
         $schedule->command('syncOrderPackageLogisticRouteTask')->dailyAt('1:20');//同步快递信息到orderPackage
+        $schedule->command('syncOrderPackageLogisticRouteTask')->dailyAt('12:01');//同步快递信息到orderPackage
+        $schedule->command('updateOrderPackageExceptionTypeCountingRecordTask')->dailyAt('2:20');//更新OrderPackageExceptionTypeCountingRecord
         $schedule->command('SyncWmsCommoditiesInformation')->everyMinute();
         $schedule->command('SyncWmsCommoditiesInformation')->everyMinute();
         $schedule->command('clear:cancelledOrder')->everyMinute();
         $schedule->command('clear:cancelledOrder')->everyMinute();
         $schedule->command('WasSyncWmsAsnInformation')->everyMinute();
         $schedule->command('WasSyncWmsAsnInformation')->everyMinute();

+ 16 - 0
app/Events/DeliveryAppointmentEvent.php

@@ -2,6 +2,7 @@
 
 
 namespace App\Events;
 namespace App\Events;
 
 
+use App\DeliveryAppointment;
 use App\DeliveryAppointmentCar;
 use App\DeliveryAppointmentCar;
 use Illuminate\Broadcasting\Channel;
 use Illuminate\Broadcasting\Channel;
 use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
 use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
@@ -27,10 +28,25 @@ class DeliveryAppointmentEvent implements ShouldBroadcastNow
             /** @var Builder $query */
             /** @var Builder $query */
             $query->withCount("cars");
             $query->withCount("cars");
         }]);
         }]);
+
+        $owner = $delivery->deliveryAppointment->owner->name ?? "";
+        $len = mb_strlen($owner);
+        $ownerName = "";
+        for($i=0;$i<$len-1;$i++)$ownerName .= "*";
+        $ownerName .= mb_substr($owner,$len-1,1);
+
         $count = $delivery->deliveryAppointment->cars_count ?? 0;
         $count = $delivery->deliveryAppointment->cars_count ?? 0;
         $delivery->warehouse = $delivery->deliveryAppointment->warehouse_id ?? "";
         $delivery->warehouse = $delivery->deliveryAppointment->warehouse_id ?? "";
         $delivery->cubic_meter = isset($delivery->deliveryAppointment->cubic_meter) && $delivery->deliveryAppointment->cubic_meter>0 ? ($count>1 ? $delivery->deliveryAppointment->cubic_meter."/".$count : $delivery->deliveryAppointment->cubic_meter) : "";
         $delivery->cubic_meter = isset($delivery->deliveryAppointment->cubic_meter) && $delivery->deliveryAppointment->cubic_meter>0 ? ($count>1 ? $delivery->deliveryAppointment->cubic_meter."/".$count : $delivery->deliveryAppointment->cubic_meter) : "";
         $delivery->tonne = isset($delivery->deliveryAppointment->tonne) && $delivery->deliveryAppointment->tonne>0 ? ($count>1 ? $delivery->deliveryAppointment->tonne."/".$count : $delivery->deliveryAppointment->tonne) : "";
         $delivery->tonne = isset($delivery->deliveryAppointment->tonne) && $delivery->deliveryAppointment->tonne>0 ? ($count>1 ? $delivery->deliveryAppointment->tonne."/".$count : $delivery->deliveryAppointment->tonne) : "";
+        $delivery->license_plate_number = $delivery->license_plate_number ? $delivery->license_plate_number : substr($delivery->appointment_number,0,5)."****".substr($delivery->appointment_number,9,1);
+        $delivery->owner_name = $ownerName;
+        $delivery->status = DeliveryAppointmentCar::STATUS[$delivery->status];
+        $delivery->type = DeliveryAppointment::TYPE[$delivery->deliveryAppointment->type_mark] ?? '';
+        $delivery->period = isset($delivery->deliveryAppointment->date_period) ? ($delivery->deliveryAppointment->date_period==0 ? '上午' : '下午') : '';
+        $delivery->delivery_time = $delivery->delivery_time ? substr($delivery->delivery_time,11,5) : '';
+
+        $delivery->morrow = $delivery->deliveryAppointment->appointment_date == date('Y-m-d',strtotime("+1 day"));
         $this->delivery = $delivery->withoutRelations();
         $this->delivery = $delivery->withoutRelations();
     }
     }
 
 

+ 41 - 0
app/Events/UpdateOrderPackageExceptionListenerEvent.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Events;
+
+use Illuminate\Broadcasting\Channel;
+use Illuminate\Broadcasting\InteractsWithSockets;
+use Illuminate\Broadcasting\PresenceChannel;
+use Illuminate\Broadcasting\PrivateChannel;
+use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
+use Illuminate\Foundation\Events\Dispatchable;
+use Illuminate\Queue\SerializesModels;
+
+class UpdateOrderPackageExceptionListenerEvent
+{
+    use Dispatchable, InteractsWithSockets, SerializesModels;
+
+    /**
+     * @var $order_package_ids array
+     */
+    public $order_package_ids;
+
+    /**
+     * UpdateOrderPackageExceptionListenerEvent constructor.
+     * @param $order_package_ids
+     */
+    public function __construct($order_package_ids)
+    {
+        $this->order_package_ids = $order_package_ids;
+    }
+
+
+    /**
+     * Get the channels the event should broadcast on.
+     *
+     * @return \Illuminate\Broadcasting\Channel|array
+     */
+    public function broadcastOn()
+    {
+        return new PrivateChannel('channel-name');
+    }
+}

+ 6 - 1
app/Feature.php

@@ -19,7 +19,7 @@ class Feature extends Model
     const TYPE = [
     const TYPE = [
         0 => "商品名称",  //二级
         0 => "商品名称",  //二级
         1 => "订单类型",
         1 => "订单类型",
-        2 => "承运商",
+        2 => "承运商名称",
         3 => "店铺类型",
         3 => "店铺类型",
         4 => "波次类型",
         4 => "波次类型",
         5 => "商品备注",  //二级
         5 => "商品备注",  //二级
@@ -27,6 +27,8 @@ class Feature extends Model
         7 => "订单备注",
         7 => "订单备注",
         10=> "订单商品数",//二级
         10=> "订单商品数",//二级
         11=> "属性仓",
         11=> "属性仓",
+        12=> "订单商品数",
+        13=> "承运商英文名",
     ];
     ];
     //额外定义 8:商品数量 9:商品
     //额外定义 8:商品数量 9:商品
     const TYPE_NODE = [0,5,6,8,9,10]; //标注二级类型
     const TYPE_NODE = [0,5,6,8,9,10]; //标注二级类型
@@ -41,6 +43,7 @@ class Feature extends Model
             9 => "store_items.commodity",
             9 => "store_items.commodity",
             10=> "store_items.total",
             10=> "store_items.total",
             11=> "warehouse.name",
             11=> "warehouse.name",
+            12=> "total",
         ],
         ],
         "order" => [
         "order" => [
             0 => "packages.commodities.commodity.name",
             0 => "packages.commodities.commodity.name",
@@ -54,6 +57,8 @@ class Feature extends Model
             8 => 'packages.commodities.amount',
             8 => 'packages.commodities.amount',
             9 => 'packages.commodities.commodity',
             9 => 'packages.commodities.commodity',
             10=> 'packages.commodities.total',
             10=> 'packages.commodities.total',
+            12=> "total",
+            13=> "logistic.english_name",
         ]
         ]
     ];
     ];
 }
 }

+ 9 - 1
app/Filters/OrderPackageFilters.php

@@ -15,7 +15,7 @@ class OrderPackageFilters
     protected $request;
     protected $request;
     protected $queryBuilder;
     protected $queryBuilder;
     protected $filters = ['logistic_number', 'status', 'received_at_start',
     protected $filters = ['logistic_number', 'status', 'received_at_start',
-        'received_at_end', 'is_weighed', 'logistic_id', 'owner_id', 'sent_at_start', 'sent_at_end', 'is_exception', 'exception_type', 'default_date'];
+        'received_at_end', 'is_weighed', 'logistic_id', 'owner_id', 'sent_at_start', 'sent_at_end', 'is_exception', 'exception_type', 'default_date','has_transfer_status'];
 
 
     public function __construct(Request $request)
     public function __construct(Request $request)
     {
     {
@@ -49,6 +49,14 @@ class OrderPackageFilters
     {
     {
         $this->queryBuilder->where('exception_type', $exception_type);
         $this->queryBuilder->where('exception_type', $exception_type);
     }
     }
+    private function has_transfer_status($has_transfer_status)
+    {
+        if ($has_transfer_status=='是') {
+            $this->queryBuilder->whereNotNull('transfer_status');
+        } elseif ($has_transfer_status=='否') {
+            $this->queryBuilder->whereNull('transfer_status');
+        }
+    }
 
 
     private function status($status)
     private function status($status)
     {
     {

+ 5 - 3
app/Filters/ProcurementCheckSheetFilters.php

@@ -33,9 +33,10 @@ class ProcurementCheckSheetFilters
     public function apply($builder)
     public function apply($builder)
     {
     {
         $this->queryBuilder = $builder;
         $this->queryBuilder = $builder;
-        $filters = array_filter($this->request->only($this->filters));
+        $filters = array_filter($this->request->only($this->filters),function($item){
+            return $item == null ? false : true;
+        });
         $this->beforeApply();
         $this->beforeApply();
-
         foreach ($filters as $filter => $value) {
         foreach ($filters as $filter => $value) {
             if (method_exists($this, $filter)) {
             if (method_exists($this, $filter)) {
                 $this->$filter($value, $this->queryBuilder);
                 $this->$filter($value, $this->queryBuilder);
@@ -95,7 +96,8 @@ class ProcurementCheckSheetFilters
     }
     }
     public function signed_at($signed_at)
     public function signed_at($signed_at)
     {
     {
-        $this->getProcurementDeliveryQuery()->where('signed_at','>=',"{$signed_at} 00:00:00")->where('signed_at','<=',"{$signed_at} 23:59:59");
+//        $this->getProcurementDeliveryQuery()->where('signed_at','>=',"{$signed_at} 00:00:00")->where('signed_at','<=',"{$signed_at} 23:59:59");
+        $this->getProcurementDeliveryQuery()->where('signed_at','like',$signed_at.'%');
     }
     }
 
 
     public function beforeApply()
     public function beforeApply()

+ 3 - 5
app/Http/Controllers/CarTypesController.php

@@ -77,15 +77,13 @@ class CarTypesController extends Controller
         if ($id){$name=$id;}
         if ($id){$name=$id;}
         $validator=Validator::make($request->input(),[
         $validator=Validator::make($request->input(),[
             'CarType.name'=>['required','max:50',isset($name)?"unique:car_types,name,$name":'unique:car_types,name'],
             'CarType.name'=>['required','max:50',isset($name)?"unique:car_types,name,$name":'unique:car_types,name'],
-            'CarType.model'=>'nullable|alpha_dash|max:50',
-            'CarType.length'=>'nullable|numeric|min:0',
-            'CarType.load'=>'nullable|numeric|min:0',
+            'CarType.model'=>'nullable|max:50',
+            'CarType.length'=>'nullable|min:0',
+            'CarType.load'=>'nullable|min:0',
         ],[
         ],[
             'required'=>':attribute 为必填项',
             'required'=>':attribute 为必填项',
-            'alpha_dash'=>':attribute 应为字母,数字,下划线',
             'max'=>':attribute 字符过多或数值过大',
             'max'=>':attribute 字符过多或数值过大',
             'min'=>':attribute 不得为负',
             'min'=>':attribute 不得为负',
-            'numeric'=>':attribute 应为数字',
             'unique'=>':attribute 已存在',
             'unique'=>':attribute 已存在',
         ],[
         ],[
             'CarType.name'=>'车辆名称',
             'CarType.name'=>'车辆名称',

+ 15 - 1
app/Http/Controllers/ControlPanelController.php

@@ -160,6 +160,20 @@ class ControlPanelController extends Controller
         $this->success(["title"=>$title,"data"=>$data]);
         $this->success(["title"=>$title,"data"=>$data]);
     }
     }
 
 
+    public function exceptionTypeApi(Request $request)
+    {
+        $ownerIds=$request->owner_ids;
+        if (!$ownerIds || in_array('all',$ownerIds)) $ownerIds = $this->getCountingOwnerIds(null);
+        $service = app('OrderPackageExceptionTypeCountingRecordService');
+
+        $data = $service->get([
+            'start_date' => $request->start,
+            'end_date' => $request->end,
+            'owner_ids' => $ownerIds,
+        ]);
+        $this->success(["title"=>'',"data"=>$data]);
+    }
+
     /**
     /**
      * 根据指定日期获取目标统计数据
      * 根据指定日期获取目标统计数据
      *
      *
@@ -172,7 +186,7 @@ class ControlPanelController extends Controller
             $sql = <<<sql
             $sql = <<<sql
 SELECT DATE_FORMAT(order_packages.created_at,'%Y-%m-%d') date,
 SELECT DATE_FORMAT(order_packages.created_at,'%Y-%m-%d') date,
 SUM(CASE WHEN order_packages.weighed_at IS NOT NULL THEN 1 ELSE 0 END) AS count,
 SUM(CASE WHEN order_packages.weighed_at IS NOT NULL THEN 1 ELSE 0 END) AS count,
-COUNT(1) total FROM order_packages LEFT JOIN orders ON order_packages.order_id=orders.id WHERE orders.wms_status != '订单取消' 
+COUNT(1) total FROM order_packages LEFT JOIN orders ON order_packages.order_id=orders.id WHERE orders.wms_status != '订单取消'
 AND order_packages.created_at >= '{$date} 00:00:00' GROUP BY date
 AND order_packages.created_at >= '{$date} 00:00:00' GROUP BY date
 sql;
 sql;
 
 

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

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 use App\Components\AsyncResponse;
 use App\Components\AsyncResponse;
 use App\Jobs\OrderCreateInstantBill;
 use App\Jobs\OrderCreateInstantBill;
 use App\Jobs\ResetInstantBill;
 use App\Jobs\ResetInstantBill;
+use App\Jobs\StoreCreateInstantBill;
 use App\Order;
 use App\Order;
 use App\Owner;
 use App\Owner;
 use App\OwnerAreaReport;
 use App\OwnerAreaReport;
@@ -571,7 +572,7 @@ class CustomerController extends Controller
             ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")->where("outer_table_name","stores")
             ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")->where("outer_table_name","stores")
                 ->whereBetween("worked_at",["{$startData} 00:00:00","{$endDate} 23:59:59"]))->get();
                 ->whereBetween("worked_at",["{$startData} 00:00:00","{$endDate} 23:59:59"]))->get();
         foreach ($stores->chunk(50) as $st){
         foreach ($stores->chunk(50) as $st){
-            dispatch(new OrderCreateInstantBill($st));
+            dispatch(new StoreCreateInstantBill($st));
         }
         }
     }
     }
     public function resetBillConfirmation()
     public function resetBillConfirmation()

+ 40 - 12
app/Http/Controllers/DeliveryAppointmentController.php

@@ -29,7 +29,7 @@ class DeliveryAppointmentController extends Controller
     {
     {
         if(!Gate::allows('入库管理-入库预约-预约管理')){ return view("exception.authority");  }
         if(!Gate::allows('入库管理-入库预约-预约管理')){ return view("exception.authority");  }
         $list = app("DeliveryAppointmentService")->query(request()->input())
         $list = app("DeliveryAppointmentService")->query(request()->input())
-            ->with("logistic")
+            ->with(["logistic",'warehouse','details.commodity.barcodes','cars.car'])
             ->paginate(request("paginate") ?? 50);
             ->paginate(request("paginate") ?? 50);
 
 
         $warehouses = Warehouse::query()->select("id","name")->get();
         $warehouses = Warehouse::query()->select("id","name")->get();
@@ -174,8 +174,8 @@ class DeliveryAppointmentController extends Controller
                 $len = strlen($appointment->id);
                 $len = strlen($appointment->id);
                 $ten = $len < 2 ? "0" : substr($appointment->id,$len-2,1);
                 $ten = $len < 2 ? "0" : substr($appointment->id,$len-2,1);
                 $one = substr($appointment->id,$len-1,1);
                 $one = substr($appointment->id,$len-1,1);
-                //唯一码 随机数+十位+当前下标+个位+日期
-                $number = $rand.$ten.$index.$one.date("d");
+                //唯一码 仓库CODE+随机数+十位+当前下标+个位+日期
+                $number = $warehouse->code.$rand.$ten.$index.$one.date("d");
                 $insert[] = [
                 $insert[] = [
                     "delivery_appointment_id" => $appointment->id,
                     "delivery_appointment_id" => $appointment->id,
                     "license_plate_number"    => $car["license_plate_number"],
                     "license_plate_number"    => $car["license_plate_number"],
@@ -188,6 +188,11 @@ class DeliveryAppointmentController extends Controller
             DeliveryAppointmentCar::query()->insert($insert);
             DeliveryAppointmentCar::query()->insert($insert);
         });
         });
         dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($appointment->appointment_date." ".(explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1]).":00:01"));
         dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($appointment->appointment_date." ".(explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1]).":00:01"));
+        //当日或次日预约单广播
+        if (strtotime(date('Y-m-d',strtotime("+2 day")))>strtotime($appointment->appointment_date." 00:00:00")){
+            $appointment->load("cars");
+            event(new DeliveryAppointmentEvent($appointment->cars[0]));
+        }
         //md5加密在密文第五位后插入
         //md5加密在密文第五位后插入
         $md5 = substr_replace(md5(date("m-d")),$appointment->id,5,0);
         $md5 = substr_replace(md5(date("m-d")),$appointment->id,5,0);
         $this->success(["key"=>$md5]);
         $this->success(["key"=>$md5]);
@@ -234,6 +239,16 @@ class DeliveryAppointmentController extends Controller
             ]);
             ]);
         });
         });
         dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($selectDate["date"]." ".(explode("-",DeliveryAppointment::PERIOD[$selectDate["time"]])[1]).":00:01"));
         dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($selectDate["date"]." ".(explode("-",DeliveryAppointment::PERIOD[$selectDate["time"]])[1]).":00:01"));
+        //当日或次日预约单广播
+        $old = $appointment->appointment_date == date('Y-m-d') ? 0 : ($appointment->appointment_date == date('Y-m-d',strtotime('+1 day') ? 1 : 2));
+        $new = $selectDate["date"] == date('Y-m-d') ? 0 : ($selectDate["date"] == date('Y-m-d',strtotime('+1 day') ? 1 : 2));
+        if ($old==2 && $new==2)$this->success(); //超过广播区间不推送
+        if (($old-$new)!=0 || $appointment->date_period!=$selectDate["time"]){
+            $appointment->cars[0]->change = true;
+            $appointment->cars[0]->old = $old;
+            $appointment->cars[0]->new = $new;
+            event(new DeliveryAppointmentEvent($appointment->cars[0]));
+        }
         $this->success();
         $this->success();
     }
     }
 
 
@@ -362,7 +377,7 @@ class DeliveryAppointmentController extends Controller
         $list = [];
         $list = [];
         DeliveryAppointmentCar::query()->with(["deliveryAppointment"=>function($query){
         DeliveryAppointmentCar::query()->with(["deliveryAppointment"=>function($query){
             /** @var Builder $query */
             /** @var Builder $query */
-            $query->withCount("cars");
+            $query->withCount("cars")->with("owner");
         }])->whereHas("deliveryAppointment",function ($query)use($period,$warehouse,$date){
         }])->whereHas("deliveryAppointment",function ($query)use($period,$warehouse,$date){
             /** @var Builder $query */
             /** @var Builder $query */
             $query->where("appointment_date",$date)
             $query->where("appointment_date",$date)
@@ -376,15 +391,24 @@ class DeliveryAppointmentController extends Controller
             ->limit(10)->get()->each(function ($car)use(&$list){
             ->limit(10)->get()->each(function ($car)use(&$list){
                 //$diff = $car->delivery_time ? (strtotime($car->delivery_time)+1799)-time() : 0;
                 //$diff = $car->delivery_time ? (strtotime($car->delivery_time)+1799)-time() : 0;
                 $count = $car->deliveryAppointment->cars_count ?? 0;
                 $count = $car->deliveryAppointment->cars_count ?? 0;
+                $owner = $car->deliveryAppointment->owner->name ?? "";
+                $len = mb_strlen($owner);
+                $ownerName = "";
+                for($i=0;$i<$len-1;$i++)$ownerName .= "*";
+                $ownerName .= mb_substr($owner,$len-1,1);
                 $list[] = [
                 $list[] = [
                     "id" => $car->id,
                     "id" => $car->id,
-                    "license_plate_number" => $car->license_plate_number,
+                    "license_plate_number" => $car->license_plate_number ? $car->license_plate_number : substr($car->appointment_number,0,5)."****".substr($car->appointment_number,9,1),
                     "driver_name" => $car->driver_name,
                     "driver_name" => $car->driver_name,
                     "driver_phone" => $car->driver_phone,
                     "driver_phone" => $car->driver_phone,
-                    "status" => $car->status,
+                    "status" => DeliveryAppointmentCar::STATUS[$car->status],
                     "cubic_meter" => isset($car->deliveryAppointment->cubic_meter) && $car->deliveryAppointment->cubic_meter>0 ? ($count>1 ? $car->deliveryAppointment->cubic_meter."/".$count : $car->deliveryAppointment->cubic_meter) : "",
                     "cubic_meter" => isset($car->deliveryAppointment->cubic_meter) && $car->deliveryAppointment->cubic_meter>0 ? ($count>1 ? $car->deliveryAppointment->cubic_meter."/".$count : $car->deliveryAppointment->cubic_meter) : "",
                     "tonne" => isset($car->deliveryAppointment->tonne) && $car->deliveryAppointment->tonne>0 ? ($count>1 ? $car->deliveryAppointment->tonne."/".$count : $car->deliveryAppointment->tonne) : "",
                     "tonne" => isset($car->deliveryAppointment->tonne) && $car->deliveryAppointment->tonne>0 ? ($count>1 ? $car->deliveryAppointment->tonne."/".$count : $car->deliveryAppointment->tonne) : "",
                     //"diff" => $diff>0 ? $diff*1000 : 0,
                     //"diff" => $diff>0 ? $diff*1000 : 0,
+                    "owner_name" => $ownerName,
+                    "type" => DeliveryAppointment::TYPE[$car->deliveryAppointment->type_mark] ?? '',
+                    "period"=>isset($car->deliveryAppointment->date_period) ? ($car->deliveryAppointment->date_period==0 ? '上午' : '下午') : '',
+                    "delivery_time" => $car->delivery_time ? substr($car->delivery_time,11,5) : '',
                 ];
                 ];
             });
             });
         return $list;
         return $list;
@@ -576,14 +600,18 @@ html;
     public function verifyASN()
     public function verifyASN()
     {
     {
         $this->gate("入库管理-入库预约-预约");
         $this->gate("入库管理-入库预约-预约");
-        $asn = request("asn");
+        $asn = preg_split('/[,, ]+/is', request("asn"));
         $owner = request("owner_id");
         $owner = request("owner_id");
-        if (!$asn || strlen($asn)<13)$this->error("非法ASN单号");
-        $query = Store::query()->where("asn_code",$asn);
+        if (!$asn || strlen(request("asn"))<13)$this->error("非法ASN单号");
+        $query = Store::query()->whereIn("asn_code",$asn);
         if ($owner)$query->where("owner_id",$owner);
         if ($owner)$query->where("owner_id",$owner);
-        $store = $query->with("storeItems")->first();
-        if (!$store)$this->error("无此ASN单号");
-        $this->success($store->storeItems);
+        $stores = $query->with("storeItems")->get();
+        if (!$stores)$this->error("无此ASN单号");
+        $items = [];
+        $stores->each(function ($store)use(&$items){
+            if ($store->storeItems)$items = array_merge($items,$store->storeItems->toArray());
+        });
+        $this->success($items);
     }
     }
 
 
     /**
     /**

+ 19 - 6
app/Http/Controllers/PackageLogisticController.php

@@ -2,11 +2,13 @@
 
 
 namespace App\Http\Controllers;
 namespace App\Http\Controllers;
 
 
+use App\Events\UpdateOrderPackageExceptionListenerEvent;
 use App\Filters\OrderPackageFilters;
 use App\Filters\OrderPackageFilters;
 use App\Logistic;
 use App\Logistic;
 use App\OrderPackage;
 use App\OrderPackage;
 use App\Owner;
 use App\Owner;
 use App\Services\UserService;
 use App\Services\UserService;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 
 
 class PackageLogisticController extends Controller
 class PackageLogisticController extends Controller
@@ -28,7 +30,9 @@ class PackageLogisticController extends Controller
         $orderPackages = OrderPackage::query()
         $orderPackages = OrderPackage::query()
             ->filter($filters)
             ->filter($filters)
             ->whereIn('owner_id', $owner_ids)->with(['order.logistic', 'order.owner', 'order.issue' => function ($query) {
             ->whereIn('owner_id', $owner_ids)->with(['order.logistic', 'order.owner', 'order.issue' => function ($query) {
-                $query->with(['issueType', 'logs.user']);
+                $query->with(['issueType', 'logs'=>function($query) {
+                    $query->with('user')->orderBy('created_at', 'DESC');
+                }]);
             }])->orderByDesc('id')->paginate($request->paginate ?? 50);
             }])->orderByDesc('id')->paginate($request->paginate ?? 50);
         $logistics = Logistic::all();
         $logistics = Logistic::all();
         $owners = Owner::find($owner_ids);
         $owners = Owner::find($owner_ids);
@@ -45,17 +49,26 @@ class PackageLogisticController extends Controller
             $data['exception_type'] = $request->input('exception_type');
             $data['exception_type'] = $request->input('exception_type');
         }
         }
         OrderPackage::query()->where('id', $request['id'])->update($data);
         OrderPackage::query()->where('id', $request['id'])->update($data);
+        //更新统计数据
+        event(new UpdateOrderPackageExceptionListenerEvent([$request['id']]));
     }
     }
 
 
     public function batchUpdate(Request $request)
     public function batchUpdate(Request $request)
     {
     {
-        if ('无' == $request->input('exception_type')) {
-            $data['exception_type'] = $request->input('exception_type');
-            $data['exception'] = "否";
-        } else {
-            $data['exception_type'] = $request->input('exception_type');
+        $data = [];
+        if (array_key_exists('exception_type',$request->all())) {
+            if ('无' == $request->input('exception_type')) {
+                $data['exception_type'] = $request->input('exception_type');
+                $data['exception'] = "否";
+            } else {
+                $data['exception_type'] = $request->input('exception_type');
+            }
+        }else if (array_key_exists('status',$request->all())) {
+            $data['status'] = $request->input('status');
         }
         }
         $logistic_numbers = $request->input('logistic_numbers');
         $logistic_numbers = $request->input('logistic_numbers');
         OrderPackage::query()->whereIn('logistic_number', $logistic_numbers)->update($data);
         OrderPackage::query()->whereIn('logistic_number', $logistic_numbers)->update($data);
+        //更新统计数据
+        event(new UpdateOrderPackageExceptionListenerEvent($logistic_numbers));
     }
     }
 }
 }

+ 39 - 7
app/Http/Controllers/ProcurementController.php

@@ -64,7 +64,7 @@ class ProcurementController extends Controller
 
 
     public function index(Request $request,ProcurementFilters $filters)
     public function index(Request $request,ProcurementFilters $filters)
     {
     {
-        if(!Gate::allows('采购管理-采购-查询')){ return ["success"=>false,"data"=>"您无此权限操作!"];  }
+        if(!Gate::allows('采购管理-采购-查询')){ return redirect(url('/'));  }
         $paginateParams=$request->input();
         $paginateParams=$request->input();
         $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
         $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
         $procurements = Procurement::query()
         $procurements = Procurement::query()
@@ -272,7 +272,7 @@ class ProcurementController extends Controller
 
 
     public function checkBill(Request $request,ProcurementCheckSheetFilters $filters)
     public function checkBill(Request $request,ProcurementCheckSheetFilters $filters)
     {
     {
-        if(!Gate::allows('采购管理-财务-对账单')){ return ["success"=>false,"data"=>"您无此权限操作!"];  }
+        if(!Gate::allows('采购管理-财务-对账单')){ return redirect(url('/'));  }
         $paginateParams=$request->input();
         $paginateParams=$request->input();
         /**@var SupplierService $supplierService*/
         /**@var SupplierService $supplierService*/
         $supplierService=app(SupplierService::class);
         $supplierService=app(SupplierService::class);
@@ -298,15 +298,39 @@ class ProcurementController extends Controller
         $this->gate('采购管理-财务-对账单');
         $this->gate('采购管理-财务-对账单');
         $id=$request->input('procurementCheckSheetId');
         $id=$request->input('procurementCheckSheetId');
         $invoice_number=$request->input('invoice_number');
         $invoice_number=$request->input('invoice_number');
-        $procurementCheckSheet=ProcurementCheckSheet::query()->where('id',$id)->update(['invoice_number'=>$invoice_number]);
-        if ($procurementCheckSheet) return ['success' => true,'data' => $invoice_number];
-        else return ['success' => false, 'message' => '添加失败'];
+        $procurementCheckSheet=ProcurementCheckSheet::query()->find($id);
+        $procurementTotalBill=null;
+        $procurementCheckSheet->update([
+                'invoice_number'=>$invoice_number,
+                'status'=>3,//3 已完结
+            ]);
+        $supplier_id = $procurementCheckSheet->procurementDelivery->procurement->supplier_id ?? null;
+        $ProcurementQuery = Procurement::query()->select("id")
+            ->where('supplier_id',$supplier_id);
+        $procurementDeliveryQuery= ProcurementDeliverie::query()->select('id')
+            ->whereIn("procurement_id",$ProcurementQuery)
+            ->where("created_at","like",Carbon::parse($procurementCheckSheet['procurementDelivery']['created_at'])->format('Y-m')."%");
+        $count=ProcurementCheckSheet::query()
+            ->with(['procurementDelivery.procurement.ownerMaterial.material','procurementDelivery.procurement.supplier'])
+            ->whereIn('procurement_delivery_id',$procurementDeliveryQuery)->where('status','!=',3)->count();
+        if($count==0){
+            $procurementTotalBill=ProcurementTotalBill::query()
+                ->where('counting_month','like',Carbon::parse($procurementCheckSheet['procurementDelivery']['created_at'])->format('Y-m')."%")
+                ->where('supplier_id',$supplier_id)
+                ->update(['status'=>2]);
+        }
+        if ($procurementTotalBill) {
+            return ['success' => true,'data' => $invoice_number,'status'=>3,'totalStatus'=>2];
+        }
+        elseif ($procurementCheckSheet){
+            return ['success' => true,'data' => $invoice_number,'status'=>3];
+        }else return ['success' => false, 'message' => '添加失败'];
 
 
     }
     }
 
 
     public function procurementBill(Request $request,ProcurementFilters $filters)
     public function procurementBill(Request $request,ProcurementFilters $filters)
     {
     {
-        if(!Gate::allows('采购管理-财务-采购账单')){ return ["success"=>false,"data"=>"您无此权限操作!"];  }
+        if(!Gate::allows('采购管理-财务-采购账单')){ return redirect(url('/'));  }
         $paginateParams=$request->input();
         $paginateParams=$request->input();
         $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
         $owner_ids=app('UserService')->getPermittingOwnerIds(auth()->user());
         $owners=app("OwnerService")->getIntersectPermitting();
         $owners=app("OwnerService")->getIntersectPermitting();
@@ -336,7 +360,7 @@ class ProcurementController extends Controller
 
 
     public function monthlyBillReport(Request $request)
     public function monthlyBillReport(Request $request)
     {
     {
-        if(!Gate::allows('采购管理-财务-月账单报表')){ return ["success"=>false,"data"=>"您无此权限操作!"];  }
+        if(!Gate::allows('采购管理-财务-月账单报表')){ return redirect(url('/'));  }
         $paginateParams=$request->input();
         $paginateParams=$request->input();
         /** @var ProcurementTotalBillService $procurementTotalBillService*/
         /** @var ProcurementTotalBillService $procurementTotalBillService*/
         $procurementTotalBillService=app(ProcurementTotalBillService::class);
         $procurementTotalBillService=app(ProcurementTotalBillService::class);
@@ -344,6 +368,14 @@ class ProcurementController extends Controller
         $suppliers=Supplier::query()->select('id','name')->get();
         $suppliers=Supplier::query()->select('id','name')->get();
         return view('procurement/finance/monthlyBillReport',compact('suppliers','procurementTotalBills','paginateParams'));
         return view('procurement/finance/monthlyBillReport',compact('suppliers','procurementTotalBills','paginateParams'));
     }
     }
+    public function getCheckBillMonth(Request $request)
+    {
+        if(!Gate::allows('采购管理-财务-月账单报表')){ return ["success"=>false,"data"=>"您无此权限操作!"];  }
+        $procurementTotalBill=ProcurementTotalBill::query()->find($request->input('procurement_total_bill_id'));
+        /** @var  ProcurementTotalBill $procurementTotalBill */
+        $procurementTotalBill->setCurrentMothProcurements();
+        return ["success"=>true,"data"=>$procurementTotalBill->procurementCheckSheets??[]];
+    }
     //采购导出
     //采购导出
     public function procurementExport(Request $request,ProcurementFilters $filters){
     public function procurementExport(Request $request,ProcurementFilters $filters){
         $this->gate('采购管理-采购-查询');
         $this->gate('采购管理-采购-查询');

+ 8 - 0
app/Http/Controllers/StoreController.php

@@ -432,4 +432,12 @@ class StoreController extends Controller
         ])->validate();
         ])->validate();
         return $validator;
         return $validator;
     }
     }
+
+    /**
+     * 缓存架入库表单
+     */
+    public function cacheRackStorage()
+    {
+        return \view("store.inStorage.cacheRackStorage");
+    }
 }
 }

+ 71 - 7
app/Http/Controllers/TestController.php

@@ -25,6 +25,7 @@ use App\Exceptions\ErrorException;
 use App\Events\CancelOrder;
 use App\Events\CancelOrder;
 use App\Events\SendEmailEvent;
 use App\Events\SendEmailEvent;
 use App\Exceptions\Exception;
 use App\Exceptions\Exception;
+use App\Feature;
 use App\Http\Controllers\api\thirdPart\haiq\PickStationController;
 use App\Http\Controllers\api\thirdPart\haiq\PickStationController;
 use App\Http\Controllers\api\thirdPart\hengli\PackageController;
 use App\Http\Controllers\api\thirdPart\hengli\PackageController;
 use App\Http\Controllers\api\thirdPart\weight\WeightBaseController;
 use App\Http\Controllers\api\thirdPart\weight\WeightBaseController;
@@ -103,6 +104,7 @@ use App\Services\OracleDocAsnHerderService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OracleDocWaveDetailService;
 use App\Services\OracleDocWaveDetailService;
 use App\Services\OrderCommodityService;
 use App\Services\OrderCommodityService;
+use App\Services\OrderPackageExceptionTypeCountingRecordService;
 use App\Services\OrderPackageReceivedSyncService;
 use App\Services\OrderPackageReceivedSyncService;
 use App\Services\OrderPackageService;
 use App\Services\OrderPackageService;
 use App\Services\OrderService;
 use App\Services\OrderService;
@@ -176,16 +178,62 @@ class TestController extends Controller
     {
     {
         return call_user_func([$this, $method], $request);
         return call_user_func([$this, $method], $request);
     }
     }
-
     public function test()
     public function test()
     {
     {
-        $order = Order::query()->where("code","SO210509003964")->first();
+        Owner::query()->where("id",360)->update([
+            "relevance" => [0,1],
+        ]);
+        $customers = DB::connection("oracle")->select(DB::raw("select * from BAS_CUSTOMER where CUSTOMER_TYPE = 'CA'"));
+        foreach ($customers as $customer){
+            $l = Logistic::query()->where("code",$customer->customerid)->orWhere("name",$customer->descr_c)->first();
+            if ($l)$l->update(["english_name"=>$customer->descr_e]);
+        }
+        dd("OK");
+        $asnno = "ASN2105141388";
+        $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,d.RECEIVEDQTY_EACH,d.EXPECTEDQTY_EACH,d.LOTATT01,d.LOTATT02,d.lotatt04,".
+            "d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".
+            " LEFT JOIN BAS_SKU b ON d.CUSTOMERID = b.CUSTOMERID AND d.SKU = b.SKU INNER JOIN DOC_ASN_HEADER h ON d.ASNNO = h.ASNNO WHERE h.ASNNO = ?");
+        $detail = DB::connection("oracle")->selectOne($query,[$asnno]);
+        //dd($detail);
+        $ser = new StoreService();
+        $result = $ser->warehousing(array(
+            "IN_Warehouse" => $detail->warehouseid ?? '',
+            "In_ASNNo_C" => $detail->asnno ?? '',
+            "In_ASNLineNo_C" => $detail->asnlineno ?? '',
+            "In_New_TraceID_C" => (string)rand(100,999),
+            "In_CustomerID" => $detail->customerid ?? '',
+            "In_SKU" => $detail->sku ?? '',
+            "In_ReceivedQty" => (string)((int)$detail->expectedqty_each - (int)$detail->receivedqty_each) ?? '',
+            "In_PackID" => $detail->packid ?? '',
+            "In_LotAtt01_C" => $detail->lotatt01 ?? '',
+            "In_LotAtt02_C" => $detail->lotatt02 ?? '',
+            "In_LotAtt04_C" => $detail->lotatt04 ?? '',
+            "In_LotAtt05_C" => $detail->lotatt05 ?? '',
+            "In_LotAtt08_C" => $detail->lotatt08 ?? '',
+            "In_UserDefine1" => $detail->userdefine1 ?? '',
+            "In_UserDefine2" => $detail->userdefine2 ?? '',
+            "In_UserDefine3" => $detail->userdefine3 ?? '',
+            "In_UserDefine4" => $detail->userdefine4 ?? '',
+            "In_UserDefine5" => $detail->userdefine5 ?? '',
+            "In_FMLocation"  => 'STAGE' . $detail->warehouseid,
+            "In_TOLocation_C" => 'STAGE' . $detail->warehouseid,//'IDE0000001',
+        ));
+       dd($result);
+        /*$order = Order::query()->where("code","SO210511005663")->first();
         $ser = new OrderService();
         $ser = new OrderService();
         $ser->createInstantBill($order);
         $ser->createInstantBill($order);
-        dd();
-        $store = Store::query()->find(164944);
+        dd();*/
+        $store = Store::query()->find(173382);dd($store->load("storeItems.commodity"));
         $ser = new StoreService();
         $ser = new StoreService();
         $ser->createInstantBill($store);
         $ser->createInstantBill($store);
+        dd($store);
+    }
+    public function orderCreateBill()
+    {
+        $order = Order::query()->find(\request("id"));
+        $ser = new OrderService();
+        $ser->createInstantBill($order);
+        dd("order create bill success");
     }
     }
     public function supplementMarchOwnerReport()
     public function supplementMarchOwnerReport()
     {
     {
@@ -760,7 +808,7 @@ class TestController extends Controller
 
 
     public function reNewBatches3()
     public function reNewBatches3()
     {
     {
-        $batches = Batch::query()->where('id', '>', 97397)->get('code');
+        $batches = Batch::query()->where('id', '>', 111090)->get('code');
         $batchCodes = $batches->map(function ($batch) {
         $batchCodes = $batches->map(function ($batch) {
             return $batch['code'];
             return $batch['code'];
         })->toArray();
         })->toArray();
@@ -787,7 +835,7 @@ class TestController extends Controller
 //        dd($logs);
 //        dd($logs);
         foreach ($batchCodes as $code) {
         foreach ($batchCodes as $code) {
 //            $request=Cache::get('temp'.$code)['description'];
 //            $request=Cache::get('temp'.$code)['description'];
-            $request = Log::query()->select('description')->where('CREATED_AT', '>=', '2021-04-14')
+            $request = Log::query()->select('description')->where('CREATED_AT', '>=', '2021-05-18 15:00')
                 ->where('method', "issued_newBatch")
                 ->where('method', "issued_newBatch")
                 ->where('description', 'like', "%{$code}%")
                 ->where('description', 'like', "%{$code}%")
                 ->first();
                 ->first();
@@ -919,8 +967,9 @@ class TestController extends Controller
         dump($orderPackage);
         dump($orderPackage);
     }
     }
 
 
-    public function logistic_route_sync_SF()
+    public function logistic_route_sync()
     {
     {
+        ini_set('max_execution_time', 60*10);
         $orderPackageReceivedSyncService = new OrderPackageReceivedSyncService();
         $orderPackageReceivedSyncService = new OrderPackageReceivedSyncService();
         $orderPackageReceivedSyncService->syncLogisticRoute();
         $orderPackageReceivedSyncService->syncLogisticRoute();
     }
     }
@@ -937,6 +986,12 @@ class TestController extends Controller
         event(new SendEmailEvent());
         event(new SendEmailEvent());
     }
     }
 
 
+    public function ld2()
+    {
+        /** @var LogisticService $logisticService */
+        $logisticService=app('LogisticService');
+        var_dump($logisticService->get(['name'=>'顺丰'])->first());
+    }
     public function y111()
     public function y111()
     {
     {
         $controller = new SendEmailsController();
         $controller = new SendEmailsController();
@@ -1516,4 +1571,13 @@ TEXT;
         $stationTask = StationTask::query()->where('id',711)->first();
         $stationTask = StationTask::query()->where('id',711)->first();
         $stationTask->update(['status'=>'完成']);
         $stationTask->update(['status'=>'完成']);
     }
     }
+
+    public function order_package_exception_type_counting_record_init()
+    {
+        /**
+         * @var $service OrderPackageExceptionTypeCountingRecordService
+         */
+        $service = app('OrderPackageExceptionTypeCountingRecordService');
+        $service->updateOrCreate(30);
+    }
 }
 }

+ 11 - 0
app/Http/Controllers/WaybillController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 namespace App\Http\Controllers;
 
 
 
 
+use App\CarType;
 use App\Components\AsyncResponse;
 use App\Components\AsyncResponse;
 use App\Region;
 use App\Region;
 use App\Services\CarTypeService;
 use App\Services\CarTypeService;
@@ -61,6 +62,7 @@ class WaybillController extends Controller
             'waybills' => $waybills,
             'waybills' => $waybills,
             'logistics' => $logisticService->getSelection(["id","name"],"物流"),
             'logistics' => $logisticService->getSelection(["id","name"],"物流"),
             'owners' => $ownerService->getIntersectPermitting(),
             'owners' => $ownerService->getIntersectPermitting(),
+            "carTypes" => CarType::query()->get(),
             'paginateParams'=>$paginateParams,
             'paginateParams'=>$paginateParams,
             'uriType'=>$request->uriType??'']);
             'uriType'=>$request->uriType??'']);
     }
     }
@@ -939,5 +941,14 @@ class WaybillController extends Controller
         if (!$order)$this->error("暂无绑定订单");
         if (!$order)$this->error("暂无绑定订单");
         $this->success($order);
         $this->success($order);
     }
     }
+    //按日输入专线费
+    public function dailyBilling(Request $request): array
+    {
+        if(!Gate::allows('运输管理-运单-按日计算专线费')){return ['success'=>false,'message'=>'没有权限'];}
+        $dailyBilling=$request->input('param');
+        $waybills=app('waybillService')->dailyBilling($dailyBilling);
+        if (!isset($waybills))return ['success'=>false,'message'=>'该日有记录未填写重量'];
+        return ['success'=>true,'data'=>$waybills];
+    }
 
 
 }
 }

+ 76 - 76
app/Http/Controllers/api/thirdPart/flux/SortingController.php

@@ -30,83 +30,83 @@ class SortingController extends Controller
      */
      */
     public function newBatch(Request $request)
     public function newBatch(Request $request)
     {
     {
-       $requestArr=$request->all();
+//       $requestArr=$request->all();
         app('LogService')->log(__METHOD__, 'issued_' . __FUNCTION__, json_encode($request->all()));
         app('LogService')->log(__METHOD__, 'issued_' . __FUNCTION__, json_encode($request->all()));
-        !$requestArr?$requestArr=json_decode($request->getContent(),true):false;
-        $errors=$this->newBatchValidator($requestArr)->errors();
-        if(count($errors)>0){
-            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, 'fields wrong, see Errors report please.'.'|'.json_encode($request->all()).'|'.json_encode($errors));
-            return response()->json(['Response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001',
-                'returnDesc'=>':Failure','resultInfo'=>'','errors'=>$errors]]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
-        }
-        $requestBatches = $requestArr['request']?? '';
-
-        foreach ($requestBatches as $requestBatch){
-            $requestBatch['edittime']&&strpos(trim($requestBatch['edittime']),' ')?$editTimeFormat='Y-m-d H:i:s':$editTimeFormat='YmdHis';
-            $batch=Batch::query()->firstOrCreate(['code' => $requestBatch['waveno']]);
-
-            if(!$batch)$batch=new Batch();
-            $batch->fill([
-                    'code' => $requestBatch['waveno'],
-                    'wms_type' => $requestBatch['batch_type']??'',
-                    'wms_status' => $requestBatch['docstatus']??'',
-                    'status' => '未处理',
-                    'wms_created_at' => $requestBatch['edittime']?Carbon::createFromFormat($editTimeFormat,$requestBatch['edittime']):'',
-            ]);
-            $batch->save();
-            $oracleAlloactions=OracleActAllocationDetails::query()->where('waveno',$requestBatch['waveno'])->get();
-            foreach($requestBatch['order_list'] as $requestOrder){
-                $owner=Owner::query()->where('code',$requestOrder['customerid'])->first();
-                $order=app("OrderService")->first(['code'=>$requestOrder['docno']]);
-                if(!$order){
-                    $order=app("OrderService")->createOrder([
-                        'batch_id' => $batch['id'],
-                        'code' => $requestOrder['docno'],
-                        'owner_id' => $owner['id'],
-                        'wms_status' => $requestOrder['docstatus']??'波次下发',
-                        'status' => '未处理',
-                    ]);
-                    app('LogService')->log(__METHOD__,__FUNCTION__,'创建 Order'.json_encode($order));
-                }else{
-                    $order['batch_id']= $batch['id'] ;
-                    $order['owner_id']=$order['owner_id']??$owner['owner_id'];
-                    $order['wms_status']=$order['wms_status']??$requestOrder['docstatus']??'波次下发';
-                    $order['status']=$order['status']??'未处理';
-                }
-                $order->save();
-                OrderBin::query()->firstOrCreate([
-                    'order_id' => $order['id'],
-                    'number' => $requestOrder['reservedfield01'],
-                ]);
-                foreach($requestOrder['barcode_list'] as $requestBarcode){
-                    $orderCommodity=OrderCommodity::query()
-                        ->where('order_id',$order['id'])->where('wms_ptltaskid',$requestBarcode['ptltaskid'])->first();
-                    if(!$orderCommodity){
-                        /** @var CommodityService $commodityService */
-                        $commodityService=app('CommodityService');
-                        $commodity=$commodityService->syncBarcodes($requestBarcode['alternate_sku1'],$owner['id'],$requestBarcode['sku']);
-                        $orderCommodity=OrderCommodity::query()->firstOrCreate(['order_id'=>$order['id'],'commodity_id'=>$commodity['id']]);
-                        if(!$orderCommodity){
-                            $orderCommodity = new OrderCommodity([
-                                'order_id' => $order['id'],
-                                'commodity_id' => $commodity['id'],
-                                'amount' => $requestBarcode['fmqty_each']??0,
-                                'wms_ptltaskid' => $requestBarcode['ptltaskid'],
-                            ]);
-                        }else{
-                            $orderCommodity['order_id']=$order['id'];
-                            $orderCommodity['commodity_id']=$commodity['id'];
-                            $orderCommodity['amount']=$requestBarcode['fmqty_each']??0;
-                            $orderCommodity['wms_ptltaskid']=$requestBarcode['ptltaskid']??0;
-                        }
-                        $allocation=$oracleAlloactions->where('orderno',$requestOrder['docno'])->where('sku',$commodity['sku'])->where('qty',$requestBarcode['fmqty_each'])->first();
-                        if($allocation)
-                            $orderCommodity['location'] = $allocation['location'];
-                        $orderCommodity->save();
-                    }
-                }
-            }
-        }
+//        !$requestArr?$requestArr=json_decode($request->getContent(),true):false;
+//        $errors=$this->newBatchValidator($requestArr)->errors();
+//        if(count($errors)>0){
+//            app('LogService')->log(__METHOD__, 'error' . __FUNCTION__, 'fields wrong, see Errors report please.'.'|'.json_encode($request->all()).'|'.json_encode($errors));
+//            return response()->json(['Response'=>['return'=>['returnFlag'=>'0','returnCode'=>'0001',
+//                'returnDesc'=>':Failure','resultInfo'=>'','errors'=>$errors]]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
+//        }
+//        $requestBatches = $requestArr['request']?? '';
+//
+//        foreach ($requestBatches as $requestBatch){
+//            $requestBatch['edittime']&&strpos(trim($requestBatch['edittime']),' ')?$editTimeFormat='Y-m-d H:i:s':$editTimeFormat='YmdHis';
+//            $batch=Batch::query()->firstOrCreate(['code' => $requestBatch['waveno']]);
+//
+//            if(!$batch)$batch=new Batch();
+//            $batch->fill([
+//                    'code' => $requestBatch['waveno'],
+//                    'wms_type' => $requestBatch['batch_type']??'',
+//                    'wms_status' => $requestBatch['docstatus']??'',
+//                    'status' => '未处理',
+//                    'wms_created_at' => $requestBatch['edittime']?Carbon::createFromFormat($editTimeFormat,$requestBatch['edittime']):'',
+//            ]);
+//            $batch->save();
+//            $oracleAlloactions=OracleActAllocationDetails::query()->where('waveno',$requestBatch['waveno'])->get();
+//            foreach($requestBatch['order_list'] as $requestOrder){
+//                $owner=Owner::query()->where('code',$requestOrder['customerid'])->first();
+//                $order=app("OrderService")->first(['code'=>$requestOrder['docno']]);
+//                if(!$order){
+//                    $order=app("OrderService")->createOrder([
+//                        'batch_id' => $batch['id'],
+//                        'code' => $requestOrder['docno'],
+//                        'owner_id' => $owner['id'],
+//                        'wms_status' => $requestOrder['docstatus']??'波次下发',
+//                        'status' => '未处理',
+//                    ]);
+//                    app('LogService')->log(__METHOD__,__FUNCTION__,'创建 Order'.json_encode($order));
+//                }else{
+//                    $order['batch_id']= $batch['id'] ;
+//                    $order['owner_id']=$order['owner_id']??$owner['owner_id'];
+//                    $order['wms_status']=$order['wms_status']??$requestOrder['docstatus']??'波次下发';
+//                    $order['status']=$order['status']??'未处理';
+//                }
+//                $order->save();
+//                OrderBin::query()->firstOrCreate([
+//                    'order_id' => $order['id'],
+//                    'number' => $requestOrder['reservedfield01'],
+//                ]);
+//                foreach($requestOrder['barcode_list'] as $requestBarcode){
+//                    $orderCommodity=OrderCommodity::query()
+//                        ->where('order_id',$order['id'])->where('wms_ptltaskid',$requestBarcode['ptltaskid'])->first();
+//                    if(!$orderCommodity){
+//                        /** @var CommodityService $commodityService */
+//                        $commodityService=app('CommodityService');
+//                        $commodity=$commodityService->syncBarcodes($requestBarcode['alternate_sku1'],$owner['id'],$requestBarcode['sku']);
+//                        $orderCommodity=OrderCommodity::query()->firstOrCreate(['order_id'=>$order['id'],'commodity_id'=>$commodity['id']]);
+//                        if(!$orderCommodity){
+//                            $orderCommodity = new OrderCommodity([
+//                                'order_id' => $order['id'],
+//                                'commodity_id' => $commodity['id'],
+//                                'amount' => $requestBarcode['fmqty_each']??0,
+//                                'wms_ptltaskid' => $requestBarcode['ptltaskid'],
+//                            ]);
+//                        }else{
+//                            $orderCommodity['order_id']=$order['id'];
+//                            $orderCommodity['commodity_id']=$commodity['id'];
+//                            $orderCommodity['amount']=$requestBarcode['fmqty_each']??0;
+//                            $orderCommodity['wms_ptltaskid']=$requestBarcode['ptltaskid']??0;
+//                        }
+//                        $allocation=$oracleAlloactions->where('orderno',$requestOrder['docno'])->where('sku',$commodity['sku'])->where('qty',$requestBarcode['fmqty_each'])->first();
+//                        if($allocation)
+//                            $orderCommodity['location'] = $allocation['location'];
+//                        $orderCommodity->save();
+//                    }
+//                }
+//            }
+//        }
         return response()->json(['Response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000',
         return response()->json(['Response'=>['return'=>['returnFlag'=>'1','returnCode'=>'0000',
             'returnDesc'=>'消息处理成功:Success','resultInfo'=>'']]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
             'returnDesc'=>'消息处理成功:Success','resultInfo'=>'']]])->setEncodingOptions(JSON_UNESCAPED_UNICODE);
     }
     }

+ 2 - 0
app/Http/Kernel.php

@@ -2,6 +2,7 @@
 
 
 namespace App\Http;
 namespace App\Http;
 
 
+use App\Http\Middleware\CheckCsrfToken;
 use App\Http\Middleware\LogPostRequest;
 use App\Http\Middleware\LogPostRequest;
 use Illuminate\Foundation\Http\Kernel as HttpKernel;
 use Illuminate\Foundation\Http\Kernel as HttpKernel;
 
 
@@ -75,6 +76,7 @@ class Kernel extends HttpKernel
         'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
         'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
         'auth.api' => \App\Http\Middleware\ApiAuth::class,
         'auth.api' => \App\Http\Middleware\ApiAuth::class,
         'procurement.auth.api' => \App\Http\Middleware\ProcurementApiAuth::class,
         'procurement.auth.api' => \App\Http\Middleware\ProcurementApiAuth::class,
+        'check.token' => CheckCsrfToken::class,
     ];
     ];
 
 
     /**
     /**

+ 1 - 0
app/Http/Middleware/Authenticate.php

@@ -2,6 +2,7 @@
 
 
 namespace App\Http\Middleware;
 namespace App\Http\Middleware;
 
 
+use Closure;
 use Illuminate\Auth\Middleware\Authenticate as Middleware;
 use Illuminate\Auth\Middleware\Authenticate as Middleware;
 
 
 class Authenticate extends Middleware
 class Authenticate extends Middleware

+ 21 - 0
app/Http/Middleware/CheckCsrfToken.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+
+class CheckCsrfToken
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if (!$request->cookie("XSRF-TOKEN"))return redirect("login");
+        return $next($request);
+    }
+}

+ 1 - 0
app/Http/Middleware/VerifyCsrfToken.php

@@ -20,5 +20,6 @@ class VerifyCsrfToken extends Middleware
      */
      */
     protected $except = [
     protected $except = [
         'store/deliveryAppointment/delivery',
         'store/deliveryAppointment/delivery',
+        'package/weigh/measureMonitor/speech',
     ];
     ];
 }
 }

+ 132 - 0
app/Imports/RejectedImport.php

@@ -9,6 +9,8 @@ use App\Owner;
 use App\Rejected;
 use App\Rejected;
 use App\RejectedBill;
 use App\RejectedBill;
 use App\RejectedBillItem;
 use App\RejectedBillItem;
+use App\Services\LogisticService;
+use App\Services\OwnerService;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Session;
 use Illuminate\Support\Facades\Session;
 use Maatwebsite\Excel\Concerns\ToCollection;
 use Maatwebsite\Excel\Concerns\ToCollection;
@@ -119,6 +121,136 @@ class RejectedImport implements ToCollection, WithHeadingRow
             Session::put('jianshangLastImportedMobile',trim($mobile_sender));
             Session::put('jianshangLastImportedMobile',trim($mobile_sender));
         }
         }
     }
     }
+//    public function collection(Collection $collections)
+//    {
+//        $rejectedBill_index=[];
+//        $errers=[];
+//        foreach ($collections as $i=>$row) {
+//            $logistic_number_return = trim($row['退回单号'] ?? $row['退货单号'] ?? $row['快递单号'] ?? $row['logistic_number_return'] ?? '');
+//            $mobile_sender = trim($row['手机号'] ?? $row['mobile_sender'] ?? '');
+//            $logistic_name = trim($row['快递公司'] ?? $row['logistic_name'] ?? '');
+//            $barcode = trim($row['条码'] ?? $row['barcode'] ?? '');
+//            $amount = trim($row['数量'] ?? $row['amount'] ?? '');
+//            $quality_label_name = trim($row['品质'] ?? $row['quality_label_name'] ?? '正品');
+//            $remark = trim($row['备注'] ?? $row['remark'] ?? '');
+//            $ownerName = trim($row['货主'] ?? $row['owner'] ?? '');
+//            if(!$logistic_number_return){$errers[$i][]='第'.($i+1).'行退回单号不能为空,该行没有录入,请手动编辑';continue;}
+//            if(!$logistic_name){$errers[$i][]='第'.($i+1).'行快递公司不能为空,该行没有录入,请手动编辑';continue;}
+//            if(!$barcode){$errers[$i][]='第'.($i+1).'行条码不能为空,该行没有录入,请手动编辑';continue;}
+//            if(!$amount){$errers[$i][]='第'.($i+1).'行数量不能为空,该行没有录入,请手动编辑';continue;}
+//            if(!$ownerName){$errers[$i][]='第'.($i+1).'行货主不能为空,该行没有录入,请手动编辑';continue;}
+//            /** @var OwnerService $ownerService */
+//            $ownerService=app('OwnerService');
+//            /** @var LogisticService $logisticService */
+//            $logisticService=app('LogisticService');
+//            if(!isset($rejectedBill_index[$logistic_number_return])){
+//                $rejectedBill=RejectedBill::query()->where('logistic_number_return',$logistic_number_return)->get();
+//                if($rejectedBill){$errers[$i][]='第'.($i+1).'行的退货单在导入前已有记录,需要先删除掉再导入或手动添加,该行没有录入';continue;}
+//                $owner_id = $ownerService->get(['name' => $ownerName])->first()['id'];
+//                if($rejectedBill){$errers[$i][]='第'.($i+1).'行的货主不存在,请检查是否输错货主名或未录入系统,该行没有录入,请手动编辑';continue;}
+//                $logistic_id = $logisticService->get(['name' => $logistic_name])->first()['id'];
+//                if($rejectedBill){$errers[$i][]='第'.($i+1).'行的快递不存在,请检查是否输错快递名或未录入系统,该行没有录入,请手动编辑';continue;}
+//                $rejectedBill=new RejectedBill([
+//                    'id_owner'=> $owner_id,
+//                    'mobile_sender'=>$mobile_sender,
+//                    'logistic_number_return'=>$logistic_number_return,
+//                    'id_logistic_return'=>$logistic_id,
+//                    'is_loaded'=>0,
+//                ]);
+//                $rejectedBill_index[$logistic_number_return]=$rejectedBill;
+//            }
+//        }
+//
+//        foreach ($collections as $row)
+//        {
+//            $logistic_number_return = trim($row['退回单号']??$row['退货单号']??$row['快递单号']??$row['logistic_number_return']??'');
+//            $mobile_sender = trim($row['手机号']??$row['mobile_sender']??'');
+//            $logistic_name = trim($row['快递公司']??$row['logistic_name']??'');
+//            $barcode = trim($row['条码']??$row['barcode']??'');
+//            $amount = trim($row['数量']??$row['amount']??'');
+//            $quality_label_name = trim($row['品质']??$row['quality_label_name']??'');
+//            $remark = trim($row['备注']??$row['remark']??'');
+//            $owner=trim($row['货主']??$row['owner']??'');
+//
+////            $lastReturnNumber = Session::get('jianshangLastImportedBill');
+////            if(!$logistic_number_return)$logistic_number_return=$lastReturnNumber;
+////            $lastMobile = Session::get('jianshangLastImportedMobile');
+////            if(!$mobile_sender)$mobile_sender=$lastMobile;
+////            $lastlogistic_name = Session::get('jianshangLastImportedLogisticName');
+////            if(!$logistic_name)$logistic_name=$lastlogistic_name;
+//
+//
+//            $owner=Owner::query()->where('name','like',$owner.'%')->first();
+//            $id_logistic_return=Logistic::query()->where('name','like',"%{$logistic_name}%")->first()['id'];
+//            if(!$id_logistic_return){
+//                $id_logistic_return=Logistic::query()->where('name','like',"%其它%")->first()['id'];
+//            }
+//
+//            $id_quality_label=3;
+//            if(trim($quality_label_name)=='正品'){
+//                $id_quality_label=1;
+//            }elseif(trim($quality_label_name)=='残次'){
+//                $id_quality_label=2;
+//            }
+//            if(!$amount)$amount=1;
+//
+//
+//            $bill=RejectedBill::query()->where('logistic_number_return',trim($logistic_number_return))->first();
+//            if($bill){
+//                $item=RejectedBillItem::query()->where('id_rejected_bill',$bill['id'])
+//                    ->where('barcode_goods',trim($barcode))->where('id_quality_label',$id_quality_label)->first();
+//                if($item){
+//                    $item['amount']+=$amount;
+//                    $item->update();
+//                }else{
+//                    $item=new RejectedBillItem([
+//                        'id_rejected_bill'=>$bill['id'],
+//                        'barcode_goods'=>trim($barcode),
+//                        'amount'=>trim($amount),
+//                        'id_quality_label'=>$id_quality_label,
+//                        'remark'=>$remark,
+//                    ]);
+//                    $item->save();
+//                }
+//                $bill->syncOrderIssue();
+//            }else{
+//                $bill=new RejectedBill([
+//                    'id_owner'=>$owner['id'],
+//                    'mobile_sender'=>$mobile_sender,
+//                    'logistic_number_return'=>$logistic_number_return,
+//                    'id_logistic_return'=>$id_logistic_return,
+//                    'is_loaded'=>0,
+//                ]);
+//                $bill->save();
+//                $bill->joinOrderIssue();
+//                $bill->syncOrderIssue();
+//                $item=RejectedBillItem::query()->where('id_rejected_bill',$bill['id'])
+//                    ->where('barcode_goods',trim($barcode))->where('id_quality_label',$id_quality_label)->first();
+//                if($item){
+//                    $item['amount']+=$amount;
+//                    $item->update();
+//                }else{
+//                    $item=new RejectedBillItem([
+//                        'id_rejected_bill'=>$bill['id'],
+//                        'barcode_goods'=>trim($barcode),
+//                        'amount'=>trim($amount),
+//                        'id_quality_label'=>$id_quality_label,
+//                        'remark'=>$remark,
+//                    ]);
+//                    $item->save();
+//                }
+//            }
+//
+//            $lastBill = Session::get('jianshangLastImportedBill');
+//            if($owner['name']=='笕尚'&&$lastBill&&$lastBill !=trim($logistic_number_return)){
+//                $this->submitToApi($bill);
+//            }
+//            Session::put('jianshangLastImportedLogisticName',trim($logistic_name));
+//            Session::put('jianshangLastImportedBill',trim($logistic_number_return));
+//            Session::put('jianshangLastImportedMobile',trim($mobile_sender));
+//        }
+//    }
+
     private function submitToApi(RejectedBill $bill){
     private function submitToApi(RejectedBill $bill){
         if(!$bill||$bill->items()->get()->isEmpty())return;
         if(!$bill||$bill->items()->get()->isEmpty())return;
         $havingFail=0;
         $havingFail=0;

+ 1 - 1
app/Jobs/DeliveryAppointmentCheck.php

@@ -38,7 +38,7 @@ class DeliveryAppointmentCheck implements ShouldQueue
         /** @var DeliveryAppointment|\stdClass $appointment */
         /** @var DeliveryAppointment|\stdClass $appointment */
         $appointment = DeliveryAppointment::query()->find($this->int);
         $appointment = DeliveryAppointment::query()->find($this->int);
         $time = explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1];
         $time = explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1];
-        if ($appointment && $appointment->status!=2
+        if ($appointment && $appointment->status==0
             && Carbon::now()->gt(Carbon::parse($appointment->appointment_date." ".$time.":00:00"))
             && Carbon::now()->gt(Carbon::parse($appointment->appointment_date." ".$time.":00:00"))
         )$appointment->update(["status"=>3]);
         )$appointment->update(["status"=>3]);
     }
     }

+ 57 - 0
app/Jobs/LogisticYDSync.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace App\Jobs;
+
+use App\Services\LogisticYDService;
+use App\Services\OrderPackageReceivedSyncService;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Foundation\Bus\Dispatchable;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Queue\SerializesModels;
+
+class LogisticYDSync implements ShouldQueue
+{
+    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+    /**
+     * @var $logisticYDService LogisticYDService
+     * @var $orderPackageReceivedSyncService OrderPackageReceivedSyncService
+     * @var $orderPackageReceivedSyncService OrderPackageReceivedSyncService
+     * @var $logistic_number string
+     */
+
+    protected $logistic_number;
+
+    protected $logisticYDService;
+    protected $orderPackageReceivedSyncService;
+
+    /**
+     * LogisticYDSync constructor.
+     * @param $logistic_number
+     */
+    public function __construct($logistic_number)
+    {
+        $this->logistic_number = $logistic_number;
+    }
+
+
+    /**
+     * Execute the job.
+     *
+     * @return void
+     */
+    public function handle()
+    {
+        ini_set('max_execution_time', 60);
+        $this->logisticYDService = app('LogisticYDService');
+        //先订阅订单
+        $this->logisticYDService->registerApi([$this->logistic_number]);
+        //查询订单路由信息
+        $nativeResponse = $this->logisticYDService->query($this->logistic_number);
+        //格式化信息
+        $formattedData = $this->logisticYDService->format($nativeResponse);
+        $this->orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
+        //更新数据
+        $this->orderPackageReceivedSyncService->update([$formattedData]);
+    }
+}

+ 7 - 159
app/Jobs/LogisticZopSync.php

@@ -37,8 +37,7 @@ class LogisticZopSync implements ShouldQueue
      */
      */
     public function handle()
     public function handle()
     {
     {
-        //
-        ini_set('max_execution_time', 10);
+        ini_set('max_execution_time', 60);
         $zopResult = [];
         $zopResult = [];
         $response = $this->sentRequestToZT();
         $response = $this->sentRequestToZT();
         if(is_null($response)) return;
         if(is_null($response)) return;
@@ -92,7 +91,10 @@ class LogisticZopSync implements ShouldQueue
             $resultItem['transfer_status'] = [];
             $resultItem['transfer_status'] = [];
         }
         }
         try {
         try {
-            $resultItem = $this->setExceptionType($resultItem, $lastRoute ? $lastRoute->scanDate / 1000 : null);
+            $orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
+            $exceptionData = $orderPackageReceivedSyncService->setExceptionType($resultItem, $lastRoute ? $lastRoute->scanDate / 1000 : null);
+            $resultItem['exception_type'] = $exceptionData['exception_type'];
+            $resultItem['exception'] = $exceptionData['exception'];
         } catch (\Exception $e) {
         } catch (\Exception $e) {
         }
         }
         if ($resultItem['status'] == null) {
         if ($resultItem['status'] == null) {
@@ -107,164 +109,10 @@ class LogisticZopSync implements ShouldQueue
             $resultItem['exception_type'] = '无';
             $resultItem['exception_type'] = '无';
             $resultItem['exception'] = '否';
             $resultItem['exception'] = '否';
         }
         }
+        $resultItem['routes_length'] = array_key_exists('transfer_status', $resultItem) ? count($resultItem['transfer_status']) : 0;
         $result[] = $resultItem;
         $result[] = $resultItem;
         return $result;
         return $result;
     }
     }
-
-    /**
-     * @param array $data
-     * @param $lastRouteDate
-     * @return array
-     */
-    private function setExceptionType(array $data, $lastRouteDate = null): array
-    {
-        $logistic_number = $data['logistic_number'];
-        /** @var OrderPackage $orderPackage */
-        $orderPackage = OrderPackage::query()->with('order')->where('logistic_number', $logistic_number)->first();
-        $delivered_duration = now()->diffInHours(Carbon::parse($orderPackage['sent_at']));
-        $last_routed_duration = now()->diffInHours(Carbon::parse($lastRouteDate));
-        $VALID_HOURS = 4;
-        $SHORT_RESPONSE_HOURS = (function ($province) {
-            switch ($province) {
-                case '浙江省':
-                case '江苏省':
-                case '上海':
-                case '安徽省':
-                    return 24;
-                case '北京':
-                case '天津':
-                case '江西省':
-                case '湖北省':
-                case '湖南省':
-                case '广东省':
-                case '福建省':
-                case '山东省':
-                case '河北省':
-                case '河南省':
-                case '山西省':
-                case '四川省':
-                case '陕西省':
-                case '重庆':
-                case '广西壮族自治区':
-                case '贵州省':
-                case '云南省':
-                case '海南省':
-                case '吉林省':
-                case '黑龙江省':
-                case '辽宁省':
-                    return 72;
-                case '青海省':
-                case '宁夏回族自治区':
-                case '甘肃省':
-                case '内蒙古自治区':
-                case '新疆维吾尔自治区':
-                case '西藏自治区':
-                    return 120;
-                default:
-                    return 24;
-            }
-        })($orderPackage->order->province);
-        $LONG_RESPONSE_HOURS = (function ($province) {
-            switch ($province) {
-                case '浙江省':
-                case '江苏省':
-                case '上海':
-                case '安徽省':
-                    return 72;
-                case '北京':
-                case '天津':
-                case '江西省':
-                case '湖北省':
-                case '湖南省':
-                case '广东省':
-                case '福建省':
-                case '山东省':
-                case '河北省':
-                case '河南省':
-                case '山西省':
-                case '四川省':
-                case '陕西省':
-                case '重庆':
-                case '广西壮族自治区':
-                case '贵州省':
-                case '云南省':
-                case '海南省':
-                case '吉林省':
-                case '黑龙江省':
-                case '辽宁省':
-                    return 120;
-                case '青海省':
-                case '宁夏回族自治区':
-                case '甘肃省':
-                case '内蒙古自治区':
-                case '新疆维吾尔自治区':
-                case '西藏自治区':
-                    return 168;
-                default:
-                    return 72;
-            }
-        })($orderPackage->order->province);
-        $SENDING_RESPONSE_HOURS = 48;
-        $IS_ROUTED = 1;               //0000 0001 有路由信息
-        $IS_IN_VALID_TIME = 2;        //0000 0010 大于4小时
-        $IS_WEIGHED = 4;              //0000 0100 称重过
-        $IS_RECEIVED = 8;          //0000 1000 已经收货
-        $IS_SENDING = 16;             //0001 0000 正在派送
-        $IS_SHORT_NO_RESPONSE = 32;     //0010 0000 中转异常
-        $IS_LONG_NO_RESPONSE = 64;     //0010 0000 疑似丢件
-        $IS_SENDING_NO_RESPONSE = 128;     //0010 0000 派送异常
-        $conclusion = (function () use (
-            $data, $delivered_duration, $last_routed_duration,
-            $VALID_HOURS, $IS_ROUTED, $IS_IN_VALID_TIME, $IS_WEIGHED, $IS_RECEIVED, $IS_SENDING, $IS_SHORT_NO_RESPONSE, $IS_LONG_NO_RESPONSE, $IS_SENDING_NO_RESPONSE,
-            $SHORT_RESPONSE_HOURS, $LONG_RESPONSE_HOURS, $SENDING_RESPONSE_HOURS,
-            $orderPackage
-        ) {
-            $conclusion = 0;
-            $conclusion |= !empty($data['transfer_status']) ? $IS_ROUTED : 0;
-            $conclusion |= ($delivered_duration > $VALID_HOURS) ? $IS_IN_VALID_TIME : 0;
-            $conclusion |= ($orderPackage->weighed_at) ? $IS_WEIGHED : 0;
-            $conclusion |= ($data['status'] == '已收件') ? $IS_RECEIVED : 0;
-            $conclusion |= ($data['status'] == '派送中') ? $IS_SENDING : 0;//
-            $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
-            $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;
-            $conclusion |= ($last_routed_duration > $SENDING_RESPONSE_HOURS && $data['status'] == '派送中') ? $IS_SENDING_NO_RESPONSE : 0;
-            return $conclusion;
-        })();
-        switch ($conclusion) {
-            case $IS_IN_VALID_TIME:
-                $data['exception_type'] = '疑似库内丢件';
-                break;
-            case $IS_IN_VALID_TIME | $IS_WEIGHED:
-                $data['exception_type'] = '揽件异常';
-                break;
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE:
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE | $IS_WEIGHED:
-                $data['exception_type'] = '中转异常';
-                break;
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE:
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE | $IS_WEIGHED:
-                $data['exception_type'] = '疑似丢件';
-                break;
-            default:
-                break;
-        }
-        if ($conclusion
-            == ($conclusion | $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SENDING | $IS_SENDING_NO_RESPONSE)) {
-            $data['exception_type'] = '派件异常';
-        }
-        switch ($conclusion) {
-            case $IS_IN_VALID_TIME:
-            case $IS_IN_VALID_TIME | $IS_WEIGHED:
-            case $IS_ROUTED | $IS_SHORT_NO_RESPONSE:
-            case $IS_LONG_NO_RESPONSE:
-                $data['exception'] = '是';
-                break;
-            default:
-                break;
-        }
-        return $data;
-    }
-
     /**
     /**
      * 正常的状态与签收时间
      * 正常的状态与签收时间
      * @param $lastRoute
      * @param $lastRoute
@@ -332,7 +180,7 @@ class LogisticZopSync implements ShouldQueue
         $request->setUrl($url);
         $request->setUrl($url);
         $request->setBody(json_encode([
         $request->setBody(json_encode([
             'billCode' => $this->logistic_number,
             'billCode' => $this->logistic_number,
-        ]));
+        ],JSON_UNESCAPED_UNICODE));
         return json_decode($client->execute($request));
         return json_decode($client->execute($request));
     }
     }
 }
 }

+ 1 - 1
app/Jobs/ResetInstantBill.php

@@ -176,7 +176,7 @@ class ResetInstantBill implements ShouldQueue
                 /** @var \stdClass $store */
                 /** @var \stdClass $store */
                 $store = Store::query()->find($this->detail->outer_id);
                 $store = Store::query()->find($this->detail->outer_id);
                 if (!$store || $store->status != "已入库") break;
                 if (!$store || $store->status != "已入库") break;
-                $store->loadMissing(["storeItems","warehouse"]);
+                $store->loadMissing(["storeItems.commodity","warehouse"]);
 
 
                 /** @var OwnerPriceOperationService $service */
                 /** @var OwnerPriceOperationService $service */
                 $service = app("OwnerPriceOperationService");
                 $service = app("OwnerPriceOperationService");

+ 5 - 1
app/Listeners/AddOrUpdateOrderIssuesListener.php

@@ -3,6 +3,7 @@
 namespace App\Listeners;
 namespace App\Listeners;
 
 
 use App\Events\AddOrUpdateOrderIssues;
 use App\Events\AddOrUpdateOrderIssues;
+use App\Events\UpdateOrderPackageExceptionListenerEvent;
 use App\OrderIssue;
 use App\OrderIssue;
 use App\OrderPackage;
 use App\OrderPackage;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Contracts\Queue\ShouldQueue;
@@ -28,7 +29,7 @@ class AddOrUpdateOrderIssuesListener implements ShouldQueue
     public function handle(AddOrUpdateOrderIssues $event)
     public function handle(AddOrUpdateOrderIssues $event)
     {
     {
         $order_ids = OrderIssue::query()->select('order_id')->whereIn('order_id', $event->order_ids)->whereIn('order_issue_type_id', function ($query) {
         $order_ids = OrderIssue::query()->select('order_id')->whereIn('order_id', $event->order_ids)->whereIn('order_issue_type_id', function ($query) {
-            $query->from('order_issue_types')->select('id')->whereNotIn('name', ['拦截', '信息更改', '其他', '错漏发', '仓库问题', '二次加工', '全检问题', '系统问题', '快递方式更改']);
+            $query->from('order_issue_types')->select('id')->whereNotIn('name', ['拦截', '信息更改', '其他', '错漏发', '仓库问题', '二次加工', '全检问题', '系统问题', '快递方式更改', '无记录']);
         })->pluck('order_id');
         })->pluck('order_id');
         OrderPackage::query()->whereIn('order_id',
         OrderPackage::query()->whereIn('order_id',
             $order_ids)
             $order_ids)
@@ -36,5 +37,8 @@ class AddOrUpdateOrderIssuesListener implements ShouldQueue
                 'exception_type' => '其他',
                 'exception_type' => '其他',
                 'exception' => '是',
                 'exception' => '是',
             ]);
             ]);
+        //更新统计数据
+        $orderPackageIds = OrderPackage::query()->whereIn('order_id', $order_ids)->pluck('id');
+        event(new UpdateOrderPackageExceptionListenerEvent($orderPackageIds));
     }
     }
 }
 }

+ 5 - 1
app/Listeners/UpdateOrderPackageExceptionListener.php

@@ -3,6 +3,7 @@
 namespace App\Listeners;
 namespace App\Listeners;
 
 
 use App\Events\OrderIssueProcessLogCreateEvent;
 use App\Events\OrderIssueProcessLogCreateEvent;
+use App\Events\UpdateOrderPackageExceptionListenerEvent;
 use App\OrderPackage;
 use App\OrderPackage;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Queue\InteractsWithQueue;
 use Illuminate\Queue\InteractsWithQueue;
@@ -37,10 +38,13 @@ class UpdateOrderPackageExceptionListener implements ShouldQueue
             default:
             default:
                 $status = '无';
                 $status = '无';
         }
         }
-        OrderPackage::query()->whereIn('id', $event->orderPackageIds)->update([
+        $orderPackageIds = $event->orderPackageIds;
+        OrderPackage::query()->whereIn('id', $orderPackageIds)->update([
             'exception_type' => '无',
             'exception_type' => '无',
             'exception' => '否',
             'exception' => '否',
             'status' => $status,
             'status' => $status,
         ]);
         ]);
+        //更新统计数据
+        event(new UpdateOrderPackageExceptionListenerEvent($orderPackageIds));
     }
     }
 }
 }

+ 42 - 0
app/Listeners/UpdateOrderPackageExceptionTypeCountingRecordListener.php

@@ -0,0 +1,42 @@
+<?php
+
+namespace App\Listeners;
+
+use App\Events\UpdateOrderPackageExceptionListenerEvent;
+use App\OrderPackage;
+use App\Services\OrderPackageExceptionTypeCountingRecordService;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Queue\InteractsWithQueue;
+use Illuminate\Support\Facades\DB;
+
+class UpdateOrderPackageExceptionTypeCountingRecordListener implements ShouldQueue
+{
+    /**
+     * Create the event listener.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        //
+    }
+
+    /**
+     * Handle the event.
+     *
+     * @param UpdateOrderPackageExceptionListenerEvent $event
+     * @return void
+     */
+    public function handle(UpdateOrderPackageExceptionListenerEvent $event)
+    {
+        $order_package_ids = $event->order_package_ids;
+        $dates = OrderPackage::query()->select(DB::raw("DATE_FORMAT( sent_at, '%Y-%m-%d' ) AS sent_at_date "))->whereIn('id', $order_package_ids)->get();
+        /**
+         * @var $service OrderPackageExceptionTypeCountingRecordService
+         */
+        $service = app('OrderPackageExceptionTypeCountingRecordService');
+        foreach ($dates as $date) {
+            $service->updateOrCreateByDate($date->sent_at_date);
+        }
+    }
+}

+ 1 - 1
app/Logistic.php

@@ -17,7 +17,7 @@ class Logistic extends Model
     use ModelLogChanging;
     use ModelLogChanging;
     use SoftDeletes;
     use SoftDeletes;
     use ModelTimeFormat;
     use ModelTimeFormat;
-    protected $fillable = ['name','code',"type","mobile","remark","delivery_fee","is_bunched"];
+    protected $fillable = ['name','code',"type","mobile","remark","delivery_fee","is_bunched","english_name"];
 
 
 
 
     static function nameById($id){
     static function nameById($id){

+ 28 - 1
app/MaterialBox.php

@@ -10,5 +10,32 @@ class MaterialBox extends Model
 {
 {
     use ModelLogChanging;
     use ModelLogChanging;
 
 
-    protected $fillable=['code'];
+    protected $fillable=['code','status'];
+
+    public $enums=[
+        'status'=>[
+            '在库外'=>1,
+            '在U型线'=>2,
+            '在出库中'=>3,
+            '在入库中'=>4,
+            '在立库'=>5,
+            '异常'=>6,
+        ],
+    ];
+    function __construct(array $attributes = [])
+    {
+        foreach ($this->enums as &$enum) {
+            $enum=$enum+array_flip($enum);
+        }
+        parent::__construct($attributes);
+    }
+
+    public function getStatusAttribute($value)
+    {
+        return $this->enums['status'][$value];
+    }
+    public function setStatusAttribute($value)
+    {
+        $this->attributes['status']=$this->enums['status'][$value];
+    }
 }
 }

+ 1 - 0
app/OrderIssueRejectedBill.php

@@ -10,6 +10,7 @@ class OrderIssueRejectedBill extends Model
 {
 {
     use ModelLogChanging;
     use ModelLogChanging;
     protected $table='order_issue_rejected_bill';
     protected $table='order_issue_rejected_bill';
+    public $timestamps = false;
     protected $fillable = [
     protected $fillable = [
         'order_issue_id','logistic_number_return'
         'order_issue_id','logistic_number_return'
     ];
     ];

+ 17 - 0
app/OrderPackageExceptionTypeCountingRecord.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class OrderPackageExceptionTypeCountingRecord extends Model
+{
+    use ModelLogChanging;
+    public $timestamps = false;
+
+
+    //
+    public $fillable = ["sent_at_date", 'exception_type', 'exception_type_count', 'owner_id',];
+}

+ 6 - 2
app/ProcurementTotalBill.php

@@ -43,15 +43,19 @@ class ProcurementTotalBill extends Model
     public function  setCurrentMothProcurements(){
     public function  setCurrentMothProcurements(){
         $ProcurementQuery = Procurement::query()->select("id")
         $ProcurementQuery = Procurement::query()->select("id")
             ->where('supplier_id',$this->supplier_id);
             ->where('supplier_id',$this->supplier_id);
-//            ->where("created_at","like",$this->counting_month."%");
          $procurementDeliveryQuery= ProcurementDeliverie::query()->select('id')
          $procurementDeliveryQuery= ProcurementDeliverie::query()->select('id')
             ->whereIn("procurement_id",$ProcurementQuery)
             ->whereIn("procurement_id",$ProcurementQuery)
             ->where("created_at","like",$this->counting_month."%");
             ->where("created_at","like",$this->counting_month."%");
         $this->relations["procurementCheckSheets"]=ProcurementCheckSheet::query()
         $this->relations["procurementCheckSheets"]=ProcurementCheckSheet::query()
-            ->with(['procurementDelivery.procurement.ownerMaterial.material'])
+            ->with(['procurementDelivery.procurement.ownerMaterial.material','procurementDelivery.procurement.supplier'])
             ->whereIn('procurement_delivery_id',$procurementDeliveryQuery)->get();
             ->whereIn('procurement_delivery_id',$procurementDeliveryQuery)->get();
     }
     }
 
 
+    public function checkSheet()
+    {
+
+    }
+
     protected static function booted()
     protected static function booted()
     {
     {
         /** @var User $user */
         /** @var User $user */

+ 4 - 0
app/Providers/AppServiceProvider.php

@@ -111,6 +111,8 @@ use Ramsey\Uuid\Uuid;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Support\Facades\Validator;
 use App\Services\SupplierService;
 use App\Services\SupplierService;
 use App\Services\OrderPackageCommoditySerialNumberService;
 use App\Services\OrderPackageCommoditySerialNumberService;
+use App\Services\OrderPackageExceptionTypeCountingRecordService;
+use App\Services\LogisticYDService;
 
 
 class AppServiceProvider extends ServiceProvider
 class AppServiceProvider extends ServiceProvider
 {
 {
@@ -184,6 +186,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('LaborReportsCountingRecordService',LaborReportsCountingRecordService::class);
         app()->singleton('LaborReportsCountingRecordService',LaborReportsCountingRecordService::class);
         app()->singleton('LogService',LogService::class);
         app()->singleton('LogService',LogService::class);
         app()->singleton('LogisticService',LogisticService::class);
         app()->singleton('LogisticService',LogisticService::class);
+        app()->singleton('LogisticYDService',LogisticYDService::class);
         app()->singleton('MaterialBoxService',MaterialBoxService::class);
         app()->singleton('MaterialBoxService',MaterialBoxService::class);
         app()->singleton('OracleActAllocationDetailService',OracleActAllocationDetailService::class);
         app()->singleton('OracleActAllocationDetailService',OracleActAllocationDetailService::class);
         app()->singleton('OracleBasCustomerService',OracleBasCustomerService::class);
         app()->singleton('OracleBasCustomerService',OracleBasCustomerService::class);
@@ -201,6 +204,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('OrderIssueWorkLoadService',OrderIssueWorkLoadService::class);
         app()->singleton('OrderIssueWorkLoadService',OrderIssueWorkLoadService::class);
         app()->singleton('OrderPackageCommoditiesService',OrderPackageCommoditiesService::class);
         app()->singleton('OrderPackageCommoditiesService',OrderPackageCommoditiesService::class);
         app()->singleton('OrderPackageCommoditySerialNumberService',OrderPackageCommoditySerialNumberService::class);
         app()->singleton('OrderPackageCommoditySerialNumberService',OrderPackageCommoditySerialNumberService::class);
+        app()->singleton('OrderPackageExceptionTypeCountingRecordService',OrderPackageExceptionTypeCountingRecordService::class);
         app()->singleton('OrderPackageReceivedSyncService',OrderPackageReceivedSyncService::class);
         app()->singleton('OrderPackageReceivedSyncService',OrderPackageReceivedSyncService::class);
         app()->singleton('OrderPackageService',OrderPackageService::class);
         app()->singleton('OrderPackageService',OrderPackageService::class);
         app()->singleton('OrderService',OrderService::class);
         app()->singleton('OrderService',OrderService::class);

+ 0 - 4
app/Providers/AuthServiceProvider.php

@@ -7,11 +7,8 @@ use App\CustomerLog;
 use App\CustomerLogStatus;
 use App\CustomerLogStatus;
 use App\Policies\CustomerLogPolice;
 use App\Policies\CustomerLogPolice;
 use App\Policies\CustomerLogStatusesPolice;
 use App\Policies\CustomerLogStatusesPolice;
-use App\Services\AuthorityService;
 use App\Services\CacheService;
 use App\Services\CacheService;
 use App\Services\UserService;
 use App\Services\UserService;
-use App\User;
-use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
 use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
@@ -40,7 +37,6 @@ class AuthServiceProvider extends ServiceProvider
     public function boot()
     public function boot()
     {
     {
         $this->registerPolicies();
         $this->registerPolicies();
-
         $isSuperAdmin = null;
         $isSuperAdmin = null;
         if(!Schema::hasTable('users')){return;}
         if(!Schema::hasTable('users')){return;}
         /** @var CacheService $cacheService */
         /** @var CacheService $cacheService */

+ 7 - 4
app/Providers/EventServiceProvider.php

@@ -35,11 +35,14 @@ class EventServiceProvider extends ServiceProvider
         'App\Events\SendEmailEvent' => [
         'App\Events\SendEmailEvent' => [
             'App\Listeners\SendEmailListener'
             'App\Listeners\SendEmailListener'
         ],
         ],
-        'App\Events\AddOrUpdateOrderIssues' => [
-            'App\Listeners\AddOrUpdateOrderIssuesListener',
+        'App\Events\AddOrUpdateOrderIssues' => [//问题件新增或更新
+            'App\Listeners\AddOrUpdateOrderIssuesListener',//将对应的order_packages的数据的异常装变更
         ],
         ],
-        'App\Events\OrderIssueProcessLogCreateEvent' => [
-            'App\Listeners\UpdateOrderPackageExceptionListener',
+        'App\Events\OrderIssueProcessLogCreateEvent' => [//orderIssue增添日志时
+            'App\Listeners\UpdateOrderPackageExceptionListener',//将对应的order_packages的数据的异常装变更为无
+        ],
+        'App\Events\UpdateOrderPackageExceptionListenerEvent' => [//order_packages的数据的异常数据变更时
+            'App\Listeners\UpdateOrderPackageExceptionTypeCountingRecordListener',//更新OrderPackageExceptionTypeCountingRecord的统计信息
         ],
         ],
     ];
     ];
 
 

+ 1 - 1
app/Services/BatchService.php

@@ -106,7 +106,7 @@ class BatchService
                 $batchesJson.=json_encode($batch);
                 $batchesJson.=json_encode($batch);
                 Cache::tags(['波次防重叠'.$batch['id']])->flush();
                 Cache::tags(['波次防重叠'.$batch['id']])->flush();
             }
             }
-            throw new ErrorException('注册任务失败: '. $batchesJson . $e->getMessage().$e->getTrace());
+            throw new ErrorException('注册任务失败: '. $batchesJson . $e->getMessage().json_encode($e->getTrace()));
         }
         }
     }
     }
 
 

+ 2 - 2
app/Services/ForeignHaiRoboticsService.php

@@ -214,11 +214,11 @@ class ForeignHaiRoboticsService
                 '输送线入立架',
                 '输送线入立架',
                 'BIN-IN1',//TODO:这里应该是动态取得,参考出立架getULineExit()方法,不然不能从站获得对应的出口,而且要改Station的child为children
                 'BIN-IN1',//TODO:这里应该是动态取得,参考出立架getULineExit()方法,不然不能从站获得对应的出口,而且要改Station的child为children
                 '',
                 '',
-                $stationTaskMaterialBox['stationTaskBatch']['id']
+                $stationTaskMaterialBox_toStore['stationTaskBatch']['id']
             );
             );
             $this->controlHaiRobot($dataToPost);
             $this->controlHaiRobot($dataToPost);
 
 
-            $stationTaskMaterialBox = $stationTaskMaterialBox??$materialBox??null;
+            $stationTaskMaterialBox = $stationTaskMaterialBox_toStore??$materialBox??null;
             if($stationTaskMaterialBox && get_class($stationTaskMaterialBox)==MaterialBox::class){
             if($stationTaskMaterialBox && get_class($stationTaskMaterialBox)==MaterialBox::class){
                 $stationTaskMaterialBox = StationTaskMaterialBox::query()
                 $stationTaskMaterialBox = StationTaskMaterialBox::query()
                     ->where('material_box_id',$stationTaskMaterialBox['id'])
                     ->where('material_box_id',$stationTaskMaterialBox['id'])

+ 8 - 0
app/Services/LaborReportService.php

@@ -105,12 +105,20 @@ class LaborReportService
             $yesterdayDate=Carbon::now()->subDays(1)->format('Y-m-d');
             $yesterdayDate=Carbon::now()->subDays(1)->format('Y-m-d');
             $laborReportYesterday=LaborReport::query()->where('user_id',$userDutyCheck->user_id)->where('created_at','like',$yesterdayDate.'%')->orderBy('id','desc')->first();
             $laborReportYesterday=LaborReport::query()->where('user_id',$userDutyCheck->user_id)->where('created_at','like',$yesterdayDate.'%')->orderBy('id','desc')->first();
             if ($laborReportYesterday){
             if ($laborReportYesterday){
+                if (!$laborReportYesterday->check_out_at&&$laborReportYesterday['user_workgroup_id']){
+                    UserDutyCheck::where('user_id',$laborReportYesterday->user_id)->where('type','登出')->where('checked_at','like',Carbon::now()->format('Y-m-d H:i').'%')->orderBy('id','desc')->delete();
+                    return "<h1 style='color: darkred;text-align:center'>您还未退组,暂不可退场,请联系组长!</h1>";
+                }
                 $exportReport=LaborReport::exitAndChangeLaborReport($laborReportYesterday,$userDutyCheck);
                 $exportReport=LaborReport::exitAndChangeLaborReport($laborReportYesterday,$userDutyCheck);
                 Controller::logS(__METHOD__,"退场更改临时工报表信息__".__FUNCTION__,json_encode([$laborReportYesterday,$userDutyCheck]));
                 Controller::logS(__METHOD__,"退场更改临时工报表信息__".__FUNCTION__,json_encode([$laborReportYesterday,$userDutyCheck]));
                 if ($exportReport) event(new ExportEvent($exportReport));
                 if ($exportReport) event(new ExportEvent($exportReport));
             }
             }
         }
         }
         if($laborReport&&$importAndExportQRCodeType=='export'){
         if($laborReport&&$importAndExportQRCodeType=='export'){
+            if (!$laborReport['check_out_at']&&$laborReport['user_workgroup_id']){
+                UserDutyCheck::where('user_id',$laborReport->user_id)->where('type','登出')->where('checked_at','like',Carbon::now()->format('Y-m-d H:i').'%')->orderBy('id','desc')->delete();
+                return "<h1 style='color: darkred;text-align:center'>您还未退组,暂不可退场,请联系组长!</h1>";
+            }
             $exportReport=LaborReport::exitAndChangeLaborReport($laborReport,$userDutyCheck);
             $exportReport=LaborReport::exitAndChangeLaborReport($laborReport,$userDutyCheck);
             Controller::logS(__METHOD__,"退场更改临时工报表信息__".__FUNCTION__,json_encode([$laborReport,$userDutyCheck]));
             Controller::logS(__METHOD__,"退场更改临时工报表信息__".__FUNCTION__,json_encode([$laborReport,$userDutyCheck]));
             if ($exportReport) event(new ExportEvent($exportReport));
             if ($exportReport) event(new ExportEvent($exportReport));

+ 134 - 120
app/Services/LogisticSFService.php

@@ -101,7 +101,10 @@ xml;
             $data = $this->switchOpCodeToStatus($lastRoute, $data);
             $data = $this->switchOpCodeToStatus($lastRoute, $data);
             $data['transfer_status'] = $this->transformRoutes($routeResponse['Route']);
             $data['transfer_status'] = $this->transformRoutes($routeResponse['Route']);
             if (!array_key_exists('exception', $data)) {//当顺丰返回异常时,不需要再根据时间判断是否异常,直接用顺丰的异常就好
             if (!array_key_exists('exception', $data)) {//当顺丰返回异常时,不需要再根据时间判断是否异常,直接用顺丰的异常就好
-                $data = $this->setExceptionType($data, $lastRoute['accept_time']);
+                $orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
+                $exceptionData = $orderPackageReceivedSyncService->setExceptionType($data, array_key_exists('accept_time',$lastRoute) ? $lastRoute['accept_time'] : null);
+                $data['exception_type'] = $exceptionData['exception_type'];
+                $data['exception'] = $exceptionData['exception'];
             }
             }
             //如果没有发现额外的异常,且查询到物流轨迹,将异常置为无
             //如果没有发现额外的异常,且查询到物流轨迹,将异常置为无
             if (!array_key_exists('exception', $data)
             if (!array_key_exists('exception', $data)
@@ -114,18 +117,22 @@ xml;
         } catch (Exception $e) {
         } catch (Exception $e) {
             throw new WarningException("单号没有查询到快递路由信息','LogisticSFService->transformSFOneToArr->{$data['logistic_number']}");
             throw new WarningException("单号没有查询到快递路由信息','LogisticSFService->transformSFOneToArr->{$data['logistic_number']}");
         } finally {
         } finally {
+            $data['routes_length'] = array_key_exists('transfer_status', $data) ? count($data['transfer_status']) : 0;
             return $data;
             return $data;
         }
         }
     }
     }
 
 
     /**
     /**
      * 转换快递路由信息
      * 转换快递路由信息
-     * @param array $routs 快递路由
+     * @param  $routs 快递路由
      * @return array
      * @return array
      */
      */
-    public function transformRoutes(array $routs): array
+    public function transformRoutes($routs): array
     {
     {
         $result = [];
         $result = [];
+        if (!is_array($routs)) {
+            $routs = [$routs];
+        }
         foreach ($routs as $route) {
         foreach ($routs as $route) {
             $route = get_object_vars($route)['@attributes'];
             $route = get_object_vars($route)['@attributes'];
             $data['accept_time'] = $route['accept_time'];
             $data['accept_time'] = $route['accept_time'];
@@ -155,7 +162,6 @@ xml;
                 case 36:
                 case 36:
                     $data['status'] = '在途';
                     $data['status'] = '在途';
                     break;
                     break;
-                case 70:
                 case 33:
                 case 33:
                     $data['status'] = '派送异常';
                     $data['status'] = '派送异常';
                     $data['exception_type'] = '派件异常';
                     $data['exception_type'] = '派件异常';
@@ -178,6 +184,11 @@ xml;
                 case 99:
                 case 99:
                     $data['status'] = '返回中';
                     $data['status'] = '返回中';
                     break;
                     break;
+                case 70:
+                    $data['status'] = '无';
+                    $data['exception'] = '是';
+                    $data['exception_type'] = '其他';
+                    break;
                 default:
                 default:
                     throw new WarningException("未知的丰桥状态码: {$lastRoute['opcode']}->{json_encode($lastRoute)}");
                     throw new WarningException("未知的丰桥状态码: {$lastRoute['opcode']}->{json_encode($lastRoute)}");
             }
             }
@@ -225,120 +236,123 @@ xml;
     }
     }
 
 
 
 
-    /**
-     * @param array $data
-     * @param $lastRouteDate
-     * @return array
-     */
-    private function setExceptionType(array $data, $lastRouteDate = null): array
-    {
-        $logistic_number = $data['logistic_number'];
-        /** @var OrderPackage $orderPackage */
-        $orderPackage = OrderPackage::query()->with('order')->where('logistic_number', $logistic_number)->first();
-        $delivered_duration = now()->diffInHours(Carbon::parse($orderPackage['sent_at']));
-        $last_routed_duration = now()->diffInHours(Carbon::parse($lastRouteDate));
-        $VALID_HOURS = 4;
-        $SHORT_RESPONSE_HOURS = 24;
-        $LONG_RESPONSE_HOURS = (function ($province) {
-            switch ($province) {
-                case '浙江省':
-                case '江苏省':
-                case '上海':
-                case '安徽省':
-                    return 72;
-                case '北京':
-                case '天津':
-                case '江西省':
-                case '湖北省':
-                case '湖南省':
-                case '广东省':
-                case '福建省':
-                case '山东省':
-                case '河北省':
-                case '河南省':
-                case '山西省':
-                case '四川省':
-                case '陕西省':
-                case '重庆':
-                case '广西壮族自治区':
-                case '贵州省':
-                case '云南省':
-                case '海南省':
-                case '吉林省':
-                case '黑龙江省':
-                case '辽宁省':
-                    return 120;
-                case '青海省':
-                case '宁夏回族自治区':
-                case '甘肃省':
-                case '内蒙古自治区':
-                case '新疆维吾尔自治区':
-                case '西藏自治区':
-                    return 168;
-                default:
-                    break;
-            }
-        })($orderPackage->order->province);
-        $SENDING_RESPONSE_HOURS = 48;
-        $IS_ROUTED = 1;               //0000 0001 有路由信息
-        $IS_IN_VALID_TIME = 2;        //0000 0010 大于4小时
-        $IS_WEIGHED = 4;              //0000 0100 称重过
-        $IS_RECEIVED = 8;          //0000 1000 已经收货
-        $IS_SENDING = 16;             //0001 0000 正在派送
-        $IS_SHORT_NO_RESPONSE = 32;     //0010 0000 中转异常
-        $IS_LONG_NO_RESPONSE = 64;     //0010 0000 疑似丢件
-        $IS_SENDING_NO_RESPONSE = 128;     //0010 0000 派送异常
-        $conclusion = (function () use (
-            $data, $delivered_duration, $last_routed_duration,
-            $VALID_HOURS, $IS_ROUTED, $IS_IN_VALID_TIME, $IS_WEIGHED, $IS_RECEIVED, $IS_SENDING, $IS_SHORT_NO_RESPONSE, $IS_LONG_NO_RESPONSE, $IS_SENDING_NO_RESPONSE,
-            $SHORT_RESPONSE_HOURS, $LONG_RESPONSE_HOURS, $SENDING_RESPONSE_HOURS,
-            $orderPackage
-        ) {
-            $conclusion = 0;
-            $conclusion |= !empty($data['transfer_status']) ? $IS_ROUTED : 0;
-            $conclusion |= ($delivered_duration > $VALID_HOURS) ? $IS_IN_VALID_TIME : 0;
-            $conclusion |= ($orderPackage->weighed_at) ? $IS_WEIGHED : 0;
-            $conclusion |= ($data['status'] == '已收件') ? $IS_RECEIVED : 0;
-            $conclusion |= ($data['status'] == '派送中') ? $IS_SENDING : 0;//
-            $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
-            $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;
-            $conclusion |= ($last_routed_duration > $SENDING_RESPONSE_HOURS && $data['status'] == '派送中') ? $IS_SENDING_NO_RESPONSE : 0;
-            return $conclusion;
-        })();
-        switch ($conclusion) {
-            case $IS_IN_VALID_TIME:
-                $data['exception_type'] = '疑似库内丢件';
-                break;
-            case $IS_IN_VALID_TIME | $IS_WEIGHED:
-                $data['exception_type'] = '揽件异常';
-                break;
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE:
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE | $IS_WEIGHED:
-                $data['exception_type'] = '中转异常';
-                break;
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE:
-            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE | $IS_WEIGHED:
-                $data['exception_type'] = '疑似丢件';
-                break;
-            default:
-                break;
-        }
-
-        if($conclusion
-            ==($conclusion | $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SENDING | $IS_SENDING_NO_RESPONSE)){
-            $data['exception_type'] = '派件异常';
-        }
-
-        switch ($conclusion) {
-            case $IS_IN_VALID_TIME:
-            case $IS_IN_VALID_TIME | $IS_WEIGHED:
-            case $IS_ROUTED | $IS_SHORT_NO_RESPONSE:
-            case $IS_LONG_NO_RESPONSE:
-                $data['exception'] = '是';
-                break;
-            default:
-                break;
-        }
-        return $data;
-    }
+//    /**
+//     * @param array $data
+//     * @param $lastRouteDate
+//     * @return array
+//     */
+//    private function setExceptionType(array $data, $lastRouteDate): array
+//    {
+//        $logistic_number = $data['logistic_number'];
+//        /** @var OrderPackage $orderPackage */
+//        $orderPackage = OrderPackage::query()->with('order')->where('logistic_number', $logistic_number)->first();
+//        $delivered_duration = now()->diffInHours(Carbon::parse($orderPackage['sent_at']));
+//        $last_routed_duration = now()->diffInHours(Carbon::parse($lastRouteDate));
+//        $VALID_HOURS = 4;
+//        $SHORT_RESPONSE_HOURS = 24;
+//        $LONG_RESPONSE_HOURS = (function ($province) {
+//            switch ($province) {
+//                case '浙江省':
+//                case '江苏省':
+//                case '上海':
+//                case '安徽省':
+//                    return 72;
+//                case '北京':
+//                case '天津':
+//                case '江西省':
+//                case '湖北省':
+//                case '湖南省':
+//                case '广东省':
+//                case '福建省':
+//                case '山东省':
+//                case '河北省':
+//                case '河南省':
+//                case '山西省':
+//                case '四川省':
+//                case '陕西省':
+//                case '重庆':
+//                case '广西壮族自治区':
+//                case '贵州省':
+//                case '云南省':
+//                case '海南省':
+//                case '吉林省':
+//                case '黑龙江省':
+//                case '辽宁省':
+//                    return 120;
+//                case '青海省':
+//                case '宁夏回族自治区':
+//                case '甘肃省':
+//                case '内蒙古自治区':
+//                case '新疆维吾尔自治区':
+//                case '西藏自治区':
+//                    return 168;
+//                default:
+//                    break;
+//            }
+//        })($orderPackage->order->province);
+//        $SENDING_RESPONSE_HOURS = 48;
+//        $IS_ROUTED = 1;               //0000 0001 有路由信息
+//        $IS_IN_VALID_TIME = 2;        //0000 0010 大于4小时
+//        $IS_WEIGHED = 4;              //0000 0100 称重过
+//        $IS_RECEIVED = 8;          //0000 1000 已经收货
+//        $IS_SENDING = 16;             //0001 0000 正在派送
+//        $IS_SHORT_NO_RESPONSE = 32;     //0010 0000 中转异常
+//        $IS_LONG_NO_RESPONSE = 64;     //0010 0000 疑似丢件
+//        $IS_SENDING_NO_RESPONSE = 128;     //0010 0000 派送异常
+//        $conclusion = (function () use (
+//            $data, $delivered_duration, $last_routed_duration,
+//            $VALID_HOURS, $IS_ROUTED, $IS_IN_VALID_TIME, $IS_WEIGHED, $IS_RECEIVED, $IS_SENDING, $IS_SHORT_NO_RESPONSE, $IS_LONG_NO_RESPONSE, $IS_SENDING_NO_RESPONSE,
+//            $SHORT_RESPONSE_HOURS, $LONG_RESPONSE_HOURS, $SENDING_RESPONSE_HOURS,
+//            $orderPackage
+//        ) {
+//            $conclusion = 0;
+//            $conclusion |= !empty($data['transfer_status']) ? $IS_ROUTED : 0;
+//            $conclusion |= ($delivered_duration > $VALID_HOURS) ? $IS_IN_VALID_TIME : 0;
+//            $conclusion |= ($orderPackage->weighed_at) ? $IS_WEIGHED : 0;
+//            $conclusion |= ($data['status'] == '已收件') ? $IS_RECEIVED : 0;
+//            $conclusion |= ($data['status'] == '派送中') ? $IS_SENDING : 0;//
+//            $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
+//            $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;
+//            $conclusion |= ($last_routed_duration > $SENDING_RESPONSE_HOURS && $data['status'] == '派送中') ? $IS_SENDING_NO_RESPONSE : 0;
+//            return $conclusion;
+//        })();
+//        switch ($conclusion) {
+//            case $IS_IN_VALID_TIME:
+//                $data['exception_type'] = '疑似库内丢件';
+//                break;
+//            case $IS_IN_VALID_TIME | $IS_WEIGHED:
+//                $data['exception_type'] = '揽件异常';
+//                break;
+//            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE:
+//            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE | $IS_WEIGHED:
+//                $data['exception_type'] = '中转异常';
+//                break;
+//            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE:
+//            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE | $IS_WEIGHED:
+//                $data['exception_type'] = '疑似丢件';
+//                break;
+//            default:
+//                break;
+//        }
+//
+//        if($conclusion
+//            ==($conclusion | $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SENDING | $IS_SENDING_NO_RESPONSE)){
+//            $data['exception_type'] = '派件异常';
+//        }
+//
+//        switch ($conclusion) {
+//            case $IS_IN_VALID_TIME:
+//            case $IS_IN_VALID_TIME | $IS_WEIGHED:
+//            case $IS_ROUTED | $IS_SHORT_NO_RESPONSE:
+//            case $IS_LONG_NO_RESPONSE:
+//                $data['exception'] = '是';
+//                break;
+//            default:
+//                break;
+//        }
+//        return [
+//            'exception_type' => array_key_exists('exception_type', $data) ? $data['exception_type'] : null,
+//            'exception' => array_key_exists('exception', $data) ? $data['exception'] : null,
+//        ];
+//    }
 }
 }

+ 178 - 0
app/Services/LogisticYDService.php

@@ -0,0 +1,178 @@
+<?php
+
+namespace App\Services;
+
+use App\OrderPackage;
+use App\Traits\ServiceAppAop;
+use Carbon\Carbon;
+use Illuminate\Support\Facades\Http;
+
+class LogisticYDService
+{
+    use ServiceAppAop;
+
+    private $app_key;
+    private $app_secret;
+    private $url;
+
+
+    /**
+     * 批量订阅接口
+     * @param $logistic_numbers array
+     * @return mixed
+     */
+    public function registerApi(array $logistic_numbers)
+    {
+        $this->app_key = config('api_logistic.YD.prod.app-key', '999999');
+        $this->app_secret = config('api_logistic.YD.prod.app-secret', '04d4ad40eeec11e9bad2d962f53dda9d');
+        $this->url = config('api_logistic.YD.prod.register.url');
+        $sender = [
+            "address" => "上海市松江区泗泾镇泗砖公路351号",
+            "city" => "上海市",
+            "county" => "松江区",
+            "name" => "施尧",
+            "phone" => '13761413262',
+            "province" => "上海市"
+        ];
+        $body = [
+            "orders" => [],
+        ];
+        $order_packages = OrderPackage::query()
+            ->with('order')
+            ->whereIn('logistic_number', $logistic_numbers)->get();
+        foreach ($order_packages as $order_package) {
+            $order = $order_package->order;
+            $body['orders'][] = [
+                'orderid' => $order->client_code,
+                "mailno" => $order_package->logistic_number,
+                "receiver" => [
+                    "address" => $order->address,
+                    "city" => $order->city,
+                    "county" => $order->district,
+                    "name" => $order->consignee_name,
+                    "phone" => $order->consignee_phone,
+                    "province" => $order->province
+                ],
+                "sender" => $sender
+            ];
+        }
+        $json_body = json_encode($body, JSON_UNESCAPED_UNICODE);
+        $sign = md5($json_body . '_' . $this->app_secret);
+        $headers = [
+            'app-key' => $this->app_key,
+            'sign' => $sign,
+            'req-time' => now()->timestamp,
+            "Content-Type" => "application/json"
+        ];
+        $response = Http::withHeaders($headers)->withBody($json_body, 'application/json')->post($this->url);
+        return json_decode($response);
+    }
+
+    public function query($logistic_number)
+    {
+        $this->app_key = config('api_logistic.YD.prod.app-key', '999999');
+        $this->app_secret = config('api_logistic.YD.prod.app-secret', '04d4ad40eeec11e9bad2d962f53dda9d');
+        $this->url = config('api_logistic.YD.prod.search.url');
+        $body = [
+            "mailno" => $logistic_number
+        ];
+        $sign = md5(json_encode($body, JSON_UNESCAPED_UNICODE) . '_' . $this->app_secret);
+        $headers = [
+            'app-key' => $this->app_key,
+            'sign' => $sign,
+            'req-time' => now()->timestamp,
+            "Content-Type" => "application/json"
+        ];
+        $response = Http::withHeaders($headers)->withBody(json_encode($body, JSON_UNESCAPED_UNICODE), 'application/json')->post($this->url);
+        return json_decode($response->body());
+    }
+
+    public function format($nativeResponse)
+    {
+        $result = [];
+        if ($nativeResponse->code != '0000') {
+            return [];
+        } else {
+            $nativeData = $nativeResponse->data;
+            $result['logistic_number'] = $nativeData->mailno;
+            $nativeRoutes = $nativeData->steps;
+            if (!empty($nativeRoutes)) {
+                $lastNativeRoute = $nativeRoutes[count($nativeRoutes) - 1];
+                $result['status'] = $this->getStatus($nativeData);
+                if ($result['status'] == '已收件') {
+                    $result['received_at'] = $lastNativeRoute->time;
+                }
+                $result['transfer_status'] = $this->getTransferStatus($nativeRoutes);
+                $orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
+                $exceptionData = $orderPackageReceivedSyncService->setExceptionType($result, $lastNativeRoute ? $lastNativeRoute->time : null);
+                $result['exception_type'] = $exceptionData['exception_type'];
+                $result['exception'] = $exceptionData['exception'];
+
+            } else {
+                $result['status'] = null;
+                $result['transfer_status'] = [];
+            }
+
+            if (!array_key_exists('status', $result)) {
+                $result['status'] = null;
+                $result['transfer_status'] = [];
+            }
+            //如果没有发现额外的异常,且查询到物流轨迹,将异常置为无
+            if (!array_key_exists('exception', $result)
+                && !array_key_exists('exception_type', $result)
+                && array_key_exists('transfer_status', $result)
+            ) {
+                $result['exception_type'] = '无';
+                $result['exception'] = '否';
+            }
+            $result['routes_length'] = array_key_exists('transfer_status', $result) ? count($result['transfer_status']) : 0;
+            return $result;
+        }
+    }
+
+    /**
+     * @param $nativeData
+     * @return string
+     */
+    private function getStatus($nativeData): string
+    {
+        $status = null;
+        switch ($nativeData->status) {
+            case 'GOT':
+                $status = '已揽收';
+                break;
+            case 'TRANSIT':
+                $status = '在途';
+                break;
+            case 'SIGNED':
+                $status = '已收件';
+                break;
+            case 'RETURN':
+                $status = '返回中';
+                break;
+            case 'SIGNFAIL':
+                $status = '无';
+                break;
+            default:
+                $status = '无';
+        }
+        return $status;
+    }
+
+    /**
+     * @param $nativeRoutes
+     * @return array
+     */
+    private function getTransferStatus($nativeRoutes): array
+    {
+        $transferStatus = [];
+        foreach ($nativeRoutes as $nativeRoute) {
+            $item = [];
+            $item['accept_time'] = $nativeRoute->time;
+            $item['accept_address'] = $nativeRoute->description;
+            $item['remark'] = "";
+            $transferStatus[] = $item;
+        }
+        return $transferStatus;
+    }
+}

+ 71 - 0
app/Services/OrderPackageExceptionTypeCountingRecordService.php

@@ -0,0 +1,71 @@
+<?php
+
+namespace App\Services;
+
+use App\Traits\ServiceAppAop;
+use App\OrderPackageExceptionTypeCountingRecord;
+use Carbon\Carbon;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\DB;
+
+class OrderPackageExceptionTypeCountingRecordService
+{
+    use ServiceAppAop;
+
+    protected $modelClass = OrderPackageExceptionTypeCountingRecord::class;
+
+    /**
+     * 同步当前日期多少天前数据
+     */
+    public function updateOrCreate($days)
+    {
+        DB::table("order_packages")
+            ->select(['exception_type',
+                DB::raw('count( * ) AS exception_type_count'),
+                DB::raw("DATE_FORMAT( sent_at, '%Y-%m-%d' ) AS sent_at_date "),
+                'owner_id',
+            ])
+            ->where('sent_at', '>=', now()->subDays($days)->startOfDay())
+            ->whereNotNull(['owner_id', 'sent_at'])
+            ->where('exception_type','!=','无')
+            ->groupBy(['exception_type',
+                'sent_at_date',
+                'owner_id'])->orderBy('sent_at_date')->chunk(1000, function ($items) {
+                foreach ($items as $item) {
+                    OrderPackageExceptionTypeCountingRecord::query()->updateOrCreate((array)$item);
+                }
+            });
+    }
+
+    public function updateOrCreateByDate($date)
+    {
+        DB::table("order_packages")
+            ->select(['exception_type',
+                DB::raw('count( * ) AS exception_type_count'),
+                DB::raw("DATE_FORMAT( sent_at, '%Y-%m-%d' ) AS sent_at_date "),
+                'owner_id',
+            ])
+            ->where('sent_at', '>=', Carbon::parse($date)->startOfDay())
+            ->where('sent_at', '<=', Carbon::parse($date)->endOfDay())
+            ->whereNotNull(['owner_id', 'sent_at'])
+            ->where('exception_type','!=','无')
+            ->groupBy(['exception_type',
+                'sent_at_date',
+                'owner_id'])->orderBy('sent_at_date')->chunk(1000, function ($items) {
+                foreach ($items as $item) {
+                    OrderPackageExceptionTypeCountingRecord::query()->updateOrCreate((array)$item);
+                }
+            });
+    }
+
+    public function get(array $kvPairs): ?Collection
+    {
+        return OrderPackageExceptionTypeCountingRecord::query()
+            ->select(['exception_type', DB::raw('sum(exception_type_count) as count')])
+            ->where('sent_at_date', '>=', Carbon::parse($kvPairs['start_date'])->startOfDay())
+            ->where('sent_at_date', '<=', Carbon::parse($kvPairs['end_date'])->endOfDay())
+            ->where('exception_type','!=','无')
+            ->whereIn('owner_id', $kvPairs['owner_ids'])
+            ->groupBy('exception_type')->get();
+    }
+}

+ 192 - 12
app/Services/OrderPackageReceivedSyncService.php

@@ -4,6 +4,7 @@
 namespace App\Services;
 namespace App\Services;
 
 
 
 
+use App\Jobs\LogisticYDSync;
 use App\Jobs\LogisticZopSync;
 use App\Jobs\LogisticZopSync;
 use App\OrderPackage;
 use App\OrderPackage;
 use Carbon\Carbon;
 use Carbon\Carbon;
@@ -26,10 +27,20 @@ class OrderPackageReceivedSyncService
         $logisticNumbers = $this->getLogisticNumbers();
         $logisticNumbers = $this->getLogisticNumbers();
         $this->update($this->getLogisticRoutes($logisticNumbers));
         $this->update($this->getLogisticRoutes($logisticNumbers));
         //更新中通
         //更新中通
-        $ZTOLogisticNumbers = $logisticNumbers['ZTO'];
-        foreach ($ZTOLogisticNumbers as $logisticNumber) {
-            LogisticZopSync::dispatch($logisticNumber);
+        if (array_key_exists('ZTO', $logisticNumbers)) {
+            $ZTOLogisticNumbers = $logisticNumbers['ZTO'];
+            foreach ($ZTOLogisticNumbers as $logisticNumber) {
+                LogisticZopSync::dispatch($logisticNumber);
+            }
+        }
+        //更新韵达
+        if (array_key_exists('YUNDA', $logisticNumbers)) {
+            $YDLogisticNumbers = $logisticNumbers['YUNDA'];
+            foreach ($YDLogisticNumbers as $logistic_number) {
+                LogisticYDSync::dispatch($logistic_number);
+            }
         }
         }
+
     }
     }
 
 
     /**
     /**
@@ -102,32 +113,34 @@ class OrderPackageReceivedSyncService
     {
     {
         //初始化时间 2020-12-31 23:59:59
         //初始化时间 2020-12-31 23:59:59
         $initDate = Carbon::parse(config('api_logistic.init_date'));
         $initDate = Carbon::parse(config('api_logistic.init_date'));
-        $data = [];
         $query = OrderPackage::query()
         $query = OrderPackage::query()
+            ->select(['logistic_number', 'order_id'])
             ->with(['order' => function ($query) {
             ->with(['order' => function ($query) {
                 return $query->with('logistic');
                 return $query->with('logistic');
             }]);
             }]);
         if (Carbon::now()->lte($initDate)) {//当前时间小于等于初始化时间
         if (Carbon::now()->lte($initDate)) {//当前时间小于等于初始化时间
             //初始化查询一个月的数据,exception为否
             //初始化查询一个月的数据,exception为否
-            $query = $query->where('created_at', '>=', $initDate->subDays((int)config('api_logistic.days'))->toDateTimeString())
-//                ->where('exception', '否')
+            $query = $query->where('sent_at', '>=', $initDate->subDays((int)config('api_logistic.days'))->toDateTimeString())
                 ->whereNull('received_at');
                 ->whereNull('received_at');
-        } else {//当前时间大于初始化时间,exception为否且未收货
-            $query = $query->where('created_at', '>=', $initDate->toDateTimeString())
-//                ->where('exception', '否')
+        } else {//查询20天以内的数据
+            $query = $query->where('sent_at', '>=', now()->subDays(20))
                 ->whereNull('received_at');
                 ->whereNull('received_at');
         }
         }
-        return $this->buildData($query->get(), $data);
+        $result = [];
+        $query->chunk(1000, function ($orderPackages) use (&$result) {
+            return $result = array_merge($result, $this->buildData($orderPackages));
+        });
+        return $result;
     }
     }
 
 
     /**
     /**
      * 将orderPackage集合分类并摘取指定数据
      * 将orderPackage集合分类并摘取指定数据
      * @param Collection $orderPackages
      * @param Collection $orderPackages
-     * @param array $data
      * @return array
      * @return array
      */
      */
-    private function buildData(Collection $orderPackages, array $data): array
+    private function buildData(Collection $orderPackages): array
     {
     {
+        $data = [];
         foreach ($orderPackages as $orderPackage) {
         foreach ($orderPackages as $orderPackage) {
             try {
             try {
                 $logisticCode = $orderPackage->order->logistic->code;
                 $logisticCode = $orderPackage->order->logistic->code;
@@ -142,4 +155,171 @@ class OrderPackageReceivedSyncService
         }
         }
         return $data;
         return $data;
     }
     }
+
+
+    /**
+     * @param array $data
+     * @param $lastRouteDate
+     * @return array
+     */
+    public function setExceptionType(array $data, $lastRouteDate): array
+    {
+        $logistic_number = $data['logistic_number'];
+        /** @var OrderPackage $orderPackage */
+        $orderPackage = OrderPackage::query()->with('order')->where('logistic_number', $logistic_number)->first();
+        $delivered_duration = now()->diffInHours(Carbon::parse($orderPackage['sent_at']));
+        $last_routed_duration = now()->diffInHours(Carbon::parse($lastRouteDate));
+        $VALID_HOURS = 4;
+        $SHORT_RESPONSE_HOURS = (function ($province) {
+            switch ($province) {
+                case '浙江省':
+                case '江苏省':
+                case '上海':
+                case '安徽省':
+                    return 24;
+                case '北京':
+                case '天津':
+                case '江西省':
+                case '湖北省':
+                case '湖南省':
+                case '广东省':
+                case '福建省':
+                case '山东省':
+                case '河北省':
+                case '河南省':
+                case '山西省':
+                case '四川省':
+                case '陕西省':
+                case '重庆':
+                case '广西壮族自治区':
+                case '贵州省':
+                case '云南省':
+                case '海南省':
+                case '吉林省':
+                case '黑龙江省':
+                case '辽宁省':
+                    return 72;
+                case '青海省':
+                case '宁夏回族自治区':
+                case '甘肃省':
+                case '内蒙古自治区':
+                case '新疆维吾尔自治区':
+                case '西藏自治区':
+                    return 120;
+                default:
+                    return 24;
+            }
+        })($orderPackage->order->province);
+        $LONG_RESPONSE_HOURS = (function ($province) {
+            switch ($province) {
+                case '浙江省':
+                case '江苏省':
+                case '上海':
+                case '安徽省':
+                    return 72;
+                case '北京':
+                case '天津':
+                case '江西省':
+                case '湖北省':
+                case '湖南省':
+                case '广东省':
+                case '福建省':
+                case '山东省':
+                case '河北省':
+                case '河南省':
+                case '山西省':
+                case '四川省':
+                case '陕西省':
+                case '重庆':
+                case '广西壮族自治区':
+                case '贵州省':
+                case '云南省':
+                case '海南省':
+                case '吉林省':
+                case '黑龙江省':
+                case '辽宁省':
+                    return 120;
+                case '青海省':
+                case '宁夏回族自治区':
+                case '甘肃省':
+                case '内蒙古自治区':
+                case '新疆维吾尔自治区':
+                case '西藏自治区':
+                    return 168;
+                default:
+                    return 72;
+            }
+        })($orderPackage->order->province);
+        $SENDING_RESPONSE_HOURS = 48;
+        $HAVEN_SECOND_GOT_HOURS = 24;
+        $IS_ROUTED = 1;               //0000 0001 有路由信息
+        $IS_IN_VALID_TIME = 2;        //0000 0010 大于4小时
+        $IS_WEIGHED = 4;              //0000 0100 称重过
+        $IS_RECEIVED = 8;          //0000 1000 已经收货
+        $IS_SENDING = 16;             //0001 0000 正在派送
+        $IS_SHORT_NO_RESPONSE = 32;     //0010 0000 中转异常
+        $IS_LONG_NO_RESPONSE = 64;     //0010 0000 疑似丢件
+        $IS_SENDING_NO_RESPONSE = 128;     //0010 0000 派送异常
+        $IS_SECOND_ROUTE_HAVE = 256;     //0100 0000 揽件异常
+        $conclusion = (function () use (
+            $data, $delivered_duration, $last_routed_duration,
+            $VALID_HOURS, $IS_ROUTED, $IS_IN_VALID_TIME, $IS_WEIGHED, $IS_RECEIVED, $IS_SENDING, $IS_SHORT_NO_RESPONSE, $IS_LONG_NO_RESPONSE, $IS_SENDING_NO_RESPONSE,
+            $SHORT_RESPONSE_HOURS, $LONG_RESPONSE_HOURS, $SENDING_RESPONSE_HOURS, $HAVEN_SECOND_GOT_HOURS, $IS_SECOND_ROUTE_HAVE,
+            $orderPackage
+        ) {
+            $conclusion = 0;
+            $conclusion |= !empty($data['transfer_status']) ? $IS_ROUTED : 0;
+            $conclusion |= ($delivered_duration > $VALID_HOURS) ? $IS_IN_VALID_TIME : 0;
+            $conclusion |= ($orderPackage->weighed_at) ? $IS_WEIGHED : 0;
+            $conclusion |= ($data['status'] == '已收件') ? $IS_RECEIVED : 0;
+            $conclusion |= ($data['status'] == '派送中') ? $IS_SENDING : 0;//
+            $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
+            $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;
+            $conclusion |= ($last_routed_duration > $SENDING_RESPONSE_HOURS && $data['status'] == '派送中') ? $IS_SENDING_NO_RESPONSE : 0;
+            $conclusion |= ($delivered_duration > $HAVEN_SECOND_GOT_HOURS && $data['routes_length'] < 2) ? $IS_SECOND_ROUTE_HAVE : 0;//超过指定时间,路由信息小于两条
+            return $conclusion;
+        })();
+        switch ($conclusion) {
+            case $IS_IN_VALID_TIME:
+                $data['exception_type'] = '疑似库内丢件';
+                break;
+            case $IS_IN_VALID_TIME | $IS_WEIGHED:
+                $data['exception_type'] = '揽件异常';
+                break;
+            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE:
+            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SHORT_NO_RESPONSE | $IS_WEIGHED:
+                $data['exception_type'] = '中转异常';
+                break;
+            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE:
+            case $IS_ROUTED | $IS_IN_VALID_TIME | $IS_LONG_NO_RESPONSE | $IS_WEIGHED:
+                $data['exception_type'] = '疑似丢件';
+                break;
+            default:
+                break;
+        }
+        if ($conclusion
+            == ($conclusion | $IS_ROUTED | $IS_IN_VALID_TIME | $IS_SENDING | $IS_SENDING_NO_RESPONSE)) {
+            $data['exception_type'] = '派件异常';
+        }
+        if ($conclusion
+            == ($conclusion | $IS_SECOND_ROUTE_HAVE)) {
+            $data['exception_type'] = '派件异常';
+            $data['exception'] = '是';
+
+        }
+        switch ($conclusion) {
+            case $IS_IN_VALID_TIME:
+            case $IS_IN_VALID_TIME | $IS_WEIGHED:
+            case $IS_ROUTED | $IS_SHORT_NO_RESPONSE:
+            case $IS_LONG_NO_RESPONSE:
+                $data['exception'] = '是';
+                break;
+            default:
+                break;
+        }
+        return [
+            'exception_type' => array_key_exists('exception_type', $data) ? $data['exception_type'] : null,
+            'exception' => array_key_exists('exception', $data) ? $data['exception'] : null,
+        ];
+    }
 }
 }

+ 3 - 3
app/Services/OwnerPriceExpressService.php

@@ -225,9 +225,9 @@ class OwnerPriceExpressService
     {
     {
         return app(CacheService::class)->getOrExecute("logistics_owner_".$owner,function ()use($owner){
         return app(CacheService::class)->getOrExecute("logistics_owner_".$owner,function ()use($owner){
             $query = DB::raw(<<<sql
             $query = DB::raw(<<<sql
-    SELECT logistic_id FROM `owner_price_express_owner` e 
-    LEFT JOIN owner_price_express_logistic l 
-    ON e.owner_price_express_id = l.owner_price_express_id 
+    SELECT logistic_id FROM `owner_price_express_owner` e
+    LEFT JOIN owner_price_express_logistic l
+    ON e.owner_price_express_id = l.owner_price_express_id
     WHERE e.owner_id = ?
     WHERE e.owner_id = ?
 sql
 sql
             );
             );

+ 17 - 7
app/Services/OwnerPriceOperationService.php

@@ -328,10 +328,18 @@ class OwnerPriceOperationService
         $money = null;
         $money = null;
         $taxFee = null;
         $taxFee = null;
 
 
-        if ($type == '出库')$total = app("OrderService")->getOrderQuantity($ownerId)+1;//获取该货主本月C端单量
-        else {
+        if ($type == '出库'){
+            $total = app("OrderService")->getOrderQuantity($ownerId)+1;//获取该货主本月C端单量
+            $matchObject->packages->each(function ($package)use(&$orderTotal){
+                $package->commodities->each(function ($commodity)use(&$orderTotal){
+                    $orderTotal += (int)$commodity->amount;
+                });
+            });
+            $matchObject[$columnMapping[12]] = $orderTotal;
+        }else {
             $total = 0;
             $total = 0;
             if ($matchObject->storeItems)foreach ($matchObject->storeItems as $item)$total += $item->amount;
             if ($matchObject->storeItems)foreach ($matchObject->storeItems as $item)$total += $item->amount;
+            $matchObject[$columnMapping[12]] = $total;
             $total += app("StoreService")->getStoreAmount($ownerId);//获取该货主本月入库件数
             $total += app("StoreService")->getStoreAmount($ownerId);//获取该货主本月入库件数
         }
         }
         foreach ($rules as $rule){
         foreach ($rules as $rule){
@@ -439,11 +447,13 @@ class OwnerPriceOperationService
 
 
             if ($rule->strategy=='起步'){
             if ($rule->strategy=='起步'){
                 $startNumber = $rule->amount;
                 $startNumber = $rule->amount;
-                $money = $startNumber ? $startNumber*$rule->unit_price : $rule->unit_price;
-
+                $money = 0;
                 if ($unitName && $startNumber && $unitName != $units[$rule->unit_id])return -3; //校验单位是否一致
                 if ($unitName && $startNumber && $unitName != $units[$rule->unit_id])return -3; //校验单位是否一致
-                if ($startNumber)$matchObject=$this->settingCount($matchObject,$columnMapping[8],$startNumber);
-                if ($matchObject)foreach ($matchObject as $package)$money += $package[$columnMapping[8]] * $package["price"];
+                if ($startNumber){
+                    $money = $rule->unit_price;
+                    $matchObject=$this->settingCount($matchObject,$columnMapping[8],$startNumber);
+                }
+                if ($matchObject)foreach ($matchObject as $package)if ($package["price"] ?? false)$money += $package[$columnMapping[8]] * $package["price"];
                 if (!$startNumber && $money<$rule->unit_price)$money = $rule->unit_price;
                 if (!$startNumber && $money<$rule->unit_price)$money = $rule->unit_price;
                 return $money+$surcharge;
                 return $money+$surcharge;
             }
             }
@@ -473,7 +483,7 @@ class OwnerPriceOperationService
         }
         }
         if ($matchObject){
         if ($matchObject){
             $money = $surcharge;
             $money = $surcharge;
-            foreach ($matchObject as $package)if ($package["price"])$money += $package[$columnMapping[8]] * $package["price"];
+            foreach ($matchObject as $package)if ($package["price"] ?? false)$money += $package[$columnMapping[8]] * $package["price"];
         }
         }
         return $money ?? -7;
         return $money ?? -7;
     }
     }

+ 18 - 13
app/Services/OwnerService.php

@@ -185,19 +185,24 @@ class OwnerService
 
 
     public function get(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false, $user = null)
     public function get(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false, $user = null)
     {
     {
-        /** @var User $user */
-        if ($user==null) {
-            $user = Auth::user();
-        }
-        $query = Owner::query();
-        if ($withs)$query->with($withs);
-        if ($authority){
-            $ids = $user->getPermittingOwnerIdsAttribute();
-            $query->whereIn("id",$ids);
-        }
-        if ($notShowSoftDelete) $query->whereNull('deleted_at');
-        $query = $this->query($query,$params);
-        return $query->get();
+        return Cache::remember(
+            'owner_'.md5(json_encode($params).json_encode($withs).$authority.$notShowSoftDelete.json_encode($user))
+            ,config('cache.expirations.rarelyChange')
+            ,function()use($params,$withs,$authority,$notShowSoftDelete,$user){
+            /** @var User $user */
+            if ($user==null) {
+                $user = Auth::user();
+            }
+            $query = Owner::query();
+            if ($withs)$query->with($withs);
+            if ($authority&&$user){
+                $ids = $user->getPermittingOwnerIdsAttribute();
+                $query->whereIn("id",$ids);
+            }
+            if ($notShowSoftDelete) $query->whereNull('deleted_at');
+            $query = $this->query($query,$params);
+            return $query->get();
+        });
     }
     }
 
 
     public function paginate(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false)
     public function paginate(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false)

+ 12 - 0
app/Services/PackageService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 use App\OrderPackage;
 use App\OrderPackage;
 use App\Package;
 use App\Package;
 use App\Services\common\QueryService;
 use App\Services\common\QueryService;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Auth;
@@ -36,6 +37,17 @@ class PackageService
             $packages->whereNotNull('weighed_at');
             $packages->whereNotNull('weighed_at');
             Arr::forget($params, 'is_weighed');
             Arr::forget($params, 'is_weighed');
         }
         }
+        if ($params["batch_number"] ?? false){
+            $codes = preg_split('/[,, ]+/is', $params["batch_number"]);
+            $packages->whereHas("order",function ($query)use($codes){
+                /** @var Builder $query */
+                $query->whereHas("batch",function ($query)use($codes){
+                    /** @var Builder $query */
+                    $query->whereIn("code",$codes);
+                });
+            });
+            unset($params["batch_number"]);
+        }
         $columnQueryRules=[
         $columnQueryRules=[
             'batch_number' => ['batch' => ''],
             'batch_number' => ['batch' => ''],
             'weighed_at_start' => ['alias' => 'weighed_at', 'startDate' => ':00'],
             'weighed_at_start' => ['alias' => 'weighed_at', 'startDate' => ':00'],

+ 134 - 2
app/Services/StoreService.php

@@ -383,9 +383,12 @@ class StoreService
      */
      */
     private function storeAmountCompensationLogic($owner)
     private function storeAmountCompensationLogic($owner)
     {
     {
-        $query = DB::raw("SELECT sum(amount) total FROM `store_items` WHERE created_at LIKE ?");
+        $query = DB::raw(<<<sql
+SELECT sum(amount) total FROM `store_items` LEFT JOIN stores ON store_items.store_id=stores.id WHERE stores.owner_id = ? AND (stores.status='已入库' OR stores.status='ASN关闭') AND store_items.updated_at LIKE ?
+sql
+        );
         $statistics = DB::selectOne($query,[$owner,date("Y-m")."%"]);
         $statistics = DB::selectOne($query,[$owner,date("Y-m")."%"]);
-        Cache::put(date("Y-m")."|A|".$owner,$statistics->total,2764800);
+        Cache::put(date("Y-m")."|A|".$owner,$statistics->total ? $statistics->total : 0,2764800);
     }
     }
 
 
     /**
     /**
@@ -414,4 +417,133 @@ class StoreService
         if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);
         if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);
         return Cache::get($date."|A|".$owner);
         return Cache::get($date."|A|".$owner);
     }
     }
+
+    public function warehousing(array $params)
+    {
+        $conn = oci_connect(config('database.connections.oracle.username'),
+            config('database.connections.oracle.password'),
+            config('database.connections.oracle.host'). '/' . config('database.connections.oracle.service_name'),"utf8");
+        $sp = "begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus," .
+            ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," .
+            " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," .
+            ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," .
+            ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," .
+            ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;";
+        $inParams = array(
+            "IN_Warehouse"=>"",
+            "In_Process_Action"=>"",
+            "In_ASNNo_C"=>"",
+            "In_ASNLineNo_C"=>"",
+            "In_FMTraceID_C"=>"",
+            "In_New_TraceID_C"=>"",
+            "In_ProductStatus"=>"00",
+            "In_ProductStatus_Descr"=>"正常",
+            "In_HoldRejectCode_C"=>"OK",
+            "In_HoldRejectReason_C"=>"正常",
+            "In_PONo_C"=>"",
+            "In_CustomerID"=>"",
+            "In_SKU"=>"",
+            "In_ReceivedQty"=>"",
+            "In_RejectedQty"=>"",
+            "In_UOM"=>"EA",
+            "In_PackID"=>"",
+            "In_ContainerID"=>"",
+            "In_LotAtt01_C"=>"",
+            "In_LotAtt02_C"=>"",
+            "In_LotAtt03_C"=>"",
+            "In_LotAtt04_C"=>"",
+            "In_LotAtt05_C"=>"",
+            "In_LotAtt06_C"=>"",
+            "In_LotAtt07_C"=>"",
+            "In_LotAtt08_C"=>"",
+            "In_LotAtt09_C"=>"",
+            "In_LotAtt10_C"=>"",
+            "In_LotAtt11_C"=>"",
+            "In_LotAtt12_C"=>"",
+            "In_TotalCubic"=>"0.00",
+            "In_TotalGrossWeight"=>"0.00",
+            "In_TotalNetWeight"=>"0.00",
+            "In_TotalPrice"=>"0.00",
+            "In_UserDefine1"=>"",
+            "In_UserDefine2"=>"",
+            "In_UserDefine3"=>"",
+            "In_UserDefine4"=>"",
+            "In_UserDefine5"=>"",
+            "In_FMLocation"=>"",
+            "In_TOLocation_C"=>"",
+            "In_QC_Type_C"=>"OK",
+            "In_PlanToLoc_C"=>"",
+            "In_ReceivingTime"=>"",
+            "In_LPN"=>"*",
+            "In_Operator"=>"WCS",
+            "IN_RCVModule"=>"",
+            "IN_RCVStation"=>"",
+            "In_Language"=>"cn",
+            "In_UserID"=>"WCS",
+            "result"=>""
+        );
+        foreach ($params as $key=>$val)$inParams[$key] = $val;
+        list($IN_Warehouse,$In_Process_Action,$In_ASNNo_C,$In_ASNLineNo_C,$In_FMTraceID_C,$In_New_TraceID_C,$In_ProductStatus,
+            $In_ProductStatus_Descr,$In_HoldRejectCode_C,$In_HoldRejectReason_C,$In_PONo_C,$In_CustomerID,$In_SKU,$In_ReceivedQty,
+            $In_RejectedQty,$In_UOM,$In_PackID,$In_ContainerID,$In_LotAtt01_C,$In_LotAtt02_C,$In_LotAtt03_C,$In_LotAtt04_C,$In_LotAtt05_C,
+            $In_LotAtt06_C,$In_LotAtt07_C,$In_LotAtt08_C,$In_LotAtt09_C,$In_LotAtt10_C,$In_LotAtt11_C,$In_LotAtt12_C,$In_TotalCubic,
+            $In_TotalGrossWeight,$In_TotalNetWeight,$In_TotalPrice,$In_UserDefine1,$In_UserDefine2,$In_UserDefine3,$In_UserDefine4,
+            $In_UserDefine5,$In_FMLocation,$In_TOLocation_C,$In_QC_Type_C,$In_PlanToLoc_C,$In_ReceivingTime,$In_LPN,$In_Operator,
+            $IN_RCVModule,$IN_RCVStation,$In_Language,$In_UserID,$result) = array_values($inParams);
+        $stmt = oci_parse($conn, $sp);
+        oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse);
+        oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action);
+        oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C);
+        oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C);
+        oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C);
+        oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C);
+        oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus);
+        oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr);
+        oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C);
+        oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C);
+        oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C);
+        oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID);
+        oci_bind_by_name($stmt, ':In_SKU', $In_SKU);
+        oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty);
+        oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty);
+        oci_bind_by_name($stmt, ':In_UOM', $In_UOM);
+        oci_bind_by_name($stmt, ':In_PackID', $In_PackID);
+        oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID);
+        oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C);
+        oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C);
+        oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C);
+        oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C);
+        oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C);
+        oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C);
+        oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C);
+        oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C);
+        oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C);
+        oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C);
+        oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C);
+        oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C);
+        oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic);
+        oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight);
+        oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight);
+        oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice);
+        oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1);
+        oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2);
+        oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3);
+        oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4);
+        oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5);
+        oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation);
+        oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C);
+        oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C);
+        oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C);
+        oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime);
+        oci_bind_by_name($stmt, ':In_LPN', $In_LPN);
+        oci_bind_by_name($stmt, ':In_Operator', $In_Operator);
+        oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule);
+        oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation);
+        oci_bind_by_name($stmt, ':In_Language', $In_Language);
+        oci_bind_by_name($stmt, ':In_UserID', $In_UserID);
+        oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300);
+        oci_execute($stmt);
+        oci_close($conn);
+        return $result;
+    }
 }
 }

+ 42 - 0
app/Services/WaybillService.php

@@ -3,10 +3,12 @@
 namespace App\Services;
 namespace App\Services;
 
 
 use App\OwnerFeeDetail;
 use App\OwnerFeeDetail;
+use App\Services\common\BatchUpdateService;
 use App\Services\common\QueryService;
 use App\Services\common\QueryService;
 use App\Traits\ModelSearchWay;
 use App\Traits\ModelSearchWay;
 use App\Waybill;
 use App\Waybill;
 use App\WaybillAuditLog;
 use App\WaybillAuditLog;
+use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Auth;
@@ -98,6 +100,10 @@ class WaybillService
             unset($param["recipient_mobile"]);
             unset($param["recipient_mobile"]);
         }
         }
 
 
+        if (($param["updated_at_start"] ?? false) || ($param["updated_at_end"] ?? false)){
+            $waybills->whereIn("waybills.status",['已完结','无模型']);
+        }
+
 //        if($param['carrier_bill'] ?? false){    // 承运商单号
 //        if($param['carrier_bill'] ?? false){    // 承运商单号
 //            $this->searchWay($waybills,$param['carrier_bill'],'waybills.carrier_bill');
 //            $this->searchWay($waybills,$param['carrier_bill'],'waybills.carrier_bill');
 //            unset($param['carrier_bill']);
 //            unset($param['carrier_bill']);
@@ -123,9 +129,15 @@ class WaybillService
             'car_owner_info' => ['batch' => ''],
             'car_owner_info' => ['batch' => ''],
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ':00'],
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ':00'],
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ':59'],
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ':59'],
+            'updated_at_start' => ['alias' => 'updated_at' , 'startDate' => ':00'],
+            'updated_at_end' => ['alias' => 'updated_at' , 'endDate' => ':59'],
+            'deliver_at_start' => ['alias' => 'deliver_at' , 'startDate' => ':00'],
+            'deliver_at_end' => ['alias' => 'deliver_at' , 'endDate' => ':59'],
             'uriType' => ['alias' => 'type'],
             'uriType' => ['alias' => 'type'],
             'id' => ['multi' => ','],
             'id' => ['multi' => ','],
             'logistic_id' => ['multi' => ','],
             'logistic_id' => ['multi' => ','],
+            'mileage' => ['like' => ''],
+            'carrier_weight_other' => ['like' => ''],
         ];
         ];
         $waybills = app(QueryService::class)->query($param,$waybills,$columnQueryRules,"waybills");
         $waybills = app(QueryService::class)->query($param,$waybills,$columnQueryRules,"waybills");
         return $waybills;
         return $waybills;
@@ -140,6 +152,36 @@ class WaybillService
         $waybills = $this->conditionQuery($param);
         $waybills = $this->conditionQuery($param);
         return $waybills->get();
         return $waybills->get();
     }
     }
+    public function dailyBilling(array $param){
+        $isWeight=Waybill::query()->where('waybills.warehouse_weight_other',0)
+            ->where('waybills.created_at','like',$param['screenDate'].'%')
+            ->where('waybills.type','专线')->exists();
+        if ($isWeight)return null;
+        $waybills = Waybill::query()->with(['owner','logistic','originationCity','destinationCity.parent',
+            'uploadFile','amountUnit','warehouseWeightUnit','carrierWeightUnit','district',
+            'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFile','waybillAuditLogs.user'])
+            ->selectRaw('waybills.* ,waybill_on_tops.id top_id,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
+            ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
+            ->whereNull('waybill_on_tops.deleted_at')
+            ->orderBy('waybill_on_tops.updated_at','desc')
+            ->orderBy('waybills.id','desc')
+            ->where('waybills.created_at','like',$param['screenDate'].'%')
+            ->where('waybills.type','专线')
+            ->get();
+        $daily_total_weight=$waybills->sum('warehouse_weight_other');
+        $updateParams = [['id', 'pick_up_fee','updated_at']];
+        foreach ($waybills as $waybill){
+            $waybill['pick_up_fee']=round(($waybill->warehouse_weight_other/$daily_total_weight)*$param['billing'],2);
+            $updateParams[] = [
+                'id' => $waybill->id,
+                'pick_up_fee' => round(($waybill->warehouse_weight_other/$daily_total_weight)*$param['billing'],2),
+                'updated_at' => Carbon::now()->toDateTimeString(),
+            ];
+        }
+        if (count($updateParams)>0)app(BatchUpdateService::class)->batchUpdate('waybills', $updateParams);
+        return $waybills;
+
+    }
 
 
     public function store(Request $request){
     public function store(Request $request){
         return DB::transaction(function ()use($request){
         return DB::transaction(function ()use($request){

+ 1 - 1
app/Warehouse.php

@@ -12,7 +12,7 @@ class Warehouse extends Model
     use ModelLogChanging;
     use ModelLogChanging;
 
 
     use ModelTimeFormat;
     use ModelTimeFormat;
-    protected $fillable=['name','code',"production_capacity","reduced_production_capacity_coefficient"];
+    protected $fillable=['name','code',"production_capacity","reduced_production_capacity_coefficient","address","principal","phone"];
 
 
     public function userWorkgroups(){
     public function userWorkgroups(){
         return $this->hasMany('App\UserWorkgroup');
         return $this->hasMany('App\UserWorkgroup');

+ 1 - 1
app/library/baidu-api-speech/lib/2a7552bdd1b678c303ad53645baeafce

@@ -1 +1 @@
-{"refresh_token":"25.4d53cf00633b3d4a1aac4042f9eece5b.315360000.1899260149.282335-18688250","expires_in":2592000,"session_key":"9mzdCKZyPT8dnHgqKTa2IKAbjeiTI6dKyllds7VEsgOWDGIjY2BEgLmOazFfJmWYYTC0\/RVFMWlS0krsTPpuSdMxopSCHw==","access_token":"24.3bc112d85964e45cab8f8b33c75ac42d.2592000.1586492149.282335-18688250","scope":"audio_voice_assistant_get brain_enhanced_asr audio_tts_post public brain_all_scope picchain_test_picchain_api_scope wise_adapt lebo_resource_base lightservice_public hetu_basic lightcms_map_poi kaidian_kaidian ApsMisTest_Test\u6743\u9650 vis-classify_flower lpq_\u5f00\u653e cop_helloScope ApsMis_fangdi_permission smartapp_snsapi_base iop_autocar oauth_tp_app smartapp_smart_game_openapi oauth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi smartapp_opensource_recapi qatest_scope1 fake_face_detect_\u5f00\u653eScope vis-ocr_\u865a\u62df\u4eba\u7269\u52a9\u7406 idl-video_\u865a\u62df\u4eba\u7269\u52a9\u7406","session_secret":"7ed83fac7de4c020d1f1627700b9ab71","time":1583900148,"is_cloud_user":false}
+{"refresh_token":"25.7e4748217e997c84c2402b9b24adb134.315360000.1936752238.282335-18688250","expires_in":2592000,"session_key":"9mzdCPblW0XXeNGCMqTv\/JHlyb1R+CCFsPtDR+I+pkvO3Wt6R95mYM6B\/czx+j6XbwA+xuH79EnEt1k9LyvlecbmLoyo3A==","access_token":"24.32855024de5bed138fec0c12a1dd166d.2592000.1623984238.282335-18688250","scope":"brain_asr_async brain_speech_realtime audio_voice_assistant_get brain_enhanced_asr audio_tts_post public brain_all_scope picchain_test_picchain_api_scope wise_adapt lebo_resource_base lightservice_public hetu_basic lightcms_map_poi kaidian_kaidian ApsMisTest_Test\u6743\u9650 vis-classify_flower lpq_\u5f00\u653e cop_helloScope ApsMis_fangdi_permission smartapp_snsapi_base smartapp_mapp_dev_manage iop_autocar oauth_tp_app smartapp_smart_game_openapi oauth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi smartapp_opensource_recapi fake_face_detect_\u5f00\u653eScope vis-ocr_\u865a\u62df\u4eba\u7269\u52a9\u7406 idl-video_\u865a\u62df\u4eba\u7269\u52a9\u7406 smartapp_component smartapp_search_plugin avatar_video_test","session_secret":"a8e2a31ba3a17b7c3f30efa29600b809","time":1621392238,"is_cloud_user":false}

+ 10 - 11
app/library/zop/ZopClient.php

@@ -3,6 +3,7 @@
 
 
 namespace App\library\zop;
 namespace App\library\zop;
 use App\library\zop\ZopHttpUtil;
 use App\library\zop\ZopHttpUtil;
+use Illuminate\Support\Facades\Http;
 
 
 class ZopClient
 class ZopClient
 {
 {
@@ -40,22 +41,20 @@ class ZopClient
             $data_digest = base64_encode(md5($str_to_digest, TRUE));
             $data_digest = base64_encode(md5($str_to_digest, TRUE));
             $headers = array(
             $headers = array(
                 "Content-Type: application/x-www-form-urlencoded; charset=UTF-8",
                 "Content-Type: application/x-www-form-urlencoded; charset=UTF-8",
-                "x-companyid: " .$this->zopProperties->getCompanyid(),
-                "x-datadigest: " .$data_digest
+                "x-companyid: " . $this->zopProperties->getCompanyid(),
+                "x-datadigest: " . $data_digest
             );
             );
             return $this->httpClient->post($url, $headers, http_build_query($fixedParams), 2000);
             return $this->httpClient->post($url, $headers, http_build_query($fixedParams), 2000);
-        } else{
+        } else {
             $url = $zopRequest->getUrl();
             $url = $zopRequest->getUrl();
             $body = $zopRequest->getBody();
             $body = $zopRequest->getBody();
-            $str_to_digest = $body.$this->zopProperties->getKey();
+            $str_to_digest = $body . $this->zopProperties->getKey();
             $data_digest = base64_encode(md5($str_to_digest, TRUE));
             $data_digest = base64_encode(md5($str_to_digest, TRUE));
-            $headers = array(
-                "Content-Type: application/json; charset=UTF-8",
-                "x-companyid: ".$this->zopProperties->getCompanyid(),
-                "x-datadigest: ".$data_digest
-            );
-            return $this->httpClient->post($url, $headers, $body, 2000);
-
+            return Http::withHeaders([
+                'Content-Type' => 'application/json; charset=UTF-8',
+                'x-companyid' => $this->zopProperties->getCompanyid(),
+                'x-datadigest' => $data_digest,
+            ])->withBody(json_encode((array)json_decode($body), JSON_UNESCAPED_UNICODE), 'application/json')->post($url)->body();
         }
         }
     }
     }
 }
 }

+ 29 - 7
config/api_logistic.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 return [
 return [
-    'logistic'=>[
+    'logistic' => [
         'ZTO' => 'ZTO',
         'ZTO' => 'ZTO',
         'SF' => 'SF',
         'SF' => 'SF',
         'YUNDA' => 'YUNDA',
         'YUNDA' => 'YUNDA',
@@ -77,9 +77,9 @@ return [
     ],
     ],
     //丰桥
     //丰桥
     'SF' => [
     'SF' => [
-        'url' =>  'https://bspsw.sf-express.com/sfexpressService',
-        'head' =>  'BSGYLGL',
-        'check_word' =>  'DcauTQEavq5qqpFaYmltzR7gzVCTjvtz',
+        'url' => 'https://bspsw.sf-express.com/sfexpressService',
+        'head' => 'BSGYLGL',
+        'check_word' => 'DcauTQEavq5qqpFaYmltzR7gzVCTjvtz',
         'max_size' => 10,
         'max_size' => 10,
         'op_code_map' => [
         'op_code_map' => [
             30 => '快件在【XXX营业点】已装车,准备发往 【XXX集散中心】',
             30 => '快件在【XXX营业点】已装车,准备发往 【XXX集散中心】',
@@ -102,10 +102,32 @@ return [
     ],
     ],
     //中通 https://op.zto.cn/#/Console?type=API
     //中通 https://op.zto.cn/#/Console?type=API
     'ZTO' => [
     'ZTO' => [
-        'url' =>  'https://japi.zto.com/zto.open.getRouteInfo',
+        'url' => 'https://japi.zto.com/zto.open.getRouteInfo',
         'x-appKey' => 'c51c718eb899e9f706979',
         'x-appKey' => 'c51c718eb899e9f706979',
         'appSecret' => '9f664e3ab08049874aa417720840161a',
         'appSecret' => '9f664e3ab08049874aa417720840161a',
     ],
     ],
-    'init_date' => '2021-04-14 23:59:59',
-    'days' => 4,
+    'YD' => [
+        'test' => [
+            'app-key' => '999999',
+            'app-secret' => '04d4ad40eeec11e9bad2d962f53dda9d',
+            'search' => [
+                'url' => 'https://u-openapi.yundasys.com/openapi/outer/logictis/query',
+            ],
+            'register' => [
+                'url' => 'https://u-openapi.yundasys.com/openapi/outer/logictis/subscribe',
+            ],
+        ],
+        'prod'=>[
+            'app-key' => '000638',
+            'app-secret' => '0b941e746e3e4a5687c11f11f32ef9a3',
+            'search' => [
+                'url' => 'https://openapi.yundaex.com/openapi/outer/logictis/query',
+            ],
+            'register' => [
+                'url' => 'https://openapi.yundaex.com/openapi/outer/logictis/subscribe',
+            ],
+        ]
+    ],
+    'init_date' => '2021-05-17 23:59:59',
+    'days' => 2,
 ];
 ];

+ 1 - 1
database/factories/OracleBasCustomerFactory.php

@@ -9,6 +9,6 @@ $factory->define(OracleBasCustomer::class, function (Faker $faker) {
     return [
     return [
         'customer_type'=> $faker->uuid,
         'customer_type'=> $faker->uuid,
         'customerid'=> $faker->uuid,
         'customerid'=> $faker->uuid,
-        'descr_c'=> $faker->name
+        'descr_c'=> $faker->name,
     ];
     ];
 });
 });

+ 12 - 0
database/factories/OrderPackageExceptionTypeCountingRecordFactory.php

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

+ 24 - 1
database/factories/OrderPackageFactory.php

@@ -2,11 +2,34 @@
 
 
 /** @var \Illuminate\Database\Eloquent\Factory $factory */
 /** @var \Illuminate\Database\Eloquent\Factory $factory */
 
 
+use App\Order;
 use App\OrderPackage;
 use App\OrderPackage;
 use Faker\Generator as Faker;
 use Faker\Generator as Faker;
 
 
 $factory->define(OrderPackage::class, function (Faker $faker) {
 $factory->define(OrderPackage::class, function (Faker $faker) {
+    $statuses = ['无', '已称重', '已揽收', '在途', '在途异常', '派送中', '派送异常', '返回中', '返回异常', '返回派件', '其他异常', '已收件',];
+    $exceptions = ['是', '否'];
+    $exception_types = ['疑似库内丢件','揽件异常','中转异常','疑似丢件','派件异常','其他','无'];
     return [
     return [
-        'logistic_number' => $faker->uuid
+        'logistic_number' => $faker->uuid,
+        'order_id' => random_int(1, 10000),
+        'batch_number' => random_int(1, 100),
+        'batch_rule' => null,
+        'bulk' => null,
+        'weight' => null,
+        'height' => null,
+        'paper_box_id' => random_int(1, 100),
+        'measuring_machine_id' => random_int(1, 100),
+        'weighed_at' => now()->subHours(3),
+        'status' => $faker->randomElement($statuses),
+        'sent_at' => now()->subHours(1),
+        'received_at' => null,
+        'exception' => $faker->randomElement($exceptions),
+        'transfer_status' => null,
+        'remark' => null,
+        'owner_id' => random_int(1, 100),
+        'uploaded_to_wms' => '是',
+        'exception_message' => $faker->name,
+        'exception_type' => $faker->randomElement($exception_types),
     ];
     ];
 });
 });

+ 1 - 1
database/factories/OwnerBillReportFactory.php

@@ -11,7 +11,7 @@ $factory->define(OwnerBillReport::class, function (Faker $faker) {
     return [
     return [
         "owner_id" => factory(\App\Owner::class),       //项目ID
         "owner_id" => factory(\App\Owner::class),       //项目ID
         "counting_month" => $faker->date(), //结算月
         "counting_month" => $faker->date(), //结算月
-        "initial_fee" => $initial_fee,    //原始账单金额
+//        "initial_fee" => $initial_fee,    //原始账单金额
         "confirm_fee" => $confirm_fee,    //确认账单金额
         "confirm_fee" => $confirm_fee,    //确认账单金额
         "difference" => $confirm_fee - $initial_fee,     //差额
         "difference" => $confirm_fee - $initial_fee,     //差额
         "confirmed" => "否",      //确认状态
         "confirmed" => "否",      //确认状态

+ 0 - 1
database/factories/OwnerReportFactory.php

@@ -14,6 +14,5 @@ $factory->define(OwnerReport::class, function (Faker $faker)use($owner) {
         "current_month_counting_area" => mt_rand(100,100000) / 50,  //结算月盘点面积
         "current_month_counting_area" => mt_rand(100,100000) / 50,  //结算月盘点面积
         "last_month_counting_area"   => mt_rand(100,100000) / 50,  //结算月上月盘点面积
         "last_month_counting_area"   => mt_rand(100,100000) / 50,  //结算月上月盘点面积
         "owner_bill_report_id"  =>factory(App\OwnerBillReport::class),        //账单ID
         "owner_bill_report_id"  =>factory(App\OwnerBillReport::class),        //账单ID
-        "total" => mt_rand(1,2000),
     ];
     ];
 });
 });

+ 13 - 0
database/factories/TaxRateFactory.php

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

+ 3 - 1
database/factories/WarehouseFactory.php

@@ -8,6 +8,8 @@ use Faker\Generator as Faker;
 $factory->define(Warehouse::class, function (Faker $faker) {
 $factory->define(Warehouse::class, function (Faker $faker) {
     return [
     return [
         'name' => $faker->name,
         'name' => $faker->name,
-        'code' => $faker->uuid
+        'code' => $faker->uuid,
+        'production_capacity'=> round(2),
+        'reduced_production_capacity_coefficient'=> round(2),
     ];
     ];
 });
 });

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

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddIndexExceptionTypeSentAtOwnerIdOrderPackagesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->index(['sent_at', 'exception_type', 'owner_id']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->dropIndex(['sent_at', 'exception_type', 'owner_id']);
+        });
+    }
+}

+ 35 - 0
database/migrations/2021_05_07_141912_create_order_package_exception_type_counting_records_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderPackageExceptionTypeCountingRecordsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_package_exception_type_counting_records', function (Blueprint $table) {
+            $table->id();
+            $table->date("sent_at_date")->comment("发出日期");
+            $table->string('exception_type')->comment('异常名称');
+            $table->integer('exception_type_count')->comment('异常类型的统计数量');
+            $table->unsignedBigInteger('owner_id')->comment('货主ID');
+            $table->index(['sent_at_date', 'exception_type_count', 'owner_id'],'order_packages_s_et_o_index');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_package_exception_type_counting_records');
+    }
+}

+ 36 - 0
database/migrations/2021_05_14_100303_change_warehouses_table_add_column_address_column.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeWarehousesTableAddColumnAddressColumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table("warehouses",function (Blueprint $table){
+            $table->text("address")->nullable()->comment("仓库地址");
+            $table->string("principal")->nullable()->comment('负责人');
+            $table->string("phone")->nullable()->comment('电话');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table("warehouses",function (Blueprint $table){
+            $table->dropColumn("address");
+            $table->dropColumn("principal");
+            $table->dropColumn("phone");
+        });
+    }
+}

+ 35 - 0
database/migrations/2021_05_18_093618_add_authorities_wabill.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthoritiesWabill extends Migration
+{
+    protected $authorities = [
+        "运输管理-运单-按日计算专线费",
+    ];
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->authorities as $authority){
+            \App\Authority::query()->firstOrCreate(["name"=>$authority],["name"=>$authority,"alias_name"=>$authority]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        foreach ($this->authorities as $authority){
+            \App\Authority::query()->where("name",$authority)->delete();
+        }
+    }
+}

+ 30 - 0
database/migrations/2021_05_18_151348_add_authority_order_package_remark.php

@@ -0,0 +1,30 @@
+<?php
+
+use App\Authority;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthorityOrderPackageRemark extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Authority::query()->firstOrCreate(["name" => "包裹管理-快递-客服备注"],["alias_name"=>"包裹管理-快递-客服备注"]);
+
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::query()->where('name', '包裹管理-快递-客服备注')->delete();
+    }
+}

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

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeLogisticsTableAddEnglishNameColumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('logistics', function (Blueprint $table) {
+            $table->string("english_name")->nullable()->comment("英文名称");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('logistics', function (Blueprint $table) {
+            $table->dropColumn("english_name");
+        });
+    }
+}

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

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddMaterialBoxesFieldStatus extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('material_boxes', function (Blueprint $table) {
+            $table->tinyInteger('status')->index('material_boxes_i_status');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('material_boxes', function (Blueprint $table) {
+            $table->dropColumn('status');
+        });
+    }
+}

+ 16 - 0
database/seeds/OrderPackageExceptionTypeCountingRecordSeeder.php

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

+ 180 - 0
horizon.conf

@@ -0,0 +1,180 @@
+; Sample supervisor config file.
+;
+; For more information on the config file, please see:
+; http://supervisord.org/configuration.html
+;
+; Notes:
+;  - Shell expansion ("~" or "$HOME") is not supported.  Environment
+;    variables can be expanded using this syntax: "%(ENV_HOME)s".
+;  - Quotes around values are not supported, except in the case of
+;    the environment= options as shown below.
+;  - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
+;  - Command will be truncated if it looks like a config file comment, e.g.
+;    "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
+;
+; Warning:
+;  Paths throughout this example file use /tmp because it is available on most
+;  systems.  You will likely need to change these to locations more appropriate
+;  for your system.  Some systems periodically delete older files in /tmp.
+;  Notably, if the socket file defined in the [unix_http_server] section below
+;  is deleted, supervisorctl will be unable to connect to supervisord.
+
+[unix_http_server]
+file=/tmp/supervisor.sock   ; the path to the socket file
+;chmod=0700                 ; socket file mode (default 0700)
+;chown=nobody:nogroup       ; socket file uid:gid owner
+;username=user              ; default is no username (open server)
+;password=123               ; default is no password (open server)
+
+; Security Warning:
+;  The inet HTTP server is not enabled by default.  The inet HTTP server is
+;  enabled by uncommenting the [inet_http_server] section below.  The inet
+;  HTTP server is intended for use within a trusted environment only.  It
+;  should only be bound to localhost or only accessible from within an
+;  isolated, trusted network.  The inet HTTP server does not support any
+;  form of encryption.  The inet HTTP server does not use authentication
+;  by default (see the username= and password= options to add authentication).
+;  Never expose the inet HTTP server to the public internet.
+
+;[inet_http_server]         ; inet (TCP) server disabled by default
+;port=127.0.0.1:9001        ; ip_address:port specifier, *:port for all iface
+;username=user              ; default is no username (open server)
+;password=123               ; default is no password (open server)
+
+[supervisord]
+logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
+logfile_maxbytes=50MB        ; max main logfile bytes b4 rotation; default 50MB
+logfile_backups=10           ; # of main logfile backups; 0 means none, default 10
+loglevel=info                ; log level; default info; others: debug,warn,trace
+pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
+nodaemon=false               ; start in foreground if true; default false
+silent=false                 ; no logs to stdout if true; default false
+minfds=1024                  ; min. avail startup file descriptors; default 1024
+minprocs=200                 ; min. avail process descriptors;default 200
+;umask=022                   ; process file creation umask; default 022
+;user=supervisord            ; setuid to this UNIX account at startup; recommended if root
+;identifier=supervisor       ; supervisord identifier, default is 'supervisor'
+;directory=/tmp              ; default is not to cd during start
+;nocleanup=true              ; don't clean up tempfiles at start; default false
+;childlogdir=/tmp            ; 'AUTO' child log dir, default $TEMP
+;environment=KEY="value"     ; key value pairs to add to environment
+;strip_ansi=false            ; strip ansi escape codes in logs; def. false
+
+; The rpcinterface:supervisor section must remain in the config file for
+; RPC (supervisorctl/web interface) to work.  Additional interfaces may be
+; added by defining them in separate [rpcinterface:x] sections.
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+; The supervisorctl section configures how supervisorctl will connect to
+; supervisord.  configure it match the settings in either the unix_http_server
+; or inet_http_server section.
+
+[supervisorctl]
+serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
+;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
+;username=chris              ; should be same as in [*_http_server] if set
+;password=123                ; should be same as in [*_http_server] if set
+;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
+;history_file=~/.sc_history  ; use readline history if available
+
+; The sample program section below shows all possible program subsection values.
+; Create one or more 'real' program: sections to be able to control them under
+; supervisor.
+
+[program:artisan]
+process_name=%(program_name)s
+command=php /var/www/was/artisan horizon
+autostart=true
+autorestart=true
+user=baoshi
+redirect_stderr=true
+stdout_logfile=/var/www/was/storage/horizon.log
+stopwaitsecs=3600
+
+;[program:theprogramname]
+;command=/bin/cat              ; the program (relative uses PATH, can take args)
+;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
+;numprocs=1                    ; number of processes copies to start (def 1)
+;directory=/tmp                ; directory to cwd to before exec (def no cwd)
+;umask=022                     ; umask for process (default None)
+;priority=999                  ; the relative start priority (default 999)
+;autostart=true                ; start at supervisord start (default: true)
+;startsecs=1                   ; # of secs prog must stay up to be running (def. 1)
+;startretries=3                ; max # of serial start failures when starting (default 3)
+;autorestart=unexpected        ; when to restart if exited after running (def: unexpected)
+;exitcodes=0                   ; 'expected' exit codes used with autorestart (default 0)
+;stopsignal=QUIT               ; signal used to kill process (default TERM)
+;stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)
+;stopasgroup=false             ; send stop signal to the UNIX process group (default false)
+;killasgroup=false             ; SIGKILL the UNIX process group (def false)
+;user=chrism                   ; setuid to this UNIX account to run the program
+;redirect_stderr=true          ; redirect proc stderr to stdout (default false)
+;stdout_logfile=/a/path        ; stdout log path, NONE for none; default AUTO
+;stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
+;stdout_logfile_backups=10     ; # of stdout logfile backups (0 means none, default 10)
+;stdout_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
+;stdout_events_enabled=false   ; emit events on stdout writes (default false)
+;stdout_syslog=false           ; send stdout to syslog with process name (default false)
+;stderr_logfile=/a/path        ; stderr log path, NONE for none; default AUTO
+;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
+;stderr_logfile_backups=10     ; # of stderr logfile backups (0 means none, default 10)
+;stderr_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
+;stderr_events_enabled=false   ; emit events on stderr writes (default false)
+;stderr_syslog=false           ; send stderr to syslog with process name (default false)
+;environment=A="1",B="2"       ; process environment additions (def no adds)
+;serverurl=AUTO                ; override serverurl computation (childutils)
+
+; The sample eventlistener section below shows all possible eventlistener
+; subsection values.  Create one or more 'real' eventlistener: sections to be
+; able to handle event notifications sent by supervisord.
+
+;[eventlistener:theeventlistenername]
+;command=/bin/eventlistener    ; the program (relative uses PATH, can take args)
+;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
+;numprocs=1                    ; number of processes copies to start (def 1)
+;events=EVENT                  ; event notif. types to subscribe to (req'd)
+;buffer_size=10                ; event buffer queue size (default 10)
+;directory=/tmp                ; directory to cwd to before exec (def no cwd)
+;umask=022                     ; umask for process (default None)
+;priority=-1                   ; the relative start priority (default -1)
+;autostart=true                ; start at supervisord start (default: true)
+;startsecs=1                   ; # of secs prog must stay up to be running (def. 1)
+;startretries=3                ; max # of serial start failures when starting (default 3)
+;autorestart=unexpected        ; autorestart if exited after running (def: unexpected)
+;exitcodes=0                   ; 'expected' exit codes used with autorestart (default 0)
+;stopsignal=QUIT               ; signal used to kill process (default TERM)
+;stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)
+;stopasgroup=false             ; send stop signal to the UNIX process group (default false)
+;killasgroup=false             ; SIGKILL the UNIX process group (def false)
+;user=chrism                   ; setuid to this UNIX account to run the program
+;redirect_stderr=false         ; redirect_stderr=true is not allowed for eventlisteners
+;stdout_logfile=/a/path        ; stdout log path, NONE for none; default AUTO
+;stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
+;stdout_logfile_backups=10     ; # of stdout logfile backups (0 means none, default 10)
+;stdout_events_enabled=false   ; emit events on stdout writes (default false)
+;stdout_syslog=false           ; send stdout to syslog with process name (default false)
+;stderr_logfile=/a/path        ; stderr log path, NONE for none; default AUTO
+;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
+;stderr_logfile_backups=10     ; # of stderr logfile backups (0 means none, default 10)
+;stderr_events_enabled=false   ; emit events on stderr writes (default false)
+;stderr_syslog=false           ; send stderr to syslog with process name (default false)
+;environment=A="1",B="2"       ; process environment additions
+;serverurl=AUTO                ; override serverurl computation (childutils)
+
+; The sample group section below shows all possible group values.  Create one
+; or more 'real' group: sections to create "heterogeneous" process groups.
+
+;[group:thegroupname]
+;programs=progname1,progname2  ; each refers to 'x' in [program:x] definitions
+;priority=999                  ; the relative start priority (default 999)
+
+; The [include] section can just contain the "files" setting.  This
+; setting can list multiple files (separated by whitespace or
+; newlines).  It can also contain wildcards.  The filenames are
+; interpreted as relative to this file.  Included files *cannot*
+; include files themselves.
+
+;[include]
+;files = relative/directory/*.ini

BIN
public/images/QRCodeIMG/1.png


+ 25 - 4
public/t.php

@@ -1,5 +1,26 @@
 <?php
 <?php
-$codes=['sdf',33,'4'];
-$responseBody = 'sadfsdlfkj200,34324';
-$responseBody = strstr($responseBody,'200')?'取料箱'.implode(',',$codes).'成功':$responseBody;
-var_dump($responseBody);
+
+
+class Aa
+{
+    public $enums=[
+        'status'=>[
+            '在库外'=>6,
+            '在U型线'=>1,
+            '在出库中'=>2,
+            '在入库中'=>3,
+            '在立库'=>4,
+            '异常'=>5,
+        ],
+    ];
+    function __construct(array $attributes = [])
+    {
+        foreach ($this->enums as &$enum) {
+            $enum=$enum+array_flip($enum);
+        }
+    }
+
+}
+
+$aa = new Aa();
+var_dump($aa->enums['status'][1]);

+ 6 - 5
resources/js/queryForm/header.js

@@ -4,10 +4,10 @@ window.Header = function getHeader(object) {
     let _targetDom = object.el ? document.getElementById(object.el) : document.getElementsByTagName("table")[0];//基点元素
     let _targetDom = object.el ? document.getElementById(object.el) : document.getElementsByTagName("table")[0];//基点元素
     let _columns = object.column;   //列名
     let _columns = object.column;   //列名
     let _fixedTop = object.fixedTop || 0;  //同级浮动元素高度,使当前元素追加该元素高度浮动
     let _fixedTop = object.fixedTop || 0;  //同级浮动元素高度,使当前元素追加该元素高度浮动
-    let _isCheckAllBox = object.isCheckAllBox || true;//是否开启全选框
+    let _isCheckAllBox = object.isCheckAllBox!==false;//是否开启全选框
     let _data = object.data || [];   //被排序数据
     let _data = object.data || [];   //被排序数据
     let _restorationColumn = object.restorationColumn || 'id'; //恢复原数据基准字段
     let _restorationColumn = object.restorationColumn || 'id'; //恢复原数据基准字段
-    let _is_restorationColumn_asc = object.is_restorationColumn_asc || false;    //恢复原数据基准字段的排序类型 true:asc false:desc
+    let _isRestorationColumnAsc = object.isRestorationColumnAsc || false;    //恢复原数据基准字段的排序类型 true:asc false:desc
     let _before = object.before;//前置元素
     let _before = object.before;//前置元素
     let _name = "header:"+(object.name ? object.name+"." : "");//唯一名称 用于区别模块 本地存储
     let _name = "header:"+(object.name ? object.name+"." : "");//唯一名称 用于区别模块 本地存储
     let _isForbidDrag = object.isForbidDrag;
     let _isForbidDrag = object.isForbidDrag;
@@ -61,7 +61,6 @@ window.Header = function getHeader(object) {
         let firstTr = _targetDom.getElementsByTagName("tr")[0];
         let firstTr = _targetDom.getElementsByTagName("tr")[0];
         let tds = [];
         let tds = [];
         if (firstTr)tds = firstTr.children;
         if (firstTr)tds = firstTr.children;
-
         if (_isCheckAllBox){//是否开启全选
         if (_isCheckAllBox){//是否开启全选
             let div = document.createElement("div");
             let div = document.createElement("div");
             let check = document.createElement("input");
             let check = document.createElement("input");
@@ -77,7 +76,7 @@ window.Header = function getHeader(object) {
             let div = document.createElement("div");
             let div = document.createElement("div");
             let th = appendFloat(div);
             let th = appendFloat(div);
             let column = _columns[(_isCheckAllBox && firstTr) ? i-1 : i];
             let column = _columns[(_isCheckAllBox && firstTr) ? i-1 : i];
-            let wid = localStorage.getItem(_name+column.name);
+            let wid = column ? localStorage.getItem(_name+column.name) : null;
             if (wid){
             if (wid){
                 div.style.width = wid+"px";
                 div.style.width = wid+"px";
                 th.style.minWidth = wid+"px";
                 th.style.minWidth = wid+"px";
@@ -175,7 +174,7 @@ window.Header = function getHeader(object) {
                         for(let i = gap; i < len; i++) {
                         for(let i = gap; i < len; i++) {
                             let j = i;
                             let j = i;
                             let current = arr[i];
                             let current = arr[i];
-                            if (_is_restorationColumn_asc){
+                            if (_isRestorationColumnAsc){
                                 while(j - gap >= 0 && Number(current[_restorationColumn]) < Number(arr[j - gap][_restorationColumn])) {
                                 while(j - gap >= 0 && Number(current[_restorationColumn]) < Number(arr[j - gap][_restorationColumn])) {
                                     arr[j] = arr[j - gap];
                                     arr[j] = arr[j - gap];
                                     j = j - gap;
                                     j = j - gap;
@@ -271,6 +270,7 @@ window.Header = function getHeader(object) {
                         trs[j].children[moveTd.index].firstElementChild.style.width = newWidth;
                         trs[j].children[moveTd.index].firstElementChild.style.width = newWidth;
                         trs[j].children[moveTd.index].style.minWidth = newWidth;
                         trs[j].children[moveTd.index].style.minWidth = newWidth;
                     }
                     }
+                    _targetDom.style.width = _targetDom.offsetWidth+diff+"px";
                     moveTd.oldX = event.clientX;
                     moveTd.oldX = event.clientX;
                 }
                 }
             }
             }
@@ -613,5 +613,6 @@ window.Header = function getHeader(object) {
         createSetting();
         createSetting();
         _exeHid([]);
         _exeHid([]);
         bindGlobalEvent();
         bindGlobalEvent();
+        _targetDom.style.width = _targetDom.offsetWidth+"px";
     };
     };
 };
 };

+ 8 - 6
resources/js/queryForm/queryForm.js

@@ -97,14 +97,14 @@ const query = function getQueryForm(data) {
     }
     }
 
 
     function getToggleBtn(){
     function getToggleBtn(){
-        _toggle_btn = $("<button  type='button' class='btn btn-sm btn-success position-fixed' style='left:-5px;top:290px;z-index:10;width: 25px;'>展开</button>")
+        _toggle_btn = $("<button  type='button' class='btn btn-sm btn-success position-fixed' style='left:-5px;top:290px;z-index:10;width: 28px;'>展开筛选</button>")
         _toggle_btn.click(function(){
         _toggle_btn.click(function(){
-            if(_toggle_btn.text() === "展开"){
+            if(_toggle_btn.text() === "展开筛选"){
                 _toggle_btn.text("收缩");
                 _toggle_btn.text("收缩");
                 _table.removeClass("d-none")
                 _table.removeClass("d-none")
                 _table.css("z-index",9);
                 _table.css("z-index",9);
             }else if(_toggle_btn.text() === "收缩"){
             }else if(_toggle_btn.text() === "收缩"){
-                _toggle_btn.text("展开");
+                _toggle_btn.text("展开筛选");
                 _table.addClass("d-none")
                 _table.addClass("d-none")
             }
             }
         });
         });
@@ -633,9 +633,11 @@ const query = function getQueryForm(data) {
             _data[condition.name].select = [];
             _data[condition.name].select = [];
             if (check[0].checked === true) {
             if (check[0].checked === true) {
                 condition.data.forEach(function (data) {
                 condition.data.forEach(function (data) {
-                    _data[condition.name].value.push(data.name);
-                    if (_data[condition.name].select) _data[condition.name].select.push(data.name);
-                    else _data[condition.name].select = [data.name];
+                    if (data.value.indexOf(input.val())!==-1){
+                        _data[condition.name].value.push(data.name);
+                        if (_data[condition.name].select) _data[condition.name].select.push(data.name);
+                        else _data[condition.name].select = [data.name];
+                    }
                 });
                 });
             } else {
             } else {
                 let dom = {
                 let dom = {

+ 93 - 0
resources/views/control/panel.blade.php

@@ -364,7 +364,35 @@
                     </div>
                     </div>
                 </div>
                 </div>
                 @endcan
                 @endcan
+                <div class="col-6">
+                    <div class="card">
+                        <div class="card-header">
+                            <div class="flex-column">
+                                <el-date-picker size="small" class="col-6 date" @blur="loadExceptionTypeInfo()"
+                                                type="daterange" align="right"
+                                                v-model="searchOption.exceptionTypeDate" unlink-panels range-separator="-"
+                                                start-placeholder="开始日期" end-placeholder="结束日期"
+                                                value-format="yyyy-MM-dd">
+                                </el-date-picker>
+                                <el-select class="col-3"  placeholder="请选择对应货主" multiple v-model="selectExceptionTypeOwners" size="small" style="width: 20%"  @change="loadExceptionTypeInfo()">
+                                    <el-option label="选择所有" value="all"></el-option>
+                                    <el-option v-for="item in owners" :label="item.name" :value="item.id" :key="item.id"></el-option>
+                                </el-select>
+                                <label class="col-3 ">
+                                    <select class="form-control rounded" v-model="searchOption.exceptionTypeSelect"
+                                            @change="switchExceptionTypeDate()">
+                                        <option v-for="(date,i) in dateOptions" :value="i">@{{ date.text }}</option>
+                                    </select>
+                                </label>
+                            </div>
+                        </div>
+                        <div class="card-body row">
+                            <div id="exceptionType" class="col-12" style="min-height: 500px"></div>
+                        </div>
+                    </div>
+                </div>
             </div>
             </div>
+
         </div>
         </div>
     </div>
     </div>
 @endsection
 @endsection
@@ -380,6 +408,7 @@
                 owners:{!! $owners !!},
                 owners:{!! $owners !!},
                 selectOrderOwners: [],
                 selectOrderOwners: [],
                 selectLogisticsOwners: [],
                 selectLogisticsOwners: [],
+                selectExceptionTypeOwners: [],
                 warehousesOrders:{!! $warehousesOrders !!},
                 warehousesOrders:{!! $warehousesOrders !!},
                 orderCountingRecords:{},
                 orderCountingRecords:{},
                 logisticsCountingRecords:{},
                 logisticsCountingRecords:{},
@@ -481,7 +510,9 @@
                 cardPool:{},
                 cardPool:{},
                 searchOption:{
                 searchOption:{
                     weightDate:[],
                     weightDate:[],
+                    exceptionTypeDate: [],
                     weightSelect:"",
                     weightSelect:"",
+                    exceptionTypeSelect:"",
                 },
                 },
             },
             },
             watch:{
             watch:{
@@ -506,7 +537,9 @@
                 $('#list').removeClass('d-none');
                 $('#list').removeClass('d-none');
                 let index = 4;
                 let index = 4;
                 this.searchOption.weightSelect = index;
                 this.searchOption.weightSelect = index;
+                this.searchOption.exceptionTypeSelect = index;
                 this.searchOption.weightDate = [this.dateOptions[index].start, this.dateOptions[index].end];
                 this.searchOption.weightDate = [this.dateOptions[index].start, this.dateOptions[index].end];
+                this.searchOption.exceptionTypeDate = [this.dateOptions[index].start, this.dateOptions[index].end];
                 let _this = this;
                 let _this = this;
                 this.warehousesOrders.forEach(function (item) {
                 this.warehousesOrders.forEach(function (item) {
                     _this.totalOrders.total += parseInt(item.total);
                     _this.totalOrders.total += parseInt(item.total);
@@ -543,6 +576,8 @@
                 this.cardPool.weight = echarts.init(document.getElementById("weight"));
                 this.cardPool.weight = echarts.init(document.getElementById("weight"));
                 this.loadWeightInfo();
                 this.loadWeightInfo();
                 @endcan
                 @endcan
+                this.cardPool.exceptionType = echarts.init(document.getElementById("exceptionType"));
+                this.loadExceptionTypeInfo();
             },
             },
             methods: {
             methods: {
                 switchDataPanel_forOrderCountingRecords(fromUnit, toUnit) {
                 switchDataPanel_forOrderCountingRecords(fromUnit, toUnit) {
@@ -898,11 +933,34 @@
                         this.cardPool.weight.setOption(this._setWeightData(res.title,res.data));
                         this.cardPool.weight.setOption(this._setWeightData(res.title,res.data));
                     });
                     });
                 },
                 },
+                loadExceptionTypeInfo() {
+                    window.tempTip.setDuration(3000);
+                    if (!this.searchOption.exceptionTypeDate[0]){
+                        window.tempTip.show("开始时间未选择");
+                        return;
+                    }
+                    if (!this.searchOption.exceptionTypeDate[1]){
+                        window.tempTip.show("结束时间未选择");
+                        return;
+                    }
+                    this.cardPool.exceptionType.showLoading('default',{text:"加 载 中",color:'#C0C0C0'});
+                    let url = "{{url('apiLocal/control/panel/menu/exceptionTypeApi')}}";
+                    let params = {start:this.searchOption.exceptionTypeDate[0],end:this.searchOption.exceptionTypeDate[1],owner_ids:this.selectExceptionTypeOwners};
+                    window.tempTip.postBasicRequest(url,params,res=>{
+                        this.cardPool.exceptionType.hideLoading();
+                        this.cardPool.exceptionType.setOption(this._setExceptionTypeData(res.data));
+                    });
+                },
                 switchWeightDate(){
                 switchWeightDate(){
                     let obj = this.dateOptions[this.searchOption.weightSelect];
                     let obj = this.dateOptions[this.searchOption.weightSelect];
                     this.searchOption.weightDate = [obj.start,obj.end];
                     this.searchOption.weightDate = [obj.start,obj.end];
                     this.loadWeightInfo();
                     this.loadWeightInfo();
                 },
                 },
+                switchExceptionTypeDate(){
+                    let obj = this.dateOptions[this.searchOption.exceptionTypeSelect];
+                    this.searchOption.exceptionTypeDate = [obj.start,obj.end];
+                    this.loadExceptionTypeInfo();
+                },
                 _setWeightData(title, data){
                 _setWeightData(title, data){
                     return {
                     return {
                         title: {
                         title: {
@@ -937,6 +995,41 @@
                         }]
                         }]
                     };
                     };
                 },
                 },
+                _setExceptionTypeData(data) {
+                    let resData = [];
+                    data.forEach(item => {
+                        resData.push({
+                            value:item.count,
+                            name:item.exception_type
+                        })
+                    })
+                    return {
+                        title: {
+                            text: '异常分布',
+                            left: 'left'
+                        },
+                        tooltip: {
+                            trigger: 'item',
+                            formatter: '{a} <br/>{b} : {c} ({d}%)'
+                        },
+                        series: [
+                            {
+                                name: '异常分布',
+                                type: 'pie',
+                                radius: '55%',
+                                center: ['50%', '60%'],
+                                data: resData,
+                                emphasis: {
+                                    itemStyle: {
+                                        shadowBlur: 10,
+                                        shadowOffsetX: 0,
+                                        shadowColor: 'rgba(0, 0, 0, 0.5)'
+                                    }
+                                }
+                            }
+                        ]
+                    }
+                }
             }
             }
         });
         });
     </script>
     </script>

+ 13 - 6
resources/views/customer/project/create.blade.php

@@ -551,12 +551,14 @@
                 //重载作业费
                 //重载作业费
                 _overrideOperation(operation){
                 _overrideOperation(operation){
                     if (operation.discount_count){
                     if (operation.discount_count){
-                        if (operation.discount_count) operation.discount_count = operation.discount_count.split(",");
-                        if (operation.total_discount_price) operation.total_discount_price = operation.total_discount_price.split(",");
                         operation.isDiscount = true;
                         operation.isDiscount = true;
-                    }
+                        operation.discount_count = operation.discount_count.split(",");
+                    } else operation.discount_count = [];
+                    if (operation.total_discount_price) operation.total_discount_price = operation.total_discount_price.split(",");
+                    else operation.total_discount_price = [];
                     operation.items.forEach((item,j)=>{
                     operation.items.forEach((item,j)=>{
                         if (item.discount_price) operation.items[j].discount_price = item.discount_price.split(",");
                         if (item.discount_price) operation.items[j].discount_price = item.discount_price.split(",");
+                        else operation.items[j].discount_price = [];
                     });
                     });
                     if (operation.total_price)operation.isSingle = true;
                     if (operation.total_price)operation.isSingle = true;
                     if (operation.type_mark===0 || operation.type_mark==='0')operation.isRejected = true;
                     if (operation.type_mark===0 || operation.type_mark==='0')operation.isRejected = true;
@@ -782,7 +784,7 @@
                         }else{
                         }else{
                             this.model.storage.amount_interval.forEach((amount,i)=>{
                             this.model.storage.amount_interval.forEach((amount,i)=>{
                                 if (amount==="")error["amount_interval."+i] = ["未设定数量区间"];
                                 if (amount==="")error["amount_interval."+i] = ["未设定数量区间"];
-                                else if (i!==0 && amount<=this.model.storage.amount_interval[i-1])
+                                else if (i!==0 && Number(amount)<=Number(this.model.storage.amount_interval[i-1]))
                                     error["amount_interval."+i] = ["阶梯区间应大于上一区间值"];
                                     error["amount_interval."+i] = ["阶梯区间应大于上一区间值"];
                                 this.model.storage.amount_interval[i] = parseFloat(this.model.storage.amount_interval[i]);
                                 this.model.storage.amount_interval[i] = parseFloat(this.model.storage.amount_interval[i]);
                             });
                             });
@@ -998,12 +1000,12 @@
                     if (this.model.express.isInterval){
                     if (this.model.express.isInterval){
                         this.model.express.amount_interval.forEach((amount,i)=>{
                         this.model.express.amount_interval.forEach((amount,i)=>{
                             if (amount==="") error["amount_interval."+i] = ["区间值不得为空"];
                             if (amount==="") error["amount_interval."+i] = ["区间值不得为空"];
-                            else if (i!==0 && amount<=this.model.express.amount_interval[i-1])error["amount_interval."+i] = ["阶梯区间应大于上一区间值"];
+                            else if (i!==0 && Number(amount)<=Number(this.model.express.amount_interval[i-1]))error["amount_interval."+i] = ["阶梯区间应大于上一区间值"];
                             if (this.model.express.weight_interval[i].length>0){
                             if (this.model.express.weight_interval[i].length>0){
                                 this.model.express.weight_interval[i].forEach((weight,j)=>{
                                 this.model.express.weight_interval[i].forEach((weight,j)=>{
                                     this.model.express.weight_interval[i][j] = parseFloat(this.model.express.weight_interval[i][j]);
                                     this.model.express.weight_interval[i][j] = parseFloat(this.model.express.weight_interval[i][j]);
                                     if (weight==="") error["weight_interval."+i+"."+j] = ["区间值不得为空"];
                                     if (weight==="") error["weight_interval."+i+"."+j] = ["区间值不得为空"];
-                                    else if (j!==0 && weight<=this.model.express.weight_interval[j-1])error["weight_interval."+i+"."+j] = ["阶梯区间应大于上一区间值"];
+                                    else if (j!==0 && Number(weight)<=Number(this.model.express.weight_interval[j-1]))error["weight_interval."+i+"."+j] = ["阶梯区间应大于上一区间值"];
                                 })
                                 })
                             }
                             }
                         });
                         });
@@ -1910,6 +1912,11 @@
                     this.model.operation.total_discount_price.push("");
                     this.model.operation.total_discount_price.push("");
                     arr.push('');
                     arr.push('');
                 },
                 },
+                //开启满减
+                onDiscount(type){
+                  if (!type)return;
+                  if (this.model.operation.discount_count.length===0) this.model.operation.discount_count = [""];
+                },
                 //删除阶梯满减阈值
                 //删除阶梯满减阈值
                 delDiscount(index){
                 delDiscount(index){
                     this.model.operation.items.forEach((item,i)=>{
                     this.model.operation.items.forEach((item,i)=>{

+ 2 - 1
resources/views/customer/project/part/_operation.blade.php

@@ -40,7 +40,7 @@
 <div class="row mt-3">
 <div class="row mt-3">
     <label class="col-2" for="isDiscount">是否满减</label>
     <label class="col-2" for="isDiscount">是否满减</label>
     <div class="col-2">
     <div class="col-2">
-        <input type="checkbox" id="isDiscount" class="rounded mt-1" v-model="model.operation.isDiscount">
+        <input type="checkbox" id="isDiscount" class="rounded mt-1" v-model="model.operation.isDiscount" @change="onDiscount(model.operation.isDiscount)">
     </div>
     </div>
     <div class="col-8 row" v-if="model.operation.isDiscount">
     <div class="col-8 row" v-if="model.operation.isDiscount">
         <div class="col-1 cursor-pointer"><span class="fa fa-plus" @click="addDiscount(model.operation.discount_count)"></span></div>
         <div class="col-1 cursor-pointer"><span class="fa fa-plus" @click="addDiscount(model.operation.discount_count)"></span></div>
@@ -175,6 +175,7 @@
     <input id="surcharge" type="number" step="0.01" min="0" class="form-control col-3" :class="errors.surcharge ? 'is-invalid' : ''" v-model="model.operation.surcharge">
     <input id="surcharge" type="number" step="0.01" min="0" class="form-control col-3" :class="errors.surcharge ? 'is-invalid' : ''" v-model="model.operation.surcharge">
     <label for="surcharge_unit_id" class="col-2 text-right">单位</label>
     <label for="surcharge_unit_id" class="col-2 text-right">单位</label>
     <select id="surcharge_unit_id" v-model="model.operation.surcharge_unit_id" class="form-control col-2" :class="errors.surcharge_unit_id ? 'is-invalid' : ''">
     <select id="surcharge_unit_id" v-model="model.operation.surcharge_unit_id" class="form-control col-2" :class="errors.surcharge_unit_id ? 'is-invalid' : ''">
+        <option> </option>
         <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='单'">@{{ unit.name }}</option>
         <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='单'">@{{ unit.name }}</option>
     </select>
     </select>
 </div>
 </div>

+ 1 - 0
resources/views/customer/project/part/_three.blade.php

@@ -98,6 +98,7 @@
                                         <div class="col-10">
                                         <div class="col-10">
                                             <label>@{{ item.strategy }} <span v-if="item.strategy!='起步'">续费</span></label>:
                                             <label>@{{ item.strategy }} <span v-if="item.strategy!='起步'">续费</span></label>:
                                             <b>@{{ item.amount }}</b>&nbsp;@{{ poolMapping.units ? poolMapping.units[item.unit_id] : '' }} / <b>@{{ item.unit_price }}</b>元
                                             <b>@{{ item.amount }}</b>&nbsp;@{{ poolMapping.units ? poolMapping.units[item.unit_id] : '' }} / <b>@{{ item.unit_price }}</b>元
+                                            <span class="badge badge-secondary" v-if="item.odd_price">零头价:@{{ item.odd_price }}元</span>
                                             <span v-if="operation.isDiscount">&nbsp;(满减单价:<b>@{{ item.discount_price }}元</b>)</span>
                                             <span v-if="operation.isDiscount">&nbsp;(满减单价:<b>@{{ item.discount_price }}元</b>)</span>
                                         </div>
                                         </div>
                                         <div class="col-1">
                                         <div class="col-1">

+ 1 - 1
resources/views/inventory/statement/changeInventory.blade.php

@@ -139,7 +139,7 @@
                     column: column,
                     column: column,
                     data: this.oracleActTransactingLogs,
                     data: this.oracleActTransactingLogs,
                     restorationColumn: 'rn',
                     restorationColumn: 'rn',
-                    is_restorationColumn_asc:true,
+                    isRestorationColumnAsc:true,
                     fixedTop:($('#form_div').height())+2,
                     fixedTop:($('#form_div').height())+2,
                 }).init();
                 }).init();
 
 

+ 7 - 0
resources/views/maintenance/logistic/create.blade.php

@@ -41,6 +41,13 @@
                             @enderror
                             @enderror
                         </div>
                         </div>
                     </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="english_name" class="col-2 col-form-label text-right">承运商英文名称</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control" id="english_name"
+                                   name="english_name" autocomplete="off" value="{{ old('name') }}">
+                        </div>
+                    </div>
                     <div class="form-group row">
                     <div class="form-group row">
                         <label for="code" class="col-2 col-form-label text-right">承运商代码 <b class="text-danger">*</b></label>
                         <label for="code" class="col-2 col-form-label text-right">承运商代码 <b class="text-danger">*</b></label>
                         <div class="col-8">
                         <div class="col-8">

+ 9 - 2
resources/views/maintenance/logistic/edit.blade.php

@@ -36,7 +36,7 @@
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="form-group row">
                     <div class="form-group row">
-                        <label for="name" class="col-2 col-form-label text-right">物流公司名称 <b class="text-danger">*</b></label>
+                        <label for="name" class="col-2 col-form-label text-right">承运商名称 <b class="text-danger">*</b></label>
                         <div class="col-8">
                         <div class="col-8">
                             <input type="text" class="form-control @error('name') is-invalid @enderror"
                             <input type="text" class="form-control @error('name') is-invalid @enderror"
                                    name="name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" required>
                                    name="name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" required>
@@ -48,7 +48,14 @@
                         </div>
                         </div>
                     </div>
                     </div>
                     <div class="form-group row">
                     <div class="form-group row">
-                        <label for="code" class="col-2 col-form-label text-right">物流公司代码 <b class="text-danger">*</b></label>
+                        <label for="english_name" class="col-2 col-form-label text-right">承运商英文名称</label>
+                        <div class="col-8">
+                            <input id="english_name" type="text" class="form-control"
+                                   name="english_name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="code" class="col-2 col-form-label text-right">承运商代码 <b class="text-danger">*</b></label>
                         <div class="col-8">
                         <div class="col-8">
                             <input type="text" class="form-control @error('code') is-invalid @enderror"
                             <input type="text" class="form-control @error('code') is-invalid @enderror"
                                    name="code" autocomplete="off" value="@if(old('code')){{old('code')}}@else{{$logistic->code}}@endif" required>
                                    name="code" autocomplete="off" value="@if(old('code')){{old('code')}}@else{{$logistic->code}}@endif" required>

+ 2 - 0
resources/views/maintenance/logistic/index.blade.php

@@ -16,6 +16,7 @@
                     <tr>
                     <tr>
                         <th>ID</th>
                         <th>ID</th>
                         <th>承运商名称</th>
                         <th>承运商名称</th>
+                        <th>承运商英文名称</th>
                         <th>承运商代码</th>
                         <th>承运商代码</th>
                         <th>承运商联系方式</th>
                         <th>承运商联系方式</th>
                         <th>承运商类型</th>
                         <th>承运商类型</th>
@@ -27,6 +28,7 @@
                     <tr v-for="(logistic,i) in logistics" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
                     <tr v-for="(logistic,i) in logistics" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
                         <td class="text-muted">@{{logistic.id}}</td>
                         <td class="text-muted">@{{logistic.id}}</td>
                         <td>@{{logistic.name}}&nbsp;<span class="badge badge-success" v-if="logistic.is_bunched=='Y'">子母单</span></td>
                         <td>@{{logistic.name}}&nbsp;<span class="badge badge-success" v-if="logistic.is_bunched=='Y'">子母单</span></td>
+                        <td>@{{logistic.english_name}}</td>
                         <td>@{{logistic.code}}</td>
                         <td>@{{logistic.code}}</td>
                         <td>@{{logistic.mobile}}</td>
                         <td>@{{logistic.mobile}}</td>
                         <td>@{{logistic.type}}</td>
                         <td>@{{logistic.type}}</td>

+ 1 - 0
resources/views/maintenance/role/index.blade.php

@@ -85,6 +85,7 @@
                     column: column,
                     column: column,
                     data: this.roles,
                     data: this.roles,
                     fixedTop: ($('#form_div').height())+2,
                     fixedTop: ($('#form_div').height())+2,
+                    isCheckAllBox:false,
                 }).init();
                 }).init();
             },
             },
             methods:{
             methods:{

+ 2 - 1
resources/views/maintenance/user/index.blade.php

@@ -101,7 +101,8 @@
                     column: column,
                     column: column,
                     data: this.users,
                     data: this.users,
                     fixedTop: ($('#form_div').height())+2,
                     fixedTop: ($('#form_div').height())+2,
-                    is_restorationColumn_asc:true,
+                    isRestorationColumnAsc:true,
+                    isCheckAllBox:false,
                 }).init();
                 }).init();
             },
             },
             methods:{
             methods:{

+ 36 - 0
resources/views/maintenance/warehouse/create.blade.php

@@ -68,6 +68,42 @@
                             @enderror
                             @enderror
                         </div>
                         </div>
                     </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="principal" class="col-2 col-form-label text-right">联系人</label>
+                        <div class="col-8">
+                            <input id="principal" type="text" class="form-control @error('principal') is-invalid @enderror"
+                                   name="principal" autocomplete="off" value="{{ old('principal') }}">
+                            @error('principal')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="phone" class="col-2 col-form-label text-right">联系电话</label>
+                        <div class="col-8">
+                            <input id="phone" type="text" class="form-control @error('phone') is-invalid @enderror"
+                                   name="phone" autocomplete="off" value="{{ old('phone') }}">
+                            @error('phone')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="address" class="col-2 col-form-label text-right">地址</label>
+                        <div class="col-8">
+                            <input id="address" type="text" class="form-control @error('address') is-invalid @enderror"
+                                   name="address" autocomplete="off" value="{{ old('address') }}">
+                            @error('address')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
                     <div class="form-group row">
                     <div class="form-group row">
                         <div class="col-8 offset-2">
                         <div class="col-8 offset-2">
                             <input type="submit" class="btn btn-success form-control">
                             <input type="submit" class="btn btn-success form-control">

+ 37 - 1
resources/views/maintenance/warehouse/edit.blade.php

@@ -56,7 +56,7 @@
                             </span>
                             </span>
                             @enderror
                             @enderror
                         </div>
                         </div>
-                    </div>F
+                    </div>
                     <div class="form-group row">
                     <div class="form-group row">
                         <label for="reduced_production_capacity_coefficient" class="col-2 col-form-label text-right">SKU减产系数</label>
                         <label for="reduced_production_capacity_coefficient" class="col-2 col-form-label text-right">SKU减产系数</label>
                         <div class="col-8 input-group">
                         <div class="col-8 input-group">
@@ -74,6 +74,42 @@
                             <div class="text-muted">当SKU的数量多到可以影响产能时,每个SKU增加百分之几的产能需求(如填5,那每个原来1产能完成的,需要105%完成)</div>
                             <div class="text-muted">当SKU的数量多到可以影响产能时,每个SKU增加百分之几的产能需求(如填5,那每个原来1产能完成的,需要105%完成)</div>
                         </div>
                         </div>
                     </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="principal" class="col-2 col-form-label text-right">联系人</label>
+                        <div class="col-8">
+                            <input id="principal" type="text" class="form-control @error('principal') is-invalid @enderror"
+                                   name="principal" autocomplete="off" value="{{ old('principal') ?? $warehouse->principal }}">
+                            @error('principal')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="phone" class="col-2 col-form-label text-right">联系电话</label>
+                        <div class="col-8">
+                            <input id="phone" type="text" class="form-control @error('phone') is-invalid @enderror"
+                                   name="phone" autocomplete="off" value="{{ old('phone') ?? $warehouse->phone }}">
+                            @error('phone')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="address" class="col-2 col-form-label text-right">地址</label>
+                        <div class="col-8">
+                            <input id="address" type="text" class="form-control @error('address') is-invalid @enderror"
+                                   name="address" autocomplete="off" value="{{ old('address') ?? $warehouse->address }}">
+                            @error('address')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
                     <div class="form-group row">
                     <div class="form-group row">
                         <div class="col-8 offset-2">
                         <div class="col-8 offset-2">
                             <input type="submit" class="btn btn-outline-dark form-control">
                             <input type="submit" class="btn btn-outline-dark form-control">

+ 9 - 0
resources/views/maintenance/warehouse/index.blade.php

@@ -19,6 +19,9 @@
                         <th>仓库代码</th>
                         <th>仓库代码</th>
                         <th>产能</th>
                         <th>产能</th>
                         <th>SKU减产系数</th>
                         <th>SKU减产系数</th>
+                        <th>联系人</th>
+                        <th>联系电话</th>
+                        <th>地址</th>
                         <th>创建时间</th>
                         <th>创建时间</th>
                         <th>操作</th>
                         <th>操作</th>
                     </tr>
                     </tr>
@@ -28,6 +31,9 @@
                         <td>@{{warehouse.code}}</td>
                         <td>@{{warehouse.code}}</td>
                         <td>@{{warehouse.production_capacity}}</td>
                         <td>@{{warehouse.production_capacity}}</td>
                         <td>@{{warehouse.reduced_production_capacity_coefficient}}%</td>
                         <td>@{{warehouse.reduced_production_capacity_coefficient}}%</td>
+                        <td>@{{warehouse.principal}}</td>
+                        <td>@{{warehouse.phone}}</td>
+                        <td>@{{warehouse.address}}</td>
                         <td class="text-muted">@{{warehouse.created_at}}</td>
                         <td class="text-muted">@{{warehouse.created_at}}</td>
                         <td>
                         <td>
                             @can('仓库-编辑')
                             @can('仓库-编辑')
@@ -52,6 +58,9 @@
                     @foreach( $warehouses as $warehouse )
                     @foreach( $warehouses as $warehouse )
                     {id:'{{$warehouse->id}}',name:'{{$warehouse->name}}',
                     {id:'{{$warehouse->id}}',name:'{{$warehouse->name}}',
                         production_capacity:"{{$warehouse->production_capacity}}",
                         production_capacity:"{{$warehouse->production_capacity}}",
+                        principal:"{{$warehouse->principal}}",
+                        phone:"{{$warehouse->phone}}",
+                        address:"{{$warehouse->address}}",
                         reduced_production_capacity_coefficient:"{{$warehouse->reduced_production_capacity_coefficient}}",
                         reduced_production_capacity_coefficient:"{{$warehouse->reduced_production_capacity_coefficient}}",
                         code:'{{$warehouse->code}}',created_at:'{{$warehouse->created_at}}'},
                         code:'{{$warehouse->code}}',created_at:'{{$warehouse->created_at}}'},
                     @endforeach
                     @endforeach

+ 0 - 1
resources/views/order/index/delivering.blade.php

@@ -487,7 +487,6 @@
                             tempTip.show('标记勾选内容取消分配失败,错误:'+response.data.fail_info);
                             tempTip.show('标记勾选内容取消分配失败,错误:'+response.data.fail_info);
                         }
                         }
                     }).catch(function (e) {
                     }).catch(function (e) {
-                        alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.setDuration(2500);
                         tempTip.show('标记勾选内容取消分配失败,网络连接错误:'+e);
                         tempTip.show('标记勾选内容取消分配失败,网络连接错误:'+e);
                     })
                     })

+ 56 - 18
resources/views/package/logistic/index.blade.php

@@ -8,7 +8,7 @@
     <div id="list" class="d-none">
     <div id="list" class="d-none">
         <div class="container-fluid">
         <div class="container-fluid">
             <div id="form_div"></div>
             <div id="form_div"></div>
-            <div class="ml-3 form-inline" id="btn">
+            <div class="form-inline" id="btn">
                 @can('包裹管理-快递-异常类型-编辑')
                 @can('包裹管理-快递-异常类型-编辑')
                     <select class="form-control-sm" v-model="batchExceptionType">
                     <select class="form-control-sm" v-model="batchExceptionType">
                         <option v-for="(value,index) in exception_types" :value="value"
                         <option v-for="(value,index) in exception_types" :value="value"
@@ -18,6 +18,14 @@
                     <button @click="batchExceptionTypeUpdate()" type="button"
                     <button @click="batchExceptionTypeUpdate()" type="button"
                             class="btn btn-sm ml-2 btn-outline-primary">批量异常状态修改
                             class="btn btn-sm ml-2 btn-outline-primary">批量异常状态修改
                     </button>
                     </button>
+                    <select class="form-control-sm ml-2" v-model="batchStatus">
+                        <option v-for="(value,index) in statuses" :value="value"
+                                :name="value" :key="index">@{{ value }}
+                        </option>
+                    </select>
+                    <button @click="batchStatusUpdate()" type="button"
+                            class="btn btn-sm ml-2 btn-outline-danger">批量状态修改
+                    </button>
                 @endcan
                 @endcan
             </div>
             </div>
             <table class="table table-striped table-sm text-nowrap table-hover" id="table">
             <table class="table table-striped table-sm text-nowrap table-hover" id="table">
@@ -67,16 +75,18 @@
                         </div>
                         </div>
                     </td>
                     </td>
                     <td @mouseover="remarkHover = package.id" @mouseleave="remarkHover=null;remark=null;isShowRemarkInput = false">
                     <td @mouseover="remarkHover = package.id" @mouseleave="remarkHover=null;remark=null;isShowRemarkInput = false">
+                        @can('包裹管理-快递-客服备注')
                         <button @click="isShowRemarkInput = true" v-if="remarkHover===package.id">新增</button>
                         <button @click="isShowRemarkInput = true" v-if="remarkHover===package.id">新增</button>
                         <input @keydown.enter="submitRemark(package)" v-if="isShowRemarkInput && remarkHover===package.id" type="text" v-model="remark">
                         <input @keydown.enter="submitRemark(package)" v-if="isShowRemarkInput && remarkHover===package.id" type="text" v-model="remark">
-                        <div v-if="package.remark && package.remark.length>0"
-                             class="text-overflow-warp-200 up" :id="'remark-'+i">
-                            <p v-for="remark_item in package.remark">
-                                @{{ remark_item }}
-                            </p>
-                        </div>
-                        <div class="text-overflow-warp-200 " v-if=" package.remark && !showRemarkList[i] && package.remark.length > 0">
-                            @{{ package.remark[0] }}
+                        <div v-if="package.remark && package.remark.length>0" :id="'remark-'+i">
+                            <div v-if="showRemarkList[i]" class="text-overflow-warp-200 up" >
+                                <p v-for="remark_item in package.remark">
+                                    @{{ remark_item }}
+                                </p>
+                            </div>
+                            <div class="text-overflow-warp-200" v-else>
+                                @{{ package.remark[0] }}
+                            </div>
                         </div>
                         </div>
                         <div @click="showRemarkItem(i)" v-if="package.remark && package.remark.length > 1">
                         <div @click="showRemarkItem(i)" v-if="package.remark && package.remark.length > 1">
                             <label class="text-center mt-0 p-0 cursor-pointer pull-left">
                             <label class="text-center mt-0 p-0 cursor-pointer pull-left">
@@ -86,6 +96,7 @@
                                     v-else>展开</span>&nbsp;@{{ package.remark.length }} 条
                                     v-else>展开</span>&nbsp;@{{ package.remark.length }} 条
                             </label>
                             </label>
                         </div>
                         </div>
+                        @endcan
                     </td>
                     </td>
                     <td class="text-overflow-warp-200"><span v-if="package.order && package.order.issue">@{{ package.order.issue.result_explain }}</span>
                     <td class="text-overflow-warp-200"><span v-if="package.order && package.order.issue">@{{ package.order.issue.result_explain }}</span>
                     </td>
                     </td>
@@ -147,9 +158,14 @@
                     '其他',
                     '其他',
                     '无',
                     '无',
                 ],
                 ],
+                statuses: [
+                  '已揽收',
+                  '无',
+                ],
                 exception_editable: @can('包裹管理-快递-异常类型-编辑') true @else false  @endcan,
                 exception_editable: @can('包裹管理-快递-异常类型-编辑') true @else false  @endcan,
                 selectedExceptionType: '修改异常类型',
                 selectedExceptionType: '修改异常类型',
                 batchExceptionType: null,
                 batchExceptionType: null,
+                batchStatus: null,
                 remarkHover: null,
                 remarkHover: null,
                 remark: null,
                 remark: null,
                 isShowRemarkInput: false
                 isShowRemarkInput: false
@@ -199,9 +215,6 @@
 
 
 
 
                         {name: 'sent_at_start', type: 'dateTime', tip: '选择显示发出时间的起始时间'},
                         {name: 'sent_at_start', type: 'dateTime', tip: '选择显示发出时间的起始时间'},
-                        {name: 'received_at_start', type: 'dateTime', tip: '选择显示收货时间的起始时间'},
-
-
                         {
                         {
                             name: 'is_weighed',
                             name: 'is_weighed',
                             type: 'select',
                             type: 'select',
@@ -209,6 +222,14 @@
                             placeholder: '是否称重',
                             placeholder: '是否称重',
                             data: [{name: false, value: '无'}, {name: true, value: '已称重'}]
                             data: [{name: false, value: '无'}, {name: true, value: '已称重'}]
                         },
                         },
+                        {name: 'received_at_start', type: 'dateTime', tip: '选择显示收货时间的起始时间'},
+                        {
+                            name: 'has_transfer_status',
+                            type: 'select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的状态'],
+                            placeholder: '是否有物流信息',
+                            data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
+                        },
                         {name: 'default_date', type: 'checkbox', tip: '默认15天', data: [{name: 'ture', value: '默认15天'}]},
                         {name: 'default_date', type: 'checkbox', tip: '默认15天', data: [{name: 'ture', value: '默认15天'}]},
 
 
                     ], [
                     ], [
@@ -227,8 +248,6 @@
                             data: _this.owners
                             data: _this.owners
                         },
                         },
                         {name: 'sent_at_end', type: 'dateTime', tip: '选择显示发出时间的截止时间'},
                         {name: 'sent_at_end', type: 'dateTime', tip: '选择显示发出时间的截止时间'},
-                        {name: 'received_at_end', type: 'dateTime', tip: '选择显示收货时间的截止时间'},
-
                         {
                         {
                             name: 'is_exception',
                             name: 'is_exception',
                             type: 'select',
                             type: 'select',
@@ -236,6 +255,8 @@
                             placeholder: '是否有异常',
                             placeholder: '是否有异常',
                             data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
                             data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
                         },
                         },
+                        {name: 'received_at_end', type: 'dateTime', tip: '选择显示收货时间的截止时间'},
+
                         {
                         {
                             name: 'exception_type',
                             name: 'exception_type',
                             type: 'select',
                             type: 'select',
@@ -288,7 +309,6 @@
             },
             },
             methods: {
             methods: {
                 showRoute(id) {
                 showRoute(id) {
-                    // item.isShowTransferStatus = true;
                     if (this.showList[id]) {
                     if (this.showList[id]) {
                         this.$set(this.showList, id, false);
                         this.$set(this.showList, id, false);
                         $("#route-" + id).slideUp();
                         $("#route-" + id).slideUp();
@@ -299,7 +319,6 @@
                     this.$forceUpdate();
                     this.$forceUpdate();
                 },
                 },
                 showRemarkItem(id) {
                 showRemarkItem(id) {
-                    // item.isShowTransferStatus = true;
                     if (this.showRemarkList[id]) {
                     if (this.showRemarkList[id]) {
                         this.$set(this.showRemarkList, id, false);
                         this.$set(this.showRemarkList, id, false);
                         $("#remark-" + id).slideUp();
                         $("#remark-" + id).slideUp();
@@ -327,7 +346,21 @@
                         logistic_numbers: checkData
                         logistic_numbers: checkData
                     }).then(() => {
                     }).then(() => {
                         tempTip.setDuration(1000);
                         tempTip.setDuration(1000);
-                        tempTip.showSuccess('批量更新异常类型成功');
+                        tempTip.showSuccess('批量更新异常状态成功');
+                    })
+                },
+                batchStatusUpdate() {
+                    let _this = this;
+                    if (checkData.length === 0) {
+                        tempTip.show('没有勾选记录');
+                        return
+                    }
+                    axios.put('{{url('package/logistic/batchUpdate')}}', {
+                        status: this.batchStatus,
+                        logistic_numbers: checkData
+                    }).then(() => {
+                        tempTip.setDuration(1000);
+                        tempTip.showSuccess('批量状态成功');
                     })
                     })
                 },
                 },
                 submitRemark(orderPackage) {
                 submitRemark(orderPackage) {
@@ -349,7 +382,12 @@
                         tempTip.setDuration(3000);
                         tempTip.setDuration(3000);
                         tempTip.show("网络错误:"+err)
                         tempTip.show("网络错误:"+err)
                     });
                     });
-                }
+                },
+                {{--orderPackageExport(checkAllSign){--}}
+                {{--    let url = '{{url('package/logistic/export')}}';--}}
+                {{--    let token='{{ csrf_token() }}';--}}
+                {{--    excelExport(checkAllSign,checkData,url,this.packages.length,token,{is_merge : this.is_merge});--}}
+                {{--},--}}
             },
             },
             filters: {
             filters: {
                 toObjected: function (value) {
                 toObjected: function (value) {

+ 17 - 22
resources/views/package/measureMonitor/index.blade.php

@@ -18,7 +18,6 @@
                                         <ul class="nav nav-pills">
                                         <ul class="nav nav-pills">
                                             <b style="padding: 10px">请选择设备:</b>
                                             <b style="padding: 10px">请选择设备:</b>
                                             <li v-for="measuringMachine in measuringMachines" @click="clickMeasuringMachine(measuringMachine.id)" :class="[measuringMachine.name==package.measuringMachine ?  selectedMachine : otherMachine] " style="padding: 10px">
                                             <li v-for="measuringMachine in measuringMachines" @click="clickMeasuringMachine(measuringMachine.id)" :class="[measuringMachine.name==package.measuringMachine ?  selectedMachine : otherMachine] " style="padding: 10px">
-                                                {{--<span v-if="package.measuringMachine==measuringMachine.name" :class="[package.measuringMachine_status=='离线' ?  off : on] " style="font-size:12px;"></span>--}}
                                                 <span :class="[measuringMachine.status=='离线' ?  off : on] " style="font-size:12px;"></span>
                                                 <span :class="[measuringMachine.status=='离线' ?  off : on] " style="font-size:12px;"></span>
                                                 <a style="text-decoration:none;cursor:pointer" class="text-dark"  >@{{measuringMachine.name}}</a>
                                                 <a style="text-decoration:none;cursor:pointer" class="text-dark"  >@{{measuringMachine.name}}</a>
                                             </li>
                                             </li>
@@ -32,31 +31,31 @@
                                             <tr>
                                             <tr>
                                                 <th class="tag" scope="row">货主</th>
                                                 <th class="tag" scope="row">货主</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.owner}}</td>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.owner}}</td>
-                                                <th class="tag" scope="row" scope="row">重量(KG)</th>
+                                                <th class="tag" scope="row">重量(KG)</th>
                                                 <td>@{{package.weight}}</td>
                                                 <td>@{{package.weight}}</td>
                                             </tr>
                                             </tr>
                                             <tr>
                                             <tr>
-                                                <th class="tag" scope="row" scope="row">订单编号</th>
+                                                <th class="tag" scope="row">订单编号</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.orderno}}</td>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.orderno}}</td>
-                                                <th class="tag" scope="row" scope="row">收件人</th>
+                                                <th class="tag" scope="row">收件人</th>
                                                 <td>@{{package.recipient}}</td>
                                                 <td>@{{package.recipient}}</td>
                                             </tr>
                                             </tr>
                                             <tr>
                                             <tr>
-                                                <th class="tag" scope="row" scope="row">承运商</th>
+                                                <th class="tag" scope="row">承运商</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.logistic_name}}</td>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.logistic_name}}</td>
-                                                <th class="tag" scope="row" scope="row">快递单号</th>
+                                                <th class="tag" scope="row">快递单号</th>
                                                 <td>@{{package.logistic_number}}</td>
                                                 <td>@{{package.logistic_number}}</td>
                                             </tr>
                                             </tr>
                                             <tr>
                                             <tr>
-                                                <th class="tag" scope="row" scope="row">纸箱名称</th>
+                                                <th class="tag" scope="row">纸箱名称</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.paperBox}}</td>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.paperBox}}</td>
-                                                <th class="tag" scope="row" scope="row">体积(CM³)</th>
+                                                <th class="tag" scope="row">体积(CM³)</th>
                                                 <td>@{{package.bulk}}</td>
                                                 <td>@{{package.bulk}}</td>
                                             </tr>
                                             </tr>
                                             <tr>
                                             <tr>
-                                                <th  class="tag" scope="row" scope="row">状态</th>
+                                                <th  class="tag" scope="row">状态</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.status}}</td>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.status}}</td>
-                                                <th  class="tag" scope="row" scope="row">操作时间</th>
+                                                <th  class="tag" scope="row">操作时间</th>
                                                 <td>@{{package.weighed_at}}</td>
                                                 <td>@{{package.weighed_at}}</td>
                                             </tr>
                                             </tr>
                                         </table>
                                         </table>
@@ -136,31 +135,27 @@
                             audio.src=_this.logisticAudioURL[logistic_name];
                             audio.src=_this.logisticAudioURL[logistic_name];
                             audio.play();
                             audio.play();
                         }else {
                         }else {
-                            axios.post('/package/measureMonitor/speech',{logistic:logistic_name})
+                            window.tempTip.setDuration(3000);
+                            window.axios.post('/package/measureMonitor/speech',{logistic:logistic_name})
                                 .then(function (response) {
                                 .then(function (response) {
                                     if (response.data){
                                     if (response.data){
                                         _this.logisticAudioURL[logistic_name]=response.data;
                                         _this.logisticAudioURL[logistic_name]=response.data;
                                         audio.src=response.data;
                                         audio.src=response.data;
                                         audio.play();
                                         audio.play();
-                                    }else {
-                                        tempTip.setDuration(4000);
-                                        tempTip.show('没有对应快递名称!');
-                                    }
-                                })
-                                .catch(function (err) {
-                                    tempTip.setDuration(4000);
-                                    tempTip.show('语音合成发生错误:'+err);
+                                    }else window.tempTip.show('没有对应快递名称!');
+                                }).catch(function (err) {
+                                    window.tempTip.show('语音合成发生错误:'+err);
                                 });
                                 });
                         }
                         }
-                        tempTip.setDuration(1000);
-                        tempTip.showSuccess('刷新成功!');
+                        window.tempTip.setDuration(1000);
+                        window.tempTip.showSuccess('刷新成功!');
                     }
                     }
                 });
                 });
             },
             },
             methods:{
             methods:{
                 clickMeasuringMachine(e){
                 clickMeasuringMachine(e){
                     let _this=this;
                     let _this=this;
-                    axios.post('{{url('package/measureMonitor/data')}}',{id:e})
+                    window.axios.post('{{url('package/weigh/measureMonitor/data')}}',{id:e})
                         .then(function (response) {
                         .then(function (response) {
                             if (response.data.id){
                             if (response.data.id){
                                 let orderPackage=response.data;
                                 let orderPackage=response.data;

+ 1 - 1
resources/views/personnel/checking-in/createReplenishClock.blade.php

@@ -6,7 +6,7 @@
         @component('personnel.checking-in.menuChecking-in')@endcomponent
         @component('personnel.checking-in.menuChecking-in')@endcomponent
     </div>
     </div>
     <div class="container-fluid" id="list">
     <div class="container-fluid" id="list">
-        <div class="card col-md-10 offset-1">
+        <div class="card">
             <div class="card-body">
             <div class="card-body">
                 <div class="form-group row">
                 <div class="form-group row">
                     <input v-model="full_name" class="col-6 offset-2 form-control" type="text" placeholder="按名称搜索临时工">
                     <input v-model="full_name" class="col-6 offset-2 form-control" type="text" placeholder="按名称搜索临时工">

+ 1 - 1
resources/views/personnel/discharge/facilitator/index.blade.php

@@ -110,7 +110,7 @@
                     window.axios.post(url,data).then(res=>{
                     window.axios.post(url,data).then(res=>{
                         if(res.data.success){
                         if(res.data.success){
                             this.$set(this.facilitatorStatements[index],'subjection',res.data.data);
                             this.$set(this.facilitatorStatements[index],'subjection',res.data.data);
-                            facilitatorStatement['showSubject'] = true;selectAll
+                            facilitatorStatement['showSubject'] = true;/*selectAll*/
                             $("#Statement"+index).slideToggle();
                             $("#Statement"+index).slideToggle();
                             $($e.target).html('点击收起');
                             $($e.target).html('点击收起');
                             this.$forceUpdate();
                             this.$forceUpdate();

+ 1 - 1
resources/views/process/index.blade.php

@@ -587,7 +587,7 @@
                     data: this.processes,
                     data: this.processes,
                     restorationColumn: 'serial_number',
                     restorationColumn: 'serial_number',
                     fixedTop:($('#form_div').height())+2,
                     fixedTop:($('#form_div').height())+2,
-                    is_restorationColumn_asc :true,
+                    isRestorationColumnAsc :true,
                     isForbidDrag:true,
                     isForbidDrag:true,
                 }).init();
                 }).init();
             },
             },

+ 5 - 4
resources/views/procurement/finance/checkBill.blade.php

@@ -106,16 +106,16 @@
                 $('#list').removeClass('d-none');
                 $('#list').removeClass('d-none');
                 let data = [
                 let data = [
                     [
                     [
-                        {name: 'signed_at', type: 'dateTime', tip: '选择显示指定的签收日期'},
+                        {name: 'signed_at', type: 'dateMonth', tip: '选择显示指定的签收日期'},
                         {
                         {
                             name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
                             name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
                             placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
                             placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
                         },
                         },
                         {
                         {
                             name: 'status', type: 'select',
                             name: 'status', type: 'select',
-                            tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
+                            tip: '输入关键词快速定位下拉列表,回车确定',
                             placeholder: '对账单状态',
                             placeholder: '对账单状态',
-                            data: [{name:0,value:'未出账'},{name:1,value:'已出账'},{name:2,value:'已完结'},],
+                            data: [{name:0,value:'未出账'},{name:1,value:'待出账'},{name:2,value:'已出账'},{name:3,value:'已完结'},],
                         },
                         },
                     ],
                     ],
                 ];
                 ];
@@ -172,7 +172,8 @@
                         }else {
                         }else {
                             _this.procurementCheckSheets.forEach(function (procurementCheckSheet) {
                             _this.procurementCheckSheets.forEach(function (procurementCheckSheet) {
                                 if (procurementCheckSheet.id===_this.procurementCheckSheetId){
                                 if (procurementCheckSheet.id===_this.procurementCheckSheetId){
-                                    procurementCheckSheet.invoice_number=_this.invoice_number;
+                                    procurementCheckSheet.invoice_number=res.data.data;
+                                    procurementCheckSheet.status=res.data.status;
                                 }
                                 }
                             });
                             });
                             $("#fill-invoice-number").modal('hide');
                             $("#fill-invoice-number").modal('hide');

+ 4 - 4
resources/views/procurement/finance/menu.blade.php

@@ -4,17 +4,17 @@
     <div class="container-fluid nav3">
     <div class="container-fluid nav3">
         <div class="card menu-third" >
         <div class="card menu-third" >
             <ul class="nav nav-pills">
             <ul class="nav nav-pills">
-                @can('采购管理-财务-对账单')
+                @can('采购管理-财务-月账单报表')
                     <li class="nav-item">
                     <li class="nav-item">
-                        <a class="nav-link" href="{{url('procurement/finance/checkBill')}}" :class="{active:isActive('checkBill',3)}">对账单</a>
+                        <a  class="nav-link" href="{{url('procurement/finance/monthlyBillReport')}}" :class="{active:isActive('monthlyBillReport',3)}">月账单报表</a>
                     </li> @endcan
                     </li> @endcan
                 @can('采购管理-财务-采购账单')
                 @can('采购管理-财务-采购账单')
                     <li class="nav-item">
                     <li class="nav-item">
                         <a  class="nav-link" href="{{url('procurement/finance/procurementBill')}}" :class="{active:isActive('procurementBill',3)}">采购账单</a>
                         <a  class="nav-link" href="{{url('procurement/finance/procurementBill')}}" :class="{active:isActive('procurementBill',3)}">采购账单</a>
                     </li> @endcan
                     </li> @endcan
-                    @can('采购管理-财务-月账单报表')
+                @can('采购管理-财务-对账单')
                     <li class="nav-item">
                     <li class="nav-item">
-                        <a  class="nav-link" href="{{url('procurement/finance/monthlyBillReport')}}" :class="{active:isActive('monthlyBillReport',3)}">月账单报表</a>
+                        <a class="nav-link" href="{{url('procurement/finance/checkBill')}}" :class="{active:isActive('checkBill',3)}">对账单</a>
                     </li> @endcan
                     </li> @endcan
             </ul>
             </ul>
         </div>
         </div>

+ 141 - 8
resources/views/procurement/finance/monthlyBillReport.blade.php

@@ -18,18 +18,84 @@
         </span>
         </span>
         </div>
         </div>
         <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2 td-min-width-80" id="table">
         <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2 td-min-width-80" id="table">
-            <tr v-for="(procurementTotalBill,i) in procurementTotalBills">
-                <td>
+            <template  v-for="(procurementTotalBill,i) in procurementTotalBills">
+            <tr>
+                <td >
                     <input class="checkItem" type="checkbox" :value="procurementTotalBill.id">
                     <input class="checkItem" type="checkbox" :value="procurementTotalBill.id">
                 </td>
                 </td>
-                <td><span>@{{ procurementTotalBill.id }}</span></td>
-                <td class="text-muted"><span>@{{ procurementTotalBill.counting_month }}</span></td>
-                <td class="text-muted"><span>@{{ procurementTotalBill.created_at.substr(0,10) }}</span></td>
-                <td class="text-muted"><span>@{{ procurementTotalBill.supplier_name }}</span></td>
-                <td><span>@{{ procurementTotalBill.total_payable }}</span></td>
-                <td><span>@{{ procurement_total_bill_status[procurementTotalBill.status] }}</span></td>
+                <td class="text-center"><span>@{{ procurementTotalBill.id }}</span></td>
+                <td class="text-muted text-center"><span>@{{ procurementTotalBill.counting_month }}</span></td>
+                <td class="text-muted text-center"><span>@{{ procurementTotalBill.created_at.substr(0,10) }}</span></td>
+                <td class="text-muted text-center"><span>@{{ procurementTotalBill.supplier_name }}</span></td>
+                <td class="text-center"><span>@{{ procurementTotalBill.total_payable }}</span></td>
+                <td class="text-center"><span>@{{ procurement_total_bill_status[procurementTotalBill.status] }}</span></td>
+                <td class="text-center">
+                    <button class="btn btn-sm btn-outline-info" @click="getCheckBill(procurementTotalBill,i,$event)">点击展开</button>
+                </td>
+            </tr>
+            <tr v-if="procurementTotalBill.showSubject" class="p-0 up" >
+                <td></td>
+                <td colspan="7" class="p-0 m-0">
+                    <div class="p-0 " :id="'Statement' + i">
+                        <table class="table table-bordered m-0">
+                            <thead class="thead-light">
+                            <tr>
+                                <th>采购编号</th>
+                                <th>采购日期</th>
+                                <th>送货日期</th>
+                                <th>供应商</th>
+                                <th>耗材编号</th>
+                                <th>耗材</th>
+                                <th>采购数量</th>
+                                <th>送货数量</th>
+                                <th>签收人</th>
+                                <th>签收日期</th>
+                                <th>应付金额</th>
+                                <th>发票号</th>
+                                <th>状态</th>
+                                <th>填写发票号</th>
+                            </tr>
+                            </thead>
+                            <tbody>
+                            <tr v-for="(procurementCheckSheet,i) in procurementTotalBill.procurementCheckSheets">
+                                <td>
+                                    <span v-if="procurementCheckSheet.procurement_delivery.procurement">@{{ procurementCheckSheet.procurement_delivery.procurement.code }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery.procurement">@{{ procurementCheckSheet.procurement_delivery.procurement.created_at }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery">@{{ procurementCheckSheet.procurement_delivery.created_at }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery.procurement.supplier">@{{ procurementCheckSheet.procurement_delivery.procurement.supplier.name }}</span></td>
+                                <td class="tooltipTarget" style="max-width: 200px;overflow:hidden">
+                                    <span  v-if="procurementCheckSheet.procurement_delivery.procurement.owner_material">@{{ procurementCheckSheet.procurement_delivery.procurement.owner_material.material_code }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery.procurement.owner_material">@{{ procurementCheckSheet.procurement_delivery.procurement.owner_material.material.name }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery.procurement">@{{ procurementCheckSheet.procurement_delivery.procurement.quantity }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery">@{{ procurementCheckSheet.procurement_delivery.amount }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery.receiver">@{{ procurementCheckSheet.procurement_delivery.receiver.name }}</span></td>
+                                <td class="text-muted">
+                                    <span v-if="procurementCheckSheet.procurement_delivery">@{{ procurementCheckSheet.procurement_delivery.signed_at }}</span></td>
+                                <td class="text-muted"><span >@{{ procurementCheckSheet.account_payable }}</span></td>
+                                <td><span>@{{ procurementCheckSheet.invoice_number }}</span></td>
+                                <td><span>@{{ procurement_check_sheet_status[procurementCheckSheet.status] }}</span></td>
+                                <td class="text-center">
+                                    <a class="text-primary" @click="fillInvoiceNumber(procurementCheckSheet.id)" v-if="!procurementCheckSheet.invoice_number">填写发票号</a>
+                                    <span v-else>-</span>
+                                </td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </td>
             </tr>
             </tr>
+            </template>
         </table>
         </table>
+        @can('采购管理-财务-对账单')
+            @include('procurement.finance._fillInvoiceNumber')
+        @endcan
         <div class="text-info h5 btn btn">{{$procurementTotalBills->count()}}/@{{ sum }}</div>
         <div class="text-info h5 btn btn">{{$procurementTotalBills->count()}}/@{{ sum }}</div>
         <div>{{$procurementTotalBills->appends($paginateParams)->links()}}</div>
         <div>{{$procurementTotalBills->appends($paginateParams)->links()}}</div>
     </div>
     </div>
@@ -46,6 +112,7 @@
                     @foreach($procurementTotalBills as $procurementTotalBill)
                     @foreach($procurementTotalBills as $procurementTotalBill)
                     {
                     {
                         id:'{{$procurementTotalBill->id ?? ''}}',counting_month:'{{$procurementTotalBill->counting_month ?? ''}}',
                         id:'{{$procurementTotalBill->id ?? ''}}',counting_month:'{{$procurementTotalBill->counting_month ?? ''}}',
+                        showSubject:false,procurementCheckSheets:[],
                         created_at:'{{$procurementTotalBill->created_at ?? ''}}',status:'{{$procurementTotalBill->status ?? ''}}',total_payable:'{{$procurementTotalBill->total_payable ?? ''}}',
                         created_at:'{{$procurementTotalBill->created_at ?? ''}}',status:'{{$procurementTotalBill->status ?? ''}}',total_payable:'{{$procurementTotalBill->total_payable ?? ''}}',
                             @if($procurementTotalBill->supplier)
                             @if($procurementTotalBill->supplier)
                             supplier_id:'{{$procurementTotalBill->supplier->id ?? ''}}',supplier_name:'{{$procurementTotalBill->supplier->name ?? ''}}',@endif
                             supplier_id:'{{$procurementTotalBill->supplier->id ?? ''}}',supplier_name:'{{$procurementTotalBill->supplier->name ?? ''}}',@endif
@@ -59,9 +126,12 @@
                 ],
                 ],
                 sum:{!! $procurementTotalBills->total() !!},
                 sum:{!! $procurementTotalBills->total() !!},
                 procurement_total_bill_status:{!! json_encode(\App\ProcurementTotalBill::status,JSON_UNESCAPED_UNICODE) !!},
                 procurement_total_bill_status:{!! json_encode(\App\ProcurementTotalBill::status,JSON_UNESCAPED_UNICODE) !!},
+                procurement_check_sheet_status:{!! json_encode(\App\ProcurementCheckSheet::status,JSON_UNESCAPED_UNICODE) !!},
+                invoice_number:'',procurementCheckSheetId:null,index:'',
 
 
             },
             },
             mounted: function () {
             mounted: function () {
+                $(".up").slideUp();
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
                 $('#list').removeClass('d-none');
                 $('#list').removeClass('d-none');
                 let data = [
                 let data = [
@@ -85,6 +155,7 @@
                     {name: 'supplier', value: '供应商',class: 'text-center'},
                     {name: 'supplier', value: '供应商',class: 'text-center'},
                     {name: 'total_payable', value: '总金额',class: 'text-center'},
                     {name: 'total_payable', value: '总金额',class: 'text-center'},
                     {name: 'status', value: '状态',class: 'text-center'},
                     {name: 'status', value: '状态',class: 'text-center'},
+                    {name: 'detail', value: '月账单详情',class: 'text-center'},
                 ];
                 ];
                 new Header({
                 new Header({
                     el: "table",
                     el: "table",
@@ -100,6 +171,68 @@
                     let token='{{ csrf_token() }}';
                     let token='{{ csrf_token() }}';
                     excelExport(selectAll,checkData,url,this.sum,token);
                     excelExport(selectAll,checkData,url,this.sum,token);
                 },
                 },
+                getCheckBill(procurementTotalBill,index,$e){
+                    this.index=index;
+                    if(procurementTotalBill.showSubject){
+                        procurementTotalBill.showSubject=false;
+                        $($e.target).html('点击展开');
+                        return;
+                    }
+                    $($e.target).html('加载中...');
+                    let url = '{{url('procurement/finance/getCheckBillMonth')}}'
+                    let data = {
+                        'procurement_total_bill_id':procurementTotalBill['id'],
+                    };
+                    window.axios.post(url,data).then(res=>{
+                        if(res.data.success){
+                            // this.$set(this.procurementTotalBills[index],'subjection',res.data.data);
+                            this.procurementTotalBills[index].procurementCheckSheets=res.data.data;
+                            procurementTotalBill['showSubject'] = true;
+                            $("#Statement"+index).slideToggle();
+                            $($e.target).html('点击收起');
+                            this.$forceUpdate();
+                        }
+                    }).catch(err=>{
+                        $($e.target).html('点击展开');
+                        window.tempTip.show(err);
+                    });
+                },
+                fillInvoiceNumber(id){
+                    let _this=this;
+                    _this.procurementCheckSheetId=id;
+                    $('#fill-invoice-number').modal('show');
+                },
+                fillInvoice(){
+                    let _this=this;
+                    if (!_this.procurementCheckSheetId)return;
+                    if (!_this.invoice_number){
+                        tempTip.setDuration(3000);
+                        tempTip.show('发票号不可为空!');
+                        return;
+                    }
+                    let url = '{{url('procurement/finance/fillInvoice')}}';
+                    let params = {invoice_number:_this.invoice_number,procurementCheckSheetId:_this.procurementCheckSheetId};
+                    window.axios.post(url,params).then(function (res) {
+                        if (!res.data.success){
+                            tempTip.setDuration(3000);
+                            tempTip.show(res.data.message);
+                        }else {
+                            _this.procurementTotalBills[_this.index].procurementCheckSheets.forEach(function (procurementCheckSheet) {
+                                if (procurementCheckSheet.id===_this.procurementCheckSheetId){
+                                    procurementCheckSheet.invoice_number=res.data.data;
+                                    procurementCheckSheet.status=res.data.status;
+                                }
+                            });
+                            if (res.data.totalStatus) _this.procurementTotalBills[_this.index].status=res.data.totalStatus;
+                            $("#fill-invoice-number").modal('hide');
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('添加发票号成功!');
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show('添加发票号失败!网络错误:'+err);
+                    });
+                },
             }
             }
         });
         });
     </script>
     </script>

+ 1 - 1
resources/views/procurement/finance/procurementBill.blade.php

@@ -131,8 +131,8 @@
                     {name: 'deliver_amount', value: '收货数量', neglect: true,class: 'text-center'},
                     {name: 'deliver_amount', value: '收货数量', neglect: true,class: 'text-center'},
                     {name: '采购单价', value: '采购单价(元)', neglect: true,class: 'text-center'},
                     {name: '采购单价', value: '采购单价(元)', neglect: true,class: 'text-center'},
                     {name: 'unit_price', value: '销售单价(元)', neglect: true,class: 'text-center'},
                     {name: 'unit_price', value: '销售单价(元)', neglect: true,class: 'text-center'},
-                    {name: '应收金额', value: '应收金额(元)', neglect: true,class: 'text-center'},
                     {name: '应付金额', value: '应付金额(元)', neglect: true,class: 'text-center'},
                     {name: '应付金额', value: '应付金额(元)', neglect: true,class: 'text-center'},
+                    {name: '应收金额', value: '应收金额(元)', neglect: true,class: 'text-center'},
                     {name: '状态', value: '状态', neglect: true,class: 'text-center'},
                     {name: '状态', value: '状态', neglect: true,class: 'text-center'},
                     {name: '操作', value: '操作', neglect: true,class: 'text-center'},
                     {name: '操作', value: '操作', neglect: true,class: 'text-center'},
                 ];
                 ];

+ 0 - 2
resources/views/rejected/recycle.blade.php

@@ -428,7 +428,6 @@
                             tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
                             tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
                         }
                         }
                     }).catch(function (e) {
                     }).catch(function (e) {
-                        alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.setDuration(2500);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
                     });
                     });
@@ -472,7 +471,6 @@
                             tempTip.show('恢复勾选内容失败,错误:'+response.data.fail_info);
                             tempTip.show('恢复勾选内容失败,错误:'+response.data.fail_info);
                         }
                         }
                     }).catch(function (e) {
                     }).catch(function (e) {
-                        alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.setDuration(2500);
                         tempTip.show('恢复勾选内容失败,网络连接错误:'+e);
                         tempTip.show('恢复勾选内容失败,网络连接错误:'+e);
                     })
                     })

+ 0 - 2
resources/views/rejected/search/general.blade.php

@@ -417,7 +417,6 @@
                             tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
                             tempTip.show('修改勾选记录的入库状态失败,错误:'+response.data.fail_info);
                         }
                         }
                     }).catch(function (e) {
                     }).catch(function (e) {
-                        alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.setDuration(2500);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
 
 
@@ -448,7 +447,6 @@
                             tempTip.show('审核勾选内容失败,错误:'+response.data.fail_info);
                             tempTip.show('审核勾选内容失败,错误:'+response.data.fail_info);
                         }
                         }
                     }).catch(function (e) {
                     }).catch(function (e) {
-                        alert('网络连接错误:'+e);
                         tempTip.setDuration(2500);
                         tempTip.setDuration(2500);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
                         tempTip.show('审核勾选内容失败,网络连接错误:'+e);
                     })
                     })

+ 95 - 0
resources/views/store/deliveryAppointment/_printBody.blade.php

@@ -0,0 +1,95 @@
+<div class="container" id="printContent" v-show="infoShow">
+    <div class="row">
+        <div class="col-5">
+            <a href="{{ url('/control/panel/menu') }}" style="vertical-align: text-bottom">
+                <img src="{{asset('icon/logo100b.png')}}" height="30">
+            </a>
+        </div>
+        <div class="col-6 font-weight-bold h3">
+            宝时云仓入库预约单
+        </div>
+    </div>
+    <table class="table table-bordered border border-2 border-dark h5 text-nowrap">
+        <tr>
+            <td colspan="6" class="text-white bg-secondary font-weight-bold">预约信息</td>
+        </tr>
+        <tr>
+            <th>预约单号</th>
+            <td>@{{ printInfo.id }}</td>
+            <th>收货日期</th>
+            <td>@{{ printInfo.appointment_date }}</td>
+            <th>货主</th>
+            <td>@{{ poolMapping.owners ? poolMapping.owners[printInfo.owner_id] : '' }}</td>
+        </tr>
+        <tr>
+            <th>车辆信息</th>
+            <td>@{{ printInfo.cars ? (printInfo.cars[0] ?  printInfo.cars[0].appointment_number : '') : '' }}</td>
+            <th>司机姓名</th>
+            <td>@{{ printInfo.cars ? (printInfo.cars[0] ?  printInfo.cars[0].driver_name : '') : '' }}</td>
+            <th>联系电话</th>
+            <td>@{{ printInfo.cars ? (printInfo.cars[0] ?  printInfo.cars[0].driver_phone : '') : '' }}</td>
+        </tr>
+        <tr>
+            <th>入库单号</th>
+            <td>@{{ printInfo.asn_number }}</td>
+            <th>备注</th>
+            <td colspan="3" class="text-overflow-warp-200">@{{ printInfo.remark }}</td>
+        </tr>
+        <tr>
+            <th>总体积</th>
+            <td>@{{ printInfo.cubic_meter ? printInfo.cubic_meter+'M³' : '' }}</td>
+            <th>总重量</th>
+            <td>@{{ printInfo.tonne ? printInfo.tonne+'T' : '' }}</td>
+            <th>总件数</th>
+            <td>@{{ printInfo.box_amount }}</td>
+        </tr>
+    </table>
+
+    <table class="table table-bordered border border-2 border-dark h5 text-nowrap mt-5">
+        <tr>
+            <td colspan="6" class="text-white bg-secondary font-weight-bold">仓库信息</td>
+        </tr>
+        <tr>
+            <th>仓库</th>
+            <td>@{{ printInfo.warehouse ? printInfo.warehouse.name : '' }}</td>
+            <th>仓库地址</th>
+            <td colspan="3" class="text-overflow-warp-200">@{{ printInfo.warehouse ? printInfo.warehouse.address : '' }}</td>
+        </tr>
+        <tr>
+            <th>仓库联系人</th>
+            <td>@{{ printInfo.warehouse ? printInfo.warehouse.principal : '' }}</td>
+            <th>联系电话</th>
+            <td>@{{ printInfo.warehouse ? printInfo.warehouse.phone : '' }}</td>
+            <th>签收人</th>
+            <td>@{{ printInfo.signer }}</td>
+        </tr>
+        <tr>
+            <th>预约时间</th>
+            <td>@{{ printInfo.appointment_date+' '+printInfo.period }}</td>
+            <th>到场时间</th>
+            <td>@{{ printInfo.cars ? (printInfo.cars[0] ?  printInfo.cars[0].delivery_time : '') : '' }}</td>
+            <th>打印时间</th>
+            <td>@{{ printInfo.print_date }}</td>
+        </tr>
+    </table>
+
+    <table class="table table-bordered border border-2 border-dark h5 text-nowrap mt-5">
+        <tr>
+            <td colspan="6" class="text-white bg-secondary font-weight-bold">商品明细</td>
+        </tr>
+        <tr>
+            <th>编号</th>
+            <th>商品名称</th>
+            <th>商品编码</th>
+            <th>条码</th>
+            <th>数量</th>
+        </tr>
+        <tr v-for="(detail,i) in printInfo.details">
+            <td>@{{ i+1 }}</td>
+            <td>@{{ detail.commodity_id ? (detail.commodity ? detail.commodity.name : '') : detail.name }}</td>
+            <td>@{{ detail.commodity_id ? (detail.commodity ? detail.commodity.sku : '') : '' }}</td>
+            <td>@{{ detail | getCommodity }}</td>
+            <td>@{{ detail.amount }}</td>
+        </tr>
+    </table>
+</div>

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff