
19 changed files with 720 additions and 39 deletions
@ -0,0 +1,48 @@ |
|||||
|
package com.yxt.anrui.fin.api.kingdee.stkmiscellaneous; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2025/4/29 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class StkMiscellaneous { |
||||
|
|
||||
|
@ApiModelProperty("编号") |
||||
|
private String FBillNo; |
||||
|
@ApiModelProperty("库存组织") |
||||
|
private String FStockOrgId; |
||||
|
@ApiModelProperty("部门") |
||||
|
private String FDEPTID; |
||||
|
@ApiModelProperty("日期") |
||||
|
private String FDate; |
||||
|
@ApiModelProperty("货主") |
||||
|
private String FOwnerIdHead; |
||||
|
@ApiModelProperty("备注") |
||||
|
private String FNOTE; |
||||
|
|
||||
|
public List<StkMiscellaneousEntry> StkMiscellaneousEntry = new ArrayList<>(); |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
public class StkMiscellaneousEntry { |
||||
|
|
||||
|
//物料编码
|
||||
|
private String FMATERIALID; |
||||
|
//单位
|
||||
|
private String FUnitID; |
||||
|
//收货仓库
|
||||
|
private String FSTOCKID; |
||||
|
//货主
|
||||
|
private String FOWNERID; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.yxt.anrui.fin.api.kingdee.stkmisdelivery; |
||||
|
|
||||
|
import com.yxt.anrui.fin.api.kingdee.stkmiscellaneous.StkMiscellaneous; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2025/4/29 |
||||
|
**/ |
||||
|
@Data |
||||
|
public class StkMisDelivery { |
||||
|
|
||||
|
@ApiModelProperty("编号") |
||||
|
private String FBillNo; |
||||
|
@ApiModelProperty("库存组织") |
||||
|
private String FStockOrgId; |
||||
|
@ApiModelProperty("部门") |
||||
|
private String FDEPTID; |
||||
|
@ApiModelProperty("日期") |
||||
|
private String FDate; |
||||
|
@ApiModelProperty("货主") |
||||
|
private String FOwnerIdHead; |
||||
|
@ApiModelProperty("备注") |
||||
|
private String FNOTE; |
||||
|
|
||||
|
public List<StkMisDelivery.StkMisDeliveryEntry> StkMisDeliveryEntry = new ArrayList<>(); |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
public class StkMisDeliveryEntry { |
||||
|
|
||||
|
//物料编码
|
||||
|
private String FMATERIALID; |
||||
|
//单位
|
||||
|
private String FUnitID; |
||||
|
//收货仓库
|
||||
|
private String FSTOCKID; |
||||
|
//货主
|
||||
|
private String FOWNERID; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
package com.yxt.anrui.fin.biz.kingdee.stkmiscellaneous; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.alibaba.fastjson.parser.Feature; |
||||
|
import com.yxt.anrui.fin.biz.kingdee.KingDeeUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2025/4/28 |
||||
|
**/ |
||||
|
public class StkMiscellaneousCastToKingDeeBillFields { |
||||
|
|
||||
|
/** |
||||
|
* 构造金蝶需要的数据结构 并对字段赋值 |
||||
|
* |
||||
|
* @param map_fEntityModel_ |
||||
|
* @param vehicleList |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getKingDeeData(Map<String, String> map_fEntityModel_, List<Map<String, String>> vehicleList) { |
||||
|
/** |
||||
|
* 取模板 |
||||
|
*/ |
||||
|
String readJsonFile = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmiscellaneous/data.json"); |
||||
|
String fEntityData_ = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmiscellaneous/data_data.json"); |
||||
|
String fEntityModel_ = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmiscellaneous/data_model.json"); |
||||
|
|
||||
|
//模板字符创转json
|
||||
|
JSONObject jsonObj = JSONObject.parseObject(readJsonFile, Feature.OrderedField); |
||||
|
JSONObject jsonFEntityData_ = JSONObject.parseObject(fEntityData_, Feature.OrderedField); |
||||
|
fEntityModel_ = KingDeeUtils.replaceTemplateParams(fEntityModel_, map_fEntityModel_); |
||||
|
JSONObject jsonFEntityModel_ = JSONObject.parseObject(fEntityModel_, Feature.OrderedField); |
||||
|
|
||||
|
List<JSONObject> list_fEntity_ = new ArrayList<>(); |
||||
|
|
||||
|
//对模板字段赋值 根据传递进来的map数据的集合进行赋值
|
||||
|
for (int i = 0; i < vehicleList.size(); i++) { |
||||
|
String fEntity_ = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmiscellaneous/data_FEntity.json"); |
||||
|
Map<String, String> params = vehicleList.get(i); |
||||
|
Map<String, String> map_fEntity_ = new HashMap<>(); |
||||
|
for (Map.Entry<String, String> entry : params.entrySet()) { |
||||
|
map_fEntity_.put(entry.getKey(), entry.getValue()); |
||||
|
} |
||||
|
fEntity_ = KingDeeUtils.replaceTemplateParams(fEntity_, map_fEntity_); |
||||
|
list_fEntity_.add(JSONObject.parseObject(fEntity_, Feature.OrderedField)); |
||||
|
} |
||||
|
|
||||
|
jsonFEntityModel_.put("FEntity", JSONArray.parseArray(JSON.toJSONString(list_fEntity_))); |
||||
|
jsonFEntityData_.put("Model", JSONObject.parseObject(JSON.toJSONString(jsonFEntityModel_), Feature.OrderedField)); |
||||
|
jsonObj.put("data", jsonFEntityData_.toJSONString()); |
||||
|
|
||||
|
return jsonObj.toJSONString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
package com.yxt.anrui.fin.biz.kingdee.stkmiscellaneous; |
||||
|
|
||||
|
import com.yxt.anrui.fin.api.kingdee.KingDeeBillId; |
||||
|
import com.yxt.anrui.fin.api.kingdee.KingDeeBillUrl; |
||||
|
import com.yxt.anrui.fin.api.kingdee.stkmiscellaneous.StkMiscellaneous; |
||||
|
import com.yxt.anrui.fin.biz.kingdee.FinKingDeeService; |
||||
|
import com.yxt.anrui.fin.biz.kingdee.voucher.VoucherCastToKingDeeBillFields; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2025/4/28 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class StkMiscellaneousService extends FinKingDeeService { |
||||
|
|
||||
|
public ResultBean draftStkMiscellaneous(StkMiscellaneous stkMiscellaneous) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//业务表的主表数据集合
|
||||
|
Map<String, String> map_fEntityModel_ = new HashMap<>(); |
||||
|
//物料的数组集合
|
||||
|
if (StringUtils.isBlank(stkMiscellaneous.getFStockOrgId())) { |
||||
|
return rb.setMsg("库存组织不能为空"); |
||||
|
} |
||||
|
map_fEntityModel_.put("FStockOrgId", stkMiscellaneous.getFStockOrgId()); |
||||
|
//业务日期
|
||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
if (StringUtils.isNotBlank(stkMiscellaneous.getFDate())) { |
||||
|
map_fEntityModel_.put("FDate", stkMiscellaneous.getFDate()); |
||||
|
} else { |
||||
|
map_fEntityModel_.put("FDate", sdf.format(new Date())); |
||||
|
} |
||||
|
map_fEntityModel_.put("FBaseCurrId", "PRE001"); |
||||
|
List<StkMiscellaneous.StkMiscellaneousEntry> stkMiscellaneousEntryList = stkMiscellaneous.getStkMiscellaneousEntry() == null ? new ArrayList<>() : stkMiscellaneous.getStkMiscellaneousEntry(); |
||||
|
//准备 物料列表的数据
|
||||
|
ResultBean<List<Map<String, String>>> vehicleListMap = createVehicleListsForReceivableBill(stkMiscellaneousEntryList); |
||||
|
if (!vehicleListMap.getSuccess()) { |
||||
|
return rb.setMsg(vehicleListMap.getMsg()); |
||||
|
} |
||||
|
String kingDeeData = VoucherCastToKingDeeBillFields.getKingDeeData(map_fEntityModel_, vehicleListMap.getData()); |
||||
|
try { |
||||
|
ResultBean<String> resultBean1 = accessKingDeeInterface(KingDeeBillId.STK_MISCELLANEOUS.getID(), kingDeeData, KingDeeBillUrl.SAVE_URL.getURL()); |
||||
|
if (!resultBean1.getSuccess()) { |
||||
|
log.info("其他入库单保存失败!"); |
||||
|
return rb.setMsg("其他入库单保存失败!"); |
||||
|
} |
||||
|
log.info("其他入库单保存成功!"); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private ResultBean<List<Map<String, String>>> createVehicleListsForReceivableBill(List<StkMiscellaneous.StkMiscellaneousEntry> stkMiscellaneousEntryList) { |
||||
|
ResultBean<List<Map<String, String>>> rb = ResultBean.fireFail(); |
||||
|
List<Map<String, String>> mapList = new ArrayList<>(); |
||||
|
for (int i = 0; i < stkMiscellaneousEntryList.size(); i++) { |
||||
|
StkMiscellaneous.StkMiscellaneousEntry c = stkMiscellaneousEntryList.get(i); |
||||
|
Map<String, String> m = new HashMap<>(); |
||||
|
if (StringUtils.isBlank(c.getFMATERIALID())) { |
||||
|
return rb.setMsg("物料编码不能为空"); |
||||
|
} |
||||
|
m.put("FMATERIALID", c.getFMATERIALID()); |
||||
|
m.put("FUnitID", c.getFUnitID()); |
||||
|
m.put("FSTOCKID", c.getFSTOCKID()); |
||||
|
m.put("FOWNERID", c.getFOWNERID()); |
||||
|
|
||||
|
mapList.add(m); |
||||
|
} |
||||
|
return rb.success().setData(mapList); |
||||
|
} |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"formId": "STK_MISCELLANEOUS", |
||||
|
"data": "@KD_data" |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
{ |
||||
|
"FEntryID": 0, |
||||
|
"FMATERIALID": { |
||||
|
"FNumber": "@KD_FMATERIALID" |
||||
|
}, |
||||
|
"FUnitID": { |
||||
|
"FNumber": "@KD_FUnitID" |
||||
|
}, |
||||
|
"FQty": { |
||||
|
"FNumber": "@KD_FQty" |
||||
|
}, |
||||
|
"FSTOCKID": { |
||||
|
"FNumber": "@KD_FSTOCKID" |
||||
|
}, |
||||
|
"FSTOCKSTATUSID": { |
||||
|
"FNumber": "KCZT01_SYS" |
||||
|
}, |
||||
|
"FOWNERTYPEID": "BD_OwnerOrg", |
||||
|
"FOWNERID": { |
||||
|
"FNumber": "@KD_FOWNERID" |
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
{ |
||||
|
"Creator": "", |
||||
|
"NeedUpDateFields": [], |
||||
|
"NeedReturnFields": [], |
||||
|
"IsDeleteEntry": "True", |
||||
|
"SubSystemId": "", |
||||
|
"IsVerifyBaseDataField": "false", |
||||
|
"IsEntryBatchFill": "True", |
||||
|
"ValidateFlag": "True", |
||||
|
"NumberSearch": "True", |
||||
|
"InterationFlags": "", |
||||
|
"Model": {} |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
{ |
||||
|
"FBillNo": "@KD_FBillNo", |
||||
|
"FBillTypeID": { |
||||
|
"FNUMBER": "QTRKD01_SYS" |
||||
|
}, |
||||
|
"FStockOrgId": { |
||||
|
"FNumber": "@KD_FStockOrgId" |
||||
|
}, |
||||
|
"FStockDirect": "IN", |
||||
|
"FDate": "@KD_FDate", |
||||
|
"FOwnerTypeIdHead": "BD_OwnerOrg", |
||||
|
"FOwnerIdHead": { |
||||
|
"FNumber": "@KD_FOwnerIdHead" |
||||
|
}, |
||||
|
"FBaseCurrId": { |
||||
|
"FNumber": "PRE001" |
||||
|
}, |
||||
|
"FNOTE": "@KD_FNOTE", |
||||
|
"FEntity": [ |
||||
|
] |
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
一、请求参数说明: |
||||
|
1.formid:业务对象表单Id,字符串类型(必录) |
||||
|
2.data:Json格式数据(详情参考Json格式数据)(必录) |
||||
|
2.1.Creator:创建者内码(非必录) |
||||
|
2.2.NeedUpDateFields:需要更新的字段,数组类型,格式:[key1,key2,...](非必录),注(更新单据体字段得加上单据体key) |
||||
|
2.3.NeedReturnFields:需返回结果的字段集合,数组类型,格式:[key,entitykey.key,...](非必录),注(返回单据体字段格式:entitykey.key) |
||||
|
2.4.IsDeleteEntry:是否删除已存在的分录,布尔类型,默认true(非必录) |
||||
|
2.5.SubSystemId:表单所在的子系统内码,字符串类型(非必录) |
||||
|
2.6.IsVerifyBaseDataField:是否验证所有的基础资料有效性,布尔类,默认false(非必录) |
||||
|
2.7.IsEntryBatchFill:是否批量填充分录,默认true(非必录) |
||||
|
2.8.ValidateFlag:是否验证标志,布尔类型,默认true(非必录) |
||||
|
2.9.NumberSearch:是否用编码搜索基础资料,布尔类型,默认true(非必录) |
||||
|
2.10.InterationFlags:交互标志集合,字符串类型,分号分隔,格式:"flag1;flag2;..."(非必录),例如(允许负库存标识:STK_InvCheckResult) |
||||
|
2.11.Model:表单数据包,Json类型(必录) |
||||
|
|
||||
|
|
||||
|
五、字段说明: |
||||
|
生产日期:FPRODUCEDATE |
||||
|
有效期至:FEXPIRYDATE |
||||
|
计划跟踪号:FMTONO |
||||
|
成本价:FPrice |
||||
|
总成本:FAmount |
||||
|
BOM版本:FBOMID |
||||
|
实收数量(基本单位):FBASEQTY |
||||
|
库存辅单位:FSecUNITID |
||||
|
实收数量(库存辅单位):FSecQTY |
||||
|
项目编号:FProjectNo |
||||
|
库存状态:FSTOCKSTATUSID (必填项) |
||||
|
基本单位:FBASEUNITID |
||||
|
序列号上传:FScanBox |
||||
|
收货仓库:FSTOCKID (必填项) |
||||
|
单位:FUnitID (必填项) |
||||
|
实收数量:FQty |
||||
|
客户:F_PAEZ_Base |
||||
|
物料编码:FMATERIALID (必填项) |
||||
|
物料名称:FMATERIALNAME |
||||
|
仓位:FStockLocId |
||||
|
序列号单位:FSNUnitID |
||||
|
序列号单位数量:FSNQty |
||||
|
批号:FLOT |
||||
|
备注:FEntryNote |
||||
|
辅助属性:FAuxPropId |
||||
|
序列号:FSerialNo |
||||
|
序列号:FSerialId |
||||
|
备注:FSerialNote |
||||
|
关联数量(辅单位):FJOINSECQTY |
||||
|
辅单位:FExtAuxUnitId |
||||
|
实收数量(辅单位):FExtAuxUnitQty |
||||
|
保管者:FKEEPERID (必填项) |
||||
|
库存更新标志:FSTOCKFLAG |
||||
|
规格型号:FModel |
||||
|
货主类型:FOWNERTYPEID (必填项) |
||||
|
货主:FOWNERID (必填项) |
||||
|
保管者类型:FKEEPERTYPEID (必填项) |
||||
|
保质期单位:FExpUnit |
||||
|
源单类型:FSRCBILLTYPEID |
||||
|
源单编号:FSRCBILLNO |
||||
|
关联数量:FJoinQty |
||||
|
关联数量(基本单位):FJoinBaseQty |
||||
|
保质期:FExpperiod |
||||
|
创建人:FCreatorId |
||||
|
创建日期:FCreateDate |
||||
|
最后修改人:FModifierId |
||||
|
库存组:FSTOCKERGROUPID |
||||
|
备注:FNOTE |
||||
|
本位币:FBaseCurrId |
||||
|
作废日期:FCANCELDATE |
||||
|
审核人:FAPPROVERID |
||||
|
审核日期:FAPPROVEDATE |
||||
|
最后修改日期:FModifyDate |
||||
|
作废状态:FCANCELSTATUS |
||||
|
作废人:FCANCELLERID |
||||
|
日期:FDate (必填项) |
||||
|
单据类型:FBillTypeID (必填项) |
||||
|
货主类型:FOwnerTypeIdHead (必填项) |
||||
|
单据编号:FBillNo |
||||
|
单据状态:FDocumentStatus |
||||
|
库存组织:FStockOrgId (必填项) |
||||
|
部门:FDEPTID |
||||
|
验收员:FACCEPTANCE |
||||
|
仓管员:FSTOCKERID |
||||
|
货主:FOwnerIdHead |
||||
|
库存方向:FStockDirect (必填项) |
||||
|
供应商:FSUPPLIERID |
@ -0,0 +1,62 @@ |
|||||
|
package com.yxt.anrui.fin.biz.kingdee.stkmisdelivery; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.alibaba.fastjson.parser.Feature; |
||||
|
import com.yxt.anrui.fin.biz.kingdee.KingDeeUtils; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2025/4/29 |
||||
|
**/ |
||||
|
public class StkMisDeliveryCastToKingDeeBillFields { |
||||
|
|
||||
|
/** |
||||
|
* 构造金蝶需要的数据结构 并对字段赋值 |
||||
|
* |
||||
|
* @param map_fEntityModel_ |
||||
|
* @param vehicleList |
||||
|
* @return |
||||
|
*/ |
||||
|
public static String getKingDeeData(Map<String, String> map_fEntityModel_, List<Map<String, String>> vehicleList) { |
||||
|
/** |
||||
|
* 取模板 |
||||
|
*/ |
||||
|
String readJsonFile = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmisdelivery/data.json"); |
||||
|
String fEntityData_ = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmisdelivery/data_data.json"); |
||||
|
String fEntityModel_ = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmisdelivery/data_model.json"); |
||||
|
|
||||
|
//模板字符创转json
|
||||
|
JSONObject jsonObj = JSONObject.parseObject(readJsonFile, Feature.OrderedField); |
||||
|
JSONObject jsonFEntityData_ = JSONObject.parseObject(fEntityData_, Feature.OrderedField); |
||||
|
fEntityModel_ = KingDeeUtils.replaceTemplateParams(fEntityModel_, map_fEntityModel_); |
||||
|
JSONObject jsonFEntityModel_ = JSONObject.parseObject(fEntityModel_, Feature.OrderedField); |
||||
|
|
||||
|
List<JSONObject> list_fEntity_ = new ArrayList<>(); |
||||
|
|
||||
|
//对模板字段赋值 根据传递进来的map数据的集合进行赋值
|
||||
|
for (int i = 0; i < vehicleList.size(); i++) { |
||||
|
String fEntity_ = KingDeeUtils.readJsonFile("com/yxt/anrui/fin/biz/kingdee/stkmisdelivery/data_FEntity.json"); |
||||
|
Map<String, String> params = vehicleList.get(i); |
||||
|
Map<String, String> map_fEntity_ = new HashMap<>(); |
||||
|
for (Map.Entry<String, String> entry : params.entrySet()) { |
||||
|
map_fEntity_.put(entry.getKey(), entry.getValue()); |
||||
|
} |
||||
|
fEntity_ = KingDeeUtils.replaceTemplateParams(fEntity_, map_fEntity_); |
||||
|
list_fEntity_.add(JSONObject.parseObject(fEntity_, Feature.OrderedField)); |
||||
|
} |
||||
|
|
||||
|
jsonFEntityModel_.put("FEntity", JSONArray.parseArray(JSON.toJSONString(list_fEntity_))); |
||||
|
jsonFEntityData_.put("Model", JSONObject.parseObject(JSON.toJSONString(jsonFEntityModel_), Feature.OrderedField)); |
||||
|
jsonObj.put("data", jsonFEntityData_.toJSONString()); |
||||
|
|
||||
|
return jsonObj.toJSONString(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
package com.yxt.anrui.fin.biz.kingdee.stkmisdelivery; |
||||
|
|
||||
|
import com.yxt.anrui.fin.api.kingdee.KingDeeBillId; |
||||
|
import com.yxt.anrui.fin.api.kingdee.KingDeeBillUrl; |
||||
|
import com.yxt.anrui.fin.api.kingdee.stkmiscellaneous.StkMiscellaneous; |
||||
|
import com.yxt.anrui.fin.api.kingdee.stkmisdelivery.StkMisDelivery; |
||||
|
import com.yxt.anrui.fin.biz.kingdee.FinKingDeeService; |
||||
|
import com.yxt.anrui.fin.biz.kingdee.voucher.VoucherCastToKingDeeBillFields; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: dimengzhe |
||||
|
* @date: 2025/4/29 |
||||
|
**/ |
||||
|
@Service |
||||
|
public class StkMisDeliveryService extends FinKingDeeService { |
||||
|
|
||||
|
public ResultBean draftStkMisDelivery(StkMisDelivery stkMisDelivery) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//业务表的主表数据集合
|
||||
|
Map<String, String> map_fEntityModel_ = new HashMap<>(); |
||||
|
//物料的数组集合
|
||||
|
if (StringUtils.isBlank(stkMisDelivery.getFStockOrgId())) { |
||||
|
return rb.setMsg("库存组织不能为空"); |
||||
|
} |
||||
|
map_fEntityModel_.put("FStockOrgId", stkMisDelivery.getFStockOrgId()); |
||||
|
//业务日期
|
||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
if (StringUtils.isNotBlank(stkMisDelivery.getFDate())) { |
||||
|
map_fEntityModel_.put("FDate", stkMisDelivery.getFDate()); |
||||
|
} else { |
||||
|
map_fEntityModel_.put("FDate", sdf.format(new Date())); |
||||
|
} |
||||
|
map_fEntityModel_.put("FBaseCurrId", "PRE001"); |
||||
|
List<StkMisDelivery.StkMisDeliveryEntry> stkMiscellaneousEntryList = |
||||
|
stkMisDelivery.getStkMisDeliveryEntry() == null ? new ArrayList<>() : stkMisDelivery.getStkMisDeliveryEntry(); |
||||
|
//准备 物料列表的数据
|
||||
|
ResultBean<List<Map<String, String>>> vehicleListMap = createVehicleListsForReceivableBill(stkMiscellaneousEntryList); |
||||
|
if (!vehicleListMap.getSuccess()) { |
||||
|
return rb.setMsg(vehicleListMap.getMsg()); |
||||
|
} |
||||
|
String kingDeeData = VoucherCastToKingDeeBillFields.getKingDeeData(map_fEntityModel_, vehicleListMap.getData()); |
||||
|
try { |
||||
|
ResultBean<String> resultBean1 = accessKingDeeInterface(KingDeeBillId.STK_MISCELLANEOUS.getID(), kingDeeData, KingDeeBillUrl.SAVE_URL.getURL()); |
||||
|
if (!resultBean1.getSuccess()) { |
||||
|
log.info("其他出库单保存失败!"); |
||||
|
return rb.setMsg("其他出库单保存失败!"); |
||||
|
} |
||||
|
log.info("其他出库单保存成功!"); |
||||
|
|
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
private ResultBean<List<Map<String, String>>> createVehicleListsForReceivableBill(List<StkMisDelivery.StkMisDeliveryEntry> stkMiscellaneousEntryList) { |
||||
|
ResultBean<List<Map<String, String>>> rb = ResultBean.fireFail(); |
||||
|
List<Map<String, String>> mapList = new ArrayList<>(); |
||||
|
for (int i = 0; i < stkMiscellaneousEntryList.size(); i++) { |
||||
|
StkMisDelivery.StkMisDeliveryEntry c = stkMiscellaneousEntryList.get(i); |
||||
|
Map<String, String> m = new HashMap<>(); |
||||
|
if (StringUtils.isBlank(c.getFMATERIALID())) { |
||||
|
return rb.setMsg("物料编码不能为空"); |
||||
|
} |
||||
|
m.put("FMATERIALID", c.getFMATERIALID()); |
||||
|
m.put("FUnitID", c.getFUnitID()); |
||||
|
m.put("FSTOCKID", c.getFSTOCKID()); |
||||
|
m.put("FOWNERID", c.getFOWNERID()); |
||||
|
|
||||
|
mapList.add(m); |
||||
|
} |
||||
|
return rb.success().setData(mapList); |
||||
|
} |
||||
|
} |
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"formId": "STK_MisDelivery", |
||||
|
"data": "@KD_data" |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
{ |
||||
|
"FEntryID": 0, |
||||
|
"FMATERIALID": { |
||||
|
"FNumber": "@KD_FMATERIALID" |
||||
|
}, |
||||
|
"FUnitID": { |
||||
|
"FNumber": "@KD_FUnitID" |
||||
|
}, |
||||
|
"FQty": { |
||||
|
"FNumber": "@KD_FQty" |
||||
|
}, |
||||
|
"FSTOCKID": { |
||||
|
"FNumber": "@KD_FSTOCKID" |
||||
|
}, |
||||
|
"FSTOCKSTATUSID": { |
||||
|
"FNumber": "KCZT01_SYS" |
||||
|
}, |
||||
|
"FOWNERTYPEID": "BD_OwnerOrg", |
||||
|
"FOWNERID": { |
||||
|
"FNumber": "@KD_FOWNERID" |
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
{ |
||||
|
"Creator": "", |
||||
|
"NeedUpDateFields": [], |
||||
|
"NeedReturnFields": [], |
||||
|
"IsDeleteEntry": "True", |
||||
|
"SubSystemId": "", |
||||
|
"IsVerifyBaseDataField": "false", |
||||
|
"IsEntryBatchFill": "True", |
||||
|
"ValidateFlag": "True", |
||||
|
"NumberSearch": "True", |
||||
|
"InterationFlags": "", |
||||
|
"Model": {} |
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
{ |
||||
|
"FBillNo": "@KD_FBillNo", |
||||
|
"FBillTypeID": { |
||||
|
"FNUMBER": "QTCKD01_SYS" |
||||
|
}, |
||||
|
"FStockOrgId": { |
||||
|
"FNumber": "@KD_FStockOrgId" |
||||
|
}, |
||||
|
"FStockDirect": "OUT", |
||||
|
"FDate": "@KD_FDate", |
||||
|
"FOwnerTypeIdHead": "BD_OwnerOrg", |
||||
|
"FOwnerIdHead": { |
||||
|
"FNumber": "@KD_FOwnerIdHead" |
||||
|
}, |
||||
|
"FBaseCurrId": { |
||||
|
"FNumber": "PRE001" |
||||
|
}, |
||||
|
"FNOTE": "@KD_FNOTE", |
||||
|
"FEntity": [ |
||||
|
] |
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
一、请求参数说明: |
||||
|
1.formid:业务对象表单Id,字符串类型(必录) |
||||
|
2.data:Json格式数据(详情参考Json格式数据)(必录) |
||||
|
2.1.Creator:创建者内码(非必录) |
||||
|
2.2.NeedUpDateFields:需要更新的字段,数组类型,格式:[key1,key2,...](非必录),注(更新单据体字段得加上单据体key) |
||||
|
2.3.NeedReturnFields:需返回结果的字段集合,数组类型,格式:[key,entitykey.key,...](非必录),注(返回单据体字段格式:entitykey.key) |
||||
|
2.4.IsDeleteEntry:是否删除已存在的分录,布尔类型,默认true(非必录) |
||||
|
2.5.SubSystemId:表单所在的子系统内码,字符串类型(非必录) |
||||
|
2.6.IsVerifyBaseDataField:是否验证所有的基础资料有效性,布尔类,默认false(非必录) |
||||
|
2.7.IsEntryBatchFill:是否批量填充分录,默认true(非必录) |
||||
|
2.8.ValidateFlag:是否验证标志,布尔类型,默认true(非必录) |
||||
|
2.9.NumberSearch:是否用编码搜索基础资料,布尔类型,默认true(非必录) |
||||
|
2.10.InterationFlags:交互标志集合,字符串类型,分号分隔,格式:"flag1;flag2;..."(非必录),例如(允许负库存标识:STK_InvCheckResult) |
||||
|
2.11.Model:表单数据包,Json类型(必录) |
||||
|
|
||||
|
五、字段说明: |
||||
|
项目编号:FProjectNo |
||||
|
生产日期:FProduceDate |
||||
|
保质期:FKFPeriod |
||||
|
实发数量(库存辅单位):FSecQty |
||||
|
单位:FUnitID (必填项) |
||||
|
规格型号:FModel |
||||
|
保质期单位:FKFPeriodUnit |
||||
|
货主类型:FOwnerTypeId (必填项) |
||||
|
货主:FOwnerId (必填项) |
||||
|
保管者类型:FKeeperTypeId (必填项) |
||||
|
有效期至:FExpiryDate |
||||
|
计划跟踪号:FMtoNo |
||||
|
库存状态:FStockStatusId (必填项) |
||||
|
实发数量(基本单位):FBaseQty |
||||
|
调入组织:F_PAEZ_Base |
||||
|
调入部门:F_PAEZ_Base1 (必填项) |
||||
|
记账部门:F_PAEZ_Base2 (必填项) |
||||
|
序列号上传:FScanBox |
||||
|
出库用途:F_PAEZ_Assistant (必填项) |
||||
|
实发数量:FQty |
||||
|
成本价:FPrice |
||||
|
总成本:FAmount |
||||
|
物料编码:FMaterialId (必填项) |
||||
|
物料名称:FMaterialName |
||||
|
发货仓库:FStockId (必填项) |
||||
|
保管者:FKeeperId (必填项) |
||||
|
成本项目:FCostItem |
||||
|
参加费用分配:FDistribution |
||||
|
辅单位:FExtAuxUnitId |
||||
|
序列号单位数量:FSNQty |
||||
|
关联数量(辅单位):FSECJOINQTY |
||||
|
消耗汇总:FIsConsumeSum |
||||
|
实发数量(辅单位):FExtAuxUnitQty |
||||
|
序列号:FSerialNo |
||||
|
序列号:FSerialId |
||||
|
备注:FSerialNote |
||||
|
产品组:FPRODUCTGROUPID |
||||
|
出库单价:F_PAEZ_Price |
||||
|
出库金额:F_PAEZ_Amount |
||||
|
序列号单位:FSNUnitID |
||||
|
库存更新标识:FStockFlag |
||||
|
关联数量:FJoinQty |
||||
|
辅助属性:FAuxPropId |
||||
|
BOM版本:FBomId |
||||
|
基本单位:FBaseUnitId (必填项) |
||||
|
库存辅单位:FSecUnitId |
||||
|
关联数量(基本单位):FBaseJoinQty |
||||
|
批号:FLot |
||||
|
备注:FEntryNote |
||||
|
服务上下文:FServiceContext |
||||
|
仓位:FStockLocId |
||||
|
源单类型:FSrcBillTypeId |
||||
|
源单编号:FSrcBillNo |
||||
|
组织间结算跨法人标识:FIsInterLegalPerson |
||||
|
最后修改人:FModifierId |
||||
|
最后修改日期:FModifyDate |
||||
|
作废人:FCancellerId |
||||
|
库存组:FStockerGroupId |
||||
|
创建人:FCreatorId |
||||
|
创建日期:FCreateDate |
||||
|
审核人:FApproverId |
||||
|
作废状态:FCancelStatus |
||||
|
作废日期:FCancelDate |
||||
|
审核日期:FApproveDate |
||||
|
仓管员:FStockerId |
||||
|
日期:FDate (必填项) |
||||
|
单据类型:FBillTypeID (必填项) |
||||
|
货主类型:FOwnerTypeIdHead (必填项) |
||||
|
单据编号:FBillNo |
||||
|
单据状态:FDocumentStatus |
||||
|
库存组织:FStockOrgId (必填项) |
||||
|
货主:FOwnerIdHead |
||||
|
本位币:FBaseCurrId |
||||
|
客户:FCustId |
||||
|
备注:FNote |
||||
|
库存方向:FStockDirect (必填项) |
||||
|
领料部门:FDeptId |
||||
|
领料人:FPickerId |
||||
|
业务类型:FBizType (必填项) |
||||
|
领用组织:FPickOrgId |
||||
|
跨组织业务类型:FTransferBizType |
Loading…
Reference in new issue