部件入库接口相关接口
This commit is contained in:
parent
03dd870202
commit
f49d221ac0
@ -58,9 +58,7 @@ public class EbikeComponentInventorycount implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 部件数量
|
* 部件数量
|
||||||
*/
|
*/
|
||||||
@Column(onInsertValue = "0")
|
private Long itemCount = 0L; // 使用包装类 Long,允许 NULL
|
||||||
private long itemCount;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单位
|
* 单位
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -35,9 +36,6 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private EbikeEcuEnterRecordsMapper ebikeEcuEnterRecordsMapper;
|
private EbikeEcuEnterRecordsMapper ebikeEcuEnterRecordsMapper;
|
||||||
@Resource
|
|
||||||
private EbikeComponentProductionMapper ebikeComponentProductionMapper;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private StaffFeignClient staffFeignClient;
|
private StaffFeignClient staffFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
@ -62,10 +60,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EbikeBatteryOutRecordsMapper ebikeBatteryOutRecordsMapper;
|
private EbikeBatteryOutRecordsMapper ebikeBatteryOutRecordsMapper;
|
||||||
|
|
||||||
public EbikeComponentServiceImpl(EbikeEcuEnterRecordsMapper ebikeEcuEnterRecordsMapper, EbikeComponentProductionMapper ebikeComponentProductionMapper) {
|
|
||||||
this.ebikeEcuEnterRecordsMapper = ebikeEcuEnterRecordsMapper;
|
|
||||||
this.ebikeComponentProductionMapper = ebikeComponentProductionMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 中控设备部件入库接口,暂存
|
* 中控设备部件入库接口,暂存
|
||||||
@ -84,20 +79,43 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
saveOrUpdateEnterRecord(ebikeComponentEnterRecords, params.getComponentEnterRecordId(), userId);
|
saveOrUpdateEnterRecord(ebikeComponentEnterRecords, params.getComponentEnterRecordId(), userId);
|
||||||
|
|
||||||
String componentEnterRecordId = ebikeComponentEnterRecords.getComponentEnterRecordId();
|
String componentEnterRecordId = ebikeComponentEnterRecords.getComponentEnterRecordId();
|
||||||
|
// 用于存储重复部件名称的集合
|
||||||
|
List<String> duplicatePartNames = new ArrayList<>();
|
||||||
if (params.getEbikeEcuEnterRecords() != null && !params.getEbikeEcuEnterRecords().isEmpty()) {
|
if (params.getEbikeEcuEnterRecords() != null && !params.getEbikeEcuEnterRecords().isEmpty()) {
|
||||||
|
// 遍历所有的EbikeEcuEnterRecords记录
|
||||||
|
for (EbikeEcuEnterRecords res : params.getEbikeEcuEnterRecords()) {
|
||||||
|
boolean isDuplicate = isDuplicateEntry(res.getEcuSn(),res.getEcuCode());
|
||||||
|
if (isDuplicate) {
|
||||||
|
// 如果是重复部件,则将部件名称添加到重复部件名称记录中
|
||||||
|
duplicatePartNames.add(res.getEcuSn()); // 假设 EcuSn 是部件名称
|
||||||
|
}
|
||||||
|
}
|
||||||
// 删除原有的ECU入库记录并保存新的记录
|
// 删除原有的ECU入库记录并保存新的记录
|
||||||
deleteAndInsertEcuEnterRecords(componentEnterRecordId, params.getEbikeEcuEnterRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
deleteAndInsertEcuEnterRecords(componentEnterRecordId, params.getEbikeEcuEnterRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
||||||
if (stockInType == 1) {
|
if (stockInType == 1) {
|
||||||
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeEcuEnterRecords().size(), 1);
|
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeEcuEnterRecords().size(), 1);
|
||||||
}
|
}
|
||||||
} else if (params.getEbikeBatteryEnterRecords() != null && !params.getEbikeBatteryEnterRecords().isEmpty()) {
|
} else if (params.getEbikeBatteryEnterRecords() != null && !params.getEbikeBatteryEnterRecords().isEmpty()) {
|
||||||
|
for (EbikeBatteryEnterRecords res : params.getEbikeBatteryEnterRecords()) {
|
||||||
|
boolean isDuplicate = isDuplicateEntry(res.getBatteryCode(),"");
|
||||||
|
if (isDuplicate) {
|
||||||
|
// 如果是重复部件,则将部件名称添加到重复部件名称记录中
|
||||||
|
duplicatePartNames.add(res.getBatteryCode()); // 假设 EcuSn 是部件名称
|
||||||
|
}
|
||||||
|
}
|
||||||
// 删除原有的电池入库记录并保存新的记录
|
// 删除原有的电池入库记录并保存新的记录
|
||||||
deleteAndInsertBatteryRecords(componentEnterRecordId, params.getEbikeBatteryEnterRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
deleteAndInsertBatteryRecords(componentEnterRecordId, params.getEbikeBatteryEnterRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
||||||
if (stockInType == 1) {
|
if (stockInType == 1) {
|
||||||
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeBatteryEnterRecords().size(), 1);
|
updateInventoryCount(ebikeComponentTypeInfo, orgId, params.getEbikeBatteryEnterRecords().size(), 1);
|
||||||
}
|
}
|
||||||
} else if (params.getEbikeHelmetEnterRecords() != null && !params.getEbikeHelmetEnterRecords().isEmpty()) {
|
} else if (params.getEbikeHelmetEnterRecords() != null && !params.getEbikeHelmetEnterRecords().isEmpty()) {
|
||||||
|
for (EbikeHelmetEnterRecords res : params.getEbikeHelmetEnterRecords()) {
|
||||||
|
boolean isDuplicate = isDuplicateEntry(res.getHelmetCode(),"");
|
||||||
|
if (isDuplicate) {
|
||||||
|
// 如果是重复部件,则将部件名称添加到重复部件名称记录中
|
||||||
|
duplicatePartNames.add(res.getHelmetCode()); // 假设 EcuSn 是部件名称
|
||||||
|
}
|
||||||
|
}
|
||||||
// 删除原有的头盔入库记录并保存新的记录
|
// 删除原有的头盔入库记录并保存新的记录
|
||||||
deleteAndInsertHelmetEnterRecords(componentEnterRecordId, params.getEbikeHelmetEnterRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
deleteAndInsertHelmetEnterRecords(componentEnterRecordId, params.getEbikeHelmetEnterRecords(), stockInType, ebikeComponentTypeInfo, userId, orgId);
|
||||||
if (stockInType == 1) {
|
if (stockInType == 1) {
|
||||||
@ -110,12 +128,16 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
updateInventoryCount(ebikeComponentTypeInfo, orgId, enterQuantity, 1);
|
updateInventoryCount(ebikeComponentTypeInfo, orgId, enterQuantity, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 如果有重复部件名称记录,则返回错误信息
|
||||||
|
if (!duplicatePartNames.isEmpty()) {
|
||||||
|
// 可以在错误信息中添加重复的部件名称
|
||||||
|
String duplicateParts = String.join(", ", duplicatePartNames);
|
||||||
|
return JsonResult.failed("以下部件已存在,不能重复入库: " + duplicateParts);
|
||||||
|
}
|
||||||
String componentOutRecordId = params.getComponentOutRecordId();
|
String componentOutRecordId = params.getComponentOutRecordId();
|
||||||
if(componentOutRecordId != null && !componentOutRecordId.isEmpty()){
|
if(componentOutRecordId != null && !componentOutRecordId.isEmpty() && stockInType == 1 ){
|
||||||
// 更新出库记录状态为 已归还
|
// 更新出库记录状态为 已归还
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneById(componentOutRecordId);
|
updateOutRecordStatus(componentOutRecordId);
|
||||||
ebikeComponentOutRecords.setState("2");
|
|
||||||
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
|
||||||
}
|
}
|
||||||
return JsonResult.success("", componentEnterRecordId);
|
return JsonResult.success("", componentEnterRecordId);
|
||||||
}
|
}
|
||||||
@ -127,7 +149,6 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
StaffFeign staffFeign = getStaffFeignInfo();
|
StaffFeign staffFeign = getStaffFeignInfo();
|
||||||
return staffFeign.getStaffId().toString();
|
return staffFeign.getStaffId().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
获取组织Id
|
获取组织Id
|
||||||
*/
|
*/
|
||||||
@ -185,7 +206,13 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
// 删除原有的ECU入库记录
|
// 删除原有的ECU入库记录
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_enter_record_id", componentEnterRecordId);
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
ebikeHelmetEnterRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
ebikeEcuEnterRecordsMapper.deleteByQuery(query);
|
ebikeEcuEnterRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
ebikeBatteryEnterRecordsMapper.deleteByQuery(query);
|
||||||
// 插入新的ECU入库记录
|
// 插入新的ECU入库记录
|
||||||
for (EbikeEcuEnterRecords record : enterRecords) {
|
for (EbikeEcuEnterRecords record : enterRecords) {
|
||||||
record.setComponentEnterRecordId(componentEnterRecordId);
|
record.setComponentEnterRecordId(componentEnterRecordId);
|
||||||
@ -201,6 +228,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_enter_record_id", componentEnterRecordId);
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
ebikeHelmetEnterRecordsMapper.deleteByQuery(query);
|
ebikeHelmetEnterRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
ebikeEcuEnterRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
ebikeBatteryEnterRecordsMapper.deleteByQuery(query);
|
||||||
// 插入新的头盔入库记录
|
// 插入新的头盔入库记录
|
||||||
for (EbikeHelmetEnterRecords record : ebikeHelmetEnterRecords) {
|
for (EbikeHelmetEnterRecords record : ebikeHelmetEnterRecords) {
|
||||||
record.setComponentEnterRecordId(componentEnterRecordId);
|
record.setComponentEnterRecordId(componentEnterRecordId);
|
||||||
@ -215,6 +248,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
// 删除原有的电池入库记录
|
// 删除原有的电池入库记录
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_enter_record_id", componentEnterRecordId);
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
ebikeHelmetEnterRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
ebikeEcuEnterRecordsMapper.deleteByQuery(query);
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
ebikeBatteryEnterRecordsMapper.deleteByQuery(query);
|
ebikeBatteryEnterRecordsMapper.deleteByQuery(query);
|
||||||
// 插入新的电池入库记录
|
// 插入新的电池入库记录
|
||||||
for (EbikeBatteryEnterRecords record : ebikeBatteryEnterRecords) {
|
for (EbikeBatteryEnterRecords record : ebikeBatteryEnterRecords) {
|
||||||
@ -238,9 +277,25 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentInventory.setLastUpdatedAt(LocalDateTime.now());
|
ebikeComponentInventory.setLastUpdatedAt(LocalDateTime.now());
|
||||||
ebikeComponentInventory.setLastUpdatedUser(userId);
|
ebikeComponentInventory.setLastUpdatedUser(userId);
|
||||||
ebikeComponentInventory.setState(state); // 1 已入库 //2 已出库
|
ebikeComponentInventory.setState(state); // 1 已入库 //2 已出库
|
||||||
|
// 查询是否已存在该记录
|
||||||
|
QueryWrapper query =new QueryWrapper();
|
||||||
|
query.eq("item_code",ItemCode);
|
||||||
|
query.eq("serial_number",SerialNumber);
|
||||||
|
EbikeComponentInventory existingInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
if (existingInventory != null) {
|
||||||
|
// 如果记录存在,则进行更新
|
||||||
|
existingInventory.setLastUpdatedAt(LocalDateTime.now());
|
||||||
|
existingInventory.setLastUpdatedUser(userId);
|
||||||
|
existingInventory.setState(state);
|
||||||
|
// 执行更新操作
|
||||||
|
ebikeComponentInventoryMapper.update(existingInventory);
|
||||||
|
} else {
|
||||||
|
// 如果记录不存在,则执行插入操作
|
||||||
ebikeComponentInventoryMapper.insert(ebikeComponentInventory);
|
ebikeComponentInventoryMapper.insert(ebikeComponentInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//入库记录更新数量 type 1 入库 2 出库
|
//入库记录更新数量 type 1 入库 2 出库
|
||||||
private void updateInventoryCount(EbikeComponentTypeInfo ebikeComponentTypeInfo, Long orgId, int size, Integer type) {
|
private void updateInventoryCount(EbikeComponentTypeInfo ebikeComponentTypeInfo, Long orgId, int size, Integer type) {
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
@ -254,7 +309,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentInventorycount.setBrand(ebikeComponentTypeInfo.getBrand());
|
ebikeComponentInventorycount.setBrand(ebikeComponentTypeInfo.getBrand());
|
||||||
ebikeComponentInventorycount.setUnit(ebikeComponentTypeInfo.getUnit());
|
ebikeComponentInventorycount.setUnit(ebikeComponentTypeInfo.getUnit());
|
||||||
ebikeComponentInventorycount.setPrice(ebikeComponentTypeInfo.getPrice());
|
ebikeComponentInventorycount.setPrice(ebikeComponentTypeInfo.getPrice());
|
||||||
ebikeComponentInventorycount.setItemCount(size);
|
ebikeComponentInventorycount.setItemCount(0L+size);
|
||||||
ebikeComponentInventorycountMapper.insert(ebikeComponentInventorycount);
|
ebikeComponentInventorycountMapper.insert(ebikeComponentInventorycount);
|
||||||
} else {
|
} else {
|
||||||
if (type == 1) {//入库
|
if (type == 1) {//入库
|
||||||
@ -320,67 +375,6 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 方法实现
|
|
||||||
private void updateBatteryDetails(String componentEnterRecordId, String componentType, Integer state) {
|
|
||||||
// 具体更新电池仓库明细状态和仓库总数量的逻辑
|
|
||||||
QueryWrapper query = new QueryWrapper();
|
|
||||||
query.eq("component_enter_record_id", componentEnterRecordId);
|
|
||||||
List<EbikeBatteryEnterRecords> ebikeBatteryEnterRecords = ebikeBatteryEnterRecordsMapper.selectListWithRelationsByQuery(query);
|
|
||||||
for (EbikeBatteryEnterRecords record : ebikeBatteryEnterRecords) {
|
|
||||||
query = new QueryWrapper();
|
|
||||||
query.eq("item_code", record.getBatteryCode());
|
|
||||||
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
|
||||||
ebikeComponentInventory.setState(state);
|
|
||||||
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
|
||||||
}
|
|
||||||
int size = ebikeBatteryEnterRecords.size();
|
|
||||||
updateOtherComponentStock(componentType, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateHelmetDetails(String componentEnterRecordId, String componentType, Integer state) {
|
|
||||||
// 具体更新头盔仓库明细状态和仓库总数量的逻辑
|
|
||||||
QueryWrapper query = new QueryWrapper();
|
|
||||||
query.eq("component_enter_record_id", componentEnterRecordId);
|
|
||||||
|
|
||||||
List<EbikeHelmetEnterRecords> ebikeHelmetEnterRecords = ebikeHelmetEnterRecordsMapper.selectListWithRelationsByQuery(query);
|
|
||||||
for (EbikeHelmetEnterRecords record : ebikeHelmetEnterRecords) {
|
|
||||||
query = new QueryWrapper();
|
|
||||||
query.eq("item_code", record.getHelmetCode());
|
|
||||||
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
|
||||||
ebikeComponentInventory.setState(state);
|
|
||||||
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
|
||||||
}
|
|
||||||
int size = ebikeHelmetEnterRecords.size();
|
|
||||||
updateOtherComponentStock(componentType, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateCentralControlDetails(String componentEnterRecordId, String componentType, Integer state) {
|
|
||||||
// 具体更新中控仓库明细状态和仓库总数量的逻辑
|
|
||||||
QueryWrapper query = new QueryWrapper();
|
|
||||||
query.eq("component_enter_record_id", componentEnterRecordId);
|
|
||||||
List<EbikeEcuEnterRecords> ebikeEcuEnterRecords = ebikeEcuEnterRecordsMapper.selectListWithRelationsByQuery(query);
|
|
||||||
for (EbikeEcuEnterRecords record : ebikeEcuEnterRecords) {
|
|
||||||
query = new QueryWrapper();
|
|
||||||
query.eq("item_code", record.getEcuSn());
|
|
||||||
query.eq("serial_number", record.getEcuCode());
|
|
||||||
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
|
||||||
ebikeComponentInventory.setState(state);
|
|
||||||
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
|
||||||
}
|
|
||||||
int size = ebikeEcuEnterRecords.size();
|
|
||||||
updateOtherComponentStock(componentType, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateOtherComponentStock(String componentType, Integer size) {
|
|
||||||
// 具体更新其他组件仓库总数量的逻辑
|
|
||||||
QueryWrapper query1 = new QueryWrapper();
|
|
||||||
query1.eq("code", componentType);
|
|
||||||
EbikeComponentInventorycount ebikeComponentInventorycount = ebikeComponentInventorycountMapper.selectOneByQuery(query1);
|
|
||||||
if (ebikeComponentInventorycount != null) {
|
|
||||||
ebikeComponentInventorycount.setItemCount(ebikeComponentInventorycount.getItemCount() - size);
|
|
||||||
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出库作废增加部件数量
|
* 出库作废增加部件数量
|
||||||
@ -464,7 +458,186 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
return JsonResult.success(componentOutRecordId);
|
return JsonResult.success(componentOutRecordId);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 设备部件出库取消(通用)
|
||||||
|
*
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JsonResult<?> cancelOutDevicePart(String componentOutRecordId) {
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
||||||
|
//先更新记录表状态 为已取消(-1)
|
||||||
|
ebikeComponentOutRecords.setState("-1");
|
||||||
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
|
return JsonResult.success("成功");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设备部件出库作废 (通用
|
||||||
|
*
|
||||||
|
* @param componentOutRecordId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public JsonResult<?> invalidateOutDevicePart(String componentOutRecordId) {
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
||||||
|
String componentType = ebikeComponentOutRecords.getComponentType();
|
||||||
|
Integer enterQuantity = ebikeComponentOutRecords.getEnterQuantity();
|
||||||
|
// 电池262711452730000 头盔262711452730001 中控262711452730008 需要单独操作明细表
|
||||||
|
//先更新记录表状态 为已作废(-2)
|
||||||
|
ebikeComponentOutRecords.setState("-2");
|
||||||
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
|
ComponentType componentTypeEnum = ComponentType.fromCode(componentType);
|
||||||
|
switch (componentTypeEnum) {
|
||||||
|
case BATTERY: // 电池
|
||||||
|
updateBatteryOutDetails(componentOutRecordId, componentType, -2);
|
||||||
|
break;
|
||||||
|
case HELMET: // 头盔
|
||||||
|
updateHelmetOutDetails(componentOutRecordId, componentType, -2);
|
||||||
|
break;
|
||||||
|
case ECU: // 中控
|
||||||
|
updateCentralControlOutDetails(componentOutRecordId, componentType, -2);
|
||||||
|
break;
|
||||||
|
default: // 其他
|
||||||
|
updateOtherComponentStock(componentType, enterQuantity);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return JsonResult.success("成功");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 分页查询Ecu入库记录。
|
||||||
|
*
|
||||||
|
* @param reqEbikeEcuEnterRecordsDto 分页查询条件
|
||||||
|
* @return 分页对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<EbikeEcuEnterRecords> ecuEnterList(ReqEbikeEcuEnterRecordsDto reqEbikeEcuEnterRecordsDto) {
|
||||||
|
QueryWrapper query = QueryWrapper.create();
|
||||||
|
String componentId = reqEbikeEcuEnterRecordsDto.getComponentEnterRecordId();
|
||||||
|
if(componentId!=null&&!componentId.isEmpty())
|
||||||
|
query.where(EBIKE_ECU_ENTER_RECORDS.COMPONENT_ENTER_RECORD_ID.eq(componentId));
|
||||||
|
Page<EbikeEcuEnterRecords> page = reqEbikeEcuEnterRecordsDto.getPageParam().getPage();
|
||||||
|
return ebikeEcuEnterRecordsMapper.paginate(page, query);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 分页查询Ecu出库库记录。
|
||||||
|
*
|
||||||
|
* @param reqEbikeEcuOutRecordsDto 分页查询条件
|
||||||
|
* @return 分页对象
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Page<EbikeEcuOutRecords> ecuOutList(ReqEbikeEcuOutRecordsDto reqEbikeEcuOutRecordsDto) {
|
||||||
|
QueryWrapper query = QueryWrapper.create();
|
||||||
|
String componentId = reqEbikeEcuOutRecordsDto.getComponentOutRecordId();
|
||||||
|
if(componentId!=null&&!componentId.isEmpty())
|
||||||
|
query.where(EBIKE_ECU_OUT_RECORDS.COMPONENT_OUT_RECORD_ID.eq(componentId));
|
||||||
|
Page<EbikeEcuOutRecords> page = reqEbikeEcuOutRecordsDto.getPageParam().getPage();
|
||||||
|
return ebikeEcuOutRecordsMapper.paginate(page, query);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据部件出库记录表主键,查询部件出库记录信息以及归还部件信息
|
||||||
|
*
|
||||||
|
* @param componentOutRecordId 部件出库记录ID
|
||||||
|
* @return ResComponentOutRecordInfoDto
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public JsonResult<?> getComponentOutRecordInfo(String componentOutRecordId) {
|
||||||
|
// 创建查询条件
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
|
||||||
|
// 获取出库记录
|
||||||
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
||||||
|
if (ebikeComponentOutRecords == null) {
|
||||||
|
return JsonResult.failed("记录未找到");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将出库记录的属性复制到返回的DTO中
|
||||||
|
ResComponentOutRecordInfoDto resComponentOutRecordInfoDto = new ResComponentOutRecordInfoDto();
|
||||||
|
BeanUtils.copyProperties(ebikeComponentOutRecords, resComponentOutRecordInfoDto);
|
||||||
|
|
||||||
|
// 根据组件类型填充对应的出库记录
|
||||||
|
ComponentType componentTypeEnum = ComponentType.fromCode(ebikeComponentOutRecords.getComponentType());
|
||||||
|
populateOutRecords(resComponentOutRecordInfoDto, componentOutRecordId, componentTypeEnum);
|
||||||
|
|
||||||
|
// 查询是否存在归还记录,如果存在,则填充归还记录
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
EbikeComponentEnterRecords ebikeComponentEnterRecords = ebikeComponentEnterRecordsMapper.selectOneByQuery(query);
|
||||||
|
if (ebikeComponentEnterRecords != null) {
|
||||||
|
populateEnterRecords(resComponentOutRecordInfoDto, ebikeComponentEnterRecords);
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonResult.success(resComponentOutRecordInfoDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 方法实现
|
||||||
|
private void updateBatteryDetails(String componentEnterRecordId, String componentType, Integer state) {
|
||||||
|
// 具体更新电池仓库明细状态和仓库总数量的逻辑
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
List<EbikeBatteryEnterRecords> ebikeBatteryEnterRecords = ebikeBatteryEnterRecordsMapper.selectListByQuery(query);
|
||||||
|
for (EbikeBatteryEnterRecords record : ebikeBatteryEnterRecords) {
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("item_code", record.getBatteryCode());
|
||||||
|
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
ebikeComponentInventory.setState(state);
|
||||||
|
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
||||||
|
}
|
||||||
|
int size = ebikeBatteryEnterRecords.size();
|
||||||
|
updateOtherComponentStock(componentType, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateHelmetDetails(String componentEnterRecordId, String componentType, Integer state) {
|
||||||
|
// 具体更新头盔仓库明细状态和仓库总数量的逻辑
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
|
||||||
|
List<EbikeHelmetEnterRecords> ebikeHelmetEnterRecords = ebikeHelmetEnterRecordsMapper.selectListByQuery(query);
|
||||||
|
for (EbikeHelmetEnterRecords record : ebikeHelmetEnterRecords) {
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("item_code", record.getHelmetCode());
|
||||||
|
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
ebikeComponentInventory.setState(state);
|
||||||
|
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
||||||
|
}
|
||||||
|
int size = ebikeHelmetEnterRecords.size();
|
||||||
|
updateOtherComponentStock(componentType, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCentralControlDetails(String componentEnterRecordId, String componentType, Integer state) {
|
||||||
|
// 具体更新中控仓库明细状态和仓库总数量的逻辑
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_enter_record_id", componentEnterRecordId);
|
||||||
|
List<EbikeEcuEnterRecords> ebikeEcuEnterRecords = ebikeEcuEnterRecordsMapper.selectListByQuery(query);
|
||||||
|
for (EbikeEcuEnterRecords record : ebikeEcuEnterRecords) {
|
||||||
|
query = new QueryWrapper();
|
||||||
|
query.eq("item_code", record.getEcuSn());
|
||||||
|
query.eq("serial_number", record.getEcuCode());
|
||||||
|
EbikeComponentInventory ebikeComponentInventory = ebikeComponentInventoryMapper.selectOneByQuery(query);
|
||||||
|
ebikeComponentInventory.setState(state);
|
||||||
|
ebikeComponentInventoryMapper.update(ebikeComponentInventory);
|
||||||
|
}
|
||||||
|
int size = ebikeEcuEnterRecords.size();
|
||||||
|
updateOtherComponentStock(componentType, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateOtherComponentStock(String componentType, Integer size) {
|
||||||
|
// 具体更新其他组件仓库总数量的逻辑
|
||||||
|
QueryWrapper query1 = new QueryWrapper();
|
||||||
|
query1.eq("code", componentType);
|
||||||
|
EbikeComponentInventorycount ebikeComponentInventorycount = ebikeComponentInventorycountMapper.selectOneByQuery(query1);
|
||||||
|
if (ebikeComponentInventorycount != null) {
|
||||||
|
ebikeComponentInventorycount.setItemCount(ebikeComponentInventorycount.getItemCount() - size);
|
||||||
|
ebikeComponentInventorycountMapper.update(ebikeComponentInventorycount);
|
||||||
|
}
|
||||||
|
}
|
||||||
private EbikeComponentOutRecords buildOutRecord(ReqComponentOutRecordDto params, EbikeComponentTypeInfo ebikeComponentTypeInfo, Integer stockInType, Long orgId) {
|
private EbikeComponentOutRecords buildOutRecord(ReqComponentOutRecordDto params, EbikeComponentTypeInfo ebikeComponentTypeInfo, Integer stockInType, Long orgId) {
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = new EbikeComponentOutRecords();
|
EbikeComponentOutRecords ebikeComponentOutRecords = new EbikeComponentOutRecords();
|
||||||
ebikeComponentOutRecords.setOwningRegion(params.getOwningRegion());
|
ebikeComponentOutRecords.setOwningRegion(params.getOwningRegion());
|
||||||
@ -544,64 +717,12 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备部件出库取消(通用)
|
|
||||||
*
|
|
||||||
* @param componentOutRecordId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public JsonResult<?> cancelOutDevicePart(String componentOutRecordId) {
|
|
||||||
QueryWrapper query = new QueryWrapper();
|
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
|
||||||
//先更新记录表状态 为已取消(-1)
|
|
||||||
ebikeComponentOutRecords.setState("-1");
|
|
||||||
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
|
||||||
return JsonResult.success("成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备部件出库作废 (通用
|
|
||||||
*
|
|
||||||
* @param componentOutRecordId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public JsonResult<?> invalidateOutDevicePart(String componentOutRecordId) {
|
|
||||||
QueryWrapper query = new QueryWrapper();
|
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
|
||||||
String componentType = ebikeComponentOutRecords.getComponentType();
|
|
||||||
Integer enterQuantity = ebikeComponentOutRecords.getEnterQuantity();
|
|
||||||
// 电池262711452730000 头盔262711452730001 中控262711452730008 需要单独操作明细表
|
|
||||||
//先更新记录表状态 为已作废(-2)
|
|
||||||
ebikeComponentOutRecords.setState("-2");
|
|
||||||
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
|
||||||
ComponentType componentTypeEnum = ComponentType.fromCode(componentType);
|
|
||||||
switch (componentTypeEnum) {
|
|
||||||
case BATTERY: // 电池
|
|
||||||
updateBatteryOutDetails(componentOutRecordId, componentType, -2);
|
|
||||||
break;
|
|
||||||
case HELMET: // 头盔
|
|
||||||
updateHelmetOutDetails(componentOutRecordId, componentType, -2);
|
|
||||||
break;
|
|
||||||
case ECU: // 中控
|
|
||||||
updateCentralControlOutDetails(componentOutRecordId, componentType, -2);
|
|
||||||
break;
|
|
||||||
default: // 其他
|
|
||||||
updateOtherComponentStock(componentType, enterQuantity);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return JsonResult.success("成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateBatteryOutDetails(String componentOutRecordId, String componentType, Integer state) {
|
private void updateBatteryOutDetails(String componentOutRecordId, String componentType, Integer state) {
|
||||||
// 具体更新电池仓库明细状态和仓库总数量的逻辑
|
// 具体更新电池仓库明细状态和仓库总数量的逻辑
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
List<EbikeBatteryOutRecords> ebikeBatteryOutRecords = ebikeBatteryOutRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeBatteryOutRecords> ebikeBatteryOutRecords = ebikeBatteryOutRecordsMapper.selectListByQuery(query);
|
||||||
for (EbikeBatteryOutRecords record : ebikeBatteryOutRecords) {
|
for (EbikeBatteryOutRecords record : ebikeBatteryOutRecords) {
|
||||||
query = new QueryWrapper();
|
query = new QueryWrapper();
|
||||||
query.eq("item_code", record.getBatteryCode());
|
query.eq("item_code", record.getBatteryCode());
|
||||||
@ -618,7 +739,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
|
|
||||||
List<EbikeHelmetOutRecords> ebikeHelmetOutRecords = ebikeHelmetOutRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeHelmetOutRecords> ebikeHelmetOutRecords = ebikeHelmetOutRecordsMapper.selectListByQuery(query);
|
||||||
for (EbikeHelmetOutRecords record : ebikeHelmetOutRecords) {
|
for (EbikeHelmetOutRecords record : ebikeHelmetOutRecords) {
|
||||||
query = new QueryWrapper();
|
query = new QueryWrapper();
|
||||||
query.eq("item_code", record.getHelmetCode());
|
query.eq("item_code", record.getHelmetCode());
|
||||||
@ -634,7 +755,7 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
// 具体更新中控仓库明细状态和仓库总数量的逻辑
|
// 具体更新中控仓库明细状态和仓库总数量的逻辑
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
List<EbikeEcuOutRecords> ebikeEcuOutRecords = ebikeEcuOutRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeEcuOutRecords> ebikeEcuOutRecords = ebikeEcuOutRecordsMapper.selectListByQuery(query);
|
||||||
for (EbikeEcuOutRecords record : ebikeEcuOutRecords) {
|
for (EbikeEcuOutRecords record : ebikeEcuOutRecords) {
|
||||||
query = new QueryWrapper();
|
query = new QueryWrapper();
|
||||||
query.eq("item_code", record.getEcuSn());
|
query.eq("item_code", record.getEcuSn());
|
||||||
@ -646,84 +767,23 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
int size = ebikeEcuOutRecords.size();
|
int size = ebikeEcuOutRecords.size();
|
||||||
updateOtherOutComponentStock(componentType, size);
|
updateOtherOutComponentStock(componentType, size);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* 分页查询Ecu入库记录。
|
|
||||||
*
|
|
||||||
* @param reqEbikeEcuEnterRecordsDto 分页查询条件
|
|
||||||
* @return 分页对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Page<EbikeEcuEnterRecords> ecuEnterList(ReqEbikeEcuEnterRecordsDto reqEbikeEcuEnterRecordsDto) {
|
|
||||||
QueryWrapper query = QueryWrapper.create();
|
|
||||||
String componentId = reqEbikeEcuEnterRecordsDto.getComponentEnterRecordId();
|
|
||||||
if(componentId!=null&&!componentId.isEmpty())
|
|
||||||
query.where(EBIKE_ECU_ENTER_RECORDS.COMPONENT_ENTER_RECORD_ID.eq(componentId));
|
|
||||||
Page<EbikeEcuEnterRecords> page = reqEbikeEcuEnterRecordsDto.getPageParam().getPage();
|
|
||||||
return ebikeEcuEnterRecordsMapper.paginate(page, query);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 分页查询Ecu出库库记录。
|
|
||||||
*
|
|
||||||
* @param reqEbikeEcuOutRecordsDto 分页查询条件
|
|
||||||
* @return 分页对象
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Page<EbikeEcuOutRecords> ecuOutList(ReqEbikeEcuOutRecordsDto reqEbikeEcuOutRecordsDto) {
|
|
||||||
QueryWrapper query = QueryWrapper.create();
|
|
||||||
String componentId = reqEbikeEcuOutRecordsDto.getComponentOutRecordId();
|
|
||||||
if(componentId!=null&&!componentId.isEmpty())
|
|
||||||
query.where(EBIKE_ECU_OUT_RECORDS.COMPONENT_OUT_RECORD_ID.eq(componentId));
|
|
||||||
Page<EbikeEcuOutRecords> page = reqEbikeEcuOutRecordsDto.getPageParam().getPage();
|
|
||||||
return ebikeEcuOutRecordsMapper.paginate(page, query);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 根据部件出库记录表主键,查询部件出库记录信息以及归还部件信息
|
|
||||||
*
|
|
||||||
* @param componentOutRecordId 部件出库记录ID
|
|
||||||
* @return ResComponentOutRecordInfoDto
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public JsonResult<?> getComponentOutRecordInfo(String componentOutRecordId) {
|
|
||||||
// 创建查询条件
|
|
||||||
QueryWrapper query = new QueryWrapper();
|
|
||||||
query.eq("component_out_record_id", componentOutRecordId);
|
|
||||||
|
|
||||||
// 获取出库记录
|
|
||||||
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneByQuery(query);
|
|
||||||
if (ebikeComponentOutRecords == null) {
|
|
||||||
return JsonResult.failed("记录未找到");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将出库记录的属性复制到返回的DTO中
|
|
||||||
ResComponentOutRecordInfoDto resComponentOutRecordInfoDto = new ResComponentOutRecordInfoDto();
|
|
||||||
BeanUtils.copyProperties(ebikeComponentOutRecords, resComponentOutRecordInfoDto);
|
|
||||||
|
|
||||||
// 根据组件类型填充对应的出库记录
|
|
||||||
ComponentType componentTypeEnum = ComponentType.fromCode(ebikeComponentOutRecords.getComponentType());
|
|
||||||
populateOutRecords(resComponentOutRecordInfoDto, query, componentTypeEnum);
|
|
||||||
|
|
||||||
// 查询是否存在归还记录,如果存在,则填充归还记录
|
|
||||||
EbikeComponentEnterRecords ebikeComponentEnterRecords = ebikeComponentEnterRecordsMapper.selectOneByQuery(query);
|
|
||||||
if (ebikeComponentEnterRecords != null) {
|
|
||||||
populateEnterRecords(resComponentOutRecordInfoDto, ebikeComponentEnterRecords);
|
|
||||||
}
|
|
||||||
|
|
||||||
return JsonResult.success(resComponentOutRecordInfoDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 根据组件类型填充出库记录
|
// 根据组件类型填充出库记录
|
||||||
private void populateOutRecords(ResComponentOutRecordInfoDto dto, QueryWrapper query, ComponentType componentTypeEnum) {
|
private void populateOutRecords(ResComponentOutRecordInfoDto dto, String componentOutRecordId, ComponentType componentTypeEnum) {
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("component_out_record_id", componentOutRecordId);
|
||||||
switch (componentTypeEnum) {
|
switch (componentTypeEnum) {
|
||||||
case BATTERY: // 电池
|
case BATTERY: // 电池
|
||||||
List<EbikeBatteryOutRecords> batteryOutRecords = ebikeBatteryOutRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeBatteryOutRecords> batteryOutRecords = ebikeBatteryOutRecordsMapper.selectListByQuery(query);
|
||||||
dto.setEbikeBatteryOutRecords(batteryOutRecords);
|
dto.setEbikeBatteryOutRecords(batteryOutRecords);
|
||||||
break;
|
break;
|
||||||
case HELMET: // 头盔
|
case HELMET: // 头盔
|
||||||
List<EbikeHelmetOutRecords> helmetOutRecords = ebikeHelmetOutRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeHelmetOutRecords> helmetOutRecords = ebikeHelmetOutRecordsMapper.selectListByQuery(query);
|
||||||
dto.setEbikeHelmetOutRecords(helmetOutRecords);
|
dto.setEbikeHelmetOutRecords(helmetOutRecords);
|
||||||
break;
|
break;
|
||||||
case ECU: // 中控
|
case ECU: // 中控
|
||||||
List<EbikeEcuOutRecords> ecuOutRecords = ebikeEcuOutRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeEcuOutRecords> ecuOutRecords = ebikeEcuOutRecordsMapper.selectListByQuery(query);
|
||||||
dto.setEbikeEcuOutRecords(ecuOutRecords);
|
dto.setEbikeEcuOutRecords(ecuOutRecords);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -740,22 +800,35 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ComponentType componentTypeEnumEnter = ComponentType.fromCode(enterRecords.getComponentType());
|
ComponentType componentTypeEnumEnter = ComponentType.fromCode(enterRecords.getComponentType());
|
||||||
switch (componentTypeEnumEnter) {
|
switch (componentTypeEnumEnter) {
|
||||||
case BATTERY: // 电池
|
case BATTERY: // 电池
|
||||||
List<EbikeBatteryEnterRecords> batteryEnterRecords = ebikeBatteryEnterRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeBatteryEnterRecords> batteryEnterRecords = ebikeBatteryEnterRecordsMapper.selectListByQuery(query);
|
||||||
dto.setEbikeBatteryEnterRecords(batteryEnterRecords);
|
dto.setEbikeBatteryEnterRecords(batteryEnterRecords);
|
||||||
break;
|
break;
|
||||||
case HELMET: // 头盔
|
case HELMET: // 头盔
|
||||||
List<EbikeHelmetEnterRecords> helmetEnterRecords = ebikeHelmetEnterRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeHelmetEnterRecords> helmetEnterRecords = ebikeHelmetEnterRecordsMapper.selectListByQuery(query);
|
||||||
dto.setEbikeHelmetEnterRecords(helmetEnterRecords);
|
dto.setEbikeHelmetEnterRecords(helmetEnterRecords);
|
||||||
break;
|
break;
|
||||||
case ECU: // 中控
|
case ECU: // 中控
|
||||||
List<EbikeEcuEnterRecords> ecuEnterRecords = ebikeEcuEnterRecordsMapper.selectListWithRelationsByQuery(query);
|
List<EbikeEcuEnterRecords> ecuEnterRecords = ebikeEcuEnterRecordsMapper.selectListByQuery(query);
|
||||||
dto.setEbikeEcuEnterRecords(ecuEnterRecords);
|
dto.setEbikeEcuEnterRecords(ecuEnterRecords);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 更新出库记录状态为已归还
|
||||||
|
private void updateOutRecordStatus(String componentOutRecordId) {
|
||||||
|
EbikeComponentOutRecords ebikeComponentOutRecords = ebikeComponentOutRecordsMapper.selectOneById(componentOutRecordId);
|
||||||
|
ebikeComponentOutRecords.setState("2");
|
||||||
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
|
}
|
||||||
|
public boolean isDuplicateEntry(String itemCode, String serialNumber) {
|
||||||
|
QueryWrapper query = new QueryWrapper();
|
||||||
|
query.eq("item_code", itemCode);
|
||||||
|
query.eq("serial_number", serialNumber);
|
||||||
|
query.eq("state", 1); // 假设 1 表示已已入库
|
||||||
|
long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
||||||
|
return count > 0; // 如果记录数大于 0,说明已经存在重复入库
|
||||||
|
}
|
||||||
public StaffFeign getStaffFeignInfo() {
|
public StaffFeign getStaffFeignInfo() {
|
||||||
String tokenValue = StpUtil.getTokenValue();
|
String tokenValue = StpUtil.getTokenValue();
|
||||||
// 调用 Feign 客户端获取用户信息
|
// 调用 Feign 客户端获取用户信息
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user