质检问题统计表

master
赵嘉伟 3 years ago
parent 1319c54773
commit 84193aa065

@ -3,9 +3,11 @@ package com.foreverwin.mesnac.anomaly.service.impl;
import com.foreverwin.mesnac.anomaly.dto.IntegrationLogDto; import com.foreverwin.mesnac.anomaly.dto.IntegrationLogDto;
import com.foreverwin.mesnac.anomaly.mapper.ReportMapper; import com.foreverwin.mesnac.anomaly.mapper.ReportMapper;
import com.foreverwin.mesnac.anomaly.service.ReportService; import com.foreverwin.mesnac.anomaly.service.ReportService;
import com.foreverwin.mesnac.meapi.mapper.DataFieldListMapper;
import com.foreverwin.mesnac.meapi.model.DataField;
import com.foreverwin.mesnac.meapi.model.DataFieldList;
import com.foreverwin.mesnac.meapi.model.NcCode; import com.foreverwin.mesnac.meapi.model.NcCode;
import com.foreverwin.mesnac.meapi.model.NwaUser; import com.foreverwin.mesnac.meapi.model.NwaUser;
import com.foreverwin.mesnac.meapi.service.DataFieldListService;
import com.foreverwin.mesnac.meapi.service.NcCodeService; import com.foreverwin.mesnac.meapi.service.NcCodeService;
import com.foreverwin.mesnac.meapi.service.NwaUserService; import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.mesnac.meapi.util.StringUtils; import com.foreverwin.mesnac.meapi.util.StringUtils;
@ -36,7 +38,7 @@ public class ReportServiceImpl implements ReportService {
@Autowired @Autowired
private NwaUserService nwaUserService; private NwaUserService nwaUserService;
@Autowired @Autowired
private DataFieldListService dataFieldListService; private DataFieldListMapper dataFieldListMapper;
/** /**
* *
@ -132,10 +134,6 @@ public class ReportServiceImpl implements ReportService {
} }
maps.get(i).put("REPAIR_USERS_DESCRIPTION", repairUserDescription); maps.get(i).put("REPAIR_USERS_DESCRIPTION", repairUserDescription);
} }
return maps; return maps;
} }
@ -161,6 +159,87 @@ public class ReportServiceImpl implements ReportService {
paramMap.put("locale",LocaleContextHolder.getLocale().getLanguage()); paramMap.put("locale",LocaleContextHolder.getLocale().getLanguage());
List<Map<String, Object>> qualityInspectionReport = reportMapper.findQualityInspectionReport(paramMap); List<Map<String, Object>> qualityInspectionReport = reportMapper.findQualityInspectionReport(paramMap);
return null;
//原因分类
Map<String, List<DataFieldList>> dataFieldListMap = new HashMap<>();
DataField dataField = new DataField();
dataField.setSite(site);
dataField.setDataField("REASON_CATEGORY");
List<DataFieldList> dataFieldList = dataFieldListMapper.findDataFieldList(dataField);
if (dataFieldList != null && dataFieldList.size() > 0) {
dataFieldListMap = dataFieldList.stream().collect(Collectors.groupingBy(DataFieldList::getDataValue));
}
for (int i = 0; i < qualityInspectionReport.size(); i++) {
Map<String, Object> temporaryMap = qualityInspectionReport.get(i);
String dutyCauseType = (String) temporaryMap.get("DUTY_CAUSE_TYPE");
if (StringUtils.isBlank(dutyCauseType)) {
qualityInspectionReport.get(i).put("DUTY_CAUSE_TYPE_DESCRIPTION", "");
continue;
}
String[] dutyCauseTypeSplit = dutyCauseType.split(",");
StringBuilder dutyCauseTypeDescription = new StringBuilder();
for (int j = 0; j < dutyCauseTypeSplit.length; j++) {
dutyCauseTypeDescription.append(dataFieldListMap.get(dutyCauseTypeSplit[j]).get(0).getDescription()).append(";");
}
qualityInspectionReport.get(i).put("DUTY_CAUSE_TYPE_DESCRIPTION", dutyCauseTypeDescription);
}
//责任分类
dataField.setDataField("RESPONSIBILITY_TYPE");
dataFieldList = dataFieldListMapper.findDataFieldList(dataField);
if (dataFieldList != null && dataFieldList.size() > 0) {
dataFieldListMap = dataFieldList.stream().collect(Collectors.groupingBy(DataFieldList::getDataValue));
}
for (int i = 0; i < qualityInspectionReport.size(); i++) {
Map<String, Object> temporaryMap = qualityInspectionReport.get(i);
String dutyType = (String) temporaryMap.get("DUTY_TYPE");
if (StringUtils.isBlank(dutyType)) {
qualityInspectionReport.get(i).put("DUTY_TYPE_DESCRIPTION", "");
continue;
}
String[] dutyTypeSplit = dutyType.split(",");
StringBuilder dutyTypeDescription = new StringBuilder();
for (int j = 0; j < dutyTypeSplit.length; j++) {
dutyTypeDescription.append(dataFieldListMap.get(dutyTypeSplit[j]).get(0).getDescription()).append(";");
}
qualityInspectionReport.get(i).put("DUTY_TYPE_DESCRIPTION", dutyTypeDescription);
}
//责任部门
dataField.setDataField("RESPONSIBILITY_DEPARTMENT");
dataFieldList = dataFieldListMapper.findDataFieldList(dataField);
if (dataFieldList != null && dataFieldList.size() > 0) {
dataFieldListMap = dataFieldList.stream().collect(Collectors.groupingBy(DataFieldList::getDataValue));
}
for (int i = 0; i < qualityInspectionReport.size(); i++) {
Map<String, Object> temporaryMap = qualityInspectionReport.get(i);
String dutyDepart = (String) temporaryMap.get("DUTY_DEPART");
if (StringUtils.isBlank(dutyDepart)) {
qualityInspectionReport.get(i).put("DUTY_DEPART_DESCRIPTION", "");
continue;
}
String[] dutyDepartSplit = dutyDepart.split(",");
StringBuilder dutyDepartDescription = new StringBuilder();
for (int j = 0; j < dutyDepartSplit.length; j++) {
dutyDepartDescription.append(dataFieldListMap.get(dutyDepartSplit[j]).get(0).getDescription()).append(";");
}
qualityInspectionReport.get(i).put("DUTY_DEPART_DESCRIPTION", dutyDepartDescription);
}
return qualityInspectionReport;
} }
} }

@ -225,9 +225,9 @@
</if> </if>
</select> </select>
<select id="findQualityInspectionReport" resultType="map"> <select id="findQualityInspectionReport" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT zab.CREATED_DATE_TIME CREATED_DATE_TIME,zab.ABNORMAL_NO ABNORMAL_NO, SELECT zab.CREATED_DATE_TIME,zab.ABNORMAL_NO ABNORMAL_NO,
zab.PRODUCT_CATEGORY PRODUCT_CATEGORY, dflt.DATA_TAG PRODUCT_CATEGORY,
CASE WHEN zab.DISCOVER = 'Z' THEN '自制' CASE WHEN zab.DISCOVER = 'Z' THEN '自制'
WHEN zab.DISCOVER = 'W' THEN '外协' WHEN zab.DISCOVER = 'W' THEN '外协'
WHEN zab.DISCOVER = 'D' THEN '到货' WHEN zab.DISCOVER = 'D' THEN '到货'
@ -239,7 +239,6 @@
CASE WHEN zab."TYPE" = 'Z' THEN '质量异常' CASE WHEN zab."TYPE" = 'Z' THEN '质量异常'
WHEN zab."TYPE" = 'Q' THEN '其他异常' WHEN zab."TYPE" = 'Q' THEN '其他异常'
WHEN zab."TYPE" = 'S' THEN '设备异常' END "TYPE", WHEN zab."TYPE" = 'S' THEN '设备异常' END "TYPE",
zab.REPORT_SEND_USER_GROUP INSPECTOR , zab.REPORT_SEND_USER_GROUP INSPECTOR ,
zab.PB_GRADE PB_GRADE , zab.PB_GRADE PB_GRADE ,
zabd.PRINCIPAL_USER PRINCIPAL_USER, zabd.PRINCIPAL_USER PRINCIPAL_USER,
@ -257,7 +256,9 @@
CASE WHEN (zabd.ABNORMAL_METHOD ='F' AND zab.SHOP_ORDER IS NOT NULL) THEN TO_CHAR(so.QTY_TO_BUILD,'9999') CASE WHEN (zabd.ABNORMAL_METHOD ='F' AND zab.SHOP_ORDER IS NOT NULL) THEN TO_CHAR(so.QTY_TO_BUILD,'9999')
WHEN zabd.ABNORMAL_METHOD = 'F' THEN TO_CHAR(zab.PB_QTY,'9999') ELSE '' END NUMBERS, WHEN zabd.ABNORMAL_METHOD = 'F' THEN TO_CHAR(zab.PB_QTY,'9999') ELSE '' END NUMBERS,
zsd.EMPLOYEE_DESCRIPTION DISPATCH_USER ,ot.DESCRIPTION OPERATION , zsd.EMPLOYEE_DESCRIPTION DISPATCH_USER ,ot.DESCRIPTION OPERATION ,
r2.RESRCE RESRCE,r2.DESCRIPTION RESRCE_DESCRIPTION,zsd.RESOURCE_TYPE RESOURCE_TYPE,rt.DESCRIPTION RESOURCE_TYPE_DESCRIPTION r2.RESRCE RESRCE,r2.DESCRIPTION RESRCE_DESCRIPTION,zsd.RESOURCE_TYPE RESOURCE_TYPE,
rt.DESCRIPTION RESOURCE_TYPE_DESCRIPTION,zabd.DUTY_CAUSE_TYPE DUTY_CAUSE_TYPE,zabd.DUTY_TYPE DUTY_TYPE,
zabd.DUTY_DEPART DUTY_DEPART
FROM Z_ABNORMAL_BILL zab FROM Z_ABNORMAL_BILL zab
INNER JOIN Z_ABNORMAL_BILL_DISPOSE zabd ON zab.HANDLE = zabd.ABNORMAL_BILL_BO INNER JOIN Z_ABNORMAL_BILL_DISPOSE zabd ON zab.HANDLE = zabd.ABNORMAL_BILL_BO
LEFT JOIN Z_ABNORMAL_NC_CODE zanc ON zab.HANDLE = zanc.ABNORMAL_BILL_BO LEFT JOIN Z_ABNORMAL_NC_CODE zanc ON zab.HANDLE = zanc.ABNORMAL_BILL_BO
@ -265,6 +266,9 @@
LEFT JOIN NC_CODE_T nct ON nct.NC_CODE_BO = nc.HANDLE AND nct.LOCALE = #{locale} LEFT JOIN NC_CODE_T nct ON nct.NC_CODE_BO = nc.HANDLE AND nct.LOCALE = #{locale}
INNER JOIN ITEM i ON i.HANDLE = zab.ITEM_BO INNER JOIN ITEM i ON i.HANDLE = zab.ITEM_BO
LEFT JOIN ITEM_T it ON it.ITEM_BO = i.HANDLE AND it.LOCALE = #{locale} LEFT JOIN ITEM_T it ON it.ITEM_BO = i.HANDLE AND it.LOCALE = #{locale}
INNER JOIN DATA_FIELD df ON df.DATA_FIELD = 'PRODUCT_CATEGORY'
LEFT JOIN DATA_FIELD_LIST dfl ON dfl.DATA_FIELD_BO = df.HANDLE AND dfl.DATA_VALUE = zab.PRODUCT_CATEGORY
LEFT JOIN DATA_FIELD_LIST_T dflt ON dflt.DATA_FIELD_LIST_BO = dfl.HANDLE AND dflt.LOCALE = #{locale}
LEFT JOIN CUSTOM_FIELDS mapNo ON mapNo."ATTRIBUTE" = 'DWG_NO' AND mapNo.HANDLE = i.HANDLE LEFT JOIN CUSTOM_FIELDS mapNo ON mapNo."ATTRIBUTE" = 'DWG_NO' AND mapNo.HANDLE = i.HANDLE
LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zab.SHOP_ORDER AND so.SITE = zab.SITE LEFT JOIN SHOP_ORDER so ON so.SHOP_ORDER = zab.SHOP_ORDER AND so.SITE = zab.SITE
LEFT JOIN ROUTER r ON r.HANDLE = zabd.ROUTER_BO LEFT JOIN ROUTER r ON r.HANDLE = zabd.ROUTER_BO
@ -278,7 +282,37 @@
LEFT JOIN OPERATION_T ot ON ot.OPERATION_BO = o.HANDLE AND ot.LOCALE = #{locale} LEFT JOIN OPERATION_T ot ON ot.OPERATION_BO = o.HANDLE AND ot.LOCALE = #{locale}
LEFT JOIN RESRCE r2 ON r2.RESRCE = zsd.RESRCE AND r2.SITE = zab.SITE LEFT JOIN RESRCE r2 ON r2.RESRCE = zsd.RESRCE AND r2.SITE = zab.SITE
LEFT JOIN RESOURCE_TYPE rt ON rt.RESOURCE_TYPE = zsd.RESOURCE_TYPE AND rt.SITE = zab.SITE LEFT JOIN RESOURCE_TYPE rt ON rt.RESOURCE_TYPE = zsd.RESOURCE_TYPE AND rt.SITE = zab.SITE
WHERE zab."TYPE" ='Z' LEFT JOIN WORK_CENTER wc ON wc.WORK_CENTER = SUBSTR(o.OPERATION,1,INSTR(o.OPERATION,'_')-1) AND wc.site = zab.SITE
<where>
zab."TYPE" ='Z'
<if test="workCenter != null and workCenter != ''">
AND wc.WORK_CENTER LIKE '%${workCenter}%'
</if>
<if test="itemNumber != null and itemNumber != ''">
AND itemNumber.VALUE = #{itemNumber}
</if>
<if test="productCategory != null and productCategory != ''">
AND (dflt.DATA_TAG = #{productCategory} OR
zab.PRODUCT_CATEGORY = #{productCategory}
)
</if>
<if test="operation != null and operation != ''">
AND (o.OPERATION LIKE '%${operation}%' OR
ot.DESCRIPTION LIKE '%${operation}%'
)
</if>
<if test="resrce != null and resrce != ''">
AND (r2.RESRCE LIKE '%${resrce}%' OR
r2.DESCRIPTION LIKE '%${resrce}%'
)
</if>
<if test="startDateTime != null">
AND zab.CREATED_DATE_TIME &gt;= TO_DATE(#{startDateTime},'YYYY-MM-DD')
</if>
<if test="endDateTime != null">
AND zab.CREATED_DATE_TIME &lt;= TO_DATE(#{endDateTime},'YYYY-MM-DD')
</if>
</where>
GROUP BY zab.CREATED_DATE_TIME ,zab.ABNORMAL_NO , GROUP BY zab.CREATED_DATE_TIME ,zab.ABNORMAL_NO ,
i.ITEM ,it.DESCRIPTION ,itemNumber.VALUE , i.ITEM ,it.DESCRIPTION ,itemNumber.VALUE ,
mapNo.VALUE ,zab.PB_DESCRIPTION ,zsd.EMPLOYEE_DESCRIPTION , mapNo.VALUE ,zab.PB_DESCRIPTION ,zsd.EMPLOYEE_DESCRIPTION ,
@ -288,6 +322,7 @@
zabd.CLOSED_DATE_TIME ,zab.NC_QTY ,zab.PB_QTY ,zab.SHOP_ORDER,so.QTY_TO_BUILD, zabd.CLOSED_DATE_TIME ,zab.NC_QTY ,zab.PB_QTY ,zab.SHOP_ORDER,so.QTY_TO_BUILD,
zsd.EMPLOYEE_DESCRIPTION ,ot.DESCRIPTION , zsd.EMPLOYEE_DESCRIPTION ,ot.DESCRIPTION ,
r2.RESRCE,r2.DESCRIPTION,zsd.RESOURCE_TYPE, r2.RESRCE,r2.DESCRIPTION,zsd.RESOURCE_TYPE,
rt.DESCRIPTION,zab.PRODUCT_CATEGORY rt.DESCRIPTION, dflt.DATA_TAG,zabd.DUTY_CAUSE_TYPE,zabd.DUTY_TYPE ,zabd.DUTY_DEPART
ORDER BY zab.CREATED_DATE_TIME DESC
</select> </select>
</mapper> </mapper>

@ -2,6 +2,7 @@ package com.foreverwin.mesnac.meapi.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.meapi.model.DataField;
import com.foreverwin.mesnac.meapi.model.DataFieldList; import com.foreverwin.mesnac.meapi.model.DataFieldList;
import com.foreverwin.mesnac.meapi.service.DataFieldListService; import com.foreverwin.mesnac.meapi.service.DataFieldListService;
import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.FrontPage;
@ -119,5 +120,8 @@ public class DataFieldListController {
return R.ok(dataFieldListService.removeByIds(ids)); return R.ok(dataFieldListService.removeByIds(ids));
} }
@GetMapping("findDataFieldList")
public R findDataFieldList(DataField dataField){
return R.ok(dataFieldListService.findDataFieldList(dataField));
}
} }

@ -28,4 +28,6 @@ public interface DataFieldListMapper extends BaseMapper<DataFieldList> {
String findDataFieldListByDataField(@Param("dataField") DataField dataField,@Param("locale")String locale); String findDataFieldListByDataField(@Param("dataField") DataField dataField,@Param("locale")String locale);
List<DataFieldList> findDataFieldList(@Param("dataField") DataField dataField);
} }

@ -33,4 +33,6 @@ public interface DataFieldListService extends IService<DataFieldList> {
* @return * @return
*/ */
List<DataField> findDataFieldListById(DataField dataField); List<DataField> findDataFieldListById(DataField dataField);
List<DataFieldList> findDataFieldList(DataField dataField);
} }

