| | |
| | | package com.zy.asrs.task.handler; |
| | | |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import com.alibaba.excel.util.NumberUtils; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.Cools; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/7/7 |
| | |
| | | |
| | | @Value("${spring.profiles.active}") |
| | | private String active; |
| | | |
| | | @Value("${u8.report}") |
| | | private Boolean report; |
| | | |
| | | @Value("${u8.url}") |
| | | private String url; |
| | |
| | | } |
| | | |
| | | @Transactional |
| | | public void timelyStart(Order order) { |
| | | public synchronized void timelyStart(Order order) { |
| | | if (!report) { |
| | | return; |
| | | } |
| | | |
| | | 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())) { |
| | |
| | | if (Cools.isEmpty(order.getPltType())) { |
| | | return; |
| | | } |
| | | if (Cools.isEmpty(order.getInTime())) { |
| | | order.setInTime(DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmsssss_F)); |
| | | } |
| | | if (!Cools.isEmpty(report)) { |
| | | ReportErpParam param = new ReportErpParam(); |
| | | mappingParam(order, param); |
| | |
| | | log.info(JSON.toJSONString(param)); |
| | | int code = doHttpRequest(param, "单据审核", url, orderReportPath, null, "127.0.0.1"); |
| | | if (code == 0) { |
| | | Date date = new Date(); |
| | | order.setInTime(DateUtils.convert(date, DateUtils.yyyyMMddHHmmsssss_F)); |
| | | orderService.updateById(order); |
| | | for (OrderDetl orderDetl : report) { |
| | | log.info("{}单据审核上报了:{}", order.getOrderNo(), orderDetl.getQty() - (orderDetl.getReportQty() == null ? 0D : orderDetl.getReportQty())); |
| | | orderDetl.setReportQty(orderDetl.getQty()); |
| | | orderDetl.setUpdateTime(date); |
| | | orderDetlService.updateById(orderDetl); |
| | | } |
| | | } |
| | |
| | | } |
| | | param.set操作单据(order.getDocType$()); |
| | | param.set操作类型("add"); |
| | | param.setDdate(order.getInTime()); |
| | | param.setDdate(DateUtils.convert(new Date(), DateUtils.yyyyMMdd_F)); |
| | | param.setCWhCode(Cools.isEmpty(order.getPltType()) ? "" : order.getPltType() + ""); |
| | | param.setCDepCode("YZ"); |
| | | param.setCOrderCode(order.getOrderNo()); |
| | | param.setCMaker(""); |
| | | param.setCHandler(""); |
| | | param.setCDefine14(order.getOrderNo() + "_" + DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss + "_" + order.getPltType())); |
| | | param.setCDefine14(order.getOrderNo() + "_" + order.getInTime()); |
| | | //param.setCDefine14(order.getOrderNo() + "_" + order.getInTime() + "_" + order.getPltType())); |
| | | } |
| | | |
| | | public void mappingParamChildren(List<OrderDetl> orderDetlList, ReportErpParam param) { |
| | |
| | | boolean success = false; |
| | | |
| | | try { |
| | | response = new HttpHandler.Builder().setUri(url).setPath(path).setJson(JSONObject.toJSONString(requestParam)).build().doPost(); |
| | | response = new HttpHandler.Builder().setUri(url).setTimeout(30, TimeUnit.SECONDS).setPath(path).setJson(JSONObject.toJSONString(requestParam)).build().doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | |
| | | if (Cools.isEmpty(jsonObject.get("succeed"))) { |