| | |
| | | using SyntacticSugar.constant; |
| | | using DBUtility; |
| | | using System.Text; |
| | | using System.Web; |
| | | using WebAPI.Controllers.SCGL.æ¥è®¡å管ç; |
| | | using System.IO; |
| | | using System.Text.RegularExpressions; |
| | | |
| | | namespace WebAPI.Controllers.åºç¡èµæ.åºç¡èµæ |
| | | { |
| | |
| | | // å表å é¤ |
| | | string delWhereStr = "(" + string.Join(",", delEntryIDList.ToArray()) + ")"; |
| | | string sql2 = "Delete from Gy_PNLInfoSub where HEntryID in " + delWhereStr; |
| | | //LogService.Write("æ§è¡SQLè¯å¥ï¼" + sql2); |
| | | LogService.Write("æ§è¡SQLè¯å¥ï¼" + sql2); |
| | | oCN.RunProcReturn(sql2, "Gy_PNLInfoSub"); |
| | | |
| | | |
| | |
| | | |
| | | // 夿æ¯å¦æsetç æè
PCSç éå¤çé¨å |
| | | ds = oCN.RunProcReturn("select top 1 HEntryID from Gy_PNLInfoSub where HSetNo in " + HSetNoInStr |
| | | + "AND HPCSNo in " + HPCSNoInStr, "Gy_PNLInfoSub"); |
| | | //LogService.Write("æ§è¡ SQL è¯å¥: select top 1 HEntryID from Gy_PNLInfoSub where HSetNo in " + HSetNoInStr |
| | | // + "AND HPCSNo in " + HPCSNoInStr); |
| | | + " AND HPCSNo in " + HPCSNoInStr + "and HInterID = " + list[0].HInterID , "Gy_PNLInfoSub"); |
| | | LogService.Write("æ§è¡ SQL è¯å¥: select top 1 HEntryID from Gy_PNLInfoSub where HSetNo in " + HSetNoInStr |
| | | + " AND HPCSNo in " + HPCSNoInStr + "and HInterID = " + list[0].HInterID); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region å®¡æ ¸PNLå¸å± |
| | | [Route("Gy_PNLInfoController/CheckBill")] |
| | | [HttpGet] |
| | | public object CheckBill(int HInterID, string user, int IsAudit) |
| | | { |
| | | try |
| | | { |
| | | //å®¡æ ¸æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_PNLInfo_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼æ æéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | var ds = oCN.RunProcReturn("select top 1 HCheckMan from Gy_PNLInfo where HInterID=" + HInterID, "Gy_PNLInfo"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (IsAudit == 0) //å®¡æ ¸å¤æ |
| | | { |
| | | if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["HCheckMan"].ToString()) != true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®å·²å®¡æ ¸!ä¸è½åæ¬¡å®¡æ ¸ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsAudit == 1) //åå®¡æ ¸å¤æ |
| | | { |
| | | if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["HCheckMan"].ToString()) == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªå®¡æ ¸!ä¸éè¦åå®¡æ ¸!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | if (IsAudit == 0) //å®¡æ ¸å¤æ |
| | | { |
| | | //å®¡æ ¸åæ§å¶========================================= |
| | | ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeCheckCtrl"); |
| | | if (ds == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | oCN.RunProc("update Gy_PNLInfo set HCheckMan='" + user + "',HCheckDate=getdate() where HInterID=" + HInterID); |
| | | |
| | | //å®¡æ ¸åæ§å¶========================================= |
| | | DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterCheckCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å®¡æ ¸æå"; |
| | | objJsonResult.data = null; |
| | | } |
| | | if (IsAudit == 1) //åå®¡æ ¸å¤æ |
| | | { |
| | | //åå®¡æ ¸åæ§å¶========================================= |
| | | ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeUnCheckCtrl"); |
| | | if (ds == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | oCN.RunProc("update Gy_PNLInfo set HCheckMan='',HCheckDate=null where HInterID=" + HInterID); |
| | | |
| | | |
| | | //åå®¡æ ¸åæ§å¶========================================= |
| | | DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterUnCheckCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterUnCheckCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åå®¡æ ¸æå"; |
| | | objJsonResult.data = null; |
| | | } |
| | | |
| | | |
| | | |
| | | oCN.Commit(); |
| | | |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®¡æ ¸å¤±è´¥æè
åå®¡æ ¸å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region ç¦ç¨PNLå¸å± |
| | | [Route("Gy_PNLInfoController/StopBill")] |
| | | [HttpGet] |
| | | public object StopBill(int HInterID, string user, int IsStop) |
| | | { |
| | | try |
| | | { |
| | | //ç¦ç¨æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_PNLInfo_Stop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼æ æéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | var ds = oCN.RunProcReturn("select top 1 HStopMan from Gy_PNLInfo where HInterID=" + HInterID, "Gy_PNLInfo"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (IsStop == 0) //ç¦ç¨å¤æ |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HStopMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "忮已ç¦ç¨!ä¸è½å次ç¦ç¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (IsStop == 1) //åç¦ç¨å¤æ |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HStopMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®æªç¦ç¨!ä¸éè¦åç¦ç¨!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åæ®ä¸åå¨!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | if (IsStop == 0) //ç¦ç¨å¤æ |
| | | { |
| | | //ç¦ç¨åæ§å¶========================================= |
| | | ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeStopCtrl"); |
| | | if (ds == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | oCN.RunProc("update Gy_PNLInfo set HStopMan='" + user + "',HStopDate=getdate() where HInterID=" + HInterID); |
| | | |
| | | //ç¦ç¨åæ§å¶========================================= |
| | | DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterStopCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ç¦ç¨æå"; |
| | | objJsonResult.data = null; |
| | | } |
| | | if (IsStop == 1) //åç¦ç¨å¤æ |
| | | { |
| | | //åç¦ç¨åæ§å¶========================================= |
| | | ds = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_BeforeUnStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_BeforeUnStopCtrl"); |
| | | if (ds == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | oCN.RunProc("update Gy_PNLInfo set HStopMan='',HStopDate=null where HInterID=" + HInterID); |
| | | |
| | | |
| | | //åç¦ç¨åæ§å¶========================================= |
| | | DataSet ds2 = oCN.RunProcReturn("Exec h_p_Gy_PNLInfo_AfterUnStopCtrl " + HInterID + ",'" + user + "'", "h_p_Gy_PNLInfo_AfterUnStopCtrl"); |
| | | if (ds2 == null) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨åå¤æå¤±è´¥ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨å¤±è´¥ï¼" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åç¦ç¨æå"; |
| | | objJsonResult.data = null; |
| | | } |
| | | oCN.Commit(); |
| | | |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ç¦ç¨å¤±è´¥æè
åç¦ç¨å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region PNLå¸å±ä¿¡æ¯ æä»¶ä¸ä¼ |
| | | [Route("Gy_PNLInfo/Gy_PNLInfo_Excel")] |
| | | [HttpPost] |
| | | public object Gy_PNLInfo_Excel() |
| | | { |
| | | try |
| | | { |
| | | //var WorkBookName = HttpContext.Current.Request["WorkBookName"]; |
| | | //DBUtility.ClsPub.HOrgID = long.Parse(HttpContext.Current.Request["HOrgID"]); |
| | | //è·åæä»¶åç§° |
| | | var file = HttpContext.Current.Request.Files[0]; |
| | | //è·åæä»¶ç©çè·¯å¾ |
| | | string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName); |
| | | //ä¿åæä»¶ |
| | | file.SaveAs(ExcelPath); |
| | | |
| | | NpoiHelper np = new NpoiHelper(); |
| | | DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0"); |
| | | |
| | | //å 餿件 |
| | | File.Delete(ExcelPath); |
| | | |
| | | //å建临æ¶è¡¨ |
| | | DataTable tb2 = new DataTable("dt2"); |
| | | |
| | | //æ·»å åå |
| | | for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++) |
| | | { |
| | | tb2.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString()); |
| | | } |
| | | |
| | | //模æ¿ç¼ºå°å ä½éè¦ä»æ°æ®åºä¸æ¥è¯¢åºæ¥æ¾ç¤ºå¨é¡µé¢çåæ®µ |
| | | tb2.Columns.Add("Setå·", typeof(string)); |
| | | tb2.Columns.Add("è¡ç´¢å¼", typeof(Int32)); |
| | | tb2.Columns.Add("åç´¢å¼", typeof(Int32)); |
| | | tb2.Columns.Add("HPNLInfoTypeID", typeof(Int32)); |
| | | |
| | | //æ·»å æ°æ® |
| | | for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++) |
| | | { |
| | | DataRow row = tb2.NewRow(); |
| | | for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++) |
| | | { |
| | | row[j] = ExcelDs.Tables[0].Rows[i][j].ToString(); |
| | | } |
| | | //å¦æè¡¨æ ¼ç¬¬iè¡ç第ä¸å为空ï¼åå¤æä¸ºè¿ä¸è¡çæ°æ®ä¸ºç©ºï¼è·³åºå¾ªç¯å¹¶ä¸ä¸ææ°æ®åå
¥ tb2 |
| | | if (ExcelDs.Tables[0].Rows[i][0].ToString() == "") |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows.Add(row); |
| | | } |
| | | } |
| | | |
| | | |
| | | var error = ""; |
| | | |
| | | //æ¥è¯¢å¯¼å
¥æ¨¡æ¿æ²¡æçå |
| | | if (!tb2.Columns.Contains("æå·")) |
| | | error += "ä¸ä¼ æä»¶ä¸æ²¡ææ¾å°ãæå·ãçæ é¢,"; |
| | | |
| | | if (!tb2.Columns.Contains("åç±»")) |
| | | error += "ä¸ä¼ æä»¶ä¸æ²¡ææ¾å°ãåç±»ãçæ é¢,"; |
| | | |
| | | if (!tb2.Columns.Contains("PCSå·")) |
| | | error += "ä¸ä¼ æä»¶ä¸æ²¡ææ¾å°ãPCSå·ãçæ é¢,"; |
| | | |
| | | |
| | | if (error.Length > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = $"Excel模æ¿åå¨é误,{error}\r\n"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string HLayOutName_temp = ""; |
| | | string HPNLInfoTypeName_temp = ""; |
| | | List<string> HPCSNo_Array = new List<string>(); |
| | | if (tb2.Rows.Count > 0) |
| | | { |
| | | HLayOutName_temp = DBUtility.ClsPub.isStrNull(tb2.Rows[0]["æå·"].ToString()); |
| | | HPNLInfoTypeName_temp = DBUtility.ClsPub.isStrNull(tb2.Rows[0]["åç±»"].ToString()); |
| | | } |
| | | |
| | | for (int i = 0; i <= tb2.Rows.Count - 1; i++) |
| | | { |
| | | string HLayOutName = ""; //æå· |
| | | string HPNLInfoTypeName = ""; //åç±» |
| | | string HPCSNo = ""; //PCSå· |
| | | |
| | | HLayOutName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["æå·"].ToString()); |
| | | HPNLInfoTypeName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["åç±»"].ToString()); |
| | | HPCSNo = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["PCSå·"].ToString()); |
| | | |
| | | //æ£æ¥æ°æ®æ¯å¦å®æ´ |
| | | int index = i + 2; |
| | | |
| | | if (HLayOutName != "") |
| | | { |
| | | if (HLayOutName != HLayOutName_temp) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,ãæå·ãä¸é¦è¡æ°æ®ä¸ãæå·ãä¸ä¸è´ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HPNLInfoTypeName != HPNLInfoTypeName_temp) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,ãåç±»ãä¸é¦è¡æ°æ®ä¸ãåç±»ãä¸ä¸è´ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (HPCSNo_Array.Contains(HPCSNo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,ãPCSå·ãåå¨éå¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | HPCSNo_Array.Add(HPCSNo); |
| | | } |
| | | |
| | | |
| | | //æ¥è¯¢æå·èµææ¯å¦å·²ç»åå¨ |
| | | ds = oCN.RunProcReturn("select * from Gy_PNLInfo where HLayOutName = '" + HLayOutName + "' ", "Gy_PNLInfo"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,æå·ã" + HLayOutName + "ãèµæå·²ç»åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //æ¥è¯¢ åç±» |
| | | ds = oCN.RunProcReturn("select * from Gy_PNLInfoType where HName = '" + HPNLInfoTypeName + "' ", "Gy_PNLInfoType"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,åç±»ã" + HPNLInfoTypeName + "ãä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["HPNLInfoTypeID"] = ds.Tables[0].Rows[0]["HInterID"]; |
| | | } |
| | | |
| | | //夿PCSå·æ ¼å¼æ¯å¦æ£ç¡® |
| | | if (!Regex.IsMatch(HPCSNo, @"^\d{6}$")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,PCSå·ã" + HPCSNo + "ãæ ¼å¼é误ï¼åºè®¾ç½®ä¸ºç±6使°åç»æï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | tb2.Rows[i]["Setå·"] = HPCSNo.Substring(0, 2); |
| | | tb2.Rows[i]["è¡ç´¢å¼"] = int.Parse(HPCSNo.Substring(2, 2)); |
| | | tb2.Rows[i]["åç´¢å¼"] = int.Parse(HPCSNo.Substring(4, 2)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = error; |
| | | objJsonResult.data = tb2; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region PNLå¸å±ä¿¡æ¯ 导å
¥(ä¿å) |
| | | [Route("Gy_PNLInfo/Gy_PNLInfo_btnSave")] |
| | | [HttpPost] |
| | | public object Gy_PNLInfo_btnSave([FromBody] JObject sMainSub) |
| | | { |
| | | var _value = sMainSub["sMainSub"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { "&å" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string user = sArray[1].ToString(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_PNLInfo_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2); |
| | | List<Dictionary<string, string>> list = new List<Dictionary<string, string>>(); |
| | | |
| | | foreach (JObject item in Excel) |
| | | { |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | foreach (var itm in item.Properties()) |
| | | { |
| | | dic.Add(itm.Name, itm.Value.ToString()); |
| | | } |
| | | list.Add(dic); |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | int i = 1; |
| | | foreach (Dictionary<string, string> item in list) |
| | | { |
| | | string HInterID = "0"; |
| | | string HLayOutName = item["æå·"].ToString(); //æå· |
| | | string HPNLInfoTypeID = item["HPNLInfoTypeID"].ToString(); //åç±»ID |
| | | string HPNLInfoTypeName = item["åç±»"].ToString(); //åç±» |
| | | string HSetNo = item["Setå·"].ToString(); //Setå· |
| | | string HPCSNo = item["PCSå·"].ToString(); //PCSå· |
| | | string HPosition_x = item["è¡ç´¢å¼"].ToString(); //è¡ç´¢å¼ |
| | | string HPosition_y = item["åç´¢å¼"].ToString(); //åç´¢å¼ |
| | | |
| | | //æ£æ¥æ°æ®æ¯å¦å®æ´ |
| | | int index = i; |
| | | |
| | | if (i == 1) |
| | | { |
| | | //æ¥è¯¢æå·èµææ¯å¦å·²ç»åå¨ |
| | | ds = oCN.RunProcReturn("select * from Gy_PNLInfo where HLayOutName = '" + HLayOutName + "' ", "Gy_PNLInfo"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,æå·ã+ " + HLayOutName + "ãèµæå·²ç»åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string HIcon = "/img/æºè½è¯çï¼.png"; |
| | | string HMaker = user; |
| | | |
| | | string sql_main = "insert into Gy_PNLInfo(HLayOutName,HIcon,HMaker,HMakeDate,HPNLInfoTypeID) " + |
| | | "values(" + |
| | | "'" + HLayOutName + "'" + |
| | | ",'" + HIcon + "'" + |
| | | ",'" + HMaker + "'" + |
| | | ",getdate()" + |
| | | "," + HPNLInfoTypeID + "" + |
| | | ")"; |
| | | oCN.RunProc(sql_main); |
| | | } |
| | | |
| | | string sql_getInterID = "select * from Gy_PNLInfo where HLayOutName = '" + HLayOutName + "'"; |
| | | ds = oCN.RunProcReturn(sql_getInterID, "Gy_PNLInfo"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "PNLå¸å±ä¿¡æ¯å¯¼å
¥å¤±è´¥ï¼ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | HInterID = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HInterID"]); |
| | | } |
| | | |
| | | //æ¥è¯¢ åç±» |
| | | ds = oCN.RunProcReturn("select * from Gy_PNLInfoType where HName = '" + HPNLInfoTypeName + "' ", "Gy_PNLInfoType"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,åç±»ã+ " + HPNLInfoTypeName + "ãä¸åå¨ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //夿PCSå·æ ¼å¼æ¯å¦æ£ç¡® |
| | | if (!Regex.IsMatch(HPCSNo, @"^\d{6}$")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "第" + index + "è¡,PCSå·ã" + HPCSNo + "ãæ ¼å¼é误ï¼åºè®¾ç½®ä¸ºç±6使°åç»æï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | string sql_sub = "insert into Gy_PNLInfoSub(HInterID,HLayOutName,HSetNo,HPCSNo,HPosition_x,HPosition_y) " + |
| | | "values(" + |
| | | "" + HInterID + "" + |
| | | ",'" + HLayOutName + "'" + |
| | | ",'" + HSetNo + "'" + |
| | | ",'" + HPCSNo + "'" + |
| | | "," + HPosition_x + "" + |
| | | "," + HPosition_y + "" + |
| | | ")"; |
| | | oCN.RunProc(sql_sub); |
| | | i++; |
| | | } |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "导å
¥æå!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write(e); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |