Browse Source

1.更新出库列表

2.新增判断设备内是否有档案
master
xia 3 years ago
parent
commit
af61b8413e
  1. 30
      archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java
  2. 12
      archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java
  3. 7
      archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java
  4. 40
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java
  5. 4
      common/src/main/java/com/storeroom/utils/enums/ResponseStatus.java

30
archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java

@ -58,12 +58,21 @@ public class StorageController {
return ApiResponse.success(caseService.readyIntoCase(tid,caseName,barcode,page));
}
// 第一版本 已入库盒列表 防止业务回滚 注释不删
// @ApiOperation("已入库盒列表")
// @GetMapping("/alReadyInto")
// public ApiResponse<Object> alReadyInto(
// String caseName,String archiveNo,String title,String location, Pageable page
// ){
// return ApiResponse.success(caseService.alReadyInto(caseName,archiveNo,title,location,page));
// }
@ApiOperation("已入库盒列表")
@GetMapping("/alReadyInto")
public ApiResponse<Object> alReadyInto(
String caseName,String archiveNo,String title,String location, Pageable page
String tid, String caseName,String barcode, Pageable page
){
return ApiResponse.success(caseService.alReadyInto(caseName,archiveNo,title,location,page));
return ApiResponse.success(caseService.alReadyInto(tid,caseName,barcode,page));
}
@ApiOperation("初始化档案装盒信息")
@ -81,10 +90,14 @@ public class StorageController {
){
DeviceArchivesTag deviceArchivesTag = deviceArchivesTagService.findByDeviceInfoIdAndPosition(deviceId,position);
if(null == deviceArchivesTag)
return ApiResponse.error(ResponseStatus.Shelf_IS_NULL);
return ApiResponse.error(ResponseStatus.SHEIF_IS_NULL);
if(1==deviceType)
ApiResponse.success(true);
return ApiResponse.success(archivesService.isShelfOccupy(deviceArchivesTag.getId()));
return ApiResponse.success(deviceArchivesTag);
if(archivesService.isShelfOccupy(deviceArchivesTag.getId())){
return ApiResponse.success(deviceArchivesTag);
}else{
return ApiResponse.error(ResponseStatus.SHEIF_OCCUPY);
}
}
@ApiOperation("入库")
@ -184,9 +197,12 @@ public class StorageController {
@ApiOperation("外部回调-确认出入库")
@AnonymousPostMapping("/externalCallback")
public ApiResponse<Object> externalCallback(
@Validated @RequestBody List<String> archivesIds
@Validated @RequestBody String json
){
return ApiResponse.success(caseService.grantConfirm(archivesIds));
JSONObject jsonObject = JSONObject.parseObject(json);
String caseId = jsonObject.get("id") +"";
String storageType = jsonObject.get("type")+"";
return ApiResponse.success(caseService.externalCallback(caseId,storageType));
}
@ApiOperation("出入库记录")

12
archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesCaseRepository.java

@ -14,15 +14,18 @@ import java.util.Set;
public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, String>{
@Query("from ArchivesCase where id = ?1")
ArchivesCase findCaseById(String caseId);
@Query(nativeQuery = true,
value = "select * from archives_case where if(?1 is null,1=1,case_name like ?1) and " +
"if(?2 is null,1=1,tid like ?2) and if(?3 is null,1=1,barcode like ?3) ")
Page<ArchivesCase> initCaseList(String caseName, String tid,String barcode, Pageable page);
@Query(nativeQuery = true,
value = "select * from archives_case where storage_type != 2 and deposit_num != 0 and if(?1 is null,1=1,case_name like ?1) and " +
value = "select * from archives_case where storage_type in ?4 and deposit_num != 0 and if(?1 is null,1=1,case_name like ?1) and " +
"if(?2 is null,1=1,tid like ?2) and if(?3 is null,1=1,barcode like ?3) ")
Page<ArchivesCase> readyIntoCase(String caseName, String tid,String barcode, Pageable page);
Page<ArchivesCase> readyIntoCase(String caseName, String tid,String barcode,List storageType, Pageable page);
@Query(nativeQuery = true,
value = "SELECT distinct asum.archives_id as archivesId,ace.storage_type as storageType,asum.child as child,asum.category_type as categoryType," +
@ -55,6 +58,11 @@ public interface ArchivesCaseRepository extends JpaRepository<ArchivesCase, Stri
@Query("select caseName from ArchivesCase where id in ?1")
List<String> findCaseName(List caseIds);
@Query(nativeQuery = true,
value = "select count(1) from archives_case ace where ace.shelf_id in " +
"(select id from device_archives_tag dat where dat.device_info_id in (?1)) ")
Integer isHaveArchives(List<String> deviceId);
@Modifying
@Query(value = "update ArchivesCase set tid = null where tid = ?1")
void unbindTag(String tid);

7
archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java

@ -38,10 +38,15 @@ public interface ArchivesCaseService {
//查看盒内详情
Object findInCase(String caseId);
//设备删除 设备内是否有档案
Boolean isHaveArchives(List<String> deviceId);
//查看可入库盒列表
Object readyIntoCase(String tid, String caseName,String barcode, Pageable page);
//查看已入库列表
Object alReadyInto(String caseName,String archiveNo,String title,String location, Pageable page);
//查看已入库列表
Object alReadyInto(String tid, String caseName,String barcode, Pageable page);
//根据档案初始化装盒信息
Object initCaseByArchives(String archivesId);
//入库
@ -58,4 +63,6 @@ public interface ArchivesCaseService {
Object initStorageLogList(Integer storageType, String caseName,String tid,String barcode, Pageable page);
//根据id集合获取出入库列表
List<StorageLog> initStorageLogList(List<Integer> logs);
//第三方回调
Integer externalCallback(String caseId,String storageType);
}

40
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java

@ -400,12 +400,20 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
return vo;
}
@Override
public Boolean isHaveArchives(List<String> deviceId) {
Integer count = caseRepository.isHaveArchives(deviceId);
return count>0?false:true;
}
@Override
public Object readyIntoCase(String tid, String caseName, String barcode, Pageable page) {
tid = StringUtils.isEmpty(tid) ? null : "%"+ tid +"%";
caseName = StringUtils.isEmpty(caseName) ? null : "%"+ caseName +"%";
barcode = StringUtils.isEmpty(barcode) ? null : "%"+ barcode +"%";
Page<ArchivesCase> pageCase = caseRepository.readyIntoCase(caseName,tid,barcode,page);
List<Integer> storageType = new ArrayList<>();
storageType.add(0);storageType.add(1);
Page<ArchivesCase> pageCase = caseRepository.readyIntoCase(caseName,tid,barcode,storageType,page);
return PageUtil.toPage(pageCase);
}
@ -419,6 +427,17 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
return PageUtil.toPage(pageCase);
}
@Override
public Object alReadyInto(String tid, String caseName, String barcode, Pageable page) {
tid = StringUtils.isEmpty(tid) ? null : "%"+ tid +"%";
caseName = StringUtils.isEmpty(caseName) ? null : "%"+ caseName +"%";
barcode = StringUtils.isEmpty(barcode) ? null : "%"+ barcode +"%";
List<Integer> storageType = new ArrayList<>();
storageType.add(2);storageType.add(3);
Page<ArchivesCase> pageCase = caseRepository.readyIntoCase(caseName,tid,barcode,storageType,page);
return PageUtil.toPage(pageCase);
}
@Override
public Object initCaseByArchives(String caseId) {
return caseRepository.initCaseAllByCaseId(caseId);
@ -452,7 +471,7 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
}
}
}
if(resultOk>1){
if(resultOk>0){
newShelfId = newShelfId.substring(0,newShelfId.length()-1);
newLocation = newLocation.substring(0,newLocation.length()-1);
newLocationName = newLocationName.substring(0,newLocationName.length()-1);
@ -560,4 +579,21 @@ public class ArchivesCaseServiceImpl implements ArchivesCaseService {
public List<StorageLog> initStorageLogList(List<Integer> logs) {
return storageLogRepository.findAllById(logs);
}
@Override
public Integer externalCallback(String caseId, String type) {
Integer storageType = "1".equals(type)? 2:0;
ArchivesCase archivesCase = caseRepository.findCaseById(caseId);
if(null == archivesCase)
return 0;
//入库回调
if("1".equals(type)){
archivesCase.setStorageType(storageType);
//出库回调
}else{
}
caseRepository.saveAndFlush(archivesCase);
return null;
}
}

4
common/src/main/java/com/storeroom/utils/enums/ResponseStatus.java

@ -28,7 +28,9 @@ public enum ResponseStatus {
//设备 为空
DEVICE_IS_NULL(7001,"找不到当前设备"),
//层架位不存在
Shelf_IS_NULL(7010,"层架位不存在"),
SHEIF_IS_NULL(7010,"层架位不存在"),
//层架位已被占用
SHEIF_OCCUPY(7011,"层架位已被占用"),
//档案未入库
ARCHIVES_NOT_COLLECT(8001,"该档案未入库");

Loading…
Cancel
Save