From a6db6a4c4122985d43906b8e9d59f0c4854a5759 Mon Sep 17 00:00:00 2001
From: 16358 <1635849544@qq.com>
Date: Tue, 1 Jul 2025 15:29:47 +0800
Subject: [PATCH] =?UTF-8?q?=E6=98=9F=E7=A9=BA=E5=AF=B9=E6=8E=A5=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3=E5=BC=80=E5=8F=91:=E5=AF=B9=E5=90=8C=E6=AD=A5?=
=?UTF-8?q?=E6=98=9F=E7=A9=BA=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E4=B8=BB?=
=?UTF-8?q?=E6=A6=9C=E5=8D=95=E7=94=9F=E6=88=90=E7=AE=80=E5=8D=95=E7=94=9F?=
=?UTF-8?q?=E4=BA=A7=E5=85=A5=E5=BA=93=E8=A1=A8=E5=A4=B4=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/ruoyi/bill/domain/Poundmst.java | 11 +++++
.../java/com/ruoyi/webApi/ApiPostBack.java | 44 +++++++++++++++++++
.../requestbody/model/SPModel.java | 17 +++++++
.../measurement/bill/PoundmstMapper.xml | 7 ++-
4 files changed, 78 insertions(+), 1 deletion(-)
diff --git a/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java b/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java
index d0b2a7d..92423d2 100644
--- a/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java
+++ b/measurement/src/main/java/com/ruoyi/bill/domain/Poundmst.java
@@ -211,6 +211,9 @@ public class Poundmst extends BaseEntity
@Excel(name = "生产车间编号")
private String sccjNum;
+ //和钢、喀钢组织编码
+ private String oaOrgNumber;
+
//直供商id
private String zgsId;
@@ -225,6 +228,14 @@ public class Poundmst extends BaseEntity
this.zgsId = zgsId;
}
+ public String getOaOrgNumber() {
+ return oaOrgNumber;
+ }
+
+ public void setOaOrgNumber(String oaOrgNumber) {
+ this.oaOrgNumber = oaOrgNumber;
+ }
+
public String getZgsName() {
return zgsName;
}
diff --git a/measurement/src/main/java/com/ruoyi/webApi/ApiPostBack.java b/measurement/src/main/java/com/ruoyi/webApi/ApiPostBack.java
index bfca003..c488cfc 100644
--- a/measurement/src/main/java/com/ruoyi/webApi/ApiPostBack.java
+++ b/measurement/src/main/java/com/ruoyi/webApi/ApiPostBack.java
@@ -6,7 +6,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.bill.domain.PoundBill;
import com.ruoyi.bill.domain.Poundappli;
+import com.ruoyi.bill.domain.Poundmst;
import com.ruoyi.bill.service.IPoundBillService;
+import com.ruoyi.bill.service.IPoundmstService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.webApi.saveRequestBody.billHandlerUtil.BillHandler;
import com.ruoyi.webApi.saveRequestBody.billHandlerUtil.BillHandlers;
@@ -14,6 +16,8 @@ import com.ruoyi.webApi.pushRequestBody.billHandlerUtil.PushBillHandler;
import com.ruoyi.webApi.pushRequestBody.billHandlerUtil.PushBillHandlers;
import com.ruoyi.webApi.pushRequestBody.requestbody.DynamicFormPushRequest;
import com.ruoyi.webApi.saveRequestBody.requestbody.DynamicFormRequest;
+import com.ruoyi.webApi.saveRequestBody.requestbody.RequestData;
+import com.ruoyi.webApi.saveRequestBody.requestbody.model.SPModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -28,6 +32,7 @@ import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.util.Arrays;
import java.util.Date;
import java.util.UUID;
@@ -47,6 +52,9 @@ public class ApiPostBack {
@Autowired
private IPoundBillService poundBillService;
+ @Autowired
+ private IPoundmstService poundmstService;
+
private static final ObjectMapper objectMapper = new ObjectMapper();
//单据保存(更新)
@@ -105,6 +113,42 @@ public class ApiPostBack {
poundBillService.updateById(poundBill);
}
+ //单据保存(更新):特殊逻辑 主榜单->简单生产入库单表头
+ public void makePoundmstFormData(String id) throws IOException {
+ Poundmst poundmst = poundmstService.selectPoundmstById(id);
+ if (poundmst == null) throw new RuntimeException("主磅单不存在!");
+
+ String url = sysConfigService.selectConfigByKey("OA_Url") +
+ "/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
+
+ //构建请求体
+ DynamicFormRequest request = new DynamicFormRequest("SP_InStock");
+ RequestData data = new RequestData();
+ data.setNeedReturnFields(Arrays.asList("FID"));
+ SPModel model = new SPModel(poundmst);
+ data.setModel(model);
+ request.setData(data);
+ String jsonInputString;
+ try {
+ jsonInputString = objectMapper.writeValueAsString(request);
+ } catch (JsonProcessingException e) {
+ throw new RuntimeException("JSON序列化失败:" + e.getMessage());
+ }
+
+ String resultJSON = sendPostRequest(url, jsonInputString);
+ JSONObject jsonObject = JSONObject.parseObject(resultJSON);
+ // 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
+ JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
+ String fid = "0";
+ for (int i = 0; i < needReturnDataArray.size(); i++) {
+ JSONObject needReturnDataItem = needReturnDataArray.getJSONObject(i);
+ // 取得 FID
+ fid = needReturnDataItem.getString("FID");
+ }
+ poundmst.setFid(fid);
+ poundmstService.updateById(poundmst);
+ }
+
//单据下推
public void pushPoundBillFormData(String id) throws IOException {
PoundBill poundBill = poundBillService.selectPoundBillById(id);
diff --git a/measurement/src/main/java/com/ruoyi/webApi/saveRequestBody/requestbody/model/SPModel.java b/measurement/src/main/java/com/ruoyi/webApi/saveRequestBody/requestbody/model/SPModel.java
index e4c0d19..fa5c8c0 100644
--- a/measurement/src/main/java/com/ruoyi/webApi/saveRequestBody/requestbody/model/SPModel.java
+++ b/measurement/src/main/java/com/ruoyi/webApi/saveRequestBody/requestbody/model/SPModel.java
@@ -1,6 +1,7 @@
package com.ruoyi.webApi.saveRequestBody.requestbody.model;
import com.ruoyi.bill.domain.PoundBill;
+import com.ruoyi.bill.domain.Poundmst;
import com.ruoyi.webApi.saveRequestBody.requestbody.FNumberRef;
import com.ruoyi.webApi.saveRequestBody.requestbody.Ref;
import com.ruoyi.webApi.saveRequestBody.requestbody.entity.SPEntity;
@@ -70,6 +71,22 @@ public class SPModel extends RequestModel {
};
}
+ public SPModel(Poundmst bill) {
+ setFID(bill.getFid());
+ this.FBillType = new Ref<>(new FNumberRef("JDSCRK01_SYS"));
+ this.FDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+ this.FStockOrgId = new Ref<>(new FNumberRef(bill.getOaOrgNumber()));
+ this.FPrdOrgId = new Ref<>(new FNumberRef(bill.getOaOrgNumber()));
+ this.FCurrId = new Ref<>(new FNumberRef("PRE001"));
+ this.FOwnerTypeId0 = "BD_OwnerOrg";
+ this.FOwnerId0 = new Ref<>(new FNumberRef(bill.getOaOrgNumber()));
+ this.F_YWBD = bill.getPoundid();
+ this.F_SJYWBD = bill.getPoundid();
+ this.F_ZGS = bill.getZgsId();
+ this.F_FHDW = bill.getSendunitid();
+ this.F_SHDW = bill.getRecunitid();
+ }
+
public SPEntity[] getFEntity() {
return FEntity;
}
diff --git a/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml b/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml
index c2ae064..71ee445 100644
--- a/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml
+++ b/measurement/src/main/resources/mapper/measurement/bill/PoundmstMapper.xml
@@ -51,13 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
- select id, usrcode, srcbllknd, srcbllid, bsndt, bsnid, bllstt, itmno, itmcode, itmname, specification, msrunit, trnunitid, trnunitname, bsunitid, bsunitname, sendunitid, sendunitname, recunitid, recunitname, poundid, poundname, boilerno, steeno, unitlen, carnosum, carmqtysum, qty, resQty, indexid, steeltype, linetype, lzno, bbno, crtorgid, isinuse, crtdt, crtopr, lstedtdt, lstedtopr, remark, zgsId, zgsName, fid, fentity_fentryid, oabilltype, cangKuName, cangKuNumber, sccjNum from t_data_poundmst
+ select id, usrcode, srcbllknd, srcbllid, bsndt, bsnid, bllstt, itmno, itmcode, itmname, specification, msrunit, trnunitid, trnunitname, bsunitid, bsunitname, sendunitid, sendunitname, recunitid, recunitname, poundid, poundname, boilerno, steeno, unitlen, carnosum, carmqtysum, qty, resQty, indexid, steeltype, linetype, lzno, bbno, crtorgid, isinuse, crtdt, crtopr, lstedtdt, lstedtopr, remark, zgsId, zgsName, fid, fentity_fentryid, oabilltype, oaOrgNumber, cangKuName, cangKuNumber, sccjNum from t_data_poundmst