|
@@ -152,6 +152,50 @@ public class StorageBillPrintServiceImpl extends ServiceImpl<StorageBillPrintMap
|
|
|
|
|
|
// 保存或更新
|
|
|
this.saveOrUpdate(storageBillPrint);
|
|
|
+
|
|
|
+ // 查询当前 StorageBill 实体
|
|
|
+ StorageBill storageBill = storageBillMapper.selectById(addDTO.getStorageBillId());
|
|
|
+
|
|
|
+ if (storageBill != null) {
|
|
|
+ LambdaUpdateWrapper<StorageBill> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.eq(StorageBill::getId, addDTO.getStorageBillId());
|
|
|
+
|
|
|
+ boolean needUpdate = false;
|
|
|
+
|
|
|
+ // 仅当数据库中的 destination 为 null 且 addDTO 中有值时更新
|
|
|
+ if (StringUtils.isBlank(storageBill.getDestination()) && StringUtils.isNotBlank(addDTO.getDestination())) {
|
|
|
+ updateWrapper.set(StorageBill::getDestination, addDTO.getDestination());
|
|
|
+ BilletHotsendTypeConfig byParam = billetHotsendTypeConfigService.getByParam(addDTO);
|
|
|
+ if(oConvertUtils.isNotEmpty(byParam)){
|
|
|
+ updateWrapper.set(StorageBill::getTypeConfigId, byParam.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ needUpdate = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // size 无需判断是否为 null,直接更新为格式化后的值
|
|
|
+ if (StringUtils.isNotBlank(addDTO.getSize())) {
|
|
|
+ String processedSize = Arrays.stream(addDTO.getSize().split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .map(s -> {
|
|
|
+ try {
|
|
|
+ double val = Double.parseDouble(s);
|
|
|
+ double result = val < 20 ? val * 1000 : val;
|
|
|
+ return String.valueOf((int) result);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ return s;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .collect(Collectors.joining(","));
|
|
|
+ updateWrapper.set(StorageBill::getSize, processedSize);
|
|
|
+ needUpdate = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (needUpdate) {
|
|
|
+ storageBillMapper.update(null, updateWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1773,8 +1817,6 @@ public class StorageBillPrintServiceImpl extends ServiceImpl<StorageBillPrintMap
|
|
|
|
|
|
int fetchCount = delta / 4;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// 获取传递单
|
|
|
BilletHotsend billetHotsend = billetHotsendBaseService.getOne(
|
|
|
new LambdaQueryWrapper<BilletHotsend>()
|
|
@@ -1842,10 +1884,9 @@ public class StorageBillPrintServiceImpl extends ServiceImpl<StorageBillPrintMap
|
|
|
billetOriginalProductRecordService.updateById(originalRecord);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
- log.error("解析或更新 stack_length 出错", e);
|
|
|
+ log.error("解析 stack_length 出错", e);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
result.put("success", "堆垛保存完成");
|
|
@@ -1896,19 +1937,4 @@ public class StorageBillPrintServiceImpl extends ServiceImpl<StorageBillPrintMap
|
|
|
return stackingAndLoadingVehiclesList.stream().collect(Collectors.groupingBy(stackingAndLoadingVehicles -> stackingAndLoadingVehicles.getHeatNo() + "," + stackingAndLoadingVehicles.getShiftGroup() + "," + stackingAndLoadingVehicles.getShift()));
|
|
|
}
|
|
|
|
|
|
- public static Integer safeToInteger(String str) {
|
|
|
- if (StringUtils.isBlank(str)) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- try {
|
|
|
- return Integer.parseInt(str);
|
|
|
- } catch (NumberFormatException e) {
|
|
|
- try {
|
|
|
- // 尝试转成小数再取整
|
|
|
- return new BigDecimal(str).intValue();
|
|
|
- } catch (Exception ex) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|