|
@@ -121,20 +121,58 @@ public class BilletOriginalProductRecordController extends JeecgController<Bille
|
|
|
@PostMapping(value = "/add")
|
|
|
public Result<String> add(@RequestBody BilletOriginalProductRecord billetOriginalProductRecord) {
|
|
|
|
|
|
- if (billetOriginalProductRecord.getAmount() != null && billetOriginalProductRecord.getAmount() > 0){
|
|
|
- Integer newTotal = billetOriginalProductRecord.getAmount();
|
|
|
- // 执行随机分配
|
|
|
- Map<String, Integer> strandAllocation = allocateRandomly(newTotal, 8);
|
|
|
- // 将分配结果设置到对象中
|
|
|
- billetOriginalProductRecord.setOneStrandSum(strandAllocation.get("oneStrandSum"));
|
|
|
- billetOriginalProductRecord.setTwoStrandSum(strandAllocation.get("twoStrandSum"));
|
|
|
- billetOriginalProductRecord.setThreeStrandSum(strandAllocation.get("threeStrandSum"));
|
|
|
- billetOriginalProductRecord.setFourStrandSum(strandAllocation.get("fourStrandSum"));
|
|
|
- billetOriginalProductRecord.setFiveStrandSum(strandAllocation.get("fiveStrandSum"));
|
|
|
- billetOriginalProductRecord.setSixStrandSum(strandAllocation.get("sixStrandSum"));
|
|
|
- billetOriginalProductRecord.setSevenStrandSum(strandAllocation.get("sevenStrandSum"));
|
|
|
- billetOriginalProductRecord.setEightStrandSum(strandAllocation.get("eightStrandSum"));
|
|
|
+ String classShiftGroup = String.format("class:shift:group:%s", billetOriginalProductRecord.getCcmNo()); // 班组
|
|
|
+ String classShift = String.format("class:shift:%s", billetOriginalProductRecord.getCcmNo()); // 班别
|
|
|
+ String brandNum = String.format("billet:basic:info:brand:num:%s", billetOriginalProductRecord.getCcmNo()); // 牌号
|
|
|
+ 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)) : "";
|
|
|
+ String brandNumStr = !oConvertUtils.getString(redisTemplate.opsForValue().get(brandNum)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(brandNum)) : "";
|
|
|
+ // 通过铸机号、炉号、班组、班别 查询钢坯炉次传递单
|
|
|
+ LambdaQueryWrapper<BilletHotsend> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(BilletHotsend::getHeatNo, billetOriginalProductRecord.getHeatNo())
|
|
|
+ .eq(BilletHotsend::getShiftGroup, shiftGroup)
|
|
|
+ .eq(BilletHotsend::getShift, shift)
|
|
|
+ .eq(BilletHotsend::getCcmNo, billetOriginalProductRecord.getCcmNo()).last("limit 1");
|
|
|
+ BilletHotsend billetHotsendInfo = billetHotsendBaseService.getOne(lambdaQueryWrapper);
|
|
|
+ if(billetHotsendInfo == null){
|
|
|
+
|
|
|
+ // 同步新增炉次传递单
|
|
|
+ BilletHotsend billetHotsend = new BilletHotsend();
|
|
|
+ billetHotsend.setId(String.valueOf(IdWorker.getId()));
|
|
|
+ billetHotsend.setCcmNo(billetOriginalProductRecord.getCcmNo());
|
|
|
+ billetHotsend.setHeatNo(billetOriginalProductRecord.getHeatNo());
|
|
|
+ billetHotsend.setShiftGroup(shiftGroup);
|
|
|
+ billetHotsend.setShift(shift);
|
|
|
+ billetHotsend.setBrandNum(brandNumStr);
|
|
|
+ billetHotsend.setAmountTotal(0);
|
|
|
+ billetHotsend.setBlankOutput(0.0);
|
|
|
+ billetHotsend.setDecideWeight(0.0);
|
|
|
+ billetHotsend.setWasteBlankOutput(0.0);
|
|
|
+ billetHotsend.setRollcluboneNum(0);
|
|
|
+ billetHotsend.setRollclubtwoNum(0);
|
|
|
+ billetHotsend.setRollclubthreeNum(0);
|
|
|
+ billetHotsend.setRollheightNum(0);
|
|
|
+ billetHotsend.setRolloutshippNum(0);
|
|
|
+ billetHotsend.setRollDeputyCrossNum(0);
|
|
|
+ billetHotsend.setStackNum(0);
|
|
|
+ billetHotsend.setWasteNum(0);
|
|
|
+ billetHotsend.setIsUpd(false);
|
|
|
+ billetHotsend.setCreateTime(new Date());
|
|
|
+ billetHotsendBaseService.save(billetHotsend);
|
|
|
}
|
|
|
+ billetOriginalProductRecord.setShift(shift);
|
|
|
+ billetOriginalProductRecord.setShiftGroup(shiftGroup);
|
|
|
+ billetOriginalProductRecord.setGrade(brandNumStr);
|
|
|
+ billetOriginalProductRecord.setIsEditCharge("1");
|
|
|
+ billetOriginalProductRecord.setLength(null);
|
|
|
+ billetOriginalProductRecord.setRollClubOneDetails(null);
|
|
|
+ billetOriginalProductRecord.setRollClubTwoDetails(null);
|
|
|
+ billetOriginalProductRecord.setRollClubThreeDetails(null);
|
|
|
+ billetOriginalProductRecord.setLengthDetails(null);
|
|
|
+ billetOriginalProductRecord.setHotChargeLength(null);
|
|
|
+ billetOriginalProductRecord.setStackLength(null);
|
|
|
+ billetOriginalProductRecord.setRemark(null);
|
|
|
+ billetOriginalProductRecord.setConfirmBy(null);
|
|
|
billetOriginalProductRecordService.save(billetOriginalProductRecord);
|
|
|
return Result.OK("添加成功!");
|
|
|
}
|