Esempio n. 1
0
        /// <summary>
        /// 刷新页面
        /// </summary>
        private void refleshPage()
        {
            _woWIPinfo = null;

            List <string> lstInputParas = new List <string>();

            lstInputParas.Add(((ListItem)cbx_workshop.SelectedItem).ID);    //车间

            FuncTagInfo wipFunctag = new FuncTagInfo();

            wipFunctag             = new FuncTagInfo();
            wipFunctag.FuncName    = "GetWoWipInfo";
            wipFunctag.InputParams = lstInputParas.ToArray();


            WcfRequests.SendWipRequest(onWoInfoReceived, wipFunctag);

            //tbx_count_remain.Text = string.Empty;
            //tbx_plan_count.Text = string.Empty;
            //tbx_wip_count.Text = string.Empty;

            //cbx_workorder.SelectedIndex = -1;   //工单号清空

            //_modulePrefix = string.Empty;   //组件前缀清空
            //dgv_module_id.Rows.Clear();     //清空组件序列号

            //cbx_workorder.Enabled = true;       //使能工单选项
        }
Esempio n. 2
0
File: Pack.cs Progetto: TGHGH/MES
        /// <summary>
        /// 确定按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_ok_Click(object sender, EventArgs e)
        {
            tbx_module_id.Text    = tbx_module_id.Text.Trim().ToUpper();
            btn_ok.Enabled        = false;
            tbx_module_id.Enabled = false;

            List <string> inParameters = new List <string>();

            inParameters.Add(tbx_module_id.Text);                               //组件号

            FuncTagInfo functionTag = new FuncTagInfo();

            functionTag.FuncName    = "GetModuleInfo";
            functionTag.InputParams = inParameters.ToArray();

            WcfRequests.SendWipRequest(onGetModuleInfoReceived, functionTag);
        }
Esempio n. 3
0
        /// <summary>
        /// 确认按钮-写入数据库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 检查是否先生成序列号
            if (dgv_module_id.Rows.Count < 1)
            {
                MessageBox.Show("请先生成序列号!");
                return;
            }
            #endregion

            //写入数据库
            string workorder = cbx_workorder.Text;
            string workshop  = ((ListItem)cbx_workshop.SelectedItem).ID;
            #region 开始流水号
            int    iStart      = 0;
            string sLastFlowID = _woWIPinfo[cbx_workorder.SelectedIndex].rowData[7];
            if (sLastFlowID == string.Empty)
            {
                iStart = 1;
            }
            else
            {
                iStart = int.Parse(sLastFlowID) + 1;
            }
            #endregion
            string startModuleIdx = iStart.ToString();
            string endModuleIdx   = (int.Parse(startModuleIdx) + int.Parse(tbx_label_count.Text)).ToString();

            List <string> lstInputParas = new List <string>();
            lstInputParas.Add(workorder);                         //工单
            lstInputParas.Add(workshop);                          //车间
            lstInputParas.Add(startModuleIdx);                    //起始序列号
            lstInputParas.Add(_modulePrefix);                     //组件前缀
            lstInputParas.Add(endModuleIdx);                      //截至序列号
            lstInputParas.Add(_user);
            lstInputParas.Add(_createLabelDateTime);              //生码日期

            FuncTagInfo wipFunctag = new FuncTagInfo();
            wipFunctag             = new FuncTagInfo();
            wipFunctag.FuncName    = "CreateLabel";
            wipFunctag.InputParams = lstInputParas.ToArray();


            WcfRequests.SendWipRequest(onCreateLabelReceived, wipFunctag);
        }
Esempio n. 4
0
        /// <summary>
        /// 选择车间
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void cbx_workshop_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbx_workshop.Enabled = false;

            #region 获取设备机台号
            List <string> lstInputParas = new List <string>();
            lstInputParas.Add(BasicClass.comoboxItemName.FrameEqpType);
            lstInputParas.Add(((ListItem)cbx_workshop.SelectedItem).ID);

            FuncTagInfo wipFunctag = new FuncTagInfo();
            wipFunctag             = new FuncTagInfo();
            wipFunctag.FuncName    = "GetEQPInfo";
            wipFunctag.InputParams = lstInputParas.ToArray();


            WcfRequests.SendWipRequest(onGetEQPInfoReceived, wipFunctag);
            #endregion
        }
