瀏覽代碼

Merge branch 'master' into wangyang

king 4 年之前
父節點
當前提交
f9344f6264

+ 6 - 6
app/Filters/RequirementFilters.php

@@ -18,7 +18,7 @@ class RequirementFilters
     protected $queryBuilder;
     protected $filters = [
         'title',
-        'creator_id',
+        'creator',
         'worker_ids',
         'began_at_start',
         'began_at_end',
@@ -26,7 +26,7 @@ class RequirementFilters
         'finished_at_end',
         'created_at_start',
         'created_at_end',
-        'requirement_id',
+        'requirement',
         'status'
     ];
 
@@ -47,9 +47,9 @@ class RequirementFilters
         return $this->queryBuilder;
     }
 
-    public function creator_id($creator_id)
+    public function creator($creator)
     {
-        $this->queryBuilder->where('u];ser_id', $creator_id);
+        $this->queryBuilder->where('user_id', $creator);
     }
 
     private function worker_ids($worker_ids)
@@ -104,8 +104,8 @@ class RequirementFilters
         $this->queryBuilder->where('status', Requirement::$enums['status'][$status]);
     }
 
-    public function requirement_id($requirement_id)
+    public function requirement($requirement)
     {
-        $this->queryBuilder->where('id', $requirement_id);
+        $this->queryBuilder->where('id', $requirement);
     }
 }

+ 84 - 115
app/Http/Controllers/StorageController.php

