|
|
@@ -2,8 +2,10 @@ package com.malk.minglei.service.impl.yida;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.malk.minglei.config.YidaApplicationsProperties;
|
|
|
+import com.malk.minglei.dto.EmployeeRosterInfo;
|
|
|
import com.malk.minglei.dto.ErpYidaPushMainData;
|
|
|
import com.malk.minglei.dto.ErpYidaPushRequest;
|
|
|
+import com.malk.minglei.service.employee.EmployeeRosterService;
|
|
|
import com.malk.minglei.service.yida.YidaFormPushHandler;
|
|
|
import com.malk.minglei.service.yida.YidaProcessOpenApiClient;
|
|
|
import com.malk.server.common.McException;
|
|
|
@@ -11,6 +13,8 @@ import com.malk.server.dingtalk.DDR_New;
|
|
|
import com.malk.server.dingtalk.DDConf;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.ObjectProvider;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -18,6 +22,7 @@ import java.time.LocalDate;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -25,7 +30,8 @@ import java.util.Map;
|
|
|
/**
|
|
|
* 检验情况审批流程(aqct300)ERP 推送到宜搭的处理器。
|
|
|
* <p>
|
|
|
- * 仅负责发起流程;交易对象编号、料件编号、表头不良数、检验位置等缺口字段按约定丢弃。
|
|
|
+ * 仅负责发起流程。抽样与结果的检验项目、缺点原因按分类码查中文说明,检验标准读取 qcbd002。
|
|
|
+ * 交易对象编号、表头不良数、计量检验的检验位置等缺口字段按约定丢弃。
|
|
|
*/
|
|
|
@Service
|
|
|
public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
@@ -55,19 +61,29 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
private static final String UNIT_FIELD_ID = "textField_mt87k1g2";
|
|
|
private static final String SPEC_FIELD_ID = "textField_mt80nq6v";
|
|
|
private static final String ITEM_NAME_FIELD_ID = "textField_mt82p08x";
|
|
|
+ /** 主表料件编号,对应 ERP mainData.qcba010。 */
|
|
|
+ private static final String ITEM_CODE_FIELD_ID = "textField_mvyzi1jb";
|
|
|
private static final String INSPECTION_UNIT_FIELD_ID = "textField_mt82p091";
|
|
|
private static final String PRODUCT_FEATURE_FIELD_ID = "textField_mt82p092";
|
|
|
private static final String JUDGEMENT_FIELD_ID = "textField_mt82p094";
|
|
|
private static final String INSPECTOR_NAME_FIELD_ID = "textField_mt87k1g4";
|
|
|
+ /** 检验员人员组件,写入花名册中的钉钉用户 ID。 */
|
|
|
+ private static final String INSPECTOR_FIELD_ID = "employeeField_mt87k1g9";
|
|
|
private static final String SEND_QTY_FIELD_ID = "numberField_mt87k1ga";
|
|
|
private static final String LOT_NO_FIELD_ID = "textField_mt87k1gb";
|
|
|
private static final String PASS_QTY_FIELD_ID = "numberField_mt87k1gc";
|
|
|
+ /** 检验项目应用分类。 */
|
|
|
+ private static final String INSPECTION_ITEM_CATEGORY = "1051";
|
|
|
+ /** 缺点原因应用分类。 */
|
|
|
+ private static final String DEFECT_REASON_CATEGORY = "1053";
|
|
|
|
|
|
private static final String TABLE1_FIELD_ID = "tableField_psd31ws6n";
|
|
|
private static final String T1_ENT_FIELD_ID = "textField_psd32acoo";
|
|
|
private static final String T1_DOC_NO_FIELD_ID = "textField_psd43y52l";
|
|
|
private static final String T1_SEQ_FIELD_ID = "textField_psd44ub6a";
|
|
|
private static final String T1_ITEM_FIELD_ID = "textField_psd45i4rr";
|
|
|
+ /** 抽样与结果的检验标准,取 qcbd_t.qcbd002。 */
|
|
|
+ private static final String T1_STANDARD_FIELD_ID = "textField_psd46kfhw";
|
|
|
private static final String T1_ITEM_DESC_FIELD_ID = "textField_psd47bc9z";
|
|
|
private static final String T1_SAMPLE_QTY_FIELD_ID = "numberField_psd48zc2c";
|
|
|
private static final String T1_DEFECT_COUNT_FIELD_ID = "numberField_psd492g6k";
|
|
|
@@ -79,6 +95,8 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
private static final String T2_DOC_NO_FIELD_ID = "textField_psd4eu9ds";
|
|
|
private static final String T2_SEQ_FIELD_ID = "textField_psd4fqqt8";
|
|
|
private static final String T2_REASON_FIELD_ID = "textField_psd4ge7ws";
|
|
|
+ /** 缺点原因子表的检验项目,按 qcbe001 查分类 1053 的中文说明。 */
|
|
|
+ private static final String T2_ITEM_FIELD_ID = "textField_psd4hbe3f";
|
|
|
private static final String T2_QTY_FIELD_ID = "numberField_psd4ipqfh";
|
|
|
private static final String T2_REMARK_FIELD_ID = "textField_psd4jg5l7";
|
|
|
private static final String T2_BAD_QTY_FIELD_ID = "numberField_psd4klpby";
|
|
|
@@ -114,9 +132,32 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
private final DDConf dingTalkConfiguration;
|
|
|
private final YidaApplicationsProperties applications;
|
|
|
private final LocalFormDepartmentEnricher departmentEnricher;
|
|
|
+ private final Aqct300ReferenceLookup referenceLookup;
|
|
|
+ private final EmployeeRosterService employeeRosterService;
|
|
|
|
|
|
/**
|
|
|
- * 创建检验情况审批推送处理器。
|
|
|
+ * 创建检验情况审批推送处理器。字典库不可用时仍发起流程,名称字段保留原编号。
|
|
|
+ *
|
|
|
+ * @param yidaProcessOpenApiClient 宜搭流程 OpenAPI 客户端
|
|
|
+ * @param dingTalkConfiguration 钉钉应用配置
|
|
|
+ * @param applications 宜搭应用配置
|
|
|
+ * @param departmentEnricher 部门公司和负责人填充组件
|
|
|
+ * @param referenceLookupProvider T100 编号翻译
|
|
|
+ * @param employeeRosterService 员工花名册,用于把检验员工号换成姓名和钉钉用户 ID
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ public Aqct300FormPushHandler(YidaProcessOpenApiClient yidaProcessOpenApiClient,
|
|
|
+ DDConf dingTalkConfiguration,
|
|
|
+ YidaApplicationsProperties applications,
|
|
|
+ LocalFormDepartmentEnricher departmentEnricher,
|
|
|
+ ObjectProvider<Aqct300ReferenceLookup> referenceLookupProvider,
|
|
|
+ EmployeeRosterService employeeRosterService) {
|
|
|
+ this(yidaProcessOpenApiClient, dingTalkConfiguration, applications, departmentEnricher,
|
|
|
+ referenceLookupProvider.getIfAvailable(), employeeRosterService);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建不查询 T100 字典的检验情况审批推送处理器。
|
|
|
*
|
|
|
* @param yidaProcessOpenApiClient 宜搭流程 OpenAPI 客户端
|
|
|
* @param dingTalkConfiguration 钉钉应用配置
|
|
|
@@ -127,10 +168,49 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
DDConf dingTalkConfiguration,
|
|
|
YidaApplicationsProperties applications,
|
|
|
LocalFormDepartmentEnricher departmentEnricher) {
|
|
|
+ this(yidaProcessOpenApiClient, dingTalkConfiguration, applications, departmentEnricher,
|
|
|
+ (Aqct300ReferenceLookup) null, (EmployeeRosterService) null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建可注入编号翻译的检验情况审批推送处理器。
|
|
|
+ *
|
|
|
+ * @param yidaProcessOpenApiClient 宜搭流程 OpenAPI 客户端
|
|
|
+ * @param dingTalkConfiguration 钉钉应用配置
|
|
|
+ * @param applications 宜搭应用配置
|
|
|
+ * @param departmentEnricher 部门公司和负责人填充组件
|
|
|
+ * @param referenceLookup T100 编号翻译,为空时名称字段保留原编号
|
|
|
+ */
|
|
|
+ Aqct300FormPushHandler(YidaProcessOpenApiClient yidaProcessOpenApiClient,
|
|
|
+ DDConf dingTalkConfiguration,
|
|
|
+ YidaApplicationsProperties applications,
|
|
|
+ LocalFormDepartmentEnricher departmentEnricher,
|
|
|
+ Aqct300ReferenceLookup referenceLookup) {
|
|
|
+ this(yidaProcessOpenApiClient, dingTalkConfiguration, applications, departmentEnricher, referenceLookup, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建可注入编号翻译和花名册的检验情况审批推送处理器。
|
|
|
+ *
|
|
|
+ * @param yidaProcessOpenApiClient 宜搭流程 OpenAPI 客户端
|
|
|
+ * @param dingTalkConfiguration 钉钉应用配置
|
|
|
+ * @param applications 宜搭应用配置
|
|
|
+ * @param departmentEnricher 部门公司和负责人填充组件
|
|
|
+ * @param referenceLookup T100 编号翻译,为空时名称字段保留原编号
|
|
|
+ * @param employeeRosterService 员工花名册,为空时不翻译检验员
|
|
|
+ */
|
|
|
+ Aqct300FormPushHandler(YidaProcessOpenApiClient yidaProcessOpenApiClient,
|
|
|
+ DDConf dingTalkConfiguration,
|
|
|
+ YidaApplicationsProperties applications,
|
|
|
+ LocalFormDepartmentEnricher departmentEnricher,
|
|
|
+ Aqct300ReferenceLookup referenceLookup,
|
|
|
+ EmployeeRosterService employeeRosterService) {
|
|
|
this.yidaProcessOpenApiClient = yidaProcessOpenApiClient;
|
|
|
this.dingTalkConfiguration = dingTalkConfiguration;
|
|
|
this.applications = applications;
|
|
|
this.departmentEnricher = departmentEnricher;
|
|
|
+ this.referenceLookup = referenceLookup;
|
|
|
+ this.employeeRosterService = employeeRosterService;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -205,26 +285,29 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
putIfNotBlank(formData, ENTERPRISE_FIELD_ID, mainData.get("qcbaent"));
|
|
|
putIfNotBlank(formData, DOC_NO_FIELD_ID, docNo);
|
|
|
putIfNotBlank(formData, QCBADOCNO_FIELD_ID, docNo);
|
|
|
- putIfNotBlank(formData, INSPECTION_TYPE_FIELD_ID, mainData.get("qcba000"));
|
|
|
+ putIfNotBlank(formData, INSPECTION_TYPE_FIELD_ID, toInspectionType(mainData.get("qcba000")));
|
|
|
putIfNotBlank(formData, DOC_DATE_FIELD_ID, toDateMillis(mainData.get("qcbadocdt")));
|
|
|
putIfNotBlank(formData, SOURCE_QTY_FIELD_ID, toDecimal(mainData.get("qcba008")));
|
|
|
putIfNotBlank(formData, UNIT_FIELD_ID, mainData.get("qcba009"));
|
|
|
putIfNotBlank(formData, SPEC_FIELD_ID, mainData.get("imaal004"));
|
|
|
putIfNotBlank(formData, ITEM_NAME_FIELD_ID, mainData.get("imaal003"));
|
|
|
+ putIfNotBlank(formData, ITEM_CODE_FIELD_ID, mainData.get("qcba010"));
|
|
|
putIfNotBlank(formData, INSPECTION_UNIT_FIELD_ID, mainData.get("qcba016"));
|
|
|
putIfNotBlank(formData, PRODUCT_FEATURE_FIELD_ID, mainData.get("qcba012"));
|
|
|
- putIfNotBlank(formData, JUDGEMENT_FIELD_ID, mainData.get("qcba022"));
|
|
|
- putIfNotBlank(formData, INSPECTOR_NAME_FIELD_ID, mainData.get("qcba024"));
|
|
|
+ putIfNotBlank(formData, JUDGEMENT_FIELD_ID, toJudgementResult(mainData.get("qcba022")));
|
|
|
+ putInspector(formData, mainData.get("qcba024"));
|
|
|
putIfNotBlank(formData, SEND_QTY_FIELD_ID, toDecimal(mainData.get("qcba017")));
|
|
|
putIfNotBlank(formData, LOT_NO_FIELD_ID, mainData.get("qcba034"));
|
|
|
putIfNotBlank(formData, PASS_QTY_FIELD_ID, toDecimal(mainData.get("qcba023")));
|
|
|
|
|
|
+ String enterprise = toText(firstNonBlank(mainData.get("qcbaent"), mainData.get("gs"), mainData.get("ent")));
|
|
|
+ Map<String, String> referenceCache = new HashMap<String, String>();
|
|
|
Map<String, Object> detailWrapper = objectToMap(request.getDetailData());
|
|
|
- List<Map<String, Object>> table1 = toTable1Rows(toMapRows(detailWrapper.get("detailData1")));
|
|
|
+ List<Map<String, Object>> table1 = toTable1Rows(toMapRows(detailWrapper.get("detailData1")), enterprise, referenceCache);
|
|
|
if (!table1.isEmpty()) {
|
|
|
formData.put(TABLE1_FIELD_ID, table1);
|
|
|
}
|
|
|
- List<Map<String, Object>> table2 = toTable2Rows(toMapRows(detailWrapper.get("detailData2")));
|
|
|
+ List<Map<String, Object>> table2 = toTable2Rows(toMapRows(detailWrapper.get("detailData2")), enterprise, referenceCache);
|
|
|
if (!table2.isEmpty()) {
|
|
|
formData.put(TABLE2_FIELD_ID, table2);
|
|
|
}
|
|
|
@@ -240,16 +323,22 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 映射子表1(检验项目判定)。
|
|
|
+ * 映射子表1(抽样与结果)。检验项目用 qcbd001 查分类 1051 的中文说明,检验标准取 qcbd002。
|
|
|
*/
|
|
|
- private List<Map<String, Object>> toTable1Rows(List<Map<String, Object>> sourceRows) {
|
|
|
+ private List<Map<String, Object>> toTable1Rows(List<Map<String, Object>> sourceRows,
|
|
|
+ String enterprise,
|
|
|
+ Map<String, String> referenceCache) {
|
|
|
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();
|
|
|
for (Map<String, Object> source : sourceRows) {
|
|
|
Map<String, Object> row = new LinkedHashMap<String, Object>();
|
|
|
+ String itemCode = toText(source.get("qcbd001"));
|
|
|
putIfNotBlank(row, T1_ENT_FIELD_ID, source.get("qcbdent"));
|
|
|
putIfNotBlank(row, T1_DOC_NO_FIELD_ID, source.get("qcbddocno"));
|
|
|
putIfNotBlank(row, T1_SEQ_FIELD_ID, source.get("qcbdseq"));
|
|
|
- putIfNotBlank(row, T1_ITEM_FIELD_ID, source.get("qcbd001"));
|
|
|
+ putIfNotBlank(row, T1_ITEM_FIELD_ID, firstNonBlank(
|
|
|
+ classificationName(referenceCache, enterprise, INSPECTION_ITEM_CATEGORY, itemCode), itemCode));
|
|
|
+ putIfNotBlank(row, T1_STANDARD_FIELD_ID, inspectionStandard(referenceCache, enterprise,
|
|
|
+ toText(source.get("qcbddocno")), toText(source.get("qcbdseq"))));
|
|
|
putIfNotBlank(row, T1_ITEM_DESC_FIELD_ID, source.get("oocql004"));
|
|
|
putIfNotBlank(row, T1_SAMPLE_QTY_FIELD_ID, toDecimal(source.get("qcbd009")));
|
|
|
putIfNotBlank(row, T1_DEFECT_COUNT_FIELD_ID, toDecimal(source.get("qcbd010")));
|
|
|
@@ -263,16 +352,21 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 映射子表2(缺点原因)。
|
|
|
+ * 映射子表2(缺点原因)。缺点原因和检验项目都用 qcbe001 查分类 1053 的中文说明。
|
|
|
*/
|
|
|
- private List<Map<String, Object>> toTable2Rows(List<Map<String, Object>> sourceRows) {
|
|
|
+ private List<Map<String, Object>> toTable2Rows(List<Map<String, Object>> sourceRows,
|
|
|
+ String enterprise,
|
|
|
+ Map<String, String> referenceCache) {
|
|
|
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();
|
|
|
for (Map<String, Object> source : sourceRows) {
|
|
|
Map<String, Object> row = new LinkedHashMap<String, Object>();
|
|
|
+ String reasonCode = toText(source.get("qcbe001"));
|
|
|
+ String reasonName = classificationName(referenceCache, enterprise, DEFECT_REASON_CATEGORY, reasonCode);
|
|
|
putIfNotBlank(row, T2_ENT_FIELD_ID, source.get("qcbeent"));
|
|
|
putIfNotBlank(row, T2_DOC_NO_FIELD_ID, source.get("qcbedocno"));
|
|
|
putIfNotBlank(row, T2_SEQ_FIELD_ID, source.get("qcbeseq"));
|
|
|
- putIfNotBlank(row, T2_REASON_FIELD_ID, source.get("qcbe001"));
|
|
|
+ putIfNotBlank(row, T2_REASON_FIELD_ID, firstNonBlank(reasonName, reasonCode));
|
|
|
+ putIfNotBlank(row, T2_ITEM_FIELD_ID, reasonName);
|
|
|
putIfNotBlank(row, T2_QTY_FIELD_ID, toDecimal(source.get("qcbe002")));
|
|
|
putIfNotBlank(row, T2_REMARK_FIELD_ID, source.get("qcbe003"));
|
|
|
putIfNotBlank(row, T2_BAD_QTY_FIELD_ID, toDecimal(source.get("qcbe004")));
|
|
|
@@ -283,6 +377,61 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 检验员工号 qcba024 查花名册:姓名写入检验员名称,钉钉用户 ID 写入检验员。
|
|
|
+ */
|
|
|
+ private void putInspector(Map<String, Object> formData, Object employeeNoValue) {
|
|
|
+ String employeeNo = toText(employeeNoValue);
|
|
|
+ if (employeeNo == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (employeeRosterService == null) {
|
|
|
+ throw new IllegalStateException("Employee roster service is not configured");
|
|
|
+ }
|
|
|
+ EmployeeRosterInfo employee = employeeRosterService.findByEmployeeNo(employeeNo);
|
|
|
+ if (employee == null) {
|
|
|
+ throw new IllegalArgumentException("aqct300 inspector employee not found: " + employeeNo);
|
|
|
+ }
|
|
|
+ putIfNotBlank(formData, INSPECTOR_NAME_FIELD_ID, employee.getUsername());
|
|
|
+ String dingtalkId = toText(employee.getDingtalkId());
|
|
|
+ if (dingtalkId == null) {
|
|
|
+ throw new IllegalArgumentException("aqct300 inspector employee has no DingTalk userId: " + employeeNo);
|
|
|
+ }
|
|
|
+ formData.put(INSPECTOR_FIELD_ID, Collections.singletonList(dingtalkId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同一张单据里重复编号只查一次。查不到时返回 null,调用方保留原编号。
|
|
|
+ */
|
|
|
+ private String classificationName(Map<String, String> cache, String enterprise, String category, String code) {
|
|
|
+ if (referenceLookup == null || isBlank(enterprise) || isBlank(code)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String key = "name|" + enterprise + "|" + category + "|" + code;
|
|
|
+ if (cache.containsKey(key)) {
|
|
|
+ return cache.get(key);
|
|
|
+ }
|
|
|
+ String name = referenceLookup.classificationName(enterprise, category, code);
|
|
|
+ cache.put(key, name);
|
|
|
+ return name;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按主表企业编号和抽样与结果行的单号、项次读取检验标准。
|
|
|
+ */
|
|
|
+ private String inspectionStandard(Map<String, String> cache, String enterprise, String docNo, String seq) {
|
|
|
+ if (referenceLookup == null || isBlank(enterprise) || isBlank(docNo) || isBlank(seq)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String key = "standard|" + enterprise + "|" + docNo + "|" + seq;
|
|
|
+ if (cache.containsKey(key)) {
|
|
|
+ return cache.get(key);
|
|
|
+ }
|
|
|
+ String standard = referenceLookup.inspectionStandard(enterprise, docNo, seq);
|
|
|
+ cache.put(key, standard);
|
|
|
+ return standard;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 映射子表3(计量检验);检验位置 {@code qcbd002} 无宜搭字段,丢弃。
|
|
|
*/
|
|
|
@@ -446,6 +595,70 @@ public class Aqct300FormPushHandler implements YidaFormPushHandler {
|
|
|
return isBlank(value) ? null : String.valueOf(value).trim();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * ERP 检验类型 qcba000 用数字,宜搭下拉使用检验类别名称。
|
|
|
+ */
|
|
|
+ private String toInspectionType(Object value) {
|
|
|
+ if (isBlank(value)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String code = String.valueOf(value).trim();
|
|
|
+ if (code.endsWith(".0")) {
|
|
|
+ code = code.substring(0, code.length() - 2);
|
|
|
+ }
|
|
|
+ if ("1".equals(code)) {
|
|
|
+ return "IQC";
|
|
|
+ }
|
|
|
+ if ("2".equals(code)) {
|
|
|
+ return "FQC";
|
|
|
+ }
|
|
|
+ if ("3".equals(code)) {
|
|
|
+ return "PQC";
|
|
|
+ }
|
|
|
+ if ("4".equals(code)) {
|
|
|
+ return "OQC";
|
|
|
+ }
|
|
|
+ if ("5".equals(code)) {
|
|
|
+ return "Inventory QC";
|
|
|
+ }
|
|
|
+ if ("6".equals(code)) {
|
|
|
+ return "RQC";
|
|
|
+ }
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ERP 判定结果 qcba022 用数字,宜搭字段使用中文结果。
|
|
|
+ */
|
|
|
+ private String toJudgementResult(Object value) {
|
|
|
+ if (isBlank(value)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String code = String.valueOf(value).trim();
|
|
|
+ if (code.endsWith(".0")) {
|
|
|
+ code = code.substring(0, code.length() - 2);
|
|
|
+ }
|
|
|
+ if ("0".equals(code)) {
|
|
|
+ return "检验中";
|
|
|
+ }
|
|
|
+ if ("1".equals(code)) {
|
|
|
+ return "合格";
|
|
|
+ }
|
|
|
+ if ("2".equals(code)) {
|
|
|
+ return "验退";
|
|
|
+ }
|
|
|
+ if ("3".equals(code)) {
|
|
|
+ return "返工";
|
|
|
+ }
|
|
|
+ if ("4".equals(code)) {
|
|
|
+ return "特采";
|
|
|
+ }
|
|
|
+ if ("5".equals(code)) {
|
|
|
+ return "报废";
|
|
|
+ }
|
|
|
+ return code;
|
|
|
+ }
|
|
|
+
|
|
|
private boolean isBlank(Object value) {
|
|
|
if (value == null) {
|
|
|
return true;
|