2024-07-13 11:07:46 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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.apiweb;
|
|
|
|
|
|
2024-07-15 16:43:52 +00:00
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.xdadan.erp.common.annotation.Log;
|
2024-07-15 16:43:52 +00:00
|
|
|
import com.xdadan.erp.common.annotation.filter.jackson.JacksonFilter;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.xdadan.erp.common.config.PayConfig;
|
|
|
|
|
import com.xdadan.erp.common.core.controller.BaseController;
|
|
|
|
|
import com.xdadan.erp.common.core.domain.AjaxResult;
|
|
|
|
|
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
|
|
|
|
import com.xdadan.erp.common.core.page.TableDataInfo;
|
|
|
|
|
import com.xdadan.erp.common.enums.BusinessType;
|
|
|
|
|
import com.xdadan.erp.common.utils.DateUtils;
|
2024-07-30 22:44:24 +00:00
|
|
|
import com.xdadan.erp.common.utils.ServletUtils;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.xdadan.erp.common.utils.idgen.UUID;
|
2024-07-30 22:44:24 +00:00
|
|
|
import com.xdadan.erp.emis.domain.*;
|
2024-12-04 04:41:24 +00:00
|
|
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.xdadan.erp.emis.domain.enumtype.ScanType;
|
|
|
|
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
|
|
|
|
import com.xdadan.erp.emis.domain.vo.FeeItem;
|
|
|
|
|
import com.xdadan.erp.emis.domain.vo.WaybillOrder;
|
|
|
|
|
import com.xdadan.erp.emis.service.EmisBaseService;
|
|
|
|
|
import com.xdadan.erp.emis.service.IEmisElectronicSitePagService;
|
|
|
|
|
import com.xdadan.erp.emis.service.IEmisTmsScanRecordService;
|
|
|
|
|
import com.xdadan.erp.emis.service.IEmisWaybillService;
|
2024-12-22 14:20:32 +00:00
|
|
|
import com.xdadan.erp.emis.service.print.IXddTplPrint;
|
|
|
|
|
import com.xdadan.erp.emis.service.print.tanex.TanexPdfPrinter;
|
|
|
|
|
import com.xdadan.erp.emis.service.print.tanex.tmp.TanexTplPrintImpl;
|
|
|
|
|
import com.xdadan.erp.emis.utils.PrintUtils;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.xdadan.erp.emis.utils.WaybillHelper;
|
2024-12-22 14:20:32 +00:00
|
|
|
import com.xdadan.erp.system.domain.SysFileInfo;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.xdadan.erp.system.service.ISysFileInfoService;
|
2024-07-15 16:43:52 +00:00
|
|
|
import com.xdadan.erp.system.service.ISysPostService;
|
2024-07-13 11:07:46 +00:00
|
|
|
import com.xdadan.erp.system.service.ISysUserService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
2024-12-22 14:20:32 +00:00
|
|
|
import org.springframework.http.MediaType;
|
2024-07-13 11:07:46 +00:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
2024-12-22 14:20:32 +00:00
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
2024-07-13 11:07:46 +00:00
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.*;
|
2024-07-31 22:00:53 +00:00
|
|
|
import java.math.BigDecimal;
|
2024-07-13 11:07:46 +00:00
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 运单列表Controller
|
|
|
|
|
*
|
|
|
|
|
* @author linfso
|
|
|
|
|
* @date 2024-02-29 08:15:14
|
|
|
|
|
*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/apiweb/emisWaybill")
|
|
|
|
|
public class WaybillController extends BaseController
|
|
|
|
|
{
|
2024-07-15 16:43:52 +00:00
|
|
|
@Autowired
|
|
|
|
|
private ISysUserService userService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysPostService postService;
|
|
|
|
|
|
2024-07-13 11:07:46 +00:00
|
|
|
@Autowired
|
|
|
|
|
private IEmisWaybillService emisWaybillService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private EmisBaseService emisBaseService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysFileInfoService sysFileInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysUserService sysUserService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisElectronicSitePagService emisElectronicSitePagService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEmisTmsScanRecordService emisTmsScanRecordService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取电子运单信息
|
|
|
|
|
*/
|
2024-07-14 13:10:57 +00:00
|
|
|
@GetMapping(value = "/getWaybillDetailByOms")
|
|
|
|
|
public AjaxResult getWaybillDetailByOms(String billCode ,String orderSn)
|
2024-07-13 11:07:46 +00:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
WaybillOrder waybillOrder=null;
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(billCode) ){
|
|
|
|
|
return AjaxResult.error("参数错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
billCode= WaybillHelper.formatQueryValue(billCode);
|
|
|
|
|
if(!StringUtils.isEmpty(billCode) ){
|
|
|
|
|
boolean isExists=emisBaseService.checkWaybillIsExists(billCode);
|
|
|
|
|
if(!isExists){
|
|
|
|
|
return AjaxResult.error("运单不存在");
|
|
|
|
|
}
|
|
|
|
|
String mainBillCode=emisBaseService.getMainBillCode(billCode);
|
|
|
|
|
waybillOrder = emisWaybillService.getWaybillOrderByBillCode(mainBillCode);
|
|
|
|
|
if(waybillOrder==null){
|
|
|
|
|
return AjaxResult.error("运单不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 返回子单信息
|
|
|
|
|
waybillOrder.setBillCode(billCode);
|
|
|
|
|
|
|
|
|
|
}else if(!StringUtils.isEmpty(orderSn)){
|
|
|
|
|
waybillOrder = emisWaybillService.getWaybillOrderByOrderSn(orderSn);
|
|
|
|
|
if(waybillOrder==null){
|
|
|
|
|
return AjaxResult.error("订单不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取取件员电话
|
|
|
|
|
if(!StringUtils.isEmpty(waybillOrder.getTakePieceEmployeeCode())){
|
|
|
|
|
SysUser user= sysUserService.selectUserByUserName(waybillOrder.getTakePieceEmployeeCode());
|
|
|
|
|
waybillOrder.setTakePieceEmployeePhone(user.getPhonenumber());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("获取成功",waybillOrder);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-15 09:34:13 +00:00
|
|
|
@Log(title = "OMSExcel草稿方式下单", businessType = BusinessType.INSERT)
|
2024-07-14 13:10:57 +00:00
|
|
|
@PostMapping(value = "/draftSubmitOrderByOms")
|
|
|
|
|
public AjaxResult draftSubmitOrderByOms(@RequestBody EmisWaybill emisWaybillSave)
|
2024-07-13 11:07:46 +00:00
|
|
|
{
|
|
|
|
|
JSONObject jObjOut = new JSONObject();
|
|
|
|
|
String result="success";
|
|
|
|
|
String msg="下单成功";
|
|
|
|
|
try {
|
|
|
|
|
|
2025-01-02 22:47:46 +00:00
|
|
|
emisWaybillService.draftSubmitOrderByOms(emisWaybillSave);
|
2024-07-13 11:07:46 +00:00
|
|
|
jObjOut.put("billDetail", emisWaybillSave);
|
|
|
|
|
|
|
|
|
|
}catch(EmisBizError ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
|
|
|
|
|
result="fail";
|
|
|
|
|
msg=ex.getErrorCode()+":"+ex.getMessage();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (DuplicateKeyException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
result="fail";
|
|
|
|
|
msg="运单号重复";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
result="fail";
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
msg="系统异常:"+ex.getMessage();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
msg=((EmisBizError)ex).getErrorCode()+":"+ex.getMessage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
jObjOut.put("result", result);
|
|
|
|
|
jObjOut.put("msg", msg);
|
|
|
|
|
return AjaxResult.success("成功", jObjOut);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(title = "取消订单", businessType = BusinessType.INSERT)
|
2024-07-14 13:10:57 +00:00
|
|
|
@PostMapping(value = "/cancelOrderByOms")
|
|
|
|
|
public AjaxResult cancelOrderByOms(@Valid @RequestBody WaybillOrder waybillOrder)
|
2024-07-13 11:07:46 +00:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(waybillOrder.getOrderSn()) ){
|
|
|
|
|
return AjaxResult.error("订单号不能为空");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EmisWaybill emisWaybill = new EmisWaybill();
|
|
|
|
|
emisWaybill.setOrderSn(waybillOrder.getOrderSn());
|
2024-12-20 04:58:42 +00:00
|
|
|
emisWaybill.setBillCode(waybillOrder.getBillCode());
|
2024-07-13 11:07:46 +00:00
|
|
|
emisWaybill.setOrderRemark(waybillOrder.getOrderRemark());
|
|
|
|
|
emisWaybillService.cancelOrder(emisWaybill);
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("取消成功");
|
|
|
|
|
}catch(EmisBizError ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-14 13:10:57 +00:00
|
|
|
|
2024-07-30 22:44:24 +00:00
|
|
|
|
|
|
|
|
@Log(title = "API实时下单", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping(value = "/realMatchOrderApi")
|
|
|
|
|
public AjaxResult realMatchOrderApi(@RequestBody EmisWaybill emisWaybillSave)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
String appKey=ServletUtils.getHeaderValue("appKey");
|
|
|
|
|
String sign=ServletUtils.getHeaderValue("sign");
|
|
|
|
|
|
2024-07-30 23:10:30 +00:00
|
|
|
emisWaybillService.realMatchOrderApi(emisWaybillSave);
|
2024-07-30 22:44:24 +00:00
|
|
|
// 下单成功,查询下单数据
|
|
|
|
|
EmisWaybill newBill = emisBaseService.getWaybillByBillCode(emisWaybillSave.getBillCode());
|
|
|
|
|
|
|
|
|
|
JSONObject jObjOut = new JSONObject();
|
|
|
|
|
// 集包地,目的网点
|
|
|
|
|
String packageWdjc="";
|
|
|
|
|
try {
|
|
|
|
|
EmisSite destSite = emisBaseService.getSiteByCode(newBill.getDispatchUnderlingSiteCode());
|
|
|
|
|
packageWdjc=destSite.getSizeCode3();
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 三段码 山东淄博-越南胡志明
|
|
|
|
|
String threeCodeNum = newBill.getSendSiteName()+"-"+newBill.getDispatchUnderlingSiteName();
|
|
|
|
|
|
|
|
|
|
jObjOut.put("billCode",newBill.getBillCode());
|
|
|
|
|
jObjOut.put("packageWdjc",packageWdjc);
|
|
|
|
|
jObjOut.put("threeCodeNum",threeCodeNum);
|
|
|
|
|
|
|
|
|
|
jObjOut.put("sendCountryName",newBill.getSendCountryName());
|
|
|
|
|
jObjOut.put("destCountryName",newBill.getReceiveCountryName());
|
2024-08-01 06:16:06 +00:00
|
|
|
|
|
|
|
|
jObjOut.put("sendSiteName",newBill.getSendSiteName());
|
|
|
|
|
jObjOut.put("destSiteName",newBill.getDispatchUnderlingSiteName());
|
|
|
|
|
|
2024-07-30 22:44:24 +00:00
|
|
|
jObjOut.put("transLineTypeName",newBill.getTransLineTypeName());
|
|
|
|
|
jObjOut.put("productTypeName",newBill.getProductTypeName());
|
|
|
|
|
jObjOut.put("timeType",newBill.getTimeType());
|
|
|
|
|
return AjaxResult.success("下单成功", jObjOut);
|
|
|
|
|
}
|
|
|
|
|
catch (DuplicateKeyException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return AjaxResult.error("运单号重复");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
String msg="下单失败";
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
msg=((EmisBizError)ex).getErrorCode()+":"+ex.getMessage();
|
|
|
|
|
}
|
|
|
|
|
return AjaxResult.error(msg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-14 13:10:57 +00:00
|
|
|
@Log(title = "OMS实时下单", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping(value = "/realSubmitOrderByOms")
|
|
|
|
|
public AjaxResult realSubmitOrderByOms(@Valid @RequestBody WaybillOrder waybillOrder, Integer isModify)
|
2024-07-13 11:07:46 +00:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isEmpty(waybillOrder.getBillCode()) ){
|
2024-12-04 04:41:24 +00:00
|
|
|
try {
|
2024-12-04 04:38:12 +00:00
|
|
|
waybillOrder.setBillCode(emisElectronicSitePagService.realMatchWaybill(waybillOrder.getSendSiteCode(), "T7080"));
|
2024-12-04 04:41:24 +00:00
|
|
|
}catch(EmisBizError ex){
|
|
|
|
|
// 如果网点单号不足使用总部单号
|
|
|
|
|
if(EmisBizErrorType.NOT_ENOUGH_PAG.errorCode.equals(ex.getErrorCode()) ){
|
|
|
|
|
waybillOrder.setBillCode(emisElectronicSitePagService.realMatchWaybill("88888", "T7080"));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-13 11:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
|
|
|
|
|
2024-07-14 13:10:57 +00:00
|
|
|
emisWaybillService.realSubmitOrderByOms(emisWaybillSave);
|
2024-07-13 11:07:46 +00:00
|
|
|
|
|
|
|
|
JSONObject jObjOut = new JSONObject();
|
|
|
|
|
jObjOut.put("billCode", waybillOrder.getBillCode());
|
|
|
|
|
// jObjOut.put("prodName", waybillOrder.getProductType());
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("下单成功", jObjOut);
|
|
|
|
|
}catch(EmisBizError ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
catch (DuplicateKeyException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return AjaxResult.error("运单号重复!");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
2024-07-14 13:10:57 +00:00
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
2024-07-13 11:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-27 04:37:07 +00:00
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-07-13 11:07:46 +00:00
|
|
|
|
|
|
|
|
@Log(title = "运费试算", businessType = BusinessType.OTHER)
|
2024-07-14 13:10:57 +00:00
|
|
|
@PostMapping(value = "/preCalcWaybillFeeByOms")
|
|
|
|
|
public AjaxResult preCalcWaybillFeeByOms(@RequestBody WaybillOrder waybillOrder)
|
2024-07-13 11:07:46 +00:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
|
|
|
|
List<Map> estList=emisWaybillService.preCalcWaybillFee(emisWaybillSave);
|
|
|
|
|
return AjaxResult.success("试算成功", estList);
|
|
|
|
|
}
|
|
|
|
|
catch(EmisBizError ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-12-22 14:20:32 +00:00
|
|
|
@Log(title = "计算结算重量", businessType = BusinessType.OTHER)
|
|
|
|
|
@PostMapping(value = "/calcSetteldWeight")
|
|
|
|
|
public AjaxResult calcSetteldWeight(@RequestBody WaybillOrder waybillOrder)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
|
|
|
|
|
|
|
|
|
emisWaybillService.calcSettledWeight(emisWaybillSave);
|
|
|
|
|
|
|
|
|
|
JSONObject jObjRst = new JSONObject();
|
|
|
|
|
jObjRst.put("settlementWeight", emisWaybillSave.getSettlementWeight());
|
|
|
|
|
jObjRst.put("volumeWeight", emisWaybillSave.getVolumeWeight());
|
|
|
|
|
return AjaxResult.success("计算成功", jObjRst);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Log(title = "计算体积重量", businessType = BusinessType.OTHER)
|
|
|
|
|
@PostMapping(value = "/calcVolumeWeight")
|
|
|
|
|
public AjaxResult calcVolumeWeight(@RequestBody WaybillOrder waybillOrder)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
|
|
|
|
|
|
|
|
|
emisWaybillService.calcVolumeWeight(emisWaybillSave);
|
|
|
|
|
|
|
|
|
|
JSONObject jObjRst = new JSONObject();
|
|
|
|
|
jObjRst.put("volumeWeight", emisWaybillSave.getVolumeWeight());
|
|
|
|
|
return AjaxResult.success("计算成功", jObjRst);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-07-13 11:07:46 +00:00
|
|
|
|
2024-07-29 21:57:52 +00:00
|
|
|
@Log(title = "OMS下单运费试算", businessType = BusinessType.OTHER)
|
|
|
|
|
@PostMapping(value = "/calcProductFeeByOms")
|
|
|
|
|
public AjaxResult calcProductFeeByOms(@RequestBody WaybillOrder waybillOrder)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
EmisWaybill emisWaybillSave = waybillOrder.toDb();
|
2024-07-31 22:00:53 +00:00
|
|
|
|
|
|
|
|
if(emisWaybillSave.getTotalVolume()==null){
|
|
|
|
|
emisWaybillSave.setTotalVolume(BigDecimal.ZERO);
|
|
|
|
|
}
|
2024-07-29 21:57:52 +00:00
|
|
|
List<Map> estList=emisWaybillService.preCalcWaybillFee(emisWaybillSave);
|
|
|
|
|
|
|
|
|
|
// 如果没有报价,则使用该路线下的产品作为列表
|
|
|
|
|
if(CollectionUtil.isEmpty(estList)){
|
|
|
|
|
List<EmisTransProduct> prodList=emisBaseService.getTransProductByTransLine(emisWaybillSave.getTransLineType());
|
|
|
|
|
if(!CollectionUtil.isEmpty(prodList)){
|
2024-07-29 22:22:00 +00:00
|
|
|
estList = new ArrayList<>();
|
2024-07-29 21:57:52 +00:00
|
|
|
for (EmisTransProduct prod:prodList) {
|
|
|
|
|
Map<String, Object> estFeeMap = new HashMap<>();
|
|
|
|
|
estFeeMap.put("productType",prod.getProdCode());
|
|
|
|
|
estFeeMap.put("productTypeName",prod.getProdName()+"");
|
|
|
|
|
estFeeMap.put("agingDesc",prod.getAgingDesc());
|
|
|
|
|
estFeeMap.put("leastPrice","0");
|
|
|
|
|
estFeeMap.put("estFee","0");
|
|
|
|
|
estFeeMap.put("orderNum","0");
|
|
|
|
|
estList.add(estFeeMap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.success("试算成功", estList);
|
|
|
|
|
}
|
|
|
|
|
catch(EmisBizError ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return AjaxResult.error("("+ex.getErrorCode()+")"+ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
// 返回子定义异常
|
|
|
|
|
if(ex instanceof EmisBizError){
|
|
|
|
|
return AjaxResult.error(ex.getMessage(),((EmisBizError)ex).getErrorCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return AjaxResult.error("服务器异常,联系客服");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-22 14:20:32 +00:00
|
|
|
@Log(title = "API获取寄件面单信息", businessType = BusinessType.OTHER)
|
|
|
|
|
@GetMapping("/getSendTplImageUrl")
|
2024-12-27 05:30:24 +00:00
|
|
|
public String getSendTplImageUrl(HttpServletRequest request, HttpServletResponse response, String billCode, String customerCode )
|
2024-12-22 14:20:32 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(billCode)){
|
|
|
|
|
try {
|
2024-12-22 23:23:29 +00:00
|
|
|
|
|
|
|
|
// 非客户的单子不允许获取
|
2024-12-22 14:20:32 +00:00
|
|
|
String uuid = UUID.fastUUID().toString();
|
|
|
|
|
|
|
|
|
|
String printManCode="LP";
|
|
|
|
|
|
|
|
|
|
String tplCode="TAN-GOT-130";
|
|
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
|
|
response.setContentType(MediaType.IMAGE_PNG_VALUE);
|
|
|
|
|
response.setHeader("Content-Disposition", "filename=" + uuid+".png");
|
|
|
|
|
OutputStream os=response.getOutputStream();
|
|
|
|
|
|
|
|
|
|
Map<String, Object> order = emisBaseService.getWaybillPrintOrder(billCode, "1,1",tplCode, "zh", tplCode,printManCode);
|
|
|
|
|
if(order!=null) {
|
|
|
|
|
IXddTplPrint tplPrint = new TanexPdfPrinter();
|
|
|
|
|
tplPrint.genPNG(order,tplCode,"", os);
|
|
|
|
|
}else{
|
|
|
|
|
log.debug("获取运单信息失败");
|
|
|
|
|
return "获取失败";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
return "获取失败";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "获取失败";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-29 21:57:52 +00:00
|
|
|
|
2024-07-13 11:07:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-15 16:43:52 +00:00
|
|
|
|
2024-07-13 11:07:46 +00:00
|
|
|
}
|