Esempio n. 5
0
        /// <summary>
        /// 扫描电池片批号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void tbx_cell_batch_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                iScanCount          = 0;
                btn_scan_count.Text = iScanCount.ToString();
                _currentBatch       = tbx_cell_batch.Text.Trim();

                //获取批号信息
                FuncTagInfo functionTag = new FuncTagInfo();

                List <string> lstInputParas = new List <string>();
                lstInputParas.Add(_currentBatch);

                functionTag.FuncName    = "GetCellBatchInfo";
                functionTag.InputParams = lstInputParas.ToArray();

                WcfRequests.SendWipRequest(onCellBatchInfoReceive, functionTag);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 确定按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_ok_Click(object sender, EventArgs e)
        {
            #region 信息检查
            //if (tbx_module_id.Text.Trim()==string.Empty)
            //{
            //    MessageBox.Show("请输入组件序列号");
            //    return;
            //}
            tbx_module_id.Text = tbx_module_id.Text.Trim().ToUpper();
            if (!System.Text.RegularExpressions.Regex.IsMatch(tbx_module_id.Text.Trim(), BasicClass.sModulePattern))
            {
                //MessageBox.Show("组件序列号输入有误!");
                toolStripStatusLabelRight.Text = "组件序列号输入有误!";

                this.BackColor = Color.Red;
                changeColorTimer.Start();

                tbx_module_id.Focus();
                tbx_module_id.SelectAll();
                return;
            }

            if (cbx_eqp.Text == string.Empty ||
                cbx_workshop.Text == string.Empty)
            {
                //MessageBox.Show("必输项不能为空!");
                toolStripStatusLabelRight.Text = "必输项不能为空!";

                this.BackColor = Color.Red;
                changeColorTimer.Start();

                tbx_module_id.Focus();
                tbx_module_id.SelectAll();
                return;
            }

            if (dgv_cellbatch_info.RowCount < 1)
            {
                //MessageBox.Show("请先扫描电池片批次信息");
                toolStripStatusLabelRight.Text = "请先扫描电池片批次信息!";

                this.BackColor = Color.Red;
                changeColorTimer.Start();

                tbx_cell_batch.Focus();
                tbx_cell_batch.SelectAll();
                return;
            }


            //判断当前数量是否大于所要扣除的数量,如果小于则不扣;
            int currentBatchCount = int.Parse(dgv_cellbatch_info.Rows[0].Cells["columnCurrentCount"].Value.ToString());

            if (currentBatchCount < 60)
            {
                //MessageBox.Show("当前物料数量不足,请更新批次!");
                toolStripStatusLabelRight.Text = "当前物料数量不足,请更新批次!";

                this.BackColor = Color.Red;
                changeColorTimer.Start();
                tbx_module_id.Focus();
                tbx_module_id.SelectAll();
                return;
            }

            #endregion

            string module_id = tbx_module_id.Text.Trim();
            tbx_module_id.Text  = string.Empty;
            tbx_cell_batch.Text = string.Empty;


            ////记录到数据库中 电池片绑定没有检查站点,因为是第一站,无所谓
            FuncTagInfo functionTag = new FuncTagInfo();

            List <string> lstInputParas = new List <string>();
            lstInputParas.Add(_currentBatch);                            //批次号
            lstInputParas.Add(module_id);                                //组件号
            lstInputParas.Add(cbx_hulian_comp.Text);                     //互联条
            lstInputParas.Add(cbx_huiliu_comp.Text);                     //汇流条
            lstInputParas.Add(_currentEqp);                              //设备号
            lstInputParas.Add(_user);
            lstInputParas.Add(((ListItem)cbx_workshop.SelectedItem).ID); //车间
            lstInputParas.Add(BasicClass.getTime());

            functionTag.FuncName    = "CellBinding";
            functionTag.InputParams = lstInputParas.ToArray();

            WcfRequests.SendWipRequest(onCellBindingReceive, functionTag);
        }
