Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 删除燃润报表
 /// </summary>
 /// <param name="ID">实体主键</param>
 /// <returns></returns>
 public void Delete(string ID)
 {
     HangciBaseInputInfo cInfo = new HangciBaseInputInfo();
     cInfo.ID = ID;
     dal.Delete(cInfo);
     // 删除航次与报表的关联
     new Voyage().RanrunDelete(ID);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 添加费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 /// <returns>新增实体的主键</returns>
 public string Add(HangciBaseInputInfo cInfo)
 {
     return dal.Add(cInfo);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 更新费用类别
 /// </summary>
 /// <param name="cInfo">实体</param>
 public void Update(HangciBaseInputInfo cInfo)
 {
     if (string.IsNullOrEmpty(cInfo.ID))
     {
         throw new ArgumentNullException("参数ID不能为空。");
     }
     dal.Update(cInfo);
 }