|
|
|
@ -1,15 +1,19 @@
|
|
|
|
|
package com.glxp.api.controller.inv;
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.github.xiaoymin.knife4j.core.util.StrUtil;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.entity.inv.DeptDeviceDetailEntity;
|
|
|
|
|
import com.glxp.api.req.inv.AddDeptDeviceRequest;
|
|
|
|
|
import com.glxp.api.req.inv.FilterDeptDeviceRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.res.inv.DeptDeviceDetailResponse;
|
|
|
|
|
import com.glxp.api.service.inv.DeptDeviceDetailService;
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.util.udi.FilterUdiUtils;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
@ -17,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -37,7 +42,34 @@ public class DeptDeviceDetailController {
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/udiwms/inv/deptDevice/filter")
|
|
|
|
|
public BaseResponse filterList(FilterDeptDeviceRequest filterDeptDeviceRequest) {
|
|
|
|
|
List<DeptDeviceDetailResponse> list = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DeptDeviceDetailResponse> list = new ArrayList<>();
|
|
|
|
|
if (StrUtil.isNotBlank(filterDeptDeviceRequest.getUdiCode())) {
|
|
|
|
|
filterDeptDeviceRequest =new FilterDeptDeviceRequest();
|
|
|
|
|
//用唯一编码查询
|
|
|
|
|
filterDeptDeviceRequest.setCode(filterDeptDeviceRequest.getUdiCode());
|
|
|
|
|
list = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
if (CustomUtil.isEmpty(list)) {
|
|
|
|
|
//用设备udi码查询
|
|
|
|
|
filterDeptDeviceRequest.setCode(null);
|
|
|
|
|
filterDeptDeviceRequest.setOriginCode(filterDeptDeviceRequest.getUdiCode());
|
|
|
|
|
list = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
if (CustomUtil.isEmpty(list)) {
|
|
|
|
|
//用DI/物资编码查询
|
|
|
|
|
filterDeptDeviceRequest.setOriginCode(null);
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(filterDeptDeviceRequest.getUdiCode());
|
|
|
|
|
filterDeptDeviceRequest.setNameCode(udiEntity.getUdi());
|
|
|
|
|
filterDeptDeviceRequest.setBatchNo(udiEntity.getBatchNo());
|
|
|
|
|
filterDeptDeviceRequest.setProductionDate(udiEntity.getProduceDate());
|
|
|
|
|
filterDeptDeviceRequest.setExpireDate(udiEntity.getExpireDate());
|
|
|
|
|
filterDeptDeviceRequest.setSerialNo(udiEntity.getSerialNo());
|
|
|
|
|
list = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
list = deptDeviceDetailService.filterList(filterDeptDeviceRequest);
|
|
|
|
|
}
|
|
|
|
|
PageInfo<DeptDeviceDetailResponse> pageInfo = new PageInfo<>(list);
|
|
|
|
|
return ResultVOUtils.page(pageInfo);
|
|
|
|
|
}
|
|
|
|
|