From b9d2d6f02a977d0b2ea48f28d6eb396f4326e504 Mon Sep 17 00:00:00 2001
From: cwjbxqmz <1134865194@qq.com>
Date: 星期五, 10 十一月 2023 16:55:13 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/基础资料/工资基础资料/Gy_ProcPriceController.cs |  283 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 241 insertions(+), 42 deletions(-)

diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs"
index a07c887..3997316 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\267\245\350\265\204\345\237\272\347\241\200\350\265\204\346\226\231/Gy_ProcPriceController.cs"
@@ -120,7 +120,7 @@
                         oSub.HMaterID = DBUtility.ClsPub.isLong(subList[i].HMaterIDCol);
                         oSub.HProcID = DBUtility.ClsPub.isLong(subList[i].HProcIDCol);
                         oSub.HSourceID = DBUtility.ClsPub.isLong(subList[i].HSourceIDCol);
-                        oSub.HPrice = DBUtility.ClsPub.isLong(subList[i].HPriceCol);
+                        oSub.HPrice = DBUtility.ClsPub.isDoule(subList[i].HPriceCol);
                         oSub.HBeginDate = DBUtility.ClsPub.isDate(subList[i].HBeginDateCol);
                         oSub.HEndDate = DBUtility.ClsPub.isDate(subList[i].HEndDateCol);
                         oSub.HCostFlag = DBUtility.ClsPub.GridToBool(subList[i].HCostFlagCol);
