change - 其他出库单保存->提交->审核

master
yinq 7 months ago
parent 81d8ecab14
commit 9b5d9912c3

@ -42,6 +42,10 @@ public class KingdeeConfig {
*/
public static String STK_InStock = "STK_InStock";
/**
* formId
*/
public static String STK_MisDelivery = "STK_MisDelivery";
/**
*
@ -63,6 +67,11 @@ public class KingdeeConfig {
*/
public static JSONObject FBillTypeIDStorage = new JSONObject();
/**
* -
*/
public static JSONObject FBillTypeIDOtherOutStorage = new JSONObject();
/**
*
*/
@ -105,6 +114,14 @@ public class KingdeeConfig {
return FBillTypeIDStorage;
}
/**
* -
*/
public static JSONObject getFBillTypeIDOtherOutStorage() {
FBillTypeIDOtherOutStorage.put("FNUMBER", "QTCKD01_SYS");
return FBillTypeIDOtherOutStorage;
}
/**
*
*/

@ -75,6 +75,20 @@ public class KingdeeErpSyncController {
}
}
/**
* ->->
* @param params {"FMaterialId": "01150020","FDate": "2024-04-12 00:00:00","FUnitID": "zhi1","FStockId": "CK052","FAuxPropId": "304不锈钢滤帽","FQty": 4.0000,"FPrice": 20.3}
* @return {"msg": "{\"IsSuccess\":true,\"Errors\":[],\"SuccessEntitys\":[{\"Id\":\"116470\",\"Number\":\"QTCK004153\",\"DIndex\":0}]}","code": 200}
*/
@PostMapping(("/saveOtherOutStorage"))
public AjaxResult saveOtherOutStorage(@RequestBody String params) {
try {
return AjaxResult.success(kingdeeErpService.saveOtherOutStorage(params));
} catch (Exception e) {
return AjaxResult.error(e.toString());
}
}
/**
* ERP
*

@ -184,7 +184,7 @@ public class KingdeeErpService {
String FAuxPropId = (String) objectParams.get("FAuxPropId");//物料辅助属性
String FSrcBillNo = (String) objectParams.get("FSrcBillNo");//源单编号
String FUnitID = (String) objectParams.get("FUnitID");//单位
String FDate = (String) objectParams.get("FDate");//物料编码
String FDate = (String) objectParams.get("FDate");//日期
Double FRealQty = (Double) objectParams.get("FRealQty");//实收数量
String FStockId = (String) objectParams.get("FStockId");//仓库
String F_TOND_Base = "JY(NT)-SA-XS-2020-0039";//京源项目
@ -222,11 +222,10 @@ public class KingdeeErpService {
ArrayList<JSONObject> entityList = new ArrayList<>();
JSONObject data = new JSONObject();
entityList.add(FEntity);
model.put("FInStockEntry", entityList);
model.put("FID", KingdeeConfig.FID);
JSONObject data = new JSONObject();
model.put("FID", KingdeeConfig.FID);
// model.put("FBusinessType", ""); //业务类型(必填项)
// model.put("FOwnerTypeIdHead", ""); //货主类型(必填项)
model.put("FBillTypeID", KingdeeConfig.getFBillTypeIDStorage()); //单据类型(必填项)
@ -257,13 +256,13 @@ public class KingdeeErpService {
//采购入库单提交
String commitResult = this.genericCommitInterface(json);
RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class);
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()){
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("savePurchaseStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
}
//采购入库单审核
String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()){
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("savePurchaseStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
}
}
@ -369,4 +368,101 @@ public class KingdeeErpService {
System.out.println(("genericSaveInterface|formId" + formId + "|请求参数:" + params.toJSONString() + "|返回结果:" + save));
return save;
}
/**
* ERP
* ->->
*
* @param params
* @return
*/
public String saveOtherOutStorage(String params) {
Gson gsonParams = new Gson();
JSONObject objectParams = gsonParams.fromJson(params, JSONObject.class);
JSONObject model = new JSONObject();
JSONObject FEntity = new JSONObject();
String FDate = (String) objectParams.get("FDate");//日期
String FMaterialId = (String) objectParams.get("FMaterialId");//物料编码
String FAuxPropId = (String) objectParams.get("FAuxPropId");//物料辅助属性
String FUnitID = (String) objectParams.get("FUnitID");//单位
Double FQty = (Double) objectParams.get("FQty");//实发数量
Double FPrice = (Double) objectParams.get("FPrice");//成本价
String FStockId = (String) objectParams.get("FStockId");//仓库
try {
//业务对象标识
String formId = KingdeeConfig.STK_MisDelivery;
//调用接口
JSONObject FMaterialIdObject = new JSONObject();
FMaterialIdObject.put("FNumber", FMaterialId);
FEntity.put("FMaterialId", FMaterialIdObject); //物料编码(必填项)
JSONObject FUnitIDObject = new JSONObject();
FUnitIDObject.put("FNumber", FUnitID);
FEntity.put("FUnitID", FUnitIDObject); //单位(必填项)
FEntity.put("FQty", FQty); //实发数量
FEntity.put("FPrice", FPrice); //成本价
FEntity.put("FBaseUnitId", FUnitIDObject); //基本单位(必填项)
JSONObject FStockIdObject = new JSONObject();
FStockIdObject.put("FNumber", FStockId);
FEntity.put("FStockId", FStockIdObject); //发货仓库
FEntity.put("FOWNERTYPEID", "BD_OwnerOrg"); //货主类型(必填项)
FEntity.put("FOWNERID", KingdeeConfig.getFApplicationOrgId()); //货主(必填项)
JSONObject FStockStatusIdObject = new JSONObject();
FStockStatusIdObject.put("FNumber", "KCZT01_SYS");
FEntity.put("FStockStatusId", FStockStatusIdObject); //库存状态(必填项)
FEntity.put("FKeeperTypeId", "BD_KeeperOrg"); //保管者类型(必填项)
FEntity.put("FKeeperId", KingdeeConfig.getFApplicationOrgId()); //保管者(必填项)
JSONObject FAuxPropIdObject = new JSONObject();
FAuxPropIdObject.put("FAUXPROPID__FF100001", FAuxPropId);
FEntity.put("FAuxPropId", FAuxPropIdObject); //辅助属性
ArrayList<JSONObject> entityList = new ArrayList<>();
entityList.add(FEntity);
model.put("FEntity", entityList);
JSONObject data = new JSONObject();
model.put("FID", KingdeeConfig.FID);
model.put("FBillTypeID", KingdeeConfig.getFBillTypeIDOtherOutStorage()); //单据类型(必填项)
model.put("FStockOrgId", KingdeeConfig.getFApplicationOrgId()); //收料组织(必填项)
model.put("FPickOrgId", KingdeeConfig.getFApplicationOrgId()); //领用组织
model.put("FStockDirect", "GENERAL"); //库存方向(必填项)
model.put("FDate", FDate); //日期(必填项)
model.put("FOwnerTypeIdHead", "BD_OwnerOrg"); //货主类型(必填项)
model.put("FOwnerIdHead", KingdeeConfig.getFApplicationOrgId()); //货主(必填项)
JSONObject FDeptIdObject = new JSONObject();
FDeptIdObject.put("FNumber", "BM000001");
model.put("FDeptId", FDeptIdObject); //部门
model.put("F_TOND_Combo", "一般领料"); //领料类型(必填项)
data.put("Model", model);
String saveParams = data.toJSONString();
String resultJson = client.save(formId, saveParams);
//用于记录结果
Gson gson = new Gson();
//对返回结果进行解析和校验
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
logger.info("saveOtherOutStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
if (responseStatus.isIsSuccess()) {
JSONObject json = new JSONObject();
json.put("formId", KingdeeConfig.STK_MisDelivery);
json.put("Ids", repoRet.getResult().getId());
//其他出库单提交
String commitResult = this.genericCommitInterface(json);
RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class);
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()){
logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
}
//其他出库单审核
String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()){
logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
}
}
return gson.toJson(responseStatus);
} catch (Exception e) {
logger.error("saveOtherOutStorage|params" + params + "|Exception" + e);
return e.getMessage();
}
}
}

Loading…
Cancel
Save