|
|
@@ -122,7 +122,7 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
|
|
|
int totalElements = UtilMap.getInt(bizObjectPage, "totalElements");
|
|
|
|
|
|
if (totalElements > 0) {
|
|
|
- //云枢更新销售出库单
|
|
|
+ //云枢更新物料
|
|
|
Map content = ((List<Map>) UtilMap.getList(bizObjectPage, "content")).get(0);
|
|
|
|
|
|
String bizObjectId = UtilMap.getString(content,"bizObjectId");//主表实例id
|
|
|
@@ -131,7 +131,7 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
|
|
|
|
|
|
Map result3 = cpClient.updateCpBo(schemaCode, data,null);
|
|
|
}else {
|
|
|
- //云枢新增销售出库单
|
|
|
+ //云枢新增物料
|
|
|
Map result3 = cpClient.createCpBo(schemaCode, data,null);
|
|
|
}
|
|
|
}
|
|
|
@@ -701,6 +701,75 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void syncXingneng() {
|
|
|
+ log.info("开始同步性能数据");
|
|
|
+ K3CloudApi client = new K3CloudApi(initIden());
|
|
|
+
|
|
|
+ List<Map> result = new ArrayList<>();
|
|
|
+ List<Map> materialList = new ArrayList<>();
|
|
|
+
|
|
|
+ int startRow = 0;
|
|
|
+ int limit = 2000;
|
|
|
+
|
|
|
+ BillQuery billQuery = new BillQuery();
|
|
|
+ billQuery.setFormId("Sl_xingneng");
|
|
|
+ billQuery.setFieldKeys("FNumber,FName,Fmiduqty");
|
|
|
+ List<Map> filterString = new ArrayList<>();
|
|
|
+
|
|
|
+ //修改日期为昨天至今天 数据状态等于已审核
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FModifyDate","265",1,"","","0"));//修改日期在今天之前N天以后
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));//数据状态等于XX
|
|
|
+
|
|
|
+ billQuery.setFilterString(filterString);
|
|
|
+ billQuery.setLimit(limit);
|
|
|
+
|
|
|
+ do {
|
|
|
+ billQuery.setStartRow(startRow);
|
|
|
+ String s = null;
|
|
|
+
|
|
|
+ try {
|
|
|
+ s = client.billQuery(JSONObject.toJSONString(billQuery));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ result = (List<Map>)JSONObject.parse(s);
|
|
|
+ materialList.addAll(result);
|
|
|
+
|
|
|
+ startRow += limit;
|
|
|
+ }while (result.size() == limit);
|
|
|
+
|
|
|
+ for (Map map : materialList) {
|
|
|
+ Map data = new HashMap();
|
|
|
+ data.put("ShortText1763692732585",UtilMap.getString(map,"FName"));//名称
|
|
|
+ data.put("ShortText1763692732107",UtilMap.getString(map,"FNumber"));//性能
|
|
|
+ data.put("Number1763692741479",UtilMap.getDouble(map,"Fmiduqty"));//性能
|
|
|
+
|
|
|
+ String schemaCode = "XN";
|
|
|
+
|
|
|
+ //查询是否存在
|
|
|
+ Map result2 = cpClient.getCpBoList(schemaCode, UtilMap.map("queryFilterType, propertyCode, propertyValue", "Eq", "ShortText1763692732107", UtilMap.getString(map,"FNumber")), 0, 1, null);
|
|
|
+
|
|
|
+ Map bizObjectPage = UtilMap.getMap(UtilMap.getMap(result2, "data"),"bizObjectPage");
|
|
|
+
|
|
|
+ int totalElements = UtilMap.getInt(bizObjectPage, "totalElements");
|
|
|
+
|
|
|
+ if (totalElements > 0) {
|
|
|
+ //云枢更新性能
|
|
|
+ Map content = ((List<Map>) UtilMap.getList(bizObjectPage, "content")).get(0);
|
|
|
+
|
|
|
+ String bizObjectId = UtilMap.getString(content,"bizObjectId");//主表实例id
|
|
|
+
|
|
|
+ data.put("id",bizObjectId);
|
|
|
+
|
|
|
+ Map result3 = cpClient.updateCpBo(schemaCode, data,null);
|
|
|
+ }else {
|
|
|
+ //云枢新增性能
|
|
|
+ Map result3 = cpClient.createCpBo(schemaCode, data,null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private IdentifyInfo initIden(){
|
|
|
//注意 1:此处不再使用参数形式传入用户名及密码等敏感信息,改为在登录配置文件中设置。
|
|
|
//注意 2:必须先配置第三方系统登录授权信息后,再进行业务操作,详情参考各语言版本SDK介绍中的登录配置文件说明。
|