コード例 #1
0
        private bool RemainingWeight()
        {
            GINModel ginModel = (GINModel)Session["GINMODEL"];
            double   remainingBalance;

            if (Session["remainingBalance"] == null)
            {
                if (Session["EditMode"] == null)
                {
                    Session["remainingBalance"] = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);
                }
                else
                {
                    Session["remainingBalance"] = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);
                }
            }
            Guid commodityGradeId         = ((GINModel)Session["GINMODEL"]).PickupNoticesList[0].CommodityGradeID;
            List <BagTypeBLL> bagTypeList = BagTypeBLL.GetCommodityGradeBagTypes(commodityGradeId);

            double netWeight = 0;

            if (CurrentGINModel.PickupNoticesList[0].ConsignmentType != "Bonded Yard")
            {
                netWeight = double.Parse(txtGrossWeight.Text) - double.Parse(txtTruckWeight.Text) -
                            double.Parse(txtNoOfBags.Text) * double.Parse(HiddenFieldTare.Value) +
                            double.Parse(drpAdjustmentType.SelectedValue) * double.Parse(txtWeightAdjustment.Text);
            }
            else if (CurrentGINModel.PickupNoticesList[0].ConsignmentType == "Bonded Yard")
            {
                HiddenFieldTare.Value = "0.93";
                netWeight             = double.Parse(txtNetWeight.Text);
            }
            Session["netWeight"] = netWeight;
            remainingBalance     = Math.Round(double.Parse(Session["remainingBalance"].ToString()), 2) - Math.Round(netWeight, 2);
            if (CurrentGINModel.PickupNoticesList[0].Commodity != new Guid("71604275-df23-4449-9dae-36501b14cc3b"))
            {
                if (remainingBalance < 0)
                {
                    Messages.SetMessage("Requested Net Weight is greater than total available PUN weight. Please check the Loading Ticket.", WarehouseApplication.Messages.MessageType.Warning);
                    return(false);
                }
            }
            if (remainingBalance >= 0)
            {
                Session["RemainingMsg"] = "Selected PUNs have Total Remaining weights to be issued of = " + Convert.ToDouble(remainingBalance) + " Kg";
            }
            Session["remainingBalance"] = remainingBalance;

            return(true);
        }
コード例 #2
0
        protected void gvStack_SelectedIndexChanged(object sender, EventArgs e)
        {
            GINModel gm            = (GINModel)Session["GINMODEL"];
            Guid     stackLoadedId = new Guid(gvStack.SelectedDataKey["StackID"].ToString());

            if (gm.StackInfosList.Count != 0)
            {
                StackTransactionModel stm     = gm.StackInfosList.First(s => s.StackID == stackLoadedId);
                Guid commodityGradeId         = ((GINModel)Session["GINMODEL"]).PickupNoticesList[0].CommodityGradeID;
                List <BagTypeBLL> bagTypeList = BagTypeBLL.GetCommodityGradeBagTypes(commodityGradeId);

                if (Session["remainingBalance"] == null)
                {
                    Session["remainingBalance"] = gm.PickupNoticesList.Sum(s => s.RemainingWeight);//+ (stm.GrossWeight - stm.TruckWeight - bagTypeList[0].Tare * stm.NoOfBags);
                }
                else
                {
                    Session["remainingBalance"] = (double)Session["remainingBalance"] + (stm.GrossWeight - stm.TruckWeight - stm.Tare * stm.NoOfBags);
                }
                txtScaleTicketNo.Text    = stm.ScaleTicketNumber;
                txtDateWeighted.Text     = stm.DateTimeWeighed.ToShortDateString();
                txtDateWeightedTime.Text = stm.DateTimeWeighed.ToShortTimeString();
                txtTruckWeight.Text      = stm.TruckWeight.ToString();
                txtGrossWeight.Text      = stm.GrossWeight.ToString();
                txtNoOfBags.Text         = stm.NoOfBags.ToString();
                txtLoadingTicket.Text    = stm.LoadUnloadTicketNO;
                PopulateStack(new Guid(drpInventoryCoordinatorLoad.SelectedValue));
                drpStackNo.SelectedValue = stm.StackID.ToString();
                //stm.StackID = new Guid(drpStackNo.SelectedValue);
                HiddenFieldTare.Value = stm.Tare.ToString();
                drpWeigherSupervisor.SelectedValue = stm.WeigherID.ToString();// drpWeigherSupervisor.Items.Cast<ListItem>().First(s => new Guid(s.Value) == stm.WeigherID).Value;
                gm.StackInfosList.Remove(stm);
                gm.RemoveStack(stm.StackID);
                btnAddStack.Visible = true;
                FillWBServiceProvider(drpWBServiceProvider);
                drpWBServiceProvider.SelectedValue = stm.WBServiceProviderID.ToString();
                //drp
                FillCarType(drpTruckType);
                drpTruckType.SelectedValue = stm.TruckTypeID.ToString();
                // gvStack.DataSource = gm.StackInfosList;
                // gvStack.DataBind();
            }
            else
            {
                Messages.SetMessage("The stack is already selected or Empty Stack.", WarehouseApplication.Messages.MessageType.Warning);
            }
        }