Пример #1
0
        //航次基本信息绑定
        private void bindVoyageInfo(string voyageid)
        {
            VoyageInfo vi = new VoyageInfo();
            Voyage v = new Voyage();

            vi = v.GetByID(voyageid);

            string voyageName = vi.Name;
            string beginDate = vi.BeginDate.ToString();
            string endDate = vi.EndDate.ToString();
            string routeId = vi.RouteID.ToString();

            Route r = new Route();
            RouteInfo ri = new RouteInfo();

            ri = r.GetByID(routeId);
            float distance = ri.Distance;

            Ship ship = new Ship();
            ShipInfo si = new ShipInfo();
            si = ship.GetByID(vi.ShipID.ToString());

            string shipName = si.Name;
            string chiefEngineer = si.ChiefEngineer;
            string captain = si.Captain;
            string generalManager = si.GeneralManager;

            Relation_RoutePort rrp = new Relation_RoutePort();
            Relation_RoutePortInfo rrpi = new Relation_RoutePortInfo();

            int startPortId = 0;
            int endPortId = 0;
            rrpi = rrp.GetListByRouteID(routeId)[0];
            int portType = rrpi.PortTypeID;

            //出发港
            if (portType == 2)
            {
                startPortId = rrpi.PortID;
            }
            //到达港
            if (portType == 4)
            {
                endPortId = rrpi.PortID;
            }

            rrpi = rrp.GetListByRouteID(routeId)[1];
            portType = rrpi.PortTypeID;

            //出发港
            if (portType == 2)
            {
                startPortId = rrpi.PortID;
            }
            //到达港
            if (portType == 4)
            {
                endPortId = rrpi.PortID;
            }

            Port p = new Port();
            PortInfo pi = new PortInfo();

            pi = p.GetByID(startPortId.ToString());
            string startPortName = pi.Name;
            pi = p.GetByID(endPortId.ToString());
            string endPortName = pi.Name;

            lblShipName.Text = shipName;
            lblDistance.Text = distance.ToString();

            if (beginDate.Split(' ')[0].ToString().Equals("1900/1/1"))
            {
                lblStartTime.Text = "";
            }
            else
            {
                lblStartTime.Text = beginDate;
            }

            if (endDate.Split(' ')[0].ToString().Equals("1900/1/1"))
            {
                lblStartTime.Text = "";
            }
            else
            {
                lblEndTime.Text = endDate;
            }

            lblStartPort.Text = startPortName;
            lblEndPort.Text = endPortName;
            lblChiefEngineer.Text = chiefEngineer;
            lblCaptain.Text = captain;
            lblGeneralManager.Text = generalManager;
        }
