Commit fe9cb2e8 authored by 温志超's avatar 温志超

允许条码在不良状态下,多次重复报工

parent de99838a
...@@ -55,7 +55,7 @@ public interface IProFeedbackService { ...@@ -55,7 +55,7 @@ public interface IProFeedbackService {
* 验证序列号报工 * 验证序列号报工
* @param validateSerialNoParams * @param validateSerialNoParams
*/ */
void validateSerialNo(FeedbackValidateSerialNoParams validateSerialNoParams); boolean validateSerialNo(FeedbackValidateSerialNoParams validateSerialNoParams);
/** /**
* 新增生产报工记录 * 新增生产报工记录
......
...@@ -300,7 +300,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -300,7 +300,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
} }
@Override @Override
public void validateSerialNo(FeedbackValidateSerialNoParams validateSerialNoParams) { public boolean validateSerialNo(FeedbackValidateSerialNoParams validateSerialNoParams) {
QueryWrapper<ProWorkorder> query = new QueryWrapper<>(); QueryWrapper<ProWorkorder> query = new QueryWrapper<>();
query.eq("t4.task_workunit_id", validateSerialNoParams.getTaskWorkunitId()); query.eq("t4.task_workunit_id", validateSerialNoParams.getTaskWorkunitId());
List<ProWorkorder> listOrder = proWorkorderMapper.selectJoinTaskWorkunitByQw(query); List<ProWorkorder> listOrder = proWorkorderMapper.selectJoinTaskWorkunitByQw(query);
...@@ -319,8 +319,13 @@ public class ProFeedbackServiceImpl implements IProFeedbackService { ...@@ -319,8 +319,13 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
feedbackQuery.eq("task_workunit_id",validateSerialNoParams.getTaskWorkunitId()); feedbackQuery.eq("task_workunit_id",validateSerialNoParams.getTaskWorkunitId());
List<ProFeedback> feedbackList = proFeedbackService.selectProFeedbackList(feedbackQuery); List<ProFeedback> feedbackList = proFeedbackService.selectProFeedbackList(feedbackQuery);
if(feedbackList.size()>0){ if(feedbackList.size()>0){
throw new ServiceException(MessageUtils.message("pro.feedback.error.repeat.serialNo.report")); if(feedbackList.stream().filter(proFeedback -> proFeedback.getQuantityQualify().compareTo(BigDecimal.ZERO) > 0).count() > 0){
throw new ServiceException(MessageUtils.message("pro.feedback.error.repeat.serialNo.report"));
}else{
return true;
}
} }
return false;
} }
/** /**
......
...@@ -779,11 +779,13 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -779,11 +779,13 @@ public class ProTaskServiceImpl implements IProTaskService {
ExceptionUtil.checkTrueThrowException((feedbackQualifyConst.compareTo(BigDecimal.ZERO) <= 0 && fuantityUnqualify.compareTo(BigDecimal.ZERO) <= 0), ExceptionUtil.checkTrueThrowException((feedbackQualifyConst.compareTo(BigDecimal.ZERO) <= 0 && fuantityUnqualify.compareTo(BigDecimal.ZERO) <= 0),
"报工数目合格、不合格数不能都小于等于0"); "报工数目合格、不合格数不能都小于等于0");
boolean addOneQuantityWait = false;
//序号报工校验,当addOneQuantityWait为true时说明已经报工过不良,不再增加
if(StringUtils.isNotEmpty(feedback.getQrcode())){ if(StringUtils.isNotEmpty(feedback.getQrcode())){
FeedbackValidateSerialNoParams feedbackValidateSerialNoParams = new FeedbackValidateSerialNoParams(); FeedbackValidateSerialNoParams feedbackValidateSerialNoParams = new FeedbackValidateSerialNoParams();
feedbackValidateSerialNoParams.setQrcode(feedback.getQrcode()); feedbackValidateSerialNoParams.setQrcode(feedback.getQrcode());
feedbackValidateSerialNoParams.setTaskWorkunitId(feedback.getTaskWorkunitId()); feedbackValidateSerialNoParams.setTaskWorkunitId(feedback.getTaskWorkunitId());
proFeedbackService.validateSerialNo(feedbackValidateSerialNoParams); addOneQuantityWait = proFeedbackService.validateSerialNo(feedbackValidateSerialNoParams);
} }
ProTaskWorkunit taskWorkunit = proTaskWorkunitService.selectProTaskWorkunitByTaskWorkunitId(feedback.getTaskWorkunitId()); ProTaskWorkunit taskWorkunit = proTaskWorkunitService.selectProTaskWorkunitByTaskWorkunitId(feedback.getTaskWorkunitId());
...@@ -793,6 +795,19 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -793,6 +795,19 @@ public class ProTaskServiceImpl implements IProTaskService {
double execQuantityQualifySumConst = proFeedbackService.selectQuantityQualifySum(new ProFeedback(null, null, null, taskWorkunit.getTaskWorkunitId())); double execQuantityQualifySumConst = proFeedbackService.selectQuantityQualifySum(new ProFeedback(null, null, null, taskWorkunit.getTaskWorkunitId()));
ProTask task = this.selectProTaskByTaskId(feedback.getTaskId()); ProTask task = this.selectProTaskByTaskId(feedback.getTaskId());
if(addOneQuantityWait){
//addOneQuantityWait为true时说明该条吗已经存在过报工记录且为不良品 此时可能 不良品-》不良品 不良品-》良品
//增加一个可加工数,后续计算中会减1,抵消以后相当于QuantityWait可加工数不变
task.setQuantityWait(task.getQuantity().add(new BigDecimal(1)));
//减少一个不良加工数,后续计算中根据报工是不合格增加1,如果为合格则不再增加
task.setQuantityUnqualify(task.getQuantityUnqualify().subtract(new BigDecimal(1)));
//减少一个已加工数,抵消以后相当于加工数不变
task.setQuantityProduced(task.getQuantityProduced().subtract(new BigDecimal(1)));
taskWorkunit.setQuantityUnqualify(task.getQuantityUnqualify().subtract(new BigDecimal(1)));
taskWorkunit.setQuantityProduced(task.getQuantityProduced().subtract(new BigDecimal(1)));
}
BigDecimal taskQuantityWaitConst = task.getQuantityWait(); BigDecimal taskQuantityWaitConst = task.getQuantityWait();
double feedbackQualityDouConst = feedbackQualifyConst.doubleValue(); double feedbackQualityDouConst = feedbackQualifyConst.doubleValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment