diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/DeviceSpec35rController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/DeviceSpec35rController.java new file mode 100644 index 0000000..55d36a1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/DeviceSpec35rController.java @@ -0,0 +1,106 @@ +package com.ruoyi.system.controller; + +import java.util.List; +import java.util.Arrays; + +import lombok.RequiredArgsConstructor; +import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.PageQuery; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.domain.vo.DeviceSpec35rVo; +import com.ruoyi.system.domain.bo.DeviceSpec35rBo; +import com.ruoyi.system.service.IDeviceSpec35rService; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 35R设备规格参数 + * + * @author ruoyi + * @date 2025-12-01 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/system/spec35r") +public class DeviceSpec35rController extends BaseController { + + private final IDeviceSpec35rService iDeviceSpec35rService; + + /** + * 查询35R设备规格参数列表 + */ + @SaCheckPermission("system:spec35r:list") + @GetMapping("/list") + public TableDataInfo list(DeviceSpec35rBo bo, PageQuery pageQuery) { + return iDeviceSpec35rService.queryPageList(bo, pageQuery); + } + + /** + * 导出35R设备规格参数列表 + */ + @SaCheckPermission("system:spec35r:export") + @Log(title = "35R设备规格参数", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(DeviceSpec35rBo bo, HttpServletResponse response) { + List list = iDeviceSpec35rService.queryList(bo); + ExcelUtil.exportExcel(list, "35R设备规格参数", DeviceSpec35rVo.class, response); + } + + /** + * 获取35R设备规格参数详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("system:spec35r:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(iDeviceSpec35rService.queryById(id)); + } + + /** + * 新增35R设备规格参数 + */ + @SaCheckPermission("system:spec35r:add") + @Log(title = "35R设备规格参数", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody DeviceSpec35rBo bo) { + return toAjax(iDeviceSpec35rService.insertByBo(bo)); + } + + /** + * 修改35R设备规格参数 + */ + @SaCheckPermission("system:spec35r:edit") + @Log(title = "35R设备规格参数", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody DeviceSpec35rBo bo) { + return toAjax(iDeviceSpec35rService.updateByBo(bo)); + } + + /** + * 删除35R设备规格参数 + * + * @param ids 主键串 + */ + @SaCheckPermission("system:spec35r:remove") + @Log(title = "35R设备规格参数", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(iDeviceSpec35rService.deleteWithValidByIds(Arrays.asList(ids), true)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ProcessOrderProController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ProcessOrderProController.java index 822e101..e8ad875 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/controller/ProcessOrderProController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/ProcessOrderProController.java @@ -8,6 +8,7 @@ import java.util.*; import cn.hutool.json.JSONUtil; import com.alibaba.excel.EasyExcel; +import com.alibaba.fastjson.JSON; import com.fasterxml.jackson.core.JsonProcessingException; import com.ruoyi.common.excel.DefaultExcelListener; import com.ruoyi.common.exception.ServiceException; @@ -75,6 +76,7 @@ public class ProcessOrderProController extends BaseController { private final IImMaterialService imMaterialService; private final ISafetyStockService iSafetyStockService; private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy年MM月dd日"); + /** * 查询项目令号列表 */ @@ -370,7 +372,6 @@ public class ProcessOrderProController extends BaseController { } - @SaCheckPermission("system:route:exportRoute") @Log(title = "下载工艺生产表", businessType = BusinessType.EXPORT) @PostMapping("/exportRoute") @@ -391,8 +392,8 @@ public class ProcessOrderProController extends BaseController { } // 1. 读取第一个sheet的数据list - 使用POI直接读取以保留空格 - List allDataList = readExcelWithPOI(excelName); - List routeList = readExcelPOIRoute(excelName); + List allDataList = readExcelWithPOI(excelName,orderPro.getProductionOrderNo()); + List routeList = readExcelPOIRoute(excelName,orderPro.getProductionOrderNo()); // 2. 读取原始表数据 List rawDataList = readRawDataTable(rawDataFile); @@ -554,7 +555,7 @@ public class ProcessOrderProController extends BaseController { staticDataMap.put("productionName", orderPro.getProductionName()); //获取工艺数据信息 - List excelDTOList = iProcessOrderProService.getRouteAndBomDetail(routeList,processDataList,orderPro); + List excelDTOList = iProcessOrderProService.getRouteAndBomDetail(routeList, processDataList, orderPro); excelDTOList.sort(Comparator.comparing(ProcessRouteExcelDTO::getMaterial, Comparator.nullsLast((m1, m2) -> { // 总装部件优先 boolean isTotal1 = "总装部件".equals(m1); @@ -653,7 +654,7 @@ public class ProcessOrderProController extends BaseController { } } - private List readExcelPOIRoute(String excelName) { + private List readExcelPOIRoute(String excelName,String name) { List resultList = new ArrayList<>(); try (FileInputStream fis = new FileInputStream(excelName); @@ -662,7 +663,7 @@ public class ProcessOrderProController extends BaseController { XSSFSheet sheet = workbook.getSheetAt(6); // 读取第一个sheet // 从第3行开始读取(headRowNumber=2,所以从第3行开始) - for (int rowIndex = 2; rowIndex <= sheet.getLastRowNum(); rowIndex++) { + for (int rowIndex = 3; rowIndex <= sheet.getLastRowNum(); rowIndex++) { XSSFRow row = sheet.getRow(rowIndex); if (row == null) { continue; @@ -671,6 +672,7 @@ public class ProcessOrderProController extends BaseController { // 根据列索引读取数据,保留原始空格 vo.setMaterialCode(getCellValueAsString(row.getCell(0))); // 图号 + vo.setRouteDescription(name); // 图号 vo.setMaterialName(getCellValueAsString(row.getCell(1))); // 名称 vo.setMaterial(getCellValueAsString(row.getCell(2))); // 数量 vo.setDiscWeight(getCellValueAsDouble(row.getCell(3))); @@ -755,7 +757,7 @@ public class ProcessOrderProController extends BaseController { /** * 使用POI直接读取Excel文件,保留前后空格 */ - private List readExcelWithPOI(String excelPath) { + private List readExcelWithPOI(String excelPath,String orderName) { List resultList = new ArrayList<>(); try (FileInputStream fis = new FileInputStream(excelPath); @@ -772,6 +774,7 @@ public class ProcessOrderProController extends BaseController { ProductionOrderVo vo = new ProductionOrderVo(); // 根据列索引读取数据,保留原始空格 vo.setId(getCellValueAsLong(row.getCell(0))); + vo.setProductionOrderNo(orderName); vo.setDrawingNo(getCellValueAsString(row.getCell(1))); // 图号 vo.setDrawingName(getCellValueAsString(row.getCell(2))); // 名称 vo.setQuantity(getCellValueAsDouble(row.getCell(3))); // 数量 @@ -1096,9 +1099,11 @@ public class ProcessOrderProController extends BaseController { } return mapList; } + private String formatDate(Date date) { return date == null ? "" : DATE_FORMAT.format(date); } + /** * 转换工艺VO为Map列表(用于模板) */ @@ -1134,9 +1139,8 @@ public class ProcessOrderProController extends BaseController { } - @SaCheckPermission("system:route:exportRoute") - @Log(title = "下载工艺生产表", businessType = BusinessType.EXPORT) + @Log(title = "下载工艺生产表2", businessType = BusinessType.EXPORT) @PostMapping("/exportRoute2") public void exportRoute2(@RequestParam("id") Long id, HttpServletResponse response) { try { @@ -1155,8 +1159,8 @@ public class ProcessOrderProController extends BaseController { } // 1. 读取第一个sheet的数据list - 使用POI直接读取以保留空格 - List allDataList = readExcelWithPOI(excelName); - List routeList = readExcelPOIRoute(excelName); + List allDataList = readExcelWithPOI(excelName,orderPro.getProductionOrderNo()); + List routeList = readExcelPOIRoute(excelName,orderPro.getProductionOrderNo()); List routes = new ArrayList<>(); List> kingdeeBomRows = new ArrayList<>(); for (ProcessRoute base : routeList) { @@ -1176,44 +1180,27 @@ public class ProcessOrderProController extends BaseController { String bomversion = JdUtil.readGetTheLatestVersion(materialCode); List bomItems = StringUtils.isNotBlank(bomversion) ? JdUtil.getMaterialUseXByVer(bomversion) : Collections.emptyList(); List routeGuDing = JdUtil.getRouteGuDing(materialCode); - if (bomItems != null && !bomItems.isEmpty()) { - for (MaterialUseDTO b : bomItems) { - Map bomMap = new HashMap<>(); - bomMap.put("routeDescription", base.getRouteDescription()); - bomMap.put("materialCode", base.getMaterialCode()); - bomMap.put("materialName", base.getMaterialName()); - bomMap.put("material", base.getMaterial()); - bomMap.put("discWeight", base.getDiscWeight()); - bomMap.put("rawMaterialCode", b.getMaterialCode()); - bomMap.put("rawMaterialName", b.getMaterialName()); - bomMap.put("bomMaterial", b.getCaizhi()); - bomMap.put("bomDanZhong", b.getDanzhong()); - bomMap.put("discUsage", (b.getFenzi() != null && b.getFenmu() != null) ? (b.getFenzi() + "/" + b.getFenmu()) : null); - bomMap.put("bomUnit", b.getChildUnit()); - kingdeeBomRows.add(bomMap); - } - } + if (routeGuDing != null && !routeGuDing.isEmpty()) { - routeGuDing.stream() - .forEach(r -> { - ProcessRoute item = new ProcessRoute(); - item.setRouteDescription(base.getRouteDescription()); - item.setMaterialCode(base.getMaterialCode()); - item.setMaterialName(base.getMaterialName()); - item.setMaterial(base.getMaterial()); - item.setDiscWeight(base.getDiscWeight()); - item.setUnitQuantity(base.getUnitQuantity()); - item.setBatchQuantity(base.getBatchQuantity()); - // 不写入BOM字段,保持纯工艺数据行 - item.setProcessNo(r.getProcessNo()); - item.setWorkCenter(r.getWorkCenter()); - item.setProcessName(r.getProcessName()); - item.setProcessDescription(r.getProcessDescription()); - item.setProcessControl(r.getProcessControl()); - item.setActivityDuration(r.getActivityDuration()); - item.setActivityUnit(r.getActivityUnit()); - routes.add(item); - }); + routeGuDing.stream().forEach(r -> { + ProcessRoute item = new ProcessRoute(); + item.setRouteDescription(base.getRouteDescription()); + item.setMaterialCode(base.getMaterialCode()); + item.setMaterialName(base.getMaterialName()); + item.setMaterial(base.getMaterial()); + item.setDiscWeight(base.getDiscWeight()); + item.setUnitQuantity(base.getUnitQuantity()); + item.setBatchQuantity(base.getBatchQuantity()); + // 不写入BOM字段,保持纯工艺数据行 + item.setProcessNo(r.getProcessNo()); + item.setWorkCenter(r.getWorkCenter()); + item.setProcessName(r.getProcessName()); + item.setProcessDescription(r.getProcessDescription()); + item.setProcessControl(r.getProcessControl()); + item.setActivityDuration(r.getActivityDuration()); + item.setActivityUnit(r.getActivityUnit()); + routes.add(item); + }); } else { ProcessRoute item = new ProcessRoute(); item.setRouteDescription(base.getRouteDescription()); @@ -1226,6 +1213,32 @@ public class ProcessOrderProController extends BaseController { // 不写入BOM字段,保持纯工艺数据行 routes.add(item); } + if (bomItems != null && !bomItems.isEmpty()) { + if ("总装部件".equals(Objects.toString(base.getMaterial(), "").trim())) { + + } else { + for (MaterialUseDTO b : bomItems) { + Map bomMap = new HashMap<>(); + bomMap.put("routeDescription", base.getRouteDescription()); + bomMap.put("materialCode", base.getMaterialCode()); + bomMap.put("materialName", base.getMaterialName()); + bomMap.put("material", base.getMaterial()); + bomMap.put("discWeight", base.getDiscWeight()); + bomMap.put("rawMaterialCode", b.getMaterialCode()); + bomMap.put("rawMaterialName", b.getMaterialName()); + bomMap.put("bomMaterial", b.getCaizhi()); + bomMap.put("bomDanZhong", b.getDanzhong()); + if (b.getChildUnit().equals("根")) { + bomMap.put("discUsage", (b.getFenzi() != null && b.getFenmu() != null) ? (b.getFenzi() + "/" + b.getFenmu()) : null); + } else { + bomMap.put("discUsage", (b.getFenzi() != null && b.getFenmu() != null) ? b.getFenzi() : null); + } + + bomMap.put("bomUnit", b.getChildUnit()); + kingdeeBomRows.add(bomMap); + } + } + } } // 用生成的 routes 替换原始 routeList,保持原序展开后的结构用于后续导出 routeList = routes; @@ -1282,10 +1295,8 @@ public class ProcessOrderProController extends BaseController { // 电气外包分类条件:物料编码开头空格/特定前缀 或 备注包含"外购" if (materialCode.startsWith(" ") - || materialCode.startsWith("009301") || materialCode.startsWith("009999") - || materialCode.startsWith("017003") || materialCode.startsWith("017002") - || materialCode.startsWith("009001") || materialCode.startsWith("009081") - || (remark != null && remark.contains("外购"))) { + || materialCode.startsWith("009301") || materialCode.startsWith("009999") || materialCode.startsWith("017003") || materialCode.startsWith("017002") + || materialCode.startsWith("009001") || materialCode.startsWith("009081") || (remark != null && remark.contains("外购"))) { // 过滤安全库存:如果属于安全库存,则进入工艺数据列表 Boolean isSafeStock = iSafetyStockService.isSafeCode(materialCode.trim()); if (isSafeStock) { @@ -1387,25 +1398,6 @@ public class ProcessOrderProController extends BaseController { staticDataMap.put("productionOrderNo", orderPro.getProductionOrderNo()); staticDataMap.put("productionName", orderPro.getProductionName()); - //获取工艺数据信息 - /* List excelDTOList = iProcessOrderProService.getRouteAndBomDetail(routeList,processDataList,orderPro); - excelDTOList.sort(Comparator.comparing(ProcessRouteExcelDTO::getMaterial, Comparator.nullsLast((m1, m2) -> { - // 总装部件优先 - boolean isTotal1 = "总装部件".equals(m1); - boolean isTotal2 = "总装部件".equals(m2); - if (isTotal1 && !isTotal2) return -1; - if (!isTotal1 && isTotal2) return 1; - if (isTotal1 && isTotal2) return 0; - // 其他材质按字母顺序排序 - if (m1 == null && m2 == null) return 0; - if (m1 == null) return 1; - if (m2 == null) return -1; - return m1.compareTo(m2); - }) - ).thenComparing( - ProcessRouteExcelDTO::getMaterialCode, - Comparator.nullsLast(new VersionComparator()) - ));*/ // 准备动态数据映射 List dynamicDataMappingList = new ArrayList<>(); @@ -1502,61 +1494,28 @@ public class ProcessOrderProController extends BaseController { * 合并工艺路线与金蝶BOM行,按物料编码分组生成统一的 RouteBomData 列表 * 每条记录包含两类:rowType=route(工艺行)或 rowType=bom(BOM行),以便模板在同一块中连续展示 */ - private List> convertRouteBomToMapList(List routeDataList, - List> kingdeeBomRows) { + private List> convertRouteBomToMapList(List routeDataList, List> kingdeeBomRows) { Map>> grouped = new LinkedHashMap<>(); - - // 先按工艺数据建立分组与顺序 - for (ProcessRoute item : routeDataList) { - String mcode = item.getMaterialCode(); - if (mcode == null) mcode = ""; - grouped.computeIfAbsent(mcode, k -> new ArrayList<>()); - - Map map = new HashMap<>(); - map.put("rowType", "route"); - map.put("routeDescription", item.getRouteDescription()); - map.put("materialCode", item.getMaterialCode()); - map.put("materialName", item.getMaterialName()); - map.put("material", item.getMaterial()); - map.put("discWeight", item.getDiscWeight()); - map.put("processNo", item.getProcessNo()); - map.put("workCenter", item.getWorkCenter()); - map.put("processName", item.getProcessName()); - map.put("processDescription", item.getProcessDescription()); - map.put("processControl", item.getProcessControl()); - map.put("activityDuration", item.getActivityDuration()); - map.put("activityUnit", item.getActivityUnit()); - map.put("unitQuantity", item.getUnitQuantity()); - map.put("batchQuantity", item.getBatchQuantity()); - map.put("firstBatchQuantity", item.getFirstBatchQuantity()); - map.put("planStartTime", formatDate(item.getPlanStartTime())); - map.put("planEndTime", formatDate(item.getPlanEndTime())); - map.put("xuStartTime", formatDate(item.getXuStartTime())); - map.put("xuEndTime", formatDate(item.getXuEndTime())); - - // BOM占位(当前行类型为工艺,BOM字段置空) - map.put("rawMaterialCode", ""); - map.put("rawMaterialName", ""); - map.put("bomMaterial", ""); - map.put("bomDanZhong", ""); - map.put("discUsage", ""); - map.put("bomUnit", ""); - - grouped.get(mcode).add(map); - } - // 追加BOM数据到对应物料分组;若该物料此前未出现,则在最后新增一个分组 for (Map row : kingdeeBomRows) { - String mcode = Objects.toString(row.get("materialCode"), ""); + String mcode = Objects.toString(row.get("materialCode"), "").trim(); + String childCode = Objects.toString(row.get("rawMaterialCode"), "").trim(); + String parentMaterial = Objects.toString(row.get("material"), "").trim(); + if (mcode.isEmpty() || childCode.isEmpty()) { + continue; + } + if ("总装部件".equals(parentMaterial)) { + continue; + } grouped.computeIfAbsent(mcode, k -> new ArrayList<>()); Map map = new HashMap<>(); map.put("rowType", "bom"); - map.put("routeDescription", row.get("routeDescription")); - map.put("materialCode", row.get("materialCode")); - map.put("materialName", row.get("materialName")); - map.put("material", row.get("material")); - map.put("discWeight", row.get("discWeight")); + map.put("routeDescription", Objects.toString(row.get("routeDescription"), "")); + map.put("materialCode", mcode); + map.put("materialName", Objects.toString(row.get("materialName"), "")); + map.put("material", Objects.toString(row.get("material"), "")); + map.put("discWeight", Objects.toString(row.get("discWeight"), "")); // 工艺占位(当前行类型为BOM,工艺字段置空) map.put("processNo", ""); @@ -1575,12 +1534,71 @@ public class ProcessOrderProController extends BaseController { map.put("xuEndTime", ""); // BOM具体字段 - map.put("rawMaterialCode", row.get("rawMaterialCode")); - map.put("rawMaterialName", row.get("rawMaterialName")); - map.put("bomMaterial", row.get("bomMaterial")); - map.put("bomDanZhong", row.get("bomDanZhong")); - map.put("discUsage", row.get("discUsage")); - map.put("bomUnit", row.get("bomUnit")); + map.put("rawMaterialCode", childCode); + map.put("rawMaterialName", Objects.toString(row.get("rawMaterialName"), "")); + map.put("bomMaterial", Objects.toString(row.get("bomMaterial"), "")); + map.put("bomDanZhong", Objects.toString(row.get("bomDanZhong"), "")); + map.put("discUsage", Objects.toString(row.get("discUsage"), "")); + map.put("bomUnit", Objects.toString(row.get("bomUnit"), "")); + + grouped.get(mcode).add(map); + } + // 先按工艺数据建立分组与顺序 + for (ProcessRoute item : routeDataList) { + String mcode = Objects.toString(item.getMaterialCode(), "").trim(); + boolean noRoute = + Objects.toString(item.getMaterialCode(), "").trim().isEmpty() && + Objects.toString(item.getMaterialName(), "").trim().isEmpty() && + Objects.toString(item.getMaterial(), "").trim().isEmpty() && + item.getDiscWeight() == null && + item.getProcessNo() == null && + Objects.toString(item.getWorkCenter(), "").trim().isEmpty() && + Objects.toString(item.getProcessName(), "").trim().isEmpty() && + Objects.toString(item.getProcessDescription(), "").trim().isEmpty() && + Objects.toString(item.getProcessControl(), "").trim().isEmpty() && + item.getActivityDuration() == null && + Objects.toString(item.getActivityUnit(), "").trim().isEmpty() && + item.getUnitQuantity() == null && + item.getBatchQuantity() == null && + Objects.toString(item.getFirstBatchQuantity(), "").trim().isEmpty() && + item.getPlanStartTime() == null && + item.getPlanEndTime() == null && + item.getXuStartTime() == null && + item.getXuEndTime() == null; + if (noRoute) { + continue; + } + grouped.computeIfAbsent(mcode, k -> new ArrayList<>()); + + Map map = new HashMap<>(); + map.put("rowType", "route"); + map.put("routeDescription", Objects.toString(item.getRouteDescription(), "")); + map.put("materialCode", mcode); + map.put("materialName", Objects.toString(item.getMaterialName(), "")); + map.put("material", Objects.toString(item.getMaterial(), "")); + map.put("discWeight", Objects.toString(item.getDiscWeight(), "")); + map.put("processNo", item.getProcessNo()); + map.put("workCenter", Objects.toString(item.getWorkCenter(), "")); + map.put("processName", Objects.toString(item.getProcessName(), "")); + map.put("processDescription", Objects.toString(item.getProcessDescription(), "")); + map.put("processControl", Objects.toString(item.getProcessControl(), "")); + map.put("activityDuration", Objects.toString(item.getActivityDuration(), "")); + map.put("activityUnit", Objects.toString(item.getActivityUnit(), "")); + map.put("unitQuantity", item.getUnitQuantity()); + map.put("batchQuantity", item.getBatchQuantity()); + map.put("firstBatchQuantity", Objects.toString(item.getFirstBatchQuantity(), "")); + map.put("planStartTime", formatDate(item.getPlanStartTime())); + map.put("planEndTime", formatDate(item.getPlanEndTime())); + map.put("xuStartTime", formatDate(item.getXuStartTime())); + map.put("xuEndTime", formatDate(item.getXuEndTime())); + + // BOM占位(当前行类型为工艺,BOM字段置空) + map.put("rawMaterialCode", ""); + map.put("rawMaterialName", ""); + map.put("bomMaterial", ""); + map.put("bomDanZhong", ""); + map.put("discUsage", ""); + map.put("bomUnit", ""); grouped.get(mcode).add(map); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/DeviceSpec35r.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/DeviceSpec35r.java new file mode 100644 index 0000000..2866ee0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/DeviceSpec35r.java @@ -0,0 +1,129 @@ +package com.ruoyi.system.domain; + +import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 35R设备规格参数对象 device_spec_35r + * + * @author ruoyi + * @date 2025-12-01 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("device_spec_35r") +public class DeviceSpec35r extends BaseEntity { + + private static final long serialVersionUID=1L; + + /** + * 主键ID + */ + @TableId(value = "id") + private Long id; + /** + * 行程变量 + */ + private String travelLength; + /** + * 类型 + */ + private String itemType; + /** + * 轴向 + */ + private String axialType; + /** + * 箱体 + */ + private String boxType; + /** + * 行程 + */ + private Long V1; + /** + * 设备总长 + */ + private Long V2; + /** + * 地脚位置1 + */ + private Long V3; + /** + * 箱体装配长度 + */ + private Long V5; + /** + * 箱体地脚位置1 + */ + private Long V6; + /** + * 铝箱长度1 + */ + private Long V8; + /** + * 铝箱1重量 + */ + private BigDecimal G1; + /** + * 铝箱长度2 + */ + private BigDecimal V9; + /** + * 铝箱2重量 + */ + private BigDecimal G2; + /** + * 导向条长度1 + */ + private Long V10; + /** + * 导向条1单重 + */ + private BigDecimal G5; + /** + * 导向条长度2 + */ + private Long V12; + /** + * 导向条2单重 + */ + private BigDecimal G6; + /** + * 导向条长度3 + */ + private Long V14; + /** + * 导向条3单重 + */ + private BigDecimal G7; + /** + * 轴挡 + */ + private Long V41; + /** + * 35E链条滚轮 + */ + private Long V42; + /** + * 35E垫圈 + */ + private Long V43; + /** + * 35R链节轴2 + */ + private Long V44; + /** + * 35E链节轴2 + */ + private Long V45; + /** + * 35E链板 + */ + private Long V46; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/DeviceSpec35rBo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/DeviceSpec35rBo.java new file mode 100644 index 0000000..4d1bd82 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/bo/DeviceSpec35rBo.java @@ -0,0 +1,180 @@ +package com.ruoyi.system.domain.bo; + +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.core.validate.AddGroup; +import com.ruoyi.common.core.validate.EditGroup; +import lombok.Data; +import lombok.EqualsAndHashCode; +import javax.validation.constraints.*; + +import java.math.BigDecimal; + +/** + * 35R设备规格参数业务对象 device_spec_35r + * + * @author ruoyi + * @date 2025-12-01 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSpec35rBo extends BaseEntity { + + /** + * 主键ID + */ + @NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 行程变量 + */ + @NotBlank(message = "行程变量不能为空", groups = { AddGroup.class, EditGroup.class }) + private String travelLength; + + /** + * 类型 + */ + @NotBlank(message = "类型不能为空", groups = { AddGroup.class, EditGroup.class }) + private String itemType; + + /** + * 轴向 + */ + @NotBlank(message = "轴向不能为空", groups = { AddGroup.class, EditGroup.class }) + private String axialType; + + /** + * 箱体 + */ + @NotBlank(message = "箱体不能为空", groups = { AddGroup.class, EditGroup.class }) + private String boxType; + + /** + * 行程 + */ + @NotNull(message = "行程不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V1; + + /** + * 设备总长 + */ + @NotNull(message = "设备总长不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V2; + + /** + * 地脚位置1 + */ + @NotNull(message = "地脚位置1不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V3; + + /** + * 箱体装配长度 + */ + @NotNull(message = "箱体装配长度不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V5; + + /** + * 箱体地脚位置1 + */ + @NotNull(message = "箱体地脚位置1不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V6; + + /** + * 铝箱长度1 + */ + @NotNull(message = "铝箱长度1不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V8; + + /** + * 铝箱1重量 + */ + @NotNull(message = "铝箱1重量不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal G1; + + /** + * 铝箱长度2 + */ + @NotNull(message = "铝箱长度2不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal V9; + + /** + * 铝箱2重量 + */ + @NotNull(message = "铝箱2重量不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal G2; + + /** + * 导向条长度1 + */ + @NotNull(message = "导向条长度1不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V10; + + /** + * 导向条1单重 + */ + @NotNull(message = "导向条1单重不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal G5; + + /** + * 导向条长度2 + */ + @NotNull(message = "导向条长度2不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V12; + + /** + * 导向条2单重 + */ + @NotNull(message = "导向条2单重不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal G6; + + /** + * 导向条长度3 + */ + @NotNull(message = "导向条长度3不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V14; + + /** + * 导向条3单重 + */ + @NotNull(message = "导向条3单重不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal G7; + + /** + * 轴挡 + */ + @NotNull(message = "轴挡不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V41; + + /** + * 35E链条滚轮 + */ + @NotNull(message = "35E链条滚轮不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V42; + + /** + * 35E垫圈 + */ + @NotNull(message = "35E垫圈不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V43; + + /** + * 35R链节轴2 + */ + @NotNull(message = "35R链节轴2不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V44; + + /** + * 35E链节轴2 + */ + @NotNull(message = "35E链节轴2不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V45; + + /** + * 35E链板 + */ + @NotNull(message = "35E链板不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long V46; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/DeviceSpec35rVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/DeviceSpec35rVo.java new file mode 100644 index 0000000..86766b6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/DeviceSpec35rVo.java @@ -0,0 +1,180 @@ +package com.ruoyi.system.domain.vo; + +import java.math.BigDecimal; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import com.ruoyi.common.annotation.ExcelDictFormat; +import com.ruoyi.common.convert.ExcelDictConvert; +import lombok.Data; + + +/** + * 35R设备规格参数视图对象 device_spec_35r + * + * @author ruoyi + * @date 2025-12-01 + */ +@Data +@ExcelIgnoreUnannotated +public class DeviceSpec35rVo { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ExcelProperty(value = "主键ID") + private Long id; + + /** + * 行程变量 + */ + @ExcelProperty(value = "行程变量") + private String travelLength; + + /** + * 类型 + */ + @ExcelProperty(value = "类型") + private String itemType; + + /** + * 轴向 + */ + @ExcelProperty(value = "轴向") + private String axialType; + + /** + * 箱体 + */ + @ExcelProperty(value = "箱体") + private String boxType; + + /** + * 行程 + */ + @ExcelProperty(value = "行程") + private Long V1; + + /** + * 设备总长 + */ + @ExcelProperty(value = "设备总长") + private Long V2; + + /** + * 地脚位置1 + */ + @ExcelProperty(value = "地脚位置1") + private Long V3; + + /** + * 箱体装配长度 + */ + @ExcelProperty(value = "箱体装配长度") + private Long V5; + + /** + * 箱体地脚位置1 + */ + @ExcelProperty(value = "箱体地脚位置1") + private Long V6; + + /** + * 铝箱长度1 + */ + @ExcelProperty(value = "铝箱长度1") + private Long V8; + + /** + * 铝箱1重量 + */ + @ExcelProperty(value = "铝箱1重量") + private BigDecimal G1; + + /** + * 铝箱长度2 + */ + @ExcelProperty(value = "铝箱长度2") + private BigDecimal V9; + + /** + * 铝箱2重量 + */ + @ExcelProperty(value = "铝箱2重量") + private BigDecimal G2; + + /** + * 导向条长度1 + */ + @ExcelProperty(value = "导向条长度1") + private Long V10; + + /** + * 导向条1单重 + */ + @ExcelProperty(value = "导向条1单重") + private BigDecimal G5; + + /** + * 导向条长度2 + */ + @ExcelProperty(value = "导向条长度2") + private Long V12; + + /** + * 导向条2单重 + */ + @ExcelProperty(value = "导向条2单重") + private BigDecimal G6; + + /** + * 导向条长度3 + */ + @ExcelProperty(value = "导向条长度3") + private Long V14; + + /** + * 导向条3单重 + */ + @ExcelProperty(value = "导向条3单重") + private BigDecimal G7; + + /** + * 轴挡 + */ + @ExcelProperty(value = "轴挡") + private Long V41; + + /** + * 35E链条滚轮 + */ + @ExcelProperty(value = "35E链条滚轮") + private Long V42; + + /** + * 35E垫圈 + */ + @ExcelProperty(value = "35E垫圈") + private Long V43; + + /** + * 35R链节轴2 + */ + @ExcelProperty(value = "35R链节轴2") + private Long V44; + + /** + * 35E链节轴2 + */ + @ExcelProperty(value = "35E链节轴2") + private Long V45; + + /** + * 35E链板 + */ + @ExcelProperty(value = "35E链板") + private Long V46; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DeviceSpec35rMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DeviceSpec35rMapper.java new file mode 100644 index 0000000..f29f872 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DeviceSpec35rMapper.java @@ -0,0 +1,15 @@ +package com.ruoyi.system.mapper; + +import com.ruoyi.system.domain.DeviceSpec35r; +import com.ruoyi.system.domain.vo.DeviceSpec35rVo; +import com.ruoyi.common.core.mapper.BaseMapperPlus; + +/** + * 35R设备规格参数Mapper接口 + * + * @author ruoyi + * @date 2025-12-01 + */ +public interface DeviceSpec35rMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IDeviceSpec35rService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IDeviceSpec35rService.java new file mode 100644 index 0000000..760e4d2 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IDeviceSpec35rService.java @@ -0,0 +1,49 @@ +package com.ruoyi.system.service; + +import com.ruoyi.system.domain.DeviceSpec35r; +import com.ruoyi.system.domain.vo.DeviceSpec35rVo; +import com.ruoyi.system.domain.bo.DeviceSpec35rBo; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.domain.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 35R设备规格参数Service接口 + * + * @author ruoyi + * @date 2025-12-01 + */ +public interface IDeviceSpec35rService { + + /** + * 查询35R设备规格参数 + */ + DeviceSpec35rVo queryById(Long id); + + /** + * 查询35R设备规格参数列表 + */ + TableDataInfo queryPageList(DeviceSpec35rBo bo, PageQuery pageQuery); + + /** + * 查询35R设备规格参数列表 + */ + List queryList(DeviceSpec35rBo bo); + + /** + * 新增35R设备规格参数 + */ + Boolean insertByBo(DeviceSpec35rBo bo); + + /** + * 修改35R设备规格参数 + */ + Boolean updateByBo(DeviceSpec35rBo bo); + + /** + * 校验并批量删除35R设备规格参数信息 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DeviceSpec35rServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DeviceSpec35rServiceImpl.java new file mode 100644 index 0000000..4572799 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DeviceSpec35rServiceImpl.java @@ -0,0 +1,133 @@ +package com.ruoyi.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.domain.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ruoyi.common.utils.StringUtils; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import com.ruoyi.system.domain.bo.DeviceSpec35rBo; +import com.ruoyi.system.domain.vo.DeviceSpec35rVo; +import com.ruoyi.system.domain.DeviceSpec35r; +import com.ruoyi.system.mapper.DeviceSpec35rMapper; +import com.ruoyi.system.service.IDeviceSpec35rService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 35R设备规格参数Service业务层处理 + * + * @author ruoyi + * @date 2025-12-01 + */ +@RequiredArgsConstructor +@Service +public class DeviceSpec35rServiceImpl implements IDeviceSpec35rService { + + private final DeviceSpec35rMapper baseMapper; + + /** + * 查询35R设备规格参数 + */ + @Override + public DeviceSpec35rVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 查询35R设备规格参数列表 + */ + @Override + public TableDataInfo queryPageList(DeviceSpec35rBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询35R设备规格参数列表 + */ + @Override + public List queryList(DeviceSpec35rBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(DeviceSpec35rBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getTravelLength()), DeviceSpec35r::getTravelLength, bo.getTravelLength()); + lqw.eq(StringUtils.isNotBlank(bo.getItemType()), DeviceSpec35r::getItemType, bo.getItemType()); + lqw.eq(StringUtils.isNotBlank(bo.getAxialType()), DeviceSpec35r::getAxialType, bo.getAxialType()); + lqw.eq(StringUtils.isNotBlank(bo.getBoxType()), DeviceSpec35r::getBoxType, bo.getBoxType()); + lqw.eq(bo.getV1() != null, DeviceSpec35r::getV1, bo.getV1()); + lqw.eq(bo.getV2() != null, DeviceSpec35r::getV2, bo.getV2()); + lqw.eq(bo.getV3() != null, DeviceSpec35r::getV3, bo.getV3()); + lqw.eq(bo.getV5() != null, DeviceSpec35r::getV5, bo.getV5()); + lqw.eq(bo.getV6() != null, DeviceSpec35r::getV6, bo.getV6()); + lqw.eq(bo.getV8() != null, DeviceSpec35r::getV8, bo.getV8()); + lqw.eq(bo.getG1() != null, DeviceSpec35r::getG1, bo.getG1()); + lqw.eq(bo.getV9() != null, DeviceSpec35r::getV9, bo.getV9()); + lqw.eq(bo.getG2() != null, DeviceSpec35r::getG2, bo.getG2()); + lqw.eq(bo.getV10() != null, DeviceSpec35r::getV10, bo.getV10()); + lqw.eq(bo.getG5() != null, DeviceSpec35r::getG5, bo.getG5()); + lqw.eq(bo.getV12() != null, DeviceSpec35r::getV12, bo.getV12()); + lqw.eq(bo.getG6() != null, DeviceSpec35r::getG6, bo.getG6()); + lqw.eq(bo.getV14() != null, DeviceSpec35r::getV14, bo.getV14()); + lqw.eq(bo.getG7() != null, DeviceSpec35r::getG7, bo.getG7()); + lqw.eq(bo.getV41() != null, DeviceSpec35r::getV41, bo.getV41()); + lqw.eq(bo.getV42() != null, DeviceSpec35r::getV42, bo.getV42()); + lqw.eq(bo.getV43() != null, DeviceSpec35r::getV43, bo.getV43()); + lqw.eq(bo.getV44() != null, DeviceSpec35r::getV44, bo.getV44()); + lqw.eq(bo.getV45() != null, DeviceSpec35r::getV45, bo.getV45()); + lqw.eq(bo.getV46() != null, DeviceSpec35r::getV46, bo.getV46()); + return lqw; + } + + /** + * 新增35R设备规格参数 + */ + @Override + public Boolean insertByBo(DeviceSpec35rBo bo) { + DeviceSpec35r add = BeanUtil.toBean(bo, DeviceSpec35r.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改35R设备规格参数 + */ + @Override + public Boolean updateByBo(DeviceSpec35rBo bo) { + DeviceSpec35r update = BeanUtil.toBean(bo, DeviceSpec35r.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(DeviceSpec35r entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 批量删除35R设备规格参数 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteBatchIds(ids) > 0; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProcessOrderProServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProcessOrderProServiceImpl.java index b039210..aef41c0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProcessOrderProServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProcessOrderProServiceImpl.java @@ -424,6 +424,7 @@ public class ProcessOrderProServiceImpl implements IProcessOrderProService { // 批量查询PcRigidChain,避免N+1问题 Set figureNumbers = productionOrders.stream().map(FigureSave::getFigureNumber).collect(Collectors.toSet()); + Map rigidChainMap = pcRigidChainService.selectByTypeNames(figureNumbers).stream().collect(Collectors.toMap(PcRigidChain::getTypeName, Function.identity())); return productionOrders.stream().map(figureSave -> buildProductInfo(figureSave, rigidChainMap.get(figureSave.getFigureNumber()))).collect(Collectors.toList()); @@ -434,12 +435,9 @@ public class ProcessOrderProServiceImpl implements IProcessOrderProService { productInfo.setAssembledrawing(figureSave.getFigureNumber()); productInfo.setNumber(String.valueOf(figureSave.getFigureNum())); productInfo.setSourcefile(figureSave.getDrawPath().replace("/", "\\")); - log.info("项目生产令号为:{}查询产品型号信息: {}+ 产品名称: {}", figureSave.getProductionCode(), figureSave.getFigureNumber(), figureSave.getFigureName()); - DataInfo datainfo = buildDataInfo(rigidChain); productInfo.setVars(datainfo); - return productInfo; } diff --git a/ruoyi-system/src/main/resources/jpg/生产及工艺计划模版.xlsx b/ruoyi-system/src/main/resources/jpg/生产及工艺计划模版.xlsx index 7f72a34..1fcdf7f 100644 Binary files a/ruoyi-system/src/main/resources/jpg/生产及工艺计划模版.xlsx and b/ruoyi-system/src/main/resources/jpg/生产及工艺计划模版.xlsx differ diff --git a/ruoyi-system/src/main/resources/mapper/system/DeviceSpec35rMapper.xml b/ruoyi-system/src/main/resources/mapper/system/DeviceSpec35rMapper.xml new file mode 100644 index 0000000..fec99dc --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/DeviceSpec35rMapper.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +