Sfoglia il codice sorgente

盘库任务bug修复

wudingsheng 1 anno fa
parent
commit
368f9b4928

+ 25 - 26
src/main/java/com/imcs/admin/business/service/impl/WPInventoryCountPalletServiceImpl.java

@@ -86,51 +86,50 @@ public class WPInventoryCountPalletServiceImpl extends BaseServiceImpl implement
         wPInventoryCountPallet.setWPInventoryCountTaskId(wPInventoryCountPallet.getTaskId());
         this.wPInventoryCountPalletDao.insert(wPInventoryCountPallet);
         wPInventoryCountPallet.getDetailList().forEach(vo->{
-            WInventoryManagementDetail wInventoryManagementDetail=new WInventoryManagementDetail();
-            BeanUtils.copyProperties(vo,wInventoryManagementDetail);
-            wInventoryManagementDetail.setAmount(vo.getRealAmount());
-            wInventoryManagementDetailDao.updateById(wInventoryManagementDetail);
+            //前端传status=2 直接修改详情状态值,防止用户重复盘库
             vo.setId(null);
             vo.setWPInventoryCountPalletId(wPInventoryCountPallet.getId());
             wpInventoryCountPalletDetailDao.insert(vo);
-            // TODO 更新库存
-
+            // TODO 更新库存 任务完成后修改库存
+            /*WInventoryManagementDetail wInventoryManagementDetail=new WInventoryManagementDetail();
+            BeanUtils.copyProperties(vo,wInventoryManagementDetail);
+            wInventoryManagementDetail.setAmount(vo.getRealAmount());
+            wInventoryManagementDetailDao.updateById(wInventoryManagementDetail);*/
 
 
         });
 
-        // 开始时间 和 结束时间
+
+        // 修改 开始时间 和 结束时间
         LambdaQueryWrapper<WPInventoryCountPallet> wrapper= Wrappers.lambdaQuery(WPInventoryCountPallet.class).eq(WPInventoryCountPallet::getStatus,2).eq(WPInventoryCountPallet::getWPInventoryCountTaskId,wPInventoryCountPallet.getTaskId());
         Long count = wPInventoryCountPalletDao.selectCount(wrapper);
 
         WPInventoryCountTask wpInventoryCountTask=new WPInventoryCountTask();
         wpInventoryCountTask.setId(wPInventoryCountPallet.getTaskId());
