瀏覽代碼

Merge branch 'master' into yang

ANG YU 4 年之前
父節點
當前提交
d937732c2f
共有 100 個文件被更改,包括 899 次插入898 次删除
  1. 67 0
      app/Console/Commands/CheckCacheRackStorage.php
  2. 2 0
      app/Console/Commands/SyncBatchTask.php
  3. 1 0
      app/Console/Kernel.php
  4. 2 1
      app/Events/BroadcastToStation.php
  5. 14 5
      app/Http/Controllers/StationController.php
  6. 87 0
      app/Http/Controllers/StorageController.php
  7. 72 18
      app/Http/Controllers/TestController.php
  8. 2 1
      app/Http/Controllers/WaybillController.php
  9. 1 1
      app/Http/Controllers/WeighController.php
  10. 10 5
      app/Http/Controllers/api/thirdPart/haiq/HaiRoboticsController.php
  11. 2 2
      app/Http/Controllers/api/thirdPart/haiq/StorageController.php
  12. 1 1
      app/Http/Controllers/api/thirdPart/weight/WeightBaseController.php
  13. 3 0
      app/MaterialBox.php
  14. 5 0
      app/OracleActAllocationDetails.php
  15. 22 0
      app/OracleDocOrderSubSerialNo.php
  16. 3 2
      app/OrderPackageCommoditySerialNumber.php
  17. 1 3
      app/Package.php
  18. 2 0
      app/Providers/AppServiceProvider.php
  19. 2 8
      app/Services/BatchService.php
  20. 2 3
      app/Services/CacheShelfService.php
  21. 2 2
      app/Services/ForeignHaiRoboticsService.php
  22. 41 0
      app/Services/ForeignZhenCangService.php
  23. 1 1
      app/Services/LogisticYTOService.php
  24. 34 0
      app/Services/MaterialBoxService.php
  25. 2 2
      app/Services/OracleDOCOrderHeaderService.php
  26. 12 12
      app/Services/OrderPackageCommoditySerialNumberService.php
  27. 3 1
      app/Services/OrderService.php
  28. 3 3
      app/Services/StationRuleBatchService.php
  29. 1 0
      app/Services/StationTaskBatchService.php
  30. 3 3
      app/Services/StationTaskCommodityService.php
  31. 23 0
      app/Services/StationTaskService.php
  32. 6 4
      app/Services/WaybillService.php
  33. 7 2
      app/Services/common/BatchUpdateService.php
  34. 8 0
      app/Station.php
  35. 1 1
      app/StationTaskMaterialBox.php
  36. 27 0
      app/Storage.php
  37. 1 1
      config/haiRou.php
  38. 34 0
      database/migrations/2021_05_19_172118_create_storages_table.php
  39. 3 1
      resources/js/queryForm/queryForm.js
  40. 39 31
      resources/views/order/issue/index.blade.php
  41. 7 3
      resources/views/package/measureMonitor/index.blade.php
  42. 143 33
      resources/views/station/monitor/show.blade.php
  43. 2 1
      resources/views/store/inStorage/cacheRackStorage.blade.php
  44. 1 1
      resources/views/transport/waybill/_dailyBilling.blade.php
  45. 2 2
      resources/views/transport/waybill/index.blade.php
  46. 3 0
      routes/api/thirdPart/haiq.php
  47. 1 1
      routes/web.php
  48. 4 4
      tests/Services/BatchService/AssignTasksTest.php
  49. 5 5
      tests/Services/CacheService/GetOrExecuteTest.php
  50. 18 16
      tests/Services/CacheShelfService/ProcessTest.php
  51. 0 55
      tests/Services/CommodityBarcodeService/CreateBarcodeByWmsTest.php
  52. 2 0
      tests/Services/CommodityBarcodeService/InsertMany_onCommoditiesTest.php
  53. 1 1
      tests/Services/CommodityService/GetParamsByBasSKUTest.php
  54. 1 1
      tests/Services/CommodityService/GetParamsByBasSkusTest.php
  55. 0 2
      tests/Services/CommodityService/Get_HasOwnerIdsAndSkusTest.php
  56. 1 2
      tests/Services/CommodityService/Get_OnlyownerIdsTest.php
  57. 0 49
      tests/Services/CommodityService/Get_SyncAndSelectTest.php
  58. 0 75
      tests/Services/CommodityService/SyncCommodityCreatedTest.php
  59. 0 102
      tests/Services/CommodityService/SyncCommodityUpdatedTest.php
  60. 2 2
      tests/Services/CommodityService/SyncCreateCommodityByBasSkusTest.php
  61. 2 2
      tests/Services/CommodityService/SyncUpdateCommodityBasSkusTest.php
  62. 1 1
      tests/Services/FeatureService/FeatureServiceTest.php
  63. 1 1
      tests/Services/ForeignHaiRoboticsService/TempMarkBinProcessedTest.php
  64. 1 1
      tests/Services/LogisticQiaoSFService/LogisticQiaoSFServiceTest.php
  65. 1 2
      tests/Services/LogisticService/GetLogisticByCodeTest.php
  66. 4 1
      tests/Services/LogisticTimingService/FindByParamsTest.php
  67. 7 7
      tests/Services/LogisticYDService/FormatTest.php
  68. 5 5
      tests/Services/LogisticYDService/LogisticYDSyncTest.php
  69. 11 11
      tests/Services/LogisticYDService/QueryTest.php
  70. 11 16
      tests/Services/LogisticYDService/RegisterApiTest.php
  71. 9 4
      tests/Services/LogisticYTOService/FormatTest.php
  72. 4 4
      tests/Services/LogisticYTOService/QueryTest.php
  73. 11 11
      tests/Services/LogisticZopService/LogisticZopServiceTest.php
  74. 1 1
      tests/Services/NewOrderCountingRecordService/GetFromCacheTest.php
  75. 1 1
      tests/Services/NewOrderCountingRecordService/GetFromLowerUnitTest.php
  76. 0 116
      tests/Services/NewOrderCountingRecordService/GetFromMiddleTableTest.php
  77. 2 2
      tests/Services/NewOrderCountingRecordService/GetOrderCountingRecordsTest.php
  78. 2 2
      tests/Services/NewOrderCountingRecordService/OrderCountingRecordsTest.php
  79. 3 3
      tests/Services/NewOrderCountingRecordService/TransfersToConditionsTest.php
  80. 12 4
      tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnStartDateTest.php
  81. 10 1
      tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnStartDateEditTest.php
  82. 10 1
      tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnstartDateCreateTest.php
  83. 1 1
      tests/Services/OrderCommodityService/SyncOrderCommodityTest.php
  84. 1 1
      tests/Services/OrderPackageCommoditySerialNumberService/GetCreateModelBy.php
  85. 5 2
      tests/Services/OrderPackageService/GetInnerParamsTest.php
  86. 4 4
      tests/Services/OrderService/CreateOrFindOrderInfoTest.php
  87. 3 3
      tests/Services/OrderService/CreateOrFindOrderTest.php
  88. 1 1
      tests/Services/OwnerService/GetOwnerByCodeTest.php
  89. 1 1
      tests/Services/ShopService/GetShopByCodeMapTest.php
  90. 0 38
      tests/Services/StationCacheShelfGrid/GetGridByCodeTest.php
  91. 0 39
      tests/Services/StationCacheShelfGrid/GetLocationTest.php
  92. 0 39
      tests/Services/StationCacheShelfGridService/CancelTaskTest.php
  93. 0 47
      tests/Services/StationCacheShelfGridService/LightOffTest.php
  94. 0 42
      tests/Services/StationCacheShelfGridService/ProcessGridTest.php
  95. 17 6
      tests/Services/StationRuleBatchService/GetBatches_shouldProcessTest.php
  96. 1 1
      tests/Services/StationTaskBatchService/CreateByBatchesTest.php
  97. 0 1
      tests/Services/StationTaskBatchService/RunManyTest.php
  98. 6 4
      tests/Services/StationTaskCommodityService/CreateByBatchTest.php
  99. 3 0
      tests/Services/StationTaskMaterialBoxService/CreateByBatchesTest.php
  100. 2 2
      tests/Services/StoreService/CreateStoreTest.php

+ 67 - 0
app/Console/Commands/CheckCacheRackStorage.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Station;
+use App\StationTask;
+use App\StationTaskMaterialBox;
+use Illuminate\Console\Command;
+use Illuminate\Database\Eloquent\Collection;
+
+class CheckCacheRackStorage extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'check:cacheRack';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'check cache rack storage info';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     */
+    public function handle()
+    {
+        $stations = Station::query()->select("id","code")->where("station_type_id",5)
+            ->whereNotNull("parent_id")
+            ->whereNotIn("id",StationTask::query()->select("station_id")
+                ->where("status","!=","完成")->whereIn("station_id",Station::query()->select("id")->where("station_type_id",5)
+                    ->whereNotNull("parent_id"))->groupBy("station_id"))
+            ->get();
+        foreach ($stations as $station){
+            $box = app("MaterialBoxService")->getAnEmptyBox();
+            if (!$box)continue;
+            $task = StationTask::query()->create([
+                'status' => "待处理",
+                'station_id' => $station->id,
+            ]);
+            $collection = new Collection();
+            $collection->append(StationTaskMaterialBox::query()->create([
+                'station_id' => $station->id,
+                'material_box_id'=>$box->id,
+                'status'=>"待处理",
+                'type' => '取',
+                'station_task_id' => $task->id,
+            ]));
+            app("ForeignHaiRoboticsService")->fetchGroup($station->code,$collection,'','立架出至缓存架');
+        }
+    }
+}

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

@@ -251,6 +251,7 @@ sql;
             LogService::log(__METHOD__,"波次同步-修改订单波次号",json_encode($updateOrder));
             app("BatchService")->checkBatchOrderInfo($updatingBatches);
             LogService::log(__METHOD__,"修改过的波次_",json_encode($updatingBatches));
+            LogService::log(__METHOD__,"波次注册一入口",json_encode($updatingBatches));
             BatchTaskJob::dispatch($updatingBatches);    //在这里为波次注册队列任务!
         }
 
@@ -278,6 +279,7 @@ sql;
                     app("OrderService")->update(["code"=>$map[$batch->code]],["batch_id"=>$batch->id]);
                 }
                 app("BatchService")->checkBatchOrderInfo($batches);
+                LogService::log(__METHOD__,"波次注册二入口",json_encode($batches));
                 BatchTaskJob::dispatch($batches);    //在这里为波次注册队列任务!
             }
         }

+ 1 - 0
app/Console/Kernel.php

@@ -80,6 +80,7 @@ class  Kernel extends ConsoleKernel
         $schedule->command('create:weightStatistic')->dailyAt("00:30");
         $schedule->command('sync:carrier')->hourlyAt(1);
         $schedule->command('createProcurementTotalBill')->monthlyOn(1);
+        $schedule->command('check:cacheRack')->everyMinute();
     }
 
     /**

+ 2 - 1
app/Events/BroadcastToStation.php

@@ -9,6 +9,7 @@ class BroadcastToStation implements ShouldBroadcastNow
 {
     public $json;
     private $id;
+    const ALL_STATION=0;
     /**
      * Create a new event instance.
      *
@@ -18,7 +19,7 @@ class BroadcastToStation implements ShouldBroadcastNow
      */
     public function __construct(int $id, string $json)
     {
-        $this->id = $id;
+        $this->id = $id;// 0意味着通用站,所有站都需要收发的意思
         $this->json = $json;
     }
 

+ 14 - 5
app/Http/Controllers/StationController.php

@@ -54,12 +54,12 @@ class StationController extends Controller
     }
     public function monitorShow(Station $station)
     {
-        $stationTypeBinMonitor = StationTypeBinMonitor::query()->where("station_id",$station->id)->first();
+//        $stationTypeBinMonitor = StationTypeBinMonitor::query()->where("station_id",$station->id)->first();
         $station->loadMissing([
-            "currentStationTask.stationTaskCommodities.commodity.barcodes",
-            "currentStationTask.stationTaskCommodities.materialBox",
-            "currentStationTask.stationTaskBatches.batch",
-            "currentStationTask.stationTaskMaterialBoxes.materialBox",
+            "stationTasks_today.stationTaskCommodities.commodity.barcodes",
+            "stationTasks_today.stationTaskCommodities.materialBox",
+            "stationTasks_today.stationTaskBatches.batch.owner",
+            "stationTasks_today.stationTaskMaterialBoxes.materialBox",
             "stationTypeBinMonitor",
         ]);
         if (!$station['stationTypeBinMonitor']){
@@ -71,6 +71,15 @@ class StationController extends Controller
             ]);
             $station->load("stationTypeBinMonitor");
         }
+//        dd(
+//            data_get($station['stationTasks_today'],'*.id')
+//            ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.batch.code')
+//            ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.id')
+//            ,data_get($station['stationTasks_today'],'*.stationTaskBatches.*.batch.id')
+//            ,data_get(data_get($station['stationTasks_today'],'*.stationTaskCommodities')[7],'*.id')
+//            ,data_get(data_get($station['stationTasks_today'],'*.stationTaskCommodities')[9],'*.id')
+//        );
+//        $station=$station->toJson();
         return view('station.monitor.show',compact('station'));
     }
 

+ 87 - 0
app/Http/Controllers/StorageController.php

@@ -0,0 +1,87 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Components\AsyncResponse;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
+
+class StorageController extends Controller
+{
+    use AsyncResponse;
+
+    public function putShelf()
+    {
+        $asn = \request("asn");
+        $ide = \request("ide");
+        $barCode = \request("barCode");
+        $amount = \request("amount");
+        if (!$asn || !$ide || !$barCode || !$amount)$this->error("信息不完整");
+        $sql = <<<sql
+SELECT * FROM DOC_ASN_DETAILS LEFT JOIN BAS_SKU ON DOC_ASN_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID AND DOC_ASN_DETAILS.SKU = BAS_SKU.SKU
+WHERE asnno = ? AND (ALTERNATE_SKU1 = ? OR ALTERNATE_SKU2 = ?)
+sql;
+        $asn = DB::connection("oracle")->selectOne(DB::raw($sql),[$asn,$barCode,$barCode]);
+        if (!$asn || $asn->receivedqty_each<$amount)$this->error("ASN不存在或数量异常");
+        $sql = <<<sql
+SELECT fmlotnum,fmlocation,toid FROM ACT_TRANSACTION_LOG WHERE transactiontype = 'IN' AND fmcustomerid = ? AND fmsku = ? AND docno = ? AND doclineno = ? AND doctype = 'ASN' AND pa_flag = 'Y'
+sql;
+        $act = DB::connection("oracle")->selectOne(DB::raw($sql),[$asn->customerid,$asn->sku,$asn->asnno,$asn->asnlineno]);
+        if (!$act)$this->error("没有入库记录");
+        $sql = <<<sql
+SELECT * FROM inv_lot_loc_id  WHERE lotnum = ? AND traceid = ? AND customerid= ?  and sku = ?
+sql;
+        $inv = DB::connection("oracle")->select(DB::raw($sql),[$act->fmlotnum,$act->toid,$asn->customerid,$asn->sku]);
+        if (!$inv)$this->error("余量与入库不符");
+        DB::transaction(function ()use($inv,$amount,$ide,$asn,$act){
+            $db = DB::connection("oracle");
+            $qty = $amount;
+            foreach ($inv as $in){
+                if ($qty==0)break;
+                if ($in->qty > $qty){
+                    $db->update(DB::raw("update inv_lot_loc_id set qty = qty-?,qtymvout = qty-? where lotnum = ? and locationid = ? and traceid = ?"),[
+                        $qty,$qty,$in->lotnum,$in->locationid,$in->traceid
+                    ]);//TODO 遗留问题:对应生成分配库位上架数量未被变更
+                    $in->qty = $in->qty-$qty;
+                    $qty = 0;
+                }else{
+                    $db->delete(DB::raw("DELETE FROM inv_lot_loc_id WHERE lotnum = ? and locationid = ? and traceid = ?"),[
+                        $in->lotnum,$in->locationid,$in->traceid
+                    ]);
+                    $qty = $qty-$in->qty;
+                }
+            }
+            if ($qty!=0){
+                $db->rollBack();
+                $this->error("上架数量与入库数量不符");
+            }
+            $db->delete(DB::raw("DELETE FROM inv_lot_loc_id WHERE lotnum = ? AND traceid = ? AND traceid != '*'"),[
+                $inv[0]->lotnum,$inv[0]->traceid
+            ]);
+            $inv = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = '*' FOR UPDATE"),[
+                $inv[0]->lotnum,$ide,$inv[0]->customerid,$inv[0]->sku
+            ]);
+            $who = 'WAS'.(Auth::user() ? '-'.Auth::user()["name"] : '');
+            if ($inv)$db->update(DB::raw("UPDATE inv_lot_loc_id SET qty = qty+? WHERE lotnum = ? AND locationid = ? AND traceid = '*'"),[
+                (int)$amount,$inv[0]->lotnum,$ide
+            ]);
+            else $db->insert(DB::raw("INSERT INTO inv_lot_loc_id VALUES(?,?,'*',?,?,?,0,0,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,0,'*',0,null)"),[
+                $inv[0]->lotnum,$ide,$inv[0]->customerid,$inv[0]->sku,$amount,date("Y-m-d H:i:s"),$who,
+                date("Y-m-d H:i:s"),$who
+            ]);
+            $sql = <<<sql
+INSERT INTO ACT_TRANSACTION_LOG VALUES(?,'PA',?,?,?,?,'ASN',?,?,?,?,?,?,?,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss')),?,
+TO_DATE(?,'yyyy-mm-dd hh24:mi:ss')),?,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,?,null,null,null,'*',?,?,?,?,?,?,?,
+?,?,?,?,?,'N',null,?,?,?,?,?,?,?,null,null)
+sql;
+            $db->insert(DB::raw($sql),[
+                'WA'.date('ymdHis').substr(\request("asn"),-2).rand(0,9),$asn->customerid,$asn->sku,
+                $asn->asnno,$asn->asnlineno,$inv[0]->lotnum,$act->fmlocation,$act->toid,$asn->packid,$asn->uom,$amount,$amount,$act->status,date("Y-m-d H:i:s"),$who,
+                date("Y-m-d H:i:s"),$who,date("Y-m-d H:i:s"),$asn->customerid,$asn->sku,$ide,$who,$asn->packid,$asn->uom,$amount,$amount,$inv[0]->lotnum,
+                'QC_TASKID',$act->qc_sequence,$act->qc_flag,'*',$act->pa_sequence,$act->warehouseid,$act->userdefine1,$act->userdefine2,
+                $act->userdefine3,$act->userdefine4,$act->userdefine5,$act->edisendflag
+            ]);
+        });
+        //成功后应去修改ASN状态及数量
+    }
+}

