自动化立体仓库 - WMS系统
#
18516761980
2021-09-11 0eb4bcffe0c6e017f9a9967576f12818c9b05db7
#
4个文件已添加
41个文件已修改
1161 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MatStoreController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocMastMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/PltBarcodeMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/LocDetlService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/LocMastService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/PltBarcodeService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MatStoreServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/PltBarcodeServiceImpl.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/PltBarcodeLogScheduler.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/PlcLogHandler.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/PltBarcodeLogHandle.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/Utils.java 175 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/VersionUtils.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/LocTypeDto.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/properties/SlaveProperties.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/service/CommonService.java 328 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/WcsController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/IoCompleteController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/IoCompleteLogController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/WaitMatchkController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/WaitMatchkLogController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/WaitMatinLogController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/WaitMatoutLogController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/task/IoCompleteLogScheduler.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocMastMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WaitMatinMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/WaitMatoutMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/ioCompleteLog/ioCompleteLog.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/pltBarcode/pltBarcode.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/waitMatchkLog/waitMatchkLog.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/waitMatinLog/waitMatinLog.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/waitMatoutLog/waitMatoutLog.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/ioCompleteLog/ioCompleteLog.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/waitMatchk/waitMatchk.html 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/waitMatchkLog/waitMatchkLog.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/waitMatinLog/waitMatinLog.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/waitMatoutLog/waitMatoutLog.html 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MatStoreController.java
@@ -28,7 +28,6 @@
    @RequestMapping("/mat/store/start")
    @ManagerAuth(memo = "入库启动(通知档)")
    public R matStoreStart(@RequestBody FullStoreParam fullStoreParam) {
//        return R.ok("入库启动成功").add(workService.startupFullPutStore(fullStoreParam,getUserId()));
        return R.ok("入库启动成功").add(matStoreService.startupFullStore(fullStoreParam,getUserId()));
    }
}
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
@@ -25,8 +25,8 @@
    @Update("update asr_loc_detl set loc_no = #{newLocNo}, modi_time=getDate() where loc_no = #{oldLocNo}")
    int updateLocNo(String newLocNo, String oldLocNo);
    @Select("SELECT ld.loc_no FROM asr_loc_detl ld LEFT JOIN asr_loc_mast lm ON ld.loc_no = lm.loc_no WHERE (1 = 1 AND ld.mat_no = #{matNo} AND lm.loc_sts = 'F' AND DateDiff(dd, lm.modi_time, getdate()) = 0) ORDER BY lm.modi_time ASC")
    List<String> selectSameDetlToday(String matNo);
    @Select("SELECT ld.loc_no FROM asr_loc_detl ld LEFT JOIN asr_loc_mast lm ON ld.loc_no = lm.loc_no WHERE (1 = 1 AND ld.mat_no = #{matNo} AND (lm.row1 >= #{start} AND lm.row1 <= #{end})  AND lm.loc_sts = 'F' AND DateDiff(dd, lm.modi_time, getdate()) = 0) ORDER BY lm.modi_time ASC")
    List<String> selectSameDetlToday(@Param("matNo") String matNo, @Param("start") Integer start, @Param("end") Integer end);
    List<LocDetl> selectLocDetlList(@Param("mat_no") String matNo);
src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -13,9 +13,14 @@
@Repository
public interface LocMastMapper extends BaseMapper<LocMast> {
    LocMast queryFreeLocMast(@Param("row") Integer row);
    LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1, @Param("locType2") Short locType2, @Param("locType3") Short locType3);
    @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}")
    List<String> queryGroupEmptyStock(Integer crnNo);
//    @Select("select count(*) as count from asr_loc_mast where 1=1 and loc_sts = 'O' and loc_type1 = #{locType1} and loc_type2 = #{locType2} and loc_type3 = #{locType3} and crn_no = #{crnNo}")
@Select("select count(*) as count from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo} and (loc_type1 is null or loc_type1 = #{locType1}) " +
        "and (loc_type2 is null or loc_type2 = #{locType2}) and (loc_type3 is null or loc_type3 = #{locType3}) ")
    Integer selectEmptyLocCount(@Param("locType1") Short locType1, @Param("locType2") Short locType2, @Param("locType3") Short locType3, @Param("crnNo") Integer crnNo);
}
src/main/java/com/zy/asrs/mapper/PltBarcodeMapper.java
@@ -1,12 +1,18 @@
package com.zy.asrs.mapper;
import com.zy.asrs.entity.PltBarcode;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.asrs.entity.PltBarcode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
@Mapper
@Repository
public interface PltBarcodeMapper extends BaseMapper<PltBarcode> {
    @Select("select * from asr_plt_barcode where io_status>=2")
    List<PltBarcode> selectToBeHistoryData();
}
src/main/java/com/zy/asrs/service/LocDetlService.java
@@ -24,7 +24,7 @@
     * @param matNo 产品号
     * @return locNo 库位号
     */
    List<String> getSameDetlToday(String matNo);
    List<String> getSameDetlToday(String matNo, Integer start, Integer end);
    /**
     *
src/main/java/com/zy/asrs/service/LocMastService.java
@@ -10,7 +10,7 @@
    /**
     * 检索可用库位
     */
    LocMast queryFreeLocMast(Integer row);
    LocMast queryFreeLocMast(Integer row, Short locType1, Short locType2, Short locType3);
    /**
     * 获取同组货架的空库位
@@ -18,4 +18,11 @@
     * @return 同组空库位集合
     */
    List<String> queryGroupEmptyStock(String sourceLocNo);
    /**
     * 检查当前库位所属巷道的空库位数量
     * @param locMast
     * @return
     */
    Boolean checkEmptyCount(LocMast locMast);
}
src/main/java/com/zy/asrs/service/PltBarcodeService.java
@@ -3,6 +3,10 @@
import com.zy.asrs.entity.PltBarcode;
import com.baomidou.mybatisplus.service.IService;
import java.util.List;
public interface PltBarcodeService extends IService<PltBarcode> {
    public List<PltBarcode> selectToBeHistoryData();
}
src/main/java/com/zy/asrs/service/impl/LocDetlServiceImpl.java
@@ -41,8 +41,8 @@
    }
    @Override
    public List<String> getSameDetlToday(String matNo) {
        return this.baseMapper.selectSameDetlToday(matNo);
    public List<String> getSameDetlToday(String matNo, Integer start, Integer end) {
        return this.baseMapper.selectSameDetlToday(matNo, start, end);
    }
    @Override
src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -18,8 +18,8 @@
    private RowLastnoService rowLastnoService;
    @Override
    public LocMast queryFreeLocMast(Integer row) {
        return this.baseMapper.queryFreeLocMast(row);
    public LocMast queryFreeLocMast(Integer row, Short locType1, Short locType2, Short locType3) {
        return this.baseMapper.queryFreeLocMast(row, locType1, locType2, locType3);
    }
    @Override
@@ -33,4 +33,13 @@
        }
        return this.baseMapper.queryGroupEmptyStock(sourceStock.getCrnNo());
    }
    @Override
    public Boolean checkEmptyCount(LocMast locMast) {
        if (locMast == null) {
            return false;
        }
        return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getLocType2(), locMast.getLocType3(), locMast.getCrnNo()) > 1;
    }
}
src/main/java/com/zy/asrs/service/impl/MatStoreServiceImpl.java
@@ -8,6 +8,7 @@
import com.zy.asrs.entity.param.FullStoreParam;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
import com.zy.ints.entity.WaitMatin;
@@ -57,7 +58,9 @@
        int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
        // 检索库位
        List<String> matNos = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatNo).distinct().collect(Collectors.toList());
        StartupDto startupDtodto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos, 0);
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        locTypeDto.setLocType1((short) 1);
        StartupDto startupDtodto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(),false, matNos,locTypeDto, 0);
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
        wrkMast.setWrkNo(workNo);
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -16,7 +16,9 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
/**
 * 移动端服务核心类
@@ -53,15 +55,21 @@
        Date now = new Date();
        if (Cools.isEmpty(param.getBillNo())) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
            Random rand = new Random();
            Integer r = rand.nextInt(900)+ 100;
            String billNo = sdf.format(new Date()) + r;
            Integer seqNo=0;
            for (CombParam.CombMat combMat : param.getCombMats()) {
                MatCode matCode = matCodeService.selectOne(new EntityWrapper<MatCode>().eq("mat_no", combMat.getMatNo()));
                if (Cools.isEmpty(matCode)) {
                    throw new CoolException("物料数据错误");
                }
                seqNo++;
                PltBarcode pltBarcode = new PltBarcode();
                pltBarcode.setBarcode(param.getBarcode());
                pltBarcode.setBillNo("");
                pltBarcode.setSeqNo(0);
                pltBarcode.setBillNo(billNo);
                pltBarcode.setSeqNo(seqNo);
                pltBarcode.setBillType(5);
                pltBarcode.setMatNo(matCode.getMatNo());
                pltBarcode.setMatName(matCode.getMatName());
src/main/java/com/zy/asrs/service/impl/PltBarcodeServiceImpl.java
@@ -1,12 +1,19 @@
package com.zy.asrs.service.impl;
import com.zy.asrs.mapper.PltBarcodeMapper;
import com.zy.asrs.entity.PltBarcode;
import com.zy.asrs.service.PltBarcodeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.entity.PltBarcode;
import com.zy.asrs.mapper.PltBarcodeMapper;
import com.zy.asrs.service.PltBarcodeService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("pltBarcodeService")
public class PltBarcodeServiceImpl extends ServiceImpl<PltBarcodeMapper, PltBarcode> implements PltBarcodeService {
    @Override
    public List<PltBarcode> selectToBeHistoryData() {
        return this.baseMapper.selectToBeHistoryData();
    }
}
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -14,12 +14,11 @@
import com.zy.asrs.service.*;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocDetlDto;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.OutLocDto;
import com.zy.common.model.StartupDto;
import com.zy.common.service.CommonService;
import com.zy.ints.entity.IoComplete;
import com.zy.ints.entity.WaitMatchk;
import com.zy.ints.entity.WaitMatout;
import com.zy.ints.service.IoCompleteService;
import com.zy.ints.service.WaitMatchkService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -83,7 +82,9 @@
        int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
        // 检索库位
        List<String> matNos = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatNo).distinct().collect(Collectors.toList());
        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos, 0);
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        locTypeDto.setLocType1((short) 1);
        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(),false, matNos,locTypeDto, 0);
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
        wrkMast.setWrkNo(workNo);
@@ -156,7 +157,7 @@
            }
        }
        if (!locDetlDtos.isEmpty()) {
            // 启动出库开始 101.出库
            // 启动出库开始 101.103出库
            stockOut(staNo, locDetlDtos, null, userId);
        } else {
            throw new CoolException("库位产品不存在");
@@ -183,37 +184,38 @@
            }
            dtos.add(new OutLocDto(locNo, list));
        }
        //生成盘点文档
        for (LocDetlDto locDetlDto : locDetlDtos) {
            String id="";
        if(ioType == 107) {
            //获取当前时间戳
            SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
            String temp = sf.format(new Date());
            //获取6位随机数
            int random=(int) ((Math.random()+1)*1000);
            id=temp+random;
            //获取3位随机数
            Random rand = new Random();
            Integer r = rand.nextInt(900) + 100;
            String billNo = temp + r;
            //生成盘点通知档
            for (LocDetlDto locDetlDto : locDetlDtos) {
//            String replace = UUID.randomUUID().toString().replace("-", "");
            LocDetl locDetl = locDetlDto.getLocDetl();
            //生成盘点档
            WaitMatchk waitMatchk = new WaitMatchk();
            waitMatchk.setBillNo(id);//订单编号
            waitMatchk.setLocNo(locDetl.getLocNo());//库位号
            waitMatchk.setStockQty(locDetl.getQty());
            waitMatchk.setMatNo(locDetl.getMatNo());//产品编号
            waitMatchk.setMatName(locDetl.getMatName());//铲平名称
            waitMatchk.setSeqNo(i);
            waitMatchk.setIoTime(new Date());
            waitMatchk.setZpallet(locDetl.getZpallet());
            waitMatchk.setAppeUser(userId); // 操作人员数据
            waitMatchk.setAppeTime(new Date());
            waitMatchk.setModiUser(userId);
            waitMatchk.setModiTime(new Date());
            if (!waitMatchkService.insert(waitMatchk)){
                throw new CoolException("保存盘点档失败");
                LocDetl locDetl = locDetlDto.getLocDetl();
                //生成盘点档
                WaitMatchk waitMatchk = new WaitMatchk();
                waitMatchk.setBillNo(billNo);//订单编号
                waitMatchk.setLocNo(locDetl.getLocNo());//库位号
                waitMatchk.setStockQty(locDetl.getQty());
                waitMatchk.setMatNo(locDetl.getMatNo());//产品编号
                waitMatchk.setMatName(locDetl.getMatName());//铲平名称
                waitMatchk.setSeqNo(i);
                waitMatchk.setIoTime(new Date());
                waitMatchk.setZpallet(locDetl.getZpallet());
                waitMatchk.setAppeUser(userId); // 操作人员数据
                waitMatchk.setAppeTime(new Date());
                waitMatchk.setModiUser(userId);
                waitMatchk.setModiTime(new Date());
                if (!waitMatchkService.insert(waitMatchk)) {
                    throw new CoolException("保存盘点档失败");
                }
                i++;
            }
            i++;
        }
        // 生成工作档
@@ -236,7 +238,6 @@
            }
            // 生成工作号
            int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
            // 生成工作档
            WrkMast wrkMast = new WrkMast();
@@ -302,7 +303,9 @@
        // 生成工作号
        int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
        // 检索库位
        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, 0);
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        locTypeDto.setLocType1((short) 1);
        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, true,null,locTypeDto, 0);
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
        wrkMast.setWrkNo(workNo);
@@ -533,32 +536,7 @@
        } else if (wrkMast.getWrkSts() > 10) {
            wrkMast.setWrkSts(14L);
        }
        //查询明细
        List<WrkDetl> detls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo));
        int i=1;
        for (WrkDetl detl : detls) {
            //生成回报档
            IoComplete ioComplete = new IoComplete();
            ioComplete.setBillNo(detl.getBillNo());
            ioComplete.setMatNo(detl.getMatNo());
            ioComplete.setMatName(detl.getMatName());
            ioComplete.setSeqNo(i);
            ioComplete.setQty(detl.getQty());
            ioComplete.setZpallet(detl.getZpallet());
            ioComplete.setAppeUser(userId);
            if (wrkMast.getWrkSts()==4L){
                ioComplete.setTaskType(1);
                ioComplete.setLocNo(wrkMast.getLocNo());
            }else if (wrkMast.getWrkSts()==14L){
                ioComplete.setTaskType(2);
                ioComplete.setLocNo(wrkMast.getSourceLocNo());
            }
            ioComplete.setAppeTime(new Date());
            if (!ioCompleteService.insert(ioComplete)){
                throw new CoolException("生成回报档失败");
            }
            i++;
        }
        // 完成操作人员记录
        wrkMast.setManuType("手动完成");
        Date now = new Date();
src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java
@@ -40,8 +40,8 @@
            wrkDetl.setIoTime(new Date());
            wrkDetl.setQty(dto.getCount()); // 数量
            VersionUtils.setWrkDetl(wrkDetl, matCode); // 版本控制
            wrkDetl.setBillNo("0");
            wrkDetl.setSeqNo(0);
            wrkDetl.setBillNo((null != dto.getBillNo()) ? dto.getBillNo() : "0");
            wrkDetl.setSeqNo((null != dto.getSeqNo()) ? dto.getSeqNo() : 0);
            wrkDetl.setZpallet(barcode); // 托盘条码
            wrkDetl.setAppeUser(userId);
            wrkDetl.setAppeTime(new Date());
src/main/java/com/zy/asrs/task/PltBarcodeLogScheduler.java
New file
@@ -0,0 +1,30 @@
package com.zy.asrs.task;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.PltBarcodeLogHandle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * Created by vincent on 2021/9/10
 */
