Przeglądaj źródła

盘点--批量跳过或者确认差异,确认差异操作
人事--进出组取整,并按取整时间计算工时,

haozi 5 lat temu
rodzic
commit
f4c4bb2cad

+ 14 - 0
app/Http/Controllers/InventoryAccountController.php

@@ -283,6 +283,20 @@ class InventoryAccountController extends Controller
         $inventoryAccountMission=$inventoryService->确认盘点差异($inventoryAccountMissionId,$inventoryAccountId);
         return ['success'=>true,'inventoryAccountMission'=>$inventoryAccountMission];
     }
+    public function 批量跳过或确认差异(Request $request){
+        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
+        $checkData=$request->checkData;
+        if(is_null($checkData)){return ['success'=>false,'data'=>'传入勾选盘点记录为空'];}
+        $marks=[];
+        foreach ($checkData as $inventoryMission){
+            array_push($marks,$inventoryMission['mark']);
+        }
+        if (in_array('确认差异',$marks)||in_array('跳过',$marks)||in_array('无差异',$marks)||in_array('已复盘无差异',$marks))return ['success'=>false,'data'=>'传入勾选盘点记录存在不可操作项!'];
+        /** @var InventoryAccountService $inventoryService */
+        $inventoryService=app('inventoryAccountService');
+        $inventoryAccountMissions=$inventoryService->批量跳过或确认差异($checkData);
+        return ['success'=>true,'inventoryAccountMissions'=>$inventoryAccountMissions];
+    }
     public function exportInventoryAccountMission(Request $request){
         if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
         $post = Http::post(config('go.export.url'),['type'=>'inventoryAccountMission','data'=>$request->data]);

+ 1 - 1
app/InventoryAccount.php

@@ -33,7 +33,7 @@ class InventoryAccount extends Model
         return $this['total'] ? $this['total']-$this['processed']:0;
     }
     public function getProcessedAmount(){
-        return $this->inventoryMissions()->whereIn('checked',['是','跳过'])->where('inventory_account_id',$this['id'])->count();
+        return $this->inventoryMissions()->whereIn('checked',['是','跳过','确认差异'])->where('inventory_account_id',$this['id'])->count();
     }
     //复盘剩余数
     public function getCheckSurplusAttribute()

+ 23 - 3
app/Services/InventoryAccountService.php

@@ -566,14 +566,34 @@ class InventoryAccountService
         LogService::log(__METHOD__,"跳过盘点记录修改checked状态",json_encode($inventoryAccountMissionId));
         return $inventoryAccountMission;
     }
+    public function 批量跳过或确认差异($checkData){
+        $inventoryAccountMissions=[];
+        $inventoryAccountId=null;
+        foreach ($checkData as $inventoryMission){
+            $inventoryAccountMission=InventoryAccountMission::query()->find($inventoryMission['id']);
+            $inventoryAccountId=$inventoryAccountMission->inventory_account_id;
+            if ($inventoryMission['mark']==='未盘')$inventoryAccountMission['checked']='跳过';
+            if ($inventoryMission['mark']==='未复盘有差异'||$inventoryMission['mark']==='已复盘无差异')$inventoryAccountMission['checked']='确认差异';
+            $inventoryAccountMission->update();
+            array_push($inventoryAccountMissions,$inventoryAccountMission);
+        }
+        LogService::log(__METHOD__,"批量跳过或确认差异",json_encode($checkData));
+        $inventoryAccount=InventoryAccount::query()->find($inventoryAccountId);
+        $inventoryAccount->processed=$inventoryAccount->getProcessedAmount();//已盘点数
+        $inventoryAccount->difference=$inventoryAccount->getDifferenceAmount();//盘点差异数
+        $inventoryAccount->returned=$inventoryAccount->getReturnedAmount(); //复盘归位数
+        $inventoryAccount->update();
+        Controller::logS(__METHOD__,'批量跳过或确认差异修改盘点任务信息'.__FUNCTION__,json_encode($inventoryAccountId));
+        return $inventoryAccountMissions;
+    }
     public function searchCommodityByBarcode($barcode,$owner_code){
         $oracleBasSku=OracleBasSKU::query()
             ->where('ALTERNATE_SKU1',$barcode)
             ->orWhere('ALTERNATE_SKU2',$barcode)
             ->orWhere('ALTERNATE_SKU3',$barcode)
             ->where('customerid',$owner_code)->first();
-            if (!$oracleBasSku)return null;
-            return $oracleBasSku;
+        if (!$oracleBasSku)return null;
+        return $oracleBasSku;
     }
     public function baseOnBlindReceive($location,$owner_code,$goodses,$inventoryId){
         $request=[
@@ -604,7 +624,7 @@ class InventoryAccountService
             array_push($inventoryAccountMissions,$inventoryAccountMission);
         }
         if (count($inventoryAccountMissions)<1) return null;
-            return $inventoryAccountMissions;
+        return $inventoryAccountMissions;
     }
 
 }

+ 62 - 24
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -39,6 +39,12 @@
             <button class="btn btn-sm" @click="盲收()" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode&&!blindReceive">盲收</button>
                 <button class="btn btn-sm" @click="正常盘点()" :class="blindReceive?'btn-dark':'btn-outline-dark'" v-if="blindReceive">正常盘点</button>
             </span>
