自动化立体仓库 - WMS系统
Junjie
2023-11-20 20943f263c31beec3f25fcbeb09c73350248e74b
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -9,7 +9,9 @@
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.entity.param.MobileAdjustParam;
import com.zy.asrs.entity.param.OffSaleParam;
import com.zy.asrs.entity.param.OpenOrderPakinParam;
import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.MatUtils;
import com.zy.common.CodeRes;
@@ -73,6 +75,8 @@
    private NodeService nodeService;
    @Autowired
    private ManLocDetlService manLocDetlService;
    @Autowired
    private ManLocDetlMapper manLocDetlMapper;
    @Override
@@ -84,13 +88,19 @@
        // 判断是否有相同条码的数据
        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) {
            throw new CoolException(param.getBarcode() + "数据正在进行入库");
            throw new CoolException(param.getBarcode() + "数据组托档中已存在");
        }
        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode()));
        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode()));
        if (countLoc > 0 || countWrk > 0) {
            throw new CoolException("工作档/库存条码数据已存在===>>" + param.getBarcode());
//        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())
//                                            .last(" wrk_no IN ( SELECT wrk_no FROM asr_wrk_mast WHERE wrk_sts != 15 )"));
        if (countLoc > 0 ) {
            throw new CoolException("库存条码数据已存在===>>" + param.getBarcode());
        }
        if (countWrk > 0) {
            throw new CoolException("工作档条码数据已存在===>>" + param.getBarcode());
        }
        Date now = new Date();
@@ -114,6 +124,9 @@
            for (DetlDto detlDto : detlDtos) {
                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
                if (Cools.isEmpty(detlDto.getBatch())){
                    detlDto.setBatch("");
                }
                if (Cools.isEmpty(mat)) {
                    throw new CoolException(detlDto.getMatnr() + "商品档案不存在");
                }
@@ -187,6 +200,7 @@
    }
    // 商品上架
    @Override
    public void onSale(CombParam param) {
        Date now = new Date();
@@ -207,14 +221,14 @@
                throw new CoolException(combMat.getMatnr() + ":商品数量有误!");
            }
            if (Cools.isEmpty(combMat.getBatch())){
                throw new CoolException(combMat.getMatnr() + ":商品批号有误!");
//                throw new CoolException(combMat.getMatnr() + ":商品批号有误!");
            }
            ManLocDetl manLocDetl = new ManLocDetl();
            manLocDetl.setLocNo(locno);
            manLocDetl.setNodeId(node.getId());
            manLocDetl.setMaktx(mat.getMaktx());
            manLocDetl.setMatnr(mat.getMatnr());
            manLocDetl.setBatch(combMat.getBatch());
            manLocDetl.setBatch(Cools.isEmpty(combMat.getBatch()) ? "" : combMat.getBatch());
            manLocDetl.setAnfme(combMat.getAnfme());
            manLocDetl.setModiTime(now);
            if (!manLocDetlService.insert(manLocDetl)) {
@@ -223,6 +237,25 @@
        }
    }
    // 商品下架
    @Override
    public void offSale(OffSaleParam offSaleParam) {
        ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr());
        if (Cools.isEmpty(manLocDetl)){
            throw new CoolException("无此商品!");
        }
        double anfme = manLocDetl.getAnfme() - offSaleParam.getAnfme();
        if (anfme < 0) {
            throw new CoolException("商品库存不足!");
        } else if (anfme == 0){
            manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr());
        }
        manLocDetlMapper.updateAnfme0(anfme,manLocDetl.getNodeId());
    }
    // 查找商品
    @Override
    @Transactional
    public void adjust(MobileAdjustParam param, Long userId) {