From 8f19d764f9ce5eea37b25f5392507a0d8ed373f5 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 01 七月 2024 10:16:48 +0800
Subject: [PATCH] 销售订单:多级审批
---
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 221 insertions(+), 10 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index 0e08d65..f6519ae 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -852,7 +852,7 @@
return objJsonResult;
}
- string sql1 = "select top 1000 * from h_v_IF_BarCodeBillList where 1 = 1 ";
+ string sql1 = "select top 5000 * from h_v_IF_BarCodeBillList where 1 = 1 ";
string sql = sql1 + sWhere + " order by hmainid desc";
ds = oCN.RunProcReturn(sql, "h_v_IF_BarCodeBillList");
@@ -938,7 +938,18 @@
objJsonResult.data = null;
return objJsonResult;
}
-
+
+ //杩涜 浼氳鏈熼棿 缁撹处 鐨勫垽鏂拰鎺у埗
+ string s = "";
+ int sYear = 0;
+ int sPeriod = 0;
+ DateTime HDate = DateTime.Now;
+ if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false)
+ {
+ objJsonResult.Message = s;
+ return objJsonResult;
+ }
+
Ds = oCN.RunProcReturn("Select * from h_v_IF_BarCodeBillList Where HItemID in (" + HInterID + ")", "h_v_IF_BarCodeBillList");
if (Ds.Tables[0].Rows.Count != 0)
{
@@ -993,6 +1004,157 @@
}
#endregion
+ #region 鏉$爜涓绘。缁存姢 浣滃簾/鍙嶄綔搴�
+ /// <summary>
+ /// </summary>
+ /// <param name="HInterID">鍗曟嵁ID</param>
+ /// <param name="IsAudit">浣滃簾(0),鍙嶄綔搴�(1)</param>
+ /// <param name="CurUserName">浣滃簾浜�</param>
+ /// <returns></returns>
+ [Route("Gy_BarCodeBillList/DeleteGy_BarCodeBillList")]
+ [HttpGet]
+ public object DeleteGy_BarCodeBillList(int HInterID, int IsAudit, string CurUserName)
+ {
+ string ModRightNameCheck = "Gy_BarCodeBillList_Delete";
+ DBUtility.ClsPub.CurUserName = CurUserName;
+ try
+ {
+ //妫�鏌ユ潈闄�
+ if (!DBUtility.ClsPub.Security_Log_second(ModRightNameCheck, 1, false, CurUserName))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触锛佹棤鏉冮檺锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ //HInterID鏁版嵁鍒ゆ柇
+ if (HInterID <= 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "HInterID灏忎簬0锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+
+ Int64 lngBillKey = 0;
+ lngBillKey = DBUtility.ClsPub.isLong(HInterID); //瀵笻InterID杩涜绫诲瀷鐨勮浆鎹�
+
+ //杩涜闇�瑕佽繘琛岀殑浣滃簾/鍙嶄綔搴熸搷浣�
+ if (IsAudit == 0) //浣滃簾鎻愪氦
+ {
+ oCN.BeginTran();
+
+ //浣滃簾鏉$爜
+ oCN.RunProc("update Gy_BarCodeBill set HStopflag=1,HDeleteMan='" + CurUserName + "',HDeleteDate=getdate() where HItemID in (" + HInterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+
+ string sql = "select * from Gy_BarCodeBill where HItemID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill");
+ if(ds!=null && ds.Tables[0].Rows.Count > 0)
+ {
+ string HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString();
+
+ //娣诲姞鎿嶄綔鏃ュ織
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','浣滃簾鏉$爜锛�" + HBarCode + "','WMS绯荤粺-鏉$爜妗f鍒楄〃妯″潡','" + DBUtility.ClsPub.IPAddress + "','浣滃簾'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣滃簾鎴愬姛";
+ objJsonResult.data = null;
+
+ oCN.Commit();
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+
+ oCN.RollBack();
+ }
+
+
+ return objJsonResult;
+ }
+ if (IsAudit == 1) //鍙嶅叧闂彁浜�
+ {
+ oCN.BeginTran();
+
+ #region 鍙嶄綔搴熸潯鐮佸墠杩涜鍒ゆ柇
+ //鍙嶄綔搴熸潯鐮佸墠杩涜鍒ゆ柇------------------------------------------------------------------------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ DataSet DS = oCN.RunProcReturn("exec h_p_Gy_BarCodeBill_UnCancelltion '" + HInterID + "','N'", "h_p_Gy_BarCodeBill_UnCancelltion", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (DS == null || DS.Tables[0].Rows.Count <= 0)
+ {
+ oCN.RollBack();
+
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐ワ紝鍘熷洜锛氬弽浣滃簾鏉$爜鍓嶅垽鏂彂鐢熼敊璇紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+ {
+ oCN.RollBack();
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐ワ紝鍘熷洜锛�" + DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]);
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ #endregion
+
+ //鍙嶄綔搴熸潯鐮�
+ oCN.RunProc("update Gy_BarCodeBill set HStopflag=0,HDeleteMan='',HDeleteDate=null where HItemID in (" + HInterID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
+
+ //澧炲姞鎿嶄綔鏃ュ織
+ string sql = "select * from Gy_BarCodeBill where HItemID = " + HInterID;
+ ds = oCN.RunProcReturn(sql, "Gy_BarCodeBill");
+ if (ds != null && ds.Tables[0].Rows.Count > 0)
+ {
+ string HBarCode = ds.Tables[0].Rows[0]["HBarCode"].ToString();
+ oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + CurUserName + "','" + DBUtility.ClsPub.ComputerName + "','鍙嶄綔搴熸潯鐮侊細" + HBarCode + "','WMS绯荤粺-鏉$爜妗f鍒楄〃妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍙嶄綔搴�'", ref DBUtility.ClsPub.sExeReturnInfo);
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄綔搴熸垚鍔�";
+ objJsonResult.data = null;
+ oCN.Commit();
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鍙嶄綔搴熷け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+ objJsonResult.data = null;
+ oCN.RollBack();
+ return objJsonResult;
+ }
+ }
+ return objJsonResult;
+ }
+ catch (Exception e)
+ {
+ oCN.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "浣滃簾澶辫触鎴栬�呭弽浣滃簾澶辫触锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+ #endregion
/// <summary>
/// 鏂板妯″叿妗f-淇濆瓨鎸夐挳
@@ -1020,7 +1182,7 @@
return objJsonResult;
}
//淇濆瓨涓昏〃
- objJsonResult = AddBillMain(msg2);
+ objJsonResult = AddBillMain(msg1);
if (objJsonResult.code == "0")
{
oCN.RollBack();
@@ -1037,8 +1199,13 @@
return objJsonResult;
}
- public json AddBillMain(string msg2)
+ public json AddBillMain(string msg1)
{
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();//妯″潡鏉冮檺
+ string msg4 = sArray[2].ToString();//褰撳墠浜�
+ string msg5 = sArray[3].ToString();//瀛愯〃鏁版嵁
try
{
msg2 = "[" + msg2.ToString() + "]";
@@ -1093,7 +1260,8 @@
int HNowSupTypeID = mainList[0].HNowSupTypeID;
int HMadeSupID = mainList[0].HMadeSupID;
string HMouldClass = mainList[0].HMouldClass;
-
+ int HNowWHID = mainList[0].HNowWHID;
+ int HNowSPID = mainList[0].HNowSPID;
//涓昏〃
oCN.RunProc("Insert Into Gy_MouldFileMain " +
@@ -1106,7 +1274,7 @@
",HPrintQty,HMouldStatus,HWhID,HRoutingID,HCaveQty" +
",HBomID,HVersion,HSPGroupID,HSPID,HDesignLife,HNowSupID,HNowSupTypeID" +
",HUseLife,HLeaveLife,HProdQty,HProdWeight,HMouldOWNER,HSaveLife,HMouldDotCheckRuleInterID,HMouldMaintainRuleInterID,HBarCode,HMadeSupID" +
- ",HMouldClass) " +
+ ",HMouldClass,HNowWHID,HNowSPID) " +
" values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + HBillNo + "','" + HDate + "'" +
"," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HMaker + "',getdate()" +
",'" + HMouldNo + "','" + HName + "','" + HModel + "','" + HModel2 + "','" + HDiameter + "'" +
@@ -1116,8 +1284,7 @@
"," + HPrintQty + ",'" + HMouldStatus + "'," + HWHID + "," + HRoutingID + "," + HCaveQty +
"," + HBOMID + ",'" + HVersion + "'," + HSPGroupID + "," + HSPID + ",'" + HDesignLife + "','" + HNowSupID + "','" + HNowSupTypeID + "'" +
",'" + HUseLife + "','" + HLeaveLife + "','" + HProdQty + "','" + HProdWeight + "','" + HMouldOWNER + "','" + HSaveLife + "','" + HMouldDotCheckRuleInterID + "','" + HMouldMaintainRuleInterID + "','" + HBarCode + "'," + HMadeSupID +
- ",'"+ HMouldClass + "') ");
-
+ ",'"+ HMouldClass + "'," + HNowWHID + "," + HNowSPID + ") ");
//瀛愯〃
oCN.RunProc("Insert into Gy_MouldFileSub " +
@@ -1127,6 +1294,8 @@
" values('" + HInterID + "',0,''" +
",0,0,'','',0,0 " +
") ");
+
+ objJsonResult = AddBillSub(msg5,HInterID, HBillNo);
if (objJsonResult.code == "0")
{
@@ -1169,6 +1338,7 @@
string msg2 = sArray[0].ToString();
string msg3 = sArray[1].ToString();//妯″潡鏉冮檺
string msg4 = sArray[2].ToString();//褰撳墠浜�
+ string msg5 = sArray[3].ToString();//瀛愯〃鏁版嵁
try
{
if (!DBUtility.ClsPub.Security_Log(msg3, 1, false, msg4))
@@ -1235,6 +1405,8 @@
int HNowSupTypeID = mainList[0].HNowSupTypeID;
int HMadeSupID = mainList[0].HMadeSupID;
string HMouldClass = mainList[0].HMouldClass;
+ int HNowWHID = mainList[0].HNowWHID;
+ int HNowSPID = mainList[0].HNowSPID;
//鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
oCN.BeginTran();
@@ -1289,13 +1461,19 @@
",HProdWeight=" + HProdWeight.ToString() +
",HBarCode='" + HBarCode.ToString() + "'" +
",HMadeSupID=" + HMadeSupID +
+ ",HNowWHID=" + HNowWHID +
+ ",HNowSPID=" + HNowSPID +
" where HInterID=" + HInterID.ToString());
//淇敼瀛愰」鐩唬鐮�
//oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_Department,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
//灏嗕笂绾� 涓洪潪鏈骇
// oCN.RunProc("Update Gy_Department set HEndflag=0 where HItemID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
- //
+
+ oCN.RunProc("delete from Gy_MouldFileSub_SubMater where HInterID='" + HInterID + "'");
+
+ objJsonResult = AddBillSub(msg5, HInterID, HBillNo);
+
oCN.Commit();
objJsonResult.code = "1";
objJsonResult.count = 1;
@@ -1314,6 +1492,39 @@
}
}
+ public json AddBillSub(string msg5, long HInterID, string HBillNo)
+ {
+ List<Gy_MouldFileSub_SubMater> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_MouldFileSub_SubMater>>(msg5);
+ int i = 0; //浣滀负瀛愯〃鍐呯爜
+ foreach (Gy_MouldFileSub_SubMater oSub in DetailColl)
+ {
+ i++; //鍚屼竴涓富琛ㄤ笅鐨勫瓙琛ㄧ殑鍐呯爜鑷
+
+ int HEntryID = i;
+ string HRemark = oSub.HRemark;
+ int HMouldFileID = oSub.HMouldFileID;
+ DateTime HUnionDate = oSub.HUnionDate;
+
+ string sql = "insert into Gy_MouldFileSub_SubMater" +
+ "(HInterID,HBillNo_bak,HEntryID,HRemark,HMouldFileID,HUnionDate) " +
+ "values(" +
+ "" + HInterID +
+ ",'" + HBillNo +
+ "'," + HEntryID +
+ ",'" + HRemark +
+ "','" + HMouldFileID +
+ "','" + HUnionDate +
+ "')";
+
+ oCN.RunProc(sql);
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = null;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
/// <summary>
/// 纾ㄥ叿妗f淇敼鎸夐挳鏂规硶-璁$畻涓嬫淇濆吇/鏍℃鏃ユ湡-鑾峰彇妗f鏈�杩戜竴娆$殑淇濆吇璁板綍
@@ -1361,7 +1572,7 @@
{
try
{
- ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList where hmainid=" + HInterID, "h_v_Gy_MouldFileList");
+ ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFile_Edit where hmainid=" + HInterID, "h_v_Gy_MouldFile_Edit");
objJsonResult.code = "1";
objJsonResult.count = 1;
--
Gitblit v1.9.1