erp type 优化
This commit is contained in:
@@ -56,8 +56,8 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
// 插入
|
// 插入
|
||||||
ErpWarehouseDO warehouse = BeanUtils.toBean(createReqVO, ErpWarehouseDO.class);
|
ErpWarehouseDO warehouse = BeanUtils.toBean(createReqVO, ErpWarehouseDO.class);
|
||||||
// 库位编码自动生成,格式 KW-0001,依次新增
|
// 库位编码自动生成,格式 KW-0001,依次新增
|
||||||
String maxCode = erpWarehouseMapper.selectMaxCode();
|
if (warehouse.getNumber() == null) {
|
||||||
if (warehouse.getNumber() == null){
|
String maxCode = erpWarehouseMapper.selectMaxCode();
|
||||||
if (maxCode == null) {
|
if (maxCode == null) {
|
||||||
warehouse.setNumber("KW-0001");
|
warehouse.setNumber("KW-0001");
|
||||||
} else {
|
} else {
|
||||||
@@ -81,9 +81,9 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
validateErpWarehouseExists(updateReqVO.getId());
|
validateErpWarehouseExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
ErpWarehouseDO updateObj = BeanUtils.toBean(updateReqVO, ErpWarehouseDO.class);
|
ErpWarehouseDO updateObj = BeanUtils.toBean(updateReqVO, ErpWarehouseDO.class);
|
||||||
if (updateObj.getType().equals("SPLY")&&updateObj.getIsEnable().equals("0")){
|
if (updateObj.getType().equals("SPLY") && updateObj.getIsEnable().equals("0")) {
|
||||||
erpWarehouseMapper.updateById(updateObj);
|
erpWarehouseMapper.updateById(updateObj);
|
||||||
}else {
|
} else {
|
||||||
throw exception(ERP_WAREHOUSE_NOT_ALLOW_UPDATE);
|
throw exception(ERP_WAREHOUSE_NOT_ALLOW_UPDATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
@Override
|
@Override
|
||||||
public void enableWarehouseList(List<ErpWarehouseSaveReqVO> saveReqVOS) {
|
public void enableWarehouseList(List<ErpWarehouseSaveReqVO> saveReqVOS) {
|
||||||
List<ErpWarehouseDO> updateObj = BeanUtils.toBean(saveReqVOS, ErpWarehouseDO.class);
|
List<ErpWarehouseDO> updateObj = BeanUtils.toBean(saveReqVOS, ErpWarehouseDO.class);
|
||||||
List<BatchResult> count = erpWarehouseMapper.updateById(updateObj);
|
List<BatchResult> count = erpWarehouseMapper.updateById(updateObj);
|
||||||
if (CollUtil.isEmpty(count)) {
|
if (CollUtil.isEmpty(count)) {
|
||||||
throw exception(ERP_WAREHOUSE_NOT_EXISTS);
|
throw exception(ERP_WAREHOUSE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
@@ -203,7 +203,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
}
|
}
|
||||||
dataArrayALL.addAll(dataArray);
|
dataArrayALL.addAll(dataArray);
|
||||||
}
|
}
|
||||||
if (dataArrayALL.isEmpty()){
|
if (dataArrayALL.isEmpty()) {
|
||||||
throw exception(ERP_WAREHOUSE_NOT_EXISTS);
|
throw exception(ERP_WAREHOUSE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
Map<String, Long> deleteNumbers = new HashMap<>();
|
Map<String, Long> deleteNumbers = new HashMap<>();
|
||||||
for (String number : numbers.keySet()) {
|
for (String number : numbers.keySet()) {
|
||||||
if (!dataArrayNumbers.contains(number)) {
|
if (!dataArrayNumbers.contains(number)) {
|
||||||
deleteNumbers.put(number,numbers.get(number));
|
deleteNumbers.put(number, numbers.get(number));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
);
|
);
|
||||||
Map<String, Long> numberIdMap = insertedRecords.stream()
|
Map<String, Long> numberIdMap = insertedRecords.stream()
|
||||||
.collect(Collectors.toMap(asset -> asset.getFactoryNumber() + "-" + asset.getNumber(), ErpWarehouseDO::getId));
|
.collect(Collectors.toMap(asset -> asset.getFactoryNumber() + "-" + asset.getNumber(), ErpWarehouseDO::getId));
|
||||||
myRedisConfig.addRedisCacheMap(result.key,numberIdMap);
|
myRedisConfig.addRedisCacheMap(result.key, numberIdMap);
|
||||||
}
|
}
|
||||||
if (!result.toUpdate.isEmpty()) {
|
if (!result.toUpdate.isEmpty()) {
|
||||||
erpWarehouseMapper.updateBatch(result.toUpdate);
|
erpWarehouseMapper.updateBatch(result.toUpdate);
|
||||||
|
|||||||
Reference in New Issue
Block a user