You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Dispatch/Controllers/DispatchController.cs

1490 lines
61 KiB
C#

2 years ago

using DSWeb.Areas.Dispatch.DB;
using DSWeb.Areas.Dispatch.Models;
using System.Web.Mvc;
using System.Linq;
using System.Configuration;
using DSWeb.Areas.Dispatch.Helper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Web;
using System.Globalization;
using DSWeb.Dispatch.DAL;
using log4net;
using HcUtility.Comm;
using DSWeb.SoftMng.BLL;
using DSWeb.SoftMng.Model;
using DSWeb.SoftMng.Common;
2 years ago
using System.Net.Http;
using System.Text;
using System.Web.Http;
using Dingtalk;
using System.IO;
2 years ago
using DSWeb.Areas.CommMng.DAL;
using DSWeb.MvcShipping.DAL.MsCodeDingTalkSet;
1 year ago
using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
using DSWeb.MvcShipping.Models.MsOpSeae;
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
using MsOpSeaeDAL = DSWeb.Dispatch.DAL.MsOpSeaeDAL;
1 year ago
using System.Data.Entity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
2 years ago
namespace DSWeb.Areas.Dispatch.Controllers
{
public class DispatchController : Controller
{
private static readonly string StateKeyRegist = "regist";
private static readonly string StateKeyDispatchList = "dispatchlist";
private static readonly string StateKeyGrabList = "grablist";
private static readonly string StateKeyFeeList = "feelist";
private static readonly string StateKeyRegistCust = "registCust";
private static readonly string StateKeyOpSeaeList = "opseaelist";
private static readonly string StateKeyStockList = "stocklist"; //虎鲸库存查询
private static readonly string StateKeyRegistCustHJ = "registCustHJ"; //虎鲸注册
private static string appid = ConfigurationManager.AppSettings["BeitongDispatchAppId"];
private static string appsecret = ConfigurationManager.AppSettings["secret"]; //string.Empty;
private static string dispatchServerUrl = ConfigurationManager.AppSettings["BeitongDispatchServerUrl"];
private ILog logger = LogManager.GetLogger("DispatchController");
private DataContext dataContext = new DataContext();
public DispatchController()
{
//var config = dataContext.MpConfigs.FirstOrDefault(c => c.AppId == appid);
//if (config == null)
//{
// throw new Exception($"未找到公众号ID: {appid}) 的配置记录,请配置后再试!");
//}
//appsecret = config.AppSecret;
}
#region 授权跳转
public ActionResult AuthRedirect(string code, string state)
{
try
{
var url = $"https://api.weixin.qq.com/sns/oauth2/access_token?appid={appid}&secret={appsecret}&code={code}&grant_type=authorization_code";
string rtnStr = WebRequestHelper.DoGet(url);
var obj = new { access_token = "", expires_in = 0, refresh_token = "", openid = "", scope = "" };
var jsonObj = JsonConvert.DeserializeAnonymousType(rtnStr, obj);
if (state == StateKeyRegist)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Dispatch/DriverRegist?openid={jsonObj.openid}");
}
else if (state == StateKeyDispatchList)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Dispatch/DispatchList?openid={jsonObj.openid}");
}
else if (state == StateKeyGrabList)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Dispatch/GrabList?openid={jsonObj.openid}");
}
else if (state == StateKeyFeeList)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Dispatch/FeeList?openid={jsonObj.openid}");
}
else if (state == StateKeyRegistCust)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Dispatch/DispInfoClientRegist?openid={jsonObj.openid}");
}
else if (state == StateKeyRegistCustHJ)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Stock/Regist?openid={jsonObj.openid}");
}
else if (state == StateKeyOpSeaeList)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Dispatch/SaleOpSeaeList?openid={jsonObj.openid}");
}
else if (state == StateKeyStockList)
{
return Redirect($"{dispatchServerUrl}/Dispatch/Stock/StockTakeList?openid={jsonObj.openid}");
}
else
{
return Content($"非法请求");
}
}
catch (Exception ex)
{
return Content($"出错啦:{ex.Message}");
}
}
#endregion
#region 司机注册
public ActionResult DriverRegist(string openid)
{
if (!string.IsNullOrWhiteSpace(openid))
{
var driver = dataContext.Drivers.FirstOrDefault(d => d.OpenId == openid);
if (driver != null)
{
var driverModel = driver.AsDriverRegistViewModel();
ViewData["driver"] = driverModel;
ViewData["isAudit"] = driver.IsAudit;
}
else
{
ViewData["driver"] = new DriverRegistViewModel();
ViewData["isAudit"] = false; ;
}
ViewData["openid"] = openid;
ViewData["truckList"] = dataContext.InfoClients.Where(c => c.ISTRUCK == true).AsInfoClientTruckViewModelList();
return View();
}
else
{
return Content("非法请求_driver");
}
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult Regist(DriverRegistViewModel model)
{
RespCommon resp = new RespCommon();
if (!string.IsNullOrWhiteSpace(model.OpenId))
{
var driver = dataContext.Drivers.FirstOrDefault(d => d.OpenId == model.OpenId);
if (driver == null)
{
driver = model.AsDriverInfo();
dataContext.Drivers.Add(driver);
}
else
{
model.AsDriverInfo(driver);
}
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
}
else
{
resp.Success = false;
resp.Message = "参数无效";
}
return Json(resp);
}
#endregion
#region 司机审核
public ActionResult DriverAuditList()
{
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DriverAuditData(int offset, int limit, bool? isAudit)
{
RespDriverAuditList resp = new RespDriverAuditList();
if (isAudit.HasValue)
{
resp.Total = dataContext.Drivers.Where(d => d.IsAudit == isAudit.Value).Count();
resp.Data = dataContext.Drivers.Where(d => d.IsAudit == isAudit.Value).OrderBy(d => d.RegTime).Skip(offset).Take(limit).AsDriverAuditViewModelList();
}
else
{
resp.Total = dataContext.Drivers.Count();
resp.Data = dataContext.Drivers.OrderBy(d => d.RegTime).Skip(offset).Take(limit).AsDriverAuditViewModelList();
}
return Json(resp);
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DriverAudit(string gid, string infoClient)
{
RespCommon resp = new RespCommon();
var driver = dataContext.Drivers.FirstOrDefault(d => d.GID == gid);
if (driver != null)
{
driver.InfoClient = infoClient;
driver.IsAudit = true;
}
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
#endregion
#region 派车
public ActionResult DispatchList(string openid)
{
var driver = dataContext.Drivers.FirstOrDefault(d => d.OpenId == openid);
if (driver == null)
{
return RedirectToAction("DriverRegist", new { openid });
}
ViewData["openid"] = openid;
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DispatchData(string openid, int page = 1, int pageSize = 10)
{
var query = from d in dataContext.Drivers
join t in dataContext.OpLetterTrucks on d.InfoClient equals t.TRUCK
join l in dataContext.OpLetters on t.LE_ID equals l.LE_ID
join s in dataContext.OpSeaes on t.BSNO equals s.BSNO
where d.IsAudit == true && d.OpenId == openid && t.TRUCKSTATUS == "已派车"
select new DispatchListViewModel
{
VESSEL = s.VESSEL,
VOYNO = s.VOYNO,
MBLNO = s.MBLNO,
CTNS = t.CTNS,
KGS = t.KGS,
TRUCKFEE = t.TRUCKFEE,
YARD = t.YARD,
FACTRYNAME = t.FACTRYNAME,
FACTRYADDR = t.FACTRYADDR,
FACTRYTIME = t.FACTRYTIME,
CLOSINGDATE = t.CLOSINGDATE,
LE_ID = t.LE_ID,
INPUTBY = l.INPUTBY,
HEAD_FMTEL = l.HEAD_FMTEL,
FeeSum = dataContext.ChFees.Where(f => f.BSNO == t.BSNO && f.CUSTOMERNAME == t.TRUCK && f.CARGO_GID == t.LE_ID && f.FEETYPE == 2 && (f.FEESTATUS == 0 || f.FEESTATUS == 8 || f.FEESTATUS == 9)).Sum(f => f.AMOUNT)
};
int count = query.Count();
List<DispatchListViewModel> list = query.OrderByDescending(x => x.FACTRYTIME).Skip((page - 1) * pageSize).Take(pageSize).ToList();
return Json(new { total = count, page, pageSize, list });
}
public ActionResult DispatchListMonth(string openid, string month)
{
var driver = dataContext.Drivers.FirstOrDefault(d => d.OpenId == openid);
if (driver == null)
{
return RedirectToAction("DriverRegist", new { openid });
}
ViewData["openid"] = openid;
ViewData["month"] = month;
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DispatchDataMonth(string openid, string month, int page = 1, int pageSize = 10)
{
string strDateStart = string.Empty;
string strDateEnd = string.Empty;
if (!string.IsNullOrWhiteSpace(month))
{
DateTime dtMonth = DateTime.ParseExact(month, "yyyyMM", CultureInfo.InvariantCulture);
strDateStart = dtMonth.ToString("yyyy-MM-01 00:00:00");
strDateEnd = dtMonth.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd 23:59:59");
}
else
{
return Json(new { total = 0, page, pageSize });
}
var query = from d in dataContext.Drivers
join t in dataContext.OpLetterTrucks on d.InfoClient equals t.TRUCK
join l in dataContext.OpLetters on t.LE_ID equals l.LE_ID
join s in dataContext.OpSeaes on t.BSNO equals s.BSNO
where d.IsAudit == true && d.OpenId == openid
select new DispatchListViewModel
{
VESSEL = s.VESSEL,
VOYNO = s.VOYNO,
MBLNO = s.MBLNO,
CTNS = t.CTNS,
KGS = t.KGS,
TRUCKFEE = t.TRUCKFEE,
YARD = t.YARD,
FACTRYNAME = t.FACTRYNAME,
FACTRYADDR = t.FACTRYADDR,
FACTRYTIME = t.FACTRYTIME,
CLOSINGDATE = t.CLOSINGDATE,
LE_ID = t.LE_ID,
INPUTBY = l.INPUTBY,
HEAD_FMTEL = l.HEAD_FMTEL,
FeeSum = dataContext.ChFees.Where(f => f.BSNO == t.BSNO && f.CUSTOMERNAME == t.TRUCK && f.CARGO_GID == t.LE_ID && f.FEETYPE == 2 && (f.FEESTATUS == 0 || f.FEESTATUS == 8 || f.FEESTATUS == 9)).Sum(f => f.AMOUNT),
NoDui = dataContext.ChFees.Count(f => f.BSNO == t.BSNO && f.CUSTOMERNAME == t.TRUCK && f.CARGO_GID == t.LE_ID && f.FEETYPE == 2 && (f.FEESTATUS == 0 || f.FEESTATUS == 8 || f.FEESTATUS == 9) && (!f.CUSTDUI.HasValue || !f.CUSTDUI.Value))
};
int count = query.Where(x => x.FACTRYTIME.CompareTo(strDateStart) >= 0 && x.FACTRYTIME.CompareTo(strDateEnd) <= 0).Count();
List<DispatchListViewModel> list = query.Where(x => x.FACTRYTIME.CompareTo(strDateStart) >= 0 && x.FACTRYTIME.CompareTo(strDateEnd) <= 0).OrderByDescending(x => x.FACTRYTIME).Skip((page - 1) * pageSize).Take(pageSize).ToList();
return Json(new { total = count, page, pageSize, list });
}
#region 派车详情
public ActionResult DispatchDetail(string leid, bool hideFee = true, string openid = null)
{
if (!string.IsNullOrEmpty(openid))
{
var lt = dataContext.OpLetterTrucks.AsNoTracking().FirstOrDefault(l => l.LE_ID == leid);
var dri = dataContext.Drivers.AsNoTracking().FirstOrDefault(d => d.OpenId == openid);
if (dri == null)
{
return Content("参数有误");
}
if (lt.TRUCK != dri.InfoClient)
{
return Content("无法查看派车信息");
}
}
var query = from t in dataContext.OpLetterTrucks
join l in dataContext.OpLetters on t.LE_ID equals l.LE_ID
join s in dataContext.OpSeaes on t.BSNO equals s.BSNO
where t.LE_ID == leid
select new DispatchDetailViewModel
{
VESSEL = s.VESSEL,
VOYNO = s.VOYNO,
MBLNO = s.MBLNO,
CTNS = t.CTNS,
KGS = t.KGS,
TRUCKFEE = t.TRUCKFEE,
YARD = t.YARD,
FACTRYNAME = t.FACTRYNAME,
FACTRYADDR = t.FACTRYADDR,
FACTRYTIME = t.FACTRYTIME,
CLOSINGDATE = t.CLOSINGDATE,
LE_ID = t.LE_ID,
TRUCKSTATUS = t.TRUCKSTATUS,
REMARK = t.REMARK,
INPUTBY = l.INPUTBY,
HEAD_FMTEL = l.HEAD_FMTEL
};
var obj = query.FirstOrDefault();
ViewData["Data"] = obj;
ViewData["LEID"] = leid;
ViewData["HideFee"] = hideFee;
//费用列表
var queryFee = from t in dataContext.OpLetterTrucks
join s in dataContext.ChFees on new { t.BSNO, Name = t.TRUCK, LEID = t.LE_ID } equals new { s.BSNO, Name = s.CUSTOMERNAME, LEID = s.CARGO_GID }
where t.LE_ID == leid && s.FEETYPE == 2 && (s.FEESTATUS == 0 || s.FEESTATUS == 8 || s.FEESTATUS == 9)
select new MpFeeListViewModel
{
FEENAME = s.FEENAME,
AMOUNT = s.AMOUNT,
UNITPRICE = s.UNITPRICE,
QUANTITY = s.QUANTITY,
REMARK = s.REMARK,
CUSTDUI = s.CUSTDUI,
CUSTDUI_STR = (s.CUSTDUI.HasValue && s.CUSTDUI.Value) ? "已核对" : "未核对"
};
var feeList = queryFee.ToList();
ViewData["FeeList"] = feeList;
ViewData["NoDuiCount"] = feeList.Count(f => !f.CUSTDUI.HasValue || f.CUSTDUI == false);
return View();
}
public ActionResult DispatchFeeList(string leid)
{
var opTruck = dataContext.OpLetterTrucks.First(t => t.LE_ID == leid);
ViewData["LEID"] = leid;
ViewData["TRUCKFEE"] = opTruck.TRUCKFEE;
var task = dataContext.OpTasks.FirstOrDefault(t => t.TASKNO == leid);
ViewData["ShowConfirm"] = task.TASKTYPE == "派车中";
return View();
}
//费用核对
public ActionResult FeeDuiForTruck(string leid)
{
RespCommon resp = new RespCommon();
var queryFee = from t in dataContext.OpLetterTrucks
join s in dataContext.ChFees on new { t.BSNO, Name = t.TRUCK, LEID = t.LE_ID } equals new { s.BSNO, Name = s.CUSTOMERNAME, LEID = s.CARGO_GID }
where t.LE_ID == leid && s.FEETYPE == 2 && (s.FEESTATUS == 0 || s.FEESTATUS == 8 || s.FEESTATUS == 9)
select s;
foreach (var item in queryFee)
{
item.CUSTDUI = true;
}
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
//确认接单
public ActionResult DispatchConfirm(string leid)
{
RespCommon resp = new RespCommon();
var task = dataContext.OpTasks.FirstOrDefault(t => t.TASKNO == leid);
task.TASKTYPE = "已派车";
var opTruck = dataContext.OpLetterTrucks.First(t => t.LE_ID == leid);
opTruck.TRUCKSTATUS = "已派车";
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
#endregion
#endregion
#region 费用账单
2 years ago
[System.Web.Mvc.HttpGet]
2 years ago
public ActionResult FeeList(string openid)
{
List<dynamic> listMonth = new List<dynamic>();
for (int i = 0; i > -24; i--)
{
DateTime dtTmp = DateTime.Today.AddMonths(i);
listMonth.Add(new { title = dtTmp.ToString("yyyy年MM月"), value = dtTmp.ToString("yyyyMM") });
}
ViewData["MonthList"] = JsonConvert.SerializeObject(listMonth);
ViewData["openid"] = openid;
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public ActionResult FeeListData(string openid, string monthStart, string monthEnd)
{
DateTime dStart = DateTime.MinValue;
DateTime dEnd = DateTime.MinValue;
if (!DateTime.TryParseExact(monthStart, "yyyyMM", CultureInfo.InvariantCulture, DateTimeStyles.None, out dStart)) //默认当月
{
dStart = DateTime.Today.AddDays(-1 * DateTime.Today.Day + 1); //当月1日
}
if (!DateTime.TryParseExact(monthEnd, "yyyyMM", CultureInfo.InvariantCulture, DateTimeStyles.None, out dEnd)) //默认当月
{
dEnd = DateTime.Today.AddMonths(1).AddDays(-1 * DateTime.Today.Day); //月底
}
else
{
dEnd = dEnd.AddMonths(1).AddDays(-1); //月底
}
string strAllStart = dStart.ToString("yyyy-MM-dd 00:00:00");
string strAllEnd = dEnd.ToString("yyyy-MM-dd 23:59:59");
var query = from d in dataContext.Drivers
join t in dataContext.OpLetterTrucks on d.InfoClient equals t.TRUCK
join s in dataContext.ChFees on new { t.BSNO, Name = t.TRUCK, LEID = t.LE_ID } equals new { s.BSNO, Name = s.CUSTOMERNAME, LEID = s.CARGO_GID }
where d.OpenId == openid && s.FEETYPE == 2 && (s.FEESTATUS == 0 || s.FEESTATUS == 8 || s.FEESTATUS == 9) && t.FACTRYTIME.CompareTo(strAllStart) >= 0 && t.FACTRYTIME.CompareTo(strAllEnd) <= 0
orderby t.FACTRYTIME
select new
{
t.FACTRYTIME,
s.AMOUNT
};
var qList = query.ToList();
DateTime dtTmp = dStart;
List<dynamic> listData = new List<dynamic>();
while (dtTmp < dEnd)
{
string strFirst = dtTmp.ToString("yyyy-MM-01 00:00:00"); //月初
string strLast = dtTmp.AddMonths(1).AddDays(-1 * dtTmp.Day).ToString("yyyy-MM-dd 23:59:59"); //月底
decimal? sum = qList.Where(x => x.FACTRYTIME.CompareTo(strFirst) >= 0 && x.FACTRYTIME.CompareTo(strLast) <= 0).Sum(x => x.AMOUNT);
listData.Add(new
{
Month = dtTmp.ToString("yyyyMM"),
MonthStr = dtTmp.ToString("yyyy年MM月"),
Sum = sum.HasValue ? sum.Value : 0
});
dtTmp = dtTmp.AddMonths(1);
}
return Json(listData);
}
#endregion
#region 抢单
public ActionResult GrabList(string openid)
{
var driver = dataContext.Drivers.FirstOrDefault(d => d.OpenId == openid);
if (driver == null)
{
return RedirectToAction("DriverRegist", new { openid });
}
ViewData["openid"] = openid;
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public ActionResult GrabData(string openid, int page = 1, int pageSize = 10)
{
var query = from d in dataContext.Drivers
join g in dataContext.Grabs on d.InfoClient equals g.InfoClient
join t in dataContext.OpLetterTrucks on g.LE_ID equals t.LE_ID
join s in dataContext.OpSeaes on t.BSNO equals s.BSNO
where t.TRUCKSTATUS == "已发单" && d.OpenId == openid && (dataContext.Grabs.Count(g1 => g1.LE_ID == g.LE_ID && g1.IsGrab == true)) == 0
select new DispatchDetailViewModel
{
VESSEL = s.VESSEL,
VOYNO = s.VOYNO,
MBLNO = s.MBLNO,
CTNS = t.CTNS,
KGS = t.KGS,
TRUCKFEE = t.TRUCKFEE,
YARD = t.YARD,
FACTRYNAME = t.FACTRYNAME,
FACTRYADDR = t.FACTRYADDR,
FACTRYTIME = t.FACTRYTIME,
CLOSINGDATE = t.CLOSINGDATE,
LE_ID = t.LE_ID
};
var count = query.Count();
var list = query.OrderBy(x => x.MBLNO).Skip((page - 1) * pageSize).Take(pageSize).ToList();
return Json(new { total = count, page, pageSize, list });
}
public ActionResult GrabDetail(string leid, string openid)
{
var query = from d in dataContext.Drivers
join g in dataContext.Grabs on d.InfoClient equals g.InfoClient
join t in dataContext.OpLetterTrucks on g.LE_ID equals t.LE_ID
join s in dataContext.OpSeaes on t.BSNO equals s.BSNO
where g.LE_ID == leid && d.OpenId == openid
select new DispatchGrabViewModel
{
VESSEL = s.VESSEL,
VOYNO = s.VOYNO,
MBLNO = s.MBLNO,
CTNS = t.CTNS,
KGS = t.KGS,
TRUCKFEE = t.TRUCKFEE,
YARD = t.YARD,
FACTRYNAME = t.FACTRYNAME,
FACTRYADDR = t.FACTRYADDR,
FACTRYTIME = t.FACTRYTIME,
CLOSINGDATE = t.CLOSINGDATE,
LE_ID = t.LE_ID,
TRUCKSTATUS = t.TRUCKSTATUS,
GrabId = g.GID
};
var obj = query.FirstOrDefault();
ViewData["Data"] = obj;
var driver = dataContext.Drivers.FirstOrDefault(d => d.OpenId == openid);
ViewData["grab"] = dataContext.Grabs.FirstOrDefault(g => g.LE_ID == leid && g.InfoClient == driver.InfoClient);
ViewData["grab_success"] = dataContext.Grabs.FirstOrDefault(g => g.LE_ID == leid && g.IsGrab == true);
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public ActionResult GrabSubmit(string gid)
{
RespCommon resp = new RespCommon();
var grab = dataContext.Grabs.FirstOrDefault(g => g.GID == gid);
if (grab != null)
{
if (dataContext.Grabs.Count(g => g.LE_ID == grab.LE_ID && g.IsGrab == true) == 0)
{
grab.IsGrab = true;
grab.GrabTime = DateTime.Now;
var truck = dataContext.OpLetterTrucks.FirstOrDefault(t => t.LE_ID == grab.LE_ID);
truck.TRUCKSTATUS = "已派车";
truck.TRUCK = grab.InfoClient;
var letter = dataContext.OpLetters.FirstOrDefault(l => l.LE_ID == grab.LE_ID);
letter.HEAD_TO = grab.InfoClient;
var user = dataContext.Users.FirstOrDefault(u => u.GID == truck.INPUTBY);
var task = dataContext.OpTasks.FirstOrDefault(t => t.TASKNO == truck.LE_ID);
task.OP = user == null ? string.Empty : user.SHOWNAME;
task.ISPUBLIC = false;
task.TASKTYPE = "已派车";
task.ISCOMPLETE = 1;
task.COMPLETETIME = DateTime.Now;
task.TASKDESCRIP = "车队:" + truck.TRUCK;
#region 费用
if (truck.TRUCKFEE > 0 && truck.ISFEE != "1")
{
var fee = new ChFeeInfo();
fee.GID = Guid.NewGuid().ToString();
fee.BSNO = truck.BSNO;
fee.FEETYPE = 2;
fee.FEENAME = "陆运费";
fee.FEEDESCRIPTION = "";
fee.CUSTOMERTYPE = "车队";
fee.CUSTOMERNAME = truck.TRUCK;
fee.UNIT = "票";
fee.UNITPRICE = truck.TRUCKFEE;
fee.QUANTITY = 1;
fee.AMOUNT = truck.TRUCKFEE;
fee.CURRENCY = "RMB";
fee.EXCHANGERATE = 1;
fee.REASON = "";
fee.REMARK = "";
fee.COMMISSIONRATE = 0;
fee.ENTEROPERATOR = truck.INPUTBY;
fee.ENTERDATE = DateTime.Now;
fee.ISOPEN = false;
fee.ISADVANCEDPAY = false;
fee.SORT = 1;
fee.FEESTATUS = 1;
fee.FEEFRT = "PP";
fee.CARGO_GID = truck.LE_ID;
fee.TAXRATE = 0;
fee.NOTAXAMOUNT = truck.TRUCKFEE;
fee.ACCTAXRATE = 0;
fee.LINENUM = 1;
fee.TAXUNITPRICE = truck.TRUCKFEE;
fee.MODIFIEDUSER = truck.INPUTBY;
fee.MODIFIEDTIME = DateTime.Now;
fee.WMSOUTBSNO = "";
fee.PREAMOUNT = 0;
fee.ISINVOICE = false;
fee.INPUTMODE = "";
fee.LOCALCURR = "RMB";
fee.MANAGER = "";
fee.ISACC = false;
dataContext.ChFees.Add(fee);
}
if (truck.OTHERFEE.HasValue && truck.OTHERFEE > 0 && truck.ISFEE != "1")
{
var fee = new ChFeeInfo();
fee.GID = Guid.NewGuid().ToString();
fee.BSNO = truck.BSNO;
fee.FEETYPE = 2;
fee.FEENAME = "绩效及加班";
fee.FEEDESCRIPTION = "";
fee.CUSTOMERTYPE = "其他";
fee.CUSTOMERNAME = task.OP;
fee.UNIT = "票";
fee.UNITPRICE = truck.OTHERFEE.Value;
fee.QUANTITY = 1;
fee.AMOUNT = truck.OTHERFEE.Value;
fee.CURRENCY = "RMB";
fee.EXCHANGERATE = 1;
fee.REASON = "";
fee.REMARK = "";
fee.COMMISSIONRATE = 0;
fee.ENTEROPERATOR = truck.INPUTBY;
fee.ENTERDATE = DateTime.Now;
fee.ISOPEN = false;
fee.ISADVANCEDPAY = false;
fee.SORT = 1;
fee.FEESTATUS = 1;
fee.FEEFRT = "PP";
fee.CARGO_GID = truck.LE_ID;
fee.TAXRATE = 0;
fee.NOTAXAMOUNT = truck.OTHERFEE.Value;
fee.ACCTAXRATE = 0;
fee.LINENUM = 1;
fee.TAXUNITPRICE = truck.OTHERFEE.Value;
fee.MODIFIEDUSER = truck.INPUTBY;
fee.MODIFIEDTIME = DateTime.Now;
fee.WMSOUTBSNO = "";
fee.PREAMOUNT = 0;
fee.ISINVOICE = false;
fee.INPUTMODE = "";
fee.LOCALCURR = "RMB";
fee.MANAGER = "";
fee.ISACC = false;
dataContext.ChFees.Add(fee);
}
#endregion
truck.ISFEE = "1";
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "抢单成功";
}
else
{
resp.Success = true;
resp.Message = "抢单失败";
}
}
else
{
resp.Success = false;
resp.Message = "未找到派单信息";
}
return Json(resp);
}
//在派车单里查看抢单列表
public ActionResult GrabViewListData(string leid, int start, int limit)
{
var list = dataContext.Grabs
.Where(g => g.LE_ID == leid)
.OrderBy(g => g.SendTime)
.Skip(start)
.Take(limit)
.AsGrabViewListViewModelList();
return Json(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list }, JsonRequestBehavior.AllowGet);
}
#endregion
#region 其他
//倍通菜单
public ActionResult CreateMenu()
{
try
{
string token = string.Empty;
string errorMsg = string.Empty;
bool success = TokenHelper.GetMpToken(appid, out token, out errorMsg);
if (success)
{
var url = $"https://api.weixin.qq.com/cgi-bin/menu/create?access_token={token}";
string regRtnUrl = HttpUtility.UrlEncode($"{dispatchServerUrl}/Dispatch/Dispatch/AuthRedirect");
string regUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyRegist}#wechat_redirect";
string listUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyDispatchList}#wechat_redirect";
string listUrlGrab = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyGrabList}#wechat_redirect";
string feeUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyFeeList}#wechat_redirect";
string regUrlCust = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyRegistCust}#wechat_redirect";
string opseaeUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyOpSeaeList}#wechat_redirect";
var menuJson = new
{
button = new object[]
{
new
{
name="注册信息",
sub_button=new object[]
{
new
{
type="view",
name ="司机注册",
url =regUrl
},
new
{
type="view",
name ="客户注册",
url =regUrlCust
}
}
},
new
{
name="派车列表",
sub_button=new object[]
{
new
{
type="view",
name ="抢单列表",
url =listUrlGrab
},
new
{
type="view",
name ="派车列表",
url =listUrl
},
new
{
type="view",
name="费用账单",
url =feeUrl
}
}
},
new
{
type="view",
name="委托列表",
url =opseaeUrl
}
}
};
string jsonStr = JsonConvert.SerializeObject(menuJson);
string rtnStr = WebRequestHelper.DoPost(url, jsonStr);
return Content(rtnStr);
}
else
{
return Content($"获取token时出错{errorMsg}");
}
}
catch (Exception ex)
{
return Content($"error:{ex.Message}");
}
}
public ActionResult SendTemplateTest(string openid = "oHgaQ5no1pqAXeRZK3WcV2UzjHY4")
{
List<Tuple<string, string, string>> values = new List<Tuple<string, string, string>>();
values.Add(new Tuple<string, string, string>("TITLE", "收到新的派车消息,信息如下:", "#FF0000"));
values.Add(new Tuple<string, string, string>("XX", "OTG01256", ""));
values.Add(new Tuple<string, string, string>("DW", "1568KG", ""));
values.Add(new Tuple<string, string, string>("ZHSJ", DateTime.Today.ToString("yyyy-MM-dd"), ""));
values.Add(new Tuple<string, string, string>("JGSJ", DateTime.Today.AddDays(5).ToString("yyyy-MM-dd"), ""));
values.Add(new Tuple<string, string, string>("GCDZ", "市南区湛山街道", ""));
values.Add(new Tuple<string, string, string>("FOOTTER", "赶快点击去抢单吧~", "#0000FF"));
string mess = string.Empty;
bool success = TemplateMessageHelper.SendTemplateMessage(appid, "5zWCiYhS44naUs1dolJuMtAhzqvrfpdHUK6JQJdtkLw", values, openid, $"{dispatchServerUrl}/Dispatch/Dispatch/DispatchDetail?leid=123", out mess);
return Content($"{success} {mess}");
}
public ActionResult CreateMenuHJ()
{
try
{
logger.Debug("正在生产虎鲸微信menu");
string token = string.Empty;
string errorMsg = string.Empty;
bool success = TokenHelper.GetMpToken(appid, out token, out errorMsg);
if (success)
{
logger.Debug($"虎鲸token:{token}");
var url = $"https://api.weixin.qq.com/cgi-bin/menu/create?access_token={token}";
var url_del = $"https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={token}";
string regRtnUrl = HttpUtility.UrlEncode($"{dispatchServerUrl}/Dispatch/Dispatch/AuthRedirect");
string stockUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyStockList}#wechat_redirect";
string regUrlCust = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyRegistCustHJ}#wechat_redirect";
//string opseaeUrl = $"https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={regRtnUrl}&response_type=code&scope=snsapi_base&state={StateKeyOpSeaeList}#wechat_redirect";
var menuJson = new
{
button = new object[]
{
new
{
name="关于我们",
sub_button=new object[]
{
2 years ago
//new
//{
// type="view",
// name ="组织框架",
// url ="https://v.xiumi.us/stage/v5/3EOyB/146935898"
//},
//new
//{
// type="view",
// name ="部门职责",
// url ="https://v.xiumi.us/stage/v5/44tOy/147193130"
//},
2 years ago
new
{
type="view",
name ="公司介绍",
2 years ago
url ="https://v.xiumi.us/stage/v5/5ITnD/409265436"
2 years ago
},
2 years ago
//new
//{
// type="view",
// name ="仓库收费标准",
// url ="https://v.xiumi.us/board/v5/3EOyB/176410025"
//},
2 years ago
new
{
type="view",
name ="账号注册",
url =regUrlCust
}
}
},
new
{
name="相关政策",
sub_button=new object[]
{
new
{
type="view",
name ="海关政策",
url ="http://www.customs.gov.cn/customs/302249/302266/302267/index.html"
},
new
{
type="view",
name ="商务政策",
url ="http://www.mofcom.gov.cn/article/b/"
},
new
{
type="view",
name="船务信息",
url ="http://www.shippingchina.com"
}
}
},
new
{
name="在线查询",
sub_button=new object[]
{
new
{
type="view",
name ="舱单信息查询",
url ="http://query.customs.gov.cn/MNFTQ/"
},
new
{
type="view",
name ="通关状态查询",
url ="http://www.customs.gov.cn/customs/302427/302442/tgzt/index.html"
},
new
{
type="view",
name="国内物流查询",
url ="https://v.xiumi.us/stage/v5/3EOyB/162573181"
},
new
{
type="view",
name ="常见问题解答",
url ="https://v.xiumi.us/stage/v5/3EOyB/146990201"
},
new
{
type="view",
name="库存状况查询",
url = stockUrl
}
}
}
}
};
string jsonStr = JsonConvert.SerializeObject(menuJson);
logger.Debug("menu对象:");
logger.Debug(jsonStr);
//logger.Debug("准备删除原先menu:");
//string rtnStr = WebRequestHelper.DoPost(url_del,null);
//logger.Debug("准备menu返回:");
//logger.Debug(rtnStr);
string rtnStr = WebRequestHelper.DoPost(url, jsonStr);
return Content(rtnStr);
}
else
{
return Content($"获取token时出错{errorMsg}");
}
}
catch (Exception ex)
{
return Content($"error:{ex.Message}");
}
}
#region 筛选车队
2 years ago
[System.Web.Mvc.HttpGet]
2 years ago
public JsonResult GetTruckInfoClients(string keyword)
{
List<InfoClient> list = null;
if (string.IsNullOrWhiteSpace(keyword))
{
list = dataContext.InfoClients.Where(c => c.ISTRUCK == true).ToList();
}
else
{
list = dataContext.InfoClients.Where(c => c.ISTRUCK == true && (c.CODENAME.StartsWith(keyword) || c.SHORTNAME.IndexOf(keyword) > -1)).ToList();
}
return Json(new { value = list.AsInfoClientTruckViewModelList() }, JsonRequestBehavior.AllowGet);
}
#endregion
#endregion
1 year ago
[System.Web.Mvc.HttpPost]
public ActionResult CreateSeae()
{
RespCommon resp = new RespCommon();
StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = sr.ReadToEnd();
var path = Server.MapPath("../../UploadFiles");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string filename = path + "\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".txt";
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
FileStream f = new FileStream(filename, FileMode.Create);
StreamWriter r = new StreamWriter(f, Encoding.Default);
r.WriteLine(strJson);
r.Close();
f.Close();
var NewMsOpSeae = DSWeb.MvcShipping.Helper.JsonConvert.Deserialize<MsOpSeae>(strJson);
if (NewMsOpSeae.ORDERTYPE != "BC引入") {
var json1 = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(
new { success = false, msg = "数据不正确无法生产委托!" });
return new ContentResult() { Content = json1 };
}
var bodyList=new List<MsOpSeaeDetail>();
var head = new MsOpSeae();
head.BSNO = "topseae" + Guid.NewGuid().ToString();
head.ORDERTYPE = "BC引入";
head.OP = NewMsOpSeae.OP;
1 year ago
head.USERID = NewMsOpSeae.USERID;
head.INPUTBY = NewMsOpSeae.INPUTBY;
head.CORPID = NewMsOpSeae.CORPID;
head.VESSEL = NewMsOpSeae.VESSEL;
head.VOYNO = NewMsOpSeae.VOYNO;
head.PLACERECEIPT = NewMsOpSeae.PLACERECEIPT;
head.PORTLOAD = NewMsOpSeae.PORTLOAD;
head.PORTDISCHARGE = NewMsOpSeae.PORTDISCHARGE;
head.PLACEDELIVERY = NewMsOpSeae.PLACEDELIVERY;
head.ETD = NewMsOpSeae.ETD;
head.ETA = NewMsOpSeae.ETA;
head.CLOSINGDATE = NewMsOpSeae.CLOSINGDATE;
head.CLOSEDOCDATE = NewMsOpSeae.CLOSEDOCDATE;
head.PLACERECEIPTID = DSWeb.MvcShipping.DAL.MsOpSeaeYardDAL.MsOpSeaeYardDAL.GetPortEDICodeByEname(head.PLACERECEIPT);
head.PLACEDELIVERYID = DSWeb.MvcShipping.DAL.MsOpSeaeYardDAL.MsOpSeaeYardDAL.GetPortEDICodeByEname(head.PLACEDELIVERY);
head.MBLNO = NewMsOpSeae.MBLNO;
head.YARD = NewMsOpSeae.YARD;
1 year ago
// head.DOC = Convert.ToString(Session["SHOWNAME"]);
head.INPUTBY = NewMsOpSeae.INPUTBY;
var period = ChMonthCloseDAL.GetData("", NewMsOpSeae.CORPID);
if (Convert.ToDateTime(period.FDAY) > DateTime.Now)
{
head.ACCDATE = period.PERIOD;
}
else
{
head.ACCDATE = DateTime.Now.ToString("yyyy-MM");
}
var result = DSWeb.MvcShipping.DAL.MsOpSeaeDAL.MsOpSeaeDAL.DoSave("add", head, bodyList, head.USERID,head.INPUTBY, head.CORPID,"");
var json4 = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(
new { success = result.Success, msg = result.Message });
return new ContentResult() { Content = json4 };
}
2 years ago
[System.Web.Mvc.HttpPost]
public string DingdingCallback(string signature, string timestamp, string nonce)
2 years ago
{
2 years ago
BasicDataRefDAL.SaveLog(signature, "admin", "钉钉回调", "保存0");
2 years ago
//JeffSoft.Logger.Error("DingdingCallback Success:" + signature + "," + timestamp + "");
//第一部分
//这两句代码是为了接收body体中传入的加密json串
StreamReader sr = new StreamReader(Request.InputStream, Encoding.UTF8);
var strJson = new StringBuilder();
string line = null;
while (((line = sr.ReadLine())) != null)
{
strJson.Append(line);
}
//反序列化json串拿去加密字符串
var objRtn = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(strJson.ToString(), new { encrypt = ""});
string ever = objRtn.encrypt;
//实例化钉钉解密类构造参数为对应的 应用中的token、aes_key、AppKey值
2 years ago
var DingTalkSet = MsCodeDingTalkSetDAL.GetData("ISENABLE=1","");
if (DingTalkSet == null || !DingTalkSet.ISENABLE)
{
return "";
}
DingTalkEncryptor dingTalkEncryptor = new DingTalkEncryptor(DingTalkSet.CALBACK_TOKEN, DingTalkSet.CALLBACK_AES_KEY, DingTalkSet.APPKEY);
2 years ago
//定义字符串接收解密后的值
string text = dingTalkEncryptor.getDecryptMsg(signature, timestamp, nonce, ever);
//JeffSoft.Logger.Error("dingTalkEncryptor.getDecryptMsg:" + text + "");
2 years ago
var objRtn2 = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(text.ToString(), new DingCallBackInfo());
2 years ago
//取出事件类型字段
//JeffSoft.Logger.Error("DingdingCallback Success,EventType:" + EventType + "");
//第二部分
2 years ago
BasicDataRefDAL.SaveLog(text, "admin", "钉钉回调", "保存1");
if (("bpms_instance_change" == objRtn2.EventType|| "bpms_task_change" == objRtn2.EventType))
2 years ago
{
2 years ago
DingTalkHelper.CallBack(objRtn2);
BasicDataRefDAL.SaveLog(text, "admin", "钉钉回调", "bpms_instance_change");
2 years ago
}
//第三部分
//返回加密字符串
var msg = dingTalkEncryptor.getEncryptedMap("success");
var msg_signature = msg["msg_signature"];
var encrypt = msg["encrypt"];
var timeStamp = msg["timeStamp"];
var nonce1 = msg["nonce"];
var v = new
{
msg_signature = msg["msg_signature"],
encrypt = msg["encrypt"],
timeStamp = msg["timeStamp"],
nonce = msg["nonce"],
};
//var obj = new { success = r };
// return Json(obj);
var data = JsonConvert.SerializeObject(v);
return data;
2 years ago
//返回json数
//return new HttpResponseMessage()
//{
// Content = new StringContent(data, Encoding.UTF8, "application/json"),
//};
2 years ago
}
2 years ago
public ActionResult OpStatusZc(string BSNO)
{
//var opstatus=dataContext.OpStatus.FirstOrDefault(t => t.BSNO ==BSNO)
var dataList = dataContext.OpStatus.Where(s => s.BSNO == BSNO && s.STATUS=="入库完成").AsOpStatusViewModelList();
var COMPTIME ="";
if (dataList.Count > 0)
{
COMPTIME = dataList[0].COMPTIME;
if (!string.IsNullOrEmpty(COMPTIME)) {
COMPTIME = Convert.ToDateTime(COMPTIME).ToString("yyyy-MM-dd");
}
}
var query = from s in dataContext.OpSeais
where s.BSNO == BSNO
select new DispatchOpStatusZcViewModel
{
VESSEL = s.VESSEL,
VOYNO = s.VOYNO,
MBLNO = s.MBLNO,
CUSTSERVICE = s.OP,
CNTRTOTAL = s.CNTRTOTAL,
BSDATE = s.BSDATE,
ETD = s.ETD,
CUSTOMDATE = s.CUSTOMDATE,
TIHUOTIME = s.TIHUOTIME,
STORAGENAME = s.STORAGENAME,
WMSDATE= COMPTIME,
GOODSNAME=s.GOODSNAME
};
var obj = query.FirstOrDefault();
ViewData["Data"] = obj;
return View();
}
#region 委托单位相关
#region 委托单位注册
2 years ago
[System.Web.Mvc.HttpGet]
2 years ago
public ActionResult DispInfoClientRegist(string openid)
{
if (!string.IsNullOrWhiteSpace(openid))
{
var infoClient = dataContext.DispInfoClients.FirstOrDefault(d => d.OpenId == openid);
if (infoClient != null)
{
var infoClientModel = infoClient.AsDispInfoClientRegistViewModel();
ViewData["infoClient"] = infoClientModel;
ViewData["isAudit"] = infoClient.IsAudit;
}
else
{
ViewData["infoClient"] = new DispInfoClientRegistViewModel();
ViewData["isAudit"] = false; ;
}
ViewData["openid"] = openid;
ViewData["controllerList"] = dataContext.InfoClients.Where(c => c.ISCONTROLLER == true).AsInfoClientTruckViewModelList();
return View();
}
else
{
return Content("非法请求!");
}
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DispInfoClientRegist(DispInfoClientRegistViewModel model)
{
RespCommon resp = new RespCommon();
if (!string.IsNullOrWhiteSpace(model.OpenId))
{
var infoClient = dataContext.DispInfoClients.FirstOrDefault(d => d.OpenId == model.OpenId);
if (infoClient == null)
{
infoClient = model.AsDispInfoClientInfo();
infoClient.GID = Guid.NewGuid().ToString();
infoClient.InfoClient = string.Empty;
dataContext.DispInfoClients.Add(infoClient);
}
else
{
model.AsDispInfoClientInfo(infoClient);
}
dataContext.SaveChanges();
resp.Success = true;
resp.Message = "操作成功";
}
else
{
resp.Success = false;
resp.Message = "参数无效";
}
return Json(resp);
}
#endregion
#region 委托单位审核
public ActionResult DispInfoClientAuditList()
{
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DispInfoClientAuditData(int offset, int limit, bool? isAudit)
{
RespDispInfoClientAuditList resp = new RespDispInfoClientAuditList();
if (isAudit.HasValue)
{
resp.Total = dataContext.DispInfoClients.Where(d => d.IsAudit == isAudit.Value).Count();
resp.Data = dataContext.DispInfoClients.Where(d => d.IsAudit == isAudit.Value).OrderBy(d => d.GID).Skip(offset).Take(limit).AsAuditViewModelList();
}
else
{
resp.Total = dataContext.DispInfoClients.Count();
resp.Data = dataContext.DispInfoClients.OrderBy(d => d.GID).Skip(offset).Take(limit).AsAuditViewModelList();
}
return Json(resp);
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DispInfoClientAudit(string gid, string infoClient)
{
RespCommon resp = new RespCommon();
var driver = dataContext.DispInfoClients.FirstOrDefault(d => d.GID == gid);
if (driver != null)
{
driver.InfoClient = infoClient;
driver.IsAudit = true;
dataContext.SaveChanges();
}
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult DispInfoClientReject(string gid)
{
RespCommon resp = new RespCommon();
var driver = dataContext.DispInfoClients.FirstOrDefault(d => d.GID == gid);
if (driver != null)
{
driver.InfoClient = string.Empty;
driver.IsAudit = false;
dataContext.SaveChanges();
}
resp.Success = true;
resp.Message = "操作成功";
return Json(resp);
}
#endregion
#region 委托列表
public ActionResult SaleOpSeaeList(string openid)
{
var infoClient = dataContext.DispInfoClients.FirstOrDefault(d => d.OpenId == openid);
if (infoClient == null)
{
return RedirectToAction("DispInfoClientRegist", new { openid });
}
ViewData["openid"] = openid;
return View();
}
2 years ago
[System.Web.Mvc.HttpPost]
2 years ago
public JsonResult SaleOpSeaeListData(string openid, int page = 1, int pageSize = 10)
{
RespGetOpSeae resp = new RespGetOpSeae();
var infoClient = dataContext.DispInfoClients.FirstOrDefault(d => d.OpenId == openid);
var dataList = MsOpSeaeDAL.GetSaleDataList(infoClient.InfoClient, null, null, null);
var list = dataList.Skip((page - 1) * pageSize).Take(pageSize);
resp.Success = true;
resp.Message = "查询成功";
resp.Data = list.ToList();
resp.Total = dataList.Count;
return Json(resp);
}
#endregion
#region 委托详情
public ActionResult SaleOpSeaeDetail(string bsno)
{
ViewData["bsno"] = bsno;
return View();
}
public ActionResult SaleOpSeaeDetailData(string bsno)
{
var model = MsOpSeaeDAL.GetOneByBSNO(bsno);
var opseae = dataContext.OpSeaes.First(o => o.BSNO == bsno);
var dataList = MsChFeeDAL.GetShouldGetDataList(opseae.CUSTOMERNAME, bsno);
var staList = dataContext.OpStatus.Where(s => s.BSNO == bsno).AsOpStatusViewModelList();
var obj = new
{
model.BSNO,
model.VESSEL,
model.VOYNO,
model.MBLNO,
model.INVNO,
model.ETD,
model.ATD,
model.CNTRTOTAL,
model.KGS,
model.YARD,
model.CNTRSEALNO,
model.CUSTOMNO,
model.FACTORYADDR,
model.CARGODATE,
model.STA_ZXFC,
model.STA_HGFX,
FEE_LIST = dataList,
STATE_LIST = staList
};
return Json(obj);
}
#endregion
#endregion
}
2 years ago
2 years ago
//获取注册信息
public class RegPortController : Controller
{
#region 获取注册信息(用于在公司服务器接受注册查询请求)
public string GetSecCompany(string GID)
{
DBResult result = new DBResult();
var _GID = DSWeb.SoftMng.Common.Common.string_Decrypt(GID, "");
try
{
sys_secCompanyBLL cbll = new sys_secCompanyBLL();
sys_secCompany cmodel = cbll.GetModelList("GID='" + _GID + "'").FirstOrDefault();
result.setMessage(true, "");
result.Data = cmodel;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
}
return DSWeb.TruckMng.Helper.JsonConvert.Serialize(result);
}
public string GetSecModel(string GID)
{
DBResult result = new DBResult();
var _GID = DSWeb.SoftMng.Common.Common.string_Decrypt(GID, "");
try
{
sys_secModuleBLL ServerModel = new sys_secModuleBLL();
List<sys_secModule> ServerModelList = ServerModel.GetModelList("PID='" + _GID + "'");
result.setMessage(true, "");
result.Data = ServerModelList.ToList();
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
}
return DSWeb.TruckMng.Helper.JsonConvert.Serialize(result);
}
#endregion
}
}