#
luxiaotao1123
2021-08-09 745149fd4efc319d06538ef74887500bc26db28a
src/main/java/zy/cloud/wms/common/service/erp/ErpScheduler.java
@@ -35,7 +35,7 @@
@RestController
public class ErpScheduler {
    public static final String URI = "http://8.133.182.21:6220/api";
    public static final String URI = "http://123.60.34.127:6220/api";
    public static final String GET_ORDERS = "cM/basis/getOrders";
    public static final String GET_BASIS = "cM/basis/getBasis";
    public static final String UPLOAD_BILL = "cM/basis/uploadBill";
@@ -63,6 +63,8 @@
    private PakoutService pakoutService;
    @Autowired
    private NodeService nodeService;
    @Autowired
    private DocLogService docLogService;
    /**
     * 商品下载
@@ -215,7 +217,7 @@
    /**
     * 商品下载
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    @Scheduled(cron = "0 */2 * * * ? ")
    public void updateMatExecute(){
        try {
            Map<String, Object> param = new HashMap<>();
@@ -423,7 +425,7 @@
    /**
     * 持久化销售订单
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    @Scheduled(cron = "0 */1 * * * ?")
    @Transactional
//    @PostConstruct
    public void getOrdersExecute(){
@@ -544,6 +546,7 @@
//    @PostConstruct
    public void finishOrdersExecute(){
        try {
            Date now = new Date();
            List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4).isNotNull("number"));
            if (!Cools.isEmpty(orders)) {
                List<String> orderNos = orders.stream().map(Order::getOrderNo).distinct().collect(Collectors.toList());
@@ -552,6 +555,8 @@
                    List<GetOrderResultDetl0> list = new ArrayList<>();
                    getOrderResult0.setDetail(list);
                    // 日志
                    List<DocLog> docLogs = new ArrayList<>();
                    // 头
                    getOrderResult0.setNumber(order.getOrderNo());
@@ -573,6 +578,18 @@
                        detl0.setUnit(orderDetl.getUnit());
                        detl0.setRowNo(Integer.parseInt(orderDetl.getName()));
                        list.add(detl0);
                        // 日志
                        docLogs.add(new DocLog(
                                order.getOrderNo(),    // 单据编号
                                11L,    // 单据类型
                                "销售订单",    // 单据名称
                                orderDetl.getMatnr(),    // 商品编号
                                orderDetl.getCount(),    // 上报数量
                                1,    // 结果
                                now,    // 上报时间
                                null    // 备注
                        ));
                    }
                    log.warn(JSON.toJSONString(getOrderResult0));
@@ -583,6 +600,13 @@
                            .setJson(JSON.toJSONString(getOrderResult0))
                            .build()
                            .doPost();
                    try {
                        docLogService.insertBatch(docLogs);
                    } catch (Exception e) {
                        log.error(e.getMessage());
                    }
                    if (!Cools.isEmpty(response)) {
                        log.warn(response);
                        Result result = JSON.parseObject(response, Result.class);
@@ -621,6 +645,7 @@
//    @PostConstruct
    public void finishOrders0Execute(){
        try {
            Date now = new Date();
            List<Order> orders = orderService.selectList(new EntityWrapper<Order>().eq("settle", 4).eq("doc_type", 6));
            if (!Cools.isEmpty(orders)) {
                List<String> orderNos = orders.stream().map(Order::getOrderNo).distinct().collect(Collectors.toList());
@@ -629,6 +654,8 @@
                    List<GetOrderResultDetl0> list = new ArrayList<>();
                    getOrderResult0.setDetail(list);
                    // 日志
                    List<DocLog> docLogs = new ArrayList<>();
                    // 头
                    getOrderResult0.setNumber(order.getOrderNo());
@@ -651,10 +678,21 @@
                        detl0.setUnit(orderDetl.getUnit());
                        detl0.setComment(orderDetl.getMemo());
                        list.add(detl0);
                        // 日志
                        docLogs.add(new DocLog(
                                order.getOrderNo(),    // 单据编号
                                6L,    // 单据类型
                                "采购退货订单",    // 单据名称
                                orderDetl.getMatnr(),    // 商品编号
                                orderDetl.getCount(),    // 上报数量
                                1,    // 结果
                                now,    // 上报时间
                                null    // 备注
                        ));
                    }
                    System.out.println(JSON.toJSONString(getOrderResult0));
                    String response = new HttpHandler.Builder()
                            .setUri(URI)
@@ -662,6 +700,13 @@
                            .setJson(JSON.toJSONString(getOrderResult0))
                            .build()
                            .doPost();
                    try {
                        docLogService.insertBatch(docLogs);
                    } catch (Exception e) {
                        log.error(e.getMessage());
                    }
                    if (!Cools.isEmpty(response)) {
                        log.warn(response);
                        Result result = JSON.parseObject(response, Result.class);