@ -27,4 +27,5 @@ public interface DataFieldService extends IService<DataField> {
List<DataField> selectList(DataField dataField); List<DataField> selectList(DataField dataField);
} }

@ -49,4 +49,9 @@ public class DataFieldListServiceImpl extends ServiceImpl<DataFieldListMapper, D
String locale = LocaleContextHolder.getLocale().getLanguage(); String locale = LocaleContextHolder.getLocale().getLanguage();
return dataFieldListMapper.findDataFieldListById(dataField,locale); return dataFieldListMapper.findDataFieldListById(dataField,locale);
} }
@Override
public List<DataFieldList> findDataFieldList(DataField dataField) {
return dataFieldListMapper.findDataFieldList(dataField);
}
} }

@ -359,7 +359,6 @@
<if test="dataField.dataField != null and dataField.dataField != ''"> <if test="dataField.dataField != null and dataField.dataField != ''">
AND DF.DATA_FIELD = #{dataField.dataField} AND DF.DATA_FIELD = #{dataField.dataField}
</if> </if>
</if> </if>
</where> </where>
</select> </select>
@ -389,4 +388,24 @@
</if> </if>
</where> </where>
</select> </select>
<select id="findDataFieldList" resultMap="BaseResultMap">
SELECT DFL.DATA_VALUE DATA_VALUE,DFLT.DATA_TAG DESCRIPTION
FROM DATA_FIELD DF
INNER JOIN DATA_FIELD_LIST DFL ON DF.HANDLE = DFL.DATA_FIELD_BO
LEFT JOIN DATA_FIELD_LIST_T DFLT ON DFL.HANDLE = DFLT.DATA_FIELD_LIST_BO AND DFLT.LOCALE = 'zh'
<where>
<if test="dataField != null">
<if test="dataField.handle != null and dataField.handle != ''">
DF.HANDLE = #{dataField.handle}
</if>
<if test="dataField.site != null and dataField.site != ''">
AND DF.SITE = #{dataField.site}
</if>
<if test="dataField.dataField != null and dataField.dataField != ''">
AND DF.DATA_FIELD = #{dataField.dataField}
</if>
</if>
</where>
</select>
</mapper> </mapper>

Loading…
Cancel
Save