Commit 19d0107a authored by 李驰骋's avatar 李驰骋

Merge remote-tracking branch 'origin/master'

parents 51b694f3 9caabae9
......@@ -5,6 +5,8 @@ import com.ximai.mes.pro.domain.ProFeedback;
import com.ximai.mes.pro.domain.vo.ProFeedbackVo;
import com.ximai.mes.pro.domain.vo.ProProcessTaskVo;
import com.ximai.mes.pro.dto.ProFeedbackDto;
import com.ximai.mes.report.request.FeedbackRequest;
import com.ximai.mes.report.response.FeedbackResponse;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;
......@@ -121,4 +123,6 @@ public interface ProFeedbackMapper {
void updateAbnormal(@Param("abnormalId") Long abnormalId, @Param("abnormalReason")String abnormalReason, @Param("abnormalRemark")String abnormalRemark,@Param("abnormalType") String abnormalType,@Param("recordId") Long recordId);
void updateLastFeedback(@Param("qrcode")String qrcode, @Param("taskId")Long taskId);
List<FeedbackResponse> getList(FeedbackRequest feedbackRequest);
}
......@@ -1345,25 +1345,35 @@ public class ProTaskServiceImpl implements IProTaskService {
query.gt("ptw.quantity", 0);
query.orderByAsc("statusIndex").orderByAsc("ptw.schedule_start_date");
//搜索条件为工单号查询相应任务ID作为查询条件
if (StringUtils.isNotEmpty(proTask.getWorkorderCode())) {
QueryWrapper<ProTask> taskQuery = new QueryWrapper<>();
taskQuery.eq("t2.workorder_code", proTask.getWorkorderCode());
taskQuery.eq(proTask.getWorkunitId() != null, "t4.workunit_id", proTask.getWorkunitId());
List<ProTaskVo> taskVoList = proTaskMapper.selectProTaskJoinWorkorder(taskQuery);
if (CollectionUtil.isEmpty(taskVoList)) {
if (CollectionUtil.isNotEmpty(rst)) {
for (ProTask task : rst) {
Double v = proFeedbackService.selectQuantityQualifySum(new ProFeedback(task.getArrangeCode(), null, null, task.getTaskWorkunitId()));
task.setArrangeFeedbackSum(v);
}
}
return rst;
} else {
query.in("t.task_id", taskVoList.stream().map(ProTaskVo::getTaskId).collect(Collectors.toList()));
}
}
// if (StringUtils.isNotEmpty(proTask.getWorkorderCode())) {
// QueryWrapper<ProTask> taskQuery = new QueryWrapper<>();
// taskQuery.eq("t2.workorder_code", proTask.getWorkorderCode());
// taskQuery.eq(proTask.getWorkunitId() != null, "t4.workunit_id", proTask.getWorkunitId());
// List<ProTaskVo> taskVoList = proTaskMapper.selectProTaskJoinWorkorder(taskQuery);
// if (CollectionUtil.isEmpty(taskVoList)) {
// if (CollectionUtil.isNotEmpty(rst)) {
// for (ProTask task : rst) {
// Double v = proFeedbackService.selectQuantityQualifySum(new ProFeedback(task.getArrangeCode(), null, null, task.getTaskWorkunitId()));
// task.setArrangeFeedbackSum(v);
// }
// }
// 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.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");
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) {
......
......@@ -5,24 +5,33 @@ import com.ximai.common.core.controller.BaseController;
import com.ximai.common.core.domain.AjaxResult;
import com.ximai.common.enums.BusinessType;
import com.ximai.mes.report.request.FeedbackRequest;
import com.ximai.mes.report.response.FeedbackResponse;
import com.ximai.mes.report.service.FeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api("生产报工")
@RestController
@RequestMapping("/report/pro/feedback")
public class FeedbackController extends BaseController {
@Autowired
FeedbackService feedbackService;
/**
* 新增生产报工记录
*/
@ApiOperation("新增报工单接口")
@PreAuthorize("@ss.hasPermi('mes:pro:feedback:add')")
@Log(title = "生产报工记录", businessType = BusinessType.QUERY)
@GetMapping
public AjaxResult add(@RequestBody FeedbackRequest feedbackRequest) {
@GetMapping("/getList")
public AjaxResult getList(@RequestBody FeedbackRequest feedbackRequest) {
List<FeedbackResponse> feedbackResponseList = feedbackService.getList(feedbackRequest);
return null;
}
}
......@@ -55,6 +55,12 @@ public class FeedbackRequest {
@ApiModelProperty(name = "产品编号")
private String productCode;
/**
* 产品编号
*/
@ApiModelProperty(name = "产品编号")
private String productId;
/**
* 产品名称
*/
......@@ -76,9 +82,7 @@ public class FeedbackRequest {
/**
* 车间ID
*/
@Excel(name = "车间ID")
@ApiModelProperty("车间ID")
private Long workshopId;
@ApiModelProperty("车间名称")
private String workshopName;
......
package com.ximai.mes.report.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ximai.common.annotation.Excel;
import com.ximai.mes.pro.domain.ProFeedback;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
public class FeedbackResponse extends ProFeedback {
/**
* 工单类型,项目号,订单号,
* 生产工单,产品编码,产品名称,
* 工序任务(报工表),工序名称,
* 工作中心编码(报工表),工作中心名称,
* 工作单元编码(报工表),工作单元名称,
* 报工人员编码(报工表),报工人员名称,
* 派工数量(报工表,派工数量为0不显示),
* 报工数量,合格数量,不合格数量,
* 不合格原因,标准工时(派工表),
* 实际工时(报工表),
* 计划完成时间(派工表),报工时间(报工表)
*/
/**
* 工单类型
*/
@ApiModelProperty(name = "工单类型")
private String workorderType;
@ApiModelProperty("客户项目号")
private String customerProjectNo;
@ApiModelProperty("订单单号")
private String orderCode;
@ApiModelProperty(name = "工单编码")
private String workorderCode;
/**
* 产品编号
*/
@ApiModelProperty(name = "产品编号")
private String productCode;
/**
* 产品名称
*/
@ApiModelProperty(name = "产品名称")
private String productName;
/**
* 任务编号
*/
@ApiModelProperty(name = "工序任务号")
private String taskCode;
/**
* 工序名称
*/
@ApiModelProperty(name = "工序名称")
private String processName;
/**
* 工作中心编号
*/
@ApiModelProperty(name = "工作中心编号")
private String workstationCode;
/**
* 工作中心名称
*/
@ApiModelProperty(name = "工作中心名称")
private String workstationName;
/**
*
*/
@ApiModelProperty("工作单元ID")
private Long workunitId;
@ApiModelProperty("工作单元名称")
private String workunitName;
@ApiModelProperty("报工人员")
private String userName;
@ApiModelProperty("报工人员名称")
private String nickName;
/**
* 排产数量
*/
@ApiModelProperty(name = "派工数量")
private BigDecimal quantity;
/**
* 本次报工数量
*/
@ApiModelProperty(name = "本次报工数量")
private BigDecimal quantityFeedback;
/**
* 合格品数量
*/
@ApiModelProperty(name = "合格品数量")
private BigDecimal quantityQualify;
/**
* 不良品数量
*/
@ApiModelProperty(name = "不良品数量")
private BigDecimal quantityUnqualify;
/** 异常原因 */
@ApiModelProperty(name = "异常原因")
private String abnormalReason;
@ApiModelProperty("标准工时")
private BigDecimal stdWorkingTime;
@ApiModelProperty("实际工时")
private String machineTime;
/**
* 预计结束时间
*/
@ApiModelProperty("计划结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndDate;
/**
* 报工时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(name = "报工时间")
private Date feedbackTime;
}
package com.ximai.mes.report.service;
import com.ximai.mes.report.request.FeedbackRequest;
import com.ximai.mes.report.response.FeedbackResponse;
import java.util.List;
public interface FeedbackService {
List<FeedbackResponse> getList(FeedbackRequest feedbackRequest);
}
package com.ximai.mes.report.service.impl;
import com.ximai.mes.pro.domain.ProFeedback;
import com.ximai.mes.pro.mapper.ProFeedbackMapper;
import com.ximai.mes.report.request.FeedbackRequest;
import com.ximai.mes.report.response.FeedbackResponse;
import com.ximai.mes.report.service.FeedbackService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class FeedbackServiceImp implements FeedbackService {
@Autowired
ProFeedbackMapper proFeedbackMapper;
@Override
public List<FeedbackResponse> getList(FeedbackRequest feedbackRequest) {
return proFeedbackMapper.getList(feedbackRequest);
}
}
......@@ -168,6 +168,54 @@
<include refid="selectProFeedbackVo"/>
where f.record_id = #{recordId}
</select>
<select id="getList" resultType="com.ximai.mes.report.response.FeedbackResponse">
select
workorder.workorder_Type,
workorder.customer_Project_No,
workorder.order_Code,
workorder.workorder_Code,
workorder.product_Code,
workorder.product_Name,
pt.task_Code,
pt.process_Name,
pt.workstation_code,
pt.workstation_Name,
workunit.workunit_id,
mw.workunit_name,
f.user_name,
f.nick_name,
f.quantity,
f.quantity_qualify,
f.quantity_unqualify,
f.quantity_feedback,
f.abnormal_reason,
f.machine_time,
f.feedback_time,
workunit.std_working_time,
workunit.schedule_end_date
from pro_feedback f
left join pro_task_workunit workunit on workunit.task_id = f.task_id
left join pro_task pt on f.task_id = pt.task_id
left join pro_workorder workorder on workorder.workorder_id = f.workorder_id
LEFT JOIN md_item it ON it.item_id = f.item_id
left join md_workunit mw on workunit.workunit_id = mw.workunit_id
left join md_workstation workstation on workstation.workstation_id = mw.workstation_id
<where>
<if test="workorderType != null and workorderType != ''">and workorder.workorder_Type = #{workorderType}</if>
<if test="customerProjectNo!= null and customerProjectNo != '' ">and workorder.customer_Project_No like '%${customerProjectNo}%'</if>
<if test="orderCode != null and orderCode != '' ">and workorder.order_Code like '%${orderCode}%'</if>
<if test="workorderCode != null and workorderCode != '' ">and workorder.workorder_Code like '%${workorderCode}%' </if>
<if test="taskCode != null and taskCode != '' ">and pt.task_Code like '%${taskCode}%'</if>
<if test="productCode != null and productCode != '' ">and workorder.product_Code like '%${productCode}%' </if>
<if test=" productId != null">and workorder.product_Id = #{productId}</if>
<if test=" processId != null ">and pt.process_id = #{processId}</if>
<if test=" workshopId != null">and workstation.workshop_Id = #{workshopId}</if>
<if test=" workstationId != null">and workstation.workstation_id = #{workstationId} </if>
<if test=" workunitId != null">and workunit.workunit_id = #{workunitId}</if>
<if test=" userName != null and userName != '' ">and f.user_Name like '%${userName}%%'</if>
<if test=" startDate != null and endDate != null">and feedback_time BETWEEN #{startDate} AND #{endDate}</if>
</where>
</select>
<insert id="insertProFeedback" parameterType="ProFeedback" useGeneratedKeys="true" keyProperty="recordId">
insert into pro_feedback
......
......@@ -175,7 +175,9 @@
<if test="sapPrototypeMakeCode != null">sap_prototype_make_code,</if>
<if test="unitPrice != null">unit_price,</if>
<if test="surpassState != null">surpass_state,</if>
<if test="url != null">url,</if>
<if test="filePath != null">file_path,</if>
<if test="originalFilename != null">original_filename,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productionSolutionCode != null">#{productionSolutionCode},</if>
......@@ -206,6 +208,9 @@
<if test="sapPrototypeMakeCode != null">#{sapPrototypeMakeCode},</if>
<if test="unitPrice != null">#{unitPrice},</if>
<if test="surpassState != null">#{surpassState},</if>
<if test="url != null">#{url},</if>
<if test="filePath != null">#{filePath},</if>
<if test="originalFilename != null">#{originalFilename},</if>
</trim>
</insert>
......
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