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

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