From 579d2b489f9565f6e506ddbef634d65aa20dc27e Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期四, 12 六月 2025 14:03:28 +0800
Subject: [PATCH] 解决合并冲突
---
WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs | 851 ++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 644 insertions(+), 207 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs b/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs
index 77dd97b..92c8687 100644
--- a/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs
@@ -1,4 +1,5 @@
锘縰sing DBUtility;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -8,7 +9,10 @@
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
-
+using System.Web;
+using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
+using System.IO;
+using SyntacticSugar.constant;
namespace WebAPI.Controllers.BaseSet
{
public class Gy_ModelTypeController : ApiController
@@ -21,6 +25,85 @@
DAL.ClsGy_MouldType_Ctl oDept = new DAL.ClsGy_MouldType_Ctl();
DAL.ClsGy_MouldType_View oDeptHlp = new DAL.ClsGy_MouldType_View();
+ #region 鏍规嵁鐖秈d鍜岀瓑绾ц幏寰楁爲鐘跺浘閫掑綊
+ public class TreeModel
+ {
+ public string id { get; set; }
+ public string title { get; set; }
+ public List<TreeModel> children = new List<TreeModel>();
+ }
+
+
+ [Route("Gy_ModelType/Gy_ModelTypeTreeListByLevel")]
+ [HttpGet]
+ public object Gy_ModelTypeTreeListByLevel(string HOrgID)
+ {
+ try
+ {
+ string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel,hhelpcode from Gy_MouldType where HUSEORGID = '" + HOrgID + "' order by hhelpcode");
+
+ ds = oCN.RunProcReturn(sql1, "Gy_ModelType");
+
+ List<TreeModel> treeModels = new List<TreeModel>();
+ TreeModel first = new TreeModel();
+ first.id = "0";
+ first.title = "鍣ㄥ叿鍒嗙被璁剧疆";
+ treeModels.Add(first);
+
+ foreach (DataRow row in ds.Tables[0].Rows)
+ {
+ var HLevel = (int)row["hlevel"];
+ if (HLevel == 1)
+ {
+ TreeModel tree = new TreeModel();
+ tree.id = row["hitemid"].ToString();
+ tree.title = row["hname"].ToString();
+ treeModels[0].children.Add(tree);
+ }
+ }
+ getTreeByLevel(ds.Tables[0], treeModels[0].children, 2);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels);
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ public void getTreeByLevel(DataTable dt, List<TreeModel> tree, int num)
+ {
+ for (int m = 0; m < tree.Count; m++)
+ {
+ tree[m].children = new List<TreeModel>();
+ for (int i = 0; i < dt.Rows.Count; i++)//绗竴娆″惊鐜紝寰楀埌鎵�鏈夋牴鑺傜偣鐨勫瓙闆�
+ {
+ var HLevel = (int)dt.Rows[i]["hlevel"];
+ var HParentID = dt.Rows[i]["hparentid"].ToString();
+ if (HLevel == num && HParentID == tree[m].id)
+ {
+ TreeModel tbjson = new TreeModel();
+ tbjson.id = dt.Rows[i]["hitemid"].ToString();
+ tbjson.title = dt.Rows[i]["hname"].ToString();
+ tree[m].children.Add(tbjson);
+ }
+ }
+ for (int i = 0; i < tree[m].children.Count; i++)
+ {
+ getTreeByLevel(dt, tree[m].children, num + 1);//鍐嶆鐢ㄥ瓙闆嗗幓寰幆锛屾嬁鍑哄瓙闆嗙殑瀛愰泦
+ }
+ }
+
+ }
+ #endregion
#region 妯℃不鍏峰垎绫诲垪琛ㄦ暟鎹�
/// <summary>
@@ -34,31 +117,46 @@
{
try
{
- if (!DBUtility.ClsPub.Security_Log(ModRightNameSelect, 1, true, user))
+ List<object> a = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameSelect, 1, false, user))
{
+
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "娌℃湁鏌ョ湅鏉冮檺";
objJsonResult.data = null;
return objJsonResult;
}
- ds = oCN.RunProcReturn("select HItemID,HParentID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag from Gy_MouldType where 1=1 " + sWhere, "Gy_MouldType");
- if (ds == null || ds.Tables[0].Rows.Count == 0)
+ //ds = oCN.RunProcReturn("select HItemID,HParentID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag from Gy_MouldType where 1=1 " + sWhere+ " order by HNumber", "Gy_MouldType");
+
+ string sql = "select * from h_v_Gy_MouldType where 1=1 " + sWhere + " order by 鍣ㄥ叿鍒嗙被浠g爜,鍣ㄥ叿鍒嗙被鍚嶇О,鎵�灞炵埗绾у垎绫诲悕绉�,鍒涘缓浜�,瀹℃牳浜�,澶囨敞,缁勭粐,绂佺敤鏍囪";
+
+ ds = oCN.RunProcReturn(sql, "h_v_Gy_MouldType");
+
+ foreach (DataColumn col in ds.Tables[0].Columns)
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鏃犳ā娌诲叿鍒嗙被鏁版嵁锛�";
- objJsonResult.data = null;
- return objJsonResult;
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ a.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鏌ユ壘鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+
+ //if (ds.Tables[0].Rows.Count != 0 || ds != null)
+ //{
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ objJsonResult.list = a;
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
}
catch (Exception e)
{
@@ -128,7 +226,7 @@
try
{
- if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, User))
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, false, User))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -136,6 +234,25 @@
objJsonResult.data = null;
return objJsonResult;
}
+
+ DataSet ds_check_1 = oCN.RunProcReturn("select * from Gy_MouldType where HItemID =" + HItemID, "Gy_MouldType");
+ if (ds_check_1.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛氭暟鎹笉瀛樺湪";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else if (ds_check_1.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触锛氬綋鍓嶆暟鎹凡瀹℃牳锛屼笉鍙垹闄�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
if (oDeptHlp.GetInfoByID(HItemID))
{
if (oDept.HavChildCodes(HItemID))
@@ -229,13 +346,24 @@
bool HStopflag = list[0].HStopflag;
string HUseFlag = list[0].HUseFlag;
bool HEndFlag = list[0].HEndFlag;
+ long HUSEORGID = list[0].HUSEORGID;
- //鍒ゆ柇鏉冮檺
- if (!ClsPub.Security_Log(msg4, 1, true, msg3))
+ DataSet ds_check = oCN.RunProcReturn("select * from Gy_MouldType where HNumber = '" + HNumber + "' and HUSEORGID = " + HUSEORGID, "Gy_MouldType");
+ if (ds_check.Tables[0].Rows.Count > 0)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+ objJsonResult.Message = "鏂板澶辫触锛氬綋鍓嶇粍缁囦笅浠g爜銆�" + HNumber + "銆戝凡瀛樺湪锛岃淇敼浠g爜鍚庨噸鏂颁繚瀛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(msg4, 1, false, msg3))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺锛�";
objJsonResult.data = null;
return objJsonResult;
}
@@ -256,9 +384,9 @@
//涓昏〃
oCN.RunProc("Insert into Gy_MouldType " +
" (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
- ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime,HUSEORGID) " +
" Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID +
- "," + HLevel+ "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
+ "," + HLevel+ "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + msg3 + "',getdate()," + HUSEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
//淇敼涓婄骇涓洪潪鏈骇浠g爜
oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
oCN.Commit();
@@ -314,13 +442,42 @@
string HRemark = list[0].HRemark;
bool HStopflag = list[0].HStopflag;
string HUseFlag = list[0].HUseFlag;
+ long HUSEORGID = list[0].HUSEORGID;
- //鍒ゆ柇鏉冮檺
- if (!ClsPub.Security_Log(msg5, 1, true, msg4))
+ DataSet ds_check = oCN.RunProcReturn("select * from Gy_MouldType where HNumber = '" + HNumber + "' and HUSEORGID = " + HUSEORGID + " and HItemID <>" + HItemID,"Gy_MouldType");
+ if (ds_check.Tables[0].Rows.Count > 0)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+ objJsonResult.Message = "淇敼澶辫触锛氬綋鍓嶇粍缁囦笅浠g爜銆�" + HNumber + "銆戝凡瀛樺湪锛岃淇敼浠g爜鍚庨噸鏂颁繚瀛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DataSet ds_check_1 = oCN.RunProcReturn("select * from Gy_MouldType where HItemID =" + HItemID, "Gy_MouldType");
+ if (ds_check_1.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇敼澶辫触锛氭暟鎹笉瀛樺湪";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else if(ds_check_1.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇敼澶辫触锛氬綋鍓嶆暟鎹凡瀹℃牳锛屼笉鍙慨鏀�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍒ゆ柇鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log(msg5, 1, false, msg4))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁淇濆瓨鏉冮檺";
objJsonResult.data = null;
return objJsonResult;
}
@@ -355,7 +512,11 @@
",HHelpCode='" + HHelpCode + "'" +
",HParentID=" + HParentID +
",HStopflag='" + HStopflag + "'" +
- ",HRemark= '" + HRemark + "' Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
+ ",HRemark= '" + HRemark + "' " +
+ ",HModifyEmp='" + msg4 + "' " +
+ ",HModifyTime=getdate() " +
+ ",HUSEORGID=" + HUSEORGID + " " +
+ " Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
//淇敼瀛愰」鐩唬鐮�
//oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
//灏嗕笂绾� 涓洪潪鏈骇
@@ -392,7 +553,8 @@
{
try
{
- ds = oCN.RunProcReturn("select * from Gy_MouldType where HItemID=" + HInterID, "Gy_MouldType");
+ string sql = "select a.*,b.HName HParentName from Gy_MouldType as a left join Gy_MouldType as b on a.HParentID = b.HItemID where a.HItemID=" + HInterID;
+ ds = oCN.RunProcReturn(sql, "Gy_MouldType");
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -439,188 +601,463 @@
}
#endregion
- //#region [妯″叿鍒嗙被瀹℃牳銆佸弽瀹℃牳]
- //[Route("Gy_ModelType/ModelTypeCheck")]
- //[HttpGet]
- //public object ModelTypeCheck(int HInterID, int IsAudit, string CurUserName)
- //{
- // string ModRightNameCheck = "Gy_MouldType_Check";
- // DBUtility.ClsPub.CurUserName = CurUserName;
- // try
- // {
- // //瀹℃牳鏉冮檺
- // if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // 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);
- // ds = oCN.RunProcReturn("Select * from Gy_MouldType Where HItemID=" + lngBillKey.ToString(), "Gy_MouldType");
- // if (ds.Tables[0].Rows.Count != 0)
- // {
- // string HCloseMan = ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim();
- // string HDeleteMan = ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim();
- // string HChecker = ds.Tables[0].Rows[0]["HChecker"].ToString().Trim();
- // if (HCloseMan.Trim() != "")
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鍗曟嵁宸插叧闂�!涓嶈兘鍐嶆瀹℃牳锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // if (HDeleteMan.Trim() != "")
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶆瀹℃牳锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // if (IsAudit == 0) //瀹℃牳鍒ゆ柇
- // {
- // if (HChecker.Trim() != "")
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // }
- // if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
- // {
- // if (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;
- // }
+ #region 鍣ㄥ叿鍒嗙被瀹℃牳/鍙嶅鏍�
+ [Route("Gy_MouldType/AuditGy_MouldType")]
+ [HttpGet]
+ public object AuditGy_MouldType(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊鏍告潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Gy_MouldType_Check", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
- // if (IsAudit == 0) //瀹℃牳鎻愪氦
- // {
- // //瀹℃牳鎻愪氦
- // if (CheckBill(lngBillKey, 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) //鍙嶅鏍告彁浜�
- // {
- // //鍙嶅鏍告彁浜bandonCheck
- // if (AbandonCheck(lngBillKey, 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;
- // }
- //}
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DAL.ClsGy_MouldType_Ctl oBill = new DAL.ClsGy_MouldType_Ctl();
+ ClsPub.CurUserName = user;
+ oCN.BeginTran();//寮�濮嬩簨鍔�
- ////瀹℃牳
- //public bool CheckBill(Int64 lngBillKey, ref string sReturn)
- //{
- // //妯″叿妗f鏈夋渚�
- // try
- // {
- // string HChecker = DBUtility.ClsPub.CurUserName;
- // string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
- // oCN.BeginTran();
- // oCN.RunProc(" Update " + MvarItemKey + " set HBillStatus='2',HChecker='" + HChecker + "',HCheckDate='" + HCheckDate + "' Where HInterID=" + lngBillKey.ToString());
- // oCN.Commit();
- // //鐢熸垚璋冩嫧鍗�
- // //寰楀埌璋冩嫧鍗� mainid 鍗曟嵁鍙�
- // //long NewInterID = DBUtility.ClsPub.CreateBillID("1207", ref DBUtility.ClsPub.sExeReturnInfo);
- // //string NewBillNo = DBUtility.ClsPub.CreateBillCode("1207", ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙�
- // //oCn.RunProc("exec h_p_Kf_MoveStockBill_Add " + lngBillKey.ToString() + "," + NewInterID.ToString() + ",'" + NewBillNo + "','" + HChecker + "'");
- // //
- // sReturn = "瀹℃牳鍗曟嵁鎴愬姛锛�";
- // return true;
- // }
- // catch (Exception e)
- // {
- // sReturn = e.Message;
- // throw (e);
- // }
- //}
+ //Type 1 瀹℃牳 2 鍙嶅鏍�
+ if (Type == 1)
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡瀹℃牳
+ DataSet ds;
+ string sql = "select * from Gy_MouldType where HItemID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
+ if (ds.Tables[0].Rows[0]["HCheckEmp"] != null && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //瀹℃牳鍗曟嵁
+ if (!oBill.AuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
- ////鍙嶅鏍�
- //public bool AbandonCheck(Int64 lngBillKey, ref string sReturn)
- //{
+ else
+ {
+ //鍒ゆ柇鍗曟嵁鏄惁宸茬粡鍙嶅鏍�
+ DataSet ds;
+ string sql = "select * from Gy_MouldType where HItemID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, oBill.MvarItemKey);
+ if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
+ {
+ if (ds.Tables[0].Rows[0]["HCheckEmp"] == null || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鍙嶅鏍稿崟鎹�
+ if (!oBill.DeAuditByID2(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
- // try
- // {
- // string HChecker = DBUtility.ClsPub.CurUserName;
- // string HCheckDate = DBUtility.ClsPub.GetServerDate(-1);
- // oCN.BeginTran();
- // //杩樺師鍗曟嵁鐘舵�佷负鏈鏍哥姸鎬�
- // oCN.RunProc(" Update " + MvarItemKey + " set HBillStatus='1',HChecker='',HCheckDate='' Where HInterID=" + lngBillKey.ToString());
- // sReturn = "鍙嶅鏍稿崟鎹垚鍔燂紒";
- // oCN.Commit();
- // return true;
- // }
- // catch (Exception e)
- // {
- // sReturn = e.Message;
- // throw (e);
- // }
- //}
- //#endregion
+ 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="IsStop">绂佺敤(0),鍙嶇鐢�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Gy_MouldType/StopGy_MouldType")]
+ [HttpGet]
+ public object StopGy_MouldType(int HInterID, int IsStop, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_MouldType_Stop", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ var ds = oCN.RunProcReturn("select * from Gy_MouldType where HItemID=" + HInterID, "Gy_MouldType");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsStop == 0) //绂佺敤鍒ゆ柇
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "宸茬鐢�!涓嶈兘鍐嶆绂佺敤锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HStopEmp"].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 (IsStop == 0) //绂佺敤鍒ゆ柇
+ {
+ oCN.RunProc("update Gy_MouldType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "绂佺敤鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ oCN.RunProc("update Gy_MouldType set HStopEmp='',HStopTime=null,HStopflag=0 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 鍣ㄥ叿鍒嗙被 鏂囦欢瀵煎叆淇濆瓨
+ #region 鍣ㄥ叿鍒嗙被 鏂囦欢涓婁紶
+ [Route("Gy_MouldType/Gy_MouldType_Excel")]
+ [HttpPost]
+ public object Gy_MouldType_Excel()
+ {
+ try
+ {
+ //鑾峰彇鏂囦欢鍚嶇О
+ var file = HttpContext.Current.Request.Files[0];
+ //鑾峰彇鏂囦欢鐗╃悊璺緞
+ string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
+ //淇濆瓨鏂囦欢
+ file.SaveAs(ExcelPath);
+
+ NpoiHelper np = new NpoiHelper();
+ DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
+
+ //鍒犻櫎鏂囦欢
+ File.Delete(ExcelPath);
+
+ //鍒涘缓涓存椂琛�
+ DataTable tb2 = new DataTable("dt2");
+
+ //娣诲姞鍒楀悕
+ for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
+ {
+ tb2.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
+ }
+
+ //妯℃澘缂哄皯鍒� 浣嗛渶瑕佷粠鏁版嵁搴撲腑鏌ヨ鍑烘潵鏄剧ず鍦ㄩ〉闈㈢殑瀛楁
+ tb2.Columns.Add("HOrgID", typeof(Int32));//缁勭粐ID
+
+ //娣诲姞鏁版嵁
+ for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
+ {
+ DataRow row = tb2.NewRow();
+ for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
+ {
+ row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
+ }
+ tb2.Rows.Add(row);
+ }
+
+
+ var error = "";
+
+ //鏌ヨ娌℃湁鐨勫垪
+ if (!tb2.Columns.Contains("缁勭粐浠g爜"))
+ error += "娌℃湁鎵惧埌銆愮粍缁囦唬鐮併�戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("缁勭粐鍚嶇О"))
+ error += "娌℃湁鎵惧埌銆愮粍缁囧悕绉般�戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鍣ㄥ叿鍒嗙被"))
+ error += "娌℃湁鎵惧埌銆愬櫒鍏峰垎绫诲悕绉般�戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鍣ㄥ叿鍒嗙被浠g爜"))
+ error += "娌℃湁鎵惧埌銆愬櫒鍏峰垎绫讳唬鐮併�戠殑鏍囬,";
+ if (!tb2.Columns.Contains("澶囨敞"))
+ error += "娌℃湁鎵惧埌銆愬娉ㄣ�戠殑鏍囬,";
+ if (!tb2.Columns.Contains("鍔╄鐮�"))
+ error += "娌℃湁鎵惧埌銆愬姪璁扮爜銆戠殑鏍囬,";
+
+ if (error.Length > 0)
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ for (int i = 0; i <= tb2.Rows.Count - 1; i++)
+ {
+ string HProcessName = "";
+ string HProcessNum = "";
+ string HORGNumber = "";
+ string HORGName = "";
+
+
+ HProcessName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍣ㄥ叿鍒嗙被"].ToString());
+ HProcessNum = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍣ㄥ叿鍒嗙被浠g爜"].ToString());
+ HORGNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐浠g爜"].ToString());
+ HORGName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐鍚嶇О"].ToString());
+
+ //妫�鏌ョ墿鏂�
+ int index = i + 1;
+
+ if (HORGNumber != "")
+ {
+
+ //鏌ヨ缁勭粐
+ ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + HORGNumber + "' and Hname='" + HORGName + "'", "Xt_ORGANIZATIONS");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "绗�" + index + "琛�,缁勭粐涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HOrgID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+ string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString();
+
+ //鍣ㄥ叿鍒嗙被鍚嶇О
+ if (HProcessName == "")
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "绗�" + index + "琛�,鍣ㄥ叿鍒嗙被鍚嶇О涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍣ㄥ叿鍒嗙被浠g爜
+ if (HProcessNum == "")
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "绗�" + index + "琛�,鍣ㄥ叿鍒嗙被浠g爜涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "绗�" + index + "琛�,缁勭粐浠g爜涓虹┖";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ objJsonResult.code = CodeConstant.SUCCEED;
+ objJsonResult.count = CountConstant.SUCCEED;
+ objJsonResult.Message = error;
+ objJsonResult.data = tb2;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 鍣ㄥ叿鍒嗙被椤圭洰 瀵煎叆(淇濆瓨)
+ [Route("Gy_MouldType/Gy_MouldType_btnSave")]
+ [HttpPost]
+ public object Gy_MouldType_btnSave([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 user = sArray[1].ToString();
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Gy_ErrType_Edit", 1, false, user))
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
+ List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
+
+ foreach (JObject item in Excel)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ foreach (var itm in item.Properties())
+ {
+ dic.Add(itm.Name, itm.Value.ToString());
+ }
+ list.Add(dic);
+ }
+
+ oCN.BeginTran();
+ int i = 1;
+ foreach (Dictionary<string, string> item in list)
+ {
+ string HOrgID = item["HOrgID"].ToString();//缁勭粐ID
+ string HName = item["鍣ㄥ叿鍒嗙被"].ToString();
+ string HNumber = item["鍣ㄥ叿鍒嗙被浠g爜"].ToString();
+ string HRemark = item["澶囨敞"].ToString();
+ string HHelpCode = item["鍔╄鐮�"].ToString();
+ string sShortNumber;
+ sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+ if (sShortNumber.Trim() == "")
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ int HEndFlag = 1;//鏈骇鏍囧織
+ int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //绛夌骇
+
+
+ if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from Gy_MouldType where HNumber='" + HNumber + "'", "Gy_MouldType");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RunProc("Insert into Gy_MouldType " +
+ " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " +
+ " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 +
+ "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "',getdate())");
+ }
+ else
+ {
+ oCN.RunProc("update Gy_MouldType set HUSEORGID=" + HOrgID + ",HHelpCode = '"+ HHelpCode + "',HRemark='" + HRemark + "' where HNumber='" + HNumber + "'");
+ }
+
+ i++;
+ }
+
+ oCN.Commit();
+
+ objJsonResult.code = CodeConstant.SUCCEED;
+ objJsonResult.count = CountConstant.SUCCEED;
+ objJsonResult.Message = "瀵煎叆鎴愬姛!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ LogService.Write(e);
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+ #endregion
}
}
--
Gitblit v1.9.1