Exemplo n.º 1
0
 private void DeveCodeTextEdit_EditValueChanged(object sender, EventArgs e)
 {
     if (model != null)
     {
         if (DeveCodeTextEdit.Text.Length == 6)
         {
             var currDrums = lstVW_QC_FindLeakDrumsSet.Where(t => t.DevCode == DeveCodeTextEdit.Text).FirstOrDefault();
             if (currDrums != null)
             {
                 model.DevCode    = currDrums.DevCode;
                 model.DevName    = currDrums.DevName;
                 model.SourceCode = currDrums.ArrangedVouchCode.ToString();
             }
             else
             {
                 model.DevCode    = null;
                 model.DevName    = null;
                 model.SourceCode = null;
                 ClsMsg.ShowWarningMsg("该转鼓未设定检漏或已经检漏。");
             }
         }
         else
         {
             model.DevCode    = null;
             model.DevName    = null;
             model.SourceCode = null;
         }
     }
 }
Exemplo n.º 2
0
        private void CfPExecute_Load(object sender, EventArgs e)
        {
            try
            {
                var ExecuteStatus = DataEnum.GetEnumData(context, "CF.ExecuteStatus");

                ExecuteModeTextEdit.Properties.DataSource = DataEnum.GetEnumData("treatment");
                riluePriority.DataSource = DataEnum.GetEnumData(context, "CF.Priority");
                repositoryItemExecuteStatusLookUpEdit.DataSource = ExecuteStatus;
                ExecuteStatusTextEdit.Properties.DataSource      = ExecuteStatus;
                this.AddSysOperLogs(this.Text, OperateStatus.查询);
                using (SRBase.BaseServiceClient client = new SRBase.BaseServiceClient())
                {
                    var ret = client.GetCraftsParameterContrastList(context.SessionID);
                    if (ret.IsSuccess)
                    {
                        rilueParameterName.DataSource = ret.Data;
                    }
                    else
                    {
                        ClsMsg.ShowWarningMsg(ret.Message);
                    }
                }
                bgwWait.RunWorkerAsync("LoadTreeData");
            }
            catch (Exception ex)
            {
                Utils.Logger.Error(ex.ToString());
                ClsMsg.ShowErrMsg(ex.Message);
            }
        }
