| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | @Autowired |
| | | private LocDetlRullUpDetailService locDetlRullUpDetailService; |
| | | |
| | | |
| | | @Override |
| | |
| | | throw new CoolException("参数:托盘码为空"); |
| | | } |
| | | } |
| | | param.setPalletizingNo(147); |
| | | |
| | | |
| | | |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getPalletizingNo())){ |
| | | throw new CoolException("参数:站点编号为空"); |
| | | }else if (Cools.isEmpty(param.getOrderNo())){ |
| | | throw new CoolException("参数:退货单单号 orderNo为空"); |
| | | }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size() != 1){ |
| | | throw new CoolException("参数:物料明细 matLists为空"); |
| | | }else if (param.getSouSta()==145 || param.getMatList().size() != 1){ |
| | | |
| | | throw new CoolException("参数:原站点编号为空"); |
| | | }else if (param.getSouSta()==145 && param.getMatList().size() != 1){ |
| | | throw new CoolException("参数:物料明细 matLists为空 或者 大于1个明细"); |
| | | }else if (Cools.isEmpty(param.getMatList()) || param.getMatList().size() > 2){ |
| | | throw new CoolException("参数:物料明细 matLists为空 或者 大于2个明细"); |
| | | } |
| | | |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (Cools.isEmpty(order)){ |
| | | throw new CoolException("未查询到此订单,单号:"+param.getOrderNo()); |
| | | } |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (Cools.isEmpty(docType) || !docType.getDocName().equals("退货入库单")){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+"不是退货入库单"); |
| | | } |
| | | |
| | | List<OrderDetl> orderDetls = orderDetlService.selectByOrderId(order.getId()); |
| | | if (Cools.isEmpty(orderDetls) || orderDetls.size()==0){ |
| | | throw new CoolException("未查询到此订单明细,单号:"+param.getOrderNo()); |
| | | } |
| | | List<String> orderBoxNoList = new ArrayList<>(); |
| | | for (OrderDetl orderDetl: orderDetls){ |
| | | if (orderDetl.getWorkQty()==0){ |
| | | orderBoxNoList.add(orderDetl.getBatch()); |
| | | } |
| | | } |
| | | if (orderBoxNoList.size()==0 || orderBoxNoList.size()<param.getMatList().size()){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+" 退货数量大于明细数量"); |
| | | } |
| | | List<String> matListBoxNoList = new ArrayList<>(); |
| | | for (TrussCombParam.MatList matList: param.getMatList()){ |
| | | if (!orderBoxNoList.contains(matList.getBoxNo())){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+" 箱号:"+matList.getBatch()+"不属于此订单或者已经入库"); |
| | | }else { |
| | | matListBoxNoList.add(matList.getBoxNo()); |
| | | } |
| | | } |
| | | List<OrderDetl> orderDetlList = new ArrayList<>(); |
| | | for (OrderDetl orderDetl: orderDetls){ |
| | | if (matListBoxNoList.contains(orderDetl.getBatch())){ |
| | | orderDetl.setBrand("1"); |
| | | orderDetlList.add(orderDetl); |
| | | } |
| | | } |
| | | String matnr = null; |
| | | List<WaitPakin> waitPakins = new ArrayList<>(); |
| | | |
| | | for (OrderDetl orderDetl:orderDetlList){ |
| | | Mat mat = matService.selectByMatnr(orderDetl.getMatnr()); |
| | | for (TrussCombParam.MatList matList:param.getMatList()){ |
| | | long rollUp = new Date().getTime(); |
| | | Mat mat = matService.selectByMatnr(matList.getMatnr()); |
| | | if (Cools.isEmpty(mat)) { |
| | | throw new CoolException(orderDetl.getMatnr() + "商品档案不存在"); |
| | | throw new CoolException(matList.getMatnr() + "商品档案不存在"); |
| | | } |
| | | matnr = mat.getMatnr(); |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.sync(mat); |
| | | waitPakin.setModel(orderDetl.getModel()); //批次 |
| | | waitPakin.setSpecs(orderDetl.getSpecs()); //规格 |
| | | waitPakin.setBatch(orderDetl.getBatch()); //木箱编码 |
| | | waitPakin.setModel(matList.getModel()); //批次 |
| | | waitPakin.setSpecs(matList.getSpecs()); //规格 |
| | | waitPakin.setBatch(matList.getBatch()); //木箱编码 |
| | | waitPakin.setBrand(param.getBoxType()); //木箱类型 |
| | | waitPakin.setZpallet(param.getBarcode()); //托盘码 |
| | | waitPakin.setOrigin(orderDetl.getOrigin()); //木箱在托盘上的位置 |
| | | waitPakin.setOrigin(matList.getPosition()); //木箱在托盘上的位置 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | | waitPakin.setAnfme(orderDetl.getAnfme()); // 木箱中铜箔数量 |
| | | waitPakin.setAnfme((double)matList.getAnfme()); // 木箱中铜箔数量 |
| | | waitPakin.setStatus("Y"); // 状态 |
| | | waitPakin.setAppeUser(userId); |
| | | waitPakin.setAppeTime(now); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | waitPakin.setRollUp(orderDetl.getRollUp()); |
| | | waitPakin.setRollUp(rollUp); |
| | | if (!Cools.isEmpty(matList.getMatDetlList())){ |
| | | for (TrussCombParam.MatDetlList matDetlList:matList.getMatDetlList()){ |
| | | LocDetlRullUpDetail locDetlRullUpDetail = new LocDetlRullUpDetail(); |
| | | locDetlRullUpDetail.setUuid(rollUp); |
| | | locDetlRullUpDetail.setRollNo(matDetlList.getBoxNoDetl()); |
| | | locDetlRullUpDetail.setRollWeight(matDetlList.getWeightDetl().toString()); |
| | | locDetlRullUpDetailService.insert(locDetlRullUpDetail); |
| | | } |
| | | } |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | |
| | | public void trussCombOrder(TrussCombParam param, Long userId) { |
| | | Date now = new Date(); |
| | | param.setBarcode(String.valueOf(now.getTime())); |
| | | param.setPalletizingNo(147); |
| | | |
| | | //判断param参数 |
| | | if (Cools.isEmpty(param.getPalletizingNo())){ |
| | |
| | | } |
| | | List<String> matListBoxNoList = new ArrayList<>(); |
| | | for (TrussCombParam.MatList matList: param.getMatList()){ |
| | | if (!orderBoxNoList.contains(matList.getBoxNo())){ |
| | | if (!orderBoxNoList.contains(matList.getBatch())){ |
| | | throw new CoolException("单号:"+param.getOrderNo()+" 箱号:"+matList.getBatch()+"不属于此订单或者已经入库"); |
| | | }else { |
| | | matListBoxNoList.add(matList.getBoxNo()); |