|
|
@@ -354,42 +354,53 @@ public class materiaplan : IHttpHandler, IReadOnlySessionState
|
|
|
|
|
|
DataTable dtToLogt = conn.ExecuteDatatable(@"
|
|
|
SELECT 1
|
|
|
- FROM TP_MST_PACKINGINRELATION
|
|
|
- WHERE IDNRK = @IDNRK@ ",
|
|
|
- new CDAParameter("IDNRK", jObject["TOLOGT"].ToString(), DataType.VarChar)
|
|
|
+ FROM TP_MST_PACKINGINRELATION_NEW
|
|
|
+ WHERE IDNRK = @IDNRK@ AND CREATEUSERID = @CREATEUSERID@",
|
|
|
+ new CDAParameter("IDNRK", jObject["IDNRK"].ToString(), DataType.VarChar),
|
|
|
+ new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"])
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
if (dtToLogt.Rows.Count == 0)
|
|
|
{
|
|
|
result += conn.ExecuteNonQuery(@"
|
|
|
- INSERT INTO TP_MST_PACKINGINRELATION
|
|
|
+ INSERT INTO TP_MST_PACKINGINRELATION_NEW
|
|
|
(IDNRK,
|
|
|
TOLOGT,
|
|
|
LGORT,
|
|
|
WERKS,
|
|
|
+ CREATEUSERID,
|
|
|
+ UPDATEUSERID,
|
|
|
NAME )
|
|
|
VALUES
|
|
|
(@IDNRK@,
|
|
|
@TOLOGT@,
|
|
|
@LGORT@,
|
|
|
'5000',
|
|
|
+ @CREATEUSERID@,
|
|
|
+ @UPDATEUSERID@,
|
|
|
@NAME@ ) ",
|
|
|
new CDAParameter("NAME", jObject["NAME"].ToString()),
|
|
|
new CDAParameter("LGORT", jObject["POSITION"].ToString()),
|
|
|
new CDAParameter("IDNRK", jObject["IDNRK"].ToString()),
|
|
|
+ new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"]),
|
|
|
+ new CDAParameter("UPDATEUSERID", HttpContext.Current.Session["userId"]),
|
|
|
new CDAParameter("TOLOGT", jObject["TOLOGT"].ToString())
|
|
|
);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result += conn.ExecuteNonQuery(@"
|
|
|
- UPDATE TP_MST_PACKINGINRELATION
|
|
|
+ UPDATE TP_MST_PACKINGINRELATION_NEW
|
|
|
SET UPDATETIME = SYSDATE,
|
|
|
- TOLOGT = @TOLOGT@
|
|
|
+ TOLOGT = @TOLOGT@,
|
|
|
+ LGORT = @LGORT@
|
|
|
WHERE IDNRK = @IDNRK@
|
|
|
- AND ROWNUM = 1 ",
|
|
|
+ AND CREATEUSERID = @CREATEUSERID@ ",
|
|
|
new CDAParameter("TOLOGT", jObject["TOLOGT"].ToString()),
|
|
|
- new CDAParameter("IDNRK", jObject["IDNRK"].ToString())
|
|
|
+ new CDAParameter("LGORT", jObject["POSITION"].ToString()),
|
|
|
+ new CDAParameter("IDNRK", jObject["IDNRK"].ToString()),
|
|
|
+ new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"])
|
|
|
+
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -754,14 +765,8 @@ public class materiaplan : IHttpHandler, IReadOnlySessionState
|
|
|
ON T2.IDNRK = T1.IDNRK) T3
|
|
|
LEFT JOIN TP_PC_BOMPACKUNIT BU
|
|
|
ON BU.IDNRK = T3.IDNRK
|
|
|
- LEFT JOIN (SELECT T.*
|
|
|
- FROM (SELECT PR.IDNRK,
|
|
|
- PR.LGORT,
|
|
|
- PR.TOLOGT,
|
|
|
- RANK() OVER(PARTITION BY PR.IDNRK ORDER BY PR.UPDATETIME DESC, ROWNUM) AS RK
|
|
|
- FROM TP_MST_PACKINGINRELATION PR) T
|
|
|
- WHERE T.RK <= 1) T5
|
|
|
- ON T5.IDNRK = T3.IDNRK ";
|
|
|
+ LEFT JOIN TP_MST_PACKINGINRELATION_NEW T5
|
|
|
+ ON T5.IDNRK = T3.IDNRK AND T5.CREATEUSERID = @CREATEUSERID@";
|
|
|
|
|
|
if (sort != "")
|
|
|
{
|
|
|
@@ -771,6 +776,7 @@ public class materiaplan : IHttpHandler, IReadOnlySessionState
|
|
|
{
|
|
|
sqlStr += " ORDER BY T3.NAME";
|
|
|
}
|
|
|
+ sqlPara.Add(new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"]));
|
|
|
|
|
|
DataTable dt = conn.ExecuteDatatable(sqlStr, sqlPara.ToArray());
|
|
|
|
|
|
@@ -993,14 +999,8 @@ public class materiaplan : IHttpHandler, IReadOnlySessionState
|
|
|
PBD.MEINS) T1
|
|
|
LEFT JOIN TP_PC_BOMPACKUNIT BU
|
|
|
ON BU.IDNRK = T1.IDNRK
|
|
|
- LEFT JOIN (SELECT T.*
|
|
|
- FROM (SELECT PR.IDNRK,
|
|
|
- PR.LGORT,
|
|
|
- PR.TOLOGT,
|
|
|
- RANK() OVER(PARTITION BY PR.IDNRK ORDER BY PR.UPDATETIME DESC, ROWNUM) AS RK
|
|
|
- FROM TP_MST_PACKINGINRELATION PR) T
|
|
|
- WHERE T.RK <= 1) T5
|
|
|
- ON T5.IDNRK = T1.IDNRK ";
|
|
|
+ LEFT JOIN TP_MST_PACKINGINRELATION_NEW T5
|
|
|
+ ON T5.IDNRK = T1.IDNRK AND T5.CREATEUSERID = @CREATEUSERID@ ";
|
|
|
|
|
|
if (sort != "")
|
|
|
{
|
|
|
@@ -1010,6 +1010,7 @@ public class materiaplan : IHttpHandler, IReadOnlySessionState
|
|
|
{
|
|
|
sqlStr += " ORDER BY T1.NAME";
|
|
|
}
|
|
|
+ sqlPara.Add(new CDAParameter("CREATEUSERID", HttpContext.Current.Session["userId"]));
|
|
|
|
|
|
DataTable dt = conn.ExecuteDatatable(sqlStr, sqlPara.ToArray());
|
|
|
|