生产报工修改

This commit is contained in:
DESKTOP-J7ED0MB\yinjinlu 2022-11-01 22:50:57 +08:00
parent 042e8af180
commit 73a96ef841
10 changed files with 99 additions and 19 deletions

View File

@ -288,6 +288,9 @@ create table pro_feedback (
workorder_id bigint(20) not null comment '生产工单ID', workorder_id bigint(20) not null comment '生产工单ID',
workorder_code varchar(64) comment '生产工单编号', workorder_code varchar(64) comment '生产工单编号',
workorder_name varchar(255) comment '生产工单名称', workorder_name varchar(255) comment '生产工单名称',
process_id bigint(20) not null comment '工序ID',
process_code varchar(64) comment '工序编码',
process_name varchar(255) comment '工序名称',
task_id bigint(20) comment '生产任务ID', task_id bigint(20) comment '生产任务ID',
task_code varchar(64) comment '生产任务编号', task_code varchar(64) comment '生产任务编号',
item_id bigint(20) not null comment '产品物料ID', item_id bigint(20) not null comment '产品物料ID',

View File

@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants; import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.StringUtils;
import com.ktg.mes.md.domain.MdWorkstation;
import com.ktg.mes.md.service.IMdWorkstationService;
import com.ktg.mes.pro.domain.*; import com.ktg.mes.pro.domain.*;
import com.ktg.mes.pro.service.IProRouteProcessService; import com.ktg.mes.pro.service.IProRouteProcessService;
import com.ktg.mes.pro.service.IProTaskService; import com.ktg.mes.pro.service.IProTaskService;
@ -58,6 +60,9 @@ public class ProFeedbackController extends BaseController
@Autowired @Autowired
private IProWorkorderService proWorkorderService; private IProWorkorderService proWorkorderService;
@Autowired
private IMdWorkstationService mdWorkstationService;
@Autowired @Autowired
private IWmItemConsumeService wmItemConsumeService; private IWmItemConsumeService wmItemConsumeService;
@ -110,6 +115,13 @@ public class ProFeedbackController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ProFeedback proFeedback) public AjaxResult add(@RequestBody ProFeedback proFeedback)
{ {
MdWorkstation workstation = mdWorkstationService.selectMdWorkstationByWorkstationId(proFeedback.getWorkstationId());
proFeedback.setProcessId(workstation.getProcessId());
proFeedback.setProcessCode(workstation.getProcessCode());
proFeedback.setProcessName(workstation.getProcessName());
//根据生产工单工作站工序 查找对应的生产任务
return toAjax(proFeedbackService.insertProFeedback(proFeedback)); return toAjax(proFeedbackService.insertProFeedback(proFeedback));
} }
@ -165,7 +177,9 @@ public class ProFeedbackController extends BaseController
//如果是关键工序则更新当前工单的已生产数量进行产品产出动作 //如果是关键工序则更新当前工单的已生产数量进行产品产出动作
if(proRouteProcessService.checkKeyProcess(feedback)){ if(proRouteProcessService.checkKeyProcess(feedback)){
//更新生产工单的生产数量 //更新生产工单的生产数量
workorder.setQuantityProduced(workorder.getQuantityProduced().add(feedback.getQuantityFeedback())); BigDecimal produced = workorder.getQuantityProduced() == null?new BigDecimal(0):workorder.getQuantityProduced();
BigDecimal feedBackQuantity = feedback.getQuantityFeedback() ==null?new BigDecimal(0):feedback.getQuantityFeedback();
workorder.setQuantityProduced( produced.add(feedBackQuantity));
proWorkorderService.updateProWorkorder(workorder); proWorkorderService.updateProWorkorder(workorder);
//生成产品产出记录单 //生成产品产出记录单

View File

@ -1,5 +1,6 @@
package com.ktg.mes.pro.controller; package com.ktg.mes.pro.controller;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -117,7 +118,9 @@ public class ProTaskController extends BaseController
if(workorder.getParentId().longValue()!=0L){ if(workorder.getParentId().longValue()!=0L){
wdata.setParent("MO"+workorder.getParentId().toString()); wdata.setParent("MO"+workorder.getParentId().toString());
} }
wdata.setProgress(0f); BigDecimal produced = workorder.getQuantityProduced();
BigDecimal quantitiy = workorder.getQuantity();
wdata.setProgress( produced.divide(quantitiy).floatValue());
wdata.setDuration(0L); wdata.setDuration(0L);
wdata.setType(UserConstants.GANTT_TASK_TYPE_PROJECT); wdata.setType(UserConstants.GANTT_TASK_TYPE_PROJECT);
ganttData.add(wdata); ganttData.add(wdata);
@ -139,7 +142,9 @@ public class ProTaskController extends BaseController
data.setQuantity(task.getQuantity()); data.setQuantity(task.getQuantity());
data.setProcess(task.getProcessName()); data.setProcess(task.getProcessName());
data.setWorkstation(task.getWorkstationName()); data.setWorkstation(task.getWorkstationName());
data.setProgress(0f); BigDecimal taskproduced = task.getQuantityProduced();
BigDecimal taskquantitiy = task.getQuantity();
data.setProgress(taskproduced.divide(taskquantitiy).floatValue());
data.setType(UserConstants.GANTT_TASK_TYPE_TASK); data.setType(UserConstants.GANTT_TASK_TYPE_TASK);
ganttData.add(data); ganttData.add(data);
} }