@@ -189,59 +189,258 @@
             try
             {
                 List<object> columnNameList = new List<object>();
-                //ds = oCN.RunProcReturn("select " +
-                //    "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HProcID) 宸ュ簭宸ヤ环璧勬枡浠g爜,a.HDeptID,b.HName HDeptName" +
-                //    ",a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" +
-                //    ",a.HProcID HProcIDCol,d.HNumber HProcNumberCol,d.HName HProcNameCol" +
-                //    ",a.HSourceID HSourceIDCol,e.HNumber HSourceNumberCol,e.HName HSourceNameCol" +
-                //    ",a.HPrice HPriceCol,a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" +
-                //    ",case when a.HCostFlag<>0 then 'true'else 'false'end HCostFlagCol" +
-                //    ",case when a.HFlowFlag<>0 then 'true'else 'false'end HFlowFlagCol" +
-                //    ",case when a.HPayFlag<>0 then 'true'else 'false'end HPayFlagCol,a.HRemark HRemarkCol " +
-                //    " from Gy_ProcPrice a " +
-                //    " left join Gy_Department b on a.HDeptID = b.HItemID " +
-                //    " left join Gy_Material c on a.HMaterID = c.HItemID " +
-                //    " left join Gy_Process d on a.HProcID = d.HItemID " +
-                //    " left join Gy_Source e on a.HSourceID = e.HItemID where a.HItemID = " + HItemID, "Gy_ProcPrice");
-                ds = oCN.RunProcReturn("select " +
-                   "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HProcID) 宸ュ簭宸ヤ环璧勬枡浠g爜,a.HDeptID,b.HName 閮ㄩ棬" +
-                   ",a.HMaterID HMaterIDCol,c.HNumber 鐗╂枡浠g爜,c.HName 鐗╂枡鍚嶇О,c.HModel 瑙勬牸鍨嬪彿" +
-                   ",a.HProcID HProcIDCol,d.HNumber 宸ュ簭浠g爜,d.HName 宸ュ簭鍚嶇О" +
-                   ",a.HSourceID HSourceIDCol,e.HNumber 璧勬簮浠g爜,e.HName 璧勬簮鍚嶇О" +
-                   ",a.HPrice 鍗曚环,a.HBeginDate 寮�濮嬫棩鏈�,a.HEndDate 缁撴潫鏃ユ湡" +
-                   ",case when a.HCostFlag<>0 then 'true'else 'false'end 鎴愭湰蹇呴��" +
-                   ",case when a.HFlowFlag<>0 then 'true'else 'false'end 娴佽浆榛樿" +
-                   ",case when a.HPayFlag<>0 then 'true'else 'false'end 宸ヨ祫榛樿,a.HRemark 澶囨敞 " +
-                   " from Gy_ProcPrice a " +
-                   " left join Gy_Department b on a.HDeptID = b.HItemID " +
-                   " left join Gy_Material c on a.HMaterID = c.HItemID " +
-                   " left join Gy_Process d on a.HProcID = d.HItemID " +
-                   " left join Gy_Source e on a.HSourceID = e.HItemID where a.HItemID = " + HItemID, "Gy_ProcPrice");
-                if (ds == null || ds.Tables[0].Rows.Count == 0)
+
+                ds = oCN.RunProcReturn("select * from h_v_Gy_ProcPriceList where HItemID = " + HItemID, "h_v_Gy_ProcPriceList");
+
+                //娣诲姞鍒楀悕
+                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 宸ュ簭宸ヤ环 鍒犻櫎
+        [Route("Gy_ProcPrice/DelProcPrice")]
+        [HttpGet]
+        public object DelProcPrice(int HInterID, string User)
+        {
+            try
+            {
+                //鍒犻櫎鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_ProcPriceList_Delete", 1, false, User))
                 {
                     objJsonResult.code = "0";
                     objJsonResult.count = 0;
-                    objJsonResult.Message = "鏃犲垪琛ㄤ俊鎭紒";
+                    objJsonResult.Message = "鏃犳潈闄愬垹闄わ紒";
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                else
+
+                DAL.ClsGy_ProcPrice_Ctl BillNew = new DAL.ClsGy_ProcPrice_Ctl();
+                var sReturn = "";
+                if (BillNew.ShowBill(HInterID, ref sReturn))
                 {
-                    //娣诲姞鍒楀悕
-                    foreach (DataColumn col in ds.Tables[0].Columns)
+                    foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
                     {
-                        Type dataType = col.DataType;
-                        string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
-                        columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                        if (oSub.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
                     }
 
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "Sucess锛�";
-                    objJsonResult.data = ds.Tables[0];
-                    objJsonResult.list = columnNameList;
+
+                    bool flag = false;
+                    oCN.BeginTran();//寮�鍚簨鍔�
+
+                    flag= BillNew.DeleteByID(HInterID);
+
+                    oCN.Commit();//缁撴潫浜嬪姟
+
+                    if (flag)
+                    {
+                        objJsonResult.code = "1";
+                        objJsonResult.count = 1;
+                        objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        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 [宸ュ簭宸ヤ环瀹℃牳銆佸弽瀹℃牳]
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="HInterID">鍗曟嵁ID</param>
+        /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+        /// <param name="CurUserName">瀹℃牳浜�</param>
+        /// <returns></returns>
+        [Route("Gy_ProcPrice/AuditGy_ProcPrice")]
+        [HttpGet]
+        public object AuditGy_ProcPrice(int HInterID, int IsAudit, string CurUserName)
+        {
+            try
+            {
+                //瀹℃牳鏉冮檺
+                if (!DBUtility.ClsPub.Security_Log_second("Gy_ProcPriceList_Check", 1, false, CurUserName))
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+                    objJsonResult.data = null;
                     return objJsonResult;
                 }
+                DBUtility.ClsPub.CurUserName = CurUserName;
+                DAL.ClsGy_ProcPrice_Ctl BillNew = new DAL.ClsGy_ProcPrice_Ctl();
+                var sReturn = "";
+                if (BillNew.ShowBill(HInterID, ref sReturn))
+                {
+                    foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
+                    {
+                        if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                        {
+                            if (oSub.HChecker.Trim() != "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                        if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                        {
+                            if (oSub.HChecker.Trim() == "")
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                }
+                else
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+
+                foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
+                {
+                    if (IsAudit == 0)  //瀹℃牳鍒ゆ柇
+                    {
+                        //瀹℃牳鎻愪氦
+                        if (BillNew.CheckBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳鎴愬姛";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+                    {
+                        //鍙嶅鏍告彁浜bandonCheck
+                        if (BillNew.AbandonCheck(HInterID, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            objJsonResult.code = "1";
+                            objJsonResult.count = 1;
+                            objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                }
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+
+        #region 缁存姢宸ヤ环鏃惰繑鍥炲伐鑹鸿矾绾夸俊鎭�
+        [Route("Gy_RoutingBill/EditPrice")]
+        [HttpGet]
+        public object EditPrice(string HMaterNumber)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+
+                ds = oCN.RunProcReturn("exec Gy_RoutingBill_EditPrice '" + HMaterNumber + "'", "Gy_RoutingBill_EditPrice");
+
+                //娣诲姞鍒楀悕
+                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)
             {

--
Gitblit v1.9.1