自动化立体仓库 - WMS系统
#
zyx
2023-12-28 f3914234db3bf68dad372c4dfb9a1111a0c09e32
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -93,6 +93,12 @@
    @Autowired
    private LocInPrintMatService locInPrintMatService;
    @Autowired
    private LocOutPrintMatService locOutPrintMatService;
    @Autowired
    private LocOwnerService locOwnerService;
    @Override
@@ -963,7 +969,9 @@
    public R manDetlOrigin(JSONObject json, User user) {
        Date now = new Date();
        String jsonLocNo = (String) json.get("locNo"); //获取库位码
        Long ownerId = (Long) json.get("owner"); //获取拥有者
        String ownerName = (String) json.get("owner"); //获取拥有者
        LocOwner locOwner = locOwnerService.selectOne(new EntityWrapper<LocOwner>().eq("owner", ownerName));
        Long ownerId = locOwner.getId();
        String jsonCode = (String) json.get("code"); //获取条码
        String jsonOrigin = (String) json.get("origin"); //获取来源地
        if (Cools.isEmpty(jsonLocNo)){
@@ -1066,7 +1074,9 @@
    public R manDetlOrigInNo(JSONObject json, User user) {
        Date now = new Date();
        String jsonLocNo = (String) json.get("locNo"); //获取库位码
        Long ownerId = (Long) json.get("owner"); //获取拥有者
        String ownerName = (String) json.get("owner"); //获取拥有者
        LocOwner locOwner = locOwnerService.selectOne(new EntityWrapper<LocOwner>().eq("owner", ownerName));
        Long ownerId = locOwner.getId();
        if (Cools.isEmpty(jsonLocNo)){
            return R.error("库位号参数为空!");
        }else if (Cools.isEmpty(ownerId)){
@@ -1141,10 +1151,21 @@
    @Override
    public R manDetlOriginOut(JSONObject json, User user) {
        Date now = new Date();
        JSONArray combMats = json.getJSONArray("combMats");
        List<MatPrint> matPrintList=new ArrayList<>();
        List<Long> ids=new ArrayList<>();
        for (int i = 0; i < combMats.size(); i++) {
            MatPrint jsonOriginDetl = combMats.getObject(i, MatPrint.class);
            MatPrint matPrintNow = combMats.getObject(i, MatPrint.class);
            if (!ids.contains(matPrintNow.getIndex())){
                ids.add(matPrintNow.getIndex());
                matPrintList.add(matPrintNow);
            }
        }
        for (MatPrint jsonOriginDetl:matPrintList) {
            Double parseLong = jsonOriginDetl.getAnfme();
            Long ownerId = Long.parseLong(jsonOriginDetl.getOwner());
            jsonOriginDetl.setOwnerId(ownerId);
            Wrapper<ManLocDetl> manLocDetlWrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", jsonOriginDetl.getLocNo())
                    .eq("matnr", jsonOriginDetl.getMatnr()).eq("batch", jsonOriginDetl.getBatch()).eq("owner",jsonOriginDetl.getOwnerId());
            ManLocDetl manLocDetl = manLocDetlService.selectOne(manLocDetlWrapper);
@@ -1157,6 +1178,8 @@
            if (manLocDetl.getAnfme() > parseLong){
                BigDecimal num = anfme.subtract(outAnfme);
                manLocDetl.setAnfme(num.doubleValue());
                manLocDetl.setUpdateBy(user.getId());
                manLocDetl.setModiTime(now);
                if (!manLocDetlService.update(manLocDetl,manLocDetlWrapper)) {
                    return R.error("物料信息下架失败");
                }
@@ -1167,6 +1190,12 @@
                }
            }
        }
        for (MatPrint jsonOriginDetl:matPrintList) {
            //增加打印档案
            LocOutPrintMat locOutPrintMat = new LocOutPrintMat(now, user.getId(), jsonOriginDetl.getMatnr(), jsonOriginDetl.getBatch(), jsonOriginDetl.getAnfme(), jsonOriginDetl.getLocNo(), jsonOriginDetl.getMaktx());
            locOutPrintMat.setOwnerId(jsonOriginDetl.getOwnerId());
            locOutPrintMatService.insert(locOutPrintMat);
        }
        return R.ok();
    }
}