Esempio n. 7
0
File: Pack.cs Progetto: TGHGH/MES
        /// <summary>
        /// 获取到托盘信息
        /// </summary>
        /// <param name="wipDataReceived"></param>
        private void onCreatePckInfoReceived(CallBackData wipDataReceived)
        {
            if (!wipDataReceived.bIsOK)
            {
                //MessageBox.Show(wipDataReceived.Result);
                tbx_module_id.Enabled = true;
                btn_ok.Enabled        = true;

                this.BackColor = Color.Red;
                changeColorTimer.Start();

                toolStripStatusLabelRight.Text      = wipDataReceived.Result;
                toolStripStatusLabelRight.BackColor = Color.Red;

                tbx_module_id.Focus();
                tbx_module_id.SelectAll();
                return;
            }

            //==>如果托盘内组件数量等于设定数量,则自动打印,否则,把托盘信息加入字典
            string[] palletTag = wipDataReceived.Result.Split('|');
            int      i         = 0;

            _currentPallet = palletTag[i++];                             //托盘号
            int    iPrintCount        = Convert.ToInt32(palletTag[i++]); //预设包装数量
            string palletTagInfo      = palletTag[i++];                  //托盘pattern
            string palletPower        = palletTag[i++];                  //A4_功率
            string pallettype         = palletTag[i++];                  //A4_类型
            string jbox_spec          = palletTag[i++];                  //A4_线盒规格
            string frame_spec         = palletTag[i++];                  //A4_边框规格
            string pallet_class_grade = palletTag[i++];                  //A4_质量等级
            string busbar_type        = palletTag[i++];                  //A4_三栅四删类型  需求改为了电流等级2015-10-07

            RowData[] rowDatas = wipDataReceived.RowDatas;               //组件数量

            //显示包装数量
            btn_packing_count.Text = rowDatas.Count().ToString();

            if (rowDatas.Count() == iPrintCount)
            {//====>打印,并删除托盘字典中托盘号
                #region create file stream
                string strWriteFileStream =
                    _currentPallet + "," + palletPower + "," + pallettype + "," + jbox_spec + "," + frame_spec + "," + pallet_class_grade + ",";

                strWriteFileStream = strWriteFileStream + busbar_type + ",";

                for (int idx = 0; idx < rowDatas.Length; idx++)
                {
                    string[] rowdata       = rowDatas[idx].rowData;
                    string   module_d_temp = rowdata[1];
                    strWriteFileStream = strWriteFileStream + module_d_temp + ",";
                }

                #endregion

                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\A4Label.txt", false))
                {
                    file.WriteLine(strWriteFileStream);
                }

                using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"c:\BarcodePrint\usb.bat", false))
                {
                    file.WriteLine("@echo off");
                    if (busbar_type == "三栅")
                    {
                        file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China3.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x");
                    }
                    else if (busbar_type == "三栅")
                    {
                        file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China4.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x");
                    }
                    //file.WriteLine("Bartend.exe /F=\"C:\\BarcodePrint\\China.btw\" /D=\"C:\\BarcodePrint\\A4Label.txt\" /P /x");
                }

                try
                {
                    System.Diagnostics.Process.Start(@"c:\BarcodePrint\usb.bat");
                }
                catch (Exception)
                {
                    throw;
                }

                _dicPalletPattern.Remove(_currentPallet);
                dgv_pallet_info.Rows.Clear();
                //printLabel();
                //清空相关空间内容
                btn_packing_count.Text = string.Empty;
                btn_power_grade.Text   = string.Empty;
                btn_Imp_Grade.Text     = string.Empty;
                btn_final_grade.Text   = string.Empty;

                //==>更新托盘信息
                List <string> lstInparas = new List <string>();
                lstInparas.Add(_currentPallet);
                lstInparas.Add(iPrintCount.ToString());

                FuncTagInfo wipFunctionTag = new FuncTagInfo();
                wipFunctionTag.FuncName    = "UpdatePalletInfo";
                wipFunctionTag.InputParams = lstInparas.ToArray();

                WcfRequests.SendWipRequest(onUpdatePalletInfoReceived, wipFunctionTag);
            }
            else
            {//====>加入托盘字典,并更新托盘明细信息
                if (!_dicPalletPattern.ContainsKey(_currentPallet))
                {
                    _dicPalletPattern.Add(_currentPallet, palletTagInfo);
                }

                dgv_pallet_info.Rows.Clear();
                DataTable dt        = new DataTable();
                RowData[] row40data = wipDataReceived.RowDatas;
                for (i = 0; i < row40data.Length; i++)
                {
                    dgv_pallet_info.Rows.Add();

                    string[] rowdata = row40data[i].rowData;

                    for (int j = 0; j < rowdata.Length; j++)
                    {
                        dgv_pallet_info.Rows[i].Cells[j].Value = rowdata[j];
                    }
                }
            }

            btn_ok.Enabled        = true;
            tbx_module_id.Enabled = true;
            tbx_module_id.Focus();
            tbx_module_id.SelectAll();
        }
