//",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS";
/// </summary>
conststring业务状态查询子句="(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO and status not in('操作确认','待截VGM','已截VGM','未截VGM','紧急截VGM','待舱单','已舱单','未舱单','紧急舱单','待补料','已补料','未补料','紧急补料') ORDER BY COMPTIME DESC,INPUTTIME DESC)";
//",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS"
conststring业务状态子句=",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO and status not in('操作确认','待截VGM','已截VGM','未截VGM','紧急截VGM','待舱单','已舱单','未舱单','紧急舱单','待补料','已补料','未补料','紧急补料') ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS";
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
//strSql.Append(",(SELECT TOP 1 STATUS FROM OP_STATUS WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS ");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(业务状态子句);
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
strSql.Append(" order by "+sortstring.Replace("OPSTATUS","(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS",业务状态查询子句));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS","(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS",业务状态查询子句));
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(业务状态子句);
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
strSql.Append(" order by "+sortstring.Replace("OPSTATUS","(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=B.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS",业务状态查询子句));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS","(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS",业务状态查询子句));
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(业务状态子句);
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(业务状态子句);
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
strSql.Append(" order by "+sortstring.Replace("OPSTATUS","(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC)"));
strSql.Append(" order by "+sortstring.Replace("OPSTATUS",业务状态查询子句));
strSql.Append(",TRANSTATUS,EDIREMARK,SERVICECONTRACTNO,(CASE BSSTATUS WHEN 1 THEN '锁定' else '未锁定' end) as BSSTATUSREF ");
strSql.Append(",(CASE FEESTATUS WHEN 1 THEN '锁定' else '未锁定' end) as FEESTATUSREF,TRANSPORT ");
strSql.Append(",(SELECT TOP 1 STATUS FROM V_OP_STATUS WITH (NOLOCK) WHERE BSNO=OP_SEAE.BSNO ORDER BY COMPTIME DESC,INPUTTIME DESC) as OPSTATUS");
strSql.Append(业务状态子句);
strSql.Append(",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97018 and EnumValueID=OP_SEAE.MANIFESTSTATUS) as MANIFESTSTATUSREF");
varblUpBL="update op_seae_billmanage set VESSEL='"+headData.VESSEL+"',VOYNO='"+headData.VOYNO+"',ETD='"+headData.ETD+"',PORTLOADID='"+headData.PORTLOADID+"',PORTLOAD='"+headData.PORTLOAD+"' where BSNO='"+headData.BSNO+"'";
varblUpBL="update op_seae_billmanage set VESSEL='"+headData.VESSEL+"',VOYNO='"+headData.VOYNO+"',ETD='"+headData.ETD+"',PORTLOADID='"+headData.PORTLOADID.Replace("'","''")+"',PORTLOAD='"+headData.PORTLOAD.Replace("'","''")+"' where BSNO='"+headData.BSNO+"'";