From 877a3643ea89282775a2a5ca25a2d79fbdfad0b7 Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期四, 05 九月 2024 08:14:56 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs | 359 ++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 240 insertions(+), 119 deletions(-)
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
index f40d94e..f615569 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcExchWorkBackBillController.cs
@@ -279,11 +279,34 @@
return objJsonResult;
}
- bool IsDete = oBill.DeleteBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo);
+ //鍒犻櫎鍓嶆帶鍒�=========================================
+ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+ string sql1 = "exec h_p_Sc_ProcExchWorkBackBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql1, "h_p_Sc_ProcExchWorkBackBill_BeforeDelCtrl");
+ if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:鍒犻櫎鍓嶅垽鏂け璐ワ紝璇蜂笌缃戠粶绠$悊浜哄憳鑱旂郴";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍒犻櫎澶辫触!鍘熷洜:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //==================================================================================
+
+ bool IsDete = oBill.DeleteBill(lngBillKey,HBillNo, "h_p_Sc_ProcExchWorkBackBill_AfterDelCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo);
if (IsDete)
{
- objJsonResult.code = "0";
+ objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
objJsonResult.data = null;
@@ -311,125 +334,125 @@
#endregion
//#region 宸ュ簭杩斿伐鐢宠鍗� 瀹℃牳
- //[Route("Sc_ProcExchWorkBackBill/set_CheckBill")]
- //[HttpGet]
- //public object set_CheckBill(int HInterID, string CurUserName)
- //{
- // try
- // {
- // //瀹℃牳鏉冮檺
- // if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Check", 1, false, CurUserName))
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // if (HInterID == 0)
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
+ [Route("Sc_ProcExchWorkBackBill/set_CheckBill")]
+ [HttpGet]
+ public object set_CheckBill(int HInterID, string CurUserName)
+ {
+ try
+ {
+ //瀹℃牳鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log("Sc_ProcExchWorkBackBill_Check", 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HInterID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
- // DataSet Ds = oCN.RunProcReturn("Select * from Sc_ProcExchWorkBackBillMain Where HInterID=" + HInterID, "Sc_ProcExchWorkBackBillMain");
- // if (Ds.Tables[0].Rows.Count > 0)
- // {
- // //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
- // if (Ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
+ DataSet Ds = oCN.RunProcReturn("Select * from Sc_ProcExchWorkBackBillMain Where HInterID=" + HInterID, "Sc_ProcExchWorkBackBillMain");
+ if (Ds.Tables[0].Rows.Count > 0)
+ {
+ //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+ if (Ds.Tables[0].Rows[0]["HChecker"].ToString() != "")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
- // //瀹℃牳
- // if (Cj_StationInBillCheckBill(HInterID,int.Parse( Ds.Tables[0].Rows[0]["HProcExchInterID"].ToString()), CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
- // {
- // objJsonResult.code = "1";
- // objJsonResult.count = 1;
- // objJsonResult.Message = "瀹℃牳鎴愬姛!";
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
- // else
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
- // objJsonResult.data = null;
- // return objJsonResult;
- // }
+ //瀹℃牳
+ if (Cj_StationInBillCheckBill(HInterID, int.Parse(Ds.Tables[0].Rows[0]["HProcExchInterID"].ToString()), CurUserName, ref DBUtility.ClsPub.sExeReturnInfo))
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "瀹℃牳鎴愬姛!";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
- // }
- // else
- // {
- // objJsonResult.code = "0";
- // objJsonResult.count = 0;
- // 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;
- // }
- //}
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ 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;
+ }
+ }
- ////瀹℃牳
- //public bool Cj_StationInBillCheckBill(Int64 HInterID,int HProcExchInterID, string CurUserName, ref string sReturn)
- //{
- // try
- // {
- // oCN.BeginTran();
- // oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate=getdate() Where HInterID=" + HInterID.ToString());
- // //鍥炲~宸ュ簭娴佽浆鍗�
- // oCN.RunProc("exec h_p_ProcExchWorkBackBill_Check_In " + HInterID.ToString());
- // oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + HProcExchInterID.ToString()); //璁剧疆 澶囨敞 涓� 宸ヨ壓娴�
- // oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + HProcExchInterID.ToString()); //璁剧疆 鏈亾 棣栭亾 杞� 绛変俊鎭� 鍣ㄥ叿娓呭崟 宸ヨ壓鍙傛暟娓呭崟锛�
- // DataSet ds = new DataSet();
- // //璁剧疆鏉$爜鍙� 鍥炲~ 棰嗘枡鎵规
- // ds = oCN.RunProcReturn("exec h_p_Mes_ProcessExchangeBackBarCode " + HProcExchInterID.ToString(), "h_p_Mes_ProcessExchangeBackBarCode");
- // if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
- // {
- // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
- // oCN.RollBack();
- // return false;
- // }
+ //瀹℃牳
+ public bool Cj_StationInBillCheckBill(Int64 HInterID, int HProcExchInterID, string CurUserName, ref string sReturn)
+ {
+ try
+ {
+ oCN.BeginTran();
+ oCN.RunProc(" Update Sc_ProcExchWorkBackBillMain set HChecker='" + CurUserName + "',HBillStatus=2,HCheckDate=getdate() Where HInterID=" + HInterID.ToString());
+ //鍥炲~宸ュ簭娴佽浆鍗�
+ oCN.RunProc("exec h_p_ProcExchWorkBackBill_Check_In " + HInterID.ToString());
+ oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetRemark " + HProcExchInterID.ToString()); //璁剧疆 澶囨敞 涓� 宸ヨ壓娴�
+ oCN.RunProc("exec h_p_Sc_ProcessExchangeBill_SetUpdate " + HProcExchInterID.ToString()); //璁剧疆 鏈亾 棣栭亾 杞� 绛変俊鎭� 鍣ㄥ叿娓呭崟 宸ヨ壓鍙傛暟娓呭崟锛�
+ DataSet ds = new DataSet();
+ //璁剧疆鏉$爜鍙� 鍥炲~ 棰嗘枡鎵规
+ ds = oCN.RunProcReturn("exec h_p_Mes_ProcessExchangeBackBarCode " + HProcExchInterID.ToString(), "h_p_Mes_ProcessExchangeBackBarCode");
+ if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+ {
+ sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
+ oCN.RollBack();
+ return false;
+ }
- // //鎺у埗鍏宠仈鏁伴噺
- // ds = null;
- // ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + HProcExchInterID.ToString(), "h_p_Sc_ProcessExchangeBill_Checkqty");
- // if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
- // {
- // sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
- // oCN.RollBack();
- // return false;
- // }
- // oCN.Commit();
- // return true;
- // }
- // catch (Exception e)
- // {
- // sReturn = e.Message;
- // oCN.RollBack();
- // return false; ;
- // }
- //}
+ //鎺у埗鍏宠仈鏁伴噺
+ ds = null;
+ ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBill_Checkqty " + HProcExchInterID.ToString(), "h_p_Sc_ProcessExchangeBill_Checkqty");
+ if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
+ {
+ sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString();
+ oCN.RollBack();
+ return false;
+ }
+ oCN.Commit();
+ return true;
+ }
+ catch (Exception e)
+ {
+ sReturn = e.Message;
+ oCN.RollBack();
+ return false; ;
+ }
+ }
//#endregion
- #region 宸ヨ壓璺嚎瀹℃牳/鍙嶅鏍稿姛鑳�
+ #region 宸ュ簭杩斿伐鐢宠鍗� 瀹℃牳/鍙嶅鏍稿姛鑳�
[Route("Sc_ProcExchWorkBackBill/CheckSc_ProcExchWorkBackBill")]
[HttpGet]
public object CheckSc_ProcExchWorkBackBill(string HInterID, int Type, string user)
@@ -477,8 +500,32 @@
return objJsonResult;
}
}
+
+
+ //瀹℃牳鍓嶆帶鍒�
+ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+ sql = "exec h_p_Sc_ProcExchWorkBackBill_BeforeCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchWorkBackBill_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;
+ 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.CheckBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ if (!BillOld.CheckBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchWorkBackBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
objJsonResult.code = "0";
objJsonResult.count = 1;
@@ -504,8 +551,31 @@
return objJsonResult;
}
}
+
+ //鍙嶅鏍稿墠鎺у埗
+ string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
+ sql = "exec h_p_Sc_ProcExchWorkBackBill_BeforeUnCheckCtrl " + int.Parse(HInterID) + ",'" + HBillNo + "','" + user + "'";
+ ds = oCN.RunProcReturn(sql, "h_p_Sc_ProcExchWorkBackBill_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(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
+ if (BillOld.AbandonCheck(Int64.Parse(HInterID), HBillNo, "h_p_Sc_ProcExchWorkBackBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo))
{
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
//DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl");
@@ -665,7 +735,7 @@
DataTable dt2 = new DataTable("DataColor");
List<object> columnNameList = new List<object>();
- string sql = "exec h_p_SingleRowWall "+ sWhere;
+ string sql = "exec h_p_Sc_SingleRowWall " + sWhere;
ds = oCN.RunProcReturn(sql, "DataSouce");
//娣诲姞鍒楀悕
@@ -678,7 +748,8 @@
columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
}
- if (ds.Tables.Count == 2) {
+ if (ds.Tables.Count == 2)
+ {
int[] num2 = new int[ds.Tables[0].Columns.Count];//璁板綍姣忎竴鍒楄幏鍙栨湁鍊肩殑琛屾暟
@@ -766,7 +837,7 @@
}
}
}
- if (num == ds.Tables[0].Columns.Count||i==3)
+ if (num == ds.Tables[0].Columns.Count)
{
break;
}
@@ -776,7 +847,57 @@
ds.Tables.Clear();
ds.Tables.Add(dt1);
ds.Tables.Add(dt2);
- }
+ }
+ else {
+ int[] num2 = new int[ds.Tables[0].Columns.Count];//璁板綍姣忎竴鍒楄幏鍙栨湁鍊肩殑琛屾暟
+
+ for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+ {
+ int num = 0;//璁板綍娌℃湁鏁版嵁琛岀殑鍒楁暟
+ int[] num3 = new int[ds.Tables[0].Columns.Count];//璁板綍姣忎竴鍒楁病鏈夋暟鎹殑琛屾暟
+
+ DataRow dtrow = dt1.NewRow();
+ for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
+ {
+ int num1 = 0;//璁板綍鏈夊灏戞婊¤冻涓嶄负绌虹殑鏉′欢
+ DataColumn col = ds.Tables[0].Columns[j];
+ for (int k = 0; k < ds.Tables[0].Rows.Count; k++)
+ {
+ DataRow item = ds.Tables[0].Rows[k];
+ if (item[col.ColumnName.ToString()].ToString() != "")
+ {
+ num1 += 1;
+ if (num1 > num2[j])
+ {
+ dtrow[col.ColumnName.ToString()] = item[col.ColumnName.ToString()].ToString();
+ num2[j] += 1;
+ break;
+ }
+ else
+ {
+ num3[j] += 1;
+ }
+ }
+ else
+ {
+ num3[j] += 1;
+ }
+ if (num3[j] == ds.Tables[0].Rows.Count)
+ {
+ num += 1;
+ }
+ }
+ }
+ if (num == ds.Tables[0].Columns.Count)
+ {
+ break;
+ }
+ dt1.Rows.Add(dtrow);
+ }
+
+ ds.Tables.Clear();
+ ds.Tables.Add(dt1);
+ }
objJsonResult.code = "1";
objJsonResult.count = 1;
--
Gitblit v1.9.1