diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdOrderInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdOrderInfoController.java new file mode 100644 index 00000000..2e939e4d --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdOrderInfoController.java @@ -0,0 +1,117 @@ +package org.dromara.mes.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.mes.domain.vo.ProdOrderInfoVo; +import org.dromara.mes.domain.bo.ProdOrderInfoBo; +import org.dromara.mes.service.IProdOrderInfoService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 生产订单信息 + * 前端访问路由地址为:/mes/orderInfo + * + * @author Yinq + * @date 2025-01-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/orderInfo") +public class ProdOrderInfoController extends BaseController { + + private final IProdOrderInfoService prodOrderInfoService; + + /** + * 查询生产订单信息列表 + */ + @SaCheckPermission("mes:orderInfo:list") + @GetMapping("/list") + public TableDataInfo list(ProdOrderInfoBo bo, PageQuery pageQuery) { + return prodOrderInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出生产订单信息列表 + */ + @SaCheckPermission("mes:orderInfo:export") + @Log(title = "生产订单信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProdOrderInfoBo bo, HttpServletResponse response) { + List list = prodOrderInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "生产订单信息", ProdOrderInfoVo.class, response); + } + + /** + * 获取生产订单信息详细信息 + * + * @param productOrderId 主键 + */ + @SaCheckPermission("mes:orderInfo:query") + @GetMapping("/{productOrderId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long productOrderId) { + return R.ok(prodOrderInfoService.queryById(productOrderId)); + } + + /** + * 新增生产订单信息 + */ + @SaCheckPermission("mes:orderInfo:add") + @Log(title = "生产订单信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody ProdOrderInfoBo bo) { + return toAjax(prodOrderInfoService.insertByBo(bo)); + } + + /** + * 修改生产订单信息 + */ + @SaCheckPermission("mes:orderInfo:edit") + @Log(title = "生产订单信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody ProdOrderInfoBo bo) { + return toAjax(prodOrderInfoService.updateByBo(bo)); + } + + /** + * 删除生产订单信息 + * + * @param productOrderIds 主键串 + */ + @SaCheckPermission("mes:orderInfo:remove") + @Log(title = "生产订单信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{productOrderIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] productOrderIds) { + return toAjax(prodOrderInfoService.deleteWithValidByIds(List.of(productOrderIds), true)); + } + + + /** + * 下拉框查询生产订单信息列表 + */ + + @GetMapping("getProdOrderInfoList") + public R> getProdOrderInfolist(ProdOrderInfoBo bo) { + List list = prodOrderInfoService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java new file mode 100644 index 00000000..c497a859 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdPlanInfoController.java @@ -0,0 +1,117 @@ +package org.dromara.mes.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.mes.domain.vo.ProdPlanInfoVo; +import org.dromara.mes.domain.bo.ProdPlanInfoBo; +import org.dromara.mes.service.IProdPlanInfoService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 生产工单信息 + * 前端访问路由地址为:/mes/planInfo + * + * @author Yinq + * @date 2025-01-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/planInfo") +public class ProdPlanInfoController extends BaseController { + + private final IProdPlanInfoService prodPlanInfoService; + + /** + * 查询生产工单信息列表 + */ + @SaCheckPermission("mes:planInfo:list") + @GetMapping("/list") + public TableDataInfo list(ProdPlanInfoBo bo, PageQuery pageQuery) { + return prodPlanInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出生产工单信息列表 + */ + @SaCheckPermission("mes:planInfo:export") + @Log(title = "生产工单信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProdPlanInfoBo bo, HttpServletResponse response) { + List list = prodPlanInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "生产工单信息", ProdPlanInfoVo.class, response); + } + + /** + * 获取生产工单信息详细信息 + * + * @param planId 主键 + */ + @SaCheckPermission("mes:planInfo:query") + @GetMapping("/{planId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long planId) { + return R.ok(prodPlanInfoService.queryById(planId)); + } + + /** + * 新增生产工单信息 + */ + @SaCheckPermission("mes:planInfo:add") + @Log(title = "生产工单信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody ProdPlanInfoBo bo) { + return toAjax(prodPlanInfoService.insertByBo(bo)); + } + + /** + * 修改生产工单信息 + */ + @SaCheckPermission("mes:planInfo:edit") + @Log(title = "生产工单信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody ProdPlanInfoBo bo) { + return toAjax(prodPlanInfoService.updateByBo(bo)); + } + + /** + * 删除生产工单信息 + * + * @param planIds 主键串 + */ + @SaCheckPermission("mes:planInfo:remove") + @Log(title = "生产工单信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{planIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] planIds) { + return toAjax(prodPlanInfoService.deleteWithValidByIds(List.of(planIds), true)); + } + + + /** + * 下拉框查询生产工单信息列表 + */ + + @GetMapping("getProdPlanInfoList") + public R> getProdPlanInfolist(ProdPlanInfoBo bo) { + List list = prodPlanInfoService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdOrderInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdOrderInfo.java new file mode 100644 index 00000000..46e604ea --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdOrderInfo.java @@ -0,0 +1,168 @@ +package org.dromara.mes.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 生产订单信息对象 prod_order_info + * + * @author Yinq + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("prod_order_info") +public class ProdOrderInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "product_order_id", type = IdType.AUTO) + private Long productOrderId; + + /** + * 订单编号 + */ + private String orderCode; + + /** + * 销售订单ID + */ + private Long saleOrderId; + + /** + * 项目编号 + */ + private String projectNo; + + /** + * 订单类型(1外部销售 2对内生产) + */ + private String orderType; + + /** + * 物料ID + */ + private Long materialId; + + /** + * 物料BOM_ID;默认选择最新的正常状态的bom,可修改 + */ + private Long materialBomId; + + /** + * 派工类型(1产线 2工艺路线 3工序) + */ + private String dispatchType; + + /** + * 派工ID;(派工类型为产线关联产线主键,派工类型为工艺路线关联工艺路线主键) + */ + private Long dispatchId; + + /** + * 销售数量;销售订单的销售数量,如果无订单则需要输入 + */ + private Long saleAmount; + + /** + * 计划交货日期 + */ + private Date planDeliveryDate; + + /** + * 计划数量 + */ + private Long planAmount; + + /** + * 已派工数量;派工类型是工艺路线的每个工位派工数量相同,派工类型是产线的派工数量是所有工位累加的 + */ + private Long dispatchAmount; + + /** + * 完成数量 + */ + private Long completeAmount; + + /** + * 发布时间 + */ + private Date releaseTime; + + /** + * 计划开始时间 + */ + private Date planBeginTime; + + /** + * 计划结束时间 + */ + private Date planEndTime; + + /** + * 开始时间 + */ + private Date realBeginTime; + + /** + * 完成时间 + */ + private Date realEndTime; + + /** + * 订单状态(0待发布 1已发布 2已完成 3已开始 4暂停 8已撤回 9已删除) + */ + private String orderStatus; + + /** + * 库存锁定标识(1是 0否) + */ + private String stockLockFlag; + + /** + * 前置生产订单ID + */ + private Long preOrderId; + + /** + * 前置订单编号 + */ + private String preOrderCode; + + /** + * 完成标识(0正常 1降级 2超额) + */ + private String finishFlag; + + /** + * 是否已下达工单(1是 0否) + */ + private String releaseFlag; + + /** + * 订单版本 + */ + private String orderVersion; + + /** + * 工厂ID + */ + private Long factoryId; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdPlanInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdPlanInfo.java new file mode 100644 index 00000000..9a8cf211 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdPlanInfo.java @@ -0,0 +1,183 @@ +package org.dromara.mes.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 生产工单信息对象 prod_plan_info + * + * @author Yinq + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("prod_plan_info") +public class ProdPlanInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "plan_id", type = IdType.AUTO) + private Long planId; + + /** + * 生产订单ID + */ + private Long productOrderId; + + /** + * 销售订单ID + */ + private Long saleOrderId; + + /** + * 销售订单编号 + */ + private String saleorderCode; + + /** + * 工单编号 + */ + private String planCode; + + /** + * 派工单号 + */ + private String dispatchCode; + + /** + * 物料ID;成品ID + */ + private Long materialId; + + /** + * 物料BOM_ID + */ + private Long materialBomId; + + /** + * 工序ID + */ + private Long processId; + + /** + * 顺序;派工类型是工艺路线的需要有顺序 + */ + private Long processOrder; + + /** + * 上一工序ID + */ + private Long lastProcessId; + + /** + * 最后工序标识(1是 0否) + */ + private String finalProcessFlag; + + /** + * 下达类型(1机台 2用户 3工位) + */ + private String releaseType; + + /** + * 下达ID;根据选择的下达类型下发 + */ + private Long releaseId; + + /** + * 单位生产时间(秒) + */ + private Long productionTime; + + /** + * 工单计划数量 + */ + private Long planAmount; + + /** + * 派工数量 + */ + private Long dispatchAmount; + + /** + * 完成数量 + */ + private Long completeAmount; + + /** + * 计划开始时间 + */ + private Date planBeginTime; + + /** + * 计划结束时间 + */ + private Date planEndTime; + + /** + * 实际开始时间 + */ + private Date realBeginTime; + + /** + * 实际完成时间 + */ + private Date realEndTime; + + /** + * 附件信息,关联附件信息主键;多个用,隔开;页面可选择附件信息,也可直接上传 + */ + private String attachId; + + /** + * 工单计划状态(0未派工 1已派工 2已开始 3已完成) + */ + private String planStatus; + + /** + * 导入类型(0人工 1ERP) + */ + private String importFlag; + + /** + * 完成标识(0正常 1降级 2超额) + */ + private String finishFlag; + + /** + * 优先级 + */ + private Long priority; + + /** + * 班次ID + */ + private Long shiftId; + + /** + * 班组ID + */ + private Long classTeamId; + + /** + * 模号(L左模 R右模) + */ + private String modelCode; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdOrderInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdOrderInfoBo.java new file mode 100644 index 00000000..1d3e926e --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdOrderInfoBo.java @@ -0,0 +1,175 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.ProdOrderInfo; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 生产订单信息业务对象 prod_order_info + * + * @author Yinq + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = ProdOrderInfo.class, reverseConvertGenerate = false) +public class ProdOrderInfoBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long productOrderId; + + /** + * 订单编号 + */ + @NotBlank(message = "订单编号不能为空", groups = {AddGroup.class, EditGroup.class}) + private String orderCode; + + /** + * 销售订单ID + */ + private Long saleOrderId; + + /** + * 项目编号 + */ + private String projectNo; + + /** + * 订单类型(1外部销售 2对内生产) + */ + private String orderType; + + /** + * 物料ID + */ + @NotNull(message = "物料ID不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long materialId; + + /** + * 物料BOM_ID;默认选择最新的正常状态的bom,可修改 + */ +// @NotNull(message = "物料BOM_ID;默认选择最新的正常状态的bom,可修改不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long materialBomId; + + /** + * 派工类型(1产线 2工艺路线 3工序) + */ + @NotBlank(message = "派工类型(1产线 2工艺路线 3工序)不能为空", groups = {AddGroup.class, EditGroup.class}) + private String dispatchType; + + /** + * 派工ID;(派工类型为产线关联产线主键,派工类型为工艺路线关联工艺路线主键) + */ +// @NotNull(message = "派工ID;(派工类型为产线关联产线主键,派工类型为工艺路线关联工艺路线主键)不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long dispatchId; + + /** + * 销售数量;销售订单的销售数量,如果无订单则需要输入 + */ +// @NotNull(message = "销售数量;销售订单的销售数量,如果无订单则需要输入不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long saleAmount; + + /** + * 计划交货日期 + */ + private Date planDeliveryDate; + + /** + * 计划数量 + */ + @NotNull(message = "计划数量不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long planAmount; + + /** + * 已派工数量;派工类型是工艺路线的每个工位派工数量相同,派工类型是产线的派工数量是所有工位累加的 + */ + private Long dispatchAmount; + + /** + * 完成数量 + */ + private Long completeAmount; + + /** + * 发布时间 + */ + private Date releaseTime; + + /** + * 计划开始时间 + */ + private Date planBeginTime; + + /** + * 计划结束时间 + */ + private Date planEndTime; + + /** + * 开始时间 + */ + private Date realBeginTime; + + /** + * 完成时间 + */ + private Date realEndTime; + + /** + * 订单状态(0待发布 1已发布 2已完成 3已开始 4暂停 8已撤回 9已删除) + */ + private String orderStatus; + + /** + * 库存锁定标识(1是 0否) + */ + private String stockLockFlag; + + /** + * 前置生产订单ID + */ + private Long preOrderId; + + /** + * 前置订单编号 + */ + private String preOrderCode; + + /** + * 完成标识(0正常 1降级 2超额) + */ + private String finishFlag; + + /** + * 是否已下达工单(1是 0否) + */ + private String releaseFlag; + + /** + * 订单版本 + */ + private String orderVersion; + + /** + * 工厂ID + */ + private Long factoryId; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdPlanInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdPlanInfoBo.java new file mode 100644 index 00000000..5e3c1c7f --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdPlanInfoBo.java @@ -0,0 +1,186 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.ProdPlanInfo; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 生产工单信息业务对象 prod_plan_info + * + * @author Yinq + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = ProdPlanInfo.class, reverseConvertGenerate = false) +public class ProdPlanInfoBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long planId; + + /** + * 生产订单ID + */ + private Long productOrderId; + + /** + * 销售订单ID + */ + private Long saleOrderId; + + /** + * 销售订单编号 + */ + private String saleorderCode; + + /** + * 工单编号 + */ + @NotBlank(message = "工单编号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String planCode; + + /** + * 派工单号 + */ + private String dispatchCode; + + /** + * 物料ID;成品ID + */ + @NotNull(message = "物料ID;成品ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialId; + + /** + * 物料BOM_ID + */ + @NotNull(message = "物料BOM_ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long materialBomId; + + /** + * 工序ID + */ + private Long processId; + + /** + * 顺序;派工类型是工艺路线的需要有顺序 + */ + private Long processOrder; + + /** + * 上一工序ID + */ + private Long lastProcessId; + + /** + * 最后工序标识(1是 0否) + */ + private String finalProcessFlag; + + /** + * 下达类型(1机台 2用户 3工位) + */ + private String releaseType; + + /** + * 下达ID;根据选择的下达类型下发 + */ + private Long releaseId; + + /** + * 单位生产时间(秒) + */ + private Long productionTime; + + /** + * 工单计划数量 + */ + @NotNull(message = "工单计划数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long planAmount; + + /** + * 派工数量 + */ + @NotNull(message = "派工数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long dispatchAmount; + + /** + * 完成数量 + */ + private Long completeAmount; + + /** + * 计划开始时间 + */ + private Date planBeginTime; + + /** + * 计划结束时间 + */ + private Date planEndTime; + + /** + * 实际开始时间 + */ + private Date realBeginTime; + + /** + * 实际完成时间 + */ + private Date realEndTime; + + /** + * 附件信息,关联附件信息主键;多个用,隔开;页面可选择附件信息,也可直接上传 + */ + private String attachId; + + /** + * 工单计划状态(0未派工 1已派工 2已开始 3已完成) + */ + private String planStatus; + + /** + * 导入类型(0人工 1ERP) + */ + private String importFlag; + + /** + * 完成标识(0正常 1降级 2超额) + */ + private String finishFlag; + + /** + * 优先级 + */ + private Long priority; + + /** + * 班次ID + */ + private Long shiftId; + + /** + * 班组ID + */ + private Long classTeamId; + + /** + * 模号(L左模 R右模) + */ + private String modelCode; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdOrderInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdOrderInfoVo.java new file mode 100644 index 00000000..5ccc9704 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdOrderInfoVo.java @@ -0,0 +1,209 @@ +package org.dromara.mes.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.mes.domain.ProdOrderInfo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 生产订单信息视图对象 prod_order_info + * + * @author Yinq + * @date 2025-01-09 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdOrderInfo.class) +public class ProdOrderInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long productOrderId; + + /** + * 订单编号 + */ + @ExcelProperty(value = "订单编号") + private String orderCode; + + /** + * 销售订单ID + */ + @ExcelProperty(value = "销售订单ID") + private Long saleOrderId; + + /** + * 项目编号 + */ + @ExcelProperty(value = "项目编号") + private String projectNo; + + /** + * 订单类型(1外部销售 2对内生产) + */ + @ExcelProperty(value = "订单类型", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_order_type") + private String orderType; + + /** + * 物料ID + */ + @ExcelProperty(value = "物料ID") + private Long materialId; + + /** + * 物料BOM_ID;默认选择最新的正常状态的bom,可修改 + */ + @ExcelProperty(value = "物料BOM_ID;默认选择最新的正常状态的bom,可修改") + private Long materialBomId; + + /** + * 派工类型(1产线 2工艺路线 3工序) + */ + @ExcelProperty(value = "派工类型(1产线 2工艺路线 3工序)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_dispatch_type") + private String dispatchType; + + /** + * 派工ID;(派工类型为产线关联产线主键,派工类型为工艺路线关联工艺路线主键) + */ + @ExcelProperty(value = "派工ID;", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "派=工类型为产线关联产线主键,派工类型为工艺路线关联工艺路线主键") + private Long dispatchId; + + /** + * 销售数量;销售订单的销售数量,如果无订单则需要输入 + */ + @ExcelProperty(value = "销售数量;销售订单的销售数量,如果无订单则需要输入") + private Long saleAmount; + + /** + * 计划交货日期 + */ + @ExcelProperty(value = "计划交货日期") + private Date planDeliveryDate; + + /** + * 计划数量 + */ + @ExcelProperty(value = "计划数量") + private Long planAmount; + + /** + * 已派工数量;派工类型是工艺路线的每个工位派工数量相同,派工类型是产线的派工数量是所有工位累加的 + */ + @ExcelProperty(value = "已派工数量;派工类型是工艺路线的每个工位派工数量相同,派工类型是产线的派工数量是所有工位累加的") + private Long dispatchAmount; + + /** + * 完成数量 + */ + @ExcelProperty(value = "完成数量") + private Long completeAmount; + + /** + * 发布时间 + */ + @ExcelProperty(value = "发布时间") + private Date releaseTime; + + /** + * 计划开始时间 + */ + @ExcelProperty(value = "计划开始时间") + private Date planBeginTime; + + /** + * 计划结束时间 + */ + @ExcelProperty(value = "计划结束时间") + private Date planEndTime; + + /** + * 开始时间 + */ + @ExcelProperty(value = "开始时间") + private Date realBeginTime; + + /** + * 完成时间 + */ + @ExcelProperty(value = "完成时间") + private Date realEndTime; + + /** + * 订单状态(0待发布 1已发布 2已完成 3已开始 4暂停 8已撤回 9已删除) + */ + @ExcelProperty(value = "订单状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_order_status") + private String orderStatus; + + /** + * 库存锁定标识(1是 0否) + */ + @ExcelProperty(value = "库存锁定标识", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_stock_lock_flag") + private String stockLockFlag; + + /** + * 前置生产订单ID + */ + @ExcelProperty(value = "前置生产订单ID") + private Long preOrderId; + + /** + * 前置订单编号 + */ + @ExcelProperty(value = "前置订单编号") + private String preOrderCode; + + /** + * 完成标识(0正常 1降级 2超额) + */ + @ExcelProperty(value = "完成标识", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_finish_flag") + private String finishFlag; + + /** + * 是否已下达工单(1是 0否) + */ + @ExcelProperty(value = "是否已下达工单", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_release_flag") + private String releaseFlag; + + /** + * 订单版本 + */ + @ExcelProperty(value = "订单版本") + private String orderVersion; + + /** + * 工厂ID + */ + @ExcelProperty(value = "工厂ID") + private Long factoryId; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdPlanInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdPlanInfoVo.java new file mode 100644 index 00000000..c18eb441 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdPlanInfoVo.java @@ -0,0 +1,226 @@ +package org.dromara.mes.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.mes.domain.ProdPlanInfo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 生产工单信息视图对象 prod_plan_info + * + * @author Yinq + * @date 2025-01-09 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdPlanInfo.class) +public class ProdPlanInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long planId; + + /** + * 生产订单ID + */ + @ExcelProperty(value = "生产订单ID") + private Long productOrderId; + + /** + * 销售订单ID + */ + @ExcelProperty(value = "销售订单ID") + private Long saleOrderId; + + /** + * 销售订单编号 + */ + @ExcelProperty(value = "销售订单编号") + private String saleorderCode; + + /** + * 工单编号 + */ + @ExcelProperty(value = "工单编号") + private String planCode; + + /** + * 派工单号 + */ + @ExcelProperty(value = "派工单号") + private String dispatchCode; + + /** + * 物料ID;成品ID + */ + @ExcelProperty(value = "物料ID;成品ID") + private Long materialId; + + /** + * 物料BOM_ID + */ + @ExcelProperty(value = "物料BOM_ID") + private Long materialBomId; + + /** + * 工序ID + */ + @ExcelProperty(value = "工序ID") + private Long processId; + + /** + * 顺序;派工类型是工艺路线的需要有顺序 + */ + @ExcelProperty(value = "顺序;派工类型是工艺路线的需要有顺序") + private Long processOrder; + + /** + * 上一工序ID + */ + @ExcelProperty(value = "上一工序ID") + private Long lastProcessId; + + /** + * 最后工序标识(1是 0否) + */ + @ExcelProperty(value = "最后工序标识(1是 0否)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "active_flag") + private String finalProcessFlag; + + /** + * 下达类型(1机台 2用户 3工位) + */ + @ExcelProperty(value = "下达类型(1机台 2用户 3工位)", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_release_type") + private String releaseType; + + /** + * 下达ID;根据选择的下达类型下发 + */ + @ExcelProperty(value = "下达ID;根据选择的下达类型下发") + private Long releaseId; + + /** + * 单位生产时间(秒) + */ + @ExcelProperty(value = "单位生产时间(秒)") + private Long productionTime; + + /** + * 工单计划数量 + */ + @ExcelProperty(value = "工单计划数量") + private Long planAmount; + + /** + * 派工数量 + */ + @ExcelProperty(value = "派工数量") + private Long dispatchAmount; + + /** + * 完成数量 + */ + @ExcelProperty(value = "完成数量") + private Long completeAmount; + + /** + * 计划开始时间 + */ + @ExcelProperty(value = "计划开始时间") + private Date planBeginTime; + + /** + * 计划结束时间 + */ + @ExcelProperty(value = "计划结束时间") + private Date planEndTime; + + /** + * 实际开始时间 + */ + @ExcelProperty(value = "实际开始时间") + private Date realBeginTime; + + /** + * 实际完成时间 + */ + @ExcelProperty(value = "实际完成时间") + private Date realEndTime; + + /** + * 附件信息,关联附件信息主键;多个用,隔开;页面可选择附件信息,也可直接上传 + */ + @ExcelProperty(value = "附件信息,关联附件信息主键;多个用,隔开;页面可选择附件信息,也可直接上传") + private String attachId; + + /** + * 工单计划状态(0未派工 1已派工 2已开始 3已完成) + */ + @ExcelProperty(value = "工单计划状态", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_plan_status") + private String planStatus; + + /** + * 导入类型(0人工 1ERP) + */ + @ExcelProperty(value = "导入类型", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_import_flag") + private String importFlag; + + /** + * 完成标识(0正常 1降级 2超额) + */ + @ExcelProperty(value = "完成标识", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_finish_flag") + private String finishFlag; + + /** + * 优先级 + */ + @ExcelProperty(value = "优先级") + private Long priority; + + /** + * 班次ID + */ + @ExcelProperty(value = "班次ID") + private Long shiftId; + + /** + * 班组ID + */ + @ExcelProperty(value = "班组ID") + private Long classTeamId; + + /** + * 模号(L左模 R右模) + */ + @ExcelProperty(value = "模号", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "mes_model_code") + private String modelCode; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdOrderInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdOrderInfoMapper.java new file mode 100644 index 00000000..f710e709 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdOrderInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdOrderInfo; +import org.dromara.mes.domain.vo.ProdOrderInfoVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 生产订单信息Mapper接口 + * + * @author Yinq + * @date 2025-01-09 + */ +public interface ProdOrderInfoMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java new file mode 100644 index 00000000..2e2b9100 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdPlanInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdPlanInfo; +import org.dromara.mes.domain.vo.ProdPlanInfoVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 生产工单信息Mapper接口 + * + * @author Yinq + * @date 2025-01-09 + */ +public interface ProdPlanInfoMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdOrderInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdOrderInfoService.java new file mode 100644 index 00000000..9dfae04a --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdOrderInfoService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdOrderInfo; +import org.dromara.mes.domain.vo.ProdOrderInfoVo; +import org.dromara.mes.domain.bo.ProdOrderInfoBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 生产订单信息Service接口 + * + * @author Yinq + * @date 2025-01-09 + */ +public interface IProdOrderInfoService { + + /** + * 查询生产订单信息 + * + * @param productOrderId 主键 + * @return 生产订单信息 + */ + ProdOrderInfoVo queryById(Long productOrderId); + + /** + * 分页查询生产订单信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 生产订单信息分页列表 + */ + TableDataInfo queryPageList(ProdOrderInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的生产订单信息列表 + * + * @param bo 查询条件 + * @return 生产订单信息列表 + */ + List queryList(ProdOrderInfoBo bo); + + /** + * 新增生产订单信息 + * + * @param bo 生产订单信息 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdOrderInfoBo bo); + + /** + * 修改生产订单信息 + * + * @param bo 生产订单信息 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdOrderInfoBo bo); + + /** + * 校验并批量删除生产订单信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java new file mode 100644 index 00000000..7aaf3d14 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdPlanInfoService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdPlanInfo; +import org.dromara.mes.domain.vo.ProdPlanInfoVo; +import org.dromara.mes.domain.bo.ProdPlanInfoBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 生产工单信息Service接口 + * + * @author Yinq + * @date 2025-01-09 + */ +public interface IProdPlanInfoService { + + /** + * 查询生产工单信息 + * + * @param planId 主键 + * @return 生产工单信息 + */ + ProdPlanInfoVo queryById(Long planId); + + /** + * 分页查询生产工单信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 生产工单信息分页列表 + */ + TableDataInfo queryPageList(ProdPlanInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的生产工单信息列表 + * + * @param bo 查询条件 + * @return 生产工单信息列表 + */ + List queryList(ProdPlanInfoBo bo); + + /** + * 新增生产工单信息 + * + * @param bo 生产工单信息 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdPlanInfoBo bo); + + /** + * 修改生产工单信息 + * + * @param bo 生产工单信息 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdPlanInfoBo bo); + + /** + * 校验并批量删除生产工单信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdOrderInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdOrderInfoServiceImpl.java new file mode 100644 index 00000000..ae7f2851 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdOrderInfoServiceImpl.java @@ -0,0 +1,158 @@ +package org.dromara.mes.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.ProdOrderInfoBo; +import org.dromara.mes.domain.vo.ProdOrderInfoVo; +import org.dromara.mes.domain.ProdOrderInfo; +import org.dromara.mes.mapper.ProdOrderInfoMapper; +import org.dromara.mes.service.IProdOrderInfoService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 生产订单信息Service业务层处理 + * + * @author Yinq + * @date 2025-01-09 + */ +@RequiredArgsConstructor +@Service +public class ProdOrderInfoServiceImpl implements IProdOrderInfoService { + + private final ProdOrderInfoMapper baseMapper; + + /** + * 查询生产订单信息 + * + * @param productOrderId 主键 + * @return 生产订单信息 + */ + @Override + public ProdOrderInfoVo queryById(Long productOrderId){ + return baseMapper.selectVoById(productOrderId); + } + + /** + * 分页查询生产订单信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 生产订单信息分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdOrderInfoBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的生产订单信息列表 + * + * @param bo 查询条件 + * @return 生产订单信息列表 + */ + @Override + public List queryList(ProdOrderInfoBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdOrderInfoBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdOrderInfo.class) + .selectAll(ProdOrderInfo.class) + .eq(bo.getProductOrderId() != null, ProdOrderInfo::getProductOrderId, bo.getProductOrderId()) + .eq(StringUtils.isNotBlank(bo.getOrderCode()), ProdOrderInfo::getOrderCode, bo.getOrderCode()) + .eq(bo.getSaleOrderId() != null, ProdOrderInfo::getSaleOrderId, bo.getSaleOrderId()) + .eq(StringUtils.isNotBlank(bo.getProjectNo()), ProdOrderInfo::getProjectNo, bo.getProjectNo()) + .eq(StringUtils.isNotBlank(bo.getOrderType()), ProdOrderInfo::getOrderType, bo.getOrderType()) + .eq(bo.getMaterialId() != null, ProdOrderInfo::getMaterialId, bo.getMaterialId()) + .eq(bo.getMaterialBomId() != null, ProdOrderInfo::getMaterialBomId, bo.getMaterialBomId()) + .eq(StringUtils.isNotBlank(bo.getDispatchType()), ProdOrderInfo::getDispatchType, bo.getDispatchType()) + .eq(bo.getDispatchId() != null, ProdOrderInfo::getDispatchId, bo.getDispatchId()) + .eq(bo.getSaleAmount() != null, ProdOrderInfo::getSaleAmount, bo.getSaleAmount()) + .eq(bo.getPlanDeliveryDate() != null, ProdOrderInfo::getPlanDeliveryDate, bo.getPlanDeliveryDate()) + .eq(bo.getPlanAmount() != null, ProdOrderInfo::getPlanAmount, bo.getPlanAmount()) + .eq(bo.getDispatchAmount() != null, ProdOrderInfo::getDispatchAmount, bo.getDispatchAmount()) + .eq(bo.getCompleteAmount() != null, ProdOrderInfo::getCompleteAmount, bo.getCompleteAmount()) + .eq(bo.getReleaseTime() != null, ProdOrderInfo::getReleaseTime, bo.getReleaseTime()) + .eq(bo.getPlanBeginTime() != null, ProdOrderInfo::getPlanBeginTime, bo.getPlanBeginTime()) + .eq(bo.getPlanEndTime() != null, ProdOrderInfo::getPlanEndTime, bo.getPlanEndTime()) + .eq(bo.getRealBeginTime() != null, ProdOrderInfo::getRealBeginTime, bo.getRealBeginTime()) + .eq(bo.getRealEndTime() != null, ProdOrderInfo::getRealEndTime, bo.getRealEndTime()) + .eq(StringUtils.isNotBlank(bo.getOrderStatus()), ProdOrderInfo::getOrderStatus, bo.getOrderStatus()) + .eq(StringUtils.isNotBlank(bo.getStockLockFlag()), ProdOrderInfo::getStockLockFlag, bo.getStockLockFlag()) + .eq(bo.getPreOrderId() != null, ProdOrderInfo::getPreOrderId, bo.getPreOrderId()) + .eq(StringUtils.isNotBlank(bo.getPreOrderCode()), ProdOrderInfo::getPreOrderCode, bo.getPreOrderCode()) + .eq(StringUtils.isNotBlank(bo.getFinishFlag()), ProdOrderInfo::getFinishFlag, bo.getFinishFlag()) + .eq(StringUtils.isNotBlank(bo.getReleaseFlag()), ProdOrderInfo::getReleaseFlag, bo.getReleaseFlag()) + .eq(StringUtils.isNotBlank(bo.getOrderVersion()), ProdOrderInfo::getOrderVersion, bo.getOrderVersion()) + .eq(bo.getFactoryId() != null, ProdOrderInfo::getFactoryId, bo.getFactoryId()) + .orderByDesc(ProdOrderInfo::getCreateTime); + return lqw; + } + + /** + * 新增生产订单信息 + * + * @param bo 生产订单信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdOrderInfoBo bo) { + ProdOrderInfo add = MapstructUtils.convert(bo, ProdOrderInfo.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setProductOrderId(add.getProductOrderId()); + } + return flag; + } + + /** + * 修改生产订单信息 + * + * @param bo 生产订单信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdOrderInfoBo bo) { + ProdOrderInfo update = MapstructUtils.convert(bo, ProdOrderInfo.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdOrderInfo entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除生产订单信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java new file mode 100644 index 00000000..f14acd0e --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdPlanInfoServiceImpl.java @@ -0,0 +1,161 @@ +package org.dromara.mes.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.ProdPlanInfoBo; +import org.dromara.mes.domain.vo.ProdPlanInfoVo; +import org.dromara.mes.domain.ProdPlanInfo; +import org.dromara.mes.mapper.ProdPlanInfoMapper; +import org.dromara.mes.service.IProdPlanInfoService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 生产工单信息Service业务层处理 + * + * @author Yinq + * @date 2025-01-09 + */ +@RequiredArgsConstructor +@Service +public class ProdPlanInfoServiceImpl implements IProdPlanInfoService { + + private final ProdPlanInfoMapper baseMapper; + + /** + * 查询生产工单信息 + * + * @param planId 主键 + * @return 生产工单信息 + */ + @Override + public ProdPlanInfoVo queryById(Long planId){ + return baseMapper.selectVoById(planId); + } + + /** + * 分页查询生产工单信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 生产工单信息分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdPlanInfoBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的生产工单信息列表 + * + * @param bo 查询条件 + * @return 生产工单信息列表 + */ + @Override + public List queryList(ProdPlanInfoBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdPlanInfoBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdPlanInfo.class) + .selectAll(ProdPlanInfo.class) + .eq(bo.getPlanId() != null, ProdPlanInfo::getPlanId, bo.getPlanId()) + .eq(bo.getProductOrderId() != null, ProdPlanInfo::getProductOrderId, bo.getProductOrderId()) + .eq(bo.getSaleOrderId() != null, ProdPlanInfo::getSaleOrderId, bo.getSaleOrderId()) + .eq(StringUtils.isNotBlank(bo.getSaleorderCode()), ProdPlanInfo::getSaleorderCode, bo.getSaleorderCode()) + .eq(StringUtils.isNotBlank(bo.getPlanCode()), ProdPlanInfo::getPlanCode, bo.getPlanCode()) + .eq(StringUtils.isNotBlank(bo.getDispatchCode()), ProdPlanInfo::getDispatchCode, bo.getDispatchCode()) + .eq(bo.getMaterialId() != null, ProdPlanInfo::getMaterialId, bo.getMaterialId()) + .eq(bo.getMaterialBomId() != null, ProdPlanInfo::getMaterialBomId, bo.getMaterialBomId()) + .eq(bo.getProcessId() != null, ProdPlanInfo::getProcessId, bo.getProcessId()) + .eq(bo.getProcessOrder() != null, ProdPlanInfo::getProcessOrder, bo.getProcessOrder()) + .eq(bo.getLastProcessId() != null, ProdPlanInfo::getLastProcessId, bo.getLastProcessId()) + .eq(StringUtils.isNotBlank(bo.getFinalProcessFlag()), ProdPlanInfo::getFinalProcessFlag, bo.getFinalProcessFlag()) + .eq(StringUtils.isNotBlank(bo.getReleaseType()), ProdPlanInfo::getReleaseType, bo.getReleaseType()) + .eq(bo.getReleaseId() != null, ProdPlanInfo::getReleaseId, bo.getReleaseId()) + .eq(bo.getProductionTime() != null, ProdPlanInfo::getProductionTime, bo.getProductionTime()) + .eq(bo.getPlanAmount() != null, ProdPlanInfo::getPlanAmount, bo.getPlanAmount()) + .eq(bo.getDispatchAmount() != null, ProdPlanInfo::getDispatchAmount, bo.getDispatchAmount()) + .eq(bo.getCompleteAmount() != null, ProdPlanInfo::getCompleteAmount, bo.getCompleteAmount()) + .eq(bo.getPlanBeginTime() != null, ProdPlanInfo::getPlanBeginTime, bo.getPlanBeginTime()) + .eq(bo.getPlanEndTime() != null, ProdPlanInfo::getPlanEndTime, bo.getPlanEndTime()) + .eq(bo.getRealBeginTime() != null, ProdPlanInfo::getRealBeginTime, bo.getRealBeginTime()) + .eq(bo.getRealEndTime() != null, ProdPlanInfo::getRealEndTime, bo.getRealEndTime()) + .eq(StringUtils.isNotBlank(bo.getAttachId()), ProdPlanInfo::getAttachId, bo.getAttachId()) + .eq(StringUtils.isNotBlank(bo.getPlanStatus()), ProdPlanInfo::getPlanStatus, bo.getPlanStatus()) + .eq(StringUtils.isNotBlank(bo.getImportFlag()), ProdPlanInfo::getImportFlag, bo.getImportFlag()) + .eq(StringUtils.isNotBlank(bo.getFinishFlag()), ProdPlanInfo::getFinishFlag, bo.getFinishFlag()) + .eq(bo.getPriority() != null, ProdPlanInfo::getPriority, bo.getPriority()) + .eq(bo.getShiftId() != null, ProdPlanInfo::getShiftId, bo.getShiftId()) + .eq(bo.getClassTeamId() != null, ProdPlanInfo::getClassTeamId, bo.getClassTeamId()) + .eq(StringUtils.isNotBlank(bo.getModelCode()), ProdPlanInfo::getModelCode, bo.getModelCode()) + .orderByDesc(ProdPlanInfo::getCreateTime); + return lqw; + } + + /** + * 新增生产工单信息 + * + * @param bo 生产工单信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdPlanInfoBo bo) { + ProdPlanInfo add = MapstructUtils.convert(bo, ProdPlanInfo.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setPlanId(add.getPlanId()); + } + return flag; + } + + /** + * 修改生产工单信息 + * + * @param bo 生产工单信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdPlanInfoBo bo) { + ProdPlanInfo update = MapstructUtils.convert(bo, ProdPlanInfo.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdPlanInfo entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除生产工单信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdOrderInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdOrderInfoMapper.xml new file mode 100644 index 00000000..48b3fdaf --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdOrderInfoMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml new file mode 100644 index 00000000..1be78ee8 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdPlanInfoMapper.xml @@ -0,0 +1,7 @@ + + + + +