From daa95fd4d96d0bc7ceb0308005c78f4bfd0fd005 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 06 二月 2026 14:37:33 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/基础资料/基础资料/Gy_MatePriceSupController.cs | 374 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 327 insertions(+), 47 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs"
index c2dd857..04e16c1 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_MatePriceSupController.cs"
@@ -27,15 +27,15 @@
{
List<object> columnNameList = new List<object>();
//缂栬緫鏉冮檺
- //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
- string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList where 1 = 1 ");
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupList_Sec where 1 = 1 ");
string sql = sql1 + sWhere;
ds = oCN.RunProcReturn(sql, "h_v_Gy_MatePriceSupList");
@@ -66,6 +66,45 @@
}
#endregion
+ #region 閲囪喘浠锋牸 缂栬緫鏌ョ湅淇℃伅
+ [Route("Gy_MatePriceSup/cx")]
+ [HttpGet]
+ public object cx(string HItemID, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Query", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ string sql1 = string.Format(@"select * from h_v_Gy_MatePriceSupEdit where HItemID = " + HItemID);
+
+ ds = oCN.RunProcReturn(sql1, "h_v_Gy_MatePriceSupEdit");
+
+
+ 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("Gy_MatePriceSup/MatePriceSupEdit")]
[HttpPost]
@@ -77,19 +116,16 @@
string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg1 = sArray[0].ToString();
string msg2 = sArray[1].ToString();
- //string msg_HUSEORGID = sArray[2].ToString();
- Int64 HItemID = 0;
- SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
//缂栬緫鏉冮檺
- //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Edit", 1, false, msg2))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
//鑾峰彇鏈�澶D鍊艰祴鍊�
//DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate");
@@ -186,6 +222,16 @@
}
else
{
+ //鏄惁宸茬粡瀹℃牳鍒ゆ柇
+ DataSet Maxds = oCN.RunProcReturn("select * from h_v_Gy_MatePriceSupEdit where HItemID = " + oBill.oModel.HItemID, "h_v_Gy_MatePriceSupEdit");
+ if (Maxds != null && Maxds.Tables[0].Rows[0]["瀹℃牳浜�"].ToString()!="")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍告棤娉曠紪杈戯紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
bResult = oBill.ModifyByID(oBill.oModel.HItemID);
}
if (bResult)
@@ -227,14 +273,14 @@
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
//鍒犻櫎鏉冮檺
- //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鏃犲垹闄ゆ潈闄�";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
+ if (!DBUtility.ClsPub.Security_Log("Gy_MatePriceSupList_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
if (string.IsNullOrWhiteSpace(HItemID))
{
objJsonResult.code = "0";
@@ -254,15 +300,15 @@
return objJsonResult; ;
}
//var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
- //if (HStopflag)
- //{
- // oCN.RollBack();//鍥炴粴浜嬪姟
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鏁版嵁宸茬鐢ㄦ棤娉曞垹闄わ紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
+ if (ds.Tables[0].Rows[0]["HChecker"].ToString()!="")
+ {
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏁版嵁宸插鏍告棤娉曞垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
oCN.RunProc("delete from Gy_MatePriceSup where HItemID=" + HItemID);
oCN.Commit();//鎻愪氦浜嬪姟
@@ -292,24 +338,36 @@
try
{
var _value = msg["model"].ToString();
- SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ LogService.Write("閲囪喘浠锋牸" + _value);
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
ListModels oListModels = new ListModels();
List<Model.ClsGy_MatePriceSup_Model> lsmain = new List<Model.ClsGy_MatePriceSup_Model>();
lsmain = oListModels.getObjectByJson_Gy_MatePriceSup(_value);
string sql = string.Empty;
//淇濆瓨
oCN.BeginTran();
- sql = $"delete Gy_MatePriceSup where HItemID = {lsmain[0].HItemID}";
- oCN.RunProc(sql);
- sql = "set identity_insert Gy_MatePriceSup on";
- oCN.RunProc(sql);
- oCN.RunProc($@"insert into Gy_MatePriceSup(HItemID,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType
+ foreach (var item in lsmain)
+ {
+ sql = $"delete Gy_MatePriceSup where HItemID = {item.HItemID}";
+ oCN.RunProc(sql);
+ sql = "set identity_insert Gy_MatePriceSup on";
+ oCN.RunProc(sql);
+
+
+ LogService.Write("閲囪喘浠锋牸" + $@" insert into Gy_MatePriceSup(HItemID,HNumber,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType
,HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)
- values({lsmain[0].HItemID},{lsmain[0].HInterID},{lsmain[0].HEntryID},{lsmain[0].HMaterID},{lsmain[0].HRelationID},{lsmain[0].HUnitID},{lsmain[0].HBeginQty},{lsmain[0].HEndQty},{lsmain[0].HCurID},'{lsmain[0].HType}',{lsmain[0].HPrice},'{lsmain[0].HBeginDate}','{lsmain[0].HEndDate}','{lsmain[0].HUsed}','{lsmain[0].HRemark}','{lsmain[0].HMaker}','{lsmain[0].HMakeDate}')", ref DBUtility.ClsPub.sExeReturnInfo);
- //淇敼涓婄骇涓洪潪鏈骇浠g爜
- sql = "set identity_insert Gy_MatePriceSup off";
- oCN.RunProc(sql);
+ values({item.HItemID},'{item.HNumber}',{item.HInterID},{item.HEntryID},{item.HMaterID},{item.HRelationID},{item.HUnitID},{item.HBeginQty},{item.HEndQty},{item.HCurID},'{item.HType}',{item.HPrice},'{item.HBeginDate}','{item.HEndDate}','{item.HUsed}','{item.HRemark}','{item.HMaker}','{item.HMakeDate}')");
+
+
+ oCN.RunProc($@"insert into Gy_MatePriceSup(HItemID,HNumber,HInterID,HEntryID,HMaterID,HRelationID,HUnitID,HBeginQty,HEndQty,HCurID,HType
+ ,HPrice,HBeginDate,HEndDate,HUsed,HRemark,HMaker,HMakeDate)
+ values({item.HItemID},'{item.HNumber}',{item.HInterID},{item.HEntryID},{item.HMaterID},{item.HRelationID},{item.HUnitID},{item.HBeginQty},{item.HEndQty},{item.HCurID},'{item.HType}',{item.HPrice},'{item.HBeginDate}','{item.HEndDate}','{item.HUsed}','{item.HRemark}','{item.HMaker}','{item.HMakeDate}')", ref DBUtility.ClsPub.sExeReturnInfo);
+ //淇敼涓婄骇涓洪潪鏈骇浠g爜
+ sql = "set identity_insert Gy_MatePriceSup off";
+ oCN.RunProc(sql);
+
+ }
oCN.Commit();
objJsonResult.code = "1";
@@ -328,5 +386,227 @@
}
}
#endregion
+
+ #region 瀹℃牳銆佸弽瀹℃牳
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Gy_MatePriceSup/CheckGy_MatePriceSup")]
+ [HttpGet]
+ public object CheckGy_MatePriceSup(long HInterID, int IsAudit, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePriceSupList_Check", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ var ds = oCN.RunProcReturn("select * from Gy_MatePriceSup where HItemID=" + HInterID, "Gy_MatePriceSup");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HChecker"].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 Gy_MatePriceSup set HChecker='" + CurUserName + "',HCheckDate=getdate() where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ oCN.RunProc("update Gy_MatePriceSup set HChecker='',HCheckDate=null where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鎵归噺瀹℃牳
+ /// <summary>
+ /// 鎵归噺瀹℃牳
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="Type">瀹℃牳(0),鍙嶅鏍�(1)</param>
+ /// <param name="HMaker">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Gy_MatePriceSup/CheckAll")]
+ [HttpGet]
+ public object CheckAll(string ids, int Type, string HMaker)
+ {
+ try
+ {
+ //澶勭悊瀛楃涓�
+ if (!string.IsNullOrEmpty(ids))
+ {
+ long[] idArray = Array.ConvertAll(ids.Split(','), long.Parse);
+ // 澶勭悊idArray...
+ for (int i = 0; i < idArray.Length; i++)
+ {
+ objJsonResult = (json)CheckGy_MatePriceSup(idArray[i], Type, HMaker);//瀹℃牳鎵ц
+ if (objJsonResult.count == 0)
+ {
+
+ objJsonResult.Message += "绗�" + (i + 1) + "琛屽嚭鐜伴棶棰樻棤娉曠户缁畬鎴�";
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "璇烽�夋嫨姝g‘琛�";
+ objJsonResult.data = null;
+ 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 = "瀹℃牳鎴栧弽瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+
+ #region 閲囪喘浠风洰 閲戣澏鍚屾
+ [Route("Gy_MatePriceSup/SaveGy_PurPriceApi")]
+ [HttpPost]
+ public object SaveGy_PurPriceApi([FromBody] JObject msg)
+ {
+ try
+ {
+ var _value = msg["model"].ToString();
+ LogService.Write("閲囪喘浠风洰" + _value);
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ ListModels oListModels = new ListModels();
+ List<Model.ClsGy_PurPrice_Model> lsmain = new List<Model.ClsGy_PurPrice_Model>();
+ lsmain = oListModels.getObjectByJson_Gy_PurPrice(_value);
+ string sql = string.Empty;
+ //淇濆瓨
+ oCN.BeginTran();
+
+ foreach (var item in lsmain)
+ {
+ sql = $"delete Gy_PurPriceList where HItemID = {item.HItemID}";
+ oCN.RunProc(sql);
+ sql = "set identity_insert Gy_PurPriceList on";
+ oCN.RunProc(sql);
+
+ LogService.Write("閲囪喘浠风洰" + $@" insert into Gy_PurPriceList(HItemID, HNumber, HName, HShortNumber, HParentID, HLevel,
+ HEndFlag, HStopflag, HRemark, HUseFlag, HCREATEORGID, HUSEORGID,
+ HMakeEmp, HMakeTime, HCheckEmp, HCheckTime,HModifyEmp, HModifyTime, HStopEmp, HStopTime,
+ HPURCHASEORGID, HSupID, HCurID, HPRICER, HPRICETYPE, HPRICEOBJECT,HISINCLUDEDTAX, HDEFPRICELISTID, HSUPPLIERMASTERID)
+ values({item.HItemID},'{item.HNumber}','{item.HName}','{item.HShortNumber}',{item.HParentID},{item.HLevel},
+ '{item.HEndFlag}','{item.HStopflag}','{item.HRemark}','{item.HUseFlag}',{item.HCREATEORGID},{item.HUSEORGID},
+ {item.HMakeEmp},'{item.HMakeTime}',{item.HCheckEmp},'{item.HCheckTime}',{item.HModifyEmp},'{item.HModifyTime}',{item.HStopEmp},'{item.HStopTime}',
+ {item.HPURCHASEORGID},{item.HSupID},{item.HCurID},{item.HPRICER},{item.HPRICETYPE},'{item.HPRICEOBJECT}','{item.HISINCLUDEDTAX}','{item.HDEFPRICELISTID}','{item.HSUPPLIERMASTERID}')");
+
+ oCN.RunProc($@"insert into Gy_PurPriceList(HItemID, HNumber, HName, HShortNumber, HParentID, HLevel,
+ HEndFlag, HStopflag, HRemark, HUseFlag, HCREATEORGID, HUSEORGID,
+ HMakeEmp, HMakeTime, HCheckEmp, HCheckTime,HModifyEmp, HModifyTime, HStopEmp, HStopTime,
+ HPURCHASEORGID, HSupID, HCurID, HPRICER, HPRICETYPE, HPRICEOBJECT,HISINCLUDEDTAX, HDEFPRICELISTID, HSUPPLIERMASTERID)
+ values({item.HItemID},'{item.HNumber}','{item.HName}','{item.HShortNumber}',{item.HParentID},{item.HLevel},
+ '{item.HEndFlag}','{item.HStopflag}','{item.HRemark}','{item.HUseFlag}',{item.HCREATEORGID},{item.HUSEORGID},
+ {item.HMakeEmp},'{item.HMakeTime}',{item.HCheckEmp},'{item.HCheckTime}',{item.HModifyEmp},'{item.HModifyTime}',{item.HStopEmp},'{item.HStopTime}',
+ {item.HPURCHASEORGID},{item.HSupID},{item.HCurID},{item.HPRICER},{item.HPRICETYPE},'{item.HPRICEOBJECT}','{item.HISINCLUDEDTAX}','{item.HDEFPRICELISTID}','{item.HSUPPLIERMASTERID}')", ref DBUtility.ClsPub.sExeReturnInfo);
+ //淇敼涓婄骇涓洪潪鏈骇浠g爜
+ sql = "set identity_insert Gy_PurPriceList off";
+ oCN.RunProc(sql);
+
+ }
+
+
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
}
}
\ No newline at end of file
--
Gitblit v1.9.1