Example #1
0
 public void GenerateTaskData(string taskType, int palletID)
 {
     if (taskType == "一次分拣")
     {
         OCVPalletModel model = palletBll.GetModel(palletID);
         model.processStatus = EnumOCVProcessStatus.一次OCV检测完成.ToString();
         palletBll.Update(model);
         for (int i = 1; i < 49; i++)
         {
             OCVBatteryModel battery = batteryBll.GetModel(i.ToString(), palletID);
             if (i % 2 > 0)
             {
                 battery.hasBattery  = true;
                 battery.checkResult = EnumOCVCheckResult.良品.ToString();
             }
             else
             {
                 battery.hasBattery  = false;
                 battery.checkResult = EnumOCVCheckResult.良品.ToString();
             }
             batteryBll.Update(battery);
         }
     }
     else if (taskType == "二次分拣")
     {
         OCVPalletModel model = palletBll.GetModel(palletID);
         model.processStatus = EnumOCVProcessStatus.二次OCV检测完成.ToString();
         palletBll.Update(model);
         for (int i = 1; i < 49; i++)
         {
             OCVBatteryModel battery = batteryBll.GetModel(i.ToString(), palletID);
             if (i % 2 > 0)
             {
                 battery.checkResult = EnumOCVCheckResult.良品.ToString();
             }
             else
             {
                 battery.checkResult = EnumOCVCheckResult.良品.ToString();
             }
             if (i % 4 == 0)
             {
                 battery.hasBattery = true;
             }
             else
             {
                 battery.hasBattery = false;
             }
             batteryBll.Update(battery);
         }
     }
 }
Example #2
0
        /// <summary>
        /// 记录到本地
        /// </summary>
        /// <returns></returns>
        private bool RecordFillInfoToLocal(string palletID, string batchID, string[] batteryIDs, ref string reStr)
        {
            //  1、	查询批次信息表(TB_Batch_Index)得到批次编号和批次类型
            // 2、	插入托盘信息到托盘信息表(TB_Tray_index)中
            // 3、	更新批次信息表(TB_Batch_Index)中托盘数量和电池总数量
            // 4、	插入电池信息到电池信息表(TB_After_GradeData)
            reStr = "";

            try
            {
                TB_Batch_IndexModel batchModel = gxBatchBll.GetModel(batchID);
                if (batchModel == null)
                {
                    reStr = "批次:" + batchID + "不存在";
                    return(false);
                }


                //1 检查托盘信息
                if (ocvPalletBll.Exists(palletID))
                {
                    reStr = "托盘:" + palletID + "已经存在";
                    return(false);
                }

                //2 坚持查电芯数据是否合格
                for (int i = 0; i < batteryIDs.Count() - 1; i++)
                {
                    int row1 = i / 12 + 1;
                    int col1 = i - (row1 - 1) * 12 + 1;
                    if (string.IsNullOrWhiteSpace(batteryIDs[i]))
                    {
                        continue;
                    }
                    if (batteryIDs[i].Length < 12) //电芯条码升级为13位,,2015-07-23
                    {
                        reStr = "输入电芯条码错误:第" + (i + 1).ToString() + "个电芯条码不足12位";
                        return(false);
                    }
                    for (int j = i + 1; j < batteryIDs.Count(); j++)
                    {
                        int row2 = j / 12 + 1;
                        int col2 = j - (row2 - 1) * 12 + 1;
                        if (batteryIDs[i] == batteryIDs[j])
                        {
                            reStr = "输入电芯条码有重复:第[" + row1.ToString() + "行," + col1.ToString() + "列]和[" + row2.ToString() + "行," + col2.ToString() + "列]电芯条码有重复";
                            return(false);
                        }
                    }
                }

                OCVPalletModel palletModel = new OCVPalletModel();
                palletModel.palletID      = palletID;
                palletModel.batchID       = batchID;
                palletModel.loadInTime    = System.DateTime.Now;
                palletModel.processStatus = "A1库老化";
                ocvPalletBll.Add(palletModel);

                for (int i = 0; i < batteryIDs.Count(); i++)
                {
                    if (string.IsNullOrWhiteSpace(batteryIDs[i]) || batteryIDs[i].Length < 12) //电芯条码升级为13位,modify by zwx,2015-07-23
                    {
                        continue;
                    }


                    OCVBatteryModel battery = new OCVBatteryModel();
                    battery.batteryID    = batteryIDs[i];
                    battery.checkResult  = "良品"; //初始值假设为合格品
                    battery.rowIndex     = i / 12 + 1;
                    battery.columnIndex  = i - (battery.rowIndex - 1) * 12 + 1;
                    battery.hasBattery   = true;
                    battery.palletID     = palletID;
                    battery.positionCode = (i + 1);
                    ocvBatteryBll.Add(battery);
                }

                return(true);
            }
            catch (System.Exception ex)
            {
                ocvPalletBll.Delete(palletID);

                MessageBox.Show("录入数据库出现异常,可能有重复的电芯条码,请检查," + ex.Message);
                return(false);
            }
        }
