生产排产

This commit is contained in:
JinLu.Yin 2022-05-15 19:27:08 +08:00
parent 5956298a02
commit 491f674fe5
7 changed files with 203 additions and 3 deletions

View File

@ -3,10 +3,14 @@ package com.ktg.mes.pro.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
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.pro.domain.ProProcess; import com.ktg.mes.pro.domain.ProProcess;
import com.ktg.mes.pro.domain.ProRouteProduct;
import com.ktg.mes.pro.domain.ProWorkorder;
import com.ktg.mes.pro.service.IProProcessService; import com.ktg.mes.pro.service.IProProcessService;
import com.ktg.mes.pro.service.IProRouteProductService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -39,6 +43,9 @@ public class ProRouteProcessController extends BaseController
@Autowired @Autowired
private IProRouteProcessService proRouteProcessService; private IProRouteProcessService proRouteProcessService;
@Autowired
private IProRouteProductService proRouteProductService;
@Autowired @Autowired
private IProProcessService proProcessService; private IProProcessService proProcessService;
@ -54,6 +61,28 @@ public class ProRouteProcessController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询指定产品的工艺组成
* @return
*/
@PreAuthorize("@ss.hasPermi('mes:pro:routeproduct:list')")
@GetMapping("/listProductProcess")
public AjaxResult listProductProcess(Long productId){
ProRouteProduct proRouteProduct = new ProRouteProduct();
proRouteProduct.setItemId(productId);
List<ProRouteProduct> products = proRouteProductService.selectProRouteProductList(proRouteProduct);
if(CollUtil.isNotEmpty(products)){
ProRouteProduct product = products.get(0);
ProRouteProcess param = new ProRouteProcess();
param.setRouteId(product.getRouteId());
return AjaxResult.success(proRouteProcessService.selectProRouteProcessList(param));
}else {
return AjaxResult.error("当前产品未配置工艺路线!");
}
}
/** /**
* 导出工艺组成列表 * 导出工艺组成列表
*/ */

View File

@ -49,6 +49,7 @@ public class ProRouteProductController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 导出产品制程列表 * 导出产品制程列表
*/ */

View File

@ -2,6 +2,13 @@ package com.ktg.mes.pro.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.pro.domain.ProProcess;
import com.ktg.mes.pro.domain.ProWorkorder;
import com.ktg.mes.pro.service.IProProcessService;
import com.ktg.mes.pro.service.IProWorkorderService;
import com.ktg.system.strategy.AutoCodeUtil;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -28,12 +35,21 @@ import com.ktg.common.core.page.TableDataInfo;
* @date 2022-05-14 * @date 2022-05-14
*/ */
@RestController @RestController
@RequestMapping("/pro/protask") @RequestMapping("/mes/pro/protask")
public class ProTaskController extends BaseController public class ProTaskController extends BaseController
{ {
@Autowired @Autowired
private IProTaskService proTaskService; private IProTaskService proTaskService;
@Autowired
private IProWorkorderService proWorkorderService;
@Autowired
private IProProcessService proProcessService;
@Autowired
private AutoCodeUtil autoCodeUtil;
/** /**
* 查询生产任务列表 * 查询生产任务列表
*/ */
@ -69,6 +85,21 @@ public class ProTaskController extends BaseController
return AjaxResult.success(proTaskService.selectProTaskByTaskId(taskId)); return AjaxResult.success(proTaskService.selectProTaskByTaskId(taskId));
} }
/**
* 获取甘特图中需要显示的TASK包括三种类型的内容
* 1.Project基于时间范围搜索的生产工单转换而来的Project
* 搜索逻辑为默认使用当前日期作为开始时间搜索所有需求时间大于当前时间的生产工单
* 2.Task基于生产工单拆分到具体工作站后的生产任务转换而来的Task
* 3.Link根据工序与工序之间的依赖关系转换而来的Link
*/
@PreAuthorize("@ss.hasPermi('pro:protask:list')")
@GetMapping("/listGanttTaskList")
public AjaxResult getGanttTaskList(ProTask proTask){
return AjaxResult.success();
}
/** /**
* 新增生产任务 * 新增生产任务
*/ */
@ -77,6 +108,31 @@ public class ProTaskController extends BaseController
@PostMapping @PostMapping
public AjaxResult add(@RequestBody ProTask proTask) public AjaxResult add(@RequestBody ProTask proTask)
{ {
//生产工单
ProWorkorder order = proWorkorderService.selectProWorkorderByWorkorderId(proTask.getWorkorderId());
proTask.setWorkorderCode(order.getWorkorderCode());
proTask.setWorkorderName(order.getWorkorderName());
proTask.setItemId(order.getProductId());
proTask.setItemCode(order.getProductCode());
proTask.setItemName(order.getProductName());
proTask.setSpecification(order.getProductSpc());
proTask.setUnitOfMeasure(order.getUnitOfMeasure());
proTask.setClientId(order.getClientId());
proTask.setClientCode(order.getClientCode());
proTask.setClientName(order.getClientName());
//工序信息
ProProcess process = proProcessService.selectProProcessByProcessId(proTask.getProcessId());
proTask.setProcessId(process.getProcessId());
proTask.setProcessCode(process.getProcessCode());
proTask.setProcessName(process.getProcessName());
//自动生成任务编号和名称
proTask.setTaskCode(autoCodeUtil.genSerialCode(UserConstants.TASK_CODE,null));
proTask.setTaskName(new StringBuilder().append(proTask.getItemName()).append("").append(proTask.getQuantity().toString()).append("").append(proTask.getUnitOfMeasure()).toString());
return toAjax(proTaskService.insertProTask(proTask)); return toAjax(proTaskService.insertProTask(proTask));
} }