+ 72 - 18
app/Http/Controllers/TestController.php

@@ -180,17 +180,32 @@ class TestController extends Controller
     {
         return call_user_func([$this, $method], $request);
     }
-    public function test()
+    public function createCacheRack()
     {
-        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]);
+        $stations = [
+            "HAIB1-01-02","HAIB1-01-03",
+            "HAIB1-02-01","HAIB1-02-03",
+            "HAIB1-03-01","HAIB1-03-02","HAIB1-03-03"
+        ];
+        foreach ($stations as $station){
+            Station::query()->create([
+                "parent_id" => 6,
+                "name" => $station,
+                "code" => $station,
+                "station_type_id" => 5,
+            ]);
         }
         dd("OK");
+    }
+    public function test()
+    {
+        $orders = Order::query()->where("wms_status","订单完成")->whereBetween("updated_at",["2021-05-21 12:00:00","2021-05-21 23:59:00"])
+            ->whereNotIn("id",OwnerFeeDetail::query()->select("outer_id")->where("outer_table_name","orders")
+                ->whereBetween("worked_at",["2021-05-21 12:00:00","2021-05-21 23:59:00"]))->get();
+        foreach ($orders->chunk(50) as $or){
+            dispatch(new OrderCreateInstantBill($or));
+        }
+        dd("推进数:".count($orders));
         $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 ".
@@ -476,8 +491,7 @@ class TestController extends Controller
     public function ld()
     {
         dd(
-            json_encode(collect(collect(collect([City::query()->first()]))))
-
+            Carbon::now()->format('Y-m-d')
         );
     }
 
@@ -989,14 +1003,13 @@ class TestController extends Controller
 
     public function ld2()
     {
-        $m=MaterialBox::query()->first();
-        dump($m);
-        $m['status'] = '在缓存架';
-        dump($m['status']);
-        $m->update();
-        $m=MaterialBox::query()->first();
-        dump($m['status']);
-
+        $r=new \Illuminate\Support\Collection();
+        $sb = StationTaskBatch::query()->limit(3)->get();
+        dump(data_get($sb,'*.id'));
+        foreach ($sb as $s) {
+            $r->push($s);
+        }
+        dump(data_get($sb,'*.id'));
     }
     public function y111()
     {
@@ -1586,4 +1599,45 @@ TEXT;
         $service = app('OrderPackageExceptionTypeCountingRecordService');
         $service->updateOrCreate(30);
     }
+    public function testForeignZhenCang($batches)
+    {
+
+        $batches=Batch::query()
+            ->with(['orders.orderCommodities.commodity.barcodes'])
+            ->find(111953);
+        $body=[];
+        $body['id']=$batches->code;
+        $body['orders'] = [];
+        foreach ($batches->orders as $order){
+            $orderArr = [];
+            $orderArr['id']=$order->code??'';
+            $orderArr['createdAt']=Carbon::parse($order->created_at)->toDateTimeString()??'';
+            $orderArr['barcodes'] = [];
+            foreach ($order->orderCommodities as $orderCommodity){
+                $barcode=[];
+                $barcode['id']=$orderCommodity->id;
+                $barcode['barcode']=$orderCommodity->commodity ? ($orderCommodity->commodity->barcodes?$orderCommodity->commodity->barcodes->first()['code']:'') : '';
+                $barcode['name']=$orderCommodity->commodity->name??'';
+                $barcode['sku']=$orderCommodity->commodity->sku??'';
+                $barcode['amount']=$orderCommodity->amount??'';
+                $barcode['location']=$orderCommodity->location??'';
+                $orderArr['barcodes'][]=$barcode;
+            }
+            $body['orders'][] = $orderArr;
+        }
+        $response = Http::withHeaders([
+            'Host' => 'zc-it.com',
+        ])->post('http://1.116.164.201:8080/api/createBatch',$body);
+        dd(json_decode($response->body()));
+    }
+
+    public function updateBulk()
+    {
+        $orderPackages=OrderPackage::query()->where('measuring_machine_id',16)->get();
+        foreach ($orderPackages as $orderPackage){
+            $orderPackage->update([
+                'bulk'=>$orderPackage['length']*$orderPackage['width']*$orderPackage['height']
+            ]);
+        }
+    }
 }

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

@@ -947,10 +947,11 @@ class WaybillController extends Controller
         if(!Gate::allows('运输管理-运单-按日计算专线费')){return ['success'=>false,'message'=>'没有权限'];}
         $dailyBilling=$request->input('param');
         $waybills=app('waybillService')->dailyBilling($dailyBilling);
+        if ($waybills==false)return ['success'=>false,'message'=>'当前选定发货日期没有任何记录'];
         if (!isset($waybills))return ['success'=>false,'message'=>'该日有记录未填写重量'];
         return ['success'=>true,'data'=>$waybills];
     }
-    public function countPickUpFee(Request $request)
+    public function countPickUpFee(Request $request): array
     {
         if(!Gate::allows('运输管理-运单-查询')){ return ['success'=>false,'message'=>'没有权限'];  }
         $param=$request->input('param');

+ 1 - 1
app/Http/Controllers/WeighController.php

@@ -184,7 +184,7 @@ class WeighController extends Controller
         }else{
             $sql=app('PackageService')->getSql(['id'=>$request->data]);
         }
-        $row = ["货主","快递单号","波次号","订单号","物流公司","设备","重(KG)","长(cm)","宽(cm)","高(cm)","体积(cm³)","纸箱","状态","波次规则","称重时间","收件人","收件人电话"];
+        $row = ["货主","快递单号","波次号","订单号","物流公司","设备","重(KG)","长(mm)","宽(mm)","高(mm)","体积(mm³)","纸箱","状态","波次规则","称重时间","收件人","收件人电话"];
         $column = ["owner_name", "logistic_number", "batch_number", "order_code", "logistic_name","measuring_machine_name",
             "weight", "length", "width", "height", "bulk", "paper_box_name", "status","batch_rule","weighed_at","order_consignee_name","order_consignee_phone"];
         $rule = ["weighed_at"=> "mysqlDate"];

+ 10 - 5
app/Http/Controllers/ForeignHaiRoboticsController.php → app/Http/Controllers/api/thirdPart/haiq/HaiRoboticsController.php

@@ -1,25 +1,30 @@
 <?php
 
 
-namespace App\Http\Controllers;
+namespace App\Http\Controllers\api\thirdPart\haiq;
 
 
 use App\Services\StationTaskBatchService;
 use App\StationTaskBatch;
 use Illuminate\Http\Request;
 use App\Traits\TestableInstant;
-class ForeignHaiRoboticsController
+class HaiRoboticsController
 {
     use TestableInstant;
 
     /** @var StationTaskBatchService $stationTaskBatchService */
     private $stationTaskBatchService=null;
 
-    function runBatch(Request $request){
+    function runTaskBatch(Request $request){
+        $this->instant($this->stationTaskBatchService,'StationTaskBatchService');
         $request->validate(
-            ['id'=>'required|exists:station_task_batches,id']
+            ['station_task_batch_id'=>'required|exists:station_task_batches,id']
         );
-        $batchTask=StationTaskBatch::query()->first($request['id']);
+        if(!$request['station_task_batch_id'])return [
+            'success'=>false,
+            'errorMsg'=>'波次任务不能为空'
+        ];
+        $batchTask=StationTaskBatch::query()->find($request['station_task_batch_id']);
         $batchesFailed=$this->stationTaskBatchService->runMany(collect([$batchTask]));//执行波次任务
         if($batchesFailed && $batchesFailed->isNotEmpty()){
             return [

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

@@ -200,8 +200,8 @@ class StorageController
             "areaCode"=> "1004",
             "PTLAction"=> 1, //1是开,0是关
             "PTLSettings"=> [
-                "color"=> 1,
-                "frequency"=> 1
+                "color"=> 2, //灯颜色,0红,1绿,2绿,3黄
+                "frequency"=> 0 //频率 0是不动,最大是3
             ],
             "displayInfo"=> [
                 "detail01"=> "detail01",

+ 1 - 1
app/Http/Controllers/api/thirdPart/weight/WeightBaseController.php

@@ -257,7 +257,7 @@ class WeightBaseController
         $orderPackage['width'] = $edges[1];
         $orderPackage['height'] = $edges[2];
         $orderPackage['weighed_at'] = $req_date;
-        $orderPackage['bulk'] = $edges[0] * $edges[1] * $edges[2] / 1000;
+        $orderPackage['bulk'] = $edges[0] * $edges[1] * $edges[2] ;
         return $orderPackage->save();
     }
 

+ 3 - 0
app/MaterialBox.php

@@ -14,6 +14,7 @@ class MaterialBox extends Model
 
     static public $enums=[
         'status'=>[
+            ''=>0,
             '在库外'=>1,
             '在U型线'=>2,
             '在缓存架'=>3,
@@ -34,10 +35,12 @@ class MaterialBox extends Model
 
     public function getStatusAttribute($value)
     {
+        if(!$value)return '';
         return self::$enums['status'][$value];
     }
     public function setStatusAttribute($value)
     {
+        if(!$value)return 0;
         $this->attributes['status']=self::$enums['status'][$value];
     }
 }

+ 5 - 0
app/OracleActAllocationDetails.php

@@ -30,4 +30,9 @@ class OracleActAllocationDetails extends Model
         return $this->hasMany(OracleDocOrderSerialNo::class,'allocationdetailsid','allocationdetailsid');
     }
 
+    public function oracleDocOrderSubSerialNo()
+    {
+        return $this->hasOne(OracleDocOrderSubSerialNo::class,'allocationdetailsid','allocationdetailsid');
+    }
+
 }

+ 22 - 0
app/OracleDocOrderSubSerialNo.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class OracleDocOrderSubSerialNo extends Model
+{
+    use ModelLogChanging;
+
+    use ModelTimeFormat;
+    protected $connection="oracle";
+    protected $table="DOC_Order_SubSerialNO";
+    public $timestamps=false;
+
+    public function getIncrementing(): bool
+    { return false;}
+
+}

+ 3 - 2
app/OrderPackageCommoditySerialNumber.php

@@ -6,6 +6,7 @@ use App\Traits\ModelTimeFormat;
 use App\Traits\ModelLogChanging;
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\HasOne;
 
 class OrderPackageCommoditySerialNumber extends Model
@@ -16,8 +17,8 @@ class OrderPackageCommoditySerialNumber extends Model
     protected $fillable = ['order_package_commodity_id','serial_number'];
     //
 
-    public function orderPackageCommodity(): HasOne
+    public function orderPackageCommodity(): BelongsTo
     {
-        return $this->hasOne(OrderPackageCommodities::class);
+        return $this->belongsTo(OrderPackageCommodities::class);
     }
 }

+ 1 - 3
app/Package.php

@@ -103,9 +103,7 @@ class Package extends Model
                 "created_at"=>$now,
             ]);
         }
-        DB::transaction(function ()use($packages){
-            Package::query()->insert($packages);
-        });
+        Package::query()->insert($packages);
     }
     public function unifyThisMeasureUnderSameBatch(){
         $this->fetchPaperBox();

+ 2 - 0
app/Providers/AppServiceProvider.php

@@ -115,6 +115,7 @@ use App\Services\SupplierService;
 use App\Services\OrderPackageCommoditySerialNumberService;
 use App\Services\OrderPackageExceptionTypeCountingRecordService;
 use App\Services\LogisticYDService;
+use App\Services\ForeignZhenCangService;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -182,6 +183,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('FacilitatorService',FacilitatorService::class);
         app()->singleton('FeatureService',FeatureService::class);
         app()->singleton('ForeignHaiRoboticsService',ForeignHaiRoboticsService::class);
+        app()->singleton('ForeignZhenCangService',ForeignZhenCangService::class);
         app()->singleton('InventoryAccountMissionService',InventoryAccountMissionService::class);
         app()->singleton('InventoryCompareService',InventoryCompareService::class);
         app()->singleton('InventoryDailyLogService',InventoryDailyLogService::class);

+ 2 - 8
app/Services/BatchService.php

@@ -3,6 +3,7 @@
 namespace App\Services;
 
 use App\Batch;
+use App\Events\BroadcastToStation;
 use App\Exceptions\ErrorException;
 use App\Jobs\BatchTaskJob;
 use App\OracleActAllocationDetails;
@@ -64,7 +65,6 @@ class BatchService
     public function assignTasks($batches)
     {
         try{
-            LogService::log(__METHOD__,'assignTasks','波次任务分配1:'.json_encode($batches));
             $batches = collect($batches);
 
             $this->instant($this->stationTaskBatchService,'StationTaskBatchService');
@@ -76,9 +76,7 @@ class BatchService
             $stationTaskBatches=null;
             $batches_shouldProcess = $this->stationRuleBatchService->getBatches_shouldProcess($batches); //按规则过滤需要的波次
             if($batches_shouldProcess->isEmpty()) return;
-            LogService::log(__METHOD__,'assignTasks','波次任务分配2:'.json_encode($batches));
             $stationTaskMaterialBoxes_occupied = $this->stationTaskMaterialBoxService->getOccupied_byBatches($batches_shouldProcess); //按规则过滤需要的波次
-            LogService::log(__METHOD__,'assignTasks','波次任务分配2b:'.json_encode($batches));
             if($stationTaskMaterialBoxes_occupied->isNotEmpty()) {
                 foreach ($batches_shouldProcess as $batch){
                     Cache::tags(['波次防重叠'.$batch['id']])->flush();
@@ -89,17 +87,13 @@ class BatchService
             }
             DB::transaction(function ()use($batches,&$stationTaskBatches,&$batches_shouldProcess){
                 $stationTasks =  $this->stationTaskService->create($batches_shouldProcess->count()); //生成总任务
-                LogService::log(__METHOD__,'assignTasks','波次任务分配3:'.json_encode($batches));
                 $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($stationTaskMaterialBoxes).json_encode($batches));
                 $stationTaskCommodities=$this->stationTaskCommodityService->createByBatches($batches_shouldProcess,$stationTasks); //注册商品任务
-                LogService::log(__METHOD__,'assignTasks','波次任务分配6:'.json_encode($batches));
             });
 
+//            broadcast(new BroadcastToStation(BroadcastToStation::ALL_STATION, $json));
 //            $ran=$this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
-            LogService::log(__METHOD__,'assignTasks','波次任务分配7:'.json_encode($batches));
         }catch(Exception $e){
             $batchesJson='';
             foreach ($batches as $batch){

+ 2 - 3
app/Services/CacheShelfService.php

@@ -205,9 +205,8 @@ class   CacheShelfService
                 "uomDesc02" => "uo"
             ],
         ];
-        return new MaterialBox(['code' => 200]);
-//        $response = Http::post(config('api.haiq.storage.light'), $params);
-//        return json_decode($response->body());
+        $response = Http::post(config('api.haiq.storage.light'), $params);
+        return json_decode($response->body());
     }
 
     /**

+ 2 - 2
app/Services/ForeignHaiRoboticsService.php

@@ -88,13 +88,13 @@ class ForeignHaiRoboticsService
         ]];
     }
 
-    public function fetchGroup($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix=''): bool
+    public function fetchGroup($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix='',$mode='立架出至输送线'): bool
     {
         LogService::log(__METHOD__,'runMany','波次任务分配6.r5f0:');
         LogService::log(__METHOD__,'runMany','波次任务分配6.r5f1:'.json_encode($toLocation).json_encode($taskMaterialBoxes).json_encode($groupIdPrefix));
         $dataToPost=$this->makeJson_move(
             $taskMaterialBoxes,
-            '立架出至输送线',
+            $mode,
             '',
             $toLocation??'',
             $groupIdPrefix

+ 41 - 0
app/Services/ForeignZhenCangService.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Services;
+
+use App\Traits\ServiceAppAop;
+use App\ForeignZhenCang;
+use Carbon\Carbon;
+use Illuminate\Support\Facades\Http;
+
+class ForeignZhenCangService
+{
+    use ServiceAppAop;
+//    protected $modelClass=ForeignZhenCang::class;
+
+    public function broadcastBatch($batches)
+    {
+        $body=[];
+        $body['id']=$batches->code;
+        $body['orders'] = [];
+        foreach ($batches->orders as $order){
+            $orderArr = [];
+            $orderArr['id']=$order->code??'';
+            $orderArr['createdAt']=Carbon::parse($order->created_at)->toDateTimeString()??'';
+            $orderArr['barcodes'] = [];
+            foreach ($order->orderCommodities as $orderCommodity){
+                $barcode=[];
+                $barcode['id']=$orderCommodity->id;
+                $barcode['barcode']=$orderCommodity->commodity ? ($orderCommodity->commodity->barcodes?$orderCommodity->commodity->barcodes->first()['code']:'') : '';
+                $barcode['name']=$orderCommodity->commodity->name??'';
+                $barcode['sku']=$orderCommodity->commodity->sku??'';
+                $barcode['amount']=$orderCommodity->amount??'';
+                $barcode['location']=$orderCommodity->location??'';
+                $orderArr['barcodes'][]=$barcode;
+            }
+            $body['orders'][] = $orderArr;
+        }
+        $response = Http::withHeaders([
+            'Host' => 'zc-it.com',
+        ])->post('http://1.116.164.201:8080/api/createBatch',$body);
+    }
+}

+ 1 - 1
app/Services/LogisticYTOService.php

@@ -48,7 +48,7 @@ class LogisticYTOService
         if (is_object($response) && $response->code=='1001') {return [];}
         else {
             try {
-                $result['logistic_number'] = $response[0]->waybill_No;
+                if (is_array($response))$result['logistic_number'] = $response[0]->waybill_No;
             } catch (\Exception $e) {
                 LogService::log(LogisticYTOService::class, "YTO快递信息异常", $response);
             }

+ 34 - 0
app/Services/MaterialBoxService.php

@@ -8,6 +8,7 @@ use App\MaterialBox;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use App\Traits\ServiceAppAop;
+use Illuminate\Support\Facades\DB;
 
 
 class MaterialBoxService
@@ -16,4 +17,37 @@ class MaterialBoxService
     protected $modelClass=MaterialBox::class;
 
 
+    /**
+     * 获取一个空料箱
+     *
+     * @return MaterialBox|null
+     */
+    public function getAnEmptyBox()
+    {
+        $id = 0;
+        while (true){
+            $boxes = MaterialBox::query()->select('id',"code")->where("id",">",$id)->where("code","like","IDE%")
+                ->where("status",4)->limit(10)->orderBy("id")->get();
+            if ($boxes->count()==0)break;
+            $ides = [];
+            $str = "(";
+            for ($i=0;$i<count($boxes)-1;$i++){
+                $str .= "'".$boxes[$i]->code."',";
+                $ides[$boxes[$i]->code] = $boxes[$i];
+            }
+            $box = $boxes[count($boxes)-1];
+            $ides[$box->code] = $box;
+            $str .= "'".$box->code."')";
+            $id = $box->id;
+            $sql = <<<sql
+SELECT LOCATIONID,SUM(QTY+QTYPA) qty FROM INV_LOT_LOC_ID WHERE LOCATIONID IN {$str} GROUP BY LOCATIONID
+sql;
+            foreach (DB::connection("oracle")->select(DB::raw($sql)) as $item){
+                if ((int)$item->qty==0)return $ides[$item->locationid];
+                unset($ides[$item->locationid]);
+            }
+            if ($ides)return current($ides);
+        }
+        return null;
+    }
 }

+ 2 - 2
app/Services/OracleDOCOrderHeaderService.php

@@ -76,7 +76,7 @@ class OracleDOCOrderHeaderService
         /** @var Owner $owners */
         $owners = app(OrderTrackingOwnerService::class)->getTrackingOrderOwner();
         return OracleDOCOrderHeader::query()
-            ->with(['oracleDOCOrderDetails', 'actAllocationDetails','oracleBASCode','oracleBASCustomer'])
+            ->with(['oracleDOCOrderDetails', 'actAllocationDetails.oracleDocOrderSubSerialNos','oracleBASCode','oracleBASCustomer'])
             ->where('DOC_Order_Header.addTime','>=',$startDate)
             ->whereIn('DOC_Order_Header.customerID',data_get($owners,'*.code'))
             ->get();
@@ -86,7 +86,7 @@ class OracleDOCOrderHeaderService
         /** @var Owner $owners */
         $owners = app(OrderTrackingOwnerService::class)->getTrackingOrderOwner();
         return OracleDOCOrderHeader::query()
-            ->with(['oracleDOCOrderDetails', 'actAllocationDetails','oracleBASCode','oracleBASCustomer'])
+            ->with(['oracleDOCOrderDetails', 'actAllocationDetails.oracleDocOrderSubSerialNos','oracleBASCode','oracleBASCustomer'])
             ->where('DOC_Order_Header.EditTime','>=',$startDate)
             ->whereColumn('DOC_Order_Header.EditTime','<>','DOC_Order_Header.addTime')
             ->whereIn('DOC_Order_Header.customerID',data_get($owners,'*.code'))

+ 12 - 12
app/Services/OrderPackageCommoditySerialNumberService.php

@@ -110,7 +110,6 @@ class OrderPackageCommoditySerialNumberService
             if(!isset($orderHeader['actAllocationDetails']))continue;
             foreach ($orderHeader['actAllocationDetails'] as $actAllocationDetail) {
                 $logisticNumber = $actAllocationDetail['picktotraceid'];
-
                 if (!$logisticNumber) continue;
                 $orderPackage = $dataHandlerService->getKeyValue(['logistic_number' => $logisticNumber], $orderPackageMaps) ??
                     $dataHandlerService->getKeyValue(['logistic_number' => $orderHeader['soreference5']], $orderPackageMaps);
@@ -123,27 +122,28 @@ class OrderPackageCommoditySerialNumberService
                     if($sku === '')continue;
                     $orderPackageCommodityMap[$sku] = $orderPackageCommodity;
                 }
-                foreach ($actAllocationDetail['oracleDocOrderSerialNos'] as $oracleDocOrderSerialNo) {
-                    $sku = $oracleDocOrderSerialNo['sku'];
-                    $createParams = $this->getCreateModel($oracleDocOrderSerialNo, $orderPackageCommodityMap);
-                    if (count($createParams) == 0) continue;
-                    if (!isset($orderPackageSerialNumbers[$logisticNumber])) $orderPackageSerialNumbers[$logisticNumber] = [];
-                    if (!isset($orderPackageSerialNumbers[$logisticNumber][$sku])) $orderPackageSerialNumbers[$logisticNumber][$sku] = [];
-                    $orderPackageSerialNumbers[$logisticNumber][$sku][$createParams['serial_number']] = $createParams;
-                }
+
+                $oracleDocOrderSubSerialNo = $actAllocationDetail['oracleDocOrderSubSerialNo'];
+                if(!$oracleDocOrderSubSerialNo)continue;
+                $createParams = $this->getCreateModel($oracleDocOrderSubSerialNo, $orderPackageCommodityMap);
+                if (count($createParams) == 0) continue;
+                $sku = $oracleDocOrderSubSerialNo['sku'];
+                if (!isset($orderPackageSerialNumbers[$logisticNumber])) $orderPackageSerialNumbers[$logisticNumber] = [];
+                if (!isset($orderPackageSerialNumbers[$logisticNumber][$sku])) $orderPackageSerialNumbers[$logisticNumber][$sku] = [];
+                $orderPackageSerialNumbers[$logisticNumber][$sku][$createParams['serial_number']] = $createParams;
             }
         }
         return $orderPackageSerialNumbers;
     }
 
-    public function getCreateModel($oracleDocOrderSerialNo, $orderPackageCommodityMap)
+    public function getCreateModel($oracleDocOrderSubSerialNo, $orderPackageCommodityMap)
     {
-        $orderPackageCommodity = $orderPackageCommodityMap[$oracleDocOrderSerialNo['sku']] ?? null;
+        $orderPackageCommodity = $orderPackageCommodityMap[$oracleDocOrderSubSerialNo['sku']] ?? null;
         if (!$orderPackageCommodity) return [];
         $created_At = Carbon::now()->format(Carbon::DEFAULT_TO_STRING_FORMAT);
         return [
             'order_package_commodity_id' => $orderPackageCommodity['id'],
-            'serial_number' => $oracleDocOrderSerialNo['serialno'],
+            'serial_number' => $oracleDocOrderSubSerialNo['subserialno'],
             'created_at' => $created_At,
             'updated_at' => $created_At
         ];

+ 3 - 1
app/Services/OrderService.php

@@ -622,7 +622,9 @@ class OrderService
 
     public function pushQueue($orderHeaders){
         $orders = Order::query()->with(["logistic","packages.commodities.commodity"])->where('wms_status','订单完成')->whereIn('code',data_get($orderHeaders,'*.orderno'))->get();
-        dispatch(new OrderCreateInstantBill($orders));
+        foreach ($orders->chunk(50) as $or){
+            dispatch(new OrderCreateInstantBill($or));
+        }
     }
 
     public function syncOrderByWMSOrderHeaders(&$orderHeaders)

+ 3 - 3
app/Services/StationRuleBatchService.php

@@ -61,9 +61,9 @@ class StationRuleBatchService
     {
         LogService::log(__METHOD__,'shouldProcess','波次任务分配1.1:'.json_encode($batches));
         $batches_toProcess=collect();
-        $batches_inTask=StationTaskBatch::query()->whereIn('batch_id',data_get($batches,'*.id'))->get();
-        LogService::log(__METHOD__,'shouldProcess','波次任务分配1.2:'.json_encode($batches_inTask));
-        $batches=$batches->whereNotIn('id',data_get($batches_inTask,'*.id')??[]);
+        $stationTaskBatches_inTask=StationTaskBatch::query()->whereIn('batch_id',data_get($batches,'*.id'))->get();
+        LogService::log(__METHOD__,'shouldProcess','波次任务分配1.2:'.json_encode($stationTaskBatches_inTask));
+        $batches=$batches->whereNotIn('id',data_get($stationTaskBatches_inTask,'*.batch_id')??[]);
         foreach ($batches as $batch){
             $stationRuleBatch=$this->getByBatch($batch);
             if(!$stationRuleBatch)continue;

+ 1 - 0
app/Services/StationTaskBatchService.php

@@ -75,6 +75,7 @@ class StationTaskBatchService
             }
         }
         $this->batchService->updateWhereIn('id', data_get($batches_handled, '*.id'), ['status' => '处理中']);
+        $stationTaskBatches_toCreate=$stationTaskBatches_toCreate->reverse();
         $this->insert($stationTaskBatches_toCreate->toArray());
 
         $stationTaskBatches_toCreate=$this->getAndAttachIds($stationTaskBatches_toCreate);

+ 3 - 3
app/Services/StationTaskCommodityService.php

@@ -51,17 +51,17 @@ class StationTaskCommodityService
     function createByBatches(Collection $batches,Collection $stationTasks_toAttach): Collection
     {
         $this->instant($this->stationTaskService,'StationTaskService');
-        $stationTaskCommodities_listByBatch=new Collection();
+        $stationTaskCommodities_lists_ByBatch=new Collection();
         $stationTaskCommodities=new Collection();
         foreach ($batches as $batch){
             $taskCommodities = $this->createByBatch($batch);
             $stationTaskCommodities= $stationTaskCommodities->merge($taskCommodities);
-            $stationTaskCommodities_listByBatch->push($taskCommodities);
+            $stationTaskCommodities_lists_ByBatch->push($taskCommodities);
         }
 //        $stationTaskCommodities=$this->getAndAttachIds($stationTaskCommodities);
         $this->stationTaskService->registerSubTasks(
             $stationTasks_toAttach,
-            $stationTaskCommodities_listByBatch);
+            $stationTaskCommodities_lists_ByBatch);
         return $stationTaskCommodities;
 
     }

+ 23 - 0
app/Services/StationTaskService.php

@@ -45,6 +45,29 @@ class StationTaskService
      * @param Collection $subTaskLists 二维数组,第一维是对应注册的任务
      */
     function registerSubTasks(Collection $tasks, iterable $subTaskLists)
+    {
+        $this->instant($this->stationTaskChildService,'StationTaskChildService');
+        $taskChildren_toInsert=collect();
+        foreach ($subTaskLists as $i=>$subTaskList){
+            foreach ($subTaskList as $subTask){
+                $subTaskId = $subTask['id'];
+                $subTaskClass = get_class($subTask);
+                $paramToInsert = [
+                    'station_task_id' => $tasks[$i]['id'],
+                    'station_taskable_type' => $subTaskClass,
+                    'station_taskable_id' => $subTaskId,
+                ];
+                $taskChild_existed=$this->stationTaskChildService->get($paramToInsert)->first();
+                if(!$taskChild_existed){
+                    $taskChildren_toInsert->push($paramToInsert);
+                    $subTask['station_task_id']=$tasks[$i]['id'];
+                    $subTask->save();
+                }
+            }
+        }
+        $this->stationTaskChildService->insert($taskChildren_toInsert->toArray());
+    }
+    function registerCommoditiesSubTasks(Collection $tasks, iterable $subTaskLists)
     {
         $this->instant($this->stationTaskChildService,'StationTaskChildService');
         $taskChildren_toInsert=collect();

+ 6 - 4
app/Services/WaybillService.php

@@ -161,20 +161,22 @@ class WaybillService
             ->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.created_at','like',$param['screenDate'].'%')
             ->where('waybills.type','专线')
+            ->where('waybills.deliver_at','like',$param['screenDate'].'%')
             ->get();
+        if ($waybills->isEmpty()) return false;
         foreach ($waybills as $waybill){
             if (!$waybill['carrier_weight_other'] && !$waybill['carrier_weight']) return null;
-            if (!$waybill['carrier_weight_other']) $waybill['carrier_weight_other']=floor($waybill['carrier_weight']/0.4);
+            if (!$waybill['carrier_weight_other']) $waybill['carrier_weight_other']=($waybill['carrier_weight']/0.004);
         }
         $daily_total_weight=$waybills->sum('carrier_weight_other');
         $updateParams = [['id','pick_up_fee','updated_at']];
         foreach ($waybills as $waybill){
-            $waybill['pick_up_fee']=floor(($waybill->carrier_weight_other/$daily_total_weight)*$param['billing']);
+            $waybill['pick_up_fee']=round(($waybill->carrier_weight_other/$daily_total_weight)*$param['billing']);
             $updateParams[] = [
                 'id' => $waybill->id,
-                'pick_up_fee' => floor(($waybill->carrier_weight_other/$daily_total_weight)*$param['billing']),
+                'pick_up_fee' => (($waybill->carrier_weight_other/$daily_total_weight)*$param['billing']),
                 'updated_at' => Carbon::now()->toDateTimeString(),
             ];
         }

+ 7 - 2
app/Services/common/BatchUpdateService.php

@@ -61,13 +61,18 @@ class BatchUpdateService
         $bindings = array_merge($bindings, $whereIn);
         $whereIn = rtrim(str_repeat('?,', count($whereIn)), ',');
         $updateSql = rtrim($updateSql, ", ") . " WHERE `" . $referenceColumn . "` IN (" . $whereIn . ")";
+
+        $debug = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT ,1)[0];
+        unset($debug["object"]);
+        unset($debug["args"]);
+
         try {
             // DB::update
             $bool = DB::connection($connection)->update($updateSql, $bindings);
-            app('LogService')->log(__METHOD__, __FUNCTION__, '批量更新' . count($multipleData) . $tableName . $updateSql . json_encode($bindings));
+            app('LogService')->log(__METHOD__, __FUNCTION__, '批量更新:' . $tableName . ' | '.json_encode($multipleData).' | 溯源:'.json_encode($debug));
             return $bool;
         } catch (\Exception $e) {
-            app('LogService')->log(__METHOD__, __FUNCTION__, '批量更新失败' . count($multipleData) . $tableName . $updateSql . json_encode($bindings) . $e->getMessage() . $e->getTraceAsString());
+            app('LogService')->log(__METHOD__, __FUNCTION__, '批量更新失败' . $tableName . ' | '.json_encode($multipleData).' | 溯源:'.json_encode($debug) . $e->getMessage() . $e->getTraceAsString());
             return false;
         }
     }

+ 8 - 0
app/Station.php

@@ -3,6 +3,7 @@
 namespace App;
 
 use App\Traits\ModelTimeFormat;
+use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\HasOne;
 use App\Traits\ModelLogChanging;
@@ -27,6 +28,13 @@ class Station extends Model
         return $this->hasOne(StationTask::class)
             ->where('status','=','处理中');
     }
+    public function stationTasks_today(){
+        return $this->hasMany(StationTask::class)
+            ->where('created_at','>=',now()->format('Y-m-d'))
+            ->orderBy('status')
+            ->orderByDesc('id')
+            ;
+    }
     public function stationTypeBinMonitor(){
         return $this->hasOne(StationTypeBinMonitor::class);
     }

+ 1 - 1
app/StationTaskMaterialBox.php

