设备异常提报

赵嘉伟 4 years ago
parent 7805bc4595
commit 4d733abd4e

@ -232,6 +232,16 @@ public class AbnormalBillController {
return R.ok(abnormalBillService.anomalyReport(abnormalBill, abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType));
}
/**
*
* @param abnormalBill
* @return
*/
@GetMapping("/anomalyReportDevice")
public R anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
return R.ok(abnormalBillService.anomalyReportDevice(abnormalBill,abnormalBillDispose));
}
/**
*

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.time.LocalDateTime;

@ -47,4 +47,6 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
void cancelBrowse(String handle,String cancelBrowse);
String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose);
}

@ -143,6 +143,15 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
@Override
public String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose) {
this.generateAbnormalBill(abnormalBill,abnormalBillDispose,null,null);
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
return abnormalBill.getAbnormalNo();
}
@Override
public void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) {
String site = CommonMethods.getSite();
@ -174,7 +183,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
ArrayList<AbnormalCause> causeTypes = new ArrayList<>();
//判断原因分类是否为空
if(dutyCauseType.size() >= 1){
if(dutyCauseType != null && dutyCauseType.size() >= 1){
for(String cause:dutyCauseType){
AbnormalCause abnormalCause = new AbnormalCause();
String uuid = UUID.randomUUID().toString();
@ -198,7 +207,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
ArrayList<AbnormalDuty> dutyTypes = new ArrayList<>();
//判断责任分类是否为空
if(dutyType.size() >= 1){
if(dutyType != null && dutyType.size() >= 1){
for(String duty:dutyType){
AbnormalDuty abnormalDuty = new AbnormalDuty();
String uuid = UUID.randomUUID().toString();
@ -234,7 +243,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBillDispose.setModifiedUser(user);
//判断SFC、设备编号、消息类型是否不正确或为空
if(StringUtil.isBlank(abnormalBill.getSfc())){
if(StringUtil.isBlank(abnormalBill.getSfc()) && "S".equals(abnormalBill.getType())){
throw BusinessException.build("产品条码不能为空");
}
if(StringUtil.isBlank(abnormalBill.getResrce())){
@ -252,10 +261,10 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
//判断不良品数量和问题数量是否为正整数
try {
if(Integer.parseInt(abnormalBill.getNcQty()) < 0) {
if(!StringUtil.isBlank(abnormalBill.getNcQty()) && Integer.parseInt(abnormalBill.getNcQty()) < 0) {
throw BusinessException.build("不良品数量必须大于0");
}
if(Integer.parseInt(abnormalBill.getPbQty()) < 0){
if(!StringUtil.isBlank(abnormalBill.getPbQty()) && Integer.parseInt(abnormalBill.getPbQty()) < 0){
throw BusinessException.build("问题数量必须大于0");
}
}catch (NumberFormatException num){

Loading…
Cancel
Save