This commit is contained in:
linfso 2024-07-30 10:27:23 +08:00
parent 51a438e859
commit 780b9cbbaa
6 changed files with 229 additions and 34 deletions

View File

@ -0,0 +1,47 @@
/**
* @Project: emis
* @Title: EmisWaybillController.java
* @author linfso
* @date 2024-02-29 08:15:14
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 运单列表 控制器 </p>
*/
package com.xdadan.erp.oms.web;
import com.xdadan.erp.oms.common.core.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
* 运单列表Controller
*
* @author linfso
* @date 2024-02-29 08:15:14
*/
@Slf4j
@RestController
@RequestMapping("/oms2c/stockIn")
public class Oms2cStockInController extends BaseController
{
// @Autowired
// private IRpcStockInSvc iRpcStockInSvc;
//
// @RequestMapping("/getStockInList")
// public AjaxResult getStockInList(EmisWaybill emisWaybill)
// {
// return iRpcStockInSvc.getStockInList(emisWaybill);
// }
}

View File

@ -0,0 +1,115 @@
/**
* @Project: emis
* @Title: EmisWarehouseInController.java
* @author linfso
* @date 2024-05-22 00:20:31
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 进仓单 控制器 </p>
*/
package com.xdadan.erp.oms.web;
import com.xdadan.erp.oms.common.annotation.Log;
import com.xdadan.erp.oms.common.core.controller.BaseController;
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.common.core.page.PageDomain;
import com.xdadan.erp.oms.common.core.page.TableSupport;
import com.xdadan.erp.oms.common.enums.BusinessType;
import com.xdadan.erp.oms.domain.EmisWarehouseIn;
import com.xdadan.erp.oms.domain.vo.WaybillOrder;
import com.xdadan.erp.oms.service.svc.IRpcWarehouseInSvc;
import com.xdadan.erp.oms.service.svc.IRpcWaybillSvc;
import feign.Response;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;
/**
* 进仓单Controller
*
* @author linfso
* @date 2024-05-22 00:20:31
*/
@RestController
@RequestMapping("/oms2c/emisWarehouseIn")
public class Oms2cWarehouseInController extends BaseController
{
@Autowired
private IRpcWarehouseInSvc iRpcWarehouseInSvc;
/**
* 查询进仓单列表
*/
@GetMapping("/list")
public AjaxResult list(EmisWarehouseIn emisWarehouseIn)
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
return iRpcWarehouseInSvc.list(emisWarehouseIn,pageNum,pageSize);
}
@GetMapping("/listSimple")
public AjaxResult listSimple(EmisWarehouseIn emisWarehouseIn)
{
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
return iRpcWarehouseInSvc.listSimple(emisWarehouseIn,pageNum,pageSize);
}
/**
* 获取进仓单详细信息
*/
@GetMapping(value = "/getWarehouseInByInNo")
public AjaxResult getWarehouseInByInNo(EmisWarehouseIn emisWarehouseIn)
{
return iRpcWarehouseInSvc.getWarehouseInByInNo(emisWarehouseIn);
}
/**
* 导出进仓单模板
* @return
*/
@Log(title = "导出进仓单", businessType = BusinessType.EXPORT)
@PostMapping("/exportWarehouseInTpl")
public void exportWarehouseInTpl(HttpServletResponse servletResponse, @RequestBody WaybillOrder waybillOrder) throws IOException {
Response response = this.iRpcWarehouseInSvc.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

@ -124,38 +124,7 @@ public class Oms2cWaybillController extends BaseController
return this.iRpcWaybillSvc.draftSubmitOrderByOms(emisWaybillSave);
}
/**
* 导出进仓单模板
* @return
*/
@Log(title = "导出进仓单", businessType = BusinessType.EXPORT)
@PostMapping("/exportWarehouseInTpl")
public void exportWarehouseInTpl(HttpServletResponse servletResponse, @RequestBody WaybillOrder waybillOrder) throws IOException {
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();
}
}
/**
* 使用远程调用注意:统一使用api中心进行运费试算
@ -169,6 +138,21 @@ public class Oms2cWaybillController extends BaseController
return this.iRpcWaybillSvc.preCalcWaybillFeeByOms(waybillOrder);
}
/**
* 使用远程调用注意:统一使用api中心进行运费试算
* @param waybillOrder
* @return
*/
@Log(title = "运费试算", businessType = BusinessType.OTHER)
@PostMapping(value = "/calcProductFee")
public AjaxResult calcProductFee(@RequestBody WaybillOrder waybillOrder)
{
return this.iRpcWaybillSvc.preCalcWaybillFeeByOms(waybillOrder);
}
@GetMapping("/list")
public TableDataInfo list(EmisWaybill emisWaybill)
{
@ -241,7 +225,7 @@ public class Oms2cWaybillController extends BaseController
* @return
*/
@GetMapping("/listBindSalesmen")
public TableDataInfo listBindSalesmen(String searchValue)
public TableDataInfo listBindSalesmen(String searchValue,String blDefaultFlag)
{
startPage();
// "empCode": "业务员编码",

View File

@ -14,6 +14,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.xdadan.erp.oms.common.core.domain.BaseEntity;
import java.util.Date;
import com.xdadan.erp.oms.common.core.page.PageDomain;
import lombok.Data;

View File

@ -0,0 +1,39 @@
package com.xdadan.erp.oms.service.svc;
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.domain.EmisWarehouseIn;
import com.xdadan.erp.oms.domain.vo.WaybillOrder;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
* 仓库对货接口
*/
@FeignClient(name = "IRpcWarehouseInSvc",url = "${service.provider.url}",configuration = {FeignErrorDecoder.class})
public interface IRpcWarehouseInSvc {
@GetMapping("/apiweb/emisWarehouseIn/list")
public AjaxResult list(@RequestBody EmisWarehouseIn emisWarehouseIn,
@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize);
@GetMapping("/apiweb/emisWarehouseIn/listSimple")
public AjaxResult listSimple(@RequestBody EmisWarehouseIn emisWarehouseIn,
@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize);
@GetMapping("/apiweb/emisWarehouseIn/getWarehouseInByInNo")
public AjaxResult getWarehouseInByInNo(@RequestBody EmisWarehouseIn emisWarehouseIn);
@PostMapping(value = "/apiweb/emisWarehouseIn/exportWarehouseInTpl")
public Response exportWarehouseInTpl(@RequestBody WaybillOrder waybillOrder);
}

View File

@ -26,6 +26,16 @@ public interface IRpcWaybillSvc {
public AjaxResult preCalcWaybillFeeByOms(@RequestBody WaybillOrder waybillOrder);
/**
* 下单运费试算
* @param waybillOrder
* @return
*/
@PostMapping(value = "/apiweb/emisWaybill/calcProductFeeByOms")
public AjaxResult calcProductFee(@RequestBody WaybillOrder waybillOrder);
/**
* OMS实时下单
* @param waybillOrder
@ -70,7 +80,5 @@ public interface IRpcWaybillSvc {
@RequestParam("searchValue")String searchValue);
@PostMapping(value = "/apiweb/emisWaybill/exportWarehouseInTpl")
public Response exportWarehouseInTpl(@RequestBody WaybillOrder waybillOrder);
}