Esempio n. 1
0
        /// <summary>
        /// 当前货位原有的电池条码删除,插入新的电池条码
        /// </summary>
        /// <param name="goodssiteID"></param>
        /// <param name="batteryIDs"></param>
        /// <returns></returns>
        public bool AddBattery(int goodssiteID, string [] batteryIDs)
        {
            if (batteryIDs.Length == 0)
            {
                return(false);
            }
            //DeleteByGSID(goodssiteID);


            for (int i = 0; i < batteryIDs.Length; i++)
            {
                string channel = (i + 1).ToString();
                XWEDBAccess.Model.BatteryCodeModel batteryModel = GetModelByGSIDAndChannel(goodssiteID, channel);
                if (batteryModel == null)//插入
                {
                    batteryModel             = new Model.BatteryCodeModel();
                    batteryModel.GoodsSiteID = goodssiteID;
                    batteryModel.Code        = batteryIDs[i];
                    batteryModel.Channel     = channel;
                    Add(batteryModel);
                }
                else//更新
                {
                    batteryModel             = new Model.BatteryCodeModel();
                    batteryModel.GoodsSiteID = goodssiteID;
                    batteryModel.Code        = batteryIDs[i];
                    batteryModel.Channel     = channel;
                    Update(batteryModel);
                }
            }
            return(true);
        }
