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