自动化立体仓库 - WMS系统
#
18516761980
2021-09-11 0eb4bcffe0c6e017f9a9967576f12818c9b05db7
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();