@@ -13,7 +13,7 @@ class StationTaskMaterialBox extends Model
 {
     use ModelLogChanging;
 
-    protected $fillable=['station_id','material_box_id','status'];
+    protected $fillable=['station_id','material_box_id','status','type','station_task_batch_id','station_task_id'];
 
     function materialBox(): HasOne
     {

+ 27 - 0
app/Storage.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+
+class Storage extends Model
+{
+    use ModelLogChanging;
+
+    protected $fillable = [
+        "material_box_id",
+        "commodity_id",
+        "amount"
+    ];
+
+    public function materialBox()
+    {   //料箱
+        $this->belongsTo(MaterialBox::class);
+    }
+    public function commodity()
+    {   //商品
+        $this->belongsTo(Commodity::class);
+    }
+}

+ 1 - 1
config/haiRou.php

@@ -1,5 +1,5 @@
 <?php
 
 return [
-    "波次防重叠时间_秒" => 1200,
+    "波次防重叠时间_秒" => 1800,
 ];

+ 34 - 0
database/migrations/2021_05_19_172118_create_storages_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateStoragesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('storages', function (Blueprint $table) {
+            $table->id();
+            $table->bigInteger("material_box_id")->index()->comment("外键料箱");
+            $table->bigInteger("commodity_id")->nullable()->index()->comment("外键商品");
+            $table->integer("amount")->default(0)->comment("数量");
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('storages');
+    }
+}

+ 3 - 1
resources/js/queryForm/queryForm.js

@@ -519,7 +519,9 @@ const query = function getQueryForm(data) {
         let min = $("<input id='" + condition.name + "_min' class='form-control form-control-sm ml-2' style='max-width: 100px;' placeholder='00:00' data-toggle='tooltip' data-placement='top' >");
         min.attr('title', controlJsType(condition.tip[1], 'undefined') ? '' : condition.tip[1]);
         dateTime.bind('input propertychange', function () {
-            let value = this.value !== '' ? this.value + ' ' + (!!min.val() ? min.val() : '23:59') : '';
+            let hm = '00:00';
+            if(!condition.name.includes('start'))hm = '23:59';
+            let value = this.value !== '' ? this.value + ' ' + (!!min.val() ? min.val() : hm) : '';
             modifyData({name: condition.name, type: 'time', value: value, mold: 'time'});
             // modifyData({name: condition.name, type: 'dateTime', value: this.value, mold: 'dateTime'});
         });

+ 39 - 31
resources/views/order/issue/index.blade.php

@@ -99,23 +99,23 @@
                         <th class="one-layer align-middle" rowspan="2" style=" min-width: 50px;">序号</th>
                         <th class="one-layer align-middle" rowspan="2" style=" min-width: 70px;">ID</th>
                         @cannot('订单管理-问题件-客户不可见')
-                            <th class="one-layer align-middle" rowspan="2" style=" min-width: 75px;">新退件状态</th>
+                            <th class="one-layer align-middle" rowspan="2" style=" max-width: 55px;min-width: 55px">新退件状态</th>
                             @can("订单管理-问题件-置顶")
                                 <th class="one-layer align-middle" rowspan="2" style=" min-width: 75px;">置顶</th>
                             @endcan
                             <th class="one-layer align-middle" rowspan="2" style=" min-width: 100px;">退单状态</th>
                         @endcannot
-                        <th class="one-layer align-middle" rowspan="2" style="min-width: 120px">最终状态</th>
+                        <th class="one-layer align-middle" rowspan="2" style="min-width: 90px">最终状态</th>
                         @cannot('订单管理-问题件-客户不可见')
-                            <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 165px;">登记日期</th>
+                            <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 95px;min-width: 95px;">登记日期</th>
                         @endcannot
 
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 165px;">订单日期</th>
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 100px;">客户</th>
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 200px;">店铺</th>
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 200px;">客户订单号</th>
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 100px;">原始承运商</th>
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 150px;">原始运单号</th>
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 95px;min-width: 95px;">订单日期</th>
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 100px;min-width: 100px;">客户</th>
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 120px;min-width: 120px;">店铺</th>
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 150px;min-width: 150px;">客户订单号</th>
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 100px;min-width: 100px;">原始承运商</th>
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width: 150px;min-width: 150px;">原始运单号</th>
                         {{--原始商品明细 开始--}}
                         <th class="tow-layer align-middle td-yellow" v-show="isShowOrderInfo" rowspan="2"
                             style="min-width: 200px">收货人名称</th>
@@ -131,12 +131,12 @@
                             style="min-width:300px">收货人地址</th>
                         <th class="tow-layer align-middle td-yellow" v-show="isShowOrderInfo" colspan="3"
                             style="min-width:300px">原始商品明细</th>
-                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width:50px">@{{
+                        <th class="tow-layer align-middle td-yellow" rowspan="2" style="max-width:50px">@{{
                             isShowOrderInfo? '隐藏':'展开' }}</th>
                         {{--原始商品明细 结束--}}
 
                         {{--原始商品明细 开始--}}
-                        <th class="three-layer   align-middle" rowspan="2" style="min-width:50px">@{{ isShowRejectedBill
+                        <th class="three-layer   align-middle" rowspan="2" style="max-width:50px">@{{ isShowRejectedBill
                             ? '隐藏':'展开' }}</th>
                         <th class="three-layer align-middle" rowspan="2" v-show="isShowRejectedBill"
                             style="min-width:265px">退回单号</th>
@@ -184,9 +184,9 @@
                             <th v-show="isShowRejectedBill" style="min-width: 50px">是否正品</th>
                             <th v-show="isShowRejectedBill" style="min-width: 100px">备注</th>
                         @endcannot
-                        <th style="min-width: 120px">说明</th>
-                        <th style="min-width: 100px">操作者</th>
-                        <th style="min-width: 170px">时间</th>
+                        <th style="max-width: 135px">说明</th>
+                        <th style="max-width: 55px">操作者</th>
+                        <th style="max-width: 135px">时间</th>
                         <th></th>
                         @cannot('订单管理-问题件-客户不可见')
                             <th v-show="isShowSecondOrderInfo" style="min-width: 100px">条码</th>
@@ -269,15 +269,15 @@
                         </td>
 
                         @cannot('订单管理-问题件-客户不可见')
-                            <td class="toptd td-yellow child-layer-2">
+                            <td class="toptd td-yellow child-layer-2 m-0 p-0 pt-1">
                                 <div v-if="orderIssue.remark"
                                      class="bg-light-yellow  text-danger top text-left position-absolute"
                                      data-toggle="tooltip" style="opacity: 0.1;z-index: 1">置顶备注:@{{ orderIssue.remark }}</div>
-                                @{{ orderIssue.created_at }}
+                                @{{ orderIssue.created_at  }}
                             </td>
                         @endcannot
 
-                        <td class="td-yellow child-layer-2">
+                        <td class="td-yellow child-layer-2  m-0 p-0 pt-1">
                             @cannot('订单管理-问题件-客户不可见')
                             @else
                                 <div v-if="orderIssue.top" class="bg-light-yellow  text-danger top text-left"
@@ -338,8 +338,7 @@
                                             <td>
                                                 <p class="text-truncate text-primary m-0 p-0 tooltipTarget"
                                                    style="width: 100px;cursor:pointer;text-decoration: underline"
-                                                   title="双击展开" @dblclick="nowrapText($event)">@{{ item.commodity.name
-                                                    }}</p>
+                                                   title="双击展开" @dblclick="nowrapText($event)">@{{ item.commodity.name }}</p>
                                                 <p class="text-nowrap m-0 p-0 tooltipTarget"
                                                    style="display: none;cursor:pointer" @dblclick="truncateText($event)"
                                                    title="双击收起">@{{ item.commodity.name }}</p>
@@ -471,24 +470,25 @@
                         <td class=" m-0 p-0 log-td child-layer-3  align-center" v-on:mouseover="showAddBtn($event)"
                             v-on:mouseleave="hideAddBtn($event)" colspan="4">
                             @can('订单管理-问题件-处理结果添加')
+                                <div style="position: absolute;display: none;margin-top: -35px" class="add-btn" :id="'AddBtn'+orderIssue.id">
+                                    <button type="button" class="btn  btn-primary "
+                                            @click="showAddDiv('AddLog_'+orderIssue.id)">新
+                                    </button>
+                                </div>
+
                                 <div class="addLogDiv row m-0 p-0 form-group" :id="'AddLog_'+orderIssue.id"
                                      style="display: none;">
                                     <input type="hidden" name="id" :value="orderIssue.id">
                                     <div style="width: 45px"></div>
                                     <div class="form-inline m-2">
-                                        <input type="text" name="content" class="form-control" style="width: 300px"
+                                        <input type="text" name="content" class="form-control m-0 p-0" style="width: 275px"
                                                required>
-                                        <button type="button" class="btn btn-primary ml-2"
-                                                @click="addOrderIssueLog('AddLog_'+orderIssue.id,orderIssue)">添加
+                                        <button type="button" class="btn btn-primary ml-2 m-0 p-0"
+                                                @click="addOrderIssueLog('AddLog_'+orderIssue.id,orderIssue)" style="width: 50px">添加
                                         </button>
                                     </div>
                                 </div>
-                                <div style="position: absolute;display: none;margin-top: -35px" class="add-btn"
-                                     :id="'AddBtn'+orderIssue.id">
-                                    <button type="button" class="btn  btn-primary "
-                                            @click="showAddDiv('AddLog_'+orderIssue.id)">新
-                                    </button>
-                                </div>
+
                             @endcan
                             <template v-if="orderIssue.logs && orderIssue.logs.length > 0" class="p-0 m-0">
                                 <table class="table table-sm p-0 m-0 " :id="'logs'+orderIssue.id">
@@ -496,11 +496,11 @@
                                         @click="removeFocusing($event)" v-on:mouseover="showDelBtn($event)"
                                         v-on:mouseleave="hideDelBtn($event)">
                                         <template v-if="logIndex<2||orderIssue.log_is_show===true">
-                                            <td style="min-width: 200px">@{{ log.content }}</td>
-                                            <td class="text-muted" style="min-width: 120px">
+                                            <td style="max-width: 175px;min-width: 175px;">@{{ log.content }}</td>
+                                            <td class="text-muted" style="max-width: 55px;min-width: 55px;">
                                                 <span v-if="log.user">@{{ log.user.name}}</span>
                                             </td>
-                                            <td class="text-muted" style="min-width: 170px">@{{ log.created_at }}</td>
+                                            <td class="text-muted" style="max-width: 95px;min-width: 95px;">@{{ log.created_at }}</td>
                                             @can('订单管理-问题件-处理结果删除')
                                                 <td style="" class="m-0 p-0 border-0">
                                                     <button type="button"
@@ -2136,6 +2136,14 @@
                 listenTBodyResize(){
                     this.$set(this,'toggleBtnHeight',document.getElementById('tbody').clientHeight);
                 },
+            },
+            filters:{
+                date:function(value) {
+                    if (value !== null) {
+                        return moment(value).format('yyyy-MM-DD');
+                    }
+                    return value
+                },
             }
         })
         // modal 隐藏时修改 input 为空

+ 7 - 3
resources/views/package/measureMonitor/index.blade.php

@@ -133,15 +133,19 @@
                         let logistic_name = package.order ? (package.order.logistic ? package.order.logistic.name : '') : '';
                         if (_this.logisticAudioURL[logistic_name]){
                             audio.src=_this.logisticAudioURL[logistic_name];
-                            audio.play();
+                            setTimeout(()=>{
+                                audio.play();
+                            },10);
                         }else {
                             window.tempTip.setDuration(3000);
-                            window.axios.post('/package/weigh/measureMonitor/speech',{logistic:logistic_name})
+                            window.axios.post("{{url('package/weigh/measureMonitor/speech')}}",{logistic:logistic_name})
                                 .then(function (response) {
                                     if (response.data){
                                         _this.logisticAudioURL[logistic_name]=response.data;
                                         audio.src=response.data;
-                                        audio.play();
+                                        setTimeout(()=>{
+                                            audio.play();
+                                        },10);
                                     }else window.tempTip.show('没有对应快递名称!');
                                 }).catch(function (err) {
                                     window.tempTip.show('语音合成发生错误:'+err);

+ 143 - 33
resources/views/station/monitor/show.blade.php

@@ -26,19 +26,67 @@
                     <div class="col-4">
                         <div class="row">
                             <div class="col py-3 h4">
-                                <div>波次号:</div>
-                                <div class=" text-center">
-                                    <b v-if="task&&task.station_task_batches">
-                                        <div v-for="taskBatch in task.station_task_batches">
-                                            @{{ taskBatch.batch.code }}
+                                <div class="row">
+                                    <div class="col">选择执行波次:</div>
+                                </div>
+                                <div class="row" v-if="current_stationTaskBatch">
+                                    <div class="col font-weight-bold text-center position-relative"
+                                         :style="[
+                                                    {opacity:
+                                                        current_stationTaskBatch.status==='完成'?'0.5':'1'
+                                                    },
+                                                ]"
+                                         :class="[
+                                            (current_stationTaskBatch.runningStatus==='')?'text-info':'',
+                                            (current_stationTaskBatch.runningStatus==='请求中')?'text-dark':'',
+                                            (current_stationTaskBatch.runningStatus==='请求失败')?'text-danger':'',
+                                            (current_stationTaskBatch.runningStatus==='请求成功')?'text-success':'',
+                                            (current_stationTaskBatch.runningStatus==='请求异常')?'text-danger':'',
+                                         ]"
+                                    >
+                                        <div class="text-center mt-2">@{{ current_stationTaskBatch.batch.code }}</div>
+                                        <div class="text-center" style="font-size: 12px;">
+                                            @{{ current_stationTaskBatch.batch.owner.name }}
+                                        </div>
+                                        <div class="col text-muted text-left">
+                                            <img id="barcode" :alt="batchCode">
                                         </div>
-                                    </b>
+                                    </div>
+                                    <div class="col text-center">
+                                            <button class="btn btn-lg mt-4" @click="runTheTaskBatch()"
+                                                    :class="[
+                                            (current_stationTaskBatch.runningStatus==='')?'btn-info':'',
+                                            (current_stationTaskBatch.runningStatus==='请求中')?'btn-dark':'',
+                                            (current_stationTaskBatch.runningStatus==='请求失败')?'btn-danger':'',
+                                            (current_stationTaskBatch.runningStatus==='请求成功')?'btn-success':'',
+                                            (current_stationTaskBatch.runningStatus==='请求异常')?'btn-danger':'',
+                                         ]"
+                                            >
+                                                <span v-if="!current_stationTaskBatch.runningStatus">执行</span>
+                                                <span v-if="current_stationTaskBatch.runningStatus==='请求中'">请求中</span>
+                                                <span v-if="current_stationTaskBatch.runningStatus==='请求失败'">(失败)重新执行</span>
+                                                <span v-if="current_stationTaskBatch.runningStatus==='请求成功'">(请求成功)重新执行</span>
+                                                <span v-if="current_stationTaskBatch.runningStatus==='请求异常'">(请求异常)重新执行</span>
+                                            </button>
+                                    </div>
+                                </div>
+                                <div class="text-center my-2" style="overflow-y: scroll;max-height:200px;">
+                                    <div class="flex flex-column flex-wrap" v-if="stationTaskBatches">
+                                        <button v-for="stationTaskBatch in stationTaskBatches"
+                                                @click="selectBatch(stationTaskBatch)"
+                                                class="btn"
+                                                :class="[
+                                                    (current_stationTaskBatch&&current_stationTaskBatch.id===stationTaskBatch.id)?'btn-outline-info':'btn-outline-dark',
+                                                ]"
+                                                :style="[
+                                                    {opacity:
+                                                        stationTaskBatch.status==='完成'?'0.5':'1'
+                                                    },
+                                                ]"
+                                        >
+                                            @{{stationTaskBatch.batch.code | simplifyBatchCode}}</button>
+                                    </div>
                                 </div>
-                            </div>
-                        </div>
-                        <div class="row">
-                            <div class="col py-3 text-muted text-center">
-                                <img id="barcode" alt="" :data-refresh="batchCode">
                             </div>
                         </div>
                         <div class="row">
@@ -157,7 +205,7 @@
                                 <div class="text-left">
                                     <div >
                                         <div class="btn btn-outline-info" @click="
-                                        (inputs.manuallyTakeBox.visible=true)
+                                        (inputs.manuallyTakeBox.visible=!inputs.manuallyTakeBox.visible)
                                         &&(inputs.manuallyTakeBox.text='')">手动出库</div>
                                         <div class="position-relative bg-white" v-if="inputs.manuallyTakeBox.visible">
                                 <textarea  name="" id="" cols="30" rows="3" class="form-control" v-model="inputs.manuallyTakeBox.text"
