From 7a01f43d91c2e7e1d3ab099c7a6f0152c6abdecd Mon Sep 17 00:00:00 2001
From: pzy <2829717936@qq.com>
Date: 星期五, 04 十月 2024 08:48:14 +0800
Subject: [PATCH] 11
---
WebAPI/Controllers/XSGL/Xs_ContractBillController.cs | 1242 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,240 insertions(+), 2 deletions(-)
diff --git a/WebAPI/Controllers/XSGL/Xs_ContractBillController.cs b/WebAPI/Controllers/XSGL/Xs_ContractBillController.cs
index a22c1ed..f77f68d 100644
--- a/WebAPI/Controllers/XSGL/Xs_ContractBillController.cs
+++ b/WebAPI/Controllers/XSGL/Xs_ContractBillController.cs
@@ -15,6 +15,1244 @@
//閿�鍞悎鍚孋ontroller
public class Xs_ContractBillController : ApiController
{
-
+ //鑾峰彇绯荤粺鍙傛暟
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+ public DAL.ClsXs_ContractBill BillOld = new DAL.ClsXs_ContractBill();
+ private json objJsonResult = new json();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ DataSet ds;
+
+
+ #region 鑾峰彇鍚堝悓鍒楄〃
+ [Route("Xs_ContractBill/list")]
+ [HttpGet]
+ public object list(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+
+ if (!DBUtility.ClsPub.Security_Log("Xs_ContractBill", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愭煡鐪�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ string sql = "select * from h_v_Xs_ContractBillAllList where 1 = 1 ";
+
+ if (sWhere == "" || sWhere == null)
+ {
+ ds = oCN.RunProcReturn(sql + " order by hmainid desc", "h_v_Xs_ContractBillAllList");
+ }
+ else
+ {
+ ds = oCN.RunProcReturn(sql + sWhere + " order by hmainid desc", "h_v_Xs_ContractBillAllList");
+ }
+
+ //鍒ゆ柇鏄惁鏈夐噰璐粡鐞嗘潈闄愶紙瀹夌憺锛�
+ //bool isCgjl = Security_Log("Cg_POOrderBill_PurchasManager", 1, true, user);
+ //if (!isCgjl)
+ //{
+ // sWhere += $" and HEmpID in (select HEmpID from Gy_Czygl where Czymc='{user}' and HEmpID >0 )";
+ //}
+ //string sql = "select * from h_v_IF_POOrderBillList where 1 = 1 " + sWhere;
+ //ds = oCN.RunProcReturn(sql, "h_v_Xs_ContractBillList");
+
+ 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("Xs_ContractBill/ContractBillEdit")]
+ [HttpPost]
+ public object ContractBillEdit([FromBody] JObject sMainSub)
+ {
+ try
+ {
+ var _value = sMainSub["sMainSub"].ToString();
+ string msg1 = _value.ToString();
+ oCN.BeginTran();
+ //淇濆瓨涓昏〃
+ objJsonResult = AddBillMain(msg1);
+ if (objJsonResult.code == "0")
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.Commit();
+ objJsonResult.code = "1";
+ 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;
+ }
+ }
+ /// <summary>
+ /// 鏂板涓庢洿鏂板悎鍚�
+ /// </summary>
+ public json AddBillMain(string msg1)
+ {
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString(); //涓昏〃鏁版嵁
+ string msg3 = sArray[1].ToString(); //瀛愯〃鏁版嵁
+ string msg4 = sArray[2].ToString(); //瀛愯〃2鏁版嵁
+ int OperationType = int.Parse(sArray[3].ToString()); // 鏁版嵁绫诲瀷 1娣诲姞 3淇敼
+ string user = sArray[4].ToString();
+ string msg_allVal = sArray[4].ToString(); //涓昏〃+瀛愯〃鎵�鏈夋暟鎹�
+
+ try
+ {
+ msg2 = "[" + msg2.ToString() + "]";
+ List<ClsXs_ContractBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_ContractBillMain>>(msg2);
+
+ long HInterID = mainList[0].HInterID;//閫掑叆type寰楀埌鐨勫崟鎹甀D
+ string HBillNo = mainList[0].HBillNo;//閫掑叆type寰楀埌鐨勫崟鎹彿
+ DateTime HDate = mainList[0].HDate;//鏃ユ湡
+ string HRemark = mainList[0].HRemark;//澶囨敞
+ long HCusID = mainList[0].HCusID;//瀹㈡埛
+ long HEmpID = mainList[0].HEmpID;//涓氬姟鍛�
+ long HDeptID = mainList[0].HDeptID;//閮ㄩ棬
+ long HCurID = mainList[0].HCurID;//甯佸埆
+ Single HExRate = (float)mainList[0].HExRate;//姹囩巼
+ long HSSID = mainList[0].HSSID;//缁撶畻鏂瑰紡
+ string HContractName = mainList[0].HContractName;//鍚堝悓鍚嶇О
+ DateTime HContractDate = mainList[0].HContractDate;//缁撶畻鏃ユ湡
+
+ string HMaker = user;//鍒跺崟浜�
+ string HAddress = mainList[0].HAddress;//浜よ揣鍦板潃
+ string HExplanation = mainList[0].HExplanation;//鎽樿
+ string HInnerBillNo = mainList[0].HInnerBillNo;//鍐呴儴鍗曟嵁鍙�
+
+ List<ClsXs_ContractBillMain> mainList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_ContractBillMain>>(msg2);
+ DateTime dt = DateTime.Now;
+ long HYear = mainList2[0].HYear == null ? 0 : mainList2[0].HYear;
+ long HPeriod = mainList2[0].HPeriod == null ? 0 : mainList2[0].HPeriod;
+ string HBillType = mainList2[0].HBillType == null ? "''" : mainList2[0].HBillType;
+ string HBillSubType = mainList2[0].HBillSubType == null ? "''" : mainList2[0].HBillSubType;
+ long HBillStatus = mainList2[0].HBillStatus == null ? 0 : mainList2[0].HBillStatus;
+ string HChecker = mainList2[0].HChecker == null ? "''" : mainList2[0].HChecker;
+ string HUpDater = mainList2[0].HUpDater == null ? "''" : mainList2[0].HUpDater;
+ string HCloseMan = mainList2[0].HCloseMan == null ? "''" : mainList2[0].HCloseMan;
+ string HDeleteMan = mainList2[0].HDeleteMan == null ? "''" : mainList2[0].HDeleteMan;
+ string HCheckDate = mainList2[0].HCheckDate == null ? "''" : mainList2[0].HCheckDate;
+ string HMakeDate = mainList2[0].HMakeDate == null ? "''" : mainList2[0].HMakeDate;
+ string HUpDateDate = mainList2[0].HUpDateDate == null ? "''" : mainList2[0].HUpDateDate;
+ string HDeleteDate = mainList2[0].HDeleteDate == null ? "''" : mainList2[0].HDeleteDate;
+
+
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.Message = s;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from h_v_Xs_ContractBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_Xs_ContractBillList");
+
+ if ((OperationType == 1 || OperationType == 2) && ds.Tables[0].Rows.Count == 0)//鏂板
+ {
+
+ //淇濆瓨鍓嶆帶鍒�=========================================
+ ds = oCN.RunProcReturn("exec h_p_Xs_ContractBill_BeforeSaveCtrl " + HInterID, "h_p_Xs_ContractBill_BeforeSaveCtrl ");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //=========================================================
+ DataSet Ds;
+ Int64 NewHInterID = 1;
+ Ds = oCN.RunProcReturn("select MAX(HInterID)HInterID from Xs_ContractBillMain", "Xs_ContractBillMain");
+ if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString()) != 0)
+ {
+ NewHInterID = ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
+ NewHInterID += 1;
+ }
+ //涓昏〃
+ oCN.RunProc(@"Insert Into Xs_ContractBillMain
+ (HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate,HBillNo,HBillStatus
+ ,HRemark,HPrintQty
+ ,HMaker,HMakeDate
+ ,HContractDate,HContractName,HAddress,HSSID,HCusID,HCurID,HExRate,HEmpID,HDeptID,HExplanation,HInnerBillNo
+ )
+ values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1400 + "','" +
+ 1400 + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" +
+ HRemark + "'," + 0 + ",'" +
+ HMaker + "',getdate(),'" +
+ HContractDate + "','" + HContractName + "','" + HAddress + "'," + HSSID + "," + HCusID + "," + HCurID + "," + HExRate + "," + HEmpID + "," + HDeptID + ",'" + HExplanation + "','" + HInnerBillNo + "'" +
+ ")");
+ }
+ else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0)
+ {
+ //淇敼
+ DataSet dss;
+ dss = oCN.RunProcReturn("select * from h_v_Xs_ContractBillList where hmainid=" + HInterID + " and 鍗曟嵁鍙�='" + HBillNo + "'", "h_v_Xs_ContractBillList");
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (dss.Tables[0].Rows[0]["瀹℃牳浜�"].ToString() != "" && dss.Tables[0].Rows[0]["瀹℃牳浜�"] != null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹凡缁忚瀹℃牳锛屼笉鍏佽淇敼锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oCN.RunProc("update Xs_ContractBillMain set " +
+ "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" +
+ ",HSSID=" + HSSID + ",HCusID=" + HCusID + ",HCurID=" + HCurID
+ + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HDeptID=" + HDeptID
+ + ",HAddress='" + HAddress + "',HContractName='" + HContractName + "',HContractDate= '" + HContractDate
+ + "' where HInterID=" + HInterID);
+
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("delete from Xs_ContractBillSub where HInterID='" + HInterID + "'");
+ oCN.RunProc("delete from Xs_ContractBillScheme where HInterID='" + HInterID + "'");
+ }
+ //淇濆瓨瀛愯〃
+ objJsonResult = AddBillSubAndScheme(msg3, msg4, HInterID, HBillNo, OperationType);
+
+ if (objJsonResult.code == "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = objJsonResult.Message;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ /// <summary>
+ /// 淇濆瓨椤电
+ /// </summary>
+ /// <param name="msg3">鐗╂枡鏄庣粏</param>
+ /// <param name="msg4">浠樻璁″垝</param>
+ /// <param name="HInterID">鍗曟嵁鍐呯爜</param>
+ /// <param name="OperationType"></param>
+ /// <param name="HBillNo">鍗曟嵁鍙�</param>
+ /// <returns></returns>
+ public json AddBillSubAndScheme(string msg3, string msg4, long HInterID, string HBillNo, int OperationType)
+ {
+ List<ClsXs_ContractBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_ContractBillSub>>(msg3);
+
+ List<ClsXs_ContractBillScheme> SchemeColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsXs_ContractBillScheme>>(msg4);
+ int i = 0;
+ foreach (ClsXs_ContractBillSub oSub in DetailColl)
+ {
+ i++;
+ if (oSub.HQty <= 0 || oSub.HQty == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + i + "琛岋紝鏁伴噺涓嶈兘涓�0鎴栬�呭皬浜�0";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (oSub.HMaterID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + i + "琛岋紝鐗╂枡涓嶈兘涓虹┖";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //if (oSub.HSourceID == 0)
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "绗�" + i + "琛岋紝鐢熶骇璧勬簮涓嶈兘涓虹┖";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ if (oSub.HUnitID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + i + "琛岋紝璁¢噺鍗曚綅涓嶈兘涓虹┖";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DataSet Cs;
+ Int64 NewHEntryID = 1;
+ Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Xs_ContractBillSub", "Xs_ContractBillSub");
+ if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
+ {
+ NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
+ NewHEntryID += 1;
+ }
+
+ oCN.RunProc($@"Insert into Xs_ContractBillSub
+ (HInterID,HBillNo_bak,HEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,
+ HMaterID,HUnitID,HQty,HPrice,HMoney,HTaxRate,HTaxMoney,HlineTotal
+ )
+ values({HInterID},'{HBillNo}',{NewHEntryID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney}
+ ,{oSub.HMaterID},{oSub.HUnitID},{oSub.HQty},{oSub.HPrice},{oSub.HMoney},{oSub.HTaxRate},{oSub.HTaxMoney},{oSub.HPrice})");
+ }
+ i = 0;
+ //浠樻璁″垝淇濆瓨
+ foreach (ClsXs_ContractBillScheme oSub in SchemeColl)
+ {
+ i++;
+ DataSet Cs;
+ Int64 NewHEntryID = 1;
+ Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Xs_ContractBillScheme", "Xs_ContractBillScheme");
+ if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
+ {
+ NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
+ NewHEntryID += 1;
+ }
+
+ oCN.RunProc($@"Insert into Xs_ContractBillScheme
+ (HInterID,HBillNo_bak,HEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney,
+ HDate,HMoney,HCurID,HExRate)
+ values({HInterID},'{HBillNo}',{NewHEntryID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney}
+ ,'{oSub.HDate}',{oSub.HMoney},{oSub.HCurID},{oSub.HExRate})");
+ }
+ //淇濆瓨鍚庢帶鍒�=========================================
+ ds = oCN.RunProcReturn("exec h_p_Xs_ContractBill_AfterSaveCtrl " + HInterID, "h_p_Cg_POOrderBill_AfterSaveCtrl");
+
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //=========================================================
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ #endregion
+
+ #region 鍒犻櫎
+ /// <summary>
+ ///鍒犻櫎鍔熻兘
+ /// </summary>
+ /// <returns></returns>
+ [Route("Xs_ContractBill/DeltetXs_ContractBill")]
+ [HttpGet]
+ public object DeltetXs_ContractBill(string HInterID, string user)
+ {
+ try
+ {
+
+ string HBillNo = "";
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Xs_ContractBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Xs_ContractBill_BeforeDelCtrl");
+ 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;
+ }
+ //==================================================================================
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ DateTime HDate = DateTime.Now;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.Message = s;
+ return objJsonResult;
+ }
+ string sReturn = "";
+ oCN.BeginTran();
+ oCN.RunProc("Delete From Xs_ContractBillMain where HInterID = " + HInterID);
+ oCN.RunProc("Delete From Xs_ContractBillSub where HInterID = " + HInterID);
+ oCN.RunProc("Delete From Xs_ContractBillScheme where HInterID = " + HInterID);
+ oCN.Commit();
+
+ //鍒犻櫎鍚庢帶鍒�==================================================================================
+ string sql2 = "exec h_p_Xs_ContractBill_AfterDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql2, "h_p_Xs_ContractBill_AfterDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ sReturn = "鍒犻櫎鍚庡垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString();
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + sReturn;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==============================================================================================
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍(鍔犺浇琛ㄧ敤)
+ /// <summary>
+ /// 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Xs_ContractBill/cx")]
+ [HttpGet]
+ public object cx(long HInterID)
+ {
+ try
+ {
+
+ ds = oCN.RunProcReturn("select * from h_v_Xs_ContractBillAllList where hmainid =" + HInterID, "h_v_Xs_ContractBillAllList");
+ 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("Xs_ContractBill/getMaterialByMaterID")]
+ [HttpGet]
+ public ApiResult<DataTable> getMaterialByMaterID(Int64 HMaterID)
+ {
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+ string sql = "select a.HItemID HMaterID,a.HNumber HMaterNumber,a.HName HMaterName,a.HMaterRuleType,a.HModel HMaterModel,a.HUnitID, b.HNumber HUnitNumber, b.HName HUnitName" +
+ " from Gy_Material AS a " +
+ " LEFT OUTER JOIN Gy_Unit AS b on a.HUnitID = b.HItemID " +
+ " where a.HItemID =" + HMaterID;
+
+ var dataSet = oCN.RunProcReturn(sql, "Gy_Material");
+
+
+ if (dataSet == null || dataSet.Tables[0].Rows.Count == 0)
+ return new ApiResult<DataTable> { code = -1, msg = "涓嶅瓨鍦ㄨ鐗╂枡" };
+
+ return new ApiResult<DataTable> { code = 1, msg = "鏌ヨ鎴愬姛", data = dataSet.Tables[0] };
+ }
+ #endregion
+
+ #region 閿�鍞悎鍚� 瀹℃牳/鍙嶅鏍�
+ /// <summary>
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Xs_ContractBill/AuditXs_ContractBill")]
+ [HttpGet]
+ public object AuditXs_ContractBill(int HInterID, int IsAudit, string CurUserName)
+ {
+ string ModRightNameCheck = "Xs_ContractBill_Check";
+ DBUtility.ClsPub.CurUserName = CurUserName;
+ 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.ClsXs_ContractBill oBill = new DAL.ClsXs_ContractBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ 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) //瀹℃牳鎻愪氦
+ {
+
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Xs_ContractBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Xs_ContractBill_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;
+ 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;
+ }
+ //==================================================================================
+
+ //瀹℃牳鎻愪氦
+ if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_ContractBill_AfterCheckCtrl", 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 == 1) //鍙嶅鏍告彁浜�
+ {
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ DataSet ds = oCN.RunProcReturn("Exec h_p_Xs_ContractBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + CurUserName + "'", "h_p_Xs_ContractBill_BeforeUnCheckCtrl");
+ if (ds == null)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + "鍙嶅鏍稿墠鍒ゆ柇澶辫触锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //=========================================================
+
+ //鍙嶅鏍告彁浜bandonCheck
+ if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Xs_ContractBill_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)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 閿�鍞悎鍚� 鍏抽棴/鍙嶅叧闂姛鑳�
+ [Route("Xs_ContractBill/CloseXs_ContractBill")]
+ [HttpGet]
+ public object CloseXs_ContractBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Xs_ContractBill_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;
+ BillOld.MvarItemKey = "Xs_ContractBillMain";
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 鍏抽棴 2 鍙嶅叧闂�
+ if (Type == 1)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍏抽棴
+ DataSet ds;
+ string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+ if (ds == 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 (!BillOld.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 " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+ if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["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 (!BillOld.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 閿�鍞悎鍚� 琛屽叧闂�/琛屽弽鍏抽棴锛堟湭瀹屽杽锛�
+ /// <summary>
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="HEntryID2">瀛愬唴鐮佷粯娆捐鍒�</param>
+ /// <param name="HEntryID">瀛愬唴鐮佺墿鏂欐槑缁�</param>
+ /// <param name="IsAudit">鍏抽棴(0),鍙嶅叧闂�(1)</param>
+ /// <param name="CurUserName">鍏抽棴浜�</param>
+ /// <returns></returns>
+ //[Route("Xs_ContractBill/CloseRowXs_ContractBill")]
+ //[HttpGet]
+ //public object CloseRowXs_ContractBill(int HInterID, int HEntryID, int HEntryID2, int IsAudit, string CurUserName)
+ //{
+ // string ModRightNameCheck = "Xs_ContractBill_Close";
+ // string SubBillName = "Xs_ContractBillSub";
+ // string SchemeBillName = "Xs_ContractBillScheme"; //瀛愯〃琛ㄥ悕
+ // 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.ClsXs_ContractBill oBill = new DAL.ClsXs_ContractBill(); //瀹炰緥鍖栧崟鎹搷浣滅被锛岀敤浜庤繘琛岀浉鍏虫搷浣�
+
+ // //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ // 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, "Xs_ContractBillSub");
+ // 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 == 0) //琛屽叧闂垽鏂�
+ // {
+ // if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鐗╂枡琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒";
+ // 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;
+ // }
+
+ // //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴
+ // 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;
+ // }
+ // }
+ // //鍒ゆ柇浠樻璁″垝琛ㄦ潯浠�
+ // sql = "select * from " + SchemeBillName + " where HInterID = " + HInterID + " and HEntryID = " + HEntryID2;
+ // ds = oCN.RunProcReturn(sql, "Xs_ContractBillScheme");
+ // 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 == 0) //琛屽叧闂垽鏂�
+ // {
+ // if (ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim() != "")
+ // {
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "璁″垝琛屽凡鍏抽棴!涓嶈兘鍐嶆琛屽叧闂紒";
+ // 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;
+ // }
+
+ // //鍒ゆ柇琛屾槸鍚︿负鑷姩鍏抽棴
+ // 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;
+ // }
+
+ // oCN.BeginTran();//寮�鍚簨鍔�
+ // //杩涜闇�瑕佽繘琛岀殑琛屽叧闂�/琛屽弽鍏抽棴鎿嶄綔
+ // if (IsAudit == 0) //琛屽叧闂彁浜�
+ // {
+ // //琛屽叧闂彁浜�
+ // if (oBill.CloseRow(lngBillKey, HEntryID, HEntryID2, 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 == 1) //琛屽弽鍏抽棴鎻愪氦
+ // {
+ // //琛屽弽鍏抽棴鎻愪氦
+ // if (oBill.CancelRow(lngBillKey, HEntryID, HEntryID2, 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;
+ // }
+ // }
+ // 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("Xs_ContractBill/DropXs_ContractBill")]
+ [HttpGet]
+ public object DropXs_ContractBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈変綔搴熸潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Xs_ContractBill_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;
+ BillOld.MvarItemKey = "Xs_ContractBillMain";
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 浣滃簾 2 鍙嶄綔搴�
+ if (Type == 1)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡浣滃簾
+ DataSet ds;
+ string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+ if (ds == 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 (!BillOld.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 " + BillOld.MvarItemKey + " where HinterID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey);
+ if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (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 (!BillOld.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
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.1