From 0877bc0c40283041ac6dfb4d7c253f9b326849f7 Mon Sep 17 00:00:00 2001 From: yinq Date: Thu, 22 Feb 2024 10:26:40 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E7=94=9F=E4=BA=A7=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E6=B7=BB=E5=8A=A0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hw/common/core/constant/MesConstants.java | 21 + .../com/hw/common/core/utils/uuid/Seq.java | 13 +- .../controller/MesMaterialBomController.java | 10 + .../controller/MesProductOrderController.java | 119 ++++ .../com/hw/mes/domain/MesMaterialBom.java | 13 + .../com/hw/mes/domain/MesProductOrder.java | 378 ++++++++++ .../hw/mes/mapper/MesProductOrderMapper.java | 61 ++ .../mes/service/IMesMaterialBomService.java | 7 + .../mes/service/IMesProductOrderService.java | 76 ++ .../impl/MesMaterialBomServiceImpl.java | 12 + .../impl/MesProductOrderServiceImpl.java | 159 +++++ .../mapper/mes/MesMaterialBomMapper.xml | 5 +- .../mapper/mes/MesProductOrderMapper.xml | 217 ++++++ hw-ui/src/api/mes/materialBom.js | 8 + hw-ui/src/api/mes/productOrder.js | 61 ++ .../views/mes/productOrder/addSaleOrder.vue | 525 ++++++++++++++ hw-ui/src/views/mes/productOrder/index.vue | 673 ++++++++++++++++++ hw-ui/src/views/mes/saleOrder/index.vue | 2 +- 18 files changed, 2357 insertions(+), 3 deletions(-) create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductOrderController.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductOrder.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductOrderMapper.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductOrderService.java create mode 100644 hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java create mode 100644 hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductOrderMapper.xml create mode 100644 hw-ui/src/api/mes/productOrder.js create mode 100644 hw-ui/src/views/mes/productOrder/addSaleOrder.vue create mode 100644 hw-ui/src/views/mes/productOrder/index.vue diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java index 356ab1a4..1c60e47e 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/constant/MesConstants.java @@ -15,4 +15,25 @@ public class MesConstants { public static final String MES_BARCODE_TYPE_PRODUCT = "3";//成品 public static final String MES_BARCODE_TYPE_BACKPLATE = "4";//背板 + /** 工单状态;0-待发布 */ + public static final String UN_PUBLISH = "0"; + + /** 工单状态;0-已发布 */ + public static final String PUBLISHED = "1"; + + /** 工单状态;2-已完成 */ + public static final String FINISHED = "2"; + + /** 工单状态;3-已开始 */ + public static final String BEGIN = "3"; + + /** 工单状态;4-暂停 */ + public static final String PAUSE = "4"; + + /** 工单状态;8-已撤回 */ + public static final String RECALL = "8"; + + /** 工单状态;9-已删除 */ + public static final String DELETE = "9"; + } diff --git a/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java b/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java index 89a36b35..f9beea96 100644 --- a/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java +++ b/hw-common/hw-common-core/src/main/java/com/hw/common/core/utils/uuid/Seq.java @@ -44,6 +44,15 @@ public class Seq { // 原材料退库记录标识 public static final String rawReturnCode = "RR"; + // 工单编号序列类型 + public static final String orderCodeSeqType = "ORDER_CODE"; + + // 工单编号序列数 + private static AtomicInteger orderCodeSeq = new AtomicInteger(1); + + // 工单编号记录标识 + public static final String orderCodeCode = "OC"; + /** * 获取通用序列号 @@ -111,8 +120,10 @@ public class Seq { atomicInt = productOutstockSeq; }else if (rawReturnSeqType.equals(type)) { atomicInt = rawReturnSeq; + }else if (orderCodeSeqType.equals(type)) { + atomicInt = orderCodeSeq; } - return getId(atomicInt, 3,code); + return getId(atomicInt, 3, code); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMaterialBomController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMaterialBomController.java index 1e2b1745..90ec4b6b 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMaterialBomController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesMaterialBomController.java @@ -103,4 +103,14 @@ public class MesMaterialBomController extends BaseController { return toAjax(mesMaterialBomService.deleteMesMaterialBomByMaterialBomIds(materialBomIds)); } + + /** + * 查询物料BOM版本列表 + */ + @GetMapping(value = "/getMaterialVisionList/{materialId}") + public AjaxResult getMaterialVisionList(@PathVariable("materialId") Long materialId) + { + return success(mesMaterialBomService.getMaterialVisionList(materialId)); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductOrderController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductOrderController.java new file mode 100644 index 00000000..361d4e11 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesProductOrderController.java @@ -0,0 +1,119 @@ +package com.hw.mes.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.hw.common.log.annotation.Log; +import com.hw.common.log.enums.BusinessType; +import com.hw.common.security.annotation.RequiresPermissions; +import com.hw.mes.domain.MesProductOrder; +import com.hw.mes.service.IMesProductOrderService; +import com.hw.common.core.web.controller.BaseController; +import com.hw.common.core.web.domain.AjaxResult; +import com.hw.common.core.utils.poi.ExcelUtil; +import com.hw.common.core.web.page.TableDataInfo; + +/** + * 生产工单Controller + * + * @author Yinq + * @date 2024-02-20 + */ +@RestController +@RequestMapping("/productOrder") +public class MesProductOrderController extends BaseController { + @Autowired + private IMesProductOrderService mesProductOrderService; + + /** + * 查询生产工单列表 + */ + @RequiresPermissions("mes:productOrder:list") + @GetMapping("/list") + public TableDataInfo list(MesProductOrder mesProductOrder) { + startPage(); + List list = mesProductOrderService.selectMesProductOrderList(mesProductOrder); + return getDataTable(list); + } + + /** + * 导出生产工单列表 + */ + @RequiresPermissions("mes:productOrder:export") + @Log(title = "生产工单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, MesProductOrder mesProductOrder) { + List list = mesProductOrderService.selectMesProductOrderList(mesProductOrder); + ExcelUtil util = new ExcelUtil(MesProductOrder.class); + util.exportExcel(response, list, "生产工单数据"); + } + + /** + * 获取生产工单详细信息 + */ + @RequiresPermissions("mes:productOrder:query") + @GetMapping(value = "/{productOrderId}") + public AjaxResult getInfo(@PathVariable("productOrderId") Long productOrderId) { + return success(mesProductOrderService.selectMesProductOrderByProductOrderId(productOrderId)); + } + + /** + * 新增生产工单 + */ + @RequiresPermissions("mes:productOrder:add") + @Log(title = "生产工单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody MesProductOrder mesProductOrder) { + return toAjax(mesProductOrderService.insertMesProductOrder(mesProductOrder)); + } + + /** + * 修改生产工单 + */ + @RequiresPermissions("mes:productOrder:edit") + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody MesProductOrder mesProductOrder) { + return toAjax(mesProductOrderService.updateMesProductOrder(mesProductOrder)); + } + + /** + * 删除生产工单 + */ + @RequiresPermissions("mes:productOrder:remove") + @Log(title = "生产工单", businessType = BusinessType.DELETE) + @DeleteMapping("/{productOrderIds}") + public AjaxResult remove(@PathVariable Long[] productOrderIds) { + return toAjax(mesProductOrderService.deleteMesProductOrderByProductOrderIds(productOrderIds)); + } + + /** + * 锁库存 + */ + @Log(title = "生产工单", businessType = BusinessType.UPDATE) + @PostMapping("/productOrderLockInventory") + public AjaxResult productOrderLockInventory(@RequestBody MesProductOrder mesProductOrder) { + return toAjax(mesProductOrderService.productOrderLockInventory(mesProductOrder)); + } + + /** + * 获取工单编号 + * + * @return orderCode + */ + @GetMapping(value = "/getOrderCode") + public AjaxResult getOrderCode() { + return success(mesProductOrderService.getOrderCode()); + } + +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialBom.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialBom.java index a0ea455a..3759c604 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialBom.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesMaterialBom.java @@ -75,6 +75,19 @@ public class MesMaterialBom extends TreeEntity { @Excel(name = "物料编号") private String materialCode; + /** + * 物料名称&描述 + */ + private String materialNameDesc; + + public String getMaterialNameDesc() { + return materialNameDesc; + } + + public void setMaterialNameDesc(String materialNameDesc) { + this.materialNameDesc = materialNameDesc; + } + public String getMaterialBomDesc() { return materialBomDesc; } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductOrder.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductOrder.java new file mode 100644 index 00000000..3393aaed --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesProductOrder.java @@ -0,0 +1,378 @@ +package com.hw.mes.domain; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.hw.common.core.annotation.Excel; +import com.hw.common.core.web.domain.BaseEntity; + +/** + * 生产工单对象 mes_product_order + * + * @author Yinq + * @date 2024-02-20 + */ +public class MesProductOrder extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + private Long productOrderId; + + /** + * 工单编号 + */ + @Excel(name = "工单编号") + private String orderCode; + + /** + * 销售订单ID,关联mes_sale_order的order_id;一个销售订单可以有多个生产工单 + */ + @Excel(name = "销售订单ID") + private Long saleOrderId; + + /** + * 销售订单编号 + */ + @Excel(name = "销售订单编号") + private String saleorderCode; + + /** + * 销售订单行号 + */ + @Excel(name = "销售订单行号") + private String saleorderLinenumber; + + /** + * 项目编号 + */ + @Excel(name = "项目编号") + private String projectNo; + + /** + * 物料ID,关联mes_base_material_info的material_id;成品信息 + */ + @Excel(name = "物料ID") + private Long materialId; + + /** + * 物料bomID,关联mes_material_bom的material_bom_id;默认选择最新的正常状态的bom,可修改 + */ + @Excel(name = "物料bomID") + private Long materialBomId; + + /** + * 派工类型(1产线 2工艺路线) + */ + @Excel(name = "派工类型") + private String dispatchType; + + /** + * 派工ID(派工类型为产线关联产线主键,派工类型为工艺路线关联工艺路线主键) + */ + @Excel(name = "派工ID") + private Long dispatchId; + + /** + * 销售数量;销售订单的销售数量 + */ + @Excel(name = "销售数量") + private BigDecimal saleAmount; + + /** + * 计划数量 + */ + @Excel(name = "计划数量") + private BigDecimal planAmount; + + /** + * 已派工数量;派工类型是工艺路线的每个工位派工数量相同,派工类型是产线的派工数量是所有工位累加的 + */ + @Excel(name = "已派工数量") + private BigDecimal dispatchAmount; + + /** + * 完成数量 + */ + @Excel(name = "完成数量") + private BigDecimal completeAmount; + + /** + * 发布时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date releaseTime; + + /** + * 计划开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "计划开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date planBeginTime; + + /** + * 计划结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "计划结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date planEndTime; + + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date realBeginTime; + + /** + * 完成时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date realEndTime; + + /** + * 计划交货日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "计划交货日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date planDeliveryDate; + + /** + * 工单状态:0-待发布;1-已发布;2-已完成;3-已开始;4-暂停;8-已撤回;9-已删除 + */ + @Excel(name = "工单状态") + private String orderStatus; + + /** + * 库存锁定标识:1-是;0-否 + */ + @Excel(name = "库存锁定标识") + private String stockLockFlag; + + /** + * 是否销售订单创建生产工单(1=是;0=否) + */ + private String saleOrderFlag; + + public Date getPlanDeliveryDate() { + return planDeliveryDate; + } + + public void setPlanDeliveryDate(Date planDeliveryDate) { + this.planDeliveryDate = planDeliveryDate; + } + + public String getSaleOrderFlag() { + return saleOrderFlag; + } + + public void setSaleOrderFlag(String saleOrderFlag) { + this.saleOrderFlag = saleOrderFlag; + } + + public void setProductOrderId(Long productOrderId) { + this.productOrderId = productOrderId; + } + + public Long getProductOrderId() { + return productOrderId; + } + + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getOrderCode() { + return orderCode; + } + + public void setSaleOrderId(Long saleOrderId) { + this.saleOrderId = saleOrderId; + } + + public Long getSaleOrderId() { + return saleOrderId; + } + + public void setSaleorderCode(String saleorderCode) { + this.saleorderCode = saleorderCode; + } + + public String getSaleorderCode() { + return saleorderCode; + } + + public void setSaleorderLinenumber(String saleorderLinenumber) { + this.saleorderLinenumber = saleorderLinenumber; + } + + public String getSaleorderLinenumber() { + return saleorderLinenumber; + } + + public void setProjectNo(String projectNo) { + this.projectNo = projectNo; + } + + public String getProjectNo() { + return projectNo; + } + + public void setMaterialId(Long materialId) { + this.materialId = materialId; + } + + public Long getMaterialId() { + return materialId; + } + + public void setMaterialBomId(Long materialBomId) { + this.materialBomId = materialBomId; + } + + public Long getMaterialBomId() { + return materialBomId; + } + + public void setDispatchType(String dispatchType) { + this.dispatchType = dispatchType; + } + + public String getDispatchType() { + return dispatchType; + } + + public void setDispatchId(Long dispatchId) { + this.dispatchId = dispatchId; + } + + public Long getDispatchId() { + return dispatchId; + } + + public void setSaleAmount(BigDecimal saleAmount) { + this.saleAmount = saleAmount; + } + + public BigDecimal getSaleAmount() { + return saleAmount; + } + + public void setPlanAmount(BigDecimal planAmount) { + this.planAmount = planAmount; + } + + public BigDecimal getPlanAmount() { + return planAmount; + } + + public void setDispatchAmount(BigDecimal dispatchAmount) { + this.dispatchAmount = dispatchAmount; + } + + public BigDecimal getDispatchAmount() { + return dispatchAmount; + } + + public void setCompleteAmount(BigDecimal completeAmount) { + this.completeAmount = completeAmount; + } + + public BigDecimal getCompleteAmount() { + return completeAmount; + } + + public void setReleaseTime(Date releaseTime) { + this.releaseTime = releaseTime; + } + + public Date getReleaseTime() { + return releaseTime; + } + + public void setPlanBeginTime(Date planBeginTime) { + this.planBeginTime = planBeginTime; + } + + public Date getPlanBeginTime() { + return planBeginTime; + } + + public void setPlanEndTime(Date planEndTime) { + this.planEndTime = planEndTime; + } + + public Date getPlanEndTime() { + return planEndTime; + } + + public void setRealBeginTime(Date realBeginTime) { + this.realBeginTime = realBeginTime; + } + + public Date getRealBeginTime() { + return realBeginTime; + } + + public void setRealEndTime(Date realEndTime) { + this.realEndTime = realEndTime; + } + + public Date getRealEndTime() { + return realEndTime; + } + + public void setOrderStatus(String orderStatus) { + this.orderStatus = orderStatus; + } + + public String getOrderStatus() { + return orderStatus; + } + + public void setStockLockFlag(String stockLockFlag) { + this.stockLockFlag = stockLockFlag; + } + + public String getStockLockFlag() { + return stockLockFlag; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("productOrderId", getProductOrderId()) + .append("orderCode", getOrderCode()) + .append("saleOrderId", getSaleOrderId()) + .append("saleorderCode", getSaleorderCode()) + .append("saleorderLinenumber", getSaleorderLinenumber()) + .append("projectNo", getProjectNo()) + .append("materialId", getMaterialId()) + .append("materialBomId", getMaterialBomId()) + .append("dispatchType", getDispatchType()) + .append("dispatchId", getDispatchId()) + .append("saleAmount", getSaleAmount()) + .append("planAmount", getPlanAmount()) + .append("dispatchAmount", getDispatchAmount()) + .append("completeAmount", getCompleteAmount()) + .append("releaseTime", getReleaseTime()) + .append("planBeginTime", getPlanBeginTime()) + .append("planEndTime", getPlanEndTime()) + .append("realBeginTime", getRealBeginTime()) + .append("realEndTime", getRealEndTime()) + .append("orderStatus", getOrderStatus()) + .append("stockLockFlag", getStockLockFlag()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductOrderMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductOrderMapper.java new file mode 100644 index 00000000..60c0f27a --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesProductOrderMapper.java @@ -0,0 +1,61 @@ +package com.hw.mes.mapper; + +import java.util.List; +import com.hw.mes.domain.MesProductOrder; + +/** + * 生产工单Mapper接口 + * + * @author Yinq + * @date 2024-02-20 + */ +public interface MesProductOrderMapper +{ + /** + * 查询生产工单 + * + * @param productOrderId 生产工单主键 + * @return 生产工单 + */ + public MesProductOrder selectMesProductOrderByProductOrderId(Long productOrderId); + + /** + * 查询生产工单列表 + * + * @param mesProductOrder 生产工单 + * @return 生产工单集合 + */ + public List selectMesProductOrderList(MesProductOrder mesProductOrder); + + /** + * 新增生产工单 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + public int insertMesProductOrder(MesProductOrder mesProductOrder); + + /** + * 修改生产工单 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + public int updateMesProductOrder(MesProductOrder mesProductOrder); + + /** + * 删除生产工单 + * + * @param productOrderId 生产工单主键 + * @return 结果 + */ + public int deleteMesProductOrderByProductOrderId(Long productOrderId); + + /** + * 批量删除生产工单 + * + * @param productOrderIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds); +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesMaterialBomService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesMaterialBomService.java index 787f6403..d48d0fca 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesMaterialBomService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesMaterialBomService.java @@ -67,4 +67,11 @@ public interface IMesMaterialBomService * @return 物料BOM信息 */ public List selectMesMaterialBomJoinList(MesMaterialBom mesMaterialBom); + + /** + * 查询物料BOM版本列表 + * @param materialId + * @return + */ + public List getMaterialVisionList(Long materialId); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductOrderService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductOrderService.java new file mode 100644 index 00000000..596b31fb --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesProductOrderService.java @@ -0,0 +1,76 @@ +package com.hw.mes.service; + +import java.util.List; +import com.hw.mes.domain.MesProductOrder; + +/** + * 生产工单Service接口 + * + * @author Yinq + * @date 2024-02-20 + */ +public interface IMesProductOrderService +{ + /** + * 查询生产工单 + * + * @param productOrderId 生产工单主键 + * @return 生产工单 + */ + public MesProductOrder selectMesProductOrderByProductOrderId(Long productOrderId); + + /** + * 查询生产工单列表 + * + * @param mesProductOrder 生产工单 + * @return 生产工单集合 + */ + public List selectMesProductOrderList(MesProductOrder mesProductOrder); + + /** + * 新增生产工单 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + public int insertMesProductOrder(MesProductOrder mesProductOrder); + + /** + * 修改生产工单 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + public int updateMesProductOrder(MesProductOrder mesProductOrder); + + /** + * 批量删除生产工单 + * + * @param productOrderIds 需要删除的生产工单主键集合 + * @return 结果 + */ + public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds); + + /** + * 删除生产工单信息 + * + * @param productOrderId 生产工单主键 + * @return 结果 + */ + public int deleteMesProductOrderByProductOrderId(Long productOrderId); + + /** + * 获取工单编号 + * @return orderCode + */ + public String getOrderCode(); + + /** + * 锁库存 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + public int productOrderLockInventory(MesProductOrder mesProductOrder); + +} diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesMaterialBomServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesMaterialBomServiceImpl.java index 8c953bb8..5f4b1157 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesMaterialBomServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesMaterialBomServiceImpl.java @@ -115,6 +115,18 @@ public class MesMaterialBomServiceImpl implements IMesMaterialBomService return mesMaterialBomMapper.selectMesMaterialBomJoinList(mesMaterialBom); } + /** + * 查询物料BOM版本列表 + * @param materialId + * @return + */ + @Override + public List getMaterialVisionList(Long materialId) { + MesMaterialBom materialBom = new MesMaterialBom(); + materialBom.setMaterialId(materialId); + return mesMaterialBomMapper.selectMesMaterialBomList(materialBom); + } + /** * 判断是否顶级BOM * @param mesMaterialBom diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java new file mode 100644 index 00000000..58d5c583 --- /dev/null +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesProductOrderServiceImpl.java @@ -0,0 +1,159 @@ +package com.hw.mes.service.impl; + +import java.math.BigDecimal; +import java.util.List; + +import com.hw.common.core.constant.MesConstants; +import com.hw.common.core.exception.ServiceException; +import com.hw.common.core.utils.DateUtils; +import com.hw.common.core.utils.StringUtils; +import com.hw.common.core.utils.uuid.Seq; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.hw.mes.mapper.MesProductOrderMapper; +import com.hw.mes.domain.MesProductOrder; +import com.hw.mes.service.IMesProductOrderService; + +/** + * 生产工单Service业务层处理 + * + * @author Yinq + * @date 2024-02-20 + */ +@Service +public class MesProductOrderServiceImpl implements IMesProductOrderService { + @Autowired + private MesProductOrderMapper mesProductOrderMapper; + + /** + * 查询生产工单 + * + * @param productOrderId 生产工单主键 + * @return 生产工单 + */ + @Override + public MesProductOrder selectMesProductOrderByProductOrderId(Long productOrderId) { + return mesProductOrderMapper.selectMesProductOrderByProductOrderId(productOrderId); + } + + /** + * 查询生产工单列表 + * + * @param mesProductOrder 生产工单 + * @return 生产工单 + */ + @Override + public List selectMesProductOrderList(MesProductOrder mesProductOrder) { + return mesProductOrderMapper.selectMesProductOrderList(mesProductOrder); + } + + /** + * 新增生产工单 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + @Override + public int insertMesProductOrder(MesProductOrder mesProductOrder) { + mesProductOrder.setCreateTime(DateUtils.getNowDate()); + //校验是否超出销售数量 + if (mesProductOrder.getSaleOrderFlag().equals("1") && StringUtils.isNotNull(mesProductOrder.getSaleOrderId())) { + checkSalesQuantity(mesProductOrder); + } + return mesProductOrderMapper.insertMesProductOrder(mesProductOrder); + } + + /** + * 修改生产工单 + * + * @param mesProductOrder 生产工单 + * @return 结果 + */ + @Override + public int updateMesProductOrder(MesProductOrder mesProductOrder) { + mesProductOrder.setUpdateTime(DateUtils.getNowDate()); + return mesProductOrderMapper.updateMesProductOrder(mesProductOrder); + } + + /** + * 批量删除生产工单 + * + * @param productOrderIds 需要删除的生产工单主键 + * @return 结果 + */ + @Override + public int deleteMesProductOrderByProductOrderIds(Long[] productOrderIds) { + for (Long productOrderId : productOrderIds) { + MesProductOrder mesProductOrder = new MesProductOrder(); + mesProductOrder.setProductOrderId(productOrderId); + mesProductOrder.setOrderStatus(MesConstants.DELETE); + mesProductOrderMapper.updateMesProductOrder(mesProductOrder); + } + return 1; + } + + /** + * 删除生产工单信息 + * + * @param productOrderId 生产工单主键 + * @return 结果 + */ + @Override + public int deleteMesProductOrderByProductOrderId(Long productOrderId) { + MesProductOrder mesProductOrder = new MesProductOrder(); + mesProductOrder.setProductOrderId(productOrderId); + mesProductOrder.setOrderStatus(MesConstants.DELETE); + return mesProductOrderMapper.updateMesProductOrder(mesProductOrder); + } + + /** + * 获取工单编号 + * + * @return orderCode + */ + @Override + public String getOrderCode() { + return Seq.getId(Seq.orderCodeSeqType, Seq.orderCodeCode); + } + + /** + * 校验是否超出销售数量 + * + * @param mesProductOrder + */ + private void checkSalesQuantity(MesProductOrder mesProductOrder) { + if (StringUtils.isNull(mesProductOrder.getPlanAmount()) || StringUtils.isNull(mesProductOrder.getSaleAmount())) { + return; + } + MesProductOrder productOrder = new MesProductOrder(); + mesProductOrder.setSaleOrderId(mesProductOrder.getSaleOrderId()); + List mesProductOrders = mesProductOrderMapper.selectMesProductOrderList(productOrder); + BigDecimal sumDecimal = new BigDecimal(0); + if (StringUtils.isNotNull(mesProductOrders)) { + for (MesProductOrder order : mesProductOrders) { + sumDecimal = sumDecimal.add(order.getPlanAmount()); + } + } + sumDecimal = sumDecimal.add(mesProductOrder.getPlanAmount()); + if (mesProductOrder.getSaleAmount().compareTo(sumDecimal) < 0) { + throw new ServiceException("当前工单计划数量为:" + sumDecimal.longValue() + ",超出该订单销售数量!"); + } + } + + /** + * 锁库存 + * + * @param mesProductOrder 生产工单 + * @return + */ + @Override + public int productOrderLockInventory(MesProductOrder mesProductOrder) { + MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(mesProductOrder.getProductOrderId()); + if (productOrder.getStockLockFlag().equals("1")) { + throw new ServiceException("该工单库存已锁定!"); + } + mesProductOrder.setUpdateTime(DateUtils.getNowDate()); + return mesProductOrderMapper.updateMesProductOrder(mesProductOrder); + } + +} diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialBomMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialBomMapper.xml index 2b506e27..1da6bd3f 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialBomMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesMaterialBomMapper.xml @@ -22,6 +22,7 @@ + @@ -40,7 +41,8 @@ create_by, create_time, update_by, - update_time + update_time, + CONCAT(material_name, '-', material_bom_desc) materialNameDesc from mes_material_bom @@ -60,6 +62,7 @@ and project_id = #{projectId} and active_flag = #{activeFlag} + order by material_id, create_time desc + + + and order_code = #{orderCode} + and sale_order_id = #{saleOrderId} + and saleorder_code = #{saleorderCode} + and saleorder_linenumber = + #{saleorderLinenumber} + + and project_no = #{projectNo} + and material_id = #{materialId} + and material_bom_id = #{materialBomId} + and dispatch_type = #{dispatchType} + and dispatch_id = #{dispatchId} + and sale_amount = #{saleAmount} + and plan_amount = #{planAmount} + and dispatch_amount = #{dispatchAmount} + and complete_amount = #{completeAmount} + and release_time = #{releaseTime} + and plan_begin_time = #{planBeginTime} + and plan_end_time = #{planEndTime} + and real_begin_time = #{realBeginTime} + and real_end_time = #{realEndTime} + and order_status = #{orderStatus} + and stock_lock_flag = #{stockLockFlag} + and sale_order_flag = #{saleOrderFlag} + and create_by = #{createBy} + and create_time = #{createTime} + and update_by = #{updateBy} + and update_time = #{updateTime} + + + + + + + insert into mes_product_order + + order_code, + sale_order_id, + saleorder_code, + saleorder_linenumber, + project_no, + material_id, + material_bom_id, + dispatch_type, + dispatch_id, + sale_amount, + plan_amount, + dispatch_amount, + complete_amount, + release_time, + plan_begin_time, + plan_end_time, + real_begin_time, + real_end_time, + order_status, + stock_lock_flag, + sale_order_flag, + remark, + create_by, + create_time, + update_by, + update_time, + plan_delivery_date, + + + #{orderCode}, + #{saleOrderId}, + #{saleorderCode}, + #{saleorderLinenumber}, + #{projectNo}, + #{materialId}, + #{materialBomId}, + #{dispatchType}, + #{dispatchId}, + #{saleAmount}, + #{planAmount}, + #{dispatchAmount}, + #{completeAmount}, + #{releaseTime}, + #{planBeginTime}, + #{planEndTime}, + #{realBeginTime}, + #{realEndTime}, + #{orderStatus}, + #{stockLockFlag}, + #{saleOrderFlag}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{planDeliveryDate}, + + + + + update mes_product_order + + order_code = #{orderCode}, + sale_order_id = #{saleOrderId}, + saleorder_code = #{saleorderCode}, + saleorder_linenumber = #{saleorderLinenumber}, + project_no = #{projectNo}, + material_id = #{materialId}, + material_bom_id = #{materialBomId}, + dispatch_type = #{dispatchType}, + dispatch_id = #{dispatchId}, + sale_amount = #{saleAmount}, + plan_amount = #{planAmount}, + dispatch_amount = #{dispatchAmount}, + complete_amount = #{completeAmount}, + release_time = #{releaseTime}, + plan_begin_time = #{planBeginTime}, + plan_end_time = #{planEndTime}, + real_begin_time = #{realBeginTime}, + real_end_time = #{realEndTime}, + order_status = #{orderStatus}, + stock_lock_flag = #{stockLockFlag}, + sale_order_flag = #{saleOrderFlag}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + plan_delivery_date = #{planDeliveryDate}, + + where product_order_id = #{productOrderId} + + + + delete + from mes_product_order + where product_order_id = #{productOrderId} + + + + delete from mes_product_order where product_order_id in + + #{productOrderId} + + + \ No newline at end of file diff --git a/hw-ui/src/api/mes/materialBom.js b/hw-ui/src/api/mes/materialBom.js index f411a46e..4ce52615 100644 --- a/hw-ui/src/api/mes/materialBom.js +++ b/hw-ui/src/api/mes/materialBom.js @@ -17,6 +17,14 @@ export function getMaterialBom(materialBomId) { }) } +// 查询物料BOM版本列表 +export function getMaterialVisionList(materialId) { + return request({ + url: '/mes/materialBom/getMaterialVisionList/' + materialId, + method: 'get' + }) +} + // 新增物料BOM信息 export function addMaterialBom(data) { return request({ diff --git a/hw-ui/src/api/mes/productOrder.js b/hw-ui/src/api/mes/productOrder.js new file mode 100644 index 00000000..c9f912e2 --- /dev/null +++ b/hw-ui/src/api/mes/productOrder.js @@ -0,0 +1,61 @@ +import request from '@/utils/request' + +// 查询生产工单列表 +export function listProductOrder(query) { + return request({ + url: '/mes/productOrder/list', + method: 'get', + params: query + }) +} + +// 查询生产工单详细 +export function getProductOrder(productOrderId) { + return request({ + url: '/mes/productOrder/' + productOrderId, + method: 'get' + }) +} + +// 获取工单编号 +export function getOrderCode() { + return request({ + url: '/mes/productOrder/getOrderCode', + method: 'get' + }) +} + +// 新增生产工单 +export function addProductOrder(data) { + return request({ + url: '/mes/productOrder', + method: 'post', + data: data + }) +} + +// 修改生产工单 +export function updateProductOrder(data) { + return request({ + url: '/mes/productOrder', + method: 'put', + data: data + }) +} + +//锁库存 +export function productOrderLockInventory(data) { + return request({ + url: '/mes/productOrder/productOrderLockInventory', + method: 'post', + data: data + }) +} + +// 删除生产工单 +export function delProductOrder(productOrderId) { + return request({ + url: '/mes/productOrder/' + productOrderId, + method: 'delete' + }) +} diff --git a/hw-ui/src/views/mes/productOrder/addSaleOrder.vue b/hw-ui/src/views/mes/productOrder/addSaleOrder.vue new file mode 100644 index 00000000..5adf3e75 --- /dev/null +++ b/hw-ui/src/views/mes/productOrder/addSaleOrder.vue @@ -0,0 +1,525 @@ + + + diff --git a/hw-ui/src/views/mes/productOrder/index.vue b/hw-ui/src/views/mes/productOrder/index.vue new file mode 100644 index 00000000..2c435833 --- /dev/null +++ b/hw-ui/src/views/mes/productOrder/index.vue @@ -0,0 +1,673 @@ + + + diff --git a/hw-ui/src/views/mes/saleOrder/index.vue b/hw-ui/src/views/mes/saleOrder/index.vue index f0024fdf..a73eb692 100644 --- a/hw-ui/src/views/mes/saleOrder/index.vue +++ b/hw-ui/src/views/mes/saleOrder/index.vue @@ -109,7 +109,7 @@ - +