From 8affd199e02bd37f0dcb16447d1fbcaa34bfa2f8 Mon Sep 17 00:00:00 2001 From: lan <lan@DESKTOP-MG88OFJ> Date: 星期四, 30 五月 2024 10:39:43 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs | 275 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 259 insertions(+), 16 deletions(-) diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs index b3468e2..b5fb9f7 100644 --- a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs +++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckBillController.cs @@ -15,7 +15,8 @@ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); public DAL.ClsSb_EquipDotCheckBill BillNew = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� - public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + public DAL.ClsSb_EquipDotCheckBill BillOld = new DAL.ClsSb_EquipDotCheckBill(); //瀵瑰簲鍗曟嵁绫� + Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); //鑾峰彇绯荤粺鍙傛暟 #region 璁惧鐐规璁板綍琛� @@ -38,15 +39,34 @@ objJsonResult.data = null; return objJsonResult; } - if (sWhere == null || sWhere.Equals("")) + + string sReturn = ""; + string HViewName = "h_v_Sb_EquipDotCheckBillList";//瑙嗗浘鍛藉悕 + if (oSystemParameter.ShowBill(ref sReturn) == true) { - ds = oCN.RunProcReturn("select * from h_v_Sb_EquipDotCheckBillList " + sWhere + " order by hmainid desc", "h_v_Sb_EquipDotCheckBillList"); + if (oSystemParameter.omodel.WMS_CampanyName == "涔濊彵") + { + HViewName = "h_v_Sb_EquipDotCheckBillMainList"; + } } else { - string sql1 = "select * from h_v_Sb_EquipDotCheckBillList where 1 = 1"; + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁璇诲彇澶辫触锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from " + HViewName + " " + sWhere + " order by hmainid desc", HViewName); + } + else + { + string sql1 = "select * from " + HViewName + " " + " where 1 = 1"; string sql = sql1 + sWhere + " order by hmainid desc"; - ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBillList"); + ds = oCN.RunProcReturn(sql, HViewName); } //娣诲姞鍒楀悕 foreach (DataColumn col in ds.Tables[0].Columns) @@ -285,7 +305,29 @@ return objJsonResult; } - bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + //鍒犻櫎鍓嶆帶鍒� + DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Sb_EquipDotCheckBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Sb_EquipDotCheckBill_BeforeDelCtrl"); + if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触锛�" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + + bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sb_EquipDotCheckBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo); if (IsDete) { objJsonResult.code = "0"; @@ -340,7 +382,7 @@ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); if (sqlWhere == null || sqlWhere.Equals("")) { - ds = oCN.RunProcReturn("select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰浠g爜 as HDotCheckCode ,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart ,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,璐熻矗浜篒D HManagerID,璐熻矗浜虹紪鐮� HManagerCode,璐熻矗浜� HManagerName from h_v_Sb_EquipDotCheckBillList", "h_v_Sb_EquipDotCheckBillList"); + ds = oCN.RunProcReturn("select * from h_v_Sb_EquipDotCheckBill_Edit", "h_v_Sb_EquipDotCheckBill_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -348,9 +390,9 @@ } else { - string sql1 = "select 鐐规椤圭洰ID HDotCheckItemID,鐐规椤圭洰浠g爜 as HDotCheckCode ,鐐规椤圭洰 HDotCheckItem,鐐规閮ㄤ綅 HDotCheckPart,鍏蜂綋瑕佹眰 HClaim,琛ㄤ綋澶囨敞 HRemark,璐熻矗浜篒D HManagerID,璐熻矗浜虹紪鐮� HManagerCode,璐熻矗浜� HManagerName from h_v_Sb_EquipDotCheckBillList where 1 = 1 "; + string sql1 = "select * from h_v_Sb_EquipDotCheckBill_Edit where 1 = 1 "; string sql = sql1 + sqlWhere; - ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBillList"); + ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckBill_Edit"); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�"; @@ -369,13 +411,8 @@ #endregion - - - #endregion - - #region 璁惧鐐规璁板綍鍗昉DA #region 鏍规嵁璁惧鏉$爜鏌ユ壘璁惧妗f淇℃伅PDA [Route("Sb_PDA_EquipDotCheckBill/txtHBarCode_KeyDown")] @@ -506,8 +543,8 @@ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 //oItemSub.HRemark = ""; //澶囨敞 - oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� - oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� + //oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮� + //oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮� //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿 //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷 //oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺 @@ -559,7 +596,213 @@ } #endregion + #region 璁惧鐐规璁板綍鍗曞鏍�/鍙嶅鏍稿姛鑳� + [Route("Sb_EquipDotCheckBill/CheckSb_EquipDotCheckBill")] + [HttpGet] + public object CheckSb_EquipDotCheckBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckBill_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬鏍�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + if (!BillOld.CheckBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (BillOld.AbandonCheck(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } #endregion + #region 璁惧鐐规璁板綍鍗曞叧闂�/鍙嶅叧闂姛鑳� + [Route("Sb_EquipDotCheckBill/CloseSb_EquipDotCheckBill")] + [HttpGet] + public object CloseSb_EquipDotCheckBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckBill_Close", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愬叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (string.IsNullOrWhiteSpace(HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ClsPub.CurUserName = user; + + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + + oCN.Commit();//鎻愪氦浜嬪姟 + + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鎵ц鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; ; + + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧鐐规閫炬湡棰勮鎶ヨ〃 + + [Route("Sb_EquipDotCheckWarning/Report")] + [HttpGet] + public object Report(string HYear,string HMonth,string HEquipTypeID, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //if (!DBUtility.ClsPub.Security_Log("Gy_EquipFileList", 1, false, user)) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "娌℃湁鏌ョ湅鏉冮檺"; + // objJsonResult.data = null; + // return objJsonResult; + //} + if (HYear == null || HYear.Equals("") || HMonth == null || HMonth.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "璇烽�夋嫨鏈夋晥骞翠唤锛屾湀浠�"; + objJsonResult.data = ""; + objJsonResult.list = columnNameList; + return objJsonResult; + } + else + { + string sql = "exec h_p_Sb_EquipDotCheckWarningReport " + HYear + "," + HMonth + "," + HEquipTypeID; + ds = oCN.RunProcReturn(sql, "h_p_Sb_EquipDotCheckWarningReport"); + } + + //娣诲姞鍒楀悕 + foreach (DataColumn col in ds.Tables[0].Columns) + { + Type dataType = col.DataType; + string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; + columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕 + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1