| | |
| | | private ErpTokenService erpTokenService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(WrkMast wrkMast) { |
| | |
| | | if (wrkMast.getIoType() == 1) { |
| | | // 入库通知单 |
| | | if (!Cools.isEmpty(wrkMast.getBarcode())) { |
| | | // JSONObject res = erpTokenService.stockIn(wrkMast.getBarcode()); |
| | | // if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) { |
| | | // JSONObject data = res.getJSONObject("data"); |
| | | // String tlocation = data == null ? null : data.getString("tlocation"); |
| | | // if (!Cools.isEmpty(tlocation) && !Cools.isEmpty(wrkMast.getLocNo())) { |
| | | // List<LocDetl> detls = locDetlService.selectList(new EntityWrapper<LocDetl>() |
| | | // .eq("loc_no", wrkMast.getLocNo())); |
| | | // if (!Cools.isEmpty(detls)) { |
| | | // for (LocDetl detl : detls) { |
| | | // detl.setStandby1(tlocation); |
| | | // locDetlService.updateById(detl); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\"}"; |
| | | log.info("ERP入库上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request); |
| | | JSONObject res = erpTokenService.stockIn(wrkMast.getBarcode()); |
| | | log.info("ERP入库上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString()); |
| | | apiLogService.save("erp.stockIn", "erpTokenService.stockIn", null, null, request, |
| | | res == null ? null : res.toJSONString(), |
| | | res != null && Boolean.TRUE.equals(res.getBoolean("success"))); |
| | | if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) { |
| | | JSONObject data = res.getJSONObject("data"); |
| | | String tlocation = data == null ? null : data.getString("tlocation"); |
| | | if (!Cools.isEmpty(tlocation) && !Cools.isEmpty(wrkMast.getLocNo())) { |
| | | List<LocDetl> detls = locDetlService.selectList(new EntityWrapper<LocDetl>() |
| | | .eq("loc_no", wrkMast.getLocNo())); |
| | | if (!Cools.isEmpty(detls)) { |
| | | for (LocDetl detl : detls) { |
| | | detl.setStandby1(tlocation); |
| | | locDetlService.updateById(detl); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 保存入库通知档历史档 |
| | |
| | | |
| | | // 出库 -------------------------------------------------------------------------------- |
| | | } else if (wrkMast.getWrkSts() == 15) { |
| | | if(wrkMast.getIsSuplus()!=null && wrkMast.getIsSuplus()==1 && !Objects.isNull(wrkMast.getExitMk())){ |
| | | List<WrkDetl> wrkDetls1 = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); |
| | | if(wrkMast.getIsSuplus()!=null && wrkMast.getIsSuplus()==1 && wrkMast.getExitMk().equals("Y")){ |
| | | List<WrkDetl> wrkDetls1 = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no",wrkMast.getWrkNo())); |
| | | WrkDetl wrkDetl = wrkDetls1.get(0); |
| | | String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\",\"anfme\":" + wrkDetl.getAnfme() + "}"; |
| | | log.info("ERP退料上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request); |
| | | JSONObject res = erpTokenService.stockBack(wrkMast.getBarcode(),wrkDetl.getAnfme(),null); |
| | | log.info("ERP退料上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString()); |
| | | apiLogService.save("erp.stockBack", "erpTokenService.stockBack", null, null, request, |
| | | res == null ? null : res.toJSONString(), |
| | | res != null && Boolean.TRUE.equals(res.getBoolean("success"))); |
| | | if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) { |
| | | |
| | | } |
| | | }else if(Objects.isNull(wrkMast.getLocNo())){ |
| | | String request = "{\"barcode\":\"" + wrkMast.getBarcode() + "\"}"; |
| | | log.info("ERP出库上报请求: workNo={}, request={}", wrkMast.getWrkNo(), request); |
| | | JSONObject res = erpTokenService.stockOut(wrkMast.getBarcode(),null); |
| | | log.info("ERP出库上报响应: workNo={}, response={}", wrkMast.getWrkNo(), res == null ? null : res.toJSONString()); |
| | | apiLogService.save("erp.stockOut", "erpTokenService.stockOut", null, null, request, |
| | | res == null ? null : res.toJSONString(), |
| | | res != null && Boolean.TRUE.equals(res.getBoolean("success"))); |
| | | if (res != null && Boolean.TRUE.equals(res.getBoolean("success"))) { |
| | | |
| | | } |