From 3fe3da69ed76cc71d92198c6f0aea9f5bb4b6e77 Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期五, 27 十二月 2024 10:16:19 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs | 186 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 173 insertions(+), 13 deletions(-) diff --git a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs index 316a33e..7432842 100644 --- a/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs +++ b/WebAPI/Controllers/CGGL/Cg_POInStockBillController.cs @@ -38,7 +38,7 @@ try { - ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID, "h_v_IF_POInStockBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillEdit where hmainid=" + HInterID, "h_v_IF_POInStockBillList"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; @@ -65,6 +65,62 @@ return objJsonResult; } } + + #region 鏀舵枡閫氱煡鍗曞垎椤靛垪琛� + [Route("Cg_POInStockBill/page")] + [HttpGet] + public object Cg_POInStockBillPage(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("Cg_POInStockBillQuery", 1, false, user)) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鎮ㄦ病鏈夎妯″潡鏉冮檺,璇蜂笌绠$悊鍛樿仈绯伙紒"; + objJsonResult.data = null; + return objJsonResult; + } + + sWhere = sWhere.Replace("'", "''"); + if (sWhere == null || sWhere.Equals("")) + { + ds = oCN.RunProcReturn("exec h_p_IF_POInStockBillList " + page + "," + size + ",''", "h_p_IF_POInStockBillList"); + } + else + { + ds = oCN.RunProcReturn("exec h_p_IF_POInStockBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_IF_POInStockBillList"); + } + + //娣诲姞鍒楀悕 + 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 /// <summary> /// 杩斿洖鏀舵枡閫氱煡鍗曞垪琛� @@ -524,7 +580,7 @@ return objJsonResult; } - ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList"); + ds = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID, "h_v_IF_POOrderBillList"); if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//鏂板 { @@ -570,7 +626,7 @@ else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) { //淇敼 DataSet dss; - dss = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_IF_POOrderBillList"); + dss = oCN.RunProcReturn("select * from h_v_IF_POInStockBillList where hmainid=" + HInterID , "h_v_IF_POOrderBillList"); //鍒ゆ柇鏄惁鍙紪杈� if (dss.Tables[0].Rows[0]["瀹℃牳浜�"].ToString() != "" && dss.Tables[0].Rows[0]["瀹℃牳浜�"] != null) { @@ -590,8 +646,8 @@ } string sql= $@"update Cg_POInStockBillMain set " + - "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()" + - ",HSupID=" + HSupID + ",HCurID=" + HCurID + "HRemark='" + HRemark + "', HUpDater ='" + HMaker + "', HUpDateDate=getdate()"+ ",HBillNo='" + HBillNo + "'" + + ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "',HProjectID="+ HProjectID + ",HInvoiceBillNo='"+ HInvoiceBillNo + "' where HInterID=" + HInterID; @@ -719,14 +775,14 @@ foreach (ClsCg_POInStockBillSub oSub in DetailColl) { i++; - if (oSub.HQty <= 0 || oSub.HQty == null) - { - objJsonResult.code = "0"; - objJsonResult.count = 0; - objJsonResult.Message = "绗�" + i + "琛岋紝鏁伴噺涓嶈兘涓�0鎴栬�呭皬浜�0"; - objJsonResult.data = null; - return objJsonResult; - } + //if (oSub.HQty <= 0 || oSub.HQty == null) + //{ + // objJsonResult.code = "0"; + // objJsonResult.count = 0; + // objJsonResult.Message = "绗�" + i + "琛岋紝鏁伴噺涓嶈兘涓�0鎴栬�呭皬浜�0"; + // objJsonResult.data = null; + // return objJsonResult; + //} if (oSub.HMaterID == 0) { @@ -2556,5 +2612,109 @@ } } #endregion + + #region 鏀舵枡閫氱煡鍗曟煡璇㈠垪琛� + [Route("Cg_POInStockBill/QueryList")] + [HttpGet] + public object QueryList(string sWhere, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + + if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user)) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鏃犳潈闄愭煡鐪�!"; + objJsonResult.data = null; + return objJsonResult; + } + string sql = "select * from h_v_Cg_POInStockBillQuery where 1 = 1 "; + + if (sWhere == "" || sWhere == null) + { + ds = oCN.RunProcReturn("select * from h_v_Cg_POInStockBillQuery order by hmainid desc", "h_v_Cg_POInStockBillQuery"); + } + else + { + ds = oCN.RunProcReturn(sql + sWhere + " order by hmainid desc", "h_v_Cg_POInStockBillQuery"); + } + + + + 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 = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + 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("Cg_POInStockBill/QuerySubList")] + [HttpGet] + public object QuerySubList(string hmainid, string user) + { + try + { + List<object> columnNameList = new List<object>(); + //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄� + + if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBillQuery", 1, false, user)) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "鏃犳潈闄愭煡鐪�!"; + objJsonResult.data = null; + return objJsonResult; + } + string sql = "select * from h_v_Cg_POInStockBillQuerySub where hmainid = " + hmainid; + + ds = oCN.RunProcReturn(sql + " order by hsubid ASC", "h_v_Cg_POInStockBillQuerySub"); + + + 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 = CodeConstant.SUCCEED; + objJsonResult.count = CountConstant.SUCCEED; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1