DS7_JinGang
hanxuntao 2 years ago
parent 43fb5ea25b
commit 482f15e817

@ -10,6 +10,7 @@
<appSettings>
<add key="COMPANYID" value="6bb062a3-f1dc-40a0-912b-e51e63cb7930" />
<add key="DONGSHENGVER" value="7" />
<add key="UPDATESUBCOMPANY" value="1" />
<add key="FilePath" value="D:\HXT" />
<add key="FileType" value="提单COPY" />
<!-- rabbitmq地址 -->

@ -28,7 +28,7 @@ namespace D7MqClient
private static string MQURL = ConfigurationManager.AppSettings["DJYMQURL"];
private static string connStr = ConfigurationManager.AppSettings["ConnectionString"];
private static string DSVER = ConfigurationManager.AppSettings["DONGSHENGVER"];
private static string UPDATESUBCOMPANY = ConfigurationManager.AppSettings["UPDATESUBCOMPANY"];
private const string ExchangeName = "booking";
private const string QueueName = "djy.booking.feedback.";
@ -81,6 +81,12 @@ namespace D7MqClient
SqlCommand cmd2 = new SqlCommand(strSql2.ToString(), dbcon);
var _count=cmd2.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql2.ToString()}");
if (_count == 1&& UPDATESUBCOMPANY=="1") {
var strSql3 = new StringBuilder();
strSql3.Append("exec ExeUpdateSubOpSeae '" + BSNO + "' ");
SqlCommand cmd3 = new SqlCommand(strSql3.ToString(), dbcon);
cmd3.ExecuteNonQuery();
}
}
if (!string.IsNullOrEmpty(CUSTNO))
{
@ -89,6 +95,14 @@ namespace D7MqClient
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
var _count = cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
if (_count == 1 && UPDATESUBCOMPANY == "1")
{
var BsNo = GetBsNo(dbcon, CUSTNO);
var strSql3 = new StringBuilder();
strSql3.Append("exec ExeUpdateSubOpSeae '" + BsNo + "' ");
SqlCommand cmd3 = new SqlCommand(strSql3.ToString(), dbcon);
cmd3.ExecuteNonQuery();
}
}
}
else
@ -206,7 +220,24 @@ namespace D7MqClient
};
model.BasicConsume(CompanyQueueName, true, consumer);
}
static public string GetBsNo(SqlConnection dbcon, string mblno)
{
string bsno = "";
var strSql = new StringBuilder();
strSql.Append("select BSNO from t_op_seae where CUSTNO='" + mblno + "'");
SqlDataAdapter adapter = new SqlDataAdapter(strSql.ToString(), dbcon);
DataTable table = new DataTable();
adapter.Fill(table);
if (table.Rows.Count > 0)
{
foreach (DataRow row in table.Rows)
{
bsno = Convert.ToString(row["BSNO"].ToString());
}
}
return bsno;
}
public static void StopProcess()
{
if (mqConn != null && mqConn.IsOpen)

@ -0,0 +1,220 @@
using log4net;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net;
using MailAnalyzeTools.Common;
namespace D7MqClient
{
public class JFtoDjyJdyBackNo
{
private static string COMPANYID = ConfigurationManager.AppSettings["COMPANYID"];
private static string MQURL = ConfigurationManager.AppSettings["DJYMQURL"];
private static string connStr = ConfigurationManager.AppSettings["ConnectionString"];
private static string DSVER = ConfigurationManager.AppSettings["DONGSHENGVER"];
private const string ExchangeName = "booking";
private const string QueueName = "djy.booking.feedback.";
private static IConnection mqConn;
private static ILog logger = LogManager.GetLogger("D7MqClient");
public static void DoProcess()
{
logger.Debug($"启动接收大简云订舱数据回推");
var CompanyQueueName = QueueName + COMPANYID;
ConnectionFactory factory = new ConnectionFactory();
factory.Uri = new Uri(MQURL);
mqConn = factory.CreateConnection();
IModel model = mqConn.CreateModel();
model.ExchangeDeclare(ExchangeName, ExchangeType.Direct);
model.QueueDeclare(CompanyQueueName, false, false, false, null);
var consumer = new EventingBasicConsumer(model);
consumer.Received += (ch, ea) =>
{
var body = ea.Body;
var strBody = Encoding.UTF8.GetString(body.ToArray());
logger.Debug($"收到简云订舱数据回推消息:{strBody}");
try
{
//回写数据
var feeback = JsonConvert.DeserializeAnonymousType(strBody, new { FeedbackType = string.Empty, FeedbackData = new { MBLNO = string.Empty, BSNO = string.Empty, IRCode = string.Empty, CSRCode = string.Empty, FF = string.Empty, FR = string.Empty } });
using (SqlConnection dbcon = new SqlConnection(connStr))
{
dbcon.Open();
if (feeback.FeedbackType == "IRCode"|| feeback.FeedbackType == "CSRCode") {
var IRCODE = "";
if (!string.IsNullOrEmpty(feeback.FeedbackData.IRCode)) IRCODE = feeback.FeedbackData.IRCode;
if (!string.IsNullOrEmpty(feeback.FeedbackData.CSRCode)) IRCODE = feeback.FeedbackData.CSRCode;
if (DSVER == "7")
{
var CUSTNO = "";
var BSNO = "";
if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO)) BSNO = feeback.FeedbackData.BSNO;
if (!string.IsNullOrEmpty(feeback.FeedbackData.FF)) CUSTNO = feeback.FeedbackData.FF;
if (!string.IsNullOrEmpty(feeback.FeedbackData.FR)) CUSTNO = feeback.FeedbackData.FR;
if (!string.IsNullOrEmpty(BSNO)) {
var strSql2 = new StringBuilder();
strSql2.Append("update op_seae set IRCODE='" + IRCODE + "' where BSNO='" + BSNO + "' AND ISNULL(IRCODE,'')=''");
SqlCommand cmd2 = new SqlCommand(strSql2.ToString(), dbcon);
var _count=cmd2.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql2.ToString()}");
}
if (!string.IsNullOrEmpty(CUSTNO))
{
var strSql = new StringBuilder();
strSql.Append("update op_seae set IRCODE='" + IRCODE + "' where CUSTNO='" + CUSTNO + "' AND ISNULL(IRCODE,'')=''");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
var _count = cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
}
else
{
if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO))
{
var strSql = new StringBuilder();
strSql.Append("update t_op_seae set IRCODE='" + IRCODE + "' where 业务编号='" + feeback.FeedbackData.BSNO + "'");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
else {
var CUSTNO = "";
if (!string.IsNullOrEmpty(feeback.FeedbackData.FF)) CUSTNO = feeback.FeedbackData.FF;
if (!string.IsNullOrEmpty(feeback.FeedbackData.FR)) CUSTNO = feeback.FeedbackData.FR;
var strSql = new StringBuilder();
strSql.Append("update t_op_seae set IRCODE='" + IRCODE + "' where 业务编号='" + CUSTNO + "'");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
}
}
else if (feeback.FeedbackType == "MBLNO")
{
if (!string.IsNullOrEmpty(feeback.FeedbackData.MBLNO))
{
if (DSVER == "7")
{
var CUSTNO = "";
var BSNO = "";
var IRCODE = "";
if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO)) BSNO = feeback.FeedbackData.BSNO;
if (!string.IsNullOrEmpty(feeback.FeedbackData.FR)) CUSTNO = feeback.FeedbackData.FR;
if (!string.IsNullOrEmpty(feeback.FeedbackData.IRCode)) IRCODE = feeback.FeedbackData.IRCode;
if (!string.IsNullOrEmpty(BSNO))
{
var strSql2 = new StringBuilder();
strSql2.Append("update op_seae set MBLNO='" + feeback.FeedbackData.MBLNO + "' where BSNO='" + BSNO + "' AND ISNULL(MBLNO,'')=''");
SqlCommand cmd2 = new SqlCommand(strSql2.ToString(), dbcon);
cmd2.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql2.ToString()}");
}
if (!string.IsNullOrEmpty(CUSTNO))
{
var strSql = new StringBuilder();
strSql.Append("update op_seae set MBLNO='" + feeback.FeedbackData.MBLNO + "' where (CUSTNO='" + CUSTNO + "' OR IRCODE='" + CUSTNO + "') AND (ISNULL(MBLNO,'')='' or MBLNO LIKE '%*') ");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
if (!string.IsNullOrEmpty(IRCODE))
{
var strSql = new StringBuilder();
strSql.Append("update op_seae set MBLNO='" + feeback.FeedbackData.MBLNO + "' where IRCODE='" + IRCODE + "' AND (ISNULL(MBLNO,'')='' or MBLNO LIKE '%*') ");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
}
else
{
if (!string.IsNullOrEmpty(feeback.FeedbackData.BSNO))
{
var strSql = new StringBuilder();
strSql.Append("update t_op_seae set 主提单号='" + feeback.FeedbackData.MBLNO + "' where 业务编号='" + feeback.FeedbackData.BSNO + "' AND ISNULL(主提单号,'')='' ");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
else
{
var CUSTNO = "";
var IRCODE = "";
if (!string.IsNullOrEmpty(feeback.FeedbackData.FR)) CUSTNO = feeback.FeedbackData.FR;
if (!string.IsNullOrEmpty(feeback.FeedbackData.IRCode)) IRCODE = feeback.FeedbackData.IRCode;
if (!string.IsNullOrEmpty(CUSTNO))
{
var strSql = new StringBuilder();
strSql.Append("update t_op_seae set 主提单号='" + feeback.FeedbackData.MBLNO + "' where 业务编号='" + CUSTNO + "' AND (ISNULL(主提单号,'')='' or 主提单号 LIKE '%*') ");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
if (!string.IsNullOrEmpty(IRCODE))
{
var strSql = new StringBuilder();
strSql.Append("update t_op_seae set 主提单号='" + feeback.FeedbackData.MBLNO + "' where IRCODE='" + IRCODE + "' AND (ISNULL(主提单号,'')='' or 主提单号 LIKE '%*') ");
SqlCommand cmd = new SqlCommand(strSql.ToString(), dbcon);
cmd.ExecuteNonQuery();
logger.Debug($"执行语句1{strSql.ToString()}");
}
}
}
}
}
}
}
catch (Exception ex)
{
logger.Error($"处理简云订舱数据回推时出错:" +ex.Message);
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
}
};
model.BasicConsume(CompanyQueueName, true, consumer);
}
public static void StopProcess()
{
if (mqConn != null && mqConn.IsOpen)
{
mqConn.Close();
mqConn = null;
}
}
}
}

