1
yusijie
2024-08-05 7b776d93b25a2e9d6e2210d581c1e2998e4fc8ae
WebAPI/Controllers/²Ö´æ¹ÜÀí/ÁìÁÏ·¢»õ/Kf_StockOutRequestBillController.cs
@@ -1,5 +1,6 @@
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -26,6 +27,7 @@
        {
            try
            {
                List<object> columnNameList = new List<object>();  //定义声明变量 ï¼ŒæŠŠé€šè¿‡ new List<object>()创建的 å®žä¾‹ï¼Œèµ‹å€¼ç»™å˜é‡
                ////判断是否有查询权限
                //if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockRequestBill_Query", 1, false, user))
                //{
@@ -46,11 +48,17 @@
                    string sql = sql1 + sWhere + " order by hmainid desc";
                    ds = oCn.RunProcReturn(sql, "h_v_IF_StockOutRequestBillList");
                }
                foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用
                {
                    Type dataType = col.DataType; //获取当前数据类型传入 è‡ªå®šä¹‰å˜é‡datadataType
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接         // å°†åˆ—名和数据类型信息拼接成一个JSON格式的字符串
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.data = ds.Tables[0];//代码将第一个DataTable(索引为0)赋值给objJsonResult的data属性
                objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性
                return objJsonResult;
            }
            catch (Exception ex)
@@ -153,6 +161,16 @@
                long HOWNERTYPEIDHEAD = mainList[0].HOWNERTYPEIDHEAD;
                string HBIZTYPE = mainList[0].HBIZTYPE;
                //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.Message = s;
                    return objJsonResult;
                }
                ds = oCn.RunProcReturn("select * from h_v_IF_StockOutRequestBillList where hmainid=" + HInterID + " and å•据号='" + HBillNo + "'", "h_v_IF_StockOutRequestBillList");
                if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//新增
@@ -165,8 +183,7 @@
                       ,HDeleteMan,HDeleteDate,HCloseMan,HCloseDate
                       ,HRemark,HExplanation,HInnerBillNo,HERPInterID,HERPBillType
                       ,HSTOCKORGID,HAPPLYTYPE,HOWNERTYPEIDHEAD,HBIZTYPE)
                        values(" + HInterID + ",'" + HBillNo + "','" + HDate + "','" + 1242 + "','" +
                    1242 + "'," + HBillStatus + "," + DateTime.Now.Year + "," + DateTime.Now.Month + "," + HSupID +
                        values(" + HInterID + ",'" + HBillNo + "','" + HDate + "','" + 1242 + "','" + 1242 + "'," + HBillStatus + "," + DateTime.Now.Year + "," + DateTime.Now.Month + "," + HSupID +
                    "," + HWHID + "," + HEmpID + "," + HMangerID + "," + HSecManagerID + "," + HKeeperID +
                    "," + HDeptID + ",'" + HMaker + "','" + HMakeDate + "','" + HChecker + "','" + HCheckDate + "','" + HUpDater + "','" +
                    HUpDateDate + "','" + HDeleteMan + "','" + HDeleteDate + "','" + HCloseMan + "','" + HCloseDate + "','"
@@ -176,7 +193,7 @@
                else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
                { //修改
                    oCn.RunProc("update Kf_StockOutRequestBillMain  set " +
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + "' where HInterID=" + HInterID);
                                "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + " where HInterID=" + HInterID);
                    //删除子表
                    oCn.RunProc("delete from Kf_StockOutRequestBillSub where HInterID='" + HInterID + "'");
@@ -287,6 +304,43 @@
        #endregion
        #region å‡ºåº“申请单列表
        [Route("Kf_StockOutRequestBill/cx")]
        [HttpGet]
        public object cx(long HInterID)
        {
            try
            {
                ds = oCn.RunProcReturn("select * from h_v_IF_StockOutRequestBillList where hmainid =" + HInterID, "h_v_IF_StockOutRequestBillList");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "false!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    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
        /// <summary>
        ///删除功能
        /// </summary>
@@ -297,6 +351,17 @@
        {
            try
            {
                //进行 ä¼šè®¡æœŸé—´ ç»“è´¦ çš„判断和控制
                string s = "";
                int sYear = 0;
                int sPeriod = 0;
                DateTime HDate = DateTime.Now;
                if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
                {
                    objJsonResult.Message = s;
                    return objJsonResult;
                }
                oCn.BeginTran();
                oCn.RunProc("Delete From Kf_StockOutRequestBillMain where HInterID = " + HInterID);
                oCn.RunProc("Delete From Kf_StockOutRequestBillSub where HInterID = " + HInterID);