コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    TitleInitial("燃润料报表列表", "编辑航次相關燃润料报表,用户可以使用“添加油料”按钮跳转到油料添加報表栏目,完善途经港口加油记录。");
                    this.VoyageIds = GetRequest("voyageIds");
                    this.ReportID = GetRequest("baseId");

                    if (string.IsNullOrEmpty(this.ReportID))
                    {
                        if (string.IsNullOrEmpty(this.VoyageIds))
                        {
                            ShowMsg("请指定报表或者报表相关的航次。");
                            return;
                        }
                        HangciBaseInput hcbi = new HangciBaseInput();
                        HangciBaseInputInfo hcbii = new HangciBaseInputInfo();

                        hcbii.ShipInputDate = DateTime.Now;
                        hcbii.GeneralManagerDate = DateTime.Now;

                        this.ReportID = hcbi.Add(hcbii);
                        new Voyage().UpdateVoyage(this.VoyageIds, this.ReportID);
                    }

                    BindData(this.ReportID);
                }
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                #region 验证逻辑
                string hangciBaseId = "";
                double diff = Convert.ToDouble(ViewState["diffHrs"].ToString());
                double t1 = Convert.ToDouble(judgeIsNull(tbWorkTime1.Text));
                if (t1 > diff)
                {
                    ShowMsg("主机航次工作时间不能大于航次总时间!");
                    return;
                }

                double t2 = Convert.ToDouble(judgeIsNull(tbWorkTime2.Text));
                if (t2 > diff)
                {
                    ShowMsg("副机1航次工作时间不能大于航次总时间!");
                    return;
                }

                double t3 = Convert.ToDouble(judgeIsNull(tbWorkTime3.Text));
                if (t3 > diff)
                {
                    ShowMsg("副机2航次工作时间不能大于航次总时间!");
                    return;
                }

                double t4 = Convert.ToDouble(judgeIsNull(tbWorkTime4.Text));
                if (t4 > diff)
                {
                    ShowMsg("副机3航次工作时间不能大于航次总时间!");
                    return;
                }

                double t5 = Convert.ToDouble(judgeIsNull(tbWorkTime5.Text));
                if (t5 > diff)
                {
                    ShowMsg("锅炉航次工作时间不能大于航次总时间!");
                    return;
                }
                #endregion

                string voyageIds = this.VoyageIds;
                string baseId = GetViewState("baseId");
                hangciBaseId = baseId;

                HangciBaseInputInfo hcbii = new HangciBaseInputInfo();
                if (string.IsNullOrEmpty(hangciBaseId))
                {
                    hangciBaseId = new HangciBaseInput().Add(hcbii);
                    new Voyage().UpdateVoyage(voyageIds, hangciBaseId);
                }
                hcbii = new HangciBaseInput().GetByID(baseId);
                if (!cCaptainDate.Text.Equals(""))
                {
                    hcbii.ShipInputDate = Convert.ToDateTime(cCaptainDate.Text);
                }
                if (!cGeneralDate.Text.Equals(""))
                {
                    hcbii.GeneralManagerDate = Convert.ToDateTime(cGeneralDate.Text);
                }
                new HangciBaseInput().Update(hcbii);

                //--------------------船舶油料航次消耗表------------------
                VoyageConsume vc = new VoyageConsume();
                VoyageConsumeInfo vci = new VoyageConsumeInfo();
                vci.BaseInputID = Convert.ToInt32(hangciBaseId);

                //主机
                vci.MainSlowWorkTime = judgeIsNull(tbSlowWorkTime1.Text);
                vci.MainCruiseWorkTime = judgeIsNull(tbCruiseWorkTime1.Text);
                vci.VoyageWorkTime = judgeIsNull(tbWorkTime1.Text);
                vci.FuelConsume = judgeIsNull(tbFuelConsume1.Text);
                vci.DieselConsume = judgeIsNull(tbDieselConsume1.Text);
                vci.OtherConsume = judgeIsNull(tbOtherConsume1.Text);
                vci.ShipComponentID = 1;

                if (string.IsNullOrEmpty(lbConZhuji.Text))
                {
                    lbConZhuji.Text = vc.Add(vci);
                }
                else
                {
                    vci.ID = lbConZhuji.Text;
                    vc.Update(vci);
                }

                //副机1
                vci.MainSlowWorkTime = judgeIsNull(tbSlowWorkTime2.Text);
                vci.MainCruiseWorkTime = judgeIsNull(tbCruiseWorkTime2.Text);
                vci.VoyageWorkTime = judgeIsNull(tbWorkTime2.Text);
                vci.FuelConsume = judgeIsNull(tbFuelConsume2.Text);
                vci.DieselConsume = judgeIsNull(tbDieselConsume2.Text);
                vci.OtherConsume = judgeIsNull(tbOtherConsume2.Text);
                vci.ShipComponentID = 2;

                if (string.IsNullOrEmpty(lbConFuji1.Text))
                {
                    lbConFuji1.Text = vc.Add(vci);
                }
                else
                {
                    vci.ID = lbConFuji1.Text;
                    vc.Update(vci);
                }

                //副机2
                vci.MainSlowWorkTime = judgeIsNull(tbSlowWorkTime3.Text);
                vci.MainCruiseWorkTime = judgeIsNull(tbCruiseWorkTime3.Text);
                vci.VoyageWorkTime = judgeIsNull(tbWorkTime3.Text);
                vci.FuelConsume = judgeIsNull(tbFuelConsume3.Text);
                vci.DieselConsume = judgeIsNull(tbDieselConsume3.Text);
                vci.OtherConsume = judgeIsNull(tbOtherConsume3.Text);
                vci.ShipComponentID = 3;

                if (string.IsNullOrEmpty(lbConFuji2.Text))
                {
                    lbConFuji2.Text = vc.Add(vci);
                }
                else
                {
                    vci.ID = lbConFuji2.Text;
                    vc.Update(vci);
                }

                //副机3
                vci.MainSlowWorkTime = judgeIsNull(tbSlowWorkTime4.Text);
                vci.MainCruiseWorkTime = judgeIsNull(tbCruiseWorkTime4.Text);
                vci.VoyageWorkTime = judgeIsNull(tbWorkTime4.Text);
                vci.FuelConsume = judgeIsNull(tbFuelConsume4.Text);
                vci.DieselConsume = judgeIsNull(tbDieselConsume4.Text);
                vci.OtherConsume = judgeIsNull(tbOtherConsume4.Text);
                vci.ShipComponentID = 4;
                vc.Add(vci);

                if (string.IsNullOrEmpty(lbConFuji3.Text))
                {
                    lbConFuji3.Text = vc.Add(vci);
                }
                else
                {
                    vci.ID = lbConFuji3.Text;
                    vc.Update(vci);
                }

                //锅炉
                vci.MainSlowWorkTime = judgeIsNull(tbSlowWorkTime5.Text);
                vci.MainCruiseWorkTime = judgeIsNull(tbCruiseWorkTime5.Text);
                vci.VoyageWorkTime = judgeIsNull(tbWorkTime5.Text);
                vci.FuelConsume = judgeIsNull(tbFuelConsume5.Text);
                vci.DieselConsume = judgeIsNull(tbDieselConsume5.Text);
                vci.OtherConsume = judgeIsNull(tbOtherConsume5.Text);
                vci.ShipComponentID = 5;

                if (string.IsNullOrEmpty(lbConGuolu.Text))
                {
                    lbConGuolu.Text = vc.Add(vci);
                }
                else
                {
                    vci.ID = lbConGuolu.Text;
                    vc.Update(vci);
                }

                //--------------------燃润油领用结存(吨)------------------

                OilUseBalance oub = new OilUseBalance();
                OilUseBalanceInfo oubi = new OilUseBalanceInfo();

                oubi.BaseInputID = Convert.ToInt32(hangciBaseId);

                //燃料油
                oubi.Remaining = judgeIsNull(tbRemain1.Text);
                oubi.Addition = judgeIsNull(tbAdd1.Text);
                oubi.Consuming = judgeIsNull(tbConsume1.Text);
                oubi.Balance = judgeIsNull(tbBalance1.Text);
                oubi.OilTypeID = 1;

                if (string.IsNullOrEmpty(lbOilBalFuel.Text))
                {
                    lbOilBalFuel.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOilBalFuel.Text;
                    oub.Update(oubi);
                }

                //柴油
                oubi.Remaining = judgeIsNull(tbRemain2.Text);
                oubi.Addition = judgeIsNull(tbAdd2.Text);
                oubi.Consuming = judgeIsNull(tbConsume2.Text);
                oubi.Balance = judgeIsNull(tbBalance2.Text);
                oubi.OilTypeID = 2;

                if (string.IsNullOrEmpty(lbOilBalDiesel.Text))
                {
                    lbOilBalDiesel.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOilBalDiesel.Text;
                    oub.Update(oubi);
                }

                //机油
                oubi.Remaining = judgeIsNull(tbRemain3.Text);
                oubi.Addition = judgeIsNull(tbAdd3.Text);
                oubi.Consuming = judgeIsNull(tbConsume3.Text);
                oubi.Balance = judgeIsNull(tbBalance3.Text);
                oubi.OilTypeID = 3;

                if (string.IsNullOrEmpty(lbOilBalEngine.Text))
                {
                    lbOilBalEngine.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOilBalEngine.Text;
                    oub.Update(oubi);
                }

                //气缸油
                oubi.Remaining = judgeIsNull(tbRemain4.Text);
                oubi.Addition = judgeIsNull(tbAdd4.Text);
                oubi.Consuming = judgeIsNull(tbConsume4.Text);
                oubi.Balance = judgeIsNull(tbBalance4.Text);
                oubi.OilTypeID = 4;

                if (string.IsNullOrEmpty(lbOilBalCylinder.Text))
                {
                    lbOilBalCylinder.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOilBalCylinder.Text;
                    oub.Update(oubi);
                }

                //透平油
                oubi.Remaining = judgeIsNull(tbRemain5.Text);
                oubi.Addition = judgeIsNull(tbAdd5.Text);
                oubi.Consuming = judgeIsNull(tbConsume5.Text);
                oubi.Balance = judgeIsNull(tbBalance5.Text);
                oubi.OilTypeID = 5;

                if (string.IsNullOrEmpty(lbOilBalTurbine.Text))
                {
                    lbOilBalTurbine.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOilBalTurbine.Text;
                    oub.Update(oubi);
                }

                //液压油
                oubi.Remaining = judgeIsNull(tbRemain6.Text);
                oubi.Addition = judgeIsNull(tbAdd6.Text);
                oubi.Consuming = judgeIsNull(tbConsume6.Text);
                oubi.Balance = judgeIsNull(tbBalance6.Text);
                oubi.OilTypeID = 6;

                if (string.IsNullOrEmpty(lbOilBalHydraulic.Text))
                {
                    lbOilBalHydraulic.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOilBalHydraulic.Text;
                    oub.Update(oubi);
                }

                //冷冻油
                oubi.Remaining = judgeIsNull(tbRemain7.Text);
                oubi.Addition = judgeIsNull(tbAdd7.Text);
                oubi.Consuming = judgeIsNull(tbConsume7.Text);
                oubi.Balance = judgeIsNull(tbBalance7.Text);
                oubi.OilTypeID = 8;

                if (string.IsNullOrEmpty(lbFrozenOil.Text))
                {
                    lbFrozenOil.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbFrozenOil.Text;
                    oub.Update(oubi);
                }

                //空压机油
                oubi.Remaining = judgeIsNull(tbRemain8.Text);
                oubi.Addition = judgeIsNull(tbAdd8.Text);
                oubi.Consuming = judgeIsNull(tbConsume8.Text);
                oubi.Balance = judgeIsNull(tbBalance8.Text);
                oubi.OilTypeID = 9;

                if (string.IsNullOrEmpty(lbPressOil.Text))
                {
                    lbPressOil.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbPressOil.Text;
                    oub.Update(oubi);
                }

                //其他
                oubi.Remaining = judgeIsNull(tbRemain9.Text);
                oubi.Addition = judgeIsNull(tbAdd9.Text);
                oubi.Consuming = judgeIsNull(tbConsume9.Text);
                oubi.Balance = judgeIsNull(tbBalance9.Text);
                oubi.OilTypeID = 7;

                if (string.IsNullOrEmpty(lbOtherOil.Text))
                {
                    lbOtherOil.Text = oub.Add(oubi);
                }
                else
                {
                    oubi.ID = lbOtherOil.Text;
                    oub.Update(oubi);
                }
                ShowMsg("保存成功");
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
コード例 #3
0
        /// <summary>
        /// 绑定燃润列表
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="pageIndex"></param>
        private void BindReport(int pageSize, int pageIndex)
        {
            try
            {
                //string qShipName = tbShipName.Text;
                //string qStartDate = tbStartDate.Text;
                //string qEndDate = tbEndDate.Text;
                //string qStartPort = ddlStartPort.SelectedValue;
                //string qEndPort = ddlEndPort.SelectedValue;
                string qShipName = string.Empty;
                string qStartDate = string.Empty;
                string qEndDate = string.Empty;
                string qStartPort = string.Empty;
                string qEndPort = string.Empty;

                string shipID = MonthAndShipNavigate1.ShipID;
                if (string.IsNullOrEmpty(shipID) == false)
                {
                    ShipInfo sInfo = new Ship().GetByID(shipID);
                    qShipName = sInfo.Name;
                }
                string dateID = MonthAndShipNavigate1.DateID;

                DataSet ds = new HangciBaseInput().GetBaseInputList(dateID, qShipName, qStartDate, qEndDate, qStartPort, qEndPort, pageSize, pageIndex);
                gvReportList.DataSource = ds;
                gvReportList.DataBind();
                CustomDataSet cDS = ds as CustomDataSet;
                if (cDS == null)
                {
                    pGridV.TotalAmout = 0;
                    return;
                }
                pGridV.TotalAmout = cDS.TotalAmout;

            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
コード例 #4
0
        private void BindData(string reportID)
        {
            try
            {
                double diffHrs = 0;
                string voyageName = "";
                // 距离(海里)
                string distance = "";
                // 经停港
                string totalRoute = string.Empty;
                double sumDistance = 0;
                string shipName = "";
                string sTime = "";
                string eTime = "";
                string sPort = "";
                string ePort = "";
                string captain = "";
                string chiefEngineer = "";
                string generalManager = "";
                DateTime temp = new DateTime();

                IList<VoyageInfo> vList = new Voyage().GetVoyageListByReportID(reportID);
                string voyageIds = string.Empty;
                for (int i = 0; i < vList.Count; i++)
                {
                    VoyageInfo vInfo = vList[i];
                    voyageIds += "," + vInfo.ID;
                    RouteInfo rInfo = new Route().GetByID(vInfo.RouteID.ToString());
                    if (i == 0)
                    {
                        shipName = vInfo.ShipName;
                        sTime = vInfo.BeginDate.ToString("yyyy-MM-dd hh:mm");
                        sPort = vInfo.sName;
                        captain = vInfo.Captain;
                        chiefEngineer = vInfo.ChiefEngineer;
                        generalManager = vInfo.GeneralManager;
                    }

                    voyageName += " + " + vInfo.Name;
                    distance += " + " + vInfo.Distance;
                    totalRoute += " + " + rInfo.TotalRoute;
                    sumDistance += vInfo.Distance; ;
                    eTime = vInfo.EndDate.ToString("yyyy-MM-dd hh:mm");
                    diffHrs += vInfo.DiffHours;

                    if (Convert.ToDateTime(eTime) > temp)
                    {
                        temp = Convert.ToDateTime(eTime);
                        ePort = vInfo.eName;
                    }
                }
                this.VoyageIds = voyageIds.Substring(1);
                voyageName = string.IsNullOrEmpty(voyageName) ? string.Empty : voyageName.Substring(3);
                distance = string.IsNullOrEmpty(distance) ? string.Empty : distance.Substring(3);
                totalRoute = string.IsNullOrEmpty(totalRoute) ? string.Empty : totalRoute.Substring(3);

                // 显示总里程
                if (vList.Count > 1)
                {
                    distance += " = " + sumDistance.ToString();
                }

                lblVoyage.Text = voyageName;
                lblDistance.Text = distance + " " + totalRoute;
                lblShipName.Text = shipName;
                lblStartTime.Text = sTime;
                lblStartPort.Text = sPort;
                lblEndTime.Text = eTime;
                lblEndPort.Text = ePort;
                ViewState["diffHrs"] = diffHrs.ToString();

                HangciBaseInputInfo ii = new HangciBaseInput().GetByID(reportID);
                cCaptainDate.Text = ii.ShipInputDate.ToString("yyyy-MM-dd");
                cGeneralDate.Text = ii.GeneralManagerDate.ToString("yyyy-MM-dd");
                lblChiefEngineer.Text = chiefEngineer;
                lblCaptain.Text = captain;
                lblGeneralManager.Text = generalManager;
                bindConsumeInfo(reportID);
                bindOilBalanceInfo(reportID);
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
コード例 #5
0
        private void bindDv(string year, string month)
        {
            DataTable dtData = new DataTable();
            HangciBaseInput hcbi = new HangciBaseInput();

            dtData = hcbi.GetMonthlyReportData(year, month);

            DataTable dt = new DataTable();
            dt.Columns.Add("serialNo");
            dt.Columns.Add("shipName");
            dt.Columns.Add("fujiGo");
            dt.Columns.Add("fujiFo");
            dt.Columns.Add("zhujiGo");
            dt.Columns.Add("zhujiFo");
            dt.Columns.Add("guoluGo");
            dt.Columns.Add("guoluFo");
            dt.Columns.Add("other");
            dt.Columns.Add("sumup");
            dt.Columns.Add("zhongYouBi");
            dt.Columns.Add("fujiDay");
            dt.Columns.Add("zhujiDay");
            dt.Columns.Add("distance");
            dt.Columns.Add("tonPerKilo");
            dt.Columns.Add("fujiTonDay");
            dt.Columns.Add("zhujiTonDay");
            dt.Columns.Add("distanDay");
            dt.Columns.Add("TonPerKilo2");
            dt.Columns.Add("beginDate");
            dt.Columns.Add("endDate");

            string shipId = "";
            int serialno = 1;
            double distance = 0;
            double kgkilo = 10000;//未知暂用10000

            //用于计算重油比
            double fo = 0.0;
            double go = 0.0;

            for (int i = 0; i < dtData.Rows.Count; i++)
            {
                string tmpShipId = dtData.Rows[i]["shipId"].ToString();

                //第一条
                if (!tmpShipId.Equals(shipId))
                {
                    fo = 0.0;
                    go = 0.0;

                    shipId = tmpShipId;
                    distance = Convert.ToDouble(dtData.Rows[i]["distance"].ToString());

                    DataRow dr = dt.NewRow();
                    dr["serialNo"] = serialno;
                    dr["shipName"] = dtData.Rows[i]["shipName"].ToString();
                    dr["distance"] = distance;
                    dr["beginDate"] = dtData.Rows[i]["beginDate"].ToString();
                    dr["endDate"] = dtData.Rows[i]["endDate"].ToString();

                    dr["fujiGo"] = "0";
                    dr["fujiFo"] = "0";
                    dr["zhujiGo"] = "0";
                    dr["zhujiFo"] = "0";
                    dr["guoluGo"] = "0";
                    dr["guoluFo"] = "0";
                    dr["other"] = "0";
                    dr["sumup"] = "0";
                    dr["zhongYouBi"] = "0";
                    dr["fujiDay"] = "0";
                    dr["zhujiDay"] = "0";
                    dr["tonPerKilo"] = "未知暂用10000";
                    dr["fujiTonDay"] = "0";
                    dr["zhujiTonDay"] = "0";
                    dr["distanDay"] = "0";
                    dr["TonPerKilo2"] = "0";

                    //主机
                    string componentid = dtData.Rows[i]["ShipComponentID"].ToString();
                    if (componentid.Equals("1"))
                    {
                        double diesel = Convert.ToDouble(dtData.Rows[i]["DieselConsume"].ToString());
                        double fuel = Convert.ToDouble(dtData.Rows[i]["FuelConsume"].ToString());
                        double other = Convert.ToDouble(dtData.Rows[i]["OtherConsume"].ToString());
                        double zhujiday = Convert.ToDouble(dtData.Rows[i]["MainSlowWorkTime"].ToString()) +
                                          Convert.ToDouble(dtData.Rows[i]["MainCruiseWorkTime"].ToString()) +
                                          Convert.ToDouble(dtData.Rows[i]["VoyageWorkTime"].ToString());

                        fo += fuel;
                        go += diesel;

                        dr["zhujiGo"] = diesel.ToString();
                        dr["zhujiFo"] = fuel.ToString();
                        dr["zhujiDay"] = zhujiday.ToString();
                        dr["other"] = other.ToString();
                        dr["sumup"] = (diesel + fuel + other).ToString();
                        dr["zhujiTonDay"] = Math.Round(((diesel + fuel) / zhujiday),2).ToString();
                        dr["distanDay"] = Math.Round((1000 * (diesel + fuel + other) / distance),2).ToString();
                        dr["TonPerKilo2"] = Math.Round((1000 * (diesel + fuel + other) / kgkilo),2).ToString();
                        
                    }
                    dt.Rows.Add(dr);
                    serialno++;
                }
                else
                {
                    //辅机
                    string componentid = dtData.Rows[i]["ShipComponentID"].ToString();
                    if (componentid.Equals("2") || componentid.Equals("3") || componentid.Equals("4"))
                    {
                        double diesel = Convert.ToDouble(dtData.Rows[i]["DieselConsume"].ToString());
                        double fuel = Convert.ToDouble(dtData.Rows[i]["FuelConsume"].ToString());
                        double other = Convert.ToDouble(dtData.Rows[i]["OtherConsume"].ToString());
                        double fujiday = Convert.ToDouble(dtData.Rows[i]["MainSlowWorkTime"].ToString()) +
                                          Convert.ToDouble(dtData.Rows[i]["MainCruiseWorkTime"].ToString()) +
                                          Convert.ToDouble(dtData.Rows[i]["VoyageWorkTime"].ToString());

                        double orgfujiGo = Convert.ToDouble(dt.Rows[serialno - 2]["fujiGo"].ToString());//dt.Columns.Add("fujiGo");
                        double orgfujiFo = Convert.ToDouble(dt.Rows[serialno - 2]["fujiFo"].ToString());
                        double orgOther = Convert.ToDouble(dt.Rows[serialno - 2]["other"].ToString());
                        double orgsumup = Convert.ToDouble(dt.Rows[serialno - 2]["sumup"].ToString());
                        double orgfujiDay = Convert.ToDouble(dt.Rows[serialno - 2]["fujiDay"].ToString());

                        fo += fuel;
                        go += diesel;

                        dt.Rows[serialno - 2]["fujiGo"] = (orgfujiGo + diesel).ToString();
                        dt.Rows[serialno - 2]["fujiFo"] = (orgfujiFo + fuel).ToString();
                        dt.Rows[serialno - 2]["other"] = (orgOther + other).ToString();
                        dt.Rows[serialno - 2]["sumup"] = (orgsumup + fuel + diesel + other).ToString();
                        dt.Rows[serialno - 2]["fujiDay"] = (orgfujiDay + fujiday).ToString();
                        dt.Rows[serialno - 2]["fujiTonDay"] = Math.Round((orgfujiFo + fuel) / (orgfujiDay + fujiday),2).ToString();
                        dt.Rows[serialno - 2]["distanDay"] = Math.Round((1000 * (orgsumup + fuel + orgOther) / distance),2).ToString();
                        dt.Rows[serialno - 2]["TonPerKilo2"] = Math.Round((1000 * (orgsumup + fuel + orgOther) / kgkilo),2).ToString();
                    }
                    //锅炉
                    if (dtData.Rows[i]["ShipComponentID"].ToString().Equals("5"))
                    {
                        double diesel = Convert.ToDouble(dtData.Rows[i]["DieselConsume"].ToString());
                        double fuel = Convert.ToDouble(dtData.Rows[i]["FuelConsume"].ToString());
                        double other = Convert.ToDouble(dtData.Rows[i]["OtherConsume"].ToString());

                        double orgOther = Convert.ToDouble(dt.Rows[serialno - 2]["other"].ToString());
                        double orgsumup = Convert.ToDouble(dt.Rows[serialno - 2]["sumup"].ToString());

                        fo += fuel;
                        go += diesel;

                        dt.Rows[serialno - 2]["guoluGo"] = diesel.ToString();
                        dt.Rows[serialno - 2]["guoluFo"] = fuel.ToString();
                        dt.Rows[serialno - 2]["other"] = (orgOther + other).ToString();
                        dt.Rows[serialno - 2]["sumup"] = (orgsumup + + diesel + fuel + other).ToString();
                        dt.Rows[serialno - 2]["distanDay"] = Math.Round((1000 * (orgsumup + +diesel + fuel + other) / distance),2).ToString();
                        dt.Rows[serialno - 2]["TonPerKilo2"] = Math.Round((1000 * (orgsumup + fuel + orgOther) / kgkilo),2).ToString();

                        dt.Rows[serialno - 2]["zhongYouBi"] = Math.Round(fo * 100 / (fo + go),2).ToString();
                    }

                }
            }

            DataRow dr2 = dt.NewRow();
            dr2["serialNo"] = "";
            dr2["shipName"] = "";
            dr2["distance"] = "";
            dr2["beginDate"] = "";
            dr2["endDate"] = "";

            dr2["fujiGo"] = "";
            dr2["fujiFo"] = "";
            dr2["zhujiGo"] = "";
            dr2["zhujiFo"] = "";
            dr2["guoluGo"] = "";
            dr2["guoluFo"] = "";
            dr2["other"] = "";
            dr2["sumup"] = "";
            dr2["zhongYouBi"] = "";
            dr2["fujiDay"] = "";
            dr2["zhujiDay"] = "";
            dr2["tonPerKilo"] = "";
            dr2["fujiTonDay"] = "";
            dr2["zhujiTonDay"] = "";
            dr2["distanDay"] = "";
            dr2["TonPerKilo2"] = "";

            double allzhujiDo = 0;
            double allzhujiFo = 0;
            double allguoluDo = 0;
            double allguoluFo = 0;
            double allsumup = 0;
            double alldistance = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                allzhujiDo += Convert.ToDouble(dt.Rows[i]["zhujiGo"].ToString());
                allzhujiFo += Convert.ToDouble(dt.Rows[i]["zhujiFo"].ToString());
                allguoluDo += Convert.ToDouble(dt.Rows[i]["guoluGo"].ToString());
                allguoluFo += Convert.ToDouble(dt.Rows[i]["guoluFo"].ToString());
                allsumup += Convert.ToDouble(dt.Rows[i]["sumup"].ToString());
                alldistance += Convert.ToDouble(dt.Rows[i]["distance"].ToString());
            }
            dr2["zhujiGo"] = allzhujiDo.ToString();
            dr2["zhujiFo"] = allzhujiFo.ToString();
            dr2["guoluGo"] = allguoluDo.ToString();
            dr2["guoluFo"] = allguoluFo.ToString();
            dr2["sumup"] = allsumup.ToString();
            dr2["distance"] = alldistance.ToString();
            dr2["TonPerKilo2"] = Math.Round(1000 * (allsumup / kgkilo), 2).ToString();

            DataRow dr3 = dt.NewRow();
            dr3["serialNo"] = "";
            dr3["shipName"] = "";
            dr3["distance"] = "";
            dr3["beginDate"] = "";
            dr3["endDate"] = "";

            dr3["fujiGo"] = "";
            dr3["fujiFo"] = "";
            dr3["zhujiGo"] = "";
            dr3["zhujiFo"] = "";
            dr3["guoluGo"] = "";
            dr3["guoluFo"] = "";
            dr3["other"] = "";
            dr3["sumup"] = "";
            dr3["zhongYouBi"] = "";
            dr3["fujiDay"] = "";
            dr3["zhujiDay"] = "";
            dr3["tonPerKilo"] = "";
            dr3["fujiTonDay"] = "";
            dr3["zhujiTonDay"] = "";
            dr3["distanDay"] = "";
            dr3["TonPerKilo2"] = "";
            dt.Rows.Add(dr3);

            dt.Rows.Add(dr2);

            DataRow dr4 = dt.NewRow();
            dr4["serialNo"] = "";
            dr4["shipName"] = "";
            dr4["distance"] = "";
            dr4["beginDate"] = "";
            dr4["endDate"] = "";

            dr4["fujiGo"] = "";
            dr4["fujiFo"] = "";
            dr4["zhujiGo"] = "";
            dr4["zhujiFo"] = "";
            dr4["guoluGo"] = "";
            dr4["guoluFo"] = "";
            dr4["other"] = "";
            dr4["sumup"] = "";
            dr4["zhongYouBi"] = "";
            dr4["fujiDay"] = "";
            dr4["zhujiDay"] = "";
            dr4["tonPerKilo"] = "";
            dr4["fujiTonDay"] = "";
            dr4["zhujiTonDay"] = "";
            dr4["distanDay"] = "";
            dr4["TonPerKilo2"] = "";
            dt.Rows.Add(dr4);

            gvMonthlyReport.DataSource = dt;
            gvMonthlyReport.DataBind();
        }