/// <summary>
    /// 解除库位锁定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUnLock_Click(object sender, EventArgs e)
    {
        LWareLocatorBB wareLocatorBB = new LWareLocatorBB();

        try
        {
            //获取选中的数据Id
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    int id = int.Parse(chkId.ValidationGroup);
                    LWareLocatorData wareLocatorModel = new LWareLocatorData();

                    wareLocatorModel = wareLocatorBB.GetModel(id);
                    wareLocatorModel.isUsing = false;
                    wareLocatorModel.updtDt = System.DateTime.Now.ToString();
                    wareLocatorModel.updtEmpId = this.currentUser.empId;
                    wareLocatorBB.ModifyRecord(wareLocatorModel);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            wareLocatorBB.Dispose();
        }
    }
Пример #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">model</param>
        public bool ModifyRecord(LWareLocatorData model)
        {
            bool ret = false;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update LWareLocator set ");
            strSql.Append("wareLocatorNo=@wareLocatorNo,");
            strSql.Append("wareLocatorNm=@wareLocatorNm,");
            strSql.Append("wareNo=@wareNo,");
            strSql.Append("workPlatformId=@workPlatformId,");
            strSql.Append("maxBoxNum=@maxBoxNum,");
            strSql.Append("isBoard=@isBoard,");
            strSql.Append("isUsing=@isUsing,");
            strSql.Append("downWareLocatorNo=@downWareLocatorNo,");
            strSql.Append("returnWareLocatorNo=@returnWareLocatorNo,");
            strSql.Append("materialNo=@materialNo,");
            strSql.Append("isDel=@isDel,");
            strSql.Append("isrtEmpId=@isrtEmpId,");
            strSql.Append("isrtDt=@isrtDt,");
            strSql.Append("updtEmpId=@updtEmpId,");
            strSql.Append("updtDt=@updtDt,");
            strSql.Append("orderIndex=@orderIndex");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int),
                    new SqlParameter("@wareLocatorNo", SqlDbType.VarChar,20),
                    new SqlParameter("@wareLocatorNm", SqlDbType.NVarChar,50),
                    new SqlParameter("@wareNo", SqlDbType.VarChar,20),
                    new SqlParameter("@workPlatformId", SqlDbType.Int),
                    new SqlParameter("@maxBoxNum", SqlDbType.Int),
                    new SqlParameter("@isBoard", SqlDbType.Bit),
                    new SqlParameter("@isUsing", SqlDbType.Bit),
                    new SqlParameter("@downWareLocatorNo", SqlDbType.VarChar,20),
                    new SqlParameter("@returnWareLocatorNo", SqlDbType.VarChar,20),
                    new SqlParameter("@materialNo", SqlDbType.VarChar,20),
                    new SqlParameter("@isDel", SqlDbType.Bit),
                    new SqlParameter("@isrtEmpId", SqlDbType.Int),
                    new SqlParameter("@isrtDt", SqlDbType.DateTime),
                    new SqlParameter("@updtEmpId", SqlDbType.Int),
                    new SqlParameter("@updtDt", SqlDbType.DateTime),
                    new SqlParameter("@orderIndex", SqlDbType.Int)
                };
            parameters[0].Value = model.id;
            parameters[1].Value = model.wareLocatorNo;
            parameters[2].Value = model.wareLocatorNm;
            parameters[3].Value = model.wareNo;
            parameters[4].Value = model.workPlatformId;
            parameters[5].Value = model.maxBoxNum;
            parameters[6].Value = model.isBoard;
            parameters[7].Value = model.isUsing;
            parameters[8].Value = model.downWareLocatorNo;
            parameters[9].Value = model.returnWareLocatorNo;
            parameters[10].Value = model.materialNo;
            parameters[11].Value = model.isDel;
            parameters[12].Value = model.isrtEmpId;
            parameters[13].Value = model.isrtDt == string.Empty ? null : model.isrtDt;
            parameters[14].Value = model.updtEmpId;
            parameters[15].Value = model.updtDt == string.Empty ? null : model.updtDt;
            parameters[16].Value = model.orderIndex;

            try
            {
                SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);
                ret = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ret;
        }
