add:增加erp同步工具类
This commit is contained in:
@@ -2,34 +2,29 @@ package org.nl.wms.external_system.erp;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.github.javaparser.utils.Log;
|
||||
import com.kingdee.bos.webapi.entity.*;
|
||||
import com.kingdee.bos.webapi.entity.IdentifyInfo;
|
||||
import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.wms.base_manage.bsrealstorattr.service.dao.StIvtBsrealstorattr;
|
||||
import org.nl.common.utils.ErpServiceUtils;
|
||||
import org.nl.wms.base_manage.bsrealstorattr.service.impl.StIvtBsrealstorattrServiceImpl;
|
||||
import org.nl.wms.base_manage.customer.service.impl.BmCustomerServiceImpl;
|
||||
import org.nl.wms.base_manage.material.service.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.base_manage.material.service.impl.MdMeMaterialbaseServiceImpl;
|
||||
import org.nl.wms.base_manage.measure.service.impl.BmMeasureUnitServiceImpl;
|
||||
import org.nl.wms.base_manage.supplier.service.IBmSupplierService;
|
||||
import org.nl.wms.external_system.erp.dto.ErpQuery;
|
||||
import org.nl.wms.external_system.erp.dto.ErpSec;
|
||||
import org.nl.wms.sync_manage.service.form_mapping.dao.SyncFormMapping;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -52,71 +47,14 @@ public class SyncErpService {
|
||||
|
||||
@Autowired
|
||||
ErpSec erpSec;
|
||||
@Resource
|
||||
private ErpServiceUtils erpServiceUtils;
|
||||
|
||||
@Autowired
|
||||
MdMeMaterialbaseServiceImpl mdMeMaterialbaseServiceImpl;
|
||||
@Autowired
|
||||
private IBmSupplierService supplierService;
|
||||
@Autowired
|
||||
private BmCustomerServiceImpl bmCustomerServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private StIvtBsrealstorattrServiceImpl stIvtBsrealstorattrServiceImpl;
|
||||
@Autowired
|
||||
private BmMeasureUnitServiceImpl bmMeasureUnitServiceImpl;
|
||||
|
||||
public List<Object> syncData1(SyncFormMapping syncFormMapping) {
|
||||
List<StIvtBsrealstorattr> list = stIvtBsrealstorattrServiceImpl.list();
|
||||
list.forEach(r -> {
|
||||
syncUnit(r.getStor_code());
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Object> syncUnit(String fNumber) {
|
||||
List<Object> result = new ArrayList<>();
|
||||
try {
|
||||
// String filterString = "FNumber = '" + fNumber + "'";
|
||||
String filterString = "FCreateOrgId ='750572' AND FNumber = '" + fNumber + "'";
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
ErpQuery query = new ErpQuery();
|
||||
query.setFilterString(filterString);
|
||||
query.setFormId("BD_STOCK");
|
||||
query.setFieldKeys("FStockId,FNumber");
|
||||
//query.setLimit(10);
|
||||
String jsonString = JSON.toJSONString(query);
|
||||
List<List<Object>> lists = cloudApi.executeBillQuery(jsonString);
|
||||
log.info("同步ERP结果" + lists.size());
|
||||
List<String> ids = new ArrayList<>();
|
||||
List<Object> firstList = lists.get(0);
|
||||
for (Object r : firstList) {
|
||||
String fid = r.toString();
|
||||
if (StringUtils.isEmpty(fid)) {
|
||||
throw new RuntimeException("单据同步失败,没有找到FID");
|
||||
}
|
||||
ids.add(fid);
|
||||
}
|
||||
if (ids.size() > 1) {
|
||||
List<StIvtBsrealstorattr> sds = stIvtBsrealstorattrServiceImpl.list(new LambdaQueryWrapper<StIvtBsrealstorattr>().eq(StIvtBsrealstorattr::getStor_code, ids.get(1)));
|
||||
if (ObjectUtils.isNotEmpty(sds)) {
|
||||
if (StringUtils.isNotBlank(ids.get(0)) && StringUtils.isNotBlank(ids.get(1))) {
|
||||
String id = ids.get(0);
|
||||
String code = ids.get(1);
|
||||
LambdaUpdateWrapper<StIvtBsrealstorattr> data = new LambdaUpdateWrapper<>();
|
||||
data.eq(StIvtBsrealstorattr::getStor_code, code);
|
||||
data.set(StIvtBsrealstorattr::getId, id);
|
||||
stIvtBsrealstorattrServiceImpl.update(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new RuntimeException("同步失败:" + ex.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<Object> syncMaterialData(SyncFormMapping syncFormMapping) {
|
||||
@@ -179,192 +117,38 @@ public class SyncErpService {
|
||||
|
||||
|
||||
/**
|
||||
* 下推回传测试
|
||||
* 下推回传
|
||||
*/
|
||||
public JSONObject push(JSONObject from) {
|
||||
String result = "";
|
||||
//执行回传
|
||||
try {
|
||||
//要回传的json数据
|
||||
//todo 需要封装
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
String json =from.toJSONString();
|
||||
result = cloudApi.push(from.getString("TargetFormId"), json);
|
||||
from.put("result",result);
|
||||
Integer sd = 0;
|
||||
} catch (Exception ex) {
|
||||
Log.error(ex.getMessage());
|
||||
from.put("result",ex.getMessage());
|
||||
String sd = result;
|
||||
}
|
||||
return from;
|
||||
return erpServiceUtils.push(from);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回传测试
|
||||
* 合格证保存
|
||||
*/
|
||||
public JSONObject process(JSONObject from) {
|
||||
String result = "";
|
||||
//执行回传
|
||||
try {
|
||||
//要回传的json数据
|
||||
//todo 需要封装
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
String json =from.toJSONString();
|
||||
result = cloudApi.save(from.getString("formid"), json);
|
||||
from.put("result",result);
|
||||
Integer sd = 0;
|
||||
} catch (Exception ex) {
|
||||
Log.error(ex.getMessage());
|
||||
from.put("result",ex.getMessage());
|
||||
String sd = result;
|
||||
}
|
||||
return from;
|
||||
return erpServiceUtils.save(from);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回传测试
|
||||
* 数据同步
|
||||
*/
|
||||
public JSONObject process1(JSONObject from) {
|
||||
JSONObject result = new JSONObject();
|
||||
//执行回传
|
||||
String formType = from.getString("formid");
|
||||
try {
|
||||
// Model
|
||||
Map<String, Object> modelMap = new LinkedHashMap<>();
|
||||
Map<String, Object> fBillTypeMap = new LinkedHashMap<>();
|
||||
fBillTypeMap.put("FNUMBER", "SCRKD01_SYS");
|
||||
modelMap.put("FBillType", fBillTypeMap);
|
||||
modelMap.put("FDate", "2024-11-28");
|
||||
Map<String, Object> fStockOrgIdMap = new LinkedHashMap<>();
|
||||
fStockOrgIdMap.put("FNumber", "102");
|
||||
modelMap.put("FStockOrgId", fStockOrgIdMap);
|
||||
Map<String, Object> fPrdOrgIdMap = new LinkedHashMap<>();
|
||||
fPrdOrgIdMap.put("FNumber", "102");
|
||||
modelMap.put("FPrdOrgId", fPrdOrgIdMap);
|
||||
Map<String, Object> fOwnerId0Map = new LinkedHashMap<>();
|
||||
fOwnerId0Map.put("FNumber", "102");
|
||||
modelMap.put("FOwnerId0", fOwnerId0Map);
|
||||
List<Map<String, Object>> fEntityList = new ArrayList<>();
|
||||
Map<String, Object> fEntityMap = new LinkedHashMap<>();
|
||||
// FEntity
|
||||
fEntityMap.put("FIsNew", "false");
|
||||
fEntityMap.put("FMoBillNo", "MO102241101889");
|
||||
fEntityMap.put("FMoId", "173959");
|
||||
fEntityMap.put("FMoEntryId", "174486");
|
||||
fEntityMap.put("FSrcEntryId", 216902);
|
||||
Map<String, Object> fMaterialIdMap = new LinkedHashMap<>();
|
||||
fMaterialIdMap.put("FNumber", "05.01.D700.00225");
|
||||
fEntityMap.put("FMaterialId", fMaterialIdMap);
|
||||
Map<String, Object> fLotMap = new LinkedHashMap<>();
|
||||
fLotMap.put("FNumber", "MO102241101889");
|
||||
fEntityMap.put("FLot", fLotMap);
|
||||
Map<String, Object> fUnitIDMap = new LinkedHashMap<>();
|
||||
fUnitIDMap.put("FNumber", "MX055");
|
||||
fEntityMap.put("FUnitID", fUnitIDMap);
|
||||
Map<String, Object> fWorkShopId1Map = new LinkedHashMap<>();
|
||||
fWorkShopId1Map.put("FNumber", "03.09");
|
||||
fEntityMap.put("FWorkShopId1", fWorkShopId1Map);
|
||||
fEntityMap.put("FMustQty", "140");
|
||||
fEntityMap.put("FRealQty", "140");
|
||||
fEntityMap.put("FInStockType", "1");
|
||||
fEntityMap.put("FOwnerTypeId", "BD_OwnerOrg");
|
||||
Map<String, Object> fOwnerIdMap = new LinkedHashMap<>();
|
||||
fOwnerIdMap.put("FNumber", "102");
|
||||
fEntityMap.put("FOwnerId", fOwnerIdMap);
|
||||
Map<String, Object> fStockStatusIdMap = new LinkedHashMap<>();
|
||||
fStockStatusIdMap.put("FNumber", "10000");
|
||||
fEntityMap.put("FStockStatusId", fStockStatusIdMap);
|
||||
Map<String, Object> fStockIdMap = new LinkedHashMap<>();
|
||||
fStockIdMap.put("FNumber", "02");
|
||||
fEntityMap.put("FStockId", fStockIdMap);
|
||||
fEntityMap.put("FKeeperTypeId", "BD_KeeperOrg");
|
||||
Map<String, Object> fKeeperIdMap = new LinkedHashMap<>();
|
||||
fKeeperIdMap.put("FNumber", "102");
|
||||
fEntityMap.put("FKeeperId", fKeeperIdMap);
|
||||
fEntityList.add(fEntityMap);
|
||||
modelMap.put("FEntity", fEntityList);
|
||||
Map<String, Object> rootMap = new LinkedHashMap<>();
|
||||
rootMap.put("Model", modelMap);
|
||||
String jsonString = JSON.toJSONString(rootMap, SerializerFeature.PrettyFormat);
|
||||
//要回传的json数据
|
||||
JSONObject formData = from.getJSONObject("data");
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
//String results = cloudApi.save(formType, formData.toJSONString());
|
||||
String results = cloudApi.save(formType,jsonString);
|
||||
result.put("results", results);
|
||||
} catch (Exception ex) {
|
||||
Log.error(ex.getMessage());
|
||||
result.put("error", ex.getMessage());
|
||||
public JSONArray syncData(SyncFormMapping syncFormMapping) {
|
||||
ErpQuery query = new ErpQuery();
|
||||
query.setFormId(syncFormMapping.getForm_type());
|
||||
query.setFieldKeys(syncFormMapping.getFieldKeys());
|
||||
if (StringUtils.isNotBlank(syncFormMapping.getFilterString())) {
|
||||
query.setFilterString(syncFormMapping.getFilterString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public List<Object> syncData(SyncFormMapping syncFormMapping) {
|
||||
List<Object> result = new ArrayList<>();
|
||||
try {
|
||||
log.info("开始同步ERP" + syncFormMapping.getForm_name());
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
//String filterString = "FUseOrgId='750572'";
|
||||
String filterString = "FMoNumber ='MO102241200426'";
|
||||
//String filterString = "FCreateDate >= '" + today + " 00:00:00' and FCreateDate <= '" + today + " 23:59:59'";
|
||||
ErpQuery query = new ErpQuery();
|
||||
query.setFilterString(filterString);
|
||||
//query.setFormId(syncFormMapping.getForm_type());
|
||||
query.setFormId(syncFormMapping.getForm_type());
|
||||
query.setFieldKeys("FID");
|
||||
query.setLimit(0);
|
||||
String jsonString = JSON.toJSONString(query);
|
||||
List<List<Object>> lists = cloudApi.executeBillQuery(jsonString);
|
||||
log.info("同步ERP结果" + lists.size());
|
||||
Set<String> ids = new HashSet<>();
|
||||
for (List<Object> list : lists) {
|
||||
for (Object r : list) {
|
||||
String fid = r.toString();
|
||||
if (StringUtils.isEmpty(fid)) {
|
||||
throw new RuntimeException("单据同步失败,没有找到FID");
|
||||
}
|
||||
ids.add(fid);
|
||||
}
|
||||
}
|
||||
OperateParam param = new OperateParam();
|
||||
Map<String, String> error = new HashMap<>();
|
||||
for (String id : ids) {
|
||||
param.setId(id);
|
||||
OperatorResult view = cloudApi.view(syncFormMapping.getForm_type(), param);
|
||||
RepoStatus status = view.getResult().getResponseStatus();
|
||||
if (status.isIsSuccess()) {
|
||||
result.add(view.getResult().getResult());
|
||||
} else {
|
||||
ArrayList<RepoError> errors = status.getErrors();
|
||||
String errorMsg = errors.stream().map(RepoError::getMessage).collect(Collectors.joining(","));
|
||||
error.put(id, errorMsg);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(error)) {
|
||||
log.info("ERP单据同步同步失败:{}", error);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
throw new RuntimeException("同步失败:" + ex.getMessage());
|
||||
if (StringUtils.isNotBlank(syncFormMapping.getOrderString())) {
|
||||
query.setOrderString(syncFormMapping.getOrderString());
|
||||
}
|
||||
return result;
|
||||
query.setLimit(syncFormMapping.getLimit());
|
||||
return erpServiceUtils.queryBills(query);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SyncErpController {
|
||||
JSONArray datepick = param.getJSONArray("datepick");
|
||||
if (datepick!=null && datepick.size()>0){
|
||||
startTime = datepick.getString(0); //时间格式2024-12-12 12:00:00没选则为空
|
||||
endTime = datepick.getString(0);
|
||||
endTime = datepick.getString(1);
|
||||
}
|
||||
return new ResponseEntity<>(TableDataInfo.buildJson(syncErpBillsScheduleService.manualSync(formType,formCode,startTime,endTime)), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.enums.StatusEnum;
|
||||
import org.nl.common.utils.ErpServiceUtils;
|
||||
import org.nl.wms.external_system.erp.dto.ErpQuery;
|
||||
import org.nl.wms.external_system.erp.dto.ErpSec;
|
||||
import org.nl.wms.flow_manage.flow.framework.process.nodeType.excess.impl.process.classprocess.ClassProcess;
|
||||
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
|
||||
@@ -21,6 +23,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -39,6 +42,8 @@ public class SyncReceiptProcessHandler implements ClassProcess {
|
||||
IPmFormDataService iPmFormDataService;
|
||||
@Autowired
|
||||
ErpSec erpSec;
|
||||
@Resource
|
||||
private ErpServiceUtils erpServiceUtils;
|
||||
|
||||
/**
|
||||
* 回执单回传
|
||||
@@ -58,9 +63,19 @@ public class SyncReceiptProcessHandler implements ClassProcess {
|
||||
if (StringUtils.isEmpty(formid)) {
|
||||
throw new BadRequestException("回传失败:回传数据form_data中数据格式不是formid,data类型");
|
||||
}
|
||||
//判断生产入库的手工录入与MRP生成方式需回传不同的源单信息
|
||||
if ("0".equals(formData.getString("FSrcEntryId")) && "PRD_INSTOCK".equals(formType)) {
|
||||
//查询工序汇报单
|
||||
ErpQuery reportQuery = new ErpQuery();
|
||||
reportQuery.setFilterString("FMoNumber ='" + formData.getString("moNumber") + "'");
|
||||
reportQuery.setOrderString("FId desc");
|
||||
reportQuery.setFormId("SFC_OperationReport");
|
||||
JSONArray jsonArray = erpServiceUtils.queryBills(reportQuery);
|
||||
formData.remove("FSrcEntryId");
|
||||
formData.put("FSrcBillNo", jsonArray.getJSONObject(0).getString("BillNo"));
|
||||
}
|
||||
String json = formData.toJSONString();
|
||||
try {
|
||||
//todo 需要封装
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
@@ -96,127 +111,5 @@ public class SyncReceiptProcessHandler implements ClassProcess {
|
||||
return from;
|
||||
}
|
||||
|
||||
public JSONObject process1(JSONObject from, JSONObject param) {
|
||||
//执行回传单
|
||||
String formType = from.getString("form_type");
|
||||
try {
|
||||
if (!formType.contains("RECEIPT")) {
|
||||
throw new BadRequestException("回传失败:单据类型不是回传类型单据");
|
||||
}
|
||||
//要回传的json数据
|
||||
JSONObject formData = from.getJSONObject("form_data");
|
||||
String formid = formData.getString("formid");
|
||||
if (StringUtils.isEmpty(formid)) {
|
||||
throw new BadRequestException("回传失败:回传数据form_data中数据格式不是formid,data类型");
|
||||
}
|
||||
List<Map<String, Object>> fEntityList = new ArrayList<>();
|
||||
Map<String, Object> fPrdOrgIdMap = new LinkedHashMap<>();
|
||||
Map<String, Object> fStockOrgIdMap = new LinkedHashMap<>();
|
||||
Map<String, Object> fOwnerId0Map = new LinkedHashMap<>();
|
||||
Map<String, Object> modelMap = new LinkedHashMap<>();
|
||||
Map<String, Object> fBillTypeMap = new LinkedHashMap<>();
|
||||
Map<String, Object> modelMap1 = new LinkedHashMap<>();
|
||||
JSONObject modelData = formData.getJSONObject("Model");
|
||||
|
||||
JSONObject fBillType = modelData.getJSONObject("FBillType");
|
||||
fBillTypeMap.put("FNUMBER", fBillType.getString("FNUMBER"));
|
||||
|
||||
|
||||
modelMap.put("FDate", modelData.getString("FDate"));
|
||||
|
||||
JSONObject fStockOrgId = modelData.getJSONObject("FStockOrgId");
|
||||
fStockOrgIdMap.put("FNumber", fStockOrgId.getString("FNumber"));
|
||||
modelMap.put("FStockOrgId", fStockOrgIdMap);
|
||||
|
||||
|
||||
JSONObject fPrdOrgId = modelData.getJSONObject("FPrdOrgId");
|
||||
fPrdOrgIdMap.put("FNumber", fPrdOrgId.getString("FNumber"));
|
||||
modelMap.put("FPrdOrgId", fPrdOrgIdMap);
|
||||
|
||||
|
||||
JSONObject fOwnerId0 = modelData.getJSONObject("FOwnerId0");
|
||||
fOwnerId0Map.put("FNumber", fOwnerId0.getString("FNumber"));
|
||||
modelMap.put("FOwnerId0", fOwnerId0Map);
|
||||
|
||||
|
||||
JSONArray fEntityArray = modelData.getJSONArray("FEntity");
|
||||
for (int i = 0; i < fEntityArray.size(); i++) {
|
||||
JSONObject entity = fEntityArray.getJSONObject(i);
|
||||
Map<String, Object> entityMap = new LinkedHashMap<>();
|
||||
entityMap.put("FIsNew", entity.getString("FIsNew"));
|
||||
entityMap.put("FMoBillNo", entity.getString("FMoBillNo"));
|
||||
entityMap.put("FMoId", entity.getString("FMoId"));
|
||||
entityMap.put("FMoEntryId", entity.getString("FMoEntryId"));
|
||||
entityMap.put("FSrcEntryId", entity.getString("FSrcEntryId"));
|
||||
entityMap.put("FSrcEntryId", "216397");
|
||||
|
||||
// FMaterialId
|
||||
JSONObject fMaterialId = entity.getJSONObject("FMaterialId");
|
||||
Map<String, Object> fMaterialIdMap = new LinkedHashMap<>();
|
||||
fMaterialIdMap.put("FNumber", fMaterialId.getString("FNumber"));
|
||||
entityMap.put("FMaterialId", fMaterialIdMap);
|
||||
|
||||
// FLot
|
||||
JSONObject fLot = entity.getJSONObject("FLot");
|
||||
Map<String, Object> fLotMap = new LinkedHashMap<>();
|
||||
fLotMap.put("FNumber", fLot.getString("FNumber"));
|
||||
entityMap.put("FLot", fLotMap);
|
||||
|
||||
// FUnitID
|
||||
JSONObject fUnitID = entity.getJSONObject("FUnitID");
|
||||
Map<String, Object> fUnitIDMap = new LinkedHashMap<>();
|
||||
fUnitIDMap.put("FNumber", fUnitID.getString("FNumber"));
|
||||
entityMap.put("FUnitID", fUnitIDMap);
|
||||
|
||||
// FWorkShopId1
|
||||
JSONObject fWorkShopId1 = entity.getJSONObject("FWorkShopId1");
|
||||
Map<String, Object> fWorkShopId1Map = new LinkedHashMap<>();
|
||||
fWorkShopId1Map.put("FNumber", fWorkShopId1.getString("FNumber"));
|
||||
entityMap.put("FWorkShopId1", fWorkShopId1Map);
|
||||
|
||||
entityMap.put("FMustQty", entity.getString("FMustQty"));
|
||||
entityMap.put("FRealQty", entity.getString("FRealQty"));
|
||||
entityMap.put("FInStockType", entity.getString("FInStockType"));
|
||||
entityMap.put("FOwnerTypeId", entity.getString("FOwnerTypeId"));
|
||||
|
||||
// FOwnerId
|
||||
JSONObject fOwnerId = entity.getJSONObject("FOwnerId");
|
||||
Map<String, Object> fOwnerIdMap = new LinkedHashMap<>();
|
||||
fOwnerIdMap.put("FNumber", fOwnerId.getString("FNumber"));
|
||||
entityMap.put("FOwnerId", fOwnerIdMap);
|
||||
|
||||
// FStockStatusId
|
||||
JSONObject fStockStatusId = entity.getJSONObject("FStockStatusId");
|
||||
Map<String, Object> fStockStatusIdMap = new LinkedHashMap<>();
|
||||
fStockStatusIdMap.put("FNumber", fStockStatusId.getString("FNumber"));
|
||||
fStockStatusIdMap.put("FNumber", "10000");
|
||||
entityMap.put("FStockStatusId", fStockStatusIdMap);
|
||||
|
||||
// FStockId
|
||||
JSONObject fStockId = entity.getJSONObject("FStockId");
|
||||
Map<String, Object> fStockIdMap = new LinkedHashMap<>();
|
||||
fStockIdMap.put("FNumber", fStockId.getString("FNumber"));
|
||||
entityMap.put("FStockId", fStockIdMap);
|
||||
entityMap.put("FKeeperTypeId", entity.getString("FKeeperTypeId"));
|
||||
// FKeeperId
|
||||
JSONObject fKeeperId = entity.getJSONObject("FKeeperId");
|
||||
Map<String, Object> fKeeperIdMap = new LinkedHashMap<>();
|
||||
fKeeperIdMap.put("FNumber", fKeeperId.getString("FNumber"));
|
||||
entityMap.put("FKeeperId", fKeeperIdMap);
|
||||
fEntityList.add(entityMap);
|
||||
|
||||
}
|
||||
modelMap.put("FEntity", fEntityList);
|
||||
modelMap1.put("Model",modelMap);
|
||||
String jsonString = JSON.toJSONString(modelMap1, SerializerFeature.PrettyFormat);
|
||||
IdentifyInfo identifyInfo = new IdentifyInfo();
|
||||
BeanUtils.copyProperties(erpSec, identifyInfo);
|
||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||
String results = cloudApi.save("PRD_INSTOCK", jsonString);
|
||||
Integer sd=0;
|
||||
} catch (Exception ex) {
|
||||
Log.error(ex.getMessage());
|
||||
}
|
||||
return from;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,23 +353,7 @@ public class PdaIOService {
|
||||
result.setStockId(dFormJson.getString("stockId"));
|
||||
result.setKeeperId((dFormJson.getString("StockOrgId")));
|
||||
result.setKeeperTypeId("BD_KeeperOrg");
|
||||
String srcBillNo = dFormJson.getString("saleOrderEntryId");
|
||||
//此单据为手工录入,查询工序汇报单
|
||||
if ("0".equals(srcBillNo)) {
|
||||
ErpQuery reportQuery = new ErpQuery();
|
||||
reportQuery.setFilterString("FMoNumber ='" + moNumber + "'");
|
||||
reportQuery.setOrderString("FId desc");
|
||||
reportQuery.setFormId("SFC_OperationReport");
|
||||
JSONArray jsonArray = erpServiceUtils.queryBills(reportQuery);
|
||||
if (ObjectUtils.isEmpty(jsonArray)) {
|
||||
throw new BadRequestException("查询合格证关联的工序汇报单异常!");
|
||||
}else{
|
||||
//todo
|
||||
//result.setSrcBillNo(jsonArray.getJSONObject(0).getString("BillNo"));
|
||||
}
|
||||
} else {
|
||||
result.setSrcBillNo(srcBillNo);
|
||||
}
|
||||
result.setSrcBillNo(dFormJson.getString("saleOrderEntryId"));
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException("查询合格证关联的生产订单信息异常!");
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SyncFormMapping implements Serializable {
|
||||
* 返回数
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer Limit;
|
||||
private Integer Limit= 100;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user