自动化立体仓库 - WMS系统
pang.jiabao
2025-02-17 8be136c5e451b623cec21e806bd30e6e2698587d
src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java
@@ -93,13 +93,15 @@
    }
    //退回
    @Transactional
    public void returned(List<PlaQty> plaQties, User user) {
        plaQties.forEach(plaQty -> {
            PlaQty plaQtyOut = plaQtyService.selectById(plaQty.getId());
            if(Cools.isEmpty(plaQtyOut.getReturned())){
            if(Cools.isEmpty(plaQtyOut.getReturned()) || plaQtyOut.getReturned() == 0){
                plaQtyOut.setReturned(plaQty.getOrderWeight());
            }else {
                plaQtyOut.setReturned(plaQty.getOrderWeight()+plaQtyOut.getReturned());
                throw new CoolException("该包物料已退回");
                //plaQtyOut.setReturned(plaQty.getOrderWeight()+plaQtyOut.getReturned());
            }
            plaQtyService.updateById(plaQtyOut);
@@ -110,6 +112,7 @@
            plaQtyReturned.setLocNo(plaQtyOut.getLocNo());
            plaQtyReturned.setOrderNo(plaQtyOut.getOrderNo());
            plaQtyReturned.setPakoutTime(Utils.getDateStr(new Date()));
            plaQtyReturned.setBrand(plaQty.getBrand());
            plaQtyReturned.setOrderWeight(plaQty.getOrderWeight());
            plaQtyReturned.setTransfer("退回入库");
            plaQtyReturned.setHandlerBy(user.getUsername());
@@ -122,12 +125,19 @@
            //pla.setStatus(GlobleParameter.PLA_STATUS_0);
            pla.setModifyTime(new Date());
            // 退货人 modify_user,退货备注 create_user,退货标识 transfer
            pla.setModifyUser(user.getUsername());
            pla.setCreateUser(plaQty.getMemo());
            pla.setTransfer("退货");
            pla.setStash(""); // 库区
            pla.setLocNo(""); // 库位
            pla.setWeightAnfme(pla.getWeightAnfme() + plaQty.getOrderWeight());
            pla.setStatus(GlobleParameter.PLA_STATUS_1);
            this.updateById(pla);
            SaasUtils.insertLog(0,pla.getLocNo(),pla.getBrand(),plaQty.getOrderWeight(),user.getUsername(),
                    null,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop());
            SaasUtils.insertLog(4,pla.getLocNo(),pla.getBrand(),plaQty.getOrderWeight(),user.getUsername(),
                    null,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop(),null);
        });
    }
@@ -160,13 +170,17 @@
        Object create_time = page.getCondition().get("create_time");
        Object brand = page.getCondition().get("brand");
        Object status = page.getCondition().get("status");
        String type = (String) page.getCondition().get("type");
        String workshop = (String) page.getCondition().get("workshop");
        String transfer = (String) page.getCondition().get("transfer");
        String createTime = create_time == null ? null : create_time.toString();
        if(!Cools.isEmpty(createTime)){
            String[] dates = createTime.split(" - ");
            stime = DateUtils.convert(dates[0]);
            etime = DateUtils.convert(dates[1]);
        }
        plaList=baseMapper.getStockStatisAll(brand == null ? null:brand.toString(), status == null ? null:status.toString(),  stime,etime);
        plaList=baseMapper.getStockStatisAll(brand == null ? null:brand.toString(), status == null ? null:status.toString(),  stime,etime, type, workshop, transfer);
        double weightSum = plaList.stream().mapToDouble(Pla::getWeight).sum();