Exemplo n.º 3
0
 public void DeleteDepartmentClass(DoWorkEventArgs e)
 {
     departmentBindingSource.EndEdit();
     if (string.IsNullOrEmpty(DepCodeTextEdit.Text))
     {
         ClsMsg.ShowWarningEmptyMsg(ItemForDepCode.Text);
     }
     else
     {
         if (ClsMsg.ShowQuestionMsg("是否删除" + DepNameTextEdit.Text + "部门数据?") == DialogResult.Yes)
         {
             using (var DelClient = new SRDepartment.DepartmentServiceClient())
             {
                 Model = new SRDepartment.Department();
                 Model = departmentBindingSource.DataSource as SRDepartment.Department;
                 var ret = DelClient.DelDepartmentData(context.SessionID, Model.DepCode);
                 if (ret.IsSuccess)
                 {
                     this.AddSysOperLogs(this.Text, OperateStatus.除, strCode: Model.DepCode);
                     e.Result = true;
                     ClsMsg.ShowWarningMsg("数据删除成功!");
                 }
                 else
                 {
                     e.Result = true;
                     bgWait.ReportProgress(101, ret.Message);
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
        public void UpdataDepartmentClass(DoWorkEventArgs e)
        {
            departmentBindingSource.EndEdit();
            this.strDepartmentNameNow = DepNameTextEdit.Text;
            Model = new SRDepartment.Department();
            Model = departmentBindingSource.DataSource as SRDepartment.Department;

            if (string.IsNullOrEmpty(DepNameTextEdit.Text))
            {
                ClsMsg.ShowWarningEmptyMsg(ItemForDepName.Text);
            }
            else
            {
                if (ClsMsg.ShowQuestionMsg("是否修改该模板数据?") == DialogResult.Yes)
                {
                    using (var upClient = new SRDepartment.DepartmentServiceClient())
                    {
                        var ret = upClient.UpdataDepartmentData(context.SessionID, Model, strDepartmentNameOriginal, strDepartmentNameNow);
                        if (ret.IsSuccess)
                        {
                            this.AddSysOperLogs(this.Text, OperateStatus.修改, strCode: Model.DepCode);
                            e.Result = true;
                            ClsMsg.ShowWarningMsg("数据更新完毕!");
                        }
                        else
                        {
                            e.Result = false;
                            bgWait.ReportProgress(101, ret.Message);
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void barManager2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (backgroundWorker1.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "ButAdd":
                        if (gmc.GetSelectedRows().Count > 0)
                        {
                            this.DialogResult = DialogResult.OK;
                        }
                        else
                        {
                            ClsMsg.ShowWarningMsg("请勾选检漏的转鼓");
                        }
                        break;

                    case "ButExit":
                        this.Close();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.ToString());
            }
        }
Exemplo n.º 6
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            var result = Client.Utility.BarCode.frmScannCode1.Instance();

            if (result.IsNullOrEmpty() == false)
            {
                var currDrums = lstVW_QC_FindLeakDrumsSet.Where(t => t.DevCode == result).FirstOrDefault();
                if (currDrums != null)
                {
                    model.DevCode    = currDrums.DevCode;
                    model.DevName    = currDrums.DevName;
                    model.SourceCode = currDrums.ArrangedVouchCode;
                }
                else
                {
                    model.DevCode = null;
                    model.DevName = null;
                    ClsMsg.ShowWarningMsg("该转鼓未设定检漏或已经检漏。");
                }
            }
            else
            {
                model.DevCode = null;
                model.DevName = null;
            }


            //BgWait.RunWorkerAsync("SearchData");//提交页面数据
        }
Exemplo n.º 7
0
        /// <summary>
        /// barManager控件响应事件,打开新窗体,传入参数区分新增跟修改,等待窗体数据返回更新列表数据
        /// lastupdata:20161115XXQ
        /// /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                frmExecute AddExetue = null;
                strDeviCode = null;
                if (BgWait1.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "bbtniAdd":

                        AddExetue = new frmExecute(context, strDeviCode);

                        if (AddExetue.ShowDialog() == DialogResult.OK)
                        {
                            BgWait1.RunWorkerAsync("SearchData");
                        }

                        break;

                    case "bbtniUpdate":

                        if (gridView1.FocusedRowHandle >= 0)
                        {
                            var model1 = gridView1.GetRow(gridView1.FocusedRowHandle) as SRExcute.DeviceExecute;

                            AddExetue = new frmExecute(context, model1.DeviCode);

                            if (AddExetue.ShowDialog() == DialogResult.OK)
                            {
                                BgWait1.RunWorkerAsync("SearchData");
                            }
                        }
                        else
                        {
                            ClsMsg.ShowWarningMsg("选中要修改的设备信息");
                        }

                        break;

                    case "bbtnExit":

                        this.Close();

                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.ToString());
            }
        }
Exemplo n.º 8
0
        private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "bbtniSave":
                    //EndEditOnAllBindingSources();
                    deviceBindingSource.EndEdit();
                    if (model.DevCode.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForDevCode.Text);
                        DevCodeTextEdit.Focus();
                    }
                    else if (model.DevName.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForDevName.Text);
                        DevNameTextEdit.Focus();
                    }
                    else if (model.DevCCode.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForDevCCode.Text);
                        DevCCodeTextEdit.Focus();
                    }
                    else if (ClsMsg.ShowQuestionMsg("是否要保存设备档案信息呢?") == DialogResult.Yes)
                    {
                        bgwWait.RunWorkerAsync("SaveData");
                    }
                    break;

                case "bbtniDel":
                    if (strDevCode.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningMsg("无任何数据可删除!");
                        return;
                    }
                    if (ClsMsg.ShowQuestionMsg("是否要删除设备档案呢?") == DialogResult.Yes)
                    {
                        bgwWait.RunWorkerAsync("DeleteData");
                    }
                    break;

                case "bbtniExit":
                    this.Close();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.Message);
                Utils.Logger.Error(ex.ToString());
            }
        }
Exemplo n.º 9
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     qCFindLeakDrumsSetBindingSource.EndEdit();
     qCFindLeakDrumsSetDetailBindingSource.EndEdit();
     if (model.Frequency.IsNullOrEmpty())
     {
         ClsMsg.ShowWarningEmptyMsg(ForItemFrequency.Text);
         FrequencyTextEdit.Focus();
     }
     else if (detailList.Count == 0)
     {
         ClsMsg.ShowWarningMsg("未选择需要检漏转鼓信息,请选择转鼓");
     }
     else
     {
         bgwWait.RunWorkerAsync("SaveData");
     }
 }
Exemplo n.º 10
0
        private void SearchData2(DoWorkEventArgs e)
        {
            //打开窗口显示列表数据
            using (var client = new SRQZDDrumesSet.QCDrumsSetServiceClient())//引用服务
            {
                dCurrDate = Convert.ToDateTime(CreateTimeDateEdit.Text);

                var retlog = client.Getvw_QC_FindLeakDrumsSetList(context.SessionID, dCurrDate); // 转鼓当天待检漏信息

                if (retlog.IsSuccess)
                {
                    e.Result = retlog.Data;
                }
                else
                {
                    ClsMsg.ShowWarningMsg(retlog.Message);
                }
            }
        }
Exemplo n.º 11
0
        private void barManager_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "bbtniAdd":
                    Model = new SRDepartment.Department();
                    departmentBindingSource.DataSource = Model;
                    SetTextEditReadOnly("Add");
                    break;

                case "bbtniUpdata":
                    if (string.IsNullOrEmpty(DepCodeTextEdit.Text))
                    {
                        ClsMsg.ShowWarningMsg("请先选择需要修改的模板!");
                    }
                    else
                    {
                        SetTextEditReadOnly("Update");
                        departmentBindingSource.EndEdit();
                        this.strDepartmentNameOriginal = DepNameTextEdit.Text;
                    }
                    break;

                case "bbtniDelete":
                    if (string.IsNullOrEmpty(DepCodeTextEdit.Text))
                    {
                        ClsMsg.ShowWarningMsg("请先选择需要删除的模板!");
                    }
                    else if (bgWait.IsBusy == false)
                    {
                        bgWait.RunWorkerAsync("DeleteDepartmentClass");
                    }
                    break;

                case "bbtniSave":
                    if (DepCodeTextEdit.Properties.ReadOnly == true && DepNameTextEdit.Properties.ReadOnly == true)
                    {
                        ClsMsg.ShowWarningMsg("非“新增”、“修改”模式,保存无效!");
                    }
                    else if (bgWait.IsBusy == false)
                    {
                        bgWait.RunWorkerAsync("SaveDepartmentClass");
                    }
                    break;

                case "bbtniExit":
                    this.Close();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.Message);
                Utils.Logger.Error(ex.ToString());
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 工具栏事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bmButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (bgwWait1.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                        case "bbtnAdd1":

                            table = new SRDevice.DeviceInterface()
                            {
                                DevCode = strDevCode

                            };
                            deviceInterfaceBindingSource.DataSource = table;
                            this.DeviCodeTextEdit.Properties.ReadOnly = false;
                            this.bbtnModify.Enabled = false;
                            this.bbtnDel.Enabled = false;
                            this.bbtnSave.Enabled = true;
                            break;

                        case "bbtnSave":
                            deviceInterfaceBindingSource.EndEdit();
                            if (this.DeviCodeTextEdit.IsNullOrEmpty())
                            {
                                ClsMsg.ShowWarningMsg("无任何可保存的数据!");
                                return;
                            }
                            if (this.DeviCodeTextEdit.Text != "" && this.DeviNameTextEdit.Text != "" && this.DevpCodeTextEdit.Text != "" && this.DataTypeTextEdit.Text != "" && this.DevpAddressTextEdit.Text != "" && this.SendFormatTextEdit.Text != "")
                            {
                                if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes)
                                {
                                    bgwWait1.RunWorkerAsync("SaveData");
                                    this.DeviCodeTextEdit.Properties.ReadOnly = true;
                                    this.bbtnModify.Enabled = true;
                                    this.bbtnDel.Enabled = true;
                                    this.bbtnSave.Enabled = false;
                                }
                            }
                            else
                            {
                                ClsMsg.ShowWarningMsg("请填写完整,不能留空!");
                                return;
                            }


                            break;

                        case "bbtnDel":
                            deviceInterfaceBindingSource.EndEdit();
                            this.DeviCodeTextEdit.Properties.ReadOnly = true;
                            if (this.DeviCodeTextEdit.IsNullOrEmpty())
                            {
                                ClsMsg.ShowWarningMsg("请选中数据再进行删除!");
                                return;
                            }
                            if (ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes)
                            {
                                this.DeviNameTextEdit.Text = null;
                                this.RemarkTextEdit.Text = null;
                                this.SendFormatTextEdit.Text = null;
                                this.DevpAddressTextEdit.Text = null;
                                this.DevpCodeTextEdit.Text = null;
                                this.DataTypeTextEdit.Text = null;
                                bgwWait1.RunWorkerAsync("DelData");
                            }
                            break;

                        case "bbtnModify":

                            deviceInterfaceBindingSource.EndEdit();
                            this.DeviCodeTextEdit.Properties.ReadOnly = true;
                            if (this.DeviCodeTextEdit.IsNullOrEmpty())
                            {
                                ClsMsg.ShowWarningMsg("请选中数据再进行修改!");
                                return;
                            }
                            if (ClsMsg.ShowQuestionMsg("是否要更新当前数据呢?") == DialogResult.Yes)
                            {
                                bgwWait1.RunWorkerAsync("UpdData");
                            }
                            break;

                        case "bbtnExit":
                            this.Close();
                            break;

                        default:
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.Message);
                Utils.Logger.Error(ex.ToString());
            }
        }
Exemplo n.º 13
0
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                qCPullDetectionRegBindingSource.EndEdit();
                switch (e.Item.Name)
                {
                case "bbtniSave":

                    if (model.RegDate.ToString().IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForRegDate.Text);
                        RegDateDateEdit.Focus();
                    }
                    else if (model.QualityInspector.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForQualityInspector.Text);
                        QualityInspectorTextEdit.Focus();
                    }
                    else if (model.Frequency.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForFrequency.Text);
                        FrequencyTextEdit.Focus();
                    }
                    else if (model.ProductionLine.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForProductionLine.Text);
                        ProductionLineTextEdit.Focus();
                    }
                    else if (model.OrderCode.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForOrderCode.Text);
                        OrderCodeTextEdit.Focus();
                    }
                    else if (model.ProductLevel.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForProductLevel.Text);
                        ProductLevelComboBoxEdit.Focus();
                    }
                    else if (model.TestResults.IsNullOrEmpty())
                    {
                        ClsMsg.ShowWarningEmptyMsg(ItemForTestResults.Text);
                        //TestResultsTextEdit.Focus();
                    }
                    else
                    {
                        if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes)
                        {
                            bgwWait.RunWorkerAsync("SaveData");
                        }
                    }
                    break;

                case "bbtniStart":
                    if (bbtniStart.Caption.Equals("开始检测"))
                    {
                        if (model.ProductLevel.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForProductLevel.Text);
                            ProductLevelComboBoxEdit.Focus();
                        }
                        else if (model.OrderType.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForOrderType.Text);
                        }
                        else if (model.Width.HasValue == false)
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForWidth.Text);
                        }
                        else if (model.Thick.HasValue == false)
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForThick.Text);
                        }
                        else if (dtPullRule == null || dtPullRule.Rows.Count == 0)
                        {
                            ClsMsg.ShowWarningMsg("请先维护拉力检测计算规则!");
                        }
                        else
                        {
                            iNum = 0;
                            bool bSuccess = mp.Open("COM7");
                            if (bSuccess)
                            {
                                timer1.Start();
                                bbtniStart.Caption = "停止检测";
                            }
                            else
                            {
                                ClsMsg.ShowWarningMsg(mp.modbusMsg);
                            }
                        }
                    }
                    else
                    {
                        timer1.Stop();
                        mp.Close();
                        //   model.ActualPull = 0;
                        //   model.TestResults = "aaa";
                        //   ItemCurrPull.Text = "0";
                        qCPullDetectionRegBindingSource.DataSource = model;
                        //#if DEBUG
                        //                            model.ActualPull = Convert.ToDecimal(textEdit1.Text);
                        //#endif


                        bbtniStart.Caption = "开始检测";
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.Message);
                Utils.Logger.Error(ex.ToString());
            }
        }
Exemplo n.º 14
0
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "bbtniAddRow":
                    if (lstCPContrast != null)
                    {
                        lstCPContrast.Add(new CPContrast()
                        {
                            Editprop = "A"
                        });
                        cPContrastBindingSource.DataSource = lstCPContrast;
                        gridControl1.RefreshDataSource();
                    }
                    break;

                case "bbtniDelRow":
                    if (gridView1.FocusedRowHandle >= 0 && bgwWait.IsBusy == false)
                    {
                        gridView1.CloseEditor();
                        gridView1.UpdateCurrentRow();
                        var model = gridView1.GetRow(gridView1.FocusedRowHandle) as CPContrast;
                        if (model.Editprop.IsNullOrEmpty())
                        {
                            if (ClsMsg.ShowQuestionMsg("是否删除选中行呢?") == DialogResult.Yes)
                            {
                                bgwWait.RunWorkerAsync("DelData");
                            }
                        }
                        else
                        {
                            lstCPContrast.Remove(model);
                            cPContrastBindingSource.DataSource = lstCPContrast;
                            gridControl1.RefreshDataSource();
                        }
                    }
                    break;

                case "bbtniSave":
                    if (bgwWait.IsBusy == false && lstCPContrast != null)
                    {
                        if (ClsMsg.ShowQuestionMsg("是否要保存当前列表数据呢?") == DialogResult.Yes)
                        {
                            gridView1.CloseEditor();
                            gridView1.UpdateCurrentRow();
                            cPContrastBindingSource.EndEdit();
                            bool bEdit = false;
                            for (int i = 0; i < lstCPContrast.Count; i++)
                            {
                                var m = lstCPContrast[i];
                                if (m.Editprop.IsNullOrEmpty() == false)
                                {
                                    bEdit = true;
                                    if (m.ParamName.IsNullOrEmpty())
                                    {
                                        ClsMsg.ShowWarningMsg(string.Format("第{0}行参数名称不能为空!", (i + 1).ToString()));
                                        return;
                                    }
                                    //else if (m.DevepName.IsNullOrEmpty())
                                    //{
                                    //    ClsMsg.ShowWarningMsg(string.Format("第{0}行设备参数名称不能为空!", (i + 1).ToString()));
                                    //    return;
                                    //}
                                }
                            }
                            if (bEdit)
                            {
                                bgwWait.RunWorkerAsync("SaveData");
                            }
                        }
                    }
                    break;

                case "bbtniRefer":
                    if (bgwWait.IsBusy == false)
                    {
                        bgwWait.RunWorkerAsync("LoadData");
                    }
                    break;

                case "bbtniExit":
                    this.Close();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Utils.Logger.Error(ex.ToString());
                ClsMsg.ShowErrMsg(ex.Message);
            }
        }
Exemplo n.º 15
0
        private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (bgwWait.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "bbtniAdd":
                        DevCCodeTextEdit.Properties.ReadOnly = false;
                        model = new SRDevice.DeviceClass()
                        {
                            Grade = 0
                        };
                        deviceClassBindingSource.DataSource = model;
                        break;

                    case "bbtniSave":
                        deviceClassBindingSource.EndEdit();

                        if (model == null)
                        {
                            ClsMsg.ShowWarningMsg("无任何可保存的数据!");
                        }
                        else if (model.DevCCode.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForDevCCode.Text);
                            DevCCodeTextEdit.Focus();
                        }
                        else if (model.DevCName.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForDevCName.Text);
                            DevCNameTextEdit.Focus();
                        }
                        else if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes)
                        {
                            bgwWait.RunWorkerAsync("SaveData");
                        }
                        break;

                    case "bbtniDel":
                        deviceClassBindingSource.EndEdit();
                        if (model != null && ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes)
                        {
                            bgwWait.RunWorkerAsync("DelData");
                        }
                        break;

                    case "bbtniExit":
                        this.Close();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.Message);
                Utils.Logger.Error(ex.ToString());
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 检测拉力计算
        /// </summary>
        /// <returns></returns>
        private string CheckPullRull()
        {
            decimal dCurrPull = model.ActualPull.Value;
            bool    ifValue   = true;

            if (model.ProductLevel.Equals("二级品")) //1、当产品级别为二级品时,根据实际拉力判断上下限;
            {
                var dFilterRows = dtPullRule.Select(string.Format("[产品级别]='{0}'", model.ProductLevel), "[优先级],[强度] asc");
                if (dFilterRows.Length == 0)
                {
                    ClsMsg.ShowWarningMsg(string.Format("检测拉力计算规则中,无产品级别=[{0}]的计算规则!",
                                                        model.ProductLevel));
                    return(null);
                }
                var dRow = dFilterRows[0];
                var val  = (new DataTable().Compute(string.Format("{0}+{1}>={2} and {2}>={1}-{3}", dRow["拉力上限"].ToString(), model.StandardPull.Value, dCurrPull, dRow["拉力下限"].ToString()), "")); //拉力上限+标准拉力>=实际拉力>=标准拉力-拉力下限
                ifValue = (Boolean)val;
            }
            else
            {
                if (model.Strength.ToString().Equals("40强") && model.OrderType.Equals("*AAR外贸订单") == false)                                                                     //2、产品级别为一级品 且强度等于40强 订单类型不等于外贸订单
                {
                    var val = (new DataTable().Compute(string.Format("{0}>={1} and {1}>={2}", model.Width * model.Thick * 40, dCurrPull, model.Width * model.Thick * 38), "")); //拉力上限(订单宽度*厚度*40)>=实际拉力>=拉力下限(订单宽度*厚度*38)
                    ifValue = (Boolean)val;
                }
                else
                {
                    string strfilter   = string.Format("[产品级别]='{0}' and [订单类型]='{1}'", model.ProductLevel, model.OrderType);
                    var    dFilterRows = dtPullRule.Select(strfilter, "[优先级],[强度] asc");
                    if (dFilterRows.Length == 0)
                    {
                        ClsMsg.ShowWarningMsg(string.Format("检测拉力计算规则中,无产品级别=[{0}]+订单类型=[{1}]的计算组合!",
                                                            model.ProductLevel, model.OrderType));
                        return(null);
                    }
                    var dRow = dFilterRows[0];

                    if (dRow["产品级别"].ToString().Equals("一级品"))                                                                                                                                              //3、产品级别为一级品 且强度不等于40强
                    {
                        if (dRow["订单类型"].ToString().Equals("*AAR外贸订单"))                                                                                                                                     //3.1、订单类型:外贸订单
                        {
                            var val = (new DataTable().Compute(string.Format("{0}+{1}>={2} and {2}>={1}-{3}", dRow["拉力上限"].ToString(), model.StandardPull.Value, dCurrPull, dRow["拉力下限"].ToString()), "")); //拉力上限+标准拉力>=实际拉力>=标准拉力-拉力下限
                            ifValue = (Boolean)val;
                        }
                        else if (dRow["优先级"].ToString().Equals("4")) //3.2、优先级等于4
                        {
                            var     dt    = new DataTable();
                            DataRow dRow1 = null;
                            foreach (var item in dFilterRows)
                            {
                                var v = (Boolean)dt.Compute(string.Format("{0}{1} and {2}{3}", model.Width, item["宽度"].ToString(), model.Thick, item["厚度"].ToString()), "");
                                if (v)
                                {
                                    dRow1 = item;
                                    break;
                                }
                            }
                            if (dRow1 != null)
                            {
                                var val = (new DataTable().Compute(string.Format("{0}+{1}>={2} and {2}>={1}-{3}", dRow1["拉力上限"].ToString(), model.StandardPull.Value, dCurrPull, dRow1["拉力下限"].ToString()), "")); //拉力上限+标准拉力>=实际拉力>=标准拉力-拉力下限
                                ifValue = (Boolean)val;
                            }
                            else
                            {
                                ClsMsg.ShowWarningMsg(string.Format("检测拉力计算规则中,无产品级别=[{0}]+订单类型=[{1}]的计算范围!", model.ProductLevel, model.OrderType));
                                return(null);
                            }
                        }
                    }
                }
            }
            return(ifValue ? "合格" : "不合格");
        }
Exemplo n.º 17
0
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (BgWait2.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "bbtniAdd":

                        EndEditOnAllBindingSources();
                        if (strDeviCode.IsNullOrEmpty() && ClsMsg.ShowQuestionMsg("是否要保存设备档案信息呢?") == DialogResult.Yes)
                        {
                            BgWait2.RunWorkerAsync("SaveData");
                        }

                        else if (CollFrequencyTextEdit.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForCollFrequency.Text);
                            CollFrequencyTextEdit.Focus();
                        }
                        else if (UserStatusSpinEdit.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForUserStatus.Text);
                            UserStatusSpinEdit.Focus();
                        }

                        else
                        {
                            if (ClsMsg.ShowQuestionMsg("是否要修改设备档案信息呢?") == DialogResult.Yes)
                            {
                                EndEditOnAllBindingSources();
                                BgWait2.RunWorkerAsync("UpdData");
                            }
                        }
                        break;

                    case "bbtniUpdate":


                        BgWait2.RunWorkerAsync("UpdData");

                        break;

                    case "bbtniDelete":

                        if (strDeviCode.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningMsg("无任何数据可删除!");
                            return;
                        }
                        if (ClsMsg.ShowQuestionMsg("是否要删除设备档案呢?") == DialogResult.Yes)
                        {
                            BgWait2.RunWorkerAsync("Delete");
                        }

                        break;

                    case "bbtnExit":

                        this.Close();


                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.ToString());
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 工具栏事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                Frm.frmDevice dev = null;
                switch (e.Item.Name)
                {
                case "bbtniAdd":
                    if (tvDevClass.Nodes.Count > 0)
                    {
                        string strDevCCode = null;

                        if (tvDevClass.SelectedNode != null && tvDevClass.SelectedNode.Nodes.Count == 0)        //末级判断
                        {
                            strDevCCode = (tvDevClass.SelectedNode.Tag as SRDevice.DeviceClass).DevCCode;
                        }
                        dev = new Frm.frmDevice(context, strDevCCode: strDevCCode);
                        if (dev.ShowDialog() == DialogResult.OK)
                        {
                            bgwWait.RunWorkerAsync("SearchData");
                        }
                    }
                    else
                    {
                        ClsMsg.ShowWarningMsg("需要先建立设备分类");
                    }
                    break;

                case "bbtniModify":

                    if (gvDevice.FocusedRowHandle >= 0)
                    {
                        var model = gvDevice.GetRow(gvDevice.FocusedRowHandle) as SRDevice.VDeviceInfo;
                        dev = new Frm.frmDevice(context, model.DevCode);
                        if (dev.ShowDialog() == DialogResult.OK)
                        {
                            bgwWait.RunWorkerAsync("SearchData");
                        }
                    }
                    else
                    {
                        ClsMsg.ShowWarningMsg("选中要修改的设备信息");
                    }
                    break;

                case "bbtniParameter":
                    if (gvDevice.FocusedRowHandle >= 0)
                    {
                        var             model = gvDevice.GetRow(gvDevice.FocusedRowHandle) as SRDevice.VDeviceInfo;
                        frmDevParamList devp  = new frmDevParamList(context, model.DevCode, model.DevName);
                        if (devp.ShowDialog() == DialogResult.OK)
                        {
                            //   // bgwWait.RunWorkerAsync("SearchData");
                        }
                    }
                    else
                    {
                        ClsMsg.ShowWarningMsg("选中设备信息");
                    }
                    break;

                case "bbtniInterface":
                    if (gvDevice.FocusedRowHandle >= 0)
                    {
                        var model = gvDevice.GetRow(gvDevice.FocusedRowHandle) as SRDevice.VDeviceInfo;
                        frmDevInterfaceList interfacelist = new frmDevInterfaceList(context, model.DevCode, model.DevName);

                        if (interfacelist.ShowDialog() == DialogResult.OK)
                        {
                        }
                    }
                    else
                    {
                        ClsMsg.ShowWarningMsg("选中设备信息");
                    }
                    break;

                case "bbtniExit":
                    this.Close();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.Message);
                Utils.Logger.Error(ex.ToString());
            }
        }
