/// <summary> /// 修改车次规则 /// </summary> public InterfaceOutPut ModifyCheCiInfo(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InModifyCheCiInfo InParams = javaScriptSerializer.Deserialize <InModifyCheCiInfo>(Data); string strSql = @"update Tab_MealTicket_CheCi set strWorkShopGUID=strWorkShopGUID,iType=@iType,strQuDuan=@strQuDuan, strRuleGUID=@strRuleGUID,strCheCi=@strCheCi,dtStartTime=@dtStartTime,dtEndTime = @dtEndTime where strGUID = @strGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strWorkShopGUID", InParams.Rule.strWorkShopGUID), new SqlParameter("iType", InParams.Rule.iType), new SqlParameter("strQuDuan", InParams.Rule.strQuDuan), new SqlParameter("strRuleGUID", InParams.Rule.strRuleGUID), new SqlParameter("strGUID", InParams.CheCiGUID), new SqlParameter("strCheCi", InParams.Rule.strCheCi), new SqlParameter("dtStartTime", InParams.Rule.dtStartTime), new SqlParameter("dtEndTime", InParams.Rule.dtEndTime) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.ModifyCheCiInfo:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 根据RULE的GUID查询下面的所有车次 /// </summary> public InterfaceOutPut QueryCheCiInfo(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InQueryCheCiInfo InParams = javaScriptSerializer.Deserialize <InQueryCheCiInfo>(Data); OutQueryCheCiInfo OutParams = new OutQueryCheCiInfo(); output.data = OutParams; string strSql = @"SELECT * from Tab_MealTicket_CheCi where strRuleGUID = @strRuleGUID "; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strRuleGUID", InParams.RuleGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { MealTicketCheCi cc = new MealTicketCheCi(); PS.PSMealTicket.MealTicketCheciFromDB(cc, dt.Rows[i]); OutParams.RuleList.Add(cc); } output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.QueryCheCiInfo:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 设置计划的寓休信息 /// </summary> public InterfaceOutPut SetPlanRest(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InSetPlanRest InParams = javaScriptSerializer.Deserialize <InSetPlanRest>(Data); string strSql = "update TAB_Plan_Train set nNeedRest=@nNeedRest,dtArriveTime=@dtArriveTime,dtCallTime=@dtCallTime where strTrainPlanGUID = @strTrainPlanGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("nNeedRest", InParams.RestInfo.nNeedRest), new SqlParameter("dtArriveTime", InParams.RestInfo.dtArriveTime), new SqlParameter("dtCallTime", InParams.RestInfo.dtCallTime), new SqlParameter("strTrainPlanGUID", InParams.PlanGUID), }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.SetPlanRest:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 修改规则 /// </summary> public InterfaceOutPut ModifyRule(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InModifyRule InParams = javaScriptSerializer.Deserialize <InModifyRule>(Data); string strSql = @"update Tab_MealTicket_Rule set strName=@strName,strWorkShopGUID=@strWorkShopGUID, iA=@iA,iB=@iB,iType=@iType where strGUID = @strGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strName", InParams.Rule.strName), new SqlParameter("strGUID", InParams.RuleGUID), new SqlParameter("strWorkShopGUID", InParams.Rule.strWorkShopGUID), new SqlParameter("iA", InParams.Rule.iA), new SqlParameter("iB", InParams.Rule.iB), new SqlParameter("iType", InParams.Rule.iType) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.ModifyRule:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取所有的车型信息 /// </summary> public InterfaceOutPut GetTrainTypes(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { OutGetTrainTypes OutParams = new OutGetTrainTypes(); output.data = OutParams; string strSql = "select * from TAB_System_TrainType order by strTrainTypeName"; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { OutParams.TrainTypes.Add(dt.Rows[i]["strTrainTypeName"].ToString()); } output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetTrainTypes:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取各交路下人员数量 /// </summary> public InterfaceOutPut GetTrainmanJiaoLuCount(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetTrainmanJiaoLuCount InParams = javaScriptSerializer.Deserialize <InGetTrainmanJiaoLuCount>(Data); OutGetTrainmanJiaoLuCount OutParams = new OutGetTrainmanJiaoLuCount(); string strSql = @"select count(*) as nCount,strTrainmanJiaoluGUID,strTrainmanJiaoluName from VIEW_Nameplate_TrainmanInJiaolu_All where strTrainmanJiaoluGUID in (select strTrainmanJiaoluGUID from VIEW_Base_JiaoluRelation where strWorkShopGUID = @strWorkShopGUID) group by strTrainmanJiaoluGUID,strTrainmanJiaoluName "; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strWorkShopGUID", InParams.WorkShopGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { TrainmanJiaoluCount c = new TrainmanJiaoluCount(); c.nCount = ObjectConvertClass.static_ext_int(dt.Rows[i]["nCount"]); c.strJiaoLuName = dt.Rows[i]["strTrainmanJiaoluName"].ToString(); OutParams.SumCount.Add(c); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetTrainmanJiaoLuCount:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 根据nid获取乘务员 /// </summary> public InterfaceOutPut GetTrainmanByID(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetTrainmanByID InParams = javaScriptSerializer.Deserialize <InGetTrainmanByID>(Data); string strSql = "select top 1 * from VIEW_Org_Trainman where nid = @nid"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("nid", InParams.ID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; OutGetTrainmanByID OutParams = new OutGetTrainmanByID(); output.data = OutParams; if (dt.Rows.Count > 0) { PSTrainman.TrainmanFromDB(OutParams.TM, dt.Rows[0], 0); } output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetTrainmanByID:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 删除规则 /// </summary> public InterfaceOutPut DeleteRule(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InDeleteRule InParams = javaScriptSerializer.Deserialize <InDeleteRule>(Data); string strSql = "delete from Tab_MealTicket_CheCi where strRuleGUID = @strRuleGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strRuleGUID", InParams.RuleGUID) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); strSql = "delete from Tab_MealTicket_Rule where strGUID = @strRuleGUID"; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.DeleteRule:" + ex.Message); throw ex; } return(output); }
public InterfaceRet Find(string Data) { try { _Ret.Clear(); _Ret.result = 0; _Ret.resultStr = ""; NpSearchResult ret = new NpSearchResult(); ret.Find = false; JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetTrainman InParams = javaScriptSerializer.Deserialize <InGetTrainman>(Data); //获取人员基本信息 TmInfo tm = GetTmInfo(InParams.Number); if (tm != null) { Dictionary <string, TmJl> jlDict = GetJlDict(); ret.Find = true; ret.TmState = tm.State; ret.JlID = tm.TMJLID; //通过人员id获取机组id,机组状态,交路id NamePlate np = GetNamePlate(tm.TMID); if (null != np) { ret.GrpID = np.strGroupGUID; ret.TxState = np.nTXState; } if (jlDict.ContainsKey(ret.JlID)) { ret.JlName = jlDict[ret.JlID].Name; //轮乘交路,获取出勤点 if (jlDict[ret.JlID].JlType == 3) { Place p = GetPlace(tm.TMID); if (p != null) { ret.PlaceID = p.strPlaceID; ret.PlaceName = p.strPlaceName; } } } else { if (tm.State == 1) { ret.TmState = 7; } } } _Ret.data = ret; } catch (Exception ex) { _Ret.resultStr = ex.Message; LogClass.log("Interface.Find:" + ex.Message); throw ex; } return(_Ret); }
/// <summary> /// 获取退勤计划 /// </summary> public InterfaceOutPut GetTuiQinPlan(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetTuiQinPlan InParams = javaScriptSerializer.Deserialize <InGetTuiQinPlan>(Data); OutGetTuiQinPlan OutParams = new OutGetTuiQinPlan(); string strSql = "select top 1 * from VIEW_Plan_EndWork_Full where strTrainPlanGUID = @strTrainPlanGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainPlanGUID", InParams.TuiQinPlanGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; if (dt.Rows.Count == 0) { output.resultStr = "没有找到指定编号的退勤计划"; return(output); } PS.PSPlan.EndworkFromDB(OutParams.Plan, dt.Rows[0]); output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetTuiQinPlan:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取计划最后到达时间 /// </summary> public InterfaceOutPut GetLastArrvieTime(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetLastArrvieTime InParams = javaScriptSerializer.Deserialize <InGetLastArrvieTime>(Data); OutGetLastArrvieTime OutParams = new OutGetLastArrvieTime(); DateTime ArriveTime = DateTime.Now; bool isLastArrvieTime = getGetLastArrvieTime(InParams.TrainPlanGUID, ref ArriveTime); if (!isLastArrvieTime) { output.resultStr = "不存在此计划信息"; return(output); } else { OutParams.ArriveTime = ArriveTime; } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetLastArrvieTime:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 修改本段入寓时间 /// </summary> public InterfaceOutPut UpdateInRoomTime(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InUpdateInRoomTime InParams = javaScriptSerializer.Deserialize <InUpdateInRoomTime>(Data); string strSql = "update TAB_Plan_InRoom set dtInRoomTime = @dtInRoomTime where strInRoomGUID = @strInRoomGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("dtInRoomTime", InParams.NewTime), new SqlParameter("strInRoomGUID", InParams.strInRoomGUID) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.UpdateInRoomTime:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 添加记名式交路机组 /// </summary> public InterfaceRet InsertGrp(String Data) { _Ret.Clear(); try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InInsertGrp InParams = javaScriptSerializer.Deserialize <InInsertGrp>(Data); //记名式交路机组 RRsNamedGroup NamedGroup = new RRsNamedGroup(); NamedGroup.nCheciOrder = InParams.CheciOrder; NamedGroup.nCheciType = InParams.CheciType; NamedGroup.strCheci1 = InParams.Checi1; NamedGroup.strCheci2 = InParams.Checi2; NamedGroup.strCheciGUID = InParams.CheciGUID; NamedGroup.strTrainmanJiaoluGUID = InParams.TrainmanJiaolu.jiaoluID; NamedGroup.dtLastArriveTime = DateTime.Parse("1899-01-01"); NamedGroup.Group.groupID = Guid.NewGuid().ToString(); DBNamedGroupV2.InsertGrp(InParams.TrainmanJiaolu.jiaoluID, NamedGroup); Group group = NamedGroup.Group; TrainmanList trainmanList = new TrainmanList(); string strContent = string.Format("成功添加一个空的记名式机组"); DBNameBoard.SaveChangeLog(InParams.TrainmanJiaolu, LBoardChangeType.btcAddGroup, strContent, InParams.DutyUser, trainmanList); _Ret.result = 0; } catch (Exception ex) { _Ret.resultStr = ex.Message; _Ret.result = 1; LogClass.log("Interface.AddNamedGroup:" + ex.Message); throw ex; } return(_Ret); }
/// <summary> /// 清除乘务员的指纹信息 /// <summary> public InterfaceOutPut ClearFingerPrint(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { CommonJsonModel cjm = new CommonJsonModel(Data); string strTrainmanGUID = ObjectConvertClass.static_ext_string(cjm.GetValue("strTrainmanGUID")); string strSql = @"update TAB_Org_Trainman set Fingerprint1=null,Fingerprint2=null Where strTrainmanGUID =@strTrainmanGUID"; SqlParameter[] sqlParameters = new SqlParameter[] { new SqlParameter("strTrainmanGUID", strTrainmanGUID), }; int count = SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParameters); if (count > 0) { output.result = 0; output.resultStr = "指纹信息清除成功"; } } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.ClearFingerPrint:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 提交运行记录转储记录 /// </summary> public void SubMitRunRecordInfo(RunRecordFileMain runRecordFileMain) { SqlConnection connection = new SqlConnection(); SqlTransaction transaction = null; SqlCommand command = new SqlCommand(); command.Connection = connection; connection.ConnectionString = SqlHelper.ConnString; try { connection.Open(); transaction = connection.BeginTransaction(); command.Transaction = transaction; string strGUID = AddRunRecrod(command, runRecordFileMain); for (int i = 0; i < runRecordFileMain.RunRecordFileDetailList.Count; i++) { runRecordFileMain.RunRecordFileDetailList[i].strRecordGUID = strGUID; AddRecordFileDetail(command, runRecordFileMain.RunRecordFileDetailList[i]); } transaction.Commit(); } catch (Exception ex) { LogClass.log("Interface.SubMitRunRecordInfo:" + ex.Message); throw ex; } }
/// <summary> /// 获取运安系统时间定义信息 /// </summary> public InterfaceOutPut GetKernelTimeConfig(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { OutGetKernelTimeConfig OutParams = new OutGetKernelTimeConfig(); output.data = OutParams; string strSql = "select top 1 * from tab_Base_KernelTime"; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql).Tables[0]; if (dt.Rows.Count > 0) { OutParams.Config.nMinCallBeforeChuQing = ObjectConvertClass.static_ext_int(dt.Rows[0]["nMinCallBeforeChuQing"]); OutParams.Config.nMinChuQingBeforeStartTrain_K = ObjectConvertClass.static_ext_int(dt.Rows[0]["nMinChuQingBeforeStartTrain_K"]); OutParams.Config.nMinChuQingBeforeStartTrain_Z = ObjectConvertClass.static_ext_int(dt.Rows[0]["nMinChuQingBeforeStartTrain_Z"]); OutParams.Config.nMinDayWorkStart = ObjectConvertClass.static_ext_int(dt.Rows[0]["nMinDayWorkStart"]); OutParams.Config.nMinNightWokrStart = ObjectConvertClass.static_ext_int(dt.Rows[0]["nMinNightWokrStart"]); OutParams.Exist = 1; } output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetKernelTimeConfig:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取计划变动日志 /// </summary> public InterfaceOutPut GetChangeTrainPlanLog(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetChangeTrainPlanLog InParams = javaScriptSerializer.Deserialize <InGetChangeTrainPlanLog>(Data); OutGetChangeTrainPlanLog OutParams = new OutGetChangeTrainPlanLog(); string strSql = "select * from TAB_Plan_ChangeLog where strTrainPlanGUID = @strTrainPlanGUID ORDER BY dtChangeTime DESC"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainPlanGUID", InParams.TrainPlanGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { TrainPlanChangeLog log = new TrainPlanChangeLog(); PS.PSPlan.TrainPlanChangeLogFromDB(log, dt.Rows[i]); OutParams.Logs.Add(log); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetChangeTrainPlanLog:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取指定编号的记名式机组 /// </summary> public InterfaceOutPut GetNamedGroup(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetNamedGroup InParams = javaScriptSerializer.Deserialize <InGetNamedGroup>(Data); OutGetNamedGroup OutParams = new OutGetNamedGroup(); string strSql = "select * from VIEW_Nameplate_TrainmanJiaolu_Named where strGroupGUID= @strGroupGUID order by nCheciOrder"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strGroupGUID", InParams.GroupGUID) }; OutParams.Exist = 0; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; if (dt.Rows.Count > 0) { OutParams.Exist = 1; PS.PSNameBoard.NamedGroupFromDB(OutParams.Group, dt.Rows[0]); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetNamedGroup:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 添加包乘机车信息 /// </summary> public InterfaceOutPut AddTrain(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InAddTrain InParams = javaScriptSerializer.Deserialize <InAddTrain>(Data); string strSql = @"insert into TAB_Nameplate_TrainmanJiaolu_Train (strTrainGUID,strTrainmanJiaoluGUID,strTrainTypeName,strTrainNumber,dtCreateTime) values (@strTrainGUID,@strTrainmanJiaoluGUID,@strTrainTypeName,@strTrainNumber,getdate())"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainGUID", InParams.TrainGUID), new SqlParameter("strTrainmanJiaoluGUID", InParams.TrainmanJiaoluGUID), new SqlParameter("strTrainTypeName", InParams.TrainTypeName), new SqlParameter("strTrainNumber", InParams.TrainNumber) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.AddTrain:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 判断指定的包乘机车组是否已经存在 /// </summary> public InterfaceOutPut ExistTrain(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InExistTrain InParams = javaScriptSerializer.Deserialize <InExistTrain>(Data); string strSql = "select top 1 * from TAB_Nameplate_TrainmanJiaolu_Train where strTrainTypeName = @strTrainTypeName and strTrainNumber = @strTrainNumber "; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainTypeName", InParams.TrainTypeName), new SqlParameter("strTrainNumber", InParams.TrainNumber) }; OutExistTrain OutParams = new OutExistTrain(); OutParams.Exist = 0; if (SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0].Rows.Count > 0) { OutParams.Exist = 1; } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.ExistTrain:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 查询规则 /// </summary> public InterfaceOutPut QueryRule(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InQueryRule InParams = javaScriptSerializer.Deserialize <InQueryRule>(Data); OutQueryRule OutParams = new OutQueryRule(); output.data = OutParams; string strSql = "SELECT * from Tab_MealTicket_Rule where strWorkShopGUID = @strWorkShopGUID and iType = @iType"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strWorkShopGUID", InParams.WorkShopGUID), new SqlParameter("iType", InParams.AType) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { MealTicketRule rule = new MealTicketRule(); PS.PSMealTicket.MealTicketRuleFromDB(rule, dt.Rows[i]); OutParams.RuleList.Add(rule); } output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.QueryRule:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 修改包乘组的机车信息 /// </summary> public InterfaceOutPut UpdateTrainInfo(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InUpdateTrainInfo InParams = javaScriptSerializer.Deserialize <InUpdateTrainInfo>(Data); string strSql = "update TAB_Nameplate_TrainmanJiaolu_Train set strTrainTypeName=@strTrainTypeName,strTrainNumber=@strTrainNumber where strTrainGUID = @strTrainGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainTypeName", InParams.TrainTypeName), new SqlParameter("strTrainNumber", InParams.TrainNumber), new SqlParameter("strTrainGUID", InParams.TrainGUID) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.UpdateTrainInfo:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取包乘机车中机组正在值乘的假话信息 /// </summary> public InterfaceOutPut GetPlanOfTrain(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetPlanOfTrain InParams = javaScriptSerializer.Deserialize <InGetPlanOfTrain>(Data); OutGetPlanOfTrain OutParams = new OutGetPlanOfTrain(); string strSql = @"Select dtStartTime,strTrainNo,strTrainJiaoluName from VIEW_Plan_Trainman where strTrainPlanGUID in (select strTrainPlanGUID from VIEW_Nameplate_TrainmanJiaolu_TogetherTrain where strTrainGUID = @strTrainGUID)"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainGUID", InParams.TrainGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; OutParams.Exist = 0; if (dt.Rows.Count > 0) { OutParams.Exist = 1; PSNameBoard.TrainPlanMinFromDB(OutParams.Plan, dt.Rows[0]); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetPlanOfTrain:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 删除指定的包乘机车信息 /// </summary> public InterfaceOutPut DeleteTogetherTrain(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InDeleteTogetherTrain InParams = javaScriptSerializer.Deserialize <InDeleteTogetherTrain>(Data); string strSql = "delete from TAB_Nameplate_TrainmanJiaolu_Train where strTrainGUID = @strTrainGUID"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strTrainGUID", InParams.TrainGUID) }; SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams); output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.DeleteTogetherTrain:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获得对象信息 /// <summary> public InterfaceOutPut GetEntry(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 0; try { CommonJsonModel cjm = new CommonJsonModel(Data); Base_TrainNoQueryCondition _Base_TrainNoQueryCondition = new Base_TrainNoQueryCondition(); _Base_TrainNoQueryCondition.strGUID = ObjectConvertClass.static_ext_string(cjm.GetValue("strGUID")); DBBase_TrainNo dbBase_TrainNo = new DBBase_TrainNo(ThinkFreely.DBUtility.SqlHelper.ConnString); Base_TrainNo _Base_TrainNo = dbBase_TrainNo.GetModel(_Base_TrainNoQueryCondition); if (_Base_TrainNo == null) { output.resultStr = "没有对应数据"; } else { output.result = 1; List <Base_TrainNo> Base_TrainNoList = new List <Base_TrainNo>(); Base_TrainNoList.Add(_Base_TrainNo); output.data = Base_TrainNoList; } } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("InterfaceBase_TrainNo.GetEntry:" + ex.Message); } return(output); }
/// <summary> /// 获取指定车间指定人员交路未在牌人员的人员列表 /// </summary> public InterfaceOutPut GetTMNotInNameGroup(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetPrepareTrainmans InParams = javaScriptSerializer.Deserialize <InGetPrepareTrainmans>(Data); OutGetPrepareTrainmans OutParams = new OutGetPrepareTrainmans(); string str = ""; if (!string.IsNullOrEmpty(InParams.WorkShopGUID)) { str += " and strWorkShopGUID = @strWorkShopGUID"; } if (!string.IsNullOrEmpty(InParams.TrainmanJiaoluGUID)) { str += " and strTrainmanJiaoluGUID = @strTrainmanJiaoluGUID"; } string strSql = string.Format(@"SELECT * FROM TAB_Org_Trainman where ( nTrainmanState=7 or len(nTrainmanState)=0 or ( nTrainmanState=1 and (len(strTrainmanJiaoluGUID)=0 or strTrainmanJiaoluGUID not in(select strTrainmanJiaoluGUID from TAB_Base_TrainmanJiaolu)) ) ) {0} order by strTrainmanNumber ", str); SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strWorkShopGUID", InParams.WorkShopGUID), new SqlParameter("strTrainmanJiaoluGUID", InParams.TrainmanJiaoluGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { TrainmanNamePlate trainman = new TrainmanNamePlate(); PSNameBoard.TrainmanNamePlateFromDB(trainman, dt.Rows[i]); OutParams.Trainmans.Add(trainman); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetPrepareTrainmans:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取指定车间的指定人员交路下的非运转人员列表 /// </summary> public InterfaceOutPut GetUnRunTrainmans(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetUnRunTrainmans InParams = javaScriptSerializer.Deserialize <InGetUnRunTrainmans>(Data); OutGetUnRunTrainmans OutParams = new OutGetUnRunTrainmans(); string strSql = @"select leave.dBeginTime,leave.dEndTime,leave.strLeaveTypeGUID,leave.strTypeName as strLeaveTypeName, leave.nStatus,* from TAB_Org_Trainman as tm left join VIEW_LeaveMgr_AskLeaveWithTypeName as leave on tm.strTrainmanGUID = leave.strTrainManID where nTrainmanState = 0 and (leave.nStatus = 1 or leave.nStatus is null) "; if (!string.IsNullOrEmpty(InParams.TrainmanJiaoluGUID)) { strSql += " and strTrainmanJiaoluGUID = @strTrainmanJiaoluGUID"; } if (!string.IsNullOrEmpty(InParams.WorkShopGUID)) { strSql += " and strWorkShopGUID=@strWorkShopGUID"; } strSql += " order by strLeaveTypeGUID,dBeginTime,strTrainmanNumber"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("strWorkShopGUID", InParams.WorkShopGUID), new SqlParameter("strTrainmanJiaoluGUID", InParams.TrainmanJiaoluGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { TrainmanLeave leave = new TrainmanLeave(); leave.strLeaveTypeGUID = dt.Rows[i]["strLeaveTypeGUID"].ToString(); leave.strLeaveTypeName = dt.Rows[i]["strLeaveTypeName"].ToString(); leave.dBeginTime = TF.RunSafty.Utils.Parse.TFParse.DBToDateTime(dt.Rows[i]["dBeginTime"], DateTime.Parse("2000-01-01")).ToString("yyyy-MM-dd HH:mm:ss"); leave.dEndTime = TF.RunSafty.Utils.Parse.TFParse.DBToDateTime(dt.Rows[i]["dEndTime"], DateTime.Parse("2000-01-01")).ToString("yyyy-MM-dd HH:mm:ss"); PSNameBoard.TrainmanFromDB(leave.Trainman, dt.Rows[i]); OutParams.Trainmans.Add(leave); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetUnRunTrainmans:" + ex.Message); throw ex; } return(output); }
/// <summary> /// 获取派班写实记录 /// </summary> public InterfaceOutPut GetXSTrainmanPlans(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetXSTrainmanPlans InParams = javaScriptSerializer.Deserialize <InGetXSTrainmanPlans>(Data); OutGetXSTrainmanPlans OutParams = new OutGetXSTrainmanPlans(); string[] jiaolus = InParams.jiaolus.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string strJiaolus = ""; for (int i = 0; i < jiaolus.Length; i++) { if (strJiaolus == "") { strJiaolus = "'" + jiaolus[i] + "'"; } else { strJiaolus += "," + "'" + jiaolus[i] + "'"; } } if (strJiaolus != "") { strJiaolus = string.Format("and strTrainJiaoluGUID in ({0}) ", strJiaolus); } string strSql = @"select * from VIEW_Plan_Trainman as p where dtStartTime >=@BeginTime and dtStartTime <= @EndTime and nPlanState >= 4 " + strJiaolus + " order by dtStartTime "; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("BeginTime", InParams.dtBeginTime), new SqlParameter("EndTime", InParams.dtEndTime) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { MD.TrainmanPlan tmPlan = new MD.TrainmanPlan(); PS.PSPlan.TrainmanPlanFromDB(tmPlan, dt.Rows[i]); OutParams.Plans.Add(tmPlan); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetXSTrainmanPlans:" + ex.Message); throw ex; } return(output); }
public override void GetResult(object data, int nWorkTypeID) { base._nWorkTypeID = nWorkTypeID; input = Newtonsoft.Json.JsonConvert.DeserializeObject <InFlows_TQZhuanChu>(data.ToString()); //保存转储数据 DBEndWork dal = new DBEndWork(); if (input.runRecordFileMain != null) { dal.SubMitRunRecordInfo(input.runRecordFileMain); } else { LogClass.log("没有转储数据"); } DBStep db = new DBStep(); StepResult StepResult = null; int nStepIndex = db.getIndexOfStep(input.strWorkShopGUID, WorkType.TQZhuanChu, nWorkTypeID); if (nStepIndex != 0) { //保存转储步骤执行数据 foreach (trainmanList t in input.trainmanList) { #region 退勤步骤结果的实体信息 StepResult = new StepResult(); StepResult.dtBeginTime = ObjectConvertClass.static_ext_date(input.dtBeginTime); StepResult.dtCreateTime = ObjectConvertClass.static_ext_date(input.dtCreateTime); StepResult.dtEndTime = ObjectConvertClass.static_ext_date(input.dtEndTime); StepResult.nStepIndex = nStepIndex; StepResult.strStepBrief = "运行记录转储"; StepResult.strStepName = WorkType.TQZhuanChu; StepResult.strTrainPlanGUID = input.strTrainPlanGUID; StepResult.strTrainmanGUID = t.strTrainmanGUID; StepResult.nStepResult = input.nStepResult; StepResult.strTrainmanName = t.strTrainmanName; StepResult.strTrainmanNumber = t.strTrainmanNumber; StepResult.nWorkTypeID = 2; StepResult.strStepName = "RS.STEP.ICCARDRUNRECORD"; #endregion db.AddStep(null, null, StepResult); } db.creatMsg("RS.STEP.ICCARDRUNRECORD", input.strTrainPlanGUID, input.cid, nWorkTypeID, input.strWorkShopGUID); } }
/// <summary> /// 获取未下发的计划信息 /// </summary> public InterfaceOutPut GetUnRecvSendLog(String Data) { InterfaceOutPut output = new InterfaceOutPut(); output.result = 1; try { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); InGetUnRecvSendLog InParams = javaScriptSerializer.Deserialize <InGetUnRecvSendLog>(Data); OutGetUnRecvSendLog OutParams = new OutGetUnRecvSendLog(); string strSql = @"select * from tab_plan_send tsend where (dtSendTime <= @FromTime) and (strTrainJiaoluGUID in (select strTrainJiaoluGUID from TAB_Base_TrainJiaoluInSite where strSiteGUID=@strSiteGUID) or strTrainJiaoluGUID in (select strSubTrainJiaoluGUID from TAB_Base_TrainJiaolu_SubDetail where strTrainJiaoluGUID in (select strTrainJiaoluGUID from TAB_Base_TrainJiaoluInSite where strSiteGUID=@strSiteGUID))) and (bIsRec = 0) order by dtSendTime"; SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("FromTime", InParams.FromTime), new SqlParameter("strSiteGUID", InParams.SiteGUID) }; DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParams).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { PlanSendLog sendlog = new PlanSendLog(); sendlog.strTrainNo = dt.Rows[i]["strTrainNo"].ToString(); sendlog.strSendGUID = dt.Rows[i]["strSendGUID"].ToString(); sendlog.strTrainPlanGUID = dt.Rows[i]["strTrainPlanGUID"].ToString(); sendlog.strTrainJiaoluName = dt.Rows[i]["strTrainJiaoluName"].ToString(); sendlog.dtStartTime = TF.RunSafty.Utils.Parse.TFParse.DBToDateTime(dt.Rows[i]["dtStartTime"], DateTime.Parse("1899-01-01")); sendlog.dtRealStartTime = TF.RunSafty.Utils.Parse.TFParse.DBToDateTime(dt.Rows[i]["dtRealStartTime"], DateTime.Parse("1899-01-01")); sendlog.strSendSiteName = dt.Rows[i]["strSendSiteName"].ToString(); sendlog.dtSendTime = TF.RunSafty.Utils.Parse.TFParse.DBToDateTime(dt.Rows[i]["dtSendTime"], DateTime.Parse("1899-01-01")); OutParams.Logs.Add(sendlog); } output.data = OutParams; output.result = 0; } catch (Exception ex) { output.resultStr = ex.Message; LogClass.log("Interface.GetUnRecvSendLog:" + ex.Message); throw ex; } return(output); }