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/WxAppController.cs

2473 lines
94 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Common.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;
using DSWeb.Areas.Dispatch.Helper;
using Newtonsoft.Json;
using System.Runtime.Caching;
using System.Text;
using System.IO;
using DSWeb.Areas.Dispatch.DB;
using DSWeb.Areas.Dispatch.DB_Wx;
using DSWeb.Areas.CommMng.DAL;
using HcUtility.Comm;
using System.Data.Entity.Migrations;
using static DSWeb.Areas.CommMng.Controllers.DSWEBAPPInterfaceController;
using DSWeb.Areas.Account.Models.Chfee_Invoice;
using DSWeb.Common.DB;
using DSWeb.Areas.TruckMng.DAL.MsRptPcHeadEdit;
using System.Web.UI.WebControls;
using DSWeb.Areas.MvcShipping.DAL;
using DSWeb.Areas.Import.DAL.ReceiptDoc;
using DSWeb.Areas.TruckMng.Models.MsWlBs;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcShipping.Models.MsOpLetter;
using HcUtility.Core;
using NPOI.OpenXmlFormats.Wordprocessing;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
using sun.swing;
using DSWeb.MvcShipping.Models.WMSNew;
namespace DSWeb.Areas.Dispatch.Controllers
{
public class repobj {
public string openid { get; set; }
public int errcode { get; set; }
}
public class LoginInfo {
public string codename { get; set; }
public string password { get; set; }
public string AuthCode { get; set; }
}
//微信小程序专用接口控制器
public class WxAppController : Controller
{
private ILog log = LogManager.GetLogger("WxAppController");
private WxAppDataContext dbc = new WxAppDataContext();
private string filepath = ConfigurationManager.AppSettings["DSWMSFilePath"];
/// <summary>
///
/// </summary>
private repobj getOpenId(string code) {
var appid = ConfigurationManager.AppSettings["WechatAppId"];
var appsecret = ConfigurationManager.AppSettings["WechatAppSecret"];
var url = $"https://api.weixin.qq.com/sns/jscode2session?appid={appid}&secret={appsecret}&js_code={code}&grant_type=authorization_code";
log.Debug("获取openid" + url);
string resp = WebRequestHelper.DoGet(url);
repobj result = JsonConvert.DeserializeAnonymousType(resp, new repobj { openid = "", errcode = 0 });
log.Debug("返回:" + resp);
return result;
}
public String getDataStr(DateTime? dt) {
return dt == null ? "" : ((DateTime)dt).ToString("yyyy-MM-dd");
}
public String getDataLongStr(DateTime? dt)
{
return dt == null ? "" : ((DateTime)dt).ToString("yyyy-MM-dd HH:mm:ss");
}
//#region 裕龙集团用小程序
//校验用户是否存在,并获取用户信息
[HttpGet]
public ActionResult GetUserInfo(string code)
{
try
{
var obj = getOpenId(code);
//BasicDataRefDAL.SaveLog("获得openid", obj.openid, "wxapp", "获取用户信息");
var userWx = dbc.Users.FirstOrDefault(x => x.OPENID == obj.openid);
if (userWx != null)
{
var userinfo = dbc.vw_user.First(x => x.USERID == userWx.GID);
//BasicDataRefDAL.SaveLog("", "", "wxapp", "获取用户信息1");
return Json(new
{
ErrorCode = 0,
Message = "获取成功",
BaseInfo = new { userinfo.SHOWNAME, userWx.CODENAME, userinfo.companyname, userWx.OPENID, userinfo.Role_Id, userinfo.COMPANYID, userinfo.USERID }
},
JsonRequestBehavior.AllowGet);
}
else
{
//BasicDataRefDAL.SaveLog("", "", "wxapp", "获取用户信息2");
return Json(new { ErrorCode = -1, Message = "用户不存在" }, JsonRequestBehavior.AllowGet);
}
//BasicDataRefDAL.SaveLog("", "", "wxapp", "获取用户信息3");
return Json(new { ErrorCode = 500, Message = "发生错误" }, JsonRequestBehavior.AllowGet);
}
catch (Exception e) {
//log.Debug("获取信息错误" + e.Message);
//BasicDataRefDAL.SaveLog("错误", e.Message, "wxapp", "获取用户信息");
return Json(new { ErrorCode = 500, Message = e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 用户登陆 使用系统用户名和密码登陆
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[HttpPost]
public ActionResult FirstLogin(LoginInfo logininfo)
{
var obj = getOpenId(logininfo.AuthCode);
BasicDataRefDAL.SaveLog("获得openid", obj.openid, "wxapp", "登录");
try
{
if (obj.errcode == 0)
{
BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录1");
var userWxList = dbc.Users.Where(x => x.OPENID == obj.openid).ToList();
if (userWxList.Count > 0)
{
//将所有使用这个openid的user数据的openid置为 然后继续正常操作
foreach (var item in userWxList)
{
item.OPENID = "";
}
}
BasicDataRefDAL.SaveLog($"codename[{logininfo.codename}],password[{logininfo.password}]", obj.openid, "wxapp", "登录2");
//将正确的用户名和密码的那条user数据 的openid修改为传入的
var userWx = dbc.Users.FirstOrDefault(x => x.CODENAME.ToUpper() == logininfo.codename.ToUpper() && x.PASSWORD == logininfo.password);
if (userWx != null)
{
userWx.OPENID = obj.openid;
dbc.SaveChanges();
}
else {
BasicDataRefDAL.SaveLog("用户名、密码错误", obj.openid, "wxapp", "登录2.1");
}
var userinfo = dbc.vw_user.First(x => x.USERID == userWx.GID);
BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录3");
return Json(new
{
ErrorCode = 0,
Message = "获取成功",
BaseInfo = new { userinfo.SHOWNAME, userWx.CODENAME, userinfo.companyname, userWx.OPENID }
},
JsonRequestBehavior.AllowGet);
}
}
catch (Exception e) {
BasicDataRefDAL.SaveLog("", e.Message, "wxapp", "登陆错误");
//log.Debug("wxapp登陆错误" + e.Message);
}
BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录f");
return Json(new { ErrorCode = 500, Message = "发生错误" }, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// 获取进行中的入库执行单
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetINDOList(string CODENAME)
{
try
{
var userinfo = dbc.vw_user.First(x => x.CODENAME == CODENAME);
var limit = dbc.Sys_Role_Core.First(x => x.Role_Id == userinfo.Role_Id).LimitCompanyRange;
var indoList = new List<VW_OP_WMS_IN_DO>();
//寻找 本公司的“入库执行 1001”的入库执行单列表
if (limit)
{
indoList = dbc.VW_OP_WMS_IN_DO.Where(x => x.CORPID == userinfo.COMPANYID && x.BILLSTATUS == "1001" && (x.CUSTOMERNAME != null && x.CUSTOMERNAME != "")).ToList();
}
else {
indoList = dbc.VW_OP_WMS_IN_DO.Where(x => x.BILLSTATUS == "1001" && (x.CUSTOMERNAME != null && x.CUSTOMERNAME != "")).ToList();
}
indoList.Sort((x, y) => 4 * x.CUSTOMERNAME.CompareTo(y.CUSTOMERNAME) + 2 * x.MBLNO.CompareTo(y.MBLNO));
return Json(new { ErrorCode = 0, data = indoList }, JsonRequestBehavior.AllowGet);
}
catch (Exception e) {
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 获取入库执行明细
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetINDODetailList(string WMSDOID)
{
try
{
//var userinfo = dbc.vw_user.First(x => x.CODENAME == CODENAME);
//寻找 本公司的“入库执行 1001”的入库执行单列表
var indoList = dbc.VW_OP_WMS_IN_DO_GOODS.Where(x => x.WMSDOID == new Guid(WMSDOID)).ToList();
return Json(new { ErrorCode = 0, data = indoList }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 获取进行中的出库作业单列表
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetOUTDOList(string CODENAME)
{
try
{
var userinfo = dbc.vw_user.First(x => x.CODENAME == CODENAME);
//寻找 本公司的“出库执行 1010”的出库作业单列表
var outdoList = dbc.VW_OP_WMS_OUT_DO.Where(x => x.CORPID == userinfo.COMPANYID && (x.BILLSTATUS == "1010")).ToList();
var resultdata = outdoList.Select(x => new
{
WMSDOID = x.WMSDOID,
WMSNO = x.WMSNO,
MBLNO = x.MBLNO == null ? "" : x.MBLNO,
CORPID = x.CORPID,
CUSTOMERNAME = x.CUSTOMERNAME,
DODATE = getDataStr(x.DODATE),
REMARK = x.REMARK,
TRUCKNO = x.TRUCKNO,
CNTRNO = x.CNTRNO,
}).ToList();
resultdata.Sort((x, y) => 8 * x.DODATE.CompareTo(y.DODATE) + 4 * x.CUSTOMERNAME.CompareTo(y.CUSTOMERNAME) + 2 * x.MBLNO.CompareTo(y.MBLNO));
return Json(new { ErrorCode = 0, data = resultdata }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 获取用指定gid和指定箱号共同关联的电子文档
///
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetInfoFileList(string PID, string CNTRNO)
{
try
{
var indoList = dbc.VW_INFO_FILES.Where(x => x.PID == new Guid(PID) && x.CNTRNO == CNTRNO).ToList();
var fileList = indoList.Select(x =>
new
{
GID = x.GID,
CNTRNO = x.CNTRNO,
IMAGES = x.IMGPATH.Split(',').ToList(),
ModifyDate = getDataLongStr(x.ModifyDate)
}).ToList();
var resultlist = new List<INFO_FILES_TEMP>();
foreach (var infofile in fileList) {
var newlist = new List<IMG>();
foreach (var imgpath in infofile.IMAGES) {
//var _newpath = "/DSWMSPIC/" + imgpath;
var _newpath = new IMG();
_newpath.IMGPATH = imgpath;
newlist.Add(_newpath);
}
var newresultfile = new INFO_FILES_TEMP();
newresultfile.GID = infofile.GID;
newresultfile.CNTRNO = infofile.CNTRNO;
newresultfile.IMGPATHLIST = newlist;
newresultfile.ModifyDate = infofile.ModifyDate;
resultlist.Add(newresultfile);
}
fileList.Sort((x, y) => -x.ModifyDate.CompareTo(y.ModifyDate));
return Json(new { ErrorCode = 0, data = resultlist }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 获取全部电子文档
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetInfoFileList_ALL(string ROLE_ID, string COMPANYID, string MBLNO, string CNTRNO)
{
try
{
if (string.IsNullOrWhiteSpace(MBLNO) && string.IsNullOrWhiteSpace(CNTRNO)) {
return Json(new { ErrorCode = 500, Message = "发生错误:提单号和箱号至少要填写一个" }, JsonRequestBehavior.AllowGet);
}
if (!string.IsNullOrWhiteSpace(MBLNO) && MBLNO.Length < 3)
return Json(new { ErrorCode = 500, Message = "发生错误:提单号至少要填三位" }, JsonRequestBehavior.AllowGet);
if (!string.IsNullOrWhiteSpace(CNTRNO) && CNTRNO.Length < 3)
return Json(new { ErrorCode = 500, Message = "发生错误:箱号至少要填三位" }, JsonRequestBehavior.AllowGet);
var limit = dbc.Sys_Role_Core.First(x => x.Role_Id == ROLE_ID).LimitCompanyRange;
var indoList = new List<VW_INFO_FILES>();
if (limit)
{
//var companyuserid = dbc.vw_user.Where(x => x.COMPANYID == COMPANYID).Select(s => new Guid(s.USERID)).ToList();
indoList = dbc.VW_INFO_FILES.Where(x => x.CORPID == COMPANYID).ToList();
if (!string.IsNullOrWhiteSpace(MBLNO)) {
indoList = indoList.Where(x => x.MBLNO.Contains(MBLNO)).ToList();
}
if (!string.IsNullOrWhiteSpace(CNTRNO))
{
indoList = indoList.Where(x => x.CNTRNO.Contains(CNTRNO)).ToList();
}
}
else {
if (!string.IsNullOrWhiteSpace(MBLNO))
{
indoList = dbc.VW_INFO_FILES.Where(x => x.MBLNO.Contains(MBLNO)).ToList();
if (!string.IsNullOrWhiteSpace(CNTRNO))
{
indoList = indoList.Where(x => x.CNTRNO.Contains(CNTRNO)).ToList();
}
}
else
if (!string.IsNullOrWhiteSpace(CNTRNO))
{
indoList = dbc.VW_INFO_FILES.Where(x => x.CNTRNO.Contains(CNTRNO)).ToList();
}
//indoList = dbc.VW_INFO_FILES.Where(x => (x.MBLNO.Contains(MBLNO) )).ToList();
}
indoList = indoList.Where(x => x.IMGPATH != null && x.IMGPATH != "").ToList();
var fileList = indoList.Select(x =>
new
{
GID = x.GID,
PWORKTYPE = x.PWORKTYPE,
MBLNO = x.MBLNO,
CNTRNO = x.CNTRNO,
Modifier = x.Modifier,
ModifyDate = getDataLongStr(x.ModifyDate),
IMAGES = x.IMGPATH.Split(',').ToList()
}).ToList();
var resultlist = new List<INFO_FILES_TEMP2>();
foreach (var infofile in fileList)
{
var newlist = new List<IMG>();
foreach (var imgpath in infofile.IMAGES)
{
//var _newpath = "/DSWMSPIC/" + imgpath;
var _newpath = new IMG();
_newpath.IMGPATH = imgpath;
newlist.Add(_newpath);
}
var newresultfile = new INFO_FILES_TEMP2();
newresultfile.GID = infofile.GID;
newresultfile.CNTRNO = infofile.CNTRNO == null ? "" : infofile.CNTRNO;
newresultfile.MBLNO = infofile.MBLNO == null ? "" : infofile.MBLNO;
newresultfile.PWORKTYPE = infofile.PWORKTYPE;
newresultfile.IMGPATHLIST = newlist;
newresultfile.ModifyDate = infofile.ModifyDate;
resultlist.Add(newresultfile);
}
resultlist.Sort((x, y) => 4 * x.MBLNO.CompareTo(y.MBLNO) + 2 * x.CNTRNO.CompareTo(y.CNTRNO) + x.ModifyDate.CompareTo(y.ModifyDate));
return Json(new { ErrorCode = 0, data = resultlist }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 获取货物库位信息
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetAREAGOODS(string ROLE_ID, string COMPANYID, string MBLNO, string CNTRNO)
{
try
{
if (string.IsNullOrWhiteSpace(MBLNO) && string.IsNullOrWhiteSpace(CNTRNO))
{
return Json(new { ErrorCode = 500, Message = "发生错误:提单号和箱号至少要填写一个" }, JsonRequestBehavior.AllowGet);
}
if (!string.IsNullOrWhiteSpace(MBLNO) && MBLNO.Length < 3)
return Json(new { ErrorCode = 500, Message = "发生错误:提单号至少要填三位" }, JsonRequestBehavior.AllowGet);
if (!string.IsNullOrWhiteSpace(CNTRNO) && CNTRNO.Length < 3)
return Json(new { ErrorCode = 500, Message = "发生错误:箱号至少要填三位" }, JsonRequestBehavior.AllowGet);
var limit = dbc.Sys_Role_Core.First(x => x.Role_Id == ROLE_ID).LimitCompanyRange;
var resultList = new List<VW_OP_WMS_AREAGOODS>();
if (!string.IsNullOrWhiteSpace(MBLNO))
{
resultList = dbc.VW_OP_WMS_AREAGOODS.Where(x => x.MBLNO.Contains(MBLNO)).ToList();
if (!string.IsNullOrWhiteSpace(CNTRNO)) {
resultList = resultList.Where(x => x.CNTRNO.Contains(CNTRNO)).ToList();
}
}
else {
resultList = dbc.VW_OP_WMS_AREAGOODS.Where(x => (x.CNTRNO.Contains(CNTRNO))).ToList();
}
if (limit)
{
resultList = resultList.Where(x => x.CORPID == COMPANYID).ToList();
}
else
{
}
if (resultList != null)
resultList.Sort((x, y) => 4 * x.MBLNO.CompareTo(y.MBLNO) + 2 * x.CNTRNO.CompareTo(y.CNTRNO) + x.AREANAME.CompareTo(y.AREANAME));
return Json(new { ErrorCode = 0, data = resultList }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
//#endregion
/// <summary>
/// 目前用于裕龙版本的微信小程序
/// </summary>
/// <returns></returns>
[HttpPost]
public ActionResult UploadFile()
{
try
{
if (Request.Files.Count > 0)
{
var pid = Request.Form["pid"].ToString().Trim();
var mblno = Request.Form["mblno"].ToString().Trim();
var cntrno = Request.Form["cntrno"].ToString().Trim();
var codename = Request.Form["codename"].ToString().Trim();
var pworktype = Request.Form["pworktype"].ToString().Trim();
var userinfo = dbc.vw_user.First(x => x.CODENAME == codename);
var dayfilepath = DateTime.Today.ToString("yyyyMMdd");
var InfoFilesPath = "Upload/Tables/VW_INFO_FILES/" + dayfilepath;//保存到数据库info_files表的路径
string upDir = Path.Combine(ConfigurationManager.AppSettings["DSWMSPICPATH"], InfoFilesPath);
if (!Directory.Exists(upDir))
{
Directory.CreateDirectory(upDir);
}
//H:\DSWMS\Vue.Net\VOL.WebApi\wwwroot\Upload/Tables/VW_INFO_FILES/202012100909412467/1.jpg
//新增一条电子档案info_files
var newInfoFiles = new INFO_FILES(new Guid(pid), pworktype, mblno, cntrno);
newInfoFiles.setuser(userinfo);
for (int c = 0; c < Request.Files.Count; c++)
{
var uploadFile = Request.Files[c];
if (uploadFile.ContentLength == 0)
{
continue;
}
var extension = Path.GetExtension(uploadFile.FileName);
var timename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + new Random().Next(100, 999) + extension;
var filepath = "\\" + timename;//随机生成文件名
var infofilepath = InfoFilesPath + "/" + timename;
var savePath = upDir + filepath;
uploadFile.SaveAs(savePath);
if (!string.IsNullOrWhiteSpace(newInfoFiles.IMGPATH))
{
newInfoFiles.IMGPATH += ",";
}
newInfoFiles.IMGPATH += infofilepath;
//InfoFileList.Add(new { id = DateTime.Now.Ticks, url = relativepath + filepath, size = uploadFile.ContentLength });
}
dbc.INFO_FILES.Add(newInfoFiles);
dbc.SaveChanges();
return Json(new { Success = true, Message = "上传成功", Data = JsonConvert.SerializeObject(newInfoFiles) });
}
}
catch (Exception e) {
return Json(new { Success = false, Message = e.Message });
}
return Json(new { Success = false, Message = "没有文件" });
}
/// <summary>
/// 删除电子文档
/// 如果关联的入库执行没有处于1001状态则不允许删除
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult DelInfoFiles(string GID)
{
try
{
//1首先找到这条电子文档
var infofile = dbc.INFO_FILES.FirstOrDefault(x => x.GID == new Guid(GID));
if (infofile == null) return ErrorResult("没有可以删除的文件");
//2判断关联业务的状态 看能否删除
if (infofile.PWORKTYPE == "入库执行") {
var indo = dbc.VW_OP_WMS_IN_DO.FirstOrDefault(x => x.WMSDOID == infofile.PID);
if (indo == null) return ErrorResult("没有可以删除的文件");
if (indo.BILLSTATUS != "1001") return ErrorResult("业务完成,不可删除");
}
//3执行删除
CommMng.DAL.BasicDataRefDAL.ExecSql($"delete from info_files where gid='{GID}'");
}
catch (Exception e)
{
return ErrorResult(e.Message);
}
return ErrorResult("没有可以删除的文件");
}
private ActionResult ErrorResult(string msg) {
return Json(new { Success = false, Message = "msg" });
}
/// <summary>
/// 虎鲸 小程序
/// 获取该用户需要执行的业务
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
//[HttpGet]
/*
public ActionResult GetCTNMNGList(string USERID)
{
try
{
var resultList = new List<OP_YARD_CTNMNG>();
var cdc = new CommonDataContext();
var wx = new WxAppDataContext();
//寻找这个人需要执行的业务内容
//寻找OP_YARD_CTNMNG_WORK当中OP=这个人 且WORKSTATUS为空或为未处理的
//将这些OP_YARD_CTNMNG_WORK的父节点返回
//var _user = cdc.Users.FirstOrDefault(x => x.CODENAME == CODENAME);
var detailList = wx.OP_YARD_CTNMNG_WORK.Where(x => x.OP.ToString().ToUpper() == USERID.ToUpper() && (x.WORKSTATUS==""|| x.WORKSTATUS == null || x.WORKSTATUS=="未处理")).ToList();
if (detailList != null && detailList.Count > 0) {
var bsnoList = detailList.Select(s => s.BSNO).ToList();
var headlist = wx.OP_YARD_CTNMNG.Where(x => bsnoList.Contains(x.GID)).ToList();
if (headlist != null && headlist.Count > 0) {
resultList = headlist;
}
}
return Json(new { ErrorCode = 0, data = resultList }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
*/
private string (string USERID) {
var wx = new WxAppDataContext();
var userinfo = wx.vw_user.First(x => x.USERID == USERID);
var userrole = wx.Sys_Role_Core.First(x => x.Role_Id == userinfo.Role_Id);
var worktype_startstr = "";
if (userrole.RoleName == "调度")
{
worktype_startstr = "调度";
}
if (userrole.RoleName == "场站")
{
worktype_startstr = "场站";
}
return worktype_startstr;
}
/// <summary>
/// 虎鲸 小程序
/// 获取该用户需要执行的业务列表
/// </summary>
/// <param name="logininfo"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetCTNMNGList(string USERID)
{
try
{
var resultList = new List<VW_OP_YARD_CTNMNG_HUJINGWXHeadList>();
//var cdc = new CommonDataContext();
var wx = new WxAppDataContext();
//寻找这个人需要执行的业务内容
//寻找标准1 预计入场日期小于等于今天的预约业务
//寻找标准2 根据用户角色定义查询范围
//如果用户角色名为调度 则只显示 调度开头的worktype
//将这些OP_YARD_CTNMNG_WORK的父节点OP_YARD_CTNMNG返回
//var _user = cdc.Users.FirstOrDefault(x => x.CODENAME == CODENAME);
var worktype_startstr = (USERID);
//今天
var endTime = DateTime.Today.AddDays(1).AddSeconds(-1);//.ToUniversalTime().ToString();
var idlist = wx.OP_YARD_CTNMNG.Where(x => x.ENTERDATE <= endTime && x.BILLSTATUS_CUST != "已出场").Select(s => s.GID).ToList();
//BasicDataRefDAL.SaveLog(headidlist, "", "wxapp", "虎鲸列表1");
var detailList = wx.OP_YARD_CTNMNG_WORK.Where(x => idlist.Contains(x.BSNO) && x.WORKTYPE.StartsWith(worktype_startstr) && (x.WORKSTATUS == "未处理")).ToList();
//BasicDataRefDAL.SaveLog(detailList, "", "wxapp", "虎鲸列表2");
var userloadport = GetLoadPortList(USERID);
//BasicDataRefDAL.SaveLog(userloadport, "", "wxapp", "虎鲸列表3");
if (detailList != null && detailList.Count > 0)
{
List<Guid> idList = detailList.Select(s => s.BSNO).Distinct().ToList();
var tempList = wx.VW_OP_YARD_CTNMNG_HUJINGWXHeadList.Where(x =>
idList.Contains(x.GID)
&& userloadport.Contains(x.LOADPORT)
).ToList();
List<Guid> IDList = tempList.Select(s => (Guid)s.BlockTrainOrderGid).ToList();
string get(Guid BlockTrainOrderGid)
{
return detailList.FirstOrDefault(x => x.BSNO == get(BlockTrainOrderGid).GID).TRUCKNO;
}
VW_OP_YARD_CTNMNG_HUJINGWXHeadList get(Guid BlockTrainOrderGid)
{
return tempList.FirstOrDefault(x => x.BlockTrainOrderGid == BlockTrainOrderGid);
}
//如果同时有堆场和保税预约 则只返回堆场预约
//且将BILLTYPE设定为 堆场预约/保税预约
foreach (var bsno in IDList) {
if (tempList.Exists(x => x.BlockTrainOrderGid == bsno && x.AppointType == "yard"))
{
var newrec = tempList.First(x => x.BlockTrainOrderGid == bsno && x.AppointType == "yard");
newrec.BILLTYPE = "堆场预约";
if (tempList.Exists(x => x.BlockTrainOrderGid == bsno && x.AppointType == "yard")) {
newrec.BILLTYPE += "/保税预约";
}
if (resultList.Exists(x => x.BlockTrainOrderGid == bsno))
continue;
if (get(bsno).BILLSTATUS_CUST == "待出场") {
newrec.TRUCKNO = get(bsno);
}
resultList.Add(newrec);
}
else
{
var newrec = tempList.First(x => x.BlockTrainOrderGid == bsno && x.AppointType == "bond");
newrec.BILLTYPE = "保税预约";
if (get(bsno).BILLSTATUS_CUST == "待出场")
{
newrec.TRUCKNO = get(bsno);
}
resultList.Add(newrec);
}
}
//BasicDataRefDAL.SaveLog(resultList, "", "wxapp", "虎鲸列表4");
//foreach (var item in resultList) {
// item.BILLTYPE = detailList.FirstOrDefault(x => x.BSNO == item.GID).WORKTYPE;
//}
//resultList = wx.VW_OP_YARD_CTNMNG_HUJINGWXHeadList.Where(x => 1 == 1).ToList();
}
return Json(new { ErrorCode = 0, data = resultList }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
BasicDataRefDAL.SaveLog(e.Message, "", "wxapp", "虎鲸列表e");
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 虎鲸 小程序
/// 点击待执行业务进行的查询
/// </summary>
/// <param name="GID"></param>
/// <param name="USERID"></param>
/// <returns></returns>
[HttpGet]
public ActionResult GetCTNMNGWORK_NeedDo(string GID, string USERID)
{
try
{
var result = new OP_YARD_CTNMNG_WORK();
//var cdc = new CommonDataContext();
var wx = new WxAppDataContext();
//寻找这个人在这项业务中需要执行的业务内容并返回其中orderno最小的一项
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID.ToString().ToUpper() == GID.ToUpper());
var order = wx.tb_BlockTrainOrder.FirstOrDefault(x => x.Gid == head.BlockTrainOrderGid);
var worktype_startstr = (USERID);
var detailList = wx.OP_YARD_CTNMNG_WORK.Where(x => x.BSNO == new Guid(GID) && x.WORKTYPE.StartsWith(worktype_startstr) && (x.WORKSTATUS == "未处理")).ToList();
if (detailList != null && detailList.Count > 0)
{
detailList = detailList.OrderBy(o => o.ORDERNO).ToList();
result = detailList[0];
}
var ImgList = new List<string>();
if (!string.IsNullOrWhiteSpace(result.IMGPATH)) {
ImgList = result.IMGPATH.Split(',').ToList();
}
var headlistrec = wx.VW_OP_YARD_CTNMNG_HUJINGWXHeadList.FirstOrDefault(x => x.GID == result.BSNO);
var truckno = head.TRUCKNO;
if (result.WORKTYPE == "场站出场")
{
truckno = result.TRUCKNO;
}
var _result = new { result.GID, BILLTYPE = head.AppointType_STR, CNTRNO = order.BoxCode, head.BILLSTATUS_CUST, CTNSTATUS = order.BoxStatus, result.WORKTYPE, result.WORKSTATUS, TRUCKNO = truckno, AREACODE = headlistrec.AREACODE, AREANAME = headlistrec.AREANAME, ImgList };
return Json(new { ErrorCode = 0, data = _result }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
BasicDataRefDAL.SaveLog(e.Message, "", "wxapp", "工作明细");
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
[HttpGet]
public ActionResult GetCTNMNGWORK(string GID)
{
try
{
//var result = new OP_YARD_CTNMNG_WORK();
//var cdc = new CommonDataContext();
var wx = new WxAppDataContext();
var result = wx.OP_YARD_CTNMNG_WORK.FirstOrDefault(x => x.GID == new Guid(GID));
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == result.BSNO);
var order = wx.tb_BlockTrainOrder.FirstOrDefault(x => x.Gid == head.BlockTrainOrderGid);
var ImgList = new List<string>();
if (!string.IsNullOrWhiteSpace(result.IMGPATH))
{
ImgList = result.IMGPATH.Split(',').ToList();
}
var _result = new { result.GID, BILLTYPE = head.AppointType_STR, CNTRNO = order.BoxCode, head.BILLSTATUS_CUST, CTNSTATUS = order.BoxStatus, result.WORKTYPE, result.WORKSTATUS, TRUCKNO = head.TRUCKNO, ImgList };
return Json(new { ErrorCode = 0, data = _result }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
[HttpGet]
public ActionResult GetCanUseAreaCode(string USERID)
{
try
{
var result = new List<VW_OP_YARD_CTNMNG_STOREAREA_CANUSE>();
var wx = new WxAppDataContext();
var AreaCodeHeadList = GetAreaCodeHeadList(USERID);
var _r = wx.VW_OP_YARD_CTNMNG_STOREAREA_CANUSE.Where(x => 1 == 1).ToList();
if (AreaCodeHeadList != null && AreaCodeHeadList.Count > 0) {
foreach (var item in _r)
foreach (var headstr in AreaCodeHeadList)
{
if (item.AREACODE.StartsWith(headstr)) {
result.Add(item);
}
}
}
result.Sort(delegate (VW_OP_YARD_CTNMNG_STOREAREA_CANUSE p1, VW_OP_YARD_CTNMNG_STOREAREA_CANUSE p2)
{
return p1.AREACODE.CompareTo(p2.AREACODE);
});
return Json(new { ErrorCode = 0, data = result }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
return Json(new { ErrorCode = 500, Message = "发生错误:" + e.Message }, JsonRequestBehavior.AllowGet);
}
}
[HttpPost]
public ActionResult UploadFile_CTNMNG()
{
try
{
var GID = Request.Form["GID"].ToString().Trim();
var ISEND = Request.Form["ISEND"].ToString().Trim() == "true";
var TRUCKNO = Request.Form["TRUCKNO"].ToString().Trim();
var CNTRNO = Request.Form["CNTRNO"].ToString().Trim();
var USERID = Request.Form["USERID"].ToString().Trim();
var AREACODE = Request.Form["AREACODE"].ToString().Trim();
var DODATE = Request.Form["DODATE"].ToString().Trim();
var dayfilepath = DateTime.Today.ToString("yyyyMMdd");
var InfoFilesPath = "Upload/Tables/VW_INFO_FILES/" + dayfilepath;//保存到数据库info_files表的路径
BasicDataRefDAL.SaveLog(new { GID, ISEND, TRUCKNO, CNTRNO, USERID, AREACODE, DODATE }, USERID, "wxapp", "虎鲸app02");
string upDir = Path.Combine(ConfigurationManager.AppSettings["DSWMSPICPATH"], InfoFilesPath);
if (!Directory.Exists(upDir))
{
Directory.CreateDirectory(upDir);
}
//H:\DSWMS\Vue.Net\VOL.WebApi\wwwroot\Upload/Tables/VW_INFO_FILES/202012100909412467/1.jpg
//向OP_YARD_CTNMNG_WORK的IMGPATH中追加图片地址。
var wx = new WxAppDataContext();
var workdetail = wx.OP_YARD_CTNMNG_WORK.FirstOrDefault(x => x.GID.ToString().ToUpper() == GID.ToUpper());
//判断此次上传图片数量加上现有图片是否超6张 如果是则返回错误
//改为app端判断
//var CurrentImgCount = workdetail.IMGPATH.Split(',').ToList().Count();
//var updcount = Request.Files.Count;
//if (CurrentImgCount + updcount > 6) {
// return Json(new { Success = false, Message = "图片数量超过6张请确认后重新上传" });
//}
if (Request.Files.Count > 0)
{
for (int c = 0; c < Request.Files.Count; c++)
{
var uploadFile = Request.Files[c];
if (uploadFile.ContentLength == 0)
{
continue;
}
var extension = Path.GetExtension(uploadFile.FileName);
var timename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + new Random().Next(100, 999) + extension;
var filepath = "\\" + timename;//随机生成文件名
var infofilepath = InfoFilesPath + "/" + timename;
var savePath = upDir + filepath;
uploadFile.SaveAs(savePath);
if (!string.IsNullOrWhiteSpace(workdetail.IMGPATH))
{
workdetail.IMGPATH += ",";
}
workdetail.IMGPATH += infofilepath;
//InfoFileList.Add(new { id = DateTime.Now.Ticks, url = relativepath + filepath, size = uploadFile.ContentLength });
}
wx.SaveChanges();
}
if (ISEND) {
workdetail.WORKSTATUS = "已处理";
//重新计算业务状态和集装箱状态
//var _r = DealStatus(workdetail,TRUCKNO,CNTRNO);
//if (!_r.Success) {
// return Json(new { Success = false, Message = "状态处理失败", Data = _r.Message });
//}
//20220114 箱状态和预约状态变更 改为在后台系统中实现
//此处改为调用
SetStatus(workdetail, USERID, TRUCKNO, AREACODE, DODATE);
}
return Json(new { Success = true, Message = "上传成功", Data = JsonConvert.SerializeObject(workdetail.IMGPATH) });
}
catch (Exception e)
{
return Json(new { Success = false, Message = e.Message });
}
return Json(new { Success = false, Message = "没有文件" });
}
[HttpPost]
public ActionResult CTNMNG_WorkDo()
{
try
{
var GID = Request.Form["GID"].ToString().Trim();
var ISEND = Request.Form["ISEND"].ToString().Trim() == "true";
var TRUCKNO = Request.Form["TRUCKNO"].ToString().Trim();
var CNTRNO = Request.Form["CNTRNO"].ToString().Trim();
var USERID = Request.Form["USERID"].ToString().Trim();
var AREACODE = Request.Form["AREACODE"].ToString().Trim();
var DODATE = Request.Form["DODATE"].ToString().Trim();
BasicDataRefDAL.SaveLog(new { GID, ISEND, TRUCKNO, CNTRNO, USERID, AREACODE, DODATE }, USERID, "wxapp", "虎鲸app01");
var wx = new WxAppDataContext();
var workdetail = wx.OP_YARD_CTNMNG_WORK.FirstOrDefault(x => x.GID.ToString().ToUpper() == GID.ToUpper());
if (ISEND)
{
workdetail.WORKSTATUS = "已处理";
SetStatus(workdetail, USERID, TRUCKNO, AREACODE, DODATE);
}
//return GetCTNMNGWORK(GID);
return Json(new { Success = true, Message = "执行成功", Data = "" });
}
catch (Exception e)
{
return Json(new { Success = false, Message = e.Message });
}
return Json(new { Success = false, Message = "没有文件" });
}
public string SetStatus(OP_YARD_CTNMNG_WORK workdetail, string USERID, string TRUCKNO, string AREACODE, string DODATE) {
var result = "";
//var wx = new WxAppDataContext();
//var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
var dswmsurl = ConfigurationManager.AppSettings["DSWMSURL"] + "OP_YARD_CTNMNG/PublicFunc";
var dic = new Dictionary<string, string>();
dic.Add("TYPENAME", "CTNMNGDOWORK");
dic.Add("GID", workdetail.BSNO.ToString());
dic.Add("WORKTYPE", workdetail.WORKTYPE);
dic.Add("USERID", USERID);
dic.Add("AREACODE", AREACODE);
dic.Add("TRUCKNO", TRUCKNO);
dic.Add("DODATE", DODATE);
//BasicDataRefDAL.SaveLog(dic, USERID, "wxapp", "虎鲸app1");
var rtn = WebRequestHelper.DoPost_DSWMS(dswmsurl, dic, 50000);
BasicDataRefDAL.SaveLog("SetStatus:" + rtn, USERID, "wxapp", "虎鲸app2");
return result;
}
public class UserLoadPortListmb
{
public bool Status { get; set; }
public List<string> Data { get; set; }
}
public List<string> GetLoadPortList(string USERID) {
var dswmsurl = ConfigurationManager.AppSettings["DSWMSURL"] + "OP_YARD_CTNMNG/PublicFunc";
var dic = new Dictionary<string, string>();
dic.Add("TYPENAME", "GetUserLoadPort");
dic.Add("GID", "");
dic.Add("WORKTYPE", "");
dic.Add("USERID", USERID);
dic.Add("AREACODE", "");
dic.Add("TRUCKNO", "");
dic.Add("DODATE", "");
var rtn = WebRequestHelper.DoPost_DSWMS(dswmsurl, dic, 50000);
BasicDataRefDAL.SaveLog("GetLoadPortList:" + rtn, USERID, "wxapp", "虎鲸app");
UserLoadPortListmb pt = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoadPortListmb>(rtn);
return pt.Data;
}
public List<string> GetAreaCodeHeadList(string USERID)
{
var dswmsurl = ConfigurationManager.AppSettings["DSWMSURL"] + "OP_YARD_CTNMNG/PublicFunc";
var dic = new Dictionary<string, string>();
dic.Add("TYPENAME", "GetAreaCodeHeadList");
dic.Add("GID", "");
dic.Add("WORKTYPE", "");
dic.Add("USERID", USERID);
dic.Add("AREACODE", "");
dic.Add("TRUCKNO", "");
dic.Add("DODATE", "");
var rtn = WebRequestHelper.DoPost_DSWMS(dswmsurl, dic, 50000);
BasicDataRefDAL.SaveLog("GetAreaCodeHeadList:" + rtn, USERID, "wxapp", "虎鲸app");
UserLoadPortListmb pt = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoadPortListmb>(rtn);
return pt.Data;
}
//[HttpGet]
//public ActionResult GetAreacode_canuse() {
//}
/// <summary>
/// 删除图片
/// 如果关联的入库执行没有处于1001状态则不允许删除
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult DelFile_CTNMNG(string GID, string PICSRC)
{
try
{
var wx = new WxAppDataContext();
//1首先找到这条业务明细 和它的父节点业务
var workdetail = wx.OP_YARD_CTNMNG_WORK.FirstOrDefault(x => x.GID == new Guid(GID));
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
//2判断关联业务的状态 看能否删除
if (head.BILLSTATUS_CUST == "待发运")
{
return ErrorResult("业务完成,不可删除图片");
}
//3执行删除 即将workdetail当中的imgpath里面指定名称的图片路径去除。
var imgList = workdetail.IMGPATH.Split(',').ToList();
foreach (var img in imgList) {
if (PICSRC.IndexOf(img) > 0) {
workdetail.IMGPATH = workdetail.IMGPATH.Replace("," + img, "");
workdetail.IMGPATH = workdetail.IMGPATH.Replace(img + ",", "");
workdetail.IMGPATH = workdetail.IMGPATH.Replace(img, "");
}
}
wx.SaveChanges();
}
catch (Exception e)
{
return ErrorResult(e.Message);
}
return ErrorResult("没有可以删除的文件");
}
/*
public class 箱状态factory
{
public static 箱状态 Get箱业务(OP_YARD_CTNMNG_WORK workdetail)
{
var wx = new WxAppDataContext();
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
if (head.BILLTYPE == "保税转入")
{
return new 箱状态_保税转入(head);
}
if (head.BILLTYPE == "保税落箱" || head.BILLTYPE == "分类监管")
{
return new 箱状态_保税落箱分类监管(head);
}
if (head.BILLTYPE == "拼箱集运")
{
return new 箱状态_拼箱集运(head);
}
return null;
}
}
public abstract class 箱状态
{
public OP_YARD_CTNMNG head { get; set; }
public List<OP_YARD_CTNMNG_WORK> worklist { get; set; }
public 箱状态() { }
public abstract string Get箱状态();
}
public class 箱状态_保税转入 : 箱状态
{
public 箱状态_保税转入(OP_YARD_CTNMNG _head)
{
var wx = new WxAppDataContext();
head = _head;
//worklist = OP_YARD_CTNMNG_WORKRepository.Instance.FindAsIQueryable(x => x.BSNO == head.GID).ToList();
worklist = wx.OP_YARD_CTNMNG_WORK.Where(x => x.BSNO == head.GID).ToList();
}
public override string Get箱状态()
{
worklist = worklist.OrderBy(o => o.ORDERNO).ToList();
foreach (var item in worklist)
{
if (item.WORKSTATUS == "已处理")
{
if (item.WORKTYPE == "调度入区") head.CTNSTATUS = "待入区";
if (item.WORKTYPE == "调度出区") head.CTNSTATUS = "正在申报出区";
if (item.WORKTYPE == "卡口作业") head.CTNSTATUS = "正在前往铁路货场";
if (item.WORKTYPE == "铁路验查作业") head.CTNSTATUS = "等待铁路查验";
if (item.WORKTYPE == "铁路发运作业") head.CTNSTATUS = "待发运";
}
}
return head.CTNSTATUS;
//throw new global::System.NotImplementedException();
}
}
public class 箱状态_保税落箱分类监管 : 箱状态
{
public 箱状态_保税落箱分类监管(OP_YARD_CTNMNG _head)
{
head = _head;
var wx = new WxAppDataContext();
worklist = wx.OP_YARD_CTNMNG_WORK.Where(x => x.BSNO == head.GID).ToList();
}
public override string Get箱状态()
{
worklist = worklist.OrderBy(o => o.ORDERNO).ToList();
foreach (var item in worklist)
{
if (item.WORKSTATUS == "已处理")
{
if (item.WORKTYPE == "调度入区") head.CTNSTATUS = "待入区";
if (item.WORKTYPE == "仓库作业") head.CTNSTATUS = "已入区落箱";
if (item.WORKTYPE == "调度出区") head.CTNSTATUS = "正在申报出区";
if (item.WORKTYPE == "卡口作业") head.CTNSTATUS = "正在前往铁路货场";
if (item.WORKTYPE == "铁路验查作业") head.CTNSTATUS = "等待铁路查验";
if (item.WORKTYPE == "铁路发运作业") head.CTNSTATUS = "待发运";
}
}
return head.CTNSTATUS;
//throw new global::System.NotImplementedException();
}
}
public class 箱状态_拼箱集运 : 箱状态
{
public 箱状态_拼箱集运(OP_YARD_CTNMNG _head)
{
head = _head;
var wx = new WxAppDataContext();
worklist = wx.OP_YARD_CTNMNG_WORK.Where(x => x.BSNO == head.GID).ToList();
}
public override string Get箱状态()
{
worklist = worklist.OrderBy(o => o.ORDERNO).ToList();
foreach (var item in worklist)
{
if (item.WORKSTATUS == "已处理")
{
if (item.WORKTYPE == "仓库作业") head.CTNSTATUS = "正在装箱";
if (item.WORKTYPE == "调度入区") head.CTNSTATUS = "待入区";
if (item.WORKTYPE == "调度出区") head.CTNSTATUS = "正在申报出区";
if (item.WORKTYPE == "卡口作业") head.CTNSTATUS = "正在前往铁路货场";
if (item.WORKTYPE == "铁路验查作业") head.CTNSTATUS = "等待铁路查验";
if (item.WORKTYPE == "铁路发运作业") head.CTNSTATUS = "待发运";
}
}
return head.CTNSTATUS;
//throw new global::System.NotImplementedException();
}
}
*/
/// <summary>
/// 用于微信小程序修改车号和箱号
/// </summary>
/// <param name="workdetail"></param>
/// <param name="TRUCKNO"></param>
/// <param name="CNTRNO"></param>
/// <returns></returns>
///
/*
public DBResult DealStatus(OP_YARD_CTNMNG_WORK workdetail,string TRUCKNO,string CNTRNO) {
var wx = new WxAppDataContext();
//只有 调度入区 作业允许修改箱号
if (workdetail.WORKTYPE == "调度入区") {
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
head.CNTRNO = CNTRNO;
wx.SaveChanges();
}
//只有 调度入区/调度出区/卡口作业 允许修改工作明细的车号
if (workdetail.WORKTYPE == "调度入区"|| workdetail.WORKTYPE == "调度出区" || workdetail.WORKTYPE == "卡口作业")
{
//workdetail.TRUCKNO = TRUCKNO;
var changerecord = wx.OP_YARD_CTNMNG_WORK.FirstOrDefault(x => x.GID == workdetail.GID);
changerecord.TRUCKNO = TRUCKNO;
if (workdetail.WORKTYPE == "调度入区") {
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
head.TRUCKNO_IN = TRUCKNO;
}
if (workdetail.WORKTYPE == "调度出区")
{
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
head.TRUCKNO_OUT = TRUCKNO;
}
wx.SaveChanges();
}
return DealStatus( workdetail);
}
public DBResult DealStatus(OP_YARD_CTNMNG_WORK workdetail)
{
var result = new DBResult();
try
{
var wx = new WxAppDataContext();
//分为两部分。一部分是更改顺序号较低业务的状态,由空改为未执行
//二部分是根据目前该业务的各明细的执行状态(状态为已处理的那条明细),修改该业务的箱状态
//《1》业务逻辑如下查找所有顺序小于该明细的业务明细如果WORKSTATUS="",将之更新为 "未处理"
result = DelOldDetail(workdetail);
if (!result.Success) return result;
//《2》业务逻辑如下查找状态为“已处理”的最大顺序号业务配合其“引入方式”获取其对应的箱状态 并写入主表
//var f = new 箱状态factory();
var 箱业务 = 箱状态factory.Get箱业务(workdetail);
var head = wx.OP_YARD_CTNMNG.FirstOrDefault(x => x.GID == workdetail.BSNO);
head.CTNSTATUS = 箱业务.Get箱状态();
wx.SaveChanges();
result.OK();
return result;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
}
private static DBResult DelOldDetail(OP_YARD_CTNMNG_WORK workdetail)
{
var result = new DBResult();
var wx = new WxAppDataContext();
var oldDetailList = wx.OP_YARD_CTNMNG_WORK.Where(x => x.BSNO == workdetail.BSNO && x.ORDERNO < workdetail.ORDERNO).ToList();
if (oldDetailList == null || oldDetailList.Count == 0) {
result.OK();
return result;
}
//var updList = new List<OP_YARD_CTNMNG_WORK>();
var needupd = false;
foreach (var item in oldDetailList)
{
if (item.WORKSTATUS == "")
{
item.WORKSTATUS = "未处理";
//updList.Add(item);
needupd = true;
}
}
if (needupd)
{
//var i = OP_YARD_CTNMNG_WORKRepository.Instance.UpdateRange(updList, true);
wx.SaveChanges();
}
result.OK();
return result;
}
*/
#region 方合派车小程序
//三个功能
//1依据司机表验证登陆
//2 司机查看业务 小程序需要的字段名对应东胜派车管理里的字段
//提单号、船名航次、提箱场站、装货日期(到时分秒)、派车申请人、装货工厂、装货地址、箱型箱量、件数、重量、体积、货物标识、品名、危品登记、危品编号
//、集装箱明细(包含箱型、箱号、封号)司机注意事项、放在附件管理里的司机携带的提箱单和罐证等文件(需要司机可以下载)
//3 录入费用列表 提交后向待办事务表中添加
// 如重复添加则更新
public class DriverLoginInfo : LoginInfo
{
public string TEL { get; set; }
}
/// <summary>
/// 用于派车的微信小程序
/// </summary>
/// <returns></returns>
[HttpPost]
public ActionResult UploadFile_PC()
{
try
{
if (Request.Files.Count > 0)
{
var pcheadid = Request.Form["gid"].ToString().Trim();
var openid = Request.Form["openid"].ToString().Trim();
var condition = $" t.GId='{pcheadid}'";
var dataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
var pchead = new MsWlPcHead_WFSDEdit();
if (dataList != null && dataList.Count > 0)
{
pchead = dataList[0];
}
else {
return Json(new { Success = false, Message = "没有找到业务" });
}
var urlpath = "../../UploadFiles/MsOpFiles/tMsWlPcHead/" + pchead.BillNo;
var InfoFilesPath = Server.MapPath(urlpath);//保存到数据库info_files表的路径
if (!Directory.Exists(InfoFilesPath))
{
Directory.CreateDirectory(InfoFilesPath);
}
//新增receiptdoc
var cdc = new Common.DB.CommonDataContext();
var driverInfo = cdc.tMsWlDriver.FirstOrDefault(x => x.OPENID == openid);
for (int c = 0; c < Request.Files.Count; c++)
{
var uploadFile = Request.Files[c];
if (uploadFile.ContentLength == 0)
{
continue;
}
var newInfoFiles = new Receipt_Doc_md(pcheadid);
var extension = Path.GetExtension(uploadFile.FileName);
var timename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + new Random().Next(100, 999) + extension;
var filepath = "\\" + timename;//随机生成文件名
var infofilepath = urlpath + "/" + timename;
var savePath = InfoFilesPath + filepath;
uploadFile.SaveAs(savePath);
newInfoFiles.SetFile(driverInfo.DrvName, "司机上传", uploadFile.FileName, infofilepath);
cdc.Receipt_Doc.Add(newInfoFiles);
}
cdc.SaveChanges();
return Json(new { Success = true, Message = "上传成功" });
}
}
catch (Exception e)
{
return Json(new { Success = false, Message = e.Message });
}
return Json(new { Success = false, Message = "没有文件" });
}
[HttpPost]
public ActionResult DriverFirstLogin(DriverLoginInfo logininfo)
{
var cdc = new DSWeb.Common.DB.CommonDataContext();
try
{
//1首先根据手机号和密码 判断是否存在 如不存在 返回否 结束
var DriverList = cdc.tMsWlDriver.Where(x => x.Mobile == logininfo.TEL && x.PassWord == logininfo.password).ToList();
if (DriverList == null || DriverList.Count == 0) {
return Json(new { ErrorCode = 500, Message = "电话或密码错误" }, JsonRequestBehavior.AllowGet);
}
var Driver = DriverList[0];
if (Driver.ISSTOP == null || Driver.ISSTOP == true) {
return Json(new { ErrorCode = 500, Message = "该账户还未启用" }, JsonRequestBehavior.AllowGet);
}
var obj = getOpenId(logininfo.AuthCode);
if (obj.errcode == 0)
{
var userWxList = cdc.tMsWlDriver.Where(x => x.OPENID == obj.openid && x.DrvCode != Driver.DrvCode).ToList();
if (userWxList.Count > 0)
{
//将所有使用这个openid的其他司机数据的openid置为
foreach (var item in userWxList)
{
item.OPENID = "";
cdc.tMsWlDriver.AddOrUpdate(item);
}
}
Driver.OPENID = obj.openid;
cdc.tMsWlDriver.AddOrUpdate(Driver);
cdc.SaveChanges();
BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录3");
return Json(new
{
ErrorCode = 0,
Message = "获取成功",
BaseInfo = new { Driver.DrvName, Driver.Mobile, Driver.OPENID }
},
JsonRequestBehavior.AllowGet);
}
}
catch (Exception e)
{
BasicDataRefDAL.SaveLog("", e.Message, "wxapp", "登陆错误");
//log.Debug("wxapp登陆错误" + e.Message);
}
//BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录f");
return Json(new { ErrorCode = 500, Message = "发生错误" }, JsonRequestBehavior.AllowGet);
}
[HttpGet]
public ActionResult GetDriverInfo(string code)
{
try
{
var obj = getOpenId(code);
var cdc = new Common.DB.CommonDataContext();
var Driver = cdc.tMsWlDriver.FirstOrDefault(x => x.OPENID == obj.openid && (x.ISSTOP == null || x.ISSTOP == false));
if (Driver != null)
{
return Json(new
{
ErrorCode = 0,
Message = "获取成功",
BaseInfo = new { Driver.DrvName, Driver.Mobile, Driver.OPENID }
},
JsonRequestBehavior.AllowGet);
}
else
{
//BasicDataRefDAL.SaveLog("", "", "wxapp", "获取用户信息2");
return Json(new { ErrorCode = -1, Message = "用户不存在" }, JsonRequestBehavior.AllowGet);
}
//BasicDataRefDAL.SaveLog("", "", "wxapp", "获取用户信息3");
return Json(new { ErrorCode = 500, Message = "发生错误" }, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
//log.Debug("获取信息错误" + e.Message);
//BasicDataRefDAL.SaveLog("错误", e.Message, "wxapp", "获取用户信息");
return Json(new { ErrorCode = 500, Message = e.Message }, JsonRequestBehavior.AllowGet);
}
}
public class FHParam : AppParam
{
public string openid { get; set; }
}
public class FHParam_ChangePwd : FHParam
{
public string userOldPwd { get; set; }
public string userNewPwd1 { get; set; }
public string userNewPwd2 { get; set; }
public DBResult SavePwd() {
var result = new DBResult();
try
{
var cdc = new Common.DB.CommonDataContext();
//
var driverlist = cdc.tMsWlDriver.Where(x => x.OPENID == openid && x.ISSTOP == false).ToList();
if (driverlist == null || driverlist.Count == 0)
{
result.SetErrorInfo("没有找到当前用户");
return result;
}
var driver = driverlist[0];
if (driver.PassWord != userOldPwd)
{
result.SetErrorInfo("原密码不正确");
return result;
}
if (userNewPwd1 != userNewPwd2)
{
result.SetErrorInfo("新密码两次录入不一致");
return result;
}
driver.PassWord = userNewPwd1;
cdc.tMsWlDriver.AddOrUpdate(driver);
cdc.SaveChanges();
result.OK("密码修改成功");
} catch (Exception e) {
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
/// <summary>
/// 当前该司机所能看到的待办业务
/// </summary>
public class FHParam_ : FHParam
{
public DBResult GetPCList()
{
var result = new DBResult();
try
{
//查询这个openid对应的司机的drvcode的 tMsWlPcHead 信息
//查询条件 isend=0 drvcode in(select drvcode from tMsWlDriver where openid=)
var condition = $" t.isend=0 and DrvCode in(select drvCode from tMsWlDriver where openid='{openid}')";
var dataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
if (dataList != null && dataList.Count > 0)
{
var bsnoList = dataList.Select(s => s.gId).ToList();
var cdc = new Common.DB.CommonDataContext();
var tasklist = cdc.op_task.Where(x => bsnoList.Contains(x.BSNO)).ToList();
foreach (var item in dataList)
{
if (tasklist.Exists(x => x.BSNO == item.gId)) {
var rec = tasklist.FirstOrDefault(x => x.BSNO == item.gId);
item.TASKSTATUS = rec.TASKSTATUS;
}
}
}
result.Data = dataList;
return result;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
/// <summary>
/// 当前司机的已完成业务
/// </summary>
public class FHParam_ : FHParam
{
public DBResult GetPCList()
{
var result = new DBResult();
try
{
//查询这个openid对应的司机的drvcode的 tMsWlPcHead 信息
//查询条件 isend=0 drvcode in(select drvcode from tMsWlDriver where openid=)
var condition = $" t.isend=1 and DrvCode in(select drvCode from tMsWlDriver where openid='{openid}')";
var dataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
if (dataList != null && dataList.Count > 0)
{
var bsnoList = dataList.Select(s => s.gId).ToList();
var cdc = new Common.DB.CommonDataContext();
var tasklist = cdc.op_task.Where(x => bsnoList.Contains(x.BSNO)).ToList();
foreach (var item in dataList)
{
if (tasklist.Exists(x => x.BSNO == item.gId))
{
var rec = tasklist.FirstOrDefault(x => x.BSNO == item.gId);
item.TASKSTATUS = rec.TASKSTATUS;
}
}
}
result.Data = dataList;
return result;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
/// <summary>
/// 选中的一条业务
/// </summary>
public class FHParam_ : FHParam
{
public string GId { get; set; }
public DBResult GetPC()
{
var result = new DBResult();
try
{
//查询这个openid对应的司机的drvcode的 tMsWlPcHead 信息
//查询条件 isend=0 drvcode in(select drvcode from tMsWlDriver where openid=)
var condition = $" t.GId='{GId}'";
var dataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
//if (dataList != null && dataList.Count > 0)
//{
// foreach (var item in dataList)
// {
// if (!string.IsNullOrWhiteSpace(item.ExpDate))
// {
// item.ExpDate = item.ExpDate.Replace(" 00:00:00", "");
// }
// }
//}
if (dataList != null && dataList.Count > 0)
{
var ctncondition = $" LE_ID='{GId}'";
var ctnlist = MsOpLetterDAL.GetLetterCtnList(ctncondition);
dataList[0].CtnList = ctnlist;
var doccondition = $" BSNO='{GId}'";
var doclist = ReceiptDocDAL.GetDocList(doccondition);
var paramset = MsSysParamSetDAL.GetDataByName("DS7URL");
var ds7url = paramset.PARAMVALUE;
if (doclist != null && doclist.Count > 0) {
foreach (var item in doclist)
{
item.Driect_URL = item.Driect_URL.Replace("../../", ds7url);
}
}
dataList[0].DocList = doclist;
var cdc = new Common.DB.CommonDataContext();
var FeeList = cdc.ch_fee_order.Where(x => x.BSNO == GId).ToList();
if (FeeList != null && FeeList.Count > 0)
{
dataList[0].FeeList = FeeList;
}
else {
dataList[0].FeeList = new List<ch_fee_order_md>();
}
var FeeNameList = cdc.code_fee.Where(x => x.FEEGROUP == "车辆成本").ToList();
if (FeeNameList != null && FeeNameList.Count > 0)
{
dataList[0].FeeNameList = FeeNameList.Select(s => s.NAME).OrderBy(o => o).ToArray();
}
var tasklist = cdc.op_task.Where(x => x.BSNO== GId).ToList();
if (tasklist != null && tasklist.Count > 0)
{
dataList[0].TASKSTATUS = tasklist[0].TASKSTATUS;
}
result.Data = dataList[0];
}
return result;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
public class FHParam_ : FHParam
{
public MsWlPcHead_FH headData { get; set; }
public DBResult DoSave()
{
var result = new DBResult();
try
{
//var headData = DSWeb.TruckMng.Helper.JsonConvert.Deserialize<MsWlPcHead_FH>(headdatajson);
var isPost = true;
var errorstr = "";
var custno = "";
//var condition = $" t.GId='{headData.gId}'";
//var currDataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
//if (currDataList != null && currDataList.Count > 0)
//{
// var currHead = currDataList[0];
// if (currHead.isEnd == "1" || currHead.TASKSTATUS != "未提交")
// {
// result.SetErrorInfo("该状态不允许执行保存");
// return result;
// }
//}
var canchange = CanChange(headData.gId);
if (canchange.Success == false) {
return canchange;
}
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
var BSNO = headData.gId;
var modb = new ModelObjectDB();
result = modb.Save(headData);
if (result.Success) {
//保存费用
var feelist = headData.FeeList;
var cdc = new Common.DB.CommonDataContext();
var currFeeList = cdc.ch_fee_order.Where(x => x.BSNO == headData.gId).ToList();
var addFeeList = new List<ch_fee_order_md>();
var updFeeList = new List<ch_fee_order_md>();
var needupd = false;
var needadd = false;
foreach (var fee in feelist) {
if (currFeeList.Exists(x => x.GID == fee.GID))
{
var item = currFeeList.FirstOrDefault(x => x.GID == fee.GID);
var feenameorder = Convert.ToInt32(fee.F_NO);
item.F_NO = fee.F_NO;
item.FEENAME = headData.FeeNameList[feenameorder] ;
item.AMOUNT = fee.AMOUNT;
item.SetAmount(item.AMOUNT);
updFeeList.Add(item);
needupd = true;
}
else {
var newfee = new ch_fee_order_md();
var feenameorder = Convert.ToInt32(fee.F_NO);
newfee.F_NO = fee.F_NO;
newfee.FEENAME = headData.FeeNameList[feenameorder];
newfee.SetAmount(fee.AMOUNT);
newfee.GID = fee.GID;
newfee.BSNO = headData.gId;
addFeeList.Add(newfee);
needadd = true;
}
}
if (needadd)
{
foreach (var item in addFeeList)
{
cdc.ch_fee_order.AddOrUpdate(item);
}
//cdc.SaveChanges();
}
if (needupd) {
foreach (var item in updFeeList) {
cdc.ch_fee_order.AddOrUpdate(item);
}
//cdc.SaveChanges();
}
if (needadd || needupd)
{
cdc.SaveChanges();
}
}
return result;
}
catch (Exception e)
{
var errstr = JsonConvert.SerializeObject(e);
result.SetErrorInfo(errstr);
return result;
}
return result;
}
}
public static DBResult CanChange(string gid) {
var result = new DBResult();
result.OK();
var condition = $" t.GId='{gid}'";
var currDataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
if (currDataList != null && currDataList.Count > 0)
{
var currHead = currDataList[0];
if (currHead.isEnd == "1" || currHead.TASKSTATUS != "未提交")
{
result.SetErrorInfo("该状态不允许修改业务内容");
return result;
}
}
return result;
}
public class FHParam_ : FHParam {
public string FEEID { get; set; }
public MsWlPcHead_FH headData { get; set; }
public DBResult DoDelFee()
{
var result = new DBResult();
try
{
var cdc = new Common.DB.CommonDataContext();
var feelist = cdc.ch_fee_order.Where(x => x.GID == FEEID).ToList();
var canchange = CanChange(headData.gId);
if (canchange.Success == false)
{
return canchange;
}
//var condition = $" t.GId='{headData.gId}'";
//var currDataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
//if (currDataList != null && currDataList.Count > 0)
//{
// var currHead = currDataList[0];
// if (currHead.isEnd == "1" || currHead.TASKSTATUS != "未提交")
// {
// result.SetErrorInfo("该状态不允许执行保存");
// return result;
// }
//}
if (feelist != null && feelist.Count > 0) {
cdc.ch_fee_order.RemoveRange(feelist);
cdc.SaveChanges();
result.OK();
return result;
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
public class FHParam_ : FHParam_
{
public DBResult DoSubmit()
{
var result = new DBResult();
try
{
//看是否有已产生的待办事务 如果有 返回错误
//如果没有 产生之
var cdc = new Common.DB.CommonDataContext();
var currTaskList = cdc.op_task.Where(x => x.BSNO == headData.gId).ToList();
var currtask = new op_task_md();
if (currTaskList != null && currTaskList.Count > 0)
{
currtask = currTaskList[0];
if (currtask.TASKSTATUS != "未开始")
{
result.SetErrorInfo("业务已经提交,请勿重复操作");
return result;
}
else {
result = DoSave();
if (!result.Success) return result;
}
}
else {
result = DoSave();
if (!result.Success) return result;
currtask.GID = Guid.NewGuid().ToString();
currtask.BSNO= headData.gId;
currtask.TASKTYPE = "派车业务";
currtask.TASKSOURCE = "派车业务";
currtask.TASKNO= headData.gId;
currtask.TASKSTATUS = "未开始";
var driverList = cdc.tMsWlDriver.Where(x => x.OPENID == openid).ToList();
if (driverList != null && driverList.Count > 0)
{
currtask.CREATEUSER = driverList[0].DrvName;
}
else {
}
cdc.op_task.AddOrUpdate(currtask);
cdc.SaveChanges();
result.OK("提交成功");
return result;
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
public class FHParam_ : FHParam_
{
public DBResult DoSubmit()
{
var result = new DBResult();
try
{
//看是否有可以删除的待办事务 如果有 删除之
//如果没有 返回错误
var cdc = new Common.DB.CommonDataContext();
var currTaskList = cdc.op_task.Where(x => x.BSNO == headData.gId).ToList();
var currtask = new op_task_md();
if (currTaskList != null && currTaskList.Count > 0)
{
currtask = currTaskList[0];
if (currtask.TASKSTATUS == "未开始")
{
//删除待办事务
cdc.op_task.Remove(currtask);
cdc.SaveChanges();
result.OK("撤回成功");
}
else
{
result.SetErrorInfo("业务已经执行,不允许撤回");
}
}
else
{
result.SetErrorInfo("业务未提交,无法执行撤回");
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
/// <summary>
/// 查询业务的附件当中 修改人为司机的附件
/// </summary>
public class FHParam_ : FHParam
{
public string GId { get; set; }
public DBResult GetFiles()
{
var result = new DBResult();
try
{
//查询这个openid对应的司机的drvcode的 tMsWlPcHead 信息
//查询条件 isend=0 drvcode in(select drvcode from tMsWlDriver where openid=)
var condition = $" t.GId='{GId}'";
var dataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
var cdc = new Common.DB.CommonDataContext();
//if (dataList != null && dataList.Count > 0)
//{
// foreach (var item in dataList)
// {
// if (!string.IsNullOrWhiteSpace(item.ExpDate))
// {
// item.ExpDate = item.ExpDate.Replace(" 00:00:00", "");
// }
// }
//}
if (dataList != null && dataList.Count > 0)
{
var driverinfo = cdc.tMsWlDriver.FirstOrDefault(x => x.OPENID == openid);
var doccondition = $" BSNO='{GId}' and MODIFIEDUSER='{driverinfo.DrvName}'";
var doclist = ReceiptDocDAL.GetDocList(doccondition);
var paramset = MsSysParamSetDAL.GetDataByName("DS7URL");
var ds7url = paramset.PARAMVALUE;
if (doclist != null && doclist.Count > 0)
{
foreach (var item in doclist)
{
item.Driect_URL = item.Driect_URL.Replace("../../", ds7url);
}
}
result.Data = doclist;
}
return result;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
public class FHParam_ : FHParam
{
public string GId { get; set; }
public string DocGid { get; set; }
public DBResult DelFiles()
{
var result = new DBResult();
try
{
var cdc = new Common.DB.CommonDataContext();
var driverinfo = cdc.tMsWlDriver.FirstOrDefault(x => x.OPENID == openid);
var deldoccondition = $" gid='{DocGid}' and MODIFIEDUSER='{driverinfo.DrvName}'";
var deldoclist = ReceiptDocDAL.GetDocList(deldoccondition);
if (deldoclist != null && deldoclist.Count > 0) {
CommMng.DAL.BasicDataRefDAL.ExecSql($"delete from Receipt_Doc where gid='{DocGid}'");
var location = deldoclist[0].Driect_URL;
if (System.IO.File.Exists(location))
{
System.IO.File.Delete(location);
}
}
var condition = $" t.GId='{GId}'";
var dataList = MsRptPcHeadEditDAL.GetWFSDList(condition, "", "", "", "", "");
if (dataList != null && dataList.Count > 0)
{
var doccondition = $" BSNO='{GId}' and MODIFIEDUSER='{driverinfo.DrvName}'";
var doclist = ReceiptDocDAL.GetDocList(doccondition);
var paramset = MsSysParamSetDAL.GetDataByName("DS7URL");
var ds7url = paramset.PARAMVALUE;
if (doclist != null && doclist.Count > 0)
{
foreach (var item in doclist)
{
item.Driect_URL = item.Driect_URL.Replace("../../", ds7url);
}
}
result.Data = doclist;
}
return result;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
return result;
}
return result;
}
}
public FHParam getParamHelper(string jsonparam) {
var _param= JsonConvert.DeserializeObject<FHParam>(jsonparam);
if (_param.formname == "修改密码")
{
var result = JsonConvert.DeserializeObject<FHParam_ChangePwd>(jsonparam);
return result;
}
if (_param.formname == "当前业务")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "历史业务")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "派车业务")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "保存业务")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "删除费用")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "提交审核")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "撤回审核")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "司机上传附件")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
if (_param.formname == "司机删除附件")
{
var result = JsonConvert.DeserializeObject<FHParam_>(jsonparam);
return result;
}
return _param;
}
[HttpPost]
public ActionResult FHDriverInterface()
{
var cdc = new DSWeb.Common.DB.CommonDataContext();
var R1 = Request;
var R2 = Request.Form["jsonstr"].ToString();
try
{
var param = getParamHelper(R2);
if (param.formname == "修改密码")
{
var pr = (FHParam_ChangePwd)param;
var _r = pr.SavePwd();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "当前业务")
{
var pr = (FHParam_)param;
var _r = pr.GetPCList();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "历史业务")
{
var pr = (FHParam_)param;
var _r = pr.GetPCList();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "派车业务")
{
var pr = (FHParam_)param;
var _r = pr.GetPC();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "保存业务")
{
var pr = (FHParam_)param;
var _r = pr.DoSave();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "删除费用")
{
var pr = (FHParam_)param;
var _r = pr.DoDelFee();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "提交审核")
{
var pr = (FHParam_)param;
var _r = pr.DoSubmit();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "撤回审核")
{
var pr = (FHParam_)param;
var _r = pr.DoSubmit();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "司机上传附件")
{
var pr = (FHParam_)param;
var _r = pr.GetFiles();
return BasicDataRefDAL.GetContentResult(_r);
}
if (param.formname == "司机删除附件")
{
var pr = (FHParam_)param;
var _r = pr.DelFiles();
return BasicDataRefDAL.GetContentResult(_r);
}
}
catch (Exception e)
{
BasicDataRefDAL.SaveLog("", e.Message, "wxapp", "登陆错误");
//log.Debug("wxapp登陆错误" + e.Message);
}
//BasicDataRefDAL.SaveLog("", obj.openid, "wxapp", "登录f");
return Json(new { ErrorCode = 500, Message = "发生错误" }, JsonRequestBehavior.AllowGet);
}
#endregion
}
}