From a86725b3de175e4d90ec95d217c6fd6b27fdd2ff Mon Sep 17 00:00:00 2001
From: cwjbxqmz <1134865194@qq.com>
Date: 星期五, 02 二月 2024 10:14:31 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/项目管理/工作任务/PM_WorkTaskBillController.cs |  268 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 266 insertions(+), 2 deletions(-)

diff --git "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs" "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
index b0f8ee3..bdc1de9 100644
--- "a/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
+++ "b/WebAPI/Controllers/\351\241\271\347\233\256\347\256\241\347\220\206/\345\267\245\344\275\234\344\273\273\345\212\241/PM_WorkTaskBillController.cs"
@@ -64,6 +64,8 @@
             public int HMainSourceEntryID;
             public string HMainSourceBillNo;
             public string HMainSourceBillType;
+            public int HOrderLevID;
+            public int HHasten;
         }
         #endregion
 
@@ -181,6 +183,8 @@
                 int HMainSourceEntryID = mainList[0].HMainSourceEntryID;
                 string HMainSourceBillNo = mainList[0].HMainSourceBillNo;
                 string HMainSourceBillType = mainList[0].HMainSourceBillType;
+                int HOrderLevID = mainList[0].HOrderLevID;
+                int HHasten = mainList[0].HHasten;
 
 
                 if (OperationType == 2)
@@ -202,7 +206,7 @@
                 {
                     string sql = "insert into PM_WorkTaskBillMain" +
                         "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HBillNo,HProjectID,HProNumber,HProjectStageID,HName,HDate,HTaskNote,HPlanTimes" +
-                        ",HSelfTimes,HLastDate,HSendEmp,HReceiveEmp,HType,HCopyEmp,HRemark,HOrgID,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType)" +
+                        ",HSelfTimes,HLastDate,HSendEmp,HReceiveEmp,HType,HCopyEmp,HRemark,HOrgID,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HOrderLevID,HHasten)" +
                         "values(" +
                         "" + HYear +
                         "," + HPeriod +
@@ -231,6 +235,8 @@
                         "," + HMainSourceEntryID +
                         ",'" + HMainSourceBillNo +
                         "','" + HMainSourceBillType +
+                        "','" + HOrderLevID +
+                        "','" + HHasten +
                         "')";
 
                     //涓昏〃
@@ -267,6 +273,8 @@
                         ",HMainSourceEntryID = " + HMainSourceEntryID +
                         ",HMainSourceBillNo = '" + HMainSourceBillNo +
                         "',HMainSourceBillType = '" + HMainSourceBillType +
+                        "',HOrderLevID  = '" + HOrderLevID +
+                        "',HHasten  = '" + HHasten +
                         "' where HInterID = " + HInterID;
 
                     oCN.RunProc(sql);
@@ -280,7 +288,7 @@
                 {
                     string sql = "insert into PM_WorkTaskBillMain" +
                         "(HYear,HPeriod,HBillType,HBillSubType,HInterID,HBillNo,HProjectID,HProNumber,HProjectStageID,HName,HDate,HTaskNote,HPlanTimes" +
-                        ",HSelfTimes,HLastDate,HSendEmp,HReceiveEmp,HType,HCopyEmp,HRemark,HOrgID,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType)" +
+                        ",HSelfTimes,HLastDate,HSendEmp,HReceiveEmp,HType,HCopyEmp,HRemark,HOrgID,HMaker,HMakeDate,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType,HOrderLevID,HHasten )" +
                         "values(" +
                         "" + HYear +
                         "," + HPeriod +
@@ -309,6 +317,8 @@
                         "," + HMainSourceEntryID +
                         ",'" + HMainSourceBillNo +
                         "','" + HMainSourceBillType +
+                        "','" + HOrderLevID +
+                        "','" + HHasten +
                         "')";
                     //涓昏〃
                     oCN.RunProc(sql);
@@ -401,6 +411,101 @@
                     string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
                     ds = oCN.RunProcReturn(sql, "h_v_PM_WorkTaskBillList");
                 }
+
+                //娣诲姞鍒楀悕
+                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 = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                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 宸ヤ綔浠诲姟鍒楄〃  涓嬫帹鏁版嵁鏌ヨ
+        /// <summary>
+        /// 杩斿洖椤圭洰闃舵鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_WorkTaskBill/XTList")]
+        [HttpGet]
+        public object XTList(string HInterID,string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("select * from h_v_PM_WorkTaskBillMyList  where HInterID ='"+ HInterID + "'   and 鎺ュ崟浜�='"+user+"'", "h_v_PM_WorkTaskBillMyList");
+
+
+                //娣诲姞鍒楀悕
+                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 = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "Sucess锛�";
+                objJsonResult.data = ds.Tables[0];
+                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 璁㈠崟绛夌骇鍒楄〃 鏌ヨ
+        /// <summary>
+        /// 杩斿洖椤圭洰闃舵鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_WorkTaskBill/getOrder")]
+        [HttpGet]
+        public object getOrder()
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                //if (HItemID == null || HItemID.Equals(""))
+                //{
+                //ds = oCN.RunProcReturn("select * from Gy_OrderLev ", "Gy_OrderLev");
+                //}
+                //else
+                //{
+                //    string sql = "select * from Gy_OrderLev where HItemID='"+ HItemID + "'";
+                //    ds = oCN.RunProcReturn(sql, "Gy_OrderLev");
+                //}
+                ds = oCN.RunProcReturn("select * from Gy_OrderLev ", "Gy_OrderLev");
+
 
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
@@ -938,6 +1043,110 @@
                             objJsonResult.data = null;
                             return objJsonResult;
                         }
+                    }
+                }
+
+                oCN.Commit();//鎻愪氦浜嬪姟
+
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎵ц鎴愬姛锛�";
+                objJsonResult.data = null;
+                return objJsonResult; ;
+
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 宸ヤ綔浠诲姟  寮�濮嬩换鍔�/鎾ら攢寮�濮嬪姛鑳�
+        [Route("PM_WorkTaskBill/BeginPM_WorkTaskBill")]
+        [HttpGet]
+        public object BeginPM_WorkTaskBill(string HInterID, int Type, string user)
+        {
+            try
+            {
+                
+                if (string.IsNullOrWhiteSpace(HInterID))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "HInterID涓虹┖锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                ClsPub.CurUserName = user;
+                BillOld.MvarItemKey = "PM_WorkTaskBillMain";
+                oCN.BeginTran();//寮�濮嬩簨鍔�
+
+                //Type 0 寮�濮嬩换鍔�  1  鎾ら攢浠诲姟
+                if (Type == 0)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪
+                    DataSet ds;
+                    string sql = "select * from PM_WorkTaskBillMain  where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, "PM_WorkTaskBillMain");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        string  sql1= "update PM_WorkTaskBillMain  set  HTaskStatus='杩涜涓�' where HinterID = " + HInterID;
+                        ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain");
+
+                    }
+                }
+                else if(Type==1)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪
+                    DataSet ds;
+                    string sql = "select * from PM_WorkTaskBillMain  where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, "PM_WorkTaskBillMain");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        string sql1 = "update PM_WorkTaskBillMain  set   HTaskStatus='鏈紑濮�' where HinterID = " + HInterID;
+                        ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain");
+                    }
+                }
+                else if (Type == 2)
+                {
+                    //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪
+                    DataSet ds;
+                    string sql = "select * from PM_WorkTaskBillMain  where HinterID = " + HInterID;
+                    ds = oCN.RunProcReturn(sql, "PM_WorkTaskBillMain");
+                    if (ds == null || ds.Tables[0].Rows.Count == 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+                    {
+                        string sql1 = "update PM_WorkTaskBillMain  set   HTaskStatus='宸茬粨鏉�' where HinterID = " + HInterID;
+                        ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain");
                     }
                 }
 
@@ -1988,5 +2197,60 @@
             }
         }
         #endregion
+
+        #region  鎴戠殑浠诲姟鍒楄〃锛堟湭瀹屾垚锛屽凡瀹屾垚锛屾鍦ㄨ繘琛岋級
+        /// <summary>
+        /// 杩斿洖鎴戠殑浠诲姟鍒楄〃
+        ///鍙傛暟锛歴tring sql銆�
+        ///杩斿洖鍊硷細object銆�
+        /// </summary>
+        [Route("PM_WorkTaskBill/PM_WorkTaskBillMainList")]
+        [HttpGet]
+        public object PM_WorkTaskBillMainList( string user)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("exec h_p_PM_WorkTaskBillMyList " + user, "h_p_PM_WorkTaskBillMyList");
+
+                if (ds.Tables[0].Rows.Count != 0 || ds != null)
+                {
+                    //娣诲姞鍒楀悕
+                    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 = "1";
+                    objJsonResult.count = 1;
+                    objJsonResult.Message = "Sucess锛�";
+                    objJsonResult.data = ds;
+                    objJsonResult.list = columnNameList;
+                    return objJsonResult;
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏃犳暟鎹�";
+                    objJsonResult.data = null;
+                    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