Просмотр исходного кода

一个导出数据类型错误,一些service的修复

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

+ 16 - 27
app/Http/ApiControllers/InventoryController.php

@@ -24,6 +24,9 @@ class InventoryController
      * @apiSuccess {string} message 响应描述
      * @apiSuccess {int} status_code HTTP响应码
      * @apiSuccess {array} data 数据列表
+     * @apiSuccess {int} data.sameDayInventoryCount 员工当日盘点数
+     * @apiSuccess {int} data.stocktakingTask 当前盘点任务信息
+     * @apiSuccess {int} data.notStocktakingList 未盘任务列表
      *
      * @apiSuccessExample {json} Success-Response:
      *     HTTP/1.1 200 OK
@@ -31,27 +34,19 @@ class InventoryController
      *       "message": "请求成功",
      *       "status_code": "200"
      *       "data":[
-     *          inventoryTask => {
+     *          "sameDayInventoryCount" => 0,
+     *          "inventoryTask" => {
      *              "id" =>"盘点任务号",
      *              "created_at"   =>"任务创建时间",
      *              "end_at"     =>"库位最后操作时间",
      *              "type"=>"任务类型",
      *              "total"=>"盘点任务数",
      *              "processed"=>"盘点数",
-     *          }
-     *          inventoryTaskDetails=> [
+     *          },
+     *          "notStocktakingList"=> [
      *            {
      *              "id" =>"盘点任务明细号",
      *              "location"   =>"库位",
-     *              "commodity_id"     =>"商品id",
-     *              "produced_at"=>"生产日期",
-     *              "valid_at"=>"失效日期",
-     *              "stored_at"=>"入库日期",
-     *              "batch_number"=>"批号",
-     *              "erp_type_position"=>"属性仓",
-     *              "quality"=>"质量状态",
-     *              "stored_amount"=>"库存数量",
-     *              "verified_amount"=>"盘点数量",
      *             }
      *           ]
      *        ]
@@ -62,13 +57,12 @@ class InventoryController
         $taskId = $request->input("taskId");
         /** @var AndroidInventoryService $service */
         $service=app('AndroidInventoryService');
-        $inventoryTask = InventoryAccount::query()->find($taskId);
-        $inventoryTaskDetails=$service->getUnInventoryTaskList($taskId);
-        $staffName = Auth::user()['name'];
+        $stocktakingTask = InventoryAccount::query()->find($taskId);
+        $notStocktakingList=$service->getUnInventoryTaskList($taskId);
         $sameDayInventoryCount=$service->getStaffSameDayInvCount();
-        $this->response(['inventoryTask' => $inventoryTask,
-            'inventoryTaskDetails' => $inventoryTaskDetails,
-            'staffName'=>$staffName,'sameDayInventoryCount'=>$sameDayInventoryCount
+        $this->response(['stocktakingTask' => $stocktakingTask,
+            'notStocktakingList' => $notStocktakingList,
+            'sameDayInventoryCount'=>$sameDayInventoryCount
         ]);
     }
 
@@ -125,15 +119,12 @@ class InventoryController
      *       "data":{
      *              "id" =>"盘点任务明细号",
      *              "location"   =>"库位",
-     *              "commodity_id"     =>"商品id",
      *              "produced_at"=>"生产日期",
      *              "valid_at"=>"失效日期",
      *              "stored_at"=>"入库日期",
      *              "batch_number"=>"批号",
      *              "erp_type_position"=>"属性仓",
      *              "quality"=>"质量状态",
-     *              "stored_amount"=>"库存数量",
-     *              "verified_amount"=>"盘点数量",
      *           }
      *     }
      */
@@ -146,7 +137,7 @@ class InventoryController
         if ($inventoryDetail) {
             $this->response($inventoryDetail);
         }else{
-            $this->response(null,200,'未检测到指定盘点任务');
+            $this->response(null,403,'未检测到指定盘点任务');
         }
     }
     /**
@@ -169,13 +160,12 @@ class InventoryController
      *       "message": "请求成功",
      *       "status_code": "200"
      *       "data":[
-     *          inventoryTaskDetails=>[
+     *          "notStocktakingList"=>[
      *                  {
      *                        "id"=>"盘点任务明细号",
      *                        "location"=>"库位",
      *                  }
      *              ]
-     *          sameDayInventoryCount=>“当日盘点行数”
      *        ]
      *     }
      */
