|
|
@ -16,6 +16,8 @@ import com.gaotao.modules.warehouse.entity.PalletData; |
|
|
import com.gaotao.modules.warehouse.entity.dto.PalletQueryDto; |
|
|
import com.gaotao.modules.warehouse.entity.dto.PalletQueryDto; |
|
|
import com.gaotao.modules.warehouse.entity.vo.PalletVo; |
|
|
import com.gaotao.modules.warehouse.entity.vo.PalletVo; |
|
|
import com.gaotao.modules.warehouse.service.PalletService; |
|
|
import com.gaotao.modules.warehouse.service.PalletService; |
|
|
|
|
|
import com.gaotao.modules.system.entity.SensitiveFieldChangeLog; // 新增 - rqrq |
|
|
|
|
|
import com.gaotao.modules.system.service.SensitiveFieldChangeLogService; // 新增 - rqrq |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -38,6 +40,8 @@ public class PalletServiceImpl extends ServiceImpl<PalletMapper, Pallet> impleme |
|
|
private TransNoControlService transNoControlService; |
|
|
private TransNoControlService transNoControlService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WcsIntegrationMapper wcsIntegrationMapper; |
|
|
private WcsIntegrationMapper wcsIntegrationMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SensitiveFieldChangeLogService sensitiveFieldChangeLogService; // 新增 - rqrq |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageUtils queryPage(PalletData queryDto) { |
|
|
public PageUtils queryPage(PalletData queryDto) { |
|
|
@ -121,6 +125,9 @@ public class PalletServiceImpl extends ServiceImpl<PalletMapper, Pallet> impleme |
|
|
public boolean updatePallet(PalletData palletData) { |
|
|
public boolean updatePallet(PalletData palletData) { |
|
|
System.out.println("开始修改托盘 - rqrq,托盘ID:" + palletData.getPalletId()); |
|
|
System.out.println("开始修改托盘 - rqrq,托盘ID:" + palletData.getPalletId()); |
|
|
|
|
|
|
|
|
|
|
|
// 查询修改前的托盘信息 - rqrq |
|
|
|
|
|
Pallet oldPallet = this.getById(palletData.getId()); |
|
|
|
|
|
|
|
|
// 检查托盘ID是否已被其他记录使用 - rqrq |
|
|
// 检查托盘ID是否已被其他记录使用 - rqrq |
|
|
if (checkPalletIdExists(palletData.getPalletId(), palletData.getId())) { |
|
|
if (checkPalletIdExists(palletData.getPalletId(), palletData.getId())) { |
|
|
throw new RuntimeException("托盘ID [" + palletData.getPalletId() + "] 已被其他记录使用"); |
|
|
throw new RuntimeException("托盘ID [" + palletData.getPalletId() + "] 已被其他记录使用"); |
|
|
@ -139,6 +146,47 @@ public class PalletServiceImpl extends ServiceImpl<PalletMapper, Pallet> impleme |
|
|
palletData.setUpdatedTime(new Date()); |
|
|
palletData.setUpdatedTime(new Date()); |
|
|
|
|
|
|
|
|
boolean result = this.updateById(palletData); |
|
|
boolean result = this.updateById(palletData); |
|
|
|
|
|
|
|
|
|
|
|
// 记录location_code变化 - rqrq |
|
|
|
|
|
if (oldPallet != null) { |
|
|
|
|
|
String oldLocationCode = oldPallet.getLocationCode(); |
|
|
|
|
|
String newLocationCode = palletData.getLocationCode(); |
|
|
|
|
|
|
|
|
|
|
|
// 判断location_code是否发生变化 - rqrq |
|
|
|
|
|
boolean locationChanged = false; |
|
|
|
|
|
if (oldLocationCode == null && newLocationCode != null) { |
|
|
|
|
|
locationChanged = true; |
|
|
|
|
|
} else if (oldLocationCode != null && !oldLocationCode.equals(newLocationCode)) { |
|
|
|
|
|
locationChanged = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (locationChanged) { |
|
|
|
|
|
System.out.println("检测到location_code变化 - rqrq,原值:" + oldLocationCode + ",新值:" + newLocationCode); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
SensitiveFieldChangeLog log = new SensitiveFieldChangeLog(); |
|
|
|
|
|
log.setSite(palletData.getSite()); |
|
|
|
|
|
log.setFunctionPage("托盘管理"); |
|
|
|
|
|
log.setOperationName("修改托盘"); |
|
|
|
|
|
log.setOperationObject("托盘" + palletData.getPalletId()); |
|
|
|
|
|
log.setTableName("pallet"); |
|
|
|
|
|
log.setFieldName("location_code"); |
|
|
|
|
|
log.setOldValue(oldLocationCode != null ? oldLocationCode : ""); |
|
|
|
|
|
log.setNewValue(newLocationCode != null ? newLocationCode : ""); |
|
|
|
|
|
log.setOperator("SYSTEM"); // 可根据实际情况从上下文获取 - rqrq |
|
|
|
|
|
log.setOperationTime(new Date()); |
|
|
|
|
|
log.setRecordId(palletData.getId()); |
|
|
|
|
|
log.setOperationType("UPDATE"); |
|
|
|
|
|
|
|
|
|
|
|
sensitiveFieldChangeLogService.recordFieldChange(log); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
System.out.println("记录location_code变化失败 - rqrq:" + e.getMessage()); |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
// 不影响主流程,只记录异常 - rqrq |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
System.out.println("托盘修改完成 - rqrq"); |
|
|
System.out.println("托盘修改完成 - rqrq"); |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|