Esempio n. 2
0
        private void bt_Save_Click(object sender, EventArgs e)
        {
            if (this.parentPNP.RoleID > 2)
            {
                MessageBox.Show("当前用户没有此功能的操作权限!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.dgv_GS.CurrentRow == null)
            {
                return;
            }
            int    rowIndex      = this.dgv_GS.CurrentRow.Index;
            int    goodsSiteID   = int.Parse(this.dgv_GS.CurrentRow.Cells["GoodsSiteID"].Value.ToString());
            string testType      = this.dgv_GS.CurrentRow.Cells["TestType"].Value.ToString();
            string testStatus    = this.dgv_GS.CurrentRow.Cells["TestStatus"].Value.ToString();
            string gsName        = this.dgv_GS.CurrentRow.Cells["GoodsSiteName"].Value.ToString();
            string operateStatus = this.dgv_GS.CurrentRow.Cells["OperateStatus"].Value.ToString();

            bllGs.UpdateGs(this.cb_HouseName.Text.Trim(), gsName, operateStatus, testStatus, testType);

            for (int i = 0; i < this.dgv_TestDetail.Rows.Count; i++)
            {
                DataGridViewRow row = this.dgv_TestDetail.Rows[i];

                XWEDBAccess.Model.BatteryCodeModel batteryModel = new XWEDBAccess.Model.BatteryCodeModel();
                int    btteryCodeID = int.Parse(row.Cells["BatteryCodeID"].Value.ToString());
                string code         = row.Cells["Code"].Value.ToString();
                string channel      = row.Cells["Channel"].Value.ToString();
                string pressure     = row.Cells["Pressure"].Value.ToString();
                string innerRc      = row.Cells["InnerRC"].Value.ToString();
                string power        = row.Cells["Power"].Value.ToString();
                string capcity      = row.Cells["Capcity"].Value.ToString();
                string testResult   = row.Cells["TestResult"].Value.ToString();
                string testTime     = row.Cells["TestTime"].Value.ToString();
                batteryModel.BatteryCodeID = btteryCodeID;
                batteryModel.Capcity       = capcity;
                batteryModel.GoodsSiteID   = goodsSiteID;
                batteryModel.Channel       = channel;
                batteryModel.Code          = code;
                batteryModel.InnerRC       = innerRc;
                batteryModel.Power         = power;
                batteryModel.Pressure      = pressure;
                batteryModel.TestResult    = testResult;

                bllBattery.Update(batteryModel);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XWEDBAccess.Model.BatteryCodeModel GetModelByCode(string Code)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" BatteryCodeID,Code,GoodsSiteID,Channel,Pressure,InnerRC,Power,Capcity,TestResult,TestTime,Tag1,Tag2,Tag3,Tag4,Tag5 ");
            strSql.Append(" from BatteryCode ");
            strSql.Append(" where Code = '" + Code + "' ");
            XWEDBAccess.Model.BatteryCodeModel model = new XWEDBAccess.Model.BatteryCodeModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XWEDBAccess.Model.BatteryCodeModel DataRowToModel(DataRow row)
 {
     XWEDBAccess.Model.BatteryCodeModel model = new XWEDBAccess.Model.BatteryCodeModel();
     if (row != null)
     {
         if (row["BatteryCodeID"] != null && row["BatteryCodeID"].ToString() != "")
         {
             model.BatteryCodeID = long.Parse(row["BatteryCodeID"].ToString());
         }
         if (row["Code"] != null)
         {
             model.Code = row["Code"].ToString();
         }
         if (row["GoodsSiteID"] != null && row["GoodsSiteID"].ToString() != "")
         {
             model.GoodsSiteID = long.Parse(row["GoodsSiteID"].ToString());
         }
         if (row["Channel"] != null)
         {
             model.Channel = row["Channel"].ToString();
         }
         if (row["Pressure"] != null)
         {
             model.Pressure = row["Pressure"].ToString();
         }
         if (row["InnerRC"] != null)
         {
             model.InnerRC = row["InnerRC"].ToString();
         }
         if (row["Power"] != null)
         {
             model.Power = row["Power"].ToString();
         }
         if (row["Capcity"] != null)
         {
             model.Capcity = row["Capcity"].ToString();
         }
         if (row["TestResult"] != null)
         {
             model.TestResult = row["TestResult"].ToString();
         }
         if (row["Temperature"] != null)
         {
             model.Temperature = row["Temperature"].ToString();
         }
         if (row["Electricity"] != null)
         {
             model.Electricity = row["Electricity"].ToString();
         }
         if (row["TestTime"] != null && row["TestTime"].ToString() != "")
         {
             model.TestTime = DateTime.Parse(row["TestTime"].ToString());
         }
         if (row["Tag1"] != null)
         {
             model.Tag1 = row["Tag1"].ToString();
         }
         if (row["Tag2"] != null)
         {
             model.Tag2 = row["Tag2"].ToString();
         }
         if (row["Tag3"] != null)
         {
             model.Tag3 = row["Tag3"].ToString();
         }
         if (row["Tag4"] != null)
         {
             model.Tag4 = row["Tag4"].ToString();
         }
         if (row["Tag5"] != null)
         {
             model.Tag5 = row["Tag5"].ToString();
         }
     }
     return(model);
 }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(XWEDBAccess.Model.BatteryCodeModel model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.Code != null)
            {
                strSql1.Append("Code,");
                strSql2.Append("'" + model.Code + "',");
            }
            if (model.GoodsSiteID != null)
            {
                strSql1.Append("GoodsSiteID,");
                strSql2.Append("" + model.GoodsSiteID + ",");
            }
            if (model.Channel != null)
            {
                strSql1.Append("Channel,");
                strSql2.Append("'" + model.Channel + "',");
            }
            if (model.Pressure != null)
            {
                strSql1.Append("Pressure,");
                strSql2.Append("'" + model.Pressure + "',");
            }
            if (model.InnerRC != null)
            {
                strSql1.Append("InnerRC,");
                strSql2.Append("'" + model.InnerRC + "',");
            }
            if (model.Power != null)
            {
                strSql1.Append("Power,");
                strSql2.Append("'" + model.Power + "',");
            }
            if (model.Capcity != null)
            {
                strSql1.Append("Capcity,");
                strSql2.Append("'" + model.Capcity + "',");
            }
            if (model.TestResult != null)
            {
                strSql1.Append("TestResult,");
                strSql2.Append("'" + model.TestResult + "',");
            }
            if (model.Temperature != null)
            {
                strSql1.Append("Temperature,");
                strSql2.Append("'" + model.Temperature + "',");
            }
            if (model.Electricity != null)
            {
                strSql1.Append("Electricity,");
                strSql2.Append("'" + model.Electricity + "',");
            }
            if (model.TestTime != null)
            {
                strSql1.Append("TestTime,");
                strSql2.Append("'" + model.TestTime + "',");
            }
            if (model.Tag1 != null)
            {
                strSql1.Append("Tag1,");
                strSql2.Append("'" + model.Tag1 + "',");
            }
            if (model.Tag2 != null)
            {
                strSql1.Append("Tag2,");
                strSql2.Append("'" + model.Tag2 + "',");
            }
            if (model.Tag3 != null)
            {
                strSql1.Append("Tag3,");
                strSql2.Append("'" + model.Tag3 + "',");
            }
            if (model.Tag4 != null)
            {
                strSql1.Append("Tag4,");
                strSql2.Append("'" + model.Tag4 + "',");
            }
            if (model.Tag5 != null)
            {
                strSql1.Append("Tag5,");
                strSql2.Append("'" + model.Tag5 + "',");
            }
            strSql.Append("insert into BatteryCode(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            strSql.Append(";select @@IDENTITY");
            object obj = DbHelperSQL.GetSingle(strSql.ToString());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XWEDBAccess.Model.BatteryCodeModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BatteryCode set ");
            if (model.Code != null)
            {
                strSql.Append("Code='" + model.Code + "',");
            }
            else
            {
                strSql.Append("Code= null ,");
            }
            if (model.GoodsSiteID != null)
            {
                strSql.Append("GoodsSiteID=" + model.GoodsSiteID + ",");
            }
            if (model.Channel != null)
            {
                strSql.Append("Channel='" + model.Channel + "',");
            }
            else
            {
                strSql.Append("Channel= null ,");
            }
            if (model.Pressure != null)
            {
                strSql.Append("Pressure='" + model.Pressure + "',");
            }
            else
            {
                strSql.Append("Pressure= null ,");
            }
            if (model.InnerRC != null)
            {
                strSql.Append("InnerRC='" + model.InnerRC + "',");
            }
            else
            {
                strSql.Append("InnerRC= null ,");
            }
            if (model.Power != null)
            {
                strSql.Append("Power='" + model.Power + "',");
            }
            else
            {
                strSql.Append("Power= null ,");
            }
            if (model.Capcity != null)
            {
                strSql.Append("Capcity='" + model.Capcity + "',");
            }
            else
            {
                strSql.Append("Capcity= null ,");
            }
            if (model.TestResult != null)
            {
                strSql.Append("TestResult='" + model.TestResult + "',");
            }
            else
            {
                strSql.Append("TestResult= null ,");
            }
            if (model.Temperature != null)
            {
                strSql.Append("Temperature='" + model.Temperature + "',");
            }
            else
            {
                strSql.Append("Temperature= null ,");
            }
            if (model.Electricity != null)
            {
                strSql.Append("Electricity='" + model.Electricity + "',");
            }
            else
            {
                strSql.Append("Electricity= null ,");
            }
            if (model.TestTime != null)
            {
                strSql.Append("TestTime='" + model.TestTime + "',");
            }
            else
            {
                strSql.Append("TestTime= null ,");
            }
            if (model.Tag1 != null)
            {
                strSql.Append("Tag1='" + model.Tag1 + "',");
            }
            else
            {
                strSql.Append("Tag1= null ,");
            }
            if (model.Tag2 != null)
            {
                strSql.Append("Tag2='" + model.Tag2 + "',");
            }
            else
            {
                strSql.Append("Tag2= null ,");
            }
            if (model.Tag3 != null)
            {
                strSql.Append("Tag3='" + model.Tag3 + "',");
            }
            else
            {
                strSql.Append("Tag3= null ,");
            }
            if (model.Tag4 != null)
            {
                strSql.Append("Tag4='" + model.Tag4 + "',");
            }
            else
            {
                strSql.Append("Tag4= null ,");
            }
            if (model.Tag5 != null)
            {
                strSql.Append("Tag5='" + model.Tag5 + "',");
            }
            else
            {
                strSql.Append("Tag5= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where BatteryCodeID=" + model.BatteryCodeID + "");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        private void bt_DcrTest_Click(object sender, EventArgs e)
        {
            if (this.parentPNP.RoleID > 2)
            {
                MessageBox.Show("当前用户没有此功能的操作权限!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.dgv_GS.CurrentRow == null)
            {
                return;
            }
            int rowIndex    = this.dgv_GS.CurrentRow.Index;
            int goodsSiteID = int.Parse(this.dgv_GS.CurrentRow.Cells["GoodsSiteID"].Value.ToString());

            string gsName = this.dgv_GS.CurrentRow.Cells["GoodsSiteName"].Value.ToString();

            if (this.cb_HouseName.Text.Trim() == "A1库房")
            {
                if (gsName != "1-15-1")
                {
                    MessageBox.Show("请选择1-15-1货位DCR测试!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            else
            {
                if (gsName != "1-1-1")
                {
                    MessageBox.Show("请选择1-1-1货位DCR测试!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            string rfid = this.dgv_GS.CurrentRow.Cells["tag1"].Value.ToString();

            if (rfid.Trim().Length == 0)
            {
                MessageBox.Show("此位置没有工装板号,不能进行DCR测试!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            for (int i = 0; i < this.dgv_TestDetail.Rows.Count; i++)
            {
                DataGridViewRow row = this.dgv_TestDetail.Rows[i];

                XWEDBAccess.Model.BatteryCodeModel batteryModel = new XWEDBAccess.Model.BatteryCodeModel();
                int    btteryCodeID = int.Parse(row.Cells["BatteryCodeID"].Value.ToString());
                string code         = row.Cells["Code"].Value.ToString();
                batteryModel.BatteryCodeID = btteryCodeID;
                batteryModel.Capcity       = "12";
                batteryModel.GoodsSiteID   = goodsSiteID;
                batteryModel.Channel       = (i + 1).ToString();
                batteryModel.Code          = code;
                batteryModel.InnerRC       = "13";
                batteryModel.Power         = "34";
                batteryModel.Pressure      = "1.5";
                batteryModel.TestResult    = "OK";

                bllBattery.Update(batteryModel);
            }

            bllGs.UpdateGs(this.cb_HouseName.Text.Trim(), gsName, SysCfg.EnumOperateStatus.空闲.ToString(), SysCfg.EnumTestStatus.成功.ToString(), SysCfg.EnumTestType.DCR测试.ToString());

            bt_QueryGs_Click(null, null);
        }
Esempio n. 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(XWEDBAccess.Model.BatteryCodeModel model)
 {
     return(dal.Update(model));
 }
Esempio n. 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(XWEDBAccess.Model.BatteryCodeModel model)
 {
     return(dal.Add(model));
 }