Example #3
0
        private void GetFillInfo(string palletID)
        {
            string dbSet = this.comboBoxDBset_BL.Text;

            if (string.IsNullOrWhiteSpace(dbSet))
            {
                MessageBox.Show("未设定入库类型");
                return;
            }
            if (dbSet == "初入库")
            {
                OCVPalletModel palletModel = ocvPalletBll.GetModel(palletID);
                if (palletModel == null)
                {
                    MessageBox.Show("提示:本地信息库里未找到该托盘号信息");
                    return;
                }
                this.labelWarn.Text              = "";
                this.comboBoxBatch_BL.Text       = palletModel.batchID;
                this.textBoxCurrentBatch_BL.Text = palletModel.batchID;
                this.dataGridViewBatterys_BL.Rows.Clear();
                for (int i = 0; i < 4; i++)
                {
                    //if (i <3)
                    {
                        this.dataGridViewBatterys_BL.Rows.Add();
                    }
                    this.dataGridViewBatterys_BL.RowCount = this.dataGridViewBatterys_BL.Rows.Count;
                    DataGridViewRow dr = this.dataGridViewBatterys_BL.Rows[i];

                    //DataRow dr = dt.NewRow();
                    for (int j = 0; j < 12; j++)
                    {
                        dr.Cells[j].Value = "";
                    }
                }
                string strWhere = "palletID = '" + palletID + "'";
                // List<TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList(strWhere);
                List <OCVBatteryModel> batteryList = ocvBatteryBll.GetModelList(strWhere);

                for (int i = 0; i < batteryList.Count(); i++)
                {
                    //TB_After_GradeDataModel battery = batteryList[i];
                    OCVBatteryModel battery = batteryList[i];
                    if (battery == null)
                    {
                        continue;
                    }
                    int             rowIndex = (int)battery.rowIndex - 1;    // (int)(battery.Tf_ChannelNo - 1) / 12;
                    int             cowIndex = (int)battery.columnIndex - 1; // (int)battery.Tf_ChannelNo - rowIndex * 12 - 1;
                    DataGridViewRow dr       = this.dataGridViewBatterys_BL.Rows[rowIndex];
                    dr.Cells[cowIndex].Value = battery.batteryID;            // battery.Tf_CellSn;
                }
            }
            else if (dbSet == "二次分容入库")
            {
                TB_Tray_indexModel trayModel = gxTrayBll.GetModel(palletID);
                if (trayModel == null)
                {
                    MessageBox.Show("提示:国轩托盘信息库里未找到该托盘号信息");
                    return;
                }
                this.labelWarn.Text              = "";
                this.comboBoxBatch_BL.Text       = trayModel.Tf_BatchID;
                this.textBoxCurrentBatch_BL.Text = trayModel.Tf_BatchID;
                if (this.dataGridViewBatterys_BL.Rows.Count > 0)
                {
                    this.dataGridViewBatterys_BL.Rows.Clear();
                }

                for (int i = 0; i < 4; i++)
                {
                    if (i < 3)
                    {
                        this.dataGridViewBatterys_BL.Rows.Add();
                    }
                    this.dataGridViewBatterys_BL.RowCount = this.dataGridViewBatterys_BL.Rows.Count;
                    DataGridViewRow dr = this.dataGridViewBatterys_BL.Rows[i];

                    //DataRow dr = dt.NewRow();
                    for (int j = 0; j < 12; j++)
                    {
                        dr.Cells[j].Value = "";
                    }
                }

                string strWhere = " Tf_TrayId = '" + palletID + "' and Tf_BatchID='" + trayModel.Tf_BatchID + "' ";
                List <TB_After_GradeDataModel> batteryList = gxBatteryBll.GetModelList(strWhere);
                for (int i = 0; i < batteryList.Count(); i++)
                {
                    TB_After_GradeDataModel battery = batteryList[i];
                    if (battery == null)
                    {
                        continue;
                    }
                    int             rowIndex = (int)(battery.Tf_ChannelNo - 1) / 12;
                    int             cowIndex = (int)battery.Tf_ChannelNo - rowIndex * 12 - 1;
                    DataGridViewRow dr       = this.dataGridViewBatterys_BL.Rows[rowIndex];
                    dr.Cells[cowIndex].Value = battery.Tf_CellSn;
                }
            }
            else
            {
                MessageBox.Show("入库类型设置错误");
                return;
            }


            this.dataGridViewBatterys_BL.BeginEdit(false);
            this.dataGridViewBatterys_BL.CurrentCell = null;
        }
