|
|
@@ -18,10 +18,14 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
public void ProcessRequest(HttpContext context)
|
|
|
{
|
|
|
context.Response.ContentType = "text/plain";
|
|
|
+ OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.193.152)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=wmsdpdb.hegii.com)));User Id=wms_dkselect;Password=Wmshgdk0815");
|
|
|
+ OracleConnection conn1 = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.19.252.4)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=TIMMS)));User Id=kcsec_view_ycd;Password=123456");
|
|
|
+ // DataAccess conn1 = DataAccess.Create(DataBaseType.Oracle, "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.19.252.4)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=TIMMS)));User Id=kcsec_view_ycd;Password=123456");
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
- OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.193.152)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=wmsdpdb.hegii.com)));User Id=wms_dkselect;Password=Wmshgdk0815");
|
|
|
conn.Open();
|
|
|
+ conn1.Open();
|
|
|
string jsonStr;
|
|
|
string m = context.Request["m"].ToString();
|
|
|
//主表
|
|
|
@@ -29,7 +33,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
{
|
|
|
string sql = @"SELECT asnno
|
|
|
,mblnr
|
|
|
- ,zeile
|
|
|
+ --,to_char(zeile) zeile
|
|
|
+ , zeile
|
|
|
,werks
|
|
|
,cpudt
|
|
|
,case when receivedqty = 0 then null else receivingtime end as receivingtime
|
|
|
@@ -51,9 +56,11 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
string asnno = context.Request["asnno"].ToString();//asn单号
|
|
|
string MBLNR = context.Request["MBLNR"].ToString();//asn单号
|
|
|
string lgort = context.Request["lgort[]"] is object ? context.Request["lgort[]"].ToString() : "";//发出仓
|
|
|
- if (lgort == "" && (context.Request["lgort"] is object)) lgort = context.Request["lgort"].ToString();
|
|
|
+ if (lgort == "" && (context.Request["lgort"] is object))
|
|
|
+ lgort = context.Request["lgort"].ToString();
|
|
|
string umlgo = context.Request["umlgo[]"] is object ? context.Request["umlgo[]"].ToString() : "";//发出仓
|
|
|
- if (umlgo == "" && (context.Request["umlgo"] is object)) umlgo = context.Request["umlgo"].ToString();
|
|
|
+ if (umlgo == "" && (context.Request["umlgo"] is object))
|
|
|
+ umlgo = context.Request["umlgo"].ToString();
|
|
|
if (string.IsNullOrEmpty(context.Request["datebeginMaster"]) && string.IsNullOrEmpty(context.Request["dateendMaster"]) && string.IsNullOrEmpty(context.Request["receivingdatebeginMaster"]) && string.IsNullOrEmpty(context.Request["receivingdateendMaster"]))
|
|
|
{
|
|
|
jsonStr = new JsonResult(JsonStatus.success) { message = "未找到任何数据!" }.ToJson();
|
|
|
@@ -61,12 +68,17 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
else
|
|
|
{
|
|
|
OracleCommand cmd = new OracleCommand();
|
|
|
+ OracleCommand cmd1 = new OracleCommand();
|
|
|
+ CDAParameters psp = CDAParameters.Create();
|
|
|
+
|
|
|
//移仓开始日期
|
|
|
if (!string.IsNullOrEmpty(context.Request["datebeginMaster"]))
|
|
|
{
|
|
|
DateTime cpudtdatestart = Convert.ToDateTime(context.Request["datebeginMaster"]);
|
|
|
sql += " and cpudt>=:cpudt";
|
|
|
cmd.Parameters.Add("cpudt", OracleDbType.Date, cpudtdatestart, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("cpudt", OracleDbType.Date, cpudtdatestart, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("cpudt", cpudtdatestart);
|
|
|
}
|
|
|
//移仓截止日期
|
|
|
if (!string.IsNullOrEmpty(context.Request["dateendMaster"]))
|
|
|
@@ -74,6 +86,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
DateTime cpudtdateend = Convert.ToDateTime(context.Request["dateendMaster"]);
|
|
|
sql += " and cpudt<=:cpudtdateend";
|
|
|
cmd.Parameters.Add("cpudtdateend", OracleDbType.Date, cpudtdateend, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("cpudtdateend", OracleDbType.Date, cpudtdateend, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("cpudtdateend", cpudtdateend);
|
|
|
}
|
|
|
//收货开始日期
|
|
|
if (!string.IsNullOrEmpty(context.Request["receivingdatebeginMaster"]))
|
|
|
@@ -81,6 +95,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
DateTime receivingtimestart = Convert.ToDateTime(context.Request["receivingdatebeginMaster"]);
|
|
|
sql += " and receivingtime>=:receivingtimestart";
|
|
|
cmd.Parameters.Add("receivingtimestart", OracleDbType.Date, receivingtimestart, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("receivingtimestart", OracleDbType.Date, receivingtimestart, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("receivingtimestart", receivingtimestart);
|
|
|
}
|
|
|
//收货截止日期
|
|
|
if (!string.IsNullOrEmpty(context.Request["receivingdateendMaster"]))
|
|
|
@@ -88,6 +104,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
DateTime receivingtimeend = Convert.ToDateTime(context.Request["receivingdateendMaster"]);
|
|
|
sql += " and receivingtime<=:receivingtimeend";
|
|
|
cmd.Parameters.Add("receivingtimeend", OracleDbType.Date, receivingtimeend, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("receivingtimeend", OracleDbType.Date, receivingtimeend, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("receivingtimeend", receivingtimeend);
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(sku))
|
|
|
{
|
|
|
@@ -111,7 +129,7 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
{
|
|
|
sql += " and INSTR('" + umlgo + "' ,umlgo)> 0 ";
|
|
|
}
|
|
|
- sql += " order by ASNNO,MBLNR,ZEILE ";
|
|
|
+ //sql += " order by ASNNO,MBLNR,ZEILE ";
|
|
|
cmd.CommandText = sql;
|
|
|
cmd.Connection = conn;
|
|
|
OracleDataAdapter da = new OracleDataAdapter(cmd);
|
|
|
@@ -121,6 +139,21 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
|
|
|
da.Fill(dt);
|
|
|
conn.Close();
|
|
|
+
|
|
|
+ sql = sql.Replace("wms_hg.ycd_details", "L1101.KSEC_YCD_DETAILS");
|
|
|
+ //DataTable dt1= conn1.ExecuteDatatable(sql, psp.ToArray());
|
|
|
+
|
|
|
+ cmd1.CommandText = sql;
|
|
|
+ cmd1.Connection = conn1;
|
|
|
+ //cmd1.Parameters.AddRange(cmd.Parameters);
|
|
|
+ OracleDataAdapter da1 = new OracleDataAdapter(cmd1);
|
|
|
+ DataTable dt1 = new DataTable();//定义数据集
|
|
|
+ da1.Fill(dt1);
|
|
|
+ conn1.Close();
|
|
|
+
|
|
|
+
|
|
|
+ dt.Merge(dt1);
|
|
|
+ dt.DefaultView.Sort = "ASNNO,MBLNR,ZEILE";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
@@ -163,13 +196,15 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
string mm = context.Request["m"].ToString();
|
|
|
if (mm == "1" || mm == "3")
|
|
|
{
|
|
|
- string sku = context.Request["matnr"]+ "";//sku
|
|
|
- string asnno = context.Request["asnno"]+ "";//asn单号
|
|
|
- string MBLNR = context.Request["MBLNR"]+ "";//asn单号
|
|
|
- string lgort = context.Request["lgort[]"] is object ? context.Request["lgort[]"]+ "" : "";//发出仓
|
|
|
- if (lgort == "" && (context.Request["lgort"] is object)) lgort = context.Request["lgort"]+ "";
|
|
|
- string umlgo = context.Request["umlgo[]"] is object ? context.Request["umlgo[]"]+ "" : "";//发出仓
|
|
|
- if (umlgo == "" && (context.Request["umlgo"] is object)) umlgo = context.Request["umlgo"]+ "";
|
|
|
+ string sku = context.Request["matnr"] + "";//sku
|
|
|
+ string asnno = context.Request["asnno"] + "";//asn单号
|
|
|
+ string MBLNR = context.Request["MBLNR"] + "";//asn单号
|
|
|
+ string lgort = context.Request["lgort[]"] is object ? context.Request["lgort[]"] + "" : "";//发出仓
|
|
|
+ if (lgort == "" && (context.Request["lgort"] is object))
|
|
|
+ lgort = context.Request["lgort"] + "";
|
|
|
+ string umlgo = context.Request["umlgo[]"] is object ? context.Request["umlgo[]"] + "" : "";//发出仓
|
|
|
+ if (umlgo == "" && (context.Request["umlgo"] is object))
|
|
|
+ umlgo = context.Request["umlgo"] + "";
|
|
|
//if (mm == "3" && string.IsNullOrEmpty(context.Request["datebeginMaster"]) && string.IsNullOrEmpty(context.Request["dateendMaster"]) && string.IsNullOrEmpty(context.Request["receivingdatebeginMaster"]) && string.IsNullOrEmpty(context.Request["receivingdateendMaster"]))
|
|
|
//{
|
|
|
// jsonStr = new JsonResult(JsonStatus.success) { message = "未找到任何数据!" }.ToJson();
|
|
|
@@ -178,6 +213,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
//{
|
|
|
conn.BeginTransaction();
|
|
|
OracleCommand cmd = new OracleCommand();
|
|
|
+ OracleCommand cmd1 = new OracleCommand();
|
|
|
+ CDAParameters psp = CDAParameters.Create();
|
|
|
string sql = "select b.* from wms_hg.ycd_details a inner join wms_hg.YCD_SERIALNO_DETAILS b on a.matnr=b.matnr and a.asnno=b.asnno where 1=1";
|
|
|
//string sku = context.Request["matnr"].ToString();
|
|
|
string barcode = context.Request["barcode"] + "";
|
|
|
@@ -185,57 +222,65 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
|
|
|
if (string.IsNullOrEmpty(barcode) && string.IsNullOrEmpty(outbarcode))
|
|
|
{
|
|
|
- //移仓开始日期
|
|
|
- if (!string.IsNullOrEmpty(context.Request["datebeginMaster"]))
|
|
|
- {
|
|
|
- DateTime cpudtdatestart = Convert.ToDateTime(context.Request["datebeginMaster"]);
|
|
|
- sql += " and a.cpudt>=:cpudt";
|
|
|
- cmd.Parameters.Add("cpudt", OracleDbType.Date, cpudtdatestart, System.Data.ParameterDirection.Input);
|
|
|
- }
|
|
|
- //移仓截止日期
|
|
|
- if (!string.IsNullOrEmpty(context.Request["dateendMaster"]))
|
|
|
- {
|
|
|
- DateTime cpudtdateend = Convert.ToDateTime(context.Request["dateendMaster"]);
|
|
|
- sql += " and a.cpudt<=:cpudtdateend";
|
|
|
- cmd.Parameters.Add("cpudtdateend", OracleDbType.Date, cpudtdateend, System.Data.ParameterDirection.Input);
|
|
|
- }
|
|
|
- //收货开始日期
|
|
|
- if (!string.IsNullOrEmpty(context.Request["receivingdatebeginMaster"]))
|
|
|
- {
|
|
|
- DateTime receivingtimestart = Convert.ToDateTime(context.Request["receivingdatebeginMaster"]);
|
|
|
- sql += " and a.receivingtime>=:receivingtimestart";
|
|
|
- cmd.Parameters.Add("receivingtimestart", OracleDbType.Date, receivingtimestart, System.Data.ParameterDirection.Input);
|
|
|
- }
|
|
|
- //收货截止日期
|
|
|
- if (!string.IsNullOrEmpty(context.Request["receivingdateendMaster"]))
|
|
|
- {
|
|
|
- DateTime receivingtimeend = Convert.ToDateTime(context.Request["receivingdateendMaster"]);
|
|
|
- sql += " and a.receivingtime<=:receivingtimeend";
|
|
|
- cmd.Parameters.Add("receivingtimeend", OracleDbType.Date, receivingtimeend, System.Data.ParameterDirection.Input);
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(sku))
|
|
|
- {
|
|
|
- sql += " and a.matnr='" + sku + "'";
|
|
|
- // cmd.Parameters.Add("matnr", OracleDbType.Varchar2, sku, System.Data.ParameterDirection.Input);
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(asnno))
|
|
|
- {
|
|
|
- sql += " and a.asnno='" + asnno + "'";
|
|
|
- // cmd.Parameters.Add("asnno", OracleDbType.Varchar2, asnno, System.Data.ParameterDirection.Input);
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(MBLNR))
|
|
|
- {
|
|
|
- sql += " and a.MBLNR='" + MBLNR + "'";
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(lgort))
|
|
|
- {
|
|
|
- sql += " and INSTR('" + lgort + "' ,a.lgort)> 0 ";
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(umlgo))
|
|
|
- {
|
|
|
- sql += " and INSTR('" + umlgo + "' ,a.umlgo)> 0 ";
|
|
|
- }
|
|
|
-
|
|
|
+ //移仓开始日期
|
|
|
+ if (!string.IsNullOrEmpty(context.Request["datebeginMaster"]))
|
|
|
+ {
|
|
|
+ DateTime cpudtdatestart = Convert.ToDateTime(context.Request["datebeginMaster"]);
|
|
|
+ sql += " and a.cpudt>=:cpudt";
|
|
|
+ cmd.Parameters.Add("cpudt", OracleDbType.Date, cpudtdatestart, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("cpudt", OracleDbType.Date, cpudtdatestart, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("cpudt", cpudtdatestart);
|
|
|
+ }
|
|
|
+ //移仓截止日期
|
|
|
+ if (!string.IsNullOrEmpty(context.Request["dateendMaster"]))
|
|
|
+ {
|
|
|
+ DateTime cpudtdateend = Convert.ToDateTime(context.Request["dateendMaster"]);
|
|
|
+ sql += " and a.cpudt<=:cpudtdateend";
|
|
|
+ cmd.Parameters.Add("cpudtdateend", OracleDbType.Date, cpudtdateend, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("cpudtdateend", OracleDbType.Date, cpudtdateend, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("cpudtdateend", cpudtdateend);
|
|
|
+ }
|
|
|
+ //收货开始日期
|
|
|
+ if (!string.IsNullOrEmpty(context.Request["receivingdatebeginMaster"]))
|
|
|
+ {
|
|
|
+ DateTime receivingtimestart = Convert.ToDateTime(context.Request["receivingdatebeginMaster"]);
|
|
|
+ sql += " and a.receivingtime>=:receivingtimestart";
|
|
|
+ cmd.Parameters.Add("receivingtimestart", OracleDbType.Date, receivingtimestart, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("receivingtimestart", OracleDbType.Date, receivingtimestart, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("receivingtimestart", receivingtimestart);
|
|
|
+ }
|
|
|
+ //收货截止日期
|
|
|
+ if (!string.IsNullOrEmpty(context.Request["receivingdateendMaster"]))
|
|
|
+ {
|
|
|
+ DateTime receivingtimeend = Convert.ToDateTime(context.Request["receivingdateendMaster"]);
|
|
|
+ sql += " and a.receivingtime<=:receivingtimeend";
|
|
|
+ cmd.Parameters.Add("receivingtimeend", OracleDbType.Date, receivingtimeend, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("receivingtimeend", OracleDbType.Date, receivingtimeend, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("receivingtimeend", receivingtimeend);
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(sku))
|
|
|
+ {
|
|
|
+ sql += " and a.matnr='" + sku + "'";
|
|
|
+ // cmd.Parameters.Add("matnr", OracleDbType.Varchar2, sku, System.Data.ParameterDirection.Input);
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(asnno))
|
|
|
+ {
|
|
|
+ sql += " and a.asnno='" + asnno + "'";
|
|
|
+ // cmd.Parameters.Add("asnno", OracleDbType.Varchar2, asnno, System.Data.ParameterDirection.Input);
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(MBLNR))
|
|
|
+ {
|
|
|
+ sql += " and a.MBLNR='" + MBLNR + "'";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(lgort))
|
|
|
+ {
|
|
|
+ sql += " and INSTR('" + lgort + "' ,a.lgort)> 0 ";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(umlgo))
|
|
|
+ {
|
|
|
+ sql += " and INSTR('" + umlgo + "' ,a.umlgo)> 0 ";
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
//if (!string.IsNullOrEmpty(sku))
|
|
|
//{
|
|
|
@@ -253,12 +298,16 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
sql += " and b.CODEI = :barcode";
|
|
|
//sql += " and INSTR(b.CODEI , :barcode) > 0 ";
|
|
|
cmd.Parameters.Add("barcode", OracleDbType.Varchar2, barcode, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("barcode", OracleDbType.Varchar2, barcode, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("barcode", barcode);
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(outbarcode))
|
|
|
{
|
|
|
sql += " and b.SERIALNO=:outbarcode";
|
|
|
//sql += " and INSTR(b.SERIALNO , :outbarcode) > 0 ";
|
|
|
cmd.Parameters.Add("outbarcode", OracleDbType.Varchar2, outbarcode, System.Data.ParameterDirection.Input);
|
|
|
+ cmd1.Parameters.Add("outbarcode", OracleDbType.Varchar2, outbarcode, System.Data.ParameterDirection.Input);
|
|
|
+ psp.Add("outbarcode", outbarcode);
|
|
|
}
|
|
|
|
|
|
cmd.CommandText = sql;
|
|
|
@@ -267,6 +316,24 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
DataTable dt = new DataTable();//定义数据集
|
|
|
da.Fill(dt);
|
|
|
conn.Close();
|
|
|
+
|
|
|
+ sql = sql.Replace("wms_hg.ycd_details", "L1101.KSEC_YCD_DETAILS");
|
|
|
+ sql = sql.Replace("wms_hg.YCD_SERIALNO_DETAILS", "L1101.KSEC_YCD_SERIALNO_DETAILS");
|
|
|
+ //DataTable dt1= conn1.ExecuteDatatable(sql, psp.ToArray());
|
|
|
+
|
|
|
+ //OracleCommand cmd1 = new OracleCommand();
|
|
|
+ cmd1.CommandText = sql;
|
|
|
+ cmd1.Connection = conn1;
|
|
|
+ //cmd1.Parameters.AddRange(cmd.Parameters);
|
|
|
+ OracleDataAdapter da1 = new OracleDataAdapter(cmd1);
|
|
|
+ DataTable dt1 = new DataTable();//定义数据集
|
|
|
+ da1.Fill(dt1);
|
|
|
+ conn1.Close();
|
|
|
+
|
|
|
+
|
|
|
+ dt.Merge(dt1);
|
|
|
+ //dt.DefaultView.Sort = "ASNNO,MBLNR,ZEILE";
|
|
|
+
|
|
|
//string jsonStr;
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
@@ -294,10 +361,13 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
-
|
|
|
throw;
|
|
|
}
|
|
|
-
|
|
|
+ finally
|
|
|
+ {
|
|
|
+ //conn.Close();
|
|
|
+ //conn1.Close();
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|