|
@@ -32,16 +32,19 @@ import org.jeecg.modules.billet.billetHotsend.entity.BilletHotsend;
|
|
import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
|
|
import org.jeecg.modules.billet.billetHotsend.service.IBilletHotsendBaseService;
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.entity.BilletHotsendChangeShift;
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
|
|
import org.jeecg.modules.billet.billetHotsendChangeShift.service.IBilletHotsendChangeShiftService;
|
|
|
|
+import org.jeecg.modules.billet.billetHotsendConfig.entity.BilletHotsendTypeConfig;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.dto.LengthCountQueryDTO;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.dto.LengthCountQueryDTO;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.entity.BilletOriginalProductRecord;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.entity.BilletOriginalProductRecord;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.service.IBilletOriginalProductRecordService;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.service.IBilletOriginalProductRecordService;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.vo.*;
|
|
import org.jeecg.modules.billet.billetOriginalProductRecord.vo.*;
|
|
|
|
+import org.jeecg.modules.billet.shiftConfiguration.entity.ShiftConfiguration;
|
|
|
|
+import org.jeecg.modules.billet.shiftConfiguration.service.IShiftConfigurationService;
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingAndLoadingVehicles;
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.entity.StackingAndLoadingVehicles;
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.mapper.StackingAndLoadingVehiclesMapper;
|
|
import org.jeecg.modules.billet.stackingAndLoadingVehicles.mapper.StackingAndLoadingVehiclesMapper;
|
|
-import org.jeecg.modules.billet.storageBill.entity.HeatsActualsInfo;
|
|
|
|
-import org.jeecg.modules.billet.storageBill.entity.StorageBillPrint;
|
|
|
|
|
|
+import org.jeecg.modules.billet.storageBill.entity.*;
|
|
import org.jeecg.modules.billet.storageBill.service.IStorageBillPrintService;
|
|
import org.jeecg.modules.billet.storageBill.service.IStorageBillPrintService;
|
|
|
|
+import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
|
|
import org.jeecg.modules.carUnit.service.ISysDictService;
|
|
import org.jeecg.modules.carUnit.service.ISysDictService;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -88,6 +91,12 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private StackingAndLoadingVehiclesMapper stackingAndLoadingVehiclesMapper;
|
|
private StackingAndLoadingVehiclesMapper stackingAndLoadingVehiclesMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IStorageBillService storageBillService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IShiftConfigurationService shiftConfigurationService;
|
|
/**
|
|
/**
|
|
* 分页列表查询
|
|
* 分页列表查询
|
|
*
|
|
*
|
|
@@ -403,6 +412,88 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
|
|
|
return Result.OK("确认成功!");
|
|
return Result.OK("确认成功!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 推钢室快速创建装运单
|
|
|
|
+ *
|
|
|
|
+ * @param
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @AutoLog(value = "推钢室快速创建装运单")
|
|
|
|
+ @ApiOperation(value="推钢室快速创建装运单", notes="推钢室快速创建装运单")
|
|
|
|
+ @RequestMapping(value = "/addStorageBill", method = {RequestMethod.PUT})
|
|
|
|
+ public Result<String> addStorageBillHandle(@RequestParam(name="ccmNo",required = false) String ccmNo,
|
|
|
|
+ @RequestParam(name="positionNum",required = true) Integer positionNum,
|
|
|
|
+ @RequestParam(name="licensePlate",required = true) String licensePlate) {
|
|
|
|
+ StorageBill storageBill = new StorageBill();
|
|
|
|
+ storageBill.setId(String.valueOf(IdWorker.getId()));
|
|
|
|
+ storageBill.setPositionNum(positionNum);
|
|
|
|
+ storageBill.setLicensePlate(licensePlate);
|
|
|
|
+ if (positionNum == 1){
|
|
|
|
+ storageBill.setCcmNo("5");
|
|
|
|
+ }else if (positionNum == 2){
|
|
|
|
+ storageBill.setCcmNo(ccmNo);
|
|
|
|
+ }else if (positionNum == 3 || positionNum == 4){
|
|
|
|
+ storageBill.setCcmNo("6");
|
|
|
|
+ }
|
|
|
|
+ // 从 Redis 获取班次信息
|
|
|
|
+ String shiftGroup = getShiftInfo(storageBill.getCcmNo(), "class:shift:group:%s");
|
|
|
|
+ String shift = getShiftInfo(storageBill.getCcmNo(), "class:shift:%s");
|
|
|
|
+ // 判断车牌号是否存在未发车的装运单信息
|
|
|
|
+ LambdaQueryWrapper<StorageBill> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(StorageBill::getLicensePlate, licensePlate)
|
|
|
|
+ .eq(StorageBill::getShiftGroup, shiftGroup)
|
|
|
|
+ .eq(StorageBill::getShift, shift)
|
|
|
|
+ .isNull(StorageBill::getOutTime);
|
|
|
|
+ StorageBill isStorageBill = storageBillService.getOne(queryWrapper);
|
|
|
|
+ if (oConvertUtils.isNotEmpty(isStorageBill)) {
|
|
|
|
+ log.info("推钢室查询到存在未发车车辆,车牌号为:{},新增钢坯装运单失败!", storageBill.getLicensePlate());
|
|
|
|
+ return Result.error("该车存在未发车信息,操作失败!");
|
|
|
|
+ }
|
|
|
|
+ // 判断车位是否存在未发车车辆(2025/3.3,半自动化逻辑,等自动化发车车位发车完善后,在添加此段逻辑)
|
|
|
|
+ List<StorageBill> storageBillList = storageBillService.list(new LambdaQueryWrapper<StorageBill>()
|
|
|
|
+ .eq(StorageBill::getPositionNum, storageBill.getPositionNum())
|
|
|
|
+ .isNull(StorageBill::getOutTime));
|
|
|
|
+ if (oConvertUtils.listIsNotEmpty(storageBillList)){
|
|
|
|
+ log.info("{}{}", "推钢室该车位存在未发车信息,新增钢坯装运单失败!", JSON.toJSON(storageBillList));
|
|
|
|
+ return Result.error("该车位存在未发车信息,操作失败!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 根据铸机号、班组、班别,创建时间倒序 只返回一条,查询储运配置信息
|
|
|
|
+ LambdaQueryWrapper<ShiftConfiguration> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper1.eq(ShiftConfiguration::getCcmNo, ccmNo)
|
|
|
|
+ .eq(ShiftConfiguration::getShiftGroup, shiftGroup)
|
|
|
|
+ .eq(ShiftConfiguration::getShift, shift)
|
|
|
|
+ .orderByDesc(ShiftConfiguration::getCreateTime)
|
|
|
|
+ .last("limit 1");
|
|
|
|
+ ShiftConfiguration shiftConfiguration = shiftConfigurationService.getOne(queryWrapper1);
|
|
|
|
+ if (shiftConfiguration != null && oConvertUtils.isNotEmpty(shiftConfiguration.getDestination())){
|
|
|
|
+ storageBill.setBrandNum(shiftConfiguration.getSteelGrade());//牌号
|
|
|
|
+ storageBill.setNewOldPlatform(shiftConfiguration.getNewOldPlatform());
|
|
|
|
+ storageBill.setTypeConfigId("1024");
|
|
|
|
+ }else {
|
|
|
|
+ // C端自动化创建装运单时,默认未知目的地
|
|
|
|
+ storageBill.setTypeConfigId("1024");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ storageBill.setArrivalTime(new Date());// 到达时间
|
|
|
|
+ // 更新交班记录 通过铸机号、班组、班别去查询交班记录并初始化 出车号
|
|
|
|
+ updateBilletHotsendChangeShift(storageBill.getCcmNo(), shiftGroup, shift);
|
|
|
|
+
|
|
|
|
+ storageBill.setAmountTotal(0);
|
|
|
|
+ storageBill.setPanelAmountTotal(0);
|
|
|
|
+ storageBill.setShiftGroup(shiftGroup);
|
|
|
|
+ storageBill.setShift(shift);
|
|
|
|
+ String uniqueCode = generateUniqueCode(new Date(), storageBill.getCcmNo(), shift, shiftGroup);
|
|
|
|
+ storageBill.setUniqueCode(uniqueCode);
|
|
|
|
+ storageBill.setLicensePlateStatus(0);
|
|
|
|
+ storageBill.setCarNum(0); // 本车车次
|
|
|
|
+ storageBill.setCarAllNum(0); // 总车车次
|
|
|
|
+ storageBill.setBtype("0");
|
|
|
|
+ storageBillService.save(storageBill);
|
|
|
|
+
|
|
|
|
+ return Result.OK("操作成功!");
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 通过id删除
|
|
* 通过id删除
|
|
@@ -2213,4 +2304,58 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
return String.join(",", billetNosList);
|
|
return String.join(",", billetNosList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 生成综合唯一编码
|
|
|
|
+ * @param date
|
|
|
|
+ * @param ccmNo
|
|
|
|
+ * @param shift
|
|
|
|
+ * @param shiftGroup
|
|
|
|
+ * @return uniqueCode
|
|
|
|
+ */
|
|
|
|
+ public String generateUniqueCode(Date date, String ccmNo, String shift, String shiftGroup) {
|
|
|
|
+ // 将日期转换为指定格式的字符串
|
|
|
|
+ String dateStr = DateUtils.date2Str(date, DateUtils.yyyymmddhhmmss.get());
|
|
|
|
+ // 将 shift 转换为 ShiftEnum 的名称
|
|
|
|
+ String shiftName = ShiftEnum.fromCode(shift).name();
|
|
|
|
+ // 将 shiftGroup 转换为 ShiftGroupEnum 的名称
|
|
|
|
+ String shiftGroupName = ShiftGroupEnum.fromCode(shiftGroup).name();
|
|
|
|
+ // 组合生成唯一代码
|
|
|
|
+ String uniqueCode = dateStr + "-" + ccmNo + "#" + shiftName + "-" + shiftGroupName;
|
|
|
|
+ return uniqueCode;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 从Redis中获取班组班别
|
|
|
|
+ * @param ccmNo
|
|
|
|
+ * @param keyFormat
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String getShiftInfo(String ccmNo, String keyFormat) {
|
|
|
|
+ String key = String.format(keyFormat, ccmNo);
|
|
|
|
+ return oConvertUtils.getString(redisTemplate.opsForValue().get(key));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新交班记录
|
|
|
|
+ * @param ccmNo
|
|
|
|
+ * @param shiftGroup
|
|
|
|
+ * @param shift
|
|
|
|
+ */
|
|
|
|
+ private void updateBilletHotsendChangeShift(String ccmNo, String shiftGroup, String shift) {
|
|
|
|
+ LambdaQueryWrapper<BilletHotsendChangeShift> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(BilletHotsendChangeShift::getCcmNo, ccmNo)
|
|
|
|
+ .eq(BilletHotsendChangeShift::getShiftGroup, shiftGroup)
|
|
|
|
+ .eq(BilletHotsendChangeShift::getShift, shift)
|
|
|
|
+ .isNull(BilletHotsendChangeShift::getChangeShiftTime)
|
|
|
|
+ .orderByDesc(BilletHotsendChangeShift::getCreateTime)
|
|
|
|
+ .last("limit 1");
|
|
|
|
+ BilletHotsendChangeShift billetHotsendChangeShift = billetHotsendChangeShiftService.getOne(queryWrapper);
|
|
|
|
+ if (oConvertUtils.isEmpty(billetHotsendChangeShift)) {
|
|
|
|
+ log.info("手动创建装运单交班记录不存在,车次数维护失败:{}", ccmNo+shiftGroup+shift);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ billetHotsendChangeShift.setOutCarNum(billetHotsendChangeShift.getOutCarNum() + 1);
|
|
|
|
+ billetHotsendChangeShiftService.updateById(billetHotsendChangeShift);
|
|
|
|
+ }
|
|
}
|
|
}
|