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.
DS7/JobAutoCreateFee/JobGetMhData.cs

598 lines
35 KiB
C#

2 years ago
using log4net;
using Quartz;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using JobAutoCreateFee.Model;
namespace JobCreateFee
{
public class JobGetMhData : IJob
{
private ILog log = LogManager.GetLogger(typeof(JobGetMhData));
public void Execute(IJobExecutionContext context)
{
2 years ago
try
{
2 years ago
string connStr = context.JobDetail.JobDataMap.GetString("ConnectString");
string MhconnStr = context.JobDetail.JobDataMap.GetString("MhConnectString");
string D6querySql = context.JobDetail.JobDataMap.GetString("D6QuerySql");
2 years ago
log.Debug($"开始获取数据");
2 years ago
using (SqlConnection dbcon = new SqlConnection(connStr))
{
var strSql = new StringBuilder();
strSql.Append(D6querySql);
SqlCommand cmd = new SqlCommand();
cmd.CommandText = strSql.ToString();
cmd.CommandTimeout = 120000; //要加这一句
cmd.Connection = dbcon;
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataTable table = new DataTable();
adapter.Fill(table);
var CtnCodeList = GetCtnCodeList(dbcon);
var ServiceCodeList = GetServiceCodeList(dbcon);
var FrtCodeList = GetFrtCodeList(dbcon);
if (table.Rows.Count > 0)
{
2 years ago
log.Debug($"数据{table.Rows.Count}条");
2 years ago
foreach (DataRow row in table.Rows)
{
var MBLNO = row["主提单号"].ToString();
var BSNO = row["编号"].ToString();
var BSTYPE = row["BSTYPE"].ToString();
if (!string.IsNullOrEmpty(MBLNO))
{
2 years ago
log.Debug($"提单号:{MBLNO}");
while (BSNO.Length < 10) {
BSNO = " " + BSNO;
}
2 years ago
using (SqlConnection dbmh = new SqlConnection(MhconnStr))
{
var strSqlMh = new StringBuilder();
strSqlMh.Append("exec spGetBookingId '"+ MBLNO + "' ");
SqlCommand cmdMh = new SqlCommand();
cmdMh.CommandText = strSqlMh.ToString();
cmdMh.CommandTimeout = 120000; //要加这一句
cmdMh.Connection = dbmh;
SqlDataAdapter adapterMh = new SqlDataAdapter(cmdMh);
DataTable tableMh = new DataTable();
adapterMh.Fill(tableMh);
var BOOKID = "";
if (tableMh.Rows.Count > 0)
{
foreach (DataRow rowmh in tableMh.Rows)
{
BOOKID=rowmh["BookingId"].ToString();
}
}
2 years ago
if (!string.IsNullOrEmpty(BOOKID))
{
log.Debug($"BOOKID{BOOKID}");
2 years ago
var strSqlMhData = new StringBuilder();
strSqlMhData.Append("exec sp_Rpt_GetBooking " + BOOKID + " ");
SqlCommand cmdMhData = new SqlCommand();
cmdMhData.CommandText = strSqlMhData.ToString();
cmdMhData.CommandTimeout = 120000; //要加这一句
cmdMhData.Connection = dbmh;
SqlDataAdapter adapterMhData = new SqlDataAdapter(cmdMhData);
DataTable tableMhData = new DataTable();
adapterMhData.Fill(tableMhData);
if (tableMhData.Rows.Count > 0)
{
var i = 1;
var cargoid = "S";
Int32 pkgs = 0;
2 years ago
decimal kgs = 0;
decimal cbm = 0;
2 years ago
string ServiceContract = "";
string Comment = "";
string Vessel = "";
string Voyage = "";
string POL = "";
string POD = "";
2 years ago
string POLID = "";
string PODID = "";
string TermsCode = "";
2 years ago
string PaymentTypeDescription = "";
string ShipperDescription = "";
string MarksNumbers = "";
string HarmonizedCode = "";
string PackageType = "";
string SHIPPER = "";
string CONSIGNEE = "";
string NOTIFYPARTY = "";
2 years ago
string FinalDest = "";
2 years ago
string FinalDestID = "";
2 years ago
string FinalDestCountry = "";
2 years ago
string ETD = "";
2 years ago
string MhLane = "";
2 years ago
var CtnList = new List<Ctn>();
2 years ago
var CtnSumList = new List<Ctn>();
2 years ago
2 years ago
foreach (DataRow rowmhdata in tableMhData.Rows)
2 years ago
{
if (i == 1)
{
var isnotref = rowmhdata["IsNonOperReefer"].ToString();
if (isnotref == "0") cargoid = "R";
2 years ago
2 years ago
ServiceContract = rowmhdata["ServiceContract"].ToString();
2 years ago
Comment = rowmhdata["Comment"].ToString();
Vessel = rowmhdata["Vessel"].ToString();
Voyage = rowmhdata["Voyage"].ToString();
POL = rowmhdata["POL"].ToString();
POD = rowmhdata["POD"].ToString();
TermsCode = rowmhdata["TermsCode"].ToString();
2 years ago
var ServiceCode = ServiceCodeList.Find(x => x.EDICODE == TermsCode);
2 years ago
if (ServiceCode != null) TermsCode = ServiceCode.SERVICE;
2 years ago
FinalDest = rowmhdata["FinalDest"].ToString();
2 years ago
FinalDestCountry = rowmhdata["FinalDestCountry"].ToString();
if (FinalDestCountry == "United States" || FinalDestCountry == "Canada") {
var FinalDestCountryStateCode = rowmhdata["FinalDestCountryStateCode"].ToString();
FinalDest = FinalDest + "," + FinalDestCountryStateCode;
}
2 years ago
2 years ago
log.Debug($"提单号:{MBLNO} ,目的港:{FinalDest}");
2 years ago
PaymentTypeDescription = rowmhdata["PaymentTypeDescription"].ToString();
2 years ago
var FrtCode = FrtCodeList.Find(x => x.EDICODE == PaymentTypeDescription);
if (FrtCode != null) PaymentTypeDescription = FrtCode.FRT;
ShipperDescription = rowmhdata["ShipperDescription"].ToString();
MarksNumbers = rowmhdata["MarksNumbers"].ToString();
HarmonizedCode = rowmhdata["HarmonizedCode"].ToString();
PackageType = rowmhdata["PackageType"].ToString();
2 years ago
SHIPPER = rowmhdata["BLShipper"].ToString() + Environment.NewLine + rowmhdata["BLShipperAddress"].ToString();
2 years ago
if (string.IsNullOrEmpty(rowmhdata["BLShipperContact"].ToString())) SHIPPER = SHIPPER + Environment.NewLine + rowmhdata["BLShipperContact"].ToString();
CONSIGNEE = rowmhdata["BLConsignee"].ToString() + Environment.NewLine + rowmhdata["BLConsigneeAddress"].ToString();
if (string.IsNullOrEmpty(rowmhdata["BLConsigneeContact"].ToString())) CONSIGNEE = CONSIGNEE + Environment.NewLine + rowmhdata["BLConsigneeContact"].ToString();
NOTIFYPARTY = rowmhdata["BLNotify1"].ToString();
if (string.IsNullOrEmpty(rowmhdata["BLNotify1Address"].ToString())) NOTIFYPARTY = NOTIFYPARTY + Environment.NewLine + rowmhdata["BLNotify1Address"].ToString();
if (string.IsNullOrEmpty(rowmhdata["BLNotify1Contact"].ToString())) NOTIFYPARTY = NOTIFYPARTY + Environment.NewLine + rowmhdata["BLNotify1Contact"].ToString();
2 years ago
ETD = GETETD(Vessel, Voyage, dbcon);
2 years ago
MhLane = GetMHLane(BOOKID,dbmh);
2 years ago
POLID = GetMHPortid(POL, dbmh);
PODID = GetMHPortid(POD, dbmh);
FinalDestID = GetMHPortid(FinalDest, dbmh);
2 years ago
2 years ago
2 years ago
}
2 years ago
pkgs = pkgs + Convert.ToInt32(rowmhdata["Quantity"]);
cbm = cbm + Convert.ToDecimal(rowmhdata["Measurement"]);
kgs = kgs + Convert.ToDecimal(rowmhdata["Weight"]);
var ContainerNumber = rowmhdata["ContainerNumber"].ToString();
2 years ago
var SealNumber = rowmhdata["SealNumber"].ToString();
2 years ago
var ContainerTypeCode = rowmhdata["ContainerTypeCode"].ToString();
var CtnsCount = rowmhdata["CtnsCount"].ToString();
2 years ago
var CtnCode = CtnCodeList.Find(x => x.EDICODE == ContainerTypeCode);
2 years ago
var Ctnid = rowmhdata["ContainerId"].ToString();
2 years ago
2 years ago
var Ctn = CtnList.Find(x => x.Ctnid == Ctnid);
if (Ctn == null)
{
var NewCtn = new Ctn();
NewCtn.Ctnid = Ctnid;
if (CtnCode != null)
2 years ago
{
2 years ago
NewCtn.CTNALL = CtnCode.CTNALL;
NewCtn.CTNSIZE = CtnCode.CTNSIZE;
NewCtn.CTNTYPE = CtnCode.CTNTYPE;
NewCtn.CTNCODE = CtnCode.CTNCODE;
2 years ago
}
else {
NewCtn.CTNALL = ContainerTypeCode;
NewCtn.CTNCODE = ContainerTypeCode;
2 years ago
}
2 years ago
NewCtn.EdiCode = ContainerTypeCode;
NewCtn.CtnNum = 1;
NewCtn.Pkgs = Convert.ToInt32(rowmhdata["Quantity"]);
NewCtn.Cbm = Convert.ToDecimal(rowmhdata["Measurement"]);
NewCtn.Kgs = Convert.ToDecimal(rowmhdata["Weight"]);
var TMPTEU = 1;
2 years ago
if (ContainerTypeCode.IndexOf("40") >= 0)
2 years ago
{
TMPTEU = 2;
}
NewCtn.Teu = TMPTEU;
2 years ago
var CtnSum = CtnSumList.Find(x => x.CTNALL == NewCtn.CTNALL);
if (CtnSum == null)
{
var NewCtnSum = new Ctn();
NewCtnSum.CTNALL = CtnCode.CTNALL;
NewCtnSum.CtnNum = 1;
2 years ago
NewCtnSum.Teu = NewCtn.Teu;
2 years ago
CtnSumList.Add(NewCtnSum);
}
else
{
CtnSum.CtnNum = CtnSum.CtnNum + 1;
2 years ago
CtnSum.Teu = CtnSum.Teu + NewCtn.Teu;
2 years ago
}
2 years ago
CtnList.Add(NewCtn);
}
else
{
Ctn.Pkgs = Ctn.Pkgs+ Convert.ToInt32(rowmhdata["Quantity"]);
Ctn.Cbm = Ctn.Cbm+Convert.ToDecimal(rowmhdata["Measurement"]);
Ctn.Kgs = Ctn.Kgs+ Convert.ToDecimal(rowmhdata["Weight"]);
}
i = i + 1;
2 years ago
}
2 years ago
if (BSTYPE == "分单")
{
dbcon.Open();
var cmdDeleteCtnSQL = "delete from t_op_ctn_fendan where AS_ID='" + BSNO + "' ";
SqlCommand cmdDeleteCtn = new SqlCommand(cmdDeleteCtnSQL, dbcon);
cmdDeleteCtn.ExecuteNonQuery();
dbcon.Close();
}
else
{
dbcon.Open();
var cmdDeleteCtnSQL = "delete from t_op_ctn where 编号='" + BSNO + "' ";
SqlCommand cmdDeleteCtn = new SqlCommand(cmdDeleteCtnSQL, dbcon);
cmdDeleteCtn.ExecuteNonQuery();
dbcon.Close();
}
var ctnstr = "";
2 years ago
var ctnUpdatestr = "";
int TEU = 0;
int CTN20 = 0;
int CTN40= 0;
int CTN40HC= 0;
int CTN45 = 0;
2 years ago
foreach (var items in CtnSumList)
{
if (!string.IsNullOrEmpty(ctnstr))
ctnstr = ctnstr + " " + items.CTNALL + "*" + items.CtnNum.ToString();
else ctnstr = items.CTNALL + "*" + items.CtnNum.ToString();
2 years ago
TEU = TEU + items.Teu;
2 years ago
if (items.CTNALL == "20'GP")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型1=" + items.CtnNum.ToString();
CTN20 = CTN20 + items.CtnNum;
}
2 years ago
if (items.CTNALL == "20'RF")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型2=" + items.CtnNum.ToString();
CTN20 = CTN20 + items.CtnNum;
}
2 years ago
if (items.CTNALL == "40'GP")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型3=" + items.CtnNum.ToString();
CTN40 = CTN40 + items.CtnNum;
}
2 years ago
if (items.CTNALL == "40'RF") {
2 years ago
ctnUpdatestr = ctnUpdatestr + ",箱型4=" + items.CtnNum.ToString();
CTN40 = CTN40 + items.CtnNum;
}
2 years ago
if (items.CTNALL == "40'RH")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型5=" + items.CtnNum.ToString();
CTN40HC = CTN40HC + items.CtnNum;
}
2 years ago
if (items.CTNALL == "45'HC")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型6=" + items.CtnNum.ToString();
CTN45 = CTN45 + items.CtnNum;
}
2 years ago
if (items.CTNALL == "40'HC")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型7=" + items.CtnNum.ToString();
CTN40HC = CTN40HC + items.CtnNum;
}
2 years ago
if (items.CTNALL == "45'HQ")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型8=" + items.CtnNum.ToString();
CTN45 = CTN45 + items.CtnNum;
}
2 years ago
if (items.CTNALL == "40'FR")
2 years ago
{
ctnUpdatestr = ctnUpdatestr + ",箱型9=" + items.CtnNum.ToString();
CTN40 = CTN40 + items.CtnNum;
}
2 years ago
}
2 years ago
ctnUpdatestr = ctnUpdatestr + ",箱TEU=" + TEU.ToString();
ctnUpdatestr = ctnUpdatestr + ",合计20=" + CTN20.ToString();
ctnUpdatestr = ctnUpdatestr + ",合计40=" + CTN40.ToString();
ctnUpdatestr = ctnUpdatestr + ",合计40H=" + CTN40HC.ToString();
ctnUpdatestr = ctnUpdatestr + ",合计45=" + CTN45.ToString();
2 years ago
2 years ago
foreach (var items in CtnList) {
2 years ago
2 years ago
if (BSTYPE == "分单")
{
dbcon.Open();
2 years ago
2 years ago
var cmdInsertCtnSQL = "insert into t_op_ctn_fendan (AS_ID,代码,尺寸,箱型,数量,TEU,表现形式,箱号,封号,件数,包装,重量,尺码) values ("
+ "'" + BSNO + "','" + items.CTNCODE + "','" + items.CTNSIZE + "','" + items.CTNTYPE + "',1," + items.Teu.ToString() + ",'" + items.CTNALL.Replace("'", "''") + "','" + items.Cntrno + "','" + items.Sealno + "','" + Convert.ToString(items.Pkgs) + "','" + PackageType + "'," + Convert.ToString(items.Kgs) + "," + Convert.ToString(items.Cbm) + " )";
2 years ago
SqlCommand cmdInsertCtn = new SqlCommand(cmdInsertCtnSQL, dbcon);
cmdInsertCtn.ExecuteNonQuery();
dbcon.Close();
}
else
{
dbcon.Open();
2 years ago
2 years ago
var cmdInsertCtnSQL = "insert into t_op_ctn (编号,代码,尺寸,箱型,数量,TEU,表现形式,箱号,封号,件数,包装,重量,尺码) values ("
+ "'" + BSNO + "','" + items.CTNCODE + "','" + items.CTNSIZE + "','" + items.CTNTYPE + "',1," + items.Teu.ToString() + ",'" + items.CTNALL.Replace("'", "''") + "','" + items.Cntrno + "','" + items.Sealno + "','" + Convert.ToString(items.Pkgs) + "','" + PackageType + "'," + Convert.ToString(items.Kgs) + "," + Convert.ToString(items.Cbm) + " )";
2 years ago
SqlCommand cmdInsertCtn = new SqlCommand(cmdInsertCtnSQL, dbcon);
cmdInsertCtn.ExecuteNonQuery();
dbcon.Close();
}
2 years ago
}
2 years ago
var strSqlUpdateD6 = new StringBuilder();
if (BSTYPE == "分单")
{
strSqlUpdateD6.Append("update t_op_seae_assistant set 运费协议号=@ServiceContract,备注=@Comment,船名=@Vessel,航次=@Voyage,装货港=@POL");
2 years ago
strSqlUpdateD6.Append(",卸货港=@POD,目的地=@DEST,运输条款=@TermsCode,付费方式=@PaymentTypeDescription,货物描述=@ShipperDescription,唛头=@MarksNumbers");
strSqlUpdateD6.Append(",件数=@PKGS,重量=@KGS,尺码=@CBM,运输方式=@HarmonizedCode,包装=@PackageType,件数包装=@PKGSKIND,货物重量=@GOODKGS,货物尺码=@GOODCBM,集装箱=@CTNSTR");
2 years ago
strSqlUpdateD6.Append(",装港代码=@POLID,卸货代码=@PODID,目的地代码=@FinalDestID");
strSqlUpdateD6.Append(",发货人代码=@SHIPPER,收货人代码=@CONSIGNEE,通知人代码=@NOTIFYPARTY,开船日期=@ETD,船公司航线=@MHLANE where AS_ID='" + BSNO + "'");
2 years ago
}
else
{
strSqlUpdateD6.Append("update t_op_seae set 运费协议号=@ServiceContract,备注=@Comment,船名=@Vessel,航次=@Voyage,装货港=@POL");
2 years ago
strSqlUpdateD6.Append(",卸货港=@POD,目的地=@DEST,运输条款=@TermsCode,付费方式=@PaymentTypeDescription,货物描述=@ShipperDescription,唛头=@MarksNumbers");
strSqlUpdateD6.Append(",件数=@PKGS,重量=@KGS,尺码=@CBM,运输方式=@HarmonizedCode,包装=@PackageType,件数包装=@PKGSKIND,货物重量=@GOODKGS,货物尺码=@GOODCBM,集装箱=@CTNSTR");
2 years ago
strSqlUpdateD6.Append(",装港代码=@POLID,卸货代码=@PODID,目的地代码=@FinalDestID");
strSqlUpdateD6.Append(",发货人代码=@SHIPPER,收货人代码=@CONSIGNEE,通知人代码=@NOTIFYPARTY,开船日期=@ETD,船公司航线=@MHLANE "+ ctnUpdatestr + " where 编号='" + BSNO + "'");
2 years ago
}
dbcon.Open();
2 years ago
log.Debug($"更新业务信息{strSqlUpdateD6.ToString()}");
2 years ago
SqlCommand cmdUpdateD6 = new SqlCommand(strSqlUpdateD6.ToString(), dbcon);
cmdUpdateD6.Parameters.AddWithValue("@ServiceContract", ServiceContract);
cmdUpdateD6.Parameters.AddWithValue("@Comment", Comment);
cmdUpdateD6.Parameters.AddWithValue("@Vessel", Vessel);
cmdUpdateD6.Parameters.AddWithValue("@Voyage", Voyage);
cmdUpdateD6.Parameters.AddWithValue("@POL", POL);
cmdUpdateD6.Parameters.AddWithValue("@POD", POD);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@DEST", FinalDest);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@POLID", POLID);
cmdUpdateD6.Parameters.AddWithValue("@PODID", PODID);
cmdUpdateD6.Parameters.AddWithValue("@FinalDestID", FinalDestID);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@TermsCode", TermsCode);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@PaymentTypeDescription", PaymentTypeDescription);
cmdUpdateD6.Parameters.AddWithValue("@ShipperDescription", ShipperDescription);
cmdUpdateD6.Parameters.AddWithValue("@MarksNumbers", MarksNumbers);
cmdUpdateD6.Parameters.AddWithValue("@PKGS", pkgs);
cmdUpdateD6.Parameters.AddWithValue("@KGS", kgs);
cmdUpdateD6.Parameters.AddWithValue("@CBM", cbm);
cmdUpdateD6.Parameters.AddWithValue("@HarmonizedCode", HarmonizedCode);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@PackageType", "PACKAGE");
cmdUpdateD6.Parameters.AddWithValue("@PKGSKIND", pkgs.ToString() + "PACKAGES");
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@GOODKGS", kgs.ToString() + "KGS");
cmdUpdateD6.Parameters.AddWithValue("@GOODCBM", cbm.ToString() + "CBM");
cmdUpdateD6.Parameters.AddWithValue("@CTNSTR", ctnstr);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@SHIPPER", SHIPPER);
cmdUpdateD6.Parameters.AddWithValue("@CONSIGNEE", CONSIGNEE);
cmdUpdateD6.Parameters.AddWithValue("@NOTIFYPARTY", NOTIFYPARTY);
2 years ago
cmdUpdateD6.Parameters.AddWithValue("@ETD", ETD);
cmdUpdateD6.Parameters.AddWithValue("@MHLANE", MhLane);
cmdUpdateD6.ExecuteNonQuery();
2 years ago
dbcon.Close();
}
2 years ago
else {
log.Debug($"提单号:{MBLNO}未获取MH数据");
}
}
else {
log.Debug($"提单号:{MBLNO}未获取MH BOOKINGID");
2 years ago
}
}
}
}
}
2 years ago
}
}
catch (Exception ex)
{
log.Error(ex.Message);
log.Error(ex.StackTrace);
2 years ago
}
}
public static List<CtnTypeCode> GetCtnCodeList(SqlConnection dbcon)
{
var strSql = new StringBuilder();
strSql.Append("Select [代码],[箱型],[尺寸],[表现形式],MHEDI代码 ");
strSql.Append(" from t_code_ctn ");
var evList = new List<CtnTypeCode>();
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)
{
var evData = new CtnTypeCode();
evData.CTNCODE = Convert.ToString(row["代码"]);
evData.CTNTYPE = Convert.ToString(row["箱型"]);
evData.CTNSIZE= Convert.ToString(row["尺寸"]);
evData.CTNALL= Convert.ToString(row["表现形式"]);
evData.EDICODE = Convert.ToString(row["MHEDI代码"]);
evList.Add(evData);
}
}
return evList;
}
2 years ago
static public string GETETD(string VESSEL, string VOYNO, SqlConnection dbcon)
{
var result = "";
var strSql = new StringBuilder();
strSql.Append("SELECT top 1 开船日期 from t_code_voyage v left join t_code_vessel l on (l.VS_ID=v.VS_ID) where l.英文船名='"+ VESSEL + "' and v.航次='"+VOYNO+"' ");
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)
{
result = row["开船日期"].ToString();
}
}
2 years ago
2 years ago
return result;
}
2 years ago
public static List<ServiceCode> GetServiceCodeList(SqlConnection dbcon)
{
var strSql = new StringBuilder();
strSql.Append("Select 运输条款,MHEDI代码 ");
strSql.Append(" from t_code_items ");
var evList = new List<ServiceCode>();
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)
{
var evData = new ServiceCode();
evData.SERVICE = Convert.ToString(row["运输条款"]);
evData.EDICODE = Convert.ToString(row["MHEDI代码"]);
evList.Add(evData);
}
}
return evList;
}
public static List<FrtCode> GetFrtCodeList(SqlConnection dbcon)
{
var strSql = new StringBuilder();
strSql.Append("Select 付费方式,MHEDI代码 ");
strSql.Append(" from t_code_free ");
var evList = new List<FrtCode>();
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)
{
var evData = new FrtCode();
evData.FRT = Convert.ToString(row["付费方式"]);
evData.EDICODE = Convert.ToString(row["MHEDI代码"]);
evList.Add(evData);
}
}
return evList;
}
2 years ago
static public string GetMHLane(string Bookid,SqlConnection dbcon)
{
var result = "";
var strSql = new StringBuilder();
strSql.Append("select Service from uService where ServiceId in (select ServiceId from uBooking where BookingId ="+ Bookid + ")");
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)
{
result = row["Service"].ToString();
}
}
return result;
}
2 years ago
static public string GetMHPortid(string port, SqlConnection dbcon)
{
var result = "";
if (string.IsNullOrEmpty(port)) return result;
2 years ago
2 years ago
var strSql = new StringBuilder();
strSql.Append("select top 1 LocationCode from uLocation where Location ='" + port + "'");
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)
{
result = row["LocationCode"].ToString();
}
}
return result;
}
2 years ago
}
}