//间接费用分摊 public override double GetFee16() { double Fee = 0; double CheXianCount = 8; int temp1 = (int)this.trainType; ETrainType train1 = (ETrainType)temp1; if (IsUnionHighTrain(train1)) { CheXianCount = 16; } Fee = TrainProfile.JianJieFee * this.YunXingLiCheng * CheXianCount; //趟乘2,年乘2乘365 if (this.IsYearFlag) { Fee = Fee * 2 * 365 / UnitRate; } else { Fee = Fee * 2 / UnitRate; } Fee = JMath.Round1(Fee, this.XiaoShou); return(Fee); }
protected override void OnLoad(EventArgs e) { if (!Page.IsPostBack) { String line1 = Request.QueryString["Line"]; int traintype1 = int.Parse(Request.QueryString["TrainType"]); this.traintype.Text = ((ETrainType)traintype1).ToString(); bool hasDianche = true; if ((ETrainType)traintype1 == ETrainType.空调车25G) { int dianche = int.Parse(Request.QueryString["hasDianChe"]); if (dianche > 0) { this.traintype.Text = this.traintype.Text + "(非直供电)"; hasDianche = true; } else { this.traintype.Text = this.traintype.Text + "(直供电)"; hasDianche = false; } } ETrainType traintype2 = (ETrainType)traintype1; String[] lineNodes = line1.Replace("-", ",").Split(','); String[] bianzhu = Request.QueryString["BianZhu"].Split(','); this.yz1.Text = bianzhu[0]; this.yw1.Text = bianzhu[1]; this.rw1.Text = bianzhu[2]; //保存总的编组数 int totalBianZhu = int.Parse(bianzhu[0]) + int.Parse(bianzhu[1]) + int.Parse(bianzhu[2]); //设置其他的默认编组 TrainLine lineObj = Line.GetTrainLineByTrainTypeAndLineNoeds(traintype2, hasDianche, lineNodes); ViewState["Line"] = lineObj; this.line.Text = line1 + "(" + lineObj.TotalMiles + "公里)"; //设置其他的编组的数据 ECommTrainType traintype3 = (ECommTrainType)traintype1; this.SetBianZhu(traintype3, totalBianZhu); this.CalShouruAndZhiChu(); DataTable dt1 = ViewState["BianZhuData"] as DataTable; if (dt1 != null) { DataView dv = dt1.DefaultView; dv.Sort = "sz desc"; this.repeater1.DataSource = dv; this.repeater1.DataBind(); } } base.OnLoad(e); }
//判断是否为重联的动车 private static bool IsUnionHighTrain(ETrainType type1) { if (type1 == ETrainType.动车CRH2B || type1 == ETrainType.动车CRH2E || type1 == ETrainType.动车CRH380AL || type1 == ETrainType.动车CRH380BL) { return(true); } else { return(false); } }
//判断是否为普通列车 private static bool IsCommonTrain(ETrainType type1) { if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K || type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B) { return(true); } else { return(false); } }
private static bool Is300Train(ETrainType type1) { if (type1 == ETrainType.动车CRH2C || type1 == ETrainType.动车CRH380A || type1 == ETrainType.动车CRH380AL || type1 == ETrainType.动车CRH380B || type1 == ETrainType.动车CRH380BL) { return(true); } else { return(false); } }
//线路使用费 public static double GetFee1( ETrainType type1, bool kongTiao, bool hasDianChe, String[] lineStation) { TrainLine line1 = Line.GetTrainLineByTrainTypeAndLineNoeds(type1, hasDianChe, lineStation); if (line1 != null) { return(GetFee1(type1, kongTiao, line1)); } else { return(0); } }
//设置票价和满员 private void SetPriceAndPerson() { TicketPrice ticket = new TicketPrice(); int traintype1 = int.Parse(Request.QueryString["TrainType"]); ETrainType traintype = (ETrainType)traintype1; ECommTrainType type1 = (ECommTrainType)((int)traintype); int yunxingLiCheng = int.Parse(this.totalmiles.Value); TrainShouRu1 shour1 = null; if (traintype == ETrainType.绿皮车25B) { shour1 = new TrainShouRu1(yunxingLiCheng, false, EJiaKuai.其他); } else { shour1 = new TrainShouRu2(yunxingLiCheng, EJiaKuai.特快); } //设置票价 this.p1.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + ""; this.p2.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + shour1.YinWoPrice1 + ""; this.p3.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + shour1.YinWoPrice2 + ""; this.p4.Value = shour1.YinZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.硬座) + shour1.JiaKuaiFee + shour1.YinWoPrice3 + ""; this.p5.Value = shour1.RuanZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.软卧) + shour1.JiaKuaiFee + shour1.RuanWoPrice1 + ""; this.p6.Value = shour1.RuanZuoPrice + shour1.GetKongTiaoFee(type1, ECommCheXian.软卧) + shour1.JiaKuaiFee + shour1.RuanWoPrice2 + ""; //设置定员 this.m1.Value = ChexianBianZhuData.YinZuo_Pcount + ""; this.m2.Value = (ChexianBianZhuData.YinWo1_Pcount + ChexianBianZhuData.YinWo2_Pcount + ChexianBianZhuData.YinWo3_Pcount) + ""; this.m3.Value = (ChexianBianZhuData.RuanWo1_Pcount + ChexianBianZhuData.RuanWo2_Pcount) + ""; this.m4.Value = TrainProfile.SyCheXianPCount + ""; }
//得到默认的天数 public static double GetDefaultCds1(int total, ETrainType type1) { double result = 1; double speed = 0; int type0 = (int)type1; if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K || type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B) { result = 2; speed = double.Parse(CheXianProfile.Data[(ECommTrainType)type0].SPEED); } else { result = 1; EHighTrainType type2 = (EHighTrainType)type0; DataTable dt1 = HighTrainProfile.Data; if (dt1.Rows.Count > 0) { DataRow[] drs = dt1.Select("HIGHTRAINTYPE='" + type2.ToString() + "'"); if (drs != null && drs.Length > 0) { speed = double.Parse(drs[0]["speed"].ToString()); } } } if (speed > 0) { double temp1 = (total / speed) * 2; if (temp1 < 24) { temp1 = ((total / speed) * 2) / 16; } else { temp1 = temp1 / 24; } result = Math.Ceiling(temp1); } return(result); }
//人员其他的费用--OK internal override double GetFee13() { double fee = 0; if (this.CunZengMoShi == ECunZengMoShi.新人新车 || this.CunZengMoShi == ECunZengMoShi.新人有车) { #region 以前的算法 DataRow[] drs = PersonGZProfile.Data.Select("kind='0'"); foreach (DataRow dr in drs) { String gw = dr["gw"].ToString(); double qtfy = 0; if (dr["QTFY"].ToString().Trim() != String.Empty) { qtfy = double.Parse(dr["QTFY"].ToString()); } double t1 = qtfy; if (gw == "司机") { fee = fee + 2 * t1; //2个司机 } else if (gw == "列车长") { fee = fee + t1; //1个列车长 } else if (gw == "乘务员") { double rs = (this.YinZuo + this.RuanZuo + this.OpenYinWo + this.RuanWo + this.AdvanceRuanWo); if (this.ServerPerson == EServerPerson.一人2车) { rs = Math.Ceiling(rs / 2.0); } else if (this.ServerPerson == EServerPerson.二人3车) { rs = Math.Ceiling(rs * 2 / 3.0); } fee = fee + rs * t1; } else if (gw == "车检") { fee = fee + 2 * t1; if (this.GongDianType == EGongDianType.非直供电) { fee = fee + 2 * t1; //非直供电,增加2人维修发电车 } } } #endregion bool hasDianChe = false; if (this.FaDianChe > 0) { hasDianChe = true; } ETrainType type1 = (ETrainType)((int)this.trainType); int yz = this.yinZuo + this.RuanZuo; int yw = this.openYinWo + this.CloseYinWo + this.ShuYinChe; int rw = this.ruanWo + this.AdvanceRuanWo; fee = TrainPersonBU.GetPersonQtFee(type1, hasDianChe, yz, yw, rw); //计算班次 //double banci = 1; double hour1 = this.GetRunHour(); if (hour1 > 0) { /* * if (this.IsYearFlag) * { * fee = fee * Math.Ceiling(hour1 * 365 / 2000) * 2; * } * else * { * fee = Math.Ceiling(fee / 2000) * Math.Ceiling(hour1) * 2; * }*/ //直接使用车底数 fee = fee * this.CheDiShu * 2; if (this.IsYearFlag == false) { fee = fee * hour1 * 2 / 2000; } /* * if (this.IsYearFlag) * { * banci = Math.Ceiling(hour1 * 365 * 2 / 2000); * } * else * { * banci = hour1 * 2 / 2000; * }*/ } //增加系数(不考虑空调车和单趟) double PRate = 1; if (this.trainType != ECommTrainType.空调车25T && this.IsYearFlag) { if (hour1 > 12 && hour1 <= 18) { PRate = 1.5; } if (hour1 > 18) { PRate = 2.0; } } fee = fee * PRate; //费率计算 fee = fee / UnitRate; return(JMath.Round1(fee, this.XiaoShou)); } else { fee = fee / UnitRate; return(JMath.Round1(fee, this.XiaoShou)); } }
//人员其他费用 internal override double GetFee13() { if (this.CunZengMoShi == ECunZengMoShi.新人新车 || this.CunZengMoShi == ECunZengMoShi.新人有车) { double fee = 0; #region 以前的算法 double sjcount = 0; //司机数量 double czcount = 0; //列车长数量 double cwcount = 0; //乘务员数量 double jxcount = 0; //机械师数量 if (this.bianzhu == EHighTrainBianZhu.单组) { cwcount = 2; czcount = 1; jxcount = 1; sjcount = 2; } else { if (this.isDongWu == false) { cwcount = 4; czcount = 2; jxcount = 2; sjcount = 2; } else { cwcount = 8; czcount = 1; jxcount = 2; sjcount = 2; } } DataRow[] drs = PersonGZProfile.Data.Select("kind='1'"); foreach (DataRow dr in drs) { String gw = dr["gw"].ToString(); double t1 = 0; if (dr["qtfy"].ToString().Trim() != String.Empty) { t1 = double.Parse(dr["qtfy"].ToString()); } if (gw == "司机") { fee = fee + sjcount * t1; //2个司机 } else if (gw == "列车长") { fee = fee + czcount * t1; //1个列车长 } else if (gw == "乘务员") { fee = fee + cwcount * t1; } else if (gw == "车检") { fee = fee + jxcount * t1; } } #endregion ETrainType type1 = (ETrainType)((int)this.trainType); fee = TrainPersonBU.GetPersonQtFee(type1, false, 0, 0, 0); //计算班次 double banci = 1; double hour1 = this.GetRunHour(); if (hour1 > 0) { /* * if (this.IsYearFlag) * { * banci = hour1 * 365 * 2 / 2000; * } * else * { * banci = hour1 * 2 / 2000; * }*/ /* * if (this.IsYearFlag) * { * fee = fee * Math.Ceiling(hour1 * 365 / 2000) * 2; * } * else * { * fee = Math.Ceiling(fee / 2000) * Math.Ceiling(hour1) * 2; * }*/ double cds1 = this.CheDiShu; if (cds1 < 1) { // cds1 = 1.0; //7月5日修改,汉宜线过大。 } //班次的算法 fee = fee * cds1 * 2; if (this.IsYearFlag == false) { fee = fee * hour1 * 2 / 2000; } } fee = fee / UnitRate; return(JMath.Round1(fee * banci, this.XiaoShou)); } else { return(0); } }
//线路使用费--OK internal override double GetFee1() { double fee0 = 0; double jnfee = 0; ETrainType type1 = (ETrainType)((int)this.TrainType); /* * EHighTrainBianZhu bianzhu = EHighTrainBianZhu.单组; * if (IsUnionHighTrain(type1)) * { * bianzhu = EHighTrainBianZhu.重联; * }*/ if (this.Line != null && this.Line.Nodes.Count > 0) { for (int i = 0; i < this.Line.Nodes.Count; i++) { int index0 = int.Parse(this.Line.Nodes[i].LineType); double Rate = 0; if (bianzhu == EHighTrainBianZhu.单组) { if (Is300Train(type1) == false) { Rate = LineProfile.FeeRate[index0].Fee3; } else { Rate = LineProfile.FeeRate[index0].Fee1; } } else { if (Is300Train(type1) == false) { Rate = LineProfile.FeeRate[index0].Fee4; } else { Rate = LineProfile.FeeRate[index0].Fee2; } } if (String.IsNullOrEmpty(this.Line.Nodes[i].JnFlag)) { fee0 = fee0 + Rate * this.Line.Nodes[i].Miles; } else { jnfee = jnfee + Rate * this.Line.Nodes[i].Miles; } } } if (this.IsYearFlag) { fee0 = fee0 * 2 * 365 / UnitRate; jnfee = jnfee * 2 * 365 / UnitRate; this.JnFee = JMath.Round1(jnfee, this.XiaoShou); } else { fee0 = fee0 * 2 / UnitRate; jnfee = jnfee * 2 / UnitRate; this.JnFee = JMath.Round1(jnfee, this.XiaoShou); } //增加全成本和部分成本 if (this.IsFullChengBen == false) { return(JMath.Round1(fee0, this.XiaoShou)); } else { return(JMath.Round1(fee0, this.XiaoShou) + JMath.Round1(jnfee, this.XiaoShou)); } }
void Repeater2_ItemCommand(object source, RepeaterCommandEventArgs e) { RepeaterItem item = e.Item; TrainLine line0 = null; //表示选中的线路 ETrainType train1 = ETrainType.空调车25T; //表示列车类型 double cdsvalue = 1; //表示车底数 String bianZhu = String.Empty; //列车的编组 if (item != null) { Label lab1 = item.FindControl("traintype") as Label; if (lab1 != null) { ListControl rad1 = item.FindControl("selLine") as ListControl; if (rad1 != null) { List <TrainLine> list1 = null; if (lab1.Text == "0" || lab1.Text == "1" || lab1.Text == "2" || lab1.Text == "21") //普通车 { list1 = ViewState["Line4"] as List <TrainLine>; } else if (lab1.Text == "3") //直达车 { list1 = ViewState["Line3"] as List <TrainLine>; } else if (lab1.Text == "4" || lab1.Text == "5") //200公里高速 { list1 = ViewState["Line2"] as List <TrainLine>; } else if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8") //300公里高速 { list1 = ViewState["Line1"] as List <TrainLine>; } line0 = list1[rad1.SelectedIndex]; } ListControl cds = item.FindControl("cds") as ListControl; if (cds != null) { cdsvalue = double.Parse(cds.SelectedValue); } int traintype1 = int.Parse(lab1.Text); if (traintype1 == 21) { traintype1 = 2; } train1 = (ETrainType)(traintype1); Label bianzhu1 = item.FindControl("bianzhu") as Label; if (bianzhu1 != null) { bianZhu = bianzhu1.Text; } //开始计算其中的数值 if (line0 != null) { BusinessRule.PubCode.Util.ExportData("trainData1.xls"); } } } }
/// <summary> /// 计算收入和支出 20140417 /// </summary> /// <param name="line0"></param> /// <param name="item"></param> private void NewCalShourAndZhiChu(TrainLine line0, RepeaterItem item) { bool hasDianChe = false; //表示是否有发电车 Label lab1 = item.FindControl("traintype") as Label; ListControl cds = item.FindControl("cds") as ListControl; int traintype1 = int.Parse(lab1.Text); if (traintype1 == 21) { traintype1 = 2; hasDianChe = true; } ETrainType train1 = (ETrainType)(traintype1); double shouru1 = 0.0; int yz = 0, yw = 0, rw = 0, ca = 0, sy1 = 0; int totalPeople = 0; List <ZhiChuData>[] arrZc = new List <ZhiChuData> [4]; arrZc[0] = new List <ZhiChuData>(); arrZc[1] = new List <ZhiChuData>(); arrZc[2] = new List <ZhiChuData>(); arrZc[3] = new List <ZhiChuData>(); double JnFee = 0; // int cbmode = int.Parse(this.cb.selectIndex); int totalBianZhu = 18; Line.GetLineShouruAndZhiChu(train1, line0, cds.SelectedValue, totalBianZhu, out shouru1, ref yz, ref yw, ref rw, ref ca, ref sy1, out totalPeople, out arrZc[0], out arrZc[1], out arrZc[2], out arrZc[3], out JnFee, hasDianChe, true, 0, ""); //列车的收入 shouru1 = shouru1 / 10000; Label labShouRu = item.FindControl("shouru") as Label; labShouRu.Text = String.Format("{0:n0}", shouru1); //计算列车的运输总人数 Label labTotalPeople = item.FindControl("totalpeople") as Label; labTotalPeople.Text = String.Format("{0:n0}", totalPeople); //计算列车的总支出和合适的车厢编组 for (int i = 1; i <= 4; i++) { LinkButton labZhiChu = item.FindControl("zhichu" + i) as LinkButton; double sum1 = 0; String zc1 = String.Empty; foreach (ZhiChuData d1 in arrZc[i - 1]) { sum1 = sum1 + d1.ZhiChu; if (zc1 == String.Empty) { zc1 = d1.ZhiChu.ToString(); } else { zc1 = zc1 + "," + d1.ZhiChu.ToString(); } } zc1 = zc1 + "," + JnFee; sum1 = sum1 / 10000; labZhiChu.Text = String.Format("{0:n0}", sum1); labZhiChu.OnClientClick = "javascript:ShowZhiChu('" + zc1 + "');return false;"; //设置收支盈亏 Label labsz = item.FindControl("sz" + i) as Label; labsz.Text = String.Format("{0:n0}", shouru1 * SRate - sum1); //计算上座率 Label labSzr = item.FindControl("szr" + i) as Label; labSzr.Text = String.Format("{0:n0}%", 100 * sum1 / (shouru1 * SRate)); } //显示列车的合适编组 HyperLink link2 = item.FindControl("link2") as HyperLink; HyperLink link3 = item.FindControl("link3") as HyperLink; if (link2 != null) { if (int.Parse(lab1.Text) > 3 && lab1.Text != "21") { link2.Visible = false; link3.NavigateUrl = "SeeWordFile2.aspx?IsYear=1&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=0,0,0"; } else { if (lab1.Text != "21") { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=1&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2}", yz, yw, rw)); } else { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=1&TrainType=2&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2}", yz, yw, rw)); } link2.ToolTip = String.Format("最优的编组配置为:硬座{0}/ 硬卧{1}/ 软卧{2}", yz, yw, rw); link3.NavigateUrl = link2.NavigateUrl.Replace("BianZhuFenXi.aspx", "SeeWordFile.aspx"); } } Label bianzhu1 = item.FindControl("bianzhu") as Label; if (bianzhu1 != null) { bianzhu1.Text = String.Format("{0}-{1}-{2}", yz, yw, rw); } }
/// <summary> /// 绑定Repeater的数据 /// </summary> private void NewBindComplete() { foreach (RepeaterItem item in this.Repeater2.Items) { Label lab1 = item.FindControl("traintype") as Label; if (lab1 != null) { //设置不同的车底数 ListControl cds = item.FindControl("cds") as ListControl; if (cds != null) { cds.Items.Clear(); if (lab1.Text == "0" || lab1.Text == "1" || lab1.Text == "2" || lab1.Text == "3" || lab1.Text == "21") { for (int i = 1; i <= 6; i++) { ListItem list1 = new ListItem(i + "", i + ""); cds.Items.Add(list1); } cds.SelectedValue = "2"; } else { cds.Items.Clear(); for (double i = 0.3; i <= 2.1; i = i + 0.1) { ListItem list1 = new ListItem(i + "", i + ""); cds.Items.Add(list1); } cds.SelectedValue = "1"; } } //设置其他的控件 ListControl rad1 = item.FindControl("selLine") as ListControl; if (rad1 != null) { List <TrainLine> list1 = null; ETrainType type1 = ETrainType.绿皮车25B; if (lab1.Text == "21") { type1 = ETrainType.空调车25G; } else { type1 = (ETrainType)(int.Parse(lab1.Text)); } //=================================================================== if (lab1.Text == "0" || lab1.Text == "1" || lab1.Text == "2" || lab1.Text == "21") //普通车 { list1 = ViewState["Line4"] as List <TrainLine>; } else if (lab1.Text == "3") //直达车 { list1 = ViewState["Line3"] as List <TrainLine>; } else if (lab1.Text == "4" || lab1.Text == "5") //200公里高速 { list1 = ViewState["Line2"] as List <TrainLine>; } else if (lab1.Text == "6" || lab1.Text == "7" || lab1.Text == "8") //300公里高速 { list1 = ViewState["Line1"] as List <TrainLine>; } //调整车底数的默认值 if (list1 != null && list1.Count > 0) { TrainLine line0 = list1[0]; int miles = line0.TotalMiles; String defaultcds = Util.GetDefaultCds(miles, type1) + ""; if (cds.Items.FindByValue(defaultcds) != null) { cds.SelectedValue = defaultcds; //设置其他的车底数不能用(仅适用于客车) if (lab1.Text == "0" || lab1.Text == "1" || lab1.Text == "2" || lab1.Text == "3" || lab1.Text == "21") { for (int i = 0; i < cds.Items.Count; i++) { double d1 = double.Parse(cds.Items[i].Value); if (d1 < double.Parse(defaultcds)) { cds.Items[i].Enabled = false; } else { cds.Items[i].Enabled = true; } } } } } //设置选中的线路 this.SetLineItem(rad1, list1); //计算收入和支持 if (rad1.Items.Count > 0) { item.Visible = true; //列车收入和支出 this.NewCalShourAndZhiChu(list1[0], item); } else { item.Visible = false; } } } } }
//线路使用费 public static double GetFee1( ETrainType type1, bool kongTiao, TrainLine line0) { double fee0 = 0; if (line0 != null) { //普通列车 if (IsCommonTrain(type1)) { bool kt = true; if (type1 == ETrainType.绿皮车25B) { kt = kongTiao; } for (int i = 0; i < line0.Nodes.Count; i++) { int index0 = int.Parse(line0.Nodes[i].LineType); double Rate = 0; if (kt == false) { Rate = LineProfile.FeeRate[index0].Fee6; } else { Rate = LineProfile.FeeRate[index0].Fee5; } fee0 = fee0 + Rate * line0.Nodes[i].Miles; } } else //动车组 { EHighTrainBianZhu bianzhu = EHighTrainBianZhu.单组; if (IsUnionHighTrain(type1)) { bianzhu = EHighTrainBianZhu.重联; } for (int i = 0; i < line0.Nodes.Count; i++) { int index0 = int.Parse(line0.Nodes[i].LineType); double Rate = 0; if (bianzhu == EHighTrainBianZhu.单组) { if (Is300Train(type1) == false) { Rate = LineProfile.FeeRate[index0].Fee3; } else { Rate = LineProfile.FeeRate[index0].Fee1; } } else { if (Is300Train(type1) == false) { Rate = LineProfile.FeeRate[index0].Fee4; } else { Rate = LineProfile.FeeRate[index0].Fee2; } } fee0 = fee0 + Rate * line0.Nodes[i].Miles; } } } fee0 = fee0 * 2 * 365; return(fee0); }
//得到默认的车底数 public static double GetDefaultCds(int total, ETrainType type1) { double result = 1; double speed = 0; int type0 = (int)type1; if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K || type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B) { result = 2; speed = double.Parse(CheXianProfile.Data[(ECommTrainType)type0].SPEED); if (speed > 0) { if (total < 1000) { double total1 = total * 1.5; double t1 = (total1 / speed) * 2 / 24.0 + 0.00001; result = Math.Ceiling(t1); } else { double total1 = total; double t1 = (total1 / speed) * 2 / 24.0 + 0.00001; result = Math.Ceiling(t1); if (result < 2) { result = 2; } } } } else { result = 1; EHighTrainType type2 = (EHighTrainType)type0; DataTable dt1 = HighTrainProfile.Data; if (dt1.Rows.Count > 0) { DataRow[] drs = dt1.Select("HIGHTRAINTYPE='" + type2.ToString() + "'"); if (drs != null && drs.Length > 0) { speed = double.Parse(drs[0]["speed"].ToString()); } } if (speed > 0) { double total1 = total; double t1 = (total1 / speed) * 2 / 18.0 + 0.00001; result = Math.Ceiling(t1); } } /* * if (type1 == ETrainType.空调车25G || type1 == ETrainType.空调车25K || type1 == ETrainType.空调车25T || type1 == ETrainType.绿皮车25B) ||{ || if (result < 2) result = 2; ||} ||else ||{ || if (result < 1) result = 1; ||}*/ return(result); }
//得到人员的其他费用 public static double GetPersonQtFee(ETrainType traintype1, bool hasDianChe, int yz, int yw, int rz) { double fee1 = 0; String kind = "1"; String traintype = ""; GetTrainTypeForGz(traintype1, out traintype, out kind, hasDianChe); JTable tab1 = new JTable("trainpersongzview"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("traintype", traintype)); DataSet ds1 = tab1.SearchData(condition, -1, "*"); //记录服务员的值 double total = 0; double fwyqtfy = 0; foreach (DataRow dr1 in ds1.Tables[0].Rows) { double qtfy = 0; if (dr1["QTFY"].ToString().Trim() != String.Empty) { qtfy = double.Parse(dr1["QTFY"].ToString()); } double pcount1 = double.Parse(dr1["pcount"].ToString().Trim()); String gl1 = dr1["gl"].ToString().Trim(); if (gl1 != String.Empty) { if (gl1 == "0") { pcount1 = pcount1 * yz; } else if (gl1 == "2") { pcount1 = pcount1 * yw; } else if (gl1 == "3") { pcount1 = pcount1 * rz; } total = total + pcount1; if (fwyqtfy == 0) { fwyqtfy = qtfy; } } double t1 = qtfy; fee1 = fee1 + t1 * pcount1; /* * //根据车型和岗位,计算相应的资费标准 * DataRow[] drs = PersonGZProfile.Data.Select("kind='" + kind + "' and gw='" + gw1 + "'"); * if (drs != null && drs.Length > 0) * { * DataRow dr = drs[0]; * double qtfy = 0; * if (dr["QTFY"].ToString().Trim() != String.Empty) * { * qtfy = double.Parse(dr["QTFY"].ToString()); * } * * double t1 = qtfy; * fee1 = fee1 + t1 * pcount1; * }*/ } //对人数取整的补偿处理 if (total > 0) { fee1 = fee1 + fwyqtfy * (Math.Ceiling(total) - total); } tab1.Close(); return(fee1); }
// 计算收入和支出 20140417 private void NewCalShourAndZhiChu(TrainLine line0, RepeaterItem item) { bool hasDianChe = false; //表示是否有发电车 bool isYearFlag = false; //表示是否是年分析的模式 if (this.isYearPage.Value == "1") { isYearFlag = true; } Label lab1 = item.FindControl("traintype") as Label; ListControl cds = item.FindControl("cds") as ListControl; int traintype1 = int.Parse(lab1.Text); if (traintype1 == 21) { traintype1 = 2; hasDianChe = true; } //25B和25K有电车(金寿吉新增) if (traintype1 == 0 || traintype1 == 1) { hasDianChe = true; } ETrainType train1 = (ETrainType)(traintype1); double shouru1 = 0.0; int yz1 = 0, yw1 = 0, rw1 = 0, ca1 = 0, sy1 = 0; int totalPeople = 0; List <ZhiChuData>[] arrZc = new List <ZhiChuData> [4]; arrZc[0] = new List <ZhiChuData>(); arrZc[1] = new List <ZhiChuData>(); arrZc[2] = new List <ZhiChuData>(); arrZc[3] = new List <ZhiChuData>(); double JnFee = 0; int totalBianZhu = 18; if (bz.SelectedIndex == 0) //表示是自动编组方式 { totalBianZhu = int.Parse(this.bzs0.SelectedValue); } //编组的选项目 if (this.bz.SelectedIndex == 1) { yz1 = int.Parse(yz.Text); yw1 = int.Parse(yw.Text); rw1 = int.Parse(rw.Text); ca1 = int.Parse(ca.Text); sy1 = int.Parse(sy.Text); } Line.GetLineShouruAndZhiChu(train1, line0, cds.SelectedValue, totalBianZhu, out shouru1, ref yz1, ref yw1, ref rw1, ref ca1, ref sy1, out totalPeople, out arrZc[0], out arrZc[1], out arrZc[2], out arrZc[3], out JnFee, hasDianChe, isYearFlag, cb.SelectedIndex, ""); //列车的收入 shouru1 = shouru1 / 10000; Label labShouRu = item.FindControl("shouru") as Label; if (isYearFlag == false) { labShouRu.Text = String.Format("{0:n2}", shouru1); //labShouRu.Text = shouru1 + ""; } else { labShouRu.Text = String.Format("{0:n0}", shouru1); } //计算列车的运输总人数 Label labTotalPeople = item.FindControl("totalpeople") as Label; labTotalPeople.Text = String.Format("{0}", totalPeople); //计算列车的总支出和合适的车厢编组 for (int i = 1; i <= 4; i++) { Label labZhiChu = item.FindControl("zhichu" + i) as Label; double sum1 = 0; String zc1 = String.Empty; foreach (ZhiChuData d1 in arrZc[i - 1]) { double t1 = d1.ZhiChu; sum1 = sum1 + t1; if (zc1 == String.Empty) { zc1 = d1.ZhiChu.ToString(); } else { zc1 = zc1 + "," + d1.ZhiChu.ToString(); } } zc1 = zc1 + "," + JnFee; if (isYearFlag == false) { labZhiChu.Text = String.Format("{0:n2}", sum1); } else { labZhiChu.Text = String.Format("{0:n0}", sum1); } //labZhiChu.OnClientClick = "javascript:ShowZhiChu('" + zc1 + "');return false;"; //设置收支盈亏 Label labsz = item.FindControl("sz" + i) as Label; if (isYearFlag == false) { labsz.Text = String.Format("{0:n2}", shouru1 * SRate - sum1); } else { labsz.Text = String.Format("{0:n0}", shouru1 * SRate - sum1); } //计算上座率 Label labSzr = item.FindControl("szr" + i) as Label; if (isYearFlag == false) { labSzr.Text = String.Format("{0:n2}%", 100 * sum1 / (shouru1 * SRate)); } else { labSzr.Text = String.Format("{0:n0}%", 100 * sum1 / (shouru1 * SRate)); } } //显示列车的合适编组 HyperLink link2 = item.FindControl("link2") as HyperLink; HyperLink link3 = item.FindControl("link3") as HyperLink; if (link2 != null) { if (int.Parse(lab1.Text) > 3 && lab1.Text != "21") { link2.Visible = false; link3.NavigateUrl = "SeeWordFile2.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=0,0,0,0,0"; } else { if (lab1.Text != "21") { if (lab1.Text == "0" || lab1.Text == "1") //表示 25B和25K { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1)); } else { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=" + lab1.Text + "&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=0&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1)); } } else //表示非直供电25G { link2.NavigateUrl = "BianZhuFenXi.aspx?IsYear=" + this.isYearPage.Value + "&TrainType=2&Line=" + Server.UrlEncode(line0.ToString()) + "&cds=" + cds.SelectedValue + "&hasDianChe=1&BianZhu=" + Server.UrlEncode(String.Format("{0},{1},{2},{3},{4}", yz1, yw1, rw1, ca1, sy1)); } link2.ToolTip = String.Format("最优的编组配置为:硬座{0}/ 硬卧{1}/ 软卧{2}/ 餐车{3} /宿营车{4}", yz1, yw1, rw1, ca1, sy1); link3.NavigateUrl = link2.NavigateUrl.Replace("BianZhuFenXi.aspx", "SeeWordFile.aspx"); if (this.bz.SelectedIndex == 1) { link2.NavigateUrl = "javascript:alert('提示:此功能不适合手动编组模式!');"; link2.ToolTip = String.Format("手动编组:硬座{0}/ 硬卧{1}/ 软卧{2}/ 餐车{3}/宿营车{4}", yz1, yw1, rw1, ca1, sy1); } } } Label bianzhu1 = item.FindControl("bianzhu") as Label; if (bianzhu1 != null) { bianzhu1.Text = String.Format("{0}-{1}-{2}-{3}-{4}", yz1, yw1, rw1, ca1, sy1); } }
/// <summary> /// 列车类型定义 /// </summary> /// <param name="traintype"></param> public TrainTypeProfile(ETrainType traintype) { this.traintype = traintype; }
void button1_Command(object sender, CommandEventArgs e) { if (FrameLib.CheckData(button1)) { button1.ExecutePara.Success = true; if (this.Line.Text.Trim() != String.Empty) { //检查线路的配置是否正确 String traintype = this.TrainType.Text.Trim(); ETrainType type1 = ETrainType.空调车25T; if (traintype == "动车组") { type1 = ETrainType.动车CRH2A; } else if (traintype == "空调特快") { type1 = ETrainType.空调车25T; } else if (traintype == "空调快速") { type1 = ETrainType.空调车25G; } else if (traintype == "空调普快") { type1 = ETrainType.空调车25G; } else if (traintype == "快速") { type1 = ETrainType.空调车25K; } else if (traintype == "普快") { type1 = ETrainType.绿皮车25B; } String[] lineNodes = this.Line.Text.Trim().Replace("-", ",").Split(','); TrainLine lineObj = BusinessRule.Line.GetTrainLineByTrainTypeAndLineNoeds(type1, false, lineNodes); if (lineObj != null) { if (lineObj.TotalMiles + "" != this.Mile.Text.Trim()) { button1.ExecutePara.Success = false; button1.ExecutePara.FailInfo = "错误:线路的距离设置错误,应为(" + lineObj.TotalMiles + "公里)!"; } } else { button1.ExecutePara.Success = false; button1.ExecutePara.FailInfo = "错误:线路的配置不对或线路不存在!"; } } if (button1.ExecutePara.Success) { button1.JButtonType = JButtonType.SimpleAction; FrameLib.ExecuteJButton(button1); } else { FrameLib.ExecuteButtonInfo(button1); } } }
//Fee7:人员和工资附加费--OK internal override double GetFee7() { double fee = 0; if (this.CunZengMoShi == ECunZengMoShi.新人新车 || this.CunZengMoShi == ECunZengMoShi.新人有车) { #region 以前的算法 /* * DataRow[] drs = PersonGZProfile.Data.Select("kind='0'"); * foreach (DataRow dr in drs) * { * String gw = dr["gw"].ToString(); * double fj = 0; * if (dr["FJ"].ToString().Trim() != String.Empty) * { * fj = double.Parse(dr["FJ"].ToString()); * } * * double gz1 = 0; * if (dr["FJ"].ToString().Trim() != String.Empty) * { * gz1 = double.Parse(dr["FJ"].ToString()); * } * * * double t1 = gz1 * (1 + fj / 100d); * * if (gw == "司机") * { * fee = fee + 2 * t1; //2个司机 * } * else if (gw == "列车长") * { * fee = fee + t1; //1个列车长 * } * else if (gw == "乘务员") * { * double rs = (this.YinZuo + this.RuanZuo + * this.OpenYinWo + this.RuanWo + this.AdvanceRuanWo); * * if (this.ServerPerson == EServerPerson.一人2车) * { * rs = Math.Ceiling(rs / 2.0); * } * else if (this.ServerPerson == EServerPerson.二人3车) * { * rs = Math.Ceiling(rs * 2 / 3.0); * } * * fee = fee + rs * t1; * } * else if (gw == "车检") * { * fee = fee + 2 * t1; * * if (this.GongDianType == EGongDianType.非直供电) * { * fee = fee + 2*t1; //非直供电,增加2人维修发电车 * } * } * }*/ #endregion bool hasDianChe = false; if (this.FaDianChe > 0) { hasDianChe = true; } ETrainType type1 = (ETrainType)((int)this.trainType); //设置不同车厢的数量 int yz = this.yinZuo + this.RuanZuo; int yw = this.openYinWo + this.CloseYinWo + this.ShuYinChe; int rw = this.ruanWo + this.AdvanceRuanWo; fee = TrainPersonBU.GetPersonGzAndFjFee(type1, hasDianChe, yz, yw, rw); //计算班次 //double banci = 1; //调整为按车底数计算 double hour1 = this.GetRunHour(); /* * if (hour1 > 0) * { * if (this.IsYearFlag) * { * fee = fee * Math.Ceiling( hour1 * 365 / 2000) * 2; * } * else * { * fee =Math.Ceiling(fee /2000) * Math.Ceiling(hour1) * 2 ; * } * }*/ fee = fee * this.CheDiShu * 2; if (this.IsYearFlag == false) { fee = fee * hour1 * 2 / 2000; } //增加系数(空调车和单趟不考虑) double PRate = 1; if (this.trainType != ECommTrainType.空调车25T && this.IsYearFlag) { if (hour1 > 12 && hour1 <= 18) { PRate = 1.5; } if (hour1 > 18) { PRate = 2.0; } } fee = fee * PRate; //计算 fee = fee / UnitRate; return(JMath.Round1(fee, this.XiaoShou)); } else { fee = fee * UnitRate; return(JMath.Round1(fee, this.XiaoShou)); } }
//得到车的类型字符串和类别 private static void GetTrainTypeForGz(ETrainType type1, out String traintype1, out String kind, bool hadDianche) { traintype1 = String.Empty; kind = String.Empty; switch (type1) { //============客车================ case ETrainType.绿皮车25B: traintype1 = "25B"; kind = "0"; break; case ETrainType.空调车25T: traintype1 = "25T"; kind = "0"; break; case ETrainType.空调车25K: if (hadDianche) { traintype1 = "25G(非直)"; } else { traintype1 = "25G(直)"; } kind = "0"; break; case ETrainType.空调车25G: if (hadDianche) { traintype1 = "25G(非直)"; } else { traintype1 = "25G(直)"; } kind = "0"; break; //==========动车=============== case ETrainType.动车CRH2E: traintype1 = "CRH动卧"; kind = "1"; break; case ETrainType.动车CRH380AL: traintype1 = "CRH动坐(16)"; kind = "1"; break; //---------修改的地方 13年3月13日------------ case ETrainType.动车CRH380BL: traintype1 = "CRH动坐(16)"; kind = "1"; break; //-------------------------------------------- case ETrainType.动车CRH5A: traintype1 = "CRH动坐(8)"; kind = "1"; break; case ETrainType.动车CRH380A: traintype1 = "CRH动坐(8)"; kind = "1"; break; //---------修改的地方 13年3月13日------------ case ETrainType.动车CRH380B: traintype1 = "CRH动坐(8)"; kind = "1"; break; //-------------------------------------------- case ETrainType.动车CRH2C: traintype1 = "CRH动坐(8)"; kind = "1"; break; case ETrainType.动车CRH2B: traintype1 = "CRH动坐(8)"; kind = "1"; break; case ETrainType.动车CRH2A: traintype1 = "CRH动坐(8)"; kind = "1"; break; default: break; } }
// 分析线路 private void SearchLine() { String A0 = this.AStation.Text.Trim(); String B0 = this.BStation.Text.Trim(); if (String.IsNullOrEmpty(A0) == false && String.IsNullOrEmpty(B0) == false) { bool flag = true; if (Line.isExistsStation(A0) == false) { WebFrame.Util.JAjax.Alert("错误:起始站【" + A0 + "】不存在!"); flag = false; } if (flag) { if (Line.isExistsStation(B0) == false) { WebFrame.Util.JAjax.Alert("错误:终点站【" + B0 + "】不存在!"); flag = false; } } if (flag) { String traintype = Request.QueryString["traintype"]; ETrainType type1 = ETrainType.空调车25T; if (traintype == "动车组") { type1 = ETrainType.动车CRH2A; } else if (traintype == "空调特快") { type1 = ETrainType.空调车25T; } else if (traintype == "空调快速") { type1 = ETrainType.空调车25G; } else if (traintype == "空调普快") { type1 = ETrainType.空调车25G; } else if (traintype == "快速") { type1 = ETrainType.空调车25K; } else if (traintype == "普快") { type1 = ETrainType.绿皮车25B; } String[] arr1 = null; if (this.mulLine.Text.Trim() == String.Empty) { arr1 = Line.GetLineArr(this.AStation.Text, this.BStation.Text, type1, this.middleStation.Text, false); } else { arr1 = Line.GetLineArrByFengDuanSearch(this.AStation.Text, this.BStation.Text, this.mulLine.Text.Trim(), type1, this.middleStation.Text, false); } if (arr1 != null) { this.Repeater1.DataSource = arr1; this.Repeater1.DataBind(); } else { WebFrame.Util.JAjax.Alert("错误:没有搜索到合适的线路!"); } } } else { WebFrame.Util.JAjax.Alert("错误:请输入车次的起点和终点"); } }