| | |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.enums.OrderTypeEnum; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.TaskDetlLogServiceImpl; |
| | | import com.zy.asrs.service.impl.TaskDetlServiceImpl; |
| | | import com.zy.asrs.task.AbstractHandler; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.utils.OrderInAndOutUtil; |
| | |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | CheckOrderDetlService checkOrderDetlService; |
| | | @Autowired |
| | | private TaskDetlLogService taskDetlLogService; |
| | | |
| | | |
| | | @Transactional |
| | |
| | | ReportOrderParam orderParam = new ReportOrderParam(); |
| | | orderParam.setCompany_id(order.getCstmrName()) |
| | | .setWms_id(order.getId() + "") |
| | | // .setOrder_no(order.getOrderNo()) |
| | | .setDispatch_no(order.getOrderNo()) |
| | | .setType(order.getDocType() + "") |
| | | .setInv_no(order.getNumber()) |
| | |
| | | .setPro_id(detl.getSuppCode()) |
| | | .setLocation_no(locDetl.getZpallet()) |
| | | .setSj_emp(locDetl.getModiUser$()) |
| | | .setLocation_type(MatLocType.getMatTag(material.getTagId() + "")) |
| | | .setLocation_type(MatLocType.getMatTag(material.getTagId() + "")) |
| | | // 上报时,默认上报时间是更新时间 |
| | | .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss") ) |
| | | .setSj_date(Utils.dateToStr(order.getUpdateTime(), "yyyy-MM-dd HH:mm:ss")) |
| | | // 上报时,默认上报数量是订单数量 |
| | | .setPick_qty(detl.getQty().intValue()) |
| | | // 上报时,默认损坏数量是0 |
| | |
| | | } |
| | | } |
| | | } else if (Integer.valueOf(docType.getDocId() + "").equals(OrderTypeEnum.TRANSFER.type)) { |
| | | // 备货派工单(出库) |
| | | // 备货指示派工单(出库) |
| | | ReportOrderParam orderParam = new ReportOrderParam(); |
| | | orderParam.setCompany_id(order.getCstmrName()) |
| | | .setWms_id(order.getId() + "") |
| | | .setOrder_no(order.getOrderNo()) |
| | | .setDispatch_no(order.getOrderNo()) |
| | | .setType(order.getDocType() + "") |
| | | .setInv_no(order.getNumber()) |
| | | .setPm_tktid(order.getItemName()) |
| | | .setUpdate_time(Utils.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss")) |
| | | .setTarget_location(""); |
| | | //目标库区 |
| | | .setTarget_location("") |
| | | .setSource_location("1"); |
| | | |
| | | List<ReportOrderParams> reportOrderParams = new ArrayList<>(); |
| | | List<OrderItemsParam> reportOrderParams = new ArrayList<>(); |
| | | orderDetls.forEach(detl -> { |
| | | Mat material = matService.selectByMatnr(detl.getMatnr()); |
| | | if (Objects.isNull(material)) { |
| | | throw new CoolException("物料不存在"); |
| | | } |
| | | ReportOrderParams itemParam = new ReportOrderParams(); |
| | | TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>() |
| | | .eq("matnr", detl.getMatnr()) |
| | | .eq("supp_code", detl.getStandby1()) |
| | | .eq("order_no", detl.getOrderNo())); |
| | | if (Objects.isNull(detlLog)) { |
| | | throw new CoolException("数据错误 ,请检查AGV任务档是否已完成!!"); |
| | | } |
| | | //目标库区 |
| | | orderParam.setTarget_location(detlLog.getAreaType()); |
| | | OrderItemsParam itemParam = new OrderItemsParam(); |
| | | // BS Code |
| | | itemParam.setTotal_serial(detl.getThreeCode()) |
| | | itemParam |
| | | // 上报时,默认产品类型是null |
| | | .setPro_type(material.getProType()) |
| | | // 上报时,默认产品编码 |
| | | .setPro_komcode(detl.getMatnr()) |
| | | // 上报时,默认产品id是供应商编码 |
| | | .setPro_id(detl.getSuppCode()) |
| | | // 上报时,默认来源位置是null |
| | | .setLocation_no(null) |
| | | // 上报时,默认目标位置是null |
| | | .setLocation_type(null) |
| | | // 上报时,默认上报时间是更新时间 |
| | | .setSj_date(order.getUpdateBy().toString()) |
| | | // 上报时,默认上报人是更新人 |
| | | .setSj_emp(order.getUpdateBy$()) |
| | | // // 上报时,默认来源位置是null |
| | | .setLocation_no(detlLog.getZpallet()) |
| | | // 上报时,默认上报数量是订单数量 |
| | | .setPick_qty(detl.getQty().intValue()) |
| | | // 上报时,默认损坏数量是0 |
| | | .setDamage_qty(0) |
| | | // 上报时,默认差异数量是0 |
| | | .setDiff_qty(0); |
| | | |
| | | .setPick_qty(detl.getQty().intValue()); |
| | | reportOrderParams.add(itemParam); |
| | | }); |
| | | |
| | | orderParam.setDetails(reportOrderParams); |
| | | if (orderParam.getTarget_location().equals("2")) { |
| | | orderParam.setType("11"); |
| | | } else if (orderParam.getTarget_location().equals("3")) { |
| | | orderParam.setType("12"); |
| | | } else { |
| | | orderParam.setType("13"); |
| | | } |
| | | orderParam.setPartList(reportOrderParams); |
| | | |
| | | XSR response = null; |
| | | boolean success = false; |
| | | try { |
| | | // List<ReportOrderParam> orderParams = new ArrayList<>(); |
| | | // orderParams.add(orderParam); |
| | | // if (order.getReportOnce() < 4) { |
| | | // response = kopenApiService.getOutDetailsResult(orderParams, order); |
| | | // } else { |
| | | // return FAIL; |
| | | // } |
| | | // response = new HttpHandler.Builder() |
| | | // .setUri(MesConstant.URL) |
| | | // .setPath(MesConstant.PAKOUT_URL) |
| | | // .setJson(JSON.toJSONString(pakoutParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | if (true) { |
| | | List<ReportOrderParam> orderParams = new ArrayList<>(); |
| | | orderParams.add(orderParam); |
| | | if (order.getReportOnce() < 4) { |
| | | response = kopenApiService.reportOutDetailsResult(orderParams, order); |
| | | } else { |
| | | return FAIL; |
| | | } |
| | | if (response.getSuccess()) { |
| | | success = true; |
| | | // 修改订单状态 4.完成 ===>> 6.已上报 |
| | | if (!orderService.updateSettle(order.getId(), settle, null)) { |
| | |
| | | } |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", |
| | | MesConstant.URL + MesConstant.OUT_DISPATCH_RESULT, |
| | | JSON.toJSONString(orderParam), JSON.toJSONString(response)); |
| | | MesConstant.URL + MesConstant.OUT_DETAILS_RESULT, |
| | | JSON.toJSONString(orderParams), JSON.toJSONString(response)); |
| | | throw new CoolException("上报KOPEN系统失败"); |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | if (Objects.isNull(material)) { |
| | | throw new CoolException("物料不存在"); |
| | | } |
| | | |
| | | TaskDetlLog detlLog = taskDetlLogService.selectOne(new EntityWrapper<TaskDetlLog>() |
| | | .eq("matnr", detl.getMatnr()) |
| | | .eq("supp_code", detl.getStandby1()) |
| | | .eq("order_no", detl.getOrderNo())); |
| | | if (Objects.isNull(detlLog)) { |
| | | throw new CoolException("数据错误 ,请检查AGV任务档是否已完成!!"); |
| | | } |
| | | OrderItemsParam itemParam = new OrderItemsParam(); |
| | | // 上报时,默认产品类型是null |
| | | itemParam.setPro_type(material.getProType()); |
| | |
| | | // 上报时,默认产品id是供应商编码 |
| | | itemParam.setPro_id(detl.getSuppCode()); |
| | | //todo 台车编码 |
| | | itemParam.setTruck_no("TC310080014"); |
| | | itemParam.setTruck_no(detlLog.getZpallet()); |
| | | // 上报时,默认上报时间是更新时间 |
| | | itemParam.setPick_qty(detl.getQty().intValue()); |
| | | |
| | | reportOrderParams.add(itemParam); |
| | | }); |
| | | pubOrderParams.setPartList(reportOrderParams); |
| | |
| | | |
| | | /** |
| | | * 损溢单完结上报 |
| | | * |
| | | * |
| | | * @param order |
| | | * @return |
| | | */ |
| | |
| | | adjustParam.setCompany_id(order.getCstmrName()) |
| | | .setWms_id(order.getId() + "") |
| | | .setType(0 + "") |
| | | .setUpdate_time(order.getUpdateTime$()) |
| | | .setKopen_id(order.getDefNumber()); |
| | | .setUpdate_time(order.getUpdateTime$()); |
| | | // .setKopen_id(order.getDefNumber()); |
| | | |
| | | adjustParam.setBsby_no(order.getOrderNo()) |
| | | .setReason("") |
| | |
| | | |
| | | adjustParams.add(adjustParam); |
| | | |
| | | XSR response = kopenApiService.reportCheckOrder(adjustParams, order); |
| | | if (order.getReportOnce() < 3) { |
| | | XSR response = kopenApiService.reportCheckOrder(adjustParams, order); |
| | | if (response.getSuccess()) { |
| | | return SUCCESS; |
| | | } else { |
| | | return FAIL; |
| | | } |
| | | } |
| | | |
| | | return SUCCESS; |
| | | // TODO Auto-generated method stub |