|  |  |  | 
|---|
|  |  |  | 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; | 
|---|
|  |  |  | 
|---|
|  |  |  | Object process2 = null; | 
|---|
|  |  |  | String memo = order.getMemo(); | 
|---|
|  |  |  | String remark = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | log.info("订单开始上报:{}", JSON.toJSONString(order)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | switch (order.getDocType$().toString()) { | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public boolean reportTkrk(WaitPakin waitPakin) { | 
|---|
|  |  |  | String matnr = waitPakin.getMatnr(); | 
|---|
|  |  |  | String batch = waitPakin.getBatch(); | 
|---|
|  |  |  | String orderNo = waitPakin.getTkFlag(); | 
|---|
|  |  |  | Double anfme = waitPakin.getAnfme(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean reportCheckOrder(String matnr, String batch) { | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> checkOrderDetls = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>() | 
|---|
|  |  |  | .eq("matnr", matnr) | 
|---|
|  |  |  | .eq("batch", batch) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ArrayList<String> warehouseIdList = new ArrayList<>(); | 
|---|
|  |  |  | ArrayList<String> orderNoList = new ArrayList<>(); | 
|---|
|  |  |  | for (InventoryCheckOrderDetl checkOrderDetl : checkOrderDetls) { | 
|---|
|  |  |  | if (!warehouseIdList.contains(checkOrderDetl.getCwarehouseid())) { | 
|---|
|  |  |  | warehouseIdList.add(checkOrderDetl.getCwarehouseid()); | 
|---|
|  |  |  | Object process1 = null; | 
|---|
|  |  |  | NcResultMessage response1 = null; | 
|---|
|  |  |  | boolean success1 = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | process1 = processTKRK(matnr, batch, orderNo, anfme, waitPakin.getCstateid()); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | process1 = e.getMessage(); | 
|---|
|  |  |  | } 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, waitPakin.getCstateidVcode()); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | 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(); | 
|---|
|  |  |  | process2 = e.getMessage(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | reportApiLog(null, process2, process2, response2, "DBRK", nyncIp, dbdd, success2); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean reportCheckOrder(List<InventoryCheckOrderDetl> checkOrderDetls) { | 
|---|
|  |  |  | ArrayList<String> orderNoList = new ArrayList<>(); | 
|---|
|  |  |  | HashMap<String, List<InventoryCheckOrderDetl>> map = new HashMap<>(); | 
|---|
|  |  |  | for (InventoryCheckOrderDetl checkOrderDetl : checkOrderDetls) { | 
|---|
|  |  |  | if (map.containsKey(checkOrderDetl.getCwarehouseid())) { | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> list = map.get(checkOrderDetl.getCwarehouseid()); | 
|---|
|  |  |  | list.add(checkOrderDetl); | 
|---|
|  |  |  | map.put(checkOrderDetl.getCwarehouseid(), list); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> list = new ArrayList<>(); | 
|---|
|  |  |  | list.add(checkOrderDetl); | 
|---|
|  |  |  | map.put(checkOrderDetl.getCwarehouseid(), list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!orderNoList.contains(checkOrderDetl.getOrderNo())) { | 
|---|
|  |  |  | orderNoList.add(checkOrderDetl.getOrderNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean result = true; | 
|---|
|  |  |  | for (String cwarehouseid : warehouseIdList) { | 
|---|
|  |  |  | Object process1 = processInvcount(matnr, batch, cwarehouseid); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | NcResultMessage response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, invcountAdd, JSONObject.toJSONString(process1)); | 
|---|
|  |  |  | log.info("盘点单response:{}", response); | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | for (Map.Entry<String, List<InventoryCheckOrderDetl>> entry : map.entrySet()) { | 
|---|
|  |  |  | String cwarehouseid = entry.getKey(); | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> list = entry.getValue(); | 
|---|
|  |  |  | Object process1 = processInvcount(list, cwarehouseid); | 
|---|
|  |  |  | NcResultMessage response = null; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, invcountAdd, JSONObject.toJSONString(process1)); | 
|---|
|  |  |  | log.info("盘点单response:{}", response); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | result = false; | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("盘点单response:{}", response); | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | result = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | reportApiLog(null, process1, null, response, "盘点上报", nyncIp, invcountAdd, success); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (result) { | 
|---|
|  |  |  | List<InventoryCheckOrder> inventoryCheckOrders = inventoryCheckOrderService.selectList(new EntityWrapper<InventoryCheckOrder>() | 
|---|
|  |  |  | 
|---|
|  |  |  | saleOutBodyVO.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | saleOutBodyVO.setNshouldnum(flag ? -orderDetl.getQty() : orderDetl.getQty()); | 
|---|
|  |  |  | saleOutBodyVO.setNnum(flag ? -orderDetl.getQty() : orderDetl.getQty()); | 
|---|
|  |  |  | saleOutBodyVO.setCstateid(orderDetl.getCstateid()); | 
|---|
|  |  |  | saleOutBodyVOList.add(saleOutBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("SaleOutHeadVO", saleOutHeadVO); | 
|---|
|  |  |  | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processTKRK(String matnr,String batch, String orderNo, Double anfme) { | 
|---|
|  |  |  | private Object processTKRK(String matnr, String batch, String orderNo, Double anfme, String cstateid) { | 
|---|
|  |  |  | //        EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | //        wrapper.eq("VBATCHCODE", batch).eq("VSOURCEBILLCODE", orderNo); | 
|---|
|  |  |  | //        NccXsckmxTkWms nccXsckmxTkWms = nccXsckmxTkWmsService.selectOne(wrapper); | 
|---|
|  |  |  | 
|---|
|  |  |  | .eq("VBILLCODE", orderNo) | 
|---|
|  |  |  | .eq("WLBM", matnr) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(null == nccSaleXsfhmxWms) { | 
|---|
|  |  |  | if (null == nccSaleXsfhmxWms) { | 
|---|
|  |  |  | throw new CoolException("未找到销售单据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | saleOutBodyVO.setVbatchcode(batch); | 
|---|
|  |  |  | saleOutBodyVO.setNnum(anfme * -1); | 
|---|
|  |  |  | saleOutBodyVO.setCstateid(cstateid); | 
|---|
|  |  |  | saleOutBodyVOList.add(saleOutBodyVO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.put("SaleOutHeadVO", saleOutHeadVO); | 
|---|
|  |  |  | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processInvcount(String matnr, String batch, String cwarehouseid) { | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> inventoryCheckOrderDetls = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>() | 
|---|
|  |  |  | .eq("matnr", matnr) | 
|---|
|  |  |  | .eq("batch", batch) | 
|---|
|  |  |  | .eq("cwarehouseid", cwarehouseid) | 
|---|
|  |  |  | private Object processDBTK(String matnr, String batch, String orderNo, Double anfme, String cstateid) { | 
|---|
|  |  |  | 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 * -1); | 
|---|
|  |  |  | iaIjBillB.setNnum(anfme * -1); | 
|---|
|  |  |  | iaIjBillB.setVbatchcode(batch); | 
|---|
|  |  |  | iaIjBillB.setClocationid(""); | 
|---|
|  |  |  | iaIjBillB.setCstateid(cstateid); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bids.add(iaIjBillB); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.put("hid", nccSaleDbddWms.getCbillid()); | 
|---|
|  |  |  | data.put("bids", bids); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processInvcount(List<InventoryCheckOrderDetl> inventoryCheckOrderDetls, String cwarehouseid) { | 
|---|
|  |  |  | if (inventoryCheckOrderDetls.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("盘点明细不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //合并数量 | 
|---|
|  |  |  | BigDecimal checkAnfmeDecimal = new BigDecimal(0); | 
|---|
|  |  |  | HashMap<String, InventoryCheckOrderDetl> map = new HashMap<>(); | 
|---|
|  |  |  | for (InventoryCheckOrderDetl checkOrderDetl : inventoryCheckOrderDetls) { | 
|---|
|  |  |  | checkAnfmeDecimal = checkAnfmeDecimal.add(BigDecimal.valueOf(checkOrderDetl.getCheckAnfme())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String key = checkOrderDetl.getMatnr() + "_" + checkOrderDetl.getBatch() + "_" + checkOrderDetl.getCstateid(); | 
|---|
|  |  |  | if (map.containsKey(key)) { | 
|---|
|  |  |  | InventoryCheckOrderDetl orderDetl = map.get(key); | 
|---|
|  |  |  | BigDecimal checkAnfmeDecimal = BigDecimal.valueOf(orderDetl.getCheckAnfme()); | 
|---|
|  |  |  | checkAnfmeDecimal = checkAnfmeDecimal.add(BigDecimal.valueOf(checkOrderDetl.getCheckAnfme())); | 
|---|
|  |  |  | //计算辅数量 | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(orderDetl.getMatnr(), checkAnfmeDecimal.doubleValue()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //计算辅数量 | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(matnr, checkAnfmeDecimal.doubleValue()); | 
|---|
|  |  |  | orderDetl.setCheckAnfme(checkAnfmeDecimal.doubleValue()); | 
|---|
|  |  |  | orderDetl.setWeight(weight); | 
|---|
|  |  |  | map.put(key, orderDetl); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | //计算辅数量 | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(checkOrderDetl.getMatnr(), checkOrderDetl.getCheckAnfme()); | 
|---|
|  |  |  | checkOrderDetl.setWeight(weight); | 
|---|
|  |  |  | map.put(key, checkOrderDetl); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<InvCountBodyVO> invCountBodyVOList = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>() | 
|---|
|  |  |  | .eq("WLBM", matnr) | 
|---|
|  |  |  | .eq("VBATCHCODE", batch) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (null == nccScPcdaWms) { | 
|---|
|  |  |  | throw new CoolException("ERP数据库无法查询到盘点上报数据"); | 
|---|
|  |  |  | for (Map.Entry<String, InventoryCheckOrderDetl> entry : map.entrySet()) { | 
|---|
|  |  |  | InventoryCheckOrderDetl checkOrderDetl = entry.getValue(); | 
|---|
|  |  |  | String matnr = checkOrderDetl.getMatnr(); | 
|---|
|  |  |  | String batch = checkOrderDetl.getBatch(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>() | 
|---|
|  |  |  | .eq("WLBM", matnr) | 
|---|
|  |  |  | .eq("VBATCHCODE", batch) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (null == nccScPcdaWms) { | 
|---|
|  |  |  | throw new CoolException("ERP数据库无法查询到盘点上报数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | InvCountBodyVO invCountBodyVO = new InvCountBodyVO(); | 
|---|
|  |  |  | invCountBodyVO.setCmaterialoid(matnr); | 
|---|
|  |  |  | invCountBodyVO.setVbatchcode(batch); | 
|---|
|  |  |  | invCountBodyVO.setNcountnum(checkOrderDetl.getCheckAnfme()); | 
|---|
|  |  |  | invCountBodyVO.setNcountastnum(checkOrderDetl.getWeight()); | 
|---|
|  |  |  | invCountBodyVO.setCstateid(checkOrderDetl.getCstateid()); | 
|---|
|  |  |  | invCountBodyVO.setPk_batchcode(nccScPcdaWms.getPkBatchcode()); | 
|---|
|  |  |  | invCountBodyVOList.add(invCountBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | InvCountBodyVO invCountBodyVO = new InvCountBodyVO(); | 
|---|
|  |  |  | invCountBodyVO.setCmaterialoid(matnr); | 
|---|
|  |  |  | invCountBodyVO.setVbatchcode(batch); | 
|---|
|  |  |  | invCountBodyVO.setNcountnum(checkAnfmeDecimal.doubleValue()); | 
|---|
|  |  |  | invCountBodyVO.setNcountastnum(weight); | 
|---|
|  |  |  | invCountBodyVO.setCstateid(nccScPcdaWms.getPkStorestate()); | 
|---|
|  |  |  | invCountBodyVO.setPk_batchcode(nccScPcdaWms.getPkBatchcode()); | 
|---|
|  |  |  | invCountBodyVOList.add(invCountBodyVO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InvCountHeaderVO invCountHeaderVO = new InvCountHeaderVO(); | 
|---|
|  |  |  | invCountHeaderVO.setPk_org("FYT"); | 
|---|
|  |  |  | 
|---|
|  |  |  | 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"); | 
|---|
|  |  |  | 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(orderDetl.getCstateidVcode()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hid = nccSaleDbddWms.getCbillid(); | 
|---|
|  |  |  | bids.add(iaIjBillB); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | iaIjBillBS.add(iaIjBillB); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("ia_ijbill", iaIjBill); | 
|---|
|  |  |  | data.put("ia_ijbill_b", iaIjBillBS); | 
|---|
|  |  |  | data.put("hid", hid); | 
|---|
|  |  |  | data.put("bids", bids); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | whsTransBillBodyVO = new WhsTransBillBodyVO(); | 
|---|
|  |  |  | whsTransBillBodyVO.setCstateid(nccScPcdaWms.getPkStorestate()); | 
|---|
|  |  |  | whsTransBillBodyVO.setCstateid(orderDetl.getCstateid()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String remark = orderDetl.getRemark(); | 
|---|
|  |  |  | //if (!Cools.isEmpty(remark)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | generalout_b.setCsourcetype("4K-01"); | 
|---|
|  |  |  | generalout_b.setCsourcebillhid(cspecialhid); | 
|---|
|  |  |  | generalout_b.setCmaterialvid(orderDetl.getMatnr()); | 
|---|
|  |  |  | generalout_b.setCstateid(nccScPcdaWms.getPkStorestate()); | 
|---|
|  |  |  | generalout_b.setCstateid(orderDetl.getCstateid()); | 
|---|
|  |  |  | generalout_b.setPk_batchcode(nccScPcdaWms.getPkBatchcode()); | 
|---|
|  |  |  | StoreType storeType = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", orderDetl.getStandby1())); | 
|---|
|  |  |  | generalout_b.setCdptvid(storeType.getDepartmentId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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; | 
|---|