@@ -286,16 +334,20 @@
         $vue=new Vue({
             el:"#container",
             data:{
-                broadcastName : "{{config('database.redis.options.prefix').'station-'.$station->id}}",
+                taskBroadcastName : "{{config('database.redis.options.prefix').'station-'.$station->id}}",
+                allTaskBroadcastName : "{{config('database.redis.options.prefix').'station-0'}}",
                 channelName : ".App\\Events\\BroadcastToStation",
                 error:"",
-                station:{!! $station??[] !!},
+                station:{!! $station !!},
                 inputs:{
                     manuallyTakeBox:{
                         visible:false,
                         text:'',
                     }
                 },
+                current_stationTaskBatch: null,
+                stationTask_indexByBatch: [],
+                stationTaskBatch_index: [],
                 grids:{
                     single:{status:'',},
                     half:{
@@ -315,7 +367,9 @@
             },
             mounted() {
                 this._makeMenuHiding();
-                this._listenBroadcast();
+                initEcho();
+                this._listenTaskBroadcast();
+                this._listenAllTaskBroadcast();
             },
             methods:{
                 _makeMenuHiding(){
@@ -327,21 +381,33 @@
                         $('.navbar,.nav1,.nav2').hide();
                     });
                 },
-                _listenBroadcast(){
-                    initEcho();
-                    window.Echo.channel(this.broadcastName).listen(this.channelName,(msg)=> {
+                _listenTaskBroadcast(){
+                    window.Echo.channel(this.taskBroadcastName).listen(this.channelName,(msg)=> {
+                        // console.log((new Date()).toTimeString(),msg);
+                        let json = JSON.parse(msg.json);
+                        if(!json||json.length===0)return;
+                        this.task=json;
+                    });
+                },
+                _listenAllTaskBroadcast(){
+                    window.Echo.channel(this.allTaskBroadcastName).listen(this.channelName,(msg)=> {
                         console.log((new Date()).toTimeString(),msg);
                         let json = JSON.parse(msg.json);
                         if(!json||json.length===0)return;
-                        this.station['current_station_task']=json;
+                        this.task=json;
                     });
                 },
+                selectBatch(stationTaskBatch){
+                    this.current_stationTaskBatch=stationTaskBatch;
+                    if(typeof(this.current_stationTaskBatch.runningStatus)==='undefined')
+                        this.current_stationTaskBatch.runningStatus=''
+                },
                 manuallyTakeBoxOut(){
                     let text = this.inputs.manuallyTakeBox.text.trim();
                     if(!text){
                         alert('请输入料箱号')
                         return
-                    };
+                    }
                     axios.post('{{url('/api/thirdPart/haiq/storage/takeOutToULine')}}',{codes:text})
                         .then(function(response){
                             tempTip.okWindow(response.data.result,'确定')
@@ -351,36 +417,74 @@
                         this.inputs.manuallyTakeBox.text='';
                     })
                 },
+                runTheTaskBatch(){
+                    let _this=this;
+                    _this.current_stationTaskBatch.runningStatus='请求中';
+                    _this.$forceUpdate();
+                    axios.post('{{url('/api/thirdPart/haiq/runTaskBatch')}}',{station_task_batch_id:_this.current_stationTaskBatch.id})
+                        .then(function(response){
+                            if(!response.data.success){
+                                _this.current_stationTaskBatch.runningStatus='请求失败';
+                                return;
+                            }
+                            _this.current_stationTaskBatch.runningStatus='请求成功'
+                        }).catch(function(err){
+                        _this.current_stationTaskBatch.runningStatus='请求异常'
+                        tempTip.okWindow(err+': 服务器代码出错,请联系开发部门负责人','确定')
+                    }).finally(function(){
+                        _this.$forceUpdate();
+                    });
+                },
             },
             computed:{
                 task(){
-                    if(!this.station['current_station_task'])return null;
-                    return this.station['current_station_task'];
+                    if(!this.current_stationTaskBatch||typeof(this.stationTask_indexByBatch['_'+this.current_stationTaskBatch.batch_id])==='undefined')return null;
+                    return this.stationTask_indexByBatch['_'+this.current_stationTaskBatch.batch_id];
+                },
+                stationTasks(){
+                    if(!this.station)return;
+                    return this.station.station_tasks_today;
+                },
+                stationTaskBatches(){
+                    if(!this.stationTasks)return;
+                    let _this=this;
+                    let stationTaskBatches=[];
+                    this.stationTasks.forEach(function(stationTask){
+                        if(!stationTask.station_task_batches)return;
+                        stationTask.station_task_batches.forEach(function(stationTaskBatch){
+                            if(typeof(_this.stationTaskBatch_index['_'+stationTaskBatch.batch_id])==='undefined'){
+                                // if(stationTaskBatch_index['_'+stationTaskBatch.batch_id]['status']==='完成')return;
+                                stationTaskBatches.push(stationTaskBatch)
+                                _this.stationTaskBatch_index['_'+stationTaskBatch.batch_id]=stationTaskBatch;
+                                _this.stationTask_indexByBatch['_'+stationTaskBatch.batch_id]=stationTask;
+                            }
+                        })
+                    });
+                    return stationTaskBatches;
                 },
                 batchCode(){
-                    if(!this.task)return;
-                    let batches = this.task.station_task_batches;
-                    if(batches
-                        && Array.isArray(batches)
-                        && batches.length>0
+                    let _this=this;
+                    if(!this.current_stationTaskBatch)return;
+                    if(typeof(this.current_stationTaskBatch)!=='undefined'
+                        && typeof(this.current_stationTaskBatch.batch)!=='undefined'
                     ){
                         setTimeout(function (){
-                            setBarcode(batches[0].batch.code,"#barcode",1,50,false);
+                            setBarcode(_this.current_stationTaskBatch.batch.code,"#barcode",1,50,false);
                         })
                     }
-                    return batches[0].batch.code;
+                    return this.current_stationTaskBatch.batch.code;
                 },
                 taskCommodities(){
                     if(!this.task)return [];
-                    return this.station['current_station_task']['station_task_commodities'];
+                    return this.task['station_task_commodities'];
                 },
                 taskCommoditiesListByBin(){
                     if(!this.task)return [];
                     function reIndexByBin() {
                         this.taskCommoditiesListByBinVar = [];
-                        this.taskCommoditiesListByBinVar.md5 = md5(JSON.stringify(this.station['current_station_task']['station_task_commodities']));
+                        this.taskCommoditiesListByBinVar.md5 = md5(JSON.stringify(this.task['station_task_commodities']));
                         let _this=this;
-                        this.station['current_station_task']['station_task_commodities']
+                        this.task['station_task_commodities']
                             .forEach(function (taskCommodity) {
                                 if (typeof (_this.taskCommoditiesListByBinVar[taskCommodity['bin_number']]) === 'undefined') {
                                     _this.taskCommoditiesListByBinVar[taskCommodity['bin_number']] = null;
@@ -393,7 +497,7 @@
                     if((typeof this.taskCommoditiesListByBinVar)==='undefined'||!this.taskCommoditiesListByBinVar){
                         return reIndexByBin.call(this);
                     }
-                    let md5Now = md5(JSON.stringify(this.station['current_station_task']['station_task_commodities']));
+                    let md5Now = md5(JSON.stringify(this.task['station_task_commodities']));
 
                     if(this.taskCommoditiesListByBinVar.md5!==md5Now){
                         return reIndexByBin.call(this);
@@ -556,6 +660,12 @@
                     }
 
                 },
+            },
+            filters:{
+                simplifyBatchCode(val){
+                    if(!val){return ''}
+                    return val.replace(/W\d{6}0*/,'').trim()
+                }
             }
         });
     </script>

+ 2 - 1
resources/views/store/inStorage/cacheRackStorage.blade.php

@@ -32,7 +32,7 @@
                         <input type="text" class="form-control rounded col-sm-5 col-8 ml-sm-1 ml-2" :class="errors.barCode ? 'is-invalid' : ''" id="barCode" @blur="codeBlur()" @keydown.enter="checkInfo()" v-model="info.barCode">
                         <div class="input-group-append mt-sm-0 mt-4">
                             <span class="input-group-text d-none d-sm-block">@数量</span>
-                            <label class="d-sm-none col-4 text-right">数量:</label>
+                            <label for="amount" class="d-sm-none col-4 text-right">数量:</label>
                             <span class="input-group-text p-0 border-0">
                                 <input class="form-control" type="number" :class="errors.amount ? 'is-invalid' : ''" step="1" min="1" id="amount" v-model="info.amount">
                             </span>
@@ -105,6 +105,7 @@
                     this._exeTask();
                 },
                 _exeTask(){
+                    window.tempTip.postBasicRequest("{{url('')}}");
                     console.log("ok");
                     //入库成功
                     this.info = {};

+ 1 - 1
resources/views/transport/waybill/_dailyBilling.blade.php

@@ -9,7 +9,7 @@
             </div>
             <div class="modal-body">
                 <div class="form-group row">
-                    <label for="screenDate" class="col-2 col-form-label text-right">选定日期</label>
+                    <label for="screenDate" class="col-2 col-form-label text-right">选定发货日期</label>
                     <div class="col-8">
                         <input type="date" class="form-control" :class="error.screenDate ? 'is-invalid' : ''" name="screenDate" autocomplete="off"  v-model="dailyBilling.screenDate" >
                         <span class="invalid-feedback" role="alert" v-if="error.screenDate">

+ 2 - 2
resources/views/transport/waybill/index.blade.php

@@ -335,7 +335,8 @@
                         amount:'{{$waybill->amount}}',
                         @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif
                             @can('运输管理-运单-可见费用项') fee:'{{$waybill->fee}}',
-                        pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
+                        pick_up_fee:'{{$waybill->pick_up_fee? round($waybill->pick_up_fee) :''}}',
+                        other_fee:'{{$waybill->other_fee}}',
                         collect_fee:'{{$waybill->collect_fee}}', @endcan
                         deliver_at:'{{$waybill->deliver_at}}',
                         dispatch_remark:'{{$waybill->dispatch_remark}}',
@@ -431,7 +432,6 @@
                     param:param,
                 });
                 this.form.init();
-                console.log(this.form)
                 this.rendingHeader();
                 this.paginate = $("#paginate").val();
                 let waybill =  $('.table-header-layer-1')[1];

+ 3 - 0
routes/api/thirdPart/haiq.php

@@ -27,3 +27,6 @@ Route::group(['prefix'=>'pickStation'],function(){
 Route::group(['prefix'=>'light'],function(){
     Route::post('update', "LightController@update");//移库
 });
+
+
+Route::post('runTaskBatch', "HaiRoboticsController@runTaskBatch");//启动taskBatch任务

+ 1 - 1
routes/web.php

@@ -21,7 +21,7 @@ Route::get('/', function () {
 Route::any('test/{method}', 'TestController@method'); //测试
 
 /** 称重广播 */
-Route::post('package/weigh/measureMonitor/speech','MeasureMonitorController@speech')->middleware("check.token");
+Route::post('package/weigh/measureMonitor/speech','MeasureMonitorController@speech');
 
 Auth::routes();
 

+ 4 - 4
tests/Services/BatchService/AssignTasksTest.php

@@ -24,8 +24,8 @@ class AssignTasksTest extends TestCase
     /** @var BatchService $service */
     public $service;
     private $data;
-    private $batchAmount=2;
-    private $orderAmount=4;
+    private $batchAmount=3;
+    private $orderAmount=5;
     private $orderCommodityAmount=8;
     function setUp(): void
     {
@@ -82,8 +82,8 @@ class AssignTasksTest extends TestCase
         $this->service->assignTasks($this->data['batches']);
         ($波次任务指向了波次=function(){
             $this->data['batches']->load('stationTaskBatch');
-            dump(data_get($this->data['batches'],'*.id'),data_get($this->data['batches'],'*.stationTaskBatch.batch_id'));
-            dd(array_diff(data_get($this->data['batches'],'*.id'),data_get($this->data['batches'],'*.stationTaskBatch.batch_id')));
+//            dump(data_get($this->data['batches'],'*.id'),data_get($this->data['batches'],'*.stationTaskBatch.batch_id'));
+//            dd(array_diff(data_get($this->data['batches'],'*.id'),data_get($this->data['batches'],'*.stationTaskBatch.batch_id')));
             $this->assertEquals(
                 data_get($this->data['batches'],'*.id'),
                 data_get($this->data['batches'],'*.stationTaskBatch.batch_id')

+ 5 - 5
tests/Services/CacheService/GetOrExecuteTest.php

@@ -26,10 +26,10 @@ class GetOrExecuteTest extends TestCase
         $this->assertEquals('yes',Cache::pull($key));//销毁
     }
 
-    public function testNullFunction(){
-        $this->expectException(\Exception::class);
-        $key = md5(microtime(true));
-        $this->cacheService->getOrExecute($key,null);
-    }
+//    public function testNullFunction(){
+//        $this->expectException(\Exception::class);
+//        $key = md5(microtime(true));
+//        $this->cacheService->getOrExecute($key,null);
+//    }
 
 }

+ 18 - 16
tests/Services/CacheShelfService/ProcessTest.php

@@ -56,6 +56,7 @@ class ProcessTest extends TestCase
     {
 
         $result = $this->cacheShelfService->createStationTask($this->data['localCode'], $this->data['boxCode']);
+        dump($result);
         $this->assertTrue($result['success'], '当前站已有为完成的任务');
 
         $station = Station::query()->where('code', $this->data['localCode'])->first();
@@ -79,6 +80,7 @@ class ProcessTest extends TestCase
         $this->assertNotEmpty($materialBox);
 
         $putStationTaskMaterialBox = StationTaskMaterialBox::query()->where('station_id', $this->data['station']['id'])->where('material_box_id', $materialBox['id'])->first();
+        dump($putStationTaskMaterialBox);
         $this->assertTrue($putStationTaskMaterialBox ? true : false);
         // 模拟海柔机器人放箱完成
         $result = $this->foreignHaiRoboticsService->taskUpdate($putStationTaskMaterialBox['id'], 1, 0, $this->data['boxCode']);
@@ -100,22 +102,22 @@ class ProcessTest extends TestCase
 
     protected function tearDown(): void
     {
-//        $station = Station::query()->with('parent')->where('code',$this->data['localCode'])->first();
-//        $materialBox = MaterialBox::query()->where('code',$this->data['boxCode'])->first();
-//        if($materialBox){
-//            $StationTaskMaterialBoxes = StationTaskMaterialBox::query()->where('material_box_id',$materialBox['id'])->get();
-//            foreach ($StationTaskMaterialBoxes as $stationTaskMaterialBox) {
-//                if($stationTaskMaterialBox->stationTask) {
-//                    StationTaskChildren::query()->where('station_task_id',$stationTaskMaterialBox->stationTask['id'])->delete();
-//                    $stationTaskMaterialBox->stationTask ? $stationTaskMaterialBox->stationTask->delete() : null;
-//                }
-//                $stationTaskMaterialBox->delete();
-//            }
-//        }
-//        if($station){
-//            $station->parent->delete();
-//            $station->delete();
-//        }
+        $station = Station::query()->with('parent')->where('code',$this->data['localCode'])->first();
+        $materialBox = MaterialBox::query()->where('code',$this->data['boxCode'])->first();
+        if($materialBox){
+            $StationTaskMaterialBoxes = StationTaskMaterialBox::query()->where('material_box_id',$materialBox['id'])->get();
+            foreach ($StationTaskMaterialBoxes as $stationTaskMaterialBox) {
+                if($stationTaskMaterialBox->stationTask) {
+                    StationTaskChildren::query()->where('station_task_id',$stationTaskMaterialBox->stationTask['id'])->delete();
+                    $stationTaskMaterialBox->stationTask ? $stationTaskMaterialBox->stationTask->delete() : null;
+                }
+                $stationTaskMaterialBox->delete();
+            }
+        }
+        if($station){
+            $station->parent->delete();
+            $station->delete();
+        }
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 

+ 0 - 55
tests/Services/CommodityBarcodeService/CreateBarcodeByWmsTest.php

@@ -1,55 +0,0 @@
-<?php
-
-
-namespace Tests\Services\CommodityBarcodeService;
-
-
-use App\OracleBasSKU;
-use App\Services\CommodityBarcodeService;
-use App\ValueStore;
-use Tests\TestCase;
-
-class CreateBarcodeByWmsTest extends TestCase
-{
-
-    /**
-     * @var CommodityBarcodeService $service
-     */
-    public $service;
-    public $bas_skus;
-    public $created_at;
-    public $commodityBarcodes;
-    public function setUp(): void
-    {
-        parent::setUp(); // TODO: Change the autogenerated stub
-        $this->created_at = config('sync.commodity_sync.created_at');
-        $last_time = ValueStore::query()->where('name', $this->created_at)->value('value');
-        $startDate = \Illuminate\Support\Carbon::now()->subSeconds(65);
-        $this->service = app(CommodityBarcodeService::class);
-        $this->bas_skus = OracleBasSKU::query()
-            ->select('customerid', 'sku', 'descr_c', 'alternate_sku1', 'alternate_sku2', 'alternate_sku3', 'skulength', 'skuwidth', 'skuhigh', 'cube', 'packid', 'addtime', 'edittime')
-            ->where('addTime', '>=', $last_time ?? $startDate)
-            ->orderByDesc('addtime')
-            ->get();
-
-    }
-
-    public function testCreateBarcodeByWms()
-    {
-
-        if ($this->bas_skus->isEmpty()) {
-            $this->assertEmpty($this->bas_skus);
-            return;
-        }
-        $this->service->createBarcodeByWms($this->bas_skus);
-        $this->commodityBarcodes=$this->service->getByWms($this->bas_skus);
-        if ($this->commodityBarcodes) $this->assertNotNull($this->commodityBarcodes);
-    }
-
-
-    public function tearDown(): void
-    {
-
-        parent::tearDown(); // TODO: Change the autogenerated stub
-    }
-}

+ 2 - 0
tests/Services/CommodityBarcodeService/InsertMany_onCommoditiesTest.php

@@ -35,9 +35,11 @@ class InsertMany_onCommoditiesTest extends TestCase
             ->where('commodity_id',$this->data['commodity']['id'])
             ->whereIn('code',$this->data['barcodes'])
             ->get();
+        $this->data['commodityBarcodes']=$this->data['commodityBarcodes']->sortBy('code');
         $resultArr=$this->data['commodityBarcodes']->map(function ($commodityBarcode){
             return [$commodityBarcode['commodity_id'],$commodityBarcode['code']];
         });
+        $resultArr=array_values($resultArr->toArray());
         $expectArr = (function () {
             $arr=[];
             foreach ($this->data['barcodes'] as $barcode) {

+ 1 - 1
tests/Services/CommodityService/GetParamsByBasSKUTest.php

@@ -18,7 +18,7 @@ class GetParamsByBasSKUTest extends TestCase
     public function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->service = app('CommodityService');
         $owner =  factory(Owner::class)->create();
         $basSKU = factory(OracleBasSKU::class)->make(['customerid'=>$owner->code,'packid'=>'STANDARD']);

+ 1 - 1
tests/Services/CommodityService/GetParamsByBasSkusTest.php

@@ -18,7 +18,7 @@ class GetParamsByBasSkusTest extends TestCase
     public function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->service=app(CommodityService::class);
         $owner =  factory(Owner::class)->create();
         $basSKU = factory(OracleBasSKU::class)->make(['customerid'=>$owner->code,'packid'=>'STANDARD']);

+ 0 - 2
tests/Services/CommodityService/Get_HasOwnerIdsAndSkusTest.php

@@ -19,7 +19,6 @@ class Get_HasOwnerIdsAndSkusTest extends TestCase
     public function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
         $this->service = app('CommodityService');
         $owner =  factory(Owner::class)->create();
         $commodity=factory(Commodity::class)->create(['owner_id'=>$owner->id]);
@@ -41,7 +40,6 @@ class Get_HasOwnerIdsAndSkusTest extends TestCase
         CommodityBarcode::query()->where('commodity_id',$commodity_id)->delete();
         $this->data['owner']->delete();
         $this->data['commodity']->delete();
-        cache()->flush();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 1 - 2
tests/Services/CommodityService/Get_OnlyownerIdsTest.php

@@ -11,7 +11,7 @@ use App\Owner;
 use App\Services\CommodityService;
 use Tests\TestCase;
 
-class Get_OnlyOwnerIdsTest extends TestCase
+class Get_OnlyownerIdsTest extends TestCase
 {
     /** @var CommodityService $service */
     private $service;
@@ -39,7 +39,6 @@ class Get_OnlyOwnerIdsTest extends TestCase
         CommodityBarcode::query()->where('commodity_id',$commodity_id)->delete();
         $this->data['owner']->delete();
         $this->data['commodity']->delete();
-        cache()->flush();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 0 - 49
tests/Services/CommodityService/Get_SyncAndSelectTest.php

@@ -1,49 +0,0 @@
-<?php
-
-
-namespace Tests\Services\CommodityService;
-
-
-use App\Commodity;
-use App\CommodityBarcode;
-use App\OracleBasSKU;
-use App\Owner;
-use App\Services\CommodityService;
-use Tests\TestCase;
-
-class Get_SyncAndSelect_Test extends TestCase
-{
-    /** @var CommodityService $service */
-    private $service;
-    private $data = [];
-    private $owner_id;
-    public function setUp(): void
-    {
-        parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
-        $this->service = app('CommodityService');
-        $owner =  factory(Owner::class)->create();
-        $commodity=factory(Commodity::class)->create(['owner_id'=>$owner->id]);
-        $this->data['owner'] = $owner;
-        $this->data['commodity'] = $commodity;
-        $this->data['basSku']=OracleBasSKU::query()->orderByDesc('edittime')->first();
-    }
-    public function testGet_SyncAndSelect()
-    {
-        //if ($this->data['basSku']) $this->assertNotNull($this->data['basSku']);
-        $this->owner_id=Owner::query()->where('code',$this->data['basSku']['customerid'])->value('id');
-        $commodities=$this->service->get_([$this->owner_id],[$this->data['basSku']['sku']],[],true);
-        $this->assertEquals($this->data['basSku']['sku'],$commodities->first()['sku']);
-    }
-
-    public function tearDown(): void
-    {
-        $commodity_id=Commodity::query()->where('owner_id',$this->owner_id)->value('id');
-        Commodity::query()->whereIn('owner_id',[$this->owner_id,$this->data['owner']['id']])->delete();
-        CommodityBarcode::query()->where('commodity_id',$commodity_id)->delete();
-        $this->data['owner']->delete();
-        $this->data['commodity']->delete();
-        cache()->flush();
-        parent::tearDown(); // TODO: Change the autogenerated stub
-    }
-}

+ 0 - 75
tests/Services/CommodityService/SyncCommodityCreatedTest.php

@@ -1,75 +0,0 @@
-<?php
-
-namespace Tests\Services\CommodityService;
-
-use App\Commodity;
-use App\OracleBasSKU;
-use App\Services\CommodityService;
-use App\Services\OwnerService;
-use App\ValueStore;
-use Carbon\Carbon;
-use Illuminate\Support\Facades\DB;
-use Tests\TestCase;
-
-class SyncCommodityCreatedTest extends TestCase
-{
-    /**
-     * @var CommodityService $service
-     */
-    public $service;
-    public $bas_skus;
-    public $created_at;
-    public $last_time;
-    public $insert_params;
-    public function setUp(): void
-    {
-        parent::setUp();
-        $this->service=app(CommodityService::class);
-    }
-
-    /**
-     * @test
-     */
-    public function testSyncCommodityCreated()
-    {
-        $this->created_at = config('sync.commodity_sync.created_at');
-        $this->last_time = ValueStore::query()->where('name',$this->created_at)->value('value');
-        if (!$this->last_time) $time=Carbon::now()->subSeconds(65);
-        $this->bas_skus=OracleBasSKU::query()
-            ->select('customerid','sku','descr_c','alternate_sku1','alternate_sku2','alternate_sku3','skulength','skuwidth','skuhigh','cube','packid','addtime','edittime')
-            ->where('addTime', '>=', $this->last_time??$time)
-            ->orderByDesc('addtime')
-            ->get();
-        $this->insert_params=$this->service->getParamsByBasSkus($this->bas_skus);
-        $this->service->syncCommodityCreated();
-        if ($this->insert_params) $this->assertNotNull($this->insert_params);
-        if ($this->insert_params)$this->assertEquals(count($this->insert_params),count($this->bas_skus));
-        if (!$this->insert_params)$this->assertNull($this->insert_params);
-    }
-
-    public function tearDown(): void
-    {
-        ValueStore::query()->updateOrCreate([
-            'name' => $this->created_at,
-        ], [
-            'name' => $this->created_at,
-            'value' => $this->last_time,
-        ]);
-        $sku=[];
-        $owner_id=[];
-        if (!$this->insert_params) return;
-        foreach ($this->insert_params as $insert_param){
-            $owner_id[]=$insert_param['owner_id'];
-            $sku[]=$insert_param['sku'];
-        }
-        $commodities=Commodity::query()->whereIn('owner_id',$owner_id)->whereIn('sku',$sku)->get();
-        $commodity_id=[];
-        foreach ($commodities as $commodity){
-            $commodity_id[]=$commodity->id;
-        }
-        DB::table('commodities')->whereIn('id',$commodity_id)->delete();
-        DB::table('commodity_barcodes')->whereIn('commodity_id',$commodity_id)->delete();
-        cache()->flush();
-        parent::tearDown(); // TODO: Change the autogenerated stub
-    }
-}

+ 0 - 102
tests/Services/CommodityService/SyncCommodityUpdatedTest.php

@@ -1,102 +0,0 @@
-<?php
-
-namespace Tests\Services\CommodityService;
-
-use App\Commodity;
-use App\OracleBasSKU;
-use App\Services\CommodityService;
-use App\Services\common\DataHandlerService;
-use App\Services\OwnerService;
-use App\ValueStore;
-use Carbon\Carbon;
-use Illuminate\Support\Facades\DB;
-use Tests\TestCase;
-
-class SyncCommodityUpdatedTest extends TestCase
-{
-    /**
-     * @var CommodityService $service
-     */
-    public $service;
-    public $bas_skus;
-    public $updated_at;
-    public $last_time;
-    public $commodities;
-    public function setUp(): void
-    {
-        parent::setUp();
-        $this->service=app(CommodityService::class);
-    }
-
-    /**
-     * @test
-     */
-    public function testSyncCommodityUpdated()
-    {
-        $this->updated_at = config('sync.commodity_sync.updated_at');
-        $this->last_time = ValueStore::query()->where('name',$this->updated_at)->value('value');
-        if (!$this->last_time) $time=Carbon::now()->subSeconds(65);
-        $this->bas_skus= OracleBasSKU::query()
-            ->select('customerid','sku','descr_c','alternate_sku1','alternate_sku2','alternate_sku3','skulength','skuwidth','skuhigh','cube','packid','addtime','edittime')
-            ->where('EditTime', '>=', $this->last_time??$time)
-            ->whereColumn('EditTime', '<>', 'addTime')
-            ->orderByDesc('EditTime')
-            ->get();
-
-        $this->service->syncCommodityUpdated();
-        $owner_sku_map = [];
-        $sku = [];
-        $this->bas_skus->each(function ($addBasSku) use (&$owner_sku_map, &$sku) {
-            if (!empty($addBasSku['customerid']) && !empty($addBasSku['sku'])) {
-                $key = "owner_code_{$addBasSku['customerid']}_sku_{$addBasSku['sku']}";
-                $owner_sku_map[$key] = ['owner_code' => $addBasSku['customerid'], 'sku' => $addBasSku['sku']];
-                $sku[] = $addBasSku['sku'];
-            }
-        });
-        /**
-         * @var OwnerService $ownerService
-         */
-        $ownerService = app(OwnerService::class);
-        $owner_codes = (function () use ($owner_sku_map) {
-            $owner_codes = [];
-            if (count($owner_sku_map) == 0) return $owner_codes;
-            foreach ($owner_sku_map as $item) {
-                $owner_codes[$item['owner_code']] = $item['owner_code'];
-            }
-            return $owner_codes;
-        })();
-        $owner_id = (function () use ($ownerService, $owner_codes) {
-            $owners = $ownerService->getOwnerByCodes($owner_codes);
-            $map = [];
-            $owners->each(function ($owner) use (&$map) {
-                $map[] = $owner['id'];
-            });
-            return $map;
-        })();
-        $this->commodities = Commodity::query()
-            ->whereIn('owner_id', array_unique($owner_id))
-            ->whereIn('sku', array_unique($sku))
-            ->groupBy('owner_id', 'sku')
-            ->get();
-        $this->assertNotNull($this->commodities);
-        $this->assertEquals(count($this->bas_skus),count($this->commodities));
-    }
-
-    public function tearDown(): void
-    {
-        ValueStore::query()->updateOrCreate([
-            'name' => $this->updated_at,
-        ], [
-            'name' => $this->updated_at,
-            'value' => $this->last_time,
-        ]);
-        $commodityIds=[];
-        foreach ($this->commodities as $commodity){
-            array_push($commodityIds,$commodity->id);
-        }
-        DB::table('commodities')->whereIn('id',$commodityIds)->delete();
-        DB::table('commodity_barcodes')->whereIn('commodity_id',$commodityIds)->delete();
-        cache()->flush();
-        parent::tearDown(); // TODO: Change the autogenerated stub
-    }
-}

+ 2 - 2
tests/Services/CommodityService/SyncCreateCommodityByBasSkusTest.php

@@ -26,7 +26,7 @@ class SyncCreateCommodityByBasSkusTest extends TestCase
     public function setUp(): void
     {
         parent::setUp();
-        cache()->flush();
+
         $this->service=app(CommodityService::class);
         $owner =  factory(Owner::class)->create();
         $basSKU = factory(OracleBasSKU::class)->make(['customerid'=>$owner->code,'packid'=>'STANDARD']);
@@ -79,7 +79,7 @@ class SyncCreateCommodityByBasSkusTest extends TestCase
         }
         DB::table('commodities')->whereIn('id',$commodity_id)->delete();
         DB::table('commodity_barcodes')->whereIn('commodity_id',$commodity_id)->delete();
-        cache()->flush();
+
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 2 - 2
tests/Services/CommodityService/SyncUpdateCommodityBasSkusTest.php

@@ -27,7 +27,7 @@ class SyncUpdateCommodityBasSkusTest extends TestCase
     public function setUp(): void
     {
         parent::setUp();
-        cache()->flush();
+
         $this->service=app(CommodityService::class);
         $owner =  factory(Owner::class)->create();
         $basSKU = factory(OracleBasSKU::class)->make(['customerid'=>$owner->code,'packid'=>'STANDARD']);
@@ -106,7 +106,7 @@ class SyncUpdateCommodityBasSkusTest extends TestCase
         }
         DB::table('commodities')->whereIn('id',$commodityIds)->delete();
         DB::table('commodity_barcodes')->whereIn('commodity_id',$commodityIds)->delete();
-        cache()->flush();
+
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 1 - 1
tests/Services/FeatureService/FeatureServiceTest.php

@@ -37,7 +37,7 @@ class FeatureServiceTest extends TestCase
         $str = $this->data["models"][0]["id"]."&(".$this->data["models"][1]["id"]."|".$this->data["models"][2]["id"].")";
         $result = $this->service->translationFeature($str);
         $this->assertEquals(3,count($result));
-        $this->assertEquals($this->data["models"][1]["type"],$result[1]["type"]);
+//        $this->assertEquals($this->data["models"][1]["type"],$result[1]["type"]);
         $this->assertEquals(false,$result[0]["strategyGroupStartSign"]);
         $this->assertEquals(true,$result[1]["strategyGroupStartSign"]);
         $this->assertEquals("并且",$result[1]["calculation"]);

+ 1 - 1
tests/Services/ForeignHaiRoboticsService/TempMarkBinProcessedTest.php

@@ -19,7 +19,7 @@ use App\StationTaskMaterialBox;
 use Tests\TestCase;
 use App\Traits\TestMockSubServices;
 
-class MarkBinProcessedTest extends TestCase
+class TempMarkBinProcessedTest extends TestCase
 {
     use TestMockSubServices;
 

+ 1 - 1
tests/Services/LogisticQiaoSFService/LogisticQiaoSFServiceTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace LogisticQiaoSFService;
+namespace Tests\Services\LogisticQiaoSFService;
 
 use App\Services\LogisticSFService;
 use Tests\TestCase;

+ 1 - 2
tests/Services/LogisticService/GetLogisticByCodeTest.php

@@ -18,8 +18,7 @@ class GetLogisticByCodeTest extends TestCase
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $this->service = app('LogisticService');
-        $logistic = factory(Logistic::class)->create(['code'=>'AABBCCDD1']);
-
+        $logistic = factory(Logistic::class)->create();
         $basCustomer = factory(OracleBasCustomer::class)->make(["customer_type"=>'OW',"customerid"=>$logistic->code]);
         $this->data['basCustomers'] = $basCustomer;
         $this->data['logistic'] = $logistic;

+ 4 - 1
tests/Services/LogisticTimingService/FindByParamsTest.php

@@ -7,6 +7,7 @@ use App\Logistic;
 use App\Province;
 use App\Services\LogisticTimingService;
 use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\DB;
 use Tests\TestCase;
 
 class FindByParamsTest extends TestCase
@@ -21,7 +22,9 @@ class FindByParamsTest extends TestCase
         parent::setUp();
         $this->logisticTimingService = app(LogisticTimingService::class);
 
-        factory(Logistic::class)->create(['name'=>'新杰物流','code'=>'XJWL']);
+//        factory(Logistic::class)->create(['name'=>'新杰物流','code'=>'XJWL']);
+        DB::insert('insert ignore into logistics (name,code) values(?, ?)',['新杰物流', 'XJWL']);
+
         $province = null;
         if(!Province::query()->where('name','like','江苏')->exists())
             $province = factory(Province::class)->create(['name'=>'江苏']);

+ 7 - 7
tests/Services/LogisticYDService/FormatTest.php

@@ -35,11 +35,11 @@ class FormatTest extends TestCase
     /**
      * @test
      */
-    public function format_test()
-    {
-        $this->service->registerApi(['4314543143889']);
-        $result = $this->service->format($this->service->query('4314543143889'));
-        $this->assertNotEmpty($result);
-
-    }
+//    public function format_test()
+//    {
+//        $this->service->registerApi(['4314543143889']);
+//        $result = $this->service->format($this->service->query('4314543143889'));
+//        $this->assertNotEmpty($result);
+//
+//    }
 }

+ 5 - 5
tests/Services/LogisticYDService/LogisticYDSyncTest.php

@@ -34,9 +34,9 @@ class LogisticYDSyncTest extends TestCase
     /**
      * @test
      */
-    public function sync_test()
-    {
-        LogisticYDSync::dispatch('4314543143889');
-        $this->assertTrue(OrderPackage::query()->where('logistic_number','4314543143889')->first()->transfer_status);
-    }
+//    public function sync_test()
+//    {
+//        LogisticYDSync::dispatch('4314543143889');
+//        $this->assertTrue(OrderPackage::query()->where('logistic_number','4314543143889')->first()->transfer_status);
+//    }
 }

+ 11 - 11
tests/Services/LogisticYDService/QueryTest.php

@@ -1,7 +1,7 @@
 <?php
 
 
-namespace LogisticYDService;
+namespace Tests\Services\LogisticYDService;
 
 use App\OrderPackage;
 use App\Services\LogisticYDService;
@@ -26,19 +26,19 @@ class QueryTest extends TestCase
     /**
      * @test
      */
-    public function queryTest()
-    {
-        $this->service->query('340987657890876');
-    }
+//    public function queryTest()
+//    {
+//        $this->service->query('340987657890876');
+//    }
 
 
     /**
      * @test
      */
-    public function prod_test()
-    {
-       $response = $this->service->query('4314519335027');
-        dump($response);
-        $this->assertEquals('0000', $response->code);
-    }
+//    public function prod_test()
+//    {
+//       $response = $this->service->query('4314519335027');
+//        dump($response);
+//        $this->assertEquals('0000', $response->code);
+//    }
 }

+ 11 - 16
tests/Services/LogisticYDService/RegisterApiTest.php

@@ -1,7 +1,7 @@
 <?php
 
 
-namespace LogisticYDService;
+namespace Tests\Services\LogisticYDService;
 
 use App\OrderPackage;
 use App\Services\LogisticYDService;
@@ -65,28 +65,23 @@ class RegisterApiTest extends TestCase
             "Content-Type" => "application/json"
         ];
         $response = Http::withHeaders($headers)->withBody(json_encode($body,JSON_UNESCAPED_UNICODE),'application/json')->post($this->url);
-        dump([
-            'url' => $this->url,
-            'headers' => $headers,
-            'body' => $body,
-            'response' => $response->body(),
-        ]);
+        $this->assertNotEmpty($response);
     }
 
     /**
      * @test
      */
-    public function registerApiTest2()
-    {
-        $this->service->registerApi(['75464485214976','75464484634676']);
-    }
+//    public function registerApiTest2()
+//    {
+//        $this->service->registerApi(['75464485214976','75464484634676']);
+//    }
 
     /**
      * @test
      */
-    public function prod_test()
-    {
-        $result = $this->service->registerApi(['4314519335027']);
-        $this->assertEquals('0000', $result->code);
-    }
+//    public function prod_test()
+//    {
+//        $result = $this->service->registerApi(['4314519335027']);
+//        $this->assertEquals('0000', $result->code);
+//    }
 }

+ 9 - 4
tests/Services/LogisticYTOService/FormatTest.php

@@ -3,6 +3,7 @@
 namespace Tests\Services\LogisticYTOService;
 
 use App\Services\LogisticYDService;
+use App\Services\LogisticYTOService;
 use Tests\TestCase;
 use App\LogisticYD;
 use App\Traits\TestMockSubServices;
@@ -11,7 +12,7 @@ class FormatTest extends TestCase
 {
     use TestMockSubServices;
 
-    /** @var LogisticYDService $service */
+    /** @var LogisticYTOService $service */
     public $service;
     private $data;
     private $amount = 2;
@@ -27,9 +28,13 @@ class FormatTest extends TestCase
      */
     public function format_test()
     {
-        $result = $this->service->format($this->service->query('YT5481469185320'));
-        dump($result);
-        $this->assertNotEmpty($result);
+        $response=$this->service->query('YT5481469185320');
+        if (is_object($response))$this->assertEquals('1001', $response->code);
+        if (!is_object($response)){
+            $this->assertNotEmpty($response);
+            $result = $this->service->format($response);
+            $this->assertNotEmpty($result);
+        }
 
     }
 }

+ 4 - 4
tests/Services/LogisticYTOService/QueryTest.php

@@ -1,17 +1,18 @@
 <?php
 
 
-namespace LogisticYTOService;
+namespace Tests\Services\LogisticYTOService;
 
 use App\OrderPackage;
 use App\Services\LogisticYDService;
+use App\Services\LogisticYTOService;
 use Illuminate\Support\Facades\Http;
 use Tests\TestCase;
 
 class QueryTest extends TestCase
 {
     /**
-     * @var $service LogisticYDService
+     * @var LogisticYTOService $service
      */
     private $service;
 
@@ -27,8 +28,7 @@ class QueryTest extends TestCase
      */
     public function prod_test()
     {
-//        'YT5481469185320';YT3153735030684
-       $response = $this->service->query('YT5481469185320');
+       $response = $this->service->query('YT5487281295636');
        dump($response);
        if (is_object($response))$this->assertEquals('1001', $response->code);
        if (!is_object($response))$this->assertNotEmpty($response);

+ 11 - 11
tests/Services/LogisticZopService/LogisticZopServiceTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace LogisticZopService;
+namespace Tests\Services\LogisticZopService;
 
 use App\Services\LogisticZopService;
 use Carbon\Carbon;
@@ -24,19 +24,19 @@ class LogisticZopServiceTest extends TestCase
     /**
      * @test
      */
-    public function get_test()
-    {
-        $result = $this->logisticZopService->get(['75453288899284']);
-        dd($result);
-    }
+//    public function get_test()
+//    {
+//        $result = $this->logisticZopService->get(['75453288899284']);
+//        dd($result);
+//    }
 
     /**
      * @test
      */
-    public function carbon_test()
-    {
-        $result =Carbon::parse(1617293640000)->toDateTimeString();
-        dd($result);
-    }
+//    public function carbon_test()
+//    {
+//        $result =Carbon::parse(1617293640000)->toDateTimeString();
+//        dd($result);
+//    }
 
 }

+ 1 - 1
tests/Services/NewOrderCountingRecordService/GetFromCacheTest.php

@@ -29,7 +29,7 @@ class GetFromCacheTest extends TestCase
     protected function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
         $this->actingAs(factory(User::class)->create(['name' => 'yang']));
         $owners = factory(Owner::class)->times(2)->create();

+ 1 - 1
tests/Services/NewOrderCountingRecordService/GetFromLowerUnitTest.php

@@ -29,7 +29,7 @@ class GetFromLowerUnitTest extends TestCase
     protected function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
         $this->actingAs(factory(User::class)->create(['name' => 'yang']));
         $owners = factory(Owner::class)->times(2)->create();

+ 0 - 116
tests/Services/NewOrderCountingRecordService/GetFromMiddleTableTest.php

@@ -1,116 +0,0 @@
-<?php
-
-namespace NewOrderCountingRecordService;
-
-
-use App\Order;
-use App\OrderCountingRecord;
-use App\Owner;
-use App\Services\NewOrderCountingRecordService;
-use App\User;
-use Carbon\Carbon;
-use Illuminate\Database\Eloquent\Collection;
-use Tests\TestCase;
-
-class GetFromMiddleTableTest extends TestCase
-{
-    protected $newOrderCountingRecordService;
-    protected $queryConditionDay;
-    protected $queryConditionWeek;
-    protected $queryConditionMonth;
-    protected $queryConditionYear;
-    protected $ownerIds;
-    protected $cache_key = 'order_counting_records_';
-    protected $step_length = 1;
-    protected $orderCountingRecordIds = [];
-    protected $units = ['日', '月', '年'];
-    protected $orderIds;
-
-
-    protected function setUp(): void
-    {
-        parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
-        $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
-        $this->actingAs(factory(User::class)->create(['name' => 'yang']));
-        $owners = factory(Owner::class)->times(2)->create();
-        $this->ownerIds = array_column($owners->toArray(), 'id');
-        $this->queryConditionDay = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subDays($this->step_length)->toDateString(), Carbon::now()->toDateString(), '日', $this->ownerIds);
-        $this->queryConditionMonth = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subMonths($this->step_length)->toDateString(), Carbon::now()->toDateString(), '月', $this->ownerIds);
-        $this->queryConditionYear = $this->newOrderCountingRecordService->transfersToCondition(Carbon::now()->subYears($this->step_length)->toDateString(), Carbon::now()->toDateString(), '年', $this->ownerIds);
-    }
-
-    protected function tearDown(): void
-    {
-        Owner::destroy($this->ownerIds);
-        OrderCountingRecord::destroy($this->orderCountingRecordIds);
-        Order::destroy($this->orderIds);
-        OrderCountingRecord::query()->whereIn('owner_id', $this->ownerIds)->delete();
-        parent::tearDown();
-    }
-
-    /**
-     * 中间表没有任何数据
-     * @test
-     */
-    public function data_empty()
-    {
-        $result = $this->newOrderCountingRecordService->getFromMiddleTable($this->queryConditionDay);
-        $this->assertEquals([
-            0 => new Collection(),
-            ['unit' => '日',
-                'data' => [
-                    Carbon::now()->subDays(1)->toDateString() => [0 => $this->ownerIds[0], 1 => $this->ownerIds[1]],
-                    Carbon::now()->subDays(0)->toDateString() => [0 => $this->ownerIds[0], 1 => $this->ownerIds[1]],
-                ]]], $result);
-    }
-
-
-    /**
-     * 中间表命中全部数据
-     * @test
-     */
-    public function data_all()
-    {
-        $orderCountingRecords = collect();
-        foreach ($this->ownerIds as $owner_id) {
-            for ($i = 1; $i >= 0; $i--) {
-                $orderCountingRecords->push(factory(OrderCountingRecord::class)->create([
-                    'date_target' => Carbon::now()->subDays($i)->toDateString(),
-                    'owner_id' => $owner_id,
-                ]));
-            }
-        }
-        $this->orderCountingRecordIds = array_column($orderCountingRecords->toArray(), 'id');
-        $result = $this->newOrderCountingRecordService->getFromMiddleTable($this->queryConditionDay);
-        $orderCountingRecords = OrderCountingRecord::query()->whereIn('owner_id', $this->ownerIds)->orderByDesc('owner_id')->get();
-
-        $this->assertEquals([
-            0 => $orderCountingRecords,
-            ['unit' => '日','data'=>[]]], $result);
-    }
-
-    /**
-     * 中间表命中部分数据
-     * @test
-     */
-    public function data_some()
-    {
-        $orderCountingRecords = collect();
-        foreach ($this->ownerIds as $owner_id) {
-            for ($i = 0; $i >= 0; $i--) {
-                $orderCountingRecords->push(factory(OrderCountingRecord::class)->create([
-                    'date_target' => Carbon::now()->subDays($i)->toDateString(),
-                    'owner_id' => $owner_id,
-                ]));
-            }
-        }
-        $this->orderCountingRecordIds = array_column($orderCountingRecords->toArray(), 'id');
-
-        $result = $this->newOrderCountingRecordService->getFromMiddleTable($this->queryConditionDay);
-        $this->assertEquals(
-            ['unit' => '日','data' => [
-                Carbon::now()->subDays(1)->toDateString() => [0 => $this->ownerIds[0], 1 => $this->ownerIds[1]],//昨天的数据没放在缓存,应该在data中返回
-            ]], $result[1]);
-    }
-}

+ 2 - 2
tests/Services/NewOrderCountingRecordService/GetOrderCountingRecordsTest.php

@@ -32,7 +32,7 @@ class GetOrderCountingRecordsTest extends TestCase
     protected function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
         $this->actingAs(factory(User::class)->create(['name' => 'yang']));
         $owners = factory(Owner::class)->times(2)->create();
@@ -44,7 +44,7 @@ class GetOrderCountingRecordsTest extends TestCase
 
     protected function tearDown(): void
     {
-        cache()->flush();
+
         Owner::destroy($this->ownerIds);
         OrderCountingRecord::destroy($this->orderCountingRecordIds);
         Order::destroy($this->orderIds);

+ 2 - 2
tests/Services/NewOrderCountingRecordService/OrderCountingRecordsTest.php

@@ -31,7 +31,7 @@ class OrderCountingRecordsTest extends TestCase
     protected function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
         $user = User::query()->where('name', 'yang')->first();
         $this->actingAs($user);
@@ -44,7 +44,7 @@ class OrderCountingRecordsTest extends TestCase
 
     protected function tearDown(): void
     {
-        cache()->flush();
+
         Owner::destroy($this->ownerIds);
         orderCountingRecord::destroy($this->orderCountingRecordIds);
         parent::tearDown();

+ 3 - 3
tests/Services/NewOrderCountingRecordService/TransfersToConditionsTest.php

@@ -20,7 +20,7 @@ class TransfersToConditionsTest extends TestCase
     protected function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->newOrderCountingRecordService = new NewOrderCountingRecordService();
         $user = User::query()->where('name', 'yang')->first();
         $this->actingAs($user);
@@ -40,7 +40,7 @@ class TransfersToConditionsTest extends TestCase
 
     protected function tearDown(): void
     {
-        cache()->flush();
+
         Owner::destroy(data_get($this->data['owners'],'*.id'));
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
@@ -98,7 +98,7 @@ class TransfersToConditionsTest extends TestCase
                     return $date->toDateString();
                 },$datesExpected);
                 $actualDays = array_keys($result['data']);
-                $this->assertEquals($datesExpected, $actualDays);
+                $this->assertEquals(array_filter($datesExpected), $actualDays);
             }
         }
     }

+ 12 - 4
tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnStartDateTest.php

@@ -8,19 +8,23 @@ use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\DB;
 use Tests\TestCase;
 
 class GetWMSOrderOnStartDateTest extends TestCase
 {
     /** @var OracleDOCOrderHeaderService $service */
     public $service;
+    public $owner;
 
     public function setUp(): void
     {
         parent::setUp();
         $this->service = app(OracleDOCOrderHeaderService::class);
+        DB::insert('insert ignore into owners (code) values(?)',['WANLING']);
+        $this->owner=Owner::query()->where('code','WANLING')->first();
         factory(OrderTrackingOwner::class)->create([
-            'owner_id'=>factory(Owner::class)->create(['user_owner_group_id'=>null,'code'=>'WANLING'])->id,
+            'owner_id'=>$this->owner->id,
             'status'=>'启用']);
     }
 
@@ -37,8 +41,12 @@ class GetWMSOrderOnStartDateTest extends TestCase
         $carbon =Carbon::parse($orderHeader->addtime)->subMinutes(5);
         $orderHeaders = $this->service->getWMSOrderOnStartDate($carbon);
         $this->assertNotNull($orderHeaders);
-        $orderHeader = $orderHeaders->first();
-        $this->assertNotNull($orderHeader);
+//        $orderHeader = $orderHeaders->first();
+//        $this->assertNotNull($orderHeader);
+    }
+    public function tearDown(): void
+    {
+        $this->owner->delete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
     }
-
 }

+ 10 - 1
tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnStartDateEditTest.php

@@ -8,19 +8,23 @@ use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\DB;
 use Tests\TestCase;
 
 class GetWmsOrderOnStartDateEditTest extends TestCase
 {
     /** @var OracleDOCOrderHeaderService $service */
     public $service;
+    public $owner;
 
     public function setUp(): void
     {
         parent::setUp();
+        DB::insert('insert ignore into owners (code) values(?)',['WANLING']);
+        $this->owner=Owner::query()->where('code','WANLING')->first();
         $this->service = app(OracleDOCOrderHeaderService::class);
         factory(OrderTrackingOwner::class)->create([
-            'owner_id'=>factory(Owner::class)->create(['user_owner_group_id'=>null,'code'=>'WANLING'])->id,
+            'owner_id'=>$this->owner->id,
             'status'=>'启用']);
      }
 
@@ -47,4 +51,9 @@ class GetWmsOrderOnStartDateEditTest extends TestCase
         $this->assertNotNull($orderHeader->oracleBASCustomer);
         $this->assertNotNull($orderHeader->oracleBASCode);
     }
+    public function tearDown(): void
+    {
+        $this->owner->delete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
 }

+ 10 - 1
tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnstartDateCreateTest.php

@@ -9,19 +9,23 @@ use App\Services\OracleDOCOrderHeaderService;
 use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
 use Illuminate\Foundation\Testing\WithFaker;
+use Illuminate\Support\Facades\DB;
 use Tests\TestCase;
 
 class GetWmsOrderOnstartDateCreateTest extends TestCase
 {
     /** @var OracleDOCOrderHeaderService $service */
     public $service;
+    public $owner;
 
     public function setUp(): void
     {
         $this->service = app(OracleDOCOrderHeaderService::class);
         parent::setUp();
+        DB::insert('insert ignore into owners (code) values(?)',['WANLING']);
+        $this->owner=Owner::query()->where('code','WANLING')->first();
         factory(OrderTrackingOwner::class)->create([
-            'owner_id'=>factory(Owner::class)->create(['user_owner_group_id'=>null,'code'=>'WANLING'])->id,
+            'owner_id'=>$this->owner->id,
             'status'=>'启用']);
     }
 
@@ -42,4 +46,9 @@ class GetWmsOrderOnstartDateCreateTest extends TestCase
         $this->assertNotNull($orderHeader->oracleBASCustomer);
         $this->assertNotNull($orderHeader->oracleBASCode);
     }
+    public function tearDown(): void
+    {
+        $this->owner->delete();
+        parent::tearDown(); // TODO: Change the autogenerated stub
+    }
 }

+ 1 - 1
tests/Services/OrderCommodityService/SyncOrderCommodityTest.php

@@ -80,7 +80,7 @@ class SyncOrderCommodityTest extends TestCase
 
     public function tearDown(): void
     {
-        cache()->flush();
+
         Order::query()->whereIn('id',data_get($this->data['orders'],'*.id'))->delete();
         Owner::query()->whereIn('id',data_get($this->data['owners'],'*.id'))->delete();
         Commodity::query()->whereIn('id',data_get($this->data['commodities'],'*.id'))->delete();

+ 1 - 1
tests/Services/OrderPackageCommoditySerialNumberService/GetCreateModelBy.php

@@ -67,7 +67,7 @@ class GetCreateModelBy extends TestCase
         $orderQuery = Order::query()->selectRaw('id')->whereIn('code', data_get($this->data['orderHeaders'], '*.orderno'));
         $orderPackages = OrderPackage::query()->with(['commodities' => function ($query) {
             $query->with('commodity', 'serialNumbers');
-        }])->whereIn('Order_Packages.Order_id', $orderQuery)->get();
+        }])->whereIn('Order_id', $orderQuery)->get();
 //        $this->tearDown();
         $innerParams = $this->service->getCreateModelBy($this->data['orderHeaders'],$orderPackages);
         foreach ($this->data['orderHeaders'] as $orderHeader){

+ 5 - 2
tests/Services/OrderPackageService/GetInnerParamsTest.php

@@ -3,6 +3,7 @@
 namespace Tests\Services\OrderPackageSerivce\GetInnerParamsTest;
 
 use App\Commodity;
+use App\Logistic;
 use App\OracleActAllocationDetails;
 use App\OracleBasSKU;
 use App\OracleDOCOrderHeader;
@@ -41,9 +42,11 @@ class GetInnerParamsTest extends TestCase
         $this->data['actAllocationDetails'] = $OracleActAllocationDetails;
         $owner = factory(Owner::class)->create(['code'=>'TEST_OW']);
         $commodity = factory(Commodity::class)->create(['sku'=>$basSku['sku'],'owner_id' => $owner]);
+        $logistic = factory(Logistic::class)->create();
         $this->data['owner'] = $owner;
         $this->data['commodity'] = $commodity;
         $this->data['order'] = $order;
+        $this->data['logistic'] = $logistic;
     }
 
     /**
@@ -58,9 +61,8 @@ class GetInnerParamsTest extends TestCase
             $query->where('code',$order['code']);
         })->get();
         $map = $dataHandlerService->dataHeader(['logistic_number'],$orderPackage);
-        $params = $this->service->getInnerParams($this->data['orderHeader'],$this->data['order'],$map);
+        $params = $this->service->getInnerParams($this->data['orderHeader'],$this->data['order'],$map,$this->data['logistic']);
         $orderPackages = collect($params);
-        dump($params,$this->data['actAllocationDetails']->toArray());
         foreach ($this->data['actAllocationDetails'] as $actAllocationDetail) {
             $orderPackage = $orderPackages->where('logistic_number',$actAllocationDetail['picktotraceid'])->first();
             $this->assertNotNull($orderPackage);
@@ -72,6 +74,7 @@ class GetInnerParamsTest extends TestCase
         $this->data['owner']->delete();
         $this->data['commodity']->delete();
         $this->data['order']->delete();
+        $this->data['logistic']->delete();
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 4 - 4
tests/Services/OrderService/CreateOrFindOrderInfoTest.php

@@ -37,8 +37,8 @@ class CreateOrFindOrderInfoTest extends TestCase
         $wmsOrderHeader = factory(OracleDOCOrderHeader::class)->make([
             'customerid'=>'TEST_OW','sostatus'=>99,'userdefine1'=>'TEST_CA','warehouseid'=>'WH_TEST'
         ]);
-        $this->data['warehouse']    = factory(Warehouse::class)->create(['code'=>'WH_TEST']);
-        $this->data['logistic']     = factory(Logistic::class)->create(['code'=>'TEST_CA','name'=>'测试承运商']);
+        $this->data['warehouse']    = factory(Warehouse::class)->create();
+        $this->data['logistic']     = factory(Logistic::class)->create();
         $this->data['owner']        = factory(Owner::class)->create(['code'=>'TEST_OW','name'=>'测试货主']);
         $this->data['shop']         = factory(Shop::class)->create(['owner_id'=>$this->data['owner']['id']]);
 
@@ -88,7 +88,7 @@ class CreateOrFindOrderInfoTest extends TestCase
         $orderPackages  = OrderPackage::query()->where('order_id',$order['id'])->get();
         $orderPackagesCommodities = OrderPackageCommodities::query()->whereIn('order_package_id',data_get($orderPackages,'*.id'))->get();
         $this->assertNotEmpty($orderPackages);
-        $this->assertNotEmpty($orderPackagesCommodities);
+//        $this->assertNotEmpty($orderPackagesCommodities);
     }
 
     public function tearDown(): void
@@ -104,7 +104,7 @@ class CreateOrFindOrderInfoTest extends TestCase
         Commodity::query()->whereIn('id',data_get($this->data['sku'],'*.id'))->delete();
         $order = Order::query()->where('code',$this->data['orderHeader']['orderno'])->first();
         $order->delete();
-        $this->data['logistic']->delete();
+        $this->data['logistic']->forceDelete();
         $this->data['owner']->delete();
         $this->data['shop']->delete();
         $this->data['warehouse']->delete();

+ 3 - 3
tests/Services/OrderService/CreateOrFindOrderTest.php

@@ -38,8 +38,8 @@ class CreateOrFindOrderTest extends TestCase
 
         $code_BasCode  = factory(OracleBasCode::class)->make(['codeid'=>'OW','code'=>'99','descr_c'=>'订单完成']);
         $wmsOrderHeader->setRelation('oracleBASCode',$code_BasCode);
-        $this->data['warehouse']    = factory(Warehouse::class)->create(['code'=>'WH_TEST']);
-        $this->data['logistic']     = factory(Logistic::class)->create(['code'=>'TEST_CA','name'=>'测试承运商']);
+        $this->data['warehouse']    = factory(Warehouse::class)->create();
+        $this->data['logistic']     = factory(Logistic::class)->create();
         $this->data['owner']        = factory(Owner::class)->create(['code'=>'TEST_OW','name'=>'测试货主']);
         $this->data['shop']         = factory(Shop::class)->create(['owner_id'=>$this->data['owner']['id']]);
     }
@@ -64,7 +64,7 @@ class CreateOrFindOrderTest extends TestCase
         cache()->forget("WareHouse_{$this->data['warehouse']}");
 
         $this->data['warehouse']->delete();
-        $this->data['logistic']->delete();
+        $this->data['logistic']->forceDelete();
         $this->data['owner']->delete();
         $this->data['shop']->delete();
         Order::query()->where('code',$this->data['orderHeader']['orderno'])->delete();

+ 1 - 1
tests/Services/OwnerService/GetOwnerByCodeTest.php

@@ -18,7 +18,7 @@ class GetOwnerByCodeTest extends TestCase
     public function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->service = app('OwnerService');
 
         $owner  = factory(Owner::class)->create();

+ 1 - 1
tests/Services/ShopService/GetShopByCodeMapTest.php

@@ -53,7 +53,7 @@ class GetShopByCodeMapTest extends TestCase
 
     public function tearDown(): void
     {
-        cache()->flush();
+
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

+ 0 - 38
tests/Services/StationCacheShelfGrid/GetGridByCodeTest.php

@@ -1,38 +0,0 @@
-<?php
-
-
-namespace Tests\Services\StationCacheShelfGrid;
-
-use App\Services\StationCacheShelfGridService;
-use App\StationCacheShelfGrid;
-use Tests\TestCase;
-
-class GetGridByCodeTest extends TestCase
-{
-    protected $data = [];
-
-    protected function setup(): void
-    {
-        parent::setUp();
-        $this->data['stationCode'] = 'station001';
-        $this->data['grid'] = 6;
-        $this->data['x'] = 2;
-        $this->data['y'] = 3;
-        $this->data['code'] = 'HAI'.$this->data['stationCode'].'-0'.$this->data['y'].'-0'.$this->data['x'];
-
-    }
-
-    function testGetGridByCodeTest()
-    {
-        list($stationCode, $gridId, $x, $y) = StationCacheShelfGrid::getGridByCode($this->data['code']);
-        $this->assertEquals($stationCode,$this->data['stationCode']);
-        $this->assertEquals($gridId,$this->data['grid']);
-        $this->assertEquals($x,$this->data['x']);
-        $this->assertEquals($y,$this->data['y']);
-    }
-
-    protected function tearDown(): void
-    {
-        parent::tearDown();
-    }
-}

+ 0 - 39
tests/Services/StationCacheShelfGrid/GetLocationTest.php

@@ -1,39 +0,0 @@
-<?php
-
-
-namespace Tests\Services\StationCacheShelfGrid;
-
-use App\Station;
-use App\StationCacheShelfGrid;
-use Tests\TestCase;
-
-class GetLocationTest extends TestCase
-{
-
-    protected $data = [];
-
-    protected function setUp(): void
-    {
-        parent::setUp();
-        $row = 3;
-        $col = 2;
-        $this->data['grid_id'] = ($row-1)*3+$col;
-        $this->data['station'] = factory(Station::class)->create();
-        $this->data['grid'] = factory(StationCacheShelfGrid::class)->create(['station_id'=>$this->data['station']['id'],'grid_id'=>$this->data['grid_id']]);
-        $this->data['code'] = 'HAI'.$this->data['station']['code'].'-0'. (2 - $col + 1).'-0'.(2-$row+1);
-    }
-
-    function testGetLocation()
-    {
-        $location = StationCacheShelfGrid::getLocation($this->data['station'],$this->data['grid']);
-        $this->assertEquals($this->data['grid_id'],$this->data['grid']['grid_id']);
-        $this->assertEquals($this->data['code'],$location);
-    }
-
-    protected function tearDown(): void
-    {
-        Station::query()->where('id',$this->data['station']['id'])->delete();
-        StationCacheShelfGrid::query()->where('id',$this->data['grid']['id'])->delete();
-        parent::tearDown();
-    }
-}

+ 0 - 39
tests/Services/StationCacheShelfGridService/CancelTaskTest.php

@@ -1,39 +0,0 @@
-<?php
-
-
-namespace Tests\Services\StationCacheShelfGridService;
-
-use App\Services\StationCacheShelfGridService;
-use App\StationCacheShelfGrid;
-use App\Traits\TestMockSubServices;
-use Tests\TestCase;
-
-class CancelTaskTest extends TestCase
-{
-    use TestMockSubServices;
-    /** @var StationCacheShelfGridService $stationCacheShelfGridService */
-    protected $stationCacheShelfGridService;
-    protected $data =[];
-
-    protected function setup(): void
-    {
-        parent::setUp();
-        $this->stationCacheShelfGridService = app(StationCacheShelfGridService::class);
-        $this->data['grids'] = factory(StationCacheShelfGrid::class)->times(3)->create();
-
-    }
-
-    public function testCancelTask()
-    {
-        $this->stationCacheShelfGridService->cancelTask($this->data['grids']);
-        $grids = StationCacheShelfGrid::query()->whereIn('id',data_get($this->data['grids'],'*.id'))->whereNull('material_box_id')->where('status',0)->count();
-        $this->assertEquals($grids, count($this->data['grids']));
-    }
-
-    protected function tearDown(): void
-    {
-        StationCacheShelfGrid::query()->where('id',data_get($this->data['grids'],'*.id'))->delete();
-        parent::tearDown();
-    }
-
-}

+ 0 - 47
tests/Services/StationCacheShelfGridService/LightOffTest.php

@@ -1,47 +0,0 @@
-<?php
-
-
-namespace Tests\Services\StationCacheShelfGridService;
-use App\Services\StationCacheShelfGridService;
-use App\Station;
-use App\StationCacheShelfGrid;
-use Tests\TestCase;
-
-class LightOffTest extends TestCase
-{
-    /** @var StationCacheShelfGridService $stationCacheShelfGridService */
-    protected $stationCacheShelfGridService;
-    protected $data = [];
-
-    protected function setup(): void
-    {
-        parent::setUp();
-        $this->stationCacheShelfGridService = app(StationCacheShelfGridService::class);
-        $row = 2;
-        $col = 1;
-        $gridIndex = ($row-1)*3 + (3-$col);
-        $this->data['station'] = factory(Station::class)->create();
-        $this->data['stationCacheShelfGrid'] = factory(StationCacheShelfGrid::class)->create(['station_id' => $this->data['station']['id'],'grid_id'=>$gridIndex]);
-        $this->data['locCode'] = 'HAI'.$this->data['station']['code'].'-0'.$col.'-0'.$row;
-        $this->data['PTLAction'] = 0;
-    }
-
-    public function testLightOff()
-    {
-        $this->stationCacheShelfGridService->lightOff($this->data['locCode'],$this->data['PTLAction']);
-        $grid = StationCacheShelfGrid::query()->where('id',$this->data['stationCacheShelfGrid']['id'])->first();
-        $this->assertEquals($grid['id'],$this->data['stationCacheShelfGrid']['id']);
-        $this->assertEquals($grid['station']['id'],$this->data['stationCacheShelfGrid']['station_id']);
-        $this->assertEquals($grid['material_box_id'],null);
-        $this->assertEquals($grid['status'],0);
-
-    }
-
-    protected function tearDown(): void
-    {
-        Station::query()->where('id',$this->data['station']['id'])->delete();
-        StationCacheShelfGrid::query()->where('id',$this->data['stationCacheShelfGrid']['id'])->delete();
-        parent::tearDown(); // TODO: Change the autogenerated stub
-    }
-
-}

+ 0 - 42
tests/Services/StationCacheShelfGridService/ProcessGridTest.php

@@ -1,42 +0,0 @@
-<?php
-
-
-namespace Tests\Services\StationCacheShelfGridService;
-use App\MaterialBox;
-use App\Services\StationCacheShelfGridService;
-use App\Station;
-use App\StationCacheShelfGrid;
-use Tests\TestCase;
-
-
-class ProcessGridTest extends TestCase
-{
-    /** @var StationCacheShelfGridService $stationCacheShelfGridService */
-    protected $stationCacheShelfGridService;
-    protected $data = [];
-
-    protected function setup(): void
-    {
-        parent::setUp();
-        $this->stationCacheShelfGridService = app(StationCacheShelfGridService::class);
-        $this->data['station'] = factory(Station::class)->create();
-        $this->data['materialBox'] = factory(MaterialBox::class)->create();
-        $this->data['stationCacheShelfGrid'] = factory(StationCacheShelfGrid::class)->create();
-    }
-
-    public function test()
-    {
-        $this->stationCacheShelfGridService->processGrid($this->data['stationCacheShelfGrid'],$this->data['station'],$this->data['materialBox']);
-        $grid = StationCacheShelfGrid::query()->where('id',$this->data['stationCacheShelfGrid']['id'])->first();
-        $this->assertEquals($grid['id'],$this->data['stationCacheShelfGrid']['id']);
-        $this->assertEquals($grid['station_id'],$this->data['station']['id']);
-        $this->assertEquals($grid['material_box_id'],$this->data['materialBox']['id']);
-    }
-    protected function tearDown(): void
-    {
-        Station::query()->where('id',$this->data['station']['id'])->delete();
-        MaterialBox::query()->where('id',$this->data['materialBox']['id'])->delete();
-        StationCacheShelfGrid::query()->where('id',$this->data['stationCacheShelfGrid']['id'])->delete();
-        parent::tearDown();
-    }
-}

+ 17 - 6
tests/Services/StationRuleBatchService/GetBatches_shouldProcessTest.php

@@ -3,10 +3,13 @@
 namespace Tests\Services\StationRuleBatchService;
 
 use App\Batch;
+use App\Order;
+use App\OrderCommodity;
 use App\Owner;
 use App\Services\BatchService;
 use App\Services\StationRuleBatchService;
 use App\StationRuleBatch;
+use App\StationTaskBatch;
 use Tests\TestCase;
 
 class GetBatches_shouldProcessTest extends TestCase
@@ -24,7 +27,6 @@ class GetBatches_shouldProcessTest extends TestCase
         $this->service = app('StationRuleBatchService');
         $this->batchService = app('BatchService');
         $this->data['owner_target'] = factory(Owner::class)->create();
-        $this->data['owner_none_target'] = factory(Owner::class)->create();
         $this->data['stationRuleBatch'] = factory(StationRuleBatch::class)
             ->create([
                 'owner_id' => $this->data['owner_target']['id'],
@@ -32,9 +34,16 @@ class GetBatches_shouldProcessTest extends TestCase
         $this->data['batches'] = factory(Batch::class, $this->amountOfInRule)->create([
             'owner_id' => $this->data['owner_target']['id'],
         ]);
-        $this->data['batches'][]=factory(Batch::class)->create([
-            'owner_id' => $this->data['owner_none_target']['id'],
-        ]);
+        $this->data['stationTaskBatch']=collect();
+        $this->data['order']=collect();
+        foreach ($this->data['batches'] as $batch){
+            $this->data['stationTaskBatch'] ->push(factory(StationTaskBatch::class)->create(['batch_id' => $batch['id'],]));
+            $this->data['order']->push(factory(Order::class)->create(['batch_id' => $batch['id'],]));
+        }
+        $this->data['orderCommodities'] =collect();
+        foreach ($this->data['order'] as $order){
+            $this->data['orderCommodities']->push( factory(OrderCommodity::class)->create(['order_id'=>$order['id'],'location'=>'IDE100']));
+        }
     }
 
     public function testFilteredOut()
@@ -45,11 +54,13 @@ class GetBatches_shouldProcessTest extends TestCase
 
     public function tearDown(): void
     {
-        cache()->flush();
+
         Owner::query()->whereIn('id',[
             $this->data['owner_target']['id'],
-            $this->data['owner_none_target']['id'],
         ])->delete();
+        OrderCommodity::query()->whereIn('id',data_get($this->data['orderCommodities'],'*.id'))->delete();
+        StationTaskBatch::query()->whereIn('batch_id',data_get($this->data['batches'],'*.id'))->delete();
+        Order::query()->whereIn('batch_id',data_get($this->data['batches'],'*.id'))->delete();
         StationRuleBatch::query()->where('id',$this->data['stationRuleBatch']['id'])->delete();
         Batch::query()->whereIn('id',data_get($this->data['batches'],'*.id'))->delete();
         parent::tearDown(); // TODO: Change the autogenerated stub

+ 1 - 1
tests/Services/StationTaskBatchService/CreateByBatchesTest.php

@@ -71,10 +71,10 @@ class CreateByBatchesTest extends TestCase
     public function tearDown(): void
     {
         Batch::query()->whereIn('id',data_get($this->data['batches'],'*.id')??[])->delete();
+        StationRuleBatch::query()->where('owner_id',$this->data['owner']['id']??'')->delete();
         StationTask::query()->whereIn('id',data_get($this->data['stationTask'],'*.id')??[])->delete();
         StationTaskBatch::query()->whereIn('id',data_get($this->data['stationTaskBatches'],'*.id')??[])->delete();
         StationTaskChild::query()->whereIn('station_task_id',data_get($this->data['stationTask'],'*.id')??[])->delete();
-        $this->data['stationRuleBatch']->delete();
         Owner::query()->where('id',$this->data['owner']['id']??'')->delete();
         parent::tearDown();
     }

+ 0 - 1
tests/Services/StationTaskBatchService/RunManyTest.php

@@ -74,7 +74,6 @@ class RunManyTest extends TestCase
         $this->data['stationTaskMaterialBoxes']=$this->stationTaskMaterialBoxService->createByBatches($this->data['batches'],$this->data['stationTask']); //注册料箱任务
         $this->data['stationTaskBathes']=$this->stationTaskBatchService->createByBatches($this->data['batches'],$this->data['stationTask']); //注册波次任务
 
-
     }
 
     public function testReturned()

+ 6 - 4
tests/Services/StationTaskCommodityService/CreateByBatchTest.php

@@ -67,8 +67,8 @@ class CreateByBatchTest extends TestCase
             ]
         ]);
 
-        $this->data['stationTaskCommodities']
-            =(function(){
+//        $this->data['stationTaskCommodities']
+//            =(function(){
             if(!isset($this->data['stationTaskCommodities']))
                 $this->data['stationTaskCommodities'] = collect();
             foreach($this->data['batches'] as $batch){
@@ -77,8 +77,10 @@ class CreateByBatchTest extends TestCase
                     $this->service->createByBatch($batch)
                 );
             }
-            return $this->data['stationTaskCommodities'];
-        })();
+//            return $this->data['stationTaskCommodities'];
+//        })();
+
+        $this->data['stationTaskCommodities']=StationTaskCommodity::query()->whereIn('order_id',data_get($this->data['orders'],'*.id')??[])->get();
         $this->assertEquals($this->orderCommodityAmount, $this->data['stationTaskCommodities']->count());
     }
 

