public static List <SelectListItem> GetUserId() { // List <SelectListItem> ListItem = new List <SelectListItem>(); string unitid = GAccount.GetAccountInfo().UnitID; string rolenames = GAccount.GetAccountInfo().RoleNames; DataTable dtDesc = PpPro.GetUserId(" and Deptid='" + unitid + "' and RoleNames='" + rolenames + "'"); if (dtDesc == null) { return(ListItem); } SelectListItem SelListItem = new SelectListItem(); SelListItem.Value = ""; SelListItem.Text = "请选择"; ListItem.Add(SelListItem); for (int i = 0; i < dtDesc.Rows.Count; i++) { SelListItem = new SelectListItem(); SelListItem.Value = dtDesc.Rows[i]["UserId"].ToString(); SelListItem.Text = dtDesc.Rows[i]["UserName"].ToString(); ListItem.Add(SelListItem); } return(ListItem); }
public static string GetSPid(string folderBack) { string[] arr = folderBack.Split('/'); Acc_Account account = GAccount.GetAccountInfo(); int unitId = Convert.ToInt16(account.UnitID); string strPID = ""; string strYMD = DateTime.Now.ToString("yyMMdd"); string strSelPID = "select SPID, SPidNo from [" + arr[0] + "].." + arr[6] + " where DateRecord='" + strYMD + "'"; DataTable dtPMaxID = SQLBase.FillTable(strSelPID); int intNewID = 0; if (dtPMaxID == null) { return(strPID); } if (dtPMaxID.Rows.Count == 0) { string strInsertID = "insert into [" + arr[0] + "].." + arr[6] + " (SPID,SPidNo,DateRecord) values('P',0,'" + strYMD + "')"; SQLBase.ExecuteNonQuery(strInsertID); intNewID = 0; } else { intNewID = Convert.ToInt32(dtPMaxID.Rows[0]["SPidNo"]); } intNewID++; string strUpdateID = "update [" + arr[0] + "].." + arr[6] + " set SPidNo='" + intNewID + "' where DateRecord ='" + strYMD + "'"; SQLBase.ExecuteNonQuery(strUpdateID); strPID = dtPMaxID.Rows[0]["SPID"].ToString() + DateTime.Now.ToString("yyMMdd") + GFun.GetNum(unitId, 4) + GFun.GetNum(intNewID, 4); return(strPID); }
// public static System.Data.DataTable GetBasicContent() { Acc_Account account = GAccount.GetAccountInfo(); string strSql = "select distinct Type as SID,TypeDesc as Text from tk_ConfigContent where validate='v' "; DataTable dt = SQLBase.FillTable(strSql, "FlowMeterDBCnn"); return(dt); }
public static DataTable GetConfigCont(string Type) { Acc_Account account = GAccount.GetAccountInfo(); string strSql = "select SID,Text from tk_ConfigContent where Type = '" + Type + "' and Validate = 'v' and UnitID = '" + account.UnitID + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); return(dt); }
public static DataTable GetUser() { Acc_Account account = GAccount.GetAccountInfo(); string unitid = account.UnitID; string strSql = "select UserId,UserName,ExJob from [BJOI_UM]..UM_UserNew where DeptId = '" + unitid + "' and ExJob != ''"; DataTable dt = SQLBase.FillTable(strSql); return(dt); }
public static int InsertApproval(string PID, string RelevanceID, string webkey, string folderBack, ref string a_strErr) { int intInsertBas = 0; int intUpdateBas = 0; int intLog = 0; Acc_Account account = GAccount.GetAccountInfo(); string createUser = account.UserID.ToString(); SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open(); string[] arr = folderBack.Split('/'); // BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/52/tk_PID/54/tk_UserLog string strInsertBas = "insert into [" + arr[0] + "].." + arr[1] + " (PID,RelevanceID,ApprovalContent,CreateUser,CreateTime,Validate,State,Job,ApprovalPersons,ApprovalLevel,AppType)" + " select '" + PID + "','" + RelevanceID + "','" + webkey + "','" + createUser + "','" + DateTime.Now + "','v','0',Duty,UserId,[Level],AppType from [BJOI_UM]..UM_Examine where BuType = '" + webkey + "'"; string strUpdateBas = ""; if (arr[2].IndexOf("..") > 0) { strUpdateBas = "update " + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strUpdateBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'"; } string strInsertLog = "insert into [" + arr[0] + "].." + arr[8] + " values ('" + RelevanceID + "','提交" + webkey + "审批操作','提交" + webkey + "审批成功','" + DateTime.Now + "','" + account.UserName + "','" + webkey + "')"; try { if (strInsertBas != "") { intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } if (strUpdateBas != "") { intUpdateBas = sqlTrans.ExecuteNonQuery(strUpdateBas, CommandType.Text, null); } if (strInsertLog != "") { intLog = sqlTrans.ExecuteNonQuery(strInsertLog, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsertBas + intUpdateBas); }
public static string GetTopJHID() { string strID = ""; string strD = "JH" + "-" + DateTime.Now.ToString("yyyyMMdd"); string UnitID = string.Format("{0:D4}", Convert.ToInt32(GAccount.GetAccountInfo().UnitID)); string strSqlID = "select max(JHID) from [BGOI_Produce].[dbo].[tk_Product_Plan]"; DataTable dtID = SQLBase.FillTable(strSqlID); if (dtID != null && dtID.Rows.Count > 0) { strID = dtID.Rows[0][0].ToString(); if (strID == "" || strID == null) { strD = strD + "-" + UnitID + "-" + "001"; } else { int num = Convert.ToInt32(strID.Substring(strID.Length - 3, 3)); string stryyyyMMdd = strID.Substring(3, 8); if (DateTime.Now.ToString("yyyyMMdd") == stryyyyMMdd) { if (num < 9) { strD = strD + "-" + UnitID + "-" + "00" + (num + 1); } else if (num < 99 && num >= 9) { strD = strD + "-" + UnitID + "-" + "0" + (num + 1); } else { strD = strD + "-" + UnitID + "-" + (num + 1); } } else { strD = strD + "-" + UnitID + "-" + "001"; } } } else { strD = strD + "-" + UnitID + "-" + "001"; } return(strD); }
// 确认新增小组 public static int InsertGroup(string text, ref string a_strErr) { int intInsert = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("AccountCnn"); string strSql = "select top 1 GroupID,DeptId from UM_Group where Validate='v' order by GroupID desc "; DataTable dt = SQLBase.FillTable(strSql, "AccountCnn"); int GroupID = 0; string DeptID = ""; if (dt.Rows.Count > 0) { GroupID = Convert.ToInt32(dt.Rows[0]["GroupID"].ToString()) + 1; DeptID = dt.Rows[0]["DeptId"].ToString(); } else { GroupID = 1; Acc_Account acc = GAccount.GetAccountInfo(); DeptID = acc.UnitID; } string strInsertOrder = "insert into UM_Group (GroupID,GroupName,DeptId,Validate) "; strInsertOrder += " values ('" + GroupID + "','" + text + "','" + DeptID + "','v') "; try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert); }
public static bool insertLog(string YYCode, string content) { tk_Log log = null; List <tk_Log> list = new List <tk_Log>(); string[] YYCodes = YYCode.Split(','); string[] Contents = content.Split(','); for (int i = 0; i < YYCodes.Length; i++) { log = new tk_Log() { ID = Convert.ToDecimal(DateTime.Now.ToString("yyyyMMddHHmmss")), LogTime = DateTime.Now, YYCode = YYCodes[i], Content = Contents[i], Actor = GAccount.GetAccountInfo().UserName, Unit = GAccount.GetAccountInfo().UnitName }; list.Add(log); } string logSql = GSqlSentence.GetInsertByList <tk_Log>(list, "tk_Log"); return(SQLBase.ExecuteNonQuery(logSql) > 0); }
public static int InsertContent(string type, string text, ref string a_strErr) { int intInsert = 0; int intContent = 0; SQLTrans sqlTrans = new SQLTrans(); sqlTrans.Open("SupplyCnn"); string XID = PreGetTaskNo(type); string strSql = "select SID,TypeDesc from tk_ConfigContent where Type='" + type + "'"; DataTable dt = SQLBase.FillTable(strSql, "SupplyCnn"); string SID = ""; string TypeDesc = ""; Acc_Account acc = GAccount.GetAccountInfo(); if (dt.Rows.Count > 0) { SID = dt.Rows[0]["SID"].ToString(); SID = SID.Substring(0, SID.Length - 1); SID = SID + (Convert.ToInt32(XID) - 1).ToString(); TypeDesc = dt.Rows[0]["TypeDesc"].ToString(); } string strInsertOrder = ""; string strConte = ""; //在此处判断 if (type == "BusinessDistribute") { strInsertOrder += "insert into tk_BusinessDistribute (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "BillingWay") { strInsertOrder += "insert into tk_ConfigBillWay (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "CPZLZXBZ") { strInsertOrder += "insert into tk_ConfigQualityStandard (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "Relation") { strInsertOrder += "insert into tk_ConfigReation (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else if (type == "ScaleType") { strInsertOrder += "insert into tk_ConfigScalType (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; strConte += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } else { strInsertOrder += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')"; } try { if (strInsertOrder != "") { intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null); } if (strConte != "") { intContent = sqlTrans.ExecuteNonQuery(strConte, CommandType.Text, null); } sqlTrans.Close(true); } catch (SqlException e) { sqlTrans.Close(false); a_strErr = e.Message; return(-1); } return(intInsert + intContent); }
public static bool SaveUpdatePlan(tk_Product_Plan record, List <tk_Product_PlanDetail> delist, ref string strErr) { //SqlTransaction sqltra = con.BeginTransaction();//开始事务 try { string strUpdate = "update BGOI_Produce.dbo.tk_Product_Plan set Specifieddate=@Specifieddate,Plannedmonth=@Plannedmonth," + "Remarks=@Remarks,Formulation=@Formulation where JHID=@JHID"; SqlParameter[] param = { new SqlParameter("@Specifieddate", SqlDbType.DateTime), new SqlParameter("@Plannedmonth", SqlDbType.NVarChar), new SqlParameter("@Remarks", SqlDbType.NVarChar), new SqlParameter("@Formulation", SqlDbType.NVarChar), new SqlParameter("@JHID", SqlDbType.NVarChar) }; param[0].Value = Convert.ToDateTime(record.Specifieddate); param[1].Value = record.Plannedmonth; param[2].Value = record.Remarks == null ? "" : record.Remarks; param[3].Value = record.Formulation; param[4].Value = record.JHID; string InserNewOrdersHIS = "insert into BGOI_Produce.dbo.tk_Product_Plan_HIS (JHID,UnitID,Plannedyear,Plannedmonth,Specifieddate,Formulation,Remarks,State,Approvalstatus,CreateUser,CreateTime,Validate,NCreateTime,NCreateUser)" + "select JHID,UnitID,Plannedyear,Plannedmonth,Specifieddate,Formulation,Remarks,State,Approvalstatus,CreateUser,CreateTime,Validate,'" + DateTime.Now + "','" + GAccount.GetAccountInfo().UserName + "' from BGOI_Produce.dbo.tk_Product_Plan where JHID ='" + record.JHID + "'"; int count = 0; count = SQLBase.ExecuteNonQuery(InserNewOrdersHIS, "MainProduce"); if (count <= 0) { strErr = "历史记录更新失败"; return(false); } count = SQLBase.ExecuteNonQuery(strUpdate, param, "MainProduce"); if (count <= 0) { strErr = "计划信息更新失败"; return(false); } string strInsertDetailHIS = "insert into BGOI_Produce.dbo.tk_Product_PlanDetail_HIS(JHID,DID,PID,Name,Specifications,Finishedproduct,finishingproduct,Spareparts,notavailable,Total,plannumber,demandnumber,Remarks,CreateUser,CreateTime,Validate,NCreateUser,NCreateTime) select JHID,DID,PID,Name,Specifications,Finishedproduct,finishingproduct,Spareparts,notavailable,Total,plannumber,demandnumber,Remarks,CreateUser,CreateTime,Validate,'" + GAccount.GetAccountInfo().UserName + "','" + DateTime.Now + "'" + " from BGOI_Produce.dbo.tk_Product_PlanDetail where JHID='" + record.JHID + "'"; count = SQLBase.ExecuteNonQuery(strInsertDetailHIS, "MainProduce"); if (count < 0) { strErr = "历史记录更新失败"; return(false); } string strDeleteDetail = "delete tk_Product_PlanDetail where JHID='" + record.JHID + "'"; count = SQLBase.ExecuteNonQuery(strDeleteDetail, "MainProduce"); if (count < 0) { return(false); } if (delist.Count > 0) { string strUpdateList = GSqlSentence.GetInsertByList <tk_Product_PlanDetail>(delist, "tk_Product_PlanDetail"); count = SQLBase.ExecuteNonQuery(strUpdateList, "MainProduce"); if (count <= 0) { return(false); } } return(true); } catch (Exception ex) { strErr = ex.Message; //trans.Close(true); return(false); } }
public static DataTable GetZD() { string str = "select distinct a.ProductID,B.ProName,b.Spec,isnull(c.finishCount,0)finishCount,isnull(c.HalfCount,0)HalfCount,isnull(c.OnlineCount,0)OnlineCount,isnull(d.num,0) xdnum,isnull(e.lj,0) lj from tk_ProductionOfFinishedGoods aa left join tk_ProFinishDefine a on aa.PID = A.ProductID left join tk_ProductInfo b on a.ProductID = b.PID left join tk_StockRemain c on a.ProductID = c.ProductID LEFT JOIN (select ProductID ,sum(OrderNum-ShipmentNum)num from BGOI_Sales.dbo.Orders_DetailInfo group by ProductID) d on a.ProductID = d.ProductID left join (select KSC.ProductID,min(FinishCount/Number)lj from tk_ProFinishDefine KSC LEFT JOIN tk_StockRemain KC ON KSC.PartPID = KC.ProductID where Number>0 group by KSC.ProductID) e on a.ProductID = e.ProductID where a.ValiDate='v' AND aa.ValiDate ='v' and UnitID ='" + GAccount.GetAccountInfo().UnitID + "'"; DataTable dt = SQLBase.FillTable(str, "MainInventory"); return(dt); }
public static OperationAnalysis getOperationAnalysis(int month) { string sql = "select top(1) OId, Year, Month, Overview, BusinesAnalysi, BusinesContent, PayableAnalysi, PayableContent, Experience, Other, Unit, CreateUser, CreateTime from OperationAnalysis where year=" + DateTime.Now.ToString("yyyy") + " and Month = " + month + " and unit='" + GAccount.GetAccountInfo().UnitName + "' order by CreateTime"; OperationAnalysis oa = new OperationAnalysis(); GSqlSentence.SetTValueD <OperationAnalysis>(oa, SQLBase.FillTable(sql).Rows[0]); return(oa); }
/// <summary> /// 获取经营任务 /// </summary> /// <param name="month"></param> /// <returns></returns> public static DataTable GetOperationTask(int month, ref string istask) { DataTable dt = null; string sql = "select count(*) from OperationAnalysis where year=" + DateTime.Now.ToString("yyyy") + " and Month = " + month + " and unit='" + GAccount.GetAccountInfo().UnitName + "'"; if ((int)SQLBase.ExecuteScalar(sql) > 0) { sql = "select a.OId,YearTarget, MonthTarget, MonthComplete, Problem, NextMonthTarget, Type, Remark from OperationAnalysis a left join OperationTask b on a.OId=b.OId where year=" + DateTime.Now.ToString("yyyy") + " and Month = " + month + " and unit='" + GAccount.GetAccountInfo().UnitName + "'"; dt = SQLBase.FillTable(sql); istask = "y"; } else { sql = "select YearTarget, MonthTarget,NextMonthTarget, Type from OperationAnalysis a left join OperationTask b on a.OId=b.OId where year=" + DateTime.Now.ToString("yyyy") + " and Month = " + (month - 1) + " and unit='" + GAccount.GetAccountInfo().UnitName + "'"; dt = SQLBase.FillTable(sql); istask = "n"; } return(dt); }
public static bool SaveAccept(string YYCode, string MCode, string AcceptPeople, string type, ref string err) { string sql = "update MandateInfo set MCode='" + MCode + "',AcceptPeople='" + AcceptPeople + "',AcceptTime='" + DateTime.Now.ToString() + "',state=1 where YYCode='" + YYCode + "'"; if (SQLBase.ExecuteNonQuery(sql) > 0) { if (!UpdateMcode(type, MCode)) { err = "委托单号更新失败"; return(false); } //sql = "update sampleInfo set sampleCode='" + MCode + ".'+right('00',2-len(convert(varchar(2),serialNumber)))+convert(varchar(2),serialNumber) where YYCode='" + YYCode + "'"; sql = "select YYCode,Number,serialNumber from SampleInfo where YYCode ='" + YYCode + "' order by serialNumber"; DataTable dt = SQLBase.FillTable(sql); //未完 int number = 0; for (int i = 0; i < dt.Rows.Count; i++) { string sampleCode = ""; if ((int)dt.Rows[i]["Number"] > 1) { string strartStr = (number + 1).ToString(); string endStr = (number + (int)dt.Rows[i]["Number"]).ToString(); if (strartStr.Length < 2) { strartStr = "0" + strartStr; } if (endStr.Length < 2) { endStr = "0" + endStr; } sampleCode = MCode + "-" + strartStr + "-" + endStr; number = Convert.ToInt32(endStr); } else { if ((number + 1).ToString().Length > 2) { sampleCode = MCode + "-" + (number + 1); } else { string result = "00" + (number + 1); sampleCode = MCode + "-" + result.Substring(result.Length - 2, 2); } number += 1; } sql = "update sampleInfo set sampleCode='" + sampleCode + "' where YYCode='" + YYCode + "' and serialNumber=" + dt.Rows[i]["serialNumber"]; if (SQLBase.ExecuteNonQuery(sql) <= 0) { err = "样品编号更新失败"; return(false); } } sql = "insert into TaskOrder(MId,CreateTime,CreateUser,state) values('" + MCode + "','" + DateTime.Now.ToString() + "','" + GAccount.GetAccountInfo().UserName + "',9)"; if (SQLBase.ExecuteNonQuery(sql) > 0) { string content = "受理委托单并创建任务单"; if (!insertLog(YYCode, content)) { err = "日志更新失败"; return(false); } return(true); } else { err = "任务单创建失败"; return(false); } } err = "受理失败"; return(false); }
public static int UpdatezhunchuApproval(string IsPass, string Opinion, string Remark, string PID, string webkey, string folderBack, string RelevanceID, ref string a_strErr) { int intInsertBas = 0; int intUpdateBas = 0; int intLog = 0; int intAllBas = 0; //string strstate = ""; //int intstate = 0; Acc_Account account = GAccount.GetAccountInfo(); string UserId = account.UserID.ToString(); string[] arr = folderBack.Split('/'); int state = 0; if (IsPass == "是") { state = 1; } else { state = -1; } //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/51/55/tk_PID/54/tk_UserLog //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/23/22/tk_PID/10/tk_UserLog //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/62/61/tk_PID/29/tk_UserLog 年度 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/73/tk_PID/75/tk_UserLog 恢复供货 string strInsertBas = "update [" + arr[0] + "].." + arr[1] + " set ApprovalMan = '" + UserId + "',ApprovalTime = '" + DateTime.Now + "',IsPass = '******',Opinion = '" + Opinion + "'," + "Remark = '" + Remark + "',State = '" + state + "' where PID = '" + PID + "' and ApprovalPersons = '" + UserId + "'"; string strUpdateBas = ""; if (state == -1) { if (arr[2].IndexOf("..") > 0) { strUpdateBas = "update " + arr[2] + " set State = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[7] == "29") { strUpdateBas = "update " + arr[2] + " set nState = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[7] == "29") { strUpdateBas = "update " + arr[2] + " set nState = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strUpdateBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[7] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } } string strInsertLog = "insert into [" + arr[0] + "].." + arr[8] + " values ('" + RelevanceID + "','" + webkey + "审批操作','" + webkey + "审批操作成功','" + DateTime.Now + "','" + account.UserName + "','" + webkey + "审批')"; if (strInsertBas != "") { intInsertBas = SQLBase.ExecuteNonQuery(strInsertBas, CommandType.Text, null); } if (strUpdateBas != "") { intUpdateBas = SQLBase.ExecuteNonQuery(strUpdateBas, CommandType.Text, null); } if (strInsertLog != "") { intLog = SQLBase.ExecuteNonQuery(strInsertLog, "SupplyCnn"); } string str = "select ApprovalLevel,SUBSTRING(AppType,1,1) as Type,SUBSTRING(AppType,3,1) as num from [" + arr[0] + "].." + arr[1] + " where PID = '" + PID + "' and state = '0'"; DataTable dt = SQLBase.FillTable(str); string Type = ""; int num = 0; int bol = 0; int Hcount = 0; for (int i = 0; i < dt.Rows.Count; i++) { Type = dt.Rows[i]["Type"].ToString(); if (Type == "1") { bol = 1; break; } if (Type == "2") { bol = 1; break; } if (Type == "3") { num = Convert.ToInt16(dt.Rows[i]["num"]); string level = dt.Rows[i]["ApprovalLevel"].ToString(); string str1 = "select count(*) from [" + arr[0] + "].." + arr[1] + " where PID = '" + PID + "' and state = '1' and AppType = '3-" + num + "'"; DataTable dt2 = SQLBase.FillTable(str1); if (dt2.Rows.Count > 0) { Hcount = Convert.ToInt16(dt2.Rows[0][0]); } if (Hcount < num) { bol = 1; break; } } } //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/23/22/tk_PID/10/tk_UserLog 准出停止 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/26/25/tk_PID/10/tk_UserLog 准出暂停 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/29/28/tk_PID/10/tk_UserLog 准出淘汰 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/62/61/tk_PID/29/tk_UserLog 年度 //BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/73/tk_PID/75/tk_UserLog 恢复供货 string strAllBas = ""; if (bol == 0 && state != -1) { if (arr[2].IndexOf("..") > 0 && arr[4] == "23") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='3' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "26") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='2' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "29") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='4' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "10") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "4") { strAllBas = "update " + arr[2] + " set State = '" + arr[4] + "',wstate='0' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[2].IndexOf("..") > 0 && arr[4] == "62") { strAllBas = "update " + arr[2] + " set nState = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "23") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='3' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "26") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='2' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "29") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='4' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "10") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } else if (arr[4] == "4") { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[4] + "',wstate='0' where " + arr[3] + " = '" + RelevanceID + "'"; } else { strAllBas = "update [" + arr[0] + "].." + arr[2] + " set nState = '" + arr[4] + "',wstate='1' where " + arr[3] + " = '" + RelevanceID + "'"; } } else { strAllBas = ""; } if (strAllBas != "") { intAllBas = SQLBase.ExecuteNonQuery(strAllBas, "SupplyCnn"); } return(intInsertBas + intUpdateBas); }