Example #4
0
        private void Modify_BatteryInfo()
        {
            string batchID  = this.comboBoxNewBatch_XG.Text;
            string batteyID = this.textBoxNewBatteryID_XG.Text;

            if (string.IsNullOrWhiteSpace(batchID))
            {
                MessageBox.Show("未设定批次");
                return;
            }
            if (string.IsNullOrWhiteSpace(batteyID))
            {
                MessageBox.Show("电芯条码为空");
                return;
            }
            TB_Batch_IndexModel batchModel = gxBatchBll.GetModel(batchID);

            if (batchModel == null)
            {
                MessageBox.Show("批次不存在");
                return;
            }
            if (string.IsNullOrWhiteSpace(this.CurrentBatteryID))
            {
                //新插入

                TB_After_GradeDataModel batteryModel = new TB_After_GradeDataModel();
                batteryModel.Tf_BatchID   = batchID;
                batteryModel.Tf_Batchtype = batchModel.Tf_Batchtype;
                batteryModel.Tf_TrayId    = this.PalletID;
                batteryModel.Tf_ChannelNo = this.batteryPos;
                batteryModel.Tf_CellSn    = batteyID;
                if (!gxBatteryBll.Add(batteryModel))
                {
                    MessageBox.Show("提交失败!");
                    return;
                }
                OCVBatteryModel battery = new OCVBatteryModel();
                battery.batteryID    = batteyID;
                battery.checkResult  = "良品"; //初始值假设为合格品
                battery.rowIndex     = this.batteryPos / 12 + 1;
                battery.columnIndex  = this.batteryPos - (battery.rowIndex - 1) * 12 + 1;
                battery.hasBattery   = true;
                battery.palletID     = this.PalletID;
                battery.positionCode = this.batteryPos;
                if (ocvBatteryBll.Add(battery))
                {
                    MessageBox.Show("提交成功!");
                }
            }
            else
            {
                //更新
                TB_After_GradeDataModel batteryModel = gxBatteryBll.GetModel(this.CurrentBatchID, PalletID, this.CurrentBatteryID);
                if (batteryModel == null)
                {
                    MessageBox.Show("不存在的电芯");
                    return;
                }
                batteryModel.Tf_BatchID = batchID;
                batteryModel.Tf_CellSn  = batteyID;
                if (gxBatteryBll.Update(batteryModel, PalletID))
                {
                    MessageBox.Show("提交成功!");
                }
                else
                {
                    MessageBox.Show("提交失败!");
                }
            }
        }