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

highway
wws 1 year ago
parent cde82abd67
commit 5009b0ded1

@ -6,7 +6,7 @@ import com.op.mes.domain.ProOrder;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
//接受前端拆分模型 // 接收前端拆分模型
public class SplitOrderDTO { public class SplitOrderDTO {
// 批次号与批次数量 // 批次号与批次数量
private List<Batch> formFields; private List<Batch> formFields;
@ -20,6 +20,29 @@ public class SplitOrderDTO {
private Long splitNum; private Long splitNum;
// 所有改变的订单列表 // 所有改变的订单列表
private ProOrderDTO product; 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() { public List<Batch> getFormFields() {
return formFields; return formFields;
@ -69,17 +92,6 @@ public class SplitOrderDTO {
this.product = product; this.product = product;
} }
@Override
public String toString() {
return "SplitOrderDTO{" +
"formFields=" + formFields +
", prodLineCode='" + prodLineCode + '\'' +
", productDate=" + productDate +
", shiftId='" + shiftId + '\'' +
", splitNum=" + splitNum +
", product=" + product +
'}';
}
public SplitOrderDTO() { public SplitOrderDTO() {
} }

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

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

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

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

Loading…
Cancel
Save