import BaseController from "../baseController";
|
import { Post } from "egg-shell-decorators";
|
import { ExpressQZPortOrder } from '../../entity/express/ldg/expressQZPortOrder';
|
|
export default class expressLdgOrder extends BaseController {
|
//#region 通过陆地港推送运单 pushOrderByLdg
|
/// <summary>
|
///通过陆地港推送运单 pushOrderByLdg
|
/// </summary>
|
/// <returns>返回获取快递单号结果</returns>
|
///
|
@Post()
|
public async pushOrderByLdg() {
|
let { ctx } = this;
|
let body = ctx.request.body;
|
try {
|
//#region 校验数据
|
|
if (!body.orderIdList) {
|
this.info.result = false;
|
this.info.msg = "至少选择一条记录!";
|
ctx.body = this.info;
|
return;
|
}
|
//#endregion
|
let orderIdList = body.orderIdList.split(",");
|
var aLLSuccess = true;
|
var msg = "返回信息:";
|
for (let orderId of orderIdList) {
|
let info = null;
|
info = await ctx.service.express.ldgHelper.pushOrderByLgd(orderId);
|
if (!info.result) {
|
aLLSuccess = false;
|
}
|
msg = msg + info.msg;
|
}
|
this.info.result = aLLSuccess;
|
this.info.msg = msg;
|
ctx.body = this.info;
|
return;
|
} catch (ex) {
|
this.info.result = false;
|
this.info.msg = ex.message;
|
ctx.body = this.info;
|
return;
|
}
|
}
|
// #endregion
|
|
// #region 通过陆地港轮询获取所有泉州顺丰圆通快递单号, 用于作业调度使用 getLdgExpressCodeByNode
|
public async getLdgExpressCodeByNode() {
|
let { ctx } = this;
|
// let body = ctx.request.body;
|
try {
|
// var pageIndex = body.pageIndex
|
var infoStr = await ctx.service.tms.routerHelper.getLdgExpressCodeByNode();
|
this.info.result = infoStr.result;
|
this.info.msg = infoStr.msg;
|
ctx.body = this.info;
|
return;
|
} catch (ex) {
|
this.info.result = false;
|
this.info.msg = ex.message;
|
ctx.body = this.info;
|
return;
|
}
|
}
|
// #endregion
|
|
// #region 获取路由
|
@Post()
|
public async getRouter() {
|
let { ctx } = this;
|
// let body = ctx.request.body;
|
try {
|
let orderCodeList = this.body.orderCodeList;
|
for (let expressNo of orderCodeList) {
|
let orderInfo = await this.dbRead.findOne(ExpressQZPortOrder, {
|
orderCode: expressNo
|
});
|
if(orderInfo.expressCorpName=="陆地港顺丰"){
|
this.info.msg = await ctx.service.express.ldgHelper.getRoute(orderInfo.mailno);
|
}
|
else if(orderInfo.expressCorpName=="陆地港圆通")
|
{
|
var ldgResultInfo = await ctx.service.express.ldgHelper.getRouteByYT(orderInfo.mailno);
|
this.info.msg = ldgResultInfo.msg;
|
}
|
}
|
this.info.result = true;
|
ctx.body = this.info;
|
} catch (ex) {
|
this.info.result = false;
|
this.info.msg = ex.message;
|
ctx.body = this.info;
|
}
|
}
|
// #endregion
|
}
|