|
|
@ -97,6 +97,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private SfcMapper sfcMapper;
|
|
|
|
private SfcMapper sfcMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private NcCodeMapper ncCodeMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -183,10 +186,10 @@ 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);
|
|
|
|
|
|
|
|
|
|
|
|
List<NcCode> ncByNG = ncCodeService.findNcByNG(abnormalBill.getMessageType(), abnormalBill.getNcCode());
|
|
|
|
// List<NcCode> ncByNG = ncCodeService.findNcByNG(abnormalBill.getMessageType(), abnormalBill.getNcCode());
|
|
|
|
if(ncByNG == null || ncByNG.size() <= 0){
|
|
|
|
// if(ncByNG == null || ncByNG.size() <= 0){
|
|
|
|
throw BusinessException.build("该消息类型下没有该不良代码");
|
|
|
|
// throw BusinessException.build("该消息类型下没有该不良代码");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
this.saveOrUpdate(abnormalBill);
|
|
|
|
this.saveOrUpdate(abnormalBill);
|
|
|
|
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|
return message;
|
|
|
|
return message;
|
|
|
@ -197,10 +200,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
//消息类型
|
|
|
|
//消息类型
|
|
|
|
if(!StringUtil.isBlank(messageType)){
|
|
|
|
if("Z".equals(type)){
|
|
|
|
List<NcCode> ncByNG = ncCodeService.findNcByNG(messageType,null);
|
|
|
|
List<NcCode> category = ncCodeService.findNcByCategory(messageType,null);
|
|
|
|
|
|
|
|
hashMap.put("ncByNG",category);
|
|
|
|
hashMap.put("ncByNG",ncByNG);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//工作中心
|
|
|
|
//工作中心
|
|
|
|
WorkCenter workCenter = new WorkCenter();
|
|
|
|
WorkCenter workCenter = new WorkCenter();
|
|
|
@ -405,7 +407,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
abnormalBillDispose.setDutyDateTime(currentTime);
|
|
|
|
abnormalBillDispose.setDutyDateTime(currentTime);
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
|
|
|
|
ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
|
|
|
|
//判断原因分类是否为空
|
|
|
|
//判断原因分类是否为空,如果不为空,把它放进Z_ABNORMAL_CAUSE表里面
|
|
|
|
if(dutyCauseType != null && dutyCauseType.size() >= 1){
|
|
|
|
if(dutyCauseType != null && dutyCauseType.size() >= 1){
|
|
|
|
for(String cause:dutyCauseType){
|
|
|
|
for(String cause:dutyCauseType){
|
|
|
|
AbnormalCause abnormalCause = new AbnormalCause();
|
|
|
|
AbnormalCause abnormalCause = new AbnormalCause();
|
|
|
@ -428,8 +430,21 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
causeTypes.add(abnormalCause);
|
|
|
|
causeTypes.add(abnormalCause);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 判断设备传递的不良代码是否有误
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getNcCode()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
|
|
|
|
List<String> ncCodes = Arrays.asList(abnormalBill.getNcCode().split(","));
|
|
|
|
|
|
|
|
Integer length = ncCodeMapper.checkNcCode(ncCodes,site,"FAILURE");
|
|
|
|
|
|
|
|
if(ncCodes.size() != length){
|
|
|
|
|
|
|
|
throw BusinessException.build("不良代码传递有误");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<AbnormalDuty> dutyTypes = new ArrayList<>();
|
|
|
|
ArrayList<AbnormalDuty> dutyTypes = new ArrayList<>();
|
|
|
|
//判断责任分类是否为空
|
|
|
|
//判断责任分类是否为空,如果不为空,把它放进Z_ABNORMAL_DUTY表里面
|
|
|
|
if(dutyType != null && dutyType.size() >= 1){
|
|
|
|
if(dutyType != null && dutyType.size() >= 1){
|
|
|
|
for(String duty:dutyType){
|
|
|
|
for(String duty:dutyType){
|
|
|
|
AbnormalDuty abnormalDuty = new AbnormalDuty();
|
|
|
|
AbnormalDuty abnormalDuty = new AbnormalDuty();
|
|
|
@ -465,24 +480,30 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
abnormalBillDispose.setModifiedDateTime(currentTime);
|
|
|
|
abnormalBillDispose.setModifiedDateTime(currentTime);
|
|
|
|
abnormalBillDispose.setModifiedUser(user);
|
|
|
|
abnormalBillDispose.setModifiedUser(user);
|
|
|
|
|
|
|
|
|
|
|
|
//判断SFC、设备编号、消息类型是否不正确或为空
|
|
|
|
/**
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getSfc()) && !"S".equals(abnormalBill.getType())){
|
|
|
|
* 判断SFC ,设备异常提交,sfc可以为空
|
|
|
|
|
|
|
|
* 设备编号
|
|
|
|
|
|
|
|
* 是否为空
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getSfc()) && !Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
throw BusinessException.build("产品条码不能为空");
|
|
|
|
throw BusinessException.build("产品条码不能为空");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if(StringUtil.isBlank(abnormalBill.getResrce())){
|
|
|
|
// if(StringUtil.isBlank(abnormalBill.getResrce())){
|
|
|
|
// throw BusinessException.build("设备编号不能为空");
|
|
|
|
// throw BusinessException.build("设备编号不能为空");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getMessageType())){
|
|
|
|
// if(!StringUtil.isBlank(abnormalBill.getMessageType())){
|
|
|
|
NcGroup messageType = ncGroupMapper.selectById(HandleEnum.NC_GROUP.getHandle(site, abnormalBill.getMessageType()));
|
|
|
|
// NcGroup messageType = ncGroupMapper.selectById(HandleEnum.NC_GROUP.getHandle(site, abnormalBill.getMessageType()));
|
|
|
|
if(messageType == null){
|
|
|
|
// if(messageType == null){
|
|
|
|
throw BusinessException.build("该消息类型不存在");
|
|
|
|
// throw BusinessException.build("该消息类型不存在");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getResrce()) && Constants.ABNORMAL_RESRCE.equals(abnormalBill.getType())){
|
|
|
|
|
|
|
|
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()));
|
|
|
|
|
|
|
|
if(resrce == null){
|
|
|
|
|
|
|
|
throw BusinessException.build("该设备编号不存在");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, abnormalBill.getResrce()));
|
|
|
|
|
|
|
|
// if(resrce == null){
|
|
|
|
|
|
|
|
// 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) {
|
|
|
@ -503,7 +524,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
if(causeTypes.size() > 0){
|
|
|
|
if(causeTypes.size() > 0){
|
|
|
|
abnormalCauseService.saveOrUpdateBatch(causeTypes);
|
|
|
|
abnormalCauseService.saveOrUpdateBatch(causeTypes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(StringUtil.isBlank(abnormalBill.getFileName())){
|
|
|
|
if(!StringUtil.isBlank(abnormalBill.getFileName())){
|
|
|
|
//放置图片
|
|
|
|
//放置图片
|
|
|
|
this.fileUpload(abnormalBill);
|
|
|
|
this.fileUpload(abnormalBill);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -626,16 +647,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
|
|
|
|
|
|
|
|
|
|
|
|
//判断工单,sfc,资源是否传递正确
|
|
|
|
//判断工单,sfc,资源是否传递正确
|
|
|
|
Sfc sfc1 = sfcMapper.selectById(HandleEnum.SFC.getHandle(site, sfc));
|
|
|
|
Sfc sfc1 = sfcMapper.selectById(HandleEnum.SFC.getHandle(site, sfc));
|
|
|
|
if(sfc == null){
|
|
|
|
if(sfc1 == null){
|
|
|
|
throw new BaseException("sfc传递有误");
|
|
|
|
throw new BaseException("sfc传递有误");
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
if(!HandleEnum.SHOP_ORDER.getHandle(site,shopOrder).equals(sfc1.getShopOrderBo())){
|
|
|
|
if(!HandleEnum.SHOP_ORDER.getHandle(site,shopOrder).equals(sfc1.getShopOrderBo())){
|
|
|
|
throw new BaseException("工单传递有误");
|
|
|
|
throw new BaseException("工单传递有误");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, resource));
|
|
|
|
// Resrce resrce = resrceMapper.selectById(HandleEnum.RESOURCE.getHandle(site, resource));
|
|
|
|
if(resrce == null){
|
|
|
|
// if(resrce == null){
|
|
|
|
throw new BaseException("资源传递有误");
|
|
|
|
// throw new BaseException("资源传递有误");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.saveOrUpdate(abnormalBill);
|
|
|
|
this.saveOrUpdate(abnormalBill);
|
|
|
|
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|