自动化立体仓库 - WMS系统
#
zjj
6 天以前 4b6e6d95ae6fbbccc4351db366b99fa05288877f
src/main/java/com/zy/asrs/task/kingdee/handler/SaveOrderSyncHandler.java
@@ -71,73 +71,29 @@
//        }
        Date now = new Date();
        //条件拼接
        JSONObject jsonObjectFBillTypeID = new JSONObject();
        JSONObject jsonObjectFPickerId = new JSONObject();
        if (kingDeeUtilType.pakIn==1){
            jsonObjectFBillTypeID.put("FNUMBER","TLD01_SYS");
        }else {
            jsonObjectFBillTypeID.put("FNUMBER","TLD01_SYS");
            jsonObjectFPickerId.put("FStaffNumber","X0103_GLGW074_1");
        }
        JSONObject jsonObject=new JSONObject();
        jsonObject.put("FormId",kingDeeUtilType.correspondingFormId);
        JSONObject jsonObjectFStockOrgId = new JSONObject();
        jsonObjectFStockOrgId.put("FNUMBER","100");
        JSONObject model=new JSONObject();
        model.put("fid",order.getPostFeeType());
        JSONObject jsonObjectFOwnerIdHead = new JSONObject();
        jsonObjectFOwnerIdHead.put("FNUMBER","100");
        JSONObject jsonObjectFDEPTID = new JSONObject();
        jsonObjectFDEPTID.put("FNUMBER","CX");
        List<JSONObject> jsonObjects = new ArrayList<>();
        for (OrderDetl orderDetl:orderDetls){
            JSONObject jsonObjectFMATERIALID = new JSONObject();
            jsonObjectFMATERIALID.put("FNUMBER",orderDetl.getMatnr());
            JSONObject jsonObjectFSTOCKID = new JSONObject();
            jsonObjectFSTOCKID.put("FNUMBER","CK001");
            JSONObject jsonObjectFLOT = new JSONObject();
            jsonObjectFLOT.put("FNUMBER",orderDetl.getBatch());
            // 使用LinkedHashMap来保持插入顺序
            Map<String, Object> orderedMap = new LinkedHashMap<>();
            // 按照期望的顺序添加键值对
            orderedMap.put("FMATERIALID", jsonObjectFMATERIALID);
            orderedMap.put("FSTOCKID", jsonObjectFSTOCKID);
            orderedMap.put("FLOT", jsonObjectFLOT);
        JSONArray fEntitys = new JSONArray();
        for (OrderDetl orderDetl : orderDetls) {
            JSONObject fEntity = new JSONObject();
            fEntity.put("FEntryID",orderDetl.getBeBatch());
            //完成数量-已上报数量
            if(orderDetl.getQty().equals(0.0)){
                orderedMap.put("FQty", orderDetl.getQty());
                fEntity.put(kingDeeUtilType.anfme, orderDetl.getQty());
            }else{
                orderedMap.put("FQty", orderDetl.getQty()-orderDetl.getPrice());    // 将"FQty"放到最后
                fEntity.put(kingDeeUtilType.anfme, orderDetl.getQty()-orderDetl.getPrice());    // 将"FQty"放到最后
            }
            JSONObject jsonObjectEnd = new JSONObject(orderedMap);
            jsonObjects.add(jsonObjectEnd);
            fEntitys.add(fEntity);
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("FBillTypeID",jsonObjectFBillTypeID);
        if (kingDeeUtilType.pakIn==0){
            jsonObject.put("FPickerId",jsonObjectFPickerId);
        }
        jsonObject.put("FDate",DateUtils.convert(now, DateUtils.yyyyMMdd_F));
        jsonObject.put("FStockOrgId",jsonObjectFStockOrgId);
        jsonObject.put("FOwnerTypeIdHead","BD_OwnerOrg");
        jsonObject.put("FOwnerIdHead",jsonObjectFOwnerIdHead);
        jsonObject.put("FDEPTID",jsonObjectFDEPTID);
        jsonObject.put("FEntity",jsonObjects);
        JSONObject jsonObjectModel = new JSONObject();
        jsonObjectModel.put("Model",jsonObject);
        JSONObject jsonObject1 = new JSONObject();
        jsonObject1.put("data", jsonObjectModel);
        jsonObject1.put("FormId",kingDeeUtilType.correspondingFormId);
        String add = jsonObject1.toJSONString();
        model.put("FEntity",fEntitys);
        JSONObject  data= new JSONObject();
        data.put("Model",model);
        jsonObject.put("data",data);
        String add = jsonObject.toJSONString();
        //上报
        String response = "";
        boolean success = false;
@@ -153,20 +109,19 @@
                    .setHttps(true)
                    .build()
                    .doPost();
            JSONObject data = JSON.parseObject(response);
//            JSONObject data = JSON.parseObject(response);
            Object IsSuccess = findValueByKey(JSON.parseObject(response), "IsSuccess");
            String bool1=IsSuccess.toString();
            boolean bool = false;
            //保存完成原订单1转2 2.保存完成
            //保存完成原订单2转3 3.保存完成
            if(bool1.equals("true")){
                ObjectMapper objectMapper =  new ObjectMapper();
                JsonNode rootNode = objectMapper.readTree(response);
                bool = rootNode.get("Result").get("ResponseStatus").get("IsSuccess").asBoolean();
                log.info("保存bool:"+bool);
                //提交完成原订单1转2  2.上报完成
                //提交完成原订单2转3  3.上报完成
                if(bool){
                    success = true;
                    order.setMemo("2");
                    order.setMemo("3");
                    order.setUpdateTime(new Date());
                    orderService.update(order,new EntityWrapper<Order>().eq("order_no",order.getOrderNo()));
@@ -203,7 +158,7 @@
            try {
                // 保存接口日志
                apiLogService.save(
                        "保存",
                        "3.保存",
                        URL+ outaddressSave,
                        null,
                        "127.0.0.1",