| | |
| | | @TableField("process_sts") |
| | | private Integer processSts; |
| | | |
| | | @TableField("report_qty") |
| | | private Double reportQty; |
| | | |
| | | public OrderDetl() {} |
| | | |
| | | public OrderDetl(Long orderId, String orderNo, Double anfme, Double qty, String matnr, String maktx, String batch, String specs, String model, String color, String brand, String unit, Double price, String sku, Double units, String barcode, String origin, String manu, String manuDate, String itemNum, Double safeQty, Double weight, Double length, Double volume, String threeCode, String supp, String suppCode, Integer beBatch, String deadTime, Integer deadWarn, Integer source, Integer inspect, Integer danger, Integer status, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo,Integer processSts) { |
| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.AgvLocDetl; |
| | | import com.zy.asrs.entity.Order; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.AgvLocDetlService; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | //@Async("orderThreadPool") |
| | | public void reportOrder() { |
| | | List<Order> orderList = orderService.selectList(new EntityWrapper<Order>().eq("settle", 2)); |
| | | orderList.forEach(order -> { |
| | | if (order.getSettle() < 4L) { |
| | | return; |
| | | } |
| | | orderSyncHandler.timelyStart(order); |
| | | }); |
| | | orderList = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4)); |
| | | orderList.forEach(order -> { |
| | | orderSyncHandler.timelyStart(order); |
| | | }); |
| | | } |
| | | |
| | | |
| | | /* |
| | | 定时查询状态为2.作业中的单据,检查是否完成 |
| | | */ |
| | |
| | | public void completeOrder() { |
| | | List<Order> orderList = orderService.selectList(new EntityWrapper<Order>().eq("settle", 2)); |
| | | orderList.forEach(order -> { |
| | | orderService.checkComplete(order.getOrderNo(),null); |
| | | orderService.checkComplete(order.getOrderNo(), null); |
| | | }); |
| | | } |
| | | |
| | |
| | | |
| | | @Transactional |
| | | public ReturnT<String> start(Order order) { |
| | | |
| | | List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单", "银座委外材料出库单", "银座委外入库单", "银座生产材料出库单")); |
| | | //List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单", "银座委外材料出库单", "银座委外入库单", "银座生产材料出库单")); |
| | | List<String> docNames = new ArrayList<>(Arrays.asList("银座委外入库单", "银座生产材料出库单")); |
| | | |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (!docNames.contains(docType.getDocName())) { |
| | |
| | | return SUCCESS; |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public void timelyStart(Order order) { |
| | | |
| | | List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单", "银座委外材料出库单")); |
| | | |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (docNames.contains(docType.getDocName())) { |
| | | List<OrderDetl> orderDetlList = orderDetlService.selectByOrderId(order.getId()); |
| | | List<OrderDetl> report = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetlList) { |
| | | if (orderDetl.getQty() > 0 && orderDetl.getQty() > (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty())) { |
| | | report.add(orderDetl); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(report)) { |
| | | ReportErpParam param = new ReportErpParam(); |
| | | mappingParam(order, param); |
| | | mappingParamChildren(report, param); |
| | | |
| | | int code = doHttpRequest(param, "单据审核", url, orderReportPath, null, "127.0.0.1"); |
| | | if (code == 0) { |
| | | for (OrderDetl orderDetl : orderDetlList) { |
| | | orderDetl.setReportQty(orderDetl.getQty() - orderDetl.getReportQty()); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | public void mappingParam(Order order, ReportErpParam param) { |
| | | param.set操作系统号(order.getDefNumber()); |
| | | param.set操作单据(order.getDocType$()); |
| | |
| | | ReportErpParam.ChildInfo childInfo = new ReportErpParam.ChildInfo(); |
| | | childInfo.setIrowno(orderDetl.getItemNum()); |
| | | childInfo.setCInvCode(orderDetl.getMatnr()); |
| | | childInfo.setIQuantity(orderDetl.getQty() + ""); |
| | | childInfo.setIQuantity(orderDetl.getQty() - (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty()) + ""); |
| | | childInfo.setCBatch(orderDetl.getBatch()); |
| | | childInfo.setINum(orderDetl.getLength() + ""); |
| | | childInfo.setIinvexchrate(""); |
| | |
| | | boolean success = false; |
| | | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(url) |
| | | .setPath(path) |
| | | .setJson(JSONObject.toJSONString(requestParam)) |
| | | .build() |
| | | .doPost(); |
| | | response = new HttpHandler.Builder().setUri(url).setPath(path).setJson(JSONObject.toJSONString(requestParam)).build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | |
| | | if (Cools.isEmpty(jsonObject.get("succeed"))) { |
| | |
| | | log.error(e.getMessage()); |
| | | throw new CoolException("调用接口响应错误"); |
| | | } finally { |
| | | apiLogService.save( |
| | | namespace, |
| | | url + path, |
| | | appkey, |
| | | ip, |
| | | JSON.toJSONString(JSONObject.toJSONString(requestParam)), |
| | | response, |
| | | success |
| | | ); |
| | | apiLogService.save(namespace, url + path, appkey, ip, JSON.toJSONString(JSONObject.toJSONString(requestParam)), response, success); |
| | | } |
| | | |
| | | } |