Merge remote-tracking branch 'origin/master'

master
philip 3 years ago
commit ab3476a2bc

@ -80,6 +80,10 @@
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>quality</artifactId>
</dependency>
<dependency>
<groupId>com.foreverwin.mesnac</groupId>
<artifactId>listener</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-quartz</artifactId>

@ -95,4 +95,19 @@ public class ReportController {
return R.failed(e.getMessage());
}
}
/**
*
* @param paramMap
* @return
*/
@PostMapping("/findQualityInspectionReport")
public R findQualityInspectionReport(@RequestBody(required = false) Map paramMap) {
try{
List<Map<String, Object>> result = reportService.findQualityInspectionReport(paramMap);
return R.ok(result);
}catch (Exception e){
return R.failed(e.getMessage());
}
}
}

@ -27,4 +27,11 @@ public interface ReportMapper {
List<Map<String, Object>> findInspectionTask(Map paramMap);
/**
*
* @param paramMap
* @return
*/
List<Map<String,Object>> findQualityInspectionReport(Map paramMap);
}

@ -26,4 +26,11 @@ public interface ReportService {
* @return
*/
List<Map<String, Object>> findInspectionTask(Map paramMap);
/**
*
* @param paramMap
* @return
*/
List<Map<String, Object>> findQualityInspectionReport(Map paramMap);
}

