|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.hw.jindie.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
|
|
|
import com.hw.common.core.utils.StringUtils;
|
|
|
|
@ -12,6 +13,7 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -33,26 +35,32 @@ public class KingdeeErpService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 单一采购申请单保存->提交->审核
|
|
|
|
|
* 采购申请单多物料保存->提交->审核
|
|
|
|
|
*
|
|
|
|
|
* @param params
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public String singleSavePurchaseRequisition(String params) {
|
|
|
|
|
Gson gsonParams = new Gson();
|
|
|
|
|
JSONObject objectParams = gsonParams.fromJson(params, JSONObject.class);
|
|
|
|
|
JSONArray jsonArray = gsonParams.fromJson(params, JSONArray.class);
|
|
|
|
|
JSONObject model = new JSONObject();
|
|
|
|
|
ArrayList<JSONObject> entityList = new ArrayList<>();
|
|
|
|
|
try {
|
|
|
|
|
//业务对象标识
|
|
|
|
|
String formId = KingdeeConfig.PUR_Requisition;
|
|
|
|
|
//调用接口
|
|
|
|
|
for (Object obj : jsonArray) {
|
|
|
|
|
JSONObject FEntity = new JSONObject();
|
|
|
|
|
JSONObject objectParams = JSONObject.from(obj);
|
|
|
|
|
String FMaterialId = (String) objectParams.get("FMaterialId");//物料编码
|
|
|
|
|
String FUnitId = (String) objectParams.get("FUnitId");//单位
|
|
|
|
|
String FPriceUnitId = (String) objectParams.get("FPriceUnitId");//计价单位
|
|
|
|
|
String FMaterialDesc = (String) objectParams.get("FMaterialDesc");//物料说明
|
|
|
|
|
Double FReqQty = (Double) objectParams.get("FReqQty");//采购数量
|
|
|
|
|
Double FTAXPRICE = (Double) objectParams.get("FTAXPRICE");//含税单价
|
|
|
|
|
try {
|
|
|
|
|
//业务对象标识
|
|
|
|
|
String formId = KingdeeConfig.PUR_Requisition;
|
|
|
|
|
//调用接口
|
|
|
|
|
BigDecimal BFReqQty = (BigDecimal) objectParams.get("FReqQty");//采购数量
|
|
|
|
|
double FReqQty = BFReqQty.doubleValue();
|
|
|
|
|
BigDecimal FFTAXPRICE = (BigDecimal) objectParams.get("FTAXPRICE");//含税单价
|
|
|
|
|
double FTAXPRICE = FFTAXPRICE.doubleValue();
|
|
|
|
|
|
|
|
|
|
FEntity.put("FRequireOrgId", KingdeeConfig.getFApplicationOrgId()); //需求组织(必填项)
|
|
|
|
|
JSONObject FMaterialIdObject = new JSONObject();
|
|
|
|
|
FMaterialIdObject.put("FNumber", FMaterialId);
|
|
|
|
@ -66,6 +74,8 @@ public class KingdeeErpService {
|
|
|
|
|
FEntity.put("FPriceUnitId", FPriceUnitIdObject); //计价单位(必填项)
|
|
|
|
|
FEntity.put("FREQSTOCKUNITID", FUnitIdObject); //库存单位(必填项)
|
|
|
|
|
FEntity.put("FReqQty", FReqQty); //申请数量
|
|
|
|
|
entityList.add(FEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FEntity.put("FMaterialDesc", FMaterialDesc); //物料说明
|
|
|
|
|
// FEntity.put("FReceiveOrgId", KingdeeConfig.getFApplicationOrgId()); //收料组织
|
|
|
|
@ -85,8 +95,7 @@ public class KingdeeErpService {
|
|
|
|
|
// FEntity.put("FIsVmiBusiness", false); //VMI业务
|
|
|
|
|
// FEntity.put("FDEMANDBILLENTRYSEQ", 0); // 需求单据行号
|
|
|
|
|
// FEntity.put("FDEMANDBILLENTRYID", 0); // 需求单据分录内码
|
|
|
|
|
ArrayList<JSONObject> entityList = new ArrayList<>();
|
|
|
|
|
entityList.add(FEntity);
|
|
|
|
|
|
|
|
|
|
model.put("FEntity", entityList);
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
|
|
model.put("FID", KingdeeConfig.FID);
|
|
|
|
|