From ed1245fc5ac69a72afe71fe4c3ed944f57691ae3 Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Wed, 26 Jul 2023 09:02:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97(=E4=BC=98=E5=8C=96=E6=8B=86?= =?UTF-8?q?=E5=88=86=E6=98=BE=E7=A4=BA)=E3=80=81=E6=B9=BF=E6=96=99?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E7=AE=A1=E7=90=86(BMS)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProWetMaterialPlanController.java | 21 +++++++++ .../src/main/java/com/op/mes/domain/BMS.java | 47 +++++++++++++++++++ .../main/java/com/op/mes/domain/Product.java | 47 +++++++++++++++++++ .../mes/mapper/ProWetMaterialPlanMapper.java | 19 ++++++++ .../service/IProWetMaterialPlanService.java | 16 +++++++ .../mes/service/impl/ProOrderServiceImpl.java | 36 +++++++++++--- .../impl/ProWetMaterialPlanServiceImpl.java | 44 +++++++++++++++-- .../resources/mapper/mes/ProOrderMapper.xml | 4 +- .../mapper/mes/ProWetMaterialPlanMapper.xml | 6 +++ 9 files changed, 229 insertions(+), 11 deletions(-) create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/BMS.java create mode 100644 op-modules/op-mes/src/main/java/com/op/mes/domain/Product.java diff --git a/op-modules/op-mes/src/main/java/com/op/mes/controller/ProWetMaterialPlanController.java b/op-modules/op-mes/src/main/java/com/op/mes/controller/ProWetMaterialPlanController.java index 1b9c2794..eeeae8b4 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/controller/ProWetMaterialPlanController.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/controller/ProWetMaterialPlanController.java @@ -35,6 +35,27 @@ public class ProWetMaterialPlanController extends BaseController { @Autowired private IProWetMaterialPlanService proWetMaterialPlanService; + /** + * 通过计划日期获取当前已经分配的料罐、物料、班次信息list + * + * @param planTime + * @return + */ + @GetMapping("/getBMSList") + public AjaxResult getBMSList(Date planTime){ + return proWetMaterialPlanService.getBMSList(planTime); + } + + /** + * 获取物料信息list + * + * @return + */ + @GetMapping("/getProductList") + public AjaxResult getProductList() { + return proWetMaterialPlanService.getProductList(); + } + /** * 查询料罐list * diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/BMS.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/BMS.java new file mode 100644 index 00000000..11734a21 --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/BMS.java @@ -0,0 +1,47 @@ +package com.op.mes.domain; + +// 料罐id、物料id、班次id 实体类 +public class BMS { + // 料罐id + private Integer bucketId; + // 物料id + private Integer materialId; + // 班次id + private Integer shiftId; + + public Integer getBucketId() { + return bucketId; + } + + public void setBucketId(Integer bucketId) { + this.bucketId = bucketId; + } + + public Integer getMaterialId() { + return materialId; + } + + public void setMaterialId(Integer materialId) { + this.materialId = materialId; + } + + public Integer getShiftId() { + return shiftId; + } + + public void setShiftId(Integer shiftId) { + this.shiftId = shiftId; + } + + @Override + public String toString() { + return "BMS{" + + "bucketId=" + bucketId + + ", materialId=" + materialId + + ", shiftId=" + shiftId + + '}'; + } + + public BMS() { + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/domain/Product.java b/op-modules/op-mes/src/main/java/com/op/mes/domain/Product.java new file mode 100644 index 00000000..08495a7b --- /dev/null +++ b/op-modules/op-mes/src/main/java/com/op/mes/domain/Product.java @@ -0,0 +1,47 @@ +package com.op.mes.domain; + +// 物料实体类 +public class Product { + // 物料id + private Integer productId; + // 物料code + private String productCode; + // 物料名称Desc + private String productDesc; + + @Override + public String toString() { + return "Product{" + + "productId=" + productId + + ", productCode='" + productCode + '\'' + + ", productDesc='" + productDesc + '\'' + + '}'; + } + + public Integer getProductId() { + return productId; + } + + public void setProductId(Integer productId) { + this.productId = productId; + } + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public String getProductDesc() { + return productDesc; + } + + public void setProductDesc(String productDesc) { + this.productDesc = productDesc; + } + + public Product() { + } +} diff --git a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWetMaterialPlanMapper.java b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWetMaterialPlanMapper.java index 8d5c22b7..19adf54f 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWetMaterialPlanMapper.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/mapper/ProWetMaterialPlanMapper.java @@ -3,8 +3,10 @@ package com.op.mes.mapper; import java.util.Date; import java.util.List; +import com.op.mes.domain.BMS; import com.op.mes.domain.Bucket; import com.op.mes.domain.ProWetMaterialPlan; +import com.op.mes.domain.Product; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @@ -83,8 +85,25 @@ public interface ProWetMaterialPlanMapper { /** * 查询料罐list + * * @return */ @Select("SELECT equipment_id AS 'bucketId',equipment_code AS 'bucketCode',equipment_name AS 'bucketName' FROM base_equipment WHERE equipment_type_code = 'equ_type_lg'") List selectBucketList(); + + /** + * 获取物料信息list + * + * @return + */ + @Select("SELECT product_id AS 'productId', product_code AS 'productCode',product_desc_zh AS 'productDesc' FROM base_product WHERE active_flag = '1'") + List selectProductList(); + + /** + * 通过计划日期获取当前已经分配的料罐、物料、班次信息list + * + * @param planTime + * @return + */ + List selectBMSList(Date planTime); } diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/IProWetMaterialPlanService.java b/op-modules/op-mes/src/main/java/com/op/mes/service/IProWetMaterialPlanService.java index a479051e..affc2464 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/IProWetMaterialPlanService.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/IProWetMaterialPlanService.java @@ -71,7 +71,23 @@ public interface IProWetMaterialPlanService { /** * 查询料罐list + * * @return */ AjaxResult getBucketList(); + + /** + * 获取物料信息list + * + * @return + */ + AjaxResult getProductList(); + + /** + * 通过计划日期获取当前已经分配的料罐、物料、班次信息list + * + * @param planTime + * @return + */ + AjaxResult getBMSList(Date planTime); } 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 3439e0f3..0844ba8a 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 @@ -124,7 +124,7 @@ public class ProOrderServiceImpl implements IProOrderService { } // 设置为底层节点 - if (checkEnd == 1){ + if (checkEnd == 1) { updateWorker.setWorkorderId(secWorkOrder.getWorkorderId()); updateWorker.setIsEnd(1); proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker); @@ -133,7 +133,7 @@ public class ProOrderServiceImpl implements IProOrderService { } // 设置为底层节点 - if (checkEnd == 1){ + if (checkEnd == 1) { updateWorker.setWorkorderId(firWorkOrder.getWorkorderId()); updateWorker.setIsEnd(1); proOrderWorkorderMapper.updateProOrderWorkorder(updateWorker); @@ -158,23 +158,23 @@ public class ProOrderServiceImpl implements IProOrderService { // 通过订单id查询所有工单信息list List proOrderWorkorderList = proOrderWorkorderMapper.selectFirWorkOrder(id); // 母工单循环遍历 - for (int i = 0;i < proOrderWorkorderList.size();i++){ + for (int i = 0; i < proOrderWorkorderList.size(); i++) { // 通过设备code查询出机型名称 String prodLineName = proOrderMapper.selectProdLineName(proOrderWorkorderList.get(i).getProdLineCode()); // 通过工单id查询批次号 List batchCodeList = proOrderMapper.selectBatchCodesById(proOrderWorkorderList.get(i).getWorkorderId()); List batchCodes = new ArrayList<>(); // 格式化数据 - for (int j = 0;j < batchCodeList.size();j++){ + for (int j = 0; j < batchCodeList.size(); j++) { batchCodes.add(new StringBuilder(batchCodeList.get(j)).append(";").append("\n")); } // 通过母工单workorder_id查询子工单 // 二级 List secProOrderWorkorder = proOrderWorkorderMapper.selectChildWorkOrder(proOrderWorkorderList.get(i).getWorkorderCode()); - if (secProOrderWorkorder.size() > 0 && secProOrderWorkorder != null){ + if (secProOrderWorkorder.size() > 0 && secProOrderWorkorder != null) { // 三级 List thiProOrderWorkorders = proOrderWorkorderMapper.selectChildWorkOrder(secProOrderWorkorder.get(0).getWorkorderCode()); - if (thiProOrderWorkorders.size() > 0 && thiProOrderWorkorders != null){ + if (thiProOrderWorkorders.size() > 0 && thiProOrderWorkorders != null) { // 将三级放入二级child thiProOrderWorkorders.get(0).setProdLineCode(prodLineName); thiProOrderWorkorders.get(0).setBatchCodeList(batchCodes); @@ -251,7 +251,14 @@ public class ProOrderServiceImpl implements IProOrderService { @Override @DS("#header.poolName") public List selectProOrderList(ProOrder proOrder) { - return proOrderMapper.selectProOrderList(proOrder); + if (proOrder.getStatus() == null || proOrder.getStatus().equals(" ")){ + proOrder.setStatus("1"); + } + List proOrderList = proOrderMapper.selectProOrderList(proOrder); + for (int i = 0; i < proOrderList.size(); i++) { + proOrderList.get(i).setStatus(changeStatus(proOrderList.get(i).getStatus())); + } + return proOrderList; } /** @@ -411,4 +418,19 @@ public class ProOrderServiceImpl implements IProOrderService { } } + /** + * 转换拆分订单状态 + * + * @param status + * @return + */ + private String changeStatus(String status) { + if (status.equals("0")){ + return "未拆分"; + } + if (status.equals("1")){ + return "已拆分"; + } + return status; + } } \ No newline at end of file diff --git a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProWetMaterialPlanServiceImpl.java b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProWetMaterialPlanServiceImpl.java index e15caafe..aea3f369 100644 --- a/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProWetMaterialPlanServiceImpl.java +++ b/op-modules/op-mes/src/main/java/com/op/mes/service/impl/ProWetMaterialPlanServiceImpl.java @@ -1,12 +1,13 @@ package com.op.mes.service.impl; -import java.util.Date; -import java.util.List; +import java.util.*; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; import com.op.common.core.web.domain.AjaxResult; +import com.op.mes.domain.BMS; import com.op.mes.domain.ProOrderWorkorder; +import com.op.mes.domain.Product; import com.op.mes.mapper.ProOrderWorkorderMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -14,6 +15,7 @@ import com.op.mes.mapper.ProWetMaterialPlanMapper; import com.op.mes.domain.ProWetMaterialPlan; import com.op.mes.service.IProWetMaterialPlanService; +import static com.op.common.core.web.domain.AjaxResult.error; import static com.op.common.core.web.domain.AjaxResult.success; /** @@ -38,6 +40,10 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService @Override @DS("#header.poolName") public ProWetMaterialPlan selectProWetMaterialPlanById(String id) { + // 参数判空 + if (id == null || id.equals("")){ + return null; + } return proWetMaterialPlanMapper.selectProWetMaterialPlanById(id); } @@ -115,9 +121,13 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService @Override @DS("#header.poolName") public AjaxResult getWorkOrderByTime(Date productDate) { + // 参数判空 + if (productDate == null){ + return error("参数为空!"); + } List workorderList = proOrderWorkorderMapper.selectWorkOrderByTime(productDate); // 循环遍历 - for (int i = 0; i < workorderList.size(); i++){ + for (int i = 0; i < workorderList.size(); i++) { // 通过班次id获取班次名称 workorderList.get(i).setShiftDesc(proWetMaterialPlanMapper.selectShiftById(workorderList.get(i).getShiftId())); } @@ -126,6 +136,7 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService /** * 查询料罐list + * * @return */ @Override @@ -133,4 +144,31 @@ public class ProWetMaterialPlanServiceImpl implements IProWetMaterialPlanService public AjaxResult getBucketList() { return success(proWetMaterialPlanMapper.selectBucketList()); } + + /** + * 获取物料list + * + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult getProductList() { + return success(proWetMaterialPlanMapper.selectProductList()); + } + + /** + * 通过计划日期获取当前已经分配的料罐、物料、班次信息list + * + * @param planTime + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult getBMSList(Date planTime) { + // 参数判空 + if (planTime == null){ + return error("参数为空!"); + } + return success(proWetMaterialPlanMapper.selectBMSList(planTime)); + } } diff --git a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml index 1147d24c..c32bd2af 100644 --- a/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml +++ b/op-modules/op-mes/src/main/resources/mapper/mes/ProOrderMapper.xml @@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and prod_type = #{prodType} and prod_spc = #{prodSpc} + ORDER BY plan_pro_date DESC + insert into pro_wet_material_plan