|
|
@ -246,16 +246,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
|
|
|
|
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
|
|
|
|
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
|
|
|
|
String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, null, null);
|
|
|
|
//判断设备异常是否有为处理完成的sfc
|
|
|
|
//判断设备异常是否有为处理完成的sfc
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getSfc()) ){
|
|
|
|
// if(!StringUtil.isBlank(abnormalBill.getSfc()) ){
|
|
|
|
List<String> status = new ArrayList<>();
|
|
|
|
// List<String> status = new ArrayList<>();
|
|
|
|
status.add(Constants.PROGRAM_CONFIRM);
|
|
|
|
// status.add(Constants.PROGRAM_CONFIRM);
|
|
|
|
status.add(Constants.CANCEL);
|
|
|
|
// status.add(Constants.CANCEL);
|
|
|
|
status.add(Constants.SHUT_DOWN);
|
|
|
|
// status.add(Constants.SHUT_DOWN);
|
|
|
|
List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
|
|
|
|
// List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
|
|
|
|
if(abnormalBillList.size() >= 1 ){
|
|
|
|
// if(abnormalBillList.size() >= 1 ){
|
|
|
|
throw BusinessException.build("设备异常有未处理完成的sfc");
|
|
|
|
// throw BusinessException.build("设备异常有未处理完成的sfc");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|
this.saveOrUpdate(abnormalBill);
|
|
|
|
this.saveOrUpdate(abnormalBill);
|
|
|
|
//发送消息
|
|
|
|
//发送消息
|
|
|
@ -463,20 +463,29 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) {
|
|
|
|
public String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) {
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
//返回的消息
|
|
|
|
|
|
|
|
String message = "提报成功";
|
|
|
|
|
|
|
|
LocalDateTime currentTime = LocalDateTime.now();
|
|
|
|
LocalDateTime currentTime = LocalDateTime.now();
|
|
|
|
String user = CommonMethods.getUser();
|
|
|
|
String user = CommonMethods.getUser();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//return 返回的消息
|
|
|
|
|
|
|
|
String message = "提报成功";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//如果前台传过来的异常单为空的话,则抛出一个异常
|
|
|
|
//如果前台传过来的异常单为空的话,则抛出一个异常
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) {
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) {
|
|
|
|
throw BusinessException.build("异常单号不存在");
|
|
|
|
throw BusinessException.build("异常单号不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置异常单的handle
|
|
|
|
//设置异常单的handle
|
|
|
|
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
|
|
|
|
abnormalBill.setHandle(HandleEnum.ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo()));
|
|
|
|
|
|
|
|
//判断该异常单是否已经提交
|
|
|
|
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) != null &&
|
|
|
|
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) != null &&
|
|
|
|
!Constants.SHUT_DOWN.equals(abnormalBill.getStatus())){
|
|
|
|
!Constants.SHUT_DOWN.equals(abnormalBill.getStatus())){
|
|
|
|
throw BusinessException.build("该异常单已经提交,请清空后提交");
|
|
|
|
throw BusinessException.build("该异常单已经提交,请清空后提交");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 取消异常提报的更新
|
|
|
|
* 取消异常提报的更新
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -492,14 +501,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
// message = "保存成功";
|
|
|
|
// message = "保存成功";
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// abnormalBillDispose.setClosedUser(null);
|
|
|
|
// abnormalBillDispose.setClosedUser(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置异常单详细表的handle和abnormalBillBo
|
|
|
|
//设置异常单详细表的handle和abnormalBillBo
|
|
|
|
abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle());
|
|
|
|
abnormalBillDispose.setAbnormalBillBo(abnormalBill.getHandle());
|
|
|
|
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
|
|
|
|
abnormalBillDispose.setHandle(HandleEnum.ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置责任划分填报人和填报时间
|
|
|
|
//设置责任划分填报人和填报时间
|
|
|
|
abnormalBillDispose.setDutyUser(user);
|
|
|
|
abnormalBillDispose.setDutyUser(user);
|
|
|
|
abnormalBillDispose.setDutyDateTime(currentTime);
|
|
|
|
abnormalBillDispose.setDutyDateTime(currentTime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断原因分类是否为空,如果不为空,把它放进Z_ABNORMAL_CAUSE表里面
|
|
|
|
//判断原因分类是否为空,如果不为空,把它放进Z_ABNORMAL_CAUSE表里面
|
|
|
|
ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
|
|
|
|
ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
|
|
|
|
if(dutyCauseType != null && dutyCauseType.size() >= 1){
|
|
|
|
if(dutyCauseType != null && dutyCauseType.size() >= 1){
|
|
|
@ -525,6 +538,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断工序编码是否传递错误
|
|
|
|
//判断工序编码是否传递错误
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getOperation())){
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getOperation())){
|
|
|
|
QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<Operation>();
|
|
|
|
QueryWrapper<Operation> operationQueryWrapper = new QueryWrapper<Operation>();
|
|
|
@ -536,7 +550,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断设备传递的不良代码是否有误
|
|
|
|
|
|
|
|
|
|
|
|
//判断设备异常提报传递的不良代码是否有误
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getNcCode()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getNcCode()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
List<String> ncCodes = Arrays.asList(abnormalBill.getNcCode().split(","));
|
|
|
|
List<String> ncCodes = Arrays.asList(abnormalBill.getNcCode().split(","));
|
|
|
|
Integer length = ncCodeMapper.checkNcCode(ncCodes,site,"FAILURE");
|
|
|
|
Integer length = ncCodeMapper.checkNcCode(ncCodes,site,"FAILURE");
|
|
|
@ -571,17 +586,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置创建时间和更新时间
|
|
|
|
|
|
|
|
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){
|
|
|
|
|
|
|
|
abnormalBill.setCreatedDateTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBill.setCreatedUser(user);
|
|
|
|
|
|
|
|
abnormalBillDispose.setCreatedDataTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBillDispose.setCreatedUser(user);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
abnormalBill.setModifiedDateTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBill.setModifiedUser(user);
|
|
|
|
|
|
|
|
abnormalBillDispose.setModifiedDateTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBillDispose.setModifiedUser(user);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 判断SFC ,设备异常提交,sfc可以为空
|
|
|
|
* 判断SFC ,设备异常提交,sfc可以为空
|
|
|
@ -591,10 +595,14 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())) {
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())) {
|
|
|
|
throw BusinessException.build("产品条码不能为空");
|
|
|
|
throw BusinessException.build("产品条码不能为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//异常提报的时候,提报用户不可以为空
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//异常提报的时候,提报用户组不可以为空
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getReportSendUserGroup()) ) {
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getReportSendUserGroup()) ) {
|
|
|
|
throw BusinessException.build("提报用户组不能为空");
|
|
|
|
throw BusinessException.build("提报用户组不能为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }else if(!StringUtil.isBlank(abnormalBill.getSfc()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
// }else if(!StringUtil.isBlank(abnormalBill.getSfc()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
// AbnormalBill abnormalBill2 = new AbnormalBill();
|
|
|
|
// AbnormalBill abnormalBill2 = new AbnormalBill();
|
|
|
|
// abnormalBill2.setType(abnormalBill.getType());
|
|
|
|
// abnormalBill2.setType(abnormalBill.getType());
|
|
|
@ -617,12 +625,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断设备异常提交的设备是否正确
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getResrce()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getResrce()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()));
|
|
|
|
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()));
|
|
|
|
if(resrce == null){
|
|
|
|
if(resrce == null){
|
|
|
|
throw BusinessException.build("该设备编号不存在");
|
|
|
|
throw BusinessException.build("该设备编号不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断不良品数量和问题数量是否为正整数
|
|
|
|
//判断不良品数量和问题数量是否为正整数
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getNcQty()) && Integer.parseInt(abnormalBill.getNcQty()) < 0) {
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getNcQty()) && Integer.parseInt(abnormalBill.getNcQty()) < 0) {
|
|
|
@ -635,8 +647,11 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
throw BusinessException.build("问题数量或不良品数量必须为一个正整数");
|
|
|
|
throw BusinessException.build("问题数量或不良品数量必须为一个正整数");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断输入的责任划分用户组是否正确,并返回对应的用户
|
|
|
|
|
|
|
|
|
|
|
|
//判断输入的责任划分用户组是否正确,并返回对应的用户组下的用户
|
|
|
|
nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup());
|
|
|
|
nwaUserService.checkUserGroup(site,abnormalBillDispose.getDutySendUserGroup());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//插入原因分类和责任分类
|
|
|
|
//插入原因分类和责任分类
|
|
|
|
if(dutyTypes.size() > 0){
|
|
|
|
if(dutyTypes.size() > 0){
|
|
|
|
abnormalDutyService.saveOrUpdateBatch(dutyTypes);
|
|
|
|
abnormalDutyService.saveOrUpdateBatch(dutyTypes);
|
|
|
@ -649,6 +664,33 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
this.fileUpload(abnormalBill);
|
|
|
|
this.fileUpload(abnormalBill);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//判断该sfc是否已经提交过一个异常,如果已经提交,且状态不是方案确认、取消、闭环关闭则报错
|
|
|
|
|
|
|
|
List<String> status = new ArrayList<>();
|
|
|
|
|
|
|
|
status.add(Constants.PROGRAM_CONFIRM);
|
|
|
|
|
|
|
|
status.add(Constants.CANCEL);
|
|
|
|
|
|
|
|
status.add(Constants.SHUT_DOWN);
|
|
|
|
|
|
|
|
List<AbnormalBill> abnormalBillList = abnormalBillMapper.findCountBySfc(abnormalBill.getSite(), abnormalBill.getType(), abnormalBill.getSfc(), status);
|
|
|
|
|
|
|
|
String abnormalType = abnormalBill.getType().equals(Constants.ABNORMAL_QUALITY) ? "质量异常" :
|
|
|
|
|
|
|
|
abnormalBill.getType().equals(Constants.ABNORMAL_OTHER) ? "其他异常" : "设备异常" ;
|
|
|
|
|
|
|
|
if(abnormalBillList.size() >= 1 ){
|
|
|
|
|
|
|
|
throw BusinessException.build(abnormalType + "有未处理完成的产品条码(SFC)");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设置创建时间和更新时间
|
|
|
|
|
|
|
|
if(abnormalBillMapper.selectById(abnormalBill.getHandle()) == null){
|
|
|
|
|
|
|
|
abnormalBill.setCreatedDateTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBill.setCreatedUser(user);
|
|
|
|
|
|
|
|
abnormalBillDispose.setCreatedDataTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBillDispose.setCreatedUser(user);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
abnormalBill.setModifiedDateTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBill.setModifiedUser(user);
|
|
|
|
|
|
|
|
abnormalBillDispose.setModifiedDateTime(currentTime);
|
|
|
|
|
|
|
|
abnormalBillDispose.setModifiedUser(user);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// this.anomalyCreatedAndSendMessage(abnormalBill,null);
|
|
|
|
// this.anomalyCreatedAndSendMessage(abnormalBill,null);
|
|
|
|
return message;
|
|
|
|
return message;
|
|
|
|
|
|
|
|
|
|
|
|