@Component
public class PltBarcodeLogScheduler {
    private static final Logger log = LoggerFactory.getLogger(PltBarcodeLogScheduler.class);
    @Autowired
    private PltBarcodeLogHandle pltBarcodeLogHandle;
    @Scheduled(cron = "0/30 * * * * ? ")
    private void execute(){
        ReturnT<String> returnT = pltBarcodeLogHandle.start();
        if (!returnT.isSuccess()) {
            log.error(returnT.getMsg());
        }
    }
}
src/main/java/com/zy/asrs/task/handler/PlcLogHandler.java
@@ -28,6 +28,15 @@
                    exceptionHandle("堆垛机&PLC命令转历史档错误 ! ");
                }
            }
//            //条码组托数据转历史档 2021-09-10 TQS ADD
//            int updateBarcodeCount = jdbcTemplate.update("insert into asr_plt_barcode_log select * from asr_plt_barcode where io_status>=2;");
//            if (updateBarcodeCount > 0) {
//                int deleteBarcodeCount = jdbcTemplate.update("delete from asr_plt_barcode where io_status>=2;");
//                if (deleteBarcodeCount <= 0) {
//                    exceptionHandle("条码组托数据转历史档错误 ! ");
//                }
//            }
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
src/main/java/com/zy/asrs/task/handler/PltBarcodeLogHandle.java
New file
@@ -0,0 +1,39 @@
package com.zy.asrs.task.handler;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
/**
 * Created by TQS on 2021/9/10
 */
