|
|
@@ -67,9 +67,19 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void syncBDSerialMainFile() {
|
|
|
+ public void syncBDSerialMainFile(String userId) {
|
|
|
MDC.put("MDC_KEY_PID","1002");
|
|
|
|
|
|
+ //创建看板更新记录
|
|
|
+ if (Strings.isBlank(userId)){
|
|
|
+ userId = "yida_pub_account";
|
|
|
+ }
|
|
|
+
|
|
|
+ String formInstId = ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-0BEA655A36724D509A2CF21C4BA38D367YF7")
|
|
|
+ .formDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mfmhvkey, selectField_mhsjnn2r, dateField_mhsjnn2s, employeeField_mhswy0xy", "成品库存天数看板", "更新中", System.currentTimeMillis(),Arrays.asList(userId))))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create).toString();
|
|
|
+
|
|
|
// 获取当前日期
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
|
@@ -277,16 +287,38 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
.formDataJson(JSONObject.toJSONString(groupMap))
|
|
|
.build(), YDConf.FORM_OPERATION.create);
|
|
|
}
|
|
|
+
|
|
|
+ //更新看板更新记录
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "已完成", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
}catch (Exception e){
|
|
|
+ //更新看板更新记录
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "异常", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void syncSTKInventory() {
|
|
|
+ public void syncSTKInventory(String userId) {
|
|
|
MDC.put("MDC_KEY_PID","1002");
|
|
|
|
|
|
+ //创建看板更新记录
|
|
|
+ if (Strings.isBlank(userId)){
|
|
|
+ userId = "yida_pub_account";
|
|
|
+ }
|
|
|
+
|
|
|
+ String formInstId = ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-0BEA655A36724D509A2CF21C4BA38D367YF7")
|
|
|
+ .formDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mfmhvkey, selectField_mhsjnn2r, dateField_mhsjnn2s, employeeField_mhswy0xy", "成品/组件库存看板", "更新中", System.currentTimeMillis(),Arrays.asList(userId))))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create).toString();
|
|
|
+
|
|
|
// 获取当前日期
|
|
|
LocalDate today = LocalDate.now();
|
|
|
int year = today.getYear();//获取当前年份
|
|
|
@@ -477,7 +509,19 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
.build(), YDConf.FORM_OPERATION.create);
|
|
|
}
|
|
|
|
|
|
+ //更新看板更新记录
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "已完成", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
}catch (Exception e){
|
|
|
+ //更新看板更新记录
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "异常", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
|
|
|
@@ -485,82 +529,106 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
|
|
|
//定时同步昨日到今天的
|
|
|
@Override
|
|
|
- public void syncPRDReturnMtrl() {
|
|
|
+ public void syncPRDReturnMtrl(String userId) {
|
|
|
MDC.put("MDC_KEY_PID","1002");
|
|
|
|
|
|
- K3CloudApi client = new K3CloudApi(initIden());
|
|
|
+ //创建看板更新记录
|
|
|
+ if (Strings.isBlank(userId)){
|
|
|
+ userId = "yida_pub_account";
|
|
|
+ }
|
|
|
|
|
|
- int startRow = 0;
|
|
|
- int limit = 2000;
|
|
|
+ //创建看板更新记录
|
|
|
+ String formInstId = ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-0BEA655A36724D509A2CF21C4BA38D367YF7")
|
|
|
+ .formDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mfmhvkey, selectField_mhsjnn2r, dateField_mhsjnn2s, employeeField_mhswy0xy", "不良物料退库统计看板", "更新中", System.currentTimeMillis(),Arrays.asList(userId))))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create).toString();
|
|
|
|
|
|
- BillQuery billQuery = new BillQuery();
|
|
|
+ try {
|
|
|
+ K3CloudApi client = new K3CloudApi(initIden());
|
|
|
|
|
|
- billQuery.setLimit(limit);
|
|
|
- billQuery.setFormId("PRD_ReturnMtrl");
|
|
|
- billQuery.setFieldKeys("FBillNo,FDate,FPPBOMEntryId,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,FMaterialId.FDefaultVendor,FReturnType,FQty");
|
|
|
- List<Map> filterString = new ArrayList<>();
|
|
|
- //审核日期为昨日到现在且单据状态等于已审核
|
|
|
- filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",1,"","","0"));//审核日期在今天之前XX天之后
|
|
|
- filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));//单据状态等于XX
|
|
|
-// filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","420","2025-01-01","","","0"));//审核日期等于XX年
|
|
|
+ int startRow = 0;
|
|
|
+ int limit = 2000;
|
|
|
|
|
|
- billQuery.setFilterString(filterString);
|
|
|
+ BillQuery billQuery = new BillQuery();
|
|
|
|
|
|
- List<Map> result = new ArrayList<>();
|
|
|
- List<Map> list = new ArrayList<>();
|
|
|
+ billQuery.setLimit(limit);
|
|
|
+ billQuery.setFormId("PRD_ReturnMtrl");
|
|
|
+ billQuery.setFieldKeys("FBillNo,FDate,FPPBOMEntryId,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,FMaterialId.FDefaultVendor,FReturnType,FQty");
|
|
|
+ List<Map> filterString = new ArrayList<>();
|
|
|
+ //审核日期为昨日到现在且单据状态等于已审核
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",1,"","","0"));//审核日期在今天之前XX天之后
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));//单据状态等于XX
|
|
|
+// filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","420","2025-01-01","","","0"));//审核日期等于XX年
|
|
|
|
|
|
- do {
|
|
|
- billQuery.setStartRow(startRow);
|
|
|
+ billQuery.setFilterString(filterString);
|
|
|
|
|
|
- try {
|
|
|
- result = (List<Map>)JSONObject.parse(client.billQuery(JSONObject.toJSONString(billQuery)));
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
+ List<Map> result = new ArrayList<>();
|
|
|
+ List<Map> list = new ArrayList<>();
|
|
|
|
|
|
- list.addAll(result);
|
|
|
+ do {
|
|
|
+ billQuery.setStartRow(startRow);
|
|
|
|
|
|
- startRow += limit;
|
|
|
- }while (result.size() == limit);
|
|
|
+ result = (List<Map>)JSONObject.parse(client.billQuery(JSONObject.toJSONString(billQuery)));
|
|
|
|
|
|
- for (Map map : list) {
|
|
|
- Map formData = new HashMap();
|
|
|
- String fBillNo = UtilMap.getString(map, "FBillNo");
|
|
|
- formData.put("textField_mfm7o4wb", fBillNo);//单据编号
|
|
|
+ list.addAll(result);
|
|
|
|
|
|
- String fDate = UtilMap.getString(map, "FDate");
|
|
|
- // 解析字符串为 LocalDateTime
|
|
|
- LocalDateTime localDateTime = LocalDateTime.parse(fDate);
|
|
|
- // 将 LocalDateTime 转换为 ZonedDateTime
|
|
|
- ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
|
|
|
- formData.put("dateField_mfm7o4wc", zonedDateTime.toInstant().toEpochMilli());//单据日期
|
|
|
+ startRow += limit;
|
|
|
+ }while (result.size() == limit);
|
|
|
|
|
|
- String fppbomEntryId = UtilMap.getString(map, "FPPBOMEntryId");
|
|
|
- formData.put("textField_mfmaqppu", fppbomEntryId);//分录明细id
|
|
|
- formData.put("textField_mfm7o4we", UtilMap.getString(map,"FMaterialId.FNumber"));//物料编码
|
|
|
+ for (Map map : list) {
|
|
|
+ Map formData = new HashMap();
|
|
|
+ String fBillNo = UtilMap.getString(map, "FBillNo");
|
|
|
+ formData.put("textField_mfm7o4wb", fBillNo);//单据编号
|
|
|
+
|
|
|
+ String fDate = UtilMap.getString(map, "FDate");
|
|
|
+ // 解析字符串为 LocalDateTime
|
|
|
+ LocalDateTime localDateTime = LocalDateTime.parse(fDate);
|
|
|
+ // 将 LocalDateTime 转换为 ZonedDateTime
|
|
|
+ ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
|
|
|
+ formData.put("dateField_mfm7o4wc", zonedDateTime.toInstant().toEpochMilli());//单据日期
|
|
|
+
|
|
|
+ String fppbomEntryId = UtilMap.getString(map, "FPPBOMEntryId");
|
|
|
+ formData.put("textField_mfmaqppu", fppbomEntryId);//分录明细id
|
|
|
+ formData.put("textField_mfm7o4we", UtilMap.getString(map,"FMaterialId.FNumber"));//物料编码
|
|
|
+
|
|
|
+ formData.put("textField_mfm7o4wf", UtilMap.getString(map,"FMaterialId.FName"));//物料名称
|
|
|
+ formData.put("textField_mfm7o4wg", UtilMap.getString(map,"FMaterialId.FSpecification"));//物料规格
|
|
|
+ formData.put("textField_mfq6bwfl", UtilMap.getString(map,"FMaterialId.FDefaultVendor"));//默认供应商
|
|
|
+
|
|
|
+ //退料类型
|
|
|
+ String type = UtilMap.getString(map, "FReturnType");
|
|
|
+ String typeValue = "";
|
|
|
+ switch (type){
|
|
|
+ case "1": typeValue = "良品退料";break;
|
|
|
+ case "2": typeValue = "来料不良退料";break;
|
|
|
+ case "3": typeValue = "作业不良退料";break;
|
|
|
+ default:break;
|
|
|
+ }
|
|
|
+ formData.put("textField_mfm7o4wh", typeValue);
|
|
|
|
|
|
- formData.put("textField_mfm7o4wf", UtilMap.getString(map,"FMaterialId.FName"));//物料名称
|
|
|
- formData.put("textField_mfm7o4wg", UtilMap.getString(map,"FMaterialId.FSpecification"));//物料规格
|
|
|
- formData.put("textField_mfq6bwfl", UtilMap.getString(map,"FMaterialId.FDefaultVendor"));//默认供应商
|
|
|
+ formData.put("numberField_mfm7o4wj", UtilMap.getDouble(map,"FQty"));//退料数量
|
|
|
|
|
|
- //退料类型
|
|
|
- String type = UtilMap.getString(map, "FReturnType");
|
|
|
- String typeValue = "";
|
|
|
- switch (type){
|
|
|
- case "1": typeValue = "良品退料";break;
|
|
|
- case "2": typeValue = "来料不良退料";break;
|
|
|
- case "3": typeValue = "作业不良退料";break;
|
|
|
- default:break;
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-D21383AF87AC48BEB577485C37F46E8FUAIK")
|
|
|
+ .searchCondition(JSONObject.toJSONString(UtilMap.map("textField_mfm7o4wb, textField_mfmaqppu, textField_mfm7o4wh",fBillNo,fppbomEntryId,typeValue)))
|
|
|
+ .formDataJson(JSONObject.toJSONString(formData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
}
|
|
|
- formData.put("textField_mfm7o4wh", typeValue);
|
|
|
|
|
|
- formData.put("numberField_mfm7o4wj", UtilMap.getDouble(map,"FQty"));//退料数量
|
|
|
+ //更新看板更新记录
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "已完成", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
|
|
|
+ }catch (Exception e){
|
|
|
+ //更新看板更新记录
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid("FORM-D21383AF87AC48BEB577485C37F46E8FUAIK")
|
|
|
- .searchCondition(JSONObject.toJSONString(UtilMap.map("textField_mfm7o4wb, textField_mfmaqppu, textField_mfm7o4wh",fBillNo,fppbomEntryId,typeValue)))
|
|
|
- .formDataJson(JSONObject.toJSONString(formData))
|
|
|
- .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "异常", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -569,18 +637,12 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
public void syncReport(String type,String userId) {
|
|
|
MDC.put("MDC_KEY_PID","1002");
|
|
|
|
|
|
- //创建看板更新记录
|
|
|
- String formInstId = ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid("FORM-0BEA655A36724D509A2CF21C4BA38D367YF7")
|
|
|
- .formDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mfmhvkey, selectField_mhsjnn2r, dateField_mhsjnn2s, employeeField_mhswy0xy", type, "更新中", System.currentTimeMillis(),Arrays.asList(userId))))
|
|
|
- .build(), YDConf.FORM_OPERATION.create).toString();
|
|
|
-
|
|
|
try {
|
|
|
switch (type){
|
|
|
- case "成品库存天数看板": syncBDSerialMainFile();break;
|
|
|
- case "成品/组件库存看板": syncSTKInventory();break;
|
|
|
- case "不良物料退库统计看板": syncPRDReturnMtrl();break;
|
|
|
- case "成品/样机出库看板": syncDLVNotice();break;
|
|
|
+ case "成品库存天数看板": syncBDSerialMainFile(userId);break;
|
|
|
+ case "成品/组件库存看板": syncSTKInventory(userId);break;
|
|
|
+ case "不良物料退库统计看板": syncPRDReturnMtrl(userId);break;
|
|
|
+ case "成品/样机出库看板": syncDLVNotice(userId);break;
|
|
|
default:break;
|
|
|
}
|
|
|
|
|
|
@@ -589,22 +651,11 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
sendDdMsg(ddClient.getAccessToken(),ddConf.getAgentId(),userId,"更新" + type + "完成 时间:" + DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
}
|
|
|
|
|
|
- //更新看板更新记录
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .formInstId(formInstId)
|
|
|
- .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "已完成", System.currentTimeMillis())))
|
|
|
- .build(), YDConf.FORM_OPERATION.update);
|
|
|
}catch (Exception e){
|
|
|
//发送工作通知
|
|
|
if (Objects.nonNull(userId)){
|
|
|
sendDdMsg(ddClient.getAccessToken(),ddConf.getAgentId(),userId,"更新" + type + "异常:" + e.getMessage() + " 时间:" + DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
}
|
|
|
-
|
|
|
- //更新看板更新记录
|
|
|
- ydClient.operateData(YDParam.builder()
|
|
|
- .formInstId(formInstId)
|
|
|
- .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "异常", System.currentTimeMillis())))
|
|
|
- .build(), YDConf.FORM_OPERATION.update);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -718,113 +769,136 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void syncDLVNotice() {
|
|
|
+ public void syncDLVNotice(String userId) {
|
|
|
MDC.put("MDC_KEY_PID","1002");
|
|
|
|
|
|
- K3CloudApi client = new K3CloudApi(initIden());
|
|
|
+ //创建看板更新记录
|
|
|
+ if (Strings.isBlank(userId)){
|
|
|
+ userId = "yida_pub_account";
|
|
|
+ }
|
|
|
|
|
|
- int startRow = 0;
|
|
|
- int limit = 2000;
|
|
|
+ //创建看板更新记录
|
|
|
+ String formInstId = ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-0BEA655A36724D509A2CF21C4BA38D367YF7")
|
|
|
+ .formDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mfmhvkey, selectField_mhsjnn2r, dateField_mhsjnn2s, employeeField_mhswy0xy", "成品/样机出库看板", "更新中", System.currentTimeMillis(),Arrays.asList(userId))))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create).toString();
|
|
|
|
|
|
- BillQuery billQuery = new BillQuery();
|
|
|
+ try {
|
|
|
+ K3CloudApi client = new K3CloudApi(initIden());
|
|
|
|
|
|
- billQuery.setLimit(limit);
|
|
|
- billQuery.setFormId("SAL_DELIVERYNOTICE");
|
|
|
- billQuery.setFieldKeys("FBillNo,FDate,FCustomerID.FName,F_QUXZ_Assistant.FNumber,FEntity_FEntryID,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,FMaterialId.F_QUXZ_Assistant,FUnitID.FName,FQty,FIsFree,FHGZBDay.FNumber,FStockID.FName");
|
|
|
- List<Map> filterString = new ArrayList<>();
|
|
|
- //审核日期为昨日到现在且单据状态等于已审核且明细收件人电话不为空
|
|
|
- filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",1,"","","0"));//审核日期在今天之前XX天之后
|
|
|
- filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));//单据状态等于XX
|
|
|
+ int startRow = 0;
|
|
|
+ int limit = 2000;
|
|
|
+
|
|
|
+ BillQuery billQuery = new BillQuery();
|
|
|
+
|
|
|
+ billQuery.setLimit(limit);
|
|
|
+ billQuery.setFormId("SAL_DELIVERYNOTICE");
|
|
|
+ billQuery.setFieldKeys("FBillNo,FDate,FCustomerID.FName,F_QUXZ_Assistant.FNumber,FEntity_FEntryID,FMaterialId.FNumber,FMaterialId.FName,FMaterialId.FSpecification,FMaterialId.F_QUXZ_Assistant,FUnitID.FName,FQty,FIsFree,FHGZBDay.FNumber,FStockID.FName");
|
|
|
+ List<Map> filterString = new ArrayList<>();
|
|
|
+ //审核日期为昨日到现在且单据状态等于已审核且明细收件人电话不为空
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",1,"","","0"));//审核日期在今天之前XX天之后
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));//单据状态等于XX
|
|
|
// filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FHGReceiveDZ","52","","","","0"));//明细收件人地址不为空
|
|
|
- filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FHGReceiveDh","52","","","","0"));//明细收件人电话不为空
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FHGReceiveDh","52","","","","0"));//明细收件人电话不为空
|
|
|
// filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","420","2025-01-01","","","0"));//审核日期等于XX年
|
|
|
// filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","63","","","","0"));//审核日期等于本月
|
|
|
|
|
|
- billQuery.setFilterString(filterString);
|
|
|
+ billQuery.setFilterString(filterString);
|
|
|
|
|
|
- List<Map> result = new ArrayList<>();
|
|
|
- List<Map> list = new ArrayList<>();
|
|
|
+ List<Map> result = new ArrayList<>();
|
|
|
+ List<Map> list = new ArrayList<>();
|
|
|
|
|
|
- do {
|
|
|
- billQuery.setStartRow(startRow);
|
|
|
+ do {
|
|
|
+ billQuery.setStartRow(startRow);
|
|
|
|
|
|
- try {
|
|
|
result = (List<Map>)JSONObject.parse(client.billQuery(JSONObject.toJSONString(billQuery)));
|
|
|
- } catch (Exception e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
|
|
|
- list.addAll(result);
|
|
|
-
|
|
|
- startRow += limit;
|
|
|
- }while (result.size() == limit);
|
|
|
-
|
|
|
- for (Map map : list) {
|
|
|
- Map formData = new HashMap();
|
|
|
- String fBillNo = UtilMap.getString(map, "FBillNo");
|
|
|
- formData.put("textField_mfqf1fj5", fBillNo);//单据编号
|
|
|
-
|
|
|
- String fDate = UtilMap.getString(map, "FDate");
|
|
|
- // 解析字符串为 LocalDateTime
|
|
|
- LocalDateTime localDateTime = LocalDateTime.parse(fDate);
|
|
|
- // 将 LocalDateTime 转换为 ZonedDateTime
|
|
|
- ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
|
|
|
-
|
|
|
- //localDateTime是当月的第几周
|
|
|
- int week = localDateTime.get(WeekFields.ISO.weekOfWeekBasedYear());
|
|
|
-
|
|
|
- formData.put("dateField_mfqf1fj4", zonedDateTime.toInstant().toEpochMilli());//单据日期
|
|
|
- formData.put("textField_mfqf1fj6",UtilMap.getString(map,"FCustomerID.FName"));//客户名称
|
|
|
-
|
|
|
- String F_QUXZ_AssistantFNumber = UtilMap.getString(map, "F_QUXZ_Assistant.FNumber");
|
|
|
- String F_QUXZ_Assistant = "";
|
|
|
- switch (F_QUXZ_AssistantFNumber){
|
|
|
- case "01": F_QUXZ_Assistant = "正常订单";break;
|
|
|
- case "02": F_QUXZ_Assistant = "样机订单";break;
|
|
|
- case "03": F_QUXZ_Assistant = "租赁订单";break;
|
|
|
- case "04": F_QUXZ_Assistant = "维修订单";break;
|
|
|
- case "05": F_QUXZ_Assistant = "研发订单";break;
|
|
|
- case "06": F_QUXZ_Assistant = "服务订单";break;
|
|
|
- case "10": F_QUXZ_Assistant = "营销支持";break;
|
|
|
- case "JD": F_QUXZ_Assistant = "京东订单";break;
|
|
|
- case "SHZY": F_QUXZ_Assistant = "售后专用";break;
|
|
|
- case "TM": F_QUXZ_Assistant = "天猫订单";break;
|
|
|
- default:break;
|
|
|
- }
|
|
|
- formData.put("textField_mfqhmwpu", F_QUXZ_Assistant);//销售类型
|
|
|
-
|
|
|
- String fEntityFEntryID = UtilMap.getString(map, "FEntity_FEntryID");
|
|
|
- formData.put("textField_mfqf1fjm", fEntityFEntryID);//销售订单分录id
|
|
|
- formData.put("textField_mfqf1fj7", UtilMap.getString(map,"FMaterialId.FNumber"));//物料编码
|
|
|
- formData.put("textField_mfqf1fj8", UtilMap.getString(map,"FMaterialId.FName"));//物料名称
|
|
|
- formData.put("textField_mfqf1fj9", UtilMap.getString(map,"FMaterialId.FSpecification"));//物料规格
|
|
|
- formData.put("textField_mfqf1fk3", UtilMap.getString(map,"FMaterialId.F_QUXZ_Assistant"));//所属系列
|
|
|
- formData.put("textField_mfqf1fjb", UtilMap.getString(map,"FUnitID.FName"));//销售单位
|
|
|
- formData.put("numberField_mfqf1fjd", UtilMap.getDouble(map,"FQty"));//销售数量
|
|
|
- formData.put("textField_mfqf1fjh", UtilMap.getBoolean(map,"FIsFree") ? "是" : "否");//是否赠品
|
|
|
- formData.put("textField_mfqf1fjj", UtilMap.getString(map,"FStockID.FName"));//出货仓库
|
|
|
-
|
|
|
- String FHGZBDayFNumber = UtilMap.getString(map, "FHGZBDay.FNumber");
|
|
|
- String FHGZBDay = "";
|
|
|
- switch (FHGZBDayFNumber){
|
|
|
- case "01": FHGZBDay = "1年";break;
|
|
|
- case "02": FHGZBDay = "2年";break;
|
|
|
- case "03": FHGZBDay = "3年";break;
|
|
|
- case "04": FHGZBDay = "4年";break;
|
|
|
- case "05": FHGZBDay = "5年";break;
|
|
|
- case "06": FHGZBDay = "15";break;
|
|
|
- case "07": FHGZBDay = "27";break;
|
|
|
- default:break;
|
|
|
- }
|
|
|
- formData.put("textField_mfqhmwpv", FHGZBDay);//质保期
|
|
|
+ list.addAll(result);
|
|
|
+
|
|
|
+ startRow += limit;
|
|
|
+ }while (result.size() == limit);
|
|
|
+
|
|
|
+ for (Map map : list) {
|
|
|
+ Map formData = new HashMap();
|
|
|
+ String fBillNo = UtilMap.getString(map, "FBillNo");
|
|
|
+ formData.put("textField_mfqf1fj5", fBillNo);//单据编号
|
|
|
+
|
|
|
+ String fDate = UtilMap.getString(map, "FDate");
|
|
|
+ // 解析字符串为 LocalDateTime
|
|
|
+ LocalDateTime localDateTime = LocalDateTime.parse(fDate);
|
|
|
+ // 将 LocalDateTime 转换为 ZonedDateTime
|
|
|
+ ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
|
|
|
+
|
|
|
+ //localDateTime是当月的第几周
|
|
|
+ int week = localDateTime.get(WeekFields.ISO.weekOfWeekBasedYear());
|
|
|
+
|
|
|
+ formData.put("dateField_mfqf1fj4", zonedDateTime.toInstant().toEpochMilli());//单据日期
|
|
|
+ formData.put("textField_mfqf1fj6",UtilMap.getString(map,"FCustomerID.FName"));//客户名称
|
|
|
+
|
|
|
+ String F_QUXZ_AssistantFNumber = UtilMap.getString(map, "F_QUXZ_Assistant.FNumber");
|
|
|
+ String F_QUXZ_Assistant = "";
|
|
|
+ switch (F_QUXZ_AssistantFNumber){
|
|
|
+ case "01": F_QUXZ_Assistant = "正常订单";break;
|
|
|
+ case "02": F_QUXZ_Assistant = "样机订单";break;
|
|
|
+ case "03": F_QUXZ_Assistant = "租赁订单";break;
|
|
|
+ case "04": F_QUXZ_Assistant = "维修订单";break;
|
|
|
+ case "05": F_QUXZ_Assistant = "研发订单";break;
|
|
|
+ case "06": F_QUXZ_Assistant = "服务订单";break;
|
|
|
+ case "10": F_QUXZ_Assistant = "营销支持";break;
|
|
|
+ case "JD": F_QUXZ_Assistant = "京东订单";break;
|
|
|
+ case "SHZY": F_QUXZ_Assistant = "售后专用";break;
|
|
|
+ case "TM": F_QUXZ_Assistant = "天猫订单";break;
|
|
|
+ default:break;
|
|
|
+ }
|
|
|
+ formData.put("textField_mfqhmwpu", F_QUXZ_Assistant);//销售类型
|
|
|
+
|
|
|
+ String fEntityFEntryID = UtilMap.getString(map, "FEntity_FEntryID");
|
|
|
+ formData.put("textField_mfqf1fjm", fEntityFEntryID);//销售订单分录id
|
|
|
+ formData.put("textField_mfqf1fj7", UtilMap.getString(map,"FMaterialId.FNumber"));//物料编码
|
|
|
+ formData.put("textField_mfqf1fj8", UtilMap.getString(map,"FMaterialId.FName"));//物料名称
|
|
|
+ formData.put("textField_mfqf1fj9", UtilMap.getString(map,"FMaterialId.FSpecification"));//物料规格
|
|
|
+ formData.put("textField_mfqf1fk3", UtilMap.getString(map,"FMaterialId.F_QUXZ_Assistant"));//所属系列
|
|
|
+ formData.put("textField_mfqf1fjb", UtilMap.getString(map,"FUnitID.FName"));//销售单位
|
|
|
+ formData.put("numberField_mfqf1fjd", UtilMap.getDouble(map,"FQty"));//销售数量
|
|
|
+ formData.put("textField_mfqf1fjh", UtilMap.getBoolean(map,"FIsFree") ? "是" : "否");//是否赠品
|
|
|
+ formData.put("textField_mfqf1fjj", UtilMap.getString(map,"FStockID.FName"));//出货仓库
|
|
|
+
|
|
|
+ String FHGZBDayFNumber = UtilMap.getString(map, "FHGZBDay.FNumber");
|
|
|
+ String FHGZBDay = "";
|
|
|
+ switch (FHGZBDayFNumber){
|
|
|
+ case "01": FHGZBDay = "1年";break;
|
|
|
+ case "02": FHGZBDay = "2年";break;
|
|
|
+ case "03": FHGZBDay = "3年";break;
|
|
|
+ case "04": FHGZBDay = "4年";break;
|
|
|
+ case "05": FHGZBDay = "5年";break;
|
|
|
+ case "06": FHGZBDay = "15";break;
|
|
|
+ case "07": FHGZBDay = "27";break;
|
|
|
+ default:break;
|
|
|
+ }
|
|
|
+ formData.put("textField_mfqhmwpv", FHGZBDay);//质保期
|
|
|
|
|
|
- formData.put("textField_mfqithiv",getWeekOfMonth(localDateTime));//所属周
|
|
|
+ formData.put("textField_mfqithiv",getWeekOfMonth(localDateTime));//所属周
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-F7DB6FC6E47949A98BDD3DC344B3CBC1V7HY")
|
|
|
+ .searchCondition(JSONObject.toJSONString(UtilMap.map("textField_mfqf1fj5, textField_mfqf1fjm",fBillNo,fEntityFEntryID)))
|
|
|
+ .formDataJson(JSONObject.toJSONString(formData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
+ }
|
|
|
|
|
|
+ //更新看板更新记录
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
- .formUuid("FORM-F7DB6FC6E47949A98BDD3DC344B3CBC1V7HY")
|
|
|
- .searchCondition(JSONObject.toJSONString(UtilMap.map("textField_mfqf1fj5, textField_mfqf1fjm",fBillNo,fEntityFEntryID)))
|
|
|
- .formDataJson(JSONObject.toJSONString(formData))
|
|
|
- .build(), YDConf.FORM_OPERATION.upsert);
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "已完成", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ }catch (Exception e){
|
|
|
+ //更新看板更新记录
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mhsjnn2r, dateField_mhsjnn2t", "异常", System.currentTimeMillis())))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+
|
|
|
+ throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|
|
|
|