质量创建专检任务

master
philip 3 years ago
parent e7cbc73296
commit a9854cfc63

@ -8,21 +8,24 @@ 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.meapi.dto.NcCodeDto;
import com.foreverwin.mesnac.meapi.mapper.*;
@ -36,11 +39,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 +147,13 @@ 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;
@Override
@ -1255,6 +1262,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);
}
}
Loading…
Cancel
Save