新火炬后端单体项目初始化代码
cuilei
2 天以前 e0f827f71f5bb9d1ed9f6414221e90eeb34632a7
排产工单模块设备点检涉及接口
已添加2个文件
已修改8个文件
297 ■■■■■ 文件已修改
db/双林新火炬MES数据库设计.pdma.json 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/vo/MaintenanceStandardDetailVo.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/vo/MaintenanceStandardVo.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/Ë«ÁÖлð¾æMESÊý¾Ý¿âÉè¼Æ.pdma.json
@@ -2,9 +2,9 @@
  "name": "双林新火炬MES数据库设计",
  "describe": "描述双薪新火炬MES数据库设计详情",
  "avatar": "",
  "version": "4.9.2",
  "version": "4.9.4",
  "createdTime": "2025-3-10 16:38:19",
  "updatedTime": "2025-8-27 18:34:50",
  "updatedTime": "2025-9-4 11:02:24",
  "dbConns": [],
  "profile": {
    "default": {
@@ -4815,6 +4815,24 @@
          "id": "C6EFA873-D974-4F7E-9CB8-FBFC44A38B4F"
        },
        {
          "defKey": "work_order_id",
          "defName": "排产工单ID",
          "comment": "",
          "type": "",
          "len": "",
          "scale": "",
          "primaryKey": false,
          "notNull": false,
          "autoIncrement": false,
          "defaultValue": "",
          "hideInGraph": false,
          "refDict": "",
          "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
          "extProps": {},
          "domain": "16120F75-6AA7-4483-868D-F07F511BB081",
          "id": "48521BC4-F13A-49F0-B8EF-383CA631C9CB"
        },
        {
          "defKey": "inspection_date",
          "defName": "点检日期",
          "comment": "",
src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
@@ -12,15 +12,21 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.util.TranslateDictTextUtils;
import org.jeecg.modules.eam.constant.AssetStatusEnum;
import org.jeecg.modules.eam.constant.MaintenanceCategoryEnum;
import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamEquipmentExtend;
import org.jeecg.modules.eam.request.EamEquipmentQuery;
import org.jeecg.modules.eam.service.IEamEquipmentExtendService;
import org.jeecg.modules.eam.service.IEamEquipmentService;
import org.jeecg.modules.eam.vo.EquipmentSearchResult;
import org.jeecg.modules.mes.entity.MesProductionWorkOrder;
import org.jeecg.modules.mes.service.IMesProductionWorkOrderService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,8 +39,10 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @Description: è®¾å¤‡å°è´¦
@@ -60,6 +68,8 @@
    private ObjectMapper objectMapper;
    @Autowired
    private TranslateDictTextUtils translateDictTextUtils;
    @Autowired
    private IMesProductionWorkOrderService mesProductionWorkOrderService;
    /**
     * åˆ†é¡µåˆ—表查询
@@ -335,4 +345,26 @@
        return Result.ok(resultList);
    }
    @AutoLog(value = "查询排产工单所属产线下需要点检的设备列表")
    @ApiOperation(value = "查询排产工单所属产线下需要点检的设备列表", notes = "查询排产工单所属产线下需要点检的设备列表")
    @GetMapping(value = "/listProductionLineInspectionEquipment")
    public Result<?> listProductionLineInspectionEquipment(@RequestParam("orderId") String orderId) {
        MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(orderId);
        if (workOrder == null) {
            return Result.error("工单不存在!");
        }
        List<Map<String, Object>> equipmentMapList = eamEquipmentService.list(new LambdaQueryWrapper<EamEquipment>()
                        .eq(EamEquipment::getOrgId, workOrder.getFactoryId())
                        .eq(EamEquipment::getDelFlag, CommonConstant.DEL_FLAG_0)
                        .apply("NOT EXISTS (SELECT 1 FROM eam_inspection_order t WHERE t.equipment_id = eam_equipment.id AND t.work_order_id = {0})", orderId)
                        .apply("EXISTS (SELECT 1 FROM eam_maintenance_standard t WHERE t.equipment_id = eam_equipment.id AND t.del_flag = {0} " +
                                        "AND t.standard_status = {1} AND t.maintenance_category = {2})",
                                CommonConstant.DEL_FLAG_0, MaintenanceStandardStatusEnum.NORMAL.name(), MaintenanceCategoryEnum.POINT_INSPECTION.name()))
                .stream().map(e -> (Map<String, Object>) new HashMap<String, Object>() {{
                    put("value", e.getId());
                    put("label", e.getEquipmentCode() + "[" + e.getEquipmentName() + "]");
                    put("text", e.getEquipmentCode() + "[" + e.getEquipmentName() + "]");
                }}).collect(Collectors.toList());
        return Result.ok(equipmentMapList);
    }
}
src/main/java/org/jeecg/modules/eam/controller/EamMaintenanceStandardController.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.eam.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
@@ -24,10 +25,15 @@
import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail;
import org.jeecg.modules.eam.request.EamMaintenanceStandardRequest;
import org.jeecg.modules.eam.service.IEamEquipmentService;
import org.jeecg.modules.eam.service.IEamMaintenanceOrderDetailService;
import org.jeecg.modules.eam.service.IEamMaintenanceStandardDetailService;
import org.jeecg.modules.eam.service.IEamMaintenanceStandardService;
import org.jeecg.modules.eam.vo.MaintenanceStandardDetailVo;
import org.jeecg.modules.eam.vo.MaintenanceStandardVo;
import org.jeecg.modules.system.service.ISysBusinessCodeRuleService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -60,6 +66,8 @@
    private ISysBusinessCodeRuleService businessCodeRuleService;
    @Autowired
    private IEamEquipmentService eamEquipmentService;
    @Autowired
    private IEamMaintenanceStandardDetailService eamMaintenanceStandardDetailService;
    /**
     * åˆ†é¡µåˆ—表查询
@@ -242,6 +250,33 @@
        return Result.OK(eamMaintenanceStandard);
    }
    @AutoLog(value = "保养标准-通过设备id查询保养标准及明细项")
    @ApiOperation(value = "保养标准-通过设备id查询保养标准及明细项", notes = "保养标准-通过设备id查询保养标准及明细项")
    @GetMapping(value = "/queryByEquipmentId")
    public Result<MaintenanceStandardVo> queryByEquipmentId(@RequestParam("equipmentId") String equipmentId) {
        EamMaintenanceStandard maintenanceStandard = eamMaintenanceStandardService.list(new LambdaQueryWrapper<EamMaintenanceStandard>()
                        .eq(EamMaintenanceStandard::getEquipmentId, equipmentId)
                        .eq(EamMaintenanceStandard::getDelFlag, CommonConstant.DEL_FLAG_0)
                        .eq(EamMaintenanceStandard::getStandardStatus, MaintenanceStandardStatusEnum.NORMAL.name())
                        .eq(EamMaintenanceStandard::getMaintenanceCategory, MaintenanceCategoryEnum.POINT_INSPECTION.name()))
                .stream().findFirst().orElse(null);
        if (maintenanceStandard == null) {
            return Result.error("未找到该设备下的保养标准!");
        }
        MaintenanceStandardVo maintenanceStandardVo = new MaintenanceStandardVo();
        BeanUtils.copyProperties(maintenanceStandard, maintenanceStandardVo);
        List<EamMaintenanceStandardDetail> maintenanceStandardDetails = eamMaintenanceStandardDetailService
                .selectByStandardId(maintenanceStandard.getId());
        List<MaintenanceStandardDetailVo> maintenanceStandardDetailVos = CollectionUtil.newArrayList();
        maintenanceStandardDetails.forEach(item -> {
            MaintenanceStandardDetailVo maintenanceStandardDetailVo = new MaintenanceStandardDetailVo();
            BeanUtils.copyProperties(item, maintenanceStandardDetailVo);
            maintenanceStandardDetailVos.add(maintenanceStandardDetailVo);
        });
        maintenanceStandardVo.setMaintenanceStandardDetailList(maintenanceStandardDetailVos);
        return Result.OK(maintenanceStandardVo);
    }
    /**
     * å¯¼å‡ºexcel
     *
src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java
@@ -67,6 +67,11 @@
    @ApiModelProperty(value = "保养标准ID")
    @Dict(dictTable = "eam_maintenance_standard", dicCode = "id", dicText = "standard_name")
    private String standardId;
    /**排产工单ID*/
    @Excel(name = "排产工单ID", width = 15)
    @ApiModelProperty(value = "排产工单ID")
    @Dict(dictTable = "mes_production_work_order", dicCode = "id", dicText = "work_order_code")
    private String workOrderId;
    /**点检日期*/
    @Excel(name = "点检日期(计划)", width = 15, format = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java
@@ -57,6 +57,10 @@
    @ApiModelProperty(value = "保养标准ID")
    @Dict(dictTable = "eam_maintenance_standard", dicCode = "standard_code", dicText = "id")
    private String standardId;
    /**排产工单ID*/
    @ApiModelProperty(value = "排产工单ID")
    @Dict(dictTable = "mes_production_work_order", dicCode = "id", dicText = "work_order_code")
    private String workOrderId;
    /**点检日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
@@ -148,12 +148,19 @@
    public boolean addInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) {
        EamInspectionOrder eamInspectionOrder = new EamInspectionOrder();
        BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder);
        //修改状态
        if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) {
            eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name());
        } else {
            eamInspectionOrder.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name());
        eamInspectionOrder.setInspectionDate(new Date());
        eamInspectionOrder.setOperateTime(new Date());
        LoginUser user = getCurrentUser();
        if (user == null || StrUtil.isBlank(user.getId())) {
            throw new JeecgBootException("账号不存在");
        }
        eamInspectionOrder.setOperator(user.getUsername());
        ////修改状态
        //if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) {
        //    eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name());
        //} else {
        //    eamInspectionOrder.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name());
        //}
        save(eamInspectionOrder);
        //处理明细数据
        if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getTableDetailList())) {
@@ -163,20 +170,20 @@
            });
            eamInspectionOrderDetailService.saveBatch(eamInspectionOrderRequest.getTableDetailList());
        }
        //处理附件
        if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getFileList())) {
            FileUploadResult fileUploadResult = eamInspectionOrderRequest.getFileList().get(0);
            ObjectMapper mapper = new ObjectMapper();
            try {
                String referenceFile = mapper.writeValueAsString(fileUploadResult);
                eamInspectionOrder.setImageFiles(referenceFile);
            } catch (JsonProcessingException e) {
                log.error("JSON转换失败:" + e.getMessage(), e);
            }
        }
        if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) {
            triggerProcess(eamInspectionOrder);
        }
        ////处理附件
        //if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getFileList())) {
        //    FileUploadResult fileUploadResult = eamInspectionOrderRequest.getFileList().get(0);
        //    ObjectMapper mapper = new ObjectMapper();
        //    try {
        //        String referenceFile = mapper.writeValueAsString(fileUploadResult);
        //        eamInspectionOrder.setImageFiles(referenceFile);
        //    } catch (JsonProcessingException e) {
        //        log.error("JSON转换失败:" + e.getMessage(), e);
        //    }
        //}
        //if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) {
        //    triggerProcess(eamInspectionOrder);
        //}
        return true;
    }
src/main/java/org/jeecg/modules/eam/vo/MaintenanceStandardDetailVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
package org.jeecg.modules.eam.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
 * @Description: ä¿å…»æ ‡å‡†æ˜Žç»†
 * @Author: jeecg-boot
 * @Date:   2025-03-26
 * @Version: V1.0
 */
@Data
@Accessors(chain = true)
public class MaintenanceStandardDetailVo implements Serializable {
    /**主键*/
    @ApiModelProperty(value = "主键")
    private String id;
    /**保养标准ID*/
    @ApiModelProperty(value = "保养标准ID")
    private String standardId;
    /**保养项序号*/
    @ApiModelProperty(value = "保养项序号")
    private Integer itemCode;
    /**部位*/
    @ApiModelProperty(value = "部位")
    private String itemPart;
    /**保养项*/
    @ApiModelProperty(value = "保养项")
    private String itemName;
    /**子保养项*/
    @ApiModelProperty(value = "子保养项")
    private String subItemName;
    /**检查标准或要求*/
    @ApiModelProperty(value = "检查标准或要求")
    private String itemDemand;
    /**保养要求2*/
    @ApiModelProperty(value = "保养要求2")
    private String itemDemandAlias;
    /**检查方法*/
    @ApiModelProperty(value = "检查方法")
    private String checkMethod;
}
src/main/java/org/jeecg/modules/eam/vo/MaintenanceStandardVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,92 @@
package org.jeecg.modules.eam.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @Description: ä¿å…»æ ‡å‡†
 * @Author: jeecg-boot
 * @Date: 2025-03-26
 * @Version: V1.0
 */
@Data
@Accessors(chain = true)
public class MaintenanceStandardVo implements Serializable {
    /**
     * ä¸»é”®
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
    /**
     * æ ‡å‡†ç¼–码
     */
    @ApiModelProperty(value = "标准编码")
    private String standardCode;
    /**
     * æ ‡å‡†åç§°
     */
    @ApiModelProperty(value = "标准名称")
    private String standardName;
    /**
     * ä¿å…»å‘¨æœŸ;单位:天
     */
    @ApiModelProperty(value = "保养周期;单位:天")
    private Integer maintenancePeriod;
    /**
     * åˆå§‹æ—¥æœŸ ä»Žå“ªä¸€å¤©å¼€å§‹è®¡ç®—下次保养日期
     */
    @ApiModelProperty(value = "初始日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date initialDate;
    /**
     * ä¿å…»åˆ†ç±»
     */
    @ApiModelProperty(value = "保养分类")
    @Dict(dicCode = "maintenance_category")
    private String maintenanceCategory;
    /**
     * è®¾å¤‡ç¼–号
     */
    @ApiModelProperty(value = "设备编号")
    @Dict(dicCode = "eam_equipment, equipment_code, id")
    private String equipmentId;
    /**
     * æ ‡å‡†çŠ¶æ€
     */
    @ApiModelProperty(value = "标准状态")
    @Dict(dicCode = "maintenance_standard_status")
    private String standardStatus;
    /**
     * æ ‡å‡†ç‰ˆæœ¬
     */
    @ApiModelProperty(value = "标准版本")
    private Integer standardVersion;
    /**
     * æ–‡ä»¶ç¼–号
     */
    @ApiModelProperty(value = "文件编号")
    private String fileCode;
    /**
     * å‚考文件
     */
    @ApiModelProperty(value = "参考文件")
    private String referenceFile;
    /**
     * ä¿å…»æ ‡å‡†æ˜Žç»†
     */
    @ApiModelProperty(value = "保养标准明细")
    private List<MaintenanceStandardDetailVo> maintenanceStandardDetailList;
}
src/main/java/org/jeecg/modules/mes/controller/MesProductionWorkOrderController.java
@@ -27,6 +27,7 @@
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@@ -93,6 +94,11 @@
        mesProductionWorkOrderList.forEach(item -> {
            if (Objects.isNull(item.getId())) {
                item.setWorkOrderStatus(ProductionWorkOrderStatus.NEW.name());
                item.setCompletenessCheckFlag(CommonConstant.DEFAULT_0);
                item.setEquipmentInspectionFlag(CommonConstant.DEFAULT_0);
                item.setProcessInspectionFlag(CommonConstant.DEFAULT_0);
                item.setActualQuantity(BigDecimal.ZERO);
                item.setFinishedPallets(0);
            }
        });
        mesProductionWorkOrderService.saveOrUpdateBatch(mesProductionWorkOrderList);
src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
@@ -101,25 +101,25 @@
    @Excel(name = "是否通过齐套性检查", width = 15, dicCode = "yn")
    @Dict(dicCode = "yn")
    @ApiModelProperty(value = "是否通过齐套性检查")
    private String completenessCheckFlag = CommonConstant.DEFAULT_0;
    private String completenessCheckFlag;
    /**是否通过设备点检*/
    @Excel(name = "是否通过设备点检", width = 15, dicCode = "yn")
    @Dict(dicCode = "yn")
    @ApiModelProperty(value = "是否通过设备点检")
    private String equipmentInspectionFlag = CommonConstant.DEFAULT_0;
    private String equipmentInspectionFlag;
    /**是否通过工艺点检*/
    @Excel(name = "是否通过工艺点检", width = 15, dicCode = "yn")
    @Dict(dicCode = "yn")
    @ApiModelProperty(value = "是否通过工艺点检")
    private String processInspectionFlag = CommonConstant.DEFAULT_0;
    private String processInspectionFlag;
    /**实际报工数量*/
    @Excel(name = "实际报工数量", width = 15)
    @ApiModelProperty(value = "实际报工数量")
    private BigDecimal actualQuantity = BigDecimal.ZERO;
    private BigDecimal actualQuantity;
    /**已生产托数(当前班次已生产的托数量,每次报工时更新)*/
    @Excel(name = "已生产托数", width = 15)
    @ApiModelProperty(value = "已生产托数")
    private Integer finishedPallets = 0;
    private Integer finishedPallets;
    /**发布人*/
    @Excel(name = "发布人", width = 15)
    @ApiModelProperty(value = "发布人")