自动化立体仓库 - WMS系统
zwl
2 天以前 757f103f37d83dfb55bb49b3df0b805cb520d4f7
src/main/java/com/zy/common/service/CommonService.java
@@ -143,82 +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("没有待测库位无法入库!!!");
                }
            }
        }
        // 靠近摆放规则 --- 空托
        if (staDescId == 10) {
            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow));
            if (locMasts.size() > 0) {
                for (LocMast loc : locMasts) {
                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
                        continue;
                    }
                    String shallowLocNo = Utils.getShallowLoc(slaveProperties,  loc.getLocNo());
                    // 检测目标库位是否为空库位
                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                        if (shallowLoc.getLocType1()<locTypeDto.getLocType1()){
                            continue;
                        }
                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                            locMast = shallowLoc;
                            crnNo = locMast.getCrnNo();
                            break;
                        }
                    }
                }
            }
            if (Cools.isEmpty(locMast)) {
                List<LocMast> locMastList3 = locMastService.selectList(new EntityWrapper<LocMast>()
                    .eq("loc_type1", (short) 3)//待测库位
                    .orderBy("row1",true)
                    .orderBy("bay1",true));
            List<LocMast> locMast2 = locMastService.selectList(new EntityWrapper<LocMast>()
                        .eq("loc_sts", "O")
                        .eq("row1",3)
                        .notIn("loc_type1",1));
                if (!Cools.isEmpty(locMastList3)) {
                    locMast = locMastList3.get(0);
                }else {
                    List<LocMast> locMastList1 = locMastService.selectList(new EntityWrapper<LocMast>()
                    .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("row1",1)
                            .notIn("loc_type1",1));
                    if (!Cools.isEmpty(locMastList1)) {
                        locMast = locMastList1.get(0);
                    .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("没有空库位");
        }