订单计划管理(工艺字段添加)

highway
wws 1 year ago
parent cde82abd67
commit 5009b0ded1

@ -6,20 +6,43 @@ import com.op.mes.domain.ProOrder;
import java.util.Date;
import java.util.List;
//接受前端拆分模型
// 接收前端拆分模型
public class SplitOrderDTO {
//批次号与批次数量
// 批次号与批次数量
private List<Batch> formFields;
//产线
// 产线
private String prodLineCode;
//日期
// 日期
private Date productDate;
//班次
// 班次
private String shiftId;
//拆分数量
// 拆分数量
private Long splitNum;
//所有改变的订单列表
// 所有改变的订单列表
private ProOrderDTO product;
// 工艺编码
private String routeCode;
@Override
public String toString() {
return "SplitOrderDTO{" +
"formFields=" + formFields +
", prodLineCode='" + prodLineCode + '\'' +
", productDate=" + productDate +
", shiftId='" + shiftId + '\'' +
", splitNum=" + splitNum +
", product=" + product +
", routeCode='" + routeCode + '\'' +
'}';
}
public String getRouteCode() {
return routeCode;
}
public void setRouteCode(String routeCode) {
this.routeCode = routeCode;
}
public List<Batch> getFormFields() {
return formFields;
@ -69,17 +92,6 @@ public class SplitOrderDTO {
this.product = product;
}
@Override
public String toString() {
return "SplitOrderDTO{" +
"formFields=" + formFields +
", prodLineCode='" + prodLineCode + '\'' +
", productDate=" + productDate +
", shiftId='" + shiftId + '\'' +
", splitNum=" + splitNum +
", product=" + product +
'}';
}
public SplitOrderDTO() {
}

@ -1,22 +1,24 @@
package com.op.mes.domain.vo;
import com.op.mes.domain.ProLine;
import com.op.mes.domain.ProRoute;
import com.op.mes.domain.ProShift;
import java.util.List;
// 返回工艺、成型机、班次VO
public class LineAndShiftVo {
//线体
// 成型机
private List<ProLine> lines;
//班次
// 班次
private List<ProShift> shifts;
// 工艺
private List<ProRoute> routes;
@Override
public String toString() {
return "LineAndShiftVo{" +
"lines=" + lines +
", shifts=" + shifts +
'}';
public LineAndShiftVo(List<ProLine> lines, List<ProShift> shifts, List<ProRoute> routes) {
this.lines = lines;
this.shifts = shifts;
this.routes = routes;
}
public List<ProLine> getLines() {
@ -35,9 +37,21 @@ public class LineAndShiftVo {
this.shifts = shifts;
}
public LineAndShiftVo(List<ProLine> lines, List<ProShift> shifts) {
this.lines = lines;
this.shifts = shifts;
public List<ProRoute> getRoutes() {
return routes;
}
public void setRoutes(List<ProRoute> routes) {
this.routes = routes;
}
@Override
public String toString() {
return "LineAndShiftVo{" +
"lines=" + lines +
", shifts=" + shifts +
", routes=" + routes +
'}';
}
public LineAndShiftVo() {

@ -13,8 +13,7 @@ import java.util.List;
* @date 2022-05-12
*/
@Mapper
public interface ProRouteMapper
{
public interface ProRouteMapper {
/**
* 线
*
@ -33,6 +32,7 @@ public interface ProRouteMapper
/**
* 线
*
* @param itemId
* @return
*/
@ -71,4 +71,11 @@ public interface ProRouteMapper
* @return
*/
public int deleteProRouteByRouteIds(String[] routeIds);
/**
* list
*
* @return
*/
List<ProRoute> selectAllRoute();
}

@ -13,6 +13,7 @@ import com.op.mes.domain.dto.SplitOrderDTO;
import com.op.mes.domain.vo.LineAndShiftVo;
import com.op.mes.mapper.ProOrderWorkorderBatchMapper;
import com.op.mes.mapper.ProOrderWorkorderMapper;
import com.op.mes.mapper.ProRouteMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -37,6 +38,8 @@ public class ProOrderServiceImpl implements IProOrderService {
private ProOrderWorkorderMapper proOrderWorkorderMapper;
@Autowired
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
@Autowired
private ProRouteMapper proRouteMapper;
/**
*
@ -79,15 +82,14 @@ public class ProOrderServiceImpl implements IProOrderService {
ProOrder product = new ProOrder();
BeanUtils.copyProperties(splitOrderDTO.getProduct(), product);
// 设置通用属性
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId());
ProOrderWorkorder proOrderWorkorder = setCommonWorkAttribute(product, splitOrderDTO.getProductDate(), splitOrderDTO.getProdLineCode(), splitOrderDTO.getShiftId(),splitOrderDTO.getRouteCode());
// 生成对应工单表
// 一级
ProOrderWorkorder firWorkOrder = setWorkOrder(proOrderWorkorder, product);
// code
int endCode = getEndCode(product.getId());
firWorkOrder.setWorkorderCode(product.getOrderCode()+"-"+endCode);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
// 创建通用批次表对象
ProOrderWorkorderBatch workBatch = setCommonBatchAttribute();
// 生成批次表并更新到数据库
@ -146,6 +148,13 @@ public class ProOrderServiceImpl implements IProOrderService {
proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker);
}
// 母工单设置底层节点(只有母工单的情况下)
if (checkEnd == 0) {
firWorkOrder.setIsEnd(1);
// 更新到数据库
proOrderWorkorderMapper.insertProOrderWorkorder(firWorkOrder);
}
return success();
}
@ -235,10 +244,10 @@ public class ProOrderServiceImpl implements IProOrderService {
@DS("#header.poolName")
public LineAndShiftVo getProdLineShift(String type) {
if (type.equals("white")){
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift());
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectProdLine(), proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
return lineAndShiftVo;
}
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), proOrderMapper.selectProShift());
LineAndShiftVo lineAndShiftVo = new LineAndShiftVo(proOrderMapper.selectPackageLine(), proOrderMapper.selectProShift(),proRouteMapper.selectAllRoute());
return lineAndShiftVo;
}
@ -335,12 +344,16 @@ public class ProOrderServiceImpl implements IProOrderService {
* @param proOrder
* @return
*/
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId) {
private ProOrderWorkorder setCommonWorkAttribute(ProOrder proOrder, Date date, String proLineCode, String shiftId,String routeCode) {
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
// 更新者
proOrderWorkorder.setUpdateBy(SecurityContextHolder.getUserName());
// 更新时间
proOrderWorkorder.setUpdateTime(DateUtils.getNowDate());
// 创建者
proOrderWorkorder.setCreateBy(SecurityContextHolder.getUserName());
// 创建时间
proOrderWorkorder.setCreateTime(DateUtils.getNowDate());
// 工单生产日期
proOrderWorkorder.setProductDate(date);
// 产品(物料)编码
@ -356,6 +369,8 @@ public class ProOrderServiceImpl implements IProOrderService {
// TODO 产品类型(pro_type)
// 单据状态(1为已经下达0未下达)
proOrderWorkorder.setStatus("w0");
// 工艺编码
proOrderWorkorder.setRouteCode(routeCode);
return proOrderWorkorder;
}
@ -401,6 +416,10 @@ public class ProOrderServiceImpl implements IProOrderService {
ProOrderWorkorderBatch workBatch = new ProOrderWorkorderBatch();
// 更新者
workBatch.setUpdateBy(SecurityContextHolder.getUserName());
// 创建更新时间
workBatch.setUpdateTime(DateUtils.getNowDate());
// 设置创建时间
workBatch.setCreateTime(DateUtils.getNowDate());
// 创建者
workBatch.setCreateBy(SecurityContextHolder.getUserName());
// 设置单据状态1正常

@ -77,10 +77,12 @@
<include refid="selectProOrderWorkorderVo"/>
where workorder_id = #{workorderId}
</select>
<select id="selectFirWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where order_id = #{id}
</select>
<select id="selectChildWorkOrder" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
WHERE parent_order = #{workorderCode}
@ -97,8 +99,7 @@
<include refid="selectProOrderWorkorderVo"/>
where workorder_id not in (
select workorder_id
from pro_wet_material_plan_detail
where CONVERT(date, plan_time) = #{productDate})
from pro_wet_material_plan_detail) and CONVERT(date, product_date) = #{productDate}
</select>
<insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder">

@ -64,6 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where route_code = #{routeCode}
</select>
<select id="selectAllRoute" resultMap="ProRouteResult">
select route_code, route_name
from pro_route
</select>
<insert id="insertProRoute" parameterType="ProRoute" useGeneratedKeys="true" keyProperty="routeId">
insert into pro_route
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save