| | |
| | | import com.zy.asrs.service.StoreTypeService; |
| | | import com.zy.nc.SendUtil; |
| | | import com.zy.nc.entity.*; |
| | | import com.zy.nc.service.NccSaleXsfhmxWmsService; |
| | | import com.zy.nc.service.NccScPcdaWmsService; |
| | | import com.zy.nc.util.NcResultMessage; |
| | | import com.zy.nc.vo.*; |
| | |
| | | |
| | | @Autowired |
| | | private NccScPcdaWmsService nccScPcdaWmsService; |
| | | |
| | | @Autowired |
| | | private NccSaleXsfhmxWmsService nccSaleXsfhmxWmsService; |
| | | |
| | | @Value("${NYNC.ip}") |
| | | private String nyncIp; |
| | |
| | | } |
| | | break; |
| | | case "采购到货": |
| | | process1 = processCGDH(orderDetls); |
| | | List<Object> cg = new ArrayList<>(); |
| | | cg.add(process1); |
| | | //发送请求 |
| | | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); |
| | | if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | log.info("采购到货response:{}", response); |
| | | step = 10; |
| | | } else { |
| | | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | } |
| | | //不需要上报了 |
| | | step = 10; |
| | | // process1 = processCGDH(orderDetls); |
| | | // List<Object> cg = new ArrayList<>(); |
| | | // cg.add(process1); |
| | | // //发送请求 |
| | | // response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); |
| | | // if (!Cools.isEmpty(response) && response.isSuccess()) { |
| | | // log.info("采购到货response:{}", response); |
| | | // step = 10; |
| | | // } else { |
| | | // remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); |
| | | // } |
| | | break; |
| | | case "转库-出库": |
| | | if (step == 1) { |
| | |
| | | |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | } |
| | | |
| | | private Object processXSFH(List<OrderDetl> orderDetls, Boolean flag) { |
| | | //组装对象数据 |
| | |
| | | saleOutBodyVO.setNnum(flag ? -orderDetl.getQty() : orderDetl.getQty()); |
| | | saleOutBodyVOList.add(saleOutBodyVO); |
| | | } |
| | | data.put("SaleOutHeadVO", saleOutHeadVO); |
| | | data.put("SaleOutBodyVO", saleOutBodyVOList); |
| | | return data; |
| | | } |
| | | |
| | | private Object processTKRK(String matnr,String batch, String orderNo, Double anfme) { |
| | | // EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); |
| | | // wrapper.eq("VBATCHCODE", batch).eq("VSOURCEBILLCODE", orderNo); |
| | | // NccXsckmxTkWms nccXsckmxTkWms = nccXsckmxTkWmsService.selectOne(wrapper); |
| | | // if (null == nccXsckmxTkWms) { |
| | | // throw new CoolException("未找到此条码"); |
| | | // } |
| | | |
| | | NccSaleXsfhmxWms nccSaleXsfhmxWms = nccSaleXsfhmxWmsService.selectOne(new EntityWrapper<NccSaleXsfhmxWms>() |
| | | .eq("VBILLCODE", orderNo) |
| | | .eq("WLBM", matnr) |
| | | ); |
| | | if(null == nccSaleXsfhmxWms) { |
| | | throw new CoolException("未找到销售单据"); |
| | | } |
| | | |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | SaleOutHeadVO saleOutHeadVO = new SaleOutHeadVO(); |
| | | saleOutHeadVO.setPk_org("FYT"); |
| | | SaleOutBodyVO saleOutBodyVO = null; |
| | | List<SaleOutBodyVO> saleOutBodyVOList = new ArrayList<>(); |
| | | |
| | | saleOutBodyVO = new SaleOutBodyVO(); |
| | | saleOutBodyVO.setCsourcetype("4331"); |
| | | saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); |
| | | saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); |
| | | saleOutHeadVO.setCwarehouseid(nccSaleXsfhmxWms.getFhckbm()); |
| | | |
| | | saleOutBodyVO.setVbatchcode(batch); |
| | | saleOutBodyVO.setNnum(anfme * -1); |
| | | saleOutBodyVOList.add(saleOutBodyVO); |
| | | |
| | | data.put("SaleOutHeadVO", saleOutHeadVO); |
| | | data.put("SaleOutBodyVO", saleOutBodyVOList); |
| | | return data; |
| | |
| | | return data; |
| | | } |
| | | |
| | | private Object processZKCK(Order order, List<OrderDetl> orderDetls) { |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | WhsTransBillHeaderVO whsTransBillHeaderVO = new WhsTransBillHeaderVO(); |
| | | whsTransBillHeaderVO.setPk_org("FYT"); |
| | | whsTransBillHeaderVO.setCotherwhid(order.getItemId()); |
| | | whsTransBillHeaderVO.setCtrantypeid("4K-01"); |
| | | WhsTransBillBodyVO whsTransBillBodyVO = null; |
| | | List<WhsTransBillBodyVO> whsTransBillBodyVOS = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | whsTransBillBodyVO = new WhsTransBillBodyVO(); |
| | | String remark = orderDetl.getRemark(); |
| | | //if (!Cools.isEmpty(remark)) { |
| | | //NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); |
| | | whsTransBillBodyVO.setNnum(orderDetl.getQty()); |
| | | whsTransBillBodyVO.setCmaterialoid(orderDetl.getMatnr()); |
| | | whsTransBillBodyVO.setVbatchcode(orderDetl.getBatch()); |
| | | //} |
| | | whsTransBillHeaderVO.setCwarehouseid(orderDetl.getStandby1()); |
| | | whsTransBillBodyVOS.add(whsTransBillBodyVO); |
| | | } |
| | | data.put("WhsTransBillHeaderVO", whsTransBillHeaderVO); |
| | | data.put("WhsTransBillBodyVO", whsTransBillBodyVOS); |
| | | return data; |
| | | } |
| | | |
| | | |
| | | |
| | | private Object processCGDH(List<OrderDetl> orderDetls) { |
| | |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | ic_purchasein_h ic_purchasein_h = new ic_purchasein_h(); |
| | | ic_purchasein_h.setPk_org("FYT"); |
| | | ic_purchasein_h.setCwarehouseid("6301"); |
| | | //ic_purchasein_h.setCwarehouseid("6301"); |
| | | ic_purchasein_h.setCfanaceorgoid("FYT"); |
| | | ic_purchasein_b ic_purchasein_b = null; |
| | | List<ic_purchasein_b> ic_purchasein_bs = new ArrayList<>(); |
| | |
| | | ic_purchasein_b.setCsourcetype(nccCgCgdhdWms.getDhlxbm()); |
| | | ic_purchasein_b.setVbatchcode(orderDetl.getBatch()); |
| | | } |
| | | ic_purchasein_h.setCwarehouseid(orderDetl.getStandby1()); |
| | | ic_purchasein_bs.add(ic_purchasein_b); |
| | | } |
| | | data.put("ic_purchasein_h", ic_purchasein_h); |
| | |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * @param orderDetls |
| | | * @return |
| | | */ |
| | | private Object processGENERALOUT(List<OrderDetl> orderDetls) { |
| | | |
| | | private Object processZKCK(Order order, List<OrderDetl> orderDetls) { |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | ic_generalout_h generalout_h = new ic_generalout_h(); |
| | | generalout_h.setPk_org("FYT"); |
| | | generalout_h.setCwarehouseid("6101"); |
| | | ic_generalout_b generalout_b = null; |
| | | List<ic_generalout_b> ic_purchasein_bs = new ArrayList<>(); |
| | | WhsTransBillHeaderVO whsTransBillHeaderVO = new WhsTransBillHeaderVO(); |
| | | whsTransBillHeaderVO.setPk_org("FYT"); |
| | | whsTransBillHeaderVO.setCotherwhid(order.getItemId()); |
| | | whsTransBillHeaderVO.setCtrantypeid("4K-01"); |
| | | WhsTransBillBodyVO whsTransBillBodyVO = null; |
| | | List<WhsTransBillBodyVO> whsTransBillBodyVOS = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | generalout_b = new ic_generalout_b(); |
| | | String remark = orderDetl.getRemark(); |
| | | if (!Cools.isEmpty(remark)) { |
| | | NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); |
| | | generalout_b.setCmaterialvid(orderDetl.getMatnr()); |
| | | generalout_b.setNshouldassistnum(orderDetl.getQty()); |
| | | generalout_b.setVbatchcode(orderDetl.getBatch()); |
| | | 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()); |
| | | } |
| | | ic_purchasein_bs.add(generalout_b); |
| | | |
| | | whsTransBillBodyVO = new WhsTransBillBodyVO(); |
| | | whsTransBillBodyVO.setCstateid(nccScPcdaWms.getPkBatchcode()); |
| | | |
| | | String remark = orderDetl.getRemark(); |
| | | //if (!Cools.isEmpty(remark)) { |
| | | //NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); |
| | | whsTransBillBodyVO.setNnum(orderDetl.getQty()); |
| | | whsTransBillBodyVO.setCmaterialoid(orderDetl.getMatnr()); |
| | | whsTransBillBodyVO.setVbatchcode(orderDetl.getBatch()); |
| | | //} |
| | | whsTransBillHeaderVO.setCwarehouseid(orderDetl.getStandby1()); |
| | | whsTransBillBodyVOS.add(whsTransBillBodyVO); |
| | | } |
| | | data.put("ic_generalout_h", generalout_h); |
| | | data.put("ic_generalout_b", ic_purchasein_bs); |
| | | data.put("WhsTransBillHeaderVO", whsTransBillHeaderVO); |
| | | data.put("WhsTransBillBodyVO", whsTransBillBodyVOS); |
| | | return data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param orderDetls |
| | |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | ic_generalout_h generalout_h = new ic_generalout_h(); |
| | | generalout_h.setPk_org("FYT"); |
| | | generalout_h.setCwarehouseid("6101"); |
| | | //generalout_h.setCwarehouseid("6101"); |
| | | ic_generalout_b generalout_b = null; |
| | | List<ic_generalout_b> ic_purchasein_bs = new ArrayList<>(); |
| | | for (int i = 0; i < orderDetls.size(); i++) { |
| | | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", orderDetls.get(i).getBatch()).eq("wlbm", orderDetls.get(i).getMatnr())); |
| | | if (nccScPcdaWms == null) { |
| | | throw new CoolException("批次[{}]物料[{}]未找到" + orderDetls.get(i).getBatch() + orderDetls.get(i).getMatnr()); |
| | | } |
| | | // NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", orderDetls.get(i).getBatch()).eq("wlbm", orderDetls.get(i).getMatnr())); |
| | | // if (nccScPcdaWms == null) { |
| | | // throw new CoolException("批次[{}]物料[{}]未找到" + orderDetls.get(i).getBatch() + orderDetls.get(i).getMatnr()); |
| | | // } |
| | | OrderDetl orderDetl = orderDetls.get(i); |
| | | generalout_h.setCwarehouseid(orderDetl.getStandby1()); |
| | | generalout_b = new ic_generalout_b(); |
| | | generalout_b.setCsourcebillbid(s.get(i)); |
| | | generalout_b.setCsourcetype("4K-01"); |
| | | generalout_b.setCsourcebillhid(cspecialhid); |
| | | generalout_b.setCmaterialvid(orderDetl.getMatnr()); |
| | | generalout_b.setCstateid(nccScPcdaWms.getVcode()); |
| | | //generalout_b.setCstateid(nccScPcdaWms.getVcode()); |
| | | StoreType storeType = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", orderDetl.getStandby1())); |
| | | generalout_b.setCdptvid(storeType.getDepartmentId()); |
| | | generalout_b.setBillmaker(renyuan); |
| | | StoreType storeType2 = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", rukucangku)); |
| | | generalout_b.setCotherwhid(rukucangku); |
| | | generalout_b.setCothercalbodyvid(storeType2.getDepartmentId()); |
| | | generalout_b.setNshouldassistnum(orderDetl.getQty()); |
| | | |
| | | //generalout_b.setNshouldassistnum(orderDetl.getQty()); |
| | | generalout_b.setNnum(orderDetl.getQty()); |
| | | generalout_b.setVbatchcode(orderDetl.getBatch()); |
| | | ic_purchasein_bs.add(generalout_b); |
| | | } |