+            <span>
+                <button class="btn btn-outline-dark btn-sm form-control-sm tooltipTarget"
+                        @click="批量跳过或确认差异()" v-if="!listMode" title="勾选指定盘点记录行,进行批量跳过或批量确认差异">
+                    批量跳过或确认差异
+                </button>
+            </span>
 
 
             <span class="form-group  mb-5">
@@ -309,7 +315,7 @@
                    id="headerParent" ref="boxPc">
                 <tr class="p-0" id="header"></tr>
                 <tr {{--v-for="(inventoryMission,i) in inventoryMissions"--}} v-for="(inventoryMission, i) in 显示记录列" :key="i"
-                    :style="{'opacity': inventoryMission.mark==='跳过'||inventoryMission.mark==='确认差异'?'0.7':''}" :class="[
+                    :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}" :class="[
                     inventoryMission.mark==='已复盘有差异'?'td-cool':'',
                     inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
                     inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
@@ -419,7 +425,7 @@
                             <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
                                   @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
                             <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
-                                  @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">提交</span>
+                                  @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">确认差异</span>
                             <span class="btn  btn-sm btn-outline-secondary"
                                   v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
                                   @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
@@ -433,11 +439,12 @@
                style="background: rgb(255, 255, 255);" ref="box">
             <tbody>
             <tr {{--v-for="(inventoryMission,i) in 显示记录列"--}} v-for="(inventoryMission, i) in 显示记录列" :key="i"
-                :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':''}"
+                :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}"
                 :class="[
                     inventoryMission.mark==='已复盘有差异'?'td-cool':'',
                     inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
                     inventoryMission.mark==='未复盘有差异'?'td-warm font-weight-bold':'',
+                    inventoryMission.mark==='确认差异'?'td-warm font-weight-bold':'',
                     inventoryMission.mark==='无差异'?'text-muted':'',
                     inventoryMission.mark==='未盘'?'td-yellow':'',
                     inventoryMission.mark==='跳过'?'text-muted':'',
@@ -502,7 +509,7 @@
                                 <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.checked==='否'"
                                       @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
                                      <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
-                                           @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">提交</span>
+                                           @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">确认差异</span>
                                     <span class="btn  btn-sm btn-outline-secondary"
                                           v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
                                           @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
@@ -683,6 +690,7 @@
             },
             beforeMount: function () {
                 this.重排序并标记全列表类型();
+                this.加载下方数据并置空上方数据()//初始化先调用一次
             },
             watch: {
                 checkData: {
@@ -698,9 +706,6 @@
                     deep: true
                 }
             },
-            created() {
-                this.加载下方数据并置空上方数据()//初始化先调用一次
-            },
             destroyed() {
                 window.removeEventListener('scroll', this.lazy)
             },
