自动化立体仓库 - WMS系统
zwl
2 天以前 757f103f37d83dfb55bb49b3df0b805cb520d4f7
src/main/java/com/zy/common/service/CommonService.java
@@ -7,6 +7,7 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.common.entity.Parameter;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.StartupDto;
@@ -142,41 +143,47 @@
        // 更新库位排号
        rowLastno.setCurrentRow(curRow);
        rowLastnoService.updateById(rowLastno);
        if (crnNo==1){
            LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>()
                    .eq("loc_sts", "F")
                    .eq("loc_type1", (short) 3));//待测库位
            LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
        if(staDescId==1){
            List<LocMast> locMast1 = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("loc_sts", "O")
                    .eq("loc_type1", (short) 1));//测试库位
            if (!Cools.isEmpty(locMast1)||Cools.isEmpty(locMast2)){
                List<LocMast> locMasts=locMastService.selectList(new EntityWrapper<LocMast>()
                        .eq("loc_sts", "O").eq("loc_type1", (short) 3)
                        .orderBy("row1",false).orderBy("bay1",true));
                if(!Cools.isEmpty(locMasts)){
                    locMast = locMasts.get(0);
                }else{
                    throw new CoolException("没有待测库位无法入库!!!");
                }
                    .eq("loc_type1", (short) 3)//待测库位
                    .orderBy("row1",true)
                    .orderBy("bay1",true));
            List<LocMast> locMast2 = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("loc_sts", "O")
                    .eq("loc_type1", (short) 1)//测试库位
                    .orderBy("row1",true)
                    .orderBy("bay1",true));
            if (Cools.isEmpty(locMast1) || Cools.isEmpty(locMast2)) {
                throw new CoolException("没有待测和测试库位无法入库!!!");
            }
            if(!Cools.isEmpty(locMast2)){
                locMast=locMast2.get(0);
            }else if(!Cools.isEmpty(locMast1)){
                locMast=locMast1.get(0);
            }
        }else if(staDescId==10){
            List<LocMast> locMast1 = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("loc_sts", "O")
                    .eq("loc_type1", (short) 3)//待测库位
                    .orderBy("row1",true)
                    .orderBy("bay1",true));
            List<LocMast> locMast2 = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("loc_sts", "O")
                    .eq("loc_type1", (short) 1)//测试库位
                    .orderBy("row1",true)
                    .orderBy("bay1",true));
            if (Cools.isEmpty(locMast1) || Cools.isEmpty(locMast2)) {
                throw new CoolException("没有待测和测试库位无法入空托!!!");
            }
            if(!Cools.isEmpty(locMast1)){
                locMast=locMast1.get(0);
            }else if(!Cools.isEmpty(locMast2)){
                locMast=locMast2.get(0);
            }
        }
        if (Cools.isEmpty(locMast)){
            locMast = locMastService.queryFreeLocMast(1, locTypeDto.getLocType1());
//            // 开始查找库位 ==============================>
//            int ruleId = Integer.parseInt(Parameter.get().getFindLocRule());
//            if (whsType != 1) {
//                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
//            } else if (ruleId == 1) {  //按测试设备排序,优先排满单台设备
//                locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1(), channelMax + 1);
//            } else if (ruleId == 2) {  //按通道排序,均匀分配每台设备
//                Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1());
//                locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(), locType2);
//            } else { //默认规则
//                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
//            }
        }
        if (Cools.isEmpty(locMast)) {
            throw new CoolException("没有空库位");
        }