|
|
@@ -25,7 +25,7 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
if (m == "master" || m == "property")
|
|
|
{
|
|
|
string barcode = context.Request["barcode"];
|
|
|
- if(!string.IsNullOrEmpty(context.Request["barcodeDB"] +""))
|
|
|
+ if (!string.IsNullOrEmpty(context.Request["barcodeDB"] + ""))
|
|
|
{
|
|
|
barcode = context.Request["barcodeDB"];
|
|
|
}
|
|
|
@@ -130,7 +130,8 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
if (m == "goods")
|
|
|
{
|
|
|
string workshop = context.Request["workshop[]"] is object ? context.Request["workshop[]"].ToString() : "";//车间
|
|
|
- if (workshop == "" && (context.Request["workshop"] is object)) workshop = context.Request["workshop"].ToString();
|
|
|
+ if (workshop == "" && (context.Request["workshop"] is object))
|
|
|
+ workshop = context.Request["workshop"].ToString();
|
|
|
|
|
|
string datebeginMasterS = context.Request["datebeginMasterS"];
|
|
|
string datebeginMasterD = context.Request["datebeginMasterD"];
|
|
|
@@ -177,30 +178,34 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
where gdd.valueflag = '1'
|
|
|
AND gdd.groutingflag = '1'
|
|
|
AND gdd.barcode IS NOT NULL
|
|
|
- AND (INSTR(GT.GOODSTYPECODE,'{GOODSTYPECODE}') = 1 OR '{GOODSTYPECODE}' IS NULL) ".Replace("{GOODSTYPECODE}", goodstypecode);
|
|
|
- if (!string.IsNullOrEmpty(datebeginMasterS))
|
|
|
- {
|
|
|
- sqlStr += " and t.fhtime >=@datebeginMasterS@ ";
|
|
|
- sqlPara.Add(new CDAParameter("datebeginMasterS", datebeginMasterS, DataType.Date));
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(datebeginMasterD))
|
|
|
- {
|
|
|
- sqlStr += " and t.fhtime <@datebeginMasterD@ ";
|
|
|
- sqlPara.Add(new CDAParameter("datebeginMasterD", Convert.ToDateTime(datebeginMasterD).AddSeconds(1), DataType.Date));
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(datebeginMasterG))
|
|
|
- {
|
|
|
- sqlStr += " and gdd.groutingdate >=@datebeginMasterG@ ";
|
|
|
- sqlPara.Add(new CDAParameter("datebeginMasterG", datebeginMasterG, DataType.Date));
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(dateendMasterG))
|
|
|
- {
|
|
|
- sqlStr += " and gdd.groutingdate <@dateendMasterG@ ";
|
|
|
- sqlPara.Add(new CDAParameter("dateendMasterG", Convert.ToDateTime(dateendMasterG).AddDays(1), DataType.Date));
|
|
|
- }
|
|
|
- if (!string.IsNullOrEmpty(workshop))
|
|
|
+ AND ('{GOODSTYPECODE}' IS NULL or INSTR(GT.GOODSTYPECODE,'{GOODSTYPECODE}') = 1) ".Replace("{GOODSTYPECODE}", goodstypecode);
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(barcode) && string.IsNullOrEmpty(IDNRKONLYCODE))
|
|
|
{
|
|
|
- sqlStr += " AND gl.workshop in (" + workshop + ")";
|
|
|
+ if (!string.IsNullOrEmpty(datebeginMasterS))
|
|
|
+ {
|
|
|
+ sqlStr += " and t.fhtime >=@datebeginMasterS@ ";
|
|
|
+ sqlPara.Add(new CDAParameter("datebeginMasterS", datebeginMasterS, DataType.Date));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(datebeginMasterD))
|
|
|
+ {
|
|
|
+ sqlStr += " and t.fhtime <@datebeginMasterD@ ";
|
|
|
+ sqlPara.Add(new CDAParameter("datebeginMasterD", Convert.ToDateTime(datebeginMasterD).AddSeconds(1), DataType.Date));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(datebeginMasterG))
|
|
|
+ {
|
|
|
+ sqlStr += " and gdd.groutingdate >=@datebeginMasterG@ ";
|
|
|
+ sqlPara.Add(new CDAParameter("datebeginMasterG", datebeginMasterG, DataType.Date));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(dateendMasterG))
|
|
|
+ {
|
|
|
+ sqlStr += " and gdd.groutingdate <@dateendMasterG@ ";
|
|
|
+ sqlPara.Add(new CDAParameter("dateendMasterG", Convert.ToDateTime(dateendMasterG).AddDays(1), DataType.Date));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(workshop))
|
|
|
+ {
|
|
|
+ sqlStr += " AND gl.workshop in (" + workshop + ")";
|
|
|
+ }
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(barcode))
|
|
|
{
|
|
|
@@ -209,11 +214,13 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
|
|
|
if (!string.IsNullOrEmpty(IDNRKONLYCODE))
|
|
|
{
|
|
|
- sqlStr += " AND exists (select 1 from TP_PM_BARCODEIDNRKREL bb where bb.IDNRKONLYCODE = @IDNRKONLYCODE@ and bb.barcode = gdd.barcode )";
|
|
|
+ //sqlStr += " AND exists (select 1 from TP_PM_BARCODEIDNRKREL bb where bb.IDNRKONLYCODE = @IDNRKONLYCODE@ and bb.barcode = gdd.barcode )";
|
|
|
+ sqlStr += " AND exists (select 1 from TP_PM_BARCODEIDNRKREL bb where bb.IDNRKONLYCODE like @IDNRKONLYCODE@ || '%' and bb.barcode = gdd.barcode )";
|
|
|
+
|
|
|
sqlPara.Add(new CDAParameter("IDNRKONLYCODE", IDNRKONLYCODE));
|
|
|
}
|
|
|
|
|
|
- sqlStr += " order by gdd.groutingdate desc, t.fhtime desc, gdd.barcode ";
|
|
|
+ sqlStr += " order by gdd.groutingdate desc, t.fhtime desc, gdd.barcode ";
|
|
|
try
|
|
|
{
|
|
|
JsonResult data = Easyui.ExecuteJsonResult(conn, sqlStr, sqlPara);
|
|
|
@@ -232,11 +239,13 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
if (m == "materiel")
|
|
|
{
|
|
|
string barcode = context.Request["barcode"];
|
|
|
- if(!string.IsNullOrEmpty(context.Request["barcodeDB"] +""))
|
|
|
+ if (!string.IsNullOrEmpty(context.Request["barcodeDB"] + ""))
|
|
|
{
|
|
|
barcode = context.Request["barcodeDB"];
|
|
|
}
|
|
|
- DataTable dt = conn.ExecuteDatatable(@"
|
|
|
+ string IDNRKONLYCODE = context.Request["IDNRKONLYCODE"];
|
|
|
+
|
|
|
+ string sql = @"
|
|
|
SELECT
|
|
|
b.MATNR AS 物料,
|
|
|
m.POSNR AS 项目,
|
|
|
@@ -255,11 +264,21 @@ public class rpt : IHttpHandler, IReadOnlySessionState
|
|
|
LEFT JOIN TP_PM_BARCODEIDNRKREL bb on bb.barcode = gdd.barcode and m.IDNRK = bb.IDNRK
|
|
|
WHERE
|
|
|
m.VALUEFLAG = '1'
|
|
|
- AND b.VALUEFLAG = '1'
|
|
|
- AND (gdd.BARCODE = @BARCODE@ or gdd.OUTLABELCODE = @BARCODE@ )
|
|
|
- ",
|
|
|
- new CDAParameter("BARCODE",barcode)
|
|
|
- );
|
|
|
+ AND b.VALUEFLAG = '1'";
|
|
|
+
|
|
|
+ List<CDAParameter> sps = new List<CDAParameter>();
|
|
|
+ if (!string.IsNullOrWhiteSpace(barcode))
|
|
|
+ {
|
|
|
+ sql += " and gdd.BARCODE = @BARCODE@";
|
|
|
+ sps.Add(new CDAParameter("BARCODE", barcode));
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrWhiteSpace(IDNRKONLYCODE))
|
|
|
+ {
|
|
|
+ sql += " and bb.IDNRKONLYCODE like @IDNRKONLYCODE@ || '%'";
|
|
|
+ sps.Add(new CDAParameter("IDNRKONLYCODE", IDNRKONLYCODE));
|
|
|
+ }
|
|
|
+
|
|
|
+ DataTable dt = conn.ExecuteDatatable(sql, sps.ToArray());
|
|
|
jsonStr = new JsonResult(dt).ToJson();
|
|
|
}
|
|
|
//===============================================
|