| | |
| | | Object process2 = null; |
| | | String memo = order.getMemo(); |
| | | String remark = ""; |
| | | boolean success = false; |
| | | log.info("订单开始上报:{}", JSON.toJSONString(order)); |
| | | try { |
| | | switch (order.getDocType$().toString()) { |
| | | case "销售退货": |
| | |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("销售发货response:{}", response); |
| | | step = 10; |
| | | success = true; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("销售发货response:{}", response); |
| | | step = 10; |
| | | success = true; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("转库-入库response:{}", response); |
| | | step = 10; |
| | | success = true; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("转库-出库2response:{}", response); |
| | | step = 10; |
| | | success = true; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("转库-出库2response:{}", response); |
| | | step = 10; |
| | | success = true; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("集团内部调拨response:{}", response); |
| | | step = 10; |
| | | success = true; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | throw new CoolException("调用接口报错,请联系管理员"); |
| | | } finally { |
| | | reportApiLog(response, order.getDocType$(), nyncIp, saveRefDelivery); |
| | | reportApiLog(order, process1, process2, response, order.getDocType$(), nyncIp, saveRefDelivery, success); |
| | | } |
| | | |
| | | } |
| | |
| | | private Object processDBDD(List<OrderDetl> orderDetls) { |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | IaIjBill iaIjBill = new IaIjBill(); |
| | | iaIjBill.setPk_org("FYT"); |
| | | //iaIjBill.setCwarehouseid("6101"); |
| | | IaIjBillB iaIjBillB = null; |
| | | List<IaIjBillB> iaIjBillBS = new ArrayList<>(); |
| | | |
| | | String hid = ""; |
| | | List<IaIjBillB> bids = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | iaIjBillB = new IaIjBillB(); |
| | | if (orderDetl.getQty() <= 0) { |
| | | continue; |
| | | } |
| | | IaIjBillB iaIjBillB = new IaIjBillB(); |
| | | String remark = orderDetl.getRemark(); |
| | | if (!Cools.isEmpty(remark)) { |
| | | NccSaleDbddWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleDbddWms.class); |
| | | iaIjBillB.setCinventoryid(nccSaleXsfhmxWms.getWlbm()); |
| | | iaIjBillB.setCinventoryvid(nccSaleXsfhmxWms.getWlbm()); |
| | | iaIjBillB.setCsrcid(nccSaleXsfhmxWms.getCbillid()); |
| | | iaIjBillB.setNnum(orderDetl.getQty().intValue() + ""); |
| | | iaIjBillB.setPk_org("FYT"); |
| | | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", orderDetl.getBatch()).eq("wlbm", orderDetl.getMatnr())); |
| | | if (nccScPcdaWms == null) { |
| | | throw new CoolException("批次[{}]物料[{}]未找到" + orderDetl.getBatch() + "-" + orderDetl.getMatnr()); |
| | | } |
| | | |
| | | Double weight = MatUtils.calcWeight(orderDetl.getMatnr(), orderDetl.getQty()); |
| | | NccSaleDbddWms nccSaleDbddWms = JSONObject.parseObject(remark, NccSaleDbddWms.class); |
| | | iaIjBillB.setBid(nccSaleDbddWms.getCbill_bid()); |
| | | iaIjBillB.setNassistnum(weight); |
| | | iaIjBillB.setNnum(orderDetl.getQty()); |
| | | iaIjBillB.setVbatchcode(orderDetl.getBatch()); |
| | | iaIjBillB.setClocationid(""); |
| | | iaIjBillB.setCstateid(nccScPcdaWms.getVcode()); |
| | | |
| | | hid = nccSaleDbddWms.getCbillid(); |
| | | } |
| | | iaIjBillBS.add(iaIjBillB); |
| | | bids.add(iaIjBillB); |
| | | } |
| | | data.put("ia_ijbill", iaIjBill); |
| | | data.put("ia_ijbill_b", iaIjBillBS); |
| | | data.put("hid", hid); |
| | | data.put("bids", bids); |
| | | return data; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | private Boolean reportApiLog(Object data, String docType, String url, String path) { |
| | | String response = ""; |
| | | boolean success = false; |
| | | private Boolean reportApiLog(Order order, Object process1, Object process2, Object response, String docType, String url, String path, Boolean success) { |
| | | HashMap<String, Object> request = new HashMap<>(); |
| | | request.put("order", order); |
| | | request.put("process1", process1); |
| | | request.put("process2", process2); |
| | | |
| | | apiLogService.save( |
| | | docType, |
| | | url + path, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(data), |
| | | response, |
| | | JSON.toJSONString(request), |
| | | JSON.toJSONString(response), |
| | | success |
| | | ); |
| | | return false; |