自动化立体仓库 - WMS系统
#
LSH
2023-12-15 fc45de2fc49363738d5854446ad2ad33b58b1949
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -89,6 +89,9 @@
    @Autowired
    private OriginRuleService originRuleService;
    @Autowired
    private LocInPrintMatService locInPrintMatService;
    @Override
@@ -957,6 +960,7 @@
    @Override
    public R manDetlOrigin(JSONObject json, User user) {
        Date now = new Date();
        String jsonLocNo = (String) json.get("locNo"); //获取库位码
        String jsonCode = (String) json.get("code"); //获取条码
        String jsonOrigin = (String) json.get("origin"); //获取来源地
@@ -992,6 +996,9 @@
            if (Cools.isEmpty(mat)){
                return R.error("未查询到商品信息");
            }
            //增加打印档案
            LocInPrintMat locInPrintMat = new LocInPrintMat(now,user.getId(), mat.getMatnr(),jsonOriginDetl.getBatch(),jsonOriginDetl.getAnfme(),jsonLocNo,mat.getMaktx());
            locInPrintMatService.insert(locInPrintMat);
            Wrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", jsonLocNo).eq("matnr", jsonOriginDetl.getMatnr()).eq("batch",date);
            ManLocDetl manLocDetl1 = manLocDetlService.selectOne(manLocDetlWrapper);
@@ -1006,7 +1013,6 @@
                }
            }else {
                Date now = new Date();
                ManLocDetl manLocDetl = new ManLocDetl();  //初始化库存实体类
                manLocDetl.sync(mat);
                manLocDetl.setLocNo(node.getUuid());
@@ -1037,6 +1043,7 @@
    @Override
    public R manDetlOrigInNo(JSONObject json, User user) {
        Date now = new Date();
        String jsonLocNo = (String) json.get("locNo"); //获取库位码
        Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", jsonLocNo));  //获取对应库位信息
@@ -1052,6 +1059,9 @@
            if (Cools.isEmpty(mat)){
                return R.error("未查询到商品信息");
            }
            //增加打印档案
            LocInPrintMat locInPrintMat = new LocInPrintMat(now,user.getId(), mat.getMatnr(),jsonOriginDetl.getBatch(),jsonOriginDetl.getAnfme(),jsonLocNo,mat.getMaktx());
            locInPrintMatService.insert(locInPrintMat);
            Wrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", jsonLocNo).eq("matnr", jsonOriginDetl.getMatnr()).eq("batch",jsonOriginDetl.getBatch());
            ManLocDetl manLocDetl1 = manLocDetlService.selectOne(manLocDetlWrapper);
@@ -1066,7 +1076,6 @@
                }
            }else {
                Date now = new Date();
                ManLocDetl manLocDetl = new ManLocDetl();  //初始化库存实体类
                manLocDetl.sync(mat);
                manLocDetl.setLocNo(node.getUuid());
@@ -1097,24 +1106,21 @@
    @Override
    public R manDetlOriginOut(JSONObject json, User user) {
        String jsonLocNo = (String) json.get("locNo"); //获取库位码
        JSONArray combMats = json.getJSONArray("combMats");
        for (int i = 0; i < combMats.size(); i++) {
            OrderDetl jsonOriginDetl = combMats.getObject(i, OrderDetl.class);
            Wrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", jsonLocNo).eq("matnr", jsonOriginDetl.getMatnr()).eq("batch", jsonOriginDetl.getBatch());
            MatPrint jsonOriginDetl = combMats.getObject(i, MatPrint.class);
            Double parseLong = jsonOriginDetl.getAnfme();
            Wrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", jsonOriginDetl.getLocNo()).eq("matnr", jsonOriginDetl.getMatnr()).eq("batch", jsonOriginDetl.getBatch());
            ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper);
            if (Cools.isEmpty(manLocDetl)){
                return R.error("未商品明细信息!库位号:"+jsonLocNo+";商品编号:"+jsonOriginDetl.getMatnr()+"批次:"+jsonOriginDetl.getBatch());
                return R.error("未商品明细信息!库位号:"+jsonOriginDetl.getLocNo()+";商品编号:"+jsonOriginDetl.getMatnr()+"批次:"+jsonOriginDetl.getBatch());
            }
            BigDecimal outAnfme = BigDecimal.valueOf(jsonOriginDetl.getAnfme());
            BigDecimal outAnfme = BigDecimal.valueOf(parseLong);
            BigDecimal anfme = BigDecimal.valueOf(manLocDetl.getAnfme());
            if (manLocDetl.getAnfme() > jsonOriginDetl.getAnfme()){
            if (manLocDetl.getAnfme() > parseLong){
                BigDecimal num = anfme.subtract(outAnfme);
                manLocDetl.setAnfme(num.doubleValue());
                if (!manLocDetlService.update(manLocDetl,manLocDetlWrapper)) {
                    return R.error("物料信息下架失败");
                }
@@ -1124,8 +1130,6 @@
                    return R.error("物料信息删除失败");
                }
            }
        }
        return R.ok();
    }