using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; namespace JobReqWebData { public class JsonStatusResponse { public string status { get; set; } } public class JsonETAResponse { public List message { get; set; } public string status { get; set; } } public class YZETAData { public string GID { get; set; } public string BWDM1 { get; set; } public string CIMO { get; set; } public string ETD { get; set; } public string ETA { get; set; } public string CKHC { get; set; } public string CMDM { get; set; } public string CYR { get; set; } public string DGBZ { get; set; } public string JKHC { get; set; } public string SJDGSJ { get; set; } public string SJLGSJ { get; set; } public string SXJSSJ { get; set; } public string SXKSSJ { get; set; } public string YWCM { get; set; } public string ZWCM { get; set; } public string create_time { get; set; } } public class JsonYZResponse { public List YZ { get; set; } } public class YZCarrierData { public string GID { get; set; } public string MBLNO { get; set; } public string XiangHao { get; set; } public string YARDNAME { get; set; } public string CUSTNAME { get; set; } public string DongTaiShiJian { get; set; } public string DiDian { get; set; } public string DongTai { get; set; } public string status { get; set; } public string ChuanMing { get; set; } public string HangCi { get; set; } public string ishppen { get; set; } public string remarks { get; set; } public string Timezone { get; set; } public string CreateTime { get; set; } } public class JsonResponse { public List TD { get; set; } public List XD { get; set; } public List FD { get; set; } public List WL { get; set; } public YGTGroup YGT { get; set; } public List SDITDS { get; set; } } public class PYChangZhanFenDanHaoData { public string GID { get; set; } public string MBLNO { get; set; } public string YARDNAME { get; set; } public string FDH { get; set; } public string XiangHao { get; set; } public string XiangXing { get; set; } public string QianFeng { get; set; } public string JianShu { get; set; } public string BaoZhuang { get; set; } public string ZhongLiang { get; set; } public string ChiMa { get; set; } public DateTime CreateTime { get; set; } } public class PYChangZhanTiDanHaoData { public string GID { get; set; } public string CZNAME { get; set; } public string YARDNAME { get; set; } public string ChuanMing_En { get; set; } public string ChuanMing_Cn { get; set; } public string HangCi { get; set; } public string HaiGuanHangCi { get; set; } public string HangXian { get; set; } public string MBLNO { get; set; } public string XiangXing { get; set; } public string XiangLiang { get; set; } public string MuDiGang { get; set; } public string ZhongZhuanGang { get; set; } public string JiGangKaiShiShiJian { get; set; } public string JiGangJieShuShiJian { get; set; } public string ChuanGongSi { get; set; } public string TongGuanFangShi { get; set; } public DateTime CreateTime { get; set; } public string XieHuoGang { get; set; } public string KaoGangMaTou { get; set; } public string ZhuangChuanMaTou { get; set; } public string SongHuoDiZhi { get; set; } public string LiHuoSongHuoChangQu { get; set; } public string JieGangShiJian { get; set; } } public class PYChangZhanXiangHaoData { public string GID { get; set; } public string MBLNO { get; set; } public string YARDNAME { get; set; } public string XiangHao { get; set; } public string XiangXing { get; set; } public string FengHao { get; set; } public string NeiDianWaiDian { get; set; } public string XiangPiZhong { get; set; } public string HuoZhong { get; set; } public string ZongZhong { get; set; } public string VGM { get; set; } public string CheHao { get; set; } public string TiXiangShiJian { get; set; } public string FanChangShiJian { get; set; } public string JiGangShiJian { get; set; } public string HuaBo { get; set; } public string ZhiDingXiangHaoTiXiangChangQu { get; set; } public string ShangJianXiangHao { get; set; } public string ISFanChang { get; set; } public string ISTiXiang { get; set; } public DateTime CreateTime { get; set; } } public class PYWuLiuXinXiWangData { public string GID { get; set; } public string MBLNO { get; set; } public string CZNAME { get; set; } public string HuoWuZhuangTai { get; set; } public string ShenBaoXiangShu { get; set; } public string JianShu { get; set; } public string ZhongLiang { get; set; } public string YuPeiShiJian { get; set; } public string YuPeiJieGuo { get; set; } public string YunDiShiJian { get; set; } public string YunDiJieGuo { get; set; } public string FangXingShiJian { get; set; } public string FangXingZhuangTai { get; set; } public string ZhuangZaiShiJian { get; set; } public string ZhuangZaiJieGuo { get; set; } public DateTime CreateTime { get; set; } } public class YGTGroup { public List QdPortChuanBoJiHua { get; set; } //public List QdPortDanChuanChuKouKLBJH { get; set; } //public List QdPortDanChuanChuKouMTCQ { get; set; } //public List QdPortDanChuanChuKouZYJH { get; set; } //public List QdPortDanChuanChuKouZYQK { get; set; } public List QdPortDanPiaoChuKouBGDFX { get; set; } public List QdPortDanPiaoChuKouMTXX { get; set; } public List QdPortDanPiaoChuKouWLLH { get; set; } public List QdPortDanPiaoChuKouWLSH { get; set; } public List QdPortDanPiaoChuKouYDBG { get; set; } public List QdPortDanPiaoChuKouZXD { get; set; } public List QdPortDanPiaoChuKouZZFX { get; set; } public List QdPortDanPiaoJinKouHGBGDFX { get; set; } } public class QdPortChuanBoJiHua { public string GID { get; set; } public string BWDM1 { get; set; } public string CIMO { get; set; } public string CKHC { get; set; } public string CMDM { get; set; } public string CYR { get; set; } public string DGBZ { get; set; } public string DLWZ { get; set; } public string ETA { get; set; } public string ETD { get; set; } public string HXDM { get; set; } public string HXZM { get; set; } public string JKDL { get; set; } public string JKHC { get; set; } public DateTime? CreateTime { get; set; } public string NWM { get; set; } public string SJDGSJ { get; set; } public string SJLGSJ { get; set; } public string SXJSSJ { get; set; } public string SXKSSJ { get; set; } public string YWCM { get; set; } public string ZWCM { get; set; } public string TDH { get; set; } } public class QdPortDanChuanChuKouKLBJH { public string GID { get; set; } public string MTMC { get; set; } public string SHIPNAME { get; set; } public string ESHIPNAME { get; set; } public string VOYAGE { get; set; } public string VOYAGE_EXP { get; set; } public string PLANDATE { get; set; } public string KB_BERTHNO { get; set; } public string KB_PLANTIME { get; set; } public string YB_BERTHNO { get; set; } public string YB_PLANTIME { get; set; } public string LG_BERTHNO { get; set; } public string LG_PLANTIME { get; set; } public string UNITID { get; set; } public DateTime? CreateTime { get; set; } public string ZTDH { get; set; } public string YWCM { get; set; } public string HC { get; set; } } public class QdPortDanChuanChuKouMTCQ { public string GID { get; set; } public string MTMC { get; set; } public string ZWCM { get; set; } public string YWCM { get; set; } public string JKHC { get; set; } public string CKHC { get; set; } public string ETA { get; set; } public string ETD { get; set; } public string SXKSSJ { get; set; } public string SXJSSJ { get; set; } public string CYR { get; set; } public string HXMC { get; set; } public string BWDM1 { get; set; } public string DGBZMC { get; set; } public string SJDGSJ { get; set; } public string SJLGSJ { get; set; } public string JKDLMC { get; set; } public string NWM { get; set; } public string GQDM { get; set; } public string CIMO { get; set; } public DateTime? CreateTime { get; set; } public string ZTDH { get; set; } } public class QdPortDanChuanChuKouZYJH { public string GID { get; set; } public string MTMC { get; set; } public string SHIPNAME { get; set; } public string ESHIPNAME { get; set; } public string VOYAGE { get; set; } public string VOYAGE_EXP { get; set; } public string PLANDATE { get; set; } public string CODE_MEAN_CN { get; set; } public string BERTH { get; set; } public string CARGONAME { get; set; } public string UNLOADID { get; set; } public string TOPORTIME { get; set; } public string BEGINTIME { get; set; } public string CAPACITY { get; set; } public string WORKTON { get; set; } public string DAYTON { get; set; } public string ENDTIME { get; set; } public string LEVPORTIME { get; set; } public string AGENTNAM { get; set; } public DateTime? CreateTime { get; set; } public string ZTDH { get; set; } public string YWCM { get; set; } public string HC { get; set; } } public class QdPortDanChuanChuKouZYQK { public string GID { get; set; } public string MTMC { get; set; } public string SHIPNAME { get; set; } public string ESHIPNAME { get; set; } public string VOYAGE { get; set; } public string VOYAGE_EXP { get; set; } public string WORKDATE1 { get; set; } public string WORKDATE2 { get; set; } public string UNITNAME { get; set; } public string BERTHNO { get; set; } public string CARGONAME { get; set; } public string UNLOADID { get; set; } public string ALLTON { get; set; } public string CLASSTON { get; set; } public string SURTON { get; set; } public DateTime? CreateTime { get; set; } public string ZTDH { get; set; } public string YWCM { get; set; } public string HC { get; set; } } public class QdPortDanPiaoChuKouBGDFX { public string GID { get; set; } public string NET_WT { get; set; } public string ENTRY_ID { get; set; } public string CIMO { get; set; } public string WAREHOUSE_CODE { get; set; } public string VOYAGE_NO { get; set; } public string CONTA_ID { get; set; } public string PASS_PACK_NO { get; set; } public string INSERTSJ { get; set; } public string GROS_WT { get; set; } public string BILL_NO { get; set; } public string R_DATE { get; set; } public string IMPORT_DATETIME { get; set; } public string I_E_PORT { get; set; } public string FLAGHT_NO { get; set; } public string TDH { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoJinKouHGBGDFX { public string GID { get; set; } public string TDH { get; set; } public string BILL_NO { get; set; } public string CIMO { get; set; } public string ENTRY_ID { get; set; } public string FLAGHT_NO { get; set; } public string FXLBMC { get; set; } public string GROS_WT { get; set; } public string INSERTSJ { get; set; } public string I_E_PORT { get; set; } public string NET_WT { get; set; } public string R_DATE { get; set; } public string PASS_PACK_NO { get; set; } public string VOYAGE_NO { get; set; } public string WAREHOUSE_CODE { get; set; } public string XH { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoChuKouMTXX { public string GID { get; set; } public string JCGSJ { get; set; } public string SJRGSJ1 { get; set; } public string MTMC { get; set; } public string XH { get; set; } public string XSGSM { get; set; } public string SJRGSJ { get; set; } public string DCT { get; set; } public string ZHGM { get; set; } public string NWM { get; set; } public string GLDW { get; set; } public string LXLBMC { get; set; } public string XPZ { get; set; } public string INSERTSJ { get; set; } public string MTDM { get; set; } public string LXLB { get; set; } public string XZMC { get; set; } public string XHGYM { get; set; } public string QFH1 { get; set; } public string DQZTMC { get; set; } public string FXBZ { get; set; } public string TSZZXQMC { get; set; } public string CKHC { get; set; } public string JKHC { get; set; } public string JKYWCM { get; set; } public string DQZT { get; set; } public string CGLB { get; set; } public string MZ { get; set; } public string XX { get; set; } public string CGMX { get; set; } public string KZ { get; set; } public string JKZWCM { get; set; } public string CKYWCM { get; set; } public string ZHGYM { get; set; } public string GLDWMC { get; set; } public string CC { get; set; } public string XZDM { get; set; } public string IMO { get; set; } public string TDH { get; set; } public string RGMX { get; set; } public string CKZWCM { get; set; } public string XHGM { get; set; } public string RGLB { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoChuKouWLLH { public string GID { get; set; } public string TRANSPORT_TOOL_COD { get; set; } public string CARGO_TOTAL_GROSS_WEIGHT { get; set; } public string CARGO_CUBE { get; set; } public string CONT_NO { get; set; } public string TRANSPORT_TOOL_NAME { get; set; } public string CARGO_NUMBER { get; set; } public string BWZL { get; set; } public string DECLARE_CUSTOMS_COD { get; set; } public string id { get; set; } public string LHLB { get; set; } public string EDI_FILE_READ_TIME { get; set; } public string INSERTSJ { get; set; } public string VESSEL_VOYAGE_NUMBER { get; set; } public string RESPONSE_CONT_MSG { get; set; } public string BILL_NO { get; set; } public string RESPONSE_CONT_FILE_TIME { get; set; } public string TDH { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoChuKouWLSH { public string GID { get; set; } public string GQDM { get; set; } public string YWCM { get; set; } public string IMPORT_TIME { get; set; } public string CIMO { get; set; } public string HC { get; set; } public string MTMC { get; set; } public string MAIN_BILL_NO { get; set; } public string XH { get; set; } public string BILL_NO { get; set; } public string TDH { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoChuKouYDBG { public string GID { get; set; } public string BWLX { get; set; } public string CIMO { get; set; } public string XHDDDSJ { get; set; } public string HCHBBH { get; set; } public string XH { get; set; } public string XHDDM { get; set; } public string HZSJ { get; set; } public string FSDW { get; set; } public string SBDHGDM { get; set; } public string FDH { get; set; } public string YWCM { get; set; } public string HZMS { get; set; } public string IMPORT_TIME { get; set; } public string XZDM { get; set; } public string TDH { get; set; } public string XHDGQDM { get; set; } public string ID { get; set; } public string INSERTSJ { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoChuKouZXD { public string GID { get; set; } public string YWCM { get; set; } public string XZDM { get; set; } public string CC { get; set; } public string XX { get; set; } public string MTMC { get; set; } public string TDH { get; set; } public string HCHC { get; set; } public string INSERTSJ { get; set; } public string XH { get; set; } public string XSGSM { get; set; } public string XHGM { get; set; } public string CMDM { get; set; } public string XSTDH { get; set; } public string ZWCM { get; set; } public DateTime CreateTime { get; set; } } public class QdPortDanPiaoChuKouZZFX { public string GID { get; set; } public string YWLX { get; set; } public string RDATE { get; set; } public string CIMO { get; set; } public string HCHC { get; set; } public string XH { get; set; } public string FXLBMC { get; set; } public string GQDM { get; set; } public string SCBZMC { get; set; } public string YWCM { get; set; } public string IMPORT_TIME { get; set; } public string TDH { get; set; } public string ID { get; set; } public string YWLXMC { get; set; } public string INSERTSJ { get; set; } public string CMHCXH { get; set; } public string FLDD { get; set; } public DateTime CreateTime { get; set; } } public class SDITDSGROUP { public List PYTongGuanWuLiuZhuangTai { get; set; } } public class PYTongGuanWuLiuZhuangTai { public string GID { get; set; } public string MBLNO { get; set; } public string CBLG { get; set; } public string ZCWC { get; set; } public string ZXLG { get; set; } public string BGFX { get; set; } public string YDBK { get; set; } public string BGSB { get; set; } public string YPCD { get; set; } public string CREATETIME { get; set; } } /// /// 箱满仓查出的按提单号的费用 /// public class XMC_FEE { #region private Fields private string _MBLNO = string.Empty; private string _NAME = string.Empty; private string _MONEY = string.Empty; private string _CURRENCY = string.Empty; private string _KJDATE = string.Empty; private string _JFSTATUS = string.Empty; private string _QRBZ = string.Empty; private string _YYFPHAO = string.Empty; private string _YYFPDATE = string.Empty; private string _SWFPHAO = string.Empty; private string _BEIZHU = string.Empty; #endregion #region R&W public string MBLNO { get { return _MBLNO; } set { _MBLNO = value; } } public string NAME { get { return _NAME; } set { _NAME = value; } } public string MONEY { get { return _MONEY; } set { _MONEY = value; } } public string ETD { get;set; } public decimal money{ get { if (string.IsNullOrWhiteSpace(_MONEY)) { return 0; } else { return Convert.ToDecimal(_MONEY); } } } public string CURRENCY { get { if (_CURRENCY == "CNY") return "RMB"; else return _CURRENCY; } set { _CURRENCY = value; } } public string KJDATE { get { return _KJDATE; } set { _KJDATE = value; } } public string JFSTATUS { get { return _JFSTATUS; } set { _JFSTATUS = value; } } public string QRBZ { get { return _QRBZ; } set { _QRBZ = value; } } public string YYFPHAO { get { return _YYFPHAO; } set { _YYFPHAO = value; } } public string YYFPDATE { get { return _YYFPDATE; } set { _YYFPDATE = value; } } public string SWFPHAO { get { return _SWFPHAO; } set { _SWFPHAO = value; } } public string BEIZHU { get { return _BEIZHU; } set { _BEIZHU = value; } } #endregion /// /// 获取提单号列表 /// /// /// public XMC_FEE(string MBLNO, string NAME, string MONEY,string ETD) { this.MBLNO = MBLNO; this.NAME = NAME; this.MONEY = MONEY; this.ETD=ETD; } } public class XMC_FEE_List { public string connStr { get; set; } //public string sqlQuery { get; set; } public List XMC; private string getMBLNOList() { var MBLNOList = ""; if(XMC!=null) foreach (var fee in XMC) { if (MBLNOList.IndexOf("'" + fee.MBLNO + "'") >= 0) { } else { if (MBLNOList != "") MBLNOList += ","; MBLNOList += "'" + fee.MBLNO + "'"; } } return MBLNOList; } /// /// 当前接口返回的费用的mblno列表 /// /// private List getMBLNOStringList() { var result = new List(); foreach (var fee in XMC) { if (result.IndexOf(fee.MBLNO) >= 0) { } else { result.Add(fee.MBLNO); } } return result; } /// /// 返回当前接口返回的费用的提单号(去掉目前系统中的任务里已存在的任务号) /// /// /// private string getMBLNOListstr(List TaskList) { var MBLNOList = ""; foreach (var fee in XMC) { if (TaskList.IndexOf(fee.MBLNO) >= 0) continue; if (MBLNOList.IndexOf("'" + fee.MBLNO + "'") >= 0) { } else { if (MBLNOList != "") MBLNOList += ","; MBLNOList += "'" + fee.MBLNO + "'"; } } return MBLNOList; } private List getMblnoFeeList(string mblno) { var result = new List(); if (XMC != null) foreach (var fee in XMC) { if (mblno==fee.MBLNO) { result.Add(fee); } } return result; } private List getFeeInsertList(List feelist, List ratelist) { List result = new List(); foreach (var fee in feelist) { var rate = ratelist.First(t => t.CURRENCY == fee.CURRENCY).RATE; result.Add(getFeeInsert(fee, rate)); } return result; } private string getFeeInsert(XMC_FEE fee, decimal rate) { var result = " insert into t_ch_fee_edi (reportid,类型,费用状态,编号,费用名称,结算单位,客户名称,标准,单价,数量,金额,币别,汇率,录入日期,提单号,发票号码)"; var insertstr=" select top 1 taskno,'付','录入状态',bsno,'"+ fee.NAME + "','场站',(select forwarder from op_seae where bsno = op_task.bsno)yard,'单票'," + fee.MONEY + ",1,"+ fee.MONEY + ",'"+fee.CURRENCY+"',"+ rate + ",getdate(),mblno,'"+ fee.SWFPHAO + "' from op_task where mblno = '"+ fee.MBLNO + "' and TASKTYPE='外运账单' and TASKSOURCE='NET' and CREATEUSER='SYSTEM' "; result += insertstr; return result; } /// /// 生成任务的sql语句 已有的不再生成 /// /// public List SaveToOpTask_SQL() { var result = new List(); //if (XMC == null || XMC.Count == 0) return ""; //TaskMBLNOList = GetTASKLIST(); var MBLNOList = getMBLNOStringList(); var currencylist = getCurrency(); var exchangelist = getAllRate(); foreach (var mblno in MBLNOList) { //首先检查目前是否有完全相同的费用存在 如有则不进行接下来的操作 var CurrFeeList = getLocalTaskFeeList(mblno); var ReturnFeeList = getFeeList_MBLNO(XMC, mblno); var needinsert = false; if (CurrFeeList.Count() != ReturnFeeList.Count()) needinsert = true; if (!needinsert) { foreach (var returnfee in ReturnFeeList) { needinsert = true; foreach (var currfee in CurrFeeList) { if (returnfee.NAME == currfee.NAME && returnfee.money == currfee.money) { needinsert = false; break; } } if (needinsert) break; } } if (!needinsert) continue; var wherestr = "TASKTYPE='外运账单' and TASKSOURCE='NET' and CREATEUSER='SYSTEM' and MBLNO='" + mblno + "'"; result.Add("delete from t_ch_fee_edi where reportid in(select taskno from op_task where " + wherestr + ")"); result.Add("delete from op_task where "+ wherestr); result.Add("insert into op_task (GID,TASKNO,TASKTYPE,TASKSOURCE,TASKSTATUS,TASKTITLE,CREATETIME,CREATEUSER,CREATER,MBLNO,BSNO,TASKBEGINDATE,CORPID,OP) select newid(),newid(),'外运账单','NET','未完成','应付费用参考_' + MBLNO,getdate(),'SYSTEM','SYSTEM',MBLNO,BSNO,getdate(),corpid,OP from op_seae where MBLNO = '" + mblno + "' "); var feeetd = getMBLNOETD(mblno)[0]; List ratelist = getRate(currencylist, exchangelist,Convert.ToDateTime( feeetd.ETD)); var feestrlist = getFeeInsertList(ReturnFeeList, ratelist); foreach (var feestr in feestrlist) { result.Add(feestr); } } return result; } private List GetTASKLIST() { var tasklist = new List(); var sqlQuery = @"select MBLNO from op_task where TASKTYPE='外运账单' and MBLNO in (" + getMBLNOList() + ")"; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, conn); DataTable tQuery = new DataTable(); dataAdapter.Fill(tQuery); if (tQuery.Rows.Count > 0) { var taskmblno = ""; foreach (DataRow row in tQuery.Rows) { tasklist.Add(row["MBLNO"].ToString()); } } return tasklist; } private List getLocalTaskFeeList(string mblno) { var result = new List(); var sqlQuery = @"select 提单号 MBLNO,费用名称 NAME,金额 [MONEY],(select top 1 etd from op_seae where mblno='"+ mblno + "')ETD from t_ch_fee_edi where reportid in(select taskno from op_task where tasktype='外运账单' and mblno ='" + mblno + "')"; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, conn); DataTable tQuery = new DataTable(); dataAdapter.Fill(tQuery); if (tQuery.Rows.Count > 0) { foreach (DataRow row in tQuery.Rows) { XMC_FEE taskfee = new XMC_FEE(row["MBLNO"].ToString(), row["NAME"].ToString(),row["MONEY"].ToString(), row["ETD"].ToString()); result.Add(taskfee); } } return result; } private List getMBLNOETD(string mblno) { var result = new List(); var sqlQuery = @"select MBLNO,ETD from op_seae where mblno ='" + mblno + "'"; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, conn); DataTable tQuery = new DataTable(); dataAdapter.Fill(tQuery); if (tQuery.Rows.Count > 0) { foreach (DataRow row in tQuery.Rows) { XMC_FEE taskfee = new XMC_FEE(row["MBLNO"].ToString(), "", "0", row["ETD"].ToString()); result.Add(taskfee); } } return result; } private List getCurrency() { var result = new List(); var sqlQuery = @"select * from code_currency"; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, conn); DataTable tQuery = new DataTable(); dataAdapter.Fill(tQuery); if (tQuery.Rows.Count > 0) { foreach (DataRow row in tQuery.Rows) { code_currencyMC cc = new code_currencyMC(row["CODENAME"].ToString()); result.Add(cc); } } return result; } private List getAllRate() { var result = new List(); var sqlQuery = @"select (select codename from code_currency where gid=CURRENCYID) CURRENCY,* from currency_exchange"; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlQuery, conn); DataTable tQuery = new DataTable(); dataAdapter.Fill(tQuery); if (tQuery.Rows.Count > 0) { foreach (DataRow row in tQuery.Rows) { currency_exchangeMC cc = new currency_exchangeMC(); cc.CURRENCY = row["CURRENCY"].ToString(); cc.VALUE = Convert.ToDecimal(row["VALUE"].ToString()); cc.STARTTIME = Convert.ToDateTime(row["STARTTIME"].ToString()); cc.ENDTIME = Convert.ToDateTime(row["ENDTIME"].ToString()); result.Add(cc); } } return result; } private List getRate(List currencylist, List ratelist, DateTime ETD) { var result = new List(); var _now = ETD; //var currencylist = getCurrency(); if (currencylist.Count == 0) { return result; } //var ratelist = getAllRate(); if (ratelist.Count == 0) { return result; } foreach (var currency in currencylist) { var localrate = ratelist.FirstOrDefault(t => t.CURRENCY == currency.CODENAME && t.STARTTIME < _now && t.ENDTIME > _now); if (localrate == null) { localrate = ratelist.FirstOrDefault(t => t.CURRENCY == currency.CODENAME && t.STARTTIME == ratelist.Where(c => c.CURRENCY == t.CURRENCY).Max(c => c.STARTTIME )); } //实在没有就写个1 if (localrate == null) { localrate = new currency_exchangeMC(); localrate.CURRENCY = currency.CODENAME; localrate.VALUE = 1; } Rate rate = new Rate(localrate); result.Add(rate); } return result; } /// /// 从一个费用列表里获得指定提单号的费用 /// /// /// /// private List getFeeList_MBLNO(List feelist,string mblno) { var result = new List(); if (feelist != null) { foreach (var fee in feelist) { if (fee.MBLNO == mblno) { result.Add(fee); } } } return result; } private List getmblnolistinFeeList(List feelist) { var result = new List(); if (feelist != null) { foreach (var fee in feelist) { if (result.IndexOf(fee.MBLNO) >= 0) { } else { result.Add(fee.MBLNO); } } } return result; } //public string Clear_SQL() //{ // var result = new StringBuilder(); // if (XMC == null || XMC.Count == 0) return result.ToString(); // result.Append(" delete from t_ch_fee_edi where reportid in(select taskno from op_task where MBLNO in(" + getMBLNOList() + ") and TASKTYPE='WMCFEE')"); // result.Append(" delete from op_task where MBLNO in(" + getMBLNOList() + ") and TASKTYPE='WMCFEE' "); // return result.ToString(); //} } /// /// 币别列表 /// public class code_currencyMC { public string CODENAME { get; set; } public code_currencyMC(string codename) { CODENAME = codename; } } /// /// 汇率列表 /// GID,CURRENCYID,CURRENCY,VALUE,STARTTIME,ENDTIME /// public class currency_exchangeMC { public string GID { get; set; } public string CURRENCYID { get; set; } public string CURRENCY { get; set; } public decimal VALUE { get; set; } public DateTime STARTTIME { get; set; } public DateTime ENDTIME { get; set; } } /// /// 用来赋值的汇率列表 /// public class Rate { public string CURRENCY { get; set; } public decimal RATE { get; set; } public Rate(currency_exchangeMC ce) { CURRENCY = ce.CURRENCY; RATE = ce.VALUE; } } public class JsonImpResponse { public ImpRecord messgae { get; set; } public string status { get; set; } } public class ImpRecord { public changeBno changeBno { get; set; } public customsRelease customsRelease { get; set; } public List originalInfos { get; set; } } public class changeBno { public string billTime { get; set; } public string shipAgent { get; set; } } public class customsRelease { public string customsNO { get; set; } public string fbno { get; set; } public string vesselEN { get; set; } public string voyage { get; set; } public string IMO { get; set; } public string customsCode { get; set; } public string permitTime { get; set; } public string permitNum { get; set; } public string ctnNO { get; set; } public string weight { get; set; } public string roughWeight { get; set; } public string customsStatus { get; set; } public string permitType { get; set; } } public class originalInfo { public string bno { get; set; } public string fbno { get; set; } public string vesselCN { get; set; } public string vesselEN { get; set; } public string voyage { get; set; } public string ctnNO { get; set; } public string bareWeight { get; set; } public string boxSize { get; set; } public string boxPile { get; set; } public string sealNO { get; set; } public string quantity { get; set; } public string weight { get; set; } public string volume { get; set; } } }