Forráskód Böngészése

Merge branch 'master' into Haozi

haozi 5 éve
szülő
commit
c900c301d4

+ 2 - 0
app/Console/Commands/SyncOrderPackageLogisticRouteTask.php

@@ -2,6 +2,7 @@
 
 namespace App\Console\Commands;
 
+use App\Services\LogService;
 use App\Services\OrderPackageReceivedSyncService;
 use Illuminate\Console\Command;
 
@@ -38,6 +39,7 @@ class SyncOrderPackageLogisticRouteTask extends Command
      */
     public function handle()
     {
+        LogService::log(__CLASS__,"同步快递信息",'');
         ini_set('memory_limit','2226M');
         (new OrderPackageReceivedSyncService)->syncLogisticRoute();
     }

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

@@ -19,18 +19,17 @@ class PackageLogisticController extends Controller
         $this->middleware('auth');
     }
 
-    public function index(Request $request,OrderPackageFilters $filters)
+    public function index(Request $request, OrderPackageFilters $filters)
     {
         /** @var UserService $userService */
         $userService = app('UserService');
         $owner_ids = $userService->getPermittingOwnerIds(auth()->user());
         $paginateParams = $request->input();
-        $orderPackages = OrderPackage::query()->filter($filters)
-            ->whereIn('owner_id',$owner_ids)->with(['order' => function ($query) {
-            $query->with(['logistic', 'owner', 'packages.commodities']);
-        }])->orderByDesc('id')->paginate($request->paginate ?? 50);
+        $orderPackages = OrderPackage::query()
+            ->filter($filters)
+            ->whereIn('owner_id', $owner_ids)->with(['order.logistic', 'order.owner'])->orderByDesc('id')->paginate($request->paginate ?? 50);
         $logistics = Logistic::all();
         $owners = Owner::find($owner_ids);
-        return view('package.logistic.index', compact('orderPackages', 'logistics', 'owners','paginateParams'));
+        return view('package.logistic.index', compact('orderPackages', 'logistics', 'owners', 'paginateParams'));
     }
 }

+ 21 - 8
app/Http/Controllers/TestController.php

@@ -105,6 +105,7 @@ use App\Services\RejectedBillService;
 use App\Services\ShopService;
 use App\Services\StoreService;
 use App\Services\WarehouseService;
+use App\Station;
 use App\StationRuleBatch;
 use App\StationTask;
 use App\StationTaskMaterialBox;
