From 5009b0ded1f9cdd8834f91b7de9262287a38edff Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Fri, 28 Jul 2023 10:31:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AE=A1=E5=88=92=E7=AE=A1?= =?UTF-8?q?=E7=90=86(=E5=B7=A5=E8=89=BA=E5=AD=97=E6=AE=B5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/mes/domain/dto/SplitOrderDTO.java | 48 ++++++++++++------- .../com/op/mes/domain/vo/LineAndShiftVo.java | 36 +++++++++----- .../com/op/mes/mapper/ProRouteMapper.java | 11 ++++- .../mes/service/impl/ProOrderServiceImpl.java | 31 +++++++++--- .../mapper/mes/ProOrderWorkorderMapper.xml | 5 +- .../resources/mapper/mes/ProRouteMapper.xml | 5 ++ 6 files changed, 97 insertions(+), 39 deletions(-) diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/dto/SplitOrderDTO.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/dto/SplitOrderDTO.java index aee3464e..197d54c7 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/dto/SplitOrderDTO.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/dto/SplitOrderDTO.java @@ -6,20 +6,43 @@ import com.op.mes.domain.ProOrder; import java.util.Date; import java.util.List; -//接受前端拆分模型 +// 接收前端拆分模型 public class SplitOrderDTO { - //批次号与批次数量 + // 批次号与批次数量 private List 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 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() { } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/LineAndShiftVo.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/LineAndShiftVo.java index e6363b92..b936c2de 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/LineAndShiftVo.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/vo/LineAndShiftVo.java @@ -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 lines; - //班次 + // 班次 private List shifts; + // 工艺 + private List routes; - @Override - public String toString() { - return "LineAndShiftVo{" + - "lines=" + lines + - ", shifts=" + shifts + - '}'; + public LineAndShiftVo(List lines, List shifts, List routes) { + this.lines = lines; + this.shifts = shifts; + this.routes = routes; } public List getLines() { @@ -35,9 +37,21 @@ public class LineAndShiftVo { this.shifts = shifts; } - public LineAndShiftVo(List lines, List shifts) { - this.lines = lines; - this.shifts = shifts; + public List getRoutes() { + return routes; + } + + public void setRoutes(List routes) { + this.routes = routes; + } + + @Override + public String toString() { + return "LineAndShiftVo{" + + "lines=" + lines + + ", shifts=" + shifts + + ", routes=" + routes + + '}'; } public LineAndShiftVo() { diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRouteMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRouteMapper.java index 8cd08b5c..f5a25bf6 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRouteMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProRouteMapper.java @@ -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 selectAllRoute(); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java index 8f27245f..e6e74848 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProOrderServiceImpl.java @@ -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正常) diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml index 041596f6..e0c1c2c2 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderWorkorderMapper.xml @@ -77,10 +77,12 @@ where workorder_id = #{workorderId} + + diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml index 1025750a..c1eff99d 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProRouteMapper.xml @@ -64,6 +64,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where route_code = #{routeCode} + + insert into pro_route