| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | 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.service.NodeService; |
| | | import com.zy.asrs.service.WaitPakinService; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.system.entity.User; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | @Service("manLocDetlService") |
| | | public class ManLocDetlServiceImpl extends ServiceImpl<ManLocDetlMapper, ManLocDetl> implements ManLocDetlService { |
| | |
| | | Date now = new Date(); |
| | | for (LocDetlAdjustParam.LocDetlAdjust locDetlAdjust : param.getList()) { |
| | | ManLocDetl manLocDetl = this.baseMapper.selectItem(param.getLocNo(), locDetlAdjust.getMatnr(), locDetlAdjust.getBatch()); |
| | | |
| | | 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>() |
| | |
| | | return baseMapper.increase(anfme,locNo,matnr,batch,weight); |
| | | } |
| | | |
| | | public double queryStockAndSetLocDto(String matnr, String batch, String orderNo, List<LocDto> locDtoList, double issued, String csocode, String isoseq) { |
| | | Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("matnr", matnr).orderBy("modi_time"); |
| | | wrapper.eq("status",1); |
| | | wapperSetCondition(wrapper,"batch",batch); |
| | | wapperSetCondition(wrapper,"csocode",csocode); |
| | | wapperSetCondition(wrapper,"isoseq",isoseq); |
| | | |
| | | List<ManLocDetl> manLocDetls = this.selectList(wrapper); |
| | | for (ManLocDetl manLocDetl : manLocDetls){ |
| | | if(issued > 0) { |
| | | double anfme = manLocDetl.getAnfme(); |
| | | anfme = anfme > issued ? issued : anfme; |
| | | LocDto locDto = new LocDto(manLocDetl.getLocNo(), manLocDetl.getMatnr(), manLocDetl.getMaktx(), manLocDetl.getBatch(), orderNo, anfme); |
| | | locDto.setCsocode(csocode); |
| | | locDto.setIsoseq(isoseq); |
| | | locDto.setContainerCode(manLocDetl.getContainerCode()); |
| | | List<String> stationList = new ArrayList<>(); |
| | | stationList.add("无需站点"); |
| | | locDto.setAgvStaNos(stationList); |
| | | |
| | | locDtoList.add(locDto); |
| | | issued -= anfme; |
| | | } |
| | | } |
| | | |
| | | return issued; |
| | | } |
| | | |
| | | private void wapperSetCondition(Wrapper wrapper,String column, String condition){ |
| | | if(Cools.isEmpty(condition)){ |
| | | wrapper.andNew().eq(column,"").or().isNull(column); |
| | | }else { |
| | | wrapper.eq(column,condition); |
| | | } |
| | | } |
| | | |
| | | private void addManlocDetl(LocDetlAdjustParam.LocDetlAdjust param, String locNo){ |
| | | Date now = new Date(); |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | | Node node = nodeService.selectOne(new EntityWrapper<Node>().eq("name", locNo)); |
| | | Mat mat = matService.selectByMatnr(param.getMatnr()); |
| | | BeanUtils.copyProperties(mat,manLocDetl); |
| | | manLocDetl.setNodeId(node.getId()); |
| | | manLocDetl.setBatch(param.getBatch()); |
| | | manLocDetl.setAnfme(param.getCount()); |
| | | manLocDetl.setContainerCode(param.getSuppCode()); |
| | | manLocDetl.setCsocode(param.getThreeCode()); |
| | | manLocDetl.setIsoseq(param.getDeadTime()); |
| | | manLocDetl.setCreateTime(now); |
| | | manLocDetl.setModiTime(now); |
| | | manLocDetl.setLocNo(locNo); |
| | | manLocDetl.setStatus(1); |
| | | this.insert(manLocDetl); |
| | | } |
| | | |
| | | } |