From 45c1541ca7d2ac7cdfebae0d08fdbc771ca37a41 Mon Sep 17 00:00:00 2001 From: zrg <z18737863051@163.com> Date: 星期一, 05 八月 2024 17:14:26 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- DBUtility/业务单据/ClsXt_BaseBill.cs | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 160 insertions(+), 0 deletions(-) diff --git "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" index 49c0bc3..e0c2dd0 100644 --- "a/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" +++ "b/DBUtility/\344\270\232\345\212\241\345\215\225\346\215\256/ClsXt_BaseBill.cs" @@ -372,6 +372,166 @@ } } + //鍙戣捣澶氱骇瀹℃壒 + public bool startCheckFlow(Int64 lngBillKey, Int64 HCheckFlowID_select, ref string sReturn) + { + try + { + string HBillNo = ""; //鍗曟嵁鍙� + string HCheckFlowID = ""; //瀹℃壒娴両D + string HCheckItemNowID = ""; //褰撳墠瀹℃牳椤圭洰ID + string HCheckItemNextID = ""; //寰呭鏍搁」鐩甀D + + //鍒ゆ柇鏄惁宸茬粡鍙戣捣瀹℃壒 + string sql0 = "select * from Xt_BillCheckFlowStatus where HBillInterID = " + lngBillKey + " and HBillTypeID = '" + this.BillType + "'"; + DataSet ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus"); + if (ds0 != null && ds0.Tables[0].Rows.Count > 0) + { + sReturn = "鍗曟嵁宸插彂璧峰鎵癸紝涓嶅彲閲嶅瀹℃壒锛�"; + return false; + } + + //鑾峰彇鍗曟嵁鏁版嵁 + string sql = "select * from " + this.MvarItemKey + " where HInterID = " + lngBillKey; + DataSet ds = oCn.RunProcReturn(sql, this.MvarItemKey); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁涓嶅瓨鍦紒"; + return false; + } + HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); + + //鑾峰彇鍗曟嵁绫诲瀷瀵瑰簲鐨勯粯璁ゅ鎵规祦 + string sql1 = "select b.HInterID,b.HCheckItemID from Xt_CheckFlowMain as a " + + "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " + + "where a.HBillTypeID = '" + this.BillType + "' " + + "and a.HInterID = " + HCheckFlowID_select + " " + + "order by b.HFlowNo asc"; + DataSet ds1 = oCn.RunProcReturn(sql1, "Xt_CheckFlowMain"); + if (ds1 == null || ds1.Tables[0].Rows.Count == 0) + { + sReturn = "榛樿瀹℃壒娴佷笉瀛樺湪锛�"; + return false; + } + + HCheckFlowID = ds1.Tables[0].Rows[0]["HInterID"].ToString(); + HCheckItemNowID = ds1.Tables[0].Rows[0]["HCheckItemID"].ToString(); + if (ds1.Tables[0].Rows.Count >= 2) + { + HCheckItemNextID = ds1.Tables[0].Rows[1]["HCheckItemID"].ToString(); + } + else + { + HCheckItemNextID = "0"; + } + + oCn.BeginTran(); + //澧炲姞 鍗曟嵁瀹℃壒鐘舵�佽〃 鏁版嵁 + for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) + { + string sql2 = "insert into Xt_BillCheckFlowStatus" + + "(HBillTypeID,HBillInterID,HBillNo,HCheckFlowID,HCheckItemID,HChecker,HCheckDate,HCheckNote) " + + "values(" + + "'" + this.BillType + "'," + + "" + lngBillKey + "," + + "'" + HBillNo + "'," + + "" + ds1.Tables[0].Rows[i]["HInterID"].ToString() + "," + + "" + ds1.Tables[0].Rows[i]["HCheckItemID"].ToString() + "," + + "" + "''" + "," + + "" + "''" + "," + + "" + "''" + "" + + ")"; + + oCn.RunProc(sql2); + } + + //鏇存柊涓昏〃 瀹℃壒娴� 鏁版嵁 + string sql3 = "update " + this.MvarItemKey + " set HCheckFlowID = " + HCheckFlowID + ",HCheckItemNowID=" + HCheckItemNowID + ",HCheckItemNextID=" + HCheckItemNextID + ",HBillStatus=" + 6 + " where HInterID = " + lngBillKey; + oCn.RunProc(sql3); + + + oCn.Commit(); + + return true; + } + catch (Exception e) + { + sReturn += e.Message; + return false; + } + } + + //椹冲洖 + public bool RejectCheckFlowProgress(Int64 lngBillKey, string HBillNo,string sUser, ref string sReturn) + { + + if (isUse(lngBillKey, ref sReturn)) + { + return false; + } + try + { + //寮�鍚簨鍔� + oCn.BeginTran(); + + //鍒ゆ柇鏄惁瀛樺湪瀹℃牳杩囩殑椤圭洰 + string sql0 = "select * from Xt_BillCheckFlowStatus where HBillInterID = " + lngBillKey + " and HBillTypeID = '" + this.BillType + "' and ISNULL(HChecker,'') <> ''"; + DataSet ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus"); + if (ds0 != null && ds0.Tables[0].Rows.Count == 0) + { + sReturn = "鍗曟嵁涓嶅瓨鍦ㄥ凡缁忓鏍哥殑椤圭洰锛�"; + return false; + } + + //鑾峰彇闇�瑕侀┏鍥炵殑瀹℃牳椤圭洰 + sql0 = "select c.* from Xt_CheckFlowMain as a " + + "inner join Xt_CheckFlowSub as b on a.HInterID = b.HInterID " + + "inner join Xt_BillCheckFlowStatus as c on a.HBillTypeID = c.HBillTypeID and b.HCheckItemID = c.HCheckItemID " + + "where c.HBillTypeID = '" + this.BillType + "' and c.HBillInterID = " + lngBillKey + " " + + "order by b.HFlowNo asc"; + ds0 = oCn.RunProcReturn(sql0, "Xt_BillCheckFlowStatus"); + if (ds0 == null || ds0.Tables[0].Rows.Count == 0) + { + sReturn = "椹冲洖澶辫触!鍘熷洜:鏈彂璧峰鎵癸紒锛�"; + return false; + } + //鑾峰彇褰撳墠瀹℃牳椤圭洰 + string HCheckFlowID = ds0.Tables[0].Rows[0]["HCheckFlowID"].ToString(); //瀹℃壒娴佸唴鐮� + sql0 = "select * from " + MvarItemKey + " where HInterID = " + lngBillKey; + ds0 = oCn.RunProcReturn(sql0, MvarItemKey); + string HCheckItemNowID = ds0.Tables[0].Rows[0]["HCheckItemNowID"].ToString(); //褰撳墠瀹℃壒椤圭洰鍐呯爜 + //鏌ユ壘鏄惁鏈夋潈闄� + string sql01 = "select * from Xt_CheckUserRight where HUserID = '" + sUser + "' and HCheckFlowInterID = " + HCheckFlowID + " and HCheckItemID = " + HCheckItemNowID + ""; + DataSet ds01 = oCn.RunProcReturn(sql01, "Xt_CheckUserRight"); + if (ds01.Tables[0].Rows.Count == 0) + { + sReturn = "鏃犳潈闄愶紒"; + return false; + } + //鏇存柊 椹冲洖鍒犻櫎瀹℃牳娴佺姸鎬佽〃 + string sql02 = "Delete Xt_BillCheckFlowStatus where HBillTypeID = '" + this.BillType + "' and HBillInterID=" + lngBillKey + " and HCheckFlowID=" + HCheckFlowID; + oCn.RunProc(sql02); + oCn.RunProc(" Update " + MvarItemKey + " set HChecker='',HCheckDate=null,HBillStatus=5 Where HInterID=" + lngBillKey.ToString()); + + //鍐欏叆鏃ュ織 + string WorkList = "椹冲洖鍗曟嵁锛屽崟鎹彿锛�" + HBillNo; + string SystemName = "LMES-" + MvarReportTitle + "妯″潡"; + oCn.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + sUser + "','" + ComputerName + "','" + WorkList + "','" + SystemName + "','" + IPAddress + "','椹冲洖')" + ); + + sReturn = "鍙嶅鏍稿崟鎹垚鍔燂紒"; + oCn.Commit(); + return true; + } + catch (Exception e) + { + oCn.RollBack(); + sReturn = e.Message; + throw (e); + } + } + //瀹℃壒娴�-鍙嶅鏍�(鍖呭惈鍙嶅鏍稿悗鎺у埗銆佸啓鍏ユ棩蹇�) 2024-01-31 public bool AbandonCheck(SQLHelper.ClsCN oCN,Int64 lngBillKey, string HBillNo, string procName, string sUser, ref string sReturn) { -- Gitblit v1.9.1