| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.StoreType; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.asrs.service.ReportToThirdService; |
| | | import com.zy.asrs.service.StoreTypeService; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | 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.service.NccXsckmxTkWmsService; |
| | | import com.zy.nc.util.NcResultMessage; |
| | | import com.zy.nc.vo.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private WrkDetlService wrkDetlService; |
| | | @Autowired |
| | | private InventoryCheckOrderService inventoryCheckOrderService; |
| | | @Autowired |
| | | private InventoryCheckOrderDetlService inventoryCheckOrderDetlService; |
| | | |
| | | @Autowired |
| | | private StoreTypeService storeTypeService; |
| | | |
| | | @Autowired |
| | | private NccScPcdaWmsService nccScPcdaWmsService; |
| | | |
| | | @Autowired |
| | | private NccXsckmxTkWmsService nccXsckmxTkWmsService; |
| | | |
| | | @Autowired |
| | | private NccSaleXsfhmxWmsService nccSaleXsfhmxWmsService; |
| | |
| | | |
| | | @Value("${NYNC.saveRefWhsTrans}") |
| | | private String saveRefWhsTrans; |
| | | |
| | | @Value("${NYNC.invcountAdd}") |
| | | private String invcountAdd; |
| | | |
| | | @Value("${NYNC.purchasein}") |
| | | private String purchasein; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void reportTkrk(String batch, String orderNo, Double anfme) { |
| | | Object process1 = processTKRK(batch, orderNo, anfme); |
| | | 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); |
| | | // } else { |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean reportCheckOrder(InventoryCheckOrder checkOrder) { |
| | | Object process1 = processInvcount(checkOrder); |
| | | //发送请求 |
| | | NcResultMessage response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, invcountAdd, 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) { |
| | |
| | | return data; |
| | | } |
| | | |
| | | private Object processTKRK(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("未找到此条码"); |
| | | } |
| | | 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", nccXsckmxTkWms.getVsourcebillcode()) |
| | | .eq("WLBM", nccXsckmxTkWms.getWlbm()) |
| | | .eq("VBILLCODE", orderNo) |
| | | .eq("WLBM", matnr) |
| | | ); |
| | | if(null == nccSaleXsfhmxWms) { |
| | | throw new CoolException("未找到销售单据"); |
| | |
| | | |
| | | saleOutBodyVO = new SaleOutBodyVO(); |
| | | saleOutBodyVO.setCsourcetype("4331"); |
| | | saleOutBodyVO.setCsourcebillbid(nccXsckmxTkWms.getCsourcebillbid()); |
| | | saleOutBodyVO.setCsourcebillhid(nccXsckmxTkWms.getCsourcebillhid()); |
| | | saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); |
| | | saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); |
| | | saleOutHeadVO.setCwarehouseid(nccSaleXsfhmxWms.getFhckbm()); |
| | | |
| | | saleOutBodyVO.setVbatchcode(nccXsckmxTkWms.getVbatchcode()); |
| | | saleOutBodyVO.setNshouldnum(anfme * -1); |
| | | saleOutBodyVO.setVbatchcode(batch); |
| | | saleOutBodyVO.setNnum(anfme * -1); |
| | | saleOutBodyVOList.add(saleOutBodyVO); |
| | | |
| | |
| | | return data; |
| | | } |
| | | |
| | | private Object processInvcount(InventoryCheckOrder checkOrder) { |
| | | List<InventoryCheckOrderDetl> inventoryCheckOrderDetls = inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>() |
| | | .eq("order_no", checkOrder.getOrderNo())); |
| | | if (inventoryCheckOrderDetls.isEmpty()) { |
| | | throw new CoolException("盘点明细不存在"); |
| | | } |
| | | |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |
| | | |
| | | //仓库id |
| | | String cwarehouseid = null; |
| | | List<InvCountBodyVO> invCountBodyVOList = new ArrayList<>(); |
| | | for (InventoryCheckOrderDetl inventoryCheckOrderDetl : inventoryCheckOrderDetls) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>() |
| | | .eq("matnr", inventoryCheckOrderDetl.getMatnr()) |
| | | .eq("batch", inventoryCheckOrderDetl.getBatch()) |
| | | ); |
| | | if (wrkDetls.isEmpty()) { |
| | | throw new CoolException("工作档明细不存在"); |
| | | } |
| | | |
| | | cwarehouseid = wrkDetls.get(0).getStandby1(); |
| | | |
| | | InvCountBodyVO invCountBodyVO = new InvCountBodyVO(); |
| | | invCountBodyVO.setCmaterialoid(inventoryCheckOrderDetl.getMatnr()); |
| | | invCountBodyVO.setVbatchcode(inventoryCheckOrderDetl.getBatch()); |
| | | invCountBodyVO.setNcountastnum(inventoryCheckOrderDetl.getCheckAnfme()); |
| | | invCountBodyVOList.add(invCountBodyVO); |
| | | } |
| | | |
| | | InvCountHeaderVO invCountHeaderVO = new InvCountHeaderVO(); |
| | | invCountHeaderVO.setPk_org("FYT"); |
| | | invCountHeaderVO.setCtrantypeid("4R-01"); |
| | | invCountHeaderVO.setCwarehouseid(cwarehouseid); |
| | | |
| | | data.put("InvCountHeaderVO", invCountHeaderVO); |
| | | data.put("InvCountBodyVO", invCountBodyVOList); |
| | | data.put("paper", "2"); |
| | | data.put("splr", "1"); |
| | | |
| | | ArrayList<Map<String, Object>> list = new ArrayList<>(); |
| | | list.add(data); |
| | | return list; |
| | | } |
| | | |
| | | private Object processZKRK(List<OrderDetl> orderDetls) { |
| | | //组装对象数据 |
| | | Map<String, Object> data = new HashMap<String, Object>(); |