| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.common.model.DetlDto; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private MatService matService; |
| | | |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | | // 9.入库完成 |
| | |
| | | exceptionHandle("拣料入库 ===>> 工作明细档为空;[workNo={0}]", wrkMast.getWrkNo()); |
| | | } |
| | | log.info("工作号:" + wrkMast.getWrkNo() + ",托盘码:" + wrkMast.getBarcode() + ",工作档明细列表:" + JSON.toJSONString(wrkDetls53)); |
| | | |
| | | // 去重 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | String zpallet = wrkDetls53.get(0).getZpallet(); |
| | | for (WrkDetl wrkDetl : wrkDetls53) { |
| | | double anfme = wrkDetl.getStock() - wrkDetl.getAnfme(); |
| | | if (anfme <= 0) {//库存 - 作业数量 <= 0 清掉该数据 |
| | | continue; |
| | | |
| | | DetlDto detlDto = new DetlDto(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme(), wrkDetl.getThreeCode(), wrkDetl.getDeadTime(),wrkDetl.getSuppCode()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(),detlDto.getCsocode(),detlDto.getIsoseq(),detlDto.getContainerCode()); |
| | | assert one != null; |
| | | //当前剩余库存 - 当前作业数量 |
| | | one.setAnfme(one.getAnfme() - detlDto.getAnfme()); |
| | | } else { |
| | | //新增的时候算出当前剩余库存 stock为总库存- 当前wrkdetl作业数量 |
| | | detlDto.setAnfme(wrkDetl.getStock() - detlDto.getAnfme()); |
| | | detlDtos.add(detlDto); |
| | | } |
| | | |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.sync(wrkDetl); |
| | | locDetl.setLocNo(wrkMast.getLocNo()); |
| | | locDetl.setAnfme(anfme); |
| | | locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 |
| | | locDetl.setAppeTime(now); |
| | | locDetl.setAppeUser(9527L); |
| | | locDetl.setModiTime(now); |
| | | locDetl.setModiUser(9527L); |
| | | if (!locDetlService.insert(locDetl)) { |
| | | exceptionHandle("拣料入库 ===>> 修改库存明细数量失败;[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | } |
| | | // double anfme = wrkDetl.getStock() - wrkDetl.getAnfme(); |
| | | // if (anfme <= 0) {//库存 - 作业数量 <= 0 清掉该数据 |
| | | // continue; |
| | | // } |
| | | // |
| | | // LocDetl locDetl = new LocDetl(); |
| | | // locDetl.sync(wrkDetl); |
| | | // locDetl.setLocNo(wrkMast.getLocNo()); |
| | | // locDetl.setAnfme(anfme); |
| | | // locDetl.setZpallet(wrkDetl.getZpallet()); // 托盘条码 |
| | | // locDetl.setAppeTime(now); |
| | | // locDetl.setAppeUser(9527L); |
| | | // locDetl.setModiTime(now); |
| | | // locDetl.setModiUser(9527L); |
| | | // if (!locDetlService.insert(locDetl)) { |
| | | // exceptionHandle("拣料入库 ===>> 修改库存明细数量失败;[workNo={0}],[locNo={1}]", wrkMast.getWrkNo(), wrkMast.getLocNo()); |
| | | // } |
| | | |
| | | // LocDetl locDetl = locDetlService.selectItem(locMast.getLocNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(),wrkDetl.getSuppCode()); |
| | | // if (null != locDetl) { |
| | |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | for (DetlDto detlDto : detlDtos) { |
| | | Mat mat = matService.selectByMatnr(detlDto.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(detlDto.getMatnr() + "商品档案不存在"); |
| | | } |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.sync(mat); |
| | | locDetl.setLocNo(wrkMast.getLocNo()); |
| | | locDetl.setAnfme(detlDto.getAnfme()); |
| | | locDetl.setZpallet(zpallet); // 托盘条码 |
| | | locDetl.setAppeTime(now); |
| | | locDetl.setAppeUser(9527L); |
| | | locDetl.setModiTime(now); |
| | | locDetl.setModiUser(9527L); |
| | | |
| | | locDetlService.insert(locDetl); |
| | | } |
| | | |
| | | |
| | | // 修改库位状态 Q ====>> F |
| | | if (locMast.getLocSts().equals("Q")) { |
| | | locMast.setLocSts("F"); |