@@ -192,11 +192,12 @@ sql;
     public function acquireBox()
     {
         $this->gate("入库管理-入库-半箱补货入库");
-        $param = request()->only(["track","barCode","lotNum","amount"]);
+        $param = request()->only(["track","barCode","lotNum","amount","call"]);
         $track = $param["track"] ?? null;
         $barCode = $param["barCode"] ?? null;
         $lotNum = $param["lotNum"] ?? null;
         $amount = $param["amount"] ?? null;
+        $manualCall = $param["call"] ?? false;
         if (!$track || !$barCode || !$lotNum || !$amount)$this->error("提交信息不完整");
 
         $sql = <<<SQL
@@ -267,14 +268,39 @@ SQL;
             $location = collect();
             $ids = [];
             //寻找半箱
-            foreach ($models as $model){
-                list($invs,$map) = app("StorageService")->getMaxAvailableHalfBoxLocation($model->commodity, request("lotNum"));
-                if (!$invs)continue;
+            $sql = <<<SQL
+SELECT LOCATIONID,QTY FROM INV_LOT_LOC_ID WHERE LOTNUM = '{$lotNum}'
+AND LOCATIONID LIKE 'IDE%' AND SKU = '{$commodity->sku}' AND TRACEID = '*' AND QTY > 0 AND QTY > 0 ORDER BY QTY
+SQL;
+            $invs = DB::connection("oracle")->select(DB::raw($sql));
+            if ($invs){
+                $map = [];
+                $codes = [];
                 foreach ($invs as $inv){
+                    $map[$inv->locationid] = $inv->qty;
+                    $codes[] = $inv->locationid;
+                }
+                $modelMap = [];
+                $orderBy = "CASE material_box_model_id ";
+                foreach ($models as $key=>$model){
+                    $orderBy .= 'WHEN '.$model->id." THEN ".$key;
+                    $modelMap[$model->id] = $model->commodity->maximum;
+                }
+                $orderBy.= " END";
+                $boxes = MaterialBox::query()->whereIn("code",$codes)->orderByRaw($orderBy)->lockForUpdate()->get();
+                //筛选下海柔可用箱
+                list($codes,$notCodes) = app("MaterialBoxService")->checkHaiQ(array_column($boxes->toArray(),"code"));
+                if (!$codes)$boxes = new \Illuminate\Database\Eloquent\Collection();
+                $boxes = $boxes->filter(function ($box)use($codes,$notCodes){
+                    if (!isset($codes[$box->code]) || isset($notCodes[$box->code]))return false;
+                    return true;
+                });
+                foreach ($boxes as $box){
+                    if ($modelMap[$box->material_box_model_id]<=$map[$box->code])continue;
+                    $num = $modelMap[$box->material_box_model_id]-$map[$box->code];
                     $station = $stations->last();
-                    $boxId = $map[$inv->locationid];
-                    $number = $amount >= $inv->qty ? $amount-$inv->qty : $amount;
-                    $task = $exe($station, $boxId, $number);
+                    $number = $amount >= $num ? $amount-$num : $amount;
+                    $task = $exe($station, $box->id, $number);
                     if ($station){
                         $stations->offsetUnset($stations->count()-1);
                         $collection->push($task);
@@ -284,8 +310,8 @@ SQL;
                     $amount -= $number;
                     if ($amount==0)break;
                 }
-                if ($amount==0)break;
             }
+
             if ($amount){
                 //寻找空箱
                 $blacklist = [];//空箱逐一寻找需要列队黑名单
@@ -311,7 +337,8 @@ SQL;
             if ($location->count()){
                 /** @var ForeignHaiRoboticsService $service */
                 $service = app("ForeignHaiRoboticsService");
-                $result = $service->fetchGroup_multiLocation($location,$collection,'','立架出至缓存架');
+                if ($manualCall)$result = $this->mergeIntoCache($location,$collection);
+                else $result = $service->fetchGroup_multiLocation($location,$collection,'','立架出至缓存架');
                 if (!$result){
                     DB::rollBack();
                     $this->error("机器人呼叫失败,海柔任务错误");
@@ -338,105 +365,35 @@ SQL;
     }
 
     /**
-     * 取得料箱 废弃
+     * 并入缓存 等待呼叫
+     *
+     * @param Collection $location
+     * @param Collection $collection
+     *
+     * @return bool
      */
-    public function acquireBoxTemp()
+    public function mergeIntoCache(Collection $location,Collection $collection):bool
     {
-        $this->gate("入库管理-入库-半箱补货入库");
-        $boxId = request("material_box_id");
-        $modelId = request("material_box_model_id");
-        if (!$modelId)$this->error("商品未设定库存上限");
-        //获取目标库位
-        $station = app("StationService")->getMirrorMappingLocation(request("station"));
-        if (!$station)$this->error("未知库位");
-        $isAvailable = app("StationService")->isAvailable($station);
-        if (!$isAvailable)$this->error("库存被占用或存在任务未处理");
-        $amount = app("StorageService")->checkPutAmount(request("track"),request("barCode"),request("lotNum"));
-        if ($amount<request("amount"))$this->error("待上架数量不足,最大可上数量为{$amount}");
-
-        //发起取箱任务
-        $exe = function ($boxId)use($station,$amount){
-            DB::beginTransaction();
-            try{
-                $collection = new Collection();
-                $task = StationTask::query()->create([
-                    'status' => "待处理",
-                    'station_id' => $station->id,
-                ]);
-                $collection->add(StationTaskMaterialBox::query()->create([
-                    'station_id' => $station->id,
-                    'material_box_id'=>$boxId,
-                    'status'=>"待处理",
-                    'type' => '取',
-                    'station_task_id' => $task->id,
-                ]));
-                if (!app("ForeignHaiRoboticsService")->fetchGroup($station->code,$collection,'','立架出至缓存架'))$this->error("呼叫机器人失败");
-                //生成临时任务事务
-                TaskTransaction::query()->create([
-                    //"doc_code" => request("asn"),
-                    "bar_code" => request("barCode"),
-                    "fm_station_id" => $station->id,
-                    "material_box_id" => $boxId,
-                    "commodity_id" => request("commodity_id"),
-                    "amount" => request("amount"),
-                    "type" => "入库",
-                    "user_id" => Auth::id(),
-                    "mark" => 1,
-                    "lot_num" => request("lotNum"),
-                    "track_num" => request("track"),
-                ]);
-                //亮灯
-                app("CacheShelfService")->lightUp($station->code,'3','0');
-                app("StationService")->locationOccupy($station->code);//占用库位
-                Cache::forever("CACHE_SHELF_OCCUPANCY_{$station->id}",true);
-                DB::commit();
-                return true;
-            }catch (\Exception $e){
-                DB::rollBack();
-                return false;
-            }
-        };
-        //检查获取的料箱仍然可用
-        if ($boxId && app("MaterialBoxService")->checkUsableBox($boxId))$this->success(["status"=>$exe($boxId),"amount"=>$amount-request("amount")]);
-
-        $commodity = Commodity::query()->find(request("commodity_id"));
-        if (!$commodity)$this->error("商品在WAS丢失");
-        $models = app("MaterialBoxModelService")->getModelSortedByOwner($commodity->owner_id);
-        $models->load(["commodity"=>function($query)use($commodity){
-            $query->where("commodity_id",$commodity->id);
-        }]);
-        //获取料箱
-        if ($boxId){
-            $blacklist = [$boxId];
-            $boxId = null;
-            //料箱存在且不可用
-            /** @var \Illuminate\Database\Eloquent\Collection $models */
-            foreach ($models as $model){
-                if (!$model->commodity)continue;
-                //料箱不可用寻找新料箱
-                $result = app("StorageService")->getMaxAvailableHalfBoxLocation($model->commodity, request("lotNum"), $blacklist);
-                while ($result){
-                    $materialBox = MaterialBox::query()->where("code",$result->locationid)->first();
-                    //料箱可用并且数量符合本次半箱数量 跳出
-                    if ($materialBox && app("MaterialBoxService")->checkUsableBox($materialBox->id)
-                        && $result->qty>=request("amount"))$this->success(["status"=>$exe($materialBox->id),"amount"=>$amount-request("amount")]);
-                    else if ($materialBox)$blacklist[] = $materialBox->id;
-                    //否则黑名单此料箱继续查找 直至料箱为空
-                    $result = app("StorageService")->getMaxAvailableHalfBoxLocation($model->commodity, request("lotNum"), $blacklist);
-                }
-            }
+        $key = "CACHE_SHELF_CALL_".Auth::id();
+        if (Cache::has($key)){
+            list($locationAdd,$collectionAdd) = Cache::get($key);
+            $location = $locationAdd->merge($location);
+            $collection = $collectionAdd->merge($collection);
         }
-        //料箱不存在且该商品有过入库记录 拿取空箱
-        if (!$modelId){
-            $box = null;
-            foreach ($models as $model){
-                if (!$model->commodity)continue;
-                $box = app("MaterialBoxService")->getAnEmptyBox($model);
-                if($box)break;
-            }
-        }else $box = app("MaterialBoxService")->getAnEmptyBox(MaterialBoxModel::query()->find($modelId));
-        if (!$box)$this->error("无可用料箱");
-        $this->success(["status"=>$exe($box->id),"amount"=>$amount-request("amount")]);
+        return Cache::forever($key,[$location,$collection]);
+    }
+
+    public function callRobot()
+    {
+        /** @var ForeignHaiRoboticsService $service */
+        $service = app("ForeignHaiRoboticsService");
+        $key = "CACHE_SHELF_CALL_".Auth::id();
+        list($location,$collection) = Cache::get($key);
+        if ($location->count()==0||$collection->count()==0)$this->error("没有可执行任务");
+        $res = $service->fetchGroup_multiLocation($location,$collection,'','立架出至缓存架');
+        if (!$res)$this->error("呼叫失败,海柔拒绝任务");
+        Cache::forget($key);
+        $this->success();
     }
 
     /**
@@ -451,16 +408,28 @@ SQL;
         $box = MaterialBox::query()->where("code",$ide)->first();
         if (!$box)$this->error("未知料箱");
 
-        $task = TaskTransaction::query()->where("material_box_id",$box->id)->where("amount",">",$amount)
-            ->where("type","入库")->where("mark",1)->where("status",0)->first();
-        if (!$task)$this->error("无任务存在");
-        $task->update(["amount" => DB::raw("amount - {$amount}")]);
-        $storage = MaterialBoxCommodity::query()->where("material_box_id",$task->material_box_id)
-            ->where("commodity_id",$task->commodity_id)->first();
-        $maximum = (($storage->amount ?? 0)+$task->amount)-$amount;
-        CommodityMaterialBoxModel::query()->where("material_box_model_id",$task->materialBox->material_box_model_id)
-            ->where("commodity_id",$task->commodity_id)->update(["maximum"=>$maximum]);
-        $this->success("校正成功");
+        DB::beginTransaction();
+        try {
+            $task = TaskTransaction::query()->where("material_box_id",$box->id)->where("amount",">=",$amount)
+                ->where("type","入库")->where("mark",1)->where("status",0)->lockForUpdate()->first();
+            if (!$task)$this->error("无任务存在");
+            if ($task->amount == $amount){
+                $station = Station::query()->find($task->fm_station_id);
+                app("CacheShelfService")->lightUp($station->code);
+                $task->delete();
+            }
+            else $task->update(["amount" => DB::raw("amount - {$amount}")]);
+            $storage = MaterialBoxCommodity::query()->where("material_box_id",$task->material_box_id)
+                ->where("commodity_id",$task->commodity_id)->first();
+            $maximum = (($storage->amount ?? 0)+$task->amount)-$amount;
+            CommodityMaterialBoxModel::query()->where("material_box_model_id",$task->materialBox->material_box_model_id)
+                ->where("commodity_id",$task->commodity_id)->update(["maximum"=>$maximum]);
+            DB::commit();
+            $this->success("校正成功");
+        }catch (\Exception $e){
+            DB::rollBack();
+            $this->error("校正失败");
+        }
     }
 
     public function syncStorage()

+ 84 - 3
app/Http/Controllers/TestController.php

@@ -2,10 +2,13 @@
 
 namespace App\Http\Controllers;
 
+use App\Commodity;
+use App\CommodityMaterialBoxModel;
 use App\Components\AsyncResponse;
 use App\Components\ErrorPush;
 use App\ErrorTemp;
 use App\Feature;
+use App\Jobs\CacheShelfTaskJob;
 use App\Jobs\OrderCreateWaybill;
 use App\MaterialBox;
 use App\MaterialBoxModel;
@@ -63,17 +66,95 @@ class TestController extends Controller
         $response = Http::post(config('api.haiq.storage.light'), $params);
         return json_decode($response->body());
     }
-    private $key = "CACHE_SHELF_AVAILABLE";
+
     public function test()
     {
-        $s = new StationService();
-        dd($s->getCacheShelf(true,true));
+        app("CacheShelfService")->_stationCacheLightOff("HAIB1-01-01");
+        app("CacheShelfService")->_stationCacheLightOff("HAIB1-01-02");
+        app("CacheShelfService")->_stationCacheLightOff("HAIB1-02-02");
+        dd(1);
+        $stationTaskMaterialBox = StationTaskMaterialBox::query()->find(70370);
+        DB::beginTransaction();
+        try{
+            $stationTaskMaterialBox->loadMissing("station");
+            //如果为半箱位置 清理原有任务
+            if (!$stationTaskMaterialBox->station)return;
+            if (app("StationService")->isHalfBoxLocation($stationTaskMaterialBox->station)){
+                app("StationService")->locationOccupy($stationTaskMaterialBox->station->code,$stationTaskMaterialBox->material_box_id);
+                //清除海柔库位信息
+                app("StorageService")->clearTask([$stationTaskMaterialBox->station->code]);
+                $stationId = $stationTaskMaterialBox->station_id;
+                $tasks = TaskTransaction::query()->with("materialBox")->where(function ($query)use($stationId){
+                    $query->where("fm_station_id",$stationId)->orWhere("to_station_id",$stationId);
+                })->where("status",0)->get();
+                if ($tasks->count()!=0){
+                    $options = [];
+                    switch ($tasks[0]->mark){
+                        case 1:
+                            $options["title"] = '上架任务';
+                            break;
+                        case 2:
+                            $options["title"] = '出库任务';
+                            break;
+                        default:
+                            $options["title"] = '未知类型';
+                    }
+                    switch ($tasks->count()){
+                        case 1:
+                            $task = $tasks[0];
+                            $options["detail01"] = $task->materialBox->code ?? '';
+                            $options["detail02"] = $task->doc_code ?: '跟踪:‘'.$task->track_num."’ 批次:‘".$task->lot_num."’";
+                            $options["detail03"] = $task->bar_code;
+                            $options["qty01"] = $task->amount;
+                            $options["uomDesc01"] = '件';
+                            $options["qty02"] = $task->bin_number;
+                            $options["uomDesc02"] = '号';
+                            break;
+                        default:
+                            $count = count(array_unique(array_column($tasks->toArray(),"commodity_id")));
+                            if ($count==1){
+                                $options["detail01"] = $tasks[0]->bar_code;
+                                $options["detail02"] = "";
+                                $options["detail03"] = "";
+                                $amount = 0;
+                                foreach ($tasks as $task){
+                                    if (mb_strlen($options["detail02"])>20){
+                                        $options["detail03"] .= $task->bin_number."号-".$task->amount."件,";
+                                    }else $options["detail02"] .= $task->bin_number."号-".$task->amount."件,";
+                                    $amount += $task->amount;
+                                }
+                                $options["detail02"] = rtrim($options["detail02"],",");
+                                $options["detail03"] = rtrim($options["detail03"],",");
+                                $options["qty02"] = $amount;
+                                $options["uomDesc02"] = '件';
+                            }else{
+                                $task = $tasks[0];
+                                $options["detail01"] = $task->materialBox->code ?? '';
+                                $options["detail02"] = "货品过多请自行核对";
+                                $options["detail03"] = "波次:".$task->doc_code ?
+                                    (Order::query()->with("batch")->where("code",$task->doc_code)->first()->batch->code ?? '无') : '无';
+                            }
+                            break;
+                    }
+                    app("CacheShelfService")->lightUp($stationTaskMaterialBox->station->code,'2','0',$options);
+                    Cache::forget("CACHE_SHELF_OCCUPANCY_{$stationTaskMaterialBox->station->id}");//关闭无限亮灯
+                }
+            }else app("StationService")->locationFreed($stationTaskMaterialBox->station->code); //释放库位占用
+            DB::commit();
+            dd("OK");
+        }catch (\Exception $e){
+            DB::rollBack();
+            dd($e->getTrace());
+        }
+
 
     }
 
     //快递称重 生成历史数据
     public function addRecord(Request $request)
     {
+        ini_set('max_execution_time',-1);
+        OrderPackageCountingRecord::query()->truncate();
         $start =  Carbon::parse(request("month"))->startOfMonth();
         $end = Carbon::parse(request('month'))->endOfMonth();
 

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

@@ -170,7 +170,7 @@ class WaybillController extends Controller
             if ($waybill->type=='德邦物流' && !$oldBill){
                 $bill = app('DbOpenService')->getDbOrderNo($waybill);
                 if (!$bill){DB::rollBack();return "获取德邦单号失败,德邦服务异常";}
-                $waybill->update(["carrier_bill"=>$bill]);
+                $waybill->update(["carrier_bill"=>$bill,'waybill_number'=>$bill]);
                 $msg =  "【申请德邦物流单号:".$bill."】";
                 if (!app("WaybillService")->notifyFlux($waybill))$msg .= ",通知FLUX失败";
                 $stage = '发起德邦调度';

+ 4 - 4
app/Jobs/CacheShelfTaskJob.php

@@ -108,7 +108,7 @@ class CacheShelfTaskJob implements ShouldQueue
                 }else $updateTransaction[] = ["id"=>$obj->id,"to_station_id"=>$stationId,"status"=>0,"updated_at"=>$time];
             },function ($service,$toLocation,$task,$prefix){
                 return $service->fetchGroup_multiLocation($toLocation,$task,$prefix,'立架出至缓存架',20);
-            })){DB::commit();return true;}
+            },"to_station_id")){DB::commit();return true;}
             DB::rollBack();
         }catch (\Exception $e){
             DB::rollBack();
@@ -137,7 +137,7 @@ class CacheShelfTaskJob implements ShouldQueue
                 $updateTransaction[] = ["id"=>$obj->id,"fm_station_id"=>$stationId,"status"=>0,"updated_at"=>$time];
             },function ($service,$toLocation,$task,$prefix){
                 return $service->fetchGroup_multiLocation($toLocation,$task,'','立架出至缓存架');
-            })){DB::commit();return true;}
+            },"fm_station_id")){DB::commit();return true;}
             DB::rollBack();
         }catch (\Exception $e){
             DB::rollBack();
@@ -147,7 +147,7 @@ class CacheShelfTaskJob implements ShouldQueue
     }
 
     private function dispatchTask(\Illuminate\Database\Eloquent\Collection $tasks, array $available, $service,
-                                  \Closure $update, \Closure $execute):bool
+                                  \Closure $update, \Closure $execute, string $stationName):bool
     {
         if (!$tasks->count())return false;
         if ($tasks->count()>count($available))$tasks = $tasks->slice(0,count($available));//事务过多切割部分处理
@@ -156,7 +156,7 @@ class CacheShelfTaskJob implements ShouldQueue
         $availableTemp = array_keys($available);
         $map = app("StationService")->getStationMapping($availableTemp);//获取库位映射信息
         $updateTask = [["id","station_id","updated_at"]];
-        $updateTransaction = [["id","to_station_id","status","updated_at"]];
+        $updateTransaction = [["id",$stationName,"status","updated_at"]];
         $time = date("Y-m-d H:i:s");
         foreach ($tasks as $index=>$obj){
             $loc = $availableTemp[$index];

+ 1 - 0
app/Services/CacheShelfService.php

@@ -66,6 +66,7 @@ class   CacheShelfService
                 $this->lightUp($station->code);
                 return ['success' => true];
             }
+            app("StationService")->locationFreed($station->code);
         }
         try {
             $bool = $this->putBinToStore($station);                         // 推送任务

+ 1 - 1
app/Services/MaterialBoxService.php

@@ -65,7 +65,7 @@ sql;
         return null;
     }
 
-    private function checkHaiQ(array $boxCodes)
+    public function checkHaiQ(array $boxCodes)
     {
         $haiBoxes = DB::connection("mysql_haiRobotics")->table("ks_bin")
             ->where("status",1)->whereIn("ks_bin_code",$boxCodes)->get();

+ 3 - 2
app/Services/StationService.php

@@ -193,13 +193,14 @@ class StationService
     /**
      * 库位释放
      *
-     * @param string $location
+     * @param ?string $location
      * @param int|null $boxId
      *
      * @return int
      */
-    public function locationFreed(string $location, ?int $boxId=null):int
+    public function locationFreed(?string $location, ?int $boxId=null):int
     {
+        if (!$location)return 0;
         $update = ["status"=>0];
         if ($boxId)$update["material_box_id"]=$boxId;
         return Station::query()->where("code",$location)->update($update);

+ 2 - 2
app/Services/StationTaskMaterialBoxService.php

@@ -179,7 +179,6 @@ class StationTaskMaterialBoxService
                     $stationTaskMaterialBox->materialBox->update();
                     $stationTaskMaterialBox->loadMissing("station");    //提前加载站,后续都需要站信息来处理
                     $this->storageService->putCacheShelf($stationTaskMaterialBox);
-                    $this->storageService->releaseOccupation($stationTaskMaterialBox); //释放库位占用
                     break;
                 default:;
             }
@@ -206,11 +205,12 @@ class StationTaskMaterialBoxService
     /**
      * 取出料箱通知
      *
-     * @param $stationTaskMaterialBox
+     * @param StationTaskMaterialBox|\stdClass $stationTaskMaterialBox
      * @throws \Exception
      */
     function markHasTaken($stationTaskMaterialBox)
     {
+        $stationTaskMaterialBox->loadMissing("station");
         $this->instant($this->cacheShelfService,'CacheShelfService');
         //维护缓存架可用度
         $map = Cache::get("CACHE_SHELF_MAPPING",function (){return [];});

+ 4 - 14
app/Services/StorageService.php

@@ -37,8 +37,9 @@ class StorageService
         try{
             $stationTaskMaterialBox->loadMissing("station");
             //如果为半箱位置 清理原有任务
-            if ($stationTaskMaterialBox->station && app("StationService")->isHalfBoxLocation($stationTaskMaterialBox->station)){
-                app("StationService")->locationFreed($stationTaskMaterialBox->station->code,$stationTaskMaterialBox->material_box_id);
+            if (!$stationTaskMaterialBox->station)return;
+            if (app("StationService")->isHalfBoxLocation($stationTaskMaterialBox->station)){
+                app("StationService")->locationOccupy($stationTaskMaterialBox->station->code,$stationTaskMaterialBox->material_box_id);
                 //清除海柔库位信息
                 $this->clearTask([$stationTaskMaterialBox->station->code]);
                 $stationId = $stationTaskMaterialBox->station_id;
@@ -97,7 +98,7 @@ class StorageService
                     app("CacheShelfService")->lightUp($stationTaskMaterialBox->station->code,'2','0',$options);
                     Cache::forget("CACHE_SHELF_OCCUPANCY_{$stationTaskMaterialBox->station->id}");//关闭无限亮灯
                 }
-            }
+            }else app("StationService")->locationFreed($stationTaskMaterialBox->station->code); //释放库位占用
             DB::commit();
         }catch (\Exception $e){
             DB::rollBack();
@@ -105,17 +106,6 @@ class StorageService
         }
     }
 
-    /**
-     * 释放库位占用
-     *
-     * @param StationTaskMaterialBox|\stdClass $stationTaskMaterialBox
-     */
-    public function releaseOccupation($stationTaskMaterialBox)
-    {
-        if (!app("StationService")->isHalfBoxLocation($stationTaskMaterialBox->station))return;
-        app("StationService")->locationFreed($stationTaskMaterialBox->station->code);
-    }
-
     /**
      * 检查临时事务标记处理一些特殊情况
      *

+ 1 - 1
app/Services/WaybillService.php

@@ -219,7 +219,7 @@ class WaybillService
     {
         //替换换行符
         if ($param["dispatch_remark"] ?? false)$param["dispatch_remark"] = str_replace(["\n","\r"], ' ', $param["dispatch_remark"]);
-        if (!$param["destination"]) $param["destination"] = $waybill->destination;
+        if (!($param["destination"] ?? false)) $param["destination"] = $waybill->destination;
         $waybill->fill($param);
         $waybill->update();
         return $waybill;

+ 2 - 2
resources/views/requirement/index.blade.php

@@ -97,7 +97,7 @@
                 let data = [
                     [
                         {
-                            name: 'requirement_id',
+                            name: 'requirement',
                             type: 'input',
                             tip: '输入任务号',
                             placeholder: '任务号',
@@ -116,7 +116,7 @@
                             ]
                         },
                         {
-                            name: 'creator_id',
+                            name: 'creator',
                             type: 'select',
                             tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的状态'],
                             placeholder: '发布人',

+ 1 - 12
resources/views/store/handInStorage/receive.blade.php

@@ -3,8 +3,6 @@
 
 @section('content')
     <div class="d-none" id="container">
-        <form  :action="'{{url('store/handInStorage/receiveDetailPage')}}/'+asnno+'/'+customerid" method="get" id="submitForm" class="d-none">
-        </form>
         <div class="card offset-md-3 col-md-6">
             <div class="card-header text-center mt-2 bg-transparent" id="header_title">
                 <span class="font-weight-bold h4">收货</span>
@@ -181,13 +179,7 @@
                     window.axios.post(url,{info:this.info})
                         .then(res=>{
                             if (res.data.success){
-                                {{--window.location.href="{{url('store/handInStorage/receiveDetailPage')}}/" + res.data.data.asnno+'/'+ res.data.data.customerid;--}}
-                                    this.asnno=res.data.data.asnno;
-                                    this.customerid=res.data.data.customerid;
-                                    let _this=this;
-                                    setTimeout(function (){
-                                        _this.submitForm();
-                                    },10)
+                                window.location.href="{{url('store/handInStorage/receiveDetailPage')}}/" + res.data.data.asnno+'/'+ res.data.data.customerid;
                             }else {
                                 window.tempTip.setDuration(2000);
                                 window.tempTip.show(res.data.data);
@@ -203,9 +195,6 @@
                         this.onfocus();
                     },100);
                 },
-                submitForm(){
-                    document.getElementById('submitForm').submit();
-                }
             },
         });
     </script>

+ 4 - 4
resources/views/store/handInStorage/receiveDetailPage.blade.php

@@ -27,7 +27,7 @@
                     <div class="form-group row m-1">
                         <label for="quantity" class="text-right">已收/预收数量:</label>
                         <span>&nbsp;&nbsp;&nbsp;</span>
-                        <span id="quantity">@{{ info.receivedqty??0 }}/@{{ info.expectedqty??0 }}</span>
+                        <span id="quantity">@{{ info.receivedqty?info.receivedqty:0 }}/@{{ info.expectedqty?info.expectedqty:0 }}</span>
                     </div>
                     <div class="form-group row m-1">
                         <label for="amount" class="text-right text-danger font-weight-bold">实收数量:</label>
@@ -158,7 +158,7 @@
                 isAndroid:false,
                 isInit:true,
                 element:[
-                    "sku","amount",/*"location",*/"trackNumber"
+                    "sku","amount","trackNumber"
                 ],
                 selectTr:'',
             },
@@ -196,7 +196,7 @@
                             if (res.data.success){
                                 this.fillInfo(res.data.asnDetail);
                                 if (res.data.asnDetail.lotatt08) this.info.lotatt08=res.data.asnDetail.lotatt08;
-                                if (res.data.asnDetail.lotatt05) this.info.lotatt08=res.data.asnDetail.lotatt05;
+                                if (res.data.asnDetail.lotatt05) this.info.lotatt05=res.data.asnDetail.lotatt05;
                                 this.basSku=res.data.basSku;
                                 this.$forceUpdate()
                                 return;
@@ -217,7 +217,7 @@
                         .then(res=>{
                             if (res.data.success){
                                 if (res.data.asnDetail.lotatt08) this.info.lotatt08=res.data.asnDetail.lotatt08;
-                                if (res.data.asnDetail.lotatt05) this.info.lotatt08=res.data.asnDetail.lotatt05;
+                                if (res.data.asnDetail.lotatt05) this.info.lotatt05=res.data.asnDetail.lotatt05;
                                 this.basSku=res.data.basSku;
                                 this.$forceUpdate()
                                 return;

+ 18 - 3
resources/views/store/inStorage/halfChestStorage.blade.php

@@ -33,8 +33,13 @@
                             <strong>@{{ errors.amount[0] }}</strong>
                         </span>
                     </div>
+                    <div class="form-group row">
+                        <label for="call" class="col-sm-2 col-3 text-right">手动呼叫:</label>
+                        <input type="checkbox" style="top: 5px" class="switch" id="call" v-model="info.call">
+                    </div>
                     <div class="input-group row mt-5">
-                        <button type="submit" id="submit" class="btn btn-success offset-2 col-8" @click="checkInfo()">提交</button>
+                        <button type="submit" id="submit" class="btn btn-success offset-3 col-6" @click="checkInfo()">提交</button>
+                        <button type="button" class="btn btn-sm btn-info col-2 text-white offset-1" @click="callRobot()">手动呼叫</button>
                     </div>
                 </div>
             </div>
@@ -142,7 +147,7 @@
                 },
                 //提交溢出减量
                 overflowRevision(){
-                    if (!this.ov.station || !this.ov.amount){
+                    if (!this.ov.ide || !this.ov.amount){
                         window.tempTip.show("信息不完整");
                         return;
                     }
@@ -175,8 +180,10 @@
                             this.showMaximumModal();
                             return;
                         }
-                        this.info = {track:this.info.track};
+                        this.info = {track:this.info.track,call:this.info.call};
                         this.errors = {};
+                        let element = document.getElementById("barCode");
+                        if (element)element.focus();
                         return res.amount==0 ? "调取料箱成功!" : "空箱不足,剩余”"+res.amount+"“未上架";
                     });
                 },
@@ -282,6 +289,14 @@
                     this.info.maximum = this.lotMap[this.lots[index].lotnum];
                     $("#lotModal").modal("hide");
                 },
+                callRobot(){
+                    window.tempTip.postBasicRequest("{{url('store/inStorage/callRobot')}}",{},()=>{
+                        this.info = {call:this.info.call};
+                        let element = document.getElementById("track");
+                        if (element)element.focus();
+                        return '呼叫成功';
+                    });
+                }
             },
         });
     </script>

+ 1 - 0
routes/web.php

@@ -490,6 +490,7 @@ Route::group(['middleware'=>'auth'],function ($route){
             Route::post('settingCommodityMaximum','StorageController@settingCommodityMaximum');
             Route::post('checkTask','StorageController@checkTask');
             Route::post('changeAsnRule','StorageController@changeAsnRule');
+            Route::post('callRobot','StorageController@callRobot');
         });
         Route::group(['prefix'=>'handInStorage'],function() {
             Route::get('receive',function (){return view('store.handInStorage.receive');});//收货页面