From e6e805f9c46f41b50f4a556732f618ffdb7b4e69 Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期二, 18 三月 2025 15:35:31 +0800 Subject: [PATCH] 生产领料单 --- WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs | 532 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 473 insertions(+), 59 deletions(-) diff --git a/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs b/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs index e0df0f0..999c60d 100644 --- a/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs +++ b/WebAPI/Controllers/MJGL/Sc_MouldUpperBillController.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json; using Model; using DBUtility; +using SyntacticSugar.constant; namespace WebAPI.Controllers.MJGL { @@ -65,6 +66,119 @@ return objJsonResult; } } + #endregion + + #region 涓婃ā鍗� 鍒楄〃鍒嗛〉鏌ヨ + [Route("Sc_MouldUpperBill/Sc_MouldUpperBillListPage")] + [HttpGet] + public object Sc_MouldUpperBillListPage(string sWhere, string user, int page, int size) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldUpperBill_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + sWhere = sWhere.Replace("'", "''"); + ds = oCN.RunProcReturn("exec h_p_Sc_MouldUpperBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldUpperBillList"); + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓婃ā鍗� 淇濆瓨鍓嶃�佷繚瀛樺悗鎺у埗 + + //淇濆瓨鍓嶆帶鍒� + public json BeforeSave_MouldUpperBill(Int64 HInterID, string HBillNo, Int64 OperationType) + { + DataSet BeforeSave = oCN.RunProcReturn("Exec h_p_Sc_MouldUpperBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldUpperBill_BeforeSaveCtrl"); + if (BeforeSave == null || BeforeSave.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else if (DBUtility.ClsPub.isLong(BeforeSave.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; //澶辫触锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; //鎴愬姛锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + + //淇濆瓨鍚庢帶鍒� + public json AfterSave_MouldUpperBill(Int64 HInterID, string HBillNo, Int64 OperationType) + { + DataSet AfterSave = oCN.RunProcReturn("Exec h_p_Sc_MouldUpperBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldUpperBill_AfterSaveCtrl"); + if (AfterSave == null || AfterSave.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else if (DBUtility.ClsPub.isLong(AfterSave.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; //澶辫触锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; //鎴愬姛锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion #region 涓婃ā鍗� 鏂板 @@ -136,6 +250,16 @@ if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//鏂板 { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } //涓昏〃 oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate @@ -147,7 +271,18 @@ } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) - { //淇敼 + { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + //淇敼 oCN.RunProc("update Sc_MouldUpperBillMain set " + "HDate='" + HDate + "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + @@ -157,7 +292,7 @@ oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub(msg3, HInterID, HBillNo); + objJsonResult = AddBillSub(msg3, HInterID, HBillNo, OperationType); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -183,7 +318,7 @@ } } - public json AddBillSub(string msg3, long HInterID,string HBillNo) + public json AddBillSub(string msg3, long HInterID,string HBillNo, Int64 OperationType) { List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg3); int i = 0; @@ -200,6 +335,32 @@ "') "); } + if (OperationType == 1)//鏂板 + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = null; @@ -746,6 +907,119 @@ } #endregion + #region 涓嬫ā鍗� 鍒楄〃鍒嗛〉鏌ヨ + [Route("Sc_MouldUpperBill/Sc_MouldLowerBillListPage")] + [HttpGet] + public object Sc_MouldLowerBillListPage(string sWhere, string user, int page, int size) + { + try + { + List<object> columnNameList = new List<object>(); + + //鏌ョ湅鏉冮檺 + if (!DBUtility.ClsPub.Security_Log("Sc_MouldLowerBill_Query", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + + sWhere = sWhere.Replace("'", "''"); + ds = oCN.RunProcReturn("exec h_p_Sc_MouldLowerBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_MouldLowerBillList"); + + //娣诲姞鍒楀悕 + 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鍒楀璞$殑鍒楀悕 + } + + + objJsonResult.code = CodeConstant.SUCCEED; + objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + objJsonResult.list = columnNameList; + return objJsonResult; + } + catch (Exception ex) + { + objJsonResult.code = CodeConstant.FAIL; + objJsonResult.count = CountConstant.FAIL; + objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + ex.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + + #region 涓嬫ā鍗� 淇濆瓨鍓嶃�佷繚瀛樺悗鎺у埗 + + //淇濆瓨鍓嶆帶鍒� + public json BeforeSave_MouldLowerBill(Int64 HInterID, string HBillNo, Int64 OperationType) + { + DataSet BeforeSave = oCN.RunProcReturn("Exec h_p_Sc_MouldLowerBill_BeforeSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldLowerBill_BeforeSaveCtrl"); + if (BeforeSave == null || BeforeSave.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍓嶅垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else if (DBUtility.ClsPub.isLong(BeforeSave.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; //澶辫触锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; //鎴愬姛锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(BeforeSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + + //淇濆瓨鍚庢帶鍒� + public json AfterSave_MouldLowerBill(Int64 HInterID, string HBillNo, Int64 OperationType) + { + DataSet AfterSave = oCN.RunProcReturn("Exec h_p_Sc_MouldLowerBill_AfterSaveCtrl " + HInterID.ToString() + ",'" + HBillNo + "'," + OperationType.ToString(), "h_p_Sc_MouldLowerBill_AfterSaveCtrl"); + if (AfterSave == null || AfterSave.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨鍚庡垽鏂け璐ワ紒"; + objJsonResult.data = null; + return objJsonResult; + } + else if (DBUtility.ClsPub.isLong(AfterSave.Tables[0].Rows[0]["HBack"]) == 1) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; //澶辫触锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; //鎴愬姛锛� + objJsonResult.Message = DBUtility.ClsPub.isStrNull(AfterSave.Tables[0].Rows[0]["HRemark"]); + objJsonResult.data = null; + return objJsonResult; + } + } + + #endregion + #region 涓嬫ā鍗� 鏂板 /// <summary> /// 鏂板鍗曟嵁-淇濆瓨鎸夐挳 @@ -815,6 +1089,16 @@ if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//鏂板 { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } //涓昏〃 oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate @@ -826,7 +1110,18 @@ } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) - { //淇敼 + { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + //淇敼 oCN.RunProc("update Sc_MouldLowerBillMain set " + "HDate='" + HDate + "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + @@ -836,7 +1131,7 @@ oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddMouldLowerBill(msg3, HInterID, HBillNo); + objJsonResult = AddMouldLowerBill(msg3, HInterID, HBillNo, OperationType); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -862,7 +1157,7 @@ } } - public json AddMouldLowerBill(string msg3, long HInterID, string HBillNo) + public json AddMouldLowerBill(string msg3, long HInterID, string HBillNo, Int64 OperationType) { List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg3); int i = 0; @@ -879,6 +1174,32 @@ "') "); } + if (OperationType == 1)//鏂板 + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = null; @@ -1375,11 +1696,46 @@ } #endregion + #region 涓嬫ā鍗曟煡璇笂妯″崟淇℃伅 鍒楄〃鏌ヨ + [Route("Sc_MouldLowerBill/Sc_MouldUpperBillList")] + [HttpGet] + public object Sc_MouldUpperBillList(string sWhere) + { + try + { + + ds = oCN.RunProcReturn("select * from h_v_Qj_Sc_MouldUpperBillList where 1=1" + sWhere, "h_v_Qj_Sc_MouldUpperBillList"); + + 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; + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "Sucess锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion #region 涓�/涓嬫ā鍗曡幏鍙栨潯鐮佷俊鎭� [Route("Sc_MouldUpperBill/txtHBarCode_KeyDown")] [HttpGet] - public object txtHBarCode_KeyDown(string HBarCode, string UserID, string HBillType) + public object txtHBarCode_KeyDown(string HBarCode,int HSourceID, string UserID, string HBillType) { try { @@ -1392,58 +1748,22 @@ return objJsonResult; } - //鎷嗗垎鏉″舰鐮� - string sBillBarCode = HBarCode.Trim(); - - - //鎴彇鏉$爜绫诲瀷2 鍓嶄袱浣� - string BillNoType2 = sBillBarCode.Substring(0, Math.Min(2, sBillBarCode.Length)); - //鎴彇鏉$爜绫诲瀷 鍓嶄笁浣� - string BillNoType3 = sBillBarCode.Substring(0, Math.Min(3, sBillBarCode.Length)); - //鎴彇鏉$爜绫诲瀷3 鍓嶅洓浣� - string BillNoType4 = sBillBarCode.Substring(0, Math.Min(4, sBillBarCode.Length)); - - - switch (BillNoType2) - { - //鐢熶骇璧勬簮 - case "BM": - case "SS": - ds = oCN.RunProcReturn("select HItemID,HName,HNumber from Gy_Source where HNumber = '" + HBarCode + "'", "Gy_Source"); - break; - case "MO": - ds = oCN.RunProcReturn("select 鍗曟嵁鍙�,hmainid,HEntryID from h_v_IF_ICMOBillList where 鍗曟嵁鍙� = '" + HBarCode + "'", "h_v_IF_ICMOBillList"); - break; - default: - break; - } - - switch (BillNoType3) - { - //鍣ㄥ叿妗f - case "MJD": - case "PAK": - ds = oCN.RunProcReturn("select * from h_v_Gy_MouldFileList where 鍗曟嵁鍙� = '" + HBarCode + "'", "h_v_Gy_MouldFileList"); - break; - default: - break; - } - - switch (BillNoType4) - { - //娴佽浆鍗� - case "GXLX": - ds = oCN.RunProcReturn("select 浠诲姟鍗曞彿,hicmointerid,HICMOEntryID,鍗曟嵁鍙�,hmainid,HEntryID from h_v_Sc_ProcessExchangeBillQuerySub where 鍗曟嵁鍙� = '" + HBarCode + "'", "h_v_Sc_ProcessExchangeBillQuerySub"); - break; - default: - break; - } + ds = oCN.RunProcReturn("exec h_p_Sc_AllowLoadData '" + HBarCode + "','"+ HSourceID + "','"+ HBillType + "'", "h_p_Sc_AllowLoadData"); 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 (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "淇濆瓨澶辫触锛�" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); objJsonResult.data = null; return objJsonResult; } @@ -1533,6 +1853,16 @@ if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//鏂板 { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } //涓昏〃 oCN.RunProc(@"Insert Into Sc_MouldUpperBillMain (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate @@ -1544,7 +1874,18 @@ } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) - { //淇敼 + { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldUpperBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + //淇敼 oCN.RunProc("update Sc_MouldUpperBillMain set " + "HDate='" + HDate + "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + @@ -1554,7 +1895,7 @@ oCN.RunProc("delete from Sc_MouldUpperBillSub where HInterID='" + HInterID + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddBillSub_PDA(msg2, HInterID, HBillNo); + objJsonResult = AddBillSub_PDA(msg2, HInterID, HBillNo, OperationType); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -1580,7 +1921,7 @@ } } - public json AddBillSub_PDA(string msg2, long HInterID, string HBillNo) + public json AddBillSub_PDA(string msg2, long HInterID, string HBillNo, Int64 OperationType) { List<ClsSc_MouldUpperBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldUpperBillSub>>(msg2); int i = 0; @@ -1600,6 +1941,32 @@ + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') "); } + if (OperationType == 1)//鏂板 + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldUpperBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = null; @@ -1677,6 +2044,16 @@ if ((OperationType == 1) && ds.Tables[0].Rows.Count == 0)//鏂板 { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } //涓昏〃 oCN.RunProc(@"Insert Into Sc_MouldLowerBillMain (HBillType,HBillStatus, HBillSubType, HInterID, HBillNo, HDate @@ -1688,7 +2065,18 @@ } else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) - { //淇敼 + { + //淇濆瓨鍓嶆帶鍒� + objJsonResult = BeforeSave_MouldLowerBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + //淇敼 oCN.RunProc("update Sc_MouldLowerBillMain set " + "HDate='" + HDate + "',HYear='" + HYear + "',HPeriod='" + HPeriod + "',HRemark='" + HRemark + "',hupdater='" + HMaker + @@ -1698,7 +2086,7 @@ oCN.RunProc("delete from Sc_MouldLowerBillSub where HInterID='" + HInterID + "'"); } //淇濆瓨瀛愯〃 - objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, HBillNo); + objJsonResult = AddSc_MouldLowerBillSub_PDA(msg2, HInterID, HBillNo, OperationType); if (objJsonResult.code == "0") { objJsonResult.code = "0"; @@ -1724,7 +2112,7 @@ } } - public json AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo) + public json AddSc_MouldLowerBillSub_PDA(string msg2, long HInterID, string HBillNo, Int64 OperationType) { List<ClsSc_MouldLowerBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_MouldLowerBillSub>>(msg2); int i = 0; @@ -1744,6 +2132,32 @@ + ",'" + oSub.HScanDate.ToString() + "','" + oSub.HMouldNumber.ToString() + "') "); } + if (OperationType == 1)//鏂板 + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 1); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } + else + { + //淇濆瓨鍚庢帶鍒� + objJsonResult = AfterSave_MouldLowerBill(HInterID, HBillNo, 2); + if (objJsonResult.count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = objJsonResult.Message; + objJsonResult.data = null; + return objJsonResult; + } + } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = null; -- Gitblit v1.9.1