Commit 55c4c563 authored by 温志超's avatar 温志超

Merge remote-tracking branch 'origin/dev' into dev

parents 9d1f7e25 532217db
...@@ -56,7 +56,7 @@ spring: ...@@ -56,7 +56,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://10.168.8.188:3306/xm_mes?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B7 url: jdbc:mysql://192.168.1.18:3306/xm_mes?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B7
username: root username: root
password: t0psunit password: t0psunit
# 从库数据源 # 从库数据源
...@@ -210,7 +210,7 @@ xss: ...@@ -210,7 +210,7 @@ xss:
#Mino配置 #Mino配置
minio: minio:
url: http://10.168.8.188:9000 url: http://192.168.1.18:9000
accessKey: minioadmin accessKey: minioadmin
secretKey: minioadmin secretKey: minioadmin
bucketName: mes bucketName: mes
......
...@@ -6,6 +6,7 @@ import cn.hutool.core.util.ArrayUtil; ...@@ -6,6 +6,7 @@ import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ximai.common.utils.data.StringUtils; import com.ximai.common.utils.data.StringUtils;
import com.ximai.mes.constant.TaskWorkunitStatusEnum; import com.ximai.mes.constant.TaskWorkunitStatusEnum;
import com.ximai.mes.constant.WorkorderStatusEnum;
import com.ximai.mes.kanban.dto.task.TaskPlanQuery; import com.ximai.mes.kanban.dto.task.TaskPlanQuery;
import com.ximai.mes.kanban.dto.task.TaskPlanStatDto; import com.ximai.mes.kanban.dto.task.TaskPlanStatDto;
import com.ximai.mes.kanban.dto.task.TaskStatDto; import com.ximai.mes.kanban.dto.task.TaskStatDto;
...@@ -243,6 +244,7 @@ public class KanbanTaskService { ...@@ -243,6 +244,7 @@ public class KanbanTaskService {
query.gt("ptw.schedule_start_date", curr.plusDays(-3)); query.gt("ptw.schedule_start_date", curr.plusDays(-3));
query.eq(StringUtils.isNotEmpty(taskPlanQuery.getLineName()), "wu.line_name", taskPlanQuery.getLineName()); query.eq(StringUtils.isNotEmpty(taskPlanQuery.getLineName()), "wu.line_name", taskPlanQuery.getLineName());
query.orderByDesc("ordinal","schedule_start_date"); query.orderByDesc("ordinal","schedule_start_date");
query.ne("wo.status", WorkorderStatusEnum.CLOSE.getValue());
List<ProTaskWorkunitDto> dataList = taskWorkunitMapper.selectTaskWorkUnitWithKanban(query); List<ProTaskWorkunitDto> dataList = taskWorkunitMapper.selectTaskWorkUnitWithKanban(query);
//合并相同批号任务 //合并相同批号任务
Map<String,List<ProTaskWorkunitDto>> dataMap = dataList.stream().collect(Collectors.groupingBy(s->s.getTaskBatch())); Map<String,List<ProTaskWorkunitDto>> dataMap = dataList.stream().collect(Collectors.groupingBy(s->s.getTaskBatch()));
......
...@@ -2,6 +2,7 @@ package com.ximai.mes.pro.domain.task; ...@@ -2,6 +2,7 @@ package com.ximai.mes.pro.domain.task;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ximai.common.annotation.Excel; import com.ximai.common.annotation.Excel;
import com.ximai.common.core.domain.BaseEntity; import com.ximai.common.core.domain.BaseEntity;
import com.ximai.mes.constant.TaskStatusEnum; import com.ximai.mes.constant.TaskStatusEnum;
...@@ -11,7 +12,6 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -11,7 +12,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -321,6 +321,12 @@ public class ProTask extends BaseEntity { ...@@ -321,6 +321,12 @@ public class ProTask extends BaseEntity {
private Boolean surpassState; private Boolean surpassState;
@TableField(exist = false) @TableField(exist = false)
private String processRemark; private String processRemark;
@JsonIgnore
@TableField(exist = false)
private String productCode;
@TableField(exist = false)
@JsonIgnore
private String productName;
public String getStatusName() { public String getStatusName() {
return TaskStatusEnum.getStatusCn(this.getStatus()); return TaskStatusEnum.getStatusCn(this.getStatus());
} }
......
...@@ -158,12 +158,14 @@ public interface ProTaskMapper extends BaseMapper<ProTask> { ...@@ -158,12 +158,14 @@ public interface ProTaskMapper extends BaseMapper<ProTask> {
"\t, ptw.task_workunit_id, ptw.quantity, t.quantity_wait, ptw.quantity_produced, ptw.quantity_changed\n" + "\t, ptw.task_workunit_id, ptw.quantity, t.quantity_wait, ptw.quantity_produced, ptw.quantity_changed\n" +
"\t, t.client_id, t.client_code, t.client_name, t.client_nick, t.is_last_process, ptw.schedule_start_date\n" + "\t, t.client_id, t.client_code, t.client_name, t.client_nick, t.is_last_process, ptw.schedule_start_date\n" +
"\t, t.duration, ptw.schedule_end_date, t.color_code, t.request_date, t.remark\n" + "\t, t.duration, ptw.schedule_end_date, t.color_code, t.request_date, t.remark\n" +
"\t, t.attr1, t.attr2, t.attr3, t.attr4, t.create_by\n" + "\t, t.attr1, t.attr2, t.attr3, t.attr4, t.create_by,ptwo.workorder_id,wo.product_code,wo.product_name\n" +
"\t, t.create_time, t.update_by, t.update_time, ptw.STATUS,ptw.task_type, ptw.quantity_qualify\n" + "\t, t.create_time, t.update_by, t.update_time, ptw.STATUS,ptw.task_type, ptw.quantity_qualify\n" +
"\t, ptw.quantity_unqualify, mw.workunit_id, mw.workunit_code, mw.workunit_name, t.arrange_code, proc.is_package, proc.is_serial_report\n" + "\t, ptw.quantity_unqualify, mw.workunit_id, mw.workunit_code, mw.workunit_name, t.arrange_code, proc.is_package, proc.is_serial_report\n" +
"\t, (case ptw.STATUS when 'BEGINNING' then 1 when 'PAUSE' then 2 when 'ERROR_STOP' then 3 when 'PREPARE' then 4 end) statusIndex \n" + "\t, (case ptw.STATUS when 'BEGINNING' then 1 when 'PAUSE' then 2 when 'ERROR_STOP' then 3 when 'PREPARE' then 4 end) statusIndex \n" +
"from pro_task t\n" + "from pro_task t\n" +
"\tleft join pro_task_workunit ptw on ptw.task_id = t.task_id\n" + "\tleft join pro_task_workunit ptw on ptw.task_id = t.task_id\n" +
"\tleft join pro_task_workorder ptwo on ptwo.task_id = t.task_id\n" +
"\tleft join pro_workorder wo on wo.workorder_id = ptwo.workorder_id "+
"\tleft join pro_process proc on proc.process_id = t.process_id\n" + "\tleft join pro_process proc on proc.process_id = t.process_id\n" +
"\tleft join md_workunit mw on ptw.workunit_id = mw.workunit_id " + "\tleft join md_workunit mw on ptw.workunit_id = mw.workunit_id " +
" ${ew.customSqlSegment}") " ${ew.customSqlSegment}")
......
...@@ -227,7 +227,7 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> { ...@@ -227,7 +227,7 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> {
"left join pro_task_workorder tw on t2.task_id = tw.task_id\n" + "left join pro_task_workorder tw on t2.task_id = tw.task_id\n" +
"left join pro_workorder wo on wo.workorder_id = tw.workorder_id\n" + "left join pro_workorder wo on wo.workorder_id = tw.workorder_id\n" +
"where t1.schedule_end_date > #{startDate} and t1.schedule_end_date < #{endDate} \n" + "where t1.schedule_end_date > #{startDate} and t1.schedule_end_date < #{endDate} \n" +
"and t2.is_last_process = 1 group by t2.arrange_code,wo.product_name") "and t2.is_last_process = 1 and wo.status <> 'close' group by t2.arrange_code,wo.product_name")
List<MesDataDto.OrderInfoDto> selectTaskWorkUnitWithKanban2(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); List<MesDataDto.OrderInfoDto> selectTaskWorkUnitWithKanban2(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
/** /**
...@@ -236,9 +236,9 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> { ...@@ -236,9 +236,9 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> {
* @param endDate 结束时间 * @param endDate 结束时间
* @return * @return
*/ */
@Select(value = "select ifnull(sum(t1.quantity),0) denominator,ifnull(sum(t1.quantity_produced),0) numerator from pro_task_workunit t1 left join pro_task t2 on t1.task_id = t2.task_id\n" + @Select(value = "select ifnull(sum(t1.quantity),0) denominator,ifnull(sum(t1.quantity_produced),0) numerator from pro_task_workunit t1 left join pro_task t2 on t1.task_id = t2.task_id left join pro_task_workorder tw on t2.task_id = tw.task_id left join pro_workorder wo on wo.workorder_id = tw.workorder_id\n" +
"where t1.schedule_end_date > #{startDate} and t1.schedule_end_date < #{endDate} \n" + "where t1.schedule_end_date > #{startDate} and t1.schedule_end_date < #{endDate} \n" +
"and t2.is_last_process = 1") "and t2.is_last_process = 1 and wo.status <> 'close'")
BasicRatio selectStockInCompleteRatio(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); BasicRatio selectStockInCompleteRatio(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
......
...@@ -1689,6 +1689,7 @@ public class ProWorkorderServiceImpl implements IProWorkorderService { ...@@ -1689,6 +1689,7 @@ public class ProWorkorderServiceImpl implements IProWorkorderService {
workorderErpQuery.setSort(sort); workorderErpQuery.setSort(sort);
workorderErpQuery.setGtEqCreateDate(maxErpCreateTime); workorderErpQuery.setGtEqCreateDate(maxErpCreateTime);
workorderErpQuery.setCurrent(1); workorderErpQuery.setCurrent(1);
workorderErpQuery.setVerifyStatus("Y");
workorderErpQuery.setPageSize(1000);//每次抓取1000行 workorderErpQuery.setPageSize(1000);//每次抓取1000行
List<ProWorkorderErpDto> list = erpService.getWorkorderList(workorderErpQuery).getData(); List<ProWorkorderErpDto> list = erpService.getWorkorderList(workorderErpQuery).getData();
QueryWrapper<MdItem> itemQuery = new QueryWrapper<>(); QueryWrapper<MdItem> itemQuery = new QueryWrapper<>();
...@@ -1746,6 +1747,7 @@ public class ProWorkorderServiceImpl implements IProWorkorderService { ...@@ -1746,6 +1747,7 @@ public class ProWorkorderServiceImpl implements IProWorkorderService {
}}; }};
workorderErpQuery.setSort(sort); workorderErpQuery.setSort(sort);
workorderErpQuery.setNeSyncMark("Y"); workorderErpQuery.setNeSyncMark("Y");
workorderErpQuery.setVerifyStatus("Y");
workorderErpQuery.setCurrent(1); workorderErpQuery.setCurrent(1);
workorderErpQuery.setPageSize(1000);//每次抓取1000行 workorderErpQuery.setPageSize(1000);//每次抓取1000行
List<ProWorkorderErpDto> list = erpService.getWorkorderList(workorderErpQuery).getData(); List<ProWorkorderErpDto> list = erpService.getWorkorderList(workorderErpQuery).getData();
......
...@@ -853,7 +853,8 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -853,7 +853,8 @@ public class ProTaskServiceImpl implements IProTaskService {
} }
//本次合格数和不合格数总和大于可报工数目 与 已报工数目已经超过了排产数量 //本次合格数和不合格数总和大于可报工数目 与 已报工数目已经超过了排产数量
if ((feedbackQualityDouConst + fuantityUnqualify.doubleValue())>= task.getQuantityWait().doubleValue() && task.getQuantity().doubleValue() <= (execQuantityQualifySumConst + feedbackQualityDouConst + fuantityUnqualify.doubleValue())) { if ((feedbackQualityDouConst + fuantityUnqualify.doubleValue())>= task.getQuantityWait().doubleValue() &&
task.getQuantity().doubleValue() <= (execQuantityQualifySumConst + feedbackQualityDouConst + fuantityUnqualify.doubleValue())) {
//记录实际完工时间 //记录实际完工时间
taskWorkunit.setActualEndDate(Calendar.getInstance().getTime()); taskWorkunit.setActualEndDate(Calendar.getInstance().getTime());
taskWorkunit.setStatus(FINISHED.getStatus()); taskWorkunit.setStatus(FINISHED.getStatus());
...@@ -1383,16 +1384,6 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -1383,16 +1384,6 @@ public class ProTaskServiceImpl implements IProTaskService {
public List<ProTask> getTaskList(ProTaskQuery proTask) { public List<ProTask> getTaskList(ProTaskQuery proTask) {
ProTaskQuery proTaskQuery = new ProTaskQuery(); ProTaskQuery proTaskQuery = new ProTaskQuery();
BeanUtils.copyProperties(proTask, proTaskQuery); BeanUtils.copyProperties(proTask, proTaskQuery);
//判断前端传来是编号还是工单
if (StringUtils.isNotEmpty(proTask.getArrangeCode())) {
if (proTask.getArrangeCode().length() == 12) {
proTask.setWorkorderCode(proTask.getArrangeCode());
proTask.setArrangeCode(null);
}
}
List<ProTask> rst = new ArrayList<>();
List<ProTask> list = new ArrayList<>();
QueryWrapper<ProTask> query = new QueryWrapper<>(); QueryWrapper<ProTask> query = new QueryWrapper<>();
List<String> statusList = Arrays.asList(TaskStatusEnum.BEGINNING.getStatus(), TaskStatusEnum.PREPARE.getStatus(), List<String> statusList = Arrays.asList(TaskStatusEnum.BEGINNING.getStatus(), TaskStatusEnum.PREPARE.getStatus(),
TaskStatusEnum.PAUSE.getStatus(), TaskStatusEnum.ERROR_STOP.getStatus()); TaskStatusEnum.PAUSE.getStatus(), TaskStatusEnum.ERROR_STOP.getStatus());
...@@ -1400,98 +1391,27 @@ public class ProTaskServiceImpl implements IProTaskService { ...@@ -1400,98 +1391,27 @@ public class ProTaskServiceImpl implements IProTaskService {
query.eq(proTask.getWorkunitId() != null, "mw.workunit_id", proTask.getWorkunitId()); query.eq(proTask.getWorkunitId() != null, "mw.workunit_id", proTask.getWorkunitId());
query.in(proTask.getWorkunitIdList() != null, "mw.workunit_id", proTask.getWorkunitIdList()); query.in(proTask.getWorkunitIdList() != null, "mw.workunit_id", proTask.getWorkunitIdList());
query.eq(proTask.getOutsourced() != null, "ptw.outsourced", proTask.getOutsourced()); query.eq(proTask.getOutsourced() != null, "ptw.outsourced", proTask.getOutsourced());
query.eq(StringUtils.isNotEmpty(proTask.getArrangeCode()), "t.arrange_code", proTask.getArrangeCode());
query.gt(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 1, "t.quantity_wait", 0); query.gt(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 1, "t.quantity_wait", 0);
query.ne("wo.`status`", "close");
query.and(StringUtils.isNotEmpty(proTask.getArrangeCode()),
i->i.eq("t.arrange_code", proTask.getArrangeCode()).or().eq("t.task_code", proTask.getArrangeCode()));
//query.le(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 0, "t.quantity_wait", 0); //query.le(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 0, "t.quantity_wait", 0);
query.gt("ptw.quantity", 0); query.gt("ptw.quantity", 0);
query.orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date"); query.orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date");
//搜索条件为工单号查询相应任务ID作为查询条件 //搜索条件为工单号查询相应任务ID作为查询条件
// if (StringUtils.isNotEmpty(proTask.getWorkorderCode())) { List<ProTask> list = this.selectProTaskJoinTaskWorkUnit(query);
// QueryWrapper<ProTask> taskQuery = new QueryWrapper<>(); List<ProTask> rst = list.stream().filter(t -> !TaskStatusEnum.FINISHED.getStatus().equals(t.getStatus())).collect(Collectors.toList());
// taskQuery.eq("t2.workorder_code", proTask.getWorkorderCode()); //兼容前端代码,后面待前端调整后可删除
// taskQuery.eq(proTask.getWorkunitId() != null, "t4.workunit_id", proTask.getWorkunitId()); rst.forEach(s->{
// List<ProTaskVo> taskVoList = proTaskMapper.selectProTaskJoinWorkorder(taskQuery); s.setProWorkorderList(new ArrayList<ProWorkorder>());
// if (CollectionUtil.isEmpty(taskVoList)) { ProWorkorder workorder = new ProWorkorder();
// if (CollectionUtil.isNotEmpty(rst)) { workorder.setWorkorderId(s.getWorkorderId());
// for (ProTask task : rst) { workorder.setWorkorderCode(s.getArrangeCode());
// Double v = proFeedbackService.selectQuantityQualifySum(new ProFeedback(task.getArrangeCode(), null, null, task.getTaskWorkunitId())); workorder.setProductName(s.getProductName());
// task.setArrangeFeedbackSum(v); workorder.setProductCode(s.getProductCode());
// } s.getProWorkorderList().add(workorder);
// } });
// return rst;
// } else {
// query.in("t.task_id", taskVoList.stream().map(ProTaskVo::getTaskId).collect(Collectors.toList()));
// }
// }
list = this.selectProTaskJoinTaskWorkUnit(query);
if(list.size() < 1 ){
query = new QueryWrapper<>();
query.in("ptw.status", statusList);
query.eq(proTask.getWorkunitId() != null, "mw.workunit_id", proTask.getWorkunitId());
query.in(proTask.getWorkunitIdList() != null, "mw.workunit_id", proTask.getWorkunitIdList());
query.eq(proTask.getOutsourced() != null, "ptw.outsourced", proTask.getOutsourced());
query.eq(StringUtils.isNotEmpty(proTask.getArrangeCode()), "t.task_code", proTask.getArrangeCode());
query.gt(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 1, "t.quantity_wait", 0);
// query.le(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 0, "t.quantity_wait", 0);
query.gt("ptw.quantity", 0);
query.orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date");
list = this.selectProTaskJoinTaskWorkUnit(query);
}
rst = list.stream().filter(t -> !TaskStatusEnum.FINISHED.getStatus().equals(t.getStatus())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(rst)) {
for (ProTask task : rst) {
String arrangeCode = task.getArrangeCode();
if (StringUtils.isNotEmpty(arrangeCode)) {
ProWorkorderQuery workorderQuery = new ProWorkorderQuery();
workorderQuery.setWorkorderCode(arrangeCode);
List<ProWorkorder> proWorkorders = proWorkorderService.selectProWorkorderList(workorderQuery);
task.setProWorkorderList(proWorkorders);
if(proWorkorders.size() > 0 && proWorkorders.get(0).getProductionSolutionId() != null){
ProProductionSolution proProductionSolution
= proProductionSolutionMapper.selectProProductionSolutionByProductionSolutionId(proWorkorders.get(0).getProductionSolutionId());
if(proProductionSolution != null){
task.setSurpassState(proProductionSolution.getSurpassState());
}
}
Double v = proFeedbackService.selectQuantityQualifySum(new ProFeedback(arrangeCode, null, null, task.getTaskWorkunitId()));
task.setArrangeFeedbackSum(v);
}
//增加校验是否序列号报工
if(StringUtils.isNotEmpty(task.getIsSerialReport()) && "1".equals(task.getIsSerialReport())){
QueryWrapper<ProProductQrcodeRecord> proProductQrcodeRecordQuery = new QueryWrapper<>();
proProductQrcodeRecordQuery.eq("m.work_order_no",task.getArrangeCode());
List<ProProductQrcodeRecordDto> proProductQrcodeRecordDtos = proProductQrcodeRecordMapper.selectDtoListByQw(proProductQrcodeRecordQuery);
if(proProductQrcodeRecordDtos.size() < 1){
task.setIsSerialReport("0");
}
}
}
}
Set<Long> taskWorkunitIds = rst.stream().map(ProTask::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));
List<ProTask> proTasks = proTaskWorkunitMapper.selectListIsExistToolByTaskWorkunitIds(new QueryWrapper<ProTaskWorkunit>().in("task_workunit_id", taskWorkunitIds));
Map<Long, ProTask> isExistToolList = proTasks.stream().collect(Collectors.toMap(ProTask::getTaskWorkunitId, x -> x));
for (ProTask task : rst) {
ProTaskAssistProcess assistProcess = assistProcessMap.get(task.getTaskWorkunitId());
ProTask taskVal = isExistToolList.get(task.getTaskWorkunitId());
if (taskVal != null) {
task.setIsExistTool(taskVal.getIsExistTool());
}
if (assistProcess != null) {
task.setCloseType(assistProcess.getCloseType());
task.setWorkorderCode(assistProcess.getWorkorderCode());
}
}
}
return rst; return rst;
} }
@Override @Override
......
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