yusijie
2024-11-22 3697b0dda739b38c33406d6e164714167e9ad5b5
WebAPI/Controllers/XSGL/Xs_ReceivableBillController.cs
@@ -25,6 +25,38 @@
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region 应收单列表 根据单价类型获取物料单击
        /// <summary>
        /// 返回应收单列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Xs_ReceivableBill/getPriceByType")]
        [HttpGet]
        public object getPriceByType(string HMaterID, string HType)
        {
            try
            {
                string sql1 = "exec h_p_Xs_ReceivableBill_getPriceByType " + HMaterID + ",'" + HType + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Xs_ReceivableBill_getPriceByType");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0].Rows[0]["HPrice"].ToString();
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 应收单列表 查询
        /// <summary>
        /// 返回应收单列表
@@ -85,6 +117,66 @@
        }
        #endregion
        #region 应收单列表 查询-分页
        /// <summary>
        /// 返回应收单列表
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Xs_ReceivableBill/list_byPage")]
        [HttpGet]
        public object getXs_ReceivableBill_byPage(string sWhere, string user, string Organization, int page, int size)
        {
            try
            {
                List<object> columnNameList = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Xs_ReceivableBill_Query", 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_Xs_ReceivableBillList_Query " + page + "," + size + ",'" + Organization + "'," + "''", "h_p_Xs_ReceivableBillList_Query");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Xs_ReceivableBillList_Query " + page + "," + size + ",'" + Organization + "','" + sWhere + "'", "h_p_Xs_ReceivableBillList_Query");
                }
                //添加列名
                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));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                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("Xs_ReceivableBill/SaveXs_ReceivableBill")]
        [HttpPost]