-        if(count==0){
-            wpInventoryCountTask.setEndTime(new Date());
-        }else if(count==1){
+        if(count==1){
             wpInventoryCountTask.setStartTime(new Date());
             wpInventoryCountTask.setStatus(1);
+            wPInventoryCountTaskDao.update(wpInventoryCountTask);
+        }else if(count >1){
+            List<WInventoryManagement> palletList = this.getPalletList(wPInventoryCountPallet.getTaskId());
+            if(count.intValue()== palletList.size()){
+                wpInventoryCountTask.setEndTime(new Date());
+                wpInventoryCountTask.setStatus(2);
+                wPInventoryCountTaskDao.update(wpInventoryCountTask);
+            }
         }
 
-        wPInventoryCountTaskDao.update(wpInventoryCountTask);
 
 
-        //这个状态最适合的位置应该是在 wcs入库完成后去更改任务状态
-        /*WPInventoryCountTask wpInventoryCountTask=new WPInventoryCountTask();
-        wpInventoryCountTask.setId(wPInventoryCountPallet.getTaskId());
-        if(wPInventoryCountPallet.getIsFinsh()){
-            wpInventoryCountTask.setStatus(2);
-
-        }else{
-            wpInventoryCountTask.setStatus(1);
-        }
-        //更新盘库任务状态
-        wPInventoryCountTaskDao.update(wpInventoryCountTask);*/
-
         //入库任务
-        //获取入库口 对应的 大小托盘
+        //获取托盘类型 以获取对应库位
+        LambdaQueryWrapper<WPalletManagement> palletWrapper=Wrappers.lambdaQuery(WPalletManagement.class).eq(WPalletManagement::getPalletCode,wPInventoryCountPallet.getPalletCode());
+        WPalletManagement wPalletManagement = wPalletManagementDao.selectOne(palletWrapper);
+
+/*
         Dic entryPointPalletType = dicDao.getListByLabel("entryPointPalletType", wPInventoryCountPallet.getEntryPoint());
-        PolicyInputQuery policyQuery = createPolicyQuery(Integer.valueOf(entryPointPalletType.getValue()),null);
+*/
+        PolicyInputQuery policyQuery = createPolicyQuery(wPalletManagement.getPalletType(),null);
         Result importPolicy = importOrExportPolicyService.findImportPolicy(policyQuery);
         if(importPolicy.getData() == null){
             throw new RuntimeException("无可用库位,请联系管理员!");
@@ -145,7 +144,7 @@ public class WPInventoryCountPalletServiceImpl extends BaseServiceImpl implement
         wInventoryTransactionTask.setEndPosition(locationCode);
         wInventoryTransactionTask.setVectorCode(wPInventoryCountPallet.getPalletCode());
         wInventoryTransactionTask.setStatus(0);
-        wInventoryTransactionTask.setTaskType(4);
+        wInventoryTransactionTask.setTaskType(2);
         wInventoryTransactionTask.setWPInventoryCountTaskId(wPInventoryCountPallet.getTaskId());
         wInventoryTransactionTask.setCreatedAt(new Date());
         wInventoryTransactionTask.setCreatedBy(getUserId());

+ 1 - 1
src/main/java/com/imcs/admin/entity/WInventoryTransactionTask.java

@@ -56,7 +56,7 @@ public class WInventoryTransactionTask extends PageSize implements Serializable
      */
     private Integer status;
 /**
-     * 任务类型(1 出库 2 入库  3 移库 4 盘库)
+     * 任务类型(1 出库 2 入库  )   作废 3 移库 4 盘库
      */
     private Integer taskType;
 /**

+ 128 - 89
src/main/resources/static/wms/plan/taskIndex.html

@@ -112,7 +112,7 @@
                                     <template #default="scope">
                                         <!-- 这里放置操作按钮 -->
                                         <div class="button-group">
-                                            <el-button type="primary" icon="el-icon-check"  :disabled="scope.row.status===2">出库</el-button>
+                                            <el-button type="primary" icon="el-icon-check"  :disabled="scope.row.status===2" @click="getOutPalletCode(scope.row)">出库</el-button>
                                         </div>
                                     </template>
                                 </el-table-column>
@@ -187,7 +187,7 @@
                 detailListStore: [],
                 detailListPallet: [],
                 detailListOut: [],
-                options:[],
+                options: [],
                 name: '',
                 entryPoint: '',
                 binCode: '',
@@ -201,31 +201,31 @@
                 formInline: {
                     taskCode: ''
                 },
-                detailType:'',
-                palletCode:'',
-                dialogVisible:false,
-                dialogVisibleTask:false,
-                inputDisabled:false,
+                detailType: '',
+                palletCode: '',
+                dialogVisible: false,
+                dialogVisibleTask: false,
+                inputDisabled: false,
                 plan: this.initOrder(),
                 rules: {
                     planName: [
-                        { required: true, message: '必填', trigger: 'blur' },
+                        {required: true, message: '必填', trigger: 'blur'},
                     ],
                     planType: [
-                        { required: true, message: '必填', trigger: 'blur' },
+                        {required: true, message: '必填', trigger: 'blur'},
                     ],
                     planStrategy: [
-                        { required: true, message: '必填', trigger: 'blur' },
+                        {required: true, message: '必填', trigger: 'blur'},
                     ],
                     planInput: [
-                        { required: true, message: '必填', trigger: 'blur' },
+                        {required: true, message: '必填', trigger: 'blur'},
                     ],
                 },
-                inputCode:'',
+                inputCode: '',
                 selection: [],
-                isViewMode:false,
-                planId:'',
-                wInventoryTransactionOrdersId:'',
+                isViewMode: false,
+                planId: '',
+                wInventoryTransactionOrdersId: '',
             }
         },
         created() {
@@ -239,14 +239,14 @@
                 this.currentPageSize = pageSize;
                 this.queryClick();
             },
-            initOrder(){
-                return{
-                    planName:'',
-                    planStrategy:'',
-                    planInput:'',
-                    planTime:'',
-                    remarks:'',
-                    planType:''
+            initOrder() {
+                return {
+                    planName: '',
+                    planStrategy: '',
+                    planInput: '',
+                    planTime: '',
+                    remarks: '',
+                    planType: ''
                 }
             },
             handleCurrentChange(page) {
@@ -294,10 +294,10 @@
                 this.loading = true;
 
                 axios.get('/wPInventoryCountTask', {
-                    params:{
+                    params: {
                         page: this.currentPage,
                         size: this.currentPageSize,
-                        taskCode:this.formInline.taskCode
+                        taskCode: this.formInline.taskCode
                     }
                 })
                     .then(response => {
@@ -350,7 +350,7 @@
                 }
 
             }, getProfitLossTypeText(status) {
-               /* if(status === null){
+                /* if(status === null){
                     let ag= row.realAmount - row.storeAmount;
                     if(ag > 0){
                         return '盘盈';
@@ -375,58 +375,57 @@
 
             }, getPendingAmount(row) {
                 return row.realAmount - row.storeAmount;
-            },handleSelectionChange(selection) {
+            }, handleSelectionChange(selection) {
                 this.selection = selection
-            },toDo(id){
-                this.dialogVisibleTask=true;
-                this.wPInventoryCountTaskId=id;
-                axios.get('/wPInventoryCountPallet/getPalletList/'+id, {
-                })
+            }, toDo(id) {
+                this.dialogVisibleTask = true;
+                this.wPInventoryCountTaskId = id;
+                axios.get('/wPInventoryCountPallet/getPalletList/' + id, {})
                     .then(response => {
                         console.log(response)
-                        if(response.data.success){
-                            this.detailListTask=response.data.data;
-                            this.isViewMode=true;
+                        if (response.data.success) {
+                            this.detailListTask = response.data.data;
+                            this.isViewMode = true;
                         }
                     })
                     .catch(error => {
                         // 处理错误
                     });
 
-            },handleCloseTask(){
-                this.dialogVisibleTask=false;
-                this.detailListPallet=[];
-                this.inputCode='';
-                this.palletCode='';
-                this.detailList=[];
-                this.entryPoint='';
-            },handleSelectChange(row){
+            }, handleCloseTask() {
+                this.dialogVisibleTask = false;
+                this.detailListPallet = [];
+                this.inputCode = '';
+                this.palletCode = '';
+                this.detailList = [];
+                this.entryPoint = '';
+            }, handleSelectChange(row) {
                 console.log(row)
-                row.inventoryManagementList.forEach(item=>{
-                    if(row.outPalletCode === item.palletCode){
-                        row.storageLocationCode=item.storageLocationCode;
-                        row.amount=item.amount;
+                row.inventoryManagementList.forEach(item => {
+                    if (row.outPalletCode === item.palletCode) {
+                        row.storageLocationCode = item.storageLocationCode;
+                        row.amount = item.amount;
                         return
                     }
                 })
             },
-            rowClick(row, column, event){
+            rowClick(row, column, event) {
                 console.log(row)
-                this.detailList=row.detailList;
-                this.isViewMode=false;
-                this.selection=row;
-                this.inputDisabled=row.status===2;
-            },orderDelete(row){
+                this.detailList = row.detailList;
+                this.isViewMode = false;
+                this.selection = row;
+                this.inputDisabled = row.status === 2;
+            }, orderDelete(row) {
                 this.$confirm('确认删除?')
                     .then(_ => {
                         axios.delete('/wPInventoryCountTask', {
-                            params:{
-                                id:row.id
+                            params: {
+                                id: row.id
                             }
                         })
                             .then(response => {
                                 console.log(response)
-                                if(response.data){
+                                if (response.data) {
                                     this.$message({
                                         message: '删除成功',
                                         type: "success"
@@ -439,27 +438,28 @@
                             });
                         done();
                     })
-                    .catch(_ => {});
+                    .catch(_ => {
+                    });
 
             },
-            handleInput(row){
+            handleInput(row) {
                 console.log(row)
 
-                let ag= row.realAmount - row.storeAmount;
-                row.profitLossQuantity=ag
-                if(ag > 0){
-                    row.profitLossType='盘盈';
-                }else if(ag === 0){
-                    row.profitLossType='正常';
-                }else{
-                    row.profitLossType='盘亏';
+                let ag = row.realAmount - row.storeAmount;
+                row.profitLossQuantity = ag
+                if (ag > 0) {
+                    row.profitLossType = '盘盈';
+                } else if (ag === 0) {
+                    row.profitLossType = '正常';
+                } else {
+                    row.profitLossType = '盘亏';
                 }
 
 
-            },handleScan(){
+            }, handleScan() {
                 console.log(this.inputCode)
-                this.palletCode=this.inputCode;
-                this.inputCode='';
+                this.palletCode = this.inputCode;
+                this.inputCode = '';
 
 
                 /*axios.get('/order/verifyCode/'+this.inputCode, {
@@ -552,24 +552,24 @@
                     });*/
 
 
-            },outSubmit(){
+            }, outSubmit() {
 
                 console.log(this.selection)
-                if(this.entryPoint===''){
+                if (this.entryPoint === '') {
                     this.$message({
                         message: '入库口不能为空',
                         type: "error"
                     })
                     return
                 }
-                if(this.selection.palletCode != this.palletCode){
+                if (this.selection.palletCode != this.palletCode) {
                     this.$message({
                         message: '选中托盘编码和扫描托盘编码不一致,请核对',
                         type: "error"
                     })
                     return
                 }
-                if(this.selection.status===2){
+                if (this.selection.status === 2) {
                     this.$message({
                         message: '选中托盘已盘库完成',
                         type: "error"
@@ -577,8 +577,8 @@
                     return
                 }
 
-                this.detailList.forEach(item=>{
-                    if(item.realAmount === '' || item.realAmount <= 0){
+                this.detailList.forEach(item => {
+                    if (item.realAmount === '' || item.realAmount <= 0) {
                         this.$message({
                             message: '盘点数量不能为空或小于等于0',
                             type: "error"
@@ -586,25 +586,28 @@
                         return
                     }
                 })
-                 /*const remainingTasks = this.detailListTask.filter(task => !this.selection.includes(task));
+                /*const remainingTasks = this.detailListTask.filter(task => !this.selection.includes(task));
 
                 const allStatusTwo = remainingTasks.every(task => task.status === 2);*/
 
                 axios.post('/wPInventoryCountPallet', {
-                    'wPInventoryCountTaskId':this.wPInventoryCountTaskId,
-                    'taskId':this.wPInventoryCountTaskId,
-                    'entryPoint':this.entryPoint,
-                    'palletCode':this.selection.palletCode,
-                    'storageLocationCode':this.selection.storageLocationCode,
-                    'status':2,
-                    'detailList':this.detailList
+                    'wPInventoryCountTaskId': this.wPInventoryCountTaskId,
+                    'taskId': this.wPInventoryCountTaskId,
+                    'entryPoint': this.entryPoint,
+                    'palletCode': this.selection.palletCode,
+                    'storageLocationCode': this.selection.storageLocationCode,
+                    'status': 2,
+                    'detailList': this.detailList
                 })
                     .then(response => {
-                        if(response.data.success){
+                        if (response.data.success) {
                             this.$message({
                                 message: '操作成功',
                                 type: 'success'
                             });
+                            this.entryPoint='';
+                            this.palletCode='';
+                            this.inputDisabled=true;
                             this.toDo(this.wPInventoryCountTaskId);
                         }
 
@@ -613,7 +616,7 @@
                         // 处理错误
                     });
 
-               /* this.selection.forEach(item=>{
+                /* this.selection.forEach(item=>{
                     if(item.amount === '' || item.amount <= 0){
                         this.$message({
                             message: '本次出库数量不能为空或小于等于0',
@@ -655,15 +658,15 @@
                         // 处理错误
                     });*/
 
-            },savePlanTask(row){
+            }, savePlanTask(row) {
 
                 this.$confirm('确认生成盘点任务吗?')
                     .then(_ => {
                         axios.post('/wPInventoryCountTask', {
-                            id:row.id
+                            id: row.id
                         })
                             .then(response => {
-                                if(response.data.success){
+                                if (response.data.success) {
                                     this.$message({
                                         message: '盘点任务生成成功',
                                         type: 'success'
@@ -676,12 +679,48 @@
                             });
                         done();
                     })
-                    .catch(_ => {});
+                    .catch(_ => {
+                    });
+
+
+            }, getOutPalletCode(row) {
+                //入库口 即空托盘出库的目的地
+                const inCode = row.storageLocationCode;
+                if (this.entryPoint === '') {
+                    this.$message({
+                        message: '请选择出入库口',
+                        type: 'error'
+                    });
+                    return
+                }
+                this.getPalletCodeCon(inCode, this.entryPoint)
 
+            }, getPalletCodeCon(startPosition, endPosition) {
+                axios.get('/wStorageLocationManagement/getPalletCode', {
+                    params: {
+                        startPosition: startPosition,
+                        endPosition: endPosition
+                    }
+                })
+                    .then(response => {
+                        if (response.data.success) {
+                            const code = response.data.msg;
+                            this.$message({
+                                message: '托盘 ' + code + ' 已出库',
+                                type: 'success'
+                            });
+                        } else {
+                            this.$message.error(response.data.msg);
+                        }
 
+                    })
+                    .catch(error => {
+                        // 处理错误
+                    });
             }
         }
 
+
     })
 </script>