@@ -850,7 +855,7 @@
                         })
                     } else {
                         _this.inventoryMissions.map((inventoryMission, index) => {
-                            if (_this.显示记录列.length < 10 + count) {
+                            if (_this.显示记录列.length < 15 + count) {
                                 if (_this.显示记录列.length < _this.inventoryMissions.length) {
                                     _this.显示记录列.push(_this.inventoryMissions[_this.显示记录列.length])
                                 }
@@ -964,6 +969,7 @@
                     _this.selectingId=id;
                     if(e.key==='Enter'){
                         this.放置焦点光标至正确位置();
+
                         let re=true;
                         _this.提交新增并盘点().then(function(result){
                             if(!result){
@@ -1137,9 +1143,9 @@
                                         $("#lastStockInventoryRecord").modal('show');
                                         return;
                                     }
-                                    _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
-                                    _this.清空指定盘点记录列();
                                 }
+                                _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
+                                _this.清空指定盘点记录列();
                             }
                         })
                     });
@@ -1207,10 +1213,6 @@
                                 _this.已复盘无差异列.push(mission);
                                 mission.mark = '已复盘无差异';
                                 return;
-                            case '确认差异':
-                                _this.确认差异列.push(mission);
-                                mission.mark = '确认差异';
-                                return;
                             case '是':
                                 if (parseInt(mission.difference_amount)) {
                                     _this.未复盘有差异列.push(mission);
@@ -1220,6 +1222,10 @@
                                 _this.无差异列.push(mission);
                                 mission.mark = '无差异';
                                 return;
+                            case '确认差异':
+                                _this.确认差异列.push(mission);
+                                mission.mark = '确认差异';
+                                return;
                             case '否':
                                 _this.未盘列.push(mission);
                                 mission.mark = '未盘';
@@ -1245,9 +1251,9 @@
                     _this.inventoryMissions = [];
                     _this.重推入(_this.inventoryMissions, _this.已复盘有差异列);
                     _this.重推入(_this.inventoryMissions, _this.未复盘有差异列);
-                    _this.重推入(_this.inventoryMissions, _this.确认差异列);
                     _this.重推入(_this.inventoryMissions, _this.未盘分隔列2);
                     _this.重推入(_this.inventoryMissions, _this.未盘分隔列1);
+                    _this.重推入(_this.inventoryMissions, _this.确认差异列);
                     _this.重推入(_this.inventoryMissions, _this.已复盘无差异列);
                     _this.重推入(_this.inventoryMissions, _this.无差异列);
                     _this.重推入(_this.inventoryMissions, _this.跳过列);
@@ -1367,9 +1373,7 @@
                 },
                 跳过盘点记录(inventoryAccountMissionId, inventoryAccountId, name) {
                     let _this = this;
-                    if (!confirm('确定要跳过商品为:“' + name + '”的盘点记录吗?')) {
-                        return ;
-                    }
+                    if (!confirm('确定要跳过商品为:“' + name + '”的盘点记录吗?')) {return ;}
                     let url = '{{url('inventory/跳过盘点记录')}}';
                     axios.post(url, {
                         inventoryAccountMissionId: inventoryAccountMissionId,
@@ -1388,7 +1392,7 @@
                                     return true
                                 });
                             }
-                            _this.重排序并标记全列表类型(_this.inventoryMissions);
+                            _this.重排序并显示();
                             tempTip.setDuration(3000);
                             tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '跳过盘点成功!');
                         }).catch(function (err) {
@@ -1398,9 +1402,7 @@
                 },
                 确认盘点差异(inventoryAccountMissionId, inventoryAccountId, name) {
                     let _this = this;
-                    if (!confirm('确定提交商品为:“' + name + '”的盘点差异吗?')) {
-                        return ;
-                    }
+                    if (!confirm('确定提交商品为:“' + name + '”的盘点差异吗?')) {return ;}
                     let url = '{{url('inventory/确认盘点差异')}}';
                     axios.post(url, {
                         inventoryAccountMissionId: inventoryAccountMissionId,
@@ -1419,7 +1421,7 @@
                                     return true
                                 });
                             }
-                            _this.重排序并标记全列表类型(_this.inventoryMissions);
+                            _this.重排序并显示();
                             tempTip.setDuration(3000);
                             tempTip.showSuccess('盘点记录:' + inventoryAccountMissionId + '提交盘点差异成功!');
                         }).catch(function (err) {
@@ -1427,6 +1429,39 @@
                         tempTip.show('提交盘点差异记录失败,网络链接错误!' + err);
                     });
                 },
+                批量跳过或确认差异(){
+                    let _this = this;
+                    if (!confirm('确定对勾选内容进行批量操作吗?')) {return ;}
+                    let url = '{{url('inventory/批量跳过或确认差异')}}';
+                    axios.post(url, {checkData: _this.checkData}).then(
+                        function (response) {
+                            if (!response.data.success) {
+                                tempTip.setDuration(3000);
+                                tempTip.show('批量操作失败!' + response.data.data);
+                            } else {
+                                response.data.inventoryAccountMissions.forEach(function (mission) {
+                                    _this.库位索引_记录[mission.location].forEach(function(missionInIndex){
+                                        if(parseInt(missionInIndex.id)===parseInt(mission.id)){
+                                            missionInIndex.checked=mission.checked;
+                                        }
+                                    });
+                                });
+                            }
+                            _this.重排序并显示();
+                            _this.清空checkbox();
+                            tempTip.setDuration(3000);
+                            tempTip.showSuccess('批量操作成功!');
+                        }).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show('批量操作失败,网络链接错误!' + err);
+                    });
+                },
+                重排序并显示(){
+                    let _this=this;
+                    _this.显示记录列=[];
+                    _this.重排序并标记全列表类型(_this.inventoryMissions);
+                    _this.加载下方数据并置空上方数据();
+                },
                 完结盘点任务(id, owner_name, type) {
                     if (!confirm('确定完结货主为:“' + owner_name + '”的“' + type + '”任务吗?')) {
                         return;
@@ -1579,6 +1614,9 @@
                         this.inputs()[key]='';
                     }
                 },
+                清空checkbox(){
+                    this.checkData=[];
+                },
                 不覆盖() {
                     let _this = this;
                     _this.清空指定盘点记录列();
@@ -1691,7 +1729,7 @@
                             delete inventoryMission.commodity;
                         });
                         let data = JSON.stringify(this.checkData);
-                        excelExport(checkAllSign,data,url,this.sum,token);
+                        //excelExport(checkAllSign,data,url,this.sum,token);
                     }
                 },
                 //盲收

+ 1 - 0
routes/web.php

@@ -385,6 +385,7 @@ Route::group(['prefix'=>'inventory'],function(){
     Route::any('删除盘点记录','InventoryAccountController@删除盘点记录');
     Route::post('跳过盘点记录','InventoryAccountController@跳过盘点记录');
     Route::post('确认盘点差异','InventoryAccountController@确认盘点差异');
+    Route::post('批量跳过或确认差异','InventoryAccountController@批量跳过或确认差异');
     Route::get('完结盘点任务/{id}','InventoryAccountController@完结盘点任务');
     Route::post('修改质量状态','InventoryAccountController@修改质量状态');
     Route::post('增加系统之外的盘点记录','InventoryAccountController@增加系统之外的盘点记录');