You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1636 lines
106 KiB
C#

9 months ago
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DSWeb.DataAccess;
using DSWeb.Models;
using System.Data.SqlClient;
using System.Collections.Generic;
namespace DSWeb.EntityDA
{
public class SeaImportInfoDA
{
private const string PARM_MODULE_GID = "@BSNO";
private const string PARM_SEAE_BSNO = "@bsno";
private const string SQL_SELECT_INFO = "select BSNO ,MASTERNO ,BSSTATUS ,FEESTATUS ,BSDATE ,ACCDATE ,MBLNO ,HBLNO ,CUSTNO ,CUSTOMERNAME ,VESSEL ,VOYNO ,ETD ,PORTLOADID , PORTLOAD ,PORTDISCHARGEID ,PORTDISCHARGE ,GOODSNAME ,KGS ,CNTRNO ,CNTR1 ,CNTR2 ,CNTR3 ,CNTR4 ,CNTR5 ,CNTR6 ,CNTR7 ,CNTR8 ,CNTR9 ,CNTR10 ,OTCNTR ,TEU ,CNTRTOTAL ,INPUTBY ,OP ,CUSTSERVICE ,SALE ,CUSTOMSER ,BSSOURCE ,BSSOURCEDETAIL ,CONTRACTNO ,CORPID ,SALEDEPT ,CREATETIME ,ORDERTYPE ,COUNTRYOFORIGIN ,NUMBERPLATE ,BALES ,NETWEIGHT ,CUSTOMNO ,CUSTOMDATE ,INSPECTION ,INSPECTIONNO ,INSPECTIONDATE, FBP, BMDDATE, MDTDATE, UNITOFWEIGHT,PKGS,ISVOU,VOUNO,MT,KINDPKGS,isnull(TRADINGAGENCY,''),isnull(GOODSTYPENAME,''),isnull(TRADETYPE,''),isnull(SHOWNAME,''),isnull(EMAIL,''),isnull(TEL,''),isnull(FAX,''),TARRIFSPAIEDTIEM,isnull(APPROVENO,''),REMARK,GRADE,NOR,STORAGENAME,ISFORCEDTODESPATCH,BSKGS,ACTUALKGS,DRAFTKGS,WHARFSKGS,WMSINKGS,YARD,WMSOUTKGS,DIFFERENCEKGS,WATERCONTENT,WATERDENSITY,BLTYPE,CBM,IMPORTVALUE,UNITPRICE,CURRENCY,UPDATETIME,LEVELS,BSTYPE,PARENTID,CARRIER,TRUCKER,WMSTYPE from op_seai where BSNO=@BSNO";//,UNITS
private const string SQL_DELETE_INFO = "DELETE FROM op_seai WHERE BSNO = @bsno";
private string strSql = "insert into op_seai(BSNO,ORDERTYPE,MASTERNO,CUSTNO,MBLNO,HBLNO,BSSTATUS,FEESTATUS,{0}ACCDATE,CUSTOMERNAME,BSSOURCE,BSSOURCEDETAIL,INPUTBY,OP,CUSTSERVICE,SALE,CORPID,SALEDEPT,CREATETIME,VESSEL,VOYNO,{2}PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,CNTRNO,CNTR1,CNTR2,CNTR3,CNTR4,CNTR5,CNTR6,CNTR7,CNTR8,CNTR9,CNTR10,OTCNTR,TEU,CNTRTOTAL,GOODSNAME,COUNTRYOFORIGIN,NUMBERPLATE,CONTRACTNO,BALES,KGS,NETWEIGHT,CUSTOMSER,CUSTOMNO,{4}INSPECTION,{6}INSPECTIONNO,FBP,{8}{10}UNITOFWEIGHT,PKGS,ISVOU,VOUNO,MT,KINDPKGS,TRADINGAGENCY,GOODSTYPENAME,TRADETYPE,SHOWNAME,EMAIL,TEL,FAX,{12}APPROVENO,REMARK,GRADE,{14}STORAGENAME,ISFORCEDTODESPATCH,BSKGS,ACTUALKGS,DRAFTKGS,WHARFSKGS,WMSINKGS,YARD,WMSOUTKGS,DIFFERENCEKGS,WATERCONTENT,WATERDENSITY,BLTYPE,CBM,IMPORTVALUE,UNITPRICE,CURRENCY{16},LEVELS,BSTYPE,PARENTID,CARRIER,TRUCKER,WMSTYPE) "
+ " values(@BSNO,@ORDERTYPE,@MASTERNO,@CUSTNO,@MBLNO,@HBLNO,@BSSTATUS,@FEESTATUS,{1}@ACCDATE,@CUSTOMERNAME,@BSSOURCE,@BSSOURCEDETAIL,@INPUTBY,@OP,@CUSTSERVICE,@SALE,@CORPID,@SALEDEPT,getdate(),@VESSEL,@VOYNO,{3}@PORTLOADID,@PORTLOAD,@PORTDISCHARGEID,@PORTDISCHARGE,@CNTRNO,@CNTR1,@CNTR2,@CNTR3,@CNTR4,@CNTR5,@CNTR6,@CNTR7,@CNTR8,@CNTR9,@CNTR10,@OTCNTR,@TEU,@CNTRTOTAL,@GOODSNAME,@COUNTRYOFORIGIN,@NUMBERPLATE,@CONTRACTNO,@BALES,@KGS,@NETWEIGHT,@CUSTOMSER,@CUSTOMNO,{5}@INSPECTION,{7}@INSPECTIONNO,@FBP,{9}{11}@UNITOFWEIGHT,@PKGS,0,'',@MT,@KINDPKGS,@TRADINGAGENCY,@GOODSTYPENAME,@TRADETYPE,@SHOWNAME,@EMAIL,@TEL,@FAX,{13}@APPROVENO,@REMARK,@GRADE,{15}@STORAGENAME,@ISFORCEDTODESPATCH,@BSKGS,@ACTUALKGS,@DRAFTKGS,@WHARFSKGS,@WMSINKGS,@YARD,@WMSOUTKGS,@DIFFERENCEKGS,@WATERCONTENT,@WATERDENSITY,@BLTYPE,@CBM,@IMPORTVALUE,@UNITPRICE,@CURRENCY{17},@LEVELS,@BSTYPE,@PARENTID,@CARRIER,@TRUCKER,@WMSTYPE)";//,UNITS,@UNITS
private string strSqlUpdateInfo = "update op_seai set CUSTNO=@CUSTNO,MBLNO=@MBLNO,HBLNO=@HBLNO,BSSTATUS=@BSSTATUS,FEESTATUS=@FEESTATUS,{0}{1}CUSTOMERNAME=@CUSTOMERNAME,BSSOURCE=@BSSOURCE,BSSOURCEDETAIL=@BSSOURCEDETAIL,OP=@OP,CUSTSERVICE=@CUSTSERVICE,SALE=@SALE,CORPID=@CORPID,SALEDEPT=@SALEDEPT,VESSEL=@VESSEL,VOYNO=@VOYNO,{2}{3}PORTLOADID=@PORTLOADID,PORTLOAD=@PORTLOAD,PORTDISCHARGEID=@PORTDISCHARGEID,PORTDISCHARGE=@PORTDISCHARGE,CNTRNO=@CNTRNO,CNTR1=@CNTR1,CNTR2=@CNTR2,CNTR3=@CNTR3,CNTR4=@CNTR4,CNTR5=@CNTR5,CNTR6=@CNTR6,CNTR7=@CNTR7,CNTR8=@CNTR8,CNTR9=@CNTR9,CNTR10=@CNTR10,OTCNTR=@OTCNTR,TEU=@TEU,CNTRTOTAL=@CNTRTOTAL,GOODSNAME=@GOODSNAME,COUNTRYOFORIGIN=@COUNTRYOFORIGIN,NUMBERPLATE=@NUMBERPLATE,CONTRACTNO=@CONTRACTNO,BALES=@BALES,KGS=@KGS,NETWEIGHT=@NETWEIGHT,CUSTOMSER=@CUSTOMSER,CUSTOMNO=@CUSTOMNO,{4}{5}INSPECTION=@INSPECTION,{6}{7}INSPECTIONNO=@INSPECTIONNO,FBP=@FBP,{8}{9}{10}{11}UNITOFWEIGHT=@UNITOFWEIGHT,PKGS=@PKGS,MT=@MT,KINDPKGS=@KINDPKGS,TRADINGAGENCY=@TRADINGAGENCY,GOODSTYPENAME=@GOODSTYPENAME,TRADETYPE=@TRADETYPE,SHOWNAME=@SHOWNAME,EMAIL=@EMAIL,TEL=@TEL,FAX=@FAX,{12}{13}APPROVENO=@APPROVENO,REMARK=@REMARK,GRADE = @GRADE ,{14}{15}STORAGENAME = @STORAGENAME ,ISFORCEDTODESPATCH = @ISFORCEDTODESPATCH ,BSKGS = @BSKGS ,ACTUALKGS = @ACTUALKGS ,DRAFTKGS = @DRAFTKGS , WHARFSKGS = @WHARFSKGS ,WMSINKGS = @WMSINKGS , YARD = @YARD,WMSOUTKGS = @WMSOUTKGS ,DIFFERENCEKGS = @DIFFERENCEKGS ,WATERCONTENT = @WATERCONTENT ,WATERDENSITY = @WATERDENSITY,BLTYPE = @BLTYPE,ACCDATE = @ACCDATE,CBM=@CBM,IMPORTVALUE=@IMPORTVALUE,UNITPRICE=@UNITPRICE,CURRENCY=@CURRENCY,UPDATETIME={16},BSTYPE=@BSTYPE,CARRIER=@CARRIER,TRUCKER=@TRUCKER,WMSTYPE=@WMSTYPE where BSNO=@BSNO";//,UNITS=@UNITS
private const string SQL_UPDATE_op_seai_FEE_LOCK = " UPDATE op_seai SET FEESTATUS = 1 WHERE BSNO = @bsno ";
private const string SQL_UPDATE_op_seai_FEE_UNLOCK = " UPDATE op_seai SET FEESTATUS = 0 WHERE BSNO = @bsno ";
public SeaImportInfoDA()
{
}
#region 根据GID获取信息
/// <summary>
/// 根据GID获取信息
/// </summary>
/// <param name="strRoleGID"></param>
/// <returns></returns>
public TopSeaiEntity GetID(string strGID)
{
//初始化返回变量
TopSeaiEntity TopSeaiEntity = null;
//初始化参数并赋值
SqlParameter parm = new SqlParameter(PARM_MODULE_GID, SqlDbType.VarChar, 100);
parm.Value = strGID;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_INFO, parm))
{
try
{
TopSeaiEntity = new TopSeaiEntity();
//读取字段值
while (sqlRead.Read())
{
if (!sqlRead.IsDBNull(0)) { TopSeaiEntity.BSNO = sqlRead.GetString(0); } //业务编号
if (!sqlRead.IsDBNull(1)) { TopSeaiEntity.MASTERNO = sqlRead.GetString(1); } //主编号
if (!sqlRead.IsDBNull(2)) { TopSeaiEntity.BSSTATUS = sqlRead.GetBoolean(2); } //业务状态
if (!sqlRead.IsDBNull(3)) { TopSeaiEntity.FEESTATUS = sqlRead.GetBoolean(3); } //费用状态
if (!sqlRead.IsDBNull(4)) { TopSeaiEntity.BSDATE = sqlRead.GetDateTime(4); } //接单日期
if (!sqlRead.IsDBNull(5)) { TopSeaiEntity.ACCDATE = sqlRead.GetString(5); } //会计期间
if (!sqlRead.IsDBNull(6)) { TopSeaiEntity.MBLNO = sqlRead.GetString(6); } //主提单号
if (!sqlRead.IsDBNull(7)) { TopSeaiEntity.HBLNO = sqlRead.GetString(7); } //分提单号
if (!sqlRead.IsDBNull(8)) { TopSeaiEntity.CUSTNO = sqlRead.GetString(8); } //委托编号
if (!sqlRead.IsDBNull(9)) { TopSeaiEntity.CUSTOMERNAME = sqlRead.GetString(9); } //委托单位
if (!sqlRead.IsDBNull(10)) { TopSeaiEntity.VESSEL = sqlRead.GetString(10); } //船名
if (!sqlRead.IsDBNull(11)) { TopSeaiEntity.VOYNO = sqlRead.GetString(11); } //航次
if (!sqlRead.IsDBNull(12)) { TopSeaiEntity.ETD = sqlRead.GetDateTime(12); } //到港日期
if (!sqlRead.IsDBNull(13)) { TopSeaiEntity.PORTLOADID = sqlRead.GetString(13); } //装货港代码
if (!sqlRead.IsDBNull(14)) { TopSeaiEntity.PORTLOAD = sqlRead.GetString(14); } //装货港
if (!sqlRead.IsDBNull(15)) { TopSeaiEntity.PORTDISCHARGEID = sqlRead.GetString(15); } //卸货港代码
if (!sqlRead.IsDBNull(16)) { TopSeaiEntity.PORTDISCHARGE = sqlRead.GetString(16); } //卸货港
if (!sqlRead.IsDBNull(17)) { TopSeaiEntity.GOODSNAME = sqlRead.GetString(17); } //品名
if (!sqlRead.IsDBNull(18)) { TopSeaiEntity.KGS = sqlRead.GetDecimal(18); } //毛重
if (!sqlRead.IsDBNull(19)) { TopSeaiEntity.CNTRNO = sqlRead.GetString(19); } //集装箱大写
if (!sqlRead.IsDBNull(20)) { TopSeaiEntity.CNTR1 = sqlRead.GetInt32(20); } //箱型1
if (!sqlRead.IsDBNull(21)) { TopSeaiEntity.CNTR2 = sqlRead.GetInt32(21); } //箱型2
if (!sqlRead.IsDBNull(22)) { TopSeaiEntity.CNTR3 = sqlRead.GetInt32(22); } //箱型3
if (!sqlRead.IsDBNull(23)) { TopSeaiEntity.CNTR4 = sqlRead.GetInt32(23); } //箱型4
if (!sqlRead.IsDBNull(24)) { TopSeaiEntity.CNTR5 = sqlRead.GetInt32(24); } //箱型5
if (!sqlRead.IsDBNull(25)) { TopSeaiEntity.CNTR6 = sqlRead.GetInt32(25); } //箱型6
if (!sqlRead.IsDBNull(26)) { TopSeaiEntity.CNTR7 = sqlRead.GetInt32(26); } //箱型7
if (!sqlRead.IsDBNull(27)) { TopSeaiEntity.CNTR8 = sqlRead.GetInt32(27); } //箱型8
if (!sqlRead.IsDBNull(28)) { TopSeaiEntity.CNTR9 = sqlRead.GetInt32(28); } //箱型9
if (!sqlRead.IsDBNull(29)) { TopSeaiEntity.CNTR10 = sqlRead.GetInt32(29); } //箱型10
if (!sqlRead.IsDBNull(30)) { TopSeaiEntity.OTCNTR = sqlRead.GetInt32(30); } //其他箱型
if (!sqlRead.IsDBNull(31)) { TopSeaiEntity.TEU = sqlRead.GetInt32(31); } //箱TEU
if (!sqlRead.IsDBNull(32)) { TopSeaiEntity.CNTRTOTAL = sqlRead.GetString(32); } //集装箱
if (!sqlRead.IsDBNull(33)) { TopSeaiEntity.INPUTBY = sqlRead.GetString(33); } //录入人
if (!sqlRead.IsDBNull(34)) { TopSeaiEntity.OP = sqlRead.GetString(34); } //操作员
if (!sqlRead.IsDBNull(35)) { TopSeaiEntity.CUSTSERVICE = sqlRead.GetString(35); } //客服
if (!sqlRead.IsDBNull(36)) { TopSeaiEntity.SALE = sqlRead.GetString(36); } //揽货人
if (!sqlRead.IsDBNull(37)) { TopSeaiEntity.CUSTOMSER = sqlRead.GetString(37); } //报关行
if (!sqlRead.IsDBNull(38)) { TopSeaiEntity.BSSOURCE = sqlRead.GetString(38); } //业务来源
if (!sqlRead.IsDBNull(39)) { TopSeaiEntity.BSSOURCEDETAIL = sqlRead.GetString(39); } //来源明细
if (!sqlRead.IsDBNull(40)) { TopSeaiEntity.CONTRACTNO = sqlRead.GetString(40); } //合同号
if (!sqlRead.IsDBNull(41)) { TopSeaiEntity.CORPID = sqlRead.GetString(41); } //分公司代码
if (!sqlRead.IsDBNull(42)) { TopSeaiEntity.SALEDEPT = sqlRead.GetString(42); } //所属业务部门
if (!sqlRead.IsDBNull(43)) { TopSeaiEntity.CREATETIME = sqlRead.GetDateTime(43); } //创建日期
if (!sqlRead.IsDBNull(44)) { TopSeaiEntity.ORDERTYPE = sqlRead.GetString(44); } //委托方式
if (!sqlRead.IsDBNull(45)) { TopSeaiEntity.COUNTRYOFORIGIN = sqlRead.GetString(45); }
if (!sqlRead.IsDBNull(46)) { TopSeaiEntity.NUMBERPLATE = sqlRead.GetString(46); }
//if (!sqlRead.IsDBNull(47)) { TopSeaiEntity.UNITS = sqlRead.GetString(47); }
if (!sqlRead.IsDBNull(47)) { TopSeaiEntity.BALES = sqlRead.GetString(47); }
if (!sqlRead.IsDBNull(48)) { TopSeaiEntity.NETWEIGHT = sqlRead.GetDecimal(48); }
if (!sqlRead.IsDBNull(49)) { TopSeaiEntity.CUSTOMNO = sqlRead.GetString(49); }
if (!sqlRead.IsDBNull(50)) { TopSeaiEntity.CUSTOMDATE = sqlRead.GetDateTime(50); }
if (!sqlRead.IsDBNull(51)) { TopSeaiEntity.INSPECTION = sqlRead.GetString(51); }
if (!sqlRead.IsDBNull(52)) { TopSeaiEntity.INSPECTIONNO = sqlRead.GetString(52); }
if (!sqlRead.IsDBNull(53)) { TopSeaiEntity.INSPECTIONDATE = sqlRead.GetDateTime(53); }
if (!sqlRead.IsDBNull(54)) { TopSeaiEntity.FBP = sqlRead.GetInt32(54); }
if (!sqlRead.IsDBNull(55)) { TopSeaiEntity.BMDDATE = sqlRead.GetDateTime(55); }
if (!sqlRead.IsDBNull(56)) { TopSeaiEntity.MDTDATE = sqlRead.GetDateTime(56); }
if (!sqlRead.IsDBNull(57)) { TopSeaiEntity.UNITOFWEIGHT = sqlRead.GetString(57); }
if (!sqlRead.IsDBNull(58)) { TopSeaiEntity.PKGS = sqlRead.GetInt32(58); } //件数
if (!sqlRead.IsDBNull(59)) { TopSeaiEntity.ISVOU = sqlRead.GetBoolean(59); } //是否生成凭证
if (!sqlRead.IsDBNull(60)) { TopSeaiEntity.VOUNO = sqlRead.GetString(60); } //凭证号
if (!sqlRead.IsDBNull(61)) { TopSeaiEntity.MT = sqlRead.GetDecimal(61); }
if (!sqlRead.IsDBNull(62)) { TopSeaiEntity.KINDPKGS = sqlRead.GetString(62); } //包装
if (!sqlRead.IsDBNull(63)) { TopSeaiEntity.TRADINGAGENCY = sqlRead.GetString(63); } //贸易代理
if (!sqlRead.IsDBNull(64)) { TopSeaiEntity.GOODSTYPENAME = sqlRead.GetString(64); } //品名类型
if (!sqlRead.IsDBNull(65)) { TopSeaiEntity.TRADETYPE = sqlRead.GetString(65); } //贸易方式
if (!sqlRead.IsDBNull(66)) { TopSeaiEntity.SHOWNAME = sqlRead.GetString(66); } //客户联系人
if (!sqlRead.IsDBNull(67)) { TopSeaiEntity.EMAIL = sqlRead.GetString(67); } //
if (!sqlRead.IsDBNull(68)) { TopSeaiEntity.TEL = sqlRead.GetString(68); } //
if (!sqlRead.IsDBNull(69)) { TopSeaiEntity.FAX = sqlRead.GetString(69); } //
if (!sqlRead.IsDBNull(70)) { TopSeaiEntity.TARRIFSPAIEDTIEM = sqlRead.GetDateTime(70); } //
if (!sqlRead.IsDBNull(71)) { TopSeaiEntity.APPROVENO = sqlRead.GetString(71); } //
if (!sqlRead.IsDBNull(72)) { TopSeaiEntity.REMARK = sqlRead.GetString(72); } //备注
if (!sqlRead.IsDBNull(73)) { TopSeaiEntity.GRADE = sqlRead.GetString(73); }
if (!sqlRead.IsDBNull(74)) { TopSeaiEntity.NOR = sqlRead.GetDateTime(74); }
if (!sqlRead.IsDBNull(75)) { TopSeaiEntity.STORAGENAME = sqlRead.GetString(75); }
if (!sqlRead.IsDBNull(76)) { TopSeaiEntity.ISFORCEDTODESPATCH = sqlRead.GetBoolean(76); }
if (!sqlRead.IsDBNull(77)) { TopSeaiEntity.BSKGS = sqlRead.GetDecimal(77); }
if (!sqlRead.IsDBNull(78)) { TopSeaiEntity.ACTUALKGS = sqlRead.GetDecimal(78); }
if (!sqlRead.IsDBNull(79)) { TopSeaiEntity.DRAFTKGS = sqlRead.GetDecimal(79); }
if (!sqlRead.IsDBNull(80)) { TopSeaiEntity.WHARFSKGS = sqlRead.GetDecimal(80); }
if (!sqlRead.IsDBNull(81)) { TopSeaiEntity.WMSINKGS = sqlRead.GetDecimal(81); }
if (!sqlRead.IsDBNull(82)) { TopSeaiEntity.YARD = sqlRead.GetString(82); }
if (!sqlRead.IsDBNull(83)) { TopSeaiEntity.WMSOUTKGS = sqlRead.GetDecimal(83); }
if (!sqlRead.IsDBNull(84)) { TopSeaiEntity.DIFFERENCEKGS = sqlRead.GetDecimal(84); }
if (!sqlRead.IsDBNull(85)) { TopSeaiEntity.WATERCONTENT = sqlRead.GetString(85); }
if (!sqlRead.IsDBNull(86)) { TopSeaiEntity.WATERDENSITY = sqlRead.GetString(86); }
if (!sqlRead.IsDBNull(87)) { TopSeaiEntity.BLTYPE = sqlRead.GetString(87); }//装运方式
if (!sqlRead.IsDBNull(88)) { TopSeaiEntity.CBM = sqlRead.GetDecimal(88); }
if (!sqlRead.IsDBNull(89)) { TopSeaiEntity.IMPORTVALUE = sqlRead.GetDecimal(89); }//货值
if (!sqlRead.IsDBNull(90)) { TopSeaiEntity.UNITPRICE = sqlRead.GetDecimal(90); }//单价
if (!sqlRead.IsDBNull(91)) { TopSeaiEntity.CURRENCY = sqlRead.GetString(91); }//币别
if (!sqlRead.IsDBNull(92)) { TopSeaiEntity.UPDATETIME = sqlRead.GetDateTime(92); }//申报日期
if (!sqlRead.IsDBNull(93)) { TopSeaiEntity.LEVELS = sqlRead.GetInt32(93); }
if (!sqlRead.IsDBNull(94)) { TopSeaiEntity.BSTYPE = sqlRead.GetString(94); }
if (!sqlRead.IsDBNull(95)) { TopSeaiEntity.PARENTID = sqlRead.GetString(95); }
if (!sqlRead.IsDBNull(96)) { TopSeaiEntity.CARRIER = sqlRead.GetString(96); }
if (!sqlRead.IsDBNull(97)) { TopSeaiEntity.TRUCKER = sqlRead.GetString(97); }
if (!sqlRead.IsDBNull(98)) { TopSeaiEntity.WMSTYPE = sqlRead.GetString(98); }
#region op_seai暂时不用
//op_seai暂时不用
//if (!sqlRead.IsDBNull(9)) { TopSeaiEntity.TRANSNO = sqlRead.GetString(9); } //运单号
//if (!sqlRead.IsDBNull(12)) { TopSeaiEntity.SHIPPERID = sqlRead.GetString(12); } //发货人
//if (!sqlRead.IsDBNull(13)) { TopSeaiEntity.CONSIGNEEID = sqlRead.GetString(13); } //收货人
//if (!sqlRead.IsDBNull(14)) { TopSeaiEntity.NOTIFYPARTYID = sqlRead.GetString(14); } //通知人
//if (!sqlRead.IsDBNull(15)) { TopSeaiEntity.SHIPPER = sqlRead.GetString(15); } //发货人内容
//if (!sqlRead.IsDBNull(16)) { TopSeaiEntity.CONSIGNEE = sqlRead.GetString(16); } //收货人内容
//if (!sqlRead.IsDBNull(17)) { TopSeaiEntity.NOTIFYPARTY = sqlRead.GetString(17); } //通知人内容
//if (!sqlRead.IsDBNull(18)) { TopSeaiEntity.AGENTID = sqlRead.GetString(18); } //国外代理
//if (!sqlRead.IsDBNull(19)) { TopSeaiEntity.AGENT = sqlRead.GetString(19); } //国外代理内容
//if (!sqlRead.IsDBNull(24)) { TopSeaiEntity.CLOSINGDATE = sqlRead.GetDateTime(24); } //截港日期
//if (!sqlRead.IsDBNull(25)) { TopSeaiEntity.ETA = sqlRead.GetDateTime(25); } //预抵日期
//if (!sqlRead.IsDBNull(26)) { TopSeaiEntity.PlACERECEIPT = sqlRead.GetString(26); } //收货地
//if (!sqlRead.IsDBNull(31)) { TopSeaiEntity.PLACEDELIVERYID = sqlRead.GetString(31); } //交货地代码
//if (!sqlRead.IsDBNull(32)) { TopSeaiEntity.PLACEDELIVERY = sqlRead.GetString(32); } //交货地
//if (!sqlRead.IsDBNull(33)) { TopSeaiEntity.DESTINATIONID = sqlRead.GetString(33); } //目的地代码
//if (!sqlRead.IsDBNull(34)) { TopSeaiEntity.DESTINATION = sqlRead.GetString(34); } //目的地
//if (!sqlRead.IsDBNull(35)) { TopSeaiEntity.NOBILL = sqlRead.GetString(35); } //提单份数
//if (!sqlRead.IsDBNull(36)) { TopSeaiEntity.ISSUETYPE = sqlRead.GetString(36); } //签单方式
//if (!sqlRead.IsDBNull(37)) { TopSeaiEntity.ISSUEDATE = sqlRead.GetDateTime(37); } //签单日期
//if (!sqlRead.IsDBNull(38)) { TopSeaiEntity.ISSUEPLACE = sqlRead.GetString(38); } //签单地点
//if (!sqlRead.IsDBNull(39)) { TopSeaiEntity.BLFRT = sqlRead.GetString(39); } //付费方式
//if (!sqlRead.IsDBNull(40)) { TopSeaiEntity.PREPARDAT = sqlRead.GetString(40); } //预付地点
//if (!sqlRead.IsDBNull(41)) { TopSeaiEntity.PAYABLEAT = sqlRead.GetString(41); } //到付地点
//if (!sqlRead.IsDBNull(42)) { TopSeaiEntity.SERVICE = sqlRead.GetString(42); } //运输条款
//if (!sqlRead.IsDBNull(43)) { TopSeaiEntity.MARKS = sqlRead.GetString(43); } //唛头
//if (!sqlRead.IsDBNull(44)) { TopSeaiEntity.CNTRSEALNO = sqlRead.GetString(44); } //箱号封号
//if (!sqlRead.IsDBNull(45)) { TopSeaiEntity.NOPKGS = sqlRead.GetString(45); } //件数包装
//if (!sqlRead.IsDBNull(46)) { TopSeaiEntity.DESCRIPTION = sqlRead.GetString(46); } //货物描述
//if (!sqlRead.IsDBNull(48)) { TopSeaiEntity.GROSSWEIGHT = sqlRead.GetString(48); } //货物毛重
//if (!sqlRead.IsDBNull(49)) { TopSeaiEntity.MEASUREMENT = sqlRead.GetString(49); } //货物尺码
//if (!sqlRead.IsDBNull(53)) { TopSeaiEntity.CBM = sqlRead.GetDecimal(53); } //尺码
//if (!sqlRead.IsDBNull(54)) { TopSeaiEntity.TOTALNO = sqlRead.GetString(54); } //件数大写
//if (!sqlRead.IsDBNull(72)) { TopSeaiEntity.LANE = sqlRead.GetString(72); } //航线
//if (!sqlRead.IsDBNull(74)) { TopSeaiEntity.CARRIER = sqlRead.GetString(74); } //船公司
//if (!sqlRead.IsDBNull(75)) { TopSeaiEntity.FORWARDER = sqlRead.GetString(75); } //订舱代理
//if (!sqlRead.IsDBNull(77)) { TopSeaiEntity.TRUCKER = sqlRead.GetString(77); } //承运车队
//if (!sqlRead.IsDBNull(78)) { TopSeaiEntity.INVNO = sqlRead.GetString(78); } //发票号
//if (!sqlRead.IsDBNull(79)) { TopSeaiEntity.CARGOID = sqlRead.GetString(79); } //货物标识
//if (!sqlRead.IsDBNull(80)) { TopSeaiEntity.DCLASS = sqlRead.GetString(80); } //危险品分类/等级
//if (!sqlRead.IsDBNull(81)) { TopSeaiEntity.DUNNO = sqlRead.GetString(81); } //危险品编号
//if (!sqlRead.IsDBNull(82)) { TopSeaiEntity.REEFERF = sqlRead.GetString(82); } //冷藏通风量
//if (!sqlRead.IsDBNull(83)) { TopSeaiEntity.TEMPID = sqlRead.GetString(83); } //温度单位
//if (!sqlRead.IsDBNull(84)) { TopSeaiEntity.TEMPSET = sqlRead.GetString(84); } //设置温度
//if (!sqlRead.IsDBNull(85)) { TopSeaiEntity.TEMPMAX = sqlRead.GetString(85); } //最高温度
//if (!sqlRead.IsDBNull(86)) { TopSeaiEntity.TEMPMIN = sqlRead.GetString(86); } //最低温度
//if (!sqlRead.IsDBNull(89)) { TopSeaiEntity.CUSTOMSNUM = sqlRead.GetInt16(89); } //报关票数
//if (!sqlRead.IsDBNull(91)) { TopSeaiEntity.ORDTYPE = sqlRead.GetString(91); } //订舱类型
//if (!sqlRead.IsDBNull(92)) { TopSeaiEntity.ORDERNO = sqlRead.GetString(92); } //订舱编号
//if (!sqlRead.IsDBNull(93)) { TopSeaiEntity.INSURANCEER = sqlRead.GetString(93); } //保险人
//if (!sqlRead.IsDBNull(94)) { TopSeaiEntity.INSURANCENO = sqlRead.GetString(94); } //保险单号
//if (!sqlRead.IsDBNull(95)) { TopSeaiEntity.INAMOUT = sqlRead.GetDecimal(95); } //保险金额
//if (!sqlRead.IsDBNull(99)) { TopSeaiEntity.STATUS1 = sqlRead.GetBoolean(99); } //状态1
//if (!sqlRead.IsDBNull(100)) { TopSeaiEntity.STATUS2 = sqlRead.GetBoolean(100); } //状态2
//if (!sqlRead.IsDBNull(101)) { TopSeaiEntity.STATUS3 = sqlRead.GetBoolean(101); } //状态3
//if (!sqlRead.IsDBNull(102)) { TopSeaiEntity.STATUS4 = sqlRead.GetBoolean(102); } //状态4
//if (!sqlRead.IsDBNull(103)) { TopSeaiEntity.STATUS5 = sqlRead.GetBoolean(103); } //状态5
//if (!sqlRead.IsDBNull(104)) { TopSeaiEntity.ISFUMIGATION = sqlRead.GetBoolean(104); } //熏蒸
//if (!sqlRead.IsDBNull(105)) { TopSeaiEntity.ISSTORAGE = sqlRead.GetBoolean(105); } //仓储
//if (!sqlRead.IsDBNull(106)) { TopSeaiEntity.ISLAND = sqlRead.GetBoolean(106); } //陆运
//if (!sqlRead.IsDBNull(107)) { TopSeaiEntity.ISCUSTOMS = sqlRead.GetBoolean(107); } //报关
//if (!sqlRead.IsDBNull(108)) { TopSeaiEntity.ISINSPECTION = sqlRead.GetBoolean(108); } //报检
//if (!sqlRead.IsDBNull(109)) { TopSeaiEntity.ISBOOKING = sqlRead.GetBoolean(109); } //订舱
//if (!sqlRead.IsDBNull(110)) { TopSeaiEntity.ISAGENT = sqlRead.GetBoolean(110); } //使用代理
//if (!sqlRead.IsDBNull(111)) { TopSeaiEntity.ISHBLNO = sqlRead.GetBoolean(111); } //分单签单
//if (!sqlRead.IsDBNull(112)) { TopSeaiEntity.SERVICE9 = sqlRead.GetBoolean(112); } //服务项目9
//if (!sqlRead.IsDBNull(113)) { TopSeaiEntity.SERVICE10 = sqlRead.GetBoolean(113); } //服务项目10
//if (!sqlRead.IsDBNull(114)) { TopSeaiEntity.DOC = sqlRead.GetString(114); } //单证
//if (!sqlRead.IsDBNull(115)) { TopSeaiEntity.PACKINGTYPE = sqlRead.GetString(115); } //装箱类型
//if (!sqlRead.IsDBNull(116)) { TopSeaiEntity.WAREHOUSE = sqlRead.GetString(116); } //仓库
//if (!sqlRead.IsDBNull(117)) { TopSeaiEntity.CLOSEDOCDATE = sqlRead.GetDateTime(117); } //截单日期
//if (!sqlRead.IsDBNull(118)) { TopSeaiEntity.INTOPORTDATE = sqlRead.GetDateTime(118); } //集港日期
//if (!sqlRead.IsDBNull(121)) { TopSeaiEntity.MBLFRT = sqlRead.GetString(121); } //MBL付费方式
//if (!sqlRead.IsDBNull(123)) { TopSeaiEntity.STLNAME = sqlRead.GetString(123); } //结算方式
//if (!sqlRead.IsDBNull(124)) { TopSeaiEntity.STLDATE = sqlRead.GetDateTime(124); } //结算日期
//if (!sqlRead.IsDBNull(126)) { TopSeaiEntity.OPERATORCODE = sqlRead.GetString(126); } //客户操作代码
//if (!sqlRead.IsDBNull(127)) { TopSeaiEntity.OPERATOR = sqlRead.GetString(127); } //客户操作名称
//if (!sqlRead.IsDBNull(128)) { TopSeaiEntity.OPERATOREMAIL = sqlRead.GetString(128); } //操作电子邮箱
//if (!sqlRead.IsDBNull(129)) { TopSeaiEntity.OPERATORTEL = sqlRead.GetString(129); } //操作电话
//if (!sqlRead.IsDBNull(130)) { TopSeaiEntity.OPERATORFAX = sqlRead.GetString(130); } //操作传真
//if (!sqlRead.IsDBNull(131)) { TopSeaiEntity.FINANCIALSTAFFCODE = sqlRead.GetString(131); } //客户财务代码
//if (!sqlRead.IsDBNull(132)) { TopSeaiEntity.FINANCIALSTAFF = sqlRead.GetString(132); } //客户财务名称
//if (!sqlRead.IsDBNull(133)) { TopSeaiEntity.FINANCIALSTAFFEMAIL = sqlRead.GetString(133); } //财务电子邮箱
//if (!sqlRead.IsDBNull(134)) { TopSeaiEntity.FINANCIALSTAFFTEL = sqlRead.GetString(134); } //财务电话
//if (!sqlRead.IsDBNull(135)) { TopSeaiEntity.FINANCIALSTAFFFAX = sqlRead.GetString(135); } //财务传真
//if (!sqlRead.IsDBNull(136)) { TopSeaiEntity.PlACERECEIPTID = sqlRead.GetString(136); }//收货地代码
//if (!sqlRead.IsDBNull(137)) { TopSeaiEntity.SOURCECODE = sqlRead.GetString(137); }//收货地代码
//if (!sqlRead.IsDBNull(138)) { TopSeaiEntity.ISCONTAINERSOC = sqlRead.GetBoolean(138); }//
//if (!sqlRead.IsDBNull(139)) { TopSeaiEntity.DPAGE = sqlRead.GetString(139); }//
//if (!sqlRead.IsDBNull(140)) { TopSeaiEntity.DLABEL = sqlRead.GetString(140); }//
//if (!sqlRead.IsDBNull(141)) { TopSeaiEntity.LINKMAN = sqlRead.GetString(141); }//
//if (!sqlRead.IsDBNull(142)) { TopSeaiEntity.VESSELID = sqlRead.GetString(142); }//
//if (!sqlRead.IsDBNull(143)) { TopSeaiEntity.ISSUEPLACEID = sqlRead.GetString(143); }//
#endregion
}
}
catch (Exception exceError)
{
//抛出异常
throw exceError;
}
}
return TopSeaiEntity;
}
#endregion
public int InsertTopSeaes(IList<TopSeaiEntity> tempTopSeaeEntities,string strUserID)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
int result = 0;
//判断是否有值
if (tempTopSeaeEntities[0].BSNO != null)
{
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
foreach (TopSeaiEntity TopSeae in tempTopSeaeEntities)
{
if (TopSeae.BSNO != null)
{
string alt = "";
alt = T_ALL_DA.GetStrSQL("MBLNO", "select MBLNO from op_seai where MBLNO='" + TopSeae.MBLNO.Trim() + "'");
if (alt.Trim() == "")
{
result = InserInfo(TopSeae, strUserID);
}
else
{
result = UpdateInfo(TopSeae,strUserID);
}
}
}
sqlTran.Commit();
result = 1;//状态为1表示插入成功
}
catch (Exception execError)
{
result = -1;//有异常,插入失败
sqlTran.Rollback();
result = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
}
return result;
}
public int InsertTopSeaesHBLNOCUSTNO(TopSeaiEntity infoEntity, String strCompanyID, String strUserID)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
int result = 0;
//判断是否有值
if (infoEntity != null)
{
if (infoEntity.BSNO.ToString().Trim() != "")
{
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
string alt = "";
if (infoEntity.HBLNO.ToString().Trim() == "")
{
infoEntity.HBLNO = getCodeRule("分提单号", "HBLNO", infoEntity.ETD.ToString().Trim(), infoEntity.ACCDATE.ToString().Trim(), infoEntity.INPUTBY.ToString().Trim(), strCompanyID);//调用编码规则
}
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + infoEntity.HBLNO.ToString().Trim() + "'");
if (alt.Trim() != "")
{
infoEntity.HBLNO = getCodeRule("分提单号", "HBLNO", infoEntity.ETD.ToString().Trim(), infoEntity.ACCDATE.ToString().Trim(), infoEntity.INPUTBY.ToString().Trim(), strCompanyID);//调用编码规则
}
//
if (infoEntity.CUSTNO.ToString().Trim() == "")
{
infoEntity.CUSTNO = getCodeRule("委托编号", "CUSTNO", infoEntity.ETD.ToString().Trim(), infoEntity.ACCDATE.ToString().Trim(), infoEntity.INPUTBY.ToString().Trim(), strCompanyID);//调用编码规则
}
alt = T_ALL_DA.GetStrSQL("CUSTNO", "select CUSTNO from [op_seai] where CUSTNO='" + infoEntity.CUSTNO.ToString().Trim() + "'");
if (alt.Trim() != "")
{
infoEntity.CUSTNO = getCodeRule("委托编号", "CUSTNO", infoEntity.ETD.ToString().Trim(), infoEntity.ACCDATE.ToString().Trim(), infoEntity.INPUTBY.ToString().Trim(), strCompanyID);//调用编码规则
}
//
result = InserInfo(infoEntity, strUserID);
sqlTran.Commit();
//result = 1;//状态为1表示插入成功
}
catch (Exception execError)
{
result = -1;//有异常,插入失败
sqlTran.Rollback();
result = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
}
}
return result;
}
public int UpdateTopSeaesHBLNOCUSTNO(TopSeaiEntity infoEntity,string strCompanyID)
{
T_ALL_DA T_ALL_DA = new T_ALL_DA();
int result = 0;
//判断是否有值
if (infoEntity != null)
{
if (infoEntity.BSNO.ToString().Trim() != "")
{
TopSeaiEntity TopSeaiEntity1 = new TopSeaiEntity();
TopSeaiEntity1 = GetID(infoEntity.BSNO.ToString().Trim());
string strUserID = T_ALL_DA.GetStrSQL("GID", "select GID from [user] where SHOWNAME='" + TopSeaiEntity1.INPUTBY.ToString().Trim() + "' and DELETEUSER='False'");
DateTime fwqdate = System.Convert.ToDateTime(T_ALL_DA.GetStrSQL("fwqdate", "select fwqdate=getdate()"));
string sCODENAME = T_ALL_DA.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
string sDEPTNO = T_ALL_DA.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
//
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
string alt = "";
string strRULENAME = "";
string strfield="";
string strETD = TopSeaiEntity1.ACCDATE.ToString().Trim();
string strACCDATE = TopSeaiEntity1.ACCDATE.ToString().Trim();
if (strETD.Trim().IndexOf("0001")>-1)
{
strETD = "";
}
//调用编码规则
string strRULEYEAR = "";
string strRULECONTENT = "";
string strCODENAME = "";
string strDEPTNO = "";
string strRULENOLENGTH = "";
int iRULENOLENGTH = 0;
int inum = 0;
string strCONTENT = "";
//
DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=2");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("业务日期"))
{
if (strETD.Trim() == "")
{
//return "";
}
DateTime dETD = System.Convert.ToDateTime(strETD.Trim());
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy") + dETD.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy") + dETD.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("会计期间"))
{
if (strACCDATE.Trim() == "")
{
//return "";
}
DateTime dACCDATE = System.Convert.ToDateTime(strACCDATE.Trim() + "-01");
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy") + dACCDATE.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy") + dACCDATE.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("自然月份"))
{
//DateTime fwqdate = System.Convert.ToDateTime(T_ALL_DA.GetStrSQL("fwqdate", "select fwqdate=getdate()"));
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy") + fwqdate.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy") + fwqdate.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy");
}
}
}
//
if (ds.Tables[0].Rows[0]["ISCOMPANY"].ToString().Trim().Equals("True"))
{
//strCODENAME = T_ALL_DA.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
strCODENAME = sCODENAME;
}
if (ds.Tables[0].Rows[0]["ISDEPT"].ToString().Trim().Equals("True"))
{
//strDEPTNO = T_ALL_DA.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
strDEPTNO = sDEPTNO;
}
strRULECONTENT = ds.Tables[0].Rows[0]["RULECONTENT"].ToString().Trim();
strRULECONTENT = strRULECONTENT.Replace("《COMPANY》", strCODENAME);
strRULECONTENT = strRULECONTENT.Replace("《DEPT》", strDEPTNO);
//
iRULENOLENGTH = int.Parse(ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim());
strCONTENT = strRULECONTENT + strRULEYEAR;
//获取分公司的票号头字符
string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
strCONTENT = tempBANKSHEAD + strCONTENT;
//
strRULENOLENGTH = T_ALL_DA.GetStrSQL(strfield, "select top 1 " + strfield + " from [op_seai] where " + strfield + " like '" + strCONTENT.Trim() + "%' order by " + strfield + " DESC");
if (strRULENOLENGTH == "")
{
strRULENOLENGTH = "1";
}
else
{
strRULENOLENGTH = strRULENOLENGTH.Replace(strCONTENT.Trim(), "");
inum = int.Parse(strRULENOLENGTH.Trim());
inum = inum + 1;
strRULENOLENGTH = inum.ToString();
}
int j = iRULENOLENGTH - strRULENOLENGTH.Length;
for (int i = 1; i <= j; i++)
{
strRULENOLENGTH = "0" + strRULENOLENGTH;
}
//
strCONTENT = strCONTENT + strRULENOLENGTH;
//return strCONTENT;
}
}
}
//return "";
if (infoEntity.HBLNO.ToString().Trim() == "")
{
if (TopSeaiEntity1.HBLNO.ToString().Trim() == "")
{
infoEntity.HBLNO = getCodeRule("分提单号", "HBLNO", TopSeaiEntity1.ETD.ToString().Trim(), TopSeaiEntity1.ACCDATE.ToString().Trim(), strUserID.Trim(), strCompanyID);//调用编码规则
}
else
{
infoEntity.HBLNO = TopSeaiEntity1.HBLNO;
}
}
else
{
alt = T_ALL_DA.GetStrSQL("HBLNO", "select HBLNO from [op_seai] where HBLNO='" + infoEntity.HBLNO.ToString().Trim() + "' and BSNO<>'" + infoEntity.BSNO.ToString().Trim().ToString().Trim() + "'");
if (alt.Trim() != "")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key5", "<script>alert('分提单号重复!');</script>");
result=8;
}
}
//
if (infoEntity.CUSTNO.ToString().Trim() == "")
{
if (TopSeaiEntity1.CUSTNO.ToString().Trim() == "")
{
infoEntity.CUSTNO = getCodeRule("委托编号", "CUSTNO", TopSeaiEntity1.ETD.ToString().Trim(), TopSeaiEntity1.ACCDATE.ToString().Trim(), strUserID.Trim(), strCompanyID);//调用编码规则
}
else
{
infoEntity.CUSTNO = TopSeaiEntity1.CUSTNO;
}
}
else
{
alt = T_ALL_DA.GetStrSQL("CUSTNO", "select CUSTNO from [op_seai] where CUSTNO='" + infoEntity.CUSTNO.ToString().Trim() + "' and BSNO<>'" + infoEntity.BSNO.ToString().Trim().ToString().Trim() + "'");
if (alt.Trim() != "")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "key6", "<script>alert('委托编号重复!');</script>");
result=9;
}
}
//
if (result == 0)
{
result = UpdateInfo(infoEntity, strUserID);
}
sqlTran.Commit();
//result = 1;//状态为1表示插入成功
}
catch (Exception execError)
{
result = -1;//有异常,插入失败
sqlTran.Rollback();
result = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
}
}
return result;
}
/// <summary>
/// 插入信息
/// </summary>
/// <param name="TopSeaiEntity">实体类</param>
/// <returns>值为1插入数据正常,-1操作异常</returns>
public int InserInfo(TopSeaiEntity infoEntity,string strUserID)
{
int iResult = 0;
//获取参数
SqlParameter[] parms = GetInsertParms();
parms[0].Value = infoEntity.BSNO;//业务编号
parms[1].Value = infoEntity.ORDERTYPE;//委托方式
parms[2].Value = infoEntity.MASTERNO;//主编号
parms[3].Value = infoEntity.CUSTNO;//委托编号
parms[4].Value = infoEntity.MBLNO;//主提单号
parms[5].Value = infoEntity.HBLNO;//分提单号
parms[6].Value = infoEntity.BSSTATUS;//业务状态
parms[7].Value = infoEntity.FEESTATUS;//费用状态
parms[8].Value = infoEntity.ACCDATE;//会计期间
parms[9].Value = infoEntity.CUSTOMERNAME;//委托单位
parms[10].Value = infoEntity.BSSOURCE;//业务来源
parms[11].Value = infoEntity.BSSOURCEDETAIL;//来源明细
parms[12].Value = infoEntity.INPUTBY;//录入人
parms[13].Value = infoEntity.OP;//操作员
parms[14].Value = infoEntity.CUSTSERVICE;//客服员
parms[15].Value = infoEntity.SALE;//揽货人
parms[16].Value = infoEntity.CORPID;//分公司代码
parms[17].Value = infoEntity.SALEDEPT;//所属部门
parms[18].Value = infoEntity.VESSEL;//船名
parms[19].Value = infoEntity.VOYNO;//航次
parms[20].Value = infoEntity.PORTLOADID;//装货港代码
parms[21].Value = infoEntity.PORTLOAD;//装货港
parms[22].Value = infoEntity.PORTDISCHARGEID;//卸货港代码
parms[23].Value = infoEntity.PORTDISCHARGE;//卸货港
parms[24].Value = infoEntity.CNTRNO;//集装箱大写
parms[25].Value = infoEntity.CNTR1;//箱型1
parms[26].Value = infoEntity.CNTR2;//箱型2
parms[27].Value = infoEntity.CNTR3;//箱型3
parms[28].Value = infoEntity.CNTR4;//箱型4
parms[29].Value = infoEntity.CNTR5;//箱型5
parms[30].Value = infoEntity.CNTR6;//箱型6
parms[31].Value = infoEntity.CNTR7;//箱型7
parms[32].Value = infoEntity.CNTR8;//箱型8
parms[33].Value = infoEntity.CNTR9;//箱型9
parms[34].Value = infoEntity.CNTR10;//箱型10
parms[35].Value = infoEntity.OTCNTR;//其他箱型
parms[36].Value = infoEntity.TEU;//箱TEU
parms[37].Value = infoEntity.CNTRTOTAL;//集装箱全部内容
parms[38].Value = infoEntity.GOODSNAME;//品名
parms[39].Value = infoEntity.COUNTRYOFORIGIN;//原产地
parms[40].Value = infoEntity.NUMBERPLATE;//牌号
parms[41].Value = infoEntity.CONTRACTNO;//合同号
//parms[42].Value = infoEntity.UNITS;//单位
parms[42].Value = infoEntity.BALES;//包装
parms[43].Value = infoEntity.KGS;//毛重
parms[44].Value = infoEntity.NETWEIGHT;//净重
parms[45].Value = infoEntity.CUSTOMSER;//报关行
parms[46].Value = infoEntity.CUSTOMNO;//报关单号
parms[47].Value = infoEntity.INSPECTION;//报检
parms[48].Value = infoEntity.INSPECTIONNO;//报检单号
parms[49].Value = infoEntity.FBP;//免箱期
parms[50].Value = infoEntity.UNITOFWEIGHT;//计费单位
parms[51].Value = infoEntity.PKGS;//件数
parms[52].Value = infoEntity.MT;
parms[53].Value = infoEntity.KINDPKGS;//包装
parms[54].Value = infoEntity.TRADINGAGENCY;//贸易代理
parms[55].Value = infoEntity.GOODSTYPENAME;//品名类型
parms[56].Value = infoEntity.TRADETYPE;//贸易方式
parms[57].Value = infoEntity.SHOWNAME;//客户联系人
parms[58].Value = infoEntity.EMAIL;
parms[59].Value = infoEntity.TEL;
parms[60].Value = infoEntity.FAX;
parms[61].Value = infoEntity.APPROVENO; //审批单号
parms[62].Value = infoEntity.REMARK;//备注
parms[63].Value = infoEntity.GRADE;
parms[64].Value = infoEntity.STORAGENAME;
parms[65].Value = infoEntity.ISFORCEDTODESPATCH;
parms[66].Value = infoEntity.BSKGS;
parms[67].Value = infoEntity.ACTUALKGS;
parms[68].Value = infoEntity.DRAFTKGS;
parms[69].Value = infoEntity.WHARFSKGS;
parms[70].Value = infoEntity.WMSINKGS;
parms[71].Value = infoEntity.YARD;
parms[72].Value = infoEntity.WMSOUTKGS;
parms[73].Value = infoEntity.DIFFERENCEKGS;
parms[74].Value = infoEntity.WATERCONTENT;
parms[75].Value = infoEntity.WATERDENSITY;
parms[76].Value = infoEntity.BLTYPE;
parms[77].Value = infoEntity.CBM;
parms[78].Value = infoEntity.IMPORTVALUE;
parms[79].Value = infoEntity.UNITPRICE;
parms[80].Value = infoEntity.CURRENCY;
parms[81].Value = infoEntity.LEVELS;
parms[82].Value = infoEntity.BSTYPE;
parms[83].Value = infoEntity.PARENTID;
parms[84].Value = infoEntity.CARRIER;
parms[85].Value = infoEntity.TRUCKER;
parms[86].Value = infoEntity.WMSTYPE;
//parms[2].Value = model.NOR;
//parms[61].Value = infoEntity.TARRIFSPAIEDTIEM; //交关税时间
//parms[50].Value = infoEntity.INSPECTIONDATE;//报检日期
//parms[51].Value = infoEntity.CUSTOMDATE;//报关日期
//parms[52].Value = infoEntity.ETD;//到港日期
//parms[53].Value = infoEntity.BSDATE;//接单日期
//parms[54].Value = infoEntity.BMDDATE;//箱使到期日期
//parms[55].Value = infoEntity.MDTDATE;//搬倒日期
string strTARRIFSPAIEDTIEM = infoEntity.TARRIFSPAIEDTIEM.ToString().IndexOf("0001") > -1 ? "" : "'" + infoEntity.TARRIFSPAIEDTIEM.ToString() + "',";
string strTARRIFSPAIEDTIEM_name = strTARRIFSPAIEDTIEM.Equals("") ? "" : "TARRIFSPAIEDTIEM,";
string strBSDATE = infoEntity.BSDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.BSDATE.ToString() + "',";
string strBSDATE_name = strBSDATE.Equals("") ? "" : "BSDATE,";
string strETD = infoEntity.ETD.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.ETD.ToString() + "',";
string strETD_name = strETD.Equals("") ? "" : "ETD,";
string strCUSTOMDATE = infoEntity.CUSTOMDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.CUSTOMDATE.ToString() + "',";
string strCUSTOMDATE_name = strCUSTOMDATE.Equals("") ? "" : "CUSTOMDATE,";
string strINSPECTIONDATE = infoEntity.INSPECTIONDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.INSPECTIONDATE.ToString() + "',";
string strINSPECTIONDATE_name = strINSPECTIONDATE.Equals("") ? "" : "INSPECTIONDATE,";
string strBMDDATE = infoEntity.BMDDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.BMDDATE.ToString() + "',";
string strBMDDATE_name = strBMDDATE.Equals("") ? "" : "BMDDATE,";
string strMDTDATE = infoEntity.MDTDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.MDTDATE.ToString() + "',";
string strMDTDATE_name = strMDTDATE.Equals("") ? "" : "MDTDATE,";
string strNOR = infoEntity.NOR.ToString().IndexOf("0001") > -1 ? "" : "'" + infoEntity.NOR.ToString() + "',";
string strNOR_name = strNOR.Equals("") ? "" : "NOR,";
string strUPDATETIME = infoEntity.UPDATETIME.ToString().IndexOf("0001") > -1 ? "" : ",'"+infoEntity.UPDATETIME.ToString()+"'";
string strUPDATETIME_name = strUPDATETIME.Equals("") ? "" : ",UPDATETIME";
strSql = String.Format(strSql, strINSPECTIONDATE_name, strINSPECTIONDATE, strCUSTOMDATE_name, strCUSTOMDATE, strETD_name, strETD, strBSDATE_name, strBSDATE, strBMDDATE_name, strBMDDATE, strMDTDATE_name, strMDTDATE, strTARRIFSPAIEDTIEM_name, strTARRIFSPAIEDTIEM, strNOR_name, strNOR,strUPDATETIME_name,strUPDATETIME);
#region op_seai暂时不用
//parms[8].Value = infoEntity.TRANSNO;//运单号
//parms[10].Value = infoEntity.BLTYPE;//装运方式
//parms[11].Value = infoEntity.SHIPPERID;//发货人
//parms[12].Value = infoEntity.CONSIGNEEID;//收货人
//parms[13].Value = infoEntity.NOTIFYPARTYID;//通知人
//parms[14].Value = infoEntity.SHIPPER;//发货人内容
//parms[15].Value = infoEntity.CONSIGNEE;//收货人内容
//parms[16].Value = infoEntity.NOTIFYPARTY;//通知人内容
//parms[17].Value = infoEntity.AGENTID;//国外代理
//parms[18].Value = infoEntity.AGENT;//国外代理内容
//parms[22].Value = infoEntity.PlACERECEIPT;//收货地
//parms[27].Value = infoEntity.PLACEDELIVERYID;//交货地代码
//parms[28].Value = infoEntity.PLACEDELIVERY;//交货地
//parms[29].Value = infoEntity.DESTINATIONID;//目的地代码
//parms[30].Value = infoEntity.DESTINATION;//目的地
//parms[31].Value = infoEntity.NOBILL;//提单份数
//parms[32].Value = infoEntity.ISSUETYPE;//签单方式
//parms[33].Value = infoEntity.ISSUEPLACE;//签单地点
//parms[34].Value = infoEntity.BLFRT;//付费方式
//parms[35].Value = infoEntity.PREPARDAT;//预付地点
//parms[36].Value = infoEntity.PAYABLEAT;//到付地点
//parms[37].Value = infoEntity.SERVICE;//运输条款
//parms[38].Value = infoEntity.MARKS;//唛头
//parms[39].Value = infoEntity.CNTRSEALNO;//箱号封号
//parms[40].Value = infoEntity.NOPKGS;//件数包装
//parms[41].Value = infoEntity.DESCRIPTION;//货物描述
//parms[43].Value = infoEntity.GROSSWEIGHT;//货物毛重
//parms[44].Value = infoEntity.MEASUREMENT;//货物尺码
//parms[48].Value = infoEntity.CBM;//尺码
//parms[49].Value = infoEntity.TOTALNO;//件数大写
//parms[67].Value = infoEntity.LANE;//航线
//parms[69].Value = infoEntity.CARRIER;//船公司
//parms[70].Value = infoEntity.FORWARDER;//订舱代理
//parms[72].Value = infoEntity.TRUCKER;//承运车队
//parms[73].Value = infoEntity.INVNO;//发票号
//parms[74].Value = infoEntity.CARGOID;//货物标识;//CHAR
//parms[75].Value = infoEntity.DCLASS;//危险品分类/等级
//parms[76].Value = infoEntity.DUNNO;//危险品编号
//parms[77].Value = infoEntity.REEFERF;//冷藏通风量
//parms[78].Value = infoEntity.TEMPID;//温度单位;//char
//parms[79].Value = infoEntity.TEMPSET;//设置温度
//parms[80].Value = infoEntity.TEMPMAX;//最高温度
//parms[81].Value = infoEntity.TEMPMIN;//最低温度
//parms[84].Value = infoEntity.CUSTOMSNUM;//报关票数
//parms[86].Value = infoEntity.ORDTYPE;//订舱类型
//parms[87].Value = infoEntity.ORDERNO;//订舱编号
//parms[88].Value = infoEntity.INSURANCEER;//保险人
//parms[89].Value = infoEntity.INSURANCENO;//保险单号
//parms[90].Value = infoEntity.INAMOUT;//保险金额
//parms[91].Value = infoEntity.ISVOU;//是否生成凭证
//parms[92].Value = infoEntity.VOUNO;//凭证号
//parms[94].Value = infoEntity.STATUS1;//状态1
//parms[95].Value = infoEntity.STATUS2;//状态2
//parms[96].Value = infoEntity.STATUS3;//状态3
//parms[97].Value = infoEntity.STATUS4;//状态4
//parms[98].Value = infoEntity.STATUS5;//状态5
//parms[99].Value = infoEntity.ISFUMIGATION;//熏蒸
//parms[100].Value = infoEntity.ISSTORAGE;//仓储
//parms[101].Value = infoEntity.ISLAND;//陆运
//parms[102].Value = infoEntity.ISCUSTOMS;//报关
//parms[103].Value = infoEntity.ISINSPECTION;//报检
//parms[104].Value = infoEntity.DOC;//单证
//parms[105].Value = infoEntity.PACKINGTYPE;//装箱类型
//parms[106].Value = infoEntity.WAREHOUSE;//仓库
//parms[109].Value = infoEntity.MBLFRT;//MBL付费方式
//parms[110].Value = infoEntity.ISBOOKING;//订舱
//parms[111].Value = infoEntity.ISAGENT;//使用代理
//parms[112].Value = infoEntity.ISHBLNO;//分单签单
//parms[113].Value = infoEntity.SERVICE9;//服务项目9
//parms[114].Value = infoEntity.SERVICE10;//服务项目10
//parms[115].Value = infoEntity.STLNAME;//结算方式
//parms[117].Value = infoEntity.OPERATORCODE;// 客户操作代码
//parms[118].Value = infoEntity.OPERATOR;// 客户操作名称
//parms[119].Value = infoEntity.OPERATOREMAIL;// 操作电子邮箱
//parms[120].Value = infoEntity.OPERATORTEL;// 操作电话
//parms[121].Value = infoEntity.OPERATORFAX;// 操作传真
//parms[122].Value = infoEntity.FINANCIALSTAFFCODE;// 客户财务代码
//parms[123].Value = infoEntity.FINANCIALSTAFF;// 客户财务名称
//parms[124].Value = infoEntity.FINANCIALSTAFFEMAIL;// 财务电子邮箱
//parms[125].Value = infoEntity.FINANCIALSTAFFTEL;// 财务电话
//parms[126].Value = infoEntity.FINANCIALSTAFFFAX;// 财务传真
//parms[127].Value = infoEntity.PlACERECEIPTID;// 收货地代码
//parms[128].Value = infoEntity.SOURCECODE;//
//parms[129].Value = infoEntity.ISCONTAINERSOC;//
//parms[130].Value = infoEntity.DPAGE;//
//parms[131].Value = infoEntity.DLABEL;//
//parms[132].Value = infoEntity.LINKMAN;//
//parms[133].Value = infoEntity.VESSELID;//
//parms[134].Value = infoEntity.ISSUEPLACEID;//
////parms[116].Value = infoEntity.STLDATE;//结算日期
////parms[111].Value = infoEntity.CLOSINGDATE;//截港日期
////parms[112].Value = infoEntity.ETA;//预抵日期
////parms[113].Value = infoEntity.ISSUEDATE;//签单日期
////parms[114].Value = infoEntity.CLOSEDOCDATE;//截单日期
////parms[115].Value = infoEntity.INTOPORTDATE;//集港日期
//string strETA = infoEntity.ETA.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.ETA.ToString() + "',";
//string strETA_name = strETA.Equals("") ? "" : "ETA,";
//string strCLOSINGDATE = infoEntity.CLOSINGDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.CLOSINGDATE.ToString() + "',";
//string strCLOSINGDATE_name = strCLOSINGDATE.Equals("") ? "" : "CLOSINGDATE,";
//string strISSUEDATE = infoEntity.ISSUEDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.ISSUEDATE.ToString() + "',";
//string strISSUEDATE_name = strISSUEDATE.Equals("") ? "" : "ISSUEDATE,";
//string strCLOSEDOCDATE = infoEntity.CLOSEDOCDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.CLOSEDOCDATE.ToString() + "',";
//string strCLOSEDOCDATE_name = strCLOSEDOCDATE.Equals("") ? "" : "CLOSEDOCDATE,";
//string strINTOPORTDATE = infoEntity.INTOPORTDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.INTOPORTDATE.ToString() + "',";
//string strINTOPORTDATE_name = strINTOPORTDATE.Equals("") ? "" : "INTOPORTDATE,";
//string strSTLDATE = infoEntity.STLDATE.ToString().IndexOf("0001")>-1 ? "" : "'" + infoEntity.STLDATE.ToString() + "',";
//string strSTLDATE_name = strSTLDATE.Equals("") ? "" : "STLDATE,";
//strSql = String.Format(strSql, strETA_name, strETA, strETD_name, strETD, strCLOSINGDATE_name, strCLOSINGDATE, strISSUEDATE_name, strISSUEDATE, strCLOSEDOCDATE_name, strCLOSEDOCDATE, strINTOPORTDATE_name, strINTOPORTDATE, strSTLDATE_name, strSTLDATE);
#endregion
//
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql, parms);
if (existVal > 0)
{
iResult = 1;
//
string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('添加海运进口业务','插入操作','主提单号:" + infoEntity.MBLNO + "','" + strUserID + "')";
bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
//
if (infoEntity.BSTYPE.ToString().Trim() == "分单")
{
str0 = "update op_seai set BSTYPE='主单' where bsno='" + infoEntity.MASTERNO.ToString().Trim() + "' and BSTYPE<>'主单'";
bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
/// <summary>
/// 更新信息
/// </summary>
/// <param name="TopSeaiEntity">实体类</param>
/// <returns>值为1更新数据正常,-1操作异常</returns>
public int UpdateInfo(TopSeaiEntity infoEntity, string strUserID)
{
int iResult = 0;
//string strUPDATETIME = infoEntity.UPDATETIME.ToString().IndexOf("0001") > -1 ? "" : "'"+infoEntity.UPDATETIME.ToString()+"'";
//获取参数
SqlParameter[] parms = GetUpdateParms();
parms[0].Value = infoEntity.BSNO;//业务编号
parms[1].Value = infoEntity.CUSTNO;//委托编号
parms[2].Value = infoEntity.MBLNO;//主提单号
parms[3].Value = infoEntity.HBLNO;//分提单号
parms[4].Value = infoEntity.BSSTATUS;//业务状态
parms[5].Value = infoEntity.FEESTATUS;//费用状态
parms[6].Value = infoEntity.CUSTOMERNAME;//委托单位
parms[7].Value = infoEntity.BSSOURCE;//业务来源
parms[8].Value = infoEntity.BSSOURCEDETAIL;//来源明细
parms[9].Value = infoEntity.OP;//操作员
parms[10].Value = infoEntity.CUSTSERVICE;//客服员
parms[11].Value = infoEntity.SALE;//揽货人
parms[12].Value = infoEntity.CORPID;//分公司代码
parms[13].Value = infoEntity.SALEDEPT;//所属部门
parms[14].Value = infoEntity.VESSEL;//船名
parms[15].Value = infoEntity.VOYNO;//航次
parms[16].Value = infoEntity.PORTLOADID;//装货港代码
parms[17].Value = infoEntity.PORTLOAD;//装货港
parms[18].Value = infoEntity.PORTDISCHARGEID;//卸货港代码
parms[19].Value = infoEntity.PORTDISCHARGE;//卸货港
parms[20].Value = infoEntity.CNTRNO;//集装箱大写
parms[21].Value = infoEntity.CNTR1;//箱型1
parms[22].Value = infoEntity.CNTR2;//箱型2
parms[23].Value = infoEntity.CNTR3;//箱型3
parms[24].Value = infoEntity.CNTR4;//箱型4
parms[25].Value = infoEntity.CNTR5;//箱型5
parms[26].Value = infoEntity.CNTR6;//箱型6
parms[27].Value = infoEntity.CNTR7;//箱型7
parms[28].Value = infoEntity.CNTR8;//箱型8
parms[29].Value = infoEntity.CNTR9;//箱型9
parms[30].Value = infoEntity.CNTR10;//箱型10
parms[31].Value = infoEntity.OTCNTR;//其他箱型
parms[32].Value = infoEntity.TEU;//箱TEU
parms[33].Value = infoEntity.CNTRTOTAL;//集装箱全部内容
parms[34].Value = infoEntity.GOODSNAME;//品名
parms[35].Value = infoEntity.COUNTRYOFORIGIN;//原产地
parms[36].Value = infoEntity.NUMBERPLATE;//牌号
parms[37].Value = infoEntity.CONTRACTNO;//合同号
//parms[38].Value = infoEntity.UNITS;//单位
parms[38].Value = infoEntity.BALES;//包装
parms[39].Value = infoEntity.KGS;//毛重
parms[40].Value = infoEntity.NETWEIGHT;//净重
parms[41].Value = infoEntity.CUSTOMSER;//报关行
parms[42].Value = infoEntity.CUSTOMNO;//报关单号
parms[43].Value = infoEntity.INSPECTION;//报检
parms[44].Value = infoEntity.INSPECTIONNO;//报检单号
parms[45].Value = infoEntity.FBP;//免箱期
parms[46].Value = infoEntity.UNITOFWEIGHT;//计费单位
parms[47].Value = infoEntity.PKGS;//件数
parms[48].Value = infoEntity.MT;
parms[49].Value = infoEntity.KINDPKGS;
parms[50].Value = infoEntity.TRADINGAGENCY;//贸易代理
parms[51].Value = infoEntity.GOODSTYPENAME;//品名类型
parms[52].Value = infoEntity.TRADETYPE;//贸易方式
parms[53].Value = infoEntity.SHOWNAME;//客户联系人
parms[54].Value = infoEntity.EMAIL;
parms[55].Value = infoEntity.TEL;
parms[56].Value = infoEntity.FAX;
parms[57].Value = infoEntity.APPROVENO; //审批单号
parms[58].Value = infoEntity.REMARK; //审批单号
parms[59].Value = infoEntity.GRADE;
parms[60].Value = infoEntity.STORAGENAME;
parms[61].Value = infoEntity.ISFORCEDTODESPATCH;
parms[62].Value = infoEntity.BSKGS;
parms[63].Value = infoEntity.ACTUALKGS;
parms[64].Value = infoEntity.DRAFTKGS;
parms[65].Value = infoEntity.WHARFSKGS;
parms[66].Value = infoEntity.WMSINKGS;
parms[67].Value = infoEntity.YARD;
parms[68].Value = infoEntity.WMSOUTKGS;
parms[69].Value = infoEntity.DIFFERENCEKGS;
parms[70].Value = infoEntity.WATERCONTENT;
parms[71].Value = infoEntity.WATERDENSITY;
parms[72].Value = infoEntity.BLTYPE;
parms[73].Value = infoEntity.ACCDATE;//会计期间
parms[74].Value = infoEntity.CBM;
parms[75].Value = infoEntity.IMPORTVALUE;
parms[76].Value = infoEntity.UNITPRICE;
parms[77].Value = infoEntity.CURRENCY;
parms[78].Value = infoEntity.BSTYPE;
parms[79].Value = infoEntity.CARRIER;
parms[80].Value = infoEntity.TRUCKER;
parms[81].Value = infoEntity.WMSTYPE;
//parms[2].Value = model.NOR;
//parms[57].Value = infoEntity.TARRIFSPAIEDTIEM; //交关税时间
//parms[46].Value = infoEntity.INPUTBY;//录入人
//parms[48].Value = infoEntity.ORDERTYPE;//委托方式
//parms[49].Value = infoEntity.INSPECTIONDATE;//报检日期
//parms[50].Value = infoEntity.CUSTOMDATE;//报关日期
//parms[51].Value = infoEntity.ETD;//到港日期
//parms[52].Value = infoEntity.BSDATE;//接单日期
//parms[54].Value = infoEntity.BMDDATE;//箱使到期日期
//parms[55].Value = infoEntity.MDTDATE;//搬倒日期
string strTARRIFSPAIEDTIEM = infoEntity.TARRIFSPAIEDTIEM.ToString().IndexOf("0001") > -1 ? "null," : "'" + infoEntity.TARRIFSPAIEDTIEM.ToString() + "',";
string strTARRIFSPAIEDTIEM_name = "TARRIFSPAIEDTIEM=";
string strBSDATE = infoEntity.BSDATE.ToString().IndexOf("0001")>-1 ? "null," : "'" + infoEntity.BSDATE.ToString() + "',";
string strBSDATE_name = "BSDATE=";
string strETD = infoEntity.ETD.ToString().IndexOf("0001")>-1 ? "null," : "'" + infoEntity.ETD.ToString() + "',";
string strETD_name = "ETD=";
string strCUSTOMDATE = infoEntity.CUSTOMDATE.ToString().IndexOf("0001") > -1 ? "null," : "'" + infoEntity.CUSTOMDATE.ToString() + "',";
string strCUSTOMDATE_name = "CUSTOMDATE=";
string strINSPECTIONDATE = infoEntity.INSPECTIONDATE.ToString().IndexOf("0001") > -1 ? "null," : "'" + infoEntity.INSPECTIONDATE.ToString() + "',";
string strINSPECTIONDATE_name = "INSPECTIONDATE=";
string strBMDDATE = infoEntity.BMDDATE.ToString().IndexOf("0001") > -1 ? "null," : "'" + infoEntity.BMDDATE.ToString() + "',";
string strBMDDATE_name = "BMDDATE=";
string strMDTDATE = infoEntity.MDTDATE.ToString().IndexOf("0001") > -1 ? "null," : "'" + infoEntity.MDTDATE.ToString() + "',";
string strMDTDATE_name = "MDTDATE=";
string strNOR = infoEntity.NOR.ToString().IndexOf("0001") > -1 ? "null," : "'" + infoEntity.NOR.ToString() + "',";
string strNOR_name = "NOR=";
string strUPDATETIME = infoEntity.UPDATETIME.ToString().IndexOf("0001") > -1 ? "null" : "'" + infoEntity.UPDATETIME.ToString() + "'";
strSqlUpdateInfo = String.Format(strSqlUpdateInfo, strINSPECTIONDATE_name, strINSPECTIONDATE, strCUSTOMDATE_name, strCUSTOMDATE, strETD_name, strETD, strBSDATE_name, strBSDATE, strBMDDATE_name, strBMDDATE, strMDTDATE_name, strMDTDATE, strTARRIFSPAIEDTIEM_name, strTARRIFSPAIEDTIEM, strNOR_name, strNOR,strUPDATETIME);
//
using (SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction))
{
int existVal = SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSqlUpdateInfo, parms);
if (existVal > 0)
{
iResult = 1;
//
string str0 = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('修改海运进口业务','更新操作','主提单号:" + infoEntity.MBLNO + "','" + strUserID + "')";
bool bl0 = SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, str0);
}
else
{
iResult = -1;//执行异常
}
}
return iResult;
}
#region 生成插入语句参数
/// <summary>
/// 生成插入语句参数
/// </summary>
/// <returns>返回SqlParameter数组</returns>
private SqlParameter[] GetInsertParms()
{
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@BSNO",SqlDbType.VarChar,100),// 业务编号
new SqlParameter("@ORDERTYPE",SqlDbType.VarChar,10),// 委托方式
new SqlParameter("@MASTERNO",SqlDbType.VarChar,100),// 主编号
new SqlParameter("@CUSTNO",SqlDbType.VarChar,30),// 委托编号
new SqlParameter("@MBLNO",SqlDbType.VarChar,30),// 主提单号
new SqlParameter("@HBLNO",SqlDbType.VarChar,30),// 分提单号
new SqlParameter("@BSSTATUS",SqlDbType.Bit),// 业务状态
new SqlParameter("@FEESTATUS",SqlDbType.Bit),// 费用状态
new SqlParameter("@ACCDATE",SqlDbType.VarChar,7),// 会计期间
new SqlParameter("@CUSTOMERNAME",SqlDbType.VarChar,20),// 委托单位
new SqlParameter("@BSSOURCE",SqlDbType.VarChar,36),// 业务来源
new SqlParameter("@BSSOURCEDETAIL",SqlDbType.VarChar,36),// 来源明细
new SqlParameter("@INPUTBY",SqlDbType.VarChar,10),// 录入人
new SqlParameter("@OP",SqlDbType.VarChar,10),// 操作员
new SqlParameter("@CUSTSERVICE",SqlDbType.VarChar,10),// 客服员
new SqlParameter("@SALE",SqlDbType.VarChar,10),// 揽货人
new SqlParameter("@CORPID",SqlDbType.VarChar,36),// 分公司代码
new SqlParameter("@SALEDEPT",SqlDbType.VarChar,20),// 所属部门
new SqlParameter("@VESSEL",SqlDbType.VarChar,60),// 船名
new SqlParameter("@VOYNO",SqlDbType.VarChar,12),// 航次
new SqlParameter("@PORTLOADID",SqlDbType.VarChar,5),// 装货港代码
new SqlParameter("@PORTLOAD",SqlDbType.VarChar,60),// 装货港
new SqlParameter("@PORTDISCHARGEID",SqlDbType.VarChar,5),// 卸货港代码
new SqlParameter("@PORTDISCHARGE",SqlDbType.VarChar,60),// 卸货港
new SqlParameter("@CNTRNO",SqlDbType.VarChar,100),// 集装箱大写
new SqlParameter("@CNTR1",SqlDbType.Int),// 箱型1
new SqlParameter("@CNTR2",SqlDbType.Int),// 箱型2
new SqlParameter("@CNTR3",SqlDbType.Int),// 箱型3
new SqlParameter("@CNTR4",SqlDbType.Int),// 箱型4
new SqlParameter("@CNTR5",SqlDbType.Int),// 箱型5
new SqlParameter("@CNTR6",SqlDbType.Int),// 箱型6
new SqlParameter("@CNTR7",SqlDbType.Int),// 箱型7
new SqlParameter("@CNTR8",SqlDbType.Int),// 箱型8
new SqlParameter("@CNTR9",SqlDbType.Int),// 箱型9
new SqlParameter("@CNTR10",SqlDbType.Int),// 箱型10
new SqlParameter("@OTCNTR",SqlDbType.Int),// 其他箱型
new SqlParameter("@TEU",SqlDbType.Int),// 箱TEU
new SqlParameter("@CNTRTOTAL",SqlDbType.VarChar,100),// 集装箱全部内容
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,30),// 品名
new SqlParameter("@COUNTRYOFORIGIN",SqlDbType.VarChar,60),// 原产地
new SqlParameter("@NUMBERPLATE",SqlDbType.VarChar,100),// 牌号
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),// 合同号
//new SqlParameter("@UNITS",SqlDbType.VarChar,20),// 单位
new SqlParameter("@BALES",SqlDbType.VarChar,20),// 包装
new SqlParameter("@KGS",SqlDbType.Decimal),// 毛重
new SqlParameter("@NETWEIGHT",SqlDbType.Decimal),// 净重
new SqlParameter("@CUSTOMSER",SqlDbType.VarChar,20),// 报关行
new SqlParameter("@CUSTOMNO",SqlDbType.VarChar,1024),// 报关单号
new SqlParameter("@INSPECTION",SqlDbType.VarChar,20),// 报检
new SqlParameter("@INSPECTIONNO",SqlDbType.VarChar,1024),// 报检单号
new SqlParameter("@FBP",SqlDbType.Int),// 免箱期
new SqlParameter("@UNITOFWEIGHT",SqlDbType.VarChar,10),// 计费单位
new SqlParameter("@PKGS",SqlDbType.Int),// 件数
new SqlParameter("@MT",SqlDbType.Decimal),
new SqlParameter("@KINDPKGS",SqlDbType.VarChar,20),
new SqlParameter("@TRADINGAGENCY",SqlDbType.VarChar,20),
new SqlParameter("@GOODSTYPENAME",SqlDbType.VarChar,20),
new SqlParameter("@TRADETYPE",SqlDbType.VarChar,20),
new SqlParameter("@ShowName",SqlDbType.VarChar,20),
new SqlParameter("@Email",SqlDbType.VarChar,20),
new SqlParameter("@Tel",SqlDbType.VarChar,20),
new SqlParameter("@Fax",SqlDbType.VarChar,20),
new SqlParameter("@APPROVENO",SqlDbType.VarChar,20), //审批单号
new SqlParameter("@REMARK",SqlDbType.VarChar,4000),
new SqlParameter("@GRADE", SqlDbType.VarChar,100) ,
new SqlParameter("@STORAGENAME", SqlDbType.VarChar,20) ,
new SqlParameter("@ISFORCEDTODESPATCH", SqlDbType.Bit,1) ,
new SqlParameter("@BSKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@ACTUALKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@DRAFTKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@WHARFSKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@WMSINKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@YARD", SqlDbType.VarChar,20) ,
new SqlParameter("@WMSOUTKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@DIFFERENCEKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@WATERCONTENT", SqlDbType.VarChar,20) ,
new SqlParameter("@WATERDENSITY", SqlDbType.VarChar,20) ,
new SqlParameter("@BLTYPE", SqlDbType.VarChar,8) ,
new SqlParameter("@CBM",SqlDbType.Decimal) ,
new SqlParameter("@IMPORTVALUE",SqlDbType.Decimal,2) ,//货值
new SqlParameter("@UNITPRICE",SqlDbType.Decimal,2) ,//单价
new SqlParameter("@CURRENCY",SqlDbType.VarChar,20) ,//币别
new SqlParameter("@LEVELS",SqlDbType.Int) ,
new SqlParameter("@BSTYPE",SqlDbType.VarChar,10) ,
new SqlParameter("@PARENTID",SqlDbType.VarChar,100),
new SqlParameter("@CARRIER",SqlDbType.VarChar,20),
new SqlParameter("@TRUCKER",SqlDbType.VarChar,20),
new SqlParameter("@WMSTYPE",SqlDbType.VarChar,20)
//new SqlParameter("@NOR", SqlDbType.DateTime) ,
//new SqlParameter("@TARRIFSPAIEDTIEM",SqlDbType.DateTime), //交关税时间
//new SqlParameter("@INSPECTIONDATE",SqlDbType.DateTime),// 报检日期
//new SqlParameter("@CUSTOMDATE",SqlDbType.DateTime),// 报关日期
//new SqlParameter("@ETD",SqlDbType.DateTime),// 到港日期
//new SqlParameter("@CREATETIME",SqlDbType.DateTime),// 创建时间
//new SqlParameter("@BSDATE",SqlDbType.DateTime),// 接单日期
};
return parms;
}
#endregion
#region 生成更新语句参数
/// <summary>
/// 生成更新语句参数
/// </summary>
/// <returns>返回SqlParameter数组</returns>
private SqlParameter[] GetUpdateParms()
{
SqlParameter[] parms = new SqlParameter[]{
new SqlParameter("@BSNO",SqlDbType.VarChar,100),// 业务编号
//new SqlParameter("@ORDERTYPE",SqlDbType.VarChar,10),// 委托方式
//new SqlParameter("@MASTERNO",SqlDbType.VarChar,100),// 主编号
new SqlParameter("@CUSTNO",SqlDbType.VarChar,30),// 委托编号
new SqlParameter("@MBLNO",SqlDbType.VarChar,30),// 主提单号
new SqlParameter("@HBLNO",SqlDbType.VarChar,30),// 分提单号
new SqlParameter("@BSSTATUS",SqlDbType.Bit),// 业务状态
new SqlParameter("@FEESTATUS",SqlDbType.Bit),// 费用状态
new SqlParameter("@CUSTOMERNAME",SqlDbType.VarChar,20),// 委托单位
new SqlParameter("@BSSOURCE",SqlDbType.VarChar,36),// 业务来源
new SqlParameter("@BSSOURCEDETAIL",SqlDbType.VarChar,36),// 来源明细
//new SqlParameter("@INPUTBY",SqlDbType.VarChar,10),// 录入人
new SqlParameter("@OP",SqlDbType.VarChar,10),// 操作员
new SqlParameter("@CUSTSERVICE",SqlDbType.VarChar,10),// 客服员
new SqlParameter("@SALE",SqlDbType.VarChar,10),// 揽货人
new SqlParameter("@CORPID",SqlDbType.VarChar,36),// 分公司代码
new SqlParameter("@SALEDEPT",SqlDbType.VarChar,20),// 所属部门
new SqlParameter("@VESSEL",SqlDbType.VarChar,60),// 船名
new SqlParameter("@VOYNO",SqlDbType.VarChar,12),// 航次
new SqlParameter("@PORTLOADID",SqlDbType.VarChar,5),// 装货港代码
new SqlParameter("@PORTLOAD",SqlDbType.VarChar,60),// 装货港
new SqlParameter("@PORTDISCHARGEID",SqlDbType.VarChar,5),// 卸货港代码
new SqlParameter("@PORTDISCHARGE",SqlDbType.VarChar,60),// 卸货港
new SqlParameter("@CNTRNO",SqlDbType.VarChar,100),// 集装箱大写
new SqlParameter("@CNTR1",SqlDbType.Int),// 箱型1
new SqlParameter("@CNTR2",SqlDbType.Int),// 箱型2
new SqlParameter("@CNTR3",SqlDbType.Int),// 箱型3
new SqlParameter("@CNTR4",SqlDbType.Int),// 箱型4
new SqlParameter("@CNTR5",SqlDbType.Int),// 箱型5
new SqlParameter("@CNTR6",SqlDbType.Int),// 箱型6
new SqlParameter("@CNTR7",SqlDbType.Int),// 箱型7
new SqlParameter("@CNTR8",SqlDbType.Int),// 箱型8
new SqlParameter("@CNTR9",SqlDbType.Int),// 箱型9
new SqlParameter("@CNTR10",SqlDbType.Int),// 箱型10
new SqlParameter("@OTCNTR",SqlDbType.Int),// 其他箱型
new SqlParameter("@TEU",SqlDbType.Int),// 箱TEU
new SqlParameter("@CNTRTOTAL",SqlDbType.VarChar,100),// 集装箱全部内容
new SqlParameter("@GOODSNAME",SqlDbType.VarChar,30),// 品名
new SqlParameter("@COUNTRYOFORIGIN",SqlDbType.VarChar,60),// 原产地
new SqlParameter("@NUMBERPLATE",SqlDbType.VarChar,100),// 牌号
new SqlParameter("@CONTRACTNO",SqlDbType.VarChar,100),// 合同号
//new SqlParameter("@UNITS",SqlDbType.VarChar,20),// 单位
new SqlParameter("@BALES",SqlDbType.VarChar,20),// 包装
new SqlParameter("@KGS",SqlDbType.Decimal),// 毛重
new SqlParameter("@NETWEIGHT",SqlDbType.Decimal),// 净重
new SqlParameter("@CUSTOMSER",SqlDbType.VarChar,20),// 报关行
new SqlParameter("@CUSTOMNO",SqlDbType.VarChar,1024),// 报关单号
new SqlParameter("@INSPECTION",SqlDbType.VarChar,20),// 报检
new SqlParameter("@INSPECTIONNO",SqlDbType.VarChar,1024),// 报检单号
new SqlParameter("@FBP",SqlDbType.Int),// 报检
new SqlParameter("@UNITOFWEIGHT",SqlDbType.VarChar,10),// 报检单号
new SqlParameter("@PKGS",SqlDbType.Int),// 件数
new SqlParameter("@MT",SqlDbType.Decimal),
new SqlParameter("@KINDPKGS",SqlDbType.VarChar,20),
new SqlParameter("@TRADINGAGENCY",SqlDbType.VarChar,20),
new SqlParameter("@GOODSTYPENAME",SqlDbType.VarChar,20),
new SqlParameter("@TRADETYPE",SqlDbType.VarChar,20),
new SqlParameter("@ShowName",SqlDbType.VarChar,20),//客户联系人
new SqlParameter("@Email",SqlDbType.VarChar,20),
new SqlParameter("@Tel",SqlDbType.VarChar,20),
new SqlParameter("@Fax",SqlDbType.VarChar,20),
new SqlParameter("@APPROVENO",SqlDbType.VarChar,20),
new SqlParameter("@REMARK",SqlDbType.VarChar,4000),
new SqlParameter("@GRADE", SqlDbType.VarChar,100) ,
new SqlParameter("@STORAGENAME", SqlDbType.VarChar,20) ,
new SqlParameter("@ISFORCEDTODESPATCH", SqlDbType.Bit,1) ,
new SqlParameter("@BSKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@ACTUALKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@DRAFTKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@WHARFSKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@WMSINKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@YARD", SqlDbType.VarChar,20) ,
new SqlParameter("@WMSOUTKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@DIFFERENCEKGS", SqlDbType.Decimal,9) ,
new SqlParameter("@WATERCONTENT", SqlDbType.VarChar,20) ,
new SqlParameter("@WATERDENSITY", SqlDbType.VarChar,20) ,
new SqlParameter("@BLTYPE", SqlDbType.VarChar,8) ,
new SqlParameter("@ACCDATE",SqlDbType.VarChar,7) ,// 会计期间
new SqlParameter("@CBM",SqlDbType.Decimal) ,
new SqlParameter("@IMPORTVALUE",SqlDbType.Decimal,2) ,//货值
new SqlParameter("@UNITPRICE",SqlDbType.Decimal,2) ,//单价
new SqlParameter("@CURRENCY",SqlDbType.VarChar,20) ,//币别 ,
new SqlParameter("@BSTYPE",SqlDbType.VarChar,10),
new SqlParameter("@CARRIER",SqlDbType.VarChar,20),
new SqlParameter("@TRUCKER",SqlDbType.VarChar,20),
new SqlParameter("@WMSTYPE",SqlDbType.VarChar,20)
//new SqlParameter("@NOR", SqlDbType.DateTime) ,
//new SqlParameter("@INSPECTIONDATE",SqlDbType.DateTime),// 报检日期
//new SqlParameter("@CUSTOMDATE",SqlDbType.DateTime),// 报关日期
//new SqlParameter("@ETD",SqlDbType.DateTime),// 到港日期
//new SqlParameter("@CREATETIME",SqlDbType.DateTime),// 创建时间
//new SqlParameter("@BSDATE",SqlDbType.DateTime),// 接单日期
};
return parms;
}
#endregion
#region 根据SQL语句查询海运出口数据集
/// <summary>
/// 返回 某字段
/// </summary>
/// <returns></returns>
public DataSet GetFieldAll(string strBSNO)
{
string str = "select * from op_seai where BSNO='" + strBSNO + "'";
DataSet DS = SqlHelper.OpenSqlDataSet(SqlHelper.ConnectionStringLocalTransaction, str);
try
{
if (DS.Tables[0].Rows.Count <= 0)
{
DS = null;
}
}
catch
{
DS = null;
}
return DS;
}
#endregion
#region 获取海运出口委托记录总页数
/// <summary>
/// 获取海运出口委托记录总页数
/// </summary>
/// <param name="strSql">sql查询语句</param>
/// <returns>返回int型海运出口委托记录总页数</returns>
public int GetPageTotal(string strSql)
{
int iResult = 0;
using (SqlDataReader sqlRead = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql, null))
{
try
{
while (sqlRead.Read())
{
iResult = sqlRead.GetInt32(0);
}
}
catch (Exception error)
{
throw error;
}
}
return iResult;
}
#endregion
#region 删除委托信息
/// <summary>
/// 删除委托信息
/// </summary>
/// <param name="tempBSNO">委托信息GID</param>
/// <returns>值1表示删除成功 值-1表示有异常删除失败 值-2表示插入异常,事务已回滚成功</returns>
public int DeleteOrder(string tempBSNO)
{
int iResult = 0;
SqlParameter parm = new SqlParameter(PARM_SEAE_BSNO, SqlDbType.VarChar, 100);
parm.Value = tempBSNO;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_DELETE_INFO, parm);
iResult = 1;//状态为1表示删除成功
sqlTran.Commit();
}
catch (Exception execError)
{
iResult = -1;//有异常,删除失败
sqlTran.Rollback();
iResult = -2;//插入异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
#endregion
#region 提取规则编号
/// <summary>
/// 提取规则编号
/// </summary>
/// <param name="strRULENAME">规则项目名称</param>
/// <param name="strfield">需要加规则的字段</param>
/// <returns></returns>
protected String getCodeRule(string strRULENAME, string strfield, string strETD, string strACCDATE, string strUserID, string strCompanyID)
{
//调用编码规则
if (strETD.Trim().IndexOf("0001")>-1)
{
strETD = "";
}
string strRULEYEAR = "";
string strRULECONTENT = "";
string strCODENAME = "";
string strDEPTNO = "";
string strRULENOLENGTH = "";
int iRULENOLENGTH = 0;
int inum = 0;
string strCONTENT = "";
T_ALL_DA T_ALL_DA = new T_ALL_DA();
//
DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=2");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("业务日期"))
{
if (strETD.Trim() == "")
{
return "";
}
DateTime dETD = System.Convert.ToDateTime(strETD.Trim());
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy") + dETD.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy") + dETD.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("会计期间"))
{
if (strACCDATE.Trim() == "")
{
return "";
}
DateTime dACCDATE = System.Convert.ToDateTime(strACCDATE.Trim() + "-01");
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy") + dACCDATE.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy") + dACCDATE.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("自然月份"))
{
DateTime fwqdate = System.Convert.ToDateTime(T_ALL_DA.GetStrSQL("fwqdate", "select fwqdate=getdate()"));
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy") + fwqdate.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy") + fwqdate.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy");
}
}
}
//
if (ds.Tables[0].Rows[0]["ISCOMPANY"].ToString().Trim().Equals("True"))
{
strCODENAME = T_ALL_DA.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
}
if (ds.Tables[0].Rows[0]["ISDEPT"].ToString().Trim().Equals("True"))
{
strDEPTNO = T_ALL_DA.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + strUserID.Trim() + "')");
}
strRULECONTENT = ds.Tables[0].Rows[0]["RULECONTENT"].ToString().Trim();
strRULECONTENT = strRULECONTENT.Replace("《COMPANY》", strCODENAME);
strRULECONTENT = strRULECONTENT.Replace("《DEPT》", strDEPTNO);
//
iRULENOLENGTH = int.Parse(ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim());
strCONTENT = strRULECONTENT + strRULEYEAR;
//获取分公司的票号头字符
string tempBANKSHEAD = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
strCONTENT = tempBANKSHEAD + strCONTENT;
//
strRULENOLENGTH = T_ALL_DA.GetStrSQL(strfield, "select top 1 " + strfield + " from [op_seai] where " + strfield + " like '" + strCONTENT.Trim() + "%' order by " + strfield + " DESC");
if (strRULENOLENGTH == "")
{
strRULENOLENGTH = "1";
}
else
{
strRULENOLENGTH = strRULENOLENGTH.Replace(strCONTENT.Trim(), "");
inum = int.Parse(strRULENOLENGTH.Trim());
inum = inum + 1;
strRULENOLENGTH = inum.ToString();
}
int j = iRULENOLENGTH - strRULENOLENGTH.Length;
for (int i = 1; i <= j; i++)
{
strRULENOLENGTH = "0" + strRULENOLENGTH;
}
//
strCONTENT = strCONTENT + strRULENOLENGTH;
return strCONTENT;
}
}
}
return "";
}
#endregion
#region 委托业务费用加锁
/// <summary>
/// 委托业务费用加锁
/// </summary>
/// <param name="tempBSNO">委托业务编号</param>
/// <returns>值等于1表示加锁成功 值不等于1表示加锁失败</returns>
public int LockFeeStatus(string tempBSNO)
{
int iResult = 0;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
SqlParameter[] parms = new SqlParameter[] {
new SqlParameter(PARM_SEAE_BSNO,SqlDbType.VarChar,100)
};
parms[0].Value = tempBSNO;
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_op_seai_FEE_LOCK, parms);
sqlTran.Commit();
iResult = 1;//状态为1表示更新成功
}
catch (Exception execError)
{
iResult = -1;//有异常,更新失败
sqlTran.Rollback();
iResult = -2;//更新异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
#endregion
#region 委托业务费用解锁
/// <summary>
/// 委托业务费用解锁
/// </summary>
/// <param name="tempBSNO">委托业务编号</param>
/// <returns>值等于1表示解锁成功 值不等于1表示解锁失败</returns>
public int UnLockFeeStatus(string tempBSNO)
{
int iResult = 0;
using (SqlTransaction sqlTran = SqlHelper.BeginTransaction(SqlHelper.ConnectionStringLocalTransaction))
{
try
{
SqlParameter[] parms = new SqlParameter[] {
new SqlParameter(PARM_SEAE_BSNO,SqlDbType.VarChar,100)
};
parms[0].Value = tempBSNO;
SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, SQL_UPDATE_op_seai_FEE_UNLOCK, parms);
sqlTran.Commit();
iResult = 1;//状态为1表示更新成功
}
catch (Exception execError)
{
iResult = -1;//有异常,更新失败
sqlTran.Rollback();
iResult = -2;//更新异常,事务已回滚成功
throw execError;
}
finally
{
SqlHelper.CloseConnection();
}
}
return iResult;
}
#endregion
#region 根据SQL语句查询数据集
/// <summary>
/// 根据SQL语句查询数据集
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public DataSet GetExcuteSql(string strSql)
{
DataSet userSet = new DataSet();
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, strSql);
return userSet;
}
#endregion
#region 返回所有数据集
/// <summary>
/// 返回所有海运出口数据集
/// </summary>
/// <param name="strSql"></param>
/// <returns></returns>
public DataSet GetSeaImportList()
{
DataSet userSet = new DataSet();
userSet = SqlHelper.ExecuteDataset(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_INFO);
return userSet;
}
#endregion
}
}