View File

@ -12,7 +12,7 @@ import com.ktg.common.core.domain.BaseEntity;
* 生产任务对象 pro_task * 生产任务对象 pro_task
* *
* @author yinjinlu * @author yinjinlu
* @date 2022-05-14 * @date 2022-05-15
*/ */
public class ProTask extends BaseEntity public class ProTask extends BaseEntity
{ {
@ -53,6 +53,18 @@ public class ProTask extends BaseEntity
@Excel(name = "工作站名称") @Excel(name = "工作站名称")
private String workstationName; private String workstationName;
/** 工序ID */
@Excel(name = "工序ID")
private Long processId;
/** 工序编码 */
@Excel(name = "工序编码")
private String processCode;
/** 工序名称 */
@Excel(name = "工序名称")
private String processName;
/** 产品物料ID */ /** 产品物料ID */
@Excel(name = "产品物料ID") @Excel(name = "产品物料ID")
private Long itemId; private Long itemId;
@ -217,6 +229,33 @@ public class ProTask extends BaseEntity
{ {
return workstationName; return workstationName;
} }
public void setProcessId(Long processId)
{
this.processId = processId;
}
public Long getProcessId()
{
return processId;
}
public void setProcessCode(String processCode)
{
this.processCode = processCode;
}
public String getProcessCode()
{
return processCode;
}
public void setProcessName(String processName)
{
this.processName = processName;
}
public String getProcessName()
{
return processName;
}
public void setItemId(Long itemId) public void setItemId(Long itemId)
{ {
this.itemId = itemId; this.itemId = itemId;
@ -419,6 +458,9 @@ public class ProTask extends BaseEntity
.append("workstationId", getWorkstationId()) .append("workstationId", getWorkstationId())
.append("workstationCode", getWorkstationCode()) .append("workstationCode", getWorkstationCode())
.append("workstationName", getWorkstationName()) .append("workstationName", getWorkstationName())
.append("processId", getProcessId())
.append("processCode", getProcessCode())
.append("processName", getProcessName())
.append("itemId", getItemId()) .append("itemId", getItemId())
.append("itemCode", getItemCode()) .append("itemCode", getItemCode())
.append("itemName", getItemName()) .append("itemName", getItemName())

View File

@ -12,7 +12,7 @@ import com.ktg.common.core.domain.TreeEntity;
* 生产工单对象 pro_workorder * 生产工单对象 pro_workorder
* *
* @author yinjinlu * @author yinjinlu
* @date 2022-05-09 * @date 2022-05-15
*/ */
public class ProWorkorder extends TreeEntity public class ProWorkorder extends TreeEntity
{ {
@ -61,6 +61,18 @@ public class ProWorkorder extends TreeEntity
@Excel(name = "生产数量") @Excel(name = "生产数量")
private BigDecimal quantity; private BigDecimal quantity;
/** 已生产数量 */
@Excel(name = "已生产数量")
private BigDecimal quantityProduced;
/** 调整数量 */
@Excel(name = "调整数量")
private BigDecimal quantityChanged;
/** 已排产数量 */
@Excel(name = "已排产数量")
private BigDecimal quantityScheduled;
/** 客户ID */ /** 客户ID */
@Excel(name = "客户ID") @Excel(name = "客户ID")
private Long clientId; private Long clientId;
@ -193,6 +205,33 @@ public class ProWorkorder extends TreeEntity
{ {
return quantity; return quantity;
} }
public void setQuantityProduced(BigDecimal quantityProduced)
{
this.quantityProduced = quantityProduced;
}
public BigDecimal getQuantityProduced()
{
return quantityProduced;
}
public void setQuantityChanged(BigDecimal quantityChanged)
{
this.quantityChanged = quantityChanged;
}
public BigDecimal getQuantityChanged()
{
return quantityChanged;
}
public void setQuantityScheduled(BigDecimal quantityScheduled)
{
this.quantityScheduled = quantityScheduled;
}
public BigDecimal getQuantityScheduled()
{
return quantityScheduled;
}
public void setClientId(Long clientId) public void setClientId(Long clientId)
{ {
this.clientId = clientId; this.clientId = clientId;
@ -289,6 +328,9 @@ public class ProWorkorder extends TreeEntity
.append("productSpc", getProductSpc()) .append("productSpc", getProductSpc())
.append("unitOfMeasure", getUnitOfMeasure()) .append("unitOfMeasure", getUnitOfMeasure())
.append("quantity", getQuantity()) .append("quantity", getQuantity())
.append("quantityProduced", getQuantityProduced())
.append("quantityChanged", getQuantityChanged())
.append("quantityScheduled", getQuantityScheduled())
.append("clientId", getClientId()) .append("clientId", getClientId())
.append("clientCode", getClientCode()) .append("clientCode", getClientCode())
.append("clientName", getClientName()) .append("clientName", getClientName())

View File

@ -14,6 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="workstationId" column="workstation_id" /> <result property="workstationId" column="workstation_id" />
<result property="workstationCode" column="workstation_code" /> <result property="workstationCode" column="workstation_code" />
<result property="workstationName" column="workstation_name" /> <result property="workstationName" column="workstation_name" />
<result property="processId" column="process_id" />
<result property="processCode" column="process_code" />
<result property="processName" column="process_name" />
<result property="itemId" column="item_id" /> <result property="itemId" column="item_id" />
<result property="itemCode" column="item_code" /> <result property="itemCode" column="item_code" />
<result property="itemName" column="item_name" /> <result property="itemName" column="item_name" />
@ -57,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="workstationId != null "> and workstation_id = #{workstationId}</if> <if test="workstationId != null "> and workstation_id = #{workstationId}</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="itemId != null "> and item_id = #{itemId}</if> <if test="itemId != null "> and item_id = #{itemId}</if>
<if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if> <if test="itemCode != null and itemCode != ''"> and item_code = #{itemCode}</if>
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if> <if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
@ -93,6 +99,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 and workstationCode != ''">workstation_code,</if> <if test="workstationCode != null and workstationCode != ''">workstation_code,</if>
<if test="workstationName != null and workstationName != ''">workstation_name,</if> <if test="workstationName != null and workstationName != ''">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="itemId != null">item_id,</if> <if test="itemId != null">item_id,</if>
<if test="itemCode != null and itemCode != ''">item_code,</if> <if test="itemCode != null and itemCode != ''">item_code,</if>
<if test="itemName != null and itemName != ''">item_name,</if> <if test="itemName != null and itemName != ''">item_name,</if>
@ -129,6 +138,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 and workstationCode != ''">#{workstationCode},</if> <if test="workstationCode != null and workstationCode != ''">#{workstationCode},</if>
<if test="workstationName != null and workstationName != ''">#{workstationName},</if> <if test="workstationName != null and workstationName != ''">#{workstationName},</if>
<if test="processId != null">#{processId},</if>
<if test="processCode != null">#{processCode},</if>
<if test="processName != null">#{processName},</if>
<if test="itemId != null">#{itemId},</if> <if test="itemId != null">#{itemId},</if>
<if test="itemCode != null and itemCode != ''">#{itemCode},</if> <if test="itemCode != null and itemCode != ''">#{itemCode},</if>
<if test="itemName != null and itemName != ''">#{itemName},</if> <if test="itemName != null and itemName != ''">#{itemName},</if>
@ -169,6 +181,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 and workstationCode != ''">workstation_code = #{workstationCode},</if> <if test="workstationCode != null and workstationCode != ''">workstation_code = #{workstationCode},</if>
<if test="workstationName != null and workstationName != ''">workstation_name = #{workstationName},</if> <if test="workstationName != null and workstationName != ''">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="itemId != null">item_id = #{itemId},</if> <if test="itemId != null">item_id = #{itemId},</if>
<if test="itemCode != null and itemCode != ''">item_code = #{itemCode},</if> <if test="itemCode != null and itemCode != ''">item_code = #{itemCode},</if>
<if test="itemName != null and itemName != ''">item_name = #{itemName},</if> <if test="itemName != null and itemName != ''">item_name = #{itemName},</if>

View File

@ -16,6 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="productSpc" column="product_spc" /> <result property="productSpc" column="product_spc" />
<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="quantityChanged" column="quantity_changed" />
<result property="quantityScheduled" column="quantity_scheduled" />
<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" />
@ -51,6 +54,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productSpc != null and productSpc != ''"> and product_spc = #{productSpc}</if> <if test="productSpc != null and productSpc != ''"> and product_spc = #{productSpc}</if>
<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="quantityChanged != null "> and quantity_changed = #{quantityChanged}</if>
<if test="quantityScheduled != null "> and quantity_scheduled = #{quantityScheduled}</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>
<if test="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if> <if test="clientName != null and clientName != ''"> and client_name like concat('%', #{clientName}, '%')</if>
@ -84,6 +90,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productSpc != null">product_spc,</if> <if test="productSpc != null">product_spc,</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''">unit_of_measure,</if> <if test="unitOfMeasure != null and unitOfMeasure != ''">unit_of_measure,</if>
<if test="quantity != null">quantity,</if> <if test="quantity != null">quantity,</if>
<if test="quantityProduced != null">quantity_produced,</if>
<if test="quantityChanged != null">quantity_changed,</if>
<if test="quantityScheduled != null">quantity_scheduled,</if>
<if test="clientId != null">client_id,</if> <if test="clientId != null">client_id,</if>
<if test="clientCode != null">client_code,</if> <if test="clientCode != null">client_code,</if>
<if test="clientName != null">client_name,</if> <if test="clientName != null">client_name,</if>
@ -112,6 +121,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productSpc != null">#{productSpc},</if> <if test="productSpc != null">#{productSpc},</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''">#{unitOfMeasure},</if> <if test="unitOfMeasure != null and unitOfMeasure != ''">#{unitOfMeasure},</if>
<if test="quantity != null">#{quantity},</if> <if test="quantity != null">#{quantity},</if>
<if test="quantityProduced != null">#{quantityProduced},</if>
<if test="quantityChanged != null">#{quantityChanged},</if>
<if test="quantityScheduled != null">#{quantityScheduled},</if>
<if test="clientId != null">#{clientId},</if> <if test="clientId != null">#{clientId},</if>
<if test="clientCode != null">#{clientCode},</if> <if test="clientCode != null">#{clientCode},</if>
<if test="clientName != null">#{clientName},</if> <if test="clientName != null">#{clientName},</if>
@ -144,6 +156,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productSpc != null">product_spc = #{productSpc},</if> <if test="productSpc != null">product_spc = #{productSpc},</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''">unit_of_measure = #{unitOfMeasure},</if> <if test="unitOfMeasure != null and unitOfMeasure != ''">unit_of_measure = #{unitOfMeasure},</if>
<if test="quantity != null">quantity = #{quantity},</if> <if test="quantity != null">quantity = #{quantity},</if>
<if test="quantityProduced != null">quantity_produced = #{quantityProduced},</if>
<if test="quantityChanged != null">quantity_changed = #{quantityChanged},</if>
<if test="quantityScheduled != null">quantity_scheduled = #{quantityScheduled},</if>
<if test="clientId != null">client_id = #{clientId},</if> <if test="clientId != null">client_id = #{clientId},</if>
<if test="clientCode != null">client_code = #{clientCode},</if> <if test="clientCode != null">client_code = #{clientCode},</if>
<if test="clientName != null">client_name = #{clientName},</if> <if test="clientName != null">client_name = #{clientName},</if>