From 8cdf2c4d1edba2cfa7d63c7b071f170354bdf691 Mon Sep 17 00:00:00 2001
From: wangyi <2946747746@qq.com>
Date: 星期一, 30 三月 2026 18:33:42 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/基础资料/基础资料/Gy_WorkStationBillController.cs | 407 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 372 insertions(+), 35 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs"
index cc7549f..a9a118d 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_WorkStationBillController.cs"
@@ -79,11 +79,14 @@
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();
- string msg3 = sArray[1].ToString();
+ string msg3 = sArray[2].ToString();
+ string msg4 = sArray[1].ToString();//瀛愯〃
//鍙嶅簭鍒楀寲
msg2 = "[" + msg2.ToString() + "]";
List<WorkStation> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WorkStation>>(msg2);
+ List<WorkStationSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WorkStationSub>>(msg4);
+
long HItemID = list[0].HItemID;
string HNumber = list[0].HNumber;
@@ -98,56 +101,114 @@
long HUSEORGID = list[0].HUSEORGID;
long HCREATEORGID = list[0].HCREATEORGID;
+
- #region [娉ㄩ噴浠g爜]
- ////鍒ゆ柇鏉冮檺
- //if (!ClsPub.Security_Log("Gy_Warehouse_Edit", 1, false, msg3))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
- //if (!DBUtility.ClsPub.AllowNumber(HNumber))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
+ #region [娉ㄩ噴浠g爜]
+ ////鍒ゆ柇鏉冮檺
+ //if (!ClsPub.Security_Log("Gy_Warehouse_Edit", 1, false, msg3))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
- //if (oDept.HavSameNumber(HItemID, HNumber))
- //{
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "浠g爜閲嶅锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- //}
- #endregion
+ //if (!DBUtility.ClsPub.AllowNumber(HNumber))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "浠g爜涓笉鑳藉嚭鐜拌繛缁��.鈥欏苟涓旈浣嶆湯浣嶄笉鑳戒负鈥�.鈥欙紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
- //淇濆瓨
- //淇濆瓨瀹屾瘯鍚庡鐞�
- if (HItemID == 0)
+ //if (oDept.HavSameNumber(HItemID, HNumber))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "浠g爜閲嶅锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ #endregion
+
+ //淇濆瓨
+ //淇濆瓨瀹屾瘯鍚庡鐞�
+ if (HItemID == 0)
{
oCN.BeginTran();
- oCN.RunProc("Insert into Gy_WorkStation " +
+ //鍒ゆ柇浠g爜鏄惁閲嶅
+ DataSet dss;
+ dss = oCN.RunProcReturn("select * from Gy_WorkStation where HNumber='" + HNumber + "'", "Gy_WorkStation");
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (dss.Tables[0].Rows.Count != 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁浠g爜閲嶅涓嶅厑璁告柊澧�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ DataSet ds = oCN.RunProcReturn("Insert into Gy_WorkStation " +
" (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
",HLevel,HEndFlag,HStopflag,HRemark," +
- "HUSEORGID,HCREATEORGID) " +
+ "HUSEORGID,HCREATEORGID,HMakeEmp,HMakeTime) output inserted.HItemID" +//鑾峰彇鍒氭墠鎻掑叆鐨勮嚜澧濱D
" Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID.ToString() +
- "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HUSEORGID + ",'" + HCREATEORGID + "')", ref DBUtility.ClsPub.sExeReturnInfo);
+ "," + HLevel.ToString() + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "'," + HUSEORGID + ",'" + HCREATEORGID + "','" + msg3 + "',getdate())", "Gy_WorkStation");
+ int HInterID = Convert.ToInt32(ds.Tables[0].Rows[0]["HItemID"]);//鑷ID
//淇敼涓婄骇涓洪潪鏈骇浠g爜
oCN.RunProc("Update Gy_WorkStation set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("Delete From " + "Gy_WorkStationSub" + " where HInterID=" + HInterID);
+
+ //鎻掑叆瀛愯〃
+ if (subList != null && subList.Count > 0)
+ {
+ int i = 0;
+ foreach (Models.WorkStationSub oSub in subList)
+ {
+
+ if (oSub == null)
+ continue;
+ i++;
+ string subSql = "insert into Gy_WorkStationSub" +
+ "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ ",HMaterID" + ")" +
+ " values(" +
+ HInterID + "," +
+ (i) + "," +
+ (oSub.HSourceInterID != 0 ? oSub.HSourceInterID.ToString() : "0") + "," +
+ ( oSub.HSourceEntryID != 0 ? oSub.HSourceEntryID.ToString() : "0") + ",'" +
+ (oSub.HSourceBillNo ?? "") + "','" + (oSub.HSourceBillType ?? "") + "'," +
+ (oSub.HMaterID != 0 ? oSub.HMaterID.ToString() : "0") +
+ ")";
+
+ oCN.RunProc(subSql);
+ }
+ }
+
+
+
oCN.Commit();
}
else
{
//鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
oCN.BeginTran();
+ //宸插鏍镐笉鍏佽淇敼
+ DataSet dss;
+ dss = oCN.RunProcReturn("select * from Gy_WorkStation where HItemID=" + HItemID, "Gy_WorkStation");
+ //鍒ゆ柇鏄惁鍙紪杈�
+ if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "姝ゅ崟鎹姸鎬佸凡缁忓鏍革紝涓嶅厑璁镐慨鏀癸紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
//涓昏〃
oCN.RunProc("Update Gy_WorkStation set " +
" HNumber='" + HNumber + "'" +
@@ -164,6 +225,37 @@
//灏嗕笂绾� 涓洪潪鏈骇
oCN.RunProc("Update Gy_WorkStation set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
//
+ //鍒犻櫎瀛愯〃
+ oCN.RunProc("Delete From " + "Gy_WorkStationSub" + " where HInterID=" + HItemID);
+
+ //鎻掑叆瀛愯〃
+ if (subList != null && subList.Count > 0)
+ {
+ int i = 0;
+ foreach (Models.WorkStationSub oSub in subList)
+ {
+
+ if (oSub == null)
+ continue;
+ i++;
+ string subSql = "insert into Gy_WorkStationSub" +
+ "(HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType" +
+ ",HMaterID" + ")" +
+ " values(" +
+ HItemID + "," +
+ (i) + "," +
+ (oSub.HSourceInterID != 0 ? oSub.HSourceInterID.ToString() : "0") + "," +
+ (oSub.HSourceEntryID != 0 ? oSub.HSourceEntryID.ToString() : "0") + ",'" +
+ (oSub.HSourceBillNo ?? "") + "','" + (oSub.HSourceBillType ?? "") + "'," +
+ (oSub.HMaterID != 0 ? oSub.HMaterID.ToString() : "0") +
+ ")";
+
+ oCN.RunProc(subSql);
+ }
+ }
+
+
+
oCN.Commit();
}
objJsonResult.code = "0";
@@ -185,6 +277,251 @@
}
#endregion
+ #region 宸ヤ綅鍒楄〃瀹℃牳銆佸弽瀹℃牳
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">瀹℃牳(0),鍙嶅鏍�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Gy_WorkStation/AuditGy_WorkStation")]
+ [HttpGet]
+ public object AuditGy_WorkStation(int HInterID, int IsAudit, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkStation_Check", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ ds = oCN.RunProcReturn("select * from Gy_WorkStation where HItemID=" + HInterID, "Gy_WorkStation");
+ if (ds.Tables[0].Rows.Count > 0)
+ {
+ if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ {
+ DataTable t1 = ds.Tables[0];
+ DataRow t2 = t1.Rows[0];
+ bool t3 = ds.Tables[0].Rows[0]["HCheckEmp"] == null;
+ if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ oCN.BeginTran();
+
+ if (IsAudit == 0) //瀹℃牳鍒ゆ柇
+ {
+ oCN.RunProc("update Gy_WorkStation set HCheckEmp='" + CurUserName + "',HCheckDate=getdate() where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsAudit == 1) //鍙嶅鏍稿垽鏂�
+ {
+ oCN.RunProc("update Gy_WorkStation set HCheckEmp='',HCheckDate=null where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶅鏍告垚鍔�";
+ objJsonResult.data = null;
+ }
+ oCN.Commit();
+
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触鎴栬�呭弽瀹℃牳澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
+ #region 宸ヤ綅鍒楄〃绂佺敤銆佸弽绂佺敤
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsStop">绂佺敤(0),鍙嶇鐢�(1)</param>
+ /// <param name="CurUserName">瀹℃牳浜�</param>
+ /// <returns></returns>
+ [Route("Gy_WorkStation/StopGy_WorkStation")]
+ [HttpGet]
+ public object StopGy_WorkStation(int HInterID, int IsStop, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_WorkStation_Stop", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "绂佺敤澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ var ds = oCN.RunProcReturn("select * from Gy_WorkStation where HItemID=" + HInterID, "Gy_WorkStation");
+ 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_WorkStation set HStopEmp='" + CurUserName + "',HStopDate=getdate(),HStopflag=1 where HItemID=" + HInterID);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "绂佺敤鎴愬姛";
+ objJsonResult.data = null;
+ }
+ if (IsStop == 1) //鍙嶇鐢ㄥ垽鏂�
+ {
+ oCN.RunProc("update Gy_WorkStation set HStopEmp='',HStopDate=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 鏍规嵁鍩虹璧勬枡 ID 鎴� 鏉$爜 鏌ユ壘璁板綍
+ [Route("Gy_WorkStationBill/cx1")]
+ [HttpGet]
+ public object cx(long HInterID = -1, string HBarCode = "-1")
+ {
+ try
+ {
+ if(HInterID != -1)
+ {
+ return cx(HInterID);
+ }
+
+ if(HBarCode != "-1")
+ {
+ ds = oCN.RunProcReturn($"select * from h_v_Gy_WorkStationEdit where 宸ヤ綅浠g爜='{HBarCode}'", "h_v_Gy_WorkStationList");
+ if (ds == null || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "false锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+ }else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "false锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
+
#region 鏍规嵁鍩虹璧勬枡ID 鏌ユ壘璁板綍
[Route("Gy_WorkStationBill/cx")]
[HttpGet]
@@ -193,7 +530,7 @@
try
{
- ds = oCN.RunProcReturn("select * from h_v_Gy_WorkStationList where HitemID=" + HInterID, "h_v_Gy_WorkStationList");
+ ds = oCN.RunProcReturn("select * from h_v_Gy_WorkStationEdit where HitemID=" + HInterID, "h_v_Gy_WorkStationList");
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
objJsonResult.code = "0";
--
Gitblit v1.9.1