Commit 1c24ee1b authored by 李驰骋's avatar 李驰骋

Merge remote-tracking branch 'origin/master'

parents bd338b2b 37cedcbe
......@@ -7,19 +7,25 @@ import com.ximai.common.core.controller.BaseController;
import com.ximai.common.core.domain.AjaxResult;
import com.ximai.common.core.page.TableDataInfo;
import com.ximai.common.enums.BusinessType;
import com.ximai.common.utils.SecurityUtils;
import com.ximai.common.utils.data.ExceptionUtil;
import com.ximai.common.utils.data.StringUtils;
import com.ximai.mes.constant.TaskWorkunitStatusEnum;
import com.ximai.mes.md.domain.MdWorkunit;
import com.ximai.mes.md.domain.MdWorkunitWorker;
import com.ximai.mes.md.mapper.MdWorkunitWorkerMapper;
import com.ximai.mes.md.service.IMdWorkstationService;
import com.ximai.mes.md.service.IMdWorkunitService;
import com.ximai.mes.md.vo.MdWorkunitVo;
import com.ximai.mes.pro.domain.ProFeedback;
import com.ximai.mes.pro.domain.task.ProTaskAssistProcess;
import com.ximai.mes.pro.domain.vo.ProFeedbackVo;
import com.ximai.mes.pro.dto.ProFeedbackCheckListDto;
import com.ximai.mes.pro.mapper.ProFeedbackMapper;
import com.ximai.mes.pro.mapper.task.ProTaskAssistProcessMapper;
import com.ximai.mes.pro.service.IProFeedbackService;
import com.ximai.mes.pro.service.proWorkOrder.IProWorkOrderSoSizeItemService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
......@@ -50,11 +56,15 @@ public class ProFeedbackController extends BaseController {
@Resource
private ProTaskAssistProcessMapper proTaskAssistProcessMapper;
@Autowired
private IMdWorkunitService mdWorkunitService;
/**
* 查询生产报工记录列表
*/
@GetMapping("/list")
public TableDataInfo<ProFeedbackVo> list(ProFeedback proFeedback) {
public TableDataInfo<ProFeedbackVo> list(ProFeedbackCheckListDto proFeedbackCheckListDto) {
ProFeedback proFeedback = new ProFeedback();
BeanUtils.copyProperties(proFeedbackCheckListDto,proFeedback);
startPage();
QueryWrapper<ProFeedback> query = new QueryWrapper<>();
query.eq(StringUtils.isNotEmpty(proFeedback.getFeedbackType()), "f.feedback_type", proFeedback.getFeedbackType());
......@@ -67,6 +77,12 @@ public class ProFeedbackController extends BaseController {
query.eq(proFeedback.getLastFeedback() != null , "f.Last_Feedback", proFeedback.getLastFeedback());
// query.eq(StringUtils.isNotEmpty(proFeedback.getUserId()), "pww.user_id", proFeedback.getUserId());
query.eq(StringUtils.isNotEmpty(proFeedback.getWorkunitId()), "tw.workunit_id", proFeedback.getWorkunitId());
if(proFeedbackCheckListDto.getIsCheckUser() && StringUtils.isEmpty(proFeedback.getWorkunitId())){
List<MdWorkunitVo> mdWorkunitVolist = mdWorkunitService.selectMdWorkunitListByUser(new QueryWrapper<MdWorkunit>().eq("user_name", SecurityUtils.getUsername()));
if(mdWorkunitVolist.size() < 1)
return getDataTable(new ArrayList<>());
query.in(mdWorkunitVolist.size() > 0 , "tw.workunit_id", mdWorkunitVolist.stream().map(mdWorkunitVo -> mdWorkunitVo.getWorkunitId()).collect(Collectors.toList()));
}
query.eq(StringUtils.isNotEmpty(proFeedback.getTaskWorkunitId()), "tw.task_workunit_id", proFeedback.getTaskWorkunitId());
query.between(StringUtils.isNotEmpty(proFeedback.getCreateStartTime()) && StringUtils.isNotEmpty(proFeedback.getCreateEndTime()), "f.update_time", proFeedback.getCreateStartTime(), proFeedback.getCreateEndTime());
query.like(StringUtils.isNotEmpty(proFeedback.getNickName()), "f.nick_name", proFeedback.getNickName());
......@@ -91,6 +107,50 @@ public class ProFeedbackController extends BaseController {
return getDataTable(proFeedbackVoList);
}
/**
* 查询生产报工记录列表
*/
@GetMapping("/listByUserId")
public TableDataInfo<ProFeedbackVo> listByUserId(ProFeedback proFeedback) {
startPage();
List<MdWorkunitVo> mdWorkunitVolist = mdWorkunitService.selectMdWorkunitListByUser(new QueryWrapper<MdWorkunit>().eq("user_name", SecurityUtils.getUsername()));
if(mdWorkunitVolist.size() < 1)
return getDataTable(new ArrayList<>());
QueryWrapper<ProFeedback> query = new QueryWrapper<>();
query.eq(StringUtils.isNotEmpty(proFeedback.getFeedbackType()), "f.feedback_type", proFeedback.getFeedbackType());
query.eq(StringUtils.isNotEmpty(proFeedback.getStatus()), "f.status", proFeedback.getStatus());
query.eq(StringUtils.isNotEmpty(proFeedback.getAssistProcessCode()), "ap.assist_process_code", proFeedback.getAssistProcessCode());
query.eq(StringUtils.isNotEmpty(proFeedback.getWorkstationName()), "f.workstation_name", proFeedback.getWorkstationName());
query.eq(StringUtils.isNotEmpty(proFeedback.getItemName()), "it.item_name", proFeedback.getItemName());
query.eq(StringUtils.isNotEmpty(proFeedback.getWorkorderCode()), "f.workorder_code", proFeedback.getWorkorderCode());
query.eq(StringUtils.isNotEmpty(proFeedback.getSapItemCode()), "it.sap_item_code", proFeedback.getSapItemCode());
query.eq(proFeedback.getLastFeedback() != null , "f.Last_Feedback", proFeedback.getLastFeedback());
//query.eq(StringUtils.isNotEmpty(proFeedback.getUserId()), "pww.user_id", proFeedback.getUserId());
//query.eq(StringUtils.isNotEmpty(proFeedback.getWorkunitId()), "tw.workunit_id", proFeedback.getWorkunitId());
query.in(mdWorkunitVolist.size() > 0 , "tw.workunit_id", mdWorkunitVolist.stream().map(mdWorkunitVo -> mdWorkunitVo.getWorkunitId()).collect(Collectors.toList()));
query.eq(StringUtils.isNotEmpty(proFeedback.getTaskWorkunitId()), "tw.task_workunit_id", proFeedback.getTaskWorkunitId());
query.between(StringUtils.isNotEmpty(proFeedback.getCreateStartTime()) && StringUtils.isNotEmpty(proFeedback.getCreateEndTime()), "f.update_time", proFeedback.getCreateStartTime(), proFeedback.getCreateEndTime());
query.like(StringUtils.isNotEmpty(proFeedback.getNickName()), "f.nick_name", proFeedback.getNickName());
query.notIn("tw.status", TaskWorkunitStatusEnum.CLOSE.getStatus());
query.orderByAsc("f.feedback_time");
List<ProFeedbackVo> list = proFeedbackService.queryProFeedbackListJoinTaskWorkUnit(query);
List<ProFeedbackVo> proFeedbackVoList = new ArrayList<>();
if (proFeedback.getUserId() != null) {
List<MdWorkunitWorker> mdWorkunitWorkers = mdWorkunitWorkerMapper.selectListByQw(new QueryWrapper<MdWorkunitWorker>().eq("user_id", proFeedback.getUserId()));
Set<Long> collect = mdWorkunitWorkers.stream().map(MdWorkunitWorker::getWorkunitId).collect(Collectors.toSet());
// 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 = proFeedbackVoList.isEmpty() ? list : proFeedbackVoList;
proFeedbackVoList.forEach(s->{
if(IMdWorkstationService.OUTSOURCE_WORKSTATION_ID.equals(s.getWorkstationId())){
s.setAssistProcessCode(s.getTaskCode());
}
});
return getDataTable(proFeedbackVoList);
}
/**
* 获取生产报工记录详细信息
*/
......
......@@ -13,7 +13,11 @@ import com.ximai.common.core.page.TableDataInfo;
import com.ximai.common.enums.BusinessType;
import com.ximai.common.exception.ServiceException;
import com.ximai.common.utils.MessageUtils;
import com.ximai.common.utils.SecurityUtils;
import com.ximai.common.utils.data.StringUtils;
import com.ximai.mes.md.domain.MdWorkunit;
import com.ximai.mes.md.service.IMdWorkunitService;
import com.ximai.mes.md.vo.MdWorkunitVo;
import com.ximai.mes.pro.domain.ProFeedback;
import com.ximai.mes.pro.domain.ProProductQrcodeRecord;
import com.ximai.mes.pro.domain.proWorkOrder.ProWorkorder;
......@@ -99,6 +103,8 @@ public class ProTaskMobController extends BaseController {
private IProProductionSolutionProcessService proProductionSolutionProcessService;
@Autowired
ProProductionSolutionMapper proProductionSolutionMapper;
@Autowired
private IMdWorkunitService mdWorkunitService;
@GetMapping("/getlist")
public AjaxResult getIssueList(ProTaskIssue proTaskIssue) {
......@@ -118,6 +124,26 @@ public class ProTaskMobController extends BaseController {
return getDataTable(rst);
}
/**
* 查询工作站的生产任务
*/
@ApiOperation("查询状态未完成的生产任务接口")
@GetMapping("/getAllTaskList")
public TableDataInfo<ProTask> getAllTaskList(ProTaskQuery proTask) {
startPage();
List<MdWorkunitVo> list = mdWorkunitService.selectMdWorkunitListByUser(new QueryWrapper<MdWorkunit>().eq("user_name", SecurityUtils.getUsername()));
if(list.size() < 1){
return getDataTable(new ArrayList<ProTask>());
}
if(proTask == null){
proTask = new ProTaskQuery();
}
proTask.setWorkunitIdList(list.stream().map(mdWorkunitVo -> mdWorkunitVo.getWorkunitId()).collect(Collectors.toList()));
List<ProTask> rst = proTaskService.getTaskList(proTask);
return getDataTable(rst);
}
/**
* 查询工作站的生产任务
......
package com.ximai.mes.pro.domain.vo;
import com.ximai.mes.md.vo.MdWorkunitVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* 生产任务对象 ProTaskQuery
*
......@@ -36,5 +39,6 @@ public class ProTaskQuery {
@ApiModelProperty("是否外委确认,1:是 0:否")
private Integer outsourced;
@ApiModelProperty("作业单元ID组合")
private List<Long> workunitIdList;
}
package com.ximai.mes.pro.dto;
import com.ximai.mes.pro.domain.ProFeedback;
import lombok.Data;
@Data
public class ProFeedbackCheckListDto extends ProFeedback {
Boolean isCheckUser = false;
}
......@@ -1354,11 +1354,12 @@ public class ProTaskServiceImpl implements IProTaskService {
TaskStatusEnum.PAUSE.getStatus(), TaskStatusEnum.ERROR_STOP.getStatus());
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.arrange_code", proTask.getArrangeCode());
query.gt(proTask.getAllowProduce() != null && proTask.getAllowProduce() == 1, "t.quantity_wait", 0);
query.gt("ptw.quantity", 0);
query.orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date");
query.orderByAsc("t.workstation_id").orderByAsc("ptw.workunit_id").orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date");
//搜索条件为工单号查询相应任务ID作为查询条件
// if (StringUtils.isNotEmpty(proTask.getWorkorderCode())) {
// QueryWrapper<ProTask> taskQuery = new QueryWrapper<>();
......@@ -1382,11 +1383,12 @@ public class ProTaskServiceImpl implements IProTaskService {
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.gt("ptw.quantity", 0);
query.orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date");
query.orderByAsc("t.workstation_id").orderByAsc("ptw.workunit_id").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());
......
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