Exemple #1
0
        private bool DoAdd()
        {
            bool result = false;

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

            model.GoodsId     = int.Parse(ddlGoods.SelectedValue);
            model.StoringTime = 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 StoreInGoodsVehicle(vehicleId, vehicleRemark[i], count));
                    }
                }
            }


            string[] fileNames    = Request.Form.GetValues("hid_attach_filename");
            string[] filePaths    = Request.Form.GetValues("hid_attach_filepath");
            string[] attachRemark = Request.Form.GetValues("txt_attach_remark");
            if (fileNames != null && filePaths != null && attachRemark != null &&
                fileNames.Length > 0 && filePaths.Length > 0 && attachRemark.Length > 0)
            {
                for (int i = 0; i < fileNames.Length; i++)
                {
                    model.AddAttach(new Attach(filePaths[i], fileNames[i], attachRemark[i]));
                }
            }

            if (bll.Add(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加待入库货物:" + model.GoodsId); //记录日志
                result = true;
            }
            return(result);
        }
Exemple #2
0
        private void ShowInfo(int _id)
        {
            BLL.StoreWaitingGoods   bll   = new BLL.StoreWaitingGoods();
            Model.StoreWaitingGoods model = bll.GetModel(_id);

            ddlGoods.SelectedValue = model.GoodsId.ToString();
            txtStoringTime.Text    = model.StoringTime.ToString("yyyy-MM-dd");
            txtAdmin.Text          = model.Admin;
            txtRemark.Text         = model.Remark;

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

            this.rptGoodsVehicleList.DataSource = goodsVehicleDT;
            this.rptGoodsVehicleList.DataBind();

            BLL.Attach attachBLL = new BLL.Attach();
            DataTable  attachDT  = attachBLL.GetList(" StoreWaitingGoodsId = " + _id + "").Tables[0];

            this.rptAttachList.DataSource = attachDT;
            this.rptAttachList.DataBind();
        }