Ejemplo n.º 1
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            if (string.IsNullOrWhiteSpace(txtStoringTime.Text))
            {
                JscriptMsg("计划出库时间不能为空!", "");
                return(false);
            }
            BLL.StoreOutWaitingGoods   bll   = new BLL.StoreOutWaitingGoods();
            Model.StoreOutWaitingGoods model = bll.GetModel(_id);

            string[] ids = ddlStoreInGoods.SelectedValue.Split('|');
            model.GoodsId        = int.Parse(ids[1]);
            model.StoreInOrderId = int.Parse(ddlStoreInOrder.SelectedValue);
            model.StoreInGoodsId = int.Parse(ids[0]);
            model.StoringOutTime = DateTime.Parse(txtStoringTime.Text);
            model.Admin          = txtAdmin.Text;
            model.Remark         = txtRemark.Text;
            model.Status         = 0;
            model.CreateTime     = DateTime.Now;

            string[] vehicleIds    = Request.Form.GetValues("VehicleId");
            string[] vehicleCount  = Request.Form.GetValues("Count");
            string[] vehicleRemark = Request.Form.GetValues("GoodsVehicleRemark");
            if (vehicleIds != null && vehicleCount != null && vehicleRemark != null &&
                vehicleIds.Length > 0 && vehicleCount.Length > 0 && vehicleRemark.Length > 0)
            {
                for (int i = 0; i < vehicleIds.Length; i++)
                {
                    decimal count;
                    int     vehicleId;
                    if (int.TryParse(vehicleIds[i], out vehicleId) && decimal.TryParse(vehicleCount[i], out count))
                    {
                        model.AddGoodsVehicle(new StoreOutGoodsVehicle(vehicleId, vehicleRemark[i], count));
                    }
                }
            }

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改待出库货物信息:" + model.GoodsId); //记录日志
                result = true;
            }
            return(result);
        }
Ejemplo n.º 2
0
        private void ShowInfo(int _id)
        {
            BLL.StoreOutWaitingGoods   bll   = new BLL.StoreOutWaitingGoods();
            Model.StoreOutWaitingGoods model = bll.GetModel(_id);

            ddlStoreInOrder.SelectedValue = model.StoreInOrderId.ToString();
            StoreInGoodsBind(model.StoreInOrderId);
            ddlStoreInGoods.SelectedValue = model.StoreInGoodsId.ToString() + "|" + model.GoodsId.ToString();
            txtStoringTime.Text           = model.StoringOutTime.ToString("yyyy-MM-dd");
            txtAdmin.Text  = model.Admin;
            txtRemark.Text = model.Remark;

            BLL.StoreOutGoodsVehicle goodsVehicleBLL = new BLL.StoreOutGoodsVehicle();
            DataTable goodsVehicleDT = goodsVehicleBLL.GetList(" and A.StoreOutWaitingGoodsId = " + _id + "").Tables[0];

            this.rptGoodsVehicleList.DataSource = goodsVehicleDT;
            this.rptGoodsVehicleList.DataBind();
        }
        private bool DoAdd()
        {
            bool result = false;
            if (string.IsNullOrWhiteSpace(txtStoringTime.Text))
            {
                JscriptMsg("计划出库时间不能为空!", "");
                return false;
            }
            Model.StoreOutWaitingGoods model = new Model.StoreOutWaitingGoods();
            BLL.StoreOutWaitingGoods bll = new BLL.StoreOutWaitingGoods();

            string[] ids = ddlStoreInGoods.SelectedValue.Split('|');
            model.GoodsId = int.Parse(ids[1]);
            model.StoreInOrderId = int.Parse(ddlStoreInOrder.SelectedValue);
            model.StoreInGoodsId = int.Parse(ids[0]);
            model.StoringOutTime = DateTime.Parse(txtStoringTime.Text);
            model.Admin = txtAdmin.Text;
            model.Remark = txtRemark.Text;
            model.Status = 0;
            model.CreateTime = DateTime.Now;

            string[] vehicleIds = Request.Form.GetValues("VehicleId");
            string[] vehicleCount = Request.Form.GetValues("Count");
            string[] vehicleRemark = Request.Form.GetValues("GoodsVehicleRemark");
            if (vehicleIds != null && vehicleCount != null && vehicleRemark != null
                && vehicleIds.Length > 0 && vehicleCount.Length > 0 && vehicleRemark.Length > 0)
            {
                for (int i = 0; i < vehicleIds.Length; i++)
                {
                    decimal count;
                    int vehicleId;
                    if (int.TryParse(vehicleIds[i], out vehicleId) && decimal.TryParse(vehicleCount[i], out count))
                    {
                        model.AddGoodsVehicle(new StoreOutGoodsVehicle(vehicleId, vehicleRemark[i], count));
                    }
                }
            }

            if (bll.Add(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加待出库货物:" + model.GoodsId); //记录日志
                result = true;
            }
            return result;
        }