质量异常、设备异常、其他异常生成异常单号

赵嘉伟 4 years ago
parent 0d49a71fe4
commit 86ee8a3f57

@ -157,8 +157,8 @@ public class AbnormalBillController {
* @return * @return
*/ */
@GetMapping("/init") @GetMapping("/init")
public R init(String messageType){ public R init(String messageType,String type){
return R.ok(abnormalBillService.init(messageType)); return R.ok(abnormalBillService.init(messageType,type));
} }
// @GetMapping("/findAllUserByUserGroup") // @GetMapping("/findAllUserByUserGroup")

@ -55,7 +55,7 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
/** /**
* *
*/ */
HashMap<String,Object> init(String messageType); HashMap<String,Object> init(String messageType,String type);
/** /**
* *
* @param abnormalBillDto * @param abnormalBillDto

@ -185,7 +185,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
} }
@Override @Override
public HashMap<String, Object> init(String messageType) { public HashMap<String, Object> init(String messageType,String type) {
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
String site = CommonMethods.getSite(); String site = CommonMethods.getSite();
//消息类型 //消息类型
@ -224,6 +224,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
if(nwaUsers != null){ if(nwaUsers != null){
hashMap.put("currentUser",nwaUsers.get(0).getFullName()); hashMap.put("currentUser",nwaUsers.get(0).getFullName());
} }
//初始化异常单号
String abnormalNo = null;
//生成异常单号
if("Q".equals(type)){//其他异常
abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_OTHER", 1, null).get(0);
}else if("Z".equals(type)){//质量异常
abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_QUALITY", 1, null).get(0);
}else if("S".equals(type)){//设备异常
abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_DEVICE", 1, null).get(0);
}
hashMap.put("abnormalNo",abnormalNo);
return hashMap; return hashMap;
} }
@ -370,16 +382,8 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime currentTime = LocalDateTime.now(); LocalDateTime currentTime = LocalDateTime.now();
String user = CommonMethods.getUser(); String user = CommonMethods.getUser();
if(StringUtil.isBlank(abnormalBill.getAbnormalNo())){ if(StringUtil.isBlank(abnormalBill.getAbnormalNo())){
String abnormalNo = null; throw BusinessException.build("异常单号不存在");
//生成异常单号
if("Q".equals(abnormalBill.getType())){//其他异常
abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_OTHER", 1, null).get(0);
}else if("Z".equals(abnormalBill.getType())){//质量异常
abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_QUALITY", 1, null).get(0);
}else if("S".equals(abnormalBill.getType())){//设备异常
abnormalNo = nextNumberHelper.getNextNumber(site, "ABNORMAL_DEVICE", 1, null).get(0);
}
abnormalBill.setAbnormalNo(abnormalNo);
} }

Loading…
Cancel
Save