Commit df3b9749 authored by 李驰骋's avatar 李驰骋

外协报工调整

parent 646666d8
......@@ -264,6 +264,7 @@ public class ProTaskMobController extends BaseController {
//验证是否报工
QueryWrapper<ProFeedback> feedbackQuery = new QueryWrapper<>();
feedbackQuery.eq("qrcode", validateSerialNoParams.getQrcode());
feedbackQuery.eq("task_workunit_id",validateSerialNoParams.getTaskWorkunitId());
List<ProFeedback> feedbackList = proFeedbackService.selectProFeedbackList(feedbackQuery);
if(feedbackList.size()>0){
throw new ServiceException("该序列号任务已报工");
......
......@@ -87,7 +87,7 @@ public interface IProFeedbackService {
LinkedHashMap<String, ProFeedbackSplitInfo> taskFeedback(ProTask proTask, ProFeedback mainFeedBack);
List<ProPackagePrintResult> assistFeedBack(ProFeedback feedback, ProTaskAssistProcess assistProcess);
List<ProPackagePrintResult> assistFeedBack(ProFeedback feedback);
// 上传报工信息到sap
......
......@@ -834,7 +834,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
}
@Override
public List<ProPackagePrintResult> assistFeedBack(ProFeedback feedback, ProTaskAssistProcess assistProcess) {
public List<ProPackagePrintResult> assistFeedBack(ProFeedback feedback) {
BigDecimal quantityFeedback = feedback.getQuantityFeedback();
ExceptionUtil.checkTrueThrowException(quantityFeedback.doubleValue() <= 0, "报工数量不能低于0");
......@@ -844,7 +844,7 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
SAPDtoFeedback sapDtoFeedback = new SAPDtoFeedback();
sapDtoFeedback.setWorkorderCode(assistProcess.getWorkorderCode());
sapDtoFeedback.setWorkorderCode(feedback.getWorkorderCode());
sapDtoFeedback.setConfirm("1");
BigDecimal quantityUnqualify = DataUtil.getNormalData(feedback.getQuantityUnqualify());
if (quantityUnqualify.intValue() > 0) {
......@@ -852,7 +852,6 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
}
sapDtoFeedback.setConfirmText("");
sapDtoFeedback.setProcessOrder(assistProcess.getIdx());
sapDtoFeedback.setWorkstationCode(feedback.getWorkstationCode());
sapDtoFeedback.setFeedbackQuantity(DataUtil.getNormalData(feedback.getQuantityQualify()).intValue());
sapDtoFeedback.setFeedbackScrapQuantity(quantityUnqualify.intValue());
......@@ -880,8 +879,6 @@ public class ProFeedbackServiceImpl implements IProFeedbackService {
sapDtoFeedback.setBreakTime("0");
sapDtoFeedback.setBreakTimeUnit("MIN");
// 判断反冲料
SapServiceFeedback.builder().feedback(feedback).sapDtoFeedback(sapDtoFeedback).proWorkorderMapper(proWorkorderMapper).actionMsg("外协报工").build().execute();
this.insertProFeedback(feedback);
return null;
......
......@@ -6,10 +6,7 @@ import com.ximai.common.constant.DataConstans;
import com.ximai.common.utils.data.DataUtil;
import com.ximai.common.utils.data.ExceptionUtil;
import com.ximai.common.utils.data.StringUtils;
import com.ximai.mes.constant.AssistProcessConst;
import com.ximai.mes.constant.TaskConst;
import com.ximai.mes.constant.TaskStatusEnum;
import com.ximai.mes.constant.TaskWorkunitStatusEnum;
import com.ximai.mes.constant.*;
import com.ximai.mes.face.sap.SapService;
import com.ximai.mes.face.sap.execute.SapServiceAssistProcess;
import com.ximai.mes.pro.domain.ProFeedback;
......@@ -361,25 +358,22 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
@Override
public int feedBack(ProFeedback feedback) {
Long taskWorkunitId = feedback.getTaskWorkunitId();
ProTaskAssistProcess proTaskAssistProcess = this.selectBaseByObj(new ProTaskAssistProcess(taskWorkunitId));
ExceptionUtil.checkTrueThrowException(StringUtils.isEmpty(proTaskAssistProcess), "外协记录不存在");
ProTaskWorkunit taskWorkunit = proTaskWorkunitService.selectProTaskWorkunitByTaskWorkunitId(taskWorkunitId);
ProWorkorder workorder = proWorkorderMapper.selectWorkorderById(feedback.getWorkorderId());
ExceptionUtil.checkTrueThrowException(taskWorkunit == null, "排产任务不存在");
ExceptionUtil.checkTrueThrowException(!taskWorkunit.getStatus().equals(TaskStatusEnum.BEGINNING.getStatus()), "请先进行开始作业操作");
feedback.initValue(workorder);
Double feedbackSum = proFeedbackService.selectQuantityQualifySum(new ProFeedback(null, null, null, taskWorkunitId));
double taskQuantityDouble = taskWorkunit.getQuantity().doubleValue();
double canBeWaitQuantity = taskQuantityDouble - feedbackSum;
ExceptionUtil.checkTrueThrowException(canBeWaitQuantity <= 0, "报工数量为0,不可报工");
BigDecimal quantityQualify = feedback.getQuantityQualify();
BigDecimal quantityUnQualify = feedback.getQuantityUnqualify();
BigDecimal quantityFeedback = quantityQualify.add(quantityUnQualify);
double quantityFeedbackDouble = quantityFeedback.doubleValue();
ExceptionUtil.checkTrueThrowException(quantityFeedbackDouble > canBeWaitQuantity, "报工数量大于可报工数量");
ProTask task = proTaskService.selectBaseById(proTaskAssistProcess.getTaskId());
ProTask task = proTaskService.selectBaseById(taskWorkunit.getTaskId());
BigDecimal taskQuantityWait = task.getQuantityWait();
ExceptionUtil.checkTrueThrowException(quantityFeedbackDouble > taskQuantityWait.longValue()
|| quantityFeedbackDouble > taskQuantityDouble, "可加工数量不足");
......@@ -399,17 +393,9 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
proTaskWorkunitService.updateProTaskWorkunit(taskWorkunit);
}
//暂停更新记录
if (Objects.equals(taskWorkunit.getStatus(), FINISHED.getStatus())) {
proStartWorkService.closeObj(feedback);
} else {
proStartWorkService.updateObj(feedback);
}
//按派工表保存报工记录
feedback.setWorkorderId(proTaskAssistProcess.getWorkorderId());
proFeedbackService.assistFeedBack(feedback, proTaskAssistProcess);
feedback.setFeedbackType("SELF");
proFeedbackService.insertProFeedback(feedback);
//查询关联下道工序
ProTask nextTask = proTaskService.getNextTaskByTaskId(feedback.getTaskId());
......@@ -429,26 +415,13 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
proTaskService.updateProTask(nextTask);
}
proTaskService.updateProTask(task);
ProWorkorder proWorkorder = proWorkorderMapper.selectWorkorderById(proTaskAssistProcess.getWorkorderId());
proWorkorder.setQuantityQualify(proWorkorder.getQuantityQualify().add(quantityQualify));
proWorkorder.setQuantityUnqualify(proWorkorder.getQuantityUnqualify().add(quantityUnQualify));
proWorkorder.setQuantityProduced(DataUtil.getNormalData(proWorkorder.getQuantityProduced()).add(quantityQualify));
proWorkorderService.updateProWorkorder(proWorkorder);
proTaskWorkunitService.updateProTaskWorkunit(taskWorkunit);
//打印记录
if ("1".equals(feedback.getPrintContents())) {
proFdQrcodePrintRecordService.insertProFdQrcodePrintRecordfeedback(feedback);
}
SapServiceAssistProcess.builder().proTaskAssistProcess(proTaskAssistProcess).feedback(feedback).build().execute();
return 1;
}
......
......@@ -1859,7 +1859,7 @@ public class ProTaskServiceImpl implements IProTaskService {
String arrangeCode = task.getArrangeCode();
if (StringUtils.isNotEmpty(arrangeCode)) {
ProWorkorderQuery workorderQuery = new ProWorkorderQuery();
workorderQuery.setArrangeCode(arrangeCode);
workorderQuery.setWorkorderCode(arrangeCode);
List<ProWorkorder> proWorkorders = proWorkorderService.selectProWorkorderList(workorderQuery);
task.setProWorkorderList(proWorkorders);
......
......@@ -523,6 +523,7 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
taskWorkunitIds.forEach(id->{
ProTaskWorkunit taskWorkunit = this.selectProTaskWorkunitByTaskWorkunitId(id);
taskWorkunit.setOutsourced(1);
taskWorkunit.setStatus(TaskStatusEnum.BEGINNING.getStatus());
this.updateProTaskWorkunit(taskWorkunit);
});
}
......
......@@ -32,6 +32,7 @@
attention,
enable_flag,
is_package,
is_serial_report,
remark,
attr1,
attr2,
......
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