Bladeren bron

原始记录确认01

qiangxuan 3 weken geleden
bovenliggende
commit
ec16baa958

+ 5 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/controller/BilletHotsendChangeShiftController.java

@@ -179,7 +179,7 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 	public Result<String> editOriginalProductRecord(@RequestBody BilletHotsendChangeShift billetHotsendChangeShift) {
 
 		if (oConvertUtils.isEmpty(billetHotsendChangeShift.getId())){
-			return Result.error("交班ID不能为空,编辑失败!");
+			return Result.error("交班ID不能为空,操作失败!");
 		}
 
 		BilletHotsendChangeShift billetHotsendChangeShiftInfo = billetHotsendChangeShiftService.getById(billetHotsendChangeShift.getId());
@@ -192,8 +192,11 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 		if (oConvertUtils.isNotEmpty(billetHotsendChangeShift.getContent())){
 			billetHotsendChangeShiftInfo.setContent(billetHotsendChangeShift.getContent());
 		}
+		if (oConvertUtils.isNotEmpty(billetHotsendChangeShift.getConfirmStatus())){
+			billetHotsendChangeShiftInfo.setConfirmStatus(billetHotsendChangeShift.getConfirmStatus());
+		}
 		billetHotsendChangeShiftService.updateById(billetHotsendChangeShiftInfo);
-		return Result.OK("编辑成功!");
+		return Result.OK("操作成功!");
 	}
 	
 	/**

+ 4 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/entity/BilletHotsendChangeShift.java

@@ -189,4 +189,8 @@ public class BilletHotsendChangeShift implements Serializable {
 
     @ApiModelProperty(value = "原始生产记录备注信息")
     private String content;
+
+    @Excel(name = "原始记录确认状态 默认待确认:1,2:已确认", width = 15)
+    @ApiModelProperty(value = "原始记录确认状态 默认待确认:1,2:已确认")
+    private Integer confirmStatus;
 }

+ 3 - 23
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsendChangeShift/service/impl/BilletHotsendChangeShiftServiceImpl.java

@@ -150,6 +150,7 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                     .setAllCarNum(0)
                     .setCounts(0)
                     .setBlankOutputs(0d)
+                    .setConfirmStatus(1)
                     .setCreateTime(new Date());
             baseMapper.insert(billetHotsendChangeShift1);
 
@@ -234,29 +235,7 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                 billetHotsendChangeShift.setChangeShiftTime(new Date());
                 billetHotsendChangeShift.setUpdateTime(new Date());
                 baseMapper.updateById(billetHotsendChangeShift);
-                // 获取当前最新炉号
-//                if (oConvertUtils.isNotEmpty(billetHotsendChangeShift.getHeatNo())) {
-//                    // 根据当前炉号、铸机号、班组、班别查询总生产的钢坯数
-//                    LambdaQueryWrapper<BilletBasicInfo> queryWrapper = new LambdaQueryWrapper<BilletBasicInfo>()
-//                            .eq(BilletBasicInfo::getCcmNo, Integer.valueOf(ccmNo))
-//                            .eq(BilletBasicInfo::getHeatNo, billetHotsendChangeShift.getHeatNo())
-//                            .eq(BilletBasicInfo::getShift, billetHotsendChangeShift.getShift())
-//                            .eq(BilletBasicInfo::getShiftGroup, billetHotsendChangeShift.getShiftGroup())
-//                            .isNull(BilletBasicInfo::getBelongTable)
-//                            .isNull(BilletBasicInfo::getBhtcId)
-//                            .orderByAsc(BilletBasicInfo::getCreateTime);
-//                    List<BilletBasicInfo> billetBasicInfoList = billetBasicInfoService.list(queryWrapper);
-//                    List<BilletBasicInfo> updateBilletBasicInfo = extractRemainderData(billetBasicInfoList);
-//                    if (oConvertUtils.listIsNotEmpty(updateBilletBasicInfo)){
-//                        updateBilletBasicInfo.forEach(x -> {
-//                            x.setShift(billetHotsendChangeShiftVo.getShift());
-//                            x.setShiftGroup(billetHotsendChangeShiftVo.getShiftGroup());
-//                            x.setUpdateTime(new Date());
-//                        });
-//                        log.info("自动化交班判定该钢坯到新的班组:{}", JSON.toJSON(updateBilletBasicInfo) + "操作时间" + new Date());
-//                        billetBasicInfoService.saveOrUpdateBatch(updateBilletBasicInfo);
-//                    }
-//                }
+
 
                 // 生成新的交班记录 初始化并保存入库
                 BilletHotsendChangeShift billetHotsendChangeShift1 = new BilletHotsendChangeShift();
@@ -286,6 +265,7 @@ public class BilletHotsendChangeShiftServiceImpl extends ServiceImpl<BilletHotse
                 billetHotsendChangeShift1.setAllCarNum(0);
                 billetHotsendChangeShift1.setCounts(0);
                 billetHotsendChangeShift1.setBlankOutputs(0d);
+                billetHotsendChangeShift1.setConfirmStatus(1);
                 baseMapper.insert(billetHotsendChangeShift1);
                 /**
                  * 6号机根据 铸机号、当班班组、当班班别 查询储运配置信息,倒序取最新的一条,把查询到的牌号、定尺、目的地、新/旧站台

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.billet.billetOriginalProductRecord.controller;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.DecimalFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
@@ -569,6 +570,7 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 		 billetOriginalProductRecordDetails.setBilletOriginalProductRecordList(billetOriginalProductRecordList);
 		 billetOriginalProductRecordDetails.setSizeInfo(billetHotsendChangeShift.getSizeInfo());
 		 billetOriginalProductRecordDetails.setContent(billetHotsendChangeShift.getContent());
+		 billetOriginalProductRecordDetails.setConfirmStatus(billetHotsendChangeShift.getConfirmStatus());
 		 return Result.OK(billetOriginalProductRecordDetails);
 	 }
 
@@ -991,6 +993,95 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
 		 return heatsActualsInfoList;
 	 }
 
+	 @ApiOperation(value="钢坯堆垛原始生产记录查询", notes="钢坯原始堆垛生产记录查询")
+	 @GetMapping(value = "/queryBilletStackRecordByCcmNo")
+	 public Result<List<BilletOriginalHeatNoDetail>> queryBilletStackRecordByCcmNo(@RequestParam(name="ccmNo", required = false) String ccmNo,
+																			   @RequestParam(name="changeShiftId", required = false) String changeShiftId,
+																			   @RequestParam(name="queryType") String queryType) {
+		 List<BilletOriginalHeatNoDetail> billetOriginalHeatNoDetailList = new ArrayList<>();
+		 BilletHotsendChangeShift billetHotsendChangeShift;
+		 if ("1".equals(queryType)){
+			 String classShiftGroup = String.format("class:shift:group:%s", ccmNo); // 班组
+			 String classShift = String.format("class:shift:%s",ccmNo); // 班别
+			 String shift = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
+			 String shiftGroup = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
+
+			 if (oConvertUtils.isEmpty(shiftGroup) || oConvertUtils.isEmpty(shift)){
+				 return Result.error("班组班别获取为空,钢坯堆垛原始生产记录查询失败!");
+			 }
+			 // 根据ccmNo、shift、shiftGroup查询最新的交班记录
+			 LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
+			 queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
+					 .eq(BilletHotsendChangeShift::getShift, shift)
+					 .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
+					 .isNull(BilletHotsendChangeShift::getChangeShiftTime)
+					 .orderByDesc(BilletHotsendChangeShift::getCreateTime)
+					 .last("limit 1");
+			 billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
+			 if (billetHotsendChangeShift == null){
+				 log.info("{}{}", "钢坯堆垛原始生产记录,交班记录为空!", ccmNo + "失败时间:" + new Date());
+				 return Result.error("交班信息为空,钢坯堆垛原始生产记录查询失败!");
+			 }
+		 }else {
+			 billetHotsendChangeShift = billetHotsendChangeShiftService.getById(changeShiftId);
+		 }
+
+		 QueryWrapper<BilletOriginalProductRecord> queryWrapper3 = new QueryWrapper<>();
+		 queryWrapper3.eq("ccm_no", ccmNo)
+				 .eq("shift", billetHotsendChangeShift.getShift())
+				 .eq("shift_group", billetHotsendChangeShift.getShiftGroup());
+		 if ("1".equals(queryType)){
+			 queryWrapper3.between("create_time", billetHotsendChangeShift.getCreateTime(), new Date());
+		 }else {
+			 queryWrapper3.between("create_time", billetHotsendChangeShift.getCreateTime(), billetHotsendChangeShift.getChangeShiftTime());
+		 }
+		 // 通过铸机号、班组、班别、交班开始时间 查询钢坯堆垛生产原始记录
+		 List<BilletOriginalProductRecord> billetOriginalProductRecordList = billetOriginalProductRecordService.list(queryWrapper3);
+		 if (oConvertUtils.listIsEmpty(billetOriginalProductRecordList)){
+			 return Result.OK(billetOriginalHeatNoDetailList);
+		 }
+		 billetOriginalProductRecordList.forEach(x -> {
+			 BilletOriginalHeatNoDetail billetOriginalHeatNoDetail = new BilletOriginalHeatNoDetail();
+			 billetOriginalHeatNoDetail.setCcmNo(x.getCcmNo());
+			 billetOriginalHeatNoDetail.setHeatNo(x.getHeatNo());
+			 billetOriginalHeatNoDetail.setBrandNum(x.getGrade());
+			 billetOriginalHeatNoDetail.setShiftGroup(x.getShiftGroup());
+			 billetOriginalHeatNoDetail.setShift(x.getShift());
+			 if (oConvertUtils.isNotEmpty(x.getStackLength())){
+				 billetOriginalHeatNoDetail.setStackLength(x.getStackLength());
+				 String stackLengthJson = x.getStackLength();
+				 JSONArray jsonArray = JSON.parseArray(stackLengthJson);
+				 // 初始化总数和总重
+				 int totalCount = 0;
+				 double totalWeight = 0.0d;
+				 // 遍历 JSON 数组计算总数和总重
+				 for (int i = 0; i < jsonArray.size(); i++) {
+					 JSONObject item = jsonArray.getJSONObject(i);
+					 // 获取 stackingCount 字段并累加到总数
+					 int count = item.getIntValue("stackingCount");
+					 // 如果 stackingCount 为 0,跳过该项
+					 if (count == 0) {
+						 continue;
+					 }
+					 totalCount += count;
+					 // 获取 stackingWeight 字段并累加到总重
+					 double weight = item.getDoubleValue("stackingWeight");
+					 totalWeight += weight;
+				 }
+				 // 使用 DecimalFormat   四舍五入 保留四位小数
+				 DecimalFormat df = new DecimalFormat("#.####");
+				 String formattedWeight = df.format(totalWeight);
+				 double roundedWeight = Double.parseDouble(formattedWeight);
+				 billetOriginalHeatNoDetail.setAmountTotal(totalCount);
+				 billetOriginalHeatNoDetail.setBlankOutput(roundedWeight);
+			 }
+			 billetOriginalHeatNoDetailList.add(billetOriginalHeatNoDetail);
+		 });
+
+		 return Result.OK(billetOriginalHeatNoDetailList);
+	 }
+
+
 	 private List<Map<String, Object>> handleStorageBillPrintHotCharge(List<StorageBillPrint> storageBillPrintList, String heatNo) {
 		 List<Map<String, Object>> hotChargeList = new ArrayList<>();
 		 List<Map<String, Object>> finalResult = new ArrayList<>();

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

@@ -0,0 +1,34 @@
+package org.jeecg.modules.billet.billetOriginalProductRecord.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class BilletOriginalHeatNoDetail {
+
+    @ApiModelProperty(value = "铸机号")
+    private String ccmNo;
+
+    @ApiModelProperty(value = "炉号")
+    private String heatNo;
+
+    @ApiModelProperty(value = "牌号")
+    private String brandNum;
+
+    @ApiModelProperty(value = "班组")
+    private String shiftGroup;
+
+    @ApiModelProperty(value = "班别")
+    private String shift;
+
+    @ApiModelProperty(value = "堆垛总支数")
+    private Integer amountTotal;
+
+    /**出坯量*/
+    @ApiModelProperty(value = "堆垛总重量")
+    private Double blankOutput;
+
+    @ApiModelProperty(value = "堆垛定尺")
+    private String stackLength;
+
+}

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

@@ -17,4 +17,7 @@ public class BilletOriginalProductRecordDetail {
 
     @ApiModelProperty(value = "原始生产记录备注信息")
     private String content;
+
+    @ApiModelProperty(value = "原始记录确认状态 默认待确认:1,2:已确认")
+    private Integer confirmStatus;
 }