Beispiel #1
0
        private void ReplaceSelectcheckBox_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                string strexitDisplayTypeConfig = "出口显示名称类型";
                long   exitDisplayType          = long.Parse(Commonfunction.GetAppSetting(strexitDisplayTypeConfig));

                if (this.ReplaceSelectcheckBox.Checked == true) //0
                {
                    this.DisplayNametextBox.ReadOnly = true;
                    exitDisplayType &= ~((long)1 << m_nCurrentExitIndex);
                }
                else //1
                {
                    this.DisplayNametextBox.ReadOnly = false;
                    exitDisplayType |= ((long)1 << m_nCurrentExitIndex);
                }

                Commonfunction.SetAppSetting(strexitDisplayTypeConfig, exitDisplayType.ToString());
            }
            catch (Exception ex)
            {
                Trace.WriteLine("ExitSwitchForm中函数ReplaceSelectcheckBox_CheckedChanged出错" + ex);
#if REALEASE
                GlobalDataInterface.WriteErrorInfo("ExitSwitchForm中函数ReplaceSelectcheckBox_CheckedChanged出错" + ex);
#endif
            }
        }
Beispiel #2
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (this.txtDeviceNumber.Text.Trim() == "")
            {
                MessageBox.Show("设备编号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtDeviceNumber.Focus();
                return;
            }
            if (this.combMacAddress.Text.Trim() == "")
            {
                MessageBox.Show("MAC地址不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.combMacAddress.Focus();
                return;
            }
            if (this.txtRegistrationCode.Text.Trim() == "")
            {
                MessageBox.Show("注册码不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtRegistrationCode.Focus();
                return;
            }

            DeviceInfo deviceInfo = new DeviceInfo();

            deviceInfo.DeviceNumber     = this.txtDeviceNumber.Text.Trim();
            deviceInfo.MacAddress       = this.combMacAddress.Text.Trim();
            deviceInfo.FactoryTime      = this.dtpFactoryTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
            deviceInfo.Country          = this.txtCountry.Text.Trim();
            deviceInfo.Area             = this.txtArea.Text.Trim();
            deviceInfo.DetailAddress    = this.txtDetailAddress.Text.Trim();
            deviceInfo.Contactor        = this.txtContactor.Text.Trim();
            deviceInfo.PhoneNumber      = this.txtPhoneNumber.Text.Trim();
            deviceInfo.TVAccount        = this.txtTVAccount.Text.Trim();
            deviceInfo.TVPassword       = this.txtTVPassword.Text.Trim();
            deviceInfo.RegistrationCode = this.txtRegistrationCode.Text.Trim();

            Commonfunction.SetAppSetting("设备编号", deviceInfo.DeviceNumber);
            Commonfunction.SetAppSetting("Mac地址", deviceInfo.MacAddress);
            Commonfunction.SetAppSetting("出厂日期", deviceInfo.FactoryTime);
            Commonfunction.SetAppSetting("国家", deviceInfo.Country);
            Commonfunction.SetAppSetting("地区", deviceInfo.Area);
            Commonfunction.SetAppSetting("详细地址", deviceInfo.DetailAddress);
            Commonfunction.SetAppSetting("负责人", deviceInfo.Contactor);
            Commonfunction.SetAppSetting("联系电话", deviceInfo.PhoneNumber);
            Commonfunction.SetAppSetting("TV账号", deviceInfo.TVAccount);
            Commonfunction.SetAppSetting("TV密码", deviceInfo.TVPassword);

            GlobalDataInterface.DeviceNumber  = deviceInfo.DeviceNumber;
            GlobalDataInterface.MacAddress    = deviceInfo.MacAddress;
            GlobalDataInterface.FactoryTime   = deviceInfo.FactoryTime;
            GlobalDataInterface.Country       = deviceInfo.Country;
            GlobalDataInterface.Area          = deviceInfo.Area;
            GlobalDataInterface.DetailAddress = deviceInfo.DetailAddress;
            GlobalDataInterface.Contactor     = deviceInfo.Contactor;
            GlobalDataInterface.PhoneNumber   = deviceInfo.PhoneNumber;
            GlobalDataInterface.TVAccount     = deviceInfo.TVAccount;
            GlobalDataInterface.TVPassword    = deviceInfo.TVPassword;

            RegisterEvent(deviceInfo);
        }
Beispiel #3
0
        /// <summary>
        /// 菜单->工具->固定窗口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 固定窗口toolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem toolStripMenuItem = (ToolStripMenuItem)sender;
                if (toolStripMenuItem.Checked == false) //未选中
                {
                    this.splitContainer2.IsSplitterFixed = true;
                    this.splitContainer3.IsSplitterFixed = true;
                    toolStripMenuItem.Checked            = true;

                    //拆分器距离
                    GlobalDataInterface.SplitterDistance2 = splitContainer2.SplitterDistance;
                    Commonfunction.SetAppSetting("拆分器距离", splitContainer2.SplitterDistance.ToString());

                    //拆分器距离
                    GlobalDataInterface.SplitterDistance3 = splitContainer3.SplitterDistance;
                    Commonfunction.SetAppSetting("拆分器距离2", splitContainer3.SplitterDistance.ToString());

                    //准备选中
                    if (bIsOnceMinimumSized)
                    {
                        GlobalDataInterface.ExitVerticalScroll = currentExitVerticalScroll;  //更新当前滚动条位置
                    }
                    else
                    {
                        GlobalDataInterface.ExitVerticalScroll = this.splitContainer2.Panel1.VerticalScroll.Value;
                    }
                    //出口垂直滚动条保存
                    Commonfunction.SetAppSetting("出口垂直滚动条", GlobalDataInterface.ExitVerticalScroll.ToString());
                }
                else //选中
                {
                    this.splitContainer2.IsSplitterFixed = false;
                    this.splitContainer3.IsSplitterFixed = false;
                    toolStripMenuItem.Checked            = false;
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("MainMenu中函数固定窗口toolStripMenuItem_Click出错" + ex);
#if REALEASE
                GlobalDataInterface.WriteErrorInfo("MainMenu中函数固定窗口toolStripMenuItem_Click出错" + ex);
#endif
            }
        }
Beispiel #4
0
        private void IPMMACAddrlistViewEx_SubItemEndEditing(object sender, ListViewEx.SubItemEndEditingEventArgs e)
        {
            try
            {
                ListViewEx.ListViewEx listviewex = (ListViewEx.ListViewEx)sender;
                switch (e.SubItem)
                {
                case 1:
                    string strMac = e.DisplayText.Trim();
                    Commonfunction.SetAppSetting("IPM-" + lstIPMIP[e.Item.Index], strMac);    //Add by ChengSk - 20190829
                    //MessageBox.Show("行号: " + e.Item.Index + " 列号: " + e.SubItem + " 内容: " + strMac);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {   }
        }
Beispiel #5
0
        /// <summary>
        /// 立即生效按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FruitEffectbutton_Click(object sender, EventArgs e)
        {
            try
            {
                string furitselect = "";
                this.FruitEffectbutton.Enabled       = false;
                this.EffectButtonDelaytimer5.Enabled = true;
                for (int i = 0; i < this.FruitTypedataGridView.Rows.Count; i++)
                {
                    string fruitsub = "";
                    for (int j = 1; j < this.FruitTypedataGridView.ColumnCount; j++)
                    {
                        if (this.FruitTypedataGridView[j, i].Value != null)
                        {
                            fruitsub += this.FruitTypedataGridView[j, i].Value.ToString().TrimEnd('\0') + ";";
                        }

                        if (this.FruitTypedataGridView[j, i].Style.BackColor == Color.Pink)
                        {
                            furitselect += (i + 1).ToString() + "." + j + '-'
                                           + this.FruitTypedataGridView[j, i].Value.ToString().TrimEnd('\0') + ";";
                        }
                    }

                    Commonfunction.SetAppSetting(sFruitMajortArray[i], fruitsub);
                }

                Commonfunction.SetAppSetting("已选水果种类", furitselect);
                if (GlobalDataInterface.global_IsTestMode)
                {
                    GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_DENSITY_INFO, null);//下发密度信息
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("ProjectSetForm-FruitSet中函数FruitEffectbutton_Click出错" + ex);
#if REALEASE
                GlobalDataInterface.WriteErrorInfo("ProjectSetForm-FruitSet中函数FruitEffectbutton_Click出错" + ex);
#endif
            }
        }
Beispiel #6
0
        private void GetMacbutton_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i < this.IPMcustomCheckedListBox.Items.Count; i++)
                {
                    if (this.IPMcustomCheckedListBox.GetItemChecked(i))
                    {
                        IPMMACAddrlistViewEx.Items[i].SubItems[1].Text = getMacAddr_Remote(lstIPMIP[i]).ToString();
                        Commonfunction.SetAppSetting("IPM-" + lstIPMIP[i], getMacAddr_Remote(lstIPMIP[i]).ToString());//Add by xcw - 20201104
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine("ProjectSetForm-SystemSruct中函数WeighcheckBox_CheckedChanged出错" + ex);
#if REALEASE
                GlobalDataInterface.WriteErrorInfo("ProjectSetForm-SystemSruct中函数WeighcheckBox_CheckedChanged出错" + ex);
#endif
            }
        }
Beispiel #7
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OKbutton_Click(object sender, EventArgs e)
        {
            try
            {
                stGradeInfo tempGradeInfo = new stGradeInfo(true);
                tempGradeInfo.ToCopy(GlobalDataInterface.globalOut_GradeInfo);
                if (m_bSwitchNumber)
                {
                    GlobalDataInterface.globalOut_GradeInfo.nSwitchLabel[m_nCurrentExitIndex]   = 0;
                    GlobalDataInterface.globalOut_GradeInfo.nExitSwitchNum[m_nCurrentExitIndex] = int.Parse(this.NumnumericUpDown.Text);
                }
                else if (m_bSwitchWeight)
                {
                    GlobalDataInterface.globalOut_GradeInfo.nSwitchLabel[m_nCurrentExitIndex]   = 1;
                    GlobalDataInterface.globalOut_GradeInfo.nExitSwitchNum[m_nCurrentExitIndex] = int.Parse(this.WeightnumericUpDown.Text);
                }
                else if (m_bSwitchVolume)
                {
                    GlobalDataInterface.globalOut_GradeInfo.nSwitchLabel[m_nCurrentExitIndex]   = 2;
                    GlobalDataInterface.globalOut_GradeInfo.nExitSwitchNum[m_nCurrentExitIndex] = int.Parse(this.VolumenumericUpDown.Text);
                }
                else
                {
                    GlobalDataInterface.globalOut_GradeInfo.nSwitchLabel[m_nCurrentExitIndex]   = 0x7f;
                    GlobalDataInterface.globalOut_GradeInfo.nExitSwitchNum[m_nCurrentExitIndex] = 0x7f7f7f7f;
                }
                if (GlobalDataInterface.globalOut_GradeInfo.nLabelType == 2)
                {
                    GlobalDataInterface.globalOut_GradeInfo.nLabelbyExit[m_nCurrentExitIndex] = m_nLabel;
                }

                int sizeNum, qualNum;
                //if ((((GlobalDataInterface.globalOut_GradeInfo.nClassifyType & 0x06) > 0) || ((GlobalDataInterface.globalOut_GradeInfo.nClassifyType & 0X38) > 0)) && ((GlobalDataInterface.globalOut_GradeInfo.nClassifyType & 1) > 0))//既有品质也有尺寸
                if ((GlobalDataInterface.globalOut_GradeInfo.nQualityGradeNum > 0) && (GlobalDataInterface.globalOut_GradeInfo.nClassifyType > 0))//既有品质也有尺寸
                {
                    sizeNum = GlobalDataInterface.globalOut_GradeInfo.nSizeGradeNum;
                    qualNum = GlobalDataInterface.globalOut_GradeInfo.nQualityGradeNum;
                }
                //else if (GlobalDataInterface.globalOut_GradeInfo.nClassifyType == 1)
                else if (GlobalDataInterface.globalOut_GradeInfo.nQualityGradeNum > 0 && GlobalDataInterface.globalOut_GradeInfo.nClassifyType == 0)
                {
                    sizeNum = 1;
                    qualNum = GlobalDataInterface.globalOut_GradeInfo.nQualityGradeNum;
                }
                else
                {
                    sizeNum = GlobalDataInterface.globalOut_GradeInfo.nSizeGradeNum;
                    qualNum = 1;
                }
                for (int i = 0; i < sizeNum; i++)
                {
                    for (int j = 0; j < qualNum; j++)
                    {
                        if (m_bIsExitGrade[i, j])
                        {
                            GlobalDataInterface.globalOut_GradeInfo.grades[j * ConstPreDefine.MAX_SIZE_GRADE_NUM + i].exit |= ((long)1 << m_nCurrentExitIndex);
                        }
                        else
                        {
                            GlobalDataInterface.globalOut_GradeInfo.grades[j * ConstPreDefine.MAX_SIZE_GRADE_NUM + i].exit &= ~((long)1 << m_nCurrentExitIndex);
                        }
                    }
                }
                if (!GlobalDataInterface.globalOut_GradeInfo.IsEqual(tempGradeInfo))
                {
                    m_mainForm.SetSeparationProgrameChangelabel(false, null);
                }

                //tempMotorInfo.bExitId = (byte)m_nCurrentExitIndex;
                //tempMotorInfo.bMotorSwitch = (byte)this.MotorEnableSwitchcomboBox.SelectedIndex;
                //tempMotorInfo.nMotorEnableSwitchNum = int.Parse(this.MotorEnableSwitchNumnumericUpDown.Text);
                //tempMotorInfo.nMotorEnableSwitchWeight = int.Parse(this.MotorEnableSwitchWeightnumericUpDown.Text);
                //tempMotorInfo.fDelay_time = float.Parse(this.DelayTimenumericUpDown.Text);
                //tempMotorInfo.fHold_time = float.Parse(this.HoldTimenumericUpDown.Text);
                //GlobalDataInterface.globalOut_MotorInfo[m_nCurrentExitIndex].ToCopy(tempMotorInfo);

                if (GlobalDataInterface.global_IsTestMode)
                {
                    // GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_MOTOR_INFO, tempMotorInfo);
                    //GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADE_INFO, null);
                    int global_IsTest = GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_GRADE_INFO, null);
                    if (global_IsTest != 0) //add by xcw 20201211
                    {
                        MessageBox.Show(LanguageContainer.MainFormMessagebox19Text[GlobalDataInterface.selectLanguageIndex],
                                        LanguageContainer.MainFormMessageboxWarningCaption[GlobalDataInterface.selectLanguageIndex],
                                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    if (GlobalDataInterface.sendBroadcastPackage)
                    {
                        GlobalDataInterface.PadGradeConfigUpdate++;                                          //等级配置信息更改,平板需更新
                    }
                }

                //将电机命令立即生效按钮整合到确定按钮 2015-6-25 ivycc 原按钮功能保留 只是不显示
                tempMotorInfo.bExitId = (byte)m_nCurrentExitIndex;
                //tempMotorInfo.bMotorSwitch = (byte)this.MotorEnableSwitchcomboBox.SelectedIndex;
                tempMotorInfo.bMotorSwitch = (byte)(this.MotorEnableSwitchcomboBox.SelectedIndex + 2);  //Modify by ChengSk - 20190708
                if (tempMotorInfo.bMotorSwitch == 2)
                {
                    if (m_bSwitchNumber)
                    {
                        tempMotorInfo.nMotorEnableSwitchNum = int.Parse(this.NumnumericUpDown.Text);
                    }
                    else if (m_bSwitchWeight)
                    {
                        tempMotorInfo.nMotorEnableSwitchWeight = int.Parse(this.WeightnumericUpDown.Text);
                    }
                }
                else
                {
                    tempMotorInfo.nMotorEnableSwitchNum    = int.Parse(this.MotorEnableSwitchNumnumericUpDown.Text);
                    tempMotorInfo.nMotorEnableSwitchWeight = int.Parse(this.MotorEnableSwitchWeightnumericUpDown.Text);
                }
                tempMotorInfo.fDelay_time = float.Parse(this.DelayTimenumericUpDown.Text);
                tempMotorInfo.fHold_time  = float.Parse(this.HoldTimenumericUpDown.Text);
                GlobalDataInterface.globalOut_GlobalExitInfo[0].Delay_time[m_nCurrentExitIndex] = float.Parse(this.DelayTimenumericUpDown.Text);
                GlobalDataInterface.globalOut_GlobalExitInfo[0].Hold_time[m_nCurrentExitIndex]  = float.Parse(this.HoldTimenumericUpDown.Text); //add by xcw - 20191209
                GlobalDataInterface.globalOut_MotorInfo[m_nCurrentExitIndex].ToCopy(tempMotorInfo);
                if (GlobalDataInterface.global_IsTestMode)
                {
                    GlobalDataInterface.TransmitParam(-1, (int)HC_FSM_COMMAND_TYPE.HC_CMD_MOTOR_INFO, tempMotorInfo);
                }

                string strDisplayNameConfig = "出口" + (m_nCurrentExitIndex + 1).ToString() + "显示名称";
                Commonfunction.SetAppSetting(strDisplayNameConfig, this.DisplayNametextBox.Text.Trim());
                string strAdditionalTextConfig = "出口" + (m_nCurrentExitIndex + 1).ToString() + "附加信息";
                Commonfunction.SetAppSetting(strAdditionalTextConfig, this.AdditionalTextrichTextBox.Text.Trim());
                GlobalDataInterface.UpData_gradeinfo = true;
                m_mainForm.SetExitListBox(m_nContorlIndex, m_nCurrentExitIndex);
                GlobalDataInterface.UpData_gradeinfo   = false;
                this.ExitSwitchdataGridView.DataSource = null; //释放资源,不知是否有效
                this.Dispose();
                this.Close();
            }
            catch (Exception ex)
            {
                Trace.WriteLine("ExitSwitchForm中函数OKbutton_Click出错" + ex);
#if REALEASE
                GlobalDataInterface.WriteErrorInfo("ExitSwitchForm中函数OKbutton_Click出错" + ex);
#endif
            }
        }