@ -491,7 +491,7 @@ namespace DSWeb.MvcShipping.Controllers
{
var dataList = MsSeaeOrderDAL . GetAuditDataList ( condition , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , start , limit , sort ) ;
var list = dataList ; //.Skip(start).Take(limit);
int count = MsSeaeOrderDAL . get Total Count( condition , CookieConfig . GetCookie_UserId ( Request ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
int count = MsSeaeOrderDAL . get Audit Count( condition , CookieConfig . GetCookie_UserId ( Request ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
var json = JsonConvert . Serialize ( new { Success = true , Message = "查询成功" , totalCount = count , data = list . ToList ( ) } ) ;
return new ContentResult ( ) { Content = json } ;
}
@ -534,6 +534,8 @@ namespace DSWeb.MvcShipping.Controllers
var OrderData = JsonConvert . Deserialize < MsSeaeOrder > ( data . Replace ( "}" , "," ) + data2 . Replace ( "{" , "" ) . Replace ( "}" , "," ) + data3 . Replace ( "{" , "" ) ) ;
var result = new DBResult ( ) ;
if ( OrderData . OPTYPE = = "OP_SEAI" )
{
result = MsSeaeOrderDAL . OrderToOpSeai ( OrderData , accdate , op , custservice , FORWARDER , ORREMARK , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) ) ;
@ -944,206 +946,224 @@ namespace DSWeb.MvcShipping.Controllers
public ContentResult AuditBackOrderForm ( string data , string data2 , string data3 , string orreason )
{
var OrderData = JsonConvert . Deserialize < MsSeaeOrder > ( data . Replace ( "}" , "," ) + data2 . Replace ( "{" , "" ) . Replace ( "}" , "," ) + data3 . Replace ( "{" , "" ) ) ;
var headData = new MsOpSeae ( ) ;
OrderData . AUDITOPERATOR = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
OrderData . AUDITDATE = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
OrderData . ORREASON = orreason ;
OrderData . ORSTATUS = "2" ;
OrderData . DbOperationType = DbOperationType . DbotUpd ;
OrderData . ModelUIStatus = "E" ;
if ( OrderData . PKGS = = "" ) OrderData . PKGS = "0" ;
if ( OrderData . KGS = = "" ) OrderData . KGS = "0" ;
if ( OrderData . CBM = = "" ) OrderData . CBM = "0" ;
if ( OrderData . ETD = = "" ) OrderData . ETD = null ;
if ( OrderData . STLDATE = = "" ) OrderData . STLDATE = null ;
if ( OrderData . CONFIRMDATE = = "" ) OrderData . CONFIRMDATE = null ;
if ( OrderData . AUDITDATE = = "" ) OrderData . AUDITDATE = null ;
if ( OrderData . ISSUEDATE = = "" ) OrderData . ISSUEDATE = null ;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( OrderData ) ;
if ( result . Success )
{
var PARAMVALUE = MsSysParamSetDAL . GetData ( "PARAMNAME='ORDERSENDMAIL'" ) ;
if ( PARAMVALUE . PARAMVALUE = = "1" )
{
var mailtitle = "订舱驳回:" + OrderData . ORDNO ;
var result = MsSeaeOrderDAL . AuditBackOrderForm ( OrderData , orreason , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
var Body = new StringBuilder ( ) ;
Body . Append ( "<html> <Body>" ) ;
Body . Append ( "<br />订舱驳回:<br />业务编号:" + OrderData . ORDNO ) ;
Body . Append ( "<br />客户名称:" + OrderData . CUSTOMERNAME ) ;
Body . Append ( "<br />揽货人" + OrderData . SALE ) ;
Body . Append ( "<br />录入人" + OrderData . INPUTBY ) ;
Body . Append ( "<br />港口:" + OrderData . DESTINATION ) ;
Body . Append ( "<br />船期:" + OrderData . ETD ) ;
Body . Append ( "<br />船公司:" + OrderData . CARRIER ) ;
Body . Append ( "<br />箱量:" + OrderData . CNTRTOTAL ) ;
Body . Append ( "<br />备注:" + OrderData . REMARK ) ;
Body . Append ( "<br />驳回原因:" + orreason ) ;
Body . Append ( "</Body></html> " ) ;
var mailto = "" ;
var SALE = SysUserDAL . GetData ( "U.SHOWNAME='" + OrderData . INPUTBY + "'" ) ;
if ( SALE . EMAIL1 ! = "" )
{
if ( mailto = = "" )
mailto = SALE . EMAIL1 ;
else
mailto = mailto + ";" + SALE . EMAIL1 ;
}
return BasicDataRefDAL . GetContentResult ( result ) ;
//var headData = new MsOpSeae();
//OrderData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
//OrderData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//OrderData.ORREASON = orreason;
//OrderData.ORSTATUS = "2";
//OrderData.DbOperationType = DbOperationType.DbotUpd;
//OrderData.ModelUIStatus = "E";
//if (OrderData.PKGS == "") OrderData.PKGS = "0";
//if (OrderData.KGS == "") OrderData.KGS = "0";
//if (OrderData.CBM == "") OrderData.CBM = "0";
//if (OrderData.ETD == "") OrderData.ETD = null;
//if (OrderData.STLDATE == "") OrderData.STLDATE = null;
//if (OrderData.CONFIRMDATE == "") OrderData.CONFIRMDATE = null;
//if (OrderData.AUDITDATE == "") OrderData.AUDITDATE = null;
//if (OrderData.ISSUEDATE == "") OrderData.ISSUEDATE = null;
if ( mailto ! = "" )
{
var j = 0 ;
var filepath = "" ;
result = MsSeaeOrderDAL . SendMailWithFile ( mailtitle , Body . ToString ( ) , filepath , mailto , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
}
//var modb = new ModelObjectDB();
//DBResult result = modb.Save(OrderData);
//if (result.Success)
//{
// var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
// if (PARAMVALUE.PARAMVALUE == "1")
// {
// var mailtitle = "订舱驳回:" + OrderData.ORDNO;
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ""
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
// var Body = new StringBuilder();
// Body.Append("<html> <Body>");
// Body.Append("<br />订舱驳回:<br />业务编号:" + OrderData.ORDNO);
// Body.Append("<br />客户名称:" + OrderData.CUSTOMERNAME);
// Body.Append("<br />揽货人" + OrderData.SALE);
// Body.Append("<br />录入人" + OrderData.INPUTBY);
// Body.Append("<br />港口:" + OrderData.DESTINATION);
// Body.Append("<br />船期:" + OrderData.ETD);
// Body.Append("<br />船公司:" + OrderData.CARRIER);
// Body.Append("<br />箱量:" + OrderData.CNTRTOTAL);
// Body.Append("<br />备注:" + OrderData.REMARK);
// Body.Append("<br />驳回原因:" + orreason);
// Body.Append("</Body></html> ");
// var mailto = "";
// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + OrderData.INPUTBY + "'");
// if (SALE.EMAIL1 != "")
// {
// if (mailto == "")
// mailto = SALE.EMAIL1;
// else
// mailto = mailto + ";" + SALE.EMAIL1;
// }
// if (mailto != "")
// {
// var j = 0;
// var filepath = "";
// result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
// }
// }
//}
//var jsonRespose = new JsonResponse
//{
// Success = result.Success,
// Message = result.Message,
// Data = ""
//};
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
/// <summary>
/// 销售订舱审核通过
/// </summary>
/// <param name="data"></param>
/// <param name="data2"></param>
/// <param name="data3"></param>
/// <param name="body"></param>
/// <returns></returns>
public ContentResult AccAuditForm ( string data , string data2 , string data3 , string body )
{
var headData = JsonConvert . Deserialize < MsSeaeOrder > ( data . Replace ( "}" , "," ) + data2 . Replace ( "{" , "" ) . Replace ( "}" , "," ) + data3 . Replace ( "{" , "" ) ) ;
var bodyList = JsonConvert . Deserialize < List < MsSeaeOrderCtn > > ( body ) ;
//if (!string.IsNullOrEmpty(headData.AUDITOPERATOR))
headData . AUDITOPERATOR = Convert . ToString ( Session [ "SHOWNAME" ] ) ;
headData . AUDITDATE = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
headData . ORSTATUS = "0" ;
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
if ( headData . PKGS = = "" ) headData . PKGS = "0" ;
if ( headData . KGS = = "" ) headData . KGS = "0" ;
if ( headData . CBM = = "" ) headData . CBM = "0" ;
if ( headData . CONFIRMDATE = = "" ) headData . CONFIRMDATE = null ;
if ( headData . AUDITDATE = = "" ) headData . AUDITDATE = null ;
if ( headData . ETD = = "" ) headData . ETD = null ;
if ( headData . STLDATE = = "" ) headData . STLDATE = null ;
if ( headData . ISSUEDATE = = "" ) headData . ISSUEDATE = null ;
var result = MsSeaeOrderDAL . AccAuditForm ( headData , bodyList , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
//var cntr = "";
//if (bodyList != null)
//{
// foreach (var enumValue in bodyList)
// {
// cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
// }
//}
return BasicDataRefDAL . GetContentResult ( result ) ;
//headData.CNTRTOTAL = cntr;
////if (!string.IsNullOrEmpty(headData.AUDITOPERATOR))
//headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
//headData.AUDITDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//headData.ORSTATUS = "0";
//headData.DbOperationType = DbOperationType.DbotUpd;
//headData.ModelUIStatus = "E";
//if (headData.PKGS == "") headData.PKGS = "0";
//if (headData.KGS == "") headData.KGS = "0";
//if (headData.CBM == "") headData.CBM = "0";
//if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
//if (headData.AUDITDATE == "") headData.AUDITDATE = null;
//if (headData.ETD == "") headData.ETD = null;
//if (headData.STLDATE == "") headData.STLDATE = null;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( headData ) ;
if ( result . Success = = true ) {
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT USERID FROM " ) ;
strSql . Append ( " user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderConfirm') " ) ;
//if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
Database db = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
var Msgdata = new SYSMessagemb ( ) ;
Msgdata . GID = Guid . NewGuid ( ) . ToString ( ) ;
Msgdata . NAME = "SALEORDERCONFIRM" ;
Msgdata . DESCRIPTION = headData . AUDITOPERATOR + "提交订舱确认" ;
Msgdata . MESSAGECONTENT = headData . AUDITOPERATOR + "提交销订舱确认" + " 单号:" + headData . ORDNO ;
Msgdata . RECEIVER = Convert . ToString ( reader [ "USERID" ] ) ;
Msgdata . CREATETIME = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
Msgdata . ISREAD = "0" ;
Msgdata . READCOUNT = "0" ;
Msgdata . TYPE = "0" ;
Msgdata . TASKURL = "" ;
Msgdata . TASKID = headData . BSNO ;
Msgdata . NUMBER = "0" ;
Msgdata . RECVTYPE = "2" ;
Msgdata . DbOperationType = DbOperationType . DbotIns ;
Msgdata . ModelUIStatus = "I" ;
////var cntr = "";
////if (bodyList != null)
////{
//// foreach (var enumValue in bodyList)
//// {
//// cntr = cntr + enumValue.CTNALL + '*' + enumValue.CTNNUM + "/";
//// }
////}
var Msgmodb = new ModelObjectRepository ( ) ;
Msgmodb . Save ( Msgdata ) ;
////headData.CNTRTOTAL = cntr;
}
reader . Close ( ) ;
}
//var modb = new ModelObjectDB();
//DBResult result = modb.Save(headData);
//if (result.Success == true) {
// var strSql = new StringBuilder();
// strSql.Append("SELECT USERID FROM ");
// strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderConfirm') ");
var PARAMVALUE = MsSysParamSetDAL . GetData ( "PARAMNAME='ORDERSENDMAIL'" ) ;
if ( PARAMVALUE . PARAMVALUE = = "1" )
{
var mailtitle = "NEW BOOKING:" + headData . CUSTNO + " PIC已审核通过" ;
// Database db = DatabaseFactory.CreateDatabase();
// using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
// {
// while (reader.Read())
// {
// var Msgdata = new SYSMessagemb();
// Msgdata.GID = Guid.NewGuid().ToString();
// Msgdata.NAME = "SALEORDERCONFIRM";
// Msgdata.DESCRIPTION = headData.AUDITOPERATOR + "提交订舱确认";
// Msgdata.MESSAGECONTENT = headData.AUDITOPERATOR + "提交销订舱确认" + " 单号:" + headData.ORDNO;
// Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
// Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// Msgdata.ISREAD = "0";
// Msgdata.READCOUNT = "0";
// Msgdata.TYPE = "0";
// Msgdata.TASKURL = "";
// Msgdata.TASKID = headData.BSNO;
// Msgdata.NUMBER = "0";
// Msgdata.RECVTYPE = "2";
// Msgdata.DbOperationType = DbOperationType.DbotIns;
// Msgdata.ModelUIStatus = "I";
// var Msgmodb = new ModelObjectRepository();
// Msgmodb.Save(Msgdata);
var Body = new StringBuilder ( ) ;
Body . Append ( "<html> <Body>" ) ;
Body . Append ( "<br />NEW BOOKING:<br />业务编号:" + headData . ORDNO ) ;
Body . Append ( "<br />客户名称:" + headData . CUSTOMERNAME ) ;
Body . Append ( "<br />揽货人" + headData . SALE ) ;
Body . Append ( "<br />录入人" + headData . INPUTBY ) ;
Body . Append ( "<br />港口:" + headData . DESTINATION ) ;
Body . Append ( "<br />船期:" + headData . ETD ) ;
Body . Append ( "<br />船公司:" + headData . CARRIER ) ;
Body . Append ( "<br />箱量:" + headData . CNTRTOTAL ) ;
Body . Append ( "<br />备注:" + headData . REMARK ) ;
Body . Append ( "</Body></html> " ) ;
var mailto = "" ;
var SALELIST = SysUserDAL . GetDataList ( "U.SHOWNAME='" + headData . OP + "' or U.SHOWNAME='" + headData . INPUTBY + "' " ) ;
foreach ( var SALE in SALELIST )
{
if ( SALE . EMAIL1 ! = "" )
{
if ( mailto = = "" )
mailto = SALE . EMAIL1 ;
else
mailto = mailto + ";" + SALE . EMAIL1 ;
}
}
// }
// reader.Close();
// }
if ( mailto ! = "" )
{
var j = 0 ;
var filepath = "" ;
result = MsSeaeOrderDAL . SendMailWithFile ( mailtitle , Body . ToString ( ) , filepath , mailto , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
}
// var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
// if (PARAMVALUE.PARAMVALUE == "1")
// {
// var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " PIC已审核通过";
// var Body = new StringBuilder();
// Body.Append("<html> <Body>");
// Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
// Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
// Body.Append("<br />揽货人" + headData.SALE);
// Body.Append("<br />录入人" + headData.INPUTBY);
// Body.Append("<br />港口:" + headData.DESTINATION);
// Body.Append("<br />船期:" + headData.ETD);
// Body.Append("<br />船公司:" + headData.CARRIER);
// Body.Append("<br />箱量:" + headData.CNTRTOTAL);
// Body.Append("<br />备注:" + headData.REMARK);
// Body.Append("</Body></html> ");
// var mailto = "";
// var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.OP + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
// foreach (var SALE in SALELIST)
// {
// if (SALE.EMAIL1 != "")
// {
// if (mailto == "")
// mailto = SALE.EMAIL1;
// else
// mailto = mailto + ";" + SALE.EMAIL1;
// }
// }
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
var SALEID = T_ALL_DA . GetStrSQL ( "GID" , "select top 1 GID from [user] where SHOWNAME='" + headData . SALE + "'" ) ;
var istrue = MsBaseInfoDAL . GetUserModuleEnable ( "modSaleOrderAuditAutoOp" , SALEID ) ;
if ( istrue )
{
var accdate = DateTime . Now . ToString ( "yyyy-MM" ) ;
// if (mailto != "")
// {
// var j = 0;
// var filepath = "";
// result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
// }
// }
if ( headData . OPTYPE = = "OP_SEAI" )
{
result = MsSeaeOrderDAL . OrderToOpSeai ( headData , accdate , headData . OP , headData . CUSTSERVICE , headData . FORWARDER , "" , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) ) ;
}
else
result = MsSeaeOrderDAL . OrderToOp ( headData , accdate , headData . OP , headData . CUSTSERVICE , headData . FORWARDER , "" , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) ) ;
// T_ALL_DA T_ALL_DA = new T_ALL_DA();
// var SALEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.SALE + "'");
// var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", SALEID);
// if (istrue)
// {
// var accdate = DateTime.Now.ToString("yyyy-MM");
//MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
// if (headData.OPTYPE == "OP_SEAI")
// {
// result = MsSeaeOrderDAL.OrderToOpSeai(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
// }
// else
// result = MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ""
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
// //MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
// }
//}
//var jsonRespose = new JsonResponse
//{
// Success = result.Success,
// Message = result.Message,
// Data = ""
//};
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
@ -1256,7 +1276,7 @@ namespace DSWeb.MvcShipping.Controllers
}
if ( isautoop | | ( isauditautoop & & istrue ) )
if ( isautoop | | ( isauditautoop & & istrue ) )
{
var accdate = DateTime . Now . ToString ( "yyyy-MM" ) ;
if ( headData . OPTYPE = = "OP_SEAI" )
@ -1563,185 +1583,190 @@ namespace DSWeb.MvcShipping.Controllers
public ContentResult SubmitAudit ( string data )
{
var headData = JsonConvert . Deserialize < MsSeaeOrder > ( data ) ;
DBResult result = null ;
if ( headData . AUDITOPERATOR = = "" | | headData . AUDITOPERATOR = = null )
{
var ORDERAUDITMUSTBE = MsSysParamSetDAL . GetData ( "PARAMNAME='ORDERAUDITMUSTBE'" ) ;
if ( ORDERAUDITMUSTBE . PARAMVALUE = = "1" )
{
var jsonRespose2 = new JsonResponse
{
Success = false ,
Message = "审核人不能为空!" ,
Data = ""
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose2 ) } ;
}
}
T_ALL_DA T_ALL_DA = new T_ALL_DA ( ) ;
var CUSTSERVICEID = T_ALL_DA . GetStrSQL ( "GID" , "select top 1 GID from [user] where SHOWNAME='" + headData . CUSTSERVICE + "'" ) ;
var isautoop = MsBaseInfoDAL . GetUserModuleEnable ( "modSaleOrderAutoToOp" , CUSTSERVICEID ) ;
var isauditautoop = MsBaseInfoDAL . GetUserModuleEnable ( "modSaleOrderAuditAutoOp" , Convert . ToString ( Session [ "USERID" ] ) ) ;
var istrue = MsBaseInfoDAL . GetUserModuleEnable ( "modSaleOrderAutoAudit" , Convert . ToString ( Session [ "USERID" ] ) ) ;
if ( isautoop | | ( isauditautoop & & istrue ) )
{
var accdate = DateTime . Now . ToString ( "yyyy-MM" ) ;
if ( headData . OPTYPE = = "OP_SEAI" )
{
result = MsSeaeOrderDAL . OrderToOpSeai ( headData , accdate , headData . OP , headData . CUSTSERVICE , headData . FORWARDER , "" , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) ) ;
}
else
result = MsSeaeOrderDAL . OrderToOp ( headData , accdate , headData . OP , headData . CUSTSERVICE , headData . FORWARDER , "" , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) , Convert . ToString ( Session [ "USERID" ] ) ) ;
//result = MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
}
else
{
// var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
if ( istrue )
headData . ORSTATUS = "0" ;
else
headData . ORSTATUS = "1" ;
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
if ( headData . PKGS = = "" ) headData . PKGS = "0" ;
if ( headData . KGS = = "" ) headData . KGS = "0" ;
if ( headData . CBM = = "" ) headData . CBM = "0" ;
if ( headData . ETD = = "" ) headData . ETD = null ;
if ( headData . STLDATE = = "" ) headData . STLDATE = null ;
if ( headData . ISSUEDATE = = "" ) headData . ISSUEDATE = null ;
if ( headData . CONFIRMDATE = = "" ) headData . CONFIRMDATE = null ;
if ( headData . AUDITDATE = = "" ) headData . AUDITDATE = null ;
var modb = new ModelObjectDB ( ) ;
result = modb . Save ( headData ) ;
if ( result . Success = = true )
{
var PARAMVALUE = MsSysParamSetDAL . GetData ( "PARAMNAME='ORDERSENDMAIL'" ) ;
if ( PARAMVALUE . PARAMVALUE = = "1" )
{
var mailtitle = "NEW BOOKING:" + headData . CUSTNO + " 销售已提交订舱" ;
var Body = new StringBuilder ( ) ;
Body . Append ( "<html> <Body>" ) ;
Body . Append ( "<br />NEW BOOKING:<br />业务编号:" + headData . ORDNO ) ;
Body . Append ( "<br />客户名称:" + headData . CUSTOMERNAME ) ;
Body . Append ( "<br />揽货人" + headData . SALE ) ;
Body . Append ( "<br />录入人" + headData . INPUTBY ) ;
Body . Append ( "<br />港口:" + headData . DESTINATION ) ;
Body . Append ( "<br />船期:" + headData . ETD ) ;
Body . Append ( "<br />船公司:" + headData . CARRIER ) ;
Body . Append ( "<br />箱量:" + headData . CNTRTOTAL ) ;
Body . Append ( "<br />备注:" + headData . REMARK ) ;
Body . Append ( "</Body></html> " ) ;
var mailto = "" ;
// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "'");
var SALELIST = SysUserDAL . GetDataList ( "U.SHOWNAME='" + headData . AUDITOPERATOR + "' or U.SHOWNAME='" + headData . INPUTBY + "'" ) ;
foreach ( var SALE in SALELIST )
{
//var SALEMNG = SysUserDAL.GetData("U.SHOWNAME=(SELECT TOP 1 MANAGE1 FROM SYS_DEPT WHERE DEPTNAME='" + SALE.DEPTNAME+ "' and LINKID='" + SALE.COMPANYID + "')");
if ( SALE . EMAIL1 ! = "" )
{
if ( mailto = = "" )
mailto = SALE . EMAIL1 ;
else
mailto = mailto + ";" + SALE . EMAIL1 ;
}
}
if ( mailto ! = "" )
{
var j = 0 ;
var filepath = "" ;
result = MsSeaeOrderDAL . SendMailWithFile ( mailtitle , Body . ToString ( ) , filepath , mailto , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
}
var OPLISTNOCANCEL = MsSysParamSetDAL . GetData ( "PARAMNAME='OPLISTNOCANCEL'" ) ;
if ( OPLISTNOCANCEL . PARAMVALUE = = "1" )
{
var USERID = T_ALL_DA . GetStrSQL ( "GID" , "select top 1 GID from [user] where SHOWNAME='" + headData . CUSTSERVICE + "'" ) ;
var Msgdata = new SYSMessagemb ( ) ;
Msgdata . GID = Guid . NewGuid ( ) . ToString ( ) ;
Msgdata . NAME = "SALEORDERAUDIT" ;
Msgdata . DESCRIPTION = headData . SALE + "提交销售订舱" ;
Msgdata . MESSAGECONTENT = headData . SALE + "有新订舱,订舱单号:" + headData . ORDNO ;
Msgdata . RECEIVER = USERID ;
Msgdata . CREATETIME = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
Msgdata . ISREAD = "0" ;
Msgdata . READCOUNT = "0" ;
Msgdata . TYPE = "0" ;
Msgdata . TASKURL = "" ;
Msgdata . TASKID = headData . BSNO ;
Msgdata . NUMBER = "0" ;
Msgdata . RECVTYPE = "2" ;
Msgdata . DbOperationType = DbOperationType . DbotIns ;
Msgdata . ModelUIStatus = "I" ;
var Msgmodb = new ModelObjectRepository ( ) ;
Msgmodb . Save ( Msgdata ) ;
}
else
{
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT USERID FROM " ) ;
strSql . Append ( " user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderAudit') " ) ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
var Msgdata = new SYSMessagemb ( ) ;
Msgdata . GID = Guid . NewGuid ( ) . ToString ( ) ;
Msgdata . NAME = "SALEORDERAUDIT" ;
Msgdata . DESCRIPTION = headData . SALE + "提交销售订舱" ;
Msgdata . MESSAGECONTENT = headData . SALE + "提交销售订舱审核" + " 单号:" + headData . ORDNO ;
Msgdata . RECEIVER = Convert . ToString ( reader [ "USERID" ] ) ;
Msgdata . CREATETIME = DateTime . Now . ToString ( "yyyy-MM-dd HH:mm:ss" ) ;
Msgdata . ISREAD = "0" ;
Msgdata . READCOUNT = "0" ;
Msgdata . TYPE = "0" ;
Msgdata . TASKURL = "" ;
Msgdata . TASKID = headData . BSNO ;
Msgdata . NUMBER = "0" ;
Msgdata . RECVTYPE = "2" ;
Msgdata . DbOperationType = DbOperationType . DbotIns ;
Msgdata . ModelUIStatus = "I" ;
var Msgmodb = new ModelObjectRepository ( ) ;
Msgmodb . Save ( Msgdata ) ;
}
reader . Close ( ) ;
}
}
}
}
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ""
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
var result = MsSeaeOrderDAL . SubmitAudit ( headData , Convert . ToString ( Session [ "USERID" ] ) , Convert . ToString ( Session [ "SHOWNAME" ] ) , Convert . ToString ( Session [ "COMPANYID" ] ) ) ;
return BasicDataRefDAL . GetContentResult ( result ) ;
// DBResult result = null;
// if (headData.AUDITOPERATOR == "" || headData.AUDITOPERATOR == null)
// {
// var ORDERAUDITMUSTBE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERAUDITMUSTBE'");
// if (ORDERAUDITMUSTBE.PARAMVALUE == "1")
// {
// var jsonRespose2 = new JsonResponse
// {
// Success = false,
// Message = "审核人不能为空!",
// Data = ""
// };
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
// }
// }
// T_ALL_DA T_ALL_DA = new T_ALL_DA();
// var CUSTSERVICEID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.CUSTSERVICE + "'");
// var isautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoToOp", CUSTSERVICEID);
// var isauditautoop = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAuditAutoOp", Convert.ToString(Session["USERID"]));
// var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
// if (isautoop||(isauditautoop&& istrue))
// {
// var accdate = DateTime.Now.ToString("yyyy-MM");
// if (headData.OPTYPE == "OP_SEAI")
// {
// result = MsSeaeOrderDAL.OrderToOpSeai(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
// }
// else
// result = MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
// //result = MsSeaeOrderDAL.OrderToOp(headData, accdate, headData.OP, headData.CUSTSERVICE, headData.FORWARDER, "", Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
// }
// else
// {
//// var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderAutoAudit", Convert.ToString(Session["USERID"]));
// if (istrue)
// headData.ORSTATUS = "0";
// else
// headData.ORSTATUS = "1";
// headData.DbOperationType = DbOperationType.DbotUpd;
// headData.ModelUIStatus = "E";
// if (headData.PKGS == "") headData.PKGS = "0";
// if (headData.KGS == "") headData.KGS = "0";
// if (headData.CBM == "") headData.CBM = "0";
// if (headData.ETD == "") headData.ETD = null;
// if (headData.STLDATE == "") headData.STLDATE = null;
// if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
// if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
// if (headData.AUDITDATE == "") headData.AUDITDATE = null;
// var modb = new ModelObjectDB();
// result = modb.Save(headData);
// if (result.Success == true)
// {
// var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
// if (PARAMVALUE.PARAMVALUE == "1")
// {
// var mailtitle = "NEW BOOKING:" + headData.CUSTNO+ " 销售已提交订舱";
// var Body = new StringBuilder();
// Body.Append("<html> <Body>");
// Body.Append("<br />NEW BOOKING:<br />业务编号:" + headData.ORDNO);
// Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
// Body.Append("<br />揽货人" + headData.SALE);
// Body.Append("<br />录入人" + headData.INPUTBY);
// Body.Append("<br />港口:" + headData.DESTINATION);
// Body.Append("<br />船期:" + headData.ETD);
// Body.Append("<br />船公司:" + headData.CARRIER);
// Body.Append("<br />箱量:" + headData.CNTRTOTAL);
// Body.Append("<br />备注:" + headData.REMARK);
// Body.Append("</Body></html> ");
// var mailto = "";
//// var SALE = SysUserDAL.GetData("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "'");
// var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.AUDITOPERATOR + "' or U.SHOWNAME='" + headData.INPUTBY + "'");
// foreach (var SALE in SALELIST)
// {
// //var SALEMNG = SysUserDAL.GetData("U.SHOWNAME=(SELECT TOP 1 MANAGE1 FROM SYS_DEPT WHERE DEPTNAME='" + SALE.DEPTNAME+ "' and LINKID='" + SALE.COMPANYID + "')");
// if (SALE.EMAIL1 != "")
// {
// if (mailto == "")
// mailto = SALE.EMAIL1;
// else
// mailto = mailto + ";" + SALE.EMAIL1;
// }
// }
// if (mailto != "")
// {
// var j = 0;
// var filepath = "";
// result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
// }
// }
// var OPLISTNOCANCEL = MsSysParamSetDAL.GetData("PARAMNAME='OPLISTNOCANCEL'");
// if (OPLISTNOCANCEL.PARAMVALUE == "1")
// {
// var USERID = T_ALL_DA.GetStrSQL("GID", "select top 1 GID from [user] where SHOWNAME='" + headData.CUSTSERVICE + "'");
// var Msgdata = new SYSMessagemb();
// Msgdata.GID = Guid.NewGuid().ToString();
// Msgdata.NAME = "SALEORDERAUDIT";
// Msgdata.DESCRIPTION = headData.SALE + "提交销售订舱";
// Msgdata.MESSAGECONTENT = headData.SALE + "有新订舱,订舱单号:" + headData.ORDNO;
// Msgdata.RECEIVER = USERID;
// Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// Msgdata.ISREAD = "0";
// Msgdata.READCOUNT = "0";
// Msgdata.TYPE = "0";
// Msgdata.TASKURL = "";
// Msgdata.TASKID = headData.BSNO;
// Msgdata.NUMBER = "0";
// Msgdata.RECVTYPE = "2";
// Msgdata.DbOperationType = DbOperationType.DbotIns;
// Msgdata.ModelUIStatus = "I";
// var Msgmodb = new ModelObjectRepository();
// Msgmodb.Save(Msgdata);
// }
// else
// {
// var strSql = new StringBuilder();
// strSql.Append("SELECT USERID FROM ");
// strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modSaleOrderAudit') ");
// Database db = DatabaseFactory.CreateDatabase();
// using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
// {
// while (reader.Read())
// {
// var Msgdata = new SYSMessagemb();
// Msgdata.GID = Guid.NewGuid().ToString();
// Msgdata.NAME = "SALEORDERAUDIT";
// Msgdata.DESCRIPTION = headData.SALE + "提交销售订舱";
// Msgdata.MESSAGECONTENT = headData.SALE + "提交销售订舱审核" + " 单号:" + headData.ORDNO;
// Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
// Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// Msgdata.ISREAD = "0";
// Msgdata.READCOUNT = "0";
// Msgdata.TYPE = "0";
// Msgdata.TASKURL = "";
// Msgdata.TASKID = headData.BSNO;
// Msgdata.NUMBER = "0";
// Msgdata.RECVTYPE = "2";
// Msgdata.DbOperationType = DbOperationType.DbotIns;
// Msgdata.ModelUIStatus = "I";
// var Msgmodb = new ModelObjectRepository();
// Msgmodb.Save(Msgdata);
// }
// reader.Close();
// }
// }
// }
// }
//var jsonRespose = new JsonResponse
//{
// Success = result.Success,
// Message = result.Message,
// Data = ""
//};
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
@ -1749,72 +1774,78 @@ namespace DSWeb.MvcShipping.Controllers
{
var headData = JsonConvert . Deserialize < MsSeaeOrder > ( data ) ;
//headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
//headData.AUDITDATE = DateTime.Now.ToShortDateString();
headData . ORSTATUS = "9" ;
headData . DbOperationType = DbOperationType . DbotUpd ;
headData . ModelUIStatus = "E" ;
if ( headData . PKGS = = "" ) headData . PKGS = "0" ;
if ( headData . KGS = = "" ) headData . KGS = "0" ;
if ( headData . CBM = = "" ) headData . CBM = "0" ;
var result = MsSeaeOrderDAL . SubmitAuditBack ( headData , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
if ( headData . ETD = = "" ) headData . ETD = null ;
if ( headData . STLDATE = = "" ) headData . STLDATE = null ;
return BasicDataRefDAL . GetContentResult ( result ) ;
if ( headData . ISSUEDATE = = "" ) headData . ISSUEDATE = null ;
////headData.AUDITOPERATOR = Convert.ToString(Session["SHOWNAME"]);
////headData.AUDITDATE = DateTime.Now.ToShortDateString();
if ( headData . CONFIRMDATE = = "" ) headData . CONFIRMDATE = null ;
if ( headData . AUDITDATE = = "" ) headData . AUDITDATE = null ;
var modb = new ModelObjectDB ( ) ;
DBResult result = modb . Save ( headData ) ;
if ( result . Success ) {
var PARAMVALUE = MsSysParamSetDAL . GetData ( "PARAMNAME='ORDERSENDMAIL'" ) ;
if ( PARAMVALUE . PARAMVALUE = = "1" )
{
var mailtitle = "订舱驳回:" + headData . CUSTNO ;
//headData.ORSTATUS = "9";
//headData.DbOperationType = DbOperationType.DbotUpd;
//headData.ModelUIStatus = "E";
//if (headData.PKGS == "") headData.PKGS = "0";
//if (headData.KGS == "") headData.KGS = "0";
//if (headData.CBM == "") headData.CBM = "0";
var Body = new StringBuilder ( ) ;
Body . Append ( "<html> <Body>" ) ;
Body . Append ( "<br />订舱驳回:<br />业务编号:" + headData . ORDNO ) ;
Body . Append ( "<br />客户名称:" + headData . CUSTOMERNAME ) ;
Body . Append ( "<br />揽货人" + headData . SALE ) ;
Body . Append ( "<br />港口:" + headData . DESTINATION ) ;
Body . Append ( "<br />船期:" + headData . ETD ) ;
Body . Append ( "<br />船公司:" + headData . CARRIER ) ;
Body . Append ( "<br />箱量:" + headData . CNTRTOTAL ) ;
Body . Append ( "<br />备注:" + headData . REMARK ) ;
Body . Append ( "</Body></html> " ) ;
var mailto = "" ;
var SALELIST = SysUserDAL . GetDataList ( "U.SHOWNAME='" + headData . SALE + "' or U.SHOWNAME='" + headData . INPUTBY + "' " ) ;
foreach ( var SALE in SALELIST )
{
if ( SALE . EMAIL1 ! = "" )
{
if ( mailto = = "" )
mailto = SALE . EMAIL1 ;
else
mailto = mailto + ";" + SALE . EMAIL1 ;
}
}
if ( mailto ! = "" )
{
var j = 0 ;
var filepath = "" ;
result = MsSeaeOrderDAL . SendMailWithFile ( mailtitle , Body . ToString ( ) , filepath , mailto , Convert . ToString ( Session [ "SHOWNAME" ] ) ) ;
}
}
//if (headData.ETD == "") headData.ETD = null;
//if (headData.STLDATE == "") headData.STLDATE = null;
//if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
}
//if (headData.CONFIRMDATE == "") headData.CONFIRMDATE = null;
//if (headData.AUDITDATE == "") headData.AUDITDATE = null;
var jsonRespose = new JsonResponse
{
Success = result . Success ,
Message = result . Message ,
Data = ""
} ;
return new ContentResult ( ) { Content = JsonConvert . Serialize ( jsonRespose ) } ;
//var modb = new ModelObjectDB();
//DBResult result = modb.Save(headData);
//if (result.Success) {
// var PARAMVALUE = MsSysParamSetDAL.GetData("PARAMNAME='ORDERSENDMAIL'");
// if (PARAMVALUE.PARAMVALUE == "1")
// {
// var mailtitle = "订舱驳回:" + headData.CUSTNO;
// var Body = new StringBuilder();
// Body.Append("<html> <Body>");
// Body.Append("<br />订舱驳回:<br />业务编号:" + headData.ORDNO);
// Body.Append("<br />客户名称:" + headData.CUSTOMERNAME);
// Body.Append("<br />揽货人" + headData.SALE);
// Body.Append("<br />港口:" + headData.DESTINATION);
// Body.Append("<br />船期:" + headData.ETD);
// Body.Append("<br />船公司:" + headData.CARRIER);
// Body.Append("<br />箱量:" + headData.CNTRTOTAL);
// Body.Append("<br />备注:" + headData.REMARK);
// Body.Append("</Body></html> ");
// var mailto = "";
// var SALELIST = SysUserDAL.GetDataList("U.SHOWNAME='" + headData.SALE + "' or U.SHOWNAME='" + headData.INPUTBY + "' ");
// foreach (var SALE in SALELIST)
// {
// if (SALE.EMAIL1 != "")
// {
// if (mailto == "")
// mailto = SALE.EMAIL1;
// else
// mailto = mailto + ";" + SALE.EMAIL1;
// }
// }
// if (mailto != "")
// {
// var j = 0;
// var filepath = "";
// result = MsSeaeOrderDAL.SendMailWithFile(mailtitle, Body.ToString(), filepath, mailto, Convert.ToString(Session["SHOWNAME"]));
// }
// }
//}
//var jsonRespose = new JsonResponse
//{
// Success = result.Success,
// Message = result.Message,
// Data = ""
//};
//return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
# endregion