Sfoglia il codice sorgente

编辑 修改 托盘 状态

oyq28 1 anno fa
parent
commit
39f50f8553

+ 7 - 0
src/main/java/com/imcs/admin/business/dao/WInventoryManagementDetailDao.java

@@ -0,0 +1,7 @@
+package com.imcs.admin.business.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.imcs.admin.entity.WInventoryManagementDetail;
+
+public interface WInventoryManagementDetailDao extends BaseMapper<WInventoryManagementDetail> {
+}

+ 5 - 2
src/main/java/com/imcs/admin/business/service/impl/BaseServiceImpl.java

@@ -20,6 +20,7 @@ import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 public class BaseServiceImpl {
     @Autowired
@@ -47,6 +48,8 @@ public class BaseServiceImpl {
 
     @Resource
     public WInventoryManagementDao wInventoryManagementDao;
+    @Resource
+    public WInventoryManagementDetailDao wInventoryManagementDetailDao;
 
     @Autowired
     public ImportOrExportPolicyService importOrExportPolicyService;
@@ -124,11 +127,11 @@ public class BaseServiceImpl {
 
                 //查询 大 小 库位 被占用
                 List<WStorageLocationManagement> subStorage = storageLocationDao.getSubStorage(ykCode);
-
+                List<String> collect = subStorage.stream().map(WStorageLocationManagement::getLocationCode).collect(Collectors.toList());
                 if(CollectionUtil.isNotEmpty(subStorage)){
 
                     LambdaQueryWrapper<WInventoryManagement> inventoryWrapper = Wrappers.lambdaQuery(WInventoryManagement.class)
-                                .in(WInventoryManagement::getStorageLocationCode,subStorage);
+                                .in(WInventoryManagement::getStorageLocationCode,collect);
 
                     //查库存
                     //如果目标库位的内侧库位存在托盘阻挡,则需要移库

+ 59 - 0
src/main/java/com/imcs/admin/business/service/impl/WStorageLocationManagementServiceImpl.java

@@ -11,6 +11,8 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Random;
+
 /**
  * 库位管理(WStorageLocationManagement)表服务实现类
  *
@@ -55,6 +57,34 @@ public class WStorageLocationManagementServiceImpl extends BaseServiceImpl imple
 
     @Override
     public String init() {
+        List<WPalletManagement> wPalletManagementList=new ArrayList<>();
+        for(int i =0;i<26*8*4;i++){
+            Random random = new Random();
+            int min = 1;
+            int max = 10;
+            int randomInt = random.nextInt(max - min + 1) + min;
+            if(randomInt % 2 == 0){
+                for (int y=1;y<3;y++){
+                    WPalletManagement wPalletManagement=new WPalletManagement();
+                    wPalletManagement.setPalletCode("TP_"+i+"_"+y);
+                    wPalletManagement.setPalletType(2);
+                    wPalletManagement.setStatus(1);
+                    wPalletManagementDao.insert(wPalletManagement);
+                    wPalletManagementList.add(wPalletManagement);
+                }
+            }else{
+                WPalletManagement wPalletManagement=new WPalletManagement();
+                wPalletManagement.setPalletCode("TP_"+i);
+                wPalletManagement.setPalletType(1);
+                wPalletManagement.setStatus(1);
+                wPalletManagementDao.insert(wPalletManagement);
+                wPalletManagementList.add(wPalletManagement);
+            }
+
+        }
+
+        int k=0;
+
         LambdaQueryWrapper<WShelfManagement> wrapper = Wrappers.lambdaQuery(WShelfManagement.class);
         List<WShelfManagement> wShelfManagements = wShelfManagementDao.selectList(wrapper);
         for(WShelfManagement wShelfManagement:wShelfManagements){
@@ -92,6 +122,35 @@ public class WStorageLocationManagementServiceImpl extends BaseServiceImpl imple
                     wStorageLocationManagementb.setShelfManagementId(wShelfManagement.getId());
                     wStorageLocationManagementb.setParentId(wStorageLocationManagement.getId());
                     wStorageLocationManagementDao.insert(wStorageLocationManagementb);
+
+
+                    if(wShelfManagement.getDistanceRoadwayNumber() == 0){
+                        WInventoryManagement wInventoryManagement=new WInventoryManagement();
+                        Random random = new Random();
+                        int min = 1;
+                        int max = 10;
+                        int randomInt = random.nextInt(max - min + 1) + min;
+                        if(randomInt % 2 == 0){
+                            wInventoryManagement.setStorageLocationCode(wShelfManagement.getShelfCode()+"-"+y+"-"+z);
+                        }else{
+                            wInventoryManagement.setStorageLocationCode(wShelfManagement.getShelfCode()+"-"+y+"-"+z+"-"+"01");
+                        }
+                        wInventoryManagement.setPalletCode(wPalletManagementList.get(k).getPalletCode());
+                        wInventoryManagementDao.insert(wInventoryManagement);
+
+                        WInventoryManagementDetail wInventoryManagementDetail=new WInventoryManagementDetail();
+                        Random random2 = new Random();
+                        // 生成一个从 0 到 25 的随机整数
+                        int randomIndex = random2.nextInt(26);
+
+                        // 将随机整数转换为对应的字母
+                        char randomLetter = (char) ('a' + randomIndex);
+                        wInventoryManagementDetail.setMaterialCode(String.valueOf(randomLetter));
+                        wInventoryManagementDetail.setAmount(10);
+                        wInventoryManagementDetail.setInventoryManagementId(wInventoryManagement.getId());
+                        wInventoryManagementDetailDao.insert(wInventoryManagementDetail);
+                    }
+                    k++;
                 }
             }
         }

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

@@ -41,7 +41,7 @@ public class WPalletManagement implements Serializable {
 /**
      * 托盘状态
      */
-    private String status;
+    private Integer status;
 /**
      * 创建时间
      */

+ 15 - 1
src/main/resources/static/wms/in/add.html

@@ -94,7 +94,7 @@
             <el-table-column prop="outLocationCode" label="库位编码" :show-overflow-tooltip="true"></el-table-column>
             <el-table-column label="托盘" :show-overflow-tooltip="true">
                 <template #default="{ row }">
-                    <el-select v-model="row.outPalletCode" placeholder="请选择">
+                    <el-select v-model="row.outPalletCode" placeholder="请选择" @change="handleSelectChange(row)">
                         <el-option
                                 v-for="option in row.locationOptions"
                                 :key="option.storageLocationCode"
@@ -221,6 +221,12 @@
                 this.selection = selection
             },addNewRow() {
                 // Define your new row object
+                /*if(this.entryPoint === ''){
+                    this.$message.error('请选择当前入库口');
+                    return
+                }*/
+
+
                const code= this.inputCode
                 //判断输入的是托盘编码 料箱编码 物料编码
                 axios.get('/order/verifyCode/'+code, {
@@ -414,6 +420,14 @@
                 return row.planAmount - row.realAmount;
             },handleInput(row){
                     row.planAmount=row.amount;
+            },handleSelectChange(row){
+                console.log(row)
+                row.locationOptions.forEach(item=>{
+                    if(row.outPalletCode === item.palletCode){
+                        row.outLocationCode=item.storageLocationCode;
+                        return
+                    }
+                })
             }
         }
 

+ 13 - 1
src/main/resources/static/wms/in/edit.html

@@ -94,7 +94,7 @@
             <el-table-column prop="outLocationCode" label="库位编码" :show-overflow-tooltip="true"></el-table-column>
             <el-table-column label="托盘" :show-overflow-tooltip="true">
                 <template #default="{ row }">
-                    <el-select v-model="row.outPalletCode" placeholder="请选择">
+                    <el-select v-model="row.outPalletCode" placeholder="请选择" @change="handleSelectChange(row)">
                         <el-option
                                 v-for="option in row.locationOptions"
                                 :key="option.storageLocationCode"
@@ -231,6 +231,10 @@
                 this.selection = selection
             },addNewRow() {
                 // Define your new row object
+                /*if(this.entryPoint === ''){
+                    this.$message.error('请选择当前入库口');
+                    return
+                }*/
                const code= this.inputCode
                 //判断输入的是托盘编码 料箱编码 物料编码
                 axios.get('/order/verifyCode/'+code, {
@@ -437,6 +441,14 @@
                     })
                     row.amount=row.planAmount;
                 }
+            },handleSelectChange(row){
+                console.log(row)
+                row.locationOptions.forEach(item=>{
+                    if(row.outPalletCode === item.palletCode){
+                        row.outLocationCode=item.storageLocationCode;
+                        return
+                    }
+                })
             }
         }