@Service
public class PltBarcodeLogHandle extends AbstractHandler<String> {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Transactional
    public ReturnT<String> start() {
        try {
            //条码组托数据转历史档 2021-09-10 TQS ADD
            int updateCount = jdbcTemplate.update("insert into asr_plt_barcode_log select * from asr_plt_barcode where io_status>=2;");
            if (updateCount > 0) {
                int deleteCount = jdbcTemplate.update("delete from asr_plt_barcode where io_status>=2;");
                if (deleteCount <= 0) {
                    exceptionHandle("条码组托数据转历史档错误 ! ");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return FAIL.setMsg(e.getMessage());
        }
        return SUCCESS;
    }
}
src/main/java/com/zy/asrs/task/handler/WorkMastHandler.java
@@ -1,14 +1,9 @@
package com.zy.asrs.task.handler;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.WrkDetl;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.LocDetlService;
import com.zy.asrs.service.LocMastService;
import com.zy.asrs.service.WrkDetlService;
import com.zy.asrs.service.WrkMastService;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.task.AbstractHandler;
import com.zy.asrs.task.core.ReturnT;
import com.zy.asrs.utils.VersionUtils;
@@ -46,6 +41,8 @@
    private WaitMatoutService waitMatoutService;
    @Autowired
    private IoCompleteService ioCompleteService;
    @Autowired
    private PltBarcodeService pltBarcodeService;
    /**
     * ERP接口是否启用
@@ -76,6 +73,7 @@
                case 10:
                    // 修改库位状态=D
                    if (locMast.getLocSts().equals("S") || locMast.getLocSts().equals("Q")) {
                        locMast.setFullPlt(wrkMast.getFullPlt());
                        locMast.setLocSts("D");
                        locMast.setIoTime(now);
                        locMast.setModiTime(now);
@@ -115,6 +113,18 @@
                            }
                        }
                        //更新组托数据状态为入库完成 IoStatus ====>> 2
                        Wrapper<PltBarcode> wrapper = new EntityWrapper<PltBarcode>().eq("barcode", wrkDetl.getZpallet())
                                .eq("bill_no", wrkDetl.getBillNo()).eq("seq_no", wrkDetl.getSeqNo()).eq("mat_no", wrkDetl.getMatNo());
                        PltBarcode pltBarcode = pltBarcodeService.selectOne(wrapper);
                        if(null != pltBarcode) {
                            pltBarcode.setIoStatus(2);//入库完成
                            boolean res = pltBarcodeService.update(pltBarcode, wrapper);
                            if(!res){
//                                exceptionHandle("全板入库 ===>> 更新组托数据失败;[workNo={0}],[billNo={1}],[seqNo={2}]", wrkMast.getWrkNo(),wrkDetl.getBillNo(),wrkDetl.getSeqNo());
                            }
                        }
                        // 更新入库通知档 ioStatus ====>> 2
                        WaitMatin waitMatin = waitMatinService.selectOne(new EntityWrapper<WaitMatin>().eq("bill_no",wrkDetl.getBillNo()).eq("seq_no",wrkDetl.getSeqNo()));
                        if(null != waitMatin && waitMatin.getInQty() >= waitMatin.getQty()){
@@ -149,6 +159,7 @@
                    }
                    // 修改库位状态 S ====>> F
                    if (locMast.getLocSts().equals("S")) {
                        locMast.setFullPlt(wrkMast.getFullPlt());
                        locMast.setLocSts("F");
                        locMast.setBarcode(wrkMast.getBarcode());
                        locMast.setIoTime(now);
@@ -207,6 +218,7 @@
                    }
                    // 修改库位状态 Q ====>> F
                    if (locMast.getLocSts().equals("Q")) {
                        locMast.setFullPlt(wrkMast.getFullPlt());
                        locMast.setLocSts("F");
                        locMast.setBarcode(wrkMast.getBarcode());
                        locMast.setIoTime(now);
@@ -275,6 +287,7 @@
                    }
                    // 修改库位状态 Q ====>> F
                    if (locMast.getLocSts().equals("Q")) {
                        locMast.setFullPlt(wrkMast.getFullPlt());
                        locMast.setLocSts("F");
                        locMast.setBarcode(wrkMast.getBarcode());
                        locMast.setIoTime(now);
@@ -293,6 +306,7 @@
                    }
                    // 修改库位状态 Q ====>> F
                    if (locMast.getLocSts().equals("Q")) {
                        locMast.setFullPlt(wrkMast.getFullPlt());
                        locMast.setLocSts("F");
                        locMast.setBarcode(wrkMast.getBarcode());
                        locMast.setIoTime(now);
@@ -316,7 +330,9 @@
                    }
                    // 修改源库位状态 ==> O
                    LocMast sourceLoc = locMastService.selectById(wrkMast.getSourceLocNo());
                    String fullPlt = sourceLoc.getFullPlt();
                    if (null != sourceLoc) {
                        sourceLoc.setFullPlt("N");
                        sourceLoc.setBarcode("");
                        sourceLoc.setLocSts("O");
                        sourceLoc.setModiTime(now);
@@ -326,6 +342,7 @@
                        }
                    }
                    // 修改目标库位状态 ==> .locSts
                    locMast.setFullPlt(fullPlt);
                    locMast.setLocSts(locSts);
                    locMast.setBarcode(wrkMast.getBarcode());
                    locMast.setIoTime(now);
@@ -403,6 +420,7 @@
                    }
                    // 修改源库位状态 R ===>> O
                    if (locMast.getLocSts().equals("R")) {
                        locMast.setFullPlt("N");
                        locMast.setLocSts("O");
                        locMast.setBarcode("");
                        locMast.setModiTime(now);
@@ -416,6 +434,7 @@
                case 110:
                    // 修改库位状态 R ===>> O
                    if (locMast.getLocSts().equals("R")) {
                        locMast.setFullPlt("N");
                        locMast.setLocSts("O");
                        locMast.setBarcode("");
                        locMast.setModiTime(now);
src/main/java/com/zy/asrs/utils/Utils.java
New file
@@ -0,0 +1,175 @@
package com.zy.asrs.utils;
import com.core.common.Arith;
import com.core.common.Cools;
import com.zy.common.properties.SlaveProperties;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by vincent on 2020/8/27
 */
public class Utils {
    private static final DecimalFormat fmt = new DecimalFormat("##0.00");
    public static float scale(Float f){
        if (f == null || f == 0f || Float.isNaN(f)) {
            return 0f;
        }
        return (float) Arith.multiplys(2, f, 1);
    }
    public static String zerofill(String msg, Integer count){
        if (msg.length() == count){
            return msg;
        } else if (msg.length() > count){
            return msg.substring(0, 16);
        } else {
            StringBuilder msgBuilder = new StringBuilder(msg);
            for (int i = 0; i<count-msg.length(); i++){
                msgBuilder.insert(0,"0");
            }
            return msgBuilder.toString();
        }
    }
    /**
     * 判断是否为深库位
     */
    public static boolean isDeepLoc(SlaveProperties slaveProperties, String locNo){
        if (slaveProperties.isDoubleDeep()) {
            int row = getRow(locNo);
            return slaveProperties.getDoubleLocs().contains(row);
        } else {
            return false;
        }
    }
    /**
     * 判断是否为深库位
     */
    public static boolean isDeepLoc(SlaveProperties slaveProperties, Integer row){
        if (slaveProperties.isDoubleDeep()) {
            return slaveProperties.getDoubleLocs().contains(row);
        } else {
            return false;
        }
    }
    /**
     * 判断是否为浅库位
     */
    public static boolean isShallowLoc(SlaveProperties slaveProperties, String locNo){
        if (slaveProperties.isDoubleDeep()) {
            int row = getRow(locNo);
            return !slaveProperties.getDoubleLocs().contains(row);
        } else {
            return false;
        }
    }
    /**
     * 判断是否为浅库位
     */
    public static boolean isShallowLoc(SlaveProperties slaveProperties, Integer row){
        if (slaveProperties.isDoubleDeep()) {
            return !slaveProperties.getDoubleLocs().contains(row);
        } else {
            return false;
        }
    }
    /**
     * 获取 深库位对应的浅库位号
     */
    public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) {
        int row = getRow(deepLoc);
        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
        int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
        return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
    }
    /**
     * 获取 深库位排对应的浅库位排
     */
    public static Integer getShallowRow(SlaveProperties slaveProperties, Integer deepRow) {
        int remainder = (int) Arith.remainder(deepRow, slaveProperties.getGroupCount());
        return remainder == 1 ? (deepRow + 1) : (deepRow - 1);
    }
    /**
     * 获取 浅库位对应的深库位号
     */
    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
        int row = getRow(shallowLoc);
        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
        int targetRow;
        if (remainder == 2) {
            targetRow = row - 1;
        } else if (remainder == 3) {
            targetRow = row + 1;
        } else {
            throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
        }
        return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
    }
    /**
     * 获取 浅库位排对应的深库位排
     */
    public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) {
        int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount());
        int targetRow;
        if (remainder == 2) {
            targetRow = shallowRow - 1;
        } else if (remainder == 3) {
            targetRow = shallowRow + 1;
        } else {
            throw new RuntimeException(shallowRow + "不是浅库位排,系统繁忙");
        }
        return targetRow;
    }
    /**
     * 通过库位号获取 排
     */
    public static int getRow(String locNo) {
        if (!Cools.isEmpty(locNo)) {
            return Integer.parseInt(locNo.substring(0, 2));
        }
        throw new RuntimeException("库位解析异常");
    }
    /**
     * 当检索到双深库位的浅库位时,如果深库位无货,则放入对应的深库位
     */
    public static void toDeepIfEmptyByShallow(String shallowLoc) {
        int row = getRow(shallowLoc);
        int remainder = (int) Arith.remainder(row, 4);
        int targetRow = 0;
        if (remainder == 2) {
            targetRow = row - 1;
        } else if (remainder == 3) {
            targetRow = row + 1;
        } else {
            throw new RuntimeException(shallowLoc + "不是浅库位,系统繁忙");
        }
        String targetLoc = zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
    }
    public static void main(String[] args) {
        SlaveProperties slaveProperties = new SlaveProperties();
        slaveProperties.setDoubleDeep(true);
        List<Integer> list = new ArrayList<>();
        list.add(1);list.add(4);list.add(5);list.add(8);list.add(9);list.add(12);
        slaveProperties.setDoubleLocs(list);
        slaveProperties.setGroupCount(4);
        Integer deepRow = getDeepRow(slaveProperties, 6);
        System.out.println(deepRow);
    }
}
src/main/java/com/zy/asrs/utils/VersionUtils.java
@@ -1,9 +1,8 @@
package com.zy.asrs.utils;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.MatCode;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.entity.WrkDetl;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.common.model.LocTypeDto;
import com.zy.common.utils.excel.matcode.MatCodeExcel;
/**
@@ -121,5 +120,41 @@
        matCode.setNum5(excel.getNum5());
    }
    /**
     *  库位移转时类型检测
     **/
    public static void locMoveCheckLocType(LocMast sourceLoc, LocMast loc){
        // 如果源库位是高库位,目标库位是低库位
        if (sourceLoc.getLocType1() == 2 && loc.getLocType1() == 1) {
            throw new CoolException("高库位不能移转至低库位");
        }
//        // 如果源库位是宽库位,目标库位是窄库位
//        if (sourceLoc.getLocType2() == 2 && loc.getLocType2() == 1) {
//            throw new CoolException("宽库位不能移转至窄库位");
//        }
//        // 如果源库位是重库位,目标库位是轻库位
//        if (sourceLoc.getLocType3() == 2 && loc.getLocType3() == 1) {
//            throw new CoolException("重库位不能移转至轻库位");
//        }
    }
    /**
     *  库位移转时类型检测
     **/
    public static boolean locMoveCheckLocType(LocMast loc, LocTypeDto dto){
        // 如果源库位是高库位,目标库位是低库位
        if (dto.getLocType1() == 2 && loc.getLocType1() == 1) {
            return false;
        }
//        // 如果源库位是宽库位,目标库位是窄库位
//        if (dto.getLocType2() == 2 && loc.getLocType2() == 1) {
//            return false;
//        }
//        // 如果源库位是重库位,目标库位是轻库位
//        if (dto.getLocType3() == 2 && loc.getLocType3() == 1) {
//            return false;
//        }
        return true;
    }
}
src/main/java/com/zy/common/model/LocTypeDto.java
@@ -4,11 +4,15 @@
import com.zy.asrs.entity.BasDevp;
import lombok.Data;
import java.io.Serializable;
/**
 * Created by vincent on 2020/10/19
 */
