自动化立体仓库 - WMS系统
zyx
2023-12-13 cf8b2e91499acfe209cd02f5714822b81d6d9598
平库库存调整修改
4个文件已修改
144 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MobileController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OutController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -338,7 +338,7 @@
    平库 库位推荐
     */
    @RequestMapping("/node/recommend/loc")
    @ManagerAuth(memo = "库位推荐")
    //@ManagerAuth(memo = "库位推荐")
    public R recommendNodeLoc(@RequestBody HashMap<String,String> param){
        String zpallet = param.get("zpallet");
src/main/java/com/zy/asrs/controller/OutController.java
@@ -246,9 +246,9 @@
                //平库
                if("无需站点".equals(locDto.getAgvStaNo())){
                    generateManPakout(locDto);
                }
                }else {
                generateTaskDtoForAgv(locDto,agvTaskDtos);
                }
                //四项库
            }else{
                generateTaskDtoForBase(locDto,taskDtos);
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java
@@ -5,7 +5,6 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.ManLocDetl;
import com.zy.asrs.entity.Mat;
import com.zy.asrs.entity.Node;
@@ -17,6 +16,7 @@
import com.zy.asrs.service.NodeService;
import com.zy.asrs.service.WaitPakinService;
import com.zy.asrs.utils.SaasUtils;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.LocDto;
import com.zy.system.entity.User;
import org.springframework.beans.BeanUtils;
@@ -154,33 +154,101 @@
    @Override
    public void adjustLocDetl(LocDetlAdjustParam param, Long userId, User user) {
        Date now = new Date();
        List<ManLocDetl> manLocDetls = this.selectList(new EntityWrapper<ManLocDetl>().eq("loc_no", param.getLocNo()));
        for (ManLocDetl manLocDetl : manLocDetls){
            Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", param.getLocNo());
            wrapper.eq("matnr",manLocDetl.getMatnr());
            Utils.wapperSetCondition(wrapper,"container_code",manLocDetl.getContainerCode());
            Utils.wapperSetCondition(wrapper,"batch",manLocDetl.getBatch());
            Utils.wapperSetCondition(wrapper,"csocode",manLocDetl.getCsocode());
            Utils.wapperSetCondition(wrapper,"isoseq",manLocDetl.getIsoseq());
            boolean existFlag = false;
        for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()) {
            ManLocDetl manLocDetl = this.baseMapper.selectItem(param.getLocNo(), locDetlAdjust.getMatnr(), locDetlAdjust.getBatch(),locDetlAdjust.getThreeCode(),locDetlAdjust.getDeadTime(),locDetlAdjust.getSuppCode());
            if(Cools.isEmpty(manLocDetl)){
                addManlocDetl(locDetlAdjust,param.getLocNo());
                continue;
            }
            this.baseMapper.delete(new EntityWrapper<ManLocDetl>()
                    .eq("loc_no", param.getLocNo()).eq("matnr",locDetlAdjust.getMatnr()));
            Mat mat = matService.selectOne(new EntityWrapper<Mat>()
                    .eq("matnr", locDetlAdjust.getMatnr()));
            if (mat == null) {
                throw new CoolException("无法找到需要调整的物料,请联系管理员");
            }
            Node node = nodeService.selectOne(new EntityWrapper<Node>()
                    .eq("uuid", param.getLocNo()));
            if (node == null) {
                throw new CoolException("无法找到需要调整的库位,请联系管理员");
            }
                if(Cools.eq(manLocDetl.getMatnr(),locDetlAdjust.getMatnr())
                        && Cools.eq(manLocDetl.getContainerCode(),locDetlAdjust.getSuppCode())
                        && Cools.eq(manLocDetl.getBatch(),locDetlAdjust.getBatch())
                        && Cools.eq(manLocDetl.getCsocode(),locDetlAdjust.getThreeCode())
                        && Cools.eq(manLocDetl.getIsoseq(),locDetlAdjust.getDeadTime())){
                    if(!locDetlAdjust.getCount().equals(manLocDetl.getAnfme())){
            manLocDetl.setAnfme(locDetlAdjust.getCount());
            manLocDetl.setUpdateBy(userId);
            manLocDetl.setModiTime(now);
                        this.update(manLocDetl,wrapper);
            SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),user.getUsername());
            this.baseMapper.insert(manLocDetl);
        }
                    existFlag = true;
                }
            }
            if(!existFlag){
                this.delete(wrapper);
                SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),0.0,user.getUsername());
            }
        }
        for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()){
            Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", param.getLocNo());
            wrapper.eq("matnr",locDetlAdjust.getMatnr());
            Utils.wapperSetCondition(wrapper,"container_code",locDetlAdjust.getSuppCode());
            Utils.wapperSetCondition(wrapper,"batch",locDetlAdjust.getBatch());
            Utils.wapperSetCondition(wrapper,"csocode",locDetlAdjust.getThreeCode());
            Utils.wapperSetCondition(wrapper,"isoseq",locDetlAdjust.getDeadTime());
            boolean existFlag = false;
            for (ManLocDetl manLocDetl : manLocDetls){
                if(Cools.eq(manLocDetl.getMatnr(),locDetlAdjust.getMatnr())
                        && Cools.eq(manLocDetl.getContainerCode(),locDetlAdjust.getSuppCode())
                        && Cools.eq(manLocDetl.getBatch(),locDetlAdjust.getBatch())
                        && Cools.eq(manLocDetl.getCsocode(),locDetlAdjust.getThreeCode())
                        && Cools.eq(manLocDetl.getIsoseq(),locDetlAdjust.getDeadTime())){
                    if(!locDetlAdjust.getCount().equals(manLocDetl.getAnfme())){
                        manLocDetl.setAnfme(locDetlAdjust.getCount());
                        manLocDetl.setModiTime(now);
                        this.update(manLocDetl,wrapper);
                        SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),user.getUsername());
                    }
                    existFlag = true;
                }
            }
            if(!existFlag){
                ManLocDetl manLocDetl = addManlocDetl(locDetlAdjust, param.getLocNo());
                SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),0.0,user.getUsername());
            }
        }
