Merge remote-tracking branch 'mesnac/master'

master
Leon 3 years ago
commit 6d3caa44d5

@ -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);
}

@ -8,22 +8,26 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto;
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillDisposeMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalCauseMapper;
import com.foreverwin.mesnac.anomaly.model.*;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.model.AbnormalNcCode;
import com.foreverwin.mesnac.anomaly.model.UploadPictures;
import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.ScrapDto;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.dto.UsrDto;
import com.foreverwin.mesnac.common.enums.AnomalyConstant;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.helper.NextNumberHelper;
import com.foreverwin.mesnac.common.mapper.MessageMapper;
import com.foreverwin.mesnac.common.model.InspectionTask;
import com.foreverwin.mesnac.common.model.Message;
import com.foreverwin.mesnac.common.service.AnomalyService;
import com.foreverwin.mesnac.common.service.MessageService;
import com.foreverwin.mesnac.common.service.UserService;
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.*;
@ -36,11 +40,13 @@ import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*;
@ -142,11 +148,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
private DataFieldListMapper dataFieldListMapper;
@Autowired
private AbnormalCauseMapper abnormalCauseMapper;
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private SplitSfcService splitSfcService;
@Autowired
private InspectionTaskService inspectionTaskService;
@Autowired
private UsrMapper usrMapper;
@Override
@ -1049,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());
@ -1255,6 +1270,57 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
return scrapDtoBySfc;
}
void creatInspectionTask(String site,String inspectionTaskBo,String sfc,String stepId){
InspectionTask byId = inspectionTaskService.getById(inspectionTaskBo);
InspectionTask newInspectionTask = new InspectionTask();
if (StringUtil.notBlank(inspectionTaskBo)){
if (byId==null){
throw new BaseException("不存在的专检任务");
}
BeanUtils.copyProperties(byId, newInspectionTask);
String newTaskNo = "P_" + DateUtil.getTimeString();
String handle = HandleEnum.INSPECTION_TASK.getHandle(site, newTaskNo);
newInspectionTask.setHandle(handle);
newInspectionTask.setTaskNo(newTaskNo);
newInspectionTask.setStatus(Constants.INSPECTION_TASK_STATUS_NEW);
newInspectionTask.setResult(null);
newInspectionTask.setComments(null);
newInspectionTask.setCreatedDateTime(LocalDateTime.now());
newInspectionTask.setModifiedDateTime(LocalDateTime.now());
}else {
String handle = "InspectionTaskBO:" + site + "," + UUID.randomUUID().toString();
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String taskNo = "P_" + dateFormat1.format(date);
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
sfcDispatchDto.setSfc(sfc);
sfcDispatchDto.setStepId(stepId);
SfcDispatchDto sfcDispatchBySfc = sfcDispatchCommonService.findSfcDispatchBySfc(sfcDispatchDto);
InspectionTask task = new InspectionTask();
task.setHandle(handle);
task.setSite(site);
task.setCategory(Constants.INSPECTION_TYPE_P);
task.setTaskNo(taskNo);
task.setStatus(Constants.INSPECTION_TASK_STATUS_NEW);
task.setResult(null);
task.setDescription("专检检验任务");
task.setInspectionItemBo( null);
task.setShopOrder(sfcDispatchBySfc.getShopOrder());
task.setWorkCenter(sfcDispatchBySfc.getWorkCenter());
task.setSfc(sfc);
task.setOperation(sfcDispatchBySfc.getOperation());
task.setStepId(stepId);
task.setResrce(sfcDispatchBySfc.getResrce());
task.setCreateUser(CommonMethods.getUser());
task.setCreatedDateTime(LocalDateTime.now());
task.setModifyUser(CommonMethods.getUser());
task.setModifiedDateTime(LocalDateTime.now());
task.setSfcDispatchBo(sfcDispatchBySfc.getHandle());
task.setSfc(sfc);
}
inspectionTaskService.save(newInspectionTask);
}
}

@ -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>

@ -3,9 +3,11 @@ package com.foreverwin.mesnac.production.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.service.InspectionTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.ExceptionUtil;
import com.foreverwin.mesnac.common.util.StringUtil;
@ -15,7 +17,6 @@ import com.foreverwin.mesnac.meapi.model.Router;
import com.foreverwin.mesnac.meapi.service.RouterService;
import com.foreverwin.mesnac.meapi.service.RouterStepService;
import com.foreverwin.mesnac.meapi.service.ShopOrderService;
import com.foreverwin.mesnac.meapi.service.WorkCenterService;
import com.foreverwin.mesnac.production.dto.SplitSfcDto;
import com.foreverwin.mesnac.production.mapper.SfcCrossMapper;
import com.foreverwin.mesnac.production.mapper.SplitSfcMapper;
@ -36,9 +37,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.*;
/**
* <p>
*
@ -57,7 +57,7 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
@Autowired
private SfcDispatchCommonService sfcDispatchCommonService;
@Autowired
private WorkCenterService workCenterService;
private InspectionTaskService inspectionTaskService;
@Autowired
private ShopOrderService shopOrderService;
@Autowired
@ -260,6 +260,17 @@ public class SplitSfcServiceImpl extends ServiceImpl<SplitSfcMapper, SplitSfc> i
throw new BaseException("处置工艺路线没有步骤");
}
sfcDispatchCommonService.saveSplitSfcDispatch(site, CommonMethods.getUser(),"R", sfcData.getShopOrder(), sfc, operation, sfcDispatchBySfc.getStepId(),newSfc, maxRevisionRouter.getHandle(), sfcData.getStepSequence());
//创建专检任务
Map<String, Object> paramMap=new HashMap<>();
paramMap.put("CATEGORY", Constants.INSPECTION_TYPE_P);
paramMap.put("SFC",sfc );
paramMap.put("SHOP_ORDER",sfcDispatchBySfc.getShopOrder());
paramMap.put("OPERATION",sfcDispatchBySfc.getOperation());
paramMap.put("STEP_ID",sfcDispatchBySfc.getStepId());;
paramMap.put("WORK_CENTER",sfcDispatchBySfc.getWorkCenter());
paramMap.put("RESRCE",sfcDispatchBySfc.getResrce());
paramMap.put("SFC_DISPATCH_DETAIL_BO",sfcDispatchBySfc.getHandle());
inspectionTaskService.createNewTask(paramMap);
}
SplitSfc splitSfc=new SplitSfc();
splitSfc.setHandle(HandleEnum.SPLIT_SFC.getHandle(site,newSfc));

Loading…
Cancel
Save