| | |
| | | import com.zy.common.model.MesCombParam; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import com.zy.third.entity.ExdInstockSource; |
| | | import com.zy.third.entity.ExdStock; |
| | | import com.zy.third.entity.ExdvYanbu; |
| | | import com.zy.third.mapper.ExdMaterialMapper; |
| | | import com.zy.third.mapper.ExdStockMapper; |
| | | import com.zy.third.service.ExdInstockSourceService; |
| | | import com.zy.third.service.ExdMaterialService; |
| | | import com.zy.third.service.ExdStockService; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private OrderDetl1Service orderDetl1Service; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | |
| | | private ManLocDetlService manLocDetlService; |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private ExdMaterialMapper exdMaterialMapper; |
| | | @Autowired |
| | | private ExdStockMapper exdStockMapper; |
| | | @Autowired |
| | | private ExdStockService exdStockService; |
| | | @Autowired |
| | | private ExdInstockSourceService exdInstockSourceService; |
| | | |
| | | |
| | | @Override |
| | |
| | | Date now = new Date(); |
| | | |
| | | //进行批号筛选,批号只能唯一 |
| | | // Set<String> batchs = new HashSet<>(); |
| | | // List<String> strings = new ArrayList<>(); |
| | | |
| | | |
| | | // for (CombParam.CombMat mat : param.getCombMats()) { |
| | | // if (Cools.isEmpty(mat.getBatch())) { |
| | | // continue; |
| | | // } |
| | | // batchs.add(mat.getBatch()); |
| | | // strings.add(mat.getBatch()); |
| | | // WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("batch", mat.getBatch())); |
| | | // WrkDetl batch = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", mat.getBatch())); |
| | | // LocDetl batch1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", mat.getBatch())); |
| | | // if (!Cools.isEmpty(batch) || !Cools.isEmpty(batch1) || !Cools.isEmpty(waitPakin)) { |
| | | // throw new CoolException("该物料批号" + mat.getBatch() + "已在入库通知档、任务明细和库存中存在"); |
| | | // } |
| | | // } |
| | | // if (batchs.size() < strings.size()) { |
| | | // throw new CoolException("有重复的物料批号"); |
| | | // } |
| | | Set<String> batchs = new HashSet<>(); |
| | | List<String> strings = new ArrayList<>(); |
| | | long time = new Date().getTime(); |
| | | //生产入库对一坨物料进行绑定。唯一值 |
| | | String fbillno = param.getBarcode()+"--"+time; |
| | | for (CombParam.CombMat mat : param.getCombMats()) { |
| | | if (Cools.isEmpty(mat.getBatch())) { |
| | | continue; |
| | | } |
| | | batchs.add(mat.getBatch()); |
| | | strings.add(mat.getBatch()); |
| | | WaitPakin waitPakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("batch", mat.getBatch())); |
| | | WrkDetl batch = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("batch", mat.getBatch())); |
| | | LocDetl batch1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("batch", mat.getBatch())); |
| | | if (!Cools.isEmpty(batch) || !Cools.isEmpty(batch1) || !Cools.isEmpty(waitPakin)) { |
| | | throw new CoolException("该物料批号" + mat.getBatch() + "已在入库通知档、任务明细和库存中存在"); |
| | | } |
| | | } |
| | | if (batchs.size() < strings.size()) { |
| | | throw new CoolException("有重复的物料批号"); |
| | | } |
| | | int i = 1; |
| | | // 无单组托 |
| | | if (Cools.isEmpty(param.getOrderNo())) { |
| | |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("three_code", elem.getBc())) > 0) { |
| | | throw new CoolException( elem.getBc() + "数据组托档中已存在"); |
| | | if (!Cools.isEmpty(elem.getBc())){ |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("three_code", elem.getBc())) > 0) { |
| | | throw new CoolException( elem.getBc() + "数据组托档中已存在"); |
| | | } |
| | | } |
| | | |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme()); |
| | |
| | | } |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setBatch(detlDto.getBatch()); |
| | | waitPakin.setBatch(detlDto.getBc()); |
| | | waitPakin.setThreeCode(detlDto.getBc()); |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setColor(userId+""); |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setBrand(param.getCk());//仓库 |
| | | //生产入库对一坨物料进行绑定。唯一值 |
| | | waitPakin.setOrigin(fbillno); |
| | | ExdvYanbu barcode1 = exdMaterialMapper.getBacode(detlDto.getBc()); |
| | | String pid="03.98"; |
| | | if(!Cools.isEmpty(barcode1)&&!Cools.isEmpty(barcode1.getProdinkind())){ |
| | | pid=barcode1.getProdinkind(); |
| | | } |
| | | ExdStock id = exdStockService.selectOne(new EntityWrapper<ExdStock>().eq("Fnumber", pid)); |
| | | waitPakin.setBrand(id.getFname());//仓库 |
| | | waitPakin.setInspect(param.isType() ? 1 : 0); |
| | | if (i == 1) { |
| | | // 0:不需要补空托盘 |
| | |
| | | * 3:AGV任务完成 |
| | | * 4:给输送线下发入库指令 |
| | | */ |
| | | waitPakin.setBeBatch(param.getBeBatch()); |
| | | waitPakin.setBeBatch(Cools.isEmpty(param.getRsta())?0:1); |
| | | waitPakin.setSuppCode(param.getBarcode()); |
| | | } |
| | | i++; |
| | |
| | | throw new CoolException(orderDetl.getMatnr() + "入库数量不合法"); |
| | | } |
| | | // 修改订单作业数量 |
| | | if (!orderDetlService.increaseWorkQty2(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme(), fxId)) { |
| | | if (!orderDetlService.increaseWorkQty2(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme(), userId)) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | // 修改子单订单作业数量 |
| | | if (!orderDetl1Service.increaseWorkQty2(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme(), userId)) { |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(order.getOrderNo()); // 单据编号 |
| | | waitPakin.setBatch(detlDto.getBatch()); // 序列码 |
| | | waitPakin.setBatch(detlDto.getBatch()); // 批号 |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(detlDto.getAnfme()); // 数量 |
| | |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setColor(userId+""); |
| | | waitPakin.setBrand(param.getCk());//仓库 |
| | | |
| | | OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>() |
| | | .eq("matnr", detlDto.getMatnr()).eq("order_no", order.getOrderNo()) |
| | | .eq("batch", detlDto.getBatch())); |
| | | waitPakin.setBrand(orderDetl.getBrand());//仓库 |
| | | waitPakin.setInspect(param.isType() ? 1 : 0); |
| | | if (i == 1) { |
| | | // 0:不需要补空托盘 |
| | |
| | | } |
| | | } |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | | List<ExdInstockSource> fBillNo = exdInstockSourceService.selectList(new EntityWrapper<ExdInstockSource>().eq("FBillNo", order.getOrderNo())); |
| | | if(fBillNo != null){ |
| | | for(ExdInstockSource exdInstockSource : fBillNo){ |
| | | exdInstockSource.setStatus(10); |
| | | exdInstockSourceService.updateById(exdInstockSource); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |