From 30ea66a7a0cf43413f483a873ba2675c52b7d6fa Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 05 十二月 2024 13:34:45 +0800
Subject: [PATCH] 入库申请单同步
---
WebAPI/Controllers/WebAPIController.cs | 1827 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1,800 insertions(+), 27 deletions(-)
diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs
index b6336fa..9828e5d 100644
--- a/WebAPI/Controllers/WebAPIController.cs
+++ b/WebAPI/Controllers/WebAPIController.cs
@@ -8,11 +8,14 @@
using System;
using System.Collections.Generic;
using System.Data;
+using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
+using System.Web;
using System.Web.Http;
using WebAPI;
+using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
using WebAPI.Models;
using WebAPI.Service;
using System.Web;
@@ -117,6 +120,68 @@
Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref sErrMsg);
HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref sErrMsg, true);
+
+ DataSet ds;
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ ds = oCN.RunProcReturn("exec h_p_IF_CheckBillIDExists_WMS " + HInterID + ",'" + HBillNo + "'", "h_p_IF_CheckBillIDExists_WMS");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ sErrMsg = "瀛樺湪閲嶅鍗曟嵁鍐呯爜鎴栧崟鎹彿鐨勫崟鎹紝涓嶅厑璁告柊澧烇紝璇烽��鍑哄悗閲嶆柊鐧诲綍锛�";
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = sErrMsg;
+ objjson.data = null;
+ return objjson;
+ }
+ else if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0][0]) == "1")
+ {
+ sErrMsg = "瀛樺湪閲嶅鍗曟嵁鍐呯爜鎴栧崟鎹彿鐨勫崟鎹紝涓嶅厑璁告柊澧烇紝璇烽��鍑哄悗閲嶆柊鐧诲綍锛�";
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = sErrMsg;
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ //----------鍒涘缓铏氳〃------------------------
+ DataTable dt_Main = new DataTable("Json");
+ dt_Main.Columns.Add("HBillNo", typeof(string));
+ dt_Main.Columns.Add("HInterID", typeof(Int64));
+ //---------鍒涘缓鏂拌------------------------
+ DataRow dr_main = dt_Main.NewRow();//鍒涘缓鏂拌
+ dt_Main.Rows.Add(dr_main);//灏嗘柊琛屽姞鍏ュ埌琛ㄤ腑
+ dr_main["HBillNo"] = DBUtility.ClsPub.isStrNull(HBillNo);
+ dr_main["HInterID"] = DBUtility.ClsPub.isLong(HInterID);
+ //杩斿洖鏁版嵁
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛";
+ objjson.data = dt_Main;
+ return objjson;
+ }
+ }
+ catch (Exception e)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+
+ [Route("Web/GetMAXNum_ProcExchange")]
+ [HttpGet]
+ public object GetMAXNum_ProcExchange(string HBillType)
+ {
+ try
+ {
+ string HBillNo = "";
+ string sErrMsg = "";
+ Int64 HInterID = 0;//鏄剧ず鐨勫瓧娈�
+ HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref sErrMsg);
+ //HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref sErrMsg, true);
DataSet ds;
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
@@ -370,47 +435,57 @@
/// <returns></returns>
[Route("Web/GetXGPassword")]
[HttpGet]
- public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword)
+ public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword,string HCloudUserName,string HCloudUserPsd)
{
try
{
ClsCN oCn = new ClsCN();
DataSet oDs = new DataSet();
//==========
- oDs = oCn.RunProcReturn("select Czmm from Gy_Czygl where Czybm='" + UserName + "'", "Gy_Czygl");
- if (PassWord.Trim() != Repassword.Trim())
+
+ if(PassWord!=null)
{
- objjson.code = "0";
- objjson.count = 0;
- objjson.Message = "2娆″瘑鐮佷笉涓�鑷达紒";
- objjson.data = oDs.Tables[0];
- return objjson; ;
- }
- //===========
- if (oDs == null || oDs.Tables[0].Rows.Count == 0)
- {
- objjson.code = "0";
- objjson.count = 0;
- objjson.Message = "娌℃湁杩欎釜鐢ㄦ埛锛屼笉鑳戒慨鏀瑰瘑鐮侊紒";
- objjson.data = null;
- return objjson; ;
- }
- else
- {
- oCn.RunProc("update Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "' where Czybm='" + UserName.Trim() + "'");
+ oDs = oCn.RunProcReturn("select Czmm from Gy_Czygl where Czybm='" + UserName + "'", "Gy_Czygl");
+ if (PassWord.Trim() != Repassword.Trim())
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "2娆″瘑鐮佷笉涓�鑷达紒";
+ objjson.data = oDs.Tables[0];
+ return objjson; ;
+ }
+ //===========
+ if (oDs == null || oDs.Tables[0].Rows.Count == 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "娌℃湁杩欎釜鐢ㄦ埛锛屼笉鑳戒慨鏀瑰瘑鐮侊紒";
+ objjson.data = null;
+ return objjson; ;
+ }
+ oCn.RunProc("update Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "',HCloudUserName = '" + HCloudUserName+ "',HCloudUserPsd = '" + HCloudUserPsd+ "' where Czybm='" + UserName.Trim() + "'");
objjson.code = "0";
objjson.count = 1;
objjson.Message = "* 瀵嗙爜淇敼鎴愬姛锛�";
objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ oCn.RunProc("update Gy_Czygl set HCloudUserName = '" + HCloudUserName + "',HCloudUserPsd = '" + HCloudUserPsd + "' where Czybm='" + UserName.Trim() + "'");
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "* 閲戣澏浜戣处鍙蜂慨鏀规垚鍔燂紒";
+ objjson.data = null;
return objjson; ;
}
}
- catch (Exception)
+ catch (Exception e)
{
objjson.code = "0";
objjson.count = 0;
- objjson.Message = "淇敼瀵嗙爜寮傚父锛�";
+ objjson.Message = "淇敼瀵嗙爜寮傚父锛�" + e.ToString();
objjson.data = null;
return objjson; ;
}
@@ -1433,6 +1508,52 @@
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
ds = oCN.RunProcReturn("Select HItemID,鐝粍浠g爜 鐝粍浠g爜,鐝粍鍚嶇О 鐝粍 from h_v_GroupList where 1=1 " + sWhere + " Order by HItemID ", "h_v_GroupList");
+ if (ds == null || ds.Tables[0].Rows.Count <= 0)
+ {
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触";
+ objjson.data = null;
+ return objjson;
+ }
+ else
+ {
+ objjson.code = "0";
+ objjson.count = 1;
+ objjson.Message = "鑾峰彇鎴愬姛!";
+ objjson.data = ds.Tables[0];
+ return objjson;
+ }
+ }
+ catch (Exception e)
+ {
+
+ objjson.code = "0";
+ objjson.count = 0;
+ objjson.Message = "鑾峰彇澶辫触" + e.ToString();
+ objjson.data = null;
+ return objjson;
+ }
+ }
+
+ /// <summary>
+ /// 鑾峰彇鐝粍鍒楄〃 鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鍏崇郴锛岃幏鍙栫敤鎴峰搴旂殑鐝粍
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Web/GetGroupListByUser_Json")]
+ [HttpGet]
+ public object GetGroupListByUser_Json(string sWhere, string user)
+ {
+ try
+ {
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+ //鏍规嵁鐢ㄦ埛瀵瑰簲鐝粍鐨勫叧绯伙紝杩囨护鏉′欢涓鍔犲彧鏄剧ず瀵瑰簲鐨勭彮缁�
+ DataSet dsHitemID = oCN.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + user + "'", "h_p_Gy_GetSQLGroupByUser");
+ sWhere = sWhere + DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
+
+ DataSet ds = oCN.RunProcReturn("Select HItemID,鐝粍浠g爜 鐝粍浠g爜,鐝粍鍚嶇О 鐝粍 from h_v_GroupList where 1=1 " + sWhere + " Order by HItemID ", "h_v_GroupList");
if (ds == null || ds.Tables[0].Rows.Count <= 0)
{
objjson.code = "0";
@@ -4104,6 +4225,208 @@
}
#endregion
+ #region 妫�娴嬪�煎垪琛� 鏂囦欢涓婁紶
+ [Route("Gy_Inspect/Gy_Process_Excel")]
+ [HttpPost]
+ public json Gy_Inspect_Excel()
+ {
+ json res = new json();
+ 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 provisional = new DataTable("dt2");
+
+ //娣诲姞鍒楀悕
+ for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
+ {
+ provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
+ }
+
+ //娣诲姞鏁版嵁
+ for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
+ {
+ DataRow row = provisional.NewRow();
+ for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
+ {
+ row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
+ }
+ provisional.Rows.Add(row);
+ }
+
+ //鍒ゆ柇鍒�
+ string error = JudgmentColumns(provisional);
+ if (error.Length > 0)
+ {
+ res.code = "0";
+ res.count = 0;
+ res.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n";
+ res.data = null;
+ return res;
+ }
+
+ for (int i = 0; i <= provisional.Rows.Count - 1; i++)
+ {
+ string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["妫�娴嬪�间唬鐮�"].ToString());
+ string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["妫�娴嬪�煎悕绉�"].ToString());
+ string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["鍔╄鐮�"]);
+ string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["澶囨敞"].ToString());
+ //鑾峰彇鐪熷疄琛屾暟
+ int line = i + 1;
+ }
+
+ res.code = "1";
+ res.count = 1;
+ res.Message = error;
+ res.data = provisional;
+ return res;
+ }
+ catch (Exception e)
+ {
+ res.code = "0";
+ res.count = 0;
+ res.Message = "Exception锛�" + e.ToString();
+ res.data = null;
+ return res;
+ }
+ }
+
+ /// <summary>
+ /// 鍒ゆ柇鍒�
+ /// </summary>
+ /// <param name="provisional"></param>
+ /// <returns></returns>
+ private static string JudgmentColumns(DataTable provisional)
+ {
+ var error = "";
+
+ //鏌ヨ娌℃湁鐨勫垪
+ if (!provisional.Columns.Contains("妫�娴嬪�间唬鐮�"))
+ error += "娌℃湁鎵惧埌銆愭娴嬪�间唬鐮併�戠殑鏍囬,";
+
+ if (!provisional.Columns.Contains("妫�娴嬪�煎悕绉�"))
+ error += "娌℃湁鎵惧埌銆愭娴嬪�煎悕绉般�戠殑鏍囬,";
+ return error;
+ }
+ #endregion
+
+ #region 妫�娴嬪�煎垪琛� 瀵煎叆(淇濆瓨)
+ [Route("Gy_Inspect/Gy_Process_btnSave")]
+ [HttpPost]
+ public object Gy_Inspect_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();
+ string organ = sArray[2].ToString();
+
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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 HNumber = item["妫�娴嬪�间唬鐮�"].ToString();
+ string HName = item["妫�娴嬪�煎悕绉�"].ToString();
+ string HHelpCode = item["鍔╄鐮�"];
+ string HRemark = item["澶囨敞"].ToString();
+
+ string sShortNumber;
+ sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+ if (sShortNumber.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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 = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from Gy_InspectValue where HNumber='" + HNumber + "'", "Gy_InspectValue");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+
+ string sql = "insert into Gy_InspectValue (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HMakeTime,HMakeEmp)" +
+ $"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '鏈娇鐢�', '{organ}', '{organ}', '{System.DateTime.Now.ToString("G")}', '{user}')";
+ oCN.RunProc(sql);
+ }
+ else
+ {
+ oCN.RunProc("update Gy_InspectValue set HName='" + HName + "', HHelpCode='" + HHelpCode + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "'where HNumber='" + HNumber + "'");
+ }
+
+ i++;
+ }
+
+ oCN.Commit();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀵煎叆鎴愬姛!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ LogService.Write(e);
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 妫�楠屾柟娉� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
/// <summary>
/// 淇濆瓨妫�楠屾柟娉�
@@ -5542,6 +5865,309 @@
#endregion
+ #region 宀椾綅鎶�鑳� 鏂囦欢瀵煎叆淇濆瓨
+ #region 宀椾綅鎶�鑳� 鏂囦欢涓婁紶
+ [Route("Gy_PostSkill/Gy_PostSkill_Excel")]
+ [HttpPost]
+ public object Gy_PostSkill_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
+ tb2.Columns.Add("HPostID", 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("宀椾綅鎶�鑳戒唬鐮�"))
+ 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 = "";
+ string HPostName = "";
+ string HPostNumber = "";
+
+
+ HProcessName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宀椾綅鎶�鑳�"].ToString());
+ HProcessNum = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宀椾綅鎶�鑳戒唬鐮�"].ToString());
+ HORGNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐浠g爜"].ToString());
+ HORGName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["缁勭粐鍚嶇О"].ToString());
+ HPostName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宀椾綅"].ToString());
+ HPostNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["宀椾綅浠g爜"].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();
+ //鏌ヨ宀椾綅
+ ds = oCN.RunProcReturn("select * from Gy_Post where HNumber='" + HPostNumber + "' and Hname='" + HPostName + "' and HUSEORGID = "+ HORGid, "Gy_Post");
+
+ 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]["HPostID"] = 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;
+ }
+
+ //宀椾綅鎶�鑳戒唬鐮�
+ if (HProcessNum == "")
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "绗�" + index + "琛�,宀椾綅鎶�鑳戒唬鐮佷笉鑳戒负绌猴紒";
+ 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_PostSkill/Gy_PostSkill_btnSave")]
+ [HttpPost]
+ public object Gy_PostSkill_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_PostSkill_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 HPostID = item["HPostID"].ToString();//缁勭粐ID
+ string HName = item["宀椾綅鎶�鑳�"].ToString();
+ string HNumber = item["宀椾綅鎶�鑳戒唬鐮�"].ToString();
+ string HRemark = item["澶囨敞"].ToString();
+ string HHelpCode = item["鍔╄鐮�"].ToString();
+ string HUseFlag = "鏈娴�";
+ string HShortNumber;
+ HShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+ if (HShortNumber.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_PostSkill where HNumber='" + HNumber + "'", "Gy_PostSkill");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RunProc("Insert into " + "Gy_PostSkill" +
+ " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID,HPostID,HProcID) " +
+ " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + 0 +
+ "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + HUseFlag + "','" + user + "','" + HOrgID + "','" + HPostID + "','" + 0 + "')");
+
+
+ }
+ else
+ {
+ oCN.RunProc("Update " + "Gy_PostSkill" + " set " +
+ "HName='" + HName + "'" +
+ ",HShortNumber='" + HShortNumber + "'" +
+ ",HHelpCode='" + HHelpCode + "'" +
+ ",HModifyTime='" + DateTime.Now + "'" +
+ ",HUSEORGID='" + HOrgID + "'" +
+ ",HModifyEmp ='" + user + "'" +
+ ",HPostID ='" + HPostID + "'" +
+ ",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
+
#region 宀椾綅 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
/// <summary>
/// 淇濆瓨宀椾綅
@@ -5820,6 +6446,279 @@
return objJsonResult;
}
}
+ #endregion
+
+ #region 宀椾綅 鏂囦欢瀵煎叆淇濆瓨
+ #region 宀椾綅 鏂囦欢涓婁紶
+ [Route("Gy_Post/Gy_Post_Excel")]
+ [HttpPost]
+ public object Gy_Post_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_Post/Gy_Post_btnSave")]
+ [HttpPost]
+ public object Gy_Post_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_Post_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 HUseFlag = "鏈娴�";
+ string HShortNumber;
+ HShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+ if (HShortNumber.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_Post where HNumber='" + HNumber + "'", "Gy_Post");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RunProc("Insert into " + "Gy_Post" +
+ " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
+ " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + 0 +
+ "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + HUseFlag + "','" + user + "','" + HOrgID + "')");
+
+
+ }
+ else
+ {
+ oCN.RunProc("Update " + "Gy_Post" + " set " +
+ "HName='" + HName + "'" +
+ ",HShortNumber='" + HShortNumber + "'" +
+ ",HHelpCode='" + HHelpCode + "'" +
+ ",HModifyTime='" + DateTime.Now + "'" +
+ ",HUSEORGID='" + HOrgID + "'" +
+ ",HModifyEmp ='" + user + "'" +
+ ",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
#region 璋冩嫧绫诲瀷 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
@@ -10385,6 +11284,274 @@
}
#endregion
+ #region 闃查敊瑁呯疆 鏂囦欢瀵煎叆淇濆瓨
+ #region 闃查敊瑁呯疆 鏂囦欢涓婁紶
+ [Route("Gy_PreventErrMould/Gy_PreventErrMould_Excel")]
+ [HttpPost]
+ public object Gy_PreventErrMould_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_PreventErrMould/Gy_PreventErrMould_btnSave")]
+ [HttpPost]
+ public object Gy_PreventErrMould_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_PreventErrMould_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 HShortNumber;
+ HShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+ if (HShortNumber.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_PreventErrMould where HNumber='" + HNumber + "'", "Gy_PreventErrMould");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RunProc("Insert into " + "Gy_PreventErrMould" +
+ " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " +
+ " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + 0 +
+ "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "鏈娴�" + "','" + user + "','" + HOrgID + "')");
+ }
+ else
+ {
+ oCN.RunProc("Update " + "Gy_PreventErrMould" + " set " +
+ "HName='" + HName + "'" +
+ ",HShortNumber='" + HShortNumber + "'" +
+ ",HHelpCode='" + HHelpCode + "'" +
+ ",HModifyTime='" + DateTime.Now + "'" +
+ ",HUSEORGID='" + HOrgID + "'" +
+ ",HModifyEmp ='" + user + "'" +
+ ",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
+
#region 闃查敊瑁呯疆 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
/// <summary>
/// 闃查敊瑁呯疆 淇濆瓨
@@ -11156,7 +12323,7 @@
try
{
//鍒犻櫎鏉冮檺
- if (!DBUtility.ClsPub.Security_Log("Gy_CheckNoteItem_Drop", 1, false, user))
+ if (!DBUtility.ClsPub.Security_Log("Gy_CheckNoteItem_Delete", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
@@ -11195,6 +12362,279 @@
return objJsonResult;
}
}
+ #endregion
+
+ #region 鍚姩妫�鏌ラ」鐩� 鏂囦欢瀵煎叆淇濆瓨
+ #region 鍚姩妫�鏌ラ」鐩� 鏂囦欢涓婁紶
+ [Route("Gy_CheckNoteItem/Gy_CheckNoteItem_Excel")]
+ [HttpPost]
+ public object Gy_CheckNoteItem_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("鍚姩妫�鏌ラ」鐩唬鐮�"))
+ 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]["鍚姩妫�鏌ラ」鐩唬鐮�"].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;
+ }
+
+ //鍚姩妫�鏌ラ」鐩唬鐮�
+ if (HProcessNum == "")
+ {
+ objJsonResult.code = CodeConstant.FAIL;
+ objJsonResult.count = CountConstant.FAIL;
+ objJsonResult.Message = "绗�" + index + "琛�,鍚姩妫�鏌ラ」鐩唬鐮佷笉鑳戒负绌猴紒";
+ 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_CheckNoteItem/Gy_CheckNoteItem_btnSave")]
+ [HttpPost]
+ public object Gy_CheckNoteItem_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_CheckNoteItem_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["鍚姩妫�鏌ラ」鐩唬鐮�"].ToString();
+ string HRemark = item["澶囨敞"].ToString();
+ string HHelpCode = item["鍔╄鐮�"].ToString();
+ string HShortNumber;
+ HShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//鐭唬鐮�
+ if (HShortNumber.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); //绛夌骇
+ string HUseFlag = "鏈娴�";
+
+ 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_CheckNoteItem where HNumber='" + HNumber + "'", "Gy_CheckNoteItem");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ oCN.RunProc("Insert into " + "Gy_CheckNoteItem" +
+ " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
+ ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID,HCheckPostID) " +
+ " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + 0 +
+ "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + HUseFlag + "','" + user + "','" + HOrgID + "','" + 0 + "')");
+
+
+ }
+ else
+ {
+ oCN.RunProc("Update " + "Gy_CheckNoteItem" + " set " +
+
+ "HName='" + HName + "'" +
+ ",HShortNumber='" + HShortNumber + "'" +
+ ",HHelpCode='" + HHelpCode + "'" +
+ ",HModifyTime='" + DateTime.Now + "'" +
+ ",HUSEORGID='" + HOrgID + "'" +
+ ",HModifyEmp ='" + user + "'" +
+ ",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
#region 浼戞伅鏃� 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
@@ -11558,6 +12998,284 @@
public string DayOfWeekText { get; set; }
}
#endregion
+
+
+ #region 鐜妫�娴嬪崟 璁剧疆鍒楄〃/淇濆瓨/缂栬緫/鍒犻櫎鏂规硶
+ /// <summary>
+ /// 淇濆瓨鐜妫�娴嬪崟
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("SaveGy_EnvironmentTestItem")]
+ [HttpPost]
+ public object SaveGy_EnvironmentTestItem([FromBody] JObject msg)
+ {
+ DataSet ds;
+ var _value = msg["msg"].ToString();
+ string msg3 = _value.ToString();
+ string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg1 = sArray[0].ToString();
+ string msg2 = sArray[1].ToString();
+
+ //鏌ョ湅鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestItem_Edit", 1, false, msg2))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ Int64 HItemID = 0;
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ //鑾峰彇鏈�澶D鍊艰祴鍊�
+ DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_EnvironmentTestItem ", "Gy_EnvironmentTestItem");
+ if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
+ {
+ //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
+ var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
+ maxid += 1;
+ HItemID = maxid;
+ }
+ ListModels oListModels = new ListModels();
+ try
+ {
+ WebAPI.DLL.ClsGy_EnvironmentTestItem_Ctl oBill = new WebAPI.DLL.ClsGy_EnvironmentTestItem_Ctl();
+ List<Model.ClsGy_EnvironmentTestItem_Model> lsmain = new List<Model.ClsGy_EnvironmentTestItem_Model>();
+ msg1 = msg1.Replace("\\", "");
+ msg1 = msg1.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_Gy_EnvironmentTestItem(msg1);
+ foreach (Model.ClsGy_EnvironmentTestItem_Model oItem in lsmain)
+ {
+ if (oItem.HNumber.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷笉鑳戒负绌猴紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (oItem.HName.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佸悕绉颁笉鑳戒负绌猴紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ if (!DBUtility.ClsPub.AllowNumber(oItem.HNumber.Trim()))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷腑涓嶈兘鍑虹幇杩炵画鈥�.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鏌ヨ鏁版嵁涓槸鍚﹀瓨鍦ㄩ噸澶嶄唬鐮�
+
+ ds = oCN.RunProcReturn("select * from Gy_EnvironmentTestItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EnvironmentTestItem");
+ if (oItem.HNumber.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮佷负绌猴紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //鏂板鏃跺垽鏂�
+ if (oItem.HItemID == 0)
+ {
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷唬鐮侀噸澶嶏紒";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+ string sParent;
+ sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+ if (sParent.Trim() == "")
+ {
+ oBill.oModel.HParentID = 0;
+ }
+ else
+ {
+ if (oBill.HavParentCode(sParent.Trim(), HItemID))
+ {
+ oBill.oModel.HParentID = oBill.oModel.HItemID;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ }
+ else//缂栬緫鏃跺垽鏂�
+ {
+ //妫�鏌ョ埗绾ф槸鍚﹀瓨鍦�
+ string sParent;
+ sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim());
+ if (sParent.Trim() == "")
+ {
+ oBill.oModel.HParentID = 0;
+ }
+ else
+ {
+ if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID))
+ {
+ oBill.oModel.HParentID = oBill.oModel.HItemID;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佷笂绾т唬鐮佷笉瀛樺湪鎴栬绂佺敤锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ }
+ //寰楀埌鐭唬鐮�
+ string sShortNumber;
+ sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim());
+ if (sShortNumber.Trim() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佺煭浠g爜涓虹┖锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oItem.HShortNumber = sShortNumber;//鐭唬鐮�
+ oItem.HEndFlag = true;//鏈骇鏍囧織
+ oItem.HLevel = DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()); //绛夌骇
+ oItem.HMakeEmp = msg2; //鍒涘缓浜�
+
+ oBill.oModel = oItem;
+ }
+
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (oBill.oModel.HItemID == 0)
+ {
+ bResult = oBill.AddNew();
+ }
+ else
+ {
+ bResult = oBill.ModifyByID(oBill.oModel.HItemID);
+ }
+ 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;
+ }
+ }
+
+ /// <summary>
+ /// 鐜妫�娴嬪崟鍙栦俊鎭�
+ /// </summary>
+ /// <returns></returns>
+ [Route("GetGy_EnvironmentTestItem_Edit")]
+ [HttpGet]
+ public ApiResult<DataSet> GetGy_EnvironmentTestItem_Edit(string HID)
+ {
+ var model = LuBaoSevice.GetGy_EnvironmentTestItemEdit(HID);
+ return model;
+ }
+
+ /// <summary>
+ /// 鐜妫�娴嬪崟鍒犻櫎鍔熻兘
+ /// </summary>
+ /// <returns></returns>
+ [Route("DeltetGy_EnvironmentTestItem")]
+ [HttpGet]
+ public object DeltetGy_EnvironmentTestItem(string HItemID, string user)
+ {
+ DataSet ds;
+ try
+ {
+ //鍒犻櫎鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Gy_EnvironmentTestItem_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ if (string.IsNullOrWhiteSpace(HItemID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HItemID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+ ds = oCN.RunProcReturn("select * from Gy_EnvironmentTestItem where HItemID=" + HItemID, "Gy_EnvironmentTestItem");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁鏁版嵁锛屾棤娉曞垹闄わ紒";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+ }
+
+ oCN.RunProc("delete Gy_EnvironmentTestItem where HItemID=" + HItemID);
+ 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
+
/// <summary>
/// 鐢ㄥ叧鑱斿伐搴忚幏鍙栦俊鎭�
@@ -12777,7 +14495,7 @@
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
if (sWhere == null || sWhere.Equals(""))
{
- ds = oCN.RunProcReturn(" select * from h_v_Sc_ProcessExchangeBillList where 1=1 and 鏃ユ湡>=DATEADD(MONTH,-2,GETDATE()) order by 鍗曟嵁鍙� desc,hsubid", "h_v_Sc_ProcessExchangeBillList");
+ ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessExchangeBillList where 1=1 order by 鍗曟嵁鍙� desc,hsubid", "h_v_Sc_ProcessExchangeBillList");
}
else
{
@@ -13328,6 +15046,61 @@
return objjson;
}
}
+
+ #region 鏉$爜涓绘。鍒嗛〉鍒楄〃
+ [Route("Gy_BarCodeBillList/page")]
+ [HttpGet]
+ public json Gy_BarCodeBillListPage(string sWhere, string user, int page, int size)
+ {
+ DataSet ds;
+ json res = new json();
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill_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("exec h_p_IF_BarCodeBillList " + page + "," + size + ",''", "h_p_IF_BarCodeBillList");
+ }
+ else
+ {
+ ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_IF_BarCodeBillList");
+ }
+
+ //娣诲姞鍒楀悕
+ 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鍒楀璞$殑鍒楀悕
+ }
+
+ res.code = CodeConstant.SUCCEED;
+ res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
+ res.Message = "Sucess锛�";
+ res.list = columnNameList;
+ res.data = ds.Tables[0];
+ return res;
+ }
+ catch (Exception e)
+ {
+ res.code = CodeConstant.FAIL;
+ res.count = CountConstant.FAIL;
+ res.Message = "Exception锛�" + e.ToString();
+ res.data = null;
+ return res;
+ }
+ }
+ #endregion
+
/// <summary>
/// 鏍规嵁璁惧淇濆吇瑙勭▼鏄剧ず璁惧淇濆吇瑙勭▼椤圭洰
/// </summary>
@@ -13488,8 +15261,8 @@
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
{
objjson.code = "0";
- objjson.count = 1;
- objjson.Message = "璇ヨ澶囨湁澶氫釜璁″垝鍗�,鎵嬪姩閫夌潃" ;
+ objjson.count = 0;
+ objjson.Message = "璇ヨ澶囨湁澶氫釜璁″垝鍗曟垨鐐规瑙勭▼,鎵嬪姩閫夌潃" ;
objjson.data = null;
return objjson;
}
--
Gitblit v1.9.1