From 38bd77018665edaae981bf1c9d80b66711802f93 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期二, 15 四月 2025 14:53:22 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs | 2036 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 1,873 insertions(+), 163 deletions(-) diff --git a/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs b/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs index daa5cb8..880b697 100644 --- a/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs +++ b/WebAPI/Controllers/CJGL/Sc_WorkBeginDotCheckBillController.cs @@ -10,7 +10,9 @@ using System.Web.Http; using System.Windows.Forms; using WebAPI.Models; - +using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�; +using System.IO; +using SyntacticSugar.constant; namespace WebAPI.Controllers.CJGL { public class Sc_WorkBeginDotCheckBillController : ApiController @@ -18,9 +20,13 @@ public DBUtility.ClsPub.Enum_BillStatus BillStatus;//鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛� private json objJsonResult = new json(); public DataSet ds = new DataSet(); + public DataSet ds1 = new DataSet(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); - public DAL.ClsSc_WorkBeginDotCheckBillMain OBill = new DAL.ClsSc_WorkBeginDotCheckBillMain(); - public DAL.ClsSc_WorkBeginDotCheckBillMain BillOld = new DAL.ClsSc_WorkBeginDotCheckBillMain(); + public DAL.ClsSc_WorkBeginDotCheckBillMain OBill = new DAL.ClsSc_WorkBeginDotCheckBillMain(); //鍚姩鐐规鍗� + public DAL.ClsSc_WorkBeginDotCheckBillMain BillOld = new DAL.ClsSc_WorkBeginDotCheckBillMain();//鍚姩鐐规鍗� + public DAL.ClsGy_WorkBeginDotCheckListBillMain OBill1 = new DAL.ClsGy_WorkBeginDotCheckListBillMain(); //璁惧鍚姩鐐规娓呭崟 + public DAL.ClsGy_WorkBeginDotCheckListBillMain BillOld1 = new DAL.ClsGy_WorkBeginDotCheckListBillMain(); //璁惧鍚姩鐐规娓呭崟 + #region 鍚姩鐐规鍒楄〃 鏌ヨ @@ -80,6 +86,62 @@ } #endregion + #region 鍚姩鐐规鍗� 鍒嗛〉鍒楄〃 + [Route("Sc_WorkBeginDotCheckBill/get锘縎c_WorkBeginDotCheckBillListPage")] + [HttpGet] + public json get锘縎c_WorkBeginDotCheckBillListPage(string sWhere, string user, int page, int size) + { + DataSet ds; + json res = new json(); + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_WorkBeginDotCheckBillMain_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳潈闄愭煡璇紒"; + objJsonResult.data = null; + return objJsonResult; + } + sWhere = sWhere.Replace("'", "''"); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("exec h_p_Sc_WorkBeginDotCheckBillList " + page + "," + size + ",''", "h_p_Sc_WorkBeginDotCheckBillList"); + } + else + { + ds = oCN.RunProcReturn("exec h_p_Sc_WorkBeginDotCheckBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_WorkBeginDotCheckBillList"); + } + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + res.code = CodeConstant.SUCCEED; + res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + res.Message = "Sucess锛�"; + res.list = columnNameList; + res.data = ds.Tables[0]; + return res; + } + catch (Exception e) + { + res.code = CodeConstant.FAIL; + res.count = CountConstant.FAIL; + res.Message = "Exception锛�" + e.ToString(); + res.data = null; + return res; + } + } + #endregion + + #region 鍚姩鐐规鍒楄〃 鑾峰彇缂栬緫鍒楄〃鏁版嵁 [Route("Sc_WorkBeginDotCheckBill/锘縎c_WorkBeginDotCheckBillMainEditList")] [HttpGet] @@ -108,7 +170,7 @@ return objJsonResult; } - ds = oCN.RunProcReturn("select * from h_v_Sc_WorkBeginDotCheckBillMainList where HInterID = " + HInterID, " h_v_Sc_WorkBeginDotCheckBillMainList"); + ds = oCN.RunProcReturn("select * from h_v_Sc_WorkBeginDotCheckBillMainList_Edit where HInterID = " + HInterID, " h_v_Sc_WorkBeginDotCheckBillMainList_Edit"); objJsonResult.code = "1"; objJsonResult.count = 1; @@ -211,7 +273,7 @@ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); - oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") { @@ -312,10 +374,78 @@ objJsonResult.data = null; return objJsonResult; } + string s = ""; + DAL.ClsSc_WorkBeginDotCheckBillMain BillOld = new DAL.ClsSc_WorkBeginDotCheckBillMain(); + if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙垹闄� + if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽鍒犻櫎锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oCN.BeginTran(); + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + oCN.RunProc("delete from Sc_WorkBeginDotCheckBillMain where HInterID = " + HInterID); + oCN.RunProc("delete from Sc_WorkBeginDotCheckBillSub where HInterID = " + HInterID); + + //鍒犻櫎鍚庢帶鍒�================================================================================== + string sql2 = "exec h_p_Sc_WorkBeginDotCheckBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql2, "h_p_Sc_WorkBeginDotCheckBill_AfterDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //============================================================================================== + + oCN.Commit(); @@ -361,45 +491,32 @@ objJsonResult.data = null; return objJsonResult; } - ClsPub.CurUserName = user; - BillOld.MvarItemKey = "Sc_WorkBeginDotCheckBillMain"; - oCN.BeginTran();//寮�濮嬩簨鍔� - //Type 1 瀹℃牳 2 鍙嶅鏍� - if (Type == 1) + DAL.ClsSc_WorkBeginDotCheckBillMain oBill = new DAL.ClsSc_WorkBeginDotCheckBillMain(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� + + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(long.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 { - //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 - DataSet ds; - string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); - if (ds == null || ds.Tables[0].Rows.Count == 0) + if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; objJsonResult.data = null; return objJsonResult; } - if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + if (oBill.omodel.HDeleteMan.Trim() != "") { - if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; - objJsonResult.data = null; - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; - objJsonResult.data = null; - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (Type == 1) //瀹℃牳鍒ゆ柇 + { + if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -407,42 +524,10 @@ objJsonResult.data = null; return objJsonResult; } - //瀹℃牳鍗曟嵁 - if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; - } } - } - else - { - //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� - DataSet ds; - string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); - if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + if (Type == 2) //鍙嶅鏍稿垽鏂� { - if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒"; - objJsonResult.data = null; - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒"; - objJsonResult.data = null; - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; @@ -450,25 +535,113 @@ objJsonResult.data = null; return objJsonResult; } - //鍙嶅鏍稿崟鎹� - if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; - } } } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } - oCN.Commit();//鎻愪氦浜嬪姟 + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + oCN.BeginTran(); - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鎵ц鎴愬姛锛�"; - objJsonResult.data = null; - return objJsonResult; ; + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鎻愪氦 + if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_WorkBeginDotCheckBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + oCN.RollBack(); + + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (Type == 2) //鍙嶅鏍告彁浜� + { + + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeUnCheckCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + + //鍙嶅鏍告彁浜bandonCheck + if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_WorkBeginDotCheckBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍告垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; } catch (Exception e) @@ -507,59 +680,48 @@ objJsonResult.data = null; return objJsonResult; } - + Int64 lngBillKey = 0; + lngBillKey = DBUtility.ClsPub.isLong(HInterID); ClsPub.CurUserName = user; - BillOld.MvarItemKey = "Sc_WorkBeginDotCheckBillMain"; - oCN.BeginTran();//寮�濮嬩簨鍔� + DAL.ClsSc_WorkBeginDotCheckBillMain oBill = new DAL.ClsSc_WorkBeginDotCheckBillMain(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣� - //Type 1 鍏抽棴 2 鍙嶅叧闂� - if (Type == 1) + //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔 + if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁 { - //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴 - DataSet ds; - string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); - if (ds == null || ds.Tables[0].Rows.Count == 0) + if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴锛�"; objJsonResult.data = null; return objJsonResult; } - if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + if (oBill.omodel.HChecker.Trim() == "") { - if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (Type == 1) //鍏抽棴鍒ゆ柇 + { + if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�"; objJsonResult.data = null; return objJsonResult; } - if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + } + if (Type == 2) //鍙嶅叧闂垽鏂� + { + if (oBill.omodel.HCloseMan.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; - objJsonResult.data = null; - return objJsonResult; - } - - if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!"; - objJsonResult.data = null; - return objJsonResult; - } - //鍏抽棴鍗曟嵁 - if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴锛�"; objJsonResult.data = null; return objJsonResult; } @@ -567,55 +729,101 @@ } else { - //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂� - DataSet ds; - string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; - ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); - if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) - { - if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; - objJsonResult.data = null; - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; - objJsonResult.data = null; - return objJsonResult; - } - if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!"; - objJsonResult.data = null; - return objJsonResult; - } - //鍙嶅叧闂崟鎹� - if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) - { - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo; - objJsonResult.data = null; - return objJsonResult; - } - } + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; } - oCN.Commit();//鎻愪氦浜嬪姟 - objJsonResult.code = "0"; - objJsonResult.count = 1; - objJsonResult.Message = "鎵ц鎴愬姛锛�"; - objJsonResult.data = null; - return objJsonResult; ; + //杩涜闇�瑕佽繘琛岀殑鍏抽棴/鍙嶅叧闂搷浣� + if (Type == 1) //鍏抽棴鎻愪氦 + { + //鍏抽棴鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeCloseCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:鍏抽棴鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + //鍏抽棴鎻愪氦 + if (oBill.CloseBill(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_WorkBeginDotCheckBill_AfterCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + if (Type == 2) //鍙嶅叧闂彁浜� + { + //鍙嶅叧闂墠鎺у埗========================================= + string sql1 = "exec h_p_Sc_WorkBeginDotCheckBill_BeforeUnCloseCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Sc_WorkBeginDotCheckBill_BeforeUnCloseCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:鍙嶅叧闂墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + + //鍙嶅叧闂彁浜� + if (oBill.CancelClose(lngBillKey, oBill.omodel.HBillNo, "h_p_Sc_WorkBeginDotCheckBill_AfterUnCloseCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅叧闂垚鍔�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + return objJsonResult; } catch (Exception e) @@ -759,5 +967,1507 @@ } #endregion + #region 鎶ュ伐鍙拌烦杞幏鍙栨暟鎹� + [Route("Sc_WorkBeginDotCheckBill/锘縎c_WorkBeginDotCheckBillList")] + [HttpGet] + public object Sc_WorkBeginDotCheckBillList(string HMaterID, string HProcID,string HSourceID, string SCOrder, string User) + { + try + { + List<DataTable> tableList = new List<DataTable>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_WorkBeginDotCheckBillMain_Edit", 1, false, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ澶辫触!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HMaterID == null || HMaterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐗╂枡涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HProcID == null || HProcID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "宸ュ簭涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSourceID == null || HSourceID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鐢熶骇璧勬簮涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("exec h_p_WorkBeginDotCheckList '" + HMaterID + "','" + HProcID + "','" + HSourceID + "','"+ SCOrder + "'", "h_p_WorkBeginDotCheckList"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏌ヨ鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 鏍规嵁鐢熶骇璧勬簮鑾峰彇鏈�鏂扮殑妯″叿 + [Route("Sc_WorkBeginDotCheckBill/锘縎c_WorkBeginDotCheckBill_HMould")] + [HttpGet] + public object Sc_WorkBeginDotCheckBill_HMould(string HSourceID, string User) + { + try + { + List<DataTable> tableList = new List<DataTable>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_WorkBeginDotCheckBillMain_Edit", 1, false, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ澶辫触!"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select top 1 a.*,b.HName 妯″叿鍚嶇О from Sc_MouldUpperBillSub a left join Gy_MouldFileMain b on a.HMouldID=b.HInterID where a.HSourceID='" + HSourceID + "'order by HScanDate desc", "Sc_MouldUpperBillSub"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏌ヨ鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧鍚姩鐐规娓呭崟鍒楄〃 鏌ヨ + [Route("Sc_WorkBeginDotCheckBill/getGy_WorkBeginDotCheckListBillMainList")] + [HttpGet] + public object getGy_WorkBeginDotCheckListBillMainList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkBeginDotCheckListBillMain_Check", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("select * from h_v_Gy_WorkBeginDotCheckListBillMainList order by 鍗曟嵁鍙� desc", "锘縣_v_Gy_WorkBeginDotCheckListBillMainList"); + } + else + { + string sql1 = "select * from h_v_Gy_WorkBeginDotCheckListBillMainList where 1 = 1 "; + string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc"; + ds = oCN.RunProcReturn(sql, "锘縣_v_Gy_WorkBeginDotCheckListBillMainList"); + } + + //娣诲姞鍒楀悕 + 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 + + #region 璁惧鍚姩鐐规娓呭崟鍒楄〃 鑾峰彇缂栬緫鍒楄〃鏁版嵁 + [Route("Sc_WorkBeginDotCheckBill/Gy_WorkBeginDotCheckListBillMainEditList")] + [HttpGet] + public object Gy_WorkBeginDotCheckListBillMainEditList(string HInterID, string User) + { + try + { + List<DataTable> tableList = new List<DataTable>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Edit", 1, false, User)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏌ヨ澶辫触!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + ds = oCN.RunProcReturn("select * from h_v_Gy_WorkBeginDotCheckListBillMainList_Edit where HInterID = " + HInterID, " h_v_Gy_WorkBeginDotCheckListBillMainList_Edit"); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏌ヨ鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧鍚姩鐐规娓呭崟鍗� 淇濆瓨/缂栬緫 + [Route("Sc_WorkBeginDotCheckBill/SaveGy_WorkBeginDotCheckListBillMain")] + [HttpPost] + public object SaveGy_WorkBeginDotCheckListBillMain([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 msg3 = sArray[1].ToString(); + string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗 + string user = sArray[3].ToString();//鐢ㄦ埛鍚� + + string UserName = ""; + string s = ""; + ListModels oListModels = new ListModels(); + try + { + //淇濆瓨鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkBeginDotCheckListBillMain_Edit", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹棤鏉冮檺锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + DAL.ClsGy_WorkBeginDotCheckListBillMain oBill = new DAL.ClsGy_WorkBeginDotCheckListBillMain(); + List<Model.ClsGy_WorkBeginDotCheckListBillMain> lsmain = new List<Model.ClsGy_WorkBeginDotCheckListBillMain>(); + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + lsmain = oListModels.getObjectByJson_Gy_WorkBeginDotCheckListBillMain(msg2); + foreach (Model.ClsGy_WorkBeginDotCheckListBillMain oItem in lsmain) + { + if (refSav == "Add") + { + //鍗曟嵁鍙锋槸鍚﹂噸澶� + if (OBill1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, OBill1.omodel.HInterID)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒"; + objJsonResult.data = 1; + return objJsonResult; + } + } + if (refSav == "Update") + { + if (OBill1.ShowBill(oItem.HInterID, ref s) == false) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹湁璇紒"; + objJsonResult.data = 1; + return objJsonResult; + } + //鍒ゆ柇鏄惁鍙紪杈� + if (OBill1.omodel.HChecker != "" && OBill1.omodel.HChecker != null) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + if (OBill1.omodel.HBillStatus > 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒"; + objJsonResult.data = 1; + return objJsonResult; + } + + } + UserName = oItem.HMaker; //鍒跺崟浜� + oItem.HBillType = "3744"; + oItem.HBillSubType = "3744"; + + + + oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + + if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + oBill.omodel = oItem; + } + // 琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + msg3 = msg3.Substring(1, msg3.Length - 2); + msg3 = msg3.Replace("\\", ""); + msg3 = msg3.Replace("\n", ""); //\n + List<Model.ClsGy_WorkBeginDotCheckListBillSub> ls = new List<Model.ClsGy_WorkBeginDotCheckListBillSub>(); + ls = oListModels.getObjectByJson_Gy_WorkBeginDotCheckListBillSub(msg3); + int i = 0; + foreach (Model.ClsGy_WorkBeginDotCheckListBillSub oItemSub in ls) + { + i++; + oItemSub.HEntryID = i; + + + oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); + oItemSub.HCloseType = false; //鍏抽棴绫诲瀷 + + oBill.DetailColl.Add(oItemSub); + + } + //淇濆瓨 + //淇濆瓨瀹屾瘯鍚庡鐞� + bool bResult; + if (refSav == "Add") + { + + bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); + } + else if (refSav == "Update") + { + bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); + } + else + { + bResult = false; + } + if (bResult) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "淇濆瓨鎴愬姛锛�"; + objJsonResult.data = 1; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo; + objJsonResult.data = 1; + return objJsonResult; + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString(); + objJsonResult.data = 1; + return objJsonResult; + } + } + #endregion + + #region 璁惧鍚姩鐐规娓呭崟鍗� 鍒犻櫎 + [Route("Sc_WorkBeginDotCheckBill/DeleteGy_WorkBeginDotCheckListBill")] + [HttpGet] + public object DeleteGy_WorkBeginDotCheckListBill(string HInterID, string user) + { + try + { + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Delete", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + if (HInterID == null || HInterID.Equals("")) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�"; + objJsonResult.data = null; + return objJsonResult; + } + oCN.BeginTran(); + //鍒ゆ柇瀛樺湪鎬� + if (BillOld1.ShowBill(Int64.Parse(HInterID), ref DBUtility.ClsPub.sExeReturnInfo)) + { + //鍒犻櫎鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_WorkBeginDotCheckListBill_BeforeDelCtrl " + BillOld1.omodel.HInterID + ",'" + BillOld1.omodel.HBillNo + "','" + user + "'"; + ds = oCN.RunProcReturn(sql1, "h_p_Gy_WorkBeginDotCheckListBill_BeforeDelCtrl"); + if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //================================================================================== + + //鍒犻櫎鍗曟嵁锛堝寘鍚垹闄ゅ悗鎺у埗銆佸啓鍏ユ棩蹇楋級 + if (!BillOld1.DeleteBill(BillOld1.omodel.HInterID, BillOld1.omodel.HBillNo, "h_p_Gy_WorkBeginDotCheckListBill_AfterDelCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍒犻櫎鎴愬姛锛�"; + objJsonResult.data = null; + return objJsonResult; + } + + } + + oCN.Commit(); + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧鍚姩鐐规娓呭崟鍗� 瀹℃牳/鍙嶅鏍� + [Route("Sc_WorkBeginDotCheckBill/AuditGy_WorkBeginDotCheckListBill")] + [HttpGet] + public object AuditGy_WorkBeginDotCheckListBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊鏍告潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_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; + BillOld.MvarItemKey = "Gy_WorkBeginDotCheckListBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 瀹℃牳 2 鍙嶅鏍� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳 + + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //瀹℃牳鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_WorkBeginDotCheckListBill_BeforeCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'"; + ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_WorkBeginDotCheckListBill_BeforeCheckCtrl"); + if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + + //瀹℃牳鍗曟嵁 + if (!BillOld.CheckBill(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_WorkBeginDotCheckListBill_AfterCheckCtrl",user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍� + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅鏍稿墠鎺у埗========================================= + string sql1 = "exec h_p_Gy_WorkBeginDotCheckListBill_BeforeUnCheckCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'"; + ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_WorkBeginDotCheckListBill_BeforeUnCheckCtrl"); + if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + return objJsonResult; + + } + if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + return objJsonResult; + } + //=========================================================== + //鍙嶅鏍稿崟鎹� + if (!BillOld.AbandonCheck(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_WorkBeginDotCheckListBill_AfterUnCheckCtrl",user, 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("Sc_WorkBeginDotCheckBill/CloseGy_WorkBeginDotCheckListBill")] + [HttpGet] + public object CloseGy_WorkBeginDotCheckListBill(string HInterID, int Type, string user) + { + try + { + //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_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; + BillOld.MvarItemKey = "Gy_WorkBeginDotCheckListBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 鍏抽棴 2 鍙嶅叧闂� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴 + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + + if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍏抽棴鍗曟嵁 + if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂� + DataSet ds; + string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜鍏抽棴!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶅叧闂崟鎹� + if (!BillOld.CancelClose(Int64.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("Sc_WorkBeginDotCheckBill/DropGy_WorkBeginDotCheckListBill")] + [HttpGet] + public object DropGy_WorkBeginDotCheckListBill(string HInterID, int Type, string user) + { + try + { + + //鍒ゆ柇鏄惁鏈変綔搴熸潈闄� + if (!DBUtility.ClsPub.Security_Log("Gy_WorkBeginDotCheckListBillMain_Drop", 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; + BillOld1.MvarItemKey = "Gy_WorkBeginDotCheckListBillMain"; + oCN.BeginTran();//寮�濮嬩簨鍔� + + //Type 1 浣滃簾 2 鍙嶄綔搴� + if (Type == 1) + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾 + + string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } + //浣滃簾鍓嶆帶鍒�========================================= + string sql1 = "exec h_p_Gy_WorkBeginDotCheckListBill_BeforeDropCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'"; + ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_WorkBeginDotCheckListBill_BeforeDropCtrl"); + if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + //浣滃簾鍗曟嵁 + if (!BillOld1.Cancelltion(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_WorkBeginDotCheckListBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo; + objJsonResult.data = null; + return objJsonResult; + } + } + } + else + { + //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴� + string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID; + ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey); + if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) + { + if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!"; + objJsonResult.data = null; + return objJsonResult; + } + //鍙嶄綔搴熷墠鎺у埗========================================= + string sql1 = "exec h_p_Gy_WorkBeginDotCheckListBill_BeforeUnDropCtrl " + HInterID + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'"; + ds1 = oCN.RunProcReturn(sql1, "h_p_Gy_WorkBeginDotCheckListBill_BeforeUnDropCtrl"); + if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:鍙嶄綔搴熷墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�"; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + + if (ds1.Tables[0].Rows[0]["HBack"].ToString() != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ds1.Tables[0].Rows[0]["HRemark"].ToString(); ; + objJsonResult.data = null; + oCN.RollBack(); + return objJsonResult; + } + //================================================================================== + //鍙嶄綔搴熷崟鎹� + if (!BillOld1.AbandonCancelltion(Int64.Parse(HInterID), ds.Tables[0].Rows[0]["HBillNo"].ToString(), "h_p_Gy_WorkBeginDotCheckListBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + 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("Sc_WorkBeginDotCheckBill/get锘縎c_WorkDotCheckList_Day")] + [HttpGet] + public object getSc_WorkDotCheckList_Day(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + + + Dictionary<object, object> dic = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<object, object>>(sWhere); + + string Type = dic["Type"].ToString(); + string HInterId = dic["HInterId"].ToString(); + + ds = oCN.RunProcReturn("exec h_p_DotCheckDayList '" + Type + "','" + HInterId + "'", "h_p_DotCheckDayList"); + if (ds.Tables.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏈煡璇㈠埌鏁版嵁锛�"; + objJsonResult.data = null; + return objJsonResult; + } + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "褰撴湀娌℃湁鏁版嵁浜х敓锛�"; + objJsonResult.data = null; + return objJsonResult; + } + //娣诲姞鍒楀悕 + 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 + + #region 璁惧鍚姩鐐规娓呭崟 鏂囦欢瀵煎叆淇濆瓨 + #region 璁惧鍚姩鐐规娓呭崟 鏂囦欢涓婁紶 + [Route("Sc_WorkBeginDotCheckBill/Sc_WorkBeginDotCheckBill_Excel")] + [HttpPost] + public object Sc_WorkBeginDotCheckBill_Excel() + { + try + { + //鑾峰彇鏂囦欢鍚嶇О + 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("HOrgID", typeof(Int32));//缁勭粐ID + tb2.Columns.Add("HMaterID", typeof(Int32));//鐗╂枡ID + tb2.Columns.Add("HProcID", typeof(Int32));//宸ュ簭ID + tb2.Columns.Add("HSourceID", typeof(Int32));//鐢熶骇璧勬簮ID + tb2.Columns.Add("HCheckNoteItemID", typeof(Int32));//妫�鏌ラ」鐩甀D + tb2.Columns.Add("HCheckPostID", typeof(Int32));//宀椾綅ID + //娣诲姞鏁版嵁 + 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(); + } + tb2.Rows.Add(row); + } + + + var error = ""; + + //鏌ヨ娌℃湁鐨勫垪 + if (!tb2.Columns.Contains("缁勭粐浠g爜")) + error += "娌℃湁鎵惧埌銆愮粍缁囦唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("缁勭粐鍚嶇О")) + error += "娌℃湁鎵惧埌銆愮粍缁囧悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鍗曟嵁鍙�")) + error += "娌℃湁鎵惧埌銆愬崟鎹彿銆戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐗╂枡浠g爜")) + error += "娌℃湁鎵惧埌銆愮墿鏂欎唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐗╂枡鍚嶇О")) + error += "娌℃湁鎵惧埌銆愮墿鏂欏悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("宸ュ簭浠g爜")) + error += "娌℃湁鎵惧埌銆愬伐搴忎唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("宸ュ簭鍚嶇О")) + error += "娌℃湁鎵惧埌銆愬伐搴忓悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐢熶骇璧勬簮浠g爜")) + error += "娌℃湁鎵惧埌銆愮敓浜ц祫婧愪唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("鐢熶骇璧勬簮鍚嶇О")) + error += "娌℃湁鎵惧埌銆愮敓浜ц祫婧愬悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("璁板綍浜嬮」")) + error += "娌℃湁鎵惧埌銆愯褰曚簨椤广�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("澶囨敞")) + error += "娌℃湁鎵惧埌銆愬娉ㄣ�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("妫�鏌ラ」鐩唬鐮�")) + error += "娌℃湁鎵惧埌銆愭鏌ラ」鐩唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("妫�鏌ラ」鐩悕绉�")) + error += "娌℃湁鎵惧埌銆愭鏌ラ」鐩悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("宀椾綅浠g爜")) + error += "娌℃湁鎵惧埌銆愬矖浣嶄唬鐮併�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("宀椾綅鍚嶇О")) + error += "娌℃湁鎵惧埌銆愬矖浣嶅悕绉般�戠殑鏍囬,"; + + if (!tb2.Columns.Contains("琛ㄤ綋澶囨敞")) + error += "娌℃湁鎵惧埌銆愯〃浣撳娉ㄣ�戠殑鏍囬,"; + + if (error.Length > 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n"; + objJsonResult.data = null; + return objJsonResult; + } + + for (int i = 0; i <= tb2.Rows.Count - 1; i++) + { + string HBillNo = ""; + string HORGNumber = ""; + string HORGName = ""; + string HMaterName = ""; + string HMaterNumber = ""; + string HProcNumber = ""; + string HProcName = ""; + string HSourceNumber = ""; + string HSourceName = ""; + string HCheckNoteItemNumber = ""; + string HCheckNoteItemName = ""; + string HCheckPostNumber = ""; + string HCheckPostName = ""; + + HBillNo = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍗曟嵁鍙�"].ToString()); + HORGNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐浠g爜"].ToString()); + HORGName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐鍚嶇О"].ToString()); + HMaterName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐗╂枡鍚嶇О"].ToString()); + HMaterNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐗╂枡浠g爜"].ToString()); + HProcName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宸ュ簭鍚嶇О"].ToString()); + HProcNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宸ュ簭浠g爜"].ToString()); + HSourceName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐢熶骇璧勬簮鍚嶇О"].ToString()); + HSourceNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐢熶骇璧勬簮浠g爜"].ToString()); + HCheckNoteItemName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["妫�鏌ラ」鐩悕绉�"].ToString()); + HCheckNoteItemNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["妫�鏌ラ」鐩唬鐮�"].ToString()); + HCheckPostName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宀椾綅鍚嶇О"].ToString()); + HCheckPostNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宀椾綅浠g爜"].ToString()); + + //妫�鏌� + int index = i + 1; + //缁勭粐 + if (HORGNumber != "") + { + //鏌ヨ缁勭粐 + ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + HORGNumber + "' and Hname='" + HORGName + "'", "Xt_ORGANIZATIONS"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,缁勭粐涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HOrgID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,缁勭粐浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //鐗╂枡浠g爜 + if (HMaterNumber != "") + { + //鏌ヨ鐗╂枡 + ds = oCN.RunProcReturn("select * from Gy_Material where HNumber='" + HMaterNumber + "' and Hname='" + HMaterName + "'", "Gy_Maintain"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鐗╂枡涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HMaterID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鐗╂枡浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //宸ュ簭浠g爜 + if (HProcNumber != "") + { + //鏌ヨ宸ュ簭 + ds = oCN.RunProcReturn("select * from Gy_Process where HNumber='" + HProcNumber + "' and Hname='" + HProcName + "'", "Gy_Process"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,宸ュ簭涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HProcID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,宸ュ簭浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //鐢熶骇璧勬簮 + if (HSourceNumber != "") + { + //鏌ヨ宸ュ簭 + ds = oCN.RunProcReturn("select * from Gy_Source where HNumber='" + HSourceNumber + "' and Hname='" + HSourceName + "'", "Gy_Source"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鐢熶骇璧勬簮涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HSourceID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + //妫�鏌ラ」鐩唬鐮� + if (HCheckNoteItemNumber != "") + { + //鏌ヨ鐗╂枡 + ds = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HNumber='" + HCheckNoteItemNumber + "' and Hname='" + HCheckNoteItemName + "'", "Gy_CheckNoteItem"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,妫�鏌ラ」鐩笉瀛樺湪锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HCheckNoteItemID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + string HMaintainItemID = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,妫�鏌ラ」鐩唬鐮佷负绌�"; + objJsonResult.data = null; + return objJsonResult; + } + //宀椾綅浠g爜 + if (HCheckPostNumber != "") + { + //鏌ヨ鐗╂枡 + ds = oCN.RunProcReturn("select * from Gy_Post where HNumber='" + HCheckPostNumber + "' and Hname='" + HCheckPostName + "'", "Gy_Post"); + + if (ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,宀椾綅涓嶅瓨鍦紒"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + tb2.Rows[i]["HCheckPostID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); + } + } + else + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,宀椾綅浠g爜涓虹┖"; + objJsonResult.data = null; + return objJsonResult; + } + //鍗曟嵁鍙� + if (HBillNo == "") + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "绗�" + index + "琛�,鍗曟嵁鍙蜂笉鑳戒负绌猴紒"; + objJsonResult.data = null; + return objJsonResult; + } + } + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = error; + objJsonResult.data = tb2; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 璁惧鍚姩鐐规娓呭崟椤圭洰 瀵煎叆(淇濆瓨) + [Route("Sc_WorkBeginDotCheckBill/Sc_WorkBeginDotCheckBill_btnSave")] + [HttpPost] + public object Sc_WorkBeginDotCheckBill_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_WorkBeginDotCheckListBillMain_Edit", 1, false, user)) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + 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 HBillType = "3744"; + string HMaker = user;//鍒跺崟浜� + DateTime HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡 + long HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); + long HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); + string HOrgID = item["HOrgID"].ToString();//缁勭粐ID + string HBillNo = item["鍗曟嵁鍙�"].ToString(); + string HMaterID = item["HMaterID"].ToString() == "" ? "0" : item["HMaterID"].ToString(); + string HProcID = item["HProcID"].ToString() == "" ? "0" : item["HProcID"].ToString(); + string HSourceID = item["HSourceID"].ToString() == "" ? "0" : item["HSourceID"].ToString(); + string HNote = item["璁板綍浜嬮」"].ToString(); + string HRemark = item["澶囨敞"].ToString(); + //瀛愯〃 + string HCheckNoteItemID = item["HCheckNoteItemID"].ToString() == "" ? "0" : item["HCheckNoteItemID"].ToString(); + string HCheckPostID = item["HCheckPostID"].ToString() == "" ? "0" : item["HCheckPostID"].ToString(); + string HSubRemark = item["琛ㄤ綋澶囨敞"].ToString(); + + ds = oCN.RunProcReturn("select * from Gy_WorkBeginDotCheckListBillMain where HBillNo='" + HBillNo + "'", "Gy_WorkBeginDotCheckListBillMain"); + + if (ds.Tables[0].Rows.Count == 0) + { + long HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo); + //鎻掑叆涓昏〃 + oCN.RunProc("insert into Gy_WorkBeginDotCheckListBillMain" + + "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HRemark,HMaker,HMakeDate" + + ",HMaterID,HSourceID,HProcID,HNote) " + + "values(" + + "" + (HYear.ToString() != "0" ? HYear.ToString() : DateTime.Now.Year.ToString()) + + "," + HPeriod.ToString() + + ",'" + HBillType + + "','" + HBillType + + "'," + HInterID + + ",'" + HDate + + "','" + HBillNo + + "','" + HRemark + + "','" + user + + "'," + "getdate()" + + ",'" + HMaterID + + "','" + HSourceID + + "','" + HProcID + + "','" + HNote + + "')"); + //鎻掑叆瀛愯〃 + oCN.RunProc("insert into Gy_WorkBeginDotCheckListBillSub " + + "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" + + ",HCheckNoteItemID,HCheckPostID,HDotCheckType,HRelationID) " + + " values(" + + "" + HInterID.ToString() + + "," + 1 + + "," + 0 + + "," + 0 + + ",'" + "" + + "','" + "" + + "','" + HSubRemark + + "','" + HCheckNoteItemID + + "','" + HCheckPostID + + "','" + "璁惧" + + "','" + 0 + + "')"); + } + else + { + long HInterID = long.Parse(ds.Tables[0].Rows[0]["HInterID"].ToString()); + //鑾峰彇鏈�澶у瓙id + DataSet ds2 = oCN.RunProcReturn("select max(HEntryID) HEntryID from Gy_WorkBeginDotCheckListBillSub where HInterID='" + HInterID + "'", "Gy_WorkBeginDotCheckListBillSub"); + long HEntryID = 1; + if (ds2.Tables[0].Rows.Count > 0) + { + HEntryID = long.Parse(ds2.Tables[0].Rows[0]["HEntryID"].ToString()) + 1; + } + //鎻掑叆瀛愯〃 + oCN.RunProc("insert into Gy_WorkBeginDotCheckListBillSub " + + "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRemark" + + ",HCheckNoteItemID,HCheckPostID,HDotCheckType,HRelationID) " + + " values(" + + "" + HInterID.ToString() + + "," + HEntryID + + "," + 0 + + "," + 0 + + ",'" + "" + + "','" + "" + + "','" + HSubRemark + + "','" + HCheckNoteItemID + + "','" + HCheckPostID + + "','" + "璁惧" + + "','" + 0 + + "')"); + } + + i++; + } + + oCN.Commit(); + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "瀵煎叆鎴愬姛!"; + objJsonResult.data = null; + return objJsonResult; + } + catch (Exception e) + { + LogService.Write(e); + oCN.RollBack(); + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #endregion + } } \ No newline at end of file -- Gitblit v1.9.1