@@ -169,20 +170,18 @@ class TestController extends Controller
 
     public function tt1()
     {
-        $response = Http::post('https://was.baoshi56.com/api/thirdPart/haiq/pickStation/processed');
-        dd($a= $response->json());
-        dd(config('api.haiq.storage.moveBin'));
+//        $response = Http::post('https://was.baoshi56.com/api/thirdPart/haiq/pickStation/processed');
         $a=Http::post(config('api.haiq.storage.moveBin'), [
   "taskMode"=> 2,
   "bins"=> [
     [
-        "taskCode"=> 65,
+        "taskCode"=> 6,
       "binCode"=> "H01-001-3",
       "fromLocCode"=> "",
       "toLocCode"=> ""
     ]
   ],
-  "groupCode"=> "1761616223042.4121",
+  "groupCode"=> 'g'.microtime(true),
   "priority"=> 10,
   "sequenceFlag"=> 1
 ]);
@@ -406,9 +405,23 @@ sql;
 
     function t1(Request $request)
     {
-
-        $re = OracleDOCWaveDetails::query()->where('orderno', 'SO201230003574')->get('seqno')->first()['seqno'];
-        dd($re);
+        $a=[
+            new Batch([
+                "id"=> 89906,
+                "code"=> "W210322000262",
+                "status"=> "\u5904\u7406\u4e2d",
+                "type"=> null,
+                "wms_type"=> "09.[BAOSHI]\u622a\u5355\u6ce2\u6b21\u3010\u65e0\u5907\u6ce8\u3011",
+                "wms_status"=> "\u90e8\u5206\u6536\u8d27",
+                "wms_created_at"=> "0000-00-00 00:00:00",
+                "created_at"=> "2021-03-22T10:35:44.000000Z",
+                "updated_at"=> "2021-03-22T10:35:46.000000Z",
+                "remark"=> null,
+                "owner_id"=> "42"
+            ])
+        ];
+        app('BatchService')->assignTasks($a);
+        dd($a);
     }
 
     function packageT(Request $request)

+ 1 - 1
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -113,7 +113,7 @@ class StorageController
             "bins"=>[
                 [
                 "taskCode"  =>'t'.Uuid::uuid4(),
-                "binCode"   => "IDE0005711",
+                "binCode"   => "IDE0015711",
                 "fromLocCode" => "HAIB2-03-03", //B1是面对架货右手,从右往左数列,第三个数字从下往上数行
                 "toLocCode" => "",
             ]

+ 4 - 3
app/Services/BatchService.php

@@ -55,13 +55,14 @@ class BatchService
 
     /**
      * 为波次附加任务,已附加的重复任务不影响
-     * @param Collection $batches
+     * @param $batches
      * @throws Exception
      */
-    public function assignTasks(Collection $batches)
+    public function assignTasks($batches)
     {
         try{
             LogService::log(__METHOD__,'assignTasks','波次任务分配1:'.json_encode($batches));
+            $batches = collect($batches);
 
             $this->instant($this->stationTaskBatchService,'StationTaskBatchService');
             $this->instant($this->stationRuleBatchService,'StationRuleBatchService');
@@ -78,7 +79,7 @@ class BatchService
             $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_shouldProcess,$stationTasks); //注册波次任务
             LogService::log(__METHOD__,'assignTasks','波次任务分配4:'.json_encode($batches));
             $stationTaskMaterialBoxes=$this->stationTaskMaterialBoxService->createByBatches($batches_shouldProcess,$stationTasks); //注册料箱任务
-            LogService::log(__METHOD__,'assignTasks','波次任务分配5:'.json_encode($batches));
+            LogService::log(__METHOD__,'assignTasks','波次任务分配5:'.json_encode($stationTaskMaterialBoxes).json_encode($batches));
             $stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
             LogService::log(__METHOD__,'assignTasks','波次任务分配6:'.json_encode($batches));
 

+ 4 - 0
app/Services/ForeignHaiRoboticsService.php

@@ -264,8 +264,12 @@ class ForeignHaiRoboticsService
     {
         LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1:'.json_encode($dataToPost));
         try{
+            LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.51:');
             $response = Http::post(config('api.haiq.storage.moveBin'), $dataToPost);
+            LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.52:');
+            LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.53:'.json_encode($response));
         }catch (\Exception $e){
+            LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c1.54:');
             throw new ErrorException('海柔机器人任务执行失败:'.json_encode($dataToPost));
         }
         LogService::log(__METHOD__,'runMany','波次任务分配6.r5f2c2:'.json_encode($dataToPost));

+ 2 - 1
app/Services/OrderPackageReceivedSyncService.php

@@ -104,7 +104,8 @@ class OrderPackageReceivedSyncService
         if (Carbon::now()->lte($initDate)) {//当前时间小于等于初始化时间
             //初始化查询一个月的数据,exception为否
             $query = $query->where('created_at', '>=', $initDate->subDays((int)config('api_logistic.days'))->toDateTimeString())
-                ->where('exception', '否');
+                ->where('exception', '否')
+                ->whereNull('received_at');
         } else {//当前时间大于初始化时间,exception为否且未收货
             $query = $query->where('created_at', '>=', $initDate->toDateTimeString())
                 ->where('exception', '否')

+ 2 - 2
app/Services/StationRuleBatchService.php

@@ -17,12 +17,12 @@ class StationRuleBatchService
 {
     use ServiceAppAop;
     protected $modelClass=StationRuleBatch::class;
-    function getByBatch(Batch $batch): ?StationRuleBatch
+    function getByBatch(?Batch $batch): ?StationRuleBatch
     {
         $batchType = $batch['type'] ?? 'null';
         $ownerId = $batch['owner_id'] ?? 'null';
         $batch->loadMissing('stationTaskBatch');
-        if($batch['stationTaskBatch'])return null;
+//        if($batch['stationTaskBatch'])return null;//? 这行有啥用?
         return Cache::remember('stationRuleBatch_batchType_'.$batchType.'_ownerId_'.$ownerId, config('cache.expirations.rarelyChange'),function()use($batch){
             $builder= StationRuleBatch::query()->with('stationType')
                 ->where('owner_id',$batch['owner_id']);

+ 2 - 2
app/Services/StationService.php

@@ -38,10 +38,10 @@ class StationService
 
     function getULineEntrance(Station $station):?Station{
         $station->loadMissing(['stationType','child']);
-        if ($station['stationType']['name']??''=='料箱出货口'){
+        if (($station['stationType']['name']??'')=='料箱出货口'){
             return $station;
         }
-        if ($station['child']['stationType']['name']??''=='料箱出货口'){
+        if (($station['child']['stationType']['name']??'')=='料箱出货口'){
             return $station['child'];
         }
         return null;

+ 2 - 1
app/Services/StationTaskBatchService.php

@@ -87,7 +87,6 @@ class StationTaskBatchService
             $stationTasks_toAttach,
             data_get($stationTaskBatches_toCreate,'*.station_id')
         );
-
         return $stationTaskBatches_toCreate;
     }
 
@@ -103,6 +102,8 @@ class StationTaskBatchService
             return StationTaskBatch::query()
                 ->whereIn('status',data_get($stationTaskBatches,'*.status'))
                 ->whereIn('batch_id',data_get($stationTaskBatches,'*.batch_id'))
+                ->orderByDesc('id')
+                ->limit(count($stationTaskBatches))
                 ->get();
         });
     }

+ 2 - 0
app/Services/StationTaskMaterialBoxService.php

@@ -45,6 +45,7 @@ class StationTaskMaterialBoxService
     function createByBatches(Collection $batches,Collection $stationTasks_toAttach): Collection
     {
         $this->instant($this->stationTaskService,'StationTaskService');
+        LogService::log(__METHOD__,'assignTasks','波次任务分配4.c1:'.json_encode($batches));
         $stationTaskMaterialBoxes_byBatch = (function () use ($batches) {
             $stationTaskMaterialBoxes_listByBatch = new Collection();
             foreach ($batches as $batch) {
@@ -54,6 +55,7 @@ class StationTaskMaterialBoxService
             }
             return $stationTaskMaterialBoxes_listByBatch;
         })();
+        LogService::log(__METHOD__,'assignTasks','波次任务分配4.c2:'.json_encode($batches));
          $this->stationTaskService
             ->registerSubTasks(
                 $stationTasks_toAttach,

+ 2 - 2
config/api.php

@@ -46,8 +46,8 @@ return [
     'haiq'=>[
         'storage'=>[
 //            'relocate' => "http://59.37.126.227:65448/api/haiqEss/gr/relocate",
-            'moveBin' => "http://58.33.243.164/ess/api/haiqEss/gr/relocate",  //移动料箱
-            'light' => "http://58.33.243.164/ess/api/haiqEss/ctlPTL",  //控灯
+            'moveBin' => "http://58.33.243.164:2011/api/haiqEss/gr/relocate",  //移动料箱
+            'light' => "http://58.33.243.164:2011/api/haiqEss/ctlPTL",  //控灯
         ],
     ],
 

+ 1 - 1
config/api_logistic.php

@@ -106,6 +106,6 @@ return [
         'x-appKey' => 'c51c718eb899e9f706979',
         'appSecret' => '9f664e3ab08049874aa417720840161a',
     ],
-    'init_date' => '2021-01-25 23:59:59',
+    'init_date' => '2021-03-19 23:59:59',
     'days' => 7,
 ];

+ 6 - 4
resources/views/package/logistic/index.blade.php

@@ -15,7 +15,7 @@
                     <th>快递公司</th>
                     <th>货主</th>
                     <th>发出日期</th>
-                    <th>收日期</th>
+                    <th>收日期</th>
                     <th>称重日期</th>
                     <th>异常标记</th>
                     <th>快递路由</th>
@@ -123,8 +123,9 @@
                         },
 
 
-                        {name: 'received_at_start', type: 'dateTime', tip: '选择显示揽收时间的起始时间'},
-                        {name: 'received_at_end', type: 'dateTime', tip: '选择显示揽收时间的截止时间'},
+                        {name: 'sent_at_start', type: 'dateTime', tip: '选择显示发出时间的起始时间'},
+                        {name: 'received_at_start', type: 'dateTime', tip: '选择显示收货时间的起始时间'},
+
 
                         {
                             name: 'is_weighed',
@@ -150,8 +151,9 @@
                             placeholder: ['货主', '定位或多选货主'],
                             data: _this.owners
                         },
-                        {name: 'sent_at_start', type: 'dateTime', tip: '选择显示发出时间的起始时间'},
                         {name: 'sent_at_end', type: 'dateTime', tip: '选择显示发出时间的截止时间'},
+                        {name: 'received_at_end', type: 'dateTime', tip: '选择显示收货时间的截止时间'},
+
                         {
                             name: 'is_exception',
                             type: 'select',