自动化立体仓库 - WMS系统
zhangchao
2024-10-22 e6bc9cbe21ed6f9de5c5701ab121aca94b2ba194
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -49,8 +49,8 @@
    @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())) {
@@ -82,6 +82,38 @@
        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$());
@@ -102,7 +134,7 @@
            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("");
@@ -122,12 +154,7 @@
        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"))) {
@@ -146,15 +173,7 @@
            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);
        }
    }