星空对接接口开发:修改生成简单生产入库单逻辑
This commit is contained in:
parent
a03f5e90e0
commit
ef050a3de7
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.ruoyi.bill.domain.Poundmst;
|
import com.ruoyi.bill.domain.Poundmst;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主榜单信息Mapper接口
|
* 主榜单信息Mapper接口
|
||||||
|
|
@ -60,4 +61,13 @@ public interface PoundmstMapper extends BaseMapper<Poundmst>
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deletePoundmstByIds(String[] ids);
|
public int deletePoundmstByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id更新fid 字段
|
||||||
|
*
|
||||||
|
* @param id 目标对象id
|
||||||
|
*@param fid 对象fid字段值
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateFidById(@Param("id")String id,@Param("fid")String fid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,15 @@ public interface IPoundmstService extends IService<Poundmst>
|
||||||
*/
|
*/
|
||||||
public int deletePoundmstByIds(String[] ids);
|
public int deletePoundmstByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id更新fid 字段
|
||||||
|
*
|
||||||
|
* @param id 目标对象id
|
||||||
|
*@param fid 对象fid字段值
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateFidById(String id, String fid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除主榜单信息信息
|
* 删除主榜单信息信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ruoyi.bill.service.impl;
|
package com.ruoyi.bill.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.bill.mapper.PoundmstMapper;
|
import com.ruoyi.bill.mapper.PoundmstMapper;
|
||||||
|
|
@ -104,6 +106,17 @@ public class PoundmstServiceImpl extends ServiceImpl<PoundmstMapper, Poundmst> i
|
||||||
return poundmstMapper.deletePoundmstByIds(ids);
|
return poundmstMapper.deletePoundmstByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id更新fid 字段
|
||||||
|
*
|
||||||
|
* @param id 目标对象id
|
||||||
|
*@param fid 对象fid字段值
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateFidById(String id, String fid){
|
||||||
|
return poundmstMapper.updateFidById(id,fid);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除主榜单信息信息
|
* 删除主榜单信息信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -113,10 +114,12 @@ public class ApiPostBack {
|
||||||
poundBillService.updateById(poundBill);
|
poundBillService.updateById(poundBill);
|
||||||
}
|
}
|
||||||
|
|
||||||
//单据保存(更新):特殊逻辑 主榜单->简单生产入库单表头
|
//单据保存(更新):特殊逻辑 : 主榜单 -> 一组关联的磅单信息 -> 简单生产入库单
|
||||||
public void makePoundmstFormData(String id) throws IOException {
|
public void makePoundmstFormData(String id) throws IOException {
|
||||||
Poundmst poundmst = poundmstService.selectPoundmstById(id);
|
PoundBill poundBill = new PoundBill();
|
||||||
if (poundmst == null) throw new RuntimeException("主磅单不存在!");
|
poundBill.setAppliid(id);
|
||||||
|
List<PoundBill> poundBills = poundBillService.selectPoundBillList(poundBill);
|
||||||
|
if (poundBills.size() == 0) throw new RuntimeException("根据主磅单未找到磅单信息!");
|
||||||
|
|
||||||
String url = sysConfigService.selectConfigByKey("OA_Url") +
|
String url = sysConfigService.selectConfigByKey("OA_Url") +
|
||||||
"/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
"/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
||||||
|
|
@ -125,7 +128,7 @@ public class ApiPostBack {
|
||||||
DynamicFormRequest request = new DynamicFormRequest("SP_InStock");
|
DynamicFormRequest request = new DynamicFormRequest("SP_InStock");
|
||||||
RequestData data = new RequestData();
|
RequestData data = new RequestData();
|
||||||
data.setNeedReturnFields(Arrays.asList("FID"));
|
data.setNeedReturnFields(Arrays.asList("FID"));
|
||||||
SPModel model = new SPModel(poundmst);
|
SPModel model = new SPModel(poundBills);
|
||||||
data.setModel(model);
|
data.setModel(model);
|
||||||
request.setData(data);
|
request.setData(data);
|
||||||
String jsonInputString;
|
String jsonInputString;
|
||||||
|
|
@ -140,13 +143,35 @@ public class ApiPostBack {
|
||||||
// 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
|
// 获取 Result.NeedReturnData 数组,更新fid ,fentryid的值
|
||||||
JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
|
JSONArray needReturnDataArray = jsonObject.getJSONObject("Result").getJSONArray("NeedReturnData");
|
||||||
String fid = "0";
|
String fid = "0";
|
||||||
|
String fEntryID = "0";
|
||||||
for (int i = 0; i < needReturnDataArray.size(); i++) {
|
for (int i = 0; i < needReturnDataArray.size(); i++) {
|
||||||
JSONObject needReturnDataItem = needReturnDataArray.getJSONObject(i);
|
JSONObject needReturnDataItem = needReturnDataArray.getJSONObject(i);
|
||||||
// 取得 FID
|
// 取得 FID
|
||||||
fid = needReturnDataItem.getString("FID");
|
fid = needReturnDataItem.getString("FID");
|
||||||
|
//更新poundmst单据
|
||||||
|
poundmstService.updateFidById(id,fid);
|
||||||
|
// 取得 FEntity 数组
|
||||||
|
JSONArray fEntityArray = needReturnDataItem.getJSONArray("FEntity");
|
||||||
|
if (fEntityArray == null || fEntityArray.isEmpty()) {
|
||||||
|
fEntityArray = needReturnDataItem.getJSONArray("FBillEntry");
|
||||||
}
|
}
|
||||||
poundmst.setFid(fid);
|
if (fEntityArray == null || fEntityArray.isEmpty()) {
|
||||||
poundmstService.updateById(poundmst);
|
fEntityArray = needReturnDataItem.getJSONArray("FDetailEntity");
|
||||||
|
}
|
||||||
|
// 如果找到有效的数组,循环赋值 FID FEntryID
|
||||||
|
if (fEntityArray != null && !fEntityArray.isEmpty()) {
|
||||||
|
for (int index = 0; index < fEntityArray.size(); index++) {
|
||||||
|
JSONObject fEntityItem = fEntityArray.getJSONObject(index);
|
||||||
|
fEntryID = fEntityItem.getString("FEntryID");
|
||||||
|
PoundBill demoPoundMst = poundBills.get(index);
|
||||||
|
demoPoundMst.setFentity_fentryid(fEntryID);
|
||||||
|
demoPoundMst.setFid(fid);
|
||||||
|
poundBillService.updateById(demoPoundMst);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//单据下推
|
//单据下推
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.ruoyi.webApi.saveRequestBody.requestbody.RequestModel;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 16358
|
* @author 16358
|
||||||
|
|
@ -71,6 +72,53 @@ public class SPModel extends RequestModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SPModel(List<PoundBill> bills) {
|
||||||
|
if (bills.isEmpty()) return;
|
||||||
|
|
||||||
|
PoundBill bill = bills.get(0);
|
||||||
|
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();
|
||||||
|
|
||||||
|
// 动态生成 FEntity 数组
|
||||||
|
this.FEntity = new SPEntity[bills.size()];
|
||||||
|
for (int i = 0; i < bills.size(); i++) {
|
||||||
|
PoundBill currentBill = bills.get(i);
|
||||||
|
this.FEntity[i] = new SPEntity() {{
|
||||||
|
setFEntryID(currentBill.getFentity_fentryid());
|
||||||
|
setFMaterialId(new Ref<>(new FNumberRef(currentBill.getItmcode())));
|
||||||
|
setFInStockType("1");
|
||||||
|
setFMustQty(currentBill.getNetmqty());
|
||||||
|
setFRealQty(currentBill.getNetmqty());
|
||||||
|
setFStockId(new Ref<>(new FNumberRef("")));
|
||||||
|
setFWorkShopId1(new Ref<>(new FNumberRef("")));
|
||||||
|
setFShiftGroupId(new Ref<>(new FNumberRef("")));
|
||||||
|
setFOwnerTypeId("BD_OwnerOrg");
|
||||||
|
setFOwnerId(new Ref<>(new FNumberRef(currentBill.getOaOrgNumber())));
|
||||||
|
setF_CZ(0L);
|
||||||
|
setFMemo(currentBill.getRemark());
|
||||||
|
setF_LC(currentBill.getBoilerno());
|
||||||
|
setF_GH(currentBill.getCarno());
|
||||||
|
setF_GANGH(currentBill.getSteeno());
|
||||||
|
setF_ZKS(0L);
|
||||||
|
setF_KH(currentBill.getBundleNo());
|
||||||
|
setF_PJZL(0L);
|
||||||
|
setF_XCLX(currentBill.getLinetype());
|
||||||
|
setF_PH(currentBill.getBatno());
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SPModel(Poundmst bill) {
|
public SPModel(Poundmst bill) {
|
||||||
setFID(bill.getFid());
|
setFID(bill.getFid());
|
||||||
this.FBillType = new Ref<>(new FNumberRef("JDSCRK01_SYS"));
|
this.FBillType = new Ref<>(new FNumberRef("JDSCRK01_SYS"));
|
||||||
|
|
|
||||||
|
|
@ -304,4 +304,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateFidById" parameterType="String">
|
||||||
|
update t_data_poundmst
|
||||||
|
set fid = #{fid}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue