Bläddra i källkod

垛位位置变更、手动交班逻辑优化

qiangxuan 1 månad sedan
förälder
incheckning
53fa57ddfd

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

@@ -292,14 +292,15 @@ public class BilletHotsendChangeShiftController extends JeecgController<BilletHo
 		// 解析输入的年月字符串
 		YearMonth yearMonth = YearMonth.parse(dateMonth, DateTimeFormatter.ofPattern("yyyy-MM"));
 
-		// 获取该月的第一天的开始时间
-		LocalDateTime startTime = yearMonth.atDay(1).atStartOfDay();
-		// 获取该月的最后一天的结束时间
-		LocalDateTime endTime = yearMonth.atEndOfMonth().atTime(LocalTime.MAX);
+		// 获取该月前一个月的最后一天的23:00:00作为开始时间
+		LocalDateTime startTime = yearMonth.minusMonths(1).atEndOfMonth().atTime(23, 0, 0);
+		// 获取该月后一个月的第一天的01:00:00作为结束时间
+		LocalDateTime endTime = yearMonth.plusMonths(1).atDay(1).atTime(1, 0, 0);
 
 		Date startDate = DateUtils.convertToDate(startTime);
 		Date endDate = DateUtils.convertToDate(endTime);
-
+		log.info("{}{}", "钢坯交班历史记录——————开始时间:", DateUtils.date2Str(startDate, DateUtils.datetimeFormat.get()));
+		log.info("{}{}", "钢坯交班历史记录——————结束时间:", DateUtils.date2Str(endDate, DateUtils.datetimeFormat.get()));
 		// 根据铸机号、开始时间、结束时间查询对应的交班信息
 		LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
 		queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)

+ 11 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/controller/StackingAndLoadingVehiclesController.java

@@ -17,6 +17,7 @@ import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.UpdateBatchPar
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.service.IStackingAndLoadingVehiclesService;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.ClipLayerVo;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.LoadingParams;
+import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.StackLocationChangeVO;
 import org.jeecg.modules.billet.storageBill.entity.StorageBill;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -219,4 +220,14 @@ public class StackingAndLoadingVehiclesController extends JeecgController<Stacki
 		 List<ClipLayerVo> clipLayerVos = stackingAndLoadingVehiclesService.clipNumAndLayerNum();
 		 return Result.OK(clipLayerVos);
 	 }
+
+
+	 @ApiOperation(value="起垛位置变更", notes="起垛位置变更")
+	 @PostMapping(value = "/stackLocationChange")
+	 public Result<?> stackLocationChangeHandle(@RequestBody StackLocationChangeVO stackLocationChangeVO){
+
+		 String result = stackingAndLoadingVehiclesService.stackLocationChangeHandle(stackLocationChangeVO);
+
+		 return Result.OK(result);
+	 }
 }

+ 3 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/IStackingAndLoadingVehiclesService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingAndLoadingVehicles;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.ClipLayerVo;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.LoadingParams;
+import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.StackLocationChangeVO;
 
 import java.util.List;
 
@@ -29,4 +30,6 @@ public interface IStackingAndLoadingVehiclesService extends IService<StackingAnd
     List<ClipLayerVo> clipNumAndLayerNum();
 
     List<StackingAndLoadingVehicles> selectByBilletNos(String billetNos);
+
+    String stackLocationChangeHandle(StackLocationChangeVO stackLocationChangeVO);
 }

+ 46 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/service/impl/StackingAndLoadingVehiclesServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.actualControl.billetActual.billetActual.entity.BilletBasicInfo;
@@ -45,6 +46,7 @@ import org.jeecg.modules.billet.stackingAndLoadingVehicles.service.IStackingDown
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.service.IStackingUpLogService;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.ClipLayerVo;
 import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.LoadingParams;
+import org.jeecg.modules.billet.stackingAndLoadingVehicles.vo.StackLocationChangeVO;
 import org.jeecg.modules.billet.storageBill.entity.StorageBill;
 import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
 import org.jeecg.modules.billet.storageCarLog.entity.StorageCarLog;
@@ -1044,6 +1046,50 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         return stackingAndLoadingVehiclesMapper.selectByBilletNos(billetNos);
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String stackLocationChangeHandle(StackLocationChangeVO stackLocationChangeVO) {
+        StackingAndLoadingVehicles stackingAndLoadingVehicles = baseMapper.selectById(stackLocationChangeVO.getStackId());
+        if (stackingAndLoadingVehicles == null) {
+            return "原垛位容器位置,未找到对应数据";
+        }
+        if (oConvertUtils.isEmpty(stackingAndLoadingVehicles.getBilletNos())) {
+            return "该位置钢坯信息不存在,操作失败!";
+        }
+
+        StackingAndLoadingVehicles newStackingAndLoadingVehicles = baseMapper.selectById(stackLocationChangeVO.getLocationChangeId());
+        if (newStackingAndLoadingVehicles == null) {
+            return "变更后的位置,未找到对应数据";
+        }
+        if (oConvertUtils.isNotEmpty(newStackingAndLoadingVehicles.getBilletNos())) {
+            return "垛位容器位置被占用,操作失败!";
+        }
+
+        try {
+            // 原位置清空
+            List<StackingAndLoadingVehicles> stackingAndLoadingVehiclesList = new ArrayList<>();
+            stackingAndLoadingVehiclesList.add(stackingAndLoadingVehicles);
+            batchUpdateStackingAndLoadingVehicles(stackingAndLoadingVehiclesList);
+
+            // 填充新位置
+            newStackingAndLoadingVehicles.setCcmNo(stackingAndLoadingVehicles.getCcmNo());
+            newStackingAndLoadingVehicles.setHeatNo(stackingAndLoadingVehicles.getHeatNo());
+            newStackingAndLoadingVehicles.setBilletNos(stackingAndLoadingVehicles.getBilletNos());
+            newStackingAndLoadingVehicles.setShiftGroup(stackingAndLoadingVehicles.getShiftGroup());
+            newStackingAndLoadingVehicles.setShift(stackingAndLoadingVehicles.getShift());
+            newStackingAndLoadingVehicles.setSize(stackingAndLoadingVehicles.getSize());
+            newStackingAndLoadingVehicles.setSpec(stackingAndLoadingVehicles.getSpec());
+            newStackingAndLoadingVehicles.setSteel(stackingAndLoadingVehicles.getSteel());
+            newStackingAndLoadingVehicles.setCreateDate(new Date());
+            log.info("{}{}", ">>>>>B端垛位位置变换,新容器位置:", JSON.toJSON(newStackingAndLoadingVehicles));
+            baseMapper.updateById(newStackingAndLoadingVehicles);
+            return "垛位容器位置变更成功!";
+        } catch (Exception e) {
+            log.error("垛位容器位置变更发生异常", e);
+            throw new RuntimeException("垛位容器位置变更失败,事务已回滚", e);
+        }
+    }
+
     /**
      *  初始化堆垛公共容器
      * @param stackingAndLoadingVehiclesList

+ 17 - 0
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/stackingAndLoadingVehicles/vo/StackLocationChangeVO.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.billet.stackingAndLoadingVehicles.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+@Data
+public class StackLocationChangeVO {
+
+    @Excel(name = "垛位公共容器ID", width = 15)
+    @ApiModelProperty(value = "垛位公共容器ID", required = true)
+    private String stackId;
+
+    @Excel(name = "变换位置后的公共容器ID", width = 15)
+    @ApiModelProperty(value = "变换位置后的公共容器ID", required = true)
+    private String locationChangeId;
+}