strSql.Append(",b.DOC,b.SALE,(select top 1 INVNO from ch_fee_invoicehexiao where EXISTS (SELECT 1 FROM ch_fee_do_invoice WHERE ch_fee_do_invoice.BILLNO=ch_fee_invoicehexiao.BILLNO AND FEEID=c.FEEID)) INVOICENO ");
strSql.Append(",b.DOC,b.SALE,(select top 1 INVNO from ch_fee_invoicehexiao where EXISTS (SELECT 1 FROM ch_fee_do_invoice WHERE ch_fee_do_invoice.BILLNO=ch_fee_invoicehexiao.BILLNO AND FEEID=c.FEEID)) INVOICENO ");
strSql.Append("SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,ISNULL(c.ORIGSTLAMOUNT,0) AS ORIGSTLAMOUNT,c.EXCHANGERATE ");
strSql.Append(",c.FEETYPE,f.CUSTOMERNAME as FEEOBJNAME,(CASE C.FEETYPE WHEN 1 THEN '收' ELSE '付' END) AS FEETYPEREF,f.EXCHANGERATE ORIGEXCHANGERATE,f.ACCTAXRATE");
strSql.Append(" ,b.OPLBNAME,b.BSSTATUS,b.ACCDATE,b.MBLNO,b.HBLNO,b.CUSTNO,b.ORDERNO,b.CUSTOMNO,(CASE b.BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF");
strSql.Append(",(CASE b.FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,b.CUSTOMERNAME,b.BLISSUESTATUS,b.CNTRTOTAL");
strSql.Append(",b.VESSEL,b.VOYNO,b.CARRIER,b.ETD,b.PORTLOAD,b.ENTERP,(select [NAME] FROM company where GID=B.SALECORPID) BSSALECORP");
strSql.Append(",b.DOC,b.SALE,(select top 1 INVNO from ch_fee_invoicehexiao where EXISTS (SELECT 1 FROM ch_fee_do_invoice WHERE ch_fee_do_invoice.BILLNO=ch_fee_invoicehexiao.BILLNO AND FEEID=c.FEEID)) INVOICENO ");
strSql.Append(",b.DOC,b.SALE,(select top 1 INVNO from ch_fee_invoicehexiao where EXISTS (SELECT 1 FROM ch_fee_do_invoice WHERE ch_fee_do_invoice.BILLNO=ch_fee_invoicehexiao.BILLNO AND FEEID=c.FEEID)) INVOICENO ");
strSql.Append(",b.DOC,b.SALE,(select top 1 INVNO from ch_fee_invoicehexiao where EXISTS (SELECT 1 FROM ch_fee_do_invoice WHERE ch_fee_do_invoice.BILLNO=ch_fee_invoicehexiao.BILLNO AND FEEID=c.FEEID)) INVOICENO ");
varcmdDelete=db.GetSqlStringCommand("delete from code_vessel where vsid='"+headData.vsid+"'");
db.ExecuteNonQuery(cmdDelete,tran);
stringsql=string.Format("insert into code_vessel values('{0}','{1}','{2}','{3}','{4}','{5}')",headData.DM_ID,headData.vessel,headData.cname,headData.carrier,headData.edicode,headData.SHIPAGENCY);
stringsql=string.Format("insert into code_vessel values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')",headData.DM_ID,headData.vessel,headData.cname,headData.carrier,headData.edicode,headData.SHIPAGENCY,headData.SHIPFLAG);
stringsql=" insert op_status (ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,COMPOP,INPUTTIME,STTYPE) Select NEWID(),BSNO,'订舱已接收',1,GETDATE(),'ADMIN',GETDATE(),'1' FROM OP_SEAE WHERE CUSTNO='"+custno+"'";
select BSNO,(SELECT TOP 1 EMAIL FROM info_client WHERE SHORTNAME=op_seae_billmanage.AGENTID) AGENTEMAIL from op_seae_billmanage WHERE AS_ID IN (SELECT BSNO FROM op_seae_edi where HBLNO='@HBLNO')