//        for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()) {
//
//            ManLocDetl manLocDetl = this.baseMapper.selectItem(param.getLocNo(), locDetlAdjust.getMatnr(), locDetlAdjust.getBatch(),locDetlAdjust.getThreeCode(),locDetlAdjust.getDeadTime(),locDetlAdjust.getSuppCode());
//
//            if(Cools.isEmpty(manLocDetl)){
//                addManlocDetl(locDetlAdjust,param.getLocNo());
//                continue;
//            }
//            Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", param.getLocNo()).eq("matnr", locDetlAdjust.getMatnr());
//            Utils.wapperSetCondition(wrapper,"container_code",manLocDetl.getContainerCode());
//            Utils.wapperSetCondition(wrapper,"csocode",manLocDetl.getCsocode());
//            Utils.wapperSetCondition(wrapper,"isoseq",manLocDetl.getIsoseq());
//            Utils.wapperSetCondition(wrapper,"batch",manLocDetl.getBatch());
//            this.baseMapper.delete(wrapper);
//            Mat mat = matService.selectOne(new EntityWrapper<Mat>()
//                    .eq("matnr", locDetlAdjust.getMatnr()));
//            if (mat == null) {
//                throw new CoolException("无法找到需要调整的物料,请联系管理员");
//            }
//            Node node = nodeService.selectOne(new EntityWrapper<Node>()
//                    .eq("uuid", param.getLocNo()));
//            if (node == null) {
//                throw new CoolException("无法找到需要调整的库位,请联系管理员");
//
//            }
//            manLocDetl.setAnfme(locDetlAdjust.getCount());
//            manLocDetl.setUpdateBy(userId);
//            manLocDetl.setModiTime(now);
//            SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),user.getUsername());
//            this.baseMapper.insert(manLocDetl);
//        }
    }
    @Override
@@ -243,7 +311,7 @@
        }
    }
    private void addManlocDetl(LocDetlAdjustParam.LocDetlAdjust param, String locNo){
    private ManLocDetl addManlocDetl(LocDetlAdjustParam.LocDetlAdjust param, String locNo){
        Date now = new Date();
        ManLocDetl manLocDetl = new ManLocDetl();
        Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", locNo));
@@ -260,6 +328,8 @@
        manLocDetl.setLocNo(locNo);
        manLocDetl.setStatus(1);
        this.insert(manLocDetl);
        return manLocDetl;
    }
}
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -492,21 +492,19 @@
        waitPakinList.forEach(waitPakin -> {
            //料想码
            String containerCode = waitPakin.getSuppCode();
            //如果当前料想码已存在,则修改该料想的物料数量
            ManLocDetl manLocDetl = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>().eq("container_code", containerCode));
            //如果当前库位已存在货物
            Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("matnr",waitPakin.getMatnr());
            Utils.wapperSetCondition(wrapper,"container_code",containerCode);
            Utils.wapperSetCondition(wrapper,"batch",waitPakin.getBatch());
            Utils.wapperSetCondition(wrapper,"csocode",waitPakin.getThreeCode());
            Utils.wapperSetCondition(wrapper,"isoseq",waitPakin.getDeadTime());
            ManLocDetl manLocDetl = manLocDetlService.selectOne(wrapper);
            if(Cools.isEmpty(manLocDetl)){
                saveManlocDetl(waitPakin,now,locNo);
            }else{
                if(Cools.eq(manLocDetl.getMatnr(),waitPakin.getMatnr())
                        && Cools.eq(manLocDetl.getCsocode(),waitPakin.getThreeCode())
                        && Cools.eq(manLocDetl.getIsoseq(),waitPakin.getDeadTime())){
                    manLocDetl.setAnfme(manLocDetl.getAnfme() + waitPakin.getAnfme());
                    manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>()
                            .eq("loc_no",manLocDetl.getLocNo())
                            .eq("container_code",manLocDetl.getContainerCode()));
                }else{
                    saveManlocDetl(waitPakin,now,locNo);
                }
                manLocDetlService.update(manLocDetl,wrapper);
            }
            //生成平库入出库日志
            SaasUtils.insertLog(0,locNo,waitPakin.getMatnr(), waitPakin.getAnfme(),user.getUsername());