Browse Source

总序号和发车

qiangxuan 6 months ago
parent
commit
c1e7d9faa9

+ 8 - 2
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/billetHotsend/service/impl/BilletHotsendBaseServiceImpl.java

@@ -626,7 +626,10 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 			x.setUpdateTime(new Date());
 		});
 		billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
-
+		if (oConvertUtils.isEmpty(billetHotsendDetailsVo.getStorageBill()) || billetHotsendDetailsVo.getStorageBill() == null){
+			result.put("success", "新增高线成功!");
+			return result;
+		}
 		// 更新装运单 车次总序号、本车车次
 		LambdaQueryWrapper<StorageBill> queryWrapperSB = new LambdaQueryWrapper<>();
 		queryWrapperSB.eq(StorageBill::getId, billetHotsendDetailsVo.getStorageBill().getId());
@@ -636,7 +639,6 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		}else {
 			storageBill.setAmountTotal(storageBillInfo.getAmountTotal() + rollClubCommonList.size());
 		}
-		// 更新装运单 车次总序号、本车车次
 		storageBill.setTypeConfigId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId()); // 钢坯配置类型ID
 		storageBill.setDestination(billetHotsendDetailsVo.getBelongTypeName());// 目的地
 		storageBillService.updateById(storageBill);
@@ -999,6 +1001,9 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		billetBasicInfoService.saveOrUpdateBatch(billetBasicInfoList);
 
 		// 更新装运单 车次总序号、本车车次
+		if (oConvertUtils.isEmpty(billetHotsendDetailsVo.getStorageBill()) || billetHotsendDetailsVo.getStorageBill() == null){
+			return;
+		}
 		LambdaQueryWrapper<StorageBill> queryWrapperSB = new LambdaQueryWrapper<>();
 		queryWrapperSB.eq(StorageBill::getId, billetHotsendDetailsVo.getStorageBill().getId());
 		StorageBill storageBillInfo = storageBillService.getOne(queryWrapperSB);
@@ -1009,6 +1014,7 @@ public class BilletHotsendBaseServiceImpl extends ServiceImpl<BilletHotsendBaseM
 		}
 		storageBill.setTypeConfigId(billetHotsendDetailsVo.getBilletHotsendTypeConfigId()); // 钢坯配置类型ID
 		storageBill.setDestination(billetHotsendDetailsVo.getBelongTypeName());// 目的地
+		storageBill.setCarAllNum(storageBillService.list().size() + 1);
 		storageBill.setOutTime(new Date());
 		storageBillService.updateById(storageBill);
 		// 生成储运单

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

@@ -679,6 +679,7 @@ public class StackingAndLoadingVehiclesServiceImpl extends ServiceImpl<StackingA
         storageBill.setDestination(loadingParams.getStorageBill().getDestination());// 目的地
         storageBill.setAmountTotal(storageBill.getAmountTotal() + stackingAndLoadingVehiclesList.size() * 4);
         storageBill.setOutTime(new Date());
+        storageBill.setCarAllNum(storageBillService.list().size() + 1);
         storageBillService.updateById(storageBill);
         // 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
         StorageCarLog storageCarLog = new StorageCarLog();

+ 27 - 3
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/billet/storageBill/controller/StorageBillController.java

@@ -19,6 +19,9 @@ import org.jeecg.modules.billet.storageBill.entity.BilletHotsendDetails;
 import org.jeecg.modules.billet.storageBill.entity.StorageBill;
 import org.jeecg.modules.billet.storageBill.service.IStorageBillService;
 import org.jeecg.modules.billet.storageBill.service.ITripsManageService;
+import org.jeecg.modules.billet.storageCarLog.entity.StorageCarLog;
+import org.jeecg.modules.billet.storageCarLog.service.IStorageCarLogService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
@@ -54,6 +57,9 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 	@Autowired
 	public RedisTemplate redisTemplate;
 
+	@Autowired
+	private IStorageCarLogService storageCarLogService;
+
 	/**
 	 * 分页列表查询
 	 *
@@ -161,10 +167,28 @@ public class StorageBillController extends JeecgController<StorageBill, IStorage
 	@ApiOperation(value="钢坯装运单-发车", notes="钢坯装运单-发车")
 	@PostMapping(value = "/startCar")
 	public Result<String> startCar(@RequestBody StorageBill storageBill) {
-		storageBill.setCreateTime(new Date());
-		storageBillService.save(storageBill);
+
+		StorageBill isStorageBill = storageBillService.getById(storageBill);
+		if (oConvertUtils.isNotEmpty(isStorageBill.getOutTime()) && storageBill.getLicensePlate().equals(isStorageBill.getLicensePlate())) {
+			return Result.OK("该车已发车,请勿重复发车!");
+		}
+		storageBill.setCarNum(isStorageBill.getCarNum() + 1);
+		storageBill.setCarAllNum(storageBillService.list().size() + 1);
+		storageBill.setUpdateTime(new Date());
+		storageBillService.updateById(storageBill);
+		// 7 发车后,新增钢坯堆垛储运信息,生成储运单 storage_car_log
+		StorageCarLog storageCarLog = new StorageCarLog();
+		BeanUtils.copyProperties(storageBill, storageCarLog);
+		storageCarLog.setCarNm(storageBill.getLicensePlate());// 车牌号
+//		storageCarLog.setTypeConfigId(billetHotsendTypeConfig.getId()); // 钢坯配置类型ID
+//		storageCarLog.setHeatNo(billetHotsend.getHeatNo());
+//		storageCarLog.setFixedWeight();// 定重
+//      storageCarLog.setSize();// 定尺
+		// 查询上垛记录,计算出总支数
+		storageCarLog.setAmount(storageBill.getAmountTotal());// 支数
+		storageCarLogService.save(storageCarLog);
 		operateLogService.add(storageBill,null,StorageBill.class);
-		return Result.OK("添加成功!");
+		return Result.OK("钢坯装运单-发车成功!");
 	}
 	
 	/**