From 2a123c42eab1784b04d6bb50f56aef76c2d27377 Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期四, 18 七月 2024 09:41:16 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/BaseSet/Gy_MaterialController.cs | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 154 insertions(+), 12 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs index 7963b8a..1974dc8 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) { @@ -1145,6 +1156,34 @@ } #endregion + #region[鍣ㄥ叿妗f缂栬緫鏃惰幏鍙栧瓙琛ㄦ暟鎹甝 + [Route("Gy_MouldFileMain/Gy_MouldFileSubDetai")] + [HttpGet] + public object Gy_MouldFileSubDetai(long HInterID) + { + try + { + List<DataTable> tableList = new List<DataTable>(); + ds = oCN.RunProcReturn("select a.*,b.HBillNo from Gy_MouldFileSub_MaintainRule AS a left join Sc_MouldMaintainRuleBillMain as b on b.HInterID = a.HMaintainRuleID where a.HInterID = " + HInterID, "Gy_MouldFileBill_MaintainRule"); + tableList.Add(ds.Tables[0]); + ds = oCN.RunProcReturn("select a.*,b.HBillNo from Gy_MouldFileSub_DotCheckRule AS a left join Sc_MouldDotCheckRuleBillMain as b on b.HInterID = a.HDotCheckRuleID where a.HInterID = " + HInterID, "Gy_MouldFileBill_DotCheckRule"); + tableList.Add(ds.Tables[0]); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = ""; + objJsonResult.data = tableList; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion /// <summary> /// 鏂板妯″叿妗f-淇濆瓨鎸夐挳 ///鍙傛暟锛歴tring sql銆� @@ -1171,10 +1210,9 @@ return objJsonResult; } //淇濆瓨涓昏〃 - objJsonResult = AddBillMain(msg2); + objJsonResult = AddBillMain(msg1); if (objJsonResult.code == "0") { - oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = objJsonResult.Message; @@ -1188,8 +1226,15 @@ 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();//瀛愯〃鏁版嵁 + string msg6 = sArray[4].ToString();//瀛愯〃1鏁版嵁 + string msg7 = sArray[5].ToString();//瀛愯〃2鏁版嵁 try { msg2 = "[" + msg2.ToString() + "]"; @@ -1244,7 +1289,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 " + @@ -1257,7 +1303,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 + "'" + @@ -1267,8 +1313,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 " + @@ -1278,6 +1323,8 @@ " values('" + HInterID + "',0,''" + ",0,0,'','',0,0 " + ") "); + + objJsonResult = AddBillSub(msg5,msg6,msg7,HInterID, HBillNo); if (objJsonResult.code == "0") { @@ -1296,6 +1343,7 @@ } catch (Exception e) { + oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception锛�" + e.ToString(); @@ -1320,6 +1368,9 @@ string msg2 = sArray[0].ToString(); string msg3 = sArray[1].ToString();//妯″潡鏉冮檺 string msg4 = sArray[2].ToString();//褰撳墠浜� + string msg5 = sArray[3].ToString();//瀛愯〃鏁版嵁 + string msg6 = sArray[4].ToString();//瀛愯〃2鏁版嵁 + string msg7 = sArray[5].ToString();//瀛愯〃3鏁版嵁 try { if (!DBUtility.ClsPub.Security_Log(msg3, 1, false, msg4)) @@ -1386,6 +1437,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(); @@ -1440,13 +1493,20 @@ ",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 + "'"); + oCN.RunProc("delete from Gy_MouldFileSub_MaintainRule where HInterID='" + HInterID + "'"); + oCN.RunProc("delete from Gy_MouldFileSub_DotCheckRule where HInterID='" + HInterID + "'"); + objJsonResult = AddBillSub(msg5, msg6, msg7, HInterID, HBillNo); + oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; @@ -1465,6 +1525,86 @@ } } + public json AddBillSub(string msg5, string msg6, string msg7, long HInterID, string HBillNo) + { + List<Gy_MouldFileSub_SubMater> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Gy_MouldFileSub_SubMater>>(msg5); + List<ClsGy_MouldFileBillSub_MaintainRule> MaintainRuleColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_MouldFileBillSub_MaintainRule>>(msg6); + + List<ClsGy_MouldFileBillSub_DotCheckRule> DotCheckRuleColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsGy_MouldFileBillSub_DotCheckRule>>(msg7); + 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); + } + i = 0; + //淇濆瓨淇濆吇瑙勬牸 + foreach (ClsGy_MouldFileBillSub_MaintainRule oSub in MaintainRuleColl) + { + i++; + Int64 NewHEntryID = i; + Int64 newHFlag = 1; + if (oSub.HStdFlag == true) + { + newHFlag = 1; + } + else + { + newHFlag = 0; + } + oCN.RunProc($@"Insert into Gy_MouldFileSub_MaintainRule + (HInterID,HBillNo_bak,HEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney, + HMaintainRuleID,HStdFlag + ) + values({HInterID},'{HBillNo}',{NewHEntryID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney} + ,{oSub.HMaintainRuleID},{newHFlag})"); + } + i = 0; + //淇濆瓨鐐规瑙勭▼ + foreach (ClsGy_MouldFileBillSub_DotCheckRule oSub in DotCheckRuleColl) + { + i++; + Int64 NewHEntryID = i; + Int64 newHFlag = 1; + if (oSub.HStdFlag == true) + { + newHFlag = 1; + } + else + { + newHFlag = 0; + } + oCN.RunProc($@"Insert into Gy_MouldFileSub_DotCheckRule + (HInterID,HBillNo_bak,HEntryID,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney, + HDotCheckRuleID,HStdFlag + ) + values({HInterID},'{HBillNo}',{NewHEntryID},'{oSub.HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{oSub.HSourceBillNo}','{oSub.HSourceBillType}',{oSub.HRelationQty},{oSub.HRelationMoney} + ,{oSub.HDotCheckRuleID},{newHFlag})"); + } + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = null; + objJsonResult.data = null; + return objJsonResult; + } /// <summary> /// 纾ㄥ叿妗f淇敼鎸夐挳鏂规硶-璁$畻涓嬫淇濆吇/鏍℃鏃ユ湡-鑾峰彇妗f鏈�杩戜竴娆$殑淇濆吇璁板綍 @@ -1512,7 +1652,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; @@ -1552,6 +1692,8 @@ } if (oBill.DeleteBill(hmainid, ref DBUtility.ClsPub.sExeReturnInfo)) { + oCN.RunProc("Delete From Gy_MouldFileSub_MaintainRule where HInterID=" + hmainid); + oCN.RunProc("Delete From Gy_MouldFileSub_DotCheckRule where HInterID=" + hmainid); //鍐欏叆鏃ュ織 ClsPub.Add_Log("", "鍒犻櫎椤圭洰锛屼唬鐮侊細" + oBill.omodel.HMouldNo + ",鍚嶇О锛�" + oBill.omodel.HName, ClsPub.CurUserName); //鏇存柊涓婄骇涓� 鏈骇 @@ -1809,7 +1951,7 @@ ,HPERUNITSTANDHOUR,HSTDLABORPREPARETIME,HSTDMACHINEPREPARETIME ) values - ({jsonData.HItemID},{jsonData.HERPItemID},'{jsonData.HNumber}','{jsonData.HName}','{jsonData.HModel}', + ({jsonData.HItemID},{jsonData.HItemID},'{jsonData.HNumber}','{jsonData.HName}','{jsonData.HModel}', '{jsonData.HShortNumber}',{jsonData.HParentID},{jsonData.HLevel},{jsonData.HEndFlag},{jsonData.HStopflag},'{jsonData.HRemark}',{jsonData.HMaterClsID},{jsonData.HUnitID},{jsonData.HUnitGroupID},{jsonData.HLength},{jsonData.HWidth},{jsonData.HHeight},{jsonData.HJQty},{jsonData.HMQty},'{jsonData.HOldMaterNumber}',{jsonData.HWHID},{jsonData.HSPID},'{jsonData.HPlanMode}','{jsonData.HUseFlag}','{jsonData.HMakeTime}',{jsonData.HMinPickQty},{jsonData.HCREATEORGID},{jsonData.HUSEORGID},'{jsonData.HBatchManager}',{jsonData.HCHECKINCOMING},{jsonData.HAuxPropFlag},{jsonData.HISKFPERIOD},{jsonData.HAuxUnitID},{jsonData.HSNUnitID},{jsonData.HBASEUNITID},{jsonData.HSALEUNITID},{jsonData.HSALEPRICEUNITID},{jsonData.HPERUNITSTANDHOUR},'{jsonData.HSTDLABORPREPARETIME}','{jsonData.HSTDMACHINEPREPARETIME}')"; oCN.RunProc(sql); -- Gitblit v1.9.1