生产工单添加生产派工功能
This commit is contained in:
parent
4a96a7c222
commit
060d347933
@ -9,12 +9,11 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.pro.domain.*;
|
||||
import com.ktg.mes.pro.service.IProProcessService;
|
||||
import com.ktg.mes.pro.service.IProRouteService;
|
||||
import com.ktg.mes.pro.service.IProWorkorderService;
|
||||
import com.ktg.mes.pro.service.*;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@ -27,7 +26,6 @@ import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.mes.pro.service.IProTaskService;
|
||||
import com.ktg.common.utils.poi.ExcelUtil;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
|
||||
@ -47,6 +45,9 @@ public class ProTaskController extends BaseController
|
||||
@Autowired
|
||||
private IProWorkorderService proWorkorderService;
|
||||
|
||||
@Autowired
|
||||
private IProRouteProductService proRouteProductService;
|
||||
|
||||
@Autowired
|
||||
private IProProcessService proProcessService;
|
||||
|
||||
@ -162,6 +163,33 @@ public class ProTaskController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按照最新的模式只展示工序级别的生产进度
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/listTaskListByWorkorder")
|
||||
public AjaxResult getWorkorderProcessTypeTaskList(ProWorkorder proWorkorder){
|
||||
if(!StringUtils.isNotNull(proWorkorder.getWorkorderId())){
|
||||
return AjaxResult.error("请选择具体的生产工单!");
|
||||
}
|
||||
|
||||
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(proWorkorder.getWorkorderId());
|
||||
if(StringUtils.isNotNull(workorder)){
|
||||
//检查当前的产品是否配置了对应的工艺路线
|
||||
ProRouteProduct param = new ProRouteProduct();
|
||||
param.setItemId(workorder.getProductId());
|
||||
List<ProRouteProduct> routes = proRouteProductService.selectProRouteProductList(param);
|
||||
if(CollectionUtils.isEmpty(routes)){
|
||||
return AjaxResult.error("当前工单生产的产品,未配置对应的生产工艺流程!");
|
||||
}
|
||||
}
|
||||
|
||||
//根据生产工单查询每个工序的生产情况
|
||||
List<ProTask> tasks = proTaskService.selectProTaskProcessViewByWorkorder(proWorkorder.getWorkorderId());
|
||||
return AjaxResult.success(tasks);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增生产任务
|
||||
*/
|
||||
|
@ -2,6 +2,7 @@ package com.ktg.mes.pro.controller;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@ -73,6 +74,19 @@ public class ProWorkorderController extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/listWithTaskJson")
|
||||
public TableDataInfo listWithTaskJson(ProWorkorder proWorkorder){
|
||||
startPage();
|
||||
List<ProWorkorder> list = proWorkorderService.selectProWorkorderList(proWorkorder);
|
||||
Iterator<ProWorkorder> iterator = list.iterator();
|
||||
while (iterator.hasNext()){
|
||||
ProWorkorder workorder = iterator.next();
|
||||
List<ProTask> tasks = proTaskService.selectProTaskProcessViewByWorkorder(workorder.getWorkorderId());
|
||||
workorder.setTasks(tasks);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出生产工单列表
|
||||
*/
|
||||
|
@ -2,6 +2,8 @@ package com.ktg.mes.pro.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
@ -132,6 +134,8 @@ public class ProWorkorder extends TreeEntity
|
||||
/** 预留字段4 */
|
||||
private Long attr4;
|
||||
|
||||
private List<ProTask> tasks;
|
||||
|
||||
public void setWorkorderId(Long workorderId)
|
||||
{
|
||||
this.workorderId = workorderId;
|
||||
@ -390,6 +394,14 @@ public class ProWorkorder extends TreeEntity
|
||||
this.finishDate = finishDate;
|
||||
}
|
||||
|
||||
public List<ProTask> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public void setTasks(List<ProTask> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProWorkorder{" +
|
||||
|
@ -28,6 +28,13 @@ public interface ProTaskMapper
|
||||
public List<ProTask> selectProTaskList(ProTask proTask);
|
||||
|
||||
|
||||
/**
|
||||
* 查询某个工单的各个工序生产进度
|
||||
* @param workorderId
|
||||
* @return
|
||||
*/
|
||||
public List<ProTask> selectProTaskProcessViewByWorkorder(Long workorderId);
|
||||
|
||||
/**
|
||||
* 新增生产任务
|
||||
*
|
||||
|
@ -27,6 +27,14 @@ public interface IProTaskService
|
||||
*/
|
||||
public List<ProTask> selectProTaskList(ProTask proTask);
|
||||
|
||||
|
||||
/**
|
||||
* 查询某个工单的各个工序生产进度
|
||||
* @param workorderId
|
||||
* @return
|
||||
*/
|
||||
public List<ProTask> selectProTaskProcessViewByWorkorder(Long workorderId);
|
||||
|
||||
/**
|
||||
* 新增生产任务
|
||||
*
|
||||
|
@ -44,6 +44,16 @@ public class ProTaskServiceImpl implements IProTaskService
|
||||
return proTaskMapper.selectProTaskList(proTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询某个工单的各个工序生产进度
|
||||
* @param workorderId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ProTask> selectProTaskProcessViewByWorkorder(Long workorderId) {
|
||||
return proTaskMapper.selectProTaskProcessViewByWorkorder(workorderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增生产任务
|
||||
*
|
||||
|
@ -117,6 +117,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where task_id = #{taskId}
|
||||
</select>
|
||||
|
||||
<select id="selectProTaskProcessViewByWorkorder" parameterType="Long" resultMap="ProTaskResult">
|
||||
select a.process_id,a.process_code,a.process_name,IFNULL(b.quantity,0) as quantity,IFNULL(b.quantity_produced,0) as quantity_produced,IFNULL(b.quantity_quanlify,0) as quantity_quanlify,IFNULL(b.quantity_unquanlify,0) as quantity_unquanlify
|
||||
from (
|
||||
select t.*
|
||||
from pro_workorder pw
|
||||
left join (
|
||||
SELECT
|
||||
prp.item_id,
|
||||
psp.process_id,
|
||||
psp.process_code,
|
||||
psp.process_name,
|
||||
psp.order_num
|
||||
FROM
|
||||
pro_route_product prp
|
||||
LEFT JOIN pro_route_process psp
|
||||
ON prp.route_id = psp.route_id
|
||||
) t
|
||||
on pw.product_id = t.item_id
|
||||
where pw.workorder_id = #{workorderId}
|
||||
)a
|
||||
left join
|
||||
(
|
||||
SELECT
|
||||
pt.item_id,
|
||||
pt.process_id,
|
||||
pt.process_code,
|
||||
pt.process_name,
|
||||
sum( pt.quantity ) AS quantity,
|
||||
sum( pt.quantity_produced ) AS quantity_produced,
|
||||
sum( pt.quantity_quanlify ) AS quantity_quanlify,
|
||||
sum( pt.quantity_unquanlify ) AS quantity_unquanlify
|
||||
FROM
|
||||
pro_task pt
|
||||
WHERE
|
||||
pt.workorder_id = #{workorderId}
|
||||
GROUP BY
|
||||
pt.item_id,
|
||||
pt.process_id,
|
||||
pt.process_code,
|
||||
pt.process_name
|
||||
)b
|
||||
on a.item_id = b.item_id and a.process_id = b.process_id
|
||||
</select>
|
||||
|
||||
<insert id="insertProTask" parameterType="ProTask" useGeneratedKeys="true" keyProperty="taskId">
|
||||
insert into pro_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
Loading…
Reference in New Issue
Block a user