From 8abb4749abe194175ca9885420c0a1dd6a1ce207 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期四, 20 七月 2023 10:07:00 +0800
Subject: [PATCH] 工资结算单(集体) 列表

---
 WebAPI/Controllers/项目管理/工程项目/PM_ProjectBillController.cs |  226 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 176 insertions(+), 50 deletions(-)

diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
index ee674c7..2aadcfc 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\347\250\213\351\241\271\347\233\256/PM_ProjectBillController.cs"
@@ -470,13 +470,13 @@
 
                 if (sWhere == null || sWhere.Equals(""))
                 {
-                    ds = oCN.RunProcReturn("select * from PM_ProjectBillMain order by HBillNo ", "PM_ProjectBillMain");
+                    ds = oCN.RunProcReturn("select * from h_v_PM_ProjectBillList order by 鍗曟嵁鍙� ", "h_v_PM_ProjectBillList");
                 }
                 else
                 {
-                    string sql1 = "select * from PM_ProjectBillMain where 1 = 1 ";
-                    string sql = sql1 + sWhere + " order by HBillNo ";
-                    ds = oCN.RunProcReturn(sql, "PM_ProjectBillMain");
+                    string sql1 = "select * from h_v_PM_ProjectBillList where 1 = 1 ";
+                    string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� ";
+                    ds = oCN.RunProcReturn(sql, "h_v_PM_ProjectBillList");
                 }
 
                 //娣诲姞鍒楀悕
@@ -624,85 +624,103 @@
         /// <returns></returns>
         [Route("PM_ProjectBill/AuditPM_ProjectBill")]
         [HttpGet]
-        public object AuditPM_ProjectBill(int HInterID, int IsAudit, string CurUserName)
+        public object AuditPM_ProjectBill(string HInterID, int Type, string user)
         {
             try
             {
-                //瀹℃牳鏉冮檺
-                if (!DBUtility.ClsPub.Security_Log_second("Pm_ProjectBill_Check", 1, false, CurUserName))
+                //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+                if (!DBUtility.ClsPub.Security_Log("Pm_ProjectBill_Check", 1, false, user))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.Message = "鏃犳潈闄愬鏍�!";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
 
-                var ds = oCN.RunProcReturn("select * from PM_ProjectBillMain where HInterID=" + HInterID, "PM_ProjectBillMain");
-                if (ds.Tables[0].Rows.Count > 0)
+                if (string.IsNullOrWhiteSpace(HInterID))
                 {
-                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "PM_ProjectBillMain";
+                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.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                     {
-                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+                        if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
                         {
                             objJsonResult.code = "0";
                             objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                            objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶉渶瑕佸啀瀹℃牳!";
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
                     }
-                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    //瀹℃牳鍗曟嵁
+                    if (!BillOld.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                     {
-                        if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
-                        {
-                            objJsonResult.code = "0";
-                            objJsonResult.count = 0;
-                            objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
-                            objJsonResult.data = null;
-                            return objJsonResult;
-                        }
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
                     }
                 }
                 else
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+                    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]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "鍗曟嵁宸插弽瀹℃牳!涓嶉渶瑕佸啀鍙嶅鏍�!";
+                            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;
+                    }
                 }
 
-                oCN.BeginTran();
+                oCN.Commit();//鎻愪氦浜嬪姟
 
-                if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
-                {
-                    oCN.RunProc("update PM_ProjectBillMain set HChecker='" + CurUserName + "',HCheckDate=getdate() where HInterID=" + HInterID);
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
 
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "瀹℃牳鎴愬姛";
-                    objJsonResult.data = null;
-                }
-                if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
-                {
-                    oCN.RunProc("update PM_ProjectBillMain set HChecker='',HCheckDate=null where HInterID=" + HInterID);
-
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍙嶅鏍告垚鍔�";
-                    objJsonResult.data = null;
-                }
-                oCN.Commit();
-
-                return objJsonResult;
             }
             catch (Exception e)
             {
-                oCN.RollBack();
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
-                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -920,5 +938,113 @@
             }
         }
         #endregion
+
+        #region 宸ョ▼椤圭洰 涓嬫帹(闃舵姹囨姤)-椤甸潰鏄剧ず
+        [Route("PM_ProjectBill/set_ProjectReport")]
+        [HttpGet]
+        public object ProjectBill_ProjectReport(string HInterID, string HProjectStageID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                List<DataTable> tables = new List<DataTable>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //鑾峰彇琛ㄥご淇℃伅
+                string sql = "exec h_p_PM_ProjectBill_setProjectReport " + HInterID + "," + HProjectStageID;
+                ds = oCN.RunProcReturn(sql, "h_p_PM_ProjectBill_setProjectReport");
+                tables.Add(ds.Tables[0]);
+                tables.Add(ds.Tables[1]);
+                if (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[1].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 = tables;
+                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("PM_ProjectBill/set_WorkTaskReport")]
+        [HttpGet]
+        public object ProjectBill_WorkTaskReport(string HInterID, string HProjectStageID, string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                List<DataTable> tables = new List<DataTable>();
+                //鏌ョ湅鏉冮檺
+                //if (!DBUtility.ClsPub.Security_Log("Gy_ProjectStage_Query", 1, false, user))
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
+                //鑾峰彇琛ㄥご淇℃伅
+                string sql = "exec h_p_PM_ProjectBill_setWorkTaskReport " + HInterID + "," + HProjectStageID;
+                ds = oCN.RunProcReturn(sql, "h_p_PM_ProjectBill_setWorkTaskReport");
+                tables.Add(ds.Tables[0]);
+                tables.Add(ds.Tables[1]);
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[1].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 = tables;
+                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
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1