Esempio n. 8
0
File: Pack.cs Progetto: TGHGH/MES
        /// <summary>
        /// 获取完组件信息
        /// </summary>
        /// <param name="WipDataReceived"></param>
        private void onGetModuleInfoReceived(CallBackData WipDataReceived)
        {
            //-->有问题,则show出来
            if (!WipDataReceived.bIsOK)
            {
                btn_ok.Enabled        = true;
                tbx_module_id.Enabled = true;

                //MessageBox.Show(WipDataReceived.Result);

                this.BackColor = Color.Red;
                changeColorTimer.Start();

                toolStripStatusLabelRight.Text      = WipDataReceived.Result;
                toolStripStatusLabelRight.BackColor = Color.Red;

                tbx_module_id.Focus();
                tbx_module_id.SelectAll();

                return;
            }

            //-->没问题,则继续
            string[] rowDatas = WipDataReceived.RowDatas[0].rowData;

            int    i                = 0;
            string module_id        = rowDatas[i++];
            string workorder        = rowDatas[i++];
            string sale_order       = rowDatas[i++];
            string final_grade      = rowDatas[i++];
            string power_grade      = rowDatas[i++];
            string imp_grade        = rowDatas[i++];
            string cell_consumption = rowDatas[i++];
            string module_color     = rowDatas[i++];
            string pack_count       = rowDatas[i++];
            string jbox_desc        = rowDatas[i++];
            string frame_desc       = rowDatas[i++];
            string pmax             = rowDatas[i++];
            string vpm              = rowDatas[i++];
            string ipm              = rowDatas[i++];
            string ff               = rowDatas[i++];
            string voc              = rowDatas[i++];
            string isc              = rowDatas[i++];
            string test_time        = rowDatas[i++];
            string surf_temp        = rowDatas[i++];
            string modult_type      = rowDatas[i++];
            string cristal_type     = rowDatas[i++];
            string wrokshop         = rowDatas[i++];
            string cell_type        = rowDatas[i++];
            string product_no1      = rowDatas[i++];
            string product_no2      = rowDatas[i++];

            //test_time = Convert.ToDateTime(test_time).ToString("yyyy-MM-dd HH:mm:ss");
            //test_time = "1970-01-01 00:00:00";  //bug

            //====>检查信息是否完整

            #region MyRegion
            if (power_grade == string.Empty)
            {
                //MessageBox.Show("没有功率测试信息");
                tbx_module_id.Enabled = true;

                this.BackColor = Color.Red;
                changeColorTimer.Start();

                toolStripStatusLabelRight.Text      = "没有功率测试信息";
                toolStripStatusLabelRight.BackColor = Color.Red;

                tbx_module_id.Focus();
                tbx_module_id.SelectAll();


                return;
            }
            #endregion

            //==>显示组件工单,质量等级,功率等级,电流等级
            tbx_work_order.Text  = workorder;
            btn_final_grade.Text = final_grade;
            btn_power_grade.Text = power_grade;
            btn_Imp_Grade.Text   = imp_grade;

            //====>构建pattern,作为拼托盘依据
            string sPattern = string.Empty;
            if (checkBox_sale_order.Checked)
            {
                sPattern = sPattern + sale_order + "!";
            }
            if (checkBox_workorder.Checked)
            {
                sPattern = sPattern + workorder + "!";
            }
            if (checkBox_final_grade.Checked)
            {
                sPattern = sPattern + final_grade + "!";
            }
            if (checkBox_power.Checked)
            {
                sPattern = sPattern + power_grade + "!";
            }
            if (checkBox_imp.Checked)
            {
                sPattern = sPattern + imp_grade + "!";
            }
            if (checkBox_module_color.Checked)
            {
                sPattern = sPattern + module_color + "!";
            }

            if (sPattern == string.Empty)
            {
                //MessageBox.Show("包装条件不能为空!");
                this.BackColor = Color.Red;
                changeColorTimer.Start();

                toolStripStatusLabelRight.Text      = "包装条件不能为空!";
                toolStripStatusLabelRight.BackColor = Color.Red;

                tbx_module_id.Focus();
                tbx_module_id.SelectAll();
                return;
            }

            //====>如果当前没有托盘,那么则产生托盘,如果有,则跟托盘的pattern做比较,相同则包到一块儿
            #region MyRegion
            bool FIND_THE_SAME_PATTERN = false;
            //字典中有托盘,则比较托盘的pattern和当前pattern是否相同
            foreach (var item in _dicPalletPattern)
            {
                if (item.Value == sPattern)
                {
                    _currentPallet        = item.Key;
                    FIND_THE_SAME_PATTERN = true;
                }
            }

            List <string> inputParas = new List <string>();
            if (FIND_THE_SAME_PATTERN)
            {
                inputParas.Add(_currentPallet);
            }
            else
            {
                #region 如果需要自动分拖,则将此段代码注释掉
                if (_dicPalletPattern.Count > 0)
                {
                    this.BackColor = Color.Red;
                    changeColorTimer.Start();

                    toolStripStatusLabelRight.Text      = "这块组件不符合成拖条件!";
                    toolStripStatusLabelRight.BackColor = Color.Red;

                    tbx_module_id.Enabled = true;
                    tbx_module_id.Focus();
                    tbx_module_id.SelectAll();

                    return;
                }
                #endregion

                inputParas.Add("");
            }
            inputParas.Add(sPattern);
            inputParas.Add(pack_count);
            inputParas.Add(module_id);
            inputParas.Add(final_grade);
            inputParas.Add(power_grade);
            inputParas.Add(imp_grade);
            inputParas.Add(pmax);
            inputParas.Add(vpm);
            inputParas.Add(ipm);
            inputParas.Add(ff);
            inputParas.Add(voc);
            inputParas.Add(isc);
            inputParas.Add(test_time);
            inputParas.Add(surf_temp);
            inputParas.Add(modult_type);
            inputParas.Add(cristal_type);
            inputParas.Add(wrokshop);
            inputParas.Add(module_color);
            inputParas.Add(cell_consumption);
            inputParas.Add(workorder);
            inputParas.Add(_user);
            inputParas.Add(cell_type);
            inputParas.Add(jbox_desc);
            inputParas.Add(frame_desc);
            inputParas.Add(product_no1);
            inputParas.Add(product_no2);

            FuncTagInfo wipFunctionTag = new FuncTagInfo();
            wipFunctionTag.FuncName    = "GetPalletInfo";
            wipFunctionTag.InputParams = inputParas.ToArray();

            WcfRequests.SendWipRequest(onCreatePckInfoReceived, wipFunctionTag);

            #endregion
        }