Pārlūkot izejas kodu

凉坯位置001

qiangxuan 5 dienas atpakaļ
vecāks
revīzija
67fa439af6

+ 17 - 10
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetOriginalProductRecord/controller/BilletOriginalProductRecordController.java

@@ -708,7 +708,9 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 					applyColdConfirmInfo(bopr, sysUser);
 				}else {
 					// 拆分指定数量的凉坯单
-					String appointColdBilletJsonArray = handleAppointColdBillet(bopr, appointColdBilletCount, targetSize, sysUser.getRealname());
+					int startPosition = billetOriginalProductRecordVo.getStartPosition();
+					int endPosition = billetOriginalProductRecordVo.getEndPosition();
+					String appointColdBilletJsonArray = handleAppointColdBillet(bopr, appointColdBilletCount, targetSize, sysUser.getRealname(), startPosition, endPosition);
 					// 更新原堆垛信息,减去已拆分的数量和重量
 					if (stackArray != null && !stackArray.isEmpty()) {
 						try {
@@ -787,7 +789,7 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 	 * @param
 	 * @return
 	 */
-	private String handleAppointColdBillet(BilletOriginalProductRecord bopr, int appointColdBilletCount, int targetSize, String coldConfirmBy) {
+	private String handleAppointColdBillet(BilletOriginalProductRecord bopr, int appointColdBilletCount, int targetSize, String coldConfirmBy, int startPosition, int endPosition) {
 
 		BigDecimal sizeDecimal = new BigDecimal(targetSize);
 		BigDecimal weight = calculateWeight(sizeDecimal, appointColdBilletCount);
@@ -826,15 +828,20 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 		List<Map<String, Object>> rollSendDetailsList = new ArrayList<>();
 		rollSendDetailsList.add(rollSendDetail);
 
-		// 3. 构建 sizeDetails 列表
-		Map<String, Integer> coldLengthCumulativeCountMap = new HashMap<>(); // 冷坯起始位置
-		String lengthKey = String.valueOf(targetSize); // 统一使用字符串键
+		// 根据传入的 startPosition 和拆单数量计算 startAmount 和 endAmount
+		int startAmount = startPosition;
+		int endAmount = startPosition + appointColdBilletCount - 1; // 因为包含起始位置,所以减1
+		// 计算原来凉坯单 剩余部分的起止位置
+		int remainingStart = endAmount + 1;
+		int remainingEnd = endPosition;
+		// 对冷坯单拆分后,原始冷坯单的起始位置、终止位置 进行记录
+		UpdateWrapper<BilletOriginalProductRecord> updateWrapper = new UpdateWrapper<>();
+		updateWrapper.eq("id", bopr.getId()) // 根据ID更新
+				.set("start_position", remainingStart) // 指定要更新的字段
+				.set("end_position", remainingEnd)
+				.set("update_time", new Date());
+		billetOriginalProductRecordService.update(updateWrapper);
 
-		// 计算起始根数与终止根数 - 使用一致的字符串键
-		int lastEndAmount = coldLengthCumulativeCountMap.getOrDefault(lengthKey, 0);
-		int startAmount = lastEndAmount + 1;
-		int endAmount = lastEndAmount + appointColdBilletCount;
-		coldLengthCumulativeCountMap.put(lengthKey, endAmount); // 更新累计值
 
 		Map<String, Object> sizeDetail = new HashMap<>();
 		sizeDetail.put("size", targetSize);

+ 8 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetOriginalProductRecord/entity/BilletOriginalProductRecord.java

@@ -243,4 +243,12 @@ public class BilletOriginalProductRecord implements Serializable {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "棒一起始时间")
     private Date rollClubOneTime;
+
+    @Excel(name = "冷坯本炉起始根", width = 15)
+    @ApiModelProperty(value = "冷坯本炉起始根")
+    private Integer startPosition;
+
+    @Excel(name = "冷坯本炉终止根", width = 15)
+    @ApiModelProperty(value = "冷坯本炉终止根")
+    private Integer endPosition;
 }

+ 3 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetOriginalProductRecord/vo/BilletColdOriginalRecordVo.java

@@ -8,4 +8,7 @@ public class BilletColdOriginalRecordVo {
     private Integer length;//定尺
     private Integer coldAmount;//冷坯数量
 
+    private Integer startPosition;
+    private Integer endPosition;
+
 }