From fa61fd1b6e892f055656c3232e8cf643d3658002 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期五, 28 三月 2025 17:36:22 +0800
Subject: [PATCH] 项目费用分类 的基础资料编辑及列表 管径、管径材质 的 基础资料 项目费用 里 增加 项目费用分类和 金额HStdMoney 的字段 异常反馈验收单,班次开班单,员工技能矩阵,工序流转卡维护,设备开机单 :增加 系统参数(参考 开工单,采购订单,采购入库单 之类的 )保存后自动审核; 如果 系统参数 为 Y,则 自动审核; 如果否 则 不审核;
---
WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs | 1053 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 1,015 insertions(+), 38 deletions(-)
diff --git a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
index 0f5157b..8c0c605 100644
--- a/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
+++ b/WebAPI/Controllers/SBGL/Sb_EquipDotCheckRuleBillController.cs
@@ -1,4 +1,7 @@
-锘縰sing System;
+锘縰sing DBUtility;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
@@ -6,6 +9,9 @@
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
+using System.Web;
+using WebAPI.Controllers.SCGL.鏃ヨ鍒掔鐞�;
+using System.IO;
namespace WebAPI.Controllers.SBGL
{
@@ -22,10 +28,20 @@
#region 璁惧鐐规瑙勭▼鍗曞垪琛�
[Route("Sb_EquipDotCheckRuleBill/GetEquipDotCheckRuleList")]
[HttpGet]
- public object GetEquipDotCheckRuleList(string sWhere)
+ public object GetEquipDotCheckRuleList(string sWhere,string user)
{
try
{
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBillList", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
if (sWhere == null || sWhere.Equals(""))
{
ds = oCN.RunProcReturn("select * from h_v_Sb_EquipDotCheckRuleList " + sWhere + " order by hmainid desc", "h_v_Sb_EquipDotCheckRuleList");
@@ -36,22 +52,95 @@
string sql = sql1 + sWhere + " order by hmainid desc";
ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList");
}
- if (ds == null || ds.Tables[0].Rows.Count == 0)
+
+ //娣诲姞鍒楀悕
+ 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鍒楀璞$殑鍒楀悕
+ }
+ //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 = columnNameList;
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
+ }
+ catch (Exception ex)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐐规瑙勭▼鍗曞垪琛≒DA
+ [Route("Sb_EquipDotCheckRuleBill/GetEquipDotCheckRuleListPDA")]
+ [HttpGet]
+ public object GetEquipDotCheckRuleListPDA(string sWhere, string user)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBillList", 1, false, user))
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "娌℃湁浣犺鎵剧殑璁板綍锛�";
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
objJsonResult.data = null;
return objJsonResult;
}
+
+ if (sWhere == null || sWhere.Equals(""))
+ {
+ ds = oCN.RunProcReturn("select * from h_v_Sb_GetDotCheckRuleListByEquip " + sWhere , "h_v_Sb_GetDotCheckRuleListByEquip");
+ }
else
{
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "杩斿洖璁板綍鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
+ string sql1 = "select * from h_v_Sb_GetDotCheckRuleListByEquip where 1 = 1";
+ string sql = sql1 + sWhere;
+ ds = oCN.RunProcReturn(sql, "h_v_Sb_GetDotCheckRuleListByEquip");
}
+
+ //娣诲姞鍒楀悕
+ 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鍒楀璞$殑鍒楀悕
+ }
+ //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 = columnNameList;
+ return objJsonResult;
+ //}
+ //else
+ //{
+ //objJsonResult.code = "0";
+ //objJsonResult.count = 0;
+ //objJsonResult.Message = "鏃犳暟鎹�";
+ //objJsonResult.data = null;
+ //return objJsonResult;
+ //}
}
catch (Exception ex)
{
@@ -67,8 +156,16 @@
#region 璁惧鐐规瑙勭▼璁板綍鍒犻櫎鍔熻兘
[Route("Sb_EquipDotCheckRuleBill/DeleteEquipDotCheckRuleBillList")]
[HttpGet]
- public object DeleteEquipDotCheckRuleBillList(string HInterID)
+ public object DeleteEquipDotCheckRuleBillList(string HInterID,string user)
{
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBill_Delete", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犲垹闄ゆ潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
Int64 lngBillKey = 0;
lngBillKey = DBUtility.ClsPub.isLong(HInterID);
if (lngBillKey == 0)
@@ -80,26 +177,46 @@
return objJsonResult;
}
DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill();
- if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
+ ds = oCN.RunProcReturn("select * from Sb_EquipDotCheckRuleBillMain where HInterID=" + HInterID, "Sb_EquipDotCheckRuleBillMain");
+ if (ds.Tables[0].Rows.Count>0)
{
- if (oBill.omodel.HBillStatus > 1)
+ //鏁版嵁搴撶┖鍊煎垽鏂�
+ if (ds.Tables[0].Rows[0]["HBillStatus"] == DBNull.Value)
{
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵��,涓嶈兘鍒犻櫎锛�";
- objJsonResult.data = null;
- return objJsonResult;
+ ds.Tables[0].Rows[0]["HBillStatus"] = 1;
}
- if (oBill.omodel.HChecker != "")
+ if (int.Parse(ds.Tables[0].Rows[0]["HBillStatus"].ToString()) > 1)
{
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�";
+ objJsonResult.Message = "鍗曟嵁褰撳墠澶勪簬涓嶈兘鍒犻櫎鐘舵�侊紒";
objJsonResult.data = null;
return objJsonResult;
}
- bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sb_EquipDotCheckRuleBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipDotCheckRuleBill_BeforeDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ bool IsDete = oBill.DeleteBill(lngBillKey,BillOld.omodel.HBillNo, "h_p_Sb_EquipDotCheckRuleBill_AfterDelCtrl",user, ref DBUtility.ClsPub.sExeReturnInfo);
if (IsDete)
{
objJsonResult.code = "0";
@@ -152,24 +269,16 @@
try
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
- if (sqlWhere == null || sqlWhere.Equals(""))
- {
- ds = oCN.RunProcReturn("select 鐐规椤圭洰ID,鐐规椤圭洰,鐐规閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜�,瀛愬娉� from h_v_Sb_EquipDotCheckRuleList", "h_v_Sb_EquipDotCheckRuleList");
- objJsonResult.code = "0";
- objJsonResult.count = 1;
- objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- }
- else
- {
- string sql1 = "select 鐐规椤圭洰ID,鐐规椤圭洰,鐐规閮ㄤ綅,鍏蜂綋瑕佹眰,璐熻矗浜篒D,璐熻矗浜轰唬鐮�,璐熻矗浜�,瀛愬娉� from h_v_Sb_EquipDotCheckRuleList where 1 = 1 ";
- string sql = sql1 + sqlWhere;
- ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList");
- objJsonResult.code = "0";
- objJsonResult.count = 1;
- objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
- objJsonResult.data = ds.Tables[0];
- }
+
+ string sql1 = @"select * from h_v_Sb_EquipDotCheckRuleList a
+ left join Gy_DotCheck b on a.鐐规椤圭洰ID =b.HItemID where 1 = 1 ";
+ string sql = sql1 + sqlWhere;
+ ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipDotCheckRuleList");
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鑾峰彇淇℃伅鎴愬姛锛�";
+ objJsonResult.data = ds.Tables[0];
+
}
catch (Exception e)
{
@@ -181,5 +290,873 @@
return objJsonResult;
}
#endregion
+
+ #region 璁惧鐐规瑙勭▼鍗� 淇濆瓨/缂栬緫
+ /// <summary>
+ /// 璁惧鐐规瑙勭▼鍗� 淇濆瓨
+ /// </summary>
+ /// <param name="msg"></param>
+ /// <returns></returns>
+ [Route("Sb_EquipDotCheckRuleBill/SaveEquipDotCheckRuleBill")]
+ [HttpPost]
+ public object SaveEquipDotCheckRuleBill([FromBody] JObject msg)
+ {
+ var _value = msg["msg"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();
+ string msg4 = sArray[2].ToString();
+
+
+ string UserName = "";
+ ListModels oListModels = new ListModels();
+ try
+ {
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBill_Edit", 1, false, msg4))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犱繚瀛樻潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill();
+ List<Models.ClsSb_EquipDotCheckRuleBillMain> lsmain = new List<Models.ClsSb_EquipDotCheckRuleBillMain>();
+ msg2 = msg2.Replace("\\", "");
+ msg2 = msg2.Replace("\n", ""); //\n
+ lsmain = oListModels.getObjectByJson_Sb_EquipDotCheckRuleBillMain(msg2);
+ foreach (Models.ClsSb_EquipDotCheckRuleBillMain oItem in lsmain)
+ {
+ UserName = oItem.HMaker; //鍒跺崟浜�
+ oItem.HBillType = "3913";
+ oItem.HBillSubType = "3913";
+ DBUtility.ClsPub.CurUserName = UserName;
+ oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));// --鏃ユ湡
+ oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+
+ if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛佹病鏈夊崟鎹棩鏈燂紝鏃犳硶淇濆瓨锛�";
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ oBill.omodel = oItem;
+ }
+
+ //琛ㄤ綋鏁版嵁 鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆�
+ msg3 = msg3.Substring(1, msg3.Length - 2);
+ msg3 = msg3.Replace("\\", "");
+ msg3 = msg3.Replace("\n", ""); //\n
+ //msg2 = msg2.Replace("'", "鈥�");
+ List<Models.ClsSb_EquipDotCheckRuleBillSub> ls = new List<Models.ClsSb_EquipDotCheckRuleBillSub>();
+ ls = oListModels.getObjectByJson_Sb_EquipDotCheckRuleBillSub(msg3);
+ int i = 0;
+ foreach (Models.ClsSb_EquipDotCheckRuleBillSub oItemSub in ls)
+ {
+
+ i++;
+ oItemSub.HEntryID = i;
+ //oItemSub.HCloseMan = ""; //琛屽叧闂�
+ oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
+ oItemSub.HCloseType = false; //鍏抽棴绫诲瀷
+ //oItemSub.HRemark = ""; //澶囨敞
+ oItemSub.HSourceInterID = 0; // 婧愬崟涓诲唴鐮�
+ oItemSub.HSourceEntryID = 0; //婧愬崟瀛愬唴鐮�
+ //oItemSub.HSourceBillNo = ""; //婧愬崟鍗曞彿
+ //oItemSub.HSourceBillType = ""; //婧愬崟绫诲瀷
+ oItemSub.HRelationQty = 0; //鍏宠仈鏁伴噺
+
+ oBill.DetailColl_Mater.Add(oItemSub);
+
+ }
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ bool bResult;
+ if (oBill.omodel.HInterID == 0)
+ {
+ // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ else
+ {
+ bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
+ }
+ if (bResult)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "淇濆瓨鎴愬姛锛�";
+ //WebAPIController.Add_Log("閫佽揣鍗曚笅鎺�", UserName, "鐢熸垚閫佽揣鍗�");
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "淇濆瓨澶辫触锛�" + e.ToString();
+ objJsonResult.data = 1;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐐规瑙勭▼鍗曞鏍�/鍙嶅鏍稿姛鑳�
+ [Route("Sb_EquipDotCheckRuleBill/CheckSb_EquipDotCheckRuleBill")]
+ [HttpGet]
+ public object CheckSb_EquipDotCheckRuleBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBill_Check", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬鏍�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill();
+ ClsPub.CurUserName = user;
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 瀹℃牳 2 鍙嶅鏍�
+ if (Type == 1)
+ {
+ //瀹℃牳鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sb_EquipDotCheckRuleBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipDotCheckRuleBill_BeforeCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:瀹℃牳鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ if (!BillOld.CheckBill(int.Parse(HInterID),oBill.omodel.HBillNo, "h_p_Sb_EquipDotCheckRuleBill_AfterCheckCtrl",user, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ //鍙嶅鏍稿墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sb_EquipDotCheckRuleBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipDotCheckRuleBill_BeforeUnCheckCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:鍙嶅鏍稿墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+
+ if (BillOld.AbandonCheck(int.Parse(HInterID),oBill.omodel.HBillNo, "h_p_Sb_EquipDotCheckRuleBill_AfterUnCheckCtrl",user, ref ClsPub.sExeReturnInfo))
+ {
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();//鎻愪氦浜嬪姟
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎵ц鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐐规瑙勭▼鍗曞叧闂�/鍙嶅叧闂姛鑳�
+ [Route("Sb_EquipDotCheckRuleBill/CloseSb_EquipDotCheckRuleBill")]
+ [HttpGet]
+ public object CloseSb_EquipDotCheckRuleBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBill_Close", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愬叧闂�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ClsPub.CurUserName = user;
+
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 鍏抽棴 2 鍙嶅叧闂�
+ if (Type == 1)
+ {
+ if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍏抽棴澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ if (!BillOld.CancelClose(int.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅叧闂け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();//鎻愪氦浜嬪姟
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎵ц鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐐规瑙勭▼浣滃簾/鍙嶄綔搴熷姛鑳�
+ [Route("Sb_EquipDotCheckRuleBill/DeleteSb_EquipDotCheckRuleBill")]
+ [HttpGet]
+ public object DeleteSb_EquipDotCheckRuleBill(string HInterID, int Type, string user)
+ {
+ try
+ {
+ //鍒ゆ柇鏄惁鏈夊垹闄ゆ潈闄�
+ if (!DBUtility.ClsPub.Security_Log("Sb_EquipDotCheckRuleBill_Drop", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳潈闄愪綔搴�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (string.IsNullOrWhiteSpace(HInterID))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DLL.ClsSb_EquipDotCheckRuleBill oBill = new DLL.ClsSb_EquipDotCheckRuleBill();
+ ClsPub.CurUserName = user;
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID);
+ //閽堝闇�瑕佽繘琛岀殑鎿嶄綔锛屾楠屽綋鍓嶅崟鎹殑鐘舵�佹槸鍚︽敮鎸侀渶瑕佽繘琛岀殑鎿嶄綔
+ if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //鏍规嵁HInterID鑾峰彇璇ュ崟鎹殑鏁版嵁
+ {
+ if (oBill.omodel.HChecker.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘杩涜浣滃簾锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (Type == 1) //浣滃簾鍒ゆ柇
+ {
+ if (oBill.omodel.HDeleteMan.Trim() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸蹭綔搴�!涓嶈兘鍐嶄綔搴燂紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (Type == 2) //鍙嶄綔搴熷垽鏂�
+ {
+ if (oBill.omodel.HDeleteMan.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;
+ }
+
+ oCN.BeginTran();//寮�濮嬩簨鍔�
+
+ //Type 1 浣滃簾 2 鍙嶄綔搴�
+ if (Type == 1)
+ {
+ //浣滃簾鍓嶆帶鍒�=========================================
+ string sql1 = "exec h_p_Sb_EquipDotCheckRuleBill_BeforeDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipDotCheckRuleBill_BeforeDropCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:浣滃簾鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ if (!oBill.Cancelltion(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sb_EquipDotCheckRuleBill_AfterDropCtrl", user, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ else
+ {
+ //鍙嶄綔搴熷墠鎺у埗=========================================
+ string sql1 = "exec h_p_Sb_EquipDotCheckRuleBill_BeforeUnDropCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sb_EquipDotCheckRuleBill_BeforeUnDropCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:鍙嶄綔搴熷墠鍒ゆ柇澶辫触锛岃涓庣綉缁滅鐞嗕汉鍛樿仈绯�";
+ objJsonResult.data = null;
+ return objJsonResult;
+
+ }
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //===========================================================
+
+ if (!oBill.AbandonCancelltion(int.Parse(HInterID), oBill.omodel.HBillNo, "h_p_Sb_EquipDotCheckRuleBill_AfterUnDropCtrl", user, ref ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
+ oCN.Commit();//鎻愪氦浜嬪姟
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鎵ц鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult; ;
+
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鎵ц澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐐规瑙勭▼鍗曟枃浠朵笂浼�
+ [Route("Sb_EquipDotCheckRuleBill/Sb_EquipDotCheckRuleBill_Excel")]
+ [HttpPost]
+ public object Sb_EquipDotCheckRuleBill_Excel()
+ {
+ try
+ {
+
+ //鑾峰彇鏂囦欢鍚嶇О
+ var file = HttpContext.Current.Request.Files[0];
+ //鑾峰彇鏂囦欢鐗╃悊璺緞
+ string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
+ // 鍒涘缓涓�涓瓧鍏告潵瀛樺偍name鍒板崟鎹彿鍜孒InterID鐨勬槧灏�
+ Dictionary<string, object[]> nameToValues = new Dictionary<string, object[]>();
+ string HBillType = "3913";
+ //淇濆瓨鏂囦欢
+ 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("HDotCheckItemID", typeof(Int32));//鐐规椤圭洰ID
+ tb2.Columns.Add("HDotCheckItemClassID", typeof(Int32));//鐐规鍒嗙被ID
+ tb2.Columns.Add("HDotCheckItemMethodID", typeof(Int32));//鐐规鏂规硶ID
+ tb2.Columns.Add("HEmpID", typeof(Int32));//璐熻矗浜�
+ tb2.Columns.Add("鍗曟嵁鍙�", typeof(string));//鍗曟嵁鍙�
+ tb2.Columns.Add("HInterID", typeof(Int64));//涓婚敭
+ //娣诲姞鏁版嵁
+ 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("鐐规瑙勭▼鍚嶇О"))
+ 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 += "娌℃湁鎵惧埌銆愮偣妫�椤圭洰浠g爜銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鐐规椤圭洰鍚嶇О"))
+ error += "娌℃湁鎵惧埌銆愮偣妫�椤圭洰鍚嶇О銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鐐规鏂规硶浠g爜"))
+ error += "娌℃湁鎵惧埌銆愮偣妫�椤圭洰浠g爜銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鐐规鏂规硶鍚嶇О"))
+ error += "娌℃湁鎵惧埌銆愮偣妫�椤圭洰鍚嶇О銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鐐规閮ㄤ綅"))
+ error += "娌℃湁鎵惧埌銆愮偣妫�閮ㄤ綅銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("鍏蜂綋瑕佹眰"))
+ error += "娌℃湁鎵惧埌銆愬叿浣撹姹傘�戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("璐熻矗浜轰唬鐮�"))
+ error += "娌℃湁鎵惧埌銆愯礋璐d汉浠g爜銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("璐熻矗浜哄悕绉�"))
+ error += "娌℃湁鎵惧埌銆愯礋璐d汉鍚嶇О銆戠殑鏍囬,";
+
+ if (!tb2.Columns.Contains("琛ㄤ綋澶囨敞"))
+ error += "娌℃湁鎵惧埌銆愯〃浣撳娉ㄣ�戠殑鏍囬,";
+
+ if (error.Length > 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"Excel妯℃澘瀛樺湪閿欒,{error}\r\n";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ for (int i = 0; i <= tb2.Rows.Count - 1; i++)
+ {
+
+ string HDotCheckItemNumber = "";
+ string HDotCheckItemName = "";
+ string HEmpNum = "";
+ string HEmpName = "";
+
+ HDotCheckItemNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规椤圭洰浠g爜"].ToString());
+ HDotCheckItemName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规椤圭洰鍚嶇О"].ToString());
+ HEmpNum = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["璐熻矗浜轰唬鐮�"].ToString());
+ HEmpName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["璐熻矗浜哄悕绉�"].ToString());
+ string HDotCheckItemMethodNumber = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规鏂规硶浠g爜"].ToString());
+ string HDotCheckItemMethodName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规鏂规硶鍚嶇О"].ToString());
+
+ string HEquipDotCheckRuleName = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规瑙勭▼鍚嶇О"].ToString());
+ string HCycleUnit = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍛ㄦ湡鍗曚綅"].ToString());
+ string HCheckCycle = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规鍛ㄦ湡"].ToString());
+ string HExplanation = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鎽樿"].ToString());
+ string HMainRemark = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["琛ㄥご澶囨敞"].ToString());
+ string HDotCheckPart = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鐐规閮ㄤ綅"].ToString());
+ string HClaim = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["鍏蜂綋瑕佹眰"].ToString());
+ string HSubRemark = DBUtility.ClsPub.isStrNull(tb2.Rows[i]["琛ㄤ綋澶囨敞"].ToString());
+
+ int index = i + 1;
+ //鏌ヨ鐐规椤圭洰
+ ds = oCN.RunProcReturn("select * from Gy_DotCheck where HNumber='" + HDotCheckItemNumber + "' and Hname='" + HDotCheckItemName + "'", "Gy_DotCheck");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,鐐规椤圭洰涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HDotCheckItemID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ tb2.Rows[i]["HDotCheckItemClassID"] = ds.Tables[0].Rows[0]["HDotCheckItemClassID"].ToString();
+ }
+ //鏌ヨ璐熻矗浜�
+ ds = oCN.RunProcReturn("select * from Gy_Employee where HNumber='" + HEmpNum + "' and Hname='" + HEmpName + "'", "Gy_Employee");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璇ヨ礋璐d汉:" + HEmpName + ",涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HEmpID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+
+ //鏌ヨ鐐规鏂规硶
+ ds = oCN.RunProcReturn("select * from Gy_DotCheckItemMethod where HNumber='" + HDotCheckItemMethodNumber + "' and Hname='" + HDotCheckItemMethodName + "'", "Gy_Employee");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璇ョ偣妫�鏂规硶:" + HEmpName + ",涓嶅瓨鍦紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ tb2.Rows[i]["HDotCheckItemMethodID"] = ds.Tables[0].Rows[0]["HItemID"].ToString();
+ }
+
+ //璁惧鐐规瑙勭▼鍚嶇О
+ if (HEquipDotCheckRuleName == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,璁惧鐐规瑙勭▼鍗曞悕绉颁笉鑳戒负绌猴紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鍛ㄦ湡鍗曚綅
+ if (HCycleUnit == "" || (HCycleUnit != "鏈�" && HCycleUnit != "鍛�" && HCycleUnit != "澶�"))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,鍛ㄦ湡鍗曚綅涓嶈兘涓虹┖涓斿彧鑳戒负澶╋紝鏈堬紝鍛紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //鐐规鍛ㄦ湡
+ if (HCheckCycle == "" )
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绗�" + index + "琛�,鐐规鍛ㄦ湡涓嶈兘涓虹┖锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //璁剧疆鍗曟嵁HinterID鍜屽崟鎹彿
+
+
+ Int64 HInterID;
+ string HBillNo;
+ object[] myArray = new object[2];
+ // 濡傛灉瀛楀吀涓繕娌℃湁杩欎釜鐐规瑙勭▼鐨勬潯鐩紝灏辨坊鍔犲畠
+ if (!nameToValues.ContainsKey(HEquipDotCheckRuleName))
+ {
+ HInterID = DBUtility.ClsPub.CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
+ HBillNo = DBUtility.ClsPub.CreateBillCode(HBillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
+ myArray[0] = HInterID;
+ myArray[1] = HBillNo;
+ nameToValues[HEquipDotCheckRuleName] = myArray;
+ tb2.Rows[i]["HInterID"] = HInterID;
+ tb2.Rows[i]["鍗曟嵁鍙�"] = HBillNo;
+ }
+ // 濡傛灉瀛楀吀涓湁杩欎釜骞撮緞鐨勬潯鐩紝浣嗘槸褰撳墠琛岀殑鍚嶇О涓嶆槸瀛楀吀涓殑鍚嶇О锛屽氨鏇存柊瀹�
+ else if (true)
+ {
+ tb2.Rows[i]["HInterID"] = nameToValues[HEquipDotCheckRuleName][0];
+ tb2.Rows[i]["鍗曟嵁鍙�"] = nameToValues[HEquipDotCheckRuleName][1];// 鏇存柊褰撳墠琛屽崟鎹彿鍜宨d
+ }
+
+ }
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = error;
+ objJsonResult.data = tb2;
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 璁惧鐐规瑙勭▼鍗� 瀵煎叆(淇濆瓨)
+ [Route("Sb_EquipDotCheckRuleBill/Sb_EquipDotCheckRuleBill_btnSave")]
+ [HttpPost]
+ public object Sb_EquipDotCheckRuleBill_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("Sb_EquipDotCheckRuleBill_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 HInterID = item["HInterID"].ToString();
+ string HBillNo = item["鍗曟嵁鍙�"].ToString();
+ //string HInterID = item["鐐规瑙勭▼鍚嶇О"].ToString();
+ string HCycleUnit = item["鍛ㄦ湡鍗曚綅"].ToString();
+ string HCheckCycle = item["鐐规鍛ㄦ湡"].ToString();
+ string HExplanation = item["鎽樿"].ToString();
+ string HMainRemark = item["琛ㄥご澶囨敞"].ToString();
+ string HDotCheckItemID = item["HDotCheckItemID"].ToString();
+ string HDotCheckItemClassID = item["HDotCheckItemClassID"].ToString();
+ string HDotCheckItemMethodID = item["HDotCheckItemMethodID"].ToString();
+ string HDotCheckItem = item["鐐规椤圭洰鍚嶇О"].ToString();
+ string HDotCheckPart = item["鐐规閮ㄤ綅"].ToString();
+ string HClaim = item["鍏蜂綋瑕佹眰"].ToString();
+ string HEmpID = item["HEmpID"].ToString();
+ string HSubRemark = item["琛ㄤ綋澶囨敞"].ToString();
+ string HBillType = "3913";
+ string HBillSubType = "3913";
+ DateTime HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));
+ Int64 HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year);
+ Int64 HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month);
+ DataSet Cs;
+ Int64 HEntryID = 1;
+ Cs = oCN.RunProcReturn("select MAX(HEntryID)HEntryID from Sb_EquipDotCheckRuleBillSub", "Sb_EquipDotCheckRuleBillSub");
+ if (Cs.Tables[0].Rows.Count != 0 && ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()) != 0)
+ {
+ HEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString());
+ HEntryID += 1;
+ }
+
+ ds = oCN.RunProcReturn("select * from Sb_EquipDotCheckRuleBillMain where HInterID =" + HInterID, "Sb_EquipDotCheckRuleBillMain");
+
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+
+ //涓昏〃
+ oCN.RunProc("Insert Into Sb_EquipDotCheckRuleBillMain " +
+ "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate,HBillStatus" +
+ ",HYear,HPeriod,HRemark" +
+ ",HBeginDate,HEndDate,HCycleUnit,HCheckCycle,HExplanation" +
+ ") " +
+ " values('" + HBillType + "','" + HBillSubType + "'," + HInterID.ToString() + ",'" + HBillNo + "','" + HDate + "','" + user + "',getdate(),1" +
+ "," + HYear.ToString() + "," + HPeriod.ToString() + ",'" + HMainRemark + "'" +
+ ",getdate()" + ",getdate()" + ",'" + HCycleUnit + "','" + HCheckCycle + "','" + HExplanation + "'" +
+ ") ");
+ //鎻掑叆瀛愯〃
+ oCN.RunProc("Insert into Sb_EquipDotCheckRuleBillSub " +
+ " (HInterID,HEntryID," +
+ "HRemark," +
+ "HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim," +
+ "HManagerID,HDotCheckItemClassID,HDotCheckItemMethodID" +
+ ") values("
+ + HInterID.ToString() + "," + HEntryID.ToString() +
+ ",'" + HSubRemark + "'" +
+ ",'" + HDotCheckItemID + "','" + HDotCheckItem + "','" + HDotCheckPart + "','" + HClaim +
+ "'," + HEmpID + "," + HDotCheckItemClassID + "," + HDotCheckItemMethodID +
+ ") ");
+ }
+ else
+ {
+ oCN.RunProc("Insert into Sb_EquipDotCheckRuleBillSub " +
+ " (HInterID,HEntryID," +
+ "HRemark," +
+ "HDotCheckItemID,HDotCheckItem,HDotCheckPart,HClaim," +
+ "HManagerID,HDotCheckItemClassID,HDotCheckItemMethodID" +
+ ") values("
+ + HInterID.ToString() + "," + HEntryID.ToString() +
+ ",'" + HSubRemark + "'" +
+ ",'" + HDotCheckItemID + "','" + HDotCheckItem + "','" + HDotCheckPart + "','" + HClaim +
+ "'," + HEmpID + "," + HDotCheckItemClassID + "," + HDotCheckItemMethodID +
+ ") ");
+ }
+
+ 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
+
}
}
--
Gitblit v1.9.1