|
|
|
@ -4,14 +4,14 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.udi.admin.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.OrderMdEntity;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.TraceUploadEntity;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.UdiInfoEntity;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.WarehouseEntity;
|
|
|
|
|
import com.glxp.udi.admin.entity.inout.*;
|
|
|
|
|
import com.glxp.udi.admin.entity.udid.UdiEntity;
|
|
|
|
|
import com.glxp.udi.admin.exception.JsonException;
|
|
|
|
|
import com.glxp.udi.admin.mongo.service.InvProductDetailMdService;
|
|
|
|
|
import com.glxp.udi.admin.mongo.service.InvProductMdService;
|
|
|
|
|
import com.glxp.udi.admin.mongo.service.OrderMdService;
|
|
|
|
|
import com.glxp.udi.admin.mongo.service.WarehouseMdService;
|
|
|
|
|
import com.glxp.udi.admin.req.inout.FilterInvProductDetailRequest;
|
|
|
|
|
import com.glxp.udi.admin.req.inout.FilterUdiInfoRequest;
|
|
|
|
|
import com.glxp.udi.admin.req.inout.OrderFilterRequest;
|
|
|
|
|
import com.glxp.udi.admin.req.inout.WarehouseQueryRequest;
|
|
|
|
@ -60,6 +60,11 @@ public class UdiTraceController {
|
|
|
|
|
AuthAdminService authAdminService;
|
|
|
|
|
@Resource
|
|
|
|
|
private OrderMdService orderMdService;
|
|
|
|
|
@Resource
|
|
|
|
|
private InvProductMdService invProductMdService;
|
|
|
|
|
@Resource
|
|
|
|
|
private InvProductDetailMdService invProductDetailMdService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/udiwarehouse/trace/filter")
|
|
|
|
|
public BaseResponse list(WarehouseQueryRequest warehouseQueryRequest) {
|
|
|
|
@ -160,13 +165,14 @@ public class UdiTraceController {
|
|
|
|
|
if (warehouseQueryRequest.getCode() != null && !"".equals(warehouseQueryRequest.getCode())) {
|
|
|
|
|
if (warehouseQueryRequest.getFilterType() == null || warehouseQueryRequest.getFilterType() == 1) {
|
|
|
|
|
List<OrderMdEntity> temps = filterUdiTrace(warehouseQueryRequest);
|
|
|
|
|
orderMdEntities.addAll(temps);
|
|
|
|
|
if (temps != null)
|
|
|
|
|
orderMdEntities.addAll(temps);
|
|
|
|
|
} else {
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(warehouseQueryRequest.getCode());
|
|
|
|
|
if (udiEntity == null)
|
|
|
|
|
return ResultVOUtils.error(500, "UDI码格式错误!");
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udiEntity.getUdi(), customerId);
|
|
|
|
|
List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiInfoEntity.getUuid(),customerId);
|
|
|
|
|
List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiInfoEntity.getUuid(), customerId);
|
|
|
|
|
if (udiInfoEntities != null && udiInfoEntities.size() > 0) {
|
|
|
|
|
for (UdiInfoEntity temp : udiInfoEntities) {
|
|
|
|
|
WarehouseQueryRequest queryRequest = new WarehouseQueryRequest();
|
|
|
|
@ -192,27 +198,62 @@ public class UdiTraceController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<OrderMdEntity> filterUdiTrace(WarehouseQueryRequest warehouseQueryRequest) {
|
|
|
|
|
List<OrderMdEntity> orderMdEntities = new ArrayList<>();
|
|
|
|
|
List<WarehouseEntity> warehouseEntityList = warehouseMdService.filterWarehouse(warehouseQueryRequest);
|
|
|
|
|
List<String> orderS = new ArrayList<>();
|
|
|
|
|
warehouseEntityList.stream().filter(
|
|
|
|
|
v -> {
|
|
|
|
|
boolean flag = !orderS.contains(v.getOrderId());
|
|
|
|
|
if (flag)
|
|
|
|
|
orderS.add(v.getOrderId());
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
String code = warehouseQueryRequest.getCode();
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
|
|
|
|
|
List<InvProductDetailEntity> invProductDetailEntities;
|
|
|
|
|
if (udiEntity.getSerialNo() != null) { //有序列号
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udiEntity.getUdi(), warehouseQueryRequest.getCustomerId() + "");
|
|
|
|
|
List<UdiInfoEntity> udiInfoEntities = udiInfoService.findByUuids(udiInfoEntity.getUuid(), warehouseQueryRequest.getCustomerId() + "");
|
|
|
|
|
if (udiInfoEntities != null) {
|
|
|
|
|
if (udiInfoEntities.size() > 1) {//多级包装,查所有
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setProductIdFk(udiInfoEntity.getUuid());
|
|
|
|
|
filterInvProductDetailRequest.setBatchNo(udiEntity.getBatchNo());
|
|
|
|
|
if (warehouseQueryRequest.getCustomerId() != null)
|
|
|
|
|
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
|
|
|
|
|
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
|
|
|
|
|
} else if (udiInfoEntities.size() == 1) { //单级包装,且唯一查询条码
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setCode(warehouseQueryRequest.getCode());
|
|
|
|
|
if (warehouseQueryRequest.getCustomerId() != null)
|
|
|
|
|
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
|
|
|
|
|
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
|
|
|
|
|
} else
|
|
|
|
|
return null;
|
|
|
|
|
} else
|
|
|
|
|
return null;
|
|
|
|
|
} else {
|
|
|
|
|
UdiInfoEntity udiInfoEntity = udiInfoService.findByNameCode(udiEntity.getUdi(), warehouseQueryRequest.getCustomerId() + "");
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setProductIdFk(udiInfoEntity.getUuid());
|
|
|
|
|
filterInvProductDetailRequest.setBatchNo(udiEntity.getBatchNo());
|
|
|
|
|
if (warehouseQueryRequest.getCustomerId() != null)
|
|
|
|
|
filterInvProductDetailRequest.setCustomerId(warehouseQueryRequest.getCustomerId() + "");
|
|
|
|
|
invProductDetailEntities = invProductDetailMdService.filterAllInvProduct(filterInvProductDetailRequest);
|
|
|
|
|
}
|
|
|
|
|
if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) {
|
|
|
|
|
List<OrderMdEntity> orderMdEntities = new ArrayList<>();
|
|
|
|
|
List<String> orderS = new ArrayList<>();
|
|
|
|
|
invProductDetailEntities.stream().filter(
|
|
|
|
|
v -> {
|
|
|
|
|
boolean flag = !orderS.contains(v.getOrderIdFk());
|
|
|
|
|
if (flag)
|
|
|
|
|
orderS.add(v.getOrderIdFk());
|
|
|
|
|
return flag;
|
|
|
|
|
}
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String orderId : orderS) {
|
|
|
|
|
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
|
|
|
|
|
orderFilterRequest.setId(orderId);
|
|
|
|
|
List<OrderMdEntity> temps = orderMdService.findAll(orderFilterRequest);
|
|
|
|
|
orderMdEntities.addAll(temps);
|
|
|
|
|
}
|
|
|
|
|
Collections.sort(orderMdEntities, Comparator.comparing(OrderMdEntity::getId));
|
|
|
|
|
return orderMdEntities;
|
|
|
|
|
for (String orderId : orderS) {
|
|
|
|
|
OrderFilterRequest orderFilterRequest = new OrderFilterRequest();
|
|
|
|
|
orderFilterRequest.setId(orderId);
|
|
|
|
|
List<OrderMdEntity> temps = orderMdService.findAll(orderFilterRequest);
|
|
|
|
|
orderMdEntities.addAll(temps);
|
|
|
|
|
}
|
|
|
|
|
Collections.sort(orderMdEntities, Comparator.comparing(OrderMdEntity::getId));
|
|
|
|
|
return orderMdEntities;
|
|
|
|
|
} else return null;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/coor/trace/findCode")
|
|
|
|
|