|
@@ -676,14 +676,36 @@ public class JianhuiServiceImpl implements JianhuiService {
|
|
}
|
|
}
|
|
defectEntity.setFDefectiveQty((int) detail.get("numberField_m64pw0gu"));//不良数量
|
|
defectEntity.setFDefectiveQty((int) detail.get("numberField_m64pw0gu"));//不良数量
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //关联检验单
|
|
|
|
+ List<Object> linkEntity = new ArrayList<>();
|
|
|
|
+ Map link = new HashMap();
|
|
|
|
+ HashMap<String, Object> detailLink = new HashMap<>();
|
|
|
|
+
|
|
|
|
+// link.put("FEntity_Link_FFlowId", "");//业务流程图
|
|
|
|
+// link.put("FEntity_Link_FFlowLineId", "");//推进路线
|
|
|
|
+ link.put("FEntity_Link_FRuleId","QM_Inspect2DefProecess");//转换规则
|
|
|
|
+// link.put("FEntity_Link_FSTableId", "");//源单表内码
|
|
|
|
+ link.put("FEntity_Link_FSTableName","T_QM_INSPECTBILLENTRY");//源单表
|
|
|
|
+ link.put("FEntity_Link_FSBillId",formData.get("numberField_m86nq0a5"));//源单内码
|
|
|
|
+ link.put("FEntity_Link_FSId", detail.get("numberField_m873a1q2"));//源单分录内码
|
|
|
|
+
|
|
|
|
+ linkEntity.add(link);
|
|
|
|
+
|
|
|
|
+ defectEntity.setFEntity_Link(linkEntity);
|
|
|
|
+
|
|
|
|
+
|
|
FEntity.add(defectEntity);
|
|
FEntity.add(defectEntity);
|
|
}
|
|
}
|
|
|
|
|
|
model.setFEntity(FEntity);
|
|
model.setFEntity(FEntity);
|
|
|
|
|
|
- save.setModel(model);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ save.setModel(model);
|
|
|
|
+
|
|
try{
|
|
try{
|
|
K3CloudApi client = new K3CloudApi(initIden());
|
|
K3CloudApi client = new K3CloudApi(initIden());
|
|
//业务对象标识
|
|
//业务对象标识
|
|
@@ -722,10 +744,10 @@ public class JianhuiServiceImpl implements JianhuiService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- fail(e.getMessage());
|
|
|
|
|
|
+ McR.errorUnknown(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
- return null;
|
|
|
|
|
|
+ return McR.success();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -1084,12 +1106,13 @@ public class JianhuiServiceImpl implements JianhuiService {
|
|
billQuery.setFormId(formId);
|
|
billQuery.setFormId(formId);
|
|
billQuery.setFieldKeys("FBillNo");
|
|
billQuery.setFieldKeys("FBillNo");
|
|
billQuery.setStartRow(0);
|
|
billQuery.setStartRow(0);
|
|
- billQuery.setLimit(100);
|
|
|
|
|
|
+ billQuery.setLimit(2000);
|
|
|
|
|
|
List<Map> filterString = new ArrayList<>();
|
|
List<Map> filterString = new ArrayList<>();
|
|
filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FInspectResult","29","2","","","0"));
|
|
filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FInspectResult","29","2","","","0"));
|
|
filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));
|
|
filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FDocumentStatus","105","C","","","0"));
|
|
- filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","13","","","","0"));
|
|
|
|
|
|
+ filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","13","","","","0"));//审核日期为今天
|
|
|
|
+// filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","39","2025-03-10 00:00:00","","","0"));//审核日期大于2025-03-10 00:00:00
|
|
billQuery.setFilterString(filterString);
|
|
billQuery.setFilterString(filterString);
|
|
|
|
|
|
String resultJson = client.billQuery(JSONObject.toJSONString(billQuery));
|
|
String resultJson = client.billQuery(JSONObject.toJSONString(billQuery));
|
|
@@ -1113,36 +1136,29 @@ public class JianhuiServiceImpl implements JianhuiService {
|
|
.searchFieldJson(JSONObject.toJSONString(UtilMap.map("textField_m82j5zsd", fBillNo)))
|
|
.searchFieldJson(JSONObject.toJSONString(UtilMap.map("textField_m82j5zsd", fBillNo)))
|
|
.build(), YDConf.FORM_QUERY.retrieve_list).getData();
|
|
.build(), YDConf.FORM_QUERY.retrieve_list).getData();
|
|
|
|
|
|
- //没有则新增
|
|
|
|
if (data.isEmpty()){
|
|
if (data.isEmpty()){
|
|
View view = new View();
|
|
View view = new View();
|
|
view.setNumber(fBillNo);
|
|
view.setNumber(fBillNo);
|
|
String resultJson2 = client.view(formId,JSONObject.toJSONString(view));
|
|
String resultJson2 = client.view(formId,JSONObject.toJSONString(view));
|
|
-
|
|
|
|
RepoRet repoRet = gson.fromJson(resultJson2, RepoRet.class);
|
|
RepoRet repoRet = gson.fromJson(resultJson2, RepoRet.class);
|
|
if (isTrue(repoRet)){
|
|
if (isTrue(repoRet)){
|
|
Map result = (Map) repoRet.getResult().getResult();
|
|
Map result = (Map) repoRet.getResult().getResult();
|
|
-
|
|
|
|
Map formData = new HashMap();
|
|
Map formData = new HashMap();
|
|
-
|
|
|
|
formData.put("textField_m82j5zsd",fBillNo);//单据编号
|
|
formData.put("textField_m82j5zsd",fBillNo);//单据编号
|
|
|
|
+ formData.put("numberField_m86nmon3",result.get("Id"));//id
|
|
formData.put("textField_m82j5zse",getMultiLanguageTextName(result.get("FBillTypeID")));//单据类型
|
|
formData.put("textField_m82j5zse",getMultiLanguageTextName(result.get("FBillTypeID")));//单据类型
|
|
formData.put("textField_m82j5zsf",BUSINESS_TYPE.get(getString(result.get("BusinessType"))));//业务类型
|
|
formData.put("textField_m82j5zsf",BUSINESS_TYPE.get(getString(result.get("BusinessType"))));//业务类型
|
|
-
|
|
|
|
// 解析字符串为 LocalDateTime
|
|
// 解析字符串为 LocalDateTime
|
|
LocalDateTime localDateTime = LocalDateTime.parse(getString(result.get("FDate")), formatter);
|
|
LocalDateTime localDateTime = LocalDateTime.parse(getString(result.get("FDate")), formatter);
|
|
// 将 LocalDateTime 转换为 ZonedDateTime
|
|
// 将 LocalDateTime 转换为 ZonedDateTime
|
|
ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
|
|
ZonedDateTime zonedDateTime = localDateTime.atZone(ZoneId.systemDefault());
|
|
formData.put("dateField_m82j5zsk",zonedDateTime.toInstant().toEpochMilli());//单据日期
|
|
formData.put("dateField_m82j5zsk",zonedDateTime.toInstant().toEpochMilli());//单据日期
|
|
formData.put("textField_m82j5zsl",FDOCUMENTSTATUS.get(getString(result.get("DocumentStatus"))));//单据状态
|
|
formData.put("textField_m82j5zsl",FDOCUMENTSTATUS.get(getString(result.get("DocumentStatus"))));//单据状态
|
|
-
|
|
|
|
if (!((List<Map>)result.get("Description")).isEmpty()){
|
|
if (!((List<Map>)result.get("Description")).isEmpty()){
|
|
formData.put("textareaField_m82j5zsm",((List<Map>)result.get("Description")).get(0).get("Value"));//描述
|
|
formData.put("textareaField_m82j5zsm",((List<Map>)result.get("Description")).get(0).get("Value"));//描述
|
|
}
|
|
}
|
|
-
|
|
|
|
List<Map> entityList = (List<Map>) result.get("Entity");
|
|
List<Map> entityList = (List<Map>) result.get("Entity");
|
|
List<Map> detailList = new ArrayList<>();
|
|
List<Map> detailList = new ArrayList<>();
|
|
-
|
|
|
|
for (Map entity : entityList) {
|
|
for (Map entity : entityList) {
|
|
Map detail = new HashMap();
|
|
Map detail = new HashMap();
|
|
detail.put("textField_m82j5zsp",getEntryNumber(entity.get("MaterialId")));//物料编码
|
|
detail.put("textField_m82j5zsp",getEntryNumber(entity.get("MaterialId")));//物料编码
|
|
@@ -1156,22 +1172,31 @@ public class JianhuiServiceImpl implements JianhuiService {
|
|
detail.put("numberField_m82j5zsu",entity.get("QualifiedQty"));//合格数
|
|
detail.put("numberField_m82j5zsu",entity.get("QualifiedQty"));//合格数
|
|
detail.put("numberField_m82j5zsv",entity.get("UnqualifiedQty"));//不合格数
|
|
detail.put("numberField_m82j5zsv",entity.get("UnqualifiedQty"));//不合格数
|
|
detail.put("textField_m82j5zsx",INSPECT_RESULT.get(getString(entity.get("InspectResult"))));//检验结果
|
|
detail.put("textField_m82j5zsx",INSPECT_RESULT.get(getString(entity.get("InspectResult"))));//检验结果
|
|
|
|
+ detail.put("numberField_m873a1q2",entity.get("Id"));//分录明细id
|
|
if (!((List<Map>)entity.get("Memo")).isEmpty()){
|
|
if (!((List<Map>)entity.get("Memo")).isEmpty()){
|
|
detail.put("textField_m82j5zsz",((List<Map>)entity.get("Memo")).get(0).get("Value"));//不良原因
|
|
detail.put("textField_m82j5zsz",((List<Map>)entity.get("Memo")).get(0).get("Value"));//不良原因
|
|
}
|
|
}
|
|
-
|
|
|
|
detailList.add(detail);
|
|
detailList.add(detail);
|
|
}
|
|
}
|
|
-
|
|
|
|
formData.put("tableField_m82j5zso",detailList);
|
|
formData.put("tableField_m82j5zso",detailList);
|
|
|
|
|
|
|
|
+
|
|
//新增数据
|
|
//新增数据
|
|
ydClient.operateData(YDParam.builder()
|
|
ydClient.operateData(YDParam.builder()
|
|
.formUuid("FORM-959B1CB0AF9F41A091DFDE1203D0C7B2FQBO")
|
|
.formUuid("FORM-959B1CB0AF9F41A091DFDE1203D0C7B2FQBO")
|
|
.formDataJson(JSONObject.toJSONString(formData))
|
|
.formDataJson(JSONObject.toJSONString(formData))
|
|
.build(), YDConf.FORM_OPERATION.create);
|
|
.build(), YDConf.FORM_OPERATION.create);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /*else {
|
|
|
|
+ //更新数据
|
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
|
+ .formInstId(getString(data.get(0).get("formInstanceId")))
|
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(formData))
|
|
|
|
+ .useLatestVersion(true).build(), YDConf.FORM_OPERATION.update);
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
return McR.errorUnknown(e.getMessage());
|
|
return McR.errorUnknown(e.getMessage());
|