Exemplo n.º 19
0
        private void bmTool_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (BgwWait.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "bbtnseach":
                        BgwWait.RunWorkerAsync("SearchData");


                        break;

                    case "bbtniAdd":

                        DevpCodeTextEdit.Properties.ReadOnly = false;
                        model = new SRDevice.DeviceParameter()
                        {
                            DevCode = strDevCode
                        };
                        deviceParameterBindingSource.DataSource = model;
                        //  DevpCodeTextEdit.Properties.ReadOnly = true;

                        bbtniSave.Enabled   = true;
                        bbtniUpdate.Enabled = false;

                        bbtniDel.Enabled = false;

                        //    ClsMsg.ShowWarningMsg("开启设备编辑模式!");

                        break;

                    case "bbtniSave":

                        //  deviceParameterBindingSource.DataSource = model;
                        //  model = new SRDevice.DeviceClass();
                        deviceParameterBindingSource.EndEdit();
                        //      if (this.DeviCodeTextEdit.Text != "" && this.DeviNameTextEdit.Text != "" && this.DevpCodeTextEdit.Text != "" && this.DataTypeTextEdit.Text != "" && this.DevpAddressTextEdit.Text != "" && this.SendFormatTextEdit.Text != "")
                        if (model == null || this.DevCodeTextEdit.Text == "" || this.DevpCodeTextEdit.Text == "" || this.DevpNameTextEdit.Text == "" || this.StandardValueTextEdit.Text == "" || this.MaxValueTextEdit.Text == "" || this.MinValueTextEdit.Text == "")
                        {
                            ClsMsg.ShowWarningMsg("请输入完整数据!");
                        }

                        else if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes)
                        {
                            BgwWait.RunWorkerAsync("SaveData");
                        }

                        break;

                    case "bbtniDel":
                        deviceParameterBindingSource.EndEdit();
                        if (model != null && ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes)
                        {
                            BgwWait.RunWorkerAsync("DelData");
                        }
                        break;

                    case "bbtniUpdate":

                        deviceParameterBindingSource.EndEdit();
                        if (model != null && ClsMsg.ShowQuestionMsg("是否要更新当前数据呢?") == DialogResult.Yes)
                        {
                            BgwWait.RunWorkerAsync("UpdData");
                        }
                        break;

                    case "bbtnExit":
                        this.Close();
                        break;


                    case "barButtonItem2":

                        if (BgwWait.IsBusy == false)
                        {
                            gridControl1.RefreshDataSource();
                            BgwWait.RunWorkerAsync("SearchData");
                        }

                        break;


                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.ToString());
            }
        }
Exemplo n.º 20
0
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (BgwWait.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "bbtnseach":

                        BgwWait.RunWorkerAsync("SearchData");

                        bbtniAdd.Enabled    = true;
                        bbtniSave.Enabled   = false;
                        bbtniUpdate.Enabled = true;
                        bbtniDel.Enabled    = true;

                        break;

                    case "bbtniAdd":

                        InsterData();

                        bbtniAdd.Enabled    = false;
                        bbtniSave.Enabled   = true;
                        bbtniUpdate.Enabled = false;
                        bbtniDel.Enabled    = false;

                        break;

                    case "bbtniSave":

                        iPRegistFormBindingSource.EndEdit();

                        if (IPTextEdit.Text == "")
                        {
                            ClsMsg.ShowWarningMsg("IP为必填项,请输入完整数据!");
                        }

                        else if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes)
                        {
                            BgwWait.RunWorkerAsync("SaveData");
                        }

                        bbtniAdd.Enabled    = true;
                        bbtniSave.Enabled   = false;
                        bbtniUpdate.Enabled = true;
                        bbtniDel.Enabled    = true;

                        break;

                    case "bbtniDel":
                        iPRegistFormBindingSource.EndEdit();
                        if (model != null && ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes)
                        {
                            BgwWait.RunWorkerAsync("DelData");
                        }

                        break;

                    case "bbtniUpdate":

                        iPRegistFormBindingSource.EndEdit();
                        if (model != null && ClsMsg.ShowQuestionMsg("是否要更新当前数据呢?") == DialogResult.Yes)
                        {
                            BgwWait.RunWorkerAsync("UpdData");
                        }

                        break;

                    case "bbtnExit":
                        this.Close();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ClsMsg.ShowErrMsg(ex.ToString());
            }
        }
