自动化立体仓库 - WMS系统
#
18516761980
2021-09-18 a7b476eaa50abb7cdebf691cc232c26926ee1328
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -14,11 +14,13 @@
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.WaitMatchk;
import com.zy.ints.entity.WaitMatout;
import com.zy.ints.service.IoCompleteService;
import com.zy.ints.service.WaitMatchkLogService;
import com.zy.ints.service.WaitMatchkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -63,9 +65,12 @@
    private WrkMastLogService wrkMastLogService;
    @Autowired
    private WrkDetlLogService wrkDetlLogService;
    @Autowired
    private WaitMatchkService waitMatchkService;
    @Autowired
    private WaitMatchkLogService waitMatchkLogService;
    @Autowired
    private IoCompleteService ioCompleteService;
    @Override
    @Transactional
@@ -80,7 +85,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);
@@ -153,7 +160,7 @@
            }
        }
        if (!locDetlDtos.isEmpty()) {
            // 启动出库开始 101.出库
            // 启动出库开始 101.103出库
            stockOut(staNo, locDetlDtos, null, userId);
        } else {
            throw new CoolException("库位产品不存在");
@@ -180,37 +187,46 @@
            }
            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();
                //////插入盘点档前,将通知档之前相同库位数据转历史档
                List<WaitMatchk> waitMatchks = waitMatchkService.selectList(new EntityWrapper<WaitMatchk>().eq("loc_no",locDetl.getLocNo()));
                for(WaitMatchk one : waitMatchks){
                    waitMatchkLogService.save(one.getBillNo(),one.getLocNo(),one.getMatNo());
                    waitMatchkService.delete(new EntityWrapper<WaitMatchk>().eq("bill_no",one.getBillNo()).eq("loc_no",one.getLocNo()).eq("mat_no",one.getMatNo()));
                }
                //生成盘点档
                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++;
        }
        // 生成工作档
@@ -233,7 +249,6 @@
            }
            // 生成工作号
            int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
            // 生成工作档
            WrkMast wrkMast = new WrkMast();
@@ -299,7 +314,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);
@@ -530,6 +547,7 @@
        } else if (wrkMast.getWrkSts() > 10) {
            wrkMast.setWrkSts(14L);
        }
        // 完成操作人员记录
        wrkMast.setManuType("手动完成");
        Date now = new Date();