@ -66,6 +66,7 @@ using DSWeb.Areas.MvcShipping.Models.Message.VGM;
using DSWeb.MvcShipping.Models.MsSysThirdPartyAccount ;
using System.Collections.Specialized ;
using DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount ;
using DSWeb.MvcShipping.Models.CodeCtnEdi ;
namespace DSWeb.Areas.CommMng.DAL
{
@ -3112,6 +3113,7 @@ namespace DSWeb.Areas.CommMng.DAL
return SetCodeDisportData ( strSql ) ;
}
static public List < CodeDisportModel > GetCodeRailwayPortList ( string condition )
{
String strSql = "SELECT PORTENAME PORT,PORTCNAME CNAME,'' EDICODE,(PORTENAME+'-'+PORTCNAME) as CodeAndName,'' LANE from code_railwayport where " ;
@ -3232,6 +3234,122 @@ namespace DSWeb.Areas.CommMng.DAL
}
# endregion
#region edi代码对应
static public List < CodeCtnEdi > GetCustList ( string strCondition , string sort = null )
{
var strSql = new StringBuilder ( ) ;
strSql . Append ( "SELECT " ) ;
strSql . Append ( "GID,CUST as CTN,EDICODE,EDINAME,REMARK" ) ;
strSql . Append ( ",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97012 and EnumValueID=code_cust_edi.EDINAME) as EDINAMEREF,'' as PORTID" ) ;
strSql . Append ( " from code_cust_edi 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 EDINAME,CUST" ) ;
}
return SetData ( strSql ) ;
}
private static List < CodeCtnEdi > SetData ( StringBuilder strSql )
{
var headList = new List < CodeCtnEdi > ( ) ;
Database db = DatabaseFactory . CreateDatabase ( ) ;
using ( IDataReader reader = db . ExecuteReader ( CommandType . Text , strSql . ToString ( ) ) )
{
while ( reader . Read ( ) )
{
CodeCtnEdi data = new CodeCtnEdi ( ) ;
#region Set DB data to Object
data . GID = Convert . ToString ( reader [ "GID" ] ) ;
data . CTN = Convert . ToString ( reader [ "CTN" ] ) ;
data . EDICODE = Convert . ToString ( reader [ "EDICODE" ] ) ;
data . EDINAME = Convert . ToString ( reader [ "EDINAME" ] ) ;
data . EDINAMEREF = Convert . ToString ( reader [ "EDINAMEREF" ] ) ;
data . REMARK = Convert . ToString ( reader [ "REMARK" ] ) ;
data . PORTID = Convert . ToString ( reader [ "PORTID" ] ) ;
# endregion
headList . Add ( data ) ;
}
reader . Close ( ) ;
}
return headList ;
}
public static string GetCustEdiNameByName ( string CUSTOMERNAME , string EDINAME )
{
var condition = $"code_cust_edi.CUST='{CUSTOMERNAME}' and EDINAME='{EDINAME}'" ;
var result = GetCustList ( condition ) ;
if ( result ! = null & & result . Count > 0 )
{
return result [ 0 ] . CTN ;
}
else
{
return CUSTOMERNAME ;
}
}
public static string GetCustEdiNameByEdiCode ( string EDICODE , string EDINAME )
{
var condition = $"code_cust_edi.EDICODE='{EDICODE}' and EDINAME='{EDINAME}'" ;
var result = GetCustList ( condition ) ;
if ( result ! = null & & result . Count > 0 )
{
return result [ 0 ] . CTN ;
}
else
{
return EDICODE ;
}
}
static public string GetPortEDICODEByPORTNAMEorPORTIDAndEDIName ( string PORTNAME , string EDINAME )
{
var cdc = new CommonDataContext ( ) ;
var info = cdc . code_disport_edi . Where ( x = > ( x . PORTDISCHARGE = = PORTNAME | | x . PORTID = = PORTNAME ) & & x . EDINAME = = EDINAME ) . ToList ( ) ;
if ( info = = null | | info . Count = = 0 )
{
return PORTNAME ;
}
else {
return info [ 0 ] . EDICODE ;
}
}
static public string GetCtnEDICODEByCtnallAndEDIName ( string CTNALL , string EDINAME )
{
var cdc = new CommonDataContext ( ) ;
var info = cdc . code_ctn_edi . Where ( x = > x . CTN = = CTNALL & & x . EDINAME = = EDINAME ) . ToList ( ) ;
if ( info = = null | | info . Count = = 0 )
{
return CTNALL ;
}
else
{
return info [ 0 ] . EDICODE ;
}
}
# endregion
#region 品名类型
static public List < sys_template > Getsys_templateList ( )
{
@ -7441,6 +7559,16 @@ namespace DSWeb.Areas.CommMng.DAL
return result ;
}
public static void CheckWebconfig ( string itemname , ref DBResult result )
{
var item = ConfigurationManager . AppSettings [ itemname ] ;
if ( string . IsNullOrWhiteSpace ( item ) )
{
result . SetErrorInfo ( $"系统配置文件中没有配置【{itemname}】项目" ) ;
}
}
}
public class BarCodeDrawing