@Data
public class LocTypeDto {
public class LocTypeDto implements Cloneable, Serializable {
    private static final long serialVersionUID = 1L;
    // 高低类型{0:未知,1:低库位,2:高库位}
    private Short locType1;
@@ -19,8 +23,7 @@
    // 轻重类型{0:未知,1:轻库位,2:重库位}
    private Short locType3;
    public LocTypeDto() {
    }
    public LocTypeDto(BasDevp basDevp) {
        if (basDevp.getLocType1() == null || basDevp.getLocType1() == 0) {
@@ -28,12 +31,10 @@
        }
        if (basDevp.getLocType1() == 1) {
            this.locType1 = 1; // 低库位
        } else if (basDevp.getLocType1() == 2){
            this.locType1 = 2; // 中库位
        } else {
            this.locType1 = 3; // 高库位
            this.locType1 = 2; // 高库位
        }
//        if (basDevp.getLocType2() == 0) {
//        if (basDevp.getLocType2() == null || basDevp.getLocType2() == 0) {
//            throw new CoolException("plc宽窄检测异常");
//        }
//        if (basDevp.getLocType2() == 1) {
@@ -41,7 +42,7 @@
//        } else {
//            this.locType2 = 2; // 宽库位
//        }
//        if (basDevp.getLocType3() == 0) {
//        if (basDevp.getLocType3() == null || basDevp.getLocType3() == 0) {
//            throw new CoolException("plc轻重检测异常");
//        }
//        if (basDevp.getLocType3() == 1) {
@@ -51,4 +52,14 @@
//        }
    }
    @Override
    public LocTypeDto clone() {
        try {
            return (LocTypeDto) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }
}
src/main/java/com/zy/common/properties/SlaveProperties.java
New file
@@ -0,0 +1,24 @@
package com.zy.common.properties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by vincent on 2020/8/4
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "wcs-slave")
public class SlaveProperties {
    private boolean doubleDeep;
    private List<Integer> doubleLocs = new ArrayList<>();
    private int groupCount;
}
src/main/java/com/zy/common/service/CommonService.java
@@ -1,5 +1,6 @@
package com.zy.common.service;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Arith;
@@ -7,8 +8,12 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.Shelves;
import com.zy.common.model.StartupDto;
import com.zy.common.properties.SlaveProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -39,6 +44,8 @@
    private LocMastService locMastService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private SlaveProperties slaveProperties;
    /**
     * 生成工作号
@@ -82,71 +89,132 @@
        return workNo;
    }
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, int times) {
        LocTypeDto oldLocType = locTypeDto.clone();
        return getLocNo(whsType, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
    }
    /**
     * 检索库位号
     * @param whsType 类型 1:双深式货架
     * @param staDescId 路径ID
     * @param sourceStaNo 源站
     * @param matNos 产品号集合
     * @param matNos 物料号集合
     * @return locNo 检索到的库位号
     */
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, int times) {
//        if (sourceStaNo == 3) {
//            whsType = 1;
//        } else if (sourceStaNo == 7) {
//            whsType = 2;
//        } else if (sourceStaNo == 19) {
//            whsType = 3;
//        } else {
//            throw new CoolException("无效入库站");
//        }
    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, boolean emptyMk, List<String> matNos, LocTypeDto locTypeDto, LocTypeDto oldLocType, int times) {
        StartupDto startupDto = new StartupDto();
        // 生成工作号
        int workNo = getWorkNo(0);
//        if (locTypeDto.getLocType3() == 1) { // 轻货信号
//            whsType = 2;    // 5 - 12 轻仓
//        } else if (locTypeDto.getLocType3() == 2) { // 重货信号
//            whsType = 1;    // 1 - 4 重仓
//        }
        RowLastno rowLastno = rowLastnoService.selectById(whsType);
        if (Cools.isEmpty(rowLastno)) {
            throw new CoolException("数据异常,请联系管理员");
        }
        int curRow = rowLastno.getCurrentRow();
        int sRow = rowLastno.getsRow();
        int eRow = rowLastno.geteRow();
        int crn_qty = rowLastno.getCrnQty();
        int rowCount = eRow - sRow + 1;
        int curRow = rowLastno.getCurrentRow();  // 当前列
        int sRow = rowLastno.getsRow();          // 起始列
        int eRow = rowLastno.geteRow();          // 终止列
        int crn_qty = rowLastno.getCrnQty();     // 堆垛机数量(巷道数量)
        int rowCount = eRow - sRow + 1;          // 库排总数
        // 目标堆垛机号
        int crnNo = 0;
        // 目标库位
        LocMast locMast = null;
        // 按规则轮询货架
        if (whsType == 1 || whsType == 2) {
            if (curRow == sRow) {
                curRow = eRow;
            } else {
                curRow = sRow;
        // 靠近摆放规则 --- 同天同规格物料
        if (!Cools.isEmpty(matNos)) {
            List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0), sRow, eRow);
            for (String locNo : locNos) {
                if (Utils.isShallowLoc(slaveProperties, locNo)) {
                    continue;
                }
                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
                // 检测目标库位是否为空库位
                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
                    // 浅库位符合尺寸检测
                    if (VersionUtils.locMoveCheckLocType(shallowLoc, locTypeDto)) {
                        // 因库位移转、需预留空库位
                        if (locMastService.checkEmptyCount(shallowLoc)) {
                            // 浅库位对应堆垛机必须可用且无异常
                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                                locMast = shallowLoc;
                                crnNo = locMast.getCrnNo();
                                break;
                            }
                        }
                    }
                }
            }
            crnNo = whsType;
            basCrnpService.checkSiteStatus(crnNo, true);
        } else {
        }
        // 靠近摆放规则 --- 空托
        if (emptyMk) {
            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 (locMastService.checkEmptyCount(shallowLoc)) {
                            // 浅库位对应堆垛机必须可用且无异常
                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
                                locMast = shallowLoc;
                                crnNo = locMast.getCrnNo();
                                break;
                            }
                        }
                    }
                }
            }
        }
        // 如果没有相近物料,则按规则轮询货架
        if (null == locMast) {
            Shelves shelves = new Shelves(rowCount, crn_qty);
            curRow = curRow - 4;
            for (int i = 0; i < shelves.group; i ++) {
                curRow = shelves.start(curRow);
                if (curRow < 0) {
                    throw new CoolException("检索库位失败,请联系管理员");
            // 重库位 1 - 4排
            if (whsType == 1) {
                for (int i = 0; i < shelves.group; i ++) {
                    curRow = shelves.start(curRow);
                    if (curRow < 0) {
                        throw new CoolException("检索库位失败,请联系管理员");
                    }
                    Integer crnNo1 = shelves.getCrnNo(curRow);
                    if (basCrnpService.checkSiteError(crnNo1, true)) {
                        crnNo = crnNo1;
                        break;
                    }
                }
                Integer crnNo1 = shelves.getCrnNo(curRow);
                if (basCrnpService.checkSiteError(crnNo1 + 2, true)) {
                    // 偏移量补偿
                    curRow = curRow + 4;
                    crnNo = crnNo1 + 2;
                    break;
                }
//                // 轻库位 5 - 12排
//            } else {
//                curRow = curRow - 4;
//                for (int i = 0; i < shelves.group; i ++) {
//                    curRow = shelves.start(curRow);
//                    if (curRow < 0) {
//                        throw new CoolException("检索库位失败,请联系管理员");
//                    }
//                    Integer crnNo1 = shelves.getCrnNo(curRow);
//                    if (basCrnpService.checkSiteError(crnNo1 + 1, true)) {
//                        // 偏移量补偿
//                        curRow = curRow + 4;
//                        crnNo = crnNo1 + 1;
//                        break;
//                    }
//                }
            }
        }
        if (crnNo == 0) {
            throw new CoolException("没有可用的堆垛机");
        }
        // 获取目标站
        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
                .eq("type_no", staDescId)
@@ -157,6 +225,7 @@
            log.error("入库路径不存在, staDescId={}, sourceStaNo={}, crnNo={}", staDescId, sourceStaNo, crnNo);
            throw new CoolException("入库路径不存在");
        }
        // 检测目标站
        BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
        if (!staNo.getAutoing().equals("Y")) {
@@ -169,21 +238,79 @@
        // 开始查找库位 ==============================>>
        // 查找库位
        locMast = locMastService.queryFreeLocMast(curRow);
        // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排
        if (locMast == null) {
            if (Utils.isShallowLoc(slaveProperties, curRow)) {
                Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
                locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1(), locTypeDto.getLocType2(), locTypeDto.getLocType3());
                // 因库位移转、需预留空库位
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
            }
            if (Cools.isEmpty(locMast)) {
                locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1(), locTypeDto.getLocType2(), locTypeDto.getLocType3());
                // 因库位移转、需预留空库位
                if (!locMastService.checkEmptyCount(locMast)) {
                    locMast = null;
                }
                // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X
                if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) {
                    LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo()));
                    if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) {
                        locMast = null;
                    }
                }
                // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O
                if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) {
                    LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo()));
                    if (!shallowLoc.getLocSts().equals("O")) {
                        locMast = null;
                    }
                }
            }
        }
        // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位
        if (Cools.isEmpty(locMast)) {
            // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归
            if (times >= rowCount) {
                log.error("系统没有空库位!!!");
                throw new CoolException("没有空库位");
            if (times < rowCount) {
                times = times + 1;
                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
            } else {
                times = 0;
            }
            times = times + 1;
            return getLocNo(1, staDescId, sourceStaNo, matNos, times);
            // 货物检索低库位仓失败,兼容高库位仓后继续执行
            if (locTypeDto.getLocType1() == 1) {
                locTypeDto.setLocType1((short) 2);
                return getLocNo(1, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
            }
//            // 货物检索窄库位仓失败,兼容宽库位仓后继续执行
//            if (locTypeDto.getLocType2() == 1) {
//                locTypeDto.setLocType2((short) 2);
//                if (oldLocType.getLocType1() == 1) {
//                    locTypeDto.setLocType1((short) 1);
//                }
//                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
//            }
//            // 货物检索轻库位仓失败,兼容重库位仓后继续执行
//            if (locTypeDto.getLocType3() == 1) {
//                locTypeDto.setLocType3((short) 2);
//                if (oldLocType.getLocType1() == 1) {
//                    locTypeDto.setLocType1((short) 1);
//                }
//                if (oldLocType.getLocType2() == 1) {
//                    locTypeDto.setLocType2((short) 1);
//                }
//                return getLocNo(null, staDescId, sourceStaNo, emptyMk, matNos, locTypeDto, oldLocType, times);
//            }
            log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times);
            throw new CoolException("没有空库位");
        }
        String locNo = locMast.getLocNo();
        // 返回dto
        startupDto.setWorkNo(workNo);
        startupDto.setCrnNo(crnNo);
        startupDto.setSourceStaNo(sourceStaNo);
        startupDto.setStaNo(staNo.getDevNo());
@@ -191,6 +318,115 @@
        return startupDto;
    }
