Zhouzhendong 4 лет назад
Родитель
Сommit
00793dae5d

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

@@ -183,6 +183,7 @@ sql;
         $result = app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->whereIn("code",$boxes)->get());
         if ($result===null)$this->error("任务下发错误,检查日志");
         if ($result===false)$this->error("已无可用料箱,部分库位填充失败");
+        app("StationService")->locationOccupyMulti($boxes);
         $this->success(["data"=>$data,"boxes"=>$boxes]);
     }
 
@@ -263,7 +264,7 @@ SQL;
                 return $task;
             };
 
-            $stations = app("StationService")->getCacheShelf(true,true);
+            $stations = app("StationService")->getCacheShelf(true);
             $collection = collect();
             $location = collect();
             $ids = [];

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

@@ -283,13 +283,15 @@ class StorageController
     {
         LogService::log('海柔请求','taskUpdate', json_encode($request->all()));
         try{
-            $stationTaskMaterialBox_id = explode('_',$request['taskCode'])[0];
-            $this->service->taskUpdate(
-                $stationTaskMaterialBox_id
-                ,$request['updateEventType']
-                ,$request['status']
-                ,$request['binCode']
-            );
+            if (substr($request['taskCode'],0,1)!='g'){
+                $stationTaskMaterialBox_id = explode('_',$request['taskCode'])[0];
+                $this->service->taskUpdate(
+                    $stationTaskMaterialBox_id
+                    ,$request['updateEventType']
+                    ,$request['status']
+                    ,$request['binCode']
+                );
+            }
             return ['code'=>200,'errMsg'=>'','data'=>$request->all()];
         }catch (\Exception $e){
             return ['code'=>$e->getCode(),'errMsg'=>$e->getMessage(),'data'=>$request->all()];

+ 2 - 2
app/Imports/UpdatePickZone.php

@@ -89,7 +89,7 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
             }
             $sql = "select BAS_ZONE.DESCR,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_LOC_ID.LOTNUM,BAS_LOCATION.PICKZONE,(INV_LOT_LOC_ID.QTY-INV_LOT_LOC_ID.QTYALLOCATED-QTYONHOLD-QTYRPOUT-QTYMVOUT) AS qty from INV_LOT_ATT LEFT JOIN
                         INV_LOT_LOC_ID ON INV_LOT_ATT.LOTNUM = INV_LOT_LOC_ID.LOTNUM LEFT JOIN BAS_LOCATION ON INV_LOT_LOC_ID.LOCATIONID = BAS_LOCATION.LOCATIONID
-                    LEFT JOIN BAS_ZONE ON BAS_LOCATION.PICKZONE = BAS_ZONE.ZONE 
+                    LEFT JOIN BAS_ZONE ON BAS_LOCATION.PICKZONE = BAS_ZONE.ZONE
                     where INV_LOT_ATT.LOTNUM in (select LOTNUM from INV_LOT_LOC_ID where CUSTOMERID = ? AND SKU = ? GROUP BY LOTNUM)";
             $bindings = [$detail->customerid,$detail->sku];
             if ($item["生产日期"]){
@@ -181,7 +181,7 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
                 ];
             }
         }
-        Cache::put("commodityAssign",["success"=>true,"data"=>$models,"errors"=>array_unique($errors)]);
+        Cache::put("commodityAssign",["success"=>true,"data"=>$models,"errors"=>array_values(array_unique($errors))]);
     }
 
     private function matchingMax($lots, $amount)

+ 2 - 4
app/Services/StationService.php

@@ -135,19 +135,17 @@ class StationService
      * 获取缓存架
      *
      * @param bool $onlyAvailable
-     * @param bool $desc
      *
      * @return Collection
      */
-    public function getCacheShelf(bool $onlyAvailable = false, bool $desc = false):Collection
+    public function getCacheShelf(bool $onlyAvailable = false):Collection
     {
         $stations = Station::query()->where("station_type_id",5)
-            ->whereNotNull("parent_id");
+            ->whereNotNull("parent_id")->orderByRaw("LEFT(code,5),RIGHT(code,1)");
         if ($onlyAvailable)$stations->where("status",0)
             ->whereNotIn("id",Station::query()->select("id")->whereHas("task",function ($query){
                 $query->whereNotIn("status",["完成","取消"]);
             }))->lockForUpdate();
-        if ($desc)$stations->orderByDesc("code");
         return $stations->get();
     }