|
@ -148,8 +148,7 @@ public class DockServiceImpl implements DockService { |
|
|
DockDO existAccountcalendar = dockMapper.selectByItemCode(dockDO.getCode()); |
|
|
DockDO existAccountcalendar = dockMapper.selectByItemCode(dockDO.getCode()); |
|
|
if (existAccountcalendar == null && mode != 3) { |
|
|
if (existAccountcalendar == null && mode != 3) { |
|
|
dockMapper.insert(DockConvert.INSTANCE.convert(dock)); |
|
|
dockMapper.insert(DockConvert.INSTANCE.convert(dock)); |
|
|
} |
|
|
} else if (existAccountcalendar != null && mode != 2) { |
|
|
else if (existAccountcalendar != null && mode != 2) { |
|
|
|
|
|
// 如果存在,判断是否允许更新
|
|
|
// 如果存在,判断是否允许更新
|
|
|
dockDO.setId(existAccountcalendar.getId()); |
|
|
dockDO.setId(existAccountcalendar.getId()); |
|
|
dockMapper.updateById(dockDO); |
|
|
dockMapper.updateById(dockDO); |
|
@ -160,7 +159,6 @@ public class DockServiceImpl implements DockService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void validateDockForCreateOrUpdate(Long id, String code, String type, String warehouseCode, |
|
|
private void validateDockForCreateOrUpdate(Long id, String code, String type, String warehouseCode, |
|
|
String defaultLocationCode, String available) { |
|
|
String defaultLocationCode, String available) { |
|
|
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
|
|
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
|
@ -174,6 +172,7 @@ public class DockServiceImpl implements DockService { |
|
|
validateAvailableExists(available); |
|
|
validateAvailableExists(available); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
@VisibleForTesting |
|
|
private void validateDockExists(Long id) { |
|
|
private void validateDockExists(Long id) { |
|
|
if (id == null) { |
|
|
if (id == null) { |
|
@ -184,6 +183,7 @@ public class DockServiceImpl implements DockService { |
|
|
throw exception(DOCK_NOT_EXISTS); |
|
|
throw exception(DOCK_NOT_EXISTS); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
@VisibleForTesting |
|
|
private void validateCodeExists(Long id, String code) { |
|
|
private void validateCodeExists(Long id, String code) { |
|
|
if (code.isEmpty()) { |
|
|
if (code.isEmpty()) { |
|
@ -204,24 +204,28 @@ public class DockServiceImpl implements DockService { |
|
|
throw exception(DOCK_CODE_EXISTS); |
|
|
throw exception(DOCK_CODE_EXISTS); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
@VisibleForTesting |
|
|
private void validateTypeExists(String type) { |
|
|
private void validateTypeExists(String type) { |
|
|
if (type.isEmpty()) { |
|
|
if (type.isEmpty()) { |
|
|
throw exception(DOCK_TYPE_NOT_EXISTS); |
|
|
throw exception(DOCK_TYPE_NOT_EXISTS); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
@VisibleForTesting |
|
|
private void validateWareHouseCodeExists(String warehouseCode) { |
|
|
private void validateWareHouseCodeExists(String warehouseCode) { |
|
|
if (warehouseCode.isEmpty()) { |
|
|
if (warehouseCode.isEmpty()) { |
|
|
throw exception(DOCK_WARE_HOUSE_CODE_NOT_EXISTS); |
|
|
throw exception(DOCK_WARE_HOUSE_CODE_NOT_EXISTS); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
@VisibleForTesting |
|
|
private void validateDefaultLocationCodeExists(String defaultLocationCode) { |
|
|
private void validateDefaultLocationCodeExists(String defaultLocationCode) { |
|
|
if (defaultLocationCode.isEmpty()) { |
|
|
if (defaultLocationCode.isEmpty()) { |
|
|
throw exception(DOCK_DEFAULT_LOCATION_CODE_NOT_EXISTS); |
|
|
throw exception(DOCK_DEFAULT_LOCATION_CODE_NOT_EXISTS); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@VisibleForTesting |
|
|
@VisibleForTesting |
|
|
private void validateAvailableExists(String available) { |
|
|
private void validateAvailableExists(String available) { |
|
|
if (available.isEmpty()) { |
|
|
if (available.isEmpty()) { |
|
@ -241,4 +245,18 @@ public class DockServiceImpl implements DockService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public DockDO selectDockByTwoCode(String code, String toWarehouseCode) { |
|
|
|
|
|
QueryWrapper<DockDO> queryWrapper = new QueryWrapper(); |
|
|
|
|
|
queryWrapper.eq("code", code); |
|
|
|
|
|
queryWrapper.eq("warehouse_code", toWarehouseCode); |
|
|
|
|
|
queryWrapper.eq("available", "TRUE"); |
|
|
|
|
|
DockDO dockDO = dockMapper.selectOne(queryWrapper); |
|
|
|
|
|
if (dockDO != null && "TRUE".equals(dockDO.getAvailable())) { |
|
|
|
|
|
return dockDO; |
|
|
|
|
|
} else { |
|
|
|
|
|
throw exception(DOCK_NOT_EXISTS); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|