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

master
yinq 7 months ago
parent bf30eb5574
commit 5775773430

@ -47,6 +47,11 @@ public class KingdeeConfig {
*/ */
public static String STK_MisDelivery = "STK_MisDelivery"; public static String STK_MisDelivery = "STK_MisDelivery";
/**
* formId
*/
public static String STK_MISCELLANEOUS = "STK_MISCELLANEOUS";
/** /**
* *
*/ */
@ -72,6 +77,11 @@ public class KingdeeConfig {
*/ */
public static JSONObject FBillTypeIDOtherOutStorage = new JSONObject(); public static JSONObject FBillTypeIDOtherOutStorage = new JSONObject();
/**
* -
*/
public static JSONObject FBillTypeIDOtherInStorage = new JSONObject();
/** /**
* *
*/ */
@ -122,6 +132,14 @@ public class KingdeeConfig {
return FBillTypeIDOtherOutStorage; return FBillTypeIDOtherOutStorage;
} }
/**
* -
*/
public static JSONObject getFBillTypeIDOtherInStorage() {
FBillTypeIDOtherInStorage.put("FNUMBER", "QTRKD01_SYS");
return FBillTypeIDOtherInStorage;
}
/** /**
* *
*/ */

@ -89,6 +89,21 @@ 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\":\"100418\",\"Number\":\"QTRK000352\",\"DIndex\":0}]}", "code": 200}
*/
@PostMapping(("/saveOtherInStorage"))
public AjaxResult saveOtherInStorage(@RequestBody String params) {
try {
return AjaxResult.success(kingdeeErpService.saveOtherInStorage(params));
} catch (Exception e) {
return AjaxResult.error(e.toString());
}
}
/** /**
* ERP * ERP
* *

@ -449,13 +449,13 @@ public class KingdeeErpService {
//其他出库单提交 //其他出库单提交
String commitResult = this.genericCommitInterface(json); String commitResult = this.genericCommitInterface(json);
RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class); RepoRet commitRepoRet = gson.fromJson(commitResult, RepoRet.class);
if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()){ if (!commitRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
//其他出库单审核 //其他出库单审核
String auditResult = this.genericAuditInterface(json); String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class); RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()){ if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()) {
logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet); logger.error("saveOtherOutStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
} }
} }
@ -465,4 +465,99 @@ public class KingdeeErpService {
return e.getMessage(); return e.getMessage();
} }
} }
/**
* ->->
*
* @param params
* @return
*/
public String saveOtherInStorage(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_MISCELLANEOUS;
//调用接口
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.getFBillTypeIDOtherInStorage()); //单据类型(必填项)
model.put("FStockOrgId", 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); //部门
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("saveOtherInStorage接口调用成功|请求参数:" + saveParams + "|返回结果:" + resultJson);
RepoStatus responseStatus = repoRet.getResult().getResponseStatus();
if (responseStatus.isIsSuccess()) {
JSONObject json = new JSONObject();
json.put("formId", KingdeeConfig.STK_MISCELLANEOUS);
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("saveOtherInStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
}
//其他入库单审核
String auditResult = this.genericAuditInterface(json);
RepoRet auditRepoRet = gson.fromJson(auditResult, RepoRet.class);
if (!auditRepoRet.getResult().getResponseStatus().isIsSuccess()){
logger.error("saveOtherInStorage|请求参数:" + json.toJSONString() + "|返回结果:" + commitRepoRet);
}
}
return gson.toJson(responseStatus);
} catch (Exception e) {
logger.error("saveOtherInStorage|params" + params + "|Exception" + e);
return e.getMessage();
}
}
} }

Loading…
Cancel
Save