星空对接接口开发:对同步星空接口添加主榜单生成简单生产入库表头逻辑
This commit is contained in:
parent
c76854cb9f
commit
a6db6a4c41
|
@ -211,6 +211,9 @@ public class Poundmst extends BaseEntity
|
||||||
@Excel(name = "生产车间编号")
|
@Excel(name = "生产车间编号")
|
||||||
private String sccjNum;
|
private String sccjNum;
|
||||||
|
|
||||||
|
//和钢、喀钢组织编码
|
||||||
|
private String oaOrgNumber;
|
||||||
|
|
||||||
//直供商id
|
//直供商id
|
||||||
private String zgsId;
|
private String zgsId;
|
||||||
|
|
||||||
|
@ -225,6 +228,14 @@ public class Poundmst extends BaseEntity
|
||||||
this.zgsId = zgsId;
|
this.zgsId = zgsId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOaOrgNumber() {
|
||||||
|
return oaOrgNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOaOrgNumber(String oaOrgNumber) {
|
||||||
|
this.oaOrgNumber = oaOrgNumber;
|
||||||
|
}
|
||||||
|
|
||||||
public String getZgsName() {
|
public String getZgsName() {
|
||||||
return zgsName;
|
return zgsName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.ruoyi.bill.domain.PoundBill;
|
import com.ruoyi.bill.domain.PoundBill;
|
||||||
import com.ruoyi.bill.domain.Poundappli;
|
import com.ruoyi.bill.domain.Poundappli;
|
||||||
|
import com.ruoyi.bill.domain.Poundmst;
|
||||||
import com.ruoyi.bill.service.IPoundBillService;
|
import com.ruoyi.bill.service.IPoundBillService;
|
||||||
|
import com.ruoyi.bill.service.IPoundmstService;
|
||||||
import com.ruoyi.system.service.ISysConfigService;
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
import com.ruoyi.webApi.saveRequestBody.billHandlerUtil.BillHandler;
|
import com.ruoyi.webApi.saveRequestBody.billHandlerUtil.BillHandler;
|
||||||
import com.ruoyi.webApi.saveRequestBody.billHandlerUtil.BillHandlers;
|
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.billHandlerUtil.PushBillHandlers;
|
||||||
import com.ruoyi.webApi.pushRequestBody.requestbody.DynamicFormPushRequest;
|
import com.ruoyi.webApi.pushRequestBody.requestbody.DynamicFormPushRequest;
|
||||||
import com.ruoyi.webApi.saveRequestBody.requestbody.DynamicFormRequest;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -28,6 +32,7 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -47,6 +52,9 @@ public class ApiPostBack {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPoundBillService poundBillService;
|
private IPoundBillService poundBillService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IPoundmstService poundmstService;
|
||||||
|
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
//单据保存(更新)
|
//单据保存(更新)
|
||||||
|
@ -105,6 +113,42 @@ public class ApiPostBack {
|
||||||
poundBillService.updateById(poundBill);
|
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 {
|
public void pushPoundBillFormData(String id) throws IOException {
|
||||||
PoundBill poundBill = poundBillService.selectPoundBillById(id);
|
PoundBill poundBill = poundBillService.selectPoundBillById(id);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.webApi.saveRequestBody.requestbody.model;
|
package com.ruoyi.webApi.saveRequestBody.requestbody.model;
|
||||||
|
|
||||||
import com.ruoyi.bill.domain.PoundBill;
|
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.FNumberRef;
|
||||||
import com.ruoyi.webApi.saveRequestBody.requestbody.Ref;
|
import com.ruoyi.webApi.saveRequestBody.requestbody.Ref;
|
||||||
import com.ruoyi.webApi.saveRequestBody.requestbody.entity.SPEntity;
|
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() {
|
public SPEntity[] getFEntity() {
|
||||||
return FEntity;
|
return FEntity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,13 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="fid" column="fid" />
|
<result property="fid" column="fid" />
|
||||||
<result property="fentity_fentryid" column="fentity_fentryid" />
|
<result property="fentity_fentryid" column="fentity_fentryid" />
|
||||||
<result property="oabilltype" column="oabilltype" />
|
<result property="oabilltype" column="oabilltype" />
|
||||||
|
<result property="oaOrgNumber" column="oaOrgNumber" />
|
||||||
<result property="cangKuName" column="cangKuName" />
|
<result property="cangKuName" column="cangKuName" />
|
||||||
<result property="cangKuNumber" column="cangKuNumber" />
|
<result property="cangKuNumber" column="cangKuNumber" />
|
||||||
<result property="sccjNum" column="sccjNum" />
|
<result property="sccjNum" column="sccjNum" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectPoundmstVo">
|
<sql id="selectPoundmstVo">
|
||||||
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
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPoundmstList" parameterType="Poundmst" resultMap="PoundmstResult">
|
<select id="selectPoundmstList" parameterType="Poundmst" resultMap="PoundmstResult">
|
||||||
|
@ -105,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="fid != null "> and fid = #{fid}</if>
|
<if test="fid != null "> and fid = #{fid}</if>
|
||||||
<if test="fentity_fentryid != null "> and fentity_fentryid = #{fentity_fentryid}</if>
|
<if test="fentity_fentryid != null "> and fentity_fentryid = #{fentity_fentryid}</if>
|
||||||
<if test="oabilltype != null and oabilltype != ''"> and oabilltype = #{oabilltype}</if>
|
<if test="oabilltype != null and oabilltype != ''"> and oabilltype = #{oabilltype}</if>
|
||||||
|
<if test="oaOrgNumber != null and oaOrgNumber != ''"> and oaOrgNumber = #{oaOrgNumber}</if>
|
||||||
<if test="cangKuName != null and cangKuName != ''"> and cangKuName = #{cangKuName}</if>
|
<if test="cangKuName != null and cangKuName != ''"> and cangKuName = #{cangKuName}</if>
|
||||||
<if test="cangKuNumber != null and cangKuNumber != ''"> and cangKuNumber = #{cangKuNumber}</if>
|
<if test="cangKuNumber != null and cangKuNumber != ''"> and cangKuNumber = #{cangKuNumber}</if>
|
||||||
<if test="sccjNum != null and sccjNum != ''"> and sccjNum = #{sccjNum}</if>
|
<if test="sccjNum != null and sccjNum != ''"> and sccjNum = #{sccjNum}</if>
|
||||||
|
@ -165,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="fid != null">fid,</if>
|
<if test="fid != null">fid,</if>
|
||||||
<if test="fentity_fentryid != null">fentity_fentryid,</if>
|
<if test="fentity_fentryid != null">fentity_fentryid,</if>
|
||||||
<if test="oabilltype != null">oabilltype,</if>
|
<if test="oabilltype != null">oabilltype,</if>
|
||||||
|
<if test="oaOrgNumber != null">oaOrgNumber,</if>
|
||||||
<if test="cangKuName != null">cangKuName,</if>
|
<if test="cangKuName != null">cangKuName,</if>
|
||||||
<if test="cangKuNumber != null">cangKuNumber,</if>
|
<if test="cangKuNumber != null">cangKuNumber,</if>
|
||||||
<if test="sccjNum != null">sccjNum,</if>
|
<if test="sccjNum != null">sccjNum,</if>
|
||||||
|
@ -217,6 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="fid != null">#{fid},</if>
|
<if test="fid != null">#{fid},</if>
|
||||||
<if test="fentity_fentryid != null">#{fentity_fentryid},</if>
|
<if test="fentity_fentryid != null">#{fentity_fentryid},</if>
|
||||||
<if test="oabilltype != null">#{oabilltype},</if>
|
<if test="oabilltype != null">#{oabilltype},</if>
|
||||||
|
<if test="oaOrgNumber != null">#{oaOrgNumber},</if>
|
||||||
<if test="cangKuName != null">#{cangKuName},</if>
|
<if test="cangKuName != null">#{cangKuName},</if>
|
||||||
<if test="cangKuNumber != null">#{cangKuNumber},</if>
|
<if test="cangKuNumber != null">#{cangKuNumber},</if>
|
||||||
<if test="sccjNum != null">#{sccjNum},</if>
|
<if test="sccjNum != null">#{sccjNum},</if>
|
||||||
|
@ -277,6 +281,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="fid != null">fid = #{fid},</if>
|
<if test="fid != null">fid = #{fid},</if>
|
||||||
<if test="fentity_fentryid != null">fentity_fentryid = #{fentity_fentryid},</if>
|
<if test="fentity_fentryid != null">fentity_fentryid = #{fentity_fentryid},</if>
|
||||||
<if test="oabilltype != null">oabilltype = #{oabilltype},</if>
|
<if test="oabilltype != null">oabilltype = #{oabilltype},</if>
|
||||||
|
<if test="oaOrgNumber != null">oaOrgNumber = #{oaOrgNumber},</if>
|
||||||
<if test="cangKuName != null">cangKuName = #{cangKuName},</if>
|
<if test="cangKuName != null">cangKuName = #{cangKuName},</if>
|
||||||
<if test="cangKuNumber != null">cangKuNumber = #{cangKuNumber},</if>
|
<if test="cangKuNumber != null">cangKuNumber = #{cangKuNumber},</if>
|
||||||
<if test="sccjNum != null">sccjNum = #{sccjNum},</if>
|
<if test="sccjNum != null">sccjNum = #{sccjNum},</if>
|
||||||
|
|
Loading…
Reference in New Issue