|
|
using System;
|
|
|
using System.IO;
|
|
|
using System.Text;
|
|
|
using System.Data;
|
|
|
using System.Data.OleDb;
|
|
|
using System.Linq;
|
|
|
using System.Web;
|
|
|
using System.Web.Mvc;
|
|
|
using System.Web.Script.Serialization;
|
|
|
using System.Web.Configuration;
|
|
|
using System.Web.Routing;
|
|
|
using System.Configuration;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Security.Principal;
|
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsCrmPriceCarrierDAL;
|
|
|
using DSWeb.MvcShipping.Models.MsCrmPriceCarrier;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
using DSWeb.EntityDA;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
|
|
|
|
|
|
//需求编号:SR2017091200003
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsCrmPriceCarrierController : Controller
|
|
|
{
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
#region 查询
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
var dataList = MsCrmPriceCarrierDAL.GetDataList(condition, start, limit, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
int count = MsCrmPriceCarrierDAL.getTotalCount(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 打印
|
|
|
public ContentResult GetDataListStr(string condition)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var dataListStr = MsCrmPriceCarrierDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 导出
|
|
|
public ContentResult GetDataListSQL(string condition)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var dataListStr = MsCrmPriceCarrierDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
//dataListStr = "select " + dataListStr + "";
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 引入 EXCEL
|
|
|
[HttpPost]
|
|
|
public ContentResult onImportClick()
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/YunJia");
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filenamepath = usercode + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + "_" + name;
|
|
|
string fileName = path + "\\" + filenamepath;
|
|
|
if (System.IO.File.Exists(fileName))
|
|
|
{
|
|
|
System.IO.File.Delete(fileName);
|
|
|
}
|
|
|
file.SaveAs(fileName);
|
|
|
|
|
|
if (!System.IO.File.Exists(fileName))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
string sError = ""; //失败提示信息
|
|
|
int InsertCount = 0; //新增条数
|
|
|
int UpdateCount = 0; //失败(更新)条数
|
|
|
int iError = 0; //失败(更新)条数
|
|
|
int iheadList = 0; //执行条数
|
|
|
string strOldDb = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=";
|
|
|
if (fileName.ToLower().IndexOf(".xlsx") > 0)
|
|
|
{
|
|
|
strOldDb = "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=\"Excel 12.0 Xml;HDR=Yes\";Data Source=";
|
|
|
}
|
|
|
OleDbConnection OleCon = new OleDbConnection(strOldDb + fileName);
|
|
|
OleDbDataAdapter OleDAp = new OleDbDataAdapter("SELECT [航线],[装货港],[卸货港],[卸货港中文],[船公司],[小柜],[小柜报价],[大柜],[大柜报价],[超高],[超高报价],[小冻],[小冻报价],[超冻],[超冻报价],[中转港],[船期],[航程],[开始日期],[结束日期],[特殊商品],[附加费],[备注] FROM [Sheet1$]", OleCon);
|
|
|
// OleDbDataAdapter OleDAp = new OleDbDataAdapter("SELECT [航线],[装货港],[卸货港],[卸货港中文],[船公司],[小柜],[大柜],[超高],[中转港],[船期],[航程],[开始日期],[结束日期],[特殊商品],[附加费],[备注] FROM [Sheet1$]", OleCon);
|
|
|
DataSet ds = new DataSet();
|
|
|
OleDAp.Fill(ds);
|
|
|
if (ds == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "无符合条件的数据";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if(ds.Tables[0].Rows.Count>0)
|
|
|
{
|
|
|
iheadList = ds.Tables[0].Rows.Count; //执行条数
|
|
|
|
|
|
#region 获取动态 集装箱列名
|
|
|
List<XiaLaKuangModel> ctnList = MsCrmPriceCarrierDAL.GetCtn();
|
|
|
string sXG = "";
|
|
|
string sDG = "";
|
|
|
string sCG = "";
|
|
|
string sXD = "";
|
|
|
string sCD = "";
|
|
|
string sXGBJ = "";
|
|
|
string sDGBJ = "";
|
|
|
string sCGBJ = "";
|
|
|
string sXDBJ = "";
|
|
|
string sCDBJ = "";
|
|
|
foreach (var enumValue in ctnList)
|
|
|
{
|
|
|
if (enumValue.NAME.ToString().Trim() == "小柜")
|
|
|
{
|
|
|
sXG = enumValue.VALUE.ToString().Trim() + "0";
|
|
|
sXGBJ = enumValue.VALUE.ToString().Trim() + "2";
|
|
|
}
|
|
|
else if (enumValue.NAME.ToString().Trim() == "大柜")
|
|
|
{
|
|
|
sDG = enumValue.VALUE.ToString().Trim() + "0";
|
|
|
sDGBJ = enumValue.VALUE.ToString().Trim() + "2";
|
|
|
}
|
|
|
else if (enumValue.NAME.ToString().Trim() == "超高")
|
|
|
{
|
|
|
sCG = enumValue.VALUE.ToString().Trim() + "0";
|
|
|
sCGBJ = enumValue.VALUE.ToString().Trim() + "2";
|
|
|
}
|
|
|
else if (enumValue.NAME.ToString().Trim() == "小冻")
|
|
|
{
|
|
|
sXD = enumValue.VALUE.ToString().Trim() + "0";
|
|
|
sXDBJ = enumValue.VALUE.ToString().Trim() + "2";
|
|
|
}
|
|
|
else if (enumValue.NAME.ToString().Trim() == "超冻")
|
|
|
{
|
|
|
sCD = enumValue.VALUE.ToString().Trim() + "0";
|
|
|
sCDBJ = enumValue.VALUE.ToString().Trim() + "2";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 获取动态 费用列名
|
|
|
List<XiaLaKuangModel> feeList = MsCrmPriceCarrierDAL.GetFeeName();
|
|
|
string sFJF = "";
|
|
|
foreach (var enumValue in feeList)
|
|
|
{
|
|
|
if (enumValue.NAME.ToString().Trim() == "附加费")
|
|
|
{
|
|
|
sFJF = enumValue.VALUE.ToString().Trim();
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
//
|
|
|
string sGID = "";
|
|
|
sError = "";
|
|
|
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
|
|
|
{
|
|
|
bool isAdd = false;
|
|
|
|
|
|
#region 获取是否有重复数据
|
|
|
string condition = "[LANE]='" + ds.Tables[0].Rows[i]["航线"].ToString() + "' and [PODLOAD]='" + ds.Tables[0].Rows[i]["装货港"].ToString() + "' and [PORTDISCHARGEID]='" + ds.Tables[0].Rows[i]["卸货港"].ToString() + "' and [PORTDISCHARGE]='" + ds.Tables[0].Rows[i]["卸货港中文"].ToString() + "' and [CARRIER]='" + ds.Tables[0].Rows[i]["船公司"].ToString() + "' and [VIA]='" + ds.Tables[0].Rows[i]["中转港"].ToString() + "' and [ETD]='" + ds.Tables[0].Rows[i]["船期"].ToString() + "' and [TT]='" + ds.Tables[0].Rows[i]["航程"].ToString() + "' and [EFFECTIVEDATE]='" + ds.Tables[0].Rows[i]["开始日期"].ToString() + "' and [VALIDDATE]='" + ds.Tables[0].Rows[i]["结束日期"].ToString() + "' and [COMMODITY]='" + ds.Tables[0].Rows[i]["特殊商品"].ToString() + "'";
|
|
|
List<MsCrmPriceCarrier> dataList = MsCrmPriceCarrierDAL.GetDataList(condition,0,1000, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null);
|
|
|
#endregion
|
|
|
|
|
|
if (dataList != null)//edit
|
|
|
{
|
|
|
if (dataList.Count > 0)
|
|
|
{
|
|
|
MsCrmPriceCarrier headRow = dataList[0];
|
|
|
if (!headRow.LOCKFLAG && !headRow.ISISSUE)//判断是否锁定或发布的数据,不是则覆盖数据
|
|
|
{
|
|
|
sGID = headRow.GID.ToString();
|
|
|
UpdateCount++; //更新条数
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iError++; //失败(更新)条数
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
else//add
|
|
|
{
|
|
|
isAdd = true;
|
|
|
}
|
|
|
}
|
|
|
else//add
|
|
|
{
|
|
|
isAdd = true;
|
|
|
}
|
|
|
if (isAdd)//add
|
|
|
{
|
|
|
MsCrmPriceCarrier headRow = new MsCrmPriceCarrier();
|
|
|
#region 默认值
|
|
|
headRow.LANE = ds.Tables[0].Rows[i]["航线"].ToString();//航线
|
|
|
headRow.PODLOAD = ds.Tables[0].Rows[i]["装货港"].ToString();//装货港
|
|
|
headRow.PORTDISCHARGEID = ds.Tables[0].Rows[i]["卸货港"].ToString();//卸货港ID
|
|
|
headRow.PORTDISCHARGE = ds.Tables[0].Rows[i]["卸货港中文"].ToString();//卸货港中文
|
|
|
headRow.CARRIER = ds.Tables[0].Rows[i]["船公司"].ToString();//船公司
|
|
|
headRow.VIA = ds.Tables[0].Rows[i]["中转港"].ToString();//中转港
|
|
|
headRow.ETD = ds.Tables[0].Rows[i]["船期"].ToString();//开航日/船期
|
|
|
headRow.TT = ds.Tables[0].Rows[i]["航程"].ToString();//航程
|
|
|
headRow.REMARK = ds.Tables[0].Rows[i]["备注"].ToString();//备注
|
|
|
if (ds.Tables[0].Rows[i]["开始日期"].ToString() != "")
|
|
|
{
|
|
|
headRow.EFFECTIVEDATE = DateTime.Parse(ds.Tables[0].Rows[i]["开始日期"].ToString());//生效期/开始日期
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (sError.IndexOf("不能导入“开始日期”为空的数据!") < 0)
|
|
|
{
|
|
|
sError += "不能导入“开始日期”为空的数据!";
|
|
|
}
|
|
|
}
|
|
|
if (ds.Tables[0].Rows[i]["结束日期"].ToString() != "")
|
|
|
{
|
|
|
headRow.VALIDDATE = DateTime.Parse(ds.Tables[0].Rows[i]["结束日期"].ToString());//有效期/结束日期
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (sError.IndexOf("不能导入“结束日期”为空的数据!") < 0)
|
|
|
{
|
|
|
sError += "不能导入“结束日期”为空的数据!";
|
|
|
}
|
|
|
}
|
|
|
headRow.COMMODITY = ds.Tables[0].Rows[i]["特殊商品"].ToString();//品名/特殊商品
|
|
|
|
|
|
headRow.LOCKFLAG = false;
|
|
|
headRow.ISISSUE = false;
|
|
|
headRow.INPUTBY = Convert.ToString(Session["USERID"]);//制单人GID
|
|
|
headRow.INPUTTIME = DateTime.Now;//创建时间
|
|
|
headRow.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次更改操作人GID
|
|
|
headRow.MODIFYTIME = DateTime.Now;//最后一次更改操作时间
|
|
|
headRow.GID = Guid.NewGuid().ToString();
|
|
|
sGID = headRow.GID.ToString();
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
#endregion
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headRow);
|
|
|
if (!result.Success)
|
|
|
{
|
|
|
iError++; //失败(更新)条数
|
|
|
continue;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
InsertCount++; //新增条数
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var XGYJ = ds.Tables[0].Rows[i]["小柜"].ToString();
|
|
|
if (XGYJ == "") XGYJ = "0";
|
|
|
var DGYJ = ds.Tables[0].Rows[i]["大柜"].ToString();
|
|
|
if (DGYJ == "") DGYJ = "0";
|
|
|
var CGYJ = ds.Tables[0].Rows[i]["超高"].ToString();
|
|
|
if (CGYJ == "") CGYJ = "0";
|
|
|
var XDYJ = ds.Tables[0].Rows[i]["小冻"].ToString();
|
|
|
if (XDYJ == "") XDYJ = "0";
|
|
|
var CDYJ = ds.Tables[0].Rows[i]["超冻"].ToString();
|
|
|
if (CDYJ == "") CDYJ = "0";
|
|
|
var XGYJBJ = ds.Tables[0].Rows[i]["小柜报价"].ToString();
|
|
|
if (XGYJBJ == "") XGYJBJ = "0";
|
|
|
var DGYJBJ = ds.Tables[0].Rows[i]["大柜报价"].ToString();
|
|
|
if (DGYJBJ == "") DGYJBJ = "0";
|
|
|
var CGYJBJ = ds.Tables[0].Rows[i]["超高报价"].ToString();
|
|
|
if (CGYJBJ == "") CGYJBJ = "0";
|
|
|
var XDYJBJ = ds.Tables[0].Rows[i]["小冻报价"].ToString();
|
|
|
if (XDYJBJ == "") XDYJBJ = "0";
|
|
|
var CDYJBJ = ds.Tables[0].Rows[i]["超冻报价"].ToString();
|
|
|
if (CDYJBJ == "") CDYJBJ = "0";
|
|
|
|
|
|
|
|
|
#region 根据动态字段名,更新集装箱与费用信息
|
|
|
string sSQL = "update crm_price_carrier_2 set [" + sXG + "]='" + XGYJ + "',[" + sDG + "]='" + DGYJ + "',[" + sCG + "]='" + CGYJ + "',[" + sXD + "]='"
|
|
|
+ XDYJ + "',[" + sCD + "]='" + CDYJ + "',[" + sXGBJ + "]='" + XGYJBJ + "',[" + sDGBJ + "]='" + DGYJBJ + "',[" + sCGBJ + "]='" + CGYJBJ + "',[" + sXDBJ + "]='"
|
|
|
+ XDYJBJ + "',[" + sCDBJ + "]='" + CDYJBJ + "',[" + sFJF + "]='" + ds.Tables[0].Rows[i]["附加费"].ToString() + "' where gid='" + sGID + "'";
|
|
|
// string sSQL = "update crm_price_carrier_2 set [" + sXG + "]='" + ds.Tables[0].Rows[i]["小柜"].ToString() + "',[" + sDG + "]='" + ds.Tables[0].Rows[i]["大柜"].ToString() + "',[" + sCG + "]='" + ds.Tables[0].Rows[i]["超高"].ToString() + "',[" + sFJF + "]='" + ds.Tables[0].Rows[i]["附加费"].ToString() + "' where gid='" + sGID + "'";
|
|
|
#endregion
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sSQL);
|
|
|
if (!bl)
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (System.IO.File.Exists(fileName))
|
|
|
{
|
|
|
System.IO.File.Delete(fileName);
|
|
|
}
|
|
|
|
|
|
if (sError.Trim() != "")
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "操作完成,共处理" + Convert.ToString(iheadList) + "条数据,其中新增" + Convert.ToString(InsertCount) + "条,覆盖" + Convert.ToString(UpdateCount) + "条,出错" + Convert.ToString(iError) + "条!错误原因:" + sError;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
jsonRespose.Success = true;
|
|
|
jsonRespose.Message = "操作完成,共处理" + Convert.ToString(iheadList) + "条数据,其中新增" + Convert.ToString(InsertCount) + "条,覆盖" + Convert.ToString(UpdateCount) + "条,出错" + Convert.ToString(iError) + "条!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 保存
|
|
|
public ContentResult Save(string body)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = new DBResult();
|
|
|
var errorstr = "";
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsCrmPriceCarrier>>(body.Replace("T00:00:00", ""));
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
MsCrmPriceCarrier headRow = new MsCrmPriceCarrier();
|
|
|
headRow = enumValue;
|
|
|
|
|
|
#region 默认值
|
|
|
headRow.LOCKFLAG = false;
|
|
|
headRow.ISISSUE = false;
|
|
|
headRow.INPUTBY = Convert.ToString(Session["USERID"]);//制单人GID
|
|
|
headRow.INPUTTIME = DateTime.Now;//创建时间
|
|
|
headRow.MODIFIEDUSER = Convert.ToString(Session["USERID"]);//最后一次更改操作人GID
|
|
|
headRow.MODIFYTIME = DateTime.Now;//最后一次更改操作时间
|
|
|
#endregion
|
|
|
|
|
|
if (enumValue.GID.ToString().Trim() == "*")//"add"
|
|
|
{
|
|
|
headRow.GID = Guid.NewGuid().ToString();
|
|
|
headRow.DbOperationType = DbOperationType.DbotIns;
|
|
|
}
|
|
|
else//"edit"
|
|
|
{
|
|
|
headRow.GID = enumValue.GID.ToString().Trim();//唯一编码
|
|
|
headRow.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headRow.ModelUIStatus = "E";
|
|
|
}
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Save(headRow);
|
|
|
if (result.Message.ToString().IndexOf("插入重复键") > -1)
|
|
|
{
|
|
|
errorstr += "重复数据不再重复插入!";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(errorstr.Trim()!="")
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "重复,不允许保存!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 删除
|
|
|
public ContentResult Delete(string gids)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.Delete(gids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 批量修改
|
|
|
public ContentResult onAlterClick(string sEFFECTIVEDATE, string sVALIDDATE, string sCTN, string sYJJB, string sFee, string gids)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onAlterClick(sEFFECTIVEDATE, sVALIDDATE, sCTN, sYJJB, sFee, gids, Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 复制
|
|
|
public ContentResult onCopyClick(string sEFFECTIVEDATE, string sVALIDDATE, string gids, string ISCOPYYJ)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onCopyClick(sEFFECTIVEDATE, sVALIDDATE, gids,ISCOPYYJ,Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 选择锁定
|
|
|
public ContentResult onLockflagClick(string gids)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onLockflagClick(gids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取消选择锁定
|
|
|
public ContentResult onNotLockflagClick(string gids)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onNotLockflagClick(gids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 全部锁定
|
|
|
public ContentResult onAllLockflagClick()
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onAllLockflagClick(Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取消全部锁定
|
|
|
public ContentResult onNotAllLockflagClick()
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onNotAllLockflagClick(Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 选择发布
|
|
|
public ContentResult onIsissueClick(string gids)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onIsissueClick(gids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取消选择发布
|
|
|
public ContentResult onNotIsissueClick(string gids)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onNotIsissueClick(gids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 全部发布
|
|
|
public ContentResult onAllIsissueClick()
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onAllIsissueClick(Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取消全部发布
|
|
|
public ContentResult onNotAllIsissueClick()
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onNotAllIsissueClick(Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 设置运价标识
|
|
|
public ContentResult onYunJiaBiaoShiClick(string gids, string sFIELDNAME, int iFIELDTYPE, string sFIELDCONTENT)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
DBResult result = MsCrmPriceCarrierDAL.onYunJiaBiaoShiClick(gids, sFIELDNAME, iFIELDTYPE, sFIELDCONTENT, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 查询运价标识
|
|
|
public ContentResult GetDataListBiaoShi(string condition, string condition2)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var dataList = MsCrmPriceCarrierDAL.GetDataListBiaoShi(condition, condition2, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var list = dataList;
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 查询修改次数
|
|
|
public ContentResult GetDataListXGCS(string condition)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var dataList = MsCrmPriceCarrierDAL.GetDataListXGCS(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var list = dataList;
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 取其他费用权限_循环列
|
|
|
public JsonResult GetFeeName()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetFeeName();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = false });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取集装箱权限_循环列
|
|
|
public JsonResult GetCtn()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetCtn();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = false });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 取报价权限_循环列
|
|
|
public JsonResult GetBaoJia()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetBaoJia();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = false });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
public JsonResult GetBaoJiaChaXun()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetBaoJiaChaXun();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = false });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 启运港,国内港口_下拉框
|
|
|
public JsonResult GetPODLOADList()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetPODLOADList();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = true, data = new XiaLaKuangModel() });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 目的港,国外港口_下拉框
|
|
|
public JsonResult GetPORTDISCHARGEList(string CODENAME)
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetPORTDISCHARGEList(CODENAME);
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = true, data = new XiaLaKuangModel() });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var ss = Json(new { success = true, data = evList.ToList() });
|
|
|
return ss;
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 中转港,国外港口_下拉框
|
|
|
public JsonResult GetVIAList()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetVIAList();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = true, data = new XiaLaKuangModel() });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var ss = Json(new { success = true, data = evList.ToList() });
|
|
|
return ss;
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 船公司_下拉框
|
|
|
public JsonResult GetCARRIERList()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetCARRIERList();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = true, data = new XiaLaKuangModel() });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 航线_下拉框
|
|
|
public JsonResult GetLANEList()
|
|
|
{
|
|
|
var evList = MsCrmPriceCarrierDAL.GetLANEList();
|
|
|
if (evList.Count == 0)
|
|
|
{
|
|
|
return Json(new { success = true, data = new XiaLaKuangModel() });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Json(new { success = true, data = evList.ToList() });
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
}
|
|
|
|