md
This commit is contained in:
parent
c7be4092cd
commit
e26dc41d08
@ -36,7 +36,12 @@ 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;
|
||||
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;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import com.xdadan.erp.system.domain.SysFileInfo;
|
||||
import com.xdadan.erp.system.service.ISysFileInfoService;
|
||||
import com.xdadan.erp.system.service.ISysPostService;
|
||||
import com.xdadan.erp.system.service.ISysUserService;
|
||||
@ -44,8 +49,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
@ -343,6 +351,58 @@ public class WaybillController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
@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("服务器异常,联系客服");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Log(title = "OMS下单运费试算", businessType = BusinessType.OTHER)
|
||||
@PostMapping(value = "/calcProductFeeByOms")
|
||||
@ -393,6 +453,45 @@ public class WaybillController extends BaseController
|
||||
|
||||
|
||||
|
||||
@Log(title = "API获取寄件面单信息", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/getSendTplImageUrl")
|
||||
public String getSendTplImage(HttpServletRequest request, HttpServletResponse response, String billCode, String customerCode )
|
||||
{
|
||||
|
||||
if(!StringUtils.isEmpty(billCode)){
|
||||
try {
|
||||
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 "获取失败";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user