Пример #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">model</param>
        public int AddRecord(LWareLocatorData model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("set nocount on; ");
            strSql.Append("insert into LWareLocator(");
            strSql.Append(@"wareLocatorNo,wareLocatorNm,wareNo,workPlatformId,maxBoxNum,isBoard,isUsing,downWareLocatorNo,returnWareLocatorNo,materialNo,
                            isDel,isrtEmpId,isrtDt,updtEmpId,updtDt,orderIndex)");
            strSql.Append(" values (");
            strSql.Append(@"@wareLocatorNo,@wareLocatorNm,@wareNo,@workPlatformId,@maxBoxNum,@isBoard,@isUsing,@downWareLocatorNo,@returnWareLocatorNo,@materialNo,
                            @isDel,@isrtEmpId,@isrtDt,@updtEmpId,@updtDt,@orderIndex)");
            strSql.Append("; select @@identity; set nocount off; ");
            SqlParameter[] parameters = {
                    new SqlParameter("@wareLocatorNo", SqlDbType.VarChar,20),
                    new SqlParameter("@wareLocatorNm", SqlDbType.NVarChar,50),
                    new SqlParameter("@wareNo", SqlDbType.VarChar,20),
                    new SqlParameter("@workPlatformId", SqlDbType.Int),
                    new SqlParameter("@maxBoxNum", SqlDbType.Int),
                    new SqlParameter("@isBoard", SqlDbType.Bit),
                    new SqlParameter("@isUsing", SqlDbType.Bit),
                    new SqlParameter("@downWareLocatorNo", SqlDbType.VarChar,20),
                    new SqlParameter("@returnWareLocatorNo", SqlDbType.VarChar,20),
                    new SqlParameter("@materialNo", SqlDbType.VarChar,20),
                    new SqlParameter("@isDel", SqlDbType.Bit),
                    new SqlParameter("@isrtEmpId", SqlDbType.Int),
                    new SqlParameter("@isrtDt", SqlDbType.DateTime),
                    new SqlParameter("@updtEmpId", SqlDbType.Int),
                    new SqlParameter("@updtDt", SqlDbType.DateTime),
                    new SqlParameter("@orderIndex", SqlDbType.Int)
                };
            parameters[0].Value = model.wareLocatorNo;
            parameters[1].Value = model.wareLocatorNm;
            parameters[2].Value = model.wareNo;
            parameters[3].Value = model.workPlatformId;
            parameters[4].Value = model.maxBoxNum;
            parameters[5].Value = model.isBoard;
            parameters[6].Value = model.isUsing;
            parameters[7].Value = model.downWareLocatorNo;
            parameters[8].Value = model.returnWareLocatorNo;
            parameters[9].Value = model.materialNo;
            parameters[10].Value = model.isDel;
            parameters[11].Value = model.isrtEmpId;
            parameters[12].Value = model.isrtDt == string.Empty ? null : model.isrtDt;
            parameters[13].Value = model.updtEmpId;
            parameters[14].Value = model.updtDt == string.Empty ? null : model.updtDt;
            parameters[15].Value = model.orderIndex;

            int id = 0;
            try
            {
                object ret = SqlHelper.ExecuteScalar(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

                if (ret != null && ret != DBNull.Value)
                {
                    id = Convert.ToInt32(ret);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return id;
        }
Пример #4
0
        /// <summary>
        /// 得到一个model
        /// </summary>
        /// <param name="id">主键值</param>
        /// <returns>model</returns>
        public LWareLocatorData GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select id,wareLocatorNo,wareLocatorNm,wareNo,workPlatformId,maxBoxNum,isBoard,isUsing,downWareLocatorNo,returnWareLocatorNo,materialNo,
                            isDel,isrtEmpId,isrtDt,updtEmpId,updtDt,orderIndex from LWareLocator");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int)
                };
            parameters[0].Value = id;

            LWareLocatorData model = new LWareLocatorData();
            DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];
                if (row["id"] != DBNull.Value)
                {
                    model.id = Convert.ToInt32(row["id"]);
                }
                if (row["wareLocatorNo"] != DBNull.Value)
                {
                    model.wareLocatorNo = Convert.ToString(row["wareLocatorNo"]);
                }
                if (row["wareLocatorNm"] != DBNull.Value)
                {
                    model.wareLocatorNm = Convert.ToString(row["wareLocatorNm"]);
                }
                if (row["wareNo"] != DBNull.Value)
                {
                    model.wareNo = Convert.ToString(row["wareNo"]);
                }
                if (row["workPlatformId"] != DBNull.Value)
                {
                    model.workPlatformId = Convert.ToInt32(row["workPlatformId"]);
                }
                if (row["maxBoxNum"] != DBNull.Value)
                {
                    model.maxBoxNum = Convert.ToInt32(row["maxBoxNum"]);
                }
                if (row["isBoard"] != DBNull.Value)
                {
                    model.isBoard = Convert.ToBoolean(row["isBoard"]);
                }
                if (row["isUsing"] != DBNull.Value)
                {
                    model.isUsing = Convert.ToBoolean(row["isUsing"]);
                }
                if (row["downWareLocatorNo"] != DBNull.Value)
                {
                    model.downWareLocatorNo = Convert.ToString(row["downWareLocatorNo"]);
                }
                if (row["returnWareLocatorNo"] != DBNull.Value)
                {
                    model.returnWareLocatorNo = Convert.ToString(row["returnWareLocatorNo"]);
                }
                if (row["materialNo"] != DBNull.Value)
                {
                    model.materialNo = Convert.ToString(row["materialNo"]);
                }
                if (row["isDel"] != DBNull.Value)
                {
                    model.isDel = Convert.ToBoolean(row["isDel"]);
                }
                if (row["isrtEmpId"] != DBNull.Value)
                {
                    model.isrtEmpId = Convert.ToInt32(row["isrtEmpId"]);
                }
                if (row["isrtDt"] != DBNull.Value)
                {
                    model.isrtDt = Convert.ToString(row["isrtDt"]);
                }
                if (row["updtEmpId"] != DBNull.Value)
                {
                    model.updtEmpId = Convert.ToInt32(row["updtEmpId"]);
                }
                if (row["updtDt"] != DBNull.Value)
                {
                    model.updtDt = Convert.ToString(row["updtDt"]);
                }
                if (row["orderIndex"] != DBNull.Value)
                {
                    model.orderIndex = Convert.ToInt32(row["orderIndex"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Пример #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">model</param>
 public bool ModifyRecord(LWareLocatorData model)
 {
     return this.wareLocatorDB.ModifyRecord(model);
 }
Пример #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">model</param>
 public int AddRecord(LWareLocatorData model)
 {
     return this.wareLocatorDB.AddRecord(model);
 }
Пример #7
0
    /// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strInfo = "";

        if (!this.ValidateData(out strInfo))
        {
            strInfo = strInfo.Replace("\"", "'").Replace("\n", "");
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + strInfo + "');", true);
            return;
        }

        LWareLocatorData model = new LWareLocatorData();
        LWareLocatorBB wareLocatorBB = new LWareLocatorBB();

        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = wareLocatorBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = wareLocatorBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                model.updtDt = DateTime.Now.ToString();
                model.updtEmpId = this.currentUser.empId;
                wareLocatorBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            wareLocatorBB.Dispose();
        }

        if (Request.Params["backurl"] != null && Request.Params["backurl"].Trim() != "")
        {
            Response.Redirect(Request.Params["backurl"], true);
        }
    }
Пример #8
0
    /// <summary>
    /// 实体类赋值
    /// </summary>
    /// <param name="model">实体类实例</param>
    private void SetModel(ref LWareLocatorData model)
    {
        model.wareLocatorNo = this.tbWareLocatorNo.Text;
        model.wareLocatorNm = this.tbWareLocatorNm.Text;
        model.wareNo = this.ddlWare.SelectedValue;

        //是否层板
        if (this.ddlIsBoard.SelectedValue != "")
        {
            model.isBoard = this.ddlIsBoard.SelectedValue == "0" ? false : true;
        }
        //else
        //{
        //    model.isBoard = false;
        //}

        //最多放置箱数
        if (this.tbMaxBoxNum.Text.Trim() != "")
        {
            model.maxBoxNum = Convert.ToInt32(this.tbMaxBoxNum.Text.Trim());
        }
        //else
        //{
        //    model.maxBoxNum = 0;
        //}
        try
        {
            if (this.DropDownList1.SelectedValue == "1")
            {
                model.isUsing = true;
            }
            else
            {
                model.isUsing = false;
            }
        }
        catch { }

        model.downWareLocatorNo = this.ddlDownWareLocator.SelectedValue;
        model.returnWareLocatorNo = this.ddlReturnWareLocator.SelectedValue;
        model.materialNo = this.hidMaterialNo.Value;
    }