1
wtt
2025-03-14 f0b9e513532dd063dc2a48102f710c6add4c802e
WebAPI/Controllers/SCGL/Èռƻ®¹ÜÀí/Sc_WorkDemandPlanBillController.cs
@@ -27,6 +27,7 @@
        {
            try
            {
                List<object> A = new List<object>();
                //查看权限
                if (!DBUtility.ClsPub.Security_Log("Sc_WorkDemandPlanBill_Query", 1, false, user))
                {
@@ -38,11 +39,18 @@
                }
                ds = oCN.RunProcReturn("select * from  h_v_JIT_Sc_WorkDemandPlanBillList where 1=1" + sWhere + "order by hmainid desc ", "h_v_JIT_Sc_WorkDemandPlanBillList");
                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格式的字符串
                    A.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = A;
                return objJsonResult;
            }
            catch (Exception e)
@@ -280,11 +288,11 @@
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["单据状态"].ToString() == "2")
                    if (ds.Tables[0].Rows[0]["单据状态"].ToString() == "3")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "当前单据正在审核,不能关闭!";
                        objJsonResult.Message = "当前单据已关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -320,6 +328,68 @@
        }
        #endregion
        #region è¦æ–™è®¡åˆ’单 åå…³é—­
        [Route("Sc_WorkDemandPlanBill/CancelCloseWorkDemandPlanBillList")]
        [HttpGet]
        public object CancelCloseWorkDemandPlanBillList(string HInterID, string User)
        {
            try
            {
                //关闭权限
                if (!DBUtility.ClsPub.Security_Log_second("Sc_WorkDemandPlanBill_Close", 1, false, User))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限关闭!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from h_v_JIT_Sc_WorkDemandPlanBillList where 1=1 and hmainid=" + HInterID, "h_v_JIT_Sc_WorkDemandPlanBillList");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["单据状态"].ToString() != "3")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "当前单据没有处于关闭状态!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    oCN.BeginTran();//开启事务
                    string HBillStatus = ds.Tables[0].Rows[0]["审核人"].ToString() == "" ? "1" : "2";
                    oCN.RunProc($"update Sc_WorkDemandPlanBillMain set HBillStatus='{HBillStatus}',HCloseMan='',HCloseDate=null   where HInterID={HInterID}");
                    oCN.Commit();//结束事务
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "关闭成功!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "当前单据不存在,无法关闭!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();//回滚事务
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region è¦æ–™è®¡åˆ’单 è¦æ–™è®¡åˆ’报表
        public class ReportWorkDemandPlanBill
        {