@ -27,6 +27,7 @@ import com.foreverwin.mesnac.common.service.*;
import com.foreverwin.mesnac.common.util.ActiveMQUtil;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.listener.mapper.UsrMapper;
import com.foreverwin.mesnac.meapi.dto.NcCodeDto;
import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.model.*;
@ -155,6 +156,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private InspectionTaskService inspectionTaskService;
@Autowired
private UsrMapper usrMapper;
@Override
public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) {
@ -1056,12 +1060,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(nwaUsers != null && nwaUsers.size() <= 0){
throw new BaseException("消息发送失败,发送的用户组下面没有用户");
}
List<String> customFieldByUserId = usrMapper.findCustomFieldByUserId(site, nwaUsers);
if(customFieldByUserId != null && customFieldByUserId.size() <= 0){
throw new BaseException("消息发送失败,发送的用户组下面的自定义数据没有维护");
}
StringBuilder sendUsers = new StringBuilder();
for (int i = 0; i < nwaUsers.size(); i++) {
if(i == (nwaUsers.size() - 1)){
sendUsers.append(nwaUsers.get(i).getUserName());
for (int i = 0; i < customFieldByUserId.size(); i++) {
if(i == (customFieldByUserId.size() - 1)){
sendUsers.append(customFieldByUserId.get(i));
}else{
sendUsers.append(nwaUsers.get(i).getUserName()).append("|");
sendUsers.append(customFieldByUserId.get(i)).append("|");
}
}
activeMQUtil.wechatSendMessage(sendUsers.toString(),abnormalMessage.getContent());

@ -5,6 +5,7 @@ import com.foreverwin.mesnac.anomaly.mapper.ReportMapper;
import com.foreverwin.mesnac.anomaly.service.ReportService;
import com.foreverwin.mesnac.meapi.model.NcCode;
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.NwaUserService;
import com.foreverwin.mesnac.meapi.util.StringUtils;
@ -34,6 +35,8 @@ public class ReportServiceImpl implements ReportService {
private ReportMapper reportMapper;
@Autowired
private NwaUserService nwaUserService;
@Autowired
private DataFieldListService dataFieldListService;
/**
*
@ -145,4 +148,19 @@ public class ReportServiceImpl implements ReportService {
public List<Map<String, Object>> findInspectionTask(Map paramMap) {
return reportMapper.findInspectionTask(paramMap);
}
/**
*
* @param paramMap
* @return
*/
@Override
public List<Map<String, Object>> findQualityInspectionReport(Map paramMap) {
String site = CommonMethods.getSite();
paramMap.put("site",site);
paramMap.put("locale",LocaleContextHolder.getLocale().getLanguage());
List<Map<String, Object>> qualityInspectionReport = reportMapper.findQualityInspectionReport(paramMap);
return null;
}
}

@ -199,4 +199,70 @@
AND ZT.MODIFIED_DATE_TIME &lt;= TO_DATE(#{startToDate}|| '23:59:59', 'YYYY-MM-DD HH24:MI:SS')
</if>
</select>
<select id="findQualityInspectionReport" resultType="map">
SELECT zab.CREATED_DATE_TIME CREATED_DATE_TIME,zab.ABNORMAL_NO ABNORMAL_NO,
zab.PRODUCT_CATEGORY PRODUCT_CATEGORY,
CASE WHEN zab.DISCOVER = 'Z' THEN '自制'
WHEN zab.DISCOVER = 'W' THEN '外协'
WHEN zab.DISCOVER = 'D' THEN '到货'
WHEN zab.DISCOVER = 'K' THEN '客户'
ELSE ''
END DISCOVER ,
i.ITEM ITEM ,it.DESCRIPTION ITEM_DESCRIPTION,itemNumber.VALUE ITEM_NUMBER,
mapNo.VALUE MAP_NO,zab.PB_DESCRIPTION PB_DESCRIPTION,zsd.EMPLOYEE_DESCRIPTION OPERATOR,
CASE WHEN zab."TYPE" = 'Z' THEN '质量异常'
WHEN zab."TYPE" = 'Q' THEN '其他异常'
WHEN zab."TYPE" = 'S' THEN '设备异常' END "TYPE",
zab.REPORT_SEND_USER_GROUP INSPECTOR ,
zab.PB_GRADE PB_GRADE ,
zabd.PRINCIPAL_USER PRINCIPAL_USER,
LISTAGG(nct.DESCRIPTION , ';') WITHIN GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE_DESCRIPTION,
zabd.DUTY_CAUSE_DESCRIPTION DUTY_CAUSE_DESCRIPTION,zabd.BEFORE_MEASURE BEFORE_MEASURE,
CASE WHEN zabd.ABNORMAL_METHOD = 'X' THEN '线下换料'
WHEN zabd.ABNORMAL_METHOD = 'S' THEN '试装'
WHEN zabd.ABNORMAL_METHOD = 'R' THEN '让步放心'
WHEN zabd.ABNORMAL_METHOD = 'C' THEN '报废'
WHEN zabd.ABNORMAL_METHOD = 'P' THEN '配作'
WHEN zabd.ABNORMAL_METHOD = 'F' THEN '返修'
ELSE ''
END ABNORMAL_METHOD,zabd.RESOLVE_REMARK RESOLVE_REMARK,zabd.RESOLVE_USER RESOLVE_USER,
zabd.CLOSED_DATE_TIME CLOSED_DATE_TIME,zab.NC_QTY NC_QTY,zab.PB_QTY PB_QTY,
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,
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
FROM Z_ABNORMAL_BILL zab
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 NC_CODE nc ON zanc.NC_CODE = nc.NC_CODE AND nc.SITE = zab.SITE
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
LEFT JOIN ITEM_T it ON it.ITEM_BO = i.HANDLE AND it.LOCALE = #{locale}
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 ROUTER r ON r.HANDLE = zabd.ROUTER_BO
LEFT JOIN CUSTOM_FIELDS itemNumber ON itemNumber.HANDLE = so.HANDLE AND itemNumber."ATTRIBUTE" = 'ITEM_NUMBER'
LEFT JOIN SFC s ON s.SFC = zab.SFC AND s.SITE = zab.SITE
LEFT JOIN SFC_ROUTING SR ON SR.SFC_BO = S.HANDLE
LEFT JOIN SFC_ROUTER ST ON ST.SFC_ROUTING_BO = SR.HANDLE
LEFT JOIN SFC_STEP SS ON SS.SFC_ROUTER_BO = ST.HANDLE AND (SS.QTY_IN_QUEUE > 0 OR SS.QTY_IN_WORK > 0)
LEFT JOIN Z_SFC_DISPATCH zsd ON zsd.DISPATCH_NO = S.SFC || '-' || SS.STEP_ID
LEFT JOIN OPERATION o ON o.OPERATION = zsd.OPERATION AND o.SITE = zab.SITE AND o.CURRENT_REVISION ='true'
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 RESOURCE_TYPE rt ON rt.RESOURCE_TYPE = zsd.RESOURCE_TYPE AND rt.SITE = zab.SITE
WHERE zab."TYPE" ='Z'
GROUP BY zab.CREATED_DATE_TIME ,zab.ABNORMAL_NO ,
i.ITEM ,it.DESCRIPTION ,itemNumber.VALUE ,
mapNo.VALUE ,zab.PB_DESCRIPTION ,zsd.EMPLOYEE_DESCRIPTION ,
zab."TYPE" ,zab.REPORT_SEND_USER_GROUP ,zabd.DUTY_DEPART ,zabd.PRINCIPAL_USER,DISCOVER ,
zab.PB_GRADE,zabd.DUTY_CAUSE_DESCRIPTION ,zabd.BEFORE_MEASURE,ABNORMAL_METHOD,
zabd.RESOLVE_REMARK ,zabd.RESOLVE_USER ,
zabd.CLOSED_DATE_TIME ,zab.NC_QTY ,zab.PB_QTY ,zab.SHOP_ORDER,so.QTY_TO_BUILD,
zsd.EMPLOYEE_DESCRIPTION ,ot.DESCRIPTION ,
r2.RESRCE,r2.DESCRIPTION,zsd.RESOURCE_TYPE,
rt.DESCRIPTION,zab.PRODUCT_CATEGORY
</select>
</mapper>

@ -11,6 +11,8 @@ public class UsrDto {
private String fullName;
private String wechatId;
public String getUserName() {
return userName;
}
@ -26,4 +28,12 @@ public class UsrDto {
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getWechatId() {
return wechatId;
}
public void setWechatId(String wechatId) {
this.wechatId = wechatId;
}
}

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.foreverwin.mesnac.common.dto.UsrDto;
import com.foreverwin.mesnac.listener.model.SysUser;
import com.foreverwin.mesnac.listener.model.Usr;
import com.foreverwin.mesnac.meapi.model.NwaUser;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@ -27,4 +28,7 @@ public interface UsrMapper extends BaseMapper<Usr> {
IPage findPage(IPage page,@Param("site")String site,@Param("user")String user);
List<String> findCustomFieldByUserId(@Param("site")String site, @Param("userList")List<NwaUser> userList);
}

@ -32,6 +32,7 @@
<resultMap id="usrDto" type="com.foreverwin.mesnac.common.dto.UsrDto">
<result column="USER_NAME" property="userName"/>
<result column="FULL_NAME" property="fullName"/>
<result column="WECHAT_ID" property="wechatId"/>
</resultMap>
@ -636,4 +637,18 @@
)
</if>
</select>
<select id="findCustomFieldByUserId" resultType="String">
SELECT cf.VALUE WECHAT_ID
FROM USR u
LEFT JOIN CUSTOM_FIELDS cf ON cf.HANDLE = u.HANDLE
<where>
u.SITE = #{site} AND
cf.VALUE IS NOT NULL AND
u.USER_ID IN
<foreach item="item" index="index" collection="userList" separator="," open="(" close=")">
UPPER(#{item.userName})
</foreach>
</where>
</select>
</mapper>

Loading…
Cancel
Save