using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DSWeb.EntityDA;
using System.Data;
using System.Text;
using DSWeb.Models;
namespace DSWeb.SeanInfo
{
public partial class SeanAjax : System.Web.UI.Page
{
private string strUserID;
private string strCompanyID;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
strUserID = "";
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
DSWeb.EntityDA.Opsean opseanDA = new EntityDA.Opsean();
if (Request["type"] == "mblnoisexist")
{
string mblno = Request["mblno"].ToString();
int result = opseanDA.ConfirMblnoIfExist(mblno);
Response.Write("{\"result\":\""+result+"\"}");
}
if (Request["type"] == "teamTruck")
{
string idd = Request["idd"].ToString();
DataTable table = opseanDA.GetExistsTeam(idd);
if (table.Rows.Count > 0)
{
Response.Write("{\"result\":\"" + table.Rows[0]["TRUCK"].ToString() + "\",\"teamstatus\":\"" + table.Rows[0]["TEAMTYPE"].ToString() + "\"}");
}
else
{
Response.Write("{\"result\":\"no\"}");
}
}
if (Request["type"] == "getTeamTruck")//状态下的承运车队信息
{
string companyid=Request["companyid"].ToString();
DataTable table = opseanDA.GetTeamInfo(companyid);
Response.Write(TeamTruckJson(table));
}
if (Request["type"] == "PrintSeanTruck")
{
string gids = Request["GID"].ToString();
Response.Write(PrintSeanBusinessTruckReport(strUserID, gids));
}
if (Request["type"] == "PrintSeanTruckByLeid")
{
string leid = Request["LEID"].ToString();
//string[] leids = leid.Split(',');
string gids = "";
DataTable table = opseanDA.GetGIDTruck(leid);
for (int i = 0; i < table.Rows.Count; i++)
{
gids += table.Rows[i]["gid"].ToString() + ",";
}
Response.Write(PrintSeanBusinessTruckReport(strUserID, gids));
}
if (Request["type"] == "PrintSeanAndCtnLists")
{
string bsnos = Request["BSNOS"].ToString();
string handle = Request["handle"].ToString();
if (handle == "printALL" && bsnos == "")
{
Response.Write(PrintSeanAndCtnListAll(strUserID,""));
}
else if (handle == "printPart" && bsnos != "")
{
Response.Write(PrintSeanAndCtnListPart(strUserID, bsnos));
}
else
{
Response.Write("{\"result\":\"no\"}");
}
}
if (Request["type"] == "getaddress")
{
T_ALL_DA tallda=new T_ALL_DA();
string custname = Request["cusname"].ToString().Trim();
string codename = tallda.GetStrSQL("codename", "select codename from info_client where SHORTNAME='" + custname+ "'");
DataSet ds = tallda.GetInfoShipper(codename);
if (ds != null)
{
Response.Write(Getjsonaddress(ds));
}
else
{
Response.Write("{\"loadaddress\":\"\",\"deliveraddress\":\"\"}");
}
}
}
private string Getjsonaddress(DataSet ds)
{
//string loadaddress="";
//string deliveraddress = "";
//string[] loadadd;
//string[] loads;
//Array arr;
//string[] deliveradd;
//string testvalue = "";
//string[] loadress;
StringBuilder jsonBuilder = new StringBuilder();
jsonBuilder.Append("{");
jsonBuilder.Append("\"result\":");
jsonBuilder.Append("[");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
jsonBuilder.Append("{\"loadaddress\":\"" + ds.Tables[0].Rows[i]["LOADADDRESS"].ToString().Replace("\r\n", "$").Trim() + "\",\"deliveraddress\":\"" + ds.Tables[0].Rows[i]["DELIVERADDRESS"].ToString().Replace("\r\n", "$") + "\"},");
//loadaddress = ds.Tables[0].Rows[i]["LOADADDRESS"].ToString().Replace("\r\n", "$").Trim();
//deliveraddress = ds.Tables[0].Rows[i]["DELIVERADDRESS"].ToString().Replace("\r\n", "$").Trim();
//loadadd = loadaddress.Split('$');
//deliveradd = deliveraddress.Split('$');
//for (int j = 0; j < loadadd.Length; j++)
//{
//}
}
jsonBuilder = jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
jsonBuilder.Append("]");
jsonBuilder.Append("}");
return jsonBuilder.ToString();
}
private string GetJosonResult(string tempCompanyID, string tempSourceID, string tempUserID)
{
StringBuilder jsonBuilder = new StringBuilder();
jsonBuilder.Append("{");
jsonBuilder.Append("\"result\":");
jsonBuilder.Append("[");
jsonBuilder.Append("{");
jsonBuilder.Append("\"compid\":\"" + tempCompanyID + "\",");
jsonBuilder.Append("\"sourceid\":\"" + tempSourceID + "\",");
jsonBuilder.Append("\"userid\":\"" + tempUserID + "\"");
jsonBuilder.Append("}");
jsonBuilder.Append("]");
jsonBuilder.Append("}");
return jsonBuilder.ToString();
}
protected string TeamTruckJson(DataTable table)//所有承运车队信息
{
StringBuilder str = new StringBuilder();
str.Append("{\"result\":[");
for (int i = 0; i <= table.Rows.Count - 1; i++)
{
str.Append("{\"textvalue\":\"" + table.Rows[i]["NewColumns"] + "\",\"values\":\"" + table.Rows[i]["SHORTNAME"].ToString() + "\"}");
}
str.Append("]}");
return str.ToString();
}
///
/// 打印出口派车通知报表
///
/// 用户GID
/// id编号
/// 返回JSON对象
private string PrintSeanBusinessTruckReport(string tempUserID, string tempGID)
{
//var printUrl = "";
//var companyID = "";
//var typeName = "PrintLoadGoodsApplicationReport";
//var dbSourceID = "";
//var userID = "";
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(tempUserID, "PrintLoadGoodsApplicationReport");
string[] gids = tempGID.Remove(tempGID.Length - 1, 1).Split(',');
string sqlstr1 = "";
for (int i = 0; i < gids.Length; i++)
{
sqlstr1 += " gid='" + gids[i].ToString() + "' or";
}
sqlstr1 = sqlstr1.Remove(sqlstr1.Length - 3, 3);
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "select (case BSSTATUS when 0 then '未锁定' else '已锁定' end) as BSSTATUS ,(case FEESTATUS when 0 then '未锁定' else '已锁定' end) as FEESTATUS , MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,PORTLOAD,PORTDISCHARGE,N.GOODSNAME as SeanGOODSNAME,GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,LOADADDRESS,DELIVERADDRESS,"
+ "CTNCODE,[SIZE],CTN,CTNNUM,TEU,CNTRNO,SEALNO,PKGS,KGS,CBM,C.REMARK,KINDPKGS,TAREWEIGHT,C.GOODSNAME AS ctnGOODSNAME,"
+ "(case T.TEAMTYPE when 0 then '装货' when 1 then '送货' else '' end) as TEAMTYPE,TRUCKNO,DRIVER,IDENTITYCARD,MOBILE,TRUCK,L.INPUTTIME "
+ " FROM [op_sean] N inner join [op_ctn] C on N.BSNO=C.BSNO INNER JOIN [op_ctn_truck] T on C.CTN_ID=T.CTN_ID INNER JOIN [op_letter_truck] L on T.LE_ID=L.LE_ID WHERE "+sqlstr1.ToString()+"";
//reportDBSourceEntity.SqlString_1 = "select * from op_sean where bsno in (select distinct bsno from [op_ctn] A inner join [op_ctn_truck] B on A.ctn_id=B.ctn_id where "+sqlstr1.ToString()+" )";
//reportDBSourceEntity.SqlString_2 = "select GID,CTN_ID,TRUCKNO,DRIVER,IDENTITYCARD,MOBILE,TRUCK,INPUTBY from [op_ctn_truck] C inner join [op_letter_truck] L on C.LE_ID=L.LE_ID where "+sqlstr1.ToString()+"";
reportDBSourceEntity.SqlString_2 = "";
//reportDBSourceEntity.SqlString_3 = "select LT.GID,CTN_ID,LT.LE_ID,LT.TEAMTYPE,LT.ISTEAMSTATUS,TRUCKNO,DRIVER,IDENTITYCARD,LT.MOBILE,INPUTBY,U.GID, U.USERNAME, U.CODENAME, U.PASSWORD, U.SHOWNAME, U.ENROLLTIME,"
// + "U.CREATEUSER, U.MODIFIEDUSER, U.MODIFIEDTIME,U.ISDELETED, U.ISDISABLE, U.DELETEUSER, U.DELETETIME,B.GID AS b_GID, B.USERID,B.COMPANYNAME, B.DEPTNAME, B.OFFICEPHONE,"
// + "B.HOMEPHONE, B.MOBILE, B.FAX, B.EMAIL1, B.EMAIL2, B.HOMEADDRESS, B.REMARK, B.CREATEUSER AS B_CREATEUSER, B.CREATETIME, B.MODIFIEDUSER AS B_MODIFIEDUSER, "
// + "B.MODIFIEDTIME AS B_MODIFIEDTIME, B.EMERGUSER, B.EMERGPHONE, B.EMERGEMAIL, B.POSTCODE, B.QQ, B.MSN,B.FINANCESOFTCODE,"
// + " B.SIGNATURE from (select GID,CTN_ID,L.LE_ID,L.TEAMTYPE,L.ISTEAMSTATUS,TRUCKNO,DRIVER,IDENTITYCARD,MOBILE,INPUTBY from [op_ctn_truck] L inner join [op_letter_truck] T on L.LE_ID=T.LE_ID WHERE GID='" + tempGID + "')LT "
// + "INNER JOIN [user] U ON LT.INPUTBY=U.SHOWNAME INNER JOIN user_baseinfo B ON U.GID=B.USERID "
// + "where U.ISDELETED=0 and U.ISDISABLE=0 AND LT.GID='" + tempGID + "'"; //操作的基本信息
reportDBSourceEntity.SqlString_3 = "";
//reportDBSourceEntity.SqlString_4 = "select * from [op_ctn] where CTN_ID IN (select distinct B.CTN_ID from [op_ctn] A inner join [op_ctn_truck] B on A.ctn_id=B.ctn_id where "+sqlstr1.ToString()+")";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, tempUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PrintLoadGoodsApplicationReport";
reportDBSourceEntity.CreateUser = tempUserID;
reportDBSourceEntity.UserID = tempUserID;
reportDBSourceEntity.SqlString_1 = "select (case BSSTATUS when 0 then '未锁定' else '已锁定' end) as BSSTATUS ,(case FEESTATUS when 0 then '未锁定' else '已锁定' end) as FEESTATUS , MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,PORTLOAD,PORTDISCHARGE,N.GOODSNAME as SeanGOODSNAME,GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,LOADADDRESS,DELIVERADDRESS,"
+ "CTNCODE,[SIZE],CTN,CTNNUM,TEU,CNTRNO,SEALNO,PKGS,KGS,CBM,C.REMARK,KINDPKGS,TAREWEIGHT,C.GOODSNAME AS ctnGOODSNAME,"
+ "(case T.TEAMTYPE when 0 then '装货' when 1 then '送货' else '' end) as TEAMTYPE,TRUCKNO,DRIVER,IDENTITYCARD,MOBILE,TRUCK,L.INPUTTIME"
+ " FROM [op_sean] N inner join [op_ctn] C on N.BSNO=C.BSNO INNER JOIN [op_ctn_truck] T on C.CTN_ID=T.CTN_ID INNER JOIN [op_letter_truck] L on T.LE_ID=L.LE_ID WHERE " + sqlstr1.ToString() + "";
reportDBSourceEntity.SqlString_2 = "";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "SELECT [user].USERNAME,[user].CODENAME,[user].PASSWORD,[user].SHOWNAME,[user].ENROLLTIME,[user].CREATEUSER,[user].MODIFIEDUSER, [user].MODIFIEDTIME, [user].ISDELETED, [user].ISDISABLE, user_baseinfo.GID,user_baseinfo.USERID,user_baseinfo.COMPANYNAME, user_baseinfo.DEPTNAME, user_baseinfo.OFFICEPHONE, user_baseinfo.HOMEPHONE, user_baseinfo.MOBILE, user_baseinfo.FAX, user_baseinfo.EMAIL1, user_baseinfo.EMAIL2, user_baseinfo.HOMEADDRESS, user_baseinfo.REMARK, user_baseinfo.EMERGUSER, user_baseinfo.EMERGPHONE,user_baseinfo.EMERGEMAIL, user_baseinfo.POSTCODE, user_baseinfo.QQ, user_baseinfo.MSN, user_baseinfo.FINANCESOFTCODE FROM [user] INNER JOIN user_baseinfo ON [user].GID = user_baseinfo.USERID where user_baseinfo.USERID='" + strUserID + "'";
reportDBSourceEntity.SqlString_8 = " SELECT * FROM [company] WHERE GID = '" + strCompanyID + "'";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, tempUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
private string PrintSeanAndCtnListAll(string tempUserID, string temBsno)
{
//var printUrl = "";
//var companyID = "";
//var typeName = "PrintSeanAndCtnList";
//var dbSourceID = "";
//var userID = "";
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(tempUserID, "PrintSeanAndCtnList");
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "select * from [op_sean] where CORPID='" + strCompanyID + "'";
reportDBSourceEntity.SqlString_2 = "select ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME "
+ ",CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK from [op_sean] A inner join [op_ctn] B ON A.BSNO=B.BSNO INNER JOIN [op_ctn_truck] C ON B.CTN_ID=C.CTN_ID INNER JOIN [op_letter_truck] D ON C.LE_ID=D.LE_ID "
+ " WHERE A.CORPID='" + strCompanyID + "' GROUP BY ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,"
+ "GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME ,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, tempUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PrintSeanAndCtnList";
reportDBSourceEntity.CreateUser = tempUserID;
reportDBSourceEntity.UserID = tempUserID;
reportDBSourceEntity.SqlString_1 = "select * from [op_sean] where CORPID='" + strCompanyID + "'";
reportDBSourceEntity.SqlString_2 = "select ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME "
+ ",CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK from [op_sean] A inner join [op_ctn] B ON A.BSNO=B.BSNO INNER JOIN [op_ctn_truck] C ON B.CTN_ID=C.CTN_ID INNER JOIN [op_letter_truck] D ON C.LE_ID=D.LE_ID "
+ " WHERE A.CORPID='" + strCompanyID + "' GROUP BY ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,"
+ "GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME ,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK ";
reportDBSourceEntity.SqlString_3 = "";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, tempUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
private string PrintSeanAndCtnListPart(string tempUserID, string temBsnos)
{
//var printUrl = "";
//var companyID = "";
//var typeName = "PrintSeanAndCtnList";
//var dbSourceID = "";
//var userID = "";
string strResult = "";
//先获取用户所在的公司信息GID
CompanyEntity companyEntity = new CompanyEntity();
CompanyDA companyDA = new CompanyDA();
companyEntity = companyDA.GetCompanyByUserID(tempUserID);
if (companyEntity.GID != null)
{
strCompanyID = companyEntity.GID;
}
ReportDBSourceDA reportDBSourceDA = new ReportDBSourceDA();
ReportDBSourceEntity reportDBSourceEntity = new ReportDBSourceEntity();
reportDBSourceEntity = reportDBSourceDA.GetReportDBSourceByUserIDAndType(tempUserID, "PrintSeanAndCtnList");
string[] BSNOS = temBsnos.Remove(temBsnos.Length - 1, 1).Split(',');
string sqlstr1 = "(";
for (int i = 0; i < BSNOS.Length; i++)
{
sqlstr1 += " A.BSNO='" + BSNOS[i].ToString() + "' OR";
}
sqlstr1 = sqlstr1.Remove(sqlstr1.Length - 3, 3);
sqlstr1 = sqlstr1 + ")";
//如果有相似的值则直接获取
if (reportDBSourceEntity.GID != null)
{
reportDBSourceEntity.SqlString_1 = "select * from [op_sean] A where A.CORPID='" + strCompanyID + "' and "+sqlstr1.ToString()+"";
reportDBSourceEntity.SqlString_2 = "select ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME "
+ ",CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK from [op_sean] A inner join [op_ctn] B ON A.BSNO=B.BSNO INNER JOIN [op_ctn_truck] C ON B.CTN_ID=C.CTN_ID INNER JOIN [op_letter_truck] D ON C.LE_ID=D.LE_ID "
+" WHERE A.CORPID='" + strCompanyID + "' AND "+sqlstr1.ToString()+" "
+ "GROUP BY ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,"
+ " GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME ,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK ";
reportDBSourceEntity.SqlString_3 = "";
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
int iTempStatus = reportDBSourceDA.UpdateReportSql(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, tempUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
else
{
reportDBSourceEntity.GID = Guid.NewGuid().ToString();
reportDBSourceEntity.ReportID = "";
reportDBSourceEntity.Name = "";
reportDBSourceEntity.Description = "";
reportDBSourceEntity.Type = "PrintSeanAndCtnList";
reportDBSourceEntity.CreateUser = tempUserID;
reportDBSourceEntity.UserID = tempUserID;
reportDBSourceEntity.SqlString_1 = "select * from [op_sean] A where A.CORPID='" + strCompanyID + "' and " + sqlstr1.ToString() + "";
reportDBSourceEntity.SqlString_2 = "select ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME "
+ ",CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK from [op_sean] A inner join [op_ctn] B ON A.BSNO=B.BSNO INNER JOIN [op_ctn_truck] C ON B.CTN_ID=C.CTN_ID INNER JOIN [op_letter_truck] D ON C.LE_ID=D.LE_ID "
+ " WHERE A.CORPID='" + strCompanyID + "' AND " + sqlstr1.ToString() + " "
+ "GROUP BY ORDERTYPE,ACCDATE,MBLNO,CUSTNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,VESSEL,VOYNO,ETD,ETA,PORTLOAD,PORTDISCHARGE,"
+ " GROSSWEIGHT,MEASUREMENT,OP,SALE,CARRIER,B.GOODSNAME ,CTN,CTNNUM,CNTRNO,SEALNO,PKGS,KGS,CBM,KINDPKGS,TAREWEIGHT,TRUCK ";
reportDBSourceEntity.SqlString_3 = "";//操作的基本信息
reportDBSourceEntity.SqlString_4 = "";
reportDBSourceEntity.SqlString_5 = "";
reportDBSourceEntity.SqlString_6 = "";
reportDBSourceEntity.SqlString_7 = "";
reportDBSourceEntity.SqlString_8 = "";
int iTempStatus = reportDBSourceDA.InsertReportDBSource(reportDBSourceEntity);
if (iTempStatus == 1)
{
strResult = GetJosonResult(strCompanyID, reportDBSourceEntity.GID, tempUserID);
}
else
{
strResult = GetJosonResult("", "", "");
}
}
return strResult;
}
}
}