| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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 |
| | |
| | | } |
| | | } |
| | | |
| | | 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)); |
| | |
| | | manLocDetl.setLocNo(locNo); |
| | | manLocDetl.setStatus(1); |
| | | this.insert(manLocDetl); |
| | | |
| | | return manLocDetl; |
| | | } |
| | | |
| | | } |