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 | 309 +++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 272 insertions(+), 37 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 57fd32f..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"
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -25,6 +26,7 @@
{
try
{
+ List<object> columnNameList = new List<object>();
//鏌ョ湅鏉冮檺
if (!DBUtility.ClsPub.Security_Log("Gy_ProcPriceList", 1, false, user))
{
@@ -36,22 +38,32 @@
}
ds = oCN.RunProcReturn("select * from h_v_Gy_ProcPriceList where 1 = 1 " + sWhere, "h_v_Gy_ProcPriceList");
- if (ds == null || ds.Tables[0].Rows.Count == 0)
+
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "false锛�";
- objJsonResult.data = null;
- return objJsonResult;
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+
+ //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+ //{
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = columnNameList;
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
}
catch (Exception e)
{
@@ -108,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);
@@ -176,36 +188,259 @@
{
try
{
- 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");
- if (ds == null || ds.Tables[0].Rows.Count == 0)
+ List<object> columnNameList = new List<object>();
+
+ 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 = "false锛�";
+ 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))
{
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
- objJsonResult.data = ds.Tables[0];
+ foreach (Model.ClsGy_ProcPrice_Model oSub in BillNew.DetailColl)
+ {
+ if (oSub.HChecker.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "褰撳墠鍗曟嵁涓嶈兘鍒犻櫎锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+
+ 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