+ 3 - 0
tests/Services/StationTaskMaterialBoxService/CreateByBatchesTest.php

@@ -79,6 +79,9 @@ class CreateByBatchesTest extends TestCase
         StationTask::query()
             ->whereIn('id',data_get($this->data['stationTask'],'*.id')??[])
             ->delete();
+        Batch::query()
+            ->whereIn('id',data_get( $this->data['batches'],'*.id')??[])
+            ->delete();
         parent::tearDown();
     }
 }

+ 2 - 2
tests/Services/StoreService/CreateStoreTest.php

@@ -24,7 +24,7 @@ class CreateStoreTest extends TestCase
     public function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
-        cache()->flush();
+
         $this->service=app(StoreService::class);
         $this->data['warehouse']  = factory(Warehouse::class)->create(['code'=>'test_wh']);
         $this->data['owner'] = factory(Owner::class)->create(['code'=>'test_owner','name'=>'测试货主']);
@@ -72,7 +72,7 @@ class CreateStoreTest extends TestCase
         DB::table('commodities')->whereIn('id',$commodity_ids)->delete();
         DB::table('stores')->whereIn('asn_code',data_get($this->asnHeaders,'*.asnno'))->delete();
         DB::table('store_items')->whereIn('store_id',$storeIds)->delete();
-        cache()->flush();
+
         parent::tearDown(); // TODO: Change the autogenerated stub
     }
 }

Some files were not shown because too many files changed in this diff