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

BUG修复

parent e294e015
...@@ -12,6 +12,7 @@ import java.util.List; ...@@ -12,6 +12,7 @@ import java.util.List;
* @date 2022-05-10 * @date 2022-05-10
*/ */
public interface IMdWorkstationService { public interface IMdWorkstationService {
public static Long OUTSOURCE_WORKSTATION_ID = 1l;
/** /**
* 查询工作站 * 查询工作站
* *
......
...@@ -12,6 +12,7 @@ import com.ximai.common.utils.data.StringUtils; ...@@ -12,6 +12,7 @@ import com.ximai.common.utils.data.StringUtils;
import com.ximai.mes.constant.TaskWorkunitStatusEnum; import com.ximai.mes.constant.TaskWorkunitStatusEnum;
import com.ximai.mes.md.domain.MdWorkunitWorker; import com.ximai.mes.md.domain.MdWorkunitWorker;
import com.ximai.mes.md.mapper.MdWorkunitWorkerMapper; import com.ximai.mes.md.mapper.MdWorkunitWorkerMapper;
import com.ximai.mes.md.service.IMdWorkstationService;
import com.ximai.mes.pro.domain.ProFeedback; import com.ximai.mes.pro.domain.ProFeedback;
import com.ximai.mes.pro.domain.task.ProTaskAssistProcess; import com.ximai.mes.pro.domain.task.ProTaskAssistProcess;
import com.ximai.mes.pro.domain.vo.ProFeedbackVo; import com.ximai.mes.pro.domain.vo.ProFeedbackVo;
...@@ -49,14 +50,6 @@ public class ProFeedbackController extends BaseController { ...@@ -49,14 +50,6 @@ public class ProFeedbackController extends BaseController {
@Resource @Resource
private ProTaskAssistProcessMapper proTaskAssistProcessMapper; private ProTaskAssistProcessMapper proTaskAssistProcessMapper;
public static void main(String[] args) {
Set<String> objects = new HashSet<>();
objects.add("1");
if (!objects.add("1")) {
System.out.printf("1", 1);
}
}
/** /**
* 查询生产报工记录列表 * 查询生产报工记录列表
*/ */
...@@ -86,24 +79,13 @@ public class ProFeedbackController extends BaseController { ...@@ -86,24 +79,13 @@ public class ProFeedbackController extends BaseController {
// objects = list.stream().filter(x -> !collect.add(x.getWorkunitId())).sorted(Comparator.comparing(ProFeedbackVo::getFeedbackTime).reversed()).collect(Collectors.toList()); // objects = list.stream().filter(x -> !collect.add(x.getWorkunitId())).sorted(Comparator.comparing(ProFeedbackVo::getFeedbackTime).reversed()).collect(Collectors.toList());
proFeedbackVoList = list.stream().filter(x -> !collect.add(x.getWorkunitId())).sorted(Comparator.comparing(ProFeedbackVo::getUpdateTime).reversed()).collect(Collectors.toList()); proFeedbackVoList = list.stream().filter(x -> !collect.add(x.getWorkunitId())).sorted(Comparator.comparing(ProFeedbackVo::getUpdateTime).reversed()).collect(Collectors.toList());
} }
proFeedbackVoList = proFeedbackVoList.isEmpty() ? list : proFeedbackVoList; proFeedbackVoList = proFeedbackVoList.isEmpty() ? list : proFeedbackVoList;
proFeedbackVoList.forEach(s->{ proFeedbackVoList.forEach(s->{
s.setStandardSize(s.getWorkorderSoSizes()); if(IMdWorkstationService.OUTSOURCE_WORKSTATION_ID.equals(s.getWorkstationId())){
s.setAssistProcessCode(s.getTaskCode());
}
}); });
Set<Long> taskWorkunitIds = proFeedbackVoList.stream().map(ProFeedbackVo::getTaskWorkunitId).collect(Collectors.toSet());
if (CollectionUtil.isNotEmpty(taskWorkunitIds)) {
Map<Long, ProTaskAssistProcess> assistProcessMap = proTaskAssistProcessMapper.selectListByQw(new QueryWrapper<ProTaskAssistProcess>().in("task_workunit_id", taskWorkunitIds)).stream().collect(Collectors.toMap(ProTaskAssistProcess::getTaskWorkunitId, x -> x));
for (ProFeedbackVo feedbackVo : proFeedbackVoList) {
ProTaskAssistProcess assistProcess = assistProcessMap.get(feedbackVo.getTaskWorkunitId());
if (assistProcess != null) {
feedbackVo.setWorkorderCode(assistProcess.getWorkorderCode());
feedbackVo.setCloseType(assistProcess.getCloseType() == 0 ? 0 : assistProcess.getCloseType());
}
}
}
return getDataTable(proFeedbackVoList); return getDataTable(proFeedbackVoList);
} }
......
...@@ -317,6 +317,8 @@ public class ProFeedback extends BaseEntity { ...@@ -317,6 +317,8 @@ public class ProFeedback extends BaseEntity {
this.setUnitOfMeasure(workorder.getUnitOfMeasure()); this.setUnitOfMeasure(workorder.getUnitOfMeasure());
this.setItemId(workorder.getProductId()); this.setItemId(workorder.getProductId());
this.setQuantity(workorder.getQuantity()); this.setQuantity(workorder.getQuantity());
this.setItemCode(workorder.getProductCode());
this.setItemName(workorder.getProductName());
} }
public void initValue(MdItem mdItem) { public void initValue(MdItem mdItem) {
......
...@@ -51,15 +51,11 @@ public interface ProFeedbackMapper { ...@@ -51,15 +51,11 @@ public interface ProFeedbackMapper {
"\tf.*,\n" + "\tf.*,\n" +
"\twu.workunit_name,\n" + "\twu.workunit_name,\n" +
"\twu.workunit_id,\n" + "\twu.workunit_id,\n" +
"\twod.client_cmd,\n" + "\tit.sap_item_code,ta.arrange_code \n" +
"\tap.assist_process_code, it.sap_item_code,ta.arrange_code \n" +
"FROM\n" + "FROM\n" +
"\tpro_feedback f\n" + "\tpro_feedback f\n" +
"\tLEFT JOIN pro_task_workunit tw ON tw.task_workunit_id = f.task_workunit_id\n" + "\tLEFT JOIN pro_task_workunit tw ON tw.task_workunit_id = f.task_workunit_id\n" +
// "\tLEFT JOIN md_workunit_worker pww ON pww.workunit_id = tw.workunit_id\n" +
"\tLEFT JOIN md_workunit wu ON wu.workunit_id = tw.workunit_id\n" + "\tLEFT JOIN md_workunit wu ON wu.workunit_id = tw.workunit_id\n" +
"\tLEFT JOIN pro_work_order_so_directive wod ON wod.workorder_so_directive_id = f.workorder_so_directive_id\n" +
"\tLEFT JOIN pro_task_assist_process ap ON ap.task_workunit_id = tw.task_workunit_id \n" +
"\tLEFT JOIN md_item it ON it.item_id = f.item_id \n" + "\tLEFT JOIN md_item it ON it.item_id = f.item_id \n" +
"\tLEFT JOIN pro_task ta ON ta.task_id = f.task_id \n" + "\tLEFT JOIN pro_task ta ON ta.task_id = f.task_id \n" +
"${ew.customSqlSegment}") "${ew.customSqlSegment}")
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ximai.common.constant.DataConstans; import com.ximai.common.constant.DataConstans;
import com.ximai.common.utils.MessageUtils; import com.ximai.common.utils.MessageUtils;
import com.ximai.common.utils.SecurityUtils;
import com.ximai.common.utils.data.DataUtil; import com.ximai.common.utils.data.DataUtil;
import com.ximai.common.utils.data.ExceptionUtil; import com.ximai.common.utils.data.ExceptionUtil;
import com.ximai.common.utils.data.StringUtils; import com.ximai.common.utils.data.StringUtils;
...@@ -31,6 +32,7 @@ import com.ximai.mes.pro.service.task.IProFdQrcodePrintRecordService; ...@@ -31,6 +32,7 @@ import com.ximai.mes.pro.service.task.IProFdQrcodePrintRecordService;
import com.ximai.mes.pro.service.task.IProTaskAssistProcessService; import com.ximai.mes.pro.service.task.IProTaskAssistProcessService;
import com.ximai.mes.pro.service.task.IProTaskService; import com.ximai.mes.pro.service.task.IProTaskService;
import com.ximai.mes.pro.service.task.IProTaskWorkunitService; import com.ximai.mes.pro.service.task.IProTaskWorkunitService;
import com.ximai.system.mapper.SysUserMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -93,6 +95,8 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer ...@@ -93,6 +95,8 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
@Resource @Resource
private ProProcessMapper proProcessMapper; private ProProcessMapper proProcessMapper;
@Resource
private SysUserMapper sysUserMapper;
/** /**
* 查询工序任务外协关系 * 查询工序任务外协关系
...@@ -303,13 +307,14 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer ...@@ -303,13 +307,14 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
taskWorkunit.setQuantityUnqualify(taskWorkunit.getQuantityUnqualify().add(quantityUnQualify)); taskWorkunit.setQuantityUnqualify(taskWorkunit.getQuantityUnqualify().add(quantityUnQualify));
taskWorkunit.setQuantityProduced(taskWorkunit.getQuantityProduced().add(quantityQualify)); taskWorkunit.setQuantityProduced(taskWorkunit.getQuantityProduced().add(quantityQualify));
if (feedback.getCloseType() == 1 || quantityWait.doubleValue() == 0) { if (feedback.getCloseType() == 1 || taskWorkunit.getQuantity().compareTo(taskWorkunit.getQuantityProduced()) <= 0) {
taskWorkunit.setStatus(TaskWorkunitStatusEnum.FINISHED.getStatus()); taskWorkunit.setStatus(TaskWorkunitStatusEnum.FINISHED.getStatus());
proTaskWorkunitService.updateProTaskWorkunit(taskWorkunit); proTaskWorkunitService.updateProTaskWorkunit(taskWorkunit);
} }
//按派工表保存报工记录 //按派工表保存报工记录
feedback.setFeedbackType("SELF"); feedback.setFeedbackType("SELF");
feedback.setNickName(sysUserMapper.selectUserById(SecurityUtils.getUserId()).getNickName());
proFeedbackService.insertProFeedback(feedback); proFeedbackService.insertProFeedback(feedback);
//查询关联下道工序 //查询关联下道工序
...@@ -332,10 +337,6 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer ...@@ -332,10 +337,6 @@ public class ProTaskAssistProcessServiceImpl implements IProTaskAssistProcessSer
proTaskService.updateProTask(task); proTaskService.updateProTask(task);
proTaskWorkunitService.updateProTaskWorkunit(taskWorkunit); proTaskWorkunitService.updateProTaskWorkunit(taskWorkunit);
//打印记录
if ("1".equals(feedback.getPrintContents())) {
proFdQrcodePrintRecordService.insertProFdQrcodePrintRecordfeedback(feedback);
}
return 1; return 1;
} }
......
...@@ -794,7 +794,7 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -794,7 +794,7 @@ public class ProTaskServiceImpl implements IProTaskService {
Long workorderId = feedback.getWorkorderId(); Long workorderId = feedback.getWorkorderId();
QueryWrapper<ProWorkorder> queryWrapper = new QueryWrapper<>(); QueryWrapper<ProWorkorder> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("t1.arrange_code", task.getArrangeCode()); queryWrapper.eq("t1.workorder_code", task.getArrangeCode());
queryWrapper.notIn("t1.status", Arrays.asList(WorkorderStatusEnum.CLOSE.getValue(), WorkorderStatusEnum.CANCEL.getValue(), WorkorderStatusEnum.CANCELED.getValue())); queryWrapper.notIn("t1.status", Arrays.asList(WorkorderStatusEnum.CLOSE.getValue(), WorkorderStatusEnum.CANCEL.getValue(), WorkorderStatusEnum.CANCELED.getValue()));
List<ProWorkorder> proWorkorders = proWorkorderService.selectListByQw(queryWrapper); List<ProWorkorder> proWorkorders = proWorkorderService.selectListByQw(queryWrapper);
double maxWorkunitQuantityConst = taskWorkunit.getQuantity().doubleValue(); double maxWorkunitQuantityConst = taskWorkunit.getQuantity().doubleValue();
...@@ -819,36 +819,6 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -819,36 +819,6 @@ public class ProTaskServiceImpl implements IProTaskService {
feedbackQualityVal = BigDecimal.valueOf(Math.min(maxWorkunitQuantityConst, feedbackQualityDouConst)); feedbackQualityVal = BigDecimal.valueOf(Math.min(maxWorkunitQuantityConst, feedbackQualityDouConst));
} }
} }
quantityWaitVal = taskQuantityWaitConst.subtract(feedbackQualityVal);
} else {
// 无报工记录第一次报工 判断可报工数和工单数
if (execQuantityQualifySumConst == 0) {
if (maxWorkunitQuantityConst > feedbackQualityDouConst) {
// 工单大于已报工数量 工单减去已报工数量
feedbackQualityVal = feedbackQualifyConst;
} else {
feedbackQualityVal = BigDecimal.valueOf(maxWorkunitQuantityConst);
}
} else {
// 有报工记录 判断报工数和可报工数和工单数
double execTotle = execQuantityQualifySumConst + feedbackQualityDouConst;
if (maxWorkunitQuantityConst > execTotle) {
feedbackQualityVal = BigDecimal.valueOf(Math.min(maxWorkunitQuantityConst, feedbackQualityDouConst));
// 工单大于已报工数量 工单减去已报工数量
} else {
if (maxWorkunitQuantityConst > execQuantityQualifySumConst) {
feedbackQualityVal = BigDecimal.valueOf(maxWorkunitQuantityConst - execQuantityQualifySumConst);
} else {
feedbackQualityVal = BigDecimal.ZERO;
}
}
}
if (feedbackQualityDouConst >= taskQuantityWaitDouConst) {
taskWorkunit.setStatus(FINISHED.getStatus());
}
quantityWaitVal = taskQuantityWaitConst.subtract(feedbackQualityVal); quantityWaitVal = taskQuantityWaitConst.subtract(feedbackQualityVal);
} }
} else { } else {
...@@ -1309,13 +1279,15 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -1309,13 +1279,15 @@ public class ProTaskServiceImpl implements IProTaskService {
@Override @Override
public ProTask getNextTaskByTaskId(Long taskId) { public ProTask getNextTaskByTaskId(Long taskId) {
ProTask thisProTask = this.selectProTaskByTaskId(taskId); ProTask thisProTask = this.selectProTaskByTaskId(taskId);
String arrangeCode = thisProTask.getArrangeCode();
QueryWrapper<ProTask> queryWrapper = new QueryWrapper<>(); QueryWrapper<ProTask> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtils.isNotEmpty(arrangeCode), "arrange_code", arrangeCode); queryWrapper.eq("task_batch", thisProTask.getTaskBatch());
queryWrapper.notIn(StringUtils.isNotEmpty(taskId), "task_id", taskId); queryWrapper.notIn(StringUtils.isNotEmpty(taskId), "task_id", taskId);
queryWrapper.ge(StringUtils.isNotEmpty(thisProTask.getOrdinal()), "ordinal", thisProTask.getOrdinal()); queryWrapper.ge(StringUtils.isNotEmpty(thisProTask.getOrdinal()), "ordinal", thisProTask.getOrdinal());
queryWrapper.orderByAsc("ordinal"); queryWrapper.orderByAsc("ordinal");
List<ProTask> tasks = proTaskMapper.selectListByQw(queryWrapper); List<ProTask> tasks = proTaskMapper.selectListByQw(queryWrapper);
if(tasks.size()==0){
return null;
}
return tasks.get(0); return tasks.get(0);
} }
...@@ -1383,7 +1355,7 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -1383,7 +1355,7 @@ public class ProTaskServiceImpl implements IProTaskService {
//搜索条件为工单号查询相应任务ID作为查询条件 //搜索条件为工单号查询相应任务ID作为查询条件
if (StringUtils.isNotEmpty(proTask.getWorkorderCode())) { if (StringUtils.isNotEmpty(proTask.getWorkorderCode())) {
QueryWrapper<ProTask> taskQuery = new QueryWrapper<>(); QueryWrapper<ProTask> taskQuery = new QueryWrapper<>();
taskQuery.eq("t3.workorder_code", proTask.getWorkorderCode()); taskQuery.eq("t2.workorder_code", proTask.getWorkorderCode());
taskQuery.eq(proTask.getWorkunitId() != null, "t4.workunit_id", proTask.getWorkunitId()); taskQuery.eq(proTask.getWorkunitId() != null, "t4.workunit_id", proTask.getWorkunitId());
List<ProTaskVo> taskVoList = proTaskMapper.selectProTaskJoinWorkorder(taskQuery); List<ProTaskVo> taskVoList = proTaskMapper.selectProTaskJoinWorkorder(taskQuery);
if (CollectionUtil.isEmpty(taskVoList)) { if (CollectionUtil.isEmpty(taskVoList)) {
......
...@@ -518,6 +518,9 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService { ...@@ -518,6 +518,9 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
public void outsourceConfirm(List<Long> taskWorkunitIds) { public void outsourceConfirm(List<Long> taskWorkunitIds) {
taskWorkunitIds.forEach(id->{ taskWorkunitIds.forEach(id->{
ProTaskWorkunit taskWorkunit = this.selectProTaskWorkunitByTaskWorkunitId(id); ProTaskWorkunit taskWorkunit = this.selectProTaskWorkunitByTaskWorkunitId(id);
if(taskWorkunit.getVendorId()==null){
throw new ServiceException(MessageUtils.message("pro.schedule.error.not.null.vendor"));
}
taskWorkunit.setOutsourced(1); taskWorkunit.setOutsourced(1);
taskWorkunit.setStatus(TaskStatusEnum.BEGINNING.getStatus()); taskWorkunit.setStatus(TaskStatusEnum.BEGINNING.getStatus());
this.updateProTaskWorkunit(taskWorkunit); this.updateProTaskWorkunit(taskWorkunit);
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
ptw.task_id, ptw.task_id,
ptw.idx, ptw.idx,
ptw.workunit_id, ptw.workunit_id,
ptw.vendor_id,
ptw.vendor_name,
ptw.outsource_unit_price,
mw.workunit_code, mw.workunit_code,
mw.workunit_name, mw.workunit_name,
ptw.unit_of_measure, ptw.unit_of_measure,
......
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