@ -38,6 +38,8 @@ using DSWeb.MvcShipping.DAL.MsOpAireDAL;
using DSWeb.MvcShipping.Models.MsOpAire;
using DSWeb.MvcShipping.DAL.MsOpAiriDAL;
using DSWeb.MvcShipping.Models.MsOpAiri;
using DSWeb.MvcShipping.Models.MsOpOther;
using DSWeb.MvcShipping.DAL.MsOpOtherDAL;
namespace DSWeb.MvcShipping.Controllers
{
@ -418,9 +420,264 @@ namespace DSWeb.MvcShipping.Controllers
}
public ContentResult SaveDs(string opstatus, string data, string data2, string body, string rolebody)
{
data = data.Replace("❥", "<");
var headData = JsonConvert.Deserialize<MsClient>(data.Replace("}", ",") + data2.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<MsClientAccount>>(body);
var bodyListDel = JsonConvert.Deserialize<List<MsClientAccount>>("");
var RolebodyList = JsonConvert.Deserialize<List<MsClientRole>>(rolebody);
var SALEROLE = new MsClientRole();
var OPROLE = new MsClientRole();
var DOCROLE = new MsClientRole();
if (!string.IsNullOrEmpty(rolebody))
{
if (RolebodyList.Count > 0)
{
foreach (var _b in RolebodyList)
{
if (_b.BEGINDATE != "") { _b.BEGINDATE = _b.BEGINDATE.Replace("T", " ").Replace("08:00:00", "00:00:00"); }
if (_b.ENDDATE != "") { _b.ENDDATE = _b.ENDDATE.Replace("T", " ").Replace("08:00:00", "23:59:59"); }
if (_b.ROLE == "揽货人") {
if (!string.IsNullOrEmpty(SALEROLE.SHOWNAME))
{
if (Convert.ToDateTime(_b.BEGINDATE) > Convert.ToDateTime(SALEROLE.BEGINDATE)) {
SALEROLE.SHOWNAME = _b.SHOWNAME;
SALEROLE.BEGINDATE = _b.BEGINDATE;
}
}
else {
SALEROLE.SHOWNAME = _b.SHOWNAME;
SALEROLE.BEGINDATE = _b.BEGINDATE;
}
}
if (_b.ROLE == "客户经理")
{
if (!string.IsNullOrEmpty(OPROLE.SHOWNAME))
{
if (Convert.ToDateTime(_b.BEGINDATE) > Convert.ToDateTime(OPROLE.BEGINDATE))
{
OPROLE.SHOWNAME = _b.SHOWNAME;
OPROLE.BEGINDATE = _b.BEGINDATE;
}
}
else
{
OPROLE.SHOWNAME = _b.SHOWNAME;
OPROLE.BEGINDATE = _b.BEGINDATE;
}
}
if (_b.ROLE == "客服")
{
if (!string.IsNullOrEmpty(DOCROLE.SHOWNAME))
{
if (Convert.ToDateTime(_b.BEGINDATE) > Convert.ToDateTime(DOCROLE.BEGINDATE))
{
DOCROLE.SHOWNAME = _b.SHOWNAME;
DOCROLE.BEGINDATE = _b.BEGINDATE;
}
}
else
{
DOCROLE.SHOWNAME = _b.SHOWNAME;
DOCROLE.BEGINDATE = _b.BEGINDATE;
}
}
}
}
}
var isPost = true;
var errorstr = "";
headData.SHORTNAME = headData.SHORTNAME.Trim();
headData.CODENAME = headData.CODENAME.Trim();
headData.SALE = SALEROLE.SHOWNAME;
headData.OP = OPROLE.SHOWNAME;
headData.DOC = DOCROLE.SHOWNAME;
var ct = MsInfoClientDAL.GetRdCount("GID<>'" + headData.GID + "' AND SHORTNAME='" + headData.SHORTNAME.Replace("'", "''") + "'");
if (ct != 0)
{
isPost = false;
errorstr = "客户简称重复";
}
ct = MsInfoClientDAL.GetRdCount("GID<>'" + headData.GID + "' AND DESCRIPTION='" + headData.DESCRIPTION.Replace("'", "''") + "'");
if (ct != 0)
{
isPost = false;
errorstr = "客户全称重复";
}
if (!string.IsNullOrEmpty(headData.LOGINNAME))
{
ct = MsInfoClientDAL.GetRdCount("GID<>'" + headData.GID + "' AND LOGINNAME='" + headData.LOGINNAME.Replace("'", "''") + "'");
if (ct != 0)
{
isPost = false;
errorstr = "登陆名重复";
}
}
if (headData.SHORTNAME.IndexOf("'") > 0)
{
isPost = false;
errorstr = "简称含有'等特殊字符";
}
if (headData.DESCRIPTION.IndexOf("'") > 0)
{
isPost = false;
errorstr = "全称含有'等特殊字符";
}
if (headData.CUSTNUM == "")
{
headData.CUSTNUM = MsInfoClientDAL.GetMaxNum();
}
if (headData.BILLRISES1 == "")
headData.BILLRISES1 = headData.DESCRIPTION;
if (headData.RMBBILLRISES == "")
headData.RMBBILLRISES = headData.DESCRIPTION;
if (headData.USDBILLRISES == "")
headData.USDBILLRISES = headData.DESCRIPTION;
if (headData.TICHENG == "") headData.TICHENG = "0";
if (headData.FENCHENG == "") headData.FENCHENG = "0";
#region 判断字段长度
if (isPost)
{
var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("info_client");
foreach (var enumValue in seaefield)
{
if (enumValue.FIELDNAME == "CODENAME" && headData.CODENAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "客户代码超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "SHORTNAME" && headData.SHORTNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "客户简称超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "DESCRIPTION" && headData.DESCRIPTION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "客户全称超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "ENFULLNAME" && headData.ENFULLNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "英文全称超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "ADDR" && headData.ADDR.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "地址超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "EMAIL" && headData.EMAIL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "邮件地址超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "WEB" && headData.WEB.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "网址超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "TEL" && headData.TEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "TEL超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "FAX" && headData.FAX.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "FAX超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "CHIEF" && headData.CHIEF.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "负责人超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "OP" && headData.OP.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "操作字段超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "COUNTRY" && headData.COUNTRY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "国家超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "PROVINCE" && headData.PROVINCE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "省超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "CITY" && headData.CITY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "城市超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "BLCONTENT" && headData.BLCONTENT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "提单信息超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "BILLRISES1" && headData.BILLRISES1.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发票抬头超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "RMBBILLRISES" && headData.RMBBILLRISES.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "人民币支票抬头超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "USDBILLRISES" && headData.USDBILLRISES.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "美元支票抬头超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "REMARK" && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "LOGINNAME" && headData.LOGINNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "登陆名超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "LOGINPASSWORD" && headData.LOGINPASSWORD.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "登陆密码超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "QQ" && headData.QQ.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "QQ超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "FARCODE" && headData.FARCODE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "财务应收账款代码超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "FAPCODE" && headData.FAPCODE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "财务应付账款代码超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "REGISTRATIONNO" && headData.REGISTRATIONNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "企业备案号超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "TAXNO" && headData.TAXNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "税号超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "INSPECTIONNO" && headData.InspectionNo.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "商检备案号超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "EDICODE" && headData.EDICODE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "EDI代码超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "EDICODE2" && headData.EDICODE2.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "EDI代码2超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "EDICODE3" && headData.EDICODE3.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "EDI代码3超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "ORGANIZATIONCODE" && headData.ORGANIZATIONCODE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "组织机构代码超长,字段长度限制" + enumValue.FIELDLEN; }
if (enumValue.FIELDNAME == "ORDERNO" && headData.ORDERNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "财务序号超长,字段长度限制" + enumValue.FIELDLEN; }
}
}
#endregion
if (isPost)
{
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.OPNAME = Convert.ToString(Session["SHOWNAME"]);
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
headData.ModelUIStatus = "I";
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
headData.ModelUIStatus = "D";
}
headData.MODIFIEDUSER = Convert.ToString(Session["USERID"]);
headData.MODIFIEDTIME = System.DateTime.Now.ToString();
var modb = new ModelObjectRepository();
var GID = headData.GID;
DBResult result = modb.Save(headData
, ModelObjectConvert<MsClientAccount>.ToModelObjectList(bodyList)
, ModelObjectConvert<MsClientAccount>.ToModelObjectList(bodyListDel)
);
if (result.Success)
{
MsInfoClientDAL.SaveRole(headData.GID, RolebodyList, Convert.ToString(Session["USERID"]));
//BasicDataRefDAL.PubStore_SetNew("INFO_CLIENT");
if (headData.ISSTOP)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var blUpSQL = " insert into sys_log(GID,NAME,LOGTYPE,LOGTIME,LOGCONTENT,CREATEUSER) values(NEWID(),'" + headData.SHORTNAME + "','停用客户','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + headData.SHORTNAME + '(' + headData.DESCRIPTION + ')' + "','" + Convert.ToString(Session["USERID"]) + "')";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsInfoClientDAL.GetData("GID='" + GID + "'")
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr + "不允许保存!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult GetRoleDataList(string condition, string sort)
{
var dataList = MsInfoClientDAL.GetRoleDataList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult Delete ( string data )
{
var headData = JsonConvert.Deserialize<MsClient>(data);
@ -1130,7 +1387,24 @@ namespace DSWeb.MvcShipping.Controllers
//
// GET/TruckMng/MsWlTyreAcc/GetData/
public ContentResult GetBsData(string condition)
{
MsOpOtherEntity head = null;
var list = MsOpOtherDAL.GetDataAllList(0,1,condition);
if (list.Count > 0)
head = list[0];
if (head == null)
{
head = new MsOpOtherEntity();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}

@ -4037,7 +4037,7 @@ namespace DSWeb.MvcShipping.Controllers
if (ftpset.SENDCODE == "") ftpset = MsCodeFtpSetDAL.GetData("EDINAME='INTTR'", Convert.ToString(Session["COMPANYID"]));
var filename = "";
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
foreach (var headdata in headList)
{
var ediheadlist = new List<MsOpSeae>();
@ -4054,7 +4054,6 @@ namespace DSWeb.MvcShipping.Controllers
var afilename = Path.GetFileName(filename);
MsOpSeaeEdiPortDAL.InsertEdiLog(bsnos, "INTTR", filetype, carrier, ftpset.SERVERIP, afilename, "../../EDIFiles/SeaeEdi/" + afilename, Convert.ToString(Session["SHOWNAME"]));
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
foreach (var bill in ediheadlist)
{
if (filetype == "B")
@ -4077,7 +4076,7 @@ namespace DSWeb.MvcShipping.Controllers
var afilename = Path.GetFileName(filename);
MsOpSeaeEdiPortDAL.InsertEdiLog(bsnos, "INTTR", filetype, carrier, ftpset.SERVERIP, afilename, "../../EDIFiles/SeaeEdi/" + afilename, Convert.ToString(Session["SHOWNAME"]));
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
foreach (var bill in ediheadlist)
{
if (filetype == "B")
@ -4099,6 +4098,17 @@ namespace DSWeb.MvcShipping.Controllers
result.Success = false;
result.Message = "FTP参数没有设置,请先设置FTP参数!";
}
if (filetype == "E"&&result.Success) {
var UPDATESUBDATAAFTERSI = MsSysParamSetDAL.GetData("PARAMNAME='UPDATESUBDATAAFTERSI'");
if (UPDATESUBDATAAFTERSI.PARAMVALUE == "1")
{
var blUpSQL = " exec ExeUpdateSubOpSeae '" + headdata.BSNO + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
}
}

@ -488,6 +488,173 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
}
#endregion
#region 角色
static public List<MsClientRole> GetRoleDataList(string strCondition, string sort = null)
{
var strSql = new StringBuilder();
strSql.Append("SELECT [GID],LINKID,[SHOWNAME],ROLE,[BEGINDATE],[ENDDATE],");
strSql.Append("[CREATEUSER],[CREATETIME],[MODIFIEDUSER],[MODIFIEDTIME]");
strSql.Append(",(select ShowName from [user] where GID=info_client_role.CREATEUSER) as CREATEUSERREF");
strSql.Append(",(select ShowName from [user] where GID=info_client_role.MODIFIEDUSER) as MODIFIEDUSERREF");
strSql.Append(" from info_client_role where 1=1 ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" and " + strCondition);
}
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring);
}
else
{
strSql.Append(" order by ROLE,BEGINDATE DESC");
}
return SetRoleData(strSql);
}
static public MsClientRole GetRoleData(string condition, string userid)
{
MsClientRole data = null;
var list = GetRoleDataList(condition, "");
if (list.Count > 0)
data = list[0];
if (data == null)
{
data = new MsClientRole();
}
return data;
}
private static List<MsClientRole> SetRoleData(StringBuilder strSql)
{
var headList = new List<MsClientRole>();
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
MsClientRole data = new MsClientRole();
#region Set DB data to Object
data.GID = Convert.ToString(reader["GID"]);
data.LINKID = Convert.ToString(reader["LINKID"]);
data.SHOWNAME = Convert.ToString(reader["SHOWNAME"]);
data.ROLE = Convert.ToString(reader["ROLE"]);
if (reader["BEGINDATE"] != DBNull.Value)
data.BEGINDATE = Convert.ToDateTime(reader["BEGINDATE"]).ToString("yyyy-MM-dd");//预抵日期
if (reader["ENDDATE"] != DBNull.Value)
data.ENDDATE = Convert.ToDateTime(reader["ENDDATE"]).ToString("yyyy-MM-dd");//预抵日期
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);
data.CREATEUSER = Convert.ToString(reader["CREATEUSER"]);
data.MODIFIEDUSER = Convert.ToString(reader["MODIFIEDUSER"]);
data.MODIFIEDTIME = Convert.ToString(reader["MODIFIEDTIME"]);
data.MODIFIEDUSERREF = Convert.ToString(reader["MODIFIEDUSERREF"]);
#endregion
headList.Add(data);
}
reader.Close();
}
return headList;
}
public static DBResult SaveRole(string GID, List<MsClientRole> bodyList, string userid)
{
var result = new DBResult();
Database db = DatabaseFactory.CreateDatabase();
using (var conn = db.CreateConnection())
{
conn.Open();
var tran = conn.BeginTransaction();
try
{
var cmdInsert =
db.GetSqlStringCommand(
@"insert into info_client_role (GID,LINKID,SHOWNAME,ROLE,BEGINDATE,ENDDATE,CREATEUSER,CREATETIME,MODIFIEDUSER,MODIFIEDTIME)
values (@GID,@LINKID,@SHOWNAME,@ROLE,@BEGINDATE,@ENDDATE,@CREATEUSER,@CREATETIME,@MODIFIEDUSER,@MODIFIEDTIME) ");
var cmdUpdate =
db.GetSqlStringCommand(
@"update info_client_role set SHOWNAME=@SHOWNAME,ROLE=@ROLE,BEGINDATE=@BEGINDATE,ENDDATE=@ENDDATE,MODIFIEDUSER=@MODIFIEDUSER,MODIFIEDTIME=@MODIFIEDTIME
where GID=@GID ");
if (bodyList != null)
{
foreach (var enumValue in bodyList)
{
if (enumValue.LINKID == "*" || enumValue.LINKID == "")
{
cmdInsert.Parameters.Clear();
db.AddInParameter(cmdInsert, "@GID", DbType.String, enumValue.GID);
db.AddInParameter(cmdInsert, "@LINKID", DbType.String, GID);
db.AddInParameter(cmdInsert, "@SHOWNAME", DbType.String, enumValue.SHOWNAME);
db.AddInParameter(cmdInsert, "@ROLE", DbType.String, enumValue.ROLE);
db.AddInParameter(cmdInsert, "@BEGINDATE", DbType.String, enumValue.BEGINDATE);
db.AddInParameter(cmdInsert, "@ENDDATE", DbType.String, enumValue.ENDDATE);
db.AddInParameter(cmdInsert, "@CREATEUSER", DbType.String, userid);
db.AddInParameter(cmdInsert, "@CREATETIME", DbType.String, DateTime.Now.ToString());
db.AddInParameter(cmdInsert, "@MODIFIEDUSER", DbType.String, userid);
db.AddInParameter(cmdInsert, "@MODIFIEDTIME", DbType.String, DateTime.Now.ToString());
db.ExecuteNonQuery(cmdInsert, tran);
}
else
{
cmdUpdate.Parameters.Clear();
db.AddInParameter(cmdUpdate, "@GID", DbType.String, enumValue.GID);
db.AddInParameter(cmdUpdate, "@SHOWNAME", DbType.String, enumValue.SHOWNAME);
db.AddInParameter(cmdUpdate, "@ROLE", DbType.String, enumValue.ROLE);
db.AddInParameter(cmdUpdate, "@BEGINDATE", DbType.String, enumValue.BEGINDATE);
db.AddInParameter(cmdUpdate, "@ENDDATE", DbType.String, enumValue.ENDDATE);
db.AddInParameter(cmdUpdate, "@MODIFIEDUSER", DbType.String, userid);
db.AddInParameter(cmdUpdate, "@MODIFIEDTIME", DbType.String, DateTime.Now.ToString());
db.ExecuteNonQuery(cmdUpdate, tran);
}
}
}
tran.Commit();
}
catch (Exception)
{
tran.Rollback();
result.Success = false;
result.Message = "保存出现错误,请重试或联系系统管理员";
return result;
}
}
result.Success = true;
result.Message = "保存成功" + result.Message;
return result;
}
#endregion
#region 联系人
static public List<MsClientContact> GetContactDataList(string strCondition,string sort = null,string USERID="1")
@ -776,7 +943,7 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
#region 合同
static public List<MsInfoContract> GetContractDataList(string strCondition, string sort = null,string USERID="1")
static public List<MsInfoContract> GetContractDataList(string strCondition, string sort = null, string USERID = "1")
{
var strSql = new StringBuilder();
@ -791,7 +958,7 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
if (USERID == "1") rangstr = "1=2";
else
{
rangstr = BasicDataRefDAL.GetVisableRange("modInfoClinet_info", USERID, "", "CREATEUSER","DEPTGID");
rangstr = BasicDataRefDAL.GetVisableRange("modInfoClinet_info", USERID, "", "CREATEUSER", "DEPTGID");
}
if (!string.IsNullOrEmpty(rangstr))
{
@ -822,10 +989,10 @@ namespace DSWeb.MvcShipping.DAL.MsInfoClient
return SetContractData(strSql);
}
static public MsInfoContract GetContractData(string condition,string userid)
static public MsInfoContract GetContractData(string condition, string userid)
{
MsInfoContract data = null;
var list = GetContractDataList(condition,"",userid);
var list = GetContractDataList(condition, "", userid);
if (list.Count > 0)
data = list[0];

@ -71,6 +71,34 @@ namespace DSWeb.MvcShipping.DAL.MsOpOtherDAL
return SetData(strSql.ToString());
}
static public List<MsOpOtherEntity> GetDataAllList(int start, int limit, string strCondition)
{
var strSql = new StringBuilder();
strSql.Append(@"SELECT * from (SELECT row_number() over (");
strSql.Append(" order by BSDATE desc");
strSql.Append(@") as num , "); //
strSql.Append("op_other.BSNO, OPLB, OPLBNAME, BSSTATUS, FEESTATUS, (CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF, (CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,");
strSql.Append(" CUSTNO, MBLNO, HBLNO, CONTRACTNO, CUSTOMERNAME, CONVERT(char(10), BSDATE, 20) as BSDATE, ACCDATE, BSSOURCE, BSSOURCEDETAIL, OP, CUSTSERVICE, SALE, FRCUSTSERVICE,CORPID, TRANSTYPE, VESSEL, VOYNO,");
strSql.Append(" CONVERT(char(10), ETD, 20) as ETD, PORTLOAD, PORTDISCHARGE, TRADETYPE, GOODSNAME, KGS, NETWEIGHT, PKGS, KINDPKGS, CBM,CTNALL,CTNNUM,ISVOU, VOUNO, REMARK,");
strSql.Append(" (select top 1 showname from [user] where GID=op_other.CREATEUSER) as CREATEUSER, CREATETIME, (select top 1 showname from [user] where GID=op_other.MODIFIEDUSER) as MODIFIEDUSER, ");
strSql.Append(" MODIFIEDTIME, ORDERNO,OPERATOR,STLNAME,STLDATE,ENTERP,BOOKNO,dbo.F_GetBillDrFeeStatus(op_other.BSNO) DRFEESTATUS,dbo.F_GetBillCrFeeStatus(op_other.BSNO) CRFEESTATUS,ISPRINTPR,I.TTLDR,I.TTLINVDR,I.TTLDUIDR,I.TTLCR,I.TTLINVCR,I.TTLDUICR ");
strSql.Append(",SALECORPID,(select [NAME] from [company] where GID=op_other.SALECORPID) as SALECORP,CLOSINGDATE,CLOSEDOCDATE,SALEDEPT,CUSTOMSER,WAREHOUSE,COUNTRYOFORIGIN");
strSql.Append(",(SELECT COUNT(*) FROM OP_AMEND WHERE PARENTID = op_other.BSNO) as AMENDCOUNT");
strSql.Append(",IsService1,IsService2,IsService3,IsService4,IsService5,IsService6,IsService7,IsService8,IsService9,IsService10,IsService11,IsService12,IsService13,IsService14,IsService15,IsService16,op_other.BillFeeStatus FROM op_other");
strSql.Append(" LEFT JOIN v_op_gain_dr_INV I ON (I.BSNO=op_other.BSNO) ");
if (!string.IsNullOrEmpty(strCondition))
{
strSql.Append(" where " + strCondition);
}
strSql.Append(@")as t ");
strSql.Append(string.Format("where t.num>={0} and t.num<={1} order by t.num", start, start + limit)); //
return SetData(strSql.ToString());
}
public static int getTotalCount(string strCondition, string userid, string usercode, string companyid)
{
var rangstr = GetRangDAStr("index", userid, usercode, companyid);

@ -816,9 +816,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
var strSql = new StringBuilder();
if (EDINAME == "")
strSql.Append("select EDICODE from code_disport where PORT='" + port + "'");
strSql.Append("select EDICODE from code_disport where PORT='" + port.Replace("'", "''") + "'");
else
strSql.Append("select EDICODE from code_disport_edi where PORTDISCHARGE='" + port + "' AND EDINAME='" + EDINAME + "'");
strSql.Append("select EDICODE from code_disport_edi where PORTDISCHARGE='" + port.Replace("'", "''") + "' AND EDINAME='" + EDINAME + "'");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{

@ -38,10 +38,10 @@ namespace DSWeb.Areas.MvcShipping.DAL
//更新状态树
sb.Append("update Op_StatusMain set ");
sb.Append("ChuanGongSi = '" + OpSeaeModel.ChuanGongSi+ "',");
sb.Append("ChuanMingHangCi = '" + OpSeaeModel.ChuanMingHangCi + "',");
sb.Append("ShiFaGang = '" + OpSeaeModel.ShiFaGang + "',");
sb.Append("MuDiGang = '" + OpSeaeModel.MuDiGang + "',");
sb.Append("ChuanGongSi = '" + OpSeaeModel.ChuanGongSi.Replace("'", "''") + "',");
sb.Append("ChuanMingHangCi = '" + OpSeaeModel.ChuanMingHangCi.Replace("'", "''") + "',");
sb.Append("ShiFaGang = '" + OpSeaeModel.ShiFaGang.Replace("'", "''") + "',");
sb.Append("MuDiGang = '" + OpSeaeModel.MuDiGang.Replace("'", "''") + "',");
sb.Append("MBLNO = '" + OpSeaeModel.MBLNO + "',");
sb.Append("XiangXingXiangLiang = '" + OpSeaeModel.XiangXingXiangLiang.Replace("'","''") + "',");
sb.Append("ETD = '" + OpSeaeModel.ETD + "',");
@ -59,10 +59,10 @@ namespace DSWeb.Areas.MvcShipping.DAL
sb.Append("values (");
sb.Append("'"+Guid.NewGuid()+"',");
sb.Append("'" + OpSeaeModel.BSNO + "',");
sb.Append("'" + OpSeaeModel.ChuanGongSi + "',");
sb.Append("'" + OpSeaeModel.ChuanMingHangCi + "',");
sb.Append("'" + OpSeaeModel.ShiFaGang + "',");
sb.Append("'" + OpSeaeModel.MuDiGang + "',");
sb.Append("'" + OpSeaeModel.ChuanGongSi.Replace("'", "''") + "',");
sb.Append("'" + OpSeaeModel.ChuanMingHangCi.Replace("'", "''") + "',");
sb.Append("'" + OpSeaeModel.ShiFaGang.Replace("'","''") + "',");
sb.Append("'" + OpSeaeModel.MuDiGang.Replace("'", "''") + "',");
sb.Append("'" + OpSeaeModel.MBLNO + "',");
sb.Append("'" + OpSeaeModel.XiangXingXiangLiang.Replace("'", "''") + "',");

@ -1368,6 +1368,109 @@ namespace DSWeb.MvcShipping.Models.MsInfoClient
}
[JsonObject]
public class MsClientRole : ModelObjectBillBody
{
#region 读写属性
private string _gid = "";
/// <summary>
/// GID
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
public string GID
{
get { return _gid; }
set { _gid = value; }
}
private string _linkid = "";
/// <summary>
/// 公司关联id
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string LINKID
{
get { return _linkid; }
set { _linkid = value; }
}
private string _SHOWNAME = "";
/// <summary>
/// CODENAME
/// </summary>
[ModelDB]
public string SHOWNAME
{
get { return _SHOWNAME; }
set { _SHOWNAME = value; }
}
private string _ROLE = "";
/// <summary>
/// CODENAME
/// </summary>
[ModelDB]
public string ROLE
{
get { return _ROLE; }
set { _ROLE = value; }
}
private string _createuser = "";
/// <summary>
/// CREATEUSER
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string CREATEUSER
{
get { return _createuser; }
set { _createuser = value; }
}
private string _createtime = "";
/// <summary>
/// CREATETIME
/// </summary>
[ModelDB(MDBType = ModelDBOprationType.Insert)]
public string CREATETIME
{
get { return _createtime; }
set { _createtime = value; }
}
[ModelDB]
public string BEGINDATE { get; set; }
[ModelDB]
public string ENDDATE { get; set; }
[ModelDB]
public string MODIFIEDUSER { get; set; }
[ModelDB]
public string MODIFIEDTIME { get; set; }
public string MODIFIEDUSERREF { get; set; }
#endregion
public MsClientRole()
{
TableName = "info_client_role";
}
override public string GetBillNoFieldName()
{
return "LINKID";
}
}
[JsonObject]
public class MsInfoClentGroup : ModelObjectBillHead
{

@ -45,9 +45,9 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
//fieldLabel: '揽货人',
store: this.storeOpCode,
// forceSelection: true,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
@ -358,7 +358,25 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSALE, this.comboxOP, this.comboxDOC, { xtype: 'hiddenfield' }]
items: [{
fieldLabel: '揽货人',//企业备案号
flex: 1,
readOnly:true,
//labelWidth: 40,
name: 'SALE'
}, {
fieldLabel: '客户经理',//商检备案号
//labelWidth: 80,
readOnly: true,
flex: 1,
name: 'OP'
}, {
fieldLabel: '客服',//商检备案号
//labelWidth: 40,
readOnly: true,
flex: 1,
name: 'DOC'
}, { xtype: 'hiddenfield' }]
}
]
});
@ -526,7 +544,34 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
height: 60,
name: 'REMARK',
anchor: '100%'
}
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [//this.CheckISSTOP,
{
fieldLabel: '业务来源',
flex: 1,
readOnly: true,
name: 'BBSSOURCE'
}, {
fieldLabel: '来源明细',
flex: 1,
readOnly: true,
name: 'BSSOURCEDETAIL'
}, {
fieldLabel: '业务日期',
readOnly: true,
name: 'ETD'
}, {
fieldLabel: '备注',
readOnly: true,
flex: 2,
name: 'BREMARK'
}
]
}
// , {
// xtype: 'textareafield',
// grow: true,
@ -900,6 +945,141 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
//#region 框架结构
this.storeBodyListRole = Ext.create('Ext.data.Store', {
model: 'MsInfoClientRoleModel',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetRoleDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 列定义
this.storeROLE = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeROLE.add({ "FSTATUS": "揽货人", "NAME": "揽货人" });
this.storeROLE.add({ "FSTATUS": "客户经理", "NAME": "客户经理" });
this.storeROLE.add({ "FSTATUS": "客服", "NAME": "客服" });
this.comboxROLE = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '费用状态',
store: this.storeROLE,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ROLE',
enableKeyEvents: true
});
this.girdcolumsRole = [{
sortable: true,
dataIndex: 'GID',
header: Zi.LAN.GID, //'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'ROLE',
header: '角色', //'费用名称',
editor: this.comboxROLE,
width: 140
}, {
sortable: true,
dataIndex: 'SHOWNAME',
header: '姓名', //'标准',
editor: this.comboxSALE,
width: 80
},
{
sortable: true,
dataIndex: 'BEGINDATE',
header: '开始日期', //'合同生效日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'ENDDATE',
header: '结束日期', //'合同失效日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERREF',
header: '修改人', //'修改人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改日期', //'修改日期',
width: 80
}
]
//#endregion
//#region gridList列表显示信息
this.gridListCellEditingRole = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridListRole = new Ext.grid.GridPanel({
region: 'center',
store: this.storeBodyListRole,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
tbar: [{
text: Zi.LAN.btnAddDetail, //'增加费用明细',
tooltip: Zi.LAN.btnAddDetail, //'增加费用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddRoleClick(button, event, 1);
},
scope: this
}, '-', {
text: Zi.LAN.btnDeleteDetail, //'删除费用明细',
tooltip: Zi.LAN.btnDeleteDetail, //'删除费用明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelRoleClick(button, event, 1);
},
scope: this
}],
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong }, //"数据加载中,请稍等..."
plugins: [this.gridListCellEditingRole],
selType: 'cellmodel',
columns: this.girdcolumsRole
});
//#endregion
this.panelRole = new Ext.Panel({
layout: "border",
region: "center",
id: 'pnlmodSaleInfo',
title: '我司联系信息',
//split: true,
items: [this.gridListRole]
});
this.panelpage = new Ext.Panel({
title: '客户基本信息',
@ -932,7 +1112,8 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
items:
[
this.panelpage,
this.panelAcc
this.panelAcc,
this.panelRole
]
});
@ -1088,6 +1269,37 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
this.ACCAfterEdit(editor, e, eOpts);
}, this);
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modInfoClientAcc"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success) {
var children = this.tabSeaeWTpanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodSaleInfo') {
children.items[i].close();
}
}
}
}
this.tabSeaeWTpanel.doLayout();
}
} else {
}
},
scope: this
});
}, //end initUIComponents
@ -1105,7 +1317,8 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: "LINKID='" + this.editRecord.get('GID') + "'", isedit: "1"} });
this.storeBodyList.load({ params: { condition: "LINKID='" + this.editRecord.get('GID') + "'", isedit: "1" } });
this.storeBodyListRole.load({ params: { condition: "LINKID='" + this.editRecord.get('GID') + "'"} });
}
this.LoadData(this.opStatus, condition);
@ -1152,6 +1365,48 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
}
this.Editdata = data;
this.GetEditStatus();
this.LoadBsData("CUSTOMERNAME='" + data.SHORTNAME +"' AND ((BSSOURCE='维护' AND BSSOURCEDETAIL='维护按年') OR BSSOURCE='SAAS续费')");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
}, // end LoadDate
LoadBsData: function ( condition) {
this.serialNo = 0;
//this.bodyDel = [];
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsInfoClient/GetBsData',
params: {
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formEdit.getForm().findField('BBSSOURCE').setValue(data.BSSOURCE);
this.formEdit.getForm().findField('BSSOURCEDETAIL').setValue(data.BSSOURCEDETAIL);
this.formEdit.getForm().findField('ETD').setValue(data.ETD);
this.formEdit.getForm().findField('BREMARK').setValue(data.REMARK);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
@ -1185,6 +1440,21 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
j = j + 1;
bodydatas.push(member);
}
var bodyRoledatas = [];
for (var i = 0; i < this.storeBodyListRole.getCount(); i += 1) {
var member = this.storeBodyListRole.getAt(i);
var BEGINDATE = member.data.BEGINDATE;
if (BEGINDATE != '')
BEGINDATE = Ext.util.Format.date(BEGINDATE, 'Y-m-d');
member.data.BEGINDATE = BEGINDATE;
var ENDDATE = member.data.ENDDATE;
if (ENDDATE != '')
ENDDATE = Ext.util.Format.date(ENDDATE, 'Y-m-d');
member.data.ENDDATE = ENDDATE;
j = j + 1;
bodyRoledatas.push(member);
}
//
if (j == 0) {
alert('请注意:未录入银行信息!');
@ -1197,6 +1467,7 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonRoleBody = ConvertRecordsToJsonAll(bodyRoledatas);
this.formEdit.getForm().findField('GID').setDisabled(false);
var data2 = this.formACC.getForm().getValues(false, false, false);
@ -1213,13 +1484,14 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsInfoClient/Save',
url: '/MvcShipping/MsInfoClient/SaveDs',
scope: this,
params: {
opstatus: this.opStatus,
data: datajs,
data2: Ext.JSON.encode(data2),
body: jsonBody
body: jsonBody,
rolebody: jsonRoleBody
},
callback: function (options, success, response) {
if (success) {
@ -1250,7 +1522,11 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeBodyListRole.getCount(); j += 1) {
var memberbody = this.storeBodyListRole.getAt(j);
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
} else if (type == '2') {
@ -1264,6 +1540,11 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeBodyListRole.getCount(); j += 1) {
var memberbody = this.storeBodyListRole.getAt(j);
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
@ -1289,7 +1570,11 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeBodyListRole.getCount(); j += 1) {
var memberbody = this.storeBodyListRole.getAt(j);
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
@ -1375,6 +1660,63 @@ Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
}
},
onAddRoleClick: function (button, event) {
var record = Ext.create('MsInfoClientRoleModel', {
GID: NewGuid(),
LINKID: '*',
SHOWNAME: '',
ROLE: ''
});
this.storeBodyListRole.add(record);
var n = this.storeBodyListRole.getCount();
this.gridListCellEditingRole.startEditByPosition({ row: n - 1, column: 1 });
},
onDelRoleClick: function (button, event) {
var selectedRecords = this.gridListRole.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.LINKID == "" || rec.data.LINKID == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyListRole.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsInfoClient/DeleteRole',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyListRole.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
//#endregion

@ -318,7 +318,23 @@ Ext.define('MsInfoClientImgmb', {
{ name: 'INDATABASE_OLD', type: 'string' }
]
});
Ext.define('MsInfoClientRoleModel', {
extend: 'Ext.data.Model',
idProperty: 'GID',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'LINKID', type: 'string' },
{ name: 'SHOWNAME', type: 'string' },
{ name: 'ROLE', type: 'string' },
{ name: 'BEGINDATE', type: 'string' },
{ name: 'ENDDATE', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'CREATEUSERREF', type: 'string' },
{ name: 'MODIFIEDUSER', type: 'string' },
{ name: 'MODIFIEDUSERREF', type: 'string' },
{ name: 'MODIFIEDTIME', type: 'string' }
]
});
Ext.define('MsInfoClientWebUser', {
extend: 'Ext.data.Model',

Loading…
Cancel
Save