@@ -188,10 +178,9 @@ class InventoryController
         /** @var AndroidInventoryService $service */
         $service=app('AndroidInventoryService');
         $service->stockInventory($taskId,$location,$barcode,$amount);
-        $inventoryTaskDetails=$service->getUnInventoryTaskList($taskId);
-        $sameDayInventoryCount=$service->getStaffSameDayInvCount();
+        $notStocktakingList=$service->getUnInventoryTaskList($taskId);
         $this->response([
-            'inventoryTaskDetails' => $inventoryTaskDetails, 'sameDayInventoryCount'=>$sameDayInventoryCount
+            "notStocktakingList" => $notStocktakingList,
         ]);
     }
 

+ 4 - 4
app/Imports/StoreCheckingReceiveImport.php

@@ -88,6 +88,7 @@ class StoreCheckingReceiveImport implements ToCollection,WithHeadingRow
                 }
                 if ($sign) continue;
             }
+            $barcode = (string)rtrim(ltrim($item["条码"]));
             array_push($items,[
                 "imported_amount" => $item["数量"],
                 "produced_at" => $item["生产日期"],
@@ -96,16 +97,15 @@ class StoreCheckingReceiveImport implements ToCollection,WithHeadingRow
                 "unique_code" => $item["唯一码"],
                 "SKU" => $item["SKU"],
                 "商品名称" => $item["商品名称"],
-                "条码" => rtrim(ltrim($item["条码"])),
+                "条码" => $barcode,
             ]);
             if ($isUniqueCommodity){
-                array_push($commodities[$item["条码"]], count($items)-1);
+                array_push($commodities[$barcode], count($items)-1);
             }else{
                 $commodities[$item["条码"]] = [count($items)-1] ;
-                array_push($barcodes,$item["条码"]);
+                array_push($barcodes,$barcode);
             }
         }
-
         //不存在货主
         if (!$owner_name){
             Cache::put("storeCheckingReceive",["success"=>false, "data"=>"货主为空,不允许录入,至少为一行标明货主!"],86400);

+ 1 - 1
app/Services/AndroidInventoryService.php

@@ -46,7 +46,7 @@ class AndroidInventoryService
     //根据盘点任务号,库位,条码 查询指定盘点任务
     public function getInventoryDetail($taskId,$location,$barcode)
     {
-        return Cache::remember($taskId.'_'.$location.'_'.$barcode, 60, function ()use($taskId,$location,$barcode) {
+        return Cache::remember($taskId.'_'.$location.'_'.$barcode, 300, function ()use($taskId,$location,$barcode) {
             return InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])
                 ->whereHas('commodity',function($query)use($barcode){
                     $query->whereHas('barcodes',function($sql)use($barcode){

+ 1 - 0
resources/views/store/checkingReceive/show.blade.php

@@ -90,6 +90,7 @@
         <div class="d-none d-sm-block">
             <table class="table table-striped table-sm text-nowrap table-hover mt-1 td-min-width-80" id="table">
                 <tr v-for="(storeCheckingReceiveItem,i) in storeCheckingReceiveItems" @click="selectedColor(storeCheckingReceiveItem.id)" :class="selectTr==storeCheckingReceiveItem.id ? 'focusing' : ''">
+                    <td><input class="checkItem" type="checkbox" :value="storeCheckingReceiveItem.id"></td>
                     <td><span>@{{ i+1 }}</span></td>
                     <td><span>@{{ storeCheckingReceiveItem.bin_number }}</span></td>
                     <td><span>@{{ storeCheckingReceiveItem.commodity_name }}</span></td>