示例#1
0
        public Get_OutAddDayPlan AddDayPlan(string data)
        {
            Get_OutAddDayPlan json = new Get_OutAddDayPlan();

            try
            {
                Get_InAddDayPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InAddDayPlan>(data);
                DBDayPlan        db    = new DBDayPlan();
                int d = db.AddDayPlan(input.Plan);
                int l = 0;
                if (d > 0)
                {
                    l = db.AddModifyPlanLog(input.Log);
                }

                if (d == 1 && l == 1)
                {
                    json.result    = "0";
                    json.resultStr = "成功插入一条数据";
                }
                else
                {
                    json.result    = "0";
                    json.resultStr = "返回失败!插入" + d + "条机车计划数据;插入" + l + "条日志信息!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#2
0
        public Get_OutSendDayPlan SendDayPlan(string data)
        {
            Get_OutSendDayPlan json = new Get_OutSendDayPlan();

            try
            {
                Get_InSendDayPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InSendDayPlan>(data);
                DBDayPlan         db    = new DBDayPlan();
                int d = db.SendDayPlan(input.BeginTime, input.EndTime, input.DayPlanID);
                if (d == 1)
                {
                    json.result    = "0";
                    json.resultStr = "成功修改一条数据!";
                }
                else
                {
                    json.result    = "0";
                    json.resultStr = "";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#3
0
        public Get_OutGetPlan GetPlan(string data)
        {
            Get_OutGetPlan json = new Get_OutGetPlan();

            try
            {
                Get_InGetPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InGetPlan>(data);
                DBDayPlan     db    = new DBDayPlan();
                resultGetPlan r     = new resultGetPlan();
                r.bExist = false;
                DayPlan Plan = new DayPlan();
                if (db.GetPlan(input.PlanGUID, Plan))
                {
                    r.bExist = true;
                    r.Plan   = Plan;
                }

                json.data      = r;
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#4
0
        public Get_OutIsLoadedPlan IsLoadedPlan(string data)
        {
            Get_OutIsLoadedPlan json = new Get_OutIsLoadedPlan();

            try
            {
                Get_InIsLoadedPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InIsLoadedPlan>(data);
                DBDayPlan          db    = new DBDayPlan();
                resultIsLoadedPlan r     = new resultIsLoadedPlan();
                int d = db.IsLoadedPlan(input.BeginDate, input.EndDate, input.nDayPlanID, input.nPlanType);
                if (d >= 1)
                {
                    r.result       = true;
                    json.result    = "0";
                    json.resultStr = "已经加载过计划";
                }
                else
                {
                    r.result       = false;
                    json.result    = "0";
                    json.resultStr = "尚未加载过计划";
                }
                json.data = r;
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#5
0
        public Get_OutClearPlan ClearPlan(string data)
        {
            Get_OutClearPlan json = new Get_OutClearPlan();

            try
            {
                Get_InClearPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InClearPlan>(data);
                DBDayPlan       db    = new DBDayPlan();
                int             d     = db.ClearPlan(input.dtBeginDate, input.dtEndDate, input.nDayPlanID);
                if (d >= 1)
                {
                    json.result    = "0";
                    json.resultStr = "删除数据成功!成功删除数据" + d + "条";
                }
                else
                {
                    json.result    = "0";
                    json.resultStr = "删除0条数据";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#6
0
        public Get_OutSetSended SetSended(string data)
        {
            Get_OutSetSended json = new Get_OutSetSended();

            try
            {
                Get_InSetSended input  = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InSetSended>(data);
                DBDayPlan       db     = new DBDayPlan();
                resultSetSended rd     = new resultSetSended();
                List <string>   strIDs = db.GetPaiBanPlans(input.dtBeginTime, input.dtEndTime, input.nDayPlanID);
                int             d      = db.SetSended(input.dtBeginTime, input.dtEndTime, input.nDayPlanID);
                if (strIDs != null && d > 0)
                {
                    rd.plans       = strIDs;
                    json.result    = "0";
                    json.resultStr = "获取计划成功,并成功修改计划为已发送";
                }
                else
                {
                    rd.plans       = new List <string>();
                    json.result    = "0";
                    json.resultStr = "获取计划成功,影响修改计划条数" + d + "条";
                }
                json.data = rd;
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#7
0
        public Get_OutExport Export(string data)
        {
            Get_OutExport json = new Get_OutExport();

            try
            {
                Get_InExport input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InExport>(data);
                DBDayPlan    db    = new DBDayPlan();

                List <PlanItemGroups> LLeftpgs  = new List <PlanItemGroups>();
                List <PlanItemGroups> LRightpgs = new List <PlanItemGroups>();

                List <PlanItemGroup> LLeftPlanItemGroup = db.QueryLeftGroupListByID(input.BeginDate, input.EndDate, input.DayPlanID);
                foreach (PlanItemGroup pig in LLeftPlanItemGroup)
                {
                    PlanItemGroups Leftpgs = new PlanItemGroups();
                    Leftpgs.PlanArray     = new List <DayPlan>();
                    Leftpgs.PlanItemGroup = pig;
                    List <DayPlan> dp = db.QueryDayPlanInfoListByGroupID(input.BeginDate, input.EndDate, pig.nID);
                    Leftpgs.PlanArray = dp;
                    LLeftpgs.Add(Leftpgs);
                }

                List <PlanItemGroup> LRightPlanItemGroup = db.QueryRightGroupListByID(input.BeginDate, input.EndDate, input.DayPlanID);
                foreach (PlanItemGroup pig in LRightPlanItemGroup)
                {
                    PlanItemGroups rightpgs = new PlanItemGroups();
                    rightpgs.PlanItemGroup = pig;
                    List <DayPlan> dp = db.QueryDayPlanInfoListByGroupID(input.BeginDate, input.EndDate, pig.nID);
                    rightpgs.PlanArray = dp;
                    LRightpgs.Add(rightpgs);
                }
                ExportDatas ed = new ExportDatas();
                ed.leftGroups  = LLeftpgs;
                ed.rightGroups = LRightpgs;
                datas d = new datas();
                d.ExportData   = ed;
                json.data      = d;
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#8
0
        public Get_OutQueryPublishPlans QueryPublishPlans(string data)
        {
            Get_OutQueryPublishPlans json = new Get_OutQueryPublishPlans();

            try
            {
                Get_InQueryPublishPlans input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InQueryPublishPlans>(data);
                DBDayPlan db = new DBDayPlan();
                resultQueryPublishPlans r = new resultQueryPublishPlans();
                r.PlanList     = db.QueryPublishPlans(input.BeginDate, input.EndDate, input.GroupID);
                json.data      = r;
                json.result    = "0";
                json.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#9
0
        public Get_OutLoad Load(string data)
        {
            Get_OutLoad json = new Get_OutLoad();

            try
            {
                Get_InLoad input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InLoad>(data);
                DBDayPlan  db    = new DBDayPlan();
                DBGroup    dg    = new DBGroup();
                int        d     = 0;
                List <DayPlanItemGroup> GroupList = dg.QueryGroups(input.DayPlanID);
                foreach (DayPlanItemGroup g in GroupList)
                {
                    DataTable dt = db.QueryItemList(g.ID, input.DayPlanTypeID);
                    d += db.LoadDayPlanInfo(input.BeginTime, DateTime.Now, input.DayPlanTypeID, input.DayPlanID, g.ID, dt);
                }
                int l = db.AddDayPlan_Send(input.BeginTime, input.EndTime, input.DayPlanID, input.DayPlanTypeID);



                if (d >= 1 && l == 1)
                {
                    json.result    = "0";
                    json.resultStr = "成功加载" + d + "条数据!向“Tab_DayPlan_Send”中插入" + l + "条数据";
                }
                else
                {
                    json.result    = "0";
                    json.resultStr = "返回失败!成功加载0条数据!向“Tab_DayPlan_Send”中插入" + l + "条数据";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#10
0
        public Get_OutAddDayPlan UpdateDayPlan(string data)
        {
            Get_OutAddDayPlan json = new Get_OutAddDayPlan();

            try
            {
                Get_InUpdateDayPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InUpdateDayPlan>(data);
                DBDayPlan           db    = new DBDayPlan();

                int d = db.ModifyDayPlanInfo(input.Plan);
                int l = 0;
                if (d > 0)
                {
                    l = db.AddModifyPlanLog(input.Log);
                }

                int upp = db.UpdatePaiPlan(input.Plan.strTrainPlanGUID, input.Plan.strTrainTypeName, input.Plan.strTrainNumber, input.Plan.strRemark, input.strSiteGUID, input.strDutyGUID);



                if (d == 1 && l == 1 && upp == 1)
                {
                    json.result    = "0";
                    json.resultStr = "成功修改一条机车计划数据,并插入一条日志,更新一条TAB_Plan_Train信息";
                }
                else
                {
                    json.result    = "0";
                    json.resultStr = "返回失败!修改" + d + "条机车计划数据;插入" + l + "条日志信息!";
                }
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }
示例#11
0
        public Get_OutDelete DeleteDayPlan(string data)
        {
            Get_OutDelete json = new Get_OutDelete();

            try
            {
                Get_InDeleteDayPlan input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InDeleteDayPlan>(data);
                DBDayPlan           db    = new DBDayPlan();
                resultDelete        rd    = new resultDelete();
                int d = db.DeleteDayPlan(input.DayPlanGUID);
                int l = 0;
                if (d > 0)
                {
                    l = db.AddModifyPlanLog(input.Log);
                }
                if (d >= 1 && l == 1)
                {
                    rd.result      = true;
                    json.result    = "0";
                    json.resultStr = "成功删除一条机车计划数据,并插入一条日志";
                }
                else
                {
                    rd.result      = false;
                    json.result    = "0";
                    json.resultStr = "返回失败!删除" + d + "条机车计划数据;插入" + l + "条日志信息!";
                }
                json.data = rd;
            }
            catch (Exception ex)
            {
                json.result    = "1";
                json.resultStr = "提交失败:" + ex.Message;
            }
            return(json);
        }