公共分页和list查询修改,设备字段修改

parent bf07ccef
...@@ -24,462 +24,382 @@ public class MaterialInfo implements Serializable { ...@@ -24,462 +24,382 @@ public class MaterialInfo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId("id")
private String id; private String id;
@TableField("creationtime")
private LocalDateTime creationtime; private LocalDateTime creationtime;
@TableField("creatoruserid")
private Long creatoruserid; private Long creatoruserid;
@TableField("lastmodificationtime")
private LocalDateTime lastmodificationtime; private LocalDateTime lastmodificationtime;
@TableField("lastmodifieruserid")
private Long lastmodifieruserid; private Long lastmodifieruserid;
@TableField("isdeleted")
private Long isdeleted; private Long isdeleted;
@TableField("deletiontime")
private LocalDateTime deletiontime; private LocalDateTime deletiontime;
@TableField("deleteruserid")
private Long deleteruserid; private Long deleteruserid;
/** /**
* 名称 * 名称
*/ */
@TableField("name")
private String name; private String name;
@TableField("brand")
private String brand; private String brand;
/** /**
* 规格 * 规格
*/ */
@TableField("specifications")
private String specifications; private String specifications;
@TableField("batch")
private String batch; private String batch;
@TableField("unit_price")
private BigDecimal unitPrice; private BigDecimal unitPrice;
@TableField("min_num")
private BigDecimal minNum; private BigDecimal minNum;
@TableField("tempcode")
private String tempcode; private String tempcode;
/** /**
* 编码 * 编码
*/ */
@TableField("code")
private String code; private String code;
@TableField("material_type_name")
private String materialTypeName; private String materialTypeName;
@TableField("inspect_duration")
private Long inspectDuration; private Long inspectDuration;
@TableField("purchase_duration")
private int purchaseDuration; private int purchaseDuration;
@TableField("first_lot")
private String firstLot; private String firstLot;
@TableField("tail_lot")
private BigDecimal tailLot; private BigDecimal tailLot;
@TableField("standard_log")
private BigDecimal standardLog; private BigDecimal standardLog;
@TableField("safe_stock_day")
private Long safeStockDay; private Long safeStockDay;
@TableField("safe_stock_quantity")
private BigDecimal safeStockQuantity; private BigDecimal safeStockQuantity;
/** /**
* 类别名称 * 类别名称
*/ */
@TableField("category_name")
private String categoryName; private String categoryName;
/** /**
* 类别编码 * 类别编码
*/ */
@TableField("category_code")
private String categoryCode; private String categoryCode;
/** /**
* 类别ID * 类别ID
*/ */
@TableField("category_id")
private Long categoryId; private Long categoryId;
@TableField("material_property")
private Long materialProperty; private Long materialProperty;
@TableField("root_category_id")
private Long rootCategoryId; private Long rootCategoryId;
@TableField("code_rule_id")
private Long codeRuleId; private Long codeRuleId;
@TableField("code_rule_type")
private Long codeRuleType; private Long codeRuleType;
/** /**
* 编码 * 编码
*/ */
@TableField("drawing")
private String drawing; private String drawing;
@TableField("material_type")
private Long materialType; private Long materialType;
/** /**
* 单位 * 单位
*/ */
@TableField("measure_unit")
private Long measureUnit; private Long measureUnit;
/** /**
* 单位名称 * 单位名称
*/ */
@TableField("measure_unit_name")
private String measureUnitName; private String measureUnitName;
/** /**
* 版本 * 版本
*/ */
@TableField("version")
private String version; private String version;
/** /**
* 产品类型 * 产品类型
*/ */
@TableField("product_type")
private String productType; private String productType;
@TableField("status")
private Long status; private Long status;
@TableField("latest")
private Long latest; private Long latest;
/** /**
* 是否创建原材料供应供应? * 是否创建原材料供应供应?
*/ */
@TableField("iscreatesupplyrouting")
private Long iscreatesupplyrouting; private Long iscreatesupplyrouting;
/** /**
* 是否创建原材料检验供应? * 是否创建原材料检验供应?
*/ */
@TableField("iscreatecheckrouting")
private Long iscreatecheckrouting; private Long iscreatecheckrouting;
@TableField("description")
private String description; private String description;
/** /**
* 物料类型 * 物料类型
*/ */
@TableField("quintiq_ortems")
private Long quintiqOrtems; private Long quintiqOrtems;
@TableField("isync")
private Long isync; private Long isync;
@TableField("issend")
private Long issend; private Long issend;
/** /**
* 辅助计量单位 * 辅助计量单位
*/ */
@TableField("measure_unit2")
private Long measureUnit2; private Long measureUnit2;
@TableField("measure_unit_name2")
private String measureUnitName2; private String measureUnitName2;
@TableField("linkmaterialid")
private String linkmaterialid; private String linkmaterialid;
/** /**
* 辅助计量单位2 * 辅助计量单位2
*/ */
@TableField("measure_unit3")
private Long measureUnit3; private Long measureUnit3;
@TableField("measure_unit_name3")
private String measureUnitName3; private String measureUnitName3;
@TableField("zjltofjl1")
private BigDecimal zjltofjl1; private BigDecimal zjltofjl1;
/** /**
* 供应商ID * 供应商ID
*/ */
@TableField("supply_id")
private String supplyId; private String supplyId;
/** /**
* 供应商名称 * 供应商名称
*/ */
@TableField("supply_name")
private String supplyName; private String supplyName;
/** /**
* 供应商编码 * 供应商编码
*/ */
@TableField("supply_code")
private String supplyCode; private String supplyCode;
@TableField("istrade")
private Long istrade; private Long istrade;
@TableField("ser")
private String ser; private String ser;
/** /**
* 是否共用? * 是否共用?
*/ */
@TableField("iscommon")
private Long iscommon; private Long iscommon;
/** /**
* 是否创建汇总供应? * 是否创建汇总供应?
*/ */
@TableField("iscreatepoolrouting")
private Long iscreatepoolrouting; private Long iscreatepoolrouting;
/** /**
* 特殊产品,普通产品 * 特殊产品,普通产品
*/ */
@TableField("variety")
private String variety; private String variety;
/** /**
* 规格 * 规格
*/ */
@TableField("spec")
private String spec; private String spec;
/** /**
* MP类别 * MP类别
*/ */
@TableField("category_id2")
private Long categoryId2; private Long categoryId2;
@TableField("utility_material")
private Long utilityMaterial; private Long utilityMaterial;
/** /**
* 特殊产品 * 特殊产品
*/ */
@TableField("special_product")
private Long specialProduct; private Long specialProduct;
/** /**
* 瓶型 * 瓶型
*/ */
@TableField("bottle_type")
private Long bottleType; private Long bottleType;
@TableField("bottle_type_str")
private String bottleTypeStr; private String bottleTypeStr;
/** /**
* 最大库存目标 * 最大库存目标
*/ */
@TableField("max_inventory_day")
private BigDecimal maxInventoryDay; private BigDecimal maxInventoryDay;
/** /**
* 最大库存目标 * 最大库存目标
*/ */
@TableField("max_inventory_quantity")
private BigDecimal maxInventoryQuantity; private BigDecimal maxInventoryQuantity;
/** /**
* 最小库存目标 * 最小库存目标
*/ */
@TableField("min_inventory_day")
private BigDecimal minInventoryDay; private BigDecimal minInventoryDay;
/** /**
* 最小库存目标 * 最小库存目标
*/ */
@TableField("min_inventory_quantity")
private BigDecimal minInventoryQuantity; private BigDecimal minInventoryQuantity;
/** /**
* 最小供应量 * 最小供应量
*/ */
@TableField("minimum_supply")
private BigDecimal minimumSupply; private BigDecimal minimumSupply;
/** /**
* 开始时间 * 开始时间
*/ */
@TableField("start_time")
private LocalDateTime startTime; private LocalDateTime startTime;
/** /**
* 结束时间 * 结束时间
*/ */
@TableField("end_time")
private LocalDateTime endTime; private LocalDateTime endTime;
/** /**
* 产线设备 * 产线设备
*/ */
@TableField("equip_id")
private Long equipId; private Long equipId;
/** /**
* 大宗产品 1==是 * 大宗产品 1==是
*/ */
@TableField("bigpro")
private Long bigpro; private Long bigpro;
/** /**
* 小宗产品 1==是 * 小宗产品 1==是
*/ */
@TableField("smallpro")
private Long smallpro; private Long smallpro;
/** /**
* 周三后排? * 周三后排?
*/ */
@TableField("isthree")
private Long isthree; private Long isthree;
/** /**
* 是否负库存 * 是否负库存
*/ */
@TableField("is_minus")
private Long isMinus; private Long isMinus;
@TableField("remark")
private String remark; private String remark;
/** /**
* 搭配大宗产品 * 搭配大宗产品
*/ */
@TableField("match_bigpro_id")
private String matchBigproId; private String matchBigproId;
/** /**
* 搭配大宗产品 * 搭配大宗产品
*/ */
@TableField("match_bigpro_code")
private String matchBigproCode; private String matchBigproCode;
/** /**
* 搭配小宗产品 * 搭配小宗产品
*/ */
@TableField("match_smallpro_id")
private String matchSmallproId; private String matchSmallproId;
/** /**
* 搭配小宗产品 * 搭配小宗产品
*/ */
@TableField("match_smallpro_code")
private String matchSmallproCode; private String matchSmallproCode;
/** /**
* 全称 * 全称
*/ */
@TableField("full_name")
private String fullName; private String fullName;
/** /**
* 是否包含库存,默认是,0否 * 是否包含库存,默认是,0否
*/ */
@TableField("is_include_store")
private Long isIncludeStore; private Long isIncludeStore;
/** /**
* 是否平分到未来四周,默认0否,1是 * 是否平分到未来四周,默认0否,1是
*/ */
@TableField("is_average_four_week")
private Long isAverageFourWeek; private Long isAverageFourWeek;
/** /**
* 库存同步时间 * 库存同步时间
*/ */
@TableField("stocksynctime")
private LocalDateTime stocksynctime; private LocalDateTime stocksynctime;
@TableField("inventory_host_cost")
private Long inventoryHostCost; private Long inventoryHostCost;
/** /**
* 拆分前计划ID * 拆分前计划ID
*/ */
@TableField("beforeplanid")
private String beforeplanid; private String beforeplanid;
/** /**
* 计划顺序号 * 计划顺序号
*/ */
@TableField("plannum")
private Long plannum; private Long plannum;
/** /**
* 计划总数 * 计划总数
*/ */
@TableField("plancount")
private Long plancount; private Long plancount;
/** /**
* 集成过来的主键; * 集成过来的主键;
*/ */
@TableField("new_long_id")
private Long newLongId; private Long newLongId;
/** /**
* 集成过来的旧物料编码 * 集成过来的旧物料编码
*/ */
@TableField("new_oldnumber")
private String newOldnumber; private String newOldnumber;
/** /**
* 集成过来的最小起订量 * 集成过来的最小起订量
*/ */
@TableField("min_quantity")
private BigDecimal minQuantity; private BigDecimal minQuantity;
/** /**
* 0 其他1 外贸 2 研发 3 试料 4西南 5追加 * 0 其他1 外贸 2 研发 3 试料 4西南 5追加
*/ */
@TableField("material_plan_type")
private Long materialPlanType; private Long materialPlanType;
/** /**
* 最小生产量 * 最小生产量
*/ */
@TableField("min_production")
private BigDecimal minProduction; private BigDecimal minProduction;
/** /**
* 最大生产量 * 最大生产量
*/ */
@TableField("max_production")
private BigDecimal maxProduction; private BigDecimal maxProduction;
/** /**
* 不可见性(外贸删除的物料) * 不可见性(外贸删除的物料)
*/ */
@TableField("invisable")
private Long invisable; private Long invisable;
} }
\ No newline at end of file
...@@ -8,39 +8,95 @@ import java.util.Objects; ...@@ -8,39 +8,95 @@ import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer; import java.util.function.Consumer;
/**
* 机器设备类
* 用于表示生产系统中的机器设备,包含基本信息、工作时间、维护窗口等
*/
@Data @Data
public class Machine { public class Machine {
private long id; private long id;
/**
* 设备名称
*/
private String name; private String name;
/**
* 最早可用时间,默认值:0
*/
private int earliestTime=0; private int earliestTime=0;
/**
* 总任务时间
*/
private double totalTaskTime=0; private double totalTaskTime=0;
/**
* 班次列表
*/
private List<Shift> shifts; private List<Shift> shifts;
/**
* 维护窗口列表
*/
private List<MaintenanceWindow> maintenanceWindows; private List<MaintenanceWindow> maintenanceWindows;
/**
* 可用时间段列表(线程安全)
*/
private CopyOnWriteArrayList<TimeSegment> availability; private CopyOnWriteArrayList<TimeSegment> availability;
/**
* 设备编码
*/
private String code; private String code;
/**
* 节假日列表
*/
private List<Holiday> holidays; private List<Holiday> holidays;
/**
* 实际工作时间
*/
private double actualWorkTime; private double actualWorkTime;
/**
* 工作效率
*/
private double rate; private double rate;
/**
* 所属部门
*/
private String department; private String department;
// 事件回调 /**
* 班次变更事件回调
*/
private Consumer<Void> shiftsChanged; private Consumer<Void> shiftsChanged;
/**
* 维护窗口变更事件回调
*/
private Consumer<Void> maintenanceWindowsChanged; private Consumer<Void> maintenanceWindowsChanged;
public Machine() { public Machine() {
this.shifts = new ArrayList<>(); this.shifts = new ArrayList<>();
this.maintenanceWindows = new ArrayList<>(); this.maintenanceWindows = new ArrayList<>();
this.availability = new CopyOnWriteArrayList<>(); this.availability = new CopyOnWriteArrayList<>();
} }
public Machine(int id, String name) { public Machine(int id, String name) {
this(); this();
this.id = id; this.id = id;
this.name = name; this.name = name;
} }
// 添加维护窗口的方法
public void addMaintenanceWindow(MaintenanceWindow window) { public void addMaintenanceWindow(MaintenanceWindow window) {
maintenanceWindows.add(window); maintenanceWindows.add(window);
if (maintenanceWindowsChanged != null) { if (maintenanceWindowsChanged != null) {
...@@ -48,6 +104,7 @@ public class Machine { ...@@ -48,6 +104,7 @@ public class Machine {
} }
} }
public void addShift(Shift shift) { public void addShift(Shift shift) {
shifts.add(shift); shifts.add(shift);
if (shiftsChanged != null) { if (shiftsChanged != null) {
...@@ -55,7 +112,7 @@ public class Machine { ...@@ -55,7 +112,7 @@ public class Machine {
} }
} }
// 重写equals和hashCode方法,只基于id进行比较
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
......
...@@ -100,7 +100,7 @@ int newStartTime=0; ...@@ -100,7 +100,7 @@ int newStartTime=0;
.filter(r -> r.getOperationId() == targetOp2.getId()) .filter(r -> r.getOperationId() == targetOp2.getId())
.findFirst() .findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId)); .orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
if (targetResult2.getEndTime() < newStartTime) { if (targetResult2.getEndTime() > newStartTime) {
throw new RuntimeException("不能早于前一工序的结束时间"); throw new RuntimeException("不能早于前一工序的结束时间");
} }
} }
...@@ -327,7 +327,10 @@ if(targetOp.getSequence()>1) { ...@@ -327,7 +327,10 @@ if(targetOp.getSequence()>1) {
opGroupMap.forEach(t->t.setTime(opTimeMap.get(t.getId()))); opGroupMap.forEach(t -> {
Integer time = opTimeMap.get(t.getId());
t.setTime(time != null ? time : 0); // 如果映射中没有该ID的时间,则默认设为0
});
opGroupMap = opGroupMap.stream() opGroupMap = opGroupMap.stream()
.sorted(Comparator.comparingLong(OperationSort::getTime)) .sorted(Comparator.comparingLong(OperationSort::getTime))
......
...@@ -515,7 +515,7 @@ public class ChromosomeDataService { ...@@ -515,7 +515,7 @@ public class ChromosomeDataService {
// 3. 尝试从JavaDoc注释中提取描述 // 3. 尝试从JavaDoc注释中提取描述
String javaDocComment = getJavaDocComment(entityClass, field.getName()); String javaDocComment = getFieldCommentFromSource(entityClass, field.getName());
if (javaDocComment != null && !javaDocComment.isEmpty() && !fieldDescriptions.containsKey(field.getName())) { if (javaDocComment != null && !javaDocComment.isEmpty() && !fieldDescriptions.containsKey(field.getName())) {
fieldDescriptions.put(field.getName(), javaDocComment); fieldDescriptions.put(field.getName(), javaDocComment);
} }
...@@ -585,50 +585,43 @@ public class ChromosomeDataService { ...@@ -585,50 +585,43 @@ public class ChromosomeDataService {
* @param fieldName 字段名 * @param fieldName 字段名
* @return 字段描述,提取失败返回null * @return 字段描述,提取失败返回null
*/ */
private String getJavaDocComment(Class<?> entityClass, String fieldName) { /**
* 从JavaDoc中提取字段注释
* @param clazz 实体类
* @param fieldName 字段名
* @return 字段注释
*/
/**
* 从源文件中提取字段注释
* @param clazz 实体类
* @param fieldName 字段名
* @return 字段注释
*/
private String getFieldCommentFromSource(Class<?> clazz, String fieldName) {
try { try {
// 这里使用简单的方式模拟JavaDoc注释提取 // 获取类的源文件路径
// 实际项目中可以使用JavaDoc API或第三方库来解析 String packagePath = clazz.getPackage().getName().replace('.', '/');
Map<String, String> orderFieldComments = new HashMap<>(); String fileName = clazz.getSimpleName() + ".java";
orderFieldComments.put("id", "自增主键"); String sourcePath = "src/main/java/" + packagePath + "/" + fileName;
orderFieldComments.put("orderId", "订单ID");
orderFieldComments.put("orderCode", "订单编码"); java.io.File file = new java.io.File(sourcePath);
orderFieldComments.put("productId", "产品ID"); if (file.exists()) {
orderFieldComments.put("materialId", "物料ID"); String content = new String(java.nio.file.Files.readAllBytes(file.toPath()), "UTF-8");
orderFieldComments.put("materialCode", "物料编码");
orderFieldComments.put("materialName", "物料名称"); // 使用正则表达式匹配字段注释
orderFieldComments.put("serie", "系列"); String pattern = "/\\*\\*\\s*(?:\\*\\s*(.*?))+\\s*\\*/\\s*private\\s+\\w+\\s+" + fieldName + "\\s*";
orderFieldComments.put("routingId", "工艺路线ID"); java.util.regex.Pattern regex = java.util.regex.Pattern.compile(pattern, java.util.regex.Pattern.DOTALL);
orderFieldComments.put("routingCode", "工艺路线编码"); java.util.regex.Matcher matcher = regex.matcher(content);
orderFieldComments.put("quantity", "订单数量,默认值:100");
orderFieldComments.put("sYQuantity", "生产数量"); if (matcher.find()) {
orderFieldComments.put("startDate", "开始日期"); String comment = matcher.group(1);
orderFieldComments.put("dueDate", "到期日期"); return comment.replaceAll("\\*\\s*", "").trim();
orderFieldComments.put("groupStartDate", "组开始日期"); }
orderFieldComments.put("groupDueDate", "组到期日期"); }
orderFieldComments.put("orderCompletion", "订单完成时间");
orderFieldComments.put("orderStart", "订单开始时间");
orderFieldComments.put("machineProcessingTime", "机器加工时间");
orderFieldComments.put("orderFlow", "订单流程");
orderFieldComments.put("orderProductTime", "订单生产时间");
orderFieldComments.put("tardiness", "延误时间");
orderFieldComments.put("priority", "优先级");
orderFieldComments.put("canSplit", "是否可拆分,默认值:false");
orderFieldComments.put("canInterrupt", "是否可中断,默认值:false");
orderFieldComments.put("actualPriority", "实际优先级");
orderFieldComments.put("mainId", "主ID");
orderFieldComments.put("FinishOrderId", "使用这个半成品的成品工单");
orderFieldComments.put("newCreate", "是否新创建,默认值:false");
orderFieldComments.put("createBom", "是否创建BOM,默认值:false");
orderFieldComments.put("TargetFinishedOperationId", "关联的成品工序ID(核心:明确该半成品服务于哪个成品工序)");
orderFieldComments.put("delayHours", "延迟时间");
orderFieldComments.put("materialRequirementList", "物料需求");
return orderFieldComments.get(fieldName);
} catch (Exception e) { } catch (Exception e) {
log.error("提取JavaDoc注释失败: {}", e.getMessage(), e); e.printStackTrace();
return null;
} }
return null;
} }
/** /**
* 创建空的分页结果 * 创建空的分页结果
...@@ -1753,9 +1746,9 @@ public class ChromosomeDataService { ...@@ -1753,9 +1746,9 @@ public class ChromosomeDataService {
// 调用editOperation方法 // 调用editOperation方法
chromosome = planResultService.editOperation(chromosome, sceneId, originalEntry ); chromosome = planResultService.editOperation(chromosome, sceneId, originalEntry );
if (originalEntry.getDesignatedStartTime()== null){ if (originalEntry.getDesignatedStartTime()== null)
planResultService.unlockStartTime(chromosome, originalEntry.getId()); planResultService.unlockStartTime(chromosome, originalEntry.getId());
}else { else {
List<Integer> opids = new ArrayList<>(); List<Integer> opids = new ArrayList<>();
opids.add(originalEntry.getId()); opids.add(originalEntry.getId());
......
...@@ -491,6 +491,8 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -491,6 +491,8 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
Chromosome chromosome = _sceneService.loadChromosomeFromFile(sceneId); Chromosome chromosome = _sceneService.loadChromosomeFromFile(sceneId);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService(); ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.UnlockStartTime(chromosome, opId); ScheduleOperation.UnlockStartTime(chromosome, opId);
_sceneService.saveChromosomeToFile(chromosome, sceneId);
} }
...@@ -2016,7 +2018,7 @@ private GlobalParam InitGlobalParam() ...@@ -2016,7 +2018,7 @@ private GlobalParam InitGlobalParam()
taskVO.setSeqName(entry.getRoutingDetailName()); taskVO.setSeqName(entry.getRoutingDetailName());
} }
if (gene.getDesignatedStartTime()!=-1) { if (gene.getDesignatedStartTime()>0) {
taskVO.setDesignatedStartTime(scheduleChromosome.getBaseTime().plusSeconds(gene.getDesignatedStartTime())); taskVO.setDesignatedStartTime(scheduleChromosome.getBaseTime().plusSeconds(gene.getDesignatedStartTime()));
}else { }else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment