|
|
|
@ -2,17 +2,29 @@ package com.glxp.api.admin.controller.thrsys;
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.glxp.api.admin.constant.UdiInfoImportStatus;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.UdiEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.thrsys.ThrInvProductsEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.thrsys.ThrInvProductsExportLogEntity;
|
|
|
|
|
import com.glxp.api.admin.httpclient.ErpInvClient;
|
|
|
|
|
import com.glxp.api.admin.req.basic.FilterUdiEpLogRequest;
|
|
|
|
|
import com.glxp.api.admin.req.inout.DeleteRequest;
|
|
|
|
|
import com.glxp.api.admin.req.inventory.ErpOnhandRequest;
|
|
|
|
|
import com.glxp.api.admin.req.thrsys.FilterThrInvProductsRequest;
|
|
|
|
|
import com.glxp.api.admin.req.thrsys.ThrInvProductsExportRequest;
|
|
|
|
|
import com.glxp.api.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.admin.res.inventory.ErpInvProductResponse;
|
|
|
|
|
import com.glxp.api.admin.service.basic.BasicThirdSysDetailService;
|
|
|
|
|
import com.glxp.api.admin.service.thrsys.ThrInvProductsExportLogService;
|
|
|
|
|
import com.glxp.api.admin.service.thrsys.ThrInvProductsService;
|
|
|
|
|
import com.glxp.api.admin.thread.ThrInvProductsDlService;
|
|
|
|
|
import com.glxp.api.admin.util.CustomUtil;
|
|
|
|
|
import com.glxp.api.admin.util.FilterUdiUtils;
|
|
|
|
|
import com.glxp.api.common.enums.ResultEnum;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
@ -27,6 +39,7 @@ import java.io.IOException;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
public class ThrInvProductsExportLogController {
|
|
|
|
@ -34,6 +47,10 @@ public class ThrInvProductsExportLogController {
|
|
|
|
|
ThrInvProductsExportLogService thrInvProductsExportLogService;
|
|
|
|
|
@Resource
|
|
|
|
|
ThrInvProductsDlService thrInvProductsDlService;
|
|
|
|
|
@Resource
|
|
|
|
|
BasicThirdSysDetailService basicThirdSysDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
private ThrInvProductsService thrInvProductsService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/udiwms/invProducts/exportLog/filter")
|
|
|
|
|
public BaseResponse filter(FilterUdiEpLogRequest filterUdiEpLogReques,
|
|
|
|
@ -103,7 +120,6 @@ public class ThrInvProductsExportLogController {
|
|
|
|
|
@PostMapping("/udiwms/invProducts/importLog/export")
|
|
|
|
|
public BaseResponse excelDownload(@RequestBody ThrInvProductsExportRequest thrInvProductsExportRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String fileName = "D:\\udiwms\\exportFile\\" + "库存产品信息导出" + System.currentTimeMillis() + ".xls";
|
|
|
|
|
File file = new File(fileName);
|
|
|
|
|
if (!file.exists()) {
|
|
|
|
@ -124,8 +140,52 @@ public class ThrInvProductsExportLogController {
|
|
|
|
|
thrInvProductsDlService.genExcel(genKey, thrInvProductsExportRequest);
|
|
|
|
|
return ResultVOUtils.success("后台正在导出生成excel文件,请稍后刷新查看!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//第三方库存产品信息接口下载(第三方使用)
|
|
|
|
|
@GetMapping("/udiwms/thirdSys/invProducts/download")
|
|
|
|
|
public BaseResponse getOnhand(ErpOnhandRequest onhandQueryRequest,
|
|
|
|
|
BindingResult bindingResult) {
|
|
|
|
|
|
|
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
|
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
}
|
|
|
|
|
BasicThirdSysDetailEntity basicThirdSysDetailEntity = basicThirdSysDetailService.selectByKey("invPiUrl", onhandQueryRequest.getThirdSys());
|
|
|
|
|
String onHandUrl;
|
|
|
|
|
if (basicThirdSysDetailEntity == null || basicThirdSysDetailEntity.getValue() == null)
|
|
|
|
|
return ResultVOUtils.error(500, "ERP库存产品信息接口地址未定义");
|
|
|
|
|
else
|
|
|
|
|
onHandUrl = basicThirdSysDetailEntity.getValue();
|
|
|
|
|
if (!basicThirdSysDetailEntity.getEnabled()) {
|
|
|
|
|
return ResultVOUtils.error(500, "第三方库存信息服务未启用!");
|
|
|
|
|
}
|
|
|
|
|
if (basicThirdSysDetailEntity.getFromType() == 0 && !basicThirdSysDetailEntity.getItrCache()) {
|
|
|
|
|
|
|
|
|
|
BaseResponse<PageSimpleResponse<ErpInvProductResponse>> responseBaseResponse = new ErpInvClient().getInvPrdoductResponse(onhandQueryRequest, onHandUrl);
|
|
|
|
|
return responseBaseResponse;
|
|
|
|
|
} else {
|
|
|
|
|
FilterThrInvProductsRequest filterThrInvProductsRequest = new FilterThrInvProductsRequest();
|
|
|
|
|
BeanUtils.copyProperties(onhandQueryRequest, filterThrInvProductsRequest);
|
|
|
|
|
filterThrInvProductsRequest.setThirdSysFk(onhandQueryRequest.getThirdSys());
|
|
|
|
|
List<ThrInvProductsEntity> thrInvProductsEntities
|
|
|
|
|
= thrInvProductsService.filterThrInvProductss(filterThrInvProductsRequest);
|
|
|
|
|
List<ErpInvProductResponse> erpInvProductResponseList = thrInvProductsEntities.stream().map(item ->
|
|
|
|
|
{
|
|
|
|
|
ErpInvProductResponse erpInvProductResponse = new ErpInvProductResponse();
|
|
|
|
|
BeanUtils.copyProperties(item, erpInvProductResponse);
|
|
|
|
|
erpInvProductResponse.setCode(item.getInventoryCode());
|
|
|
|
|
erpInvProductResponse.setName(item.getInventoryName());
|
|
|
|
|
return erpInvProductResponse;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
PageInfo<ErpInvProductResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(erpInvProductResponseList);
|
|
|
|
|
PageSimpleResponse<ErpInvProductResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(erpInvProductResponseList);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|