You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
243 lines
15 KiB
C#
243 lines
15 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Data.Common;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using DSWeb.MvcShipping.Models.MsOpSeae;
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeBill;
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
using DSWeb.EntityDA;
|
|
using DSWeb.Areas.CommMng.Models;
|
|
using HcUtility.Comm;
|
|
using System.Data.SqlClient;
|
|
using DSWeb.DataAccess;
|
|
using System.IO;
|
|
using HcUtility.Core;
|
|
using DSWeb.MvcShipping.Models.CompanyDef;
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
using DotNet4.Utilities;
|
|
using InvokeWebService;
|
|
using System.Xml;
|
|
using System.Xml.Serialization;
|
|
using System.Linq;
|
|
using System.Text.RegularExpressions;
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
using System.Web;
|
|
using System.Drawing;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.DAL.MsOpSeaeTemplateDAL
|
|
{
|
|
public class MsOpSeaeTemplateDAL
|
|
{
|
|
#region 查询
|
|
static public List<MsOpSeaeTemplate> GetDataList ( string strCondition, string userid, string usercode, string companyid, string sort = null, string load = null )
|
|
{
|
|
//var rangstr = GetRangDAStr("index", userid, usercode, companyid);
|
|
//if (!string.IsNullOrEmpty(rangstr))
|
|
//{
|
|
// if (!string.IsNullOrEmpty(strCondition))
|
|
// {
|
|
// strCondition = strCondition + " and " + rangstr;
|
|
// }
|
|
// else
|
|
// {
|
|
// strCondition = rangstr;
|
|
// }
|
|
//}
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
strSql.Append("SELECT GID,BSNO,TEMPLATENAME,CUSTOMERNAME,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,SHIPPER");
|
|
strSql.Append(",[CONSIGNEE],[NOTIFYPARTY],[AGENTID],[AGENT],[YARD],[VESSEL],[PlACERECEIPT],[PORTLOADID],[PORTLOAD]");
|
|
strSql.Append(",[PORTDISCHARGEID],[PORTDISCHARGE],[PLACEDELIVERYID],[PLACEDELIVERY],[DESTINATIONID],[DESTINATION]");
|
|
strSql.Append(",[NOBILL],[ISSUETYPE],[ISSUEDATE],[ISSUEPLACE],[BLFRT],[PREPARDAT],[PAYABLEAT],[SERVICE]");
|
|
strSql.Append(",[MARKS],[NOPKGS],[DESCRIPTION],[GOODSNAME],[GROSSWEIGHT],[MEASUREMENT],[PKGS],[KINDPKGS]");
|
|
strSql.Append(",[KGS],[CBM],[TOTALNO],[INPUTBY],[LANE],[SALE],[CARRIER],[FORWARDER],[CUSTOMSER],[TRUCKER],[CARGOID]");
|
|
strSql.Append(",[DCLASS],[DUNNO],[REEFERF],[TEMPID],[TEMPSET] ,[TEMPMAX],[TEMPMIN],[BSSOURCE],[BSSOURCEDETAIL]");
|
|
strSql.Append(",[REMARK],[ISFUMIGATION],[ISSTORAGE],[ISLAND],[ISCUSTOMS],[ISINSPECTION],[ISBOOKING],[ISAGENT],[ISHBLNO]");
|
|
strSql.Append(",[SERVICE9],[SERVICE10],[PACKINGTYPE],[WAREHOUSE],[CORPID],[SALEDEPT],[MBLFRT],[CREATETIME],[PLACERECEIPTID]");
|
|
strSql.Append(",[ISCONTAINERSOC],[DPAGE],[DLABEL],[LINKMAN],[VESSELID],[ISSUEPLACEID],[HSCODE],[MSHIPPERID],[MCONSIGNEEID]");
|
|
strSql.Append(",[MNOTIFYPARTYID],[MSHIPPER],[MCONSIGNEE],[MNOTIFYPARTY] ");
|
|
strSql.Append(" from op_seae_template ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
{
|
|
strSql.Append(" where " + strCondition );
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
{
|
|
strSql.Append(" order by " + sortstring);
|
|
}
|
|
else
|
|
{
|
|
strSql.Append(" order by TEMPLATENAME ");
|
|
}
|
|
return SetData(strSql);
|
|
}
|
|
|
|
|
|
static public MsOpSeaeTemplate GetData ( string condition )
|
|
{
|
|
var strSql = new StringBuilder();
|
|
strSql.Append("SELECT GID,BSNO,TEMPLATENAME,CUSTOMERNAME,SHIPPERID,CONSIGNEEID,NOTIFYPARTYID,SHIPPER");
|
|
strSql.Append(",[CONSIGNEE],[NOTIFYPARTY],[AGENTID],[AGENT],[YARD],[VESSEL],[PlACERECEIPT],[PORTLOADID],[PORTLOAD]");
|
|
strSql.Append(",[PORTDISCHARGEID],[PORTDISCHARGE],[PLACEDELIVERYID],[PLACEDELIVERY],[DESTINATIONID],[DESTINATION]");
|
|
strSql.Append(",[NOBILL],[ISSUETYPE],[ISSUEDATE],[ISSUEPLACE],[BLFRT],[PREPARDAT],[PAYABLEAT],[SERVICE]");
|
|
strSql.Append(",[MARKS],[NOPKGS],[DESCRIPTION],[GOODSNAME],[GROSSWEIGHT],[MEASUREMENT],[PKGS],[KINDPKGS]");
|
|
strSql.Append(",[KGS],[CBM],[TOTALNO],[INPUTBY],[LANE],[SALE],[CARRIER],[FORWARDER],[CUSTOMSER],[TRUCKER],[CARGOID]");
|
|
strSql.Append(",[DCLASS],[DUNNO],[REEFERF],[TEMPID],[TEMPSET] ,[TEMPMAX],[TEMPMIN],[BSSOURCE],[BSSOURCEDETAIL]");
|
|
strSql.Append(",[REMARK],[ISFUMIGATION],[ISSTORAGE],[ISLAND],[ISCUSTOMS],[ISINSPECTION],[ISBOOKING],[ISAGENT],[ISHBLNO]");
|
|
strSql.Append(",[SERVICE9],[SERVICE10],[PACKINGTYPE],[WAREHOUSE],[CORPID],[SALEDEPT],[MBLFRT],[CREATETIME],[PLACERECEIPTID]");
|
|
strSql.Append(",[ISCONTAINERSOC],[DPAGE],[DLABEL],[LINKMAN],[VESSELID],[ISSUEPLACEID],[HSCODE],[MSHIPPERID],[MCONSIGNEEID]");
|
|
strSql.Append(",[MNOTIFYPARTYID],[MSHIPPER],[MCONSIGNEE],[MNOTIFYPARTY] ");
|
|
strSql.Append(" from op_seae_template ");
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
{
|
|
strSql.Append(" where " + condition);
|
|
}
|
|
var list = SetData(strSql);
|
|
if (list.Count > 0)
|
|
return list[0];
|
|
return new MsOpSeaeTemplate();
|
|
}
|
|
|
|
|
|
|
|
private static List<MsOpSeaeTemplate> SetData ( StringBuilder strSql )
|
|
{
|
|
var headList = new List<MsOpSeaeTemplate>();
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
MsOpSeaeTemplate data = new MsOpSeaeTemplate();
|
|
#region Set DB data to Object
|
|
data.BSNO = Convert.ToString(reader["BSNO"]);//业务编号
|
|
data.CUSTOMERNAME = Convert.ToString(reader["CUSTOMERNAME"]);//委托单位
|
|
data.BSSOURCE = Convert.ToString(reader["BSSOURCE"]);//业务来源
|
|
data.BSSOURCEDETAIL = Convert.ToString(reader["BSSOURCEDETAIL"]);//来源明细
|
|
data.INPUTBY = Convert.ToString(reader["INPUTBY"]);//录入人
|
|
data.SALE = Convert.ToString(reader["SALE"]);//揽货人
|
|
data.CORPID = Convert.ToString(reader["CORPID"]);//分公司代码
|
|
data.SALEDEPT = Convert.ToString(reader["SALEDEPT"]);//所属部门
|
|
data.CREATETIME = Convert.ToString(reader["CREATETIME"]);//创建时间
|
|
data.VESSEL = Convert.ToString(reader["VESSEL"]);//船名
|
|
|
|
data.PORTLOADID = Convert.ToString(reader["PORTLOADID"]);//装货港代码
|
|
data.PORTLOAD = Convert.ToString(reader["PORTLOAD"]);//装货港
|
|
data.PORTDISCHARGEID = Convert.ToString(reader["PORTDISCHARGEID"]);//卸货港代码
|
|
data.PORTDISCHARGE = Convert.ToString(reader["PORTDISCHARGE"]);//卸货港
|
|
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);//品名
|
|
if (reader["KGS"] != DBNull.Value)
|
|
data.KGS = Convert.ToDecimal(reader["KGS"]);//毛重
|
|
data.CUSTOMSER = Convert.ToString(reader["CUSTOMSER"]);//报关行
|
|
if (reader["PKGS"] != DBNull.Value)
|
|
data.PKGS = Convert.ToInt32(reader["PKGS"]);//件数
|
|
data.KINDPKGS = Convert.ToString(reader["KINDPKGS"]);//件数包装
|
|
data.REMARK = Convert.ToString(reader["REMARK"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//备注
|
|
data.YARD = Convert.ToString(reader["YARD"]);//场站/靠泊码头
|
|
if (reader["CBM"] != DBNull.Value)
|
|
data.CBM = Convert.ToDecimal(reader["CBM"]);//立方数/尺码
|
|
data.CARRIER = Convert.ToString(reader["CARRIER"]);//船公司
|
|
data.TRUCKER = Convert.ToString(reader["TRUCKER"]);//承运车队
|
|
data.NOPKGS = Convert.ToString(reader["NOPKGS"]);//件数包装
|
|
if (reader["GROSSWEIGHT"] != DBNull.Value)
|
|
data.GROSSWEIGHT = Convert.ToString(reader["GROSSWEIGHT"]);//货物毛重
|
|
if (reader["MEASUREMENT"] != DBNull.Value)
|
|
data.MEASUREMENT = Convert.ToString(reader["MEASUREMENT"]);//货物尺码
|
|
data.DESCRIPTION = Convert.ToString(reader["DESCRIPTION"]);//货物描述
|
|
data.SHIPPERID = Convert.ToString(reader["SHIPPERID"]);//发货人
|
|
data.CONSIGNEEID = Convert.ToString(reader["CONSIGNEEID"]);//收货人
|
|
data.NOTIFYPARTYID = Convert.ToString(reader["NOTIFYPARTYID"]);//通知人
|
|
data.SHIPPER = Convert.ToString(reader["SHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//发货人内容
|
|
data.CONSIGNEE = Convert.ToString(reader["CONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//收货人内容
|
|
data.NOTIFYPARTY = Convert.ToString(reader["NOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//通知人内容
|
|
data.MSHIPPERID = Convert.ToString(reader["MSHIPPERID"]);//发货人
|
|
data.MCONSIGNEEID = Convert.ToString(reader["MCONSIGNEEID"]);//收货人
|
|
data.MNOTIFYPARTYID = Convert.ToString(reader["MNOTIFYPARTYID"]);//通知人
|
|
data.MSHIPPER = Convert.ToString(reader["MSHIPPER"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//发货人内容
|
|
data.MCONSIGNEE = Convert.ToString(reader["MCONSIGNEE"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//收货人内容
|
|
data.MNOTIFYPARTY = Convert.ToString(reader["MNOTIFYPARTY"]).Replace(@"\\\\", "\n").Replace(@"^", "\'");//通知人内容
|
|
|
|
data.AGENTID = Convert.ToString(reader["AGENTID"]);//国外代理
|
|
data.AGENT = Convert.ToString(reader["AGENT"]);//国外代理内容
|
|
data.PLACERECEIPT = Convert.ToString(reader["PlACERECEIPT"]);//收货地
|
|
data.PLACERECEIPTID = Convert.ToString(reader["PLACERECEIPTID"]);//收货地
|
|
data.PLACEDELIVERYID = Convert.ToString(reader["PLACEDELIVERYID"]);//交货地代码
|
|
data.PLACEDELIVERY = Convert.ToString(reader["PLACEDELIVERY"]);//交货地
|
|
data.DESTINATIONID = Convert.ToString(reader["DESTINATIONID"]);//目的地代码
|
|
data.DESTINATION = Convert.ToString(reader["DESTINATION"]);//目的地
|
|
data.NOBILL = Convert.ToString(reader["NOBILL"]);//提单份数
|
|
data.COPYNOBILL = Convert.ToString(reader["COPYNOBILL"]);//提单份数
|
|
data.ISSUETYPE = Convert.ToString(reader["ISSUETYPE"]);//签单方式
|
|
data.ISSUEPLACE = Convert.ToString(reader["ISSUEPLACE"]);//签单地点
|
|
data.BLFRT = Convert.ToString(reader["BLFRT"]);//付费方式
|
|
data.PREPARDAT = Convert.ToString(reader["PREPARDAT"]);//预付地点
|
|
data.PAYABLEAT = Convert.ToString(reader["PAYABLEAT"]);//到付地点
|
|
data.SERVICE = Convert.ToString(reader["SERVICE"]);//运输条款
|
|
data.MARKS = Convert.ToString(reader["MARKS"]);//唛头
|
|
data.LANE = Convert.ToString(reader["LANE"]);//航线
|
|
data.FORWARDER = Convert.ToString(reader["FORWARDER"]);//订舱公司
|
|
data.CARGOID = Convert.ToString(reader["CARGOID"]);//货物标识
|
|
data.DCLASS = Convert.ToString(reader["DCLASS"]);//危险品分类/等级
|
|
data.DUNNO = Convert.ToString(reader["DUNNO"]);//危险品编号
|
|
data.REEFERF = Convert.ToString(reader["REEFERF"]);//冷藏通风量
|
|
data.TEMPID = Convert.ToString(reader["TEMPID"]);//温度单位
|
|
data.TEMPSET = Convert.ToString(reader["TEMPSET"]);//设置温度
|
|
data.TEMPMAX = Convert.ToString(reader["TEMPMAX"]);//最高温度
|
|
data.TEMPMIN = Convert.ToString(reader["TEMPMIN"]);//最低温度
|
|
data.HUMIDITY = Convert.ToString(reader["HUMIDITY"]);//湿度
|
|
if (reader["ISFUMIGATION"] != DBNull.Value)
|
|
data.ISFUMIGATION = Convert.ToBoolean(reader["ISFUMIGATION"]);//熏蒸
|
|
if (reader["ISSTORAGE"] != DBNull.Value)
|
|
data.ISSTORAGE = Convert.ToBoolean(reader["ISSTORAGE"]);//仓储
|
|
if (reader["ISLAND"] != DBNull.Value)
|
|
data.ISLAND = Convert.ToBoolean(reader["ISLAND"]);//陆运
|
|
if (reader["ISCUSTOMS"] != DBNull.Value)
|
|
data.ISCUSTOMS = Convert.ToBoolean(reader["ISCUSTOMS"]);//报关
|
|
if (reader["ISINSPECTION"] != DBNull.Value)
|
|
data.ISINSPECTION = Convert.ToBoolean(reader["ISINSPECTION"]);//报检
|
|
if (reader["ISBOOKING"] != DBNull.Value)
|
|
data.ISBOOKING = Convert.ToBoolean(reader["ISBOOKING"]);//订舱
|
|
if (reader["ISAGENT"] != DBNull.Value)
|
|
data.ISAGENT = Convert.ToBoolean(reader["ISAGENT"]);//使用代理
|
|
if (reader["ISHBLNO"] != DBNull.Value)
|
|
data.ISHBLNO = Convert.ToBoolean(reader["ISHBLNO"]);//分单签单
|
|
if (reader["SERVICE9"] != DBNull.Value)
|
|
data.SERVICE9 = Convert.ToBoolean(reader["SERVICE9"]);//服务项目9
|
|
if (reader["SERVICE10"] != DBNull.Value)
|
|
data.SERVICE10 = Convert.ToBoolean(reader["SERVICE10"]);//服务项目10
|
|
data.WAREHOUSE = Convert.ToString(reader["WAREHOUSE"]);//仓库
|
|
data.MBLFRT = Convert.ToString(reader["MBLFRT"]);//MBL付费方式
|
|
data.DPAGE = Convert.ToString(reader["DPAGE"]);//危险品页号
|
|
data.DLABEL = Convert.ToString(reader["DLABEL"]);//危险品标签
|
|
data.LINKMAN = Convert.ToString(reader["LINKMAN"]);//危险品联系人
|
|
data.ISSUEPLACEID = Convert.ToString(reader["ISSUEPLACEID"]);//提单签发地代码
|
|
data.HSCODE = Convert.ToString(reader["HSCODE"]);//HS编码
|
|
data.SHIPAGENCY = Convert.ToString(reader["SHIPAGENCY"]);//船代
|
|
|
|
#endregion
|
|
headList.Add(data);
|
|
}
|
|
reader.Close();
|
|
}
|
|
return headList;
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
//
|
|
}
|
|
}
|