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