| | |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.nc.SendUtil; |
| | | import com.zy.nc.entity.*; |
| | | import com.zy.nc.service.NccSaleDbddWmsService; |
| | | import com.zy.nc.service.NccSaleXsfhmxWmsService; |
| | | import com.zy.nc.service.NccScPcdaWmsService; |
| | | import com.zy.nc.util.NcResultMessage; |
| | |
| | | |
| | | @Autowired |
| | | private NccSaleXsfhmxWmsService nccSaleXsfhmxWmsService; |
| | | @Autowired |
| | | private NccSaleDbddWmsService nccSaleDbddWmsService; |
| | | |
| | | @Value("${NYNC.ip}") |
| | | private String nyncIp; |
| | |
| | | |
| | | @Override |
| | | public boolean reportTkrk(String matnr, String batch, String orderNo, Double anfme) { |
| | | Object process1 = processTKRK(matnr, batch, orderNo, anfme); |
| | | //发送请求 |
| | | NcResultMessage response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); |
| | | log.info("退库入库response:{}", response); |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("退库入库response:{}", response); |
| | | return true; |
| | | } else { |
| | | // remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | return false; |
| | | Object process1 = null; |
| | | NcResultMessage response1 = null; |
| | | boolean success1 = false; |
| | | try { |
| | | process1 = processTKRK(matnr, batch, orderNo, anfme); |
| | | //发送请求 |
| | | response1 = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); |
| | | log.info("退库入库response:{}", response1); |
| | | if (!Cools.isEmpty(response1) && response1.isSuccess()) { |
| | | log.info("退库入库response:{}", response1); |
| | | success1 = true; |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | reportApiLog(null, process1, process1, response1, "TKRK", nyncIp, saveRefDelivery, success1); |
| | | } |
| | | |
| | | Object process2 = null; |
| | | NcResultMessage response2 = null; |
| | | boolean success2 = false; |
| | | try { |
| | | process2 = processDBTK(matnr, batch, orderNo, anfme); |
| | | //发送请求 |
| | | response2 = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, dbdd, JSONObject.toJSONString(process2)); |
| | | log.info("退库入库response:{}", response2); |
| | | if (!Cools.isEmpty(response2) && response2.isSuccess()) { |
| | | log.info("退库入库response:{}", response2); |
| | | success2 = true; |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | reportApiLog(null, process2, process2, response2, "DBRK", nyncIp, dbdd, success2); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | |
| | | return data; |
| | | } |
| | | |
| | | private Object processDBTK(String matnr, String batch, String orderNo, Double anfme) { |
| | | List<NccSaleDbddWms> nccSaleDbddWmsList = nccSaleDbddWmsService.selectList(new EntityWrapper<NccSaleDbddWms>() |
| | | .eq("wlbm", matnr) |
| | | .eq("vbillcode", orderNo) |
| | | ); |
| | | |
| | | if (nccSaleDbddWmsList.isEmpty()) { |
| | | throw new CoolException("调拨订单ERP数据为空"); |
| | | } |
| | | |
| | | NccSaleDbddWms nccSaleDbddWms = nccSaleDbddWmsList.get(0); |
| | | |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | |
| | | List<IaIjBillB> bids = new ArrayList<>(); |
| | | IaIjBillB iaIjBillB = new IaIjBillB(); |
| | | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", batch).eq("wlbm", matnr)); |
| | | if (nccScPcdaWms == null) { |
| | | throw new CoolException("批次[{}]物料[{}]未找到" + batch + "-" + matnr); |
| | | } |
| | | |
| | | Double weight = MatUtils.calcWeight(matnr, anfme); |
| | | iaIjBillB.setBid(nccSaleDbddWms.getCbill_bid()); |
| | | iaIjBillB.setNassistnum(weight); |
| | | iaIjBillB.setNnum(anfme * -1); |
| | | iaIjBillB.setVbatchcode(batch); |
| | | iaIjBillB.setClocationid(""); |
| | | iaIjBillB.setCstateid(nccScPcdaWms.getVcode()); |
| | | |
| | | bids.add(iaIjBillB); |
| | | |
| | | data.put("hid", nccSaleDbddWms.getCbill_bid()); |
| | | data.put("bids", bids); |
| | | return data; |
| | | } |
| | | |
| | | private Object processInvcount(String matnr, String batch, String cwarehouseid) { |
| | | List<InventoryCheckOrderDetl> inventoryCheckOrderDetls = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>() |
| | | .eq("matnr", matnr) |