| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/4/9 |
| | |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderLogService orderLogService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | |
| | | } |
| | | orderService.remove(order.getId()); |
| | | } |
| | | OrderLog orderLog = orderLogService.selectByNo(param.getCCode()); |
| | | if (!Cools.isEmpty(orderLog)) { |
| | | throw new CoolException(param.getCCode() + "单据已经完成,不需要再传递"); |
| | | } |
| | | |
| | | DocType docType = docTypeService.selectOrAdd(param.getType(), Boolean.FALSE); |
| | | Date now = new Date(); |
| | | |
| | |
| | | //删除存货档案 |
| | | if (param.deleteFlag == 1) { |
| | | for (MatSyncParam.MatParam matParam : param.getMatDetails()) { |
| | | matService.deleteById(matParam.getMatnr()); |
| | | matService.delete(new EntityWrapper<Mat>().eq("matnr", matParam.getMatnr())); |
| | | } |
| | | |
| | | return; |
| | |
| | | Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo, brand); |
| | | Mat mat = matService.selectByMaktx(pla.getBrand()); |
| | | //当生产单号不一致时,需要新建一个param |
| | | if (list.size() == 0 || checkOrder(list, pla.getProOrderNo()) == null) { |
| | | if (list.isEmpty() || (!Cools.isEmpty(pla.getProOrderNo()) && checkOrder(list, pla.getProOrderNo()) == null)) { |
| | | OpenOrderPakoutParam param = new OpenOrderPakoutParam(); |
| | | param.setcMaker(json.get("user").toString()); |
| | | String type = Cools.isEmpty(pla.getProOrderNo()) ? "调拨入库单" : "产成品入库"; |
| | |
| | | OpenOrderPakoutParam.Body body = new OpenOrderPakoutParam.Body(); |
| | | body.setcInvCode(mat.getMatnr()); |
| | | body.setiQuantity(pla.getWeightAnfme()); |
| | | body.setcBatch(""); |
| | | body.setcBatch(pla.getBatch()); |
| | | body.setCPackage(pla.getPackageNo()+""); |
| | | body.setCbMemo(pla.getMemo()); |
| | | bodyList.add(body); |
| | | |
| | |
| | | body = new OpenOrderPakoutParam.Body(); |
| | | body.setcInvCode(mat.getMatnr()); |
| | | body.setiQuantity(pla.getWeightAnfme()); |
| | | body.setcBatch(pla.getBatch()); |
| | | body.setCPackage(pla.getPackageNo()+""); |
| | | body.setCbMemo(pla.getMemo()); |
| | | bodyList.add(body); |
| | | } else { |
| | | body.setiQuantity(body.getIQuantity() + pla.getWeightAnfme()); |
| | | body.setcBatch(pla.getBatch()); |
| | | body.setCPackage(pla.getPackageNo()+""); |
| | | } |
| | | } |
| | | } |
| | |
| | | doHttpRequest(param, "入库单上报", url, orderReportPath, null, "127.0.0.1"); |
| | | |
| | | } |
| | | |
| | | return 200; |
| | | |
| | | //return doHttpRequest(list, "入库单上报", url, orderReportPath, null, "127.0.0.1"); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Order> selectOrderInformation(Map<String, String> param) { |
| | |
| | | boolean success = false; |
| | | |
| | | try { |
| | | log.info("请求参数:{}", requestParam); |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url) |
| | | .setTimeout(30, TimeUnit.SECONDS) |
| | | .setPath(path) |
| | | .setJson(JSONObject.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | response = response.replace("\\", ""); |
| | | response = response.substring(1, response.length() - 1); |
| | | log.info("入库单上报请求返回报文:{}", response); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | JSONArray jsonArray = (JSONArray) jsonObject.get(""); |
| | | JSONObject jsonResult = (JSONObject) jsonArray.get(0); |
| | | if (Cools.isEmpty(jsonResult.get("ErrorCode"))) { |
| | | throw new CoolException(jsonResult.get("errorMsg").toString()); |
| | | if (Cools.isEmpty(jsonObject.get("ErrorCode"))) { |
| | | throw new CoolException(jsonObject.get("ErrorMsg").toString()); |
| | | } |
| | | |
| | | int code = Integer.parseInt(jsonResult.get("ErrorCode").toString()); |
| | | if (code != 1) { |
| | | throw new CoolException(jsonResult.get("errorMsg").toString()); |
| | | int code = Integer.parseInt(jsonObject.get("ErrorCode").toString()); |
| | | if (code == 0) { |
| | | throw new CoolException(jsonObject.get("ErrorMsg").toString()); |
| | | } |
| | | success = true; |
| | | return code; |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |