From 018cc8c7f67926ad9f36cb72c5b494b949e886cd Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 14 十一月 2024 22:29:33 +0800
Subject: [PATCH] 齐套分析库存取值方式调整;森楷同步生产入库申请单调整
---
WebAPI/Controllers/项目管理/工作任务/PM_WorkTaskBillController.cs | 2162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 2,154 insertions(+), 8 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..fb72f18 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"
@@ -10,6 +10,8 @@
using System.Web.Http;
using System.Windows.Forms;
using WebAPI.Models;
+using System.Threading.Tasks;
+using DLL;
namespace WebAPI.Controllers.椤圭洰绠$悊.宸ヤ綔浠诲姟
{
@@ -22,7 +24,10 @@
public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill();
string user_LongShan = "";
string HName_LongShan = "";
+ public DAL.ClsPM_WorkTaskMoneyBillMain BillNew0 = new DAL.ClsPM_WorkTaskMoneyBillMain(); //浠诲姟璐圭敤鍗曞搴斿崟鎹被
+ public DAL.ClsGy_WorkTaskMoneyBOMBill BillNew1 = new DAL.ClsGy_WorkTaskMoneyBOMBill(); //浠诲姟璐圭敤娓呭崟瀵瑰簲鍗曟嵁绫�
+ public DAL.ClsGy_WorkTaskMoneyBOMBill BillOld1 = new DAL.ClsGy_WorkTaskMoneyBOMBill();
#region 宸ヤ綔浠诲姟 鏂板/缂栬緫
#region 宸ヤ綔浠诲姟 琛ㄥご鏁版嵁
public class PM_WorkTaskBill_Main
@@ -64,6 +69,8 @@
public int HMainSourceEntryID;
public string HMainSourceBillNo;
public string HMainSourceBillType;
+ public int HOrderLevID;
+ public int HTaskClassID;
}
#endregion
@@ -181,6 +188,8 @@
int HMainSourceEntryID = mainList[0].HMainSourceEntryID;
string HMainSourceBillNo = mainList[0].HMainSourceBillNo;
string HMainSourceBillType = mainList[0].HMainSourceBillType;
+ int HOrderLevID = mainList[0].HOrderLevID;
+ int HTaskClassID = mainList[0].HTaskClassID;
if (OperationType == 2)
@@ -202,7 +211,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,HTaskClassID)" +
"values(" +
"" + HYear +
"," + HPeriod +
@@ -223,7 +232,7 @@
"','" + HReceiveEmp +
"','" + HType +
"','" + HCopyEmp +
- "','" + HRemark +
+ "','" + HRemark +
"'," + HOrgID +
",'" + HMaker +
"','" + HMakerDate +
@@ -231,6 +240,8 @@
"," + HMainSourceEntryID +
",'" + HMainSourceBillNo +
"','" + HMainSourceBillType +
+ "','" + HOrderLevID +
+ "','"+ HTaskClassID+
"')";
//涓昏〃
@@ -267,6 +278,8 @@
",HMainSourceEntryID = " + HMainSourceEntryID +
",HMainSourceBillNo = '" + HMainSourceBillNo +
"',HMainSourceBillType = '" + HMainSourceBillType +
+ "',HOrderLevID = '" + HOrderLevID +
+ "',HTaskClassID = '" + HTaskClassID +
"' where HInterID = " + HInterID;
oCN.RunProc(sql);
@@ -276,11 +289,12 @@
//璁板綍鏃ュ織
LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ヤ綔浠诲姟:" + HBillNo);
oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ヤ綔浠诲姟锛�" + HBillNo + "','LMES-宸ヤ綔浠诲姟妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
- }else if (OperationType == 4 && ds.Tables[0].Rows.Count == 0) //涓嬫帹
+ }
+ else if (OperationType == 4 && ds.Tables[0].Rows.Count == 0) //涓嬫帹
{
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 )" +
"values(" +
"" + HYear +
"," + HPeriod +
@@ -309,6 +323,7 @@
"," + HMainSourceEntryID +
",'" + HMainSourceBillNo +
"','" + HMainSourceBillType +
+ "','" + HOrderLevID +
"')";
//涓昏〃
oCN.RunProc(sql);
@@ -401,6 +416,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)
@@ -961,8 +1071,166 @@
}
#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 鎾ら攢浠诲姟 2缁撴潫浠诲姟
+ 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)
+ {
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HMainSourceBillType"])== "4759")
+ {
+ var lInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"];
+ string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='宸插紑濮�' where HinterID = " + HInterID;
+ oCN.RunProc(sql1);
+ string sql2 = "update PM_CustomerTaskBillMain set HTaskStatus='宸插紑濮�' where HinterID = " + lInterID;
+ oCN.RunProc(sql2);
+ }
+ else
+ {
+ string sql2 = "update PM_WorkTaskBillMain set HTaskStatus='宸插紑濮�' where HinterID = " + HInterID;
+ oCN.RunProc(sql2);
+ }
+
+
+ }
+ }
+ 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)
+ {
+ var lInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"];
+ string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='鏈紑濮�' where HinterID = " + HInterID;
+ oCN.RunProc(sql1);
+ string sql2 = "update PM_CustomerTaskBillMain set HTaskStatus='鏈紑濮�' where HinterID = " + lInterID;
+ oCN.RunProc(sql2);
+ }
+ }
+ oCN.Commit();//鎻愪氦浜嬪姟
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ 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 宸ヤ綔浠诲姟 鍌績娆℃暟鍔熻兘
+ [Route("PM_WorkTaskBill/UpdateHHasten")]
+ [HttpGet]
+ public object UpdateHHasten(string HInterID, int HHasten, 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();//寮�濮嬩簨鍔�
+
+ 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 HHasten='"+ HHasten+ "' where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql1, "PM_WorkTaskBillMain");
+ }
+
+ 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 浠诲姟姹囨姤 鏂板/缂栬緫-淇濆瓨
#region 浠诲姟姹囨姤 琛ㄥご鏁版嵁
+ string reportMan;
public class PM_WorkTaskReportBill_Main
{
public int HInterID;
@@ -1108,7 +1376,7 @@
string HReportEmpName = mainList[0].HReportEmpName;
string HUpdater = mainList[0].HUpdater;
string HUpdaterDate = mainList[0].HUpdaterDate;
-
+ reportMan = HReportEmpName;//鑾峰彇姹囨姤浜哄悕绉�
//淇濆瓨鍓嶆帶鍒�
DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_PM_WorkTaskReportBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_PM_WorkTaskReportBill_BeforeSaveCtrl");
if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0)
@@ -1184,7 +1452,8 @@
//璁板綍鏃ュ織
LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼椤圭洰闃舵娓呭崟:" + HBillNo);
oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼椤圭洰闃舵娓呭崟锛�" + HBillNo + "','LMES-椤圭洰闃舵娓呭崟妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
- }else if(OperationType == 4 && ds.Tables[0].Rows.Count == 0) //涓嬫帹
+ }
+ else if(OperationType == 4 && ds.Tables[0].Rows.Count == 0) //涓嬫帹
{
string sql = "insert into PM_WorkTaskReportBillMain" +
"(HYear,HPeriod,HBillType,HBillSubType,HInterID,HDate,HBillNo,HBillStatus,HRemark,HMaker,HMakeDate,HOrgID,HReportEmpID,HMainSourceInterID,HMainSourceEntryID,HMainSourceBillType,HMainSourceBillNo) " +
@@ -1245,7 +1514,7 @@
public json AddBillSub_WorkTaskReportBill(string msg3, long HInterID, string HBillNo, int OperationType)
{
List<PM_WorkTaskReportBill_Sub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM_WorkTaskReportBill_Sub>>(msg3);
- int i = 0; //浣滀负瀛愯〃鍐呯爜
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
foreach (PM_WorkTaskReportBill_Sub oSub in DetailColl)
{
i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
@@ -1267,6 +1536,47 @@
string HSourceBillType = oSub.HSourceBillType;
bool HFinishFlag = oSub.HFinishFlag;
+ if (HFinishFlag==true)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁瀛樺湪
+ DataSet ds;
+ string sqls = "select * from PM_WorkTaskBillMain where HinterID = " + HSourceInterID;
+ ds = oCN.RunProcReturn(sqls, "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)
+ {
+ var lInterID = ds.Tables[0].Rows[0]["HMainSourceInterID"];
+ string sql1 = "update PM_WorkTaskBillMain set HTaskStatus='宸插畬鎴�' where HinterID = " + HSourceInterID;
+ oCN.RunProc(sql1);
+ string sql2 = "update PM_CustomerTaskBillMain set HTaskStatus='宸插畬鎴�' where HinterID = " + lInterID;
+ oCN.RunProc(sql2);
+ }
+ }
+ //鏌ユ壘宸ヤ綔浠诲姟鑾峰彇娲惧崟浜哄拰鎶勯�佷汉
+ string sqlz = "select * from h_v_PM_WorkTaskBillList where HInterID = " + HSourceInterID;
+ ds = oCN.RunProcReturn(sqlz, "h_v_PM_WorkTaskBillList");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ string HSendEmp = ds.Tables[0].Rows[0]["娲惧崟浜�"].ToString();//娲惧崟浜�
+ string HCopyEmp = ds.Tables[0].Rows[0]["鎶勯�佷汉"].ToString();//鎶勯�佷汉
+ string HWorkTaskDate = DateTime.Parse(ds.Tables[0].Rows[0]["鏃ユ湡"].ToString()).ToString("yyyy-MM-dd");//宸ヤ綔浠诲姟鍗曟嵁鏃堕棿
+ string HSelfTimes = ds.Tables[0].Rows[0]["鑷瘎宸ユ椂"].ToString();//鑷瘎宸ユ椂
+ string HProjectName = ds.Tables[0].Rows[0]["椤圭洰鍚嶇О"].ToString();//椤圭洰鍚嶇О
+ string HTaskDescription = ds.Tables[0].Rows[0]["浠诲姟鎻忚堪"].ToString();
+ //鎻掑叆瀛愯〃sql
string sql = "insert into PM_WorkTaskReportBillSub" +
"(HInterID,HBillNo_bak,HEntryID,HRemark,HProjectID,HProNumber,HProjectStageID,HName,HTaskNote,HType,HRelTimes,HReportNote,HAdv,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo,HFinishFlag) " +
"values(" +
@@ -1289,8 +1599,9 @@
"','" + HSourceBillNo +
"'," + DBUtility.ClsPub.BoolToString(HFinishFlag) +
")";
-
oCN.RunProc(sql);
+ string messageContext = "鍗曟嵁鏃ユ湡= " + HWorkTaskDate + ",姹囨姤浜�=" + reportMan + ",姹囨姤鍐呭=" + HReportNote +",浠诲姟鎻忚堪 ="+ HTaskDescription +",瀹屾垚鏍囪="+ (HFinishFlag?"鏄�":"鍚�") + ",鑷瘎宸ユ椂=" + HSelfTimes + "灏忔椂,鑰楃敤宸ユ椂=" + HRelTimes + "灏忔椂,浠诲姟鍚嶇О=" + HName + ",椤圭洰鍚嶇О=" + HProjectName; ;
+ _ = SendDingDingAsync(HSendEmp, messageContext, HCopyEmp);
}
//淇濆瓨鍚庢帶鍒�
@@ -1988,5 +2299,1840 @@
}
}
#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
+
+ #region 浠诲姟璐圭敤 淇濆瓨/缂栬緫
+ /// <summary>
+ /// 浠诲姟璐圭敤
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("PM_WorkTaskBill/Save锘縋M_WorkTaskMoneyBillMain")]
+ [HttpPost]
+ public object Save锘縋M_WorkTaskMoneyBillMain([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString(); //瀛愯〃
+ string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+
+ string UserName = "";
+ string s = "";
+ ListModels oListModels = new ListModels();
+ try
+ {
+ //淇濆瓨鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("PM_WorkTaskMoneyBillMain_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DAL.Cls锘縋M_WorkTaskMoneyBillMain oBill = new DAL.Cls锘縋M_WorkTaskMoneyBillMain();
+ List<Model.Cls锘縋M_WorkTaskMoneyBillMain> lsmain = new List<Model.Cls锘縋M_WorkTaskMoneyBillMain>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_锘縋M_WorkTaskMoneyBillMain(msg2);
+ foreach (Model.Cls锘縋M_WorkTaskMoneyBillMain oItem in lsmain)
+ {
+ if (refSav == "Add")
+ {
+ //鍗曟嵁鍙锋槸鍚﹂噸澶�
+ if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ if (refSav == "Update")
+ {
+ if (BillNew0.ShowBill(oItem.HInterID, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (BillNew0.omodel.HChecker != "" && BillNew0.omodel.HChecker != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (BillNew0.omodel.HBillStatus > 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ }
+ UserName = oItem.HMaker; //鍒跺崟浜�
+ oItem.HBillType = "4763";
+ oItem.HBillSubType = "4763";
+
+
+
+ //oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+
+ if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oBill.omodel = oItem;
+ }
+ // 琛ㄤ綋鏁版嵁
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+ List<Model.Cls锘縋M_WorkTaskMoneyBillSub> ls = new List<Model.Cls锘縋M_WorkTaskMoneyBillSub>();
+ ls = oListModels.getObjectByJson_锘縋M_WorkTaskMoneyBillSub(msg3);
+ int i = 0;
+ foreach (Model.Cls锘縋M_WorkTaskMoneyBillSub oItemSub in ls)
+ {
+ i++;
+ oItemSub.HEntryID = i;
+
+
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+
+ oBill.DetailColl.Add(oItemSub);
+
+ }
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (refSav == "Add")
+ {
+
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else if (refSav == "Update")
+ {
+ bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else
+ {
+ bResult = false;
+ }
+ if (bResult)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 浠诲姟璐圭敤鍒楄〃 鏌ヨ
+ /// <summary>
+ /// 杩斿洖浠诲姟璐圭敤鍒楄〃
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("PM_WorkTaskBill/get锘縋M_WorkTaskMoneyBillMainList")]
+ [HttpGet]
+ public object get锘縋M_WorkTaskMoneyBillMainList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("PM_WorkTaskMoneyBillMain_Check", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("select * from h_v_PM_WorkTaskMoneyBillMainList order by 鍗曟嵁鍙� desc", "锘縣_v_PM_WorkTaskMoneyBillMainList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_锘縣_v_PM_WorkTaskMoneyBillMainList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+ ds = oCN.RunProcReturn(sql, "锘縣_v_PM_WorkTaskMoneyBillMainList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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("PM_WorkTaskBill/锘縋M_WorkTaskMoneyBillMainEditList")]
+ [HttpGet]
+ public object PM_WorkTaskMoneyBillMainEditList(string HInterID, string User)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBillMain_Edit", 1, false, User))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ澶辫触!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("exec h_p_锘縋M_WorkTaskMoneyBill_EditInit " + HInterID, "h_p_锘縋M_WorkTaskMoneyBill_EditInit");
+ tableList.Add(ds.Tables[0]);
+ tableList.Add(ds.Tables[1]);
+
+
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏌ヨ鎴愬姛锛�";
+ objJsonResult.data = tableList;
+ 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_WorkTaskBill/CheckPM_WorkTaskMoneyBillMain")]
+ [HttpGet]
+ public object CheckPM_ProjectBeginBillMain(int HInterID, int IsAudit, string CurUserName)
+ {
+ DBUtility.ClsPub.CurUserName = CurUserName;
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("PM_WorkTaskMoneyBillMain_Check", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //HInterID鏁版嵁鍒ゆ柇
+ if (HInterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+ DAL.ClsPM_WorkTaskMoneyBillMain oBill = new DAL.ClsPM_WorkTaskMoneyBillMain(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ {
+ if (oBill.omodel.HCloseMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ {
+ if (oBill.omodel.HChecker.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ if (oBill.omodel.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;
+ }
+
+
+ //杩涜闇�瑕佽繘琛岀殑瀹℃牳/鍙嶅鏍告搷浣�
+ if (IsAudit == 0) //瀹℃牳鎻愪氦
+ {
+ oCN.BeginTran();
+
+ //璁板綍杩斿洖淇℃伅
+ string msg = "";
+
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_PM_WorkTaskMoneyBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_PM_WorkTaskMoneyBill_BeforeCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ //瀹℃牳鎻愪氦
+ if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_PM_WorkTaskMoneyBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳鎴愬姛锛�" + msg;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ oCN.RollBack();
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅鏍告彁浜�
+ {
+
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_PM_WorkTaskMoneyBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_PM_WorkTaskMoneyBill_BeforeUnCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+ //鍙嶅鏍告彁浜bandonCheck
+ if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_PM_WorkTaskMoneyBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+ #endregion
+
+ #region 浠诲姟璐圭敤鍒楄〃 鍏抽棴/鍙嶅叧闂姛鑳�
+ [Route("PM_WorkTaskBill/ClosePM_WorkTaskMoneyBillMain")]
+ [HttpGet]
+ public object ClosePM_WorkTaskMoneyBillMain(string HInterID, int IsAudit, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊叧闂潈闄�
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBillMain_Close", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ var ds = oCN.RunProcReturn("select * from PM_WorkTaskMoneyBillMain where HInterID=" + HInterID, "PM_WorkTaskMoneyBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsAudit == 0) //鍏抽棴鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸弽鍏抽棴!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ if (IsAudit == 0) //鍏抽棴鍒ゆ柇
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HCloseMan='" + user + "',HCloseDate=getdate(),HBillStatus='3' where HInterID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍏抽棴鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "")
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HCloseMan='',HCloseDate=null,HBillStatus='1' where HInterID=" + HInterID);
+ }
+ else
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HCloseMan='',HCloseDate=null,HBillStatus='2' where HInterID=" + HInterID);
+ }
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ 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/DropPM_WorkTaskMoneyBillMain")]
+ [HttpGet]
+ public object DropPM_WorkTaskMoneyBillMain(string HInterID, int IsAudit, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊叧闂潈闄�
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBillMain_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ var ds = oCN.RunProcReturn("select * from PM_WorkTaskMoneyBillMain where HInterID=" + HInterID, "PM_WorkTaskMoneyBillMain");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsAudit == 0) //鍏抽棴鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆浣滃簾锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅叧闂垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸弽浣滃簾!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ if (IsAudit == 0) //浣滃簾鍒ゆ柇
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HDeleteMan='" + user + "',HDeleteDate=getdate(),HBillStatus='4' where HInterID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍏抽棴鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsAudit == 1) //鍙嶄綔搴熷垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "" && ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus='1' where HInterID=" + HInterID);
+ }
+ else if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "" && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus='3' where HInterID=" + HInterID);
+ }
+ else if (ds.Tables[0].Rows[0]["HChecker"].ToString() == "" && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus='3' where HInterID=" + HInterID);
+ }
+ else if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "" && ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+ {
+ oCN.RunProc("update PM_WorkTaskMoneyBillMain set HDeleteMan='',HDeleteDate=null,HBillStatus='2' where HInterID=" + HInterID);
+ }
+
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ return objJsonResult;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 浠诲姟璐圭敤鍒楄〃 鍒犻櫎
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("PM_WorkTaskBill/DeletePM_WorkTaskMoneyBillMain")]
+ [HttpGet]
+ public object DeletePM_WorkTaskMoneyBillMain(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBillMain_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ oCN.RunProc("delete from Gy_WorkTaskMoneyBOMBillMain where HInterID = " + HInterID);
+
+ oCN.RunProc("delete from Gy_WorkTaskMoneyBOMBillSub where HInterID = " + HInterID);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ 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
+
+ #region 浠诲姟璐圭敤娓呭崟
+
+ #region 浠诲姟璐圭敤娓呭崟 淇濆瓨/缂栬緫
+ /// <summary>
+ /// 浠诲姟璐圭敤娓呭崟
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("PM_WorkTaskBill/Save锘縂y_WorkTaskMoneyBOMBill")]
+ [HttpPost]
+ public object Save锘縂y_WorkTaskMoneyBOMBill([FromBody] JObject sMainSub)
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString(); //瀛愯〃
+ string refSav = sArray[2].ToString();//鎿嶄綔鏂瑰紡鏁版嵁绫诲瀷 1娣诲姞 3淇敼 2 澶嶅埗
+ string user = sArray[3].ToString();//鐢ㄦ埛鍚�
+
+ string UserName = "";
+ string s = "";
+ ListModels oListModels = new ListModels();
+ try
+ {
+ //淇濆瓨鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("PM_WorkTaskMoneyBOMBill_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DAL.ClsGy_WorkTaskMoneyBOMBill oBill = new DAL.ClsGy_WorkTaskMoneyBOMBill();
+ List<Model.Cls锘縂y_WorkTaskMoneyBOMBillMain> lsmain = new List<Model.Cls锘縂y_WorkTaskMoneyBOMBillMain>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ //搴忓垪鍖栦富琛ㄦ暟鎹�
+ var jsonString = "[" + msg2.ToString() + "]";
+ lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls锘縂y_WorkTaskMoneyBOMBillMain>>(jsonString);
+ foreach (Model.Cls锘縂y_WorkTaskMoneyBOMBillMain oItem in lsmain)
+ {
+ if (refSav == "Add")
+ {
+ //鍗曟嵁鍙锋槸鍚﹂噸澶�
+ if (BillNew1.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鍙烽噸澶嶏紒涓嶅厑璁镐繚瀛橈紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ if (refSav == "Update")
+ {
+ if (BillNew1.ShowBill(oItem.HInterID, ref s) == false)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹湁璇紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (BillNew1.omodel.HChecker != "" && BillNew1.omodel.HChecker != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (BillNew1.omodel.HBillStatus > 1)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹浜庝笉鍙紪杈戠姸鎬侊紝涓嶅厑璁镐慨鏀癸紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ }
+ UserName = oItem.HMaker; //鍒跺崟浜�
+ oItem.HBillType = "3339";
+ oItem.HBillSubType = "3339";
+
+
+
+ //oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd"));
+
+ if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oBill.omodel = oItem;
+ }
+ // 琛ㄤ綋鏁版嵁
+ //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+ List<Model.Cls锘縂y_WorkTaskMoneyBOMBillSub> ls = new List<Model.Cls锘縂y_WorkTaskMoneyBOMBillSub>();
+ jsonString = "[" + msg3.ToString() + "]";
+ ls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.Cls锘縂y_WorkTaskMoneyBOMBillSub>>(jsonString);
+ int i = 0;
+ foreach (Model.Cls锘縂y_WorkTaskMoneyBOMBillSub oItemSub in ls)
+ {
+ i++;
+ oItemSub.HEntryID = i;
+
+
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+
+ oBill.DetailColl.Add(oItemSub);
+
+ }
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (refSav == "Add")
+ {
+
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else if (refSav == "Update")
+ {
+ bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else
+ {
+ bResult = false;
+ }
+ if (bResult)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 浠诲姟璐圭敤娓呭崟鍒楄〃 鏌ヨ
+ /// <summary>
+ /// 杩斿洖浠诲姟璐圭敤娓呭崟鍒楄〃
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("PM_WorkTaskBill/get锘縂y_WorkTaskMoneyBOMBillList")]
+ [HttpGet]
+ public object get锘縂y_WorkTaskMoneyBOMBillList(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("PM_WorkTaskMoneyBOMBill_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("select * from h_v_Gy_WorkTaskMoneyBOMBillList order by 鍗曟嵁鍙� desc", "锘縣_v_Gy_WorkTaskMoneyBOMBillList");
+ }
+ else
+ {
+ string sql1 = "select * from h_v_Gy_WorkTaskMoneyBOMBillList where 1 = 1 ";
+ string sql = sql1 + sWhere + " order by 鍗曟嵁鍙� desc";
+ ds = oCN.RunProcReturn(sql, "锘縣_v_Gy_WorkTaskMoneyBOMBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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>
+ /// 鑾峰彇缂栬緫鍒楄〃鏁版嵁
+ /// </summary>
+ /// <param name="HInterID"></param>
+ /// <param name="User"></param>
+ /// <returns></returns>
+ [Route("PM_WorkTaskBill/Gy_WorkTaskMoneyBOMBillEditList")]
+ [HttpGet]
+ public object Gy_WorkTaskMoneyBOMBillMainEditList(string HInterID, string User)
+ {
+ try
+ {
+ List<DataTable> tableList = new List<DataTable>();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBOMBill_Edit", 1, false, User))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏌ヨ澶辫触!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_Gy_WorkTaskMoneyBOMBillList where HInterID =" + HInterID, "h_v_Gy_WorkTaskMoneyBOMBillList");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "false锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ 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_WorkTaskBill/CheckGy_WorkTaskMoneyBOMBill")]
+ [HttpGet]
+ public object CheckGy_WorkTaskMoneyBOMBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBOMBill_Check", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ClsPub.CurUserName = user;
+ BillOld1.MvarItemKey = "Gy_WorkTaskMoneyBOMBillMain";
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 瀹℃牳 2 鍙嶅鏍�
+ if (Type == 1)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+ DataSet ds;
+ string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey);
+ 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)
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ 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 (!BillOld1.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+ DataSet ds;
+ string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey);
+ if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜鍙嶅鏍革紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍙嶅鏍革紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ 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 (!BillOld1.AbandonCheck(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ 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/CloseGy_WorkTaskMoneyBOMBill")]
+ [HttpGet]
+ public object CloseGy_WorkTaskMoneyBOMBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBOMBill_Close", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ClsPub.CurUserName = user;
+ BillOld1.MvarItemKey = "Gy_WorkTaskMoneyBOMBillMain";
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 鍏抽棴 2 鍙嶅叧闂�
+ if (Type == 1)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
+ DataSet ds;
+ string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey);
+ 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)
+ {
+ if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ 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 (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆鍏抽棴!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍏抽棴鍗曟嵁
+ if (!BillOld1.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅叧闂�
+ DataSet ds;
+ string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey);
+ if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜鍏抽棴!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ 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 (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈叧闂�!涓嶉渶瑕佸啀鍙嶅叧闂�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅叧闂崟鎹�
+ if (!BillOld1.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ 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/DropGy_WorkTaskMoneyBOMBill")]
+ [HttpGet]
+ public object DropGy_WorkTaskMoneyBOMBillMain(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBOMBill_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ClsPub.CurUserName = user;
+ BillOld1.MvarItemKey = "Gy_WorkTaskMoneyBOMBillMain";
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 浣滃簾 2 鍙嶄綔搴�
+ if (Type == 1)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
+ DataSet ds;
+ string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld1.MvarItemKey);
+ 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)
+ {
+ 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 (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶉渶瑕佸啀浣滃簾!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //浣滃簾鍗曟嵁
+ if (!BillOld1.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶄綔搴�
+ DataSet ds;
+ string sql = "select * from " + BillOld1.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld1.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 (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈綔搴�!涓嶉渶瑕佸啀鍙嶄綔搴�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶄綔搴熷崟鎹�
+ if (!BillOld1.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ 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 浠诲姟璐圭敤娓呭崟鍒楄〃 鍒犻櫎
+
+ /// <summary>
+ ///鍙傛暟锛歴tring HInterID銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("PM_WorkTaskBill/DeleteGy_WorkTaskMoneyBOMBill")]
+ [HttpGet]
+ public object DeleteGy_WorkTaskMoneyBOMBillMain(string HInterID, string user)
+ {
+ try
+ {
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("PM_WorkTaskMoneyBOMBill_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (HInterID == null || HInterID.Equals(""))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ oCN.RunProc("delete from Gy_WorkTaskMoneyBOMBillMain where HInterID = " + HInterID);
+
+ oCN.RunProc("delete from Gy_WorkTaskMoneyBOMBillSub where HInterID = " + HInterID);
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ 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
+
+ #region 椤圭洰璐圭敤娓呭崟 琛屽叧闂�/琛屽弽鍏抽棴
+ /// <summary>
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">鍏抽棴(1),鍙嶅叧闂�(2)</param>
+ /// <param name="CurUserName">鍏抽棴浜�</param>
+ /// <returns></returns>
+ [Route("PM_WorkTaskBill/CloseRowGy_WorkTaskMoneyBOMBill")]
+ [HttpGet]
+ public object CloseRowGy_WorkTaskMoneyBOMBill(int HInterID, int HEntryID, int IsAudit, string CurUserName)
+ {
+ string ModRightNameCheck = "PM_ProjectMoneyBOMBill_Close";
+ string SubBillName = "Gy_WorkTaskMoneyBOMBillSub"; //瀛愯〃琛ㄥ悕
+ DBUtility.ClsPub.CurUserName = CurUserName;
+ DataSet ds = null;
+ try
+ {
+ //妫�鏌ユ潈闄�
+ if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽叧闂け璐ワ紒鏃犳潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //HInterID鏁版嵁鍒ゆ柇
+ if (HInterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+ DAL.ClsGy_WorkTaskMoneyBOMBill oBill = new DAL.ClsGy_WorkTaskMoneyBOMBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ {
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘杩涜琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HCloseMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘杩涜琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (oBill.omodel.HChecker.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶈兘杩涜琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ string sql = "select * from " + SubBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID;
+ ds = oCN.RunProcReturn(sql, "Cg_POOrderBillSub");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璇ヨ鏁版嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (IsAudit == 1) //琛屽叧闂垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 2) //琛屽弽鍏抽棴鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屾湭鍏抽棴!涓嶉渶瑕佸啀琛屽弽鍏抽棴锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴
+ string temp = ds.Tables[0].Rows[0]["HCloseType"].ToString();
+ if (ds.Tables[0].Rows[0]["HCloseType"].ToString() == "False")
+ {
+ 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;
+ }
+
+
+ //杩涜闇�瑕佽繘琛岀殑琛屽叧闂�/琛屽弽鍏抽棴鎿嶄綔
+ if (IsAudit == 1) //琛屽叧闂彁浜�
+ {
+ //琛屽叧闂彁浜�
+ if (oBill.CloseRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "琛屽叧闂垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "琛屽叧闂け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 2) //琛屽弽鍏抽棴鎻愪氦
+ {
+ //琛屽弽鍏抽棴鎻愪氦
+ if (oBill.CancelRow(lngBillKey, HEntryID, oBill.omodel.HBillNo, CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅叧闂垚鍔�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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
+
+ #endregion
+
+ #region 浠诲姟姹囨姤鍗曚繚瀛樺彂閫侀拤閽夋秷鎭�
+ /// <summary>
+ /// 浠诲姟姹囨姤鍗曚繚瀛樺彂閫侀拤閽夋秷鎭�
+ /// </summary>
+ /// <param name="HSendMan"></param>
+ /// <param name="HDescription">鏃ユ湡+姹囨姤浜�+姹囨姤鍐呭+宸ユ椂+ 椤圭洰鍚嶇О</param>
+ /// <param name="HCopyMan">鎶勯�佷汉</param>
+ /// <returns></returns>
+ public async Task<object> SendDingDingAsync(string HSendMan, string HDescription, string HCopyMan)
+ {
+ string concatenatedNames = "";
+ Cls_DDMsg msg = new Cls_DDMsg();
+ string appKey = "dingrsrzhdyn3mlaof95";
+ string appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq";
+ //浠诲姟姹囨姤鍗曚繚瀛樺彂閫侀拤閽夋秷鎭繚瀛� 灏嗘秷鎭� 鍙戦�佺粰 鎺ユ敹浜�
+ //鑾峰彇鎺ラ�佷汉鐨勯拤閽塱d
+ string HReceiveMan = HSendMan;
+ string[] names = HCopyMan.Split(',');
+ string sqlNames = "";
+ foreach (string name in names)
+ {
+ sqlNames += "'" + name.Trim() + "',";
+ }
+ sqlNames = sqlNames.TrimEnd(',');
+ //鑾峰彇鎸囨淳澶勭悊浜�,鍙戦�佷汉鐨勯拤閽塱d
+ string sql1 = "select HDingDingUserID 閽夐拤id from Gy_Czygl where Czymc in ('" + HReceiveMan + "'," + sqlNames + ")";
+ ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
+ List<string> HNames = new List<string>();
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ string HName = ds.Tables[0].Rows[i]["閽夐拤id"].ToString();
+ HNames.Add(HName);
+ }
+ concatenatedNames = string.Join(",", HNames);//閽夐拤浜哄憳鐨刬d鍒楄〃
+ //鑾峰彇浼佷笟鐨刟ccess_token鐨勫��
+ string response = msg.GetAccessToken(appKey, appSecret);
+ JObject responseJson = JObject.Parse(response);
+ // 鑾峰彇access_token鐨勫��
+ string accessToken = responseJson["accessToken"].ToString();
+
+ //璋冪敤鏂规硶鍙戦�佹秷鎭�
+ string agentId = "3118119317";//閽夐拤鍚庡彴寤虹珛鐨勫皬绋嬪簭id
+ string userIdList = concatenatedNames;//閽夐拤浜哄憳鐨刬d
+ string deptIdList = "0"; // 绌哄瓧绗︿覆琛ㄧず涓嶆寚瀹氶儴闂�
+ string toAllUser = "false";
+ string message = HDescription;
+ response = await msg.SendTextMessage(accessToken, agentId, userIdList, deptIdList, toAllUser, message);
+ Console.WriteLine(response);
+ return response;
+ }
+ #endregion
+
+
+
+ //#region 鑷姩鍔犺浇椤甸潰琛ㄥご
+ ///// <summary>
+ ///// 杩斿洖椤圭洰闃舵鍒楄〃
+ /////鍙傛暟锛歴tring sql銆�
+ /////杩斿洖鍊硷細object銆�
+ ///// </summary>
+ //[Route("Xt_DefineBillMainSet/getDefineBillMainSet")]
+ //[HttpGet]
+ //public object getDefineBillMainSet(string HModName, string user)
+ //{
+ // try
+ // {
+ // string sql = "select * from h_v_Xt_DefineBillMainSet_AutoLoadList where HModName ='" + HModName + "' and HUser ='" + user + "' order by HArrangeOrder,HArrangeOrderSub";
+ // ds = oCN.RunProcReturn(sql, "Xt_DefineBillMainSet");
+
+ // if(ds!=null && ds.Tables[0].Rows.Count == 0)
+ // {
+ // sql = "select * from h_v_Xt_DefineBillMainSet_AutoLoadList where HModName ='" + HModName + "' and HUser ='admin' order by HArrangeOrder,HArrangeOrderSub";
+ // ds = oCN.RunProcReturn(sql, "h_v_Xt_DefineBillMainSet_AutoLoadList");
+ // }
+
+ // objJsonResult.code = "1";
+ // objJsonResult.count = 1;
+ // objJsonResult.Message = "Sucess锛�";
+ // objJsonResult.data = ds.Tables[0];
+ // 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