opt:优化手工录入的合格证查询
This commit is contained in:
@@ -320,14 +320,14 @@ public class SyncErpService {
|
|||||||
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
|
||||||
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||||
//String filterString = "FUseOrgId='750572'";
|
//String filterString = "FUseOrgId='750572'";
|
||||||
String filterString = "FBillNo ='SCRK241200094'";
|
String filterString = "FMoNumber ='MO102241200426'";
|
||||||
//String filterString = "FCreateDate >= '" + today + " 00:00:00' and FCreateDate <= '" + today + " 23:59:59'";
|
//String filterString = "FCreateDate >= '" + today + " 00:00:00' and FCreateDate <= '" + today + " 23:59:59'";
|
||||||
ErpQuery query = new ErpQuery();
|
ErpQuery query = new ErpQuery();
|
||||||
query.setFilterString(filterString);
|
query.setFilterString(filterString);
|
||||||
//query.setFormId(syncFormMapping.getForm_type());
|
//query.setFormId(syncFormMapping.getForm_type());
|
||||||
query.setFormId(syncFormMapping.getForm_type());
|
query.setFormId(syncFormMapping.getForm_type());
|
||||||
query.setFieldKeys("FID");
|
query.setFieldKeys("FID");
|
||||||
query.setLimit(1);
|
query.setLimit(0);
|
||||||
String jsonString = JSON.toJSONString(query);
|
String jsonString = JSON.toJSONString(query);
|
||||||
List<List<Object>> lists = cloudApi.executeBillQuery(jsonString);
|
List<List<Object>> lists = cloudApi.executeBillQuery(jsonString);
|
||||||
log.info("同步ERP结果" + lists.size());
|
log.info("同步ERP结果" + lists.size());
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class ErpQuery {
|
|||||||
/**
|
/**
|
||||||
* 需查询的字段key集合,字符串类型,格式:"key1,key2,..."(必录) 注(查询单据体内码,需加单据体Key和下划线,如:FEntryKey_FEntryId)
|
* 需查询的字段key集合,字符串类型,格式:"key1,key2,..."(必录) 注(查询单据体内码,需加单据体Key和下划线,如:FEntryKey_FEntryId)
|
||||||
*/
|
*/
|
||||||
private String FieldKeys;
|
private String FieldKeys = "FID";
|
||||||
/**
|
/**
|
||||||
* 过滤条件,数组类型,如:[{"Left":"(","FieldName":"Field1","Compare":"67","Value":"111","Right":")","Logic":"0"},{"Left":"(","FieldName":"Field2","Compare":"67","Value":"222","Right":")","Logic":"0"}]
|
* 过滤条件,数组类型,如:[{"Left":"(","FieldName":"Field1","Compare":"67","Value":"111","Right":")","Logic":"0"},{"Left":"(","FieldName":"Field2","Compare":"67","Value":"222","Right":")","Logic":"0"}]
|
||||||
*/
|
*/
|
||||||
@@ -32,7 +32,7 @@ public class ErpQuery {
|
|||||||
/**
|
/**
|
||||||
* 行数
|
* 行数
|
||||||
*/
|
*/
|
||||||
private Integer Limit = 20;
|
private Integer Limit = 100;
|
||||||
/**
|
/**
|
||||||
* 表单所在的子系统内码,字符串类型(非必录)
|
* 表单所在的子系统内码,字符串类型(非必录)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.wms.pda_manage.iostorage.sevice;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@@ -54,6 +55,9 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class PdaIOService {
|
public class PdaIOService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ErpServiceUtils erpServiceUtils;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ErpSec erpSec;
|
private ErpSec erpSec;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -328,11 +332,12 @@ public class PdaIOService {
|
|||||||
JSONObject pFormJson = JSONObject.parseObject(pForm_data);
|
JSONObject pFormJson = JSONObject.parseObject(pForm_data);
|
||||||
JSONObject dFormJson = JSONObject.parseObject(dForm_data);
|
JSONObject dFormJson = JSONObject.parseObject(dForm_data);
|
||||||
if (ObjectUtils.isNotEmpty(dFormJson) && ObjectUtils.isNotEmpty(pFormJson)) {
|
if (ObjectUtils.isNotEmpty(dFormJson) && ObjectUtils.isNotEmpty(pFormJson)) {
|
||||||
|
String moNumber = dataList.get(11).toString();
|
||||||
result.setBillNo(dataList.get(0).toString());
|
result.setBillNo(dataList.get(0).toString());
|
||||||
result.setPrdOrgId((pFormJson.getString("PrdOrgId")));
|
result.setPrdOrgId((pFormJson.getString("PrdOrgId")));
|
||||||
result.setStockOrgId((dFormJson.getString("StockOrgId")));
|
result.setStockOrgId((dFormJson.getString("StockOrgId")));
|
||||||
result.setOwnerIdHead_Id((dFormJson.getString("InStockOwnerId")));
|
result.setOwnerIdHead_Id((dFormJson.getString("InStockOwnerId")));
|
||||||
result.setMoNumber(dataList.get(11).toString());
|
result.setMoNumber(moNumber);
|
||||||
result.setMoId(prdMoBillData.getPId().substring(0, prdMoBillData.getPId().indexOf("$")));
|
result.setMoId(prdMoBillData.getPId().substring(0, prdMoBillData.getPId().indexOf("$")));
|
||||||
result.setMoEntryId(prdMoBillData.getDId().substring(0, prdMoBillData.getDId().indexOf("$")));
|
result.setMoEntryId(prdMoBillData.getDId().substring(0, prdMoBillData.getDId().indexOf("$")));
|
||||||
result.setMaterial_id(dataList.get(3).toString());
|
result.setMaterial_id(dataList.get(3).toString());
|
||||||
@@ -349,8 +354,19 @@ public class PdaIOService {
|
|||||||
result.setKeeperId((dFormJson.getString("StockOrgId")));
|
result.setKeeperId((dFormJson.getString("StockOrgId")));
|
||||||
result.setKeeperTypeId("BD_KeeperOrg");
|
result.setKeeperTypeId("BD_KeeperOrg");
|
||||||
String srcBillNo = dFormJson.getString("saleOrderEntryId");
|
String srcBillNo = dFormJson.getString("saleOrderEntryId");
|
||||||
|
//此单据为手工录入,查询工序汇报单
|
||||||
if ("0".equals(srcBillNo)) {
|
if ("0".equals(srcBillNo)) {
|
||||||
//tofix 查询工序汇报单信息,取末道工序为源单号
|
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.setMoNumber(jsonArray.getJSONObject(0).getString("BillNo"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.setSrcBillNo(srcBillNo);
|
result.setSrcBillNo(srcBillNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,4 +83,31 @@ public class SyncFormMapping implements Serializable {
|
|||||||
private Boolean dtl_split;
|
private Boolean dtl_split;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String FieldKeys;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤条件
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String FilterString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序条件
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String OrderString;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回数
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer Limit;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,10 +96,7 @@ public class SyncErpBillsScheduleService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String manualSyncData(String mappingJson, String formType, Boolean dtlSplit, String code, String start, String end) {
|
private String manualSyncData(String mappingJson, String formType, Boolean dtlSplit, String code, String start, String end) {
|
||||||
//formType:SAL_SaleOrder code:JDSCLLD20241102,start:2024-11-11 12:00:00 end:2024-11-11 12:00:00
|
|
||||||
boolean islock = lock.tryLock();
|
boolean islock = lock.tryLock();
|
||||||
Integer count = 0;
|
|
||||||
String msg = "同步失败,失败原因:";
|
|
||||||
Map errorMsg = new HashMap<>();
|
Map errorMsg = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
if (islock) {
|
if (islock) {
|
||||||
|
|||||||
Reference in New Issue
Block a user