Пример #2
0
        protected void btnSaveVoyage_Click(object sender, EventArgs e)
        {
            try
            {
                VoyageInfo vi = new VoyageInfo();
                if (string.IsNullOrEmpty(this.VoyageId) == false)
                {
                    vi = new Voyage().GetByID(this.VoyageId);
                }

                vi.Name = tbVoyageName.Text;
                vi.ShipID = Convert.ToInt32(ddlShipName.SelectedValue);
                vi.RouteID = Convert.ToInt32(ddlRouteName.SelectedValue);
                vi.OrderNum = Convert.ToInt32(tbOrder.Text);
                vi.ManagerTypeID = ddlManagerType.SelectedValue;

                string stime = tbStartTime.Text;
                string sHour = ddlStartHour.SelectedValue;
                string sMin = ddlStartMin.SelectedValue;
                string etime = tbEndTime.Text;
                string eHour = ddlEndHour.SelectedValue;
                string eMin = ddlEndMin.SelectedValue;

                if (!stime.Equals(""))
                {
                    string beginDate = string.Format("{0} {1}:{2}", stime, sHour, sMin);
                    vi.BeginDate = DateTime.Parse(beginDate);
                }
                else
                {
                    vi.BeginDate = Convert.ToDateTime("1900-01-01");
                }

                if (!etime.Equals(""))
                {
                    string endDate = string.Format("{0} {1}:{2}", etime, eHour, eMin);
                    vi.EndDate = DateTime.Parse(endDate);
                }
                else
                {
                    vi.EndDate = Convert.ToDateTime("1900-01-01");
                }


                if (string.IsNullOrEmpty(this.VoyageId))
                {
                    this.VoyageId = new Voyage().Add(vi);
                }
                else
                {
                    new Voyage().Update(vi);
                }
                ShowMsg("航次保存成功!");
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    TitleInitial("船舶装箱情况", "维护航次信息,可以同时编辑船只载货情况。载货情况根据船只的“装箱类型”填写:“集装箱”船填写箱量相关信息,“散货”船填写散货载货量信息。");
                    BindDDL();

                    #region 航次
                    string voyageId = GetRequest("voyageId");
                    VoyageInfo vInfo = new VoyageInfo();
                    if (string.IsNullOrEmpty(voyageId) == false)
                    {
                        this.VoyageId = voyageId;
                        vInfo = new Voyage().GetByID(this.VoyageId);
                        tbVoyageName.Text = vInfo.Name;
                        ddlRouteName.SelectedValue = vInfo.RouteID.ToString();
                        ddlManagerType.SelectedValue = vInfo.ManagerTypeID;
                        RouteInfo rInfo = new Route().GetByID(vInfo.RouteID.ToString());
                        lbRoute.Text = rInfo.TotalRoute;


                        string stime = vInfo.BeginDate.Date.ToString("yyyy-MM-dd");
                        if (stime.Equals("1900-01-01"))
                        {
                            tbStartTime.Text = "";
                            ddlStartHour.SelectedValue = "0";
                            ddlStartMin.SelectedValue = "0";
                        }
                        else
                        {
                            tbStartTime.Text = stime;
                            ddlStartHour.SelectedValue = vInfo.BeginDate.Hour.ToString();
                            ddlStartMin.SelectedValue = vInfo.BeginDate.Minute.ToString();
                        }
                        string etime = vInfo.EndDate.Date.ToString("yyyy-MM-dd");
                        if (etime.Equals("1900-01-01"))
                        {
                            tbEndTime.Text = "";
                            ddlEndHour.SelectedValue = "0";
                            ddlEndMin.SelectedValue = "0";
                        }
                        else
                        {
                            tbEndTime.Text = etime;
                            ddlEndHour.SelectedValue = vInfo.EndDate.Hour.ToString();
                            ddlEndMin.SelectedValue = vInfo.EndDate.Minute.ToString();
                        }
                        ddlShipName.SelectedValue = vInfo.ShipID.ToString();
                        tbOrder.Text = vInfo.OrderNum.ToString();
                        ShipTypeInitial();
                    }

                    #endregion

                    // 装箱情况
                    VoyageLoadInitial(vInfo);
                }
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Пример #4
0
        private void VoyageLoadInitial(VoyageInfo vInfo)
        {
            ShipInfo sInfo = new Ship().GetByID(vInfo.ShipID.ToString());
            switch (sInfo.LoadTypeEnum)
            {
                case ShipType.FCL:
                    #region 集装箱
                    divFCL.Visible = true;
                    VoyageLoadInfo vfInfo = new VoyageLoad().GetByVoyageID(this.VoyageId);
                    if (vfInfo != null && string.IsNullOrEmpty(vfInfo.ID) == false)
                    {
                        tbTEUEmpty.Text = vfInfo.TEUEmpty;
                        tbTEUHeavy.Text = vfInfo.TEUHeavy;
                        tbTEUFROST.Text = vfInfo.TEUFrost;

                        tbFEUEmpty.Text = vfInfo.FEUEmpty;
                        tbFEUHeavy.Text = vfInfo.FEUHeavy;
                        tbFEUFROST.Text = vfInfo.FEUFrost;
                        tbFEUDANG.Text = vfInfo.FEUDanger;

                        tbFFEUEmpty.Text = vfInfo.FFEUEmpty;
                        tbFFEUHeavy.Text = vfInfo.FFEUHeavy;
                        tbFFEUFROST.Text = vfInfo.FFEUFrost;
                        tbFFEUDANG.Text = vfInfo.FFEUDanger;

                        tbRest.Text = vfInfo.Rest;
                        tbEqualTo.Text = vfInfo.EqualTo;
                        tbTotalNatu.Text = vfInfo.TotalNat;
                        tbTotalStand.Text = vfInfo.TotalStand;
                    }
                    #endregion
                    break;
                default:
                    break;
            }

        }
Пример #5
0
        protected void ddlShipName_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                VoyageInfo vInfo = new VoyageInfo();
                string voyageId = this.VoyageId;
                if (string.IsNullOrEmpty(voyageId) == false)
                {
                    vInfo = new Voyage().GetByID(voyageId);
                    VoyageLoadInitial(vInfo);
                }

                ShipTypeInitial();

            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Пример #6
0
        private void VoyageLoadInitial(VoyageInfo vInfo)
        {
            if (GetRequest("type") == "other")
            {
                divOther.Visible = true;
                divFCL.Visible = false;
                divLCL.Visible = false;
            }
            if (vInfo == null || string.IsNullOrEmpty(vInfo.ID))
            {
                return;
            }

            #region 其他收入
            if (GetRequest("type") == "other")
            {

                VoyageOtherInfo voInfo = new VoyageOther().GetByVoyageID(vInfo.ID);
                if (voInfo != null && string.IsNullOrEmpty(voInfo.ID) == false)
                {
                    tbOtherName.Text = voInfo.OtherName;
                    tbRemark.Text = voInfo.Remark;
                    tbOtherFee.Text = voInfo.Amount;
                    ddlCurrencyOther.SelectedValue = voInfo.CurrencyID;
                    tbOtherUser1.Text = voInfo.User1;
                    tbOtherUser2.Text = voInfo.User2;
                    tbOtherUser3.Text = voInfo.User3;
                    lbOtherRMB.Text = new ExchangeRate().GetRMB(voInfo.Amount, voInfo.CurrencyID, voInfo.CreateTime).ToString();
                }
                return;
            }
            #endregion

            IList<PortInfo> pList = new Port().GetList(vInfo.RouteID.ToString(), string.Empty);
            gvList.DataSource = pList;
            gvList.DataBind();
            ShipInfo sInfo = new Ship().GetByID(vInfo.ShipID.ToString());
            switch (sInfo.LoadTypeEnum)
            {
                case ShipType.LCL:
                    #region 散货
                    divLCL.Visible = true;
                    // 散货
                    VoyageLCLInfo vlInfo = new VoyageLCL().GetByVoyageID(vInfo.ID);
                    if (vlInfo != null && string.IsNullOrEmpty(vlInfo.ID) == false)
                    {
                        tbCustomer.Text = vlInfo.Customer;
                        tbTaxNo.Text = vlInfo.TaxNo;
                        tbLCLAmount.Text = vlInfo.LCLAmount;
                        tbLCLAmountReal.Text = vlInfo.LCLAmountReal;
                        tbLCLName.Text = vlInfo.LCLCatalog;
                        tbTransport.Text = vlInfo.LCLPrice;
                        ddlCurrency.SelectedValue = vlInfo.CurrencyID;
                        lbAmount.Text = vlInfo.Fee;

                        tbDelay.Text = vlInfo.DelayDay;
                        tbDelayFee.Text = vlInfo.DelayRate;
                        lbDelayAmount.Text = vlInfo.DelayAmount;
                        lbDelayRMB.Text = new ExchangeRate().GetRMB(vlInfo.DelayAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString();

                        tbDispatch.Text = vlInfo.QuickDay;
                        tbDispatchFee.Text = vlInfo.QuickRate;
                        lbDispatchAmount.Text = vlInfo.DispatchAmount;
                        lbDispatchRMB.Text = new ExchangeRate().GetRMB(vlInfo.DispatchAmount, vlInfo.CurrencyID, vlInfo.CreateTime).ToString();

                        lbTotal.Text = new VoyageLCL().GetAmout(vlInfo);
                        lbLCLCName.Text = ddlCurrency.SelectedItem.Text;
                        lbTotalRMB.Text = new VoyageLCL().GetRMBAmout(vlInfo);

                        tbLCLUser1.Text = vlInfo.User1;
                        tbLCLUser2.Text = vlInfo.User2;
                        tbLCLUser3.Text = vlInfo.User3;
                    }
                    #endregion
                    break;
                case ShipType.FCL:
                    #region 集装箱
                    divFCL.Visible = true;
                    VoyageFCLInfo vfInfo = new VoyageFCL().GetByVoyageID(vInfo.ID);
                    if (vfInfo != null && string.IsNullOrEmpty(vfInfo.ID) == false)
                    {
                        tbCustomer.Text = vfInfo.Customer;
                        tbTaxNo.Text = vfInfo.TaxNo;
                        tbFCLFee.Text = vfInfo.Amount;
                        ddlCurrencyFCL.SelectedValue = vfInfo.CurrencyID;

                        tbFCLUser1.Text = vfInfo.User1;
                        tbFCLUser2.Text = vfInfo.User2;
                        tbFCLUser3.Text = vfInfo.User3;

                        tbFCLFee.Text = vfInfo.Fee;
                        tbBeginFee.Text = vfInfo.BeginFee;
                        tbEndFee.Text = vfInfo.EndFee;
                        tbOilFee.Text = vfInfo.OilFee;
                        tbTally.Text = vfInfo.Tally;
                        tbBox.Text = vfInfo.Box;
                        tbOther.Text = vfInfo.Other;
                        tbSubsidize.Text = vfInfo.Subsidize;
                        tbBookFee.Text = vfInfo.BookFee;
                        tbBranchOther.Text = vfInfo.BranchOther;

                        lbFCLTotal.Text = new VoyageFCL().GetAmout(vfInfo.ID);
                        lbFCLTotalRMB.Text = new VoyageFCL().GetRMBAmout(vfInfo.ID);
                        tbFCLRemark.Text = vfInfo.Remark;
                    }
                    #endregion
                    break;
                default:
                    break;
            }

        }
 private void BindVoyage(string shipID)
 {
     IList<VoyageInfo> sList = new Voyage().GetListByShipID(shipID);
     if (null == sList || sList.Count == 0)
     {
         sList = new List<VoyageInfo>();
         VoyageInfo vInfo = new VoyageInfo();
         vInfo.Name = "未关联到任何航次";
         sList.Add(vInfo);
     }
     ddlVoyage.DataSource = sList;
     ddlVoyage.DataBind();
 }
Пример #8
0
        /// <summary>
        /// 添加航次
        /// </summary>
        /// <param name="ID">实体主键</param>
        /// <returns></returns>
        public void Delete(string ID)
        {
            VoyageInfo cInfo = new VoyageInfo();
            cInfo.ID = ID;

            dal.Delete(cInfo);
        }
Пример #9
0
 /// <summary>
 /// 更新航次
 /// </summary>
 /// <param name="cInfo">实体</param>
 public void Update(VoyageInfo cInfo)
 {
     if (string.IsNullOrEmpty(cInfo.ID))
     {
         throw new ArgumentNullException("参数ID不能为空。");
     }
     dal.Update(cInfo);
 }
Пример #10
0
 /// <summary>
 /// 添加航次
 /// </summary>
 /// <param name="cInfo">实体</param>
 /// <returns>新增实体的主键</returns>
 public string Add(VoyageInfo cInfo)
 {
     if (string.IsNullOrEmpty(cInfo.Name))
     {
         throw new ArgumentNullException("航次名称不能为空。");
     }
     if (cInfo.OrderNum < 1)
     {
         throw new ArgumentNullException("航次排序号不能小于1。");
     }
     return dal.Add(cInfo);
 }