|
|
|
@ -3,13 +3,23 @@ package com.foreverwin.mesnac.anomaly.controller;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.dto.NcCodesVO;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.dto.RouterBpmVO;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.service.FileUploadedService;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.utils.*;
|
|
|
|
|
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
|
|
|
|
|
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
|
|
|
|
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
|
|
|
|
|
import com.foreverwin.mesnac.common.util.StringUtil;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.dto.AbnormalRouterDto;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.dto.RouterStepDto;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.RouterStep;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.NcCodeService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.RouterService;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.RouterStepService;
|
|
|
|
|
import com.foreverwin.modular.core.util.FrontPage;
|
|
|
|
|
import com.foreverwin.modular.core.util.R;
|
|
|
|
|
import com.sap.me.frame.service.CommonMethods;
|
|
|
|
@ -20,6 +30,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
@ -44,6 +55,12 @@ public class AbnormalBillController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private NcCodeService ncCodeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RouterService routerService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RouterStepService routerStepService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据id查询
|
|
|
|
|
*
|
|
|
|
@ -320,6 +337,137 @@ public class AbnormalBillController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bpm获取工艺路线
|
|
|
|
|
* @param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/getRouting")
|
|
|
|
|
public ResultVo getRouting(RouterBpmVO routerBpmVO, String secretKey){
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setSite("1000");
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setUser("BPM_USER");
|
|
|
|
|
String site = com.foreverwin.modular.core.util.CommonMethods.getSite();
|
|
|
|
|
if (!yunBpmConfig.secretKey.equals(secretKey)){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,"秘钥错误");
|
|
|
|
|
}
|
|
|
|
|
try{
|
|
|
|
|
AbnormalRouterDto abnormalRouterDto = new AbnormalRouterDto();
|
|
|
|
|
abnormalRouterDto.setSite(site);
|
|
|
|
|
abnormalRouterDto.setItem(routerBpmVO.getItem());
|
|
|
|
|
List<AbnormalRouterDto> abnormalRouterDtoList = routerService.selectDisrouter(abnormalRouterDto);
|
|
|
|
|
ArrayList<RouterBpmVO> routerBpmVOs = new ArrayList<>();
|
|
|
|
|
for (AbnormalRouterDto routerDto : abnormalRouterDtoList) {
|
|
|
|
|
RouterBpmVO bpmVO = new RouterBpmVO();
|
|
|
|
|
bpmVO.setAbnormalNo(routerDto.getAbnormalNo());
|
|
|
|
|
bpmVO.setRouter(routerDto.getRouter());
|
|
|
|
|
bpmVO.setRouterType(routerDto.getRouterType());
|
|
|
|
|
bpmVO.setItemDescription(routerDto.getItemDescription());
|
|
|
|
|
bpmVO.setItemRevision(routerDto.getRouterRevision());
|
|
|
|
|
bpmVO.setPbDescription(routerDto.getPbDescription());
|
|
|
|
|
bpmVO.setRouterRevision(routerDto.getRouterRevision());
|
|
|
|
|
bpmVO.setPbDescription(routerDto.getPbDescription());
|
|
|
|
|
bpmVO.setItem(routerDto.getItem());
|
|
|
|
|
bpmVO.setShopOrder(routerBpmVO.getShopOrder());
|
|
|
|
|
bpmVO.setSite(routerDto.getSite());
|
|
|
|
|
RouterStep routerStep = new RouterStep();
|
|
|
|
|
routerStep.setRouterBo(routerDto.getRouterBo());
|
|
|
|
|
List<RouterStepDto> routerOperationByRouterBo = routerStepService.findRouterOperationByRouterBo(site, routerDto.getRouterBo());
|
|
|
|
|
bpmVO.setRouterStep(routerOperationByRouterBo);
|
|
|
|
|
routerBpmVOs.add(bpmVO);
|
|
|
|
|
}
|
|
|
|
|
return new ResultVo(ResultCode.SUCCESS,routerBpmVOs);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,R.failed(e.getMessage()).getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bpm售后异常提报
|
|
|
|
|
* @param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/bpmAbnormalReport")
|
|
|
|
|
public ResultVo bpmAbnormalReport(String secretKey, AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,
|
|
|
|
|
NcCodesVO ncCodesVO){
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setSite("1000");
|
|
|
|
|
String site = com.foreverwin.modular.core.util.CommonMethods.getSite();
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setUser("BPM_USER");
|
|
|
|
|
if (!yunBpmConfig.secretKey.equals(secretKey)){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,"秘钥错误");
|
|
|
|
|
}
|
|
|
|
|
try{
|
|
|
|
|
String abnormalNo = abnormalBillService.getNextNumber("Z");
|
|
|
|
|
abnormalBill.setBpmSubmit("true");
|
|
|
|
|
abnormalBill.setAbnormalNo(abnormalNo);
|
|
|
|
|
abnormalBill.setStatus("N");
|
|
|
|
|
abnormalBill.setSite(site);
|
|
|
|
|
abnormalBill.setType("Z");
|
|
|
|
|
abnormalBill.setReportFrom("J");
|
|
|
|
|
abnormalBill.setItemBo(HandleEnum.ITEM.getHandle(site,abnormalBill.getItemBo(),"A"));
|
|
|
|
|
abnormalBill.setReportSendUserGroup("BPM");
|
|
|
|
|
abnormalBillDispose.setSite(site);
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setUser("BPM_USER");
|
|
|
|
|
abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,
|
|
|
|
|
ncCodesVO.getNcGroupAndNcCodes(), ncCodesVO.getDutyCauseType(), ncCodesVO.getDutyType());
|
|
|
|
|
return new ResultVo(ResultCode.SUCCESS,abnormalBill);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,R.failed(e.getMessage()).getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bpm方案确认回传mes接口
|
|
|
|
|
* @param
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/bpmPlanConfirm")
|
|
|
|
|
public ResultVo bpmPlanConfirm(String secretKey,AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setSite("1000");
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setUser("BPM_USER");
|
|
|
|
|
String site = com.foreverwin.modular.core.util.CommonMethods.getSite();
|
|
|
|
|
if (!yunBpmConfig.secretKey.equals(secretKey)){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,"秘钥错误");
|
|
|
|
|
}else if (!StringUtil.isBlank(abnormalBillDispose.getResolveUser())){
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setUser(abnormalBillDispose.getResolveUser());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
|
|
|
|
|
abnormalBill.setBpmSubmit("true");
|
|
|
|
|
abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose);
|
|
|
|
|
return new ResultVo(ResultCode.SUCCESS,"BPM方案确认回传成功");
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,R.failed(e.getMessage()).getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* bpm判责提交
|
|
|
|
|
* @param abnormalBill
|
|
|
|
|
* @param abnormalBillDispose
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/bpmDutyConfirm")
|
|
|
|
|
public ResultVo bpmDutyConfirm(String secretKey,AbnormalBill abnormalBill,
|
|
|
|
|
AbnormalBillDispose abnormalBillDispose,NcCodesVO ncCodesVO){
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setSite("1000");
|
|
|
|
|
com.foreverwin.modular.core.util.CommonMethods.setUser("BPM_USER");
|
|
|
|
|
String site = com.foreverwin.modular.core.util.CommonMethods.getSite();
|
|
|
|
|
if (!yunBpmConfig.secretKey.equals(secretKey)){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,"秘钥错误");
|
|
|
|
|
}
|
|
|
|
|
try{
|
|
|
|
|
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
|
|
|
|
|
abnormalBill.setBpmSubmit("true");
|
|
|
|
|
abnormalBillDispose.setDutyCauseType(String.join(",",ncCodesVO.getDutyCauseType()));
|
|
|
|
|
abnormalBillService.dutyConfirm(abnormalBill,abnormalBillDispose,ncCodesVO.getDutyCauseType(),ncCodesVO.getDutyType());
|
|
|
|
|
return new ResultVo(ResultCode.SUCCESS,"BPM判责提交成功");
|
|
|
|
|
}catch(Exception e){
|
|
|
|
|
return new ResultVo(ResultCode.FAILED,R.failed(e.getMessage()).getMsg());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 质量异常响应检索
|
|
|
|
|
* @param abnormalBill
|
|
|
|
@ -335,6 +483,7 @@ public class AbnormalBillController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设备异常响应检索
|
|
|
|
|