Exemplo n.º 21
0
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                if (bgwWait.IsBusy == false)
                {
                    switch (e.Item.Name)
                    {
                    case "bbtniAdd":
                        headModel = new SRCLParamSet.CraftsLineParamSet();
                        headModel.CreateDateTime = DateTime.Now;
                        headModel.Creator        = context.UserName;
                        craftsLineParamSetBindingSource.DataSource = headModel;
                        lstbodyModel = new List <SRCLParamSet.VCraftsLineParamSetDetail>();
                        //lstbodyModel.Add(new SRCLParamSet.CraftsLineParamSets());
                        craftsLineParamSetsBindingSource.DataSource = lstbodyModel;
                        gridControl1.RefreshDataSource();
                        break;

                    case "bbtniSave":
                        gvDetail.CloseEditor();
                        craftsLineParamSetBindingSource.EndEdit();
                        craftsLineParamSetsBindingSource.EndEdit();
                        if (headModel.CraftsName.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForCraftsName.Text);
                            CraftsNameButtonEdit.Focus();
                            return;
                        }
                        else if (headModel.WorkShop.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForWorkShop.Text);
                            WorkShopTextEdit.Focus();
                            return;
                        }
                        else if (headModel.Treatment.IsNullOrEmpty())
                        {
                            ClsMsg.ShowWarningEmptyMsg(ItemForTreatment.Text);
                            TreatmentLookUpEdit.Focus();
                            return;
                        }
                        else if (headModel.Treatment.Equals("1") && (headModel.CraftsTaskTime.HasValue == false || headModel.CraftsTaskTime.Value <= 0))
                        {
                            ClsMsg.ShowWarningMsg("处理方式为:自动,工艺总耗时不能小于零或为空!");
                            CraftsTaskTimeCalcEdit.Focus();
                            return;
                        }
                        else if (headModel.Order <= 0)
                        {
                            ClsMsg.ShowWarningMsg(ItemForOrder.Text + "不能小于等于零!");
                            OrderSpinEdit.Focus();
                            return;
                        }
                        else if (headModel.Treatment.Equals("1") && lstbodyModel.Count == 0)
                        {
                            ClsMsg.ShowWarningMsg("处理方式为:自动,工艺参数明细不能为空!");
                            return;
                        }
                        else if (lstbodyModel.Count > 0)
                        {
                            //if (lstbodyModel.Where(t => (t.Editprop.IsNullOrEmpty() || t.Editprop != "D")).OrderBy(t => t.Priority).First().Priority != 0)
                            //{
                            //    ClsMsg.ShowWarningMsg("工艺参数明细优先级没有开始参数");
                            //    return;
                            //}
                            //else
                            if (headModel.Treatment == "1")     //处理方式:自动,判断必须有结束
                            {
                                if (lstbodyModel.Where(t => (t.Editprop.IsNullOrEmpty() || t.Editprop != "D")).OrderByDescending(t => t.Priority).First().Priority != 100)
                                {
                                    ClsMsg.ShowWarningMsg("工艺参数明细优先级没有结束参数");
                                    return;
                                }
                            }

                            for (int i = 0; i < lstbodyModel.Count; i++)
                            {
                                var item = lstbodyModel[i];
                                if (item.Editprop.IsNullOrEmpty() || item.Editprop.Equals("E"))
                                {
                                    if (item.ParameterID == 0)
                                    {
                                        ClsMsg.ShowWarningEmptyMsg(string.Format("第{0}行参数名称", i.ToString()));
                                        return;
                                    }
                                    else if (item.UserStatus.IsNullOrEmpty())
                                    {
                                        ClsMsg.ShowWarningEmptyMsg(string.Format("第{0}行使用状态", i.ToString()));
                                        return;
                                    }
                                }
                            }
                        }
                        if (ClsMsg.ShowQuestionMsg("是否要保存当前数据呢?") == DialogResult.Yes)
                        {
                            bgwWait.RunWorkerAsync("SaveData");
                        }
                        break;

                    case "bbtniDel":
                        if (ClsMsg.ShowQuestionMsg("是否要删除当前数据呢?") == DialogResult.Yes)
                        {
                            bgwWait.RunWorkerAsync("DelData");
                        }
                        break;

                    case "bbtniDelRow":
                        var curr = lstbodyModel.Where(t => t.Editprop != "D").ToList()[gvDetail.FocusedRowHandle];
                        curr.Editprop = "D";
                        craftsLineParamSetsBindingSource.DataSource = lstbodyModel;
                        gridControl1.RefreshDataSource();
                        break;

                    case "bbtniAddRow":
                        lstbodyModel.Add(new SRCLParamSet.VCraftsLineParamSetDetail()
                        {
                            ID         = headModel.ID,
                            Editprop   = "A",
                            UserStatus = "0"
                        });
                        craftsLineParamSetsBindingSource.DataSource = lstbodyModel;
                        gridControl1.RefreshDataSource();
                        break;

                    case "bbtniExit":
                        this.Close();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.Logger.Error(ex.ToString());
                ClsMsg.ShowErrMsg(ex.Message);
            }
        }