using System; using System.Text; using System.Data.SqlClient; using System.Collections.Generic; using System.Data; using DSWeb.Areas.CommMng.DAL; using DSWeb.SoftMng.DBUtility; using DSWeb.SoftMng.Model; using DSWeb.DataAccess; using DSWeb.EntityDA; using Microsoft.Practices.EnterpriseLibrary.Data; using DSWeb.Areas.MvcShipping.DB; using HcUtility.Comm; using DSWeb.MvcShipping.Models.MsOpApply; using DSWeb.MvcShipping.DAL.MsOpApplyDAL; using HcUtility.Core; using DSWeb.SoftMng.BLL; using System.Xml.Serialization; using System.IO; // ReSharper disable once CheckNamespace namespace DSWeb.SoftMng.DAL { //DecHead public partial class DecHeadDAL { public bool Exists(string GID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select count(1) from DecHead"); strSql.Append(" where "); strSql.Append(" GID = @GID "); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50) }; parameters[0].Value = GID; return DbHelperSQL.Exists(strSql.ToString(),parameters); } /// /// 增加一条数据 /// public int Add(DSWeb.SoftMng.Model.DecHead model) { StringBuilder strSql=new StringBuilder(); strSql.Append("insert into DecHead("); strSql.Append("GID,BSNO,IEFlag,Type,EdiId,Risk,CopCode,CopName,PDate,TypistNo,InputerName,PartenerID,TgdNo,DataSource,DeclTrnRel,ChkSurety,CopCodeScc,CheckFlow,TaxAaminMark,EntyPortCode,BLNo,BillType,ApprNo,CustomMaster,CustomMaster_Text,AgentStatus,SeqNo,PreEntryId,EntryId,IEPort,IEPort_Text,ManualNo,ContrNo,IEDate,DDate,TradeCoScc,TradeCode,TradeCiqCode,TradeName,OverseasConsignorCode,OverseasConsignorCname,OverseasConsignorEname,OverseasConsignorAddr,OverseasConsigneeCode,OverseasConsigneeEname,DomesticConsigneeEname,EdiRemark2,EdiRemark,OwnerCodeScc,OwnerCode,OwnerCiqCode,OwnerName,AgentCodeScc,AgentCode,DeclCiqCode,AgentName,TrafMode,TrafMode_Text,TrafName,NativeVoyageNo,BillNo,TradeMode,TradeMode_Text,CutMode,CutMode_Text,LicenseNo,TradeCountry,TradeCountry_Text,DistinatePort,DistinatePort_Text,TransMode,TransMode_Text,FeeMark,FeeRate,FeeCurr,FeeCurr_Text,InsurMark,InsurRate,InsurCurr,InsurCurr_Text,OtherMark,OtherRate,OtherCurr,OtherCurr_Text,PackNo,WrapType,WrapType_Text,GrossWet,NetWt,TradeAreaCode,TradeAreaCode_Text,ContaCount,AttaDocuCdstr,GoodsPlace,DespPortCode,DespPortCode_Text,EntryType,EntryType_Text,NoteS,MarkNo,OrgCode,OrgCode_Text,VsaOrgCode,VsaOrgCode_Text,InspOrgCode,InspOrgCode_Text,PurpOrgCode,PurpOrgCode_Text,CorrelationNo,CorrelationReasonFlag,CorrelationReasonFlag_Text,DespDate,CmplDschrgDt,OrigBoxFlag,SpecDeclFlag,SpecDeclFlag_Text,PromiseItmes,DeclareName,NoOtherPack,Insp_cert,BillState,ClientSeqNo,ApplyType"); strSql.Append(") values ("); strSql.Append("@GID,@BSNO,@IEFlag,@Type,@EdiId,@Risk,@CopCode,@CopName,@PDate,@TypistNo,@InputerName,@PartenerID,@TgdNo,@DataSource,@DeclTrnRel,@ChkSurety,@CopCodeScc,@CheckFlow,@TaxAaminMark,@EntyPortCode,@BLNo,@BillType,@ApprNo,@CustomMaster,@CustomMaster_Text,@AgentStatus,@SeqNo,@PreEntryId,@EntryId,@IEPort,@IEPort_Text,@ManualNo,@ContrNo,@IEDate,@DDate,@TradeCoScc,@TradeCode,@TradeCiqCode,@TradeName,@OverseasConsignorCode,@OverseasConsignorCname,@OverseasConsignorEname,@OverseasConsignorAddr,@OverseasConsigneeCode,@OverseasConsigneeEname,@DomesticConsigneeEname,@EdiRemark2,@EdiRemark,@OwnerCodeScc,@OwnerCode,@OwnerCiqCode,@OwnerName,@AgentCodeScc,@AgentCode,@DeclCiqCode,@AgentName,@TrafMode,@TrafMode_Text,@TrafName,@NativeVoyageNo,@BillNo,@TradeMode,@TradeMode_Text,@CutMode,@CutMode_Text,@LicenseNo,@TradeCountry,@TradeCountry_Text,@DistinatePort,@DistinatePort_Text,@TransMode,@TransMode_Text,@FeeMark,@FeeRate,@FeeCurr,@FeeCurr_Text,@InsurMark,@InsurRate,@InsurCurr,@InsurCurr_Text,@OtherMark,@OtherRate,@OtherCurr,@OtherCurr_Text,@PackNo,@WrapType,@WrapType_Text,@GrossWet,@NetWt,@TradeAreaCode,@TradeAreaCode_Text,@ContaCount,@AttaDocuCdstr,@GoodsPlace,@DespPortCode,@DespPortCode_Text,@EntryType,@EntryType_Text,@NoteS,@MarkNo,@OrgCode,@OrgCode_Text,@VsaOrgCode,@VsaOrgCode_Text,@InspOrgCode,@InspOrgCode_Text,@PurpOrgCode,@PurpOrgCode_Text,@CorrelationNo,@CorrelationReasonFlag,@CorrelationReasonFlag_Text,@DespDate,@CmplDschrgDt,@OrigBoxFlag,@SpecDeclFlag,@SpecDeclFlag_Text,@PromiseItmes,@DeclareName,@NoOtherPack,@Insp_cert,@BillState,@ClientSeqNo,@ApplyType"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50) , new SqlParameter("@BSNO", SqlDbType.VarChar,50) , new SqlParameter("@IEFlag", SqlDbType.Char,1) , new SqlParameter("@Type", SqlDbType.VarChar,2) , new SqlParameter("@EdiId", SqlDbType.VarChar,50) , new SqlParameter("@Risk", SqlDbType.VarChar,50) , new SqlParameter("@CopCode", SqlDbType.VarChar,50) , new SqlParameter("@CopName", SqlDbType.NVarChar,50) , new SqlParameter("@PDate", SqlDbType.DateTime) , new SqlParameter("@TypistNo", SqlDbType.VarChar,50) , new SqlParameter("@InputerName", SqlDbType.NVarChar,50) , new SqlParameter("@PartenerID", SqlDbType.VarChar,50) , new SqlParameter("@TgdNo", SqlDbType.VarChar,50) , new SqlParameter("@DataSource", SqlDbType.VarChar,50) , new SqlParameter("@DeclTrnRel", SqlDbType.Char,1) , new SqlParameter("@ChkSurety", SqlDbType.VarChar,50) , new SqlParameter("@CopCodeScc", SqlDbType.VarChar,50) , new SqlParameter("@CheckFlow", SqlDbType.Char,1) , new SqlParameter("@TaxAaminMark", SqlDbType.VarChar,50) , new SqlParameter("@EntyPortCode", SqlDbType.VarChar,50) , new SqlParameter("@BLNo", SqlDbType.VarChar,50) , new SqlParameter("@BillType", SqlDbType.VarChar,50) , new SqlParameter("@ApprNo", SqlDbType.VarChar,50) , new SqlParameter("@CustomMaster", SqlDbType.VarChar,50) , new SqlParameter("@CustomMaster_Text", SqlDbType.NVarChar,50) , new SqlParameter("@AgentStatus", SqlDbType.NVarChar,50) , new SqlParameter("@SeqNo", SqlDbType.VarChar,50) , new SqlParameter("@PreEntryId", SqlDbType.VarChar,50) , new SqlParameter("@EntryId", SqlDbType.VarChar,50) , new SqlParameter("@IEPort", SqlDbType.VarChar,50) , new SqlParameter("@IEPort_Text", SqlDbType.NVarChar,50) , new SqlParameter("@ManualNo", SqlDbType.VarChar,50) , new SqlParameter("@ContrNo", SqlDbType.VarChar,50) , new SqlParameter("@IEDate", SqlDbType.DateTime) , new SqlParameter("@DDate", SqlDbType.DateTime) , new SqlParameter("@TradeCoScc", SqlDbType.VarChar,18) , new SqlParameter("@TradeCode", SqlDbType.VarChar,10) , new SqlParameter("@TradeCiqCode", SqlDbType.VarChar,10) , new SqlParameter("@TradeName", SqlDbType.NVarChar,50) , new SqlParameter("@OverseasConsignorCode", SqlDbType.VarChar,50) , new SqlParameter("@OverseasConsignorCname", SqlDbType.NVarChar,150) , new SqlParameter("@OverseasConsignorEname", SqlDbType.VarChar,150) , new SqlParameter("@OverseasConsignorAddr", SqlDbType.VarChar,500) , new SqlParameter("@OverseasConsigneeCode", SqlDbType.VarChar,50) , new SqlParameter("@OverseasConsigneeEname", SqlDbType.VarChar,150) , new SqlParameter("@DomesticConsigneeEname", SqlDbType.VarChar,150) , new SqlParameter("@EdiRemark2", SqlDbType.NVarChar,500) , new SqlParameter("@EdiRemark", SqlDbType.NVarChar,500) , new SqlParameter("@OwnerCodeScc", SqlDbType.VarChar,18) , new SqlParameter("@OwnerCode", SqlDbType.VarChar,10) , new SqlParameter("@OwnerCiqCode", SqlDbType.VarChar,10) , new SqlParameter("@OwnerName", SqlDbType.NVarChar,50) , new SqlParameter("@AgentCodeScc", SqlDbType.VarChar,18) , new SqlParameter("@AgentCode", SqlDbType.VarChar,10) , new SqlParameter("@DeclCiqCode", SqlDbType.VarChar,10) , new SqlParameter("@AgentName", SqlDbType.NVarChar,50) , new SqlParameter("@TrafMode", SqlDbType.VarChar,10) , new SqlParameter("@TrafMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@TrafName", SqlDbType.NVarChar,50) , new SqlParameter("@NativeVoyageNo", SqlDbType.VarChar,50) , new SqlParameter("@BillNo", SqlDbType.VarChar,50) , new SqlParameter("@TradeMode", SqlDbType.VarChar,50) , new SqlParameter("@TradeMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@CutMode", SqlDbType.VarChar,50) , new SqlParameter("@CutMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@LicenseNo", SqlDbType.VarChar,50) , new SqlParameter("@TradeCountry", SqlDbType.VarChar,50) , new SqlParameter("@TradeCountry_Text", SqlDbType.NVarChar,50) , new SqlParameter("@DistinatePort", SqlDbType.VarChar,50) , new SqlParameter("@DistinatePort_Text", SqlDbType.NVarChar,50) , new SqlParameter("@TransMode", SqlDbType.VarChar,50) , new SqlParameter("@TransMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@FeeMark", SqlDbType.Char,1) , new SqlParameter("@FeeRate", SqlDbType.Decimal,9) , new SqlParameter("@FeeCurr", SqlDbType.NVarChar,50) , new SqlParameter("@FeeCurr_Text", SqlDbType.NVarChar,50) , new SqlParameter("@InsurMark", SqlDbType.NVarChar,50) , new SqlParameter("@InsurRate", SqlDbType.Decimal,9) , new SqlParameter("@InsurCurr", SqlDbType.NVarChar,50) , new SqlParameter("@InsurCurr_Text", SqlDbType.NVarChar,50) , new SqlParameter("@OtherMark", SqlDbType.NVarChar,50) , new SqlParameter("@OtherRate", SqlDbType.Decimal,9) , new SqlParameter("@OtherCurr", SqlDbType.NVarChar,50) , new SqlParameter("@OtherCurr_Text", SqlDbType.NVarChar,50) , new SqlParameter("@PackNo", SqlDbType.Int,4) , new SqlParameter("@WrapType", SqlDbType.VarChar,50) , new SqlParameter("@WrapType_Text", SqlDbType.NVarChar,50) , new SqlParameter("@GrossWet", SqlDbType.Decimal,9) , new SqlParameter("@NetWt", SqlDbType.Decimal,9) , new SqlParameter("@TradeAreaCode", SqlDbType.VarChar,50) , new SqlParameter("@TradeAreaCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@ContaCount", SqlDbType.Int,4) , new SqlParameter("@AttaDocuCdstr", SqlDbType.VarChar,50) , new SqlParameter("@GoodsPlace", SqlDbType.NVarChar,50) , new SqlParameter("@DespPortCode", SqlDbType.VarChar,50) , new SqlParameter("@DespPortCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@EntryType", SqlDbType.VarChar,50) , new SqlParameter("@EntryType_Text", SqlDbType.NVarChar,50) , new SqlParameter("@NoteS", SqlDbType.NVarChar,150) , new SqlParameter("@MarkNo", SqlDbType.VarChar,400) , new SqlParameter("@OrgCode", SqlDbType.VarChar,50) , new SqlParameter("@OrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@VsaOrgCode", SqlDbType.VarChar,50) , new SqlParameter("@VsaOrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@InspOrgCode", SqlDbType.VarChar,50) , new SqlParameter("@InspOrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@PurpOrgCode", SqlDbType.VarChar,50) , new SqlParameter("@PurpOrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@CorrelationNo", SqlDbType.VarChar,500) , new SqlParameter("@CorrelationReasonFlag", SqlDbType.VarChar,50) , new SqlParameter("@CorrelationReasonFlag_Text", SqlDbType.NVarChar,50) , new SqlParameter("@DespDate", SqlDbType.DateTime) , new SqlParameter("@CmplDschrgDt", SqlDbType.DateTime) , new SqlParameter("@OrigBoxFlag", SqlDbType.VarChar,50) , new SqlParameter("@SpecDeclFlag", SqlDbType.VarChar,500) , new SqlParameter("@SpecDeclFlag_Text", SqlDbType.NVarChar,500) , new SqlParameter("@PromiseItmes", SqlDbType.VarChar,50) , new SqlParameter("@DeclareName", SqlDbType.NVarChar,50) , new SqlParameter("@NoOtherPack", SqlDbType.Char,1) , new SqlParameter("@Insp_cert", SqlDbType.NVarChar,500), new SqlParameter("@BillState", SqlDbType.Char,1), new SqlParameter("@ClientSeqNo", SqlDbType.NVarChar,18), new SqlParameter("@ApplyType", SqlDbType.TinyInt,4) }; parameters[0].Value = model.GID??(Object)DBNull.Value; parameters[1].Value = model.BSNO??(Object)DBNull.Value; parameters[2].Value = model.IEFlag??(Object)DBNull.Value; parameters[3].Value = model.Type??(Object)DBNull.Value; parameters[4].Value = model.EdiId??(Object)DBNull.Value; parameters[5].Value = model.Risk??(Object)DBNull.Value; parameters[6].Value = model.CopCode??(Object)DBNull.Value; parameters[7].Value = model.CopName??(Object)DBNull.Value; parameters[8].Value = model.PDate??(Object)DBNull.Value; parameters[9].Value = model.TypistNo??(Object)DBNull.Value; parameters[10].Value = model.InputerName??(Object)DBNull.Value; parameters[11].Value = model.PartenerID??(Object)DBNull.Value; parameters[12].Value = model.TgdNo??(Object)DBNull.Value; parameters[13].Value = model.DataSource??(Object)DBNull.Value; parameters[14].Value = model.DeclTrnRel??(Object)DBNull.Value; parameters[15].Value = model.ChkSurety??(Object)DBNull.Value; parameters[16].Value = model.CopCodeScc??(Object)DBNull.Value; parameters[17].Value = model.CheckFlow??(Object)DBNull.Value; parameters[18].Value = model.TaxAaminMark??(Object)DBNull.Value; parameters[19].Value = model.EntyPortCode??(Object)DBNull.Value; parameters[20].Value = model.BLNo??(Object)DBNull.Value; parameters[21].Value = model.BillType??(Object)DBNull.Value; parameters[22].Value = model.ApprNo??(Object)DBNull.Value; parameters[23].Value = model.CustomMaster??(Object)DBNull.Value; parameters[24].Value = model.CustomMaster_Text??(Object)DBNull.Value; parameters[25].Value = model.AgentStatus??(Object)DBNull.Value; parameters[26].Value = model.SeqNo??(Object)DBNull.Value; parameters[27].Value = model.PreEntryId??(Object)DBNull.Value; parameters[28].Value = model.EntryId??(Object)DBNull.Value; parameters[29].Value = model.IEPort??(Object)DBNull.Value; parameters[30].Value = model.IEPort_Text??(Object)DBNull.Value; parameters[31].Value = model.ManualNo??(Object)DBNull.Value; parameters[32].Value = model.ContrNo??(Object)DBNull.Value; parameters[33].Value = model.IEDate??(Object)DBNull.Value; parameters[34].Value = model.DDate??(Object)DBNull.Value; parameters[35].Value = model.TradeCoScc??(Object)DBNull.Value; parameters[36].Value = model.TradeCode??(Object)DBNull.Value; parameters[37].Value = model.TradeCiqCode??(Object)DBNull.Value; parameters[38].Value = model.TradeName??(Object)DBNull.Value; parameters[39].Value = model.OverseasConsignorCode??(Object)DBNull.Value; parameters[40].Value = model.OverseasConsignorCname??(Object)DBNull.Value; parameters[41].Value = model.OverseasConsignorEname??(Object)DBNull.Value; parameters[42].Value = model.OverseasConsignorAddr??(Object)DBNull.Value; parameters[43].Value = model.OverseasConsigneeCode??(Object)DBNull.Value; parameters[44].Value = model.OverseasConsigneeEname??(Object)DBNull.Value; parameters[45].Value = model.DomesticConsigneeEname??(Object)DBNull.Value; parameters[46].Value = model.EdiRemark2??(Object)DBNull.Value; parameters[47].Value = model.EdiRemark??(Object)DBNull.Value; parameters[48].Value = model.OwnerCodeScc??(Object)DBNull.Value; parameters[49].Value = model.OwnerCode??(Object)DBNull.Value; parameters[50].Value = model.OwnerCiqCode??(Object)DBNull.Value; parameters[51].Value = model.OwnerName??(Object)DBNull.Value; parameters[52].Value = model.AgentCodeScc??(Object)DBNull.Value; parameters[53].Value = model.AgentCode??(Object)DBNull.Value; parameters[54].Value = model.DeclCiqCode??(Object)DBNull.Value; parameters[55].Value = model.AgentName??(Object)DBNull.Value; parameters[56].Value = model.TrafMode??(Object)DBNull.Value; parameters[57].Value = model.TrafMode_Text??(Object)DBNull.Value; parameters[58].Value = model.TrafName??(Object)DBNull.Value; parameters[59].Value = model.NativeVoyageNo??(Object)DBNull.Value; parameters[60].Value = model.BillNo??(Object)DBNull.Value; parameters[61].Value = model.TradeMode??(Object)DBNull.Value; parameters[62].Value = model.TradeMode_Text??(Object)DBNull.Value; parameters[63].Value = model.CutMode??(Object)DBNull.Value; parameters[64].Value = model.CutMode_Text??(Object)DBNull.Value; parameters[65].Value = model.LicenseNo??(Object)DBNull.Value; parameters[66].Value = model.TradeCountry??(Object)DBNull.Value; parameters[67].Value = model.TradeCountry_Text??(Object)DBNull.Value; parameters[68].Value = model.DistinatePort??(Object)DBNull.Value; parameters[69].Value = model.DistinatePort_Text??(Object)DBNull.Value; parameters[70].Value = model.TransMode??(Object)DBNull.Value; parameters[71].Value = model.TransMode_Text??(Object)DBNull.Value; parameters[72].Value = model.FeeMark??(Object)DBNull.Value; parameters[73].Value = model.FeeRate??(Object)DBNull.Value; parameters[74].Value = model.FeeCurr??(Object)DBNull.Value; parameters[75].Value = model.FeeCurr_Text??(Object)DBNull.Value; parameters[76].Value = model.InsurMark??(Object)DBNull.Value; parameters[77].Value = model.InsurRate??(Object)DBNull.Value; parameters[78].Value = model.InsurCurr??(Object)DBNull.Value; parameters[79].Value = model.InsurCurr_Text??(Object)DBNull.Value; parameters[80].Value = model.OtherMark??(Object)DBNull.Value; parameters[81].Value = model.OtherRate??(Object)DBNull.Value; parameters[82].Value = model.OtherCurr??(Object)DBNull.Value; parameters[83].Value = model.OtherCurr_Text??(Object)DBNull.Value; parameters[84].Value = model.PackNo??(Object)DBNull.Value; parameters[85].Value = model.WrapType??(Object)DBNull.Value; parameters[86].Value = model.WrapType_Text??(Object)DBNull.Value; parameters[87].Value = model.GrossWet??(Object)DBNull.Value; parameters[88].Value = model.NetWt??(Object)DBNull.Value; parameters[89].Value = model.TradeAreaCode??(Object)DBNull.Value; parameters[90].Value = model.TradeAreaCode_Text??(Object)DBNull.Value; parameters[91].Value = model.ContaCount??(Object)DBNull.Value; parameters[92].Value = model.AttaDocuCdstr??(Object)DBNull.Value; parameters[93].Value = model.GoodsPlace??(Object)DBNull.Value; parameters[94].Value = model.DespPortCode??(Object)DBNull.Value; parameters[95].Value = model.DespPortCode_Text??(Object)DBNull.Value; parameters[96].Value = model.EntryType??(Object)DBNull.Value; parameters[97].Value = model.EntryType_Text??(Object)DBNull.Value; parameters[98].Value = model.NoteS??(Object)DBNull.Value; parameters[99].Value = model.MarkNo??(Object)DBNull.Value; parameters[100].Value = model.OrgCode??(Object)DBNull.Value; parameters[101].Value = model.OrgCode_Text??(Object)DBNull.Value; parameters[102].Value = model.VsaOrgCode??(Object)DBNull.Value; parameters[103].Value = model.VsaOrgCode_Text??(Object)DBNull.Value; parameters[104].Value = model.InspOrgCode??(Object)DBNull.Value; parameters[105].Value = model.InspOrgCode_Text??(Object)DBNull.Value; parameters[106].Value = model.PurpOrgCode??(Object)DBNull.Value; parameters[107].Value = model.PurpOrgCode_Text??(Object)DBNull.Value; parameters[108].Value = model.CorrelationNo??(Object)DBNull.Value; parameters[109].Value = model.CorrelationReasonFlag??(Object)DBNull.Value; parameters[110].Value = model.CorrelationReasonFlag_Text??(Object)DBNull.Value; parameters[111].Value = model.DespDate??(Object)DBNull.Value; parameters[112].Value = model.CmplDschrgDt??(Object)DBNull.Value; parameters[113].Value = model.OrigBoxFlag??(Object)DBNull.Value; parameters[114].Value = model.SpecDeclFlag??(Object)DBNull.Value; parameters[115].Value = model.SpecDeclFlag_Text??(Object)DBNull.Value; parameters[116].Value = model.PromiseItmes??(Object)DBNull.Value; parameters[117].Value = model.DeclareName??(Object)DBNull.Value; parameters[118].Value = model.NoOtherPack??(Object)DBNull.Value; parameters[119].Value = model.Insp_cert??(Object)DBNull.Value; parameters[120].Value = model.BillState ?? (Object)DBNull.Value; parameters[121].Value = model.ClientSeqNo ?? (Object)DBNull.Value; parameters[122].Value = model.ApplyType ?? (Object)DBNull.Value; //parameters[123].Value = model.ApplyType_Text ?? (Object)DBNull.Value; return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); } /// /// 更新报关单状态 /// public int UpdateBillState(string gid,string state,string reason) { StringBuilder strSql = new StringBuilder(); strSql.Append("update DecHead set "); strSql.Append(" BillState = '" + state + "'"); if (state=="R") strSql.Append(",RejectReason='" + reason + "'"); strSql.Append(" where GID = '"+gid+"' "); return DbHelperSQL.ExecuteSql(strSql.ToString()); } /// /// 更新一条数据 /// public int Update(DSWeb.SoftMng.Model.DecHead model) { StringBuilder strSql=new StringBuilder(); strSql.Append("update DecHead set "); strSql.Append(" GID = @GID,"); strSql.Append(" BSNO = @BSNO,"); strSql.Append(" IEFlag = @IEFlag,"); strSql.Append(" Type = @Type,"); strSql.Append(" EdiId = @EdiId,"); strSql.Append(" Risk = @Risk,"); strSql.Append(" CopCode = @CopCode,"); strSql.Append(" CopName = @CopName,"); strSql.Append(" PDate = @PDate,"); strSql.Append(" TypistNo = @TypistNo,"); strSql.Append(" InputerName = @InputerName,"); strSql.Append(" PartenerID = @PartenerID,"); strSql.Append(" TgdNo = @TgdNo,"); strSql.Append(" DataSource = @DataSource,"); strSql.Append(" DeclTrnRel = @DeclTrnRel,"); strSql.Append(" ChkSurety = @ChkSurety,"); strSql.Append(" CopCodeScc = @CopCodeScc,"); strSql.Append(" CheckFlow = @CheckFlow,"); strSql.Append(" TaxAaminMark = @TaxAaminMark,"); strSql.Append(" EntyPortCode = @EntyPortCode,"); strSql.Append(" BLNo = @BLNo,"); strSql.Append(" BillType = @BillType,"); strSql.Append(" ApprNo = @ApprNo,"); strSql.Append(" CustomMaster = @CustomMaster,"); strSql.Append(" CustomMaster_Text = @CustomMaster_Text,"); strSql.Append(" AgentStatus = @AgentStatus,"); strSql.Append(" SeqNo = @SeqNo,"); strSql.Append(" PreEntryId = @PreEntryId,"); strSql.Append(" EntryId = @EntryId,"); strSql.Append(" IEPort = @IEPort,"); strSql.Append(" IEPort_Text = @IEPort_Text,"); strSql.Append(" ManualNo = @ManualNo,"); strSql.Append(" ContrNo = @ContrNo,"); strSql.Append(" IEDate = @IEDate,"); strSql.Append(" DDate = @DDate,"); strSql.Append(" TradeCoScc = @TradeCoScc,"); strSql.Append(" TradeCode = @TradeCode,"); strSql.Append(" TradeCiqCode = @TradeCiqCode,"); strSql.Append(" TradeName = @TradeName,"); strSql.Append(" OverseasConsignorCode = @OverseasConsignorCode,"); strSql.Append(" OverseasConsignorCname = @OverseasConsignorCname,"); strSql.Append(" OverseasConsignorEname = @OverseasConsignorEname,"); strSql.Append(" OverseasConsignorAddr = @OverseasConsignorAddr,"); strSql.Append(" OverseasConsigneeCode = @OverseasConsigneeCode,"); strSql.Append(" OverseasConsigneeEname = @OverseasConsigneeEname,"); strSql.Append(" DomesticConsigneeEname = @DomesticConsigneeEname,"); strSql.Append(" EdiRemark2 = @EdiRemark2,"); strSql.Append(" EdiRemark = @EdiRemark,"); strSql.Append(" OwnerCodeScc = @OwnerCodeScc,"); strSql.Append(" OwnerCode = @OwnerCode,"); strSql.Append(" OwnerCiqCode = @OwnerCiqCode,"); strSql.Append(" OwnerName = @OwnerName,"); strSql.Append(" AgentCodeScc = @AgentCodeScc,"); strSql.Append(" AgentCode = @AgentCode,"); strSql.Append(" DeclCiqCode = @DeclCiqCode,"); strSql.Append(" AgentName = @AgentName,"); strSql.Append(" TrafMode = @TrafMode,"); strSql.Append(" TrafMode_Text = @TrafMode_Text,"); strSql.Append(" TrafName = @TrafName,"); strSql.Append(" NativeVoyageNo = @NativeVoyageNo,"); strSql.Append(" BillNo = @BillNo,"); strSql.Append(" TradeMode = @TradeMode,"); strSql.Append(" TradeMode_Text = @TradeMode_Text,"); strSql.Append(" CutMode = @CutMode,"); strSql.Append(" CutMode_Text = @CutMode_Text,"); strSql.Append(" LicenseNo = @LicenseNo,"); strSql.Append(" TradeCountry = @TradeCountry,"); strSql.Append(" TradeCountry_Text = @TradeCountry_Text,"); strSql.Append(" DistinatePort = @DistinatePort,"); strSql.Append(" DistinatePort_Text = @DistinatePort_Text,"); strSql.Append(" TransMode = @TransMode,"); strSql.Append(" TransMode_Text = @TransMode_Text,"); strSql.Append(" FeeMark = @FeeMark,"); strSql.Append(" FeeRate = @FeeRate,"); strSql.Append(" FeeCurr = @FeeCurr,"); strSql.Append(" FeeCurr_Text = @FeeCurr_Text,"); strSql.Append(" InsurMark = @InsurMark,"); strSql.Append(" InsurRate = @InsurRate,"); strSql.Append(" InsurCurr = @InsurCurr,"); strSql.Append(" InsurCurr_Text = @InsurCurr_Text,"); strSql.Append(" OtherMark = @OtherMark,"); strSql.Append(" OtherRate = @OtherRate,"); strSql.Append(" OtherCurr = @OtherCurr,"); strSql.Append(" OtherCurr_Text = @OtherCurr_Text,"); strSql.Append(" PackNo = @PackNo,"); strSql.Append(" WrapType = @WrapType,"); strSql.Append(" WrapType_Text = @WrapType_Text,"); strSql.Append(" GrossWet = @GrossWet,"); strSql.Append(" NetWt = @NetWt,"); strSql.Append(" TradeAreaCode = @TradeAreaCode,"); strSql.Append(" TradeAreaCode_Text = @TradeAreaCode_Text,"); strSql.Append(" ContaCount = @ContaCount,"); strSql.Append(" AttaDocuCdstr = @AttaDocuCdstr,"); strSql.Append(" GoodsPlace = @GoodsPlace,"); strSql.Append(" DespPortCode = @DespPortCode,"); strSql.Append(" DespPortCode_Text = @DespPortCode_Text,"); strSql.Append(" EntryType = @EntryType,"); strSql.Append(" EntryType_Text = @EntryType_Text,"); strSql.Append(" NoteS = @NoteS,"); strSql.Append(" MarkNo = @MarkNo,"); strSql.Append(" OrgCode = @OrgCode,"); strSql.Append(" OrgCode_Text = @OrgCode_Text,"); strSql.Append(" VsaOrgCode = @VsaOrgCode,"); strSql.Append(" VsaOrgCode_Text = @VsaOrgCode_Text,"); strSql.Append(" InspOrgCode = @InspOrgCode,"); strSql.Append(" InspOrgCode_Text = @InspOrgCode_Text,"); strSql.Append(" PurpOrgCode = @PurpOrgCode,"); strSql.Append(" PurpOrgCode_Text = @PurpOrgCode_Text,"); strSql.Append(" CorrelationNo = @CorrelationNo,"); strSql.Append(" CorrelationReasonFlag = @CorrelationReasonFlag,"); strSql.Append(" CorrelationReasonFlag_Text = @CorrelationReasonFlag_Text,"); strSql.Append(" DespDate = @DespDate,"); strSql.Append(" CmplDschrgDt = @CmplDschrgDt,"); strSql.Append(" OrigBoxFlag = @OrigBoxFlag,"); strSql.Append(" SpecDeclFlag = @SpecDeclFlag,"); strSql.Append(" SpecDeclFlag_Text = @SpecDeclFlag_Text,"); strSql.Append(" PromiseItmes = @PromiseItmes,"); strSql.Append(" DeclareName = @DeclareName,"); strSql.Append(" NoOtherPack = @NoOtherPack,"); strSql.Append(" Insp_cert = @Insp_cert,"); strSql.Append(" BillState = @BillState"); strSql.Append(" ,ApplyType = @ApplyType"); //strSql.Append(" ApplyType_Text = @ApplyType_Text"); strSql.Append(" where GID=@GID "); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50) , new SqlParameter("@BSNO", SqlDbType.VarChar,50) , new SqlParameter("@IEFlag", SqlDbType.Char,1) , new SqlParameter("@Type", SqlDbType.VarChar,2) , new SqlParameter("@EdiId", SqlDbType.VarChar,50) , new SqlParameter("@Risk", SqlDbType.VarChar,50) , new SqlParameter("@CopCode", SqlDbType.VarChar,50) , new SqlParameter("@CopName", SqlDbType.NVarChar,50) , new SqlParameter("@PDate", SqlDbType.DateTime) , new SqlParameter("@TypistNo", SqlDbType.VarChar,50) , new SqlParameter("@InputerName", SqlDbType.NVarChar,50) , new SqlParameter("@PartenerID", SqlDbType.VarChar,50) , new SqlParameter("@TgdNo", SqlDbType.VarChar,50) , new SqlParameter("@DataSource", SqlDbType.VarChar,50) , new SqlParameter("@DeclTrnRel", SqlDbType.Char,1) , new SqlParameter("@ChkSurety", SqlDbType.VarChar,50) , new SqlParameter("@CopCodeScc", SqlDbType.VarChar,50) , new SqlParameter("@CheckFlow", SqlDbType.Char,1) , new SqlParameter("@TaxAaminMark", SqlDbType.VarChar,50) , new SqlParameter("@EntyPortCode", SqlDbType.VarChar,50) , new SqlParameter("@BLNo", SqlDbType.VarChar,50) , new SqlParameter("@BillType", SqlDbType.VarChar,50) , new SqlParameter("@ApprNo", SqlDbType.VarChar,50) , new SqlParameter("@CustomMaster", SqlDbType.VarChar,50) , new SqlParameter("@CustomMaster_Text", SqlDbType.NVarChar,50) , new SqlParameter("@AgentStatus", SqlDbType.NVarChar,50) , new SqlParameter("@SeqNo", SqlDbType.VarChar,50) , new SqlParameter("@PreEntryId", SqlDbType.VarChar,50) , new SqlParameter("@EntryId", SqlDbType.VarChar,50) , new SqlParameter("@IEPort", SqlDbType.VarChar,50) , new SqlParameter("@IEPort_Text", SqlDbType.NVarChar,50) , new SqlParameter("@ManualNo", SqlDbType.VarChar,50) , new SqlParameter("@ContrNo", SqlDbType.VarChar,50) , new SqlParameter("@IEDate", SqlDbType.DateTime) , new SqlParameter("@DDate", SqlDbType.DateTime) , new SqlParameter("@TradeCoScc", SqlDbType.VarChar,18) , new SqlParameter("@TradeCode", SqlDbType.VarChar,10) , new SqlParameter("@TradeCiqCode", SqlDbType.VarChar,10) , new SqlParameter("@TradeName", SqlDbType.NVarChar,50) , new SqlParameter("@OverseasConsignorCode", SqlDbType.VarChar,50) , new SqlParameter("@OverseasConsignorCname", SqlDbType.NVarChar,150) , new SqlParameter("@OverseasConsignorEname", SqlDbType.VarChar,150) , new SqlParameter("@OverseasConsignorAddr", SqlDbType.VarChar,500) , new SqlParameter("@OverseasConsigneeCode", SqlDbType.VarChar,50) , new SqlParameter("@OverseasConsigneeEname", SqlDbType.VarChar,150) , new SqlParameter("@DomesticConsigneeEname", SqlDbType.VarChar,150) , new SqlParameter("@EdiRemark2", SqlDbType.NVarChar,500) , new SqlParameter("@EdiRemark", SqlDbType.NVarChar,500) , new SqlParameter("@OwnerCodeScc", SqlDbType.VarChar,18) , new SqlParameter("@OwnerCode", SqlDbType.VarChar,10) , new SqlParameter("@OwnerCiqCode", SqlDbType.VarChar,10) , new SqlParameter("@OwnerName", SqlDbType.NVarChar,50) , new SqlParameter("@AgentCodeScc", SqlDbType.VarChar,18) , new SqlParameter("@AgentCode", SqlDbType.VarChar,10) , new SqlParameter("@DeclCiqCode", SqlDbType.VarChar,10) , new SqlParameter("@AgentName", SqlDbType.NVarChar,50) , new SqlParameter("@TrafMode", SqlDbType.VarChar,10) , new SqlParameter("@TrafMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@TrafName", SqlDbType.NVarChar,50) , new SqlParameter("@NativeVoyageNo", SqlDbType.VarChar,50) , new SqlParameter("@BillNo", SqlDbType.VarChar,50) , new SqlParameter("@TradeMode", SqlDbType.VarChar,50) , new SqlParameter("@TradeMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@CutMode", SqlDbType.VarChar,50) , new SqlParameter("@CutMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@LicenseNo", SqlDbType.VarChar,50) , new SqlParameter("@TradeCountry", SqlDbType.VarChar,50) , new SqlParameter("@TradeCountry_Text", SqlDbType.NVarChar,50) , new SqlParameter("@DistinatePort", SqlDbType.VarChar,50) , new SqlParameter("@DistinatePort_Text", SqlDbType.NVarChar,50) , new SqlParameter("@TransMode", SqlDbType.VarChar,50) , new SqlParameter("@TransMode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@FeeMark", SqlDbType.Char,1) , new SqlParameter("@FeeRate", SqlDbType.Decimal,9) , new SqlParameter("@FeeCurr", SqlDbType.NVarChar,50) , new SqlParameter("@FeeCurr_Text", SqlDbType.NVarChar,50) , new SqlParameter("@InsurMark", SqlDbType.NVarChar,50) , new SqlParameter("@InsurRate", SqlDbType.Decimal,9) , new SqlParameter("@InsurCurr", SqlDbType.NVarChar,50) , new SqlParameter("@InsurCurr_Text", SqlDbType.NVarChar,50) , new SqlParameter("@OtherMark", SqlDbType.NVarChar,50) , new SqlParameter("@OtherRate", SqlDbType.Decimal,9) , new SqlParameter("@OtherCurr", SqlDbType.NVarChar,50) , new SqlParameter("@OtherCurr_Text", SqlDbType.NVarChar,50) , new SqlParameter("@PackNo", SqlDbType.Int,4) , new SqlParameter("@WrapType", SqlDbType.VarChar,50) , new SqlParameter("@WrapType_Text", SqlDbType.NVarChar,50) , new SqlParameter("@GrossWet", SqlDbType.Decimal,9) , new SqlParameter("@NetWt", SqlDbType.Decimal,9) , new SqlParameter("@TradeAreaCode", SqlDbType.VarChar,50) , new SqlParameter("@TradeAreaCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@ContaCount", SqlDbType.Int,4) , new SqlParameter("@AttaDocuCdstr", SqlDbType.VarChar,50) , new SqlParameter("@GoodsPlace", SqlDbType.NVarChar,50) , new SqlParameter("@DespPortCode", SqlDbType.VarChar,50) , new SqlParameter("@DespPortCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@EntryType", SqlDbType.VarChar,50) , new SqlParameter("@EntryType_Text", SqlDbType.NVarChar,50) , new SqlParameter("@NoteS", SqlDbType.NVarChar,150) , new SqlParameter("@MarkNo", SqlDbType.VarChar,400) , new SqlParameter("@OrgCode", SqlDbType.VarChar,50) , new SqlParameter("@OrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@VsaOrgCode", SqlDbType.VarChar,50) , new SqlParameter("@VsaOrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@InspOrgCode", SqlDbType.VarChar,50) , new SqlParameter("@InspOrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@PurpOrgCode", SqlDbType.VarChar,50) , new SqlParameter("@PurpOrgCode_Text", SqlDbType.NVarChar,50) , new SqlParameter("@CorrelationNo", SqlDbType.VarChar,500) , new SqlParameter("@CorrelationReasonFlag", SqlDbType.VarChar,50) , new SqlParameter("@CorrelationReasonFlag_Text", SqlDbType.NVarChar,50) , new SqlParameter("@DespDate", SqlDbType.DateTime) , new SqlParameter("@CmplDschrgDt", SqlDbType.DateTime) , new SqlParameter("@OrigBoxFlag", SqlDbType.VarChar,50) , new SqlParameter("@SpecDeclFlag", SqlDbType.VarChar,500) , new SqlParameter("@SpecDeclFlag_Text", SqlDbType.NVarChar,500) , new SqlParameter("@PromiseItmes", SqlDbType.VarChar,50) , new SqlParameter("@DeclareName", SqlDbType.NVarChar,50) , new SqlParameter("@NoOtherPack", SqlDbType.Char,1) , new SqlParameter("@Insp_cert", SqlDbType.NVarChar,500), new SqlParameter("@BillState", SqlDbType.Char,1), new SqlParameter("@ApplyType", SqlDbType.TinyInt,4) }; parameters[0].Value = model.GID??(Object)DBNull.Value; parameters[1].Value = model.BSNO??(Object)DBNull.Value; parameters[2].Value = model.IEFlag??(Object)DBNull.Value; parameters[3].Value = model.Type??(Object)DBNull.Value; parameters[4].Value = model.EdiId??(Object)DBNull.Value; parameters[5].Value = model.Risk??(Object)DBNull.Value; parameters[6].Value = model.CopCode??(Object)DBNull.Value; parameters[7].Value = model.CopName??(Object)DBNull.Value; parameters[8].Value = model.PDate??(Object)DBNull.Value; parameters[9].Value = model.TypistNo??(Object)DBNull.Value; parameters[10].Value = model.InputerName??(Object)DBNull.Value; parameters[11].Value = model.PartenerID??(Object)DBNull.Value; parameters[12].Value = model.TgdNo??(Object)DBNull.Value; parameters[13].Value = model.DataSource??(Object)DBNull.Value; parameters[14].Value = model.DeclTrnRel??(Object)DBNull.Value; parameters[15].Value = model.ChkSurety??(Object)DBNull.Value; parameters[16].Value = model.CopCodeScc??(Object)DBNull.Value; parameters[17].Value = model.CheckFlow??(Object)DBNull.Value; parameters[18].Value = model.TaxAaminMark??(Object)DBNull.Value; parameters[19].Value = model.EntyPortCode??(Object)DBNull.Value; parameters[20].Value = model.BLNo??(Object)DBNull.Value; parameters[21].Value = model.BillType??(Object)DBNull.Value; parameters[22].Value = model.ApprNo??(Object)DBNull.Value; parameters[23].Value = model.CustomMaster??(Object)DBNull.Value; parameters[24].Value = model.CustomMaster_Text??(Object)DBNull.Value; parameters[25].Value = model.AgentStatus??(Object)DBNull.Value; parameters[26].Value = model.SeqNo??(Object)DBNull.Value; parameters[27].Value = model.PreEntryId??(Object)DBNull.Value; parameters[28].Value = model.EntryId??(Object)DBNull.Value; parameters[29].Value = model.IEPort??(Object)DBNull.Value; parameters[30].Value = model.IEPort_Text??(Object)DBNull.Value; parameters[31].Value = model.ManualNo??(Object)DBNull.Value; parameters[32].Value = model.ContrNo??(Object)DBNull.Value; parameters[33].Value = model.IEDate??(Object)DBNull.Value; parameters[34].Value = model.DDate??(Object)DBNull.Value; parameters[35].Value = model.TradeCoScc??(Object)DBNull.Value; parameters[36].Value = model.TradeCode??(Object)DBNull.Value; parameters[37].Value = model.TradeCiqCode??(Object)DBNull.Value; parameters[38].Value = model.TradeName??(Object)DBNull.Value; parameters[39].Value = model.OverseasConsignorCode??(Object)DBNull.Value; parameters[40].Value = model.OverseasConsignorCname??(Object)DBNull.Value; parameters[41].Value = model.OverseasConsignorEname??(Object)DBNull.Value; parameters[42].Value = model.OverseasConsignorAddr??(Object)DBNull.Value; parameters[43].Value = model.OverseasConsigneeCode??(Object)DBNull.Value; parameters[44].Value = model.OverseasConsigneeEname??(Object)DBNull.Value; parameters[45].Value = model.DomesticConsigneeEname??(Object)DBNull.Value; parameters[46].Value = model.EdiRemark2??(Object)DBNull.Value; parameters[47].Value = model.EdiRemark??(Object)DBNull.Value; parameters[48].Value = model.OwnerCodeScc??(Object)DBNull.Value; parameters[49].Value = model.OwnerCode??(Object)DBNull.Value; parameters[50].Value = model.OwnerCiqCode??(Object)DBNull.Value; parameters[51].Value = model.OwnerName??(Object)DBNull.Value; parameters[52].Value = model.AgentCodeScc??(Object)DBNull.Value; parameters[53].Value = model.AgentCode??(Object)DBNull.Value; parameters[54].Value = model.DeclCiqCode??(Object)DBNull.Value; parameters[55].Value = model.AgentName??(Object)DBNull.Value; parameters[56].Value = model.TrafMode??(Object)DBNull.Value; parameters[57].Value = model.TrafMode_Text??(Object)DBNull.Value; parameters[58].Value = model.TrafName??(Object)DBNull.Value; parameters[59].Value = model.NativeVoyageNo??(Object)DBNull.Value; parameters[60].Value = model.BillNo??(Object)DBNull.Value; parameters[61].Value = model.TradeMode??(Object)DBNull.Value; parameters[62].Value = model.TradeMode_Text??(Object)DBNull.Value; parameters[63].Value = model.CutMode??(Object)DBNull.Value; parameters[64].Value = model.CutMode_Text??(Object)DBNull.Value; parameters[65].Value = model.LicenseNo??(Object)DBNull.Value; parameters[66].Value = model.TradeCountry??(Object)DBNull.Value; parameters[67].Value = model.TradeCountry_Text??(Object)DBNull.Value; parameters[68].Value = model.DistinatePort??(Object)DBNull.Value; parameters[69].Value = model.DistinatePort_Text??(Object)DBNull.Value; parameters[70].Value = model.TransMode??(Object)DBNull.Value; parameters[71].Value = model.TransMode_Text??(Object)DBNull.Value; parameters[72].Value = model.FeeMark??(Object)DBNull.Value; parameters[73].Value = model.FeeRate??(Object)DBNull.Value; parameters[74].Value = model.FeeCurr??(Object)DBNull.Value; parameters[75].Value = model.FeeCurr_Text??(Object)DBNull.Value; parameters[76].Value = model.InsurMark??(Object)DBNull.Value; parameters[77].Value = model.InsurRate??(Object)DBNull.Value; parameters[78].Value = model.InsurCurr??(Object)DBNull.Value; parameters[79].Value = model.InsurCurr_Text??(Object)DBNull.Value; parameters[80].Value = model.OtherMark??(Object)DBNull.Value; parameters[81].Value = model.OtherRate??(Object)DBNull.Value; parameters[82].Value = model.OtherCurr??(Object)DBNull.Value; parameters[83].Value = model.OtherCurr_Text??(Object)DBNull.Value; parameters[84].Value = model.PackNo??(Object)DBNull.Value; parameters[85].Value = model.WrapType??(Object)DBNull.Value; parameters[86].Value = model.WrapType_Text??(Object)DBNull.Value; parameters[87].Value = model.GrossWet??(Object)DBNull.Value; parameters[88].Value = model.NetWt??(Object)DBNull.Value; parameters[89].Value = model.TradeAreaCode??(Object)DBNull.Value; parameters[90].Value = model.TradeAreaCode_Text??(Object)DBNull.Value; parameters[91].Value = model.ContaCount??(Object)DBNull.Value; parameters[92].Value = model.AttaDocuCdstr??(Object)DBNull.Value; parameters[93].Value = model.GoodsPlace??(Object)DBNull.Value; parameters[94].Value = model.DespPortCode??(Object)DBNull.Value; parameters[95].Value = model.DespPortCode_Text??(Object)DBNull.Value; parameters[96].Value = model.EntryType??(Object)DBNull.Value; parameters[97].Value = model.EntryType_Text??(Object)DBNull.Value; parameters[98].Value = model.NoteS??(Object)DBNull.Value; parameters[99].Value = model.MarkNo??(Object)DBNull.Value; parameters[100].Value = model.OrgCode??(Object)DBNull.Value; parameters[101].Value = model.OrgCode_Text??(Object)DBNull.Value; parameters[102].Value = model.VsaOrgCode??(Object)DBNull.Value; parameters[103].Value = model.VsaOrgCode_Text??(Object)DBNull.Value; parameters[104].Value = model.InspOrgCode??(Object)DBNull.Value; parameters[105].Value = model.InspOrgCode_Text??(Object)DBNull.Value; parameters[106].Value = model.PurpOrgCode??(Object)DBNull.Value; parameters[107].Value = model.PurpOrgCode_Text??(Object)DBNull.Value; parameters[108].Value = model.CorrelationNo??(Object)DBNull.Value; parameters[109].Value = model.CorrelationReasonFlag??(Object)DBNull.Value; parameters[110].Value = model.CorrelationReasonFlag_Text??(Object)DBNull.Value; parameters[111].Value = model.DespDate??(Object)DBNull.Value; parameters[112].Value = model.CmplDschrgDt??(Object)DBNull.Value; parameters[113].Value = model.OrigBoxFlag??(Object)DBNull.Value; parameters[114].Value = model.SpecDeclFlag??(Object)DBNull.Value; parameters[115].Value = model.SpecDeclFlag_Text??(Object)DBNull.Value; parameters[116].Value = model.PromiseItmes??(Object)DBNull.Value; parameters[117].Value = model.DeclareName??(Object)DBNull.Value; parameters[118].Value = model.NoOtherPack??(Object)DBNull.Value; parameters[119].Value = model.Insp_cert??(Object)DBNull.Value; parameters[120].Value = model.BillState ?? (Object)DBNull.Value; parameters[121].Value = model.ApplyType ?? (Object)DBNull.Value; //parameters[122].Value = model.ApplyType_Text ?? (Object)DBNull.Value; return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); } /// /// 删除一条数据 /// public int Delete(string GID) { StringBuilder strSql=new StringBuilder(); strSql.Append("delete from DecHead "); strSql.Append(" where GID=@GID "); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50) }; parameters[0].Value = GID; return DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); } /// /// 按条件批量删除 /// public int DeleteListWhere(string strWhere) { StringBuilder strSql=new StringBuilder(); strSql.Append("delete from DecHead "); if(strWhere.Trim()!="") { strSql.Append(" where "+strWhere); } return DbHelperSQL.ExecuteSql(strSql.ToString()); } /// /// 得到一个对象实体 /// public DataSet GetModel(string GID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select GID, BSNO, IEFlag, Type, EdiId, Risk, CopCode, CopName, PDate, TypistNo, InputerName, PartenerID, TgdNo, DataSource, DeclTrnRel, ChkSurety, CopCodeScc, CheckFlow, TaxAaminMark, EntyPortCode, BLNo, BillType, ApprNo, CustomMaster, CustomMaster_Text, AgentStatus, SeqNo, PreEntryId, EntryId, IEPort, IEPort_Text, ManualNo, ContrNo, IEDate, DDate, TradeCoScc, TradeCode, TradeCiqCode, TradeName, OverseasConsignorCode, OverseasConsignorCname, OverseasConsignorEname, OverseasConsignorAddr, OverseasConsigneeCode, OverseasConsigneeEname, DomesticConsigneeEname, EdiRemark2, EdiRemark, OwnerCodeScc, OwnerCode, OwnerCiqCode, OwnerName, AgentCodeScc, AgentCode, DeclCiqCode, AgentName, TrafMode, TrafMode_Text, TrafName, NativeVoyageNo, BillNo, TradeMode, TradeMode_Text, CutMode, CutMode_Text, LicenseNo, TradeCountry, TradeCountry_Text, DistinatePort, DistinatePort_Text, TransMode, TransMode_Text, FeeMark, FeeRate, FeeCurr, FeeCurr_Text, InsurMark, InsurRate, InsurCurr, InsurCurr_Text, OtherMark, OtherRate, OtherCurr, OtherCurr_Text, PackNo, WrapType, WrapType_Text, GrossWet, NetWt, TradeAreaCode, TradeAreaCode_Text, ContaCount, AttaDocuCdstr, GoodsPlace, DespPortCode, DespPortCode_Text, EntryType, EntryType_Text, NoteS, MarkNo, OrgCode, OrgCode_Text, VsaOrgCode, VsaOrgCode_Text, InspOrgCode, InspOrgCode_Text, PurpOrgCode, PurpOrgCode_Text, CorrelationNo, CorrelationReasonFlag, CorrelationReasonFlag_Text, DespDate, CmplDschrgDt, OrigBoxFlag, SpecDeclFlag, SpecDeclFlag_Text, PromiseItmes, DeclareName, NoOtherPack, Insp_cert,BillState,ClientSeqNo,ApplyType "); strSql.Append(" from DecHead "); strSql.Append(" where GID=@GID "); SqlParameter[] parameters = { new SqlParameter("@GID", SqlDbType.VarChar,50) }; parameters[0].Value = GID; DSWeb.SoftMng.Model.DecHead model=new DSWeb.SoftMng.Model.DecHead(); return DbHelperSQL.Query(strSql.ToString(),parameters); } /// /// 获得数据列表 /// public DataSet GetList(string strWhere) { StringBuilder strSql=new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM DecHead "); if(strWhere.Trim()!="") { strSql.Append(" where "+strWhere); } return DbHelperSQL.Query(strSql.ToString()); } /// /// 获得前几行数据 /// public DataSet GetList(int Top,string strWhere,string filedOrder) { StringBuilder strSql=new StringBuilder(); strSql.Append("select "); if(Top>0) { strSql.Append(" top "+Top.ToString()); } strSql.Append(" * "); strSql.Append(" FROM DecHead "); if(strWhere.Trim()!="") { strSql.Append(" where "+strWhere); } strSql.Append(" order by " + filedOrder); return DbHelperSQL.Query(strSql.ToString()); } /// /// 分页获取数据列表 /// public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) { //动软代码 StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT * FROM ( "); strSql.Append(" SELECT ROW_NUMBER() OVER ("); if (!string.IsNullOrEmpty(orderby.Trim())) strSql.Append("order by T." + orderby); strSql.Append(")AS Row, T.* from DecHead T "); if (!string.IsNullOrEmpty(strWhere.Trim())) { strSql.Append(" WHERE " + strWhere); } strSql.Append(" ) TT"); strSql.AppendFormat(" WHERE TT.Row > {0} and TT.Row <= {1}", startIndex, endIndex); //公共代码 return DbHelperSQL.Query(strSql.ToString()); } /// /// 获取记录总数 /// public int GetRecordCount(string strWhere) { StringBuilder strSql=new StringBuilder(); strSql.Append("select count(1) FROM DecHead "); if(strWhere.Trim()!="") { strSql.Append(" where "+strWhere); } return DbHelperSQL.ExcuteScalarSQL(strSql.ToString()); } static public List GetDataList(string strCondition, int start, int limit, string userid, string username, string companyid, out int total, string sort = null) { /* var rangstr = GetRangDAStr("index", userid, username, companyid); if (!string.IsNullOrEmpty(rangstr)) { if (!string.IsNullOrEmpty(strCondition)) { strCondition = strCondition + " and " + rangstr; } else { strCondition = rangstr; } } */ var strSql = new StringBuilder(); strSql.Append("select d.GID, d.BSNO,d.IEFlag,d.Type,d.EdiId,d.Risk,d.CopCode,d.CopName,d.PDate,d.TypistNo,d.InputerName,d.PartenerID,d.TgdNo, d.DataSource,d.DeclTrnRel,d.ChkSurety,d.CopCodeScc,d.CheckFlow,d.TaxAaminMark,d.EntyPortCode,d.BLNo,d.BillType,d.ApprNo,d.CustomMaster, d.CustomMaster_Text,d.AgentStatus,d.SeqNo,d.PreEntryId,d.EntryId,d.IEPort,d.IEPort_Text,d.ManualNo,d.ContrNo,d.IEDate,d.DDate,d.TradeCoScc, d.TradeCode,d.TradeCiqCode,d.TradeName,d.OverseasConsignorCode,d.OverseasConsignorCname,d.OverseasConsignorEname,d.OverseasConsignorAddr, d.OverseasConsigneeCode,d.OverseasConsigneeEname,d.DomesticConsigneeEname,d.EdiRemark2,d.EdiRemark,d.OwnerCodeScc,d.OwnerCode,d. OwnerCiqCode,d.OwnerName,d.AgentCodeScc,d.AgentCode,d.DeclCiqCode,d.AgentName,d.TrafMode,d.TrafMode_Text,d.TrafName,d.NativeVoyageNo, d.BillNo,d.TradeMode,d.TradeMode_Text,d.CutMode,d.CutMode_Text,d.LicenseNo,d.TradeCountry,d.TradeCountry_Text,d.DistinatePort, d.DistinatePort_Text,d.TransMode,d.TransMode_Text,d.FeeMark,d.FeeRate,d.FeeCurr,d.FeeCurr_Text,d.InsurMark,d.InsurRate,d.InsurCurr, d.InsurCurr_Text,d.OtherMark,d.OtherRate,d.OtherCurr,d.OtherCurr_Text,d.PackNo,d.WrapType,d.WrapType_Text,d.GrossWet,d.NetWt,d.TradeAreaCode,d.TradeAreaCode_Text,d.ContaCount,d.AttaDocuCdstr,d.GoodsPlace,d.DespPortCode,d.DespPortCode_Text,d.EntryType,d.EntryType_Text,d.NoteS, d.MarkNo,d.OrgCode,d.OrgCode_Text,d.VsaOrgCode,d.VsaOrgCode_Text,d.InspOrgCode,d.InspOrgCode_Text,d.PurpOrgCode,d.PurpOrgCode_Text, d.CorrelationNo,d.CorrelationReasonFlag,d.CorrelationReasonFlag_Text,d.DespDate,d.CmplDschrgDt,d.OrigBoxFlag,d.SpecDeclFlag, d.SpecDeclFlag_Text,d.PromiseItmes,d.DeclareName,d.NoOtherPack,d.Insp_cert,d.BillState,o.CUSTNO,o.CUSTOMNO,o.MBLNO,o.CUSTOMERNAME,o.VESSEL,o.VOYNO,o.ETD,o.ETA ,d.ClientSeqNo ,d.ApplyType "); strSql.Append(",s.COMPOP,s.COMPTIME from DecHead d inner join op_apply o on o.bsno = d.BSNO "); strSql.Append(" left join (SELECT [ST_ID],[BSNO],[STATUS],[ISCOMP],[COMPTIME],[COMPOP],[REMARK],[INPUTBY],[INPUTTIME],[ORDNO],[STATUS_OPSEAE],[STTYPE],[ISOPEN] from ("); strSql.Append("SELECT [ST_ID],[BSNO],[STATUS],[ISCOMP],[COMPTIME],[COMPOP],[REMARK],[INPUTBY],[INPUTTIME],[ORDNO],[STATUS_OPSEAE],[STTYPE],[ISOPEN], row_number() over(partition by BSNO ORDER BY INPUTTIME desc) as rowno"); strSql.Append(" from op_status WHERE [STATUS] = '报关单待复核'"); strSql.Append(") x WHERE x.rowno = 1) s on (s.BSNO=d.BSNO) "); strSql.Append(" where d.BillState <> 'N' "); if (!string.IsNullOrEmpty(strCondition)) { strSql.Append(" and "+strCondition); } strSql.Append(" order by d.PDate DESC "); int totalCount = 0; StringBuilder sb = PagerHelper.PageSQL(strSql.ToString(), start, limit, out totalCount); total = totalCount; return SetSingleAuditListData(sb); } /// /// 执行sql /// /// /// private static List SetSingleListData(StringBuilder strSql) { #region 公共代码 var headList = new List(); Database db = DatabaseFactory.CreateDatabase(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = strSql.ToString(); cmd.CommandTimeout = 120000; //要加这一句 using (IDataReader row = db.ExecuteReader(cmd)) { while (row.Read()) { DecHead model = new DecHead(); if (row != null) { if (row["GID"] != null) { model.GID = row["GID"].ToString(); } if (row["BSNO"] != null) { model.BSNO = row["BSNO"].ToString(); } if (row["IEFlag"] != null) { model.IEFlag = row["IEFlag"].ToString(); } if (row["Type"] != null) { model.Type = row["Type"].ToString(); } if (row["EdiId"] != null) { model.EdiId = row["EdiId"].ToString(); } if (row["Risk"] != null) { model.Risk = row["Risk"].ToString(); } if (row["CopCode"] != null) { model.CopCode = row["CopCode"].ToString(); } if (row["CopName"] != null) { model.CopName = row["CopName"].ToString(); } if (row["PDate"] != null && row["PDate"].ToString() != "") { model.PDate = DateTime.Parse(row["PDate"].ToString()); } if (row["TypistNo"] != null) { model.TypistNo = row["TypistNo"].ToString(); } if (row["InputerName"] != null) { model.InputerName = row["InputerName"].ToString(); } if (row["PartenerID"] != null) { model.PartenerID = row["PartenerID"].ToString(); } if (row["TgdNo"] != null) { model.TgdNo = row["TgdNo"].ToString(); } if (row["DataSource"] != null) { model.DataSource = row["DataSource"].ToString(); } if (row["DeclTrnRel"] != null) { model.DeclTrnRel = row["DeclTrnRel"].ToString(); } if (row["ChkSurety"] != null) { model.ChkSurety = row["ChkSurety"].ToString(); } if (row["CopCodeScc"] != null) { model.CopCodeScc = row["CopCodeScc"].ToString(); } if (row["CheckFlow"] != null) { model.CheckFlow = row["CheckFlow"].ToString(); } if (row["TaxAaminMark"] != null) { model.TaxAaminMark = row["TaxAaminMark"].ToString(); } if (row["EntyPortCode"] != null) { model.EntyPortCode = row["EntyPortCode"].ToString(); } if (row["BLNo"] != null) { model.BLNo = row["BLNo"].ToString(); } if (row["BillType"] != null) { model.BillType = row["BillType"].ToString(); } if (row["ApprNo"] != null) { model.ApprNo = row["ApprNo"].ToString(); } if (row["CustomMaster"] != null) { model.CustomMaster = row["CustomMaster"].ToString(); } if (row["CustomMaster_Text"] != null) { model.CustomMaster_Text = row["CustomMaster_Text"].ToString(); } if (row["AgentStatus"] != null) { model.AgentStatus = row["AgentStatus"].ToString(); } if (row["SeqNo"] != null) { model.SeqNo = row["SeqNo"].ToString(); } if (row["PreEntryId"] != null) { model.PreEntryId = row["PreEntryId"].ToString(); } if (row["EntryId"] != null) { model.EntryId = row["EntryId"].ToString(); } if (row["IEPort"] != null) { model.IEPort = row["IEPort"].ToString(); } if (row["IEPort_Text"] != null) { model.IEPort_Text = row["IEPort_Text"].ToString(); } if (row["ManualNo"] != null) { model.ManualNo = row["ManualNo"].ToString(); } if (row["ContrNo"] != null) { model.ContrNo = row["ContrNo"].ToString(); } if (row["IEDate"] != null && row["IEDate"].ToString() != "") { model.IEDate = DateTime.Parse(row["IEDate"].ToString()); } if (row["DDate"] != null && row["DDate"].ToString() != "") { model.DDate = DateTime.Parse(row["DDate"].ToString()); } if (row["TradeCoScc"] != null) { model.TradeCoScc = row["TradeCoScc"].ToString(); } if (row["TradeCode"] != null) { model.TradeCode = row["TradeCode"].ToString(); } if (row["TradeCiqCode"] != null) { model.TradeCiqCode = row["TradeCiqCode"].ToString(); } if (row["TradeName"] != null) { model.TradeName = row["TradeName"].ToString(); } if (row["OverseasConsignorCode"] != null) { model.OverseasConsignorCode = row["OverseasConsignorCode"].ToString(); } if (row["OverseasConsignorCname"] != null) { model.OverseasConsignorCname = row["OverseasConsignorCname"].ToString(); } if (row["OverseasConsignorEname"] != null) { model.OverseasConsignorEname = row["OverseasConsignorEname"].ToString(); } if (row["OverseasConsignorAddr"] != null) { model.OverseasConsignorAddr = row["OverseasConsignorAddr"].ToString(); } if (row["OverseasConsigneeCode"] != null) { model.OverseasConsigneeCode = row["OverseasConsigneeCode"].ToString(); } if (row["OverseasConsigneeEname"] != null) { model.OverseasConsigneeEname = row["OverseasConsigneeEname"].ToString(); } if (row["DomesticConsigneeEname"] != null) { model.DomesticConsigneeEname = row["DomesticConsigneeEname"].ToString(); } if (row["EdiRemark2"] != null) { model.EdiRemark2 = row["EdiRemark2"].ToString(); } if (row["EdiRemark"] != null) { model.EdiRemark = row["EdiRemark"].ToString(); } if (row["OwnerCodeScc"] != null) { model.OwnerCodeScc = row["OwnerCodeScc"].ToString(); } if (row["OwnerCode"] != null) { model.OwnerCode = row["OwnerCode"].ToString(); } if (row["OwnerCiqCode"] != null) { model.OwnerCiqCode = row["OwnerCiqCode"].ToString(); } if (row["OwnerName"] != null) { model.OwnerName = row["OwnerName"].ToString(); } if (row["AgentCodeScc"] != null) { model.AgentCodeScc = row["AgentCodeScc"].ToString(); } if (row["AgentCode"] != null) { model.AgentCode = row["AgentCode"].ToString(); } if (row["DeclCiqCode"] != null) { model.DeclCiqCode = row["DeclCiqCode"].ToString(); } if (row["AgentName"] != null) { model.AgentName = row["AgentName"].ToString(); } if (row["TrafMode"] != null) { model.TrafMode = row["TrafMode"].ToString(); } if (row["TrafMode_Text"] != null) { model.TrafMode_Text = row["TrafMode_Text"].ToString(); } if (row["TrafName"] != null) { model.TrafName = row["TrafName"].ToString(); } if (row["NativeVoyageNo"] != null) { model.NativeVoyageNo = row["NativeVoyageNo"].ToString(); } if (row["BillNo"] != null) { model.BillNo = row["BillNo"].ToString(); } if (row["TradeMode"] != null) { model.TradeMode = row["TradeMode"].ToString(); } if (row["TradeMode_Text"] != null) { model.TradeMode_Text = row["TradeMode_Text"].ToString(); } if (row["CutMode"] != null) { model.CutMode = row["CutMode"].ToString(); } if (row["CutMode_Text"] != null) { model.CutMode_Text = row["CutMode_Text"].ToString(); } if (row["LicenseNo"] != null) { model.LicenseNo = row["LicenseNo"].ToString(); } if (row["TradeCountry"] != null) { model.TradeCountry = row["TradeCountry"].ToString(); } if (row["TradeCountry_Text"] != null) { model.TradeCountry_Text = row["TradeCountry_Text"].ToString(); } if (row["DistinatePort"] != null) { model.DistinatePort = row["DistinatePort"].ToString(); } if (row["DistinatePort_Text"] != null) { model.DistinatePort_Text = row["DistinatePort_Text"].ToString(); } if (row["TransMode"] != null) { model.TransMode = row["TransMode"].ToString(); } if (row["TransMode_Text"] != null) { model.TransMode_Text = row["TransMode_Text"].ToString(); } if (row["FeeMark"] != null) { model.FeeMark = row["FeeMark"].ToString(); } if (row["FeeRate"] != null && row["FeeRate"].ToString() != "") { model.FeeRate = decimal.Parse(row["FeeRate"].ToString()); } if (row["FeeCurr"] != null) { model.FeeCurr = row["FeeCurr"].ToString(); } if (row["FeeCurr_Text"] != null) { model.FeeCurr_Text = row["FeeCurr_Text"].ToString(); } if (row["InsurMark"] != null) { model.InsurMark = row["InsurMark"].ToString(); } if (row["InsurRate"] != null && row["InsurRate"].ToString() != "") { model.InsurRate = decimal.Parse(row["InsurRate"].ToString()); } if (row["InsurCurr"] != null) { model.InsurCurr = row["InsurCurr"].ToString(); } if (row["InsurCurr_Text"] != null) { model.InsurCurr_Text = row["InsurCurr_Text"].ToString(); } if (row["OtherMark"] != null) { model.OtherMark = row["OtherMark"].ToString(); } if (row["OtherRate"] != null && row["OtherRate"].ToString() != "") { model.OtherRate = decimal.Parse(row["OtherRate"].ToString()); } if (row["OtherCurr"] != null) { model.OtherCurr = row["OtherCurr"].ToString(); } if (row["OtherCurr_Text"] != null) { model.OtherCurr_Text = row["OtherCurr_Text"].ToString(); } if (row["PackNo"] != null && row["PackNo"].ToString() != "") { model.PackNo = int.Parse(row["PackNo"].ToString()); } if (row["WrapType"] != null) { model.WrapType = row["WrapType"].ToString(); } if (row["WrapType_Text"] != null) { model.WrapType_Text = row["WrapType_Text"].ToString(); } if (row["GrossWet"] != null && row["GrossWet"].ToString() != "") { model.GrossWet = decimal.Parse(row["GrossWet"].ToString()); } if (row["NetWt"] != null && row["NetWt"].ToString() != "") { model.NetWt = decimal.Parse(row["NetWt"].ToString()); } if (row["TradeAreaCode"] != null) { model.TradeAreaCode = row["TradeAreaCode"].ToString(); } if (row["TradeAreaCode_Text"] != null) { model.TradeAreaCode_Text = row["TradeAreaCode_Text"].ToString(); } if (row["ContaCount"] != null && row["ContaCount"].ToString() != "") { model.ContaCount = int.Parse(row["ContaCount"].ToString()); } if (row["AttaDocuCdstr"] != null) { model.AttaDocuCdstr = row["AttaDocuCdstr"].ToString(); } if (row["GoodsPlace"] != null) { model.GoodsPlace = row["GoodsPlace"].ToString(); } if (row["DespPortCode"] != null) { model.DespPortCode = row["DespPortCode"].ToString(); } if (row["DespPortCode_Text"] != null) { model.DespPortCode_Text = row["DespPortCode_Text"].ToString(); } if (row["EntryType"] != null) { model.EntryType = row["EntryType"].ToString(); } if (row["EntryType_Text"] != null) { model.EntryType_Text = row["EntryType_Text"].ToString(); } if (row["NoteS"] != null) { model.NoteS = row["NoteS"].ToString(); } if (row["MarkNo"] != null) { model.MarkNo = row["MarkNo"].ToString(); } if (row["OrgCode"] != null) { model.OrgCode = row["OrgCode"].ToString(); } if (row["OrgCode_Text"] != null) { model.OrgCode_Text = row["OrgCode_Text"].ToString(); } if (row["VsaOrgCode"] != null) { model.VsaOrgCode = row["VsaOrgCode"].ToString(); } if (row["VsaOrgCode_Text"] != null) { model.VsaOrgCode_Text = row["VsaOrgCode_Text"].ToString(); } if (row["InspOrgCode"] != null) { model.InspOrgCode = row["InspOrgCode"].ToString(); } if (row["InspOrgCode_Text"] != null) { model.InspOrgCode_Text = row["InspOrgCode_Text"].ToString(); } if (row["PurpOrgCode"] != null) { model.PurpOrgCode = row["PurpOrgCode"].ToString(); } if (row["PurpOrgCode_Text"] != null) { model.PurpOrgCode_Text = row["PurpOrgCode_Text"].ToString(); } if (row["CorrelationNo"] != null) { model.CorrelationNo = row["CorrelationNo"].ToString(); } if (row["CorrelationReasonFlag"] != null) { model.CorrelationReasonFlag = row["CorrelationReasonFlag"].ToString(); } if (row["CorrelationReasonFlag_Text"] != null) { model.CorrelationReasonFlag_Text = row["CorrelationReasonFlag_Text"].ToString(); } if (row["DespDate"] != null && row["DespDate"].ToString() != "") { model.DespDate = DateTime.Parse(row["DespDate"].ToString()); } if (row["CmplDschrgDt"] != null && row["CmplDschrgDt"].ToString() != "") { model.CmplDschrgDt = DateTime.Parse(row["CmplDschrgDt"].ToString()); } if (row["OrigBoxFlag"] != null) { model.OrigBoxFlag = row["OrigBoxFlag"].ToString(); } if (row["SpecDeclFlag"] != null) { model.SpecDeclFlag = row["SpecDeclFlag"].ToString(); } if (row["SpecDeclFlag_Text"] != null) { model.SpecDeclFlag_Text = row["SpecDeclFlag_Text"].ToString(); } if (row["PromiseItmes"] != null) { model.PromiseItmes = row["PromiseItmes"].ToString(); } if (row["DeclareName"] != null) { model.DeclareName = row["DeclareName"].ToString(); } if (row["NoOtherPack"] != null) { model.NoOtherPack = row["NoOtherPack"].ToString(); } if (row["Insp_cert"] != null) { model.Insp_cert = row["Insp_cert"].ToString(); } if (row["BillState"] != null) { model.BillState = row["BillState"].ToString(); } if (row["ApplyType"] != null && row["ApplyType"].ToString() != "") { model.ApplyType = int.Parse(row["ApplyType"].ToString()); } //if (row["ApplyType_Text"] != null) //{ // model.ApplyType_Text = row["ApplyType_Text"].ToString(); //} } headList.Add(model); } row.Close(); } return headList; #endregion } /// /// 执行sql /// /// /// private static List SetSingleAuditListData(StringBuilder strSql) { #region 公共代码 var headList = new List(); Database db = DatabaseFactory.CreateDatabase(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = strSql.ToString(); cmd.CommandTimeout = 120000; //要加这一句 using (IDataReader row = db.ExecuteReader(cmd)) { while (row.Read()) { AuditDecHead model = new AuditDecHead(); if (row != null) { if (row["GID"] != null) { model.GID = row["GID"].ToString(); } if (row["BSNO"] != null) { model.BSNO = row["BSNO"].ToString(); } if (row["IEFlag"] != null) { model.IEFlag = row["IEFlag"].ToString(); } if (row["Type"] != null) { model.Type = row["Type"].ToString(); } if (row["EdiId"] != null) { model.EdiId = row["EdiId"].ToString(); } if (row["Risk"] != null) { model.Risk = row["Risk"].ToString(); } if (row["CopCode"] != null) { model.CopCode = row["CopCode"].ToString(); } if (row["CopName"] != null) { model.CopName = row["CopName"].ToString(); } if (row["PDate"] != null && row["PDate"].ToString() != "") { model.PDate = DateTime.Parse(row["PDate"].ToString()); } if (row["TypistNo"] != null) { model.TypistNo = row["TypistNo"].ToString(); } if (row["InputerName"] != null) { model.InputerName = row["InputerName"].ToString(); } if (row["PartenerID"] != null) { model.PartenerID = row["PartenerID"].ToString(); } if (row["TgdNo"] != null) { model.TgdNo = row["TgdNo"].ToString(); } if (row["DataSource"] != null) { model.DataSource = row["DataSource"].ToString(); } if (row["DeclTrnRel"] != null) { model.DeclTrnRel = row["DeclTrnRel"].ToString(); } if (row["ChkSurety"] != null) { model.ChkSurety = row["ChkSurety"].ToString(); } if (row["CopCodeScc"] != null) { model.CopCodeScc = row["CopCodeScc"].ToString(); } if (row["CheckFlow"] != null) { model.CheckFlow = row["CheckFlow"].ToString(); } if (row["TaxAaminMark"] != null) { model.TaxAaminMark = row["TaxAaminMark"].ToString(); } if (row["EntyPortCode"] != null) { model.EntyPortCode = row["EntyPortCode"].ToString(); } if (row["BLNo"] != null) { model.BLNo = row["BLNo"].ToString(); } if (row["BillType"] != null) { model.BillType = row["BillType"].ToString(); } if (row["ApprNo"] != null) { model.ApprNo = row["ApprNo"].ToString(); } if (row["CustomMaster"] != null) { model.CustomMaster = row["CustomMaster"].ToString(); } if (row["CustomMaster_Text"] != null) { model.CustomMaster_Text = row["CustomMaster_Text"].ToString(); } if (row["AgentStatus"] != null) { model.AgentStatus = row["AgentStatus"].ToString(); } if (row["SeqNo"] != null) { model.SeqNo = row["SeqNo"].ToString(); } if (row["PreEntryId"] != null) { model.PreEntryId = row["PreEntryId"].ToString(); } if (row["EntryId"] != null) { model.EntryId = row["EntryId"].ToString(); } if (row["IEPort"] != null) { model.IEPort = row["IEPort"].ToString(); } if (row["IEPort_Text"] != null) { model.IEPort_Text = row["IEPort_Text"].ToString(); } if (row["ManualNo"] != null) { model.ManualNo = row["ManualNo"].ToString(); } if (row["ContrNo"] != null) { model.ContrNo = row["ContrNo"].ToString(); } if (row["IEDate"] != null && row["IEDate"].ToString() != "") { model.IEDate = DateTime.Parse(row["IEDate"].ToString()); } if (row["DDate"] != null && row["DDate"].ToString() != "") { model.DDate = DateTime.Parse(row["DDate"].ToString()); } if (row["TradeCoScc"] != null) { model.TradeCoScc = row["TradeCoScc"].ToString(); } if (row["TradeCode"] != null) { model.TradeCode = row["TradeCode"].ToString(); } if (row["TradeCiqCode"] != null) { model.TradeCiqCode = row["TradeCiqCode"].ToString(); } if (row["TradeName"] != null) { model.TradeName = row["TradeName"].ToString(); } if (row["OverseasConsignorCode"] != null) { model.OverseasConsignorCode = row["OverseasConsignorCode"].ToString(); } if (row["OverseasConsignorCname"] != null) { model.OverseasConsignorCname = row["OverseasConsignorCname"].ToString(); } if (row["OverseasConsignorEname"] != null) { model.OverseasConsignorEname = row["OverseasConsignorEname"].ToString(); } if (row["OverseasConsignorAddr"] != null) { model.OverseasConsignorAddr = row["OverseasConsignorAddr"].ToString(); } if (row["OverseasConsigneeCode"] != null) { model.OverseasConsigneeCode = row["OverseasConsigneeCode"].ToString(); } if (row["OverseasConsigneeEname"] != null) { model.OverseasConsigneeEname = row["OverseasConsigneeEname"].ToString(); } if (row["DomesticConsigneeEname"] != null) { model.DomesticConsigneeEname = row["DomesticConsigneeEname"].ToString(); } if (row["EdiRemark2"] != null) { model.EdiRemark2 = row["EdiRemark2"].ToString(); } if (row["EdiRemark"] != null) { model.EdiRemark = row["EdiRemark"].ToString(); } if (row["OwnerCodeScc"] != null) { model.OwnerCodeScc = row["OwnerCodeScc"].ToString(); } if (row["OwnerCode"] != null) { model.OwnerCode = row["OwnerCode"].ToString(); } if (row["OwnerCiqCode"] != null) { model.OwnerCiqCode = row["OwnerCiqCode"].ToString(); } if (row["OwnerName"] != null) { model.OwnerName = row["OwnerName"].ToString(); } if (row["AgentCodeScc"] != null) { model.AgentCodeScc = row["AgentCodeScc"].ToString(); } if (row["AgentCode"] != null) { model.AgentCode = row["AgentCode"].ToString(); } if (row["DeclCiqCode"] != null) { model.DeclCiqCode = row["DeclCiqCode"].ToString(); } if (row["AgentName"] != null) { model.AgentName = row["AgentName"].ToString(); } if (row["TrafMode"] != null) { model.TrafMode = row["TrafMode"].ToString(); } if (row["TrafMode_Text"] != null) { model.TrafMode_Text = row["TrafMode_Text"].ToString(); } if (row["TrafName"] != null) { model.TrafName = row["TrafName"].ToString(); } if (row["NativeVoyageNo"] != null) { model.NativeVoyageNo = row["NativeVoyageNo"].ToString(); } if (row["BillNo"] != null) { model.BillNo = row["BillNo"].ToString(); } if (row["TradeMode"] != null) { model.TradeMode = row["TradeMode"].ToString(); } if (row["TradeMode_Text"] != null) { model.TradeMode_Text = row["TradeMode_Text"].ToString(); } if (row["CutMode"] != null) { model.CutMode = row["CutMode"].ToString(); } if (row["CutMode_Text"] != null) { model.CutMode_Text = row["CutMode_Text"].ToString(); } if (row["LicenseNo"] != null) { model.LicenseNo = row["LicenseNo"].ToString(); } if (row["TradeCountry"] != null) { model.TradeCountry = row["TradeCountry"].ToString(); } if (row["TradeCountry_Text"] != null) { model.TradeCountry_Text = row["TradeCountry_Text"].ToString(); } if (row["DistinatePort"] != null) { model.DistinatePort = row["DistinatePort"].ToString(); } if (row["DistinatePort_Text"] != null) { model.DistinatePort_Text = row["DistinatePort_Text"].ToString(); } if (row["TransMode"] != null) { model.TransMode = row["TransMode"].ToString(); } if (row["TransMode_Text"] != null) { model.TransMode_Text = row["TransMode_Text"].ToString(); } if (row["FeeMark"] != null) { model.FeeMark = row["FeeMark"].ToString(); } if (row["FeeRate"] != null && row["FeeRate"].ToString() != "") { model.FeeRate = decimal.Parse(row["FeeRate"].ToString()); } if (row["FeeCurr"] != null) { model.FeeCurr = row["FeeCurr"].ToString(); } if (row["FeeCurr_Text"] != null) { model.FeeCurr_Text = row["FeeCurr_Text"].ToString(); } if (row["InsurMark"] != null) { model.InsurMark = row["InsurMark"].ToString(); } if (row["InsurRate"] != null && row["InsurRate"].ToString() != "") { model.InsurRate = decimal.Parse(row["InsurRate"].ToString()); } if (row["InsurCurr"] != null) { model.InsurCurr = row["InsurCurr"].ToString(); } if (row["InsurCurr_Text"] != null) { model.InsurCurr_Text = row["InsurCurr_Text"].ToString(); } if (row["OtherMark"] != null) { model.OtherMark = row["OtherMark"].ToString(); } if (row["OtherRate"] != null && row["OtherRate"].ToString() != "") { model.OtherRate = decimal.Parse(row["OtherRate"].ToString()); } if (row["OtherCurr"] != null) { model.OtherCurr = row["OtherCurr"].ToString(); } if (row["OtherCurr_Text"] != null) { model.OtherCurr_Text = row["OtherCurr_Text"].ToString(); } if (row["PackNo"] != null && row["PackNo"].ToString() != "") { model.PackNo = int.Parse(row["PackNo"].ToString()); } if (row["WrapType"] != null) { model.WrapType = row["WrapType"].ToString(); } if (row["WrapType_Text"] != null) { model.WrapType_Text = row["WrapType_Text"].ToString(); } if (row["GrossWet"] != null && row["GrossWet"].ToString() != "") { model.GrossWet = decimal.Parse(row["GrossWet"].ToString()); } if (row["NetWt"] != null && row["NetWt"].ToString() != "") { model.NetWt = decimal.Parse(row["NetWt"].ToString()); } if (row["TradeAreaCode"] != null) { model.TradeAreaCode = row["TradeAreaCode"].ToString(); } if (row["TradeAreaCode_Text"] != null) { model.TradeAreaCode_Text = row["TradeAreaCode_Text"].ToString(); } if (row["ContaCount"] != null && row["ContaCount"].ToString() != "") { model.ContaCount = int.Parse(row["ContaCount"].ToString()); } if (row["AttaDocuCdstr"] != null) { model.AttaDocuCdstr = row["AttaDocuCdstr"].ToString(); } if (row["GoodsPlace"] != null) { model.GoodsPlace = row["GoodsPlace"].ToString(); } if (row["DespPortCode"] != null) { model.DespPortCode = row["DespPortCode"].ToString(); } if (row["DespPortCode_Text"] != null) { model.DespPortCode_Text = row["DespPortCode_Text"].ToString(); } if (row["EntryType"] != null) { model.EntryType = row["EntryType"].ToString(); } if (row["EntryType_Text"] != null) { model.EntryType_Text = row["EntryType_Text"].ToString(); } if (row["NoteS"] != null) { model.NoteS = row["NoteS"].ToString(); } if (row["MarkNo"] != null) { model.MarkNo = row["MarkNo"].ToString(); } if (row["OrgCode"] != null) { model.OrgCode = row["OrgCode"].ToString(); } if (row["OrgCode_Text"] != null) { model.OrgCode_Text = row["OrgCode_Text"].ToString(); } if (row["VsaOrgCode"] != null) { model.VsaOrgCode = row["VsaOrgCode"].ToString(); } if (row["VsaOrgCode_Text"] != null) { model.VsaOrgCode_Text = row["VsaOrgCode_Text"].ToString(); } if (row["InspOrgCode"] != null) { model.InspOrgCode = row["InspOrgCode"].ToString(); } if (row["InspOrgCode_Text"] != null) { model.InspOrgCode_Text = row["InspOrgCode_Text"].ToString(); } if (row["PurpOrgCode"] != null) { model.PurpOrgCode = row["PurpOrgCode"].ToString(); } if (row["PurpOrgCode_Text"] != null) { model.PurpOrgCode_Text = row["PurpOrgCode_Text"].ToString(); } if (row["CorrelationNo"] != null) { model.CorrelationNo = row["CorrelationNo"].ToString(); } if (row["CorrelationReasonFlag"] != null) { model.CorrelationReasonFlag = row["CorrelationReasonFlag"].ToString(); } if (row["CorrelationReasonFlag_Text"] != null) { model.CorrelationReasonFlag_Text = row["CorrelationReasonFlag_Text"].ToString(); } if (row["DespDate"] != null && row["DespDate"].ToString() != "") { model.DespDate = DateTime.Parse(row["DespDate"].ToString()); } if (row["CmplDschrgDt"] != null && row["CmplDschrgDt"].ToString() != "") { model.CmplDschrgDt = DateTime.Parse(row["CmplDschrgDt"].ToString()); } if (row["OrigBoxFlag"] != null) { model.OrigBoxFlag = row["OrigBoxFlag"].ToString(); } if (row["SpecDeclFlag"] != null) { model.SpecDeclFlag = row["SpecDeclFlag"].ToString(); } if (row["SpecDeclFlag_Text"] != null) { model.SpecDeclFlag_Text = row["SpecDeclFlag_Text"].ToString(); } if (row["PromiseItmes"] != null) { model.PromiseItmes = row["PromiseItmes"].ToString(); } if (row["DeclareName"] != null) { model.DeclareName = row["DeclareName"].ToString(); } if (row["NoOtherPack"] != null) { model.NoOtherPack = row["NoOtherPack"].ToString(); } if (row["Insp_cert"] != null) { model.Insp_cert = row["Insp_cert"].ToString(); } if (row["BillState"] != null) { model.BillState = row["BillState"].ToString(); } if (row["CUSTNO"] != null) { model.CUSTNO = row["CUSTNO"].ToString(); } if (row["CUSTOMNO"] != null) { model.CUSTOMNO = row["CUSTOMNO"].ToString(); } if (row["MBLNO"] != null) { model.MBLNO = row["MBLNO"].ToString(); } if (row["CUSTOMERNAME"] != null) { model.CUSTOMERNAME = row["CUSTOMERNAME"].ToString(); } if (row["VESSEL"] != null) { model.VESSEL = row["VESSEL"].ToString(); } if (row["VOYNO"] != null) { model.VOYNO = row["VOYNO"].ToString(); } if (row["ETD"] != null) { model.ETD = row["ETD"].ToString(); } if (row["ETA"] != null) { model.ETA = row["ETA"].ToString(); } if (row["COMPOP"] != null) { model.COMPOP = row["COMPOP"].ToString(); } if (row["COMPTIME"] != null) { model.COMPTIME = Convert.ToDateTime(row["COMPTIME"]).ToString("yyyy-MM-dd hh:mm:ss"); } } headList.Add(model); } row.Close(); } return headList; #endregion } //博世381xml文本 写入文件并解析 private const string LOGICNAME_381 = "381HEAD"; public static DBResult Deal381XML(string filename,string USERID,string SHOWNAME,string COMPANYID,string dbname="") { var result = new DBResult(); try { XmlSerializer serializer = new XmlSerializer(typeof(SHIPMENT_CDF_INBOUND_V2)); using (FileStream fs = new FileStream(filename, FileMode.Open)) { SHIPMENT_CDF_INBOUND_V2 SHIPMENTLIST = (SHIPMENT_CDF_INBOUND_V2)serializer.Deserialize(fs); result = DecHeadDAL.ImportXmlBs(SHIPMENTLIST, USERID, SHOWNAME, COMPANYID, dbname); } } catch (Exception e) { result.SetErrorInfo("读取文件出错,请确认文件正确性:" + e.Message); } return result; } public static DBResult ImportXmlBs(SHIPMENT_CDF_INBOUND_V2 SHIPMENT, string userid, string showname, string companyid,string dbname="") { var result = new DBResult(); int blcount = 0; var CCS_HEADERLIST = SHIPMENT.CCS_HEADER; DecHeadBLL bll = new DecHeadBLL(); DecListBLL lbll = new DecListBLL(); ContainerBLL cbll = new ContainerBLL(); LicenseDocuBLL dbll = new LicenseDocuBLL(); DecFreeTxBLL tbll = new DecFreeTxBLL(); DecGoodsLimitBLL gbll = new DecGoodsLimitBLL(); DecGoodsLimitVinBLL vbll = new DecGoodsLimitVinBLL(); DecCopLimitBLL ebll = new DecCopLimitBLL(); DecRequestCertBLL rcbll = new DecRequestCertBLL(); DecCopLimitBLL clbll = new DecCopLimitBLL(); DecOtherPackBLL opbll = new DecOtherPackBLL(); foreach (var items in CCS_HEADERLIST) { var OPAPPLY = MsOpApplyDAL.GetData(" CUSTOMNO='" + items.CCS_NUMBER + "'", dbname); var needinsert = false;//需要新建 还是更新信息 if (string.IsNullOrWhiteSpace(OPAPPLY.CUSTOMNO)) { needinsert = true; } #region 报关信息 OPAPPLY.CUSTOMNO = items.CCS_NUMBER; //根据报关单号 结尾0出口 结尾1进口 OPAPPLY.setbstype(); OPAPPLY.BSSTATUS = false; OPAPPLY.FEESTATUS = false; OPAPPLY.BSDATE = DateTime.Now; OPAPPLY.CUSTOMDATE = items.DECLARATION_DATE;//报关日期=申报日期 OPAPPLY.OPDATE = items.IMPORT_EXPORT_DATE;//业务日期=申报日期 OPAPPLY.MBLNO = items.BL_NUMBER;//20210610 从BLNo改为使用 BL_NUMBER OPAPPLY.INPUTBY = showname; OPAPPLY.CORPID = companyid; OPAPPLY.CONTRACTNO = items.CONTRACT_NUMBER; OPAPPLY.ACCDATE = DateTime.Now.ToString("yyyy-MM"); //百特凯瑞 目前默认 导入的业务固定默认运输类型空运进口 报关类型入区报关 OPAPPLY.BSTYPE = "4";//枚举类型96004 运输类型 OPAPPLY.CUSTOMTYPE = "入区报关";//报关类型 if (needinsert) { OPAPPLY.DbOperationType = DbOperationType.DbotIns; OPAPPLY.ModelUIStatus = "I"; OPAPPLY.BSNO = Guid.NewGuid().ToString(); OPAPPLY.MASTERNO = OPAPPLY.BSNO; OPAPPLY.BSTYPE2= "报关"; var _r = MsOpApplyDAL.getCUSTNO(OPAPPLY, userid, showname, companyid, dbname); if (_r.Success) { OPAPPLY.CUSTNO = _r.Data.ToString(); } } else { OPAPPLY.DbOperationType = DbOperationType.DbotUpd; OPAPPLY.ModelUIStatus = "E"; } //OPAPPLY.CUSTNO = items.INTERNAL_CCS; OPAPPLY.CUSTOMNO = items.CCS_NUMBER;//20210609 经过比对确认这个字段是博世写报关单号的字段 OPAPPLY.BOOKNO = items.HANDBOOK_NUMBER; OPAPPLY.BYCUSTOM = items.DECLARATION_PORT; OPAPPLY.EXPCUSTOMTYPE = items.IMPORT_EXPORT_PORT; OPAPPLY.ETD = items.IMPORT_EXPORT_DATE; OPAPPLY.BSTYPE = items.TRANSPORTATION_METHOD; OPAPPLY.VESSEL = items.TRAF_NAME; OPAPPLY.VOYNO = items.VOYAGE_NUMBER; OPAPPLY.ENTERP = items.CUSTOMS_BROKER_NAME; OPAPPLY.ENTERPID = items.CUSTOMS_BROKER_CODE; OPAPPLY.TRADETERM = items.TRADE_MODE; OPAPPLY.PORTDISCHARGE = items.DESTINATION_PORT; OPAPPLY.PKGS = Convert.ToDecimal(items.PIECES); OPAPPLY.KGS = Convert.ToDecimal(items.GROSS_WEIGHT); OPAPPLY.NETWEIGHT = Convert.ToDecimal(items.NET_WEIGHT); OPAPPLY.ARCOUNTRY = items.COUNTRY; #endregion #region 20210610邓羽 记录381头部信息 var HeadDic = new Dictionary(); HeadDic.Add("ACTION", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.ACTION); HeadDic.Add("COMPANY_CODE", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.COMPANY_CODE); HeadDic.Add("ORG_CODE", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.ORG_CODE); HeadDic.Add("PRIORITY", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.PRIORITY.ToString()); HeadDic.Add("MESSAGE_TYPE", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.MESSAGE_TYPE); HeadDic.Add("USERID", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.USERID); HeadDic.Add("RECEIVER", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.RECEIVER); HeadDic.Add("SENDER", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.SENDER); HeadDic.Add("BATCH_ID", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.BATCH_ID); //HeadDic.Add("ORG_CODE", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.BUS_KEY.ORG_CODE); HeadDic.Add("SHIPMENT_NUMBER", SHIPMENT.INTEGRATION_MESSAGE_CONTROL.BUS_KEY.SHIPMENT_NUMBER); HeadDic.Add("INCOMING_STATUS", items.INCOMING_STATUS); HeadDic.Add("INTERNAL_CCS", items.INTERNAL_CCS); if(string.IsNullOrWhiteSpace(dbname)) BasicDataRefDAL.SaveLogicInfo(OPAPPLY.BSNO, LOGICNAME_381, HeadDic); #endregion #region 单一窗口 SoftMng.BLL.sys_EnumerationBLL bllEM = new SoftMng.BLL.sys_EnumerationBLL(); var emlistdataset = bllEM.GetList(""); var emlisttable = emlistdataset.Tables[0]; var emlistQuery = from emlist in emlisttable.AsEnumerable() select emlist; DecHead model = new DecHead(); model.AgentStatus = "暂存"; model.BSNO = OPAPPLY.BSNO; model.GID = Guid.NewGuid().ToString(); model.EntryType = items.CCS_TYPE; if (model.EntryType == "M") model.EntryType_Text = "无纸化通关"; if (model.EntryType == "O") model.EntryType_Text = "普通报关单"; if (model.EntryType == "L") model.EntryType_Text = "为带报关单清单的报关单"; if (model.EntryType == "W") model.EntryType_Text = "无纸报关类型"; if (model.EntryType == "D") model.EntryType_Text = "既是清单又是无纸报关的情况"; model.EntryId = items.CCS_NUMBER; model.ManualNo = items.HANDBOOK_NUMBER; model.CustomMaster = items.DECLARATION_PORT; model.CustomMaster_Text = GetTextByCode(emlistQuery, "关区代码", model.CustomMaster); model.IEPort = items.IMPORT_EXPORT_PORT; model.IEPort_Text = GetTextByCode(emlistQuery, "关区代码", model.IEPort); model.ContrNo = items.CONTRACT_NUMBER; if (!string.IsNullOrEmpty(items.IMPORT_EXPORT_DATE)) model.IEDate = Convert.ToDateTime(items.IMPORT_EXPORT_DATE); model.BillNo = items.BL_NUMBER; model.TrafMode = items.TRANSPORTATION_METHOD; model.TrafMode_Text = GetTextByCode(emlistQuery, "运输方式", model.TrafMode); model.TrafName = items.TRAF_NAME; model.NativeVoyageNo = items.VOYAGE_NUMBER; model.TradeCode = items.TRADING_COMPANY_CODE; model.TradeName = items.TRADING_COMPANY_NAME; model.OwnerCode = items.RECEIVER_COMPANY_CODE; model.OwnerName = items.RECEIVER_COMPANY_NAME; model.AgentCode = items.CUSTOMS_BROKER_CODE; model.AgentName = items.CUSTOMS_BROKER_NAME; model.TradeCountry = items.COUNTRY; model.TradeCountry_Text = GetTextByCode(emlistQuery, "国别地区", model.TradeCountry); model.TradeMode = items.TRADE_MODE; model.TradeMode_Text = GetTextByCode(emlistQuery, "监管方式", model.TradeMode); model.TransMode = items.TRANSACTION_METHOD; model.TransMode_Text = GetTextByCode(emlistQuery, "成交方式", model.TransMode); model.CutMode = items.TAX_OPTION; model.CutMode_Text = GetTextByCode(emlistQuery, "征免性质", model.CutMode); model.FeeMark = items.FREIGHT_COST_BASIS; decimal feerate = 0; TryToDecimal(items.FREIGHT_RATE, out feerate); model.FeeRate = feerate; model.FeeCurr = items.FREIGHT_CURRENCY; model.FeeCurr_Text = GetTextByCode(emlistQuery, "币别", model.FeeCurr); model.LicenseNo = items.PERMIT; model.InsurMark = items.INSURANCE_FEE_BASIS; decimal InsurRate = 0; TryToDecimal(items.INSURANCE_RATE, out InsurRate); model.InsurRate = InsurRate; model.FeeRate = feerate; model.InsurCurr = items.INSURANCE_CURRENCY; model.InsurCurr_Text = GetTextByCode(emlistQuery, "币别", model.InsurCurr); model.ApprNo = items.MOFCOM_APPROVAL_NUMBER; model.OtherMark = items.MISCELLANEOUS_EXPENSE_BASIS; decimal OtherRate = 0; TryToDecimal(items.MISCELLANEOUS_EXPENSE_RATE, out OtherRate); model.OtherRate = OtherRate; model.OtherCurr = items.MISCELLANEOUS_EXPENSE_CURRENCY; model.OtherCurr_Text = GetTextByCode(emlistQuery, "币别", model.OtherCurr); model.WrapType = items.PACKAGING_TYPE; model.WrapType_Text = GetTextByCode(emlistQuery, "包装种类", model.WrapType); Int32 PackNo = 0; TryToInt32(items.PIECES, out PackNo); model.PackNo = PackNo; decimal NetWt = 0; TryToDecimal(items.NET_WEIGHT, out NetWt); model.NetWt = NetWt; decimal GrossWet = 0; TryToDecimal(items.GROSS_WEIGHT, out GrossWet); model.GrossWet = GrossWet; model.NoteS = items.REMARK; model.SeqNo = items.E_PORT_DECLARATION_ID; model.ChkSurety = items.ChkSurety; model.BillType = items.BillType; model.AgentCodeScc = items.AgentCodeScc; model.OwnerCodeScc = items.OwnerCodeScc; model.TradeCoScc = items.TradeCodeScc; model.CopCodeScc = items.CopCodeScc; model.PromiseItmes = items.PromiseItmes; model.TradeAreaCode = items.TradeAreaCode; // model.TrnHead = items.TradeCodeScc; model.PreEntryId = items.PreEntryId; model.Type = items.Type; model.OverseasConsignorCode = items.OverseasConsignorCode; model.OverseasConsignorCname = items.OverseasConsignorCname; model.OverseasConsignorEname = items.OverseasConsignorEname; model.OverseasConsignorAddr = items.OverseasConsignorAddr; model.OverseasConsigneeCode = items.OverseasConsigneeCode; model.OverseasConsigneeEname = items.OverseasConsigneeEname; model.GoodsPlace = items.GoodsPlace; model.MarkNo = items.MarkNo; model.DespPortCode = items.DespPortCode; model.EntyPortCode = items.EntyPortCode; model.DeclareName = items.DeclareName; model.NoOtherPack = items.NoOtherPack; model.DeclTrnRel = items.DeclTrnRel; model.EdiId = items.EdiId; model.CheckFlow = items.CheckFlow; model.TaxAaminMark = items.TaxAaminMark; model.BLNo = items.BLNo; model.InspOrgCode = items.InspOrgCode; model.SpecDeclFlag = items.SpecDeclFlag; model.PurpOrgCode = items.PurpOrgCode; if (!string.IsNullOrEmpty(items.DespDate)) model.DespDate = DateTime.ParseExact(items.DespDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); if (!string.IsNullOrEmpty(items.CmplDschrgDt)) model.CmplDschrgDt = DateTime.ParseExact(items.CmplDschrgDt, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); model.CorrelationReasonFlag = items.CorrelationReasonFlag; model.VsaOrgCode = items.VsaOrgCode; model.OrigBoxFlag = items.OrigBoxFlag; model.CorrelationNo = items.CorrelationNo; model.EdiRemark = items.EdiRemark; model.EdiRemark2 = items.EdiRemark2; model.TradeCiqCode = items.TradeCiqCode; model.OwnerCiqCode = items.OwnerCiqCode; model.DeclCiqCode = items.DeclCiqCode; model.OrgCode = items.OrgCode; bll.Add(model); #endregion List list3 = new List(); decimal TOTAL_AMOUNT = 0; if (items.CCS_DETAIL != null) foreach (var GOOD in items.CCS_DETAIL) { OPAPPLY.CURRENCY = GOOD.CURRENCY; TOTAL_AMOUNT = TOTAL_AMOUNT + GOOD.TOTAL_AMOUNT; var Dec = new DecList(); Dec.PID = model.GID; Dec.GID = Guid.NewGuid().ToString(); Dec.GNo = GOOD.SEQUENCE_NUMBER; Dec.ContrItem = GOOD.CUSTOMS_ITEM_NUMBER; Dec.ExgVersion = GOOD.PRODUCT_VERSION_NUMBER; Dec.CodeTS = GOOD.HS_CODE; Dec.GName = GOOD.CHINESE_DESCRIPTION; Dec.GModel = GOOD.MODEL; Dec.GQty = GOOD.DECLARATION_QTY; Dec.GUnit = GOOD.CUSTOMS_UM; Dec.GUnit_Text = GetTextByCode(emlistQuery, "成交计量单位", Dec.GUnit); Dec.FirstQty = GOOD.CUSTOMS_QUANTITY; Dec.FirstUnit = GOOD.FIRST_CUSTOMS_UM; Dec.FirstUnit_Text = GetTextByCode(emlistQuery, "成交计量单位", Dec.FirstUnit); decimal SecondQty = 0; TryToDecimal(GOOD.SECOND_CUSTOMS_QUANTITY, out SecondQty); Dec.SecondQty = SecondQty; Dec.SecondUnit = GOOD.SECOND_CUSTOMS_UM; Dec.SecondUnit_Text = GetTextByCode(emlistQuery, "成交计量单位", Dec.SecondUnit); decimal DeclPrice = 0; TryToDecimal(GOOD.UNIT_PRICE, out DeclPrice); Dec.DeclPrice = DeclPrice; Dec.DeclTotal = GOOD.TOTAL_AMOUNT; Dec.TradeCurr = GOOD.CURRENCY; Dec.TradeCurr_Text = GetTextByCode(emlistQuery, "币别", Dec.TradeCurr); Dec.OriginCountry = GOOD.COUNTRY; Dec.OriginCountry_Text = GetTextByCode(emlistQuery, "国别地区", Dec.OriginCountry); Dec.DutyMode = GOOD.TAX_OPTION; Dec.DutyMode_Text = GetTextByCode(emlistQuery, "征免方式", Dec.DutyMode); Dec.DestinationCountry = GOOD.DestinationCountry; Dec.DestinationCountry_Text = GetTextByCode(emlistQuery, "征免方式", Dec.DestinationCountry); Dec.CiqCode = GOOD.CiqCode; Dec.DistrictCode = GOOD.DistrictCode; Dec.DestCode = GOOD.DESTINATION_DISTRICT; //Dec.Factor = GOOD.Factor; //Dec.DeclGoodsEname = GOOD.DeclGoodsEname; //Dec.OrigPlaceCode = GOOD.OrigPlaceCode; Dec.Purpose = GOOD.Purpose; Dec.Purpose_Text = GetTextByCode(emlistQuery, "用途", Dec.Purpose); if (!string.IsNullOrEmpty(GOOD.ProdValidDt)) Dec.ProdValidDt = DateTime.ParseExact(GOOD.ProdValidDt, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); ; Int32 ProdQgp = 0; TryToInt32(GOOD.ProdQgp, out ProdQgp); Dec.ProdQgp = ProdQgp; Dec.GoodsAttr = GOOD.GoodsAttr; Dec.GoodsAttr_Text = GetTextByCode(emlistQuery, "货物属性", Dec.GoodsAttr); Dec.Stuff = GOOD.Stuff; Dec.Uncode = GOOD.Uncode; Dec.DangName = GOOD.DangName; Int32 DangPackType = 0; TryToInt32(GOOD.DangPackType, out DangPackType); Dec.ProdQgp = DangPackType; Dec.DangPackSpec = GOOD.DangPackSpec; Dec.DangPackSpec_Text = GetTextByCode(emlistQuery, "危包规格", Dec.DangPackSpec); Dec.EngManEntCnm = GOOD.EngManEntCnm; Int32 NoDangFlag = 0; TryToInt32(GOOD.NoDangFlag, out NoDangFlag); Dec.NoDangFlag = NoDangFlag; Dec.GoodsSpec = GOOD.GoodsSpec; Dec.GoodsModel = GOOD.GoodsModel; Dec.GoodsBrand = GOOD.GoodsBrand; Dec.ProduceDate = GOOD.ProduceDate; Dec.ProdBatchNo = GOOD.ProdBatchNo; lbll.Add(Dec); //Dec.CiqName = GOOD.CiqName; //Dec.MnufctrRegno = GOOD.MnufctrRegno; //Dec.MnufctrRegName = GOOD.MnufctrRegName; if (GOOD.DecGoodsLimits != null) foreach (var GOODLIMIT in GOOD.DecGoodsLimits) { var DecGood = new DecGoodsLimit(); DecGood.PID = Dec.GID; DecGood.GID = Guid.NewGuid().ToString(); DecGood.GoodsNo = GOODLIMIT.GoodsNo; DecGood.LicTypeCode = GOODLIMIT.LicTypeCode; DecGood.LicTypeCode_Text = GetTextByCode(emlistQuery, "许可证类别", DecGood.LicTypeCode); DecGood.LicenceNo = GOODLIMIT.LicenceNo; DecGood.LicWrtofDetailNo = GOODLIMIT.LicWrtofDetailNo; DecGood.LicWrtofQty = Convert.ToInt32(GOODLIMIT.LicWrtofQty); gbll.Add(DecGood); if (GOODLIMIT.DecGoodsLimitVin != null) foreach (var GOODLIMITVIN in GOODLIMIT.DecGoodsLimitVin) { var DecGoodvin = new DecGoodsLimitVin(); DecGoodvin.PID = DecGood.GID; DecGoodvin.GID = Guid.NewGuid().ToString(); ////DecGoodvin.LicenceNo = GOODLIMITVIN.LicenceNo; //DecGoodvin.LicTypeCode = GOODLIMITVIN.LicTypeCode; DecGoodvin.VinNo = GOODLIMITVIN.VinNo; if (!string.IsNullOrEmpty(GOODLIMITVIN.BillLadDate)) DecGoodvin.BillLadDate = DateTime.ParseExact(GOODLIMITVIN.BillLadDate, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); DecGoodvin.QualityQgp = GOODLIMITVIN.QualityQgp; DecGoodvin.MotorNo = GOODLIMITVIN.MotorNo; DecGoodvin.VinCode = GOODLIMITVIN.VinCode; DecGoodvin.ChassisNo = GOODLIMITVIN.ChassisNo; Int32 InvoiceNum = 0; TryToInt32(GOODLIMITVIN.InvoiceNum, out InvoiceNum); DecGoodvin.InvoiceNum = InvoiceNum; DecGoodvin.ProdCnnm = GOODLIMITVIN.ProdCnnm; DecGoodvin.ProdEnnm = GOODLIMITVIN.ProdEnnm; DecGoodvin.ModelEn = GOODLIMITVIN.ModelEn; decimal PricePerUnit = 0; TryToDecimal(GOODLIMITVIN.PricePerUnit, out PricePerUnit); DecGoodvin.PricePerUnit = PricePerUnit; DecGoodvin.InvoiceNo = GOODLIMITVIN.InvoiceNo; vbll.Add(DecGoodvin); } } } OPAPPLY.CARGOVALUE = TOTAL_AMOUNT.ToString(); //var modb = new ModelObjectDB(); // var tempresult = modb.Save(OPAPPLY); var bodyList = new List(); if (items.CONTAINER_DETAIL != null) foreach (var ctn in items.CONTAINER_DETAIL) { var opctn = new MsOpCtn(); opctn.BSNO = "*"; opctn.CNTRNO = ctn.CONTAINER_NUMBER; opctn.CTNALL = ctn.CONTAINER_TYPE; opctn.KGS = Convert.ToDecimal(ctn.GoodsContaWt); Container ctnitem = new Container(); ctnitem.PID = model.GID; ctnitem.GID = Guid.NewGuid().ToString(); ctnitem.ContainerId = ctn.CONTAINER_NUMBER; ctnitem.ContainerMd = ctn.CONTAINER_TYPE; decimal ContainerWt = 0; TryToDecimal(ctn.CONTAINER_TARE_WEIGHT, out ContainerWt); ctnitem.ContainerWt = ContainerWt; ctnitem.GoodsNo = ctn.GoodsNo; decimal GoodsContaWt = 0; TryToDecimal(ctn.GoodsContaWt, out GoodsContaWt); ctnitem.GoodsContaWt = GoodsContaWt; cbll.Add(ctnitem); } if (items.ATTACHED_DOCUMENT_DETAIL != null) foreach (var DOC in items.ATTACHED_DOCUMENT_DETAIL) { LicenseDocu docitem = new LicenseDocu(); docitem.PID = model.GID; docitem.GID = Guid.NewGuid().ToString(); docitem.DocuCode = DOC.DOCUMENT_TYPE; docitem.DocuCode_Text = GetTextByCode(emlistQuery, "随附单证代码", docitem.DocuCode); docitem.CertCode = DOC.DOCUMENT_NUMBER; dbll.Add(docitem); } if (items.DecOtherPack != null) foreach (var OTHERPACK in items.DecOtherPack) { DecOtherPack otheritem = new DecOtherPack(); otheritem.PID = model.GID; otheritem.GID = Guid.NewGuid().ToString(); otheritem.PackQty = OTHERPACK.PackQty; otheritem.PackType = OTHERPACK.PackType; opbll.Add(otheritem); } if (items.DecCopLimits != null) foreach (var COPLIMITLIST in items.DecCopLimits) { DecCopLimit otheritem = new DecCopLimit(); otheritem.PID = model.GID; otheritem.GID = Guid.NewGuid().ToString(); otheritem.EntQualifNo = COPLIMITLIST.EntQualifNo; otheritem.EntQualifTypeCode = COPLIMITLIST.EntQualifTypeCode; otheritem.EntQualifTypeCode_Text = GetTextByCode(emlistQuery, "企业资质类别", otheritem.EntQualifTypeCode); clbll.Add(otheritem); } var modb = new ModelObjectDB(); result = modb.Save(OPAPPLY,dbname); if (result.Success) { MsOpApplyDAL.SaveCtnDetail(OPAPPLY.BSNO, bodyList, userid, true,dbname); } blcount = blcount + 1; } result.Message = "" + blcount + "票业务"; return result; } public static bool TryToInt32(object value, out int result) { if (value == null) { result = 0; return false; } return int.TryParse(value.ToString(), out result); } public static bool TryToDecimal(object value, out Decimal result) { if (value == null) { result = 0; return false; } return Decimal.TryParse(value.ToString(), out result); } public static string GetTextByCode(EnumerableRowCollection emlistQuery, string emtype, string emcode) { var result = ""; var emlists = emlistQuery.Where(p => p.Field("type") == emtype && p.Field("Value") == emcode); foreach (DataRow em in emlists) { result = em.Field("Name"); } return result; } public static string GetCodeByText(EnumerableRowCollection emlistQuery, string emtype, string emname) { var result = ""; var emlists = emlistQuery.Where(p => p.Field("type") == emtype && p.Field("Name") == emname); foreach (DataRow em in emlists) { result = em.Field("Value"); } return result; } } }