//    /**
//     * 检索库位号
//     * @param whsType 类型 1:双深式货架
//     * @param staDescId 路径ID
//     * @param sourceStaNo 源站
//     * @param matNos 产品号集合
//     * @return locNo 检索到的库位号
//     */
//    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, int times) {
////        if (sourceStaNo == 3) {
////            whsType = 1;
////        } else if (sourceStaNo == 7) {
////            whsType = 2;
////        } else if (sourceStaNo == 19) {
////            whsType = 3;
////        } else {
////            throw new CoolException("无效入库站");
////        }
//        StartupDto startupDto = new StartupDto();
//        RowLastno rowLastno = rowLastnoService.selectById(whsType);
//        if (Cools.isEmpty(rowLastno)) {
//            throw new CoolException("数据异常,请联系管理员");
//        }
//        int curRow = rowLastno.getCurrentRow();
//        int sRow = rowLastno.getsRow();
//        int eRow = rowLastno.geteRow();
//        int crn_qty = rowLastno.getCrnQty();
//        int rowCount = eRow - sRow + 1;
//        // 目标堆垛机号
//        int crnNo = 0;
//        // 目标库位
//        LocMast locMast = null;
//
//
//        // 按规则轮询货架
//        if (whsType == 1 || whsType == 2) {
//            if (curRow == sRow) {
//                curRow = eRow;
//            } else {
//                curRow = sRow;
//            }
//            crnNo = whsType;
//            basCrnpService.checkSiteStatus(crnNo, true);
//        } else {
//            Shelves shelves = new Shelves(rowCount, crn_qty);
//            curRow = curRow - 4;
//            for (int i = 0; i < shelves.group; i ++) {
//                curRow = shelves.start(curRow);
//                if (curRow < 0) {
//                    throw new CoolException("检索库位失败,请联系管理员");
//                }
//                Integer crnNo1 = shelves.getCrnNo(curRow);
//                if (basCrnpService.checkSiteError(crnNo1 + 2, true)) {
//                    // 偏移量补偿
//                    curRow = curRow + 4;
//                    crnNo = crnNo1 + 2;
//                    break;
//                }
//            }
//        }
//
//        if (crnNo == 0) {
//            throw new CoolException("没有可用的堆垛机");
//        }
//
//        // 获取目标站
//        Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>()
//                .eq("type_no", staDescId)
//                .eq("stn_no", sourceStaNo)
//                .eq("crn_no", crnNo);
//        StaDesc staDesc = staDescService.selectOne(wrapper);
//        if (Cools.isEmpty(staDesc)) {
//            log.error("入库路径不存在, staDescId={}, sourceStaNo={}, crnNo={}", staDescId, sourceStaNo, crnNo);
//            throw new CoolException("入库路径不存在");
//        }
//        // 检测目标站
//        BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
//        if (!staNo.getAutoing().equals("Y")) {
//            throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用");
//        }
//
//        // 更新库位排号
//        rowLastno.setCurrentRow(curRow);
//        rowLastnoService.updateById(rowLastno);
//
//        // 开始查找库位 ==============================>>
//
//        // 查找库位
//        locMast = locMastService.queryFreeLocMast(curRow);
//
//        if (Cools.isEmpty(locMast)) {
//            // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归
//            if (times >= rowCount) {
//                log.error("系统没有空库位!!!");
//                throw new CoolException("没有空库位");
//            }
//            times = times + 1;
//            return getLocNo(1, staDescId, sourceStaNo, matNos, times);
//        }
//        String locNo = locMast.getLocNo();
//
//        // 返回dto
//        startupDto.setCrnNo(crnNo);
//        startupDto.setSourceStaNo(sourceStaNo);
//        startupDto.setStaNo(staNo.getDevNo());
//        startupDto.setLocNo(locNo);
//        return startupDto;
//    }
    public static void main(String[] args) {
        System.out.println(Arith.remainder(1, 4));
        System.out.println("0200201".substring(0, 2));
src/main/java/com/zy/common/web/WcsController.java
@@ -1,6 +1,7 @@
package com.zy.common.web;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Cools;
import com.core.common.R;
import com.core.exception.CoolException;
@@ -42,6 +43,8 @@
    private WaitPakinService waitPakinService;
    @Autowired
    private  LocDetlService locDetlService;
    @Autowired
    private PltBarcodeService pltBarcodeService;
    @PostMapping("/pakin/loc/v1")
    @ResponseBody
@@ -52,13 +55,13 @@
        if (Cools.isEmpty(param.getSourceStaNo())) {
            return R.error("源站编号不能为空");
        }
        List<WaitPakin> waitPakins = null;
        List<PltBarcode> pltBarcodes = null;
        if (param.getIoType() == 1) {
            if (Cools.isEmpty(param.getBarcode())) {
                return R.error("条码不能为空");
            }
            waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
            if (Cools.isEmpty(waitPakins)) {
            pltBarcodes = pltBarcodeService.selectList(new EntityWrapper<PltBarcode>().eq("barcode", param.getBarcode()));
            if (Cools.isEmpty(pltBarcodes)) {
                return R.error("条码数据错误");
            }
            int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
@@ -71,13 +74,15 @@
            return R.error("高低检测信号不能为空");
        }
        LocTypeDto locTypeDto = new LocTypeDto();
        // 源站点状态检测
        BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), true);
        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
        locTypeDto.setLocType1(param.getLocType1());
        StartupDto dto = null;
        switch (param.getIoType()) {
            case 1:
                dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, waitPakins);
                dto = startupFullPutStore(param.getSourceStaNo(), param.getBarcode(), locTypeDto, pltBarcodes);
                break;
            case 10:
                dto = emptyPlateIn(param.getSourceStaNo(), locTypeDto);
@@ -93,12 +98,12 @@
     * 全板入库 todo:luxiaotao 1.留出中转库位
     */
    @Transactional
    public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) {
    public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<PltBarcode> pltBarcodes) {
        // 源站点状态检测
        BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
        // 检索库位
        List<String> matNos = waitPakins.stream().map(WaitPakin::getMatNo).distinct().collect(Collectors.toList());
        StartupDto dto = commonService.getLocNo(null, 1, devpNo, matNos, locTypeDto);
        List<String> matNos = pltBarcodes.stream().map(PltBarcode::getMatNo).distinct().collect(Collectors.toList());
        StartupDto dto = commonService.getLocNo(1, 1, devpNo, false, matNos, locTypeDto,0);
        int workNo = dto.getWorkNo();
        // 生成工作档
@@ -128,8 +133,16 @@
        }
        // 生成工作档明细
        List<MatCodeCountDto> matDtos = new ArrayList<>();
        waitPakins.forEach(elem -> {
            matDtos.add(new MatCodeCountDto(elem.getMatnr(), elem.getAnfme(),elem.getColor()));
        pltBarcodes.forEach(elem -> {
            matDtos.add(new MatCodeCountDto(elem.getBillNo(), elem.getSeqNo(), elem.getMatNo(), elem.getQty()));
            //更新组托数据状态为入库中
            Wrapper<PltBarcode> wrapper = new EntityWrapper<PltBarcode>().eq("barcode", elem.getBarcode())
                    .eq("bill_no", elem.getBillNo()).eq("seq_no", elem.getSeqNo()).eq("mat_no", elem.getMatNo());
            PltBarcode pltBarcode = pltBarcodeService.selectOne(wrapper);
            pltBarcode.setLocNo(dto.getLocNo());
            pltBarcode.setIoStatus(1);//入库中
            pltBarcodeService.update(pltBarcode,wrapper);
        });
        wrkDetlService.createWorkDetail(workNo, matDtos, barcode, null);
        // 更新源站点信息
@@ -157,7 +170,7 @@
        // 源站点状态检测
        BasDevp sourceStaNo = basDevpService.checkSiteStatus(devpNo, true);
        // 检索库位
        StartupDto dto = commonService.getLocNo(null, 10, devpNo, null, locTypeDto);
        StartupDto dto = commonService.getLocNo(1, 10, devpNo, true, null, locTypeDto,0);
        int workNo = dto.getWorkNo();
        // 生成工作档
        WrkMast wrkMast = new WrkMast();
src/main/java/com/zy/ints/controller/IoCompleteController.java
@@ -5,19 +5,21 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.IoComplete;
import com.zy.ints.service.IoCompleteService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.IoComplete;
import com.zy.ints.service.IoCompleteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class IoCompleteController extends BaseController {
@@ -37,10 +39,12 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<IoComplete> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(IoComplete.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(ioCompleteService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/ints/controller/IoCompleteLogController.java
@@ -5,19 +5,21 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.IoCompleteLog;
import com.zy.ints.service.IoCompleteLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.IoCompleteLog;
import com.zy.ints.service.IoCompleteLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class IoCompleteLogController extends BaseController {
@@ -37,10 +39,12 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<IoCompleteLog> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(IoCompleteLog.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(ioCompleteLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/ints/controller/WaitMatchkController.java
@@ -5,19 +5,21 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatchk;
import com.zy.ints.service.WaitMatchkService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatchk;
import com.zy.ints.service.WaitMatchkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class WaitMatchkController extends BaseController {
@@ -39,10 +41,12 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<WaitMatchk> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(WaitMatchk.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(waitMatchkService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/ints/controller/WaitMatchkLogController.java
@@ -5,19 +5,21 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatchkLog;
import com.zy.ints.service.WaitMatchkLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatchkLog;
import com.zy.ints.service.WaitMatchkLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class WaitMatchkLogController extends BaseController {
@@ -37,10 +39,12 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<WaitMatchkLog> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(WaitMatchkLog.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(waitMatchkLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/ints/controller/WaitMatinLogController.java
@@ -5,19 +5,21 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatinLog;
import com.zy.ints.service.WaitMatinLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatinLog;
import com.zy.ints.service.WaitMatinLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class WaitMatinLogController extends BaseController {
@@ -37,10 +39,12 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<WaitMatinLog> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(WaitMatinLog.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(waitMatinLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/ints/controller/WaitMatoutLogController.java
@@ -5,19 +5,21 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.DateUtils;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatoutLog;
import com.zy.ints.service.WaitMatoutLogService;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.controller.AbstractBaseController;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatoutLog;
import com.zy.ints.service.WaitMatoutLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class WaitMatoutLogController extends BaseController {
@@ -37,10 +39,12 @@
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam Map<String, Object> param){
        EntityWrapper<WaitMatoutLog> wrapper = new EntityWrapper<>();
        excludeTrash(param);
        convert(param, wrapper);
        allLike(WaitMatoutLog.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(waitMatoutLogService.selectPage(new Page<>(curr, limit), wrapper));
    }
src/main/java/com/zy/ints/task/IoCompleteLogScheduler.java
@@ -33,7 +33,7 @@
    @Value("${erp.enabled}")
    private Boolean erpEnabled;
    @Scheduled(cron = "0/3 * * * * ? ")
    @Scheduled(cron = "0/10 * * * * ? ")
    private void execute(){
        if(!erpEnabled) return;
        List<IoComplete> ioCompletes = ioCompleteService.selectIoCompleteBySts();
src/main/resources/application.yml
@@ -50,6 +50,15 @@
swagger:
  enable: false
# 下位机配置
wcs-slave:
  # 双深
  doubleDeep: true
  # 双深库位排号
  doubleLocs: 1,4,5,8,9,12
  # 一个堆垛机负责的货架排数
  groupCount: 4
#ERP接口
erp:
  enabled: true
src/main/resources/mapper/LocMastMapper.xml
@@ -39,6 +39,19 @@
    </resultMap>
    <select id="queryFreeLocMast" resultMap="BaseResultMap">
        select top 1 * from asr_loc_mast where row1=#{row} and loc_sts='O' order by loc_sts desc ,lev1 asc,bay1 asc
        select top 1 *
        from asr_loc_mast
        where row1=#{row}
        and loc_sts='O'
        <if test="locType1 != null">
            and loc_type1 = #{locType1}
        </if>
        <if test="locType2 != null">
            and loc_type2 = #{locType2}
        </if>
        <if test="locType3 != null">
            and loc_type3 = #{locType3}
        </if>
        order by loc_sts desc ,lev1 asc,bay1 asc
    </select>
</mapper>
src/main/resources/mapper/WaitMatinMapper.xml
@@ -78,7 +78,6 @@
    <select id="selectWaitMatinBySts" resultMap="BaseResultMap">
       select * from ints_wait_matin
        where io_status=2
        or (in_qty=qty)
        order by modi_time,mat_no asc
    </select>
src/main/resources/mapper/WaitMatoutMapper.xml
@@ -78,7 +78,6 @@
    <select id="selectWaitMatOutBySts" resultMap="BaseResultMap">
        select * from ints_wait_matout
        where io_status=2
        or (out_qty=qty)
        order by modi_time,mat_no asc
    </select>
src/main/webapp/static/js/ioCompleteLog/ioCompleteLog.js
@@ -36,7 +36,7 @@
            ,{field: 'appeUser$', align: 'center',title: '建档人员',event:'appeUser', style: 'cursor:pointer',hide:true}
            ,{field: 'appeTime$', align: 'center',title: '建档时间',hide:true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
        request: {
            pageName: 'curr',
src/main/webapp/static/js/pltBarcode/pltBarcode.js
@@ -34,9 +34,9 @@
            ,{field: 'size', align: 'center',title: '尺寸', hide: true}
            ,{field: 'color', align: 'center',title: '颜色', hide: true}
            ,{field: 'weight', align: 'center',title: '单重', hide: true}
            ,{field: 'memo', align: 'center',title: '备注'}
            ,{field: 'memo', align: 'center',title: '备注', hide: true}
            ,{field: 'linkErp$', align: 'center',title: 'ERP连线', hide: true}
            ,{field: 'ioStatus$', align: 'center',title: '完成状态', hide: true}
            ,{field: 'ioStatus$', align: 'center',title: '完成状态'}
            ,{field: 'ioTime$', align: 'center',title: '完成时间', hide: true}
            ,{field: 'modiUser$', align: 'center',title: '修改人员',event: 'modiUser', style: 'cursor:pointer', hide: true}
            ,{field: 'modiTime$', align: 'center',title: '修改时间', hide: true}
src/main/webapp/static/js/waitMatchkLog/waitMatchkLog.js
@@ -39,7 +39,7 @@
            ,{field: 'appeUser$', align: 'center',title: '建档人员',event: 'appeUser', style: 'cursor:pointer',hide:true}
            ,{field: 'appeTime$', align: 'center',title: '建档时间',hide:true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
        request: {
            pageName: 'curr',
src/main/webapp/static/js/waitMatinLog/waitMatinLog.js
@@ -41,7 +41,7 @@
            ,{field: 'appeUser$', align: 'center',title: '建档人员',event: 'appeUser', style: 'cursor:pointer',hide:true}
            ,{field: 'appeTime$', align: 'center',title: '建档时间',hide:true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
        request: {
            pageName: 'curr',
src/main/webapp/static/js/waitMatoutLog/waitMatoutLog.js
@@ -41,7 +41,7 @@
            ,{field: 'appeUser$', align: 'center',title: '建档人员',event: 'appeUser', style: 'cursor:pointer',hide:true}
            ,{field: 'appeTime$', align: 'center',title: '建档时间',hide:true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:150}
        ]],
        request: {
            pageName: 'curr',
src/main/webapp/views/ioCompleteLog/ioCompleteLog.html
@@ -16,7 +16,7 @@
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="id" placeholder="编号" autocomplete="off">
            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
        </div>
    </div>
    <div class="layui-inline">
@@ -66,15 +66,15 @@
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button>
<!--        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>-->
<!--        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>-->
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>
<!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>-->
<!--    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>-->
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
src/main/webapp/views/waitMatchk/waitMatchk.html
@@ -16,7 +16,7 @@
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="bill_no" placeholder="编号" autocomplete="off">
            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
        </div>
    </div>
    <div class="layui-inline">
@@ -30,28 +30,28 @@
            </div>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline cool-auto-complete">
            <input id="modiUser" class="layui-input" name="modi_user" type="text" placeholder="请输入" autocomplete="off" style="display: none">
            <input id="modiUser$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="修改人员" onfocus=this.blur()>
            <div class="cool-auto-complete-window">
                <input class="cool-auto-complete-window-input" data-key="userQueryBymodiUser" onkeyup="autoLoad(this.getAttribute('data-key'))">
                <select class="cool-auto-complete-window-select" data-key="userQueryBymodiUserSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                </select>
            </div>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline cool-auto-complete">
            <input id="appeUser" class="layui-input" name="appe_user" type="text" placeholder="请输入" autocomplete="off" style="display: none">
            <input id="appeUser$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="建档人员" onfocus=this.blur()>
            <div class="cool-auto-complete-window">
                <input class="cool-auto-complete-window-input" data-key="userQueryByappeUser" onkeyup="autoLoad(this.getAttribute('data-key'))">
                <select class="cool-auto-complete-window-select" data-key="userQueryByappeUserSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                </select>
            </div>
        </div>
    </div>
<!--    <div class="layui-inline">-->
<!--        <div class="layui-input-inline cool-auto-complete">-->
<!--            <input id="modiUser" class="layui-input" name="modi_user" type="text" placeholder="请输入" autocomplete="off" style="display: none">-->
<!--            <input id="modiUser$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="修改人员" onfocus=this.blur()>-->
<!--            <div class="cool-auto-complete-window">-->
<!--                <input class="cool-auto-complete-window-input" data-key="userQueryBymodiUser" onkeyup="autoLoad(this.getAttribute('data-key'))">-->
<!--                <select class="cool-auto-complete-window-select" data-key="userQueryBymodiUserSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">-->
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->
<!--    </div>-->
<!--    <div class="layui-inline">-->
<!--        <div class="layui-input-inline cool-auto-complete">-->
<!--            <input id="appeUser" class="layui-input" name="appe_user" type="text" placeholder="请输入" autocomplete="off" style="display: none">-->
<!--            <input id="appeUser$" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" placeholder="建档人员" onfocus=this.blur()>-->
<!--            <div class="cool-auto-complete-window">-->
<!--                <input class="cool-auto-complete-window-input" data-key="userQueryByappeUser" onkeyup="autoLoad(this.getAttribute('data-key'))">-->
<!--                <select class="cool-auto-complete-window-select" data-key="userQueryByappeUserSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">-->
<!--                </select>-->
<!--            </div>-->
<!--        </div>-->
<!--    </div>-->
    <!-- 待添加 -->
    <div id="data-search-btn" class="layui-btn-container layui-form-item">
@@ -66,15 +66,15 @@
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button>
<!--        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>-->
<!--        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>-->
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>
<!--    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>-->
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
src/main/webapp/views/waitMatchkLog/waitMatchkLog.html
@@ -16,7 +16,7 @@
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="bill_no" placeholder="编号" autocomplete="off">
            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
        </div>
    </div>
    <div class="layui-inline">
@@ -77,15 +77,15 @@
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button>
<!--        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>-->
<!--        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>-->
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>
<!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>-->
<!--    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>-->
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
src/main/webapp/views/waitMatinLog/waitMatinLog.html
@@ -16,7 +16,7 @@
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="bill_no" placeholder="编号" autocomplete="off">
            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
        </div>
    </div>
    <div class="layui-inline">
@@ -55,15 +55,15 @@
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button>
<!--        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>-->
<!--        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>-->
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>
<!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>-->
<!--    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>-->
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
src/main/webapp/views/waitMatoutLog/waitMatoutLog.html
@@ -16,7 +16,7 @@
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="bill_no" placeholder="编号" autocomplete="off">
            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
        </div>
    </div>
    <div class="layui-inline">
@@ -55,15 +55,15 @@
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>
        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button>
<!--        <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button>-->
<!--        <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button>-->
        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button>
    </div>
</script>
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>
<!--    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>-->
<!--    <a class="layui-btn layui-btn-xs btn-edit" lay-event="edit">编辑</a>-->
</script>
<script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>