View File

@ -36,6 +36,17 @@ public class ProFeedback extends BaseEntity
@Excel(name = "工作站名称") @Excel(name = "工作站名称")
private String workstationName; private String workstationName;
/** 工序ID */
private Long processId;
/** 工序编码 */
@Excel(name = "工序编码")
private String processCode;
/** 工序名称 */
@Excel(name = "工序名称")
private String processName;
/** 生产工单ID */ /** 生产工单ID */
@Excel(name = "生产工单ID") @Excel(name = "生产工单ID")
private Long workorderId; private Long workorderId;
@ -175,6 +186,30 @@ public class ProFeedback extends BaseEntity
this.workorderId = workorderId; this.workorderId = workorderId;
} }
public Long getProcessId() {
return processId;
}
public void setProcessId(Long processId) {
this.processId = processId;
}
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public Long getWorkorderId() public Long getWorkorderId()
{ {
return workorderId; return workorderId;
@ -404,6 +439,9 @@ public class ProFeedback extends BaseEntity
", workstationId=" + workstationId + ", workstationId=" + workstationId +
", workstationCode='" + workstationCode + '\'' + ", workstationCode='" + workstationCode + '\'' +
", workstationName='" + workstationName + '\'' + ", workstationName='" + workstationName + '\'' +
", processId=" + processId +
", processCode='" + processCode + '\'' +
", processName='" + processName + '\'' +
", workorderId=" + workorderId + ", workorderId=" + workorderId +
", workorderCode='" + workorderCode + '\'' + ", workorderCode='" + workorderCode + '\'' +
", workorderName='" + workorderName + '\'' + ", workorderName='" + workorderName + '\'' +

View File

@ -101,8 +101,8 @@ public class ProRouteProcessServiceImpl implements IProRouteProcessService
ProRouteProduct param = new ProRouteProduct(); ProRouteProduct param = new ProRouteProduct();
param.setItemId(feedback.getItemId()); param.setItemId(feedback.getItemId());
List<ProRouteProduct> products = proRouteProductMapper.selectProRouteProductList(param); List<ProRouteProduct> products = proRouteProductMapper.selectProRouteProductList(param);
if(!CollectionUtil.isNotEmpty(products)){ if(CollectionUtil.isNotEmpty(products)){
products = products.stream().filter(item -> proRouteMapper.selectProRouteByRouteId(item.getRouteId()).getEnableFlag()==UserConstants.YES).collect(Collectors.toList()); products = products.stream().filter(item -> proRouteMapper.selectProRouteByRouteId(item.getRouteId()).getEnableFlag().equals(UserConstants.YES)).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(products)){ if (CollectionUtil.isNotEmpty(products)){
routeId = products.get(0).getRouteId(); routeId = products.get(0).getRouteId();
} }

View File

@ -173,7 +173,7 @@ public class WmItemConsumeServiceImpl implements IWmItemConsumeService
line.setItemName(bom.getItemName()); line.setItemName(bom.getItemName());
line.setSpecification(bom.getSpecification()); line.setSpecification(bom.getSpecification());
line.setUnitOfMeasure(bom.getUnitOfMeasure()); line.setUnitOfMeasure(bom.getUnitOfMeasure());
line.setQuantityConsume(bom.getQuantity().multiply(feedback.getQuantity())); line.setQuantityConsume(bom.getQuantity().multiply(feedback.getQuantityFeedback()));
line.setBatchCode(workorder.getBatchCode()); line.setBatchCode(workorder.getBatchCode());
wmItemConsumeLineMapper.insertWmItemConsumeLine(line); wmItemConsumeLineMapper.insertWmItemConsumeLine(line);
} }

View File

@ -160,7 +160,7 @@ public class WmProductProduceServiceImpl implements IWmProductProduceService
line.setItemName(feedback.getItemName()); line.setItemName(feedback.getItemName());
line.setSpecification(feedback.getSpecification()); line.setSpecification(feedback.getSpecification());
line.setUnitOfMeasure(feedback.getUnitOfMeasure()); line.setUnitOfMeasure(feedback.getUnitOfMeasure());
line.setQuantityProduce(feedback.getQuantity()); line.setQuantityProduce(feedback.getQuantityFeedback());
line.setBatchCode(workorder.getBatchCode()); line.setBatchCode(workorder.getBatchCode());
wmProductProduceLineMapper.insertWmProductProduceLine(line); wmProductProduceLineMapper.insertWmProductProduceLine(line);
return productProduce; return productProduce;

View File

@ -13,6 +13,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="workorderId" column="workorder_id" /> <result property="workorderId" column="workorder_id" />
<result property="workorderCode" column="workorder_code" /> <result property="workorderCode" column="workorder_code" />
<result property="workorderName" column="workorder_name" /> <result property="workorderName" column="workorder_name" />
<result property="processId" column="process_id" />
<result property="processCode" column="process_code" />
<result property="processName" column="process_name" />
<result property="taskId" column="task_id" /> <result property="taskId" column="task_id" />
<result property="taskCode" column="task_code" /> <result property="taskCode" column="task_code" />
<result property="itemId" column="item_id" /> <result property="itemId" column="item_id" />
@ -42,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProFeedbackVo"> <sql id="selectProFeedbackVo">
select record_id,feedback_type, workstation_id, workstation_code, workstation_name, workorder_id, workorder_code, workorder_name, task_id, task_code,item_id,item_code,item_name,specification,unit_of_measure, quantity, quantity_feedback, quantity_qualified, quantity_unquanlified, user_name, nick_name, feedback_channel, feedback_time,record_user,record_nick,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_feedback select record_id,feedback_type, workstation_id, workstation_code, workstation_name,process_id, process_code, process_name, workorder_id, workorder_code, workorder_name, task_id, task_code,item_id,item_code,item_name,specification,unit_of_measure, quantity, quantity_feedback, quantity_qualified, quantity_unquanlified, user_name, nick_name, feedback_channel, feedback_time,record_user,record_nick,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_feedback
</sql> </sql>
<select id="selectProFeedbackList" parameterType="ProFeedback" resultMap="ProFeedbackResult"> <select id="selectProFeedbackList" parameterType="ProFeedback" resultMap="ProFeedbackResult">
@ -52,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="feedbackType !=null "> and feedback_type = #{feedbackType}</if> <if test="feedbackType !=null "> and feedback_type = #{feedbackType}</if>
<if test="workstationCode != null and workstationCode != ''"> and workstation_code = #{workstationCode}</if> <if test="workstationCode != null and workstationCode != ''"> and workstation_code = #{workstationCode}</if>
<if test="workstationName != null and workstationName != ''"> and workstation_name like concat('%', #{workstationName}, '%')</if> <if test="workstationName != null and workstationName != ''"> and workstation_name like concat('%', #{workstationName}, '%')</if>
<if test="processId != null "> and process_id = #{processId}</if>
<if test="processCode != null and processCode != ''"> and process_code = #{processCode}</if>
<if test="processName != null and processName != ''"> and process_name like concat('%', #{processName}, '%')</if>
<if test="workorderId != null "> and workorder_id = #{workorderId}</if> <if test="workorderId != null "> and workorder_id = #{workorderId}</if>
<if test="workorderCode != null and workorderCode != ''"> and workorder_code = #{workorderCode}</if> <if test="workorderCode != null and workorderCode != ''"> and workorder_code = #{workorderCode}</if>
<if test="workorderName != null and workorderName != ''"> and workorder_name like concat('%', #{workorderName}, '%')</if> <if test="workorderName != null and workorderName != ''"> and workorder_name like concat('%', #{workorderName}, '%')</if>
@ -88,6 +94,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="workstationId != null">workstation_id,</if> <if test="workstationId != null">workstation_id,</if>
<if test="workstationCode != null">workstation_code,</if> <if test="workstationCode != null">workstation_code,</if>
<if test="workstationName != null">workstation_name,</if> <if test="workstationName != null">workstation_name,</if>
<if test="processId != null">process_id,</if>
<if test="processCode != null">process_code,</if>
<if test="processName != null">process_name,</if>
<if test="workorderId != null">workorder_id,</if> <if test="workorderId != null">workorder_id,</if>
<if test="workorderCode != null">workorder_code,</if> <if test="workorderCode != null">workorder_code,</if>
<if test="workorderName != null">workorder_name,</if> <if test="workorderName != null">workorder_name,</if>
@ -124,6 +133,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="workstationId != null">#{workstationId},</if> <if test="workstationId != null">#{workstationId},</if>
<if test="workstationCode != null">#{workstationCode},</if> <if test="workstationCode != null">#{workstationCode},</if>
<if test="workstationName != null">#{workstationName},</if> <if test="workstationName != null">#{workstationName},</if>
<if test="processId != null">#{processId},</if>
<if test="processCode != null">#{processCode},</if>
<if test="processName != null">#{processName},</if>
<if test="workorderId != null">#{workorderId},</if> <if test="workorderId != null">#{workorderId},</if>
<if test="workorderCode != null">#{workorderCode},</if> <if test="workorderCode != null">#{workorderCode},</if>
<if test="workorderName != null">#{workorderName},</if> <if test="workorderName != null">#{workorderName},</if>
@ -164,6 +176,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="workstationId != null">workstation_id = #{workstationId},</if> <if test="workstationId != null">workstation_id = #{workstationId},</if>
<if test="workstationCode != null">workstation_code = #{workstationCode},</if> <if test="workstationCode != null">workstation_code = #{workstationCode},</if>
<if test="workstationName != null">workstation_name = #{workstationName},</if> <if test="workstationName != null">workstation_name = #{workstationName},</if>
<if test="processId != null">process_id = #{processId},</if>
<if test="processCode != null">process_code = #{processCode},</if>
<if test="processName != null">process_name = #{processName},</if>
<if test="workorderId != null">workorder_id = #{workorderId},</if> <if test="workorderId != null">workorder_id = #{workorderId},</if>
<if test="workorderCode != null">workorder_code = #{workorderCode},</if> <if test="workorderCode != null">workorder_code = #{workorderCode},</if>
<if test="workorderName != null">workorder_name = #{workorderName},</if> <if test="workorderName != null">workorder_name = #{workorderName},</if>

View File

@ -24,9 +24,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="unitOfMeasure" column="unit_of_measure" /> <result property="unitOfMeasure" column="unit_of_measure" />
<result property="quantity" column="quantity" /> <result property="quantity" column="quantity" />
<result property="quantityProduced" column="quantity_produced" /> <result property="quantityProduced" column="quantity_produced" />
<result property="quantityChanged" column="quantity_changed" />
<result property="status" column="status" />
<result property="quantityQuanlify" column="quantity_quanlify" /> <result property="quantityQuanlify" column="quantity_quanlify" />
<result property="quantityUnquanlify" column="quantity_unquanlify" /> <result property="quantityUnquanlify" column="quantity_unquanlify" />
<result property="quantityChanged" column="quantity_changed" />
<result property="clientId" column="client_id" /> <result property="clientId" column="client_id" />
<result property="clientCode" column="client_code" /> <result property="clientCode" column="client_code" />
<result property="clientName" column="client_name" /> <result property="clientName" column="client_name" />
@ -36,7 +37,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="endTime" column="end_time" /> <result property="endTime" column="end_time" />
<result property="colorCode" column="color_code" /> <result property="colorCode" column="color_code" />
<result property="requestDate" column="request_date" /> <result property="requestDate" column="request_date" />
<result property="status" column="status" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="attr1" column="attr1" /> <result property="attr1" column="attr1" />
<result property="attr2" column="attr2" /> <result property="attr2" column="attr2" />
@ -46,10 +46,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectProTaskVo"> <sql id="selectProTaskVo">
select task_id, task_code, task_name, workorder_id, workorder_code, workorder_name, workstation_id, workstation_code, workstation_name,process_id,process_code,process_name, item_id, item_code, item_name, specification, unit_of_measure, quantity, quantity_produced,quantity_quanlify,quantity_unquanlify, quantity_changed, client_id, client_code, client_name, client_nick, start_time, duration, end_time, color_code, request_date, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_task select task_id, task_code, task_name, workorder_id, workorder_code, workorder_name, workstation_id, workstation_code, workstation_name, process_id, process_code, process_name, item_id, item_code, item_name, specification, unit_of_measure, quantity, quantity_produced, quantity_changed, client_id, client_code, client_name, client_nick, start_time, duration, end_time, color_code, request_date, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, status, quantity_quanlify, quantity_unquanlify from pro_task
</sql> </sql>
<select id="selectProTaskList" parameterType="ProTask" resultMap="ProTaskResult"> <select id="selectProTaskList" parameterType="ProTask" resultMap="ProTaskResult">
@ -73,8 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="unitOfMeasure != null and unitOfMeasure != ''"> and unit_of_measure = #{unitOfMeasure}</if> <if test="unitOfMeasure != null and unitOfMeasure != ''"> and unit_of_measure = #{unitOfMeasure}</if>
<if test="quantity != null "> and quantity = #{quantity}</if> <if test="quantity != null "> and quantity = #{quantity}</if>
<if test="quantityProduced != null "> and quantity_produced = #{quantityProduced}</if> <if test="quantityProduced != null "> and quantity_produced = #{quantityProduced}</if>
<if test="quantityQuanlify != null "> and quantity_quanlify = #{quantityQuanlify}</if>
<if test="quantityUnquanlify != null "> and quantity_unquanlify = #{quantityUnquanlify}</if>
<if test="quantityChanged != null "> and quantity_changed = #{quantityChanged}</if> <if test="quantityChanged != null "> and quantity_changed = #{quantityChanged}</if>
<if test="clientId != null "> and client_id = #{clientId}</if> <if test="clientId != null "> and client_id = #{clientId}</if>
<if test="clientCode != null and clientCode != ''"> and client_code = #{clientCode}</if> <if test="clientCode != null and clientCode != ''"> and client_code = #{clientCode}</if>
@ -85,8 +85,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endTime != null "> and end_time = #{endTime}</if> <if test="endTime != null "> and end_time = #{endTime}</if>
<if test="colorCode != null and colorCode != ''"> and color_code = #{colorCode}</if> <if test="colorCode != null and colorCode != ''"> and color_code = #{colorCode}</if>
<if test="requestDate != null "> and request_date = #{requestDate}</if> <if test="requestDate != null "> and request_date = #{requestDate}</if>
<if test="status != null "> and status = #{status}</if> <if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
order by request_date asc <if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null "> and attr3 = #{attr3}</if>
<if test="attr4 != null "> and attr4 = #{attr4}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="quantityQuanlify != null "> and quantity_quanlify = #{quantityQuanlify}</if>
<if test="quantityUnquanlify != null "> and quantity_unquanlify = #{quantityUnquanlify}</if>
</where> </where>
</select> </select>

View File

@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectProWorkorderVo"> <sql id="selectProWorkorderVo">
select workorder_id, workorder_code, workorder_name, order_source, source_code, product_id, product_code, product_name, product_spc, unit_of_measure,batch_code, quantity, client_id, client_code, client_name, request_date, parent_id, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_workorder select workorder_id, workorder_code, workorder_name, order_source, source_code, product_id, product_code, product_name, product_spc, unit_of_measure,batch_code, quantity,quantity_produced, client_id, client_code, client_name, request_date, parent_id, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from pro_workorder
</sql> </sql>
<select id="selectProWorkorderList" parameterType="ProWorkorder" resultMap="ProWorkorderResult"> <select id="selectProWorkorderList" parameterType="ProWorkorder" resultMap="ProWorkorderResult">