This commit is contained in:
linfso 2024-07-29 17:24:29 +08:00
parent 48457ffaf0
commit 8acf5bf865
2 changed files with 29 additions and 3 deletions

View File

@ -13,6 +13,7 @@ package com.xdadan.erp.oms.web;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
@ -37,6 +38,7 @@ import com.xdadan.erp.oms.service.svc.IRpcWaybillSvc;
import com.xdadan.erp.oms.service.svc.IRpcWmsWarehouseSvc; import com.xdadan.erp.oms.service.svc.IRpcWmsWarehouseSvc;
import com.xdadan.erp.oms.system.domain.SysOmsUserRole; import com.xdadan.erp.oms.system.domain.SysOmsUserRole;
import com.xdadan.erp.oms.system.service.ISysOmsUserService; import com.xdadan.erp.oms.system.service.ISysOmsUserService;
import feign.Response;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -128,8 +130,31 @@ public class Oms2cWaybillController extends BaseController
*/ */
@Log(title = "导出进仓单", businessType = BusinessType.EXPORT) @Log(title = "导出进仓单", businessType = BusinessType.EXPORT)
@PostMapping("/exportWarehouseInTpl") @PostMapping("/exportWarehouseInTpl")
public void exportWarehouseInTpl(WaybillOrder waybillOrder) { public void exportWarehouseInTpl(HttpServletResponse servletResponse, @RequestBody WaybillOrder waybillOrder) throws IOException {
this.iRpcWaybillSvc.exportWarehouseInTpl(waybillOrder);
Response response = this.iRpcWaybillSvc.exportWarehouseInTpl(waybillOrder);
Response.Body body = response.body();
for (Object key : response.headers().keySet()) {
List<String> kList = (List<String>) response.headers().get(key);
for (String val : kList) {
servletResponse.setHeader(key.toString(), val);
}
}
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = body.asInputStream();
outputStream = servletResponse.getOutputStream();
byte[] b = new byte[inputStream.available()];
inputStream.read(b);
outputStream.write(b);
outputStream.flush();
} catch (IOException e) {
System.out.println("失败了");
}finally {
inputStream.close();
outputStream.close();
}
} }
/** /**

View File

@ -4,6 +4,7 @@ package com.xdadan.erp.oms.service.svc;
import com.xdadan.erp.oms.common.core.domain.AjaxResult; import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.domain.EmisWaybill; import com.xdadan.erp.oms.domain.EmisWaybill;
import com.xdadan.erp.oms.domain.vo.WaybillOrder; import com.xdadan.erp.oms.domain.vo.WaybillOrder;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -70,6 +71,6 @@ public interface IRpcWaybillSvc {
@PostMapping(value = "/apiweb/emisWaybill/exportWarehouseInTpl") @PostMapping(value = "/apiweb/emisWaybill/exportWarehouseInTpl")
public void exportWarehouseInTpl(@RequestBody WaybillOrder waybillOrder); public Response exportWarehouseInTpl(@RequestBody WaybillOrder waybillOrder);
} }