自动化立体仓库 - WMS系统
admin
2021-09-01 e84d4700e32dba450aa4d239779fc39f38ae4afa
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -17,13 +17,16 @@
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;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -62,9 +65,10 @@
    private WrkMastLogService wrkMastLogService;
    @Autowired
    private WrkDetlLogService wrkDetlLogService;
    @Autowired
    private WaitMatchkService waitMatchkService;
    @Autowired
    private IoCompleteService ioCompleteService;
    @Override
    @Transactional
@@ -181,11 +185,20 @@
        }
        //生成盘点文档
        for (LocDetlDto locDetlDto : locDetlDtos) {
            String replace = UUID.randomUUID().toString().replace("-", "");
            String id="";
            //获取当前时间戳
            SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
            String temp = sf.format(new Date());
            //获取6位随机数
            int random=(int) ((Math.random()+1)*1000);
            id=temp+random;
//            String replace = UUID.randomUUID().toString().replace("-", "");
            LocDetl locDetl = locDetlDto.getLocDetl();
            //生成盘点档
            WaitMatchk waitMatchk = new WaitMatchk();
            waitMatchk.setBillNo(replace);//订单编号
            waitMatchk.setBillNo(id);//订单编号
            waitMatchk.setLocNo(locDetl.getLocNo());//库位号
            waitMatchk.setStockQty(locDetl.getQty());
            waitMatchk.setMatNo(locDetl.getMatNo());//产品编号
@@ -520,6 +533,32 @@
        } 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();
@@ -535,10 +574,22 @@
    @Override
    @Transactional
    public void adjustLocDetl(LocDetlAdjustParam param, Long userId) {
        //根据库位号找寻库位
        LocMast locMast = locMastService.selectById(param.getLocNo());
        //判断
        if (Cools.isEmpty(locMast)) {
            throw new CoolException("库位不存在");
        }
        //查询库位状态
        if (locMast.getLocSts().equals("O")){
            //更新库位状态
            locMast.setLocSts("F");
//            boolean b = locMastService.updateById(locMast);
            if (!locMastService.updateById(locMast)){
                throw new CoolException("更新库位状态失败");
            }
        }
        for (LocDetlAdjustParam.LocDetlAdjust adjust : param.getList()) {
            if (Cools.isEmpty(adjust.getMatNo())) {
                throw new CoolException(BaseRes.PARAM);
@@ -561,6 +612,7 @@
                locDetl.setModiTime(new Date());
                locDetl.setAppeUser(userId);
                locDetl.setAppeTime(new Date());
                locDetl.setZpallet(param.getZpallet());//托盘号
                if (!locDetlService.insert(locDetl)) {
                    throw new CoolException("保存库存明细失败");
                }