Sfoglia il codice sorgente

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 5 anni fa
parent
commit
4ce29aa24e

+ 12 - 9
app/Console/Commands/SyncBatchTask.php

@@ -77,18 +77,22 @@ sql
         $map = [];
         $batches = $this->batchService->get(["code"=>$codes]);
         if ($batches){
-            foreach ($batches as $batch)$map[$batch->code] = $batch->id;
+            foreach ($batches as $index=>$batch)$map[$batch->code] = $index;
         }
         $update = [["id","wms_status","remark","updated_at"]];
         $insert = [];
         foreach ($waves as $wave){
             if (isset($map[$wave->waveno])){
-                $update[] = [
-                    "id" => $map[$wave->waveno],
-                    "wms_status" => $this->wms_status($wave),
-                    "remark"=>$wave->descr,
-                    "updated_at"=>$wave->edittime,
-                ];
+                $bat = $batches[$map[$wave->waveno]];
+                $wms_status = $this->wms_status($wave);
+                if ($bat->wms_status != $wms_status || $bat->remark != $wave->descr){
+                    $update[] = [
+                        "id" => $bat->id,
+                        "wms_status" => $this->wms_status($wave),
+                        "remark"=>$wave->descr,
+                        "updated_at"=>$wave->edittime,
+                    ];
+                }
                 continue;
             }
             $owner = app("OwnerService")->codeGetOwner($wave->customerid);
@@ -106,7 +110,7 @@ sql
         //存在则更新
         if (count($update)>1){
             $bool = app(BatchUpdateService::class)->batchUpdate("batches",$update);
-            if ($bool)LogService::log(__METHOD__,"SUCCESS-同步更新波次成功",json_encode($update));
+            if ($bool!==false)LogService::log(__METHOD__,"SUCCESS-同步更新波次成功",json_encode($update));
             else LogService::log(__METHOD__,"ERROR-同步更新波次失败",json_encode($update));
         }
 
@@ -162,7 +166,6 @@ sql;
             $batchMapping[$detail->orderno] = $detail->waveno;
         }
         $orders = Order::query()->select("id","batch_id","code")->whereIn("code",$orderCodes)->get();
-        //if (count($orderCodes) != count($orders))LogService::log(__METHOD__,"波次同步-本地订单缺失",json_encode($orderCodes)." | ".count($orderCodes)." | ".count($orders));
         if ($orders){
             $orderIds = [];
             $orderMap = [];

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

@@ -128,6 +128,15 @@ class TestController extends Controller
         return call_user_func([$this, $method], $request);
     }
 
+    public function zzd(){
+        $update = [
+            ["id","wms_status","remark","updated_at"],
+            ["id"=>6,"wms_status"=>"完全收货",
+                "remark"=>"01.[ALLBLU]普通波次","updated_at"=>"2021-01-27 08:58:53"]
+        ];
+        dd(app(BatchUpdateService::class)->batchUpdate("batches",$update));
+    }
+
     public function syncWeight()
     {
         $pack = OrderPackageCountingRecord::query()->get();