Beispiel #1
0
        bool arule_OptRule(string type, string[] data)
        {
            IsysService service = sysService.GetService();
            var         rs      = string.Empty;

            switch (type)
            {
            case "ADD":
                data[0] = Guid.NewGuid().ToString();
                rs      = service.AddRule(data[0], data[1], data[2], data[3], data[4].ToLower() == "all" ? "*" : data[4]);
                break;

            case "EDIT":
                rs = service.EditRule(data[0], data[1], data[2], data[3], data[4].ToLower() == "all" ? "*" : data[4]);
                break;

            case "DEL":
                rs = service.DelRule(data[0]);
                break;

            default:
                break;
            }

            if (rs == "-1")
            {
                MsgBoxEx.Info("Name already exist");
                return(false);
            }

            frm_config_Load(null, null);

            return(true);
        }
Beispiel #2
0
        private void btnDbImp_Click(object sender, EventArgs e)
        {
            if (MsgBoxEx.ConfirmYesNo("Are you sure to import the file") == DialogResult.No)
            {
                return;
            }

            if (string.IsNullOrEmpty(cbxFiles.Text))
            {
                MsgBoxEx.Info("Please select a file to import.");
                return;
            }

            ShowLoading(ToopEnum.loading);

            IwrService service = wrService.GetService();
            var        rs      = service.ImpOrExpDatabase("1", cbxFiles.Text) >= 0;

            if (rs)
            {
                cbxFiles.Items.AddRange(service.GetDBFilesList().ToArray());
            }

            CloseLoading();
        }
Beispiel #3
0
        private void btnSystem_Click(object sender, EventArgs e)
        {
            IsysService service = sysService.GetService();

            var list = service.GetCmn("3022");

            if (list.Count > 0)
            {
                foreach (var l in list)
                {
                    switch (l.CODE)
                    {
                    case "0":
                        l.VALUE = nudDisk.Value.ToString();
                        break;

                    default:
                        break;
                    }
                }
            }

            service.UpdateDict(list);

            MsgBoxEx.Info("Save success, please refresh the data.");
        }
Beispiel #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim().Length < 1)
            {
                txtName.Focus();
                MsgBoxEx.Info("Please input name");
                return;
            }

            IsysService service = sysService.GetService();
            string      res     = "";

            if (IsAdd)
            {
                res = service.AddRole(txtCode.Text, txtName.Text.Trim(), txtRemark.Text.Trim(), DataCache.UserInfo.ID);
            }
            else
            {
                res = service.UpdateRole(txtCode.Text, txtName.Text.Trim(), txtRemark.Text.Trim(), DataCache.UserInfo.ID);
            }

            if (res != "1")
            {
                MsgBoxEx.Info(res);
                return;
            }

            DialogResult = DialogResult.OK;
        }
Beispiel #5
0
        private void BtnClassRole_Click(object sender, EventArgs e)
        {
            List <CMNDICT> dictList = new List <CMNDICT>();

            if (clbClass.SelectedItems.Count == 0)
            {
                MsgBoxEx.Info("Please select at least one item.");
                return;
            }

            foreach (WmClassificationItemEntity item in clbClass.CheckedItems)
            {
                CMNDICT model = new CMNDICT();

                model.DICTID = "3000";
                model.CODE   = item.ID.ToString();
                model.NAME   = item.NAME.ToString();

                dictList.Add(model);
            }

            IsysService service = sysService.GetService();

            service.AddDict(dictList);

            MsgBoxEx.Info("Save success, please refresh the data.");
        }
Beispiel #6
0
        /// <summary>
        /// 表空间扩容
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnTableSpaceAdd_Click(object sender, EventArgs e)
        {
            if (MsgBoxEx.ConfirmYesNo("Are you sure to add the tablespace") == DialogResult.No)
            {
                return;
            }

            ShowLoading(ToopEnum.loading);

            try
            {
                IwrService service = wrService.GetService();
                var        rs      = service.AddTableSpace("");

                if (rs)
                {
                    MsgBoxEx.Info("Please restart the program.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseLoading();
            }
        }
Beispiel #7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtRecipeId.Text.Trim().Length < 1)
            {
                txtRecipeId.Focus();
                MsgBoxEx.Info("Please input recipe id");
                return;
            }

            IwrService service = wrService.GetService();
            var        res     = 0;

            var type = rbRepice.Checked ? "0" : rbLayer.Checked ? "1" : rbDevice.Checked ? "2" : "0";

            if (IsAdd)
            {
                res = service.AddYield(txtRecipeId.Text, type, nudLotYield.Value, nudWaferYield.Value, nudAYield.Value, nudBYield.Value, nudCYield.Value, nudDYield.Value, nudEYield.Value, txtImg.Text);
            }
            else
            {
                res = service.EditYield(txtRecipeId.Text, type, nudLotYield.Value, nudWaferYield.Value, nudAYield.Value, nudBYield.Value, nudCYield.Value, nudDYield.Value, nudEYield.Value, txtImg.Text);
            }

            if (res == -2)
            {
                MsgBoxEx.Info("The recipe id already exists");
                return;
            }

            DialogResult = DialogResult.OK;
        }
Beispiel #8
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            double tdays = (dateTo.Value - dtDate.Value).TotalDays;

            if (tdays < 0)
            {
                dtDate.Focus();
                MsgBoxEx.Info("From date selection error.");
                return;
            }

            IwrService service = wrService.GetService();
            var        lst     = service.GetWaferResultHis(dtDate.Value.ToString("yyyyMMdd000000"), dateTo.Value.ToString("yyyyMMdd235959"), GetLot());

            if (DataCache.UserInfo.FilterData)
            {
                var newWaferList = ((from w in lst
                                     group w by new { w.DEVICE, w.LAYER, w.LOT, w.SUBSTRATE_ID } into l
                                     select new { DEVICE = l.Key.DEVICE, LAYER = l.Key.LAYER, LOT = l.Key.LOT, SUBSTRATE_ID = l.Key.SUBSTRATE_ID, CREATEDDATE = l.Max(s => s.CREATEDDATE) }))
                                   .ToList();

                lst = (from w in lst
                       join n in newWaferList
                       on new { w.DEVICE, w.LAYER, w.LOT, w.SUBSTRATE_ID, w.CREATEDDATE } equals new { n.DEVICE, n.LAYER, n.LOT, n.SUBSTRATE_ID, n.CREATEDDATE }
                       select w).ToList();
            }

            grdData.AutoGenerateColumns = false;
            grdData.DataSource          = lst;
        }
Beispiel #9
0
        private void lblConnction_Click(object sender, EventArgs e)
        {
            frm_connsetting frm = new frm_connsetting();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                MsgBoxEx.Info("Saved successfully, Please run the program again.");
                Application.Exit();
            }
        }
Beispiel #10
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtOldPwd.Text.Trim().Length < 1)
            {
                txtOldPwd.Focus();
                MsgBoxEx.Info("Please input old password");
                return;
            }

            if (txtNewPwd.Text.Trim().Length < 1)
            {
                txtNewPwd.Focus();
                MsgBoxEx.Info("Please input new password");
                return;
            }

            if (txtConPwd.Text.Trim().Length < 1)
            {
                txtConPwd.Focus();
                MsgBoxEx.Info("Please input confirm password");
                return;
            }

            if (txtNewPwd.Text.Trim() != txtConPwd.Text.Trim())
            {
                txtNewPwd.Focus();
                MsgBoxEx.Info("New password and confirm password is not the same");
                return;
            }

            IsysService service = sysService.GetService();
            string      res     = service.UpdatePwd(DataCache.UserInfo.ID, txtOldPwd.Text.Trim(), txtNewPwd.Text.Trim(), DataCache.UserInfo.ID);

            if (res == "1")
            {
                MsgBoxEx.Info("Your password has been changed successfully,Please log in again.");
                //btnClose_Click(null, null);
                if (frmMain != null)
                {
                    frmMain.ReLogin();
                }
            }
            else if (res == "-1")
            {
                MsgBoxEx.Error("Your old password input errors");
            }
            else
            {
                MsgBoxEx.Error("Your password modification failed");
            }
        }
Beispiel #11
0
        /// <summary>
        /// 保存自定义缺陷
        /// </summary>
        /// <returns></returns>
        private bool SaveHotKey()
        {
            grdClass.EndEdit();

            List <WmClassificationItemEntity> items = grdClass.DataSource as List <WmClassificationItemEntity>;

            if (items == null || items.Count < 1)
            {
                return(false);
            }

            StringBuilder sbt = new StringBuilder();

            foreach (var item in items)
            {
                if (!string.IsNullOrEmpty(item.InspectionType))
                {
                    if (items.Any(p => p.ID != item.ID && p.HOTKEY == item.HOTKEY && !string.IsNullOrEmpty(item.HOTKEY)))
                    {
                        MsgBoxEx.Info(string.Format("Acc Keys[{0}] already repeated!", DataCache.CmnDict.FirstOrDefault(p => p.DICTID == "2010" && p.CODE == item.HOTKEY).NAME));
                        return(false);
                    }

                    sbt.AppendFormat(";{0}|{1}|{2}", item.ID, item.HOTKEY, item.COLOR);
                }
            }

            if (sbt.Length < 1)
            {
                return(true);
            }

            IwrService service = wrService.GetService();
            int        res     = service.UpdateClassificationItemUser(sbt.ToString(), "");

            if (res == 1)
            {
                items.ForEach((p) => { p.InspectionType = ""; });
            }

            return(true);
        }
Beispiel #12
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim().Length < 1)
            {
                txtName.Focus();
                MsgBoxEx.Info("Please input name");
                return;
            }

            if (IsAdd && lbResult.Items.Count == 0)
            {
                MsgBoxEx.Info("Please select wafer result");
                return;
            }

            IwrService service = wrService.GetService();
            var        res     = 0;

            var resultId = string.Join(",", ResultList.Select(s => s.ID).ToArray());

            if (IsAdd)
            {
                res = service.AddLibray(resultId, txtName.Text.Trim(), txtRemark.Text, DataCache.UserInfo.ID, (ckStatus.Checked ? "1" : "0"));
            }
            else
            {
                res = service.UpdateLibray(Entity.LID, txtName.Text.Trim(), txtRemark.Text, (ckStatus.Checked ? "1" : "0"), DataCache.UserInfo.ID);
            }

            if (res == -1)
            {
                MsgBoxEx.Info("Name already exist");
                return;
            }
            else if (res != 1)
            {
                MsgBoxEx.Info("Save failed");
                return;
            }

            DialogResult = DialogResult.OK;
        }
Beispiel #13
0
        private void tlPlanAdd_Click(object sender, EventArgs e)
        {
            if (grdLibrary.SelectedRows == null || grdLibrary.SelectedRows.Count < 1)
            {
                MsgBoxEx.Info("Please add a new library");
                return;
            }

            string lid = grdLibrary.SelectedRows[0].Cells["LID"].Value.ToString();

            frm_planedit frm = new frm_planedit();

            frm.LID = lid;

            frm.IsAdd = true;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                LoadPlanData(lid);
            }
        }
Beispiel #14
0
        private void ArchiveDate()
        {
            var lastDate = DataCache.CmnDict.Where(s => s.DICTID == "3021" && s.CODE == "0").Select(s => s.VALUE).FirstOrDefault();

            if (string.IsNullOrEmpty(lastDate))
            {
                MsgBoxEx.Info("Data not yet archived, please archive now.");
            }
            else
            {
                var intervalDay = (DateTime.Now - DateTime.ParseExact(lastDate,
                                                                      "yyyyMMdd",
                                                                      System.Globalization.CultureInfo.InvariantCulture)).Days;

                if (intervalDay > 7)
                {
                    MsgBoxEx.Info("It's been over seven days since the last archive, please archive now.");
                }
            }
        }
Beispiel #15
0
        private void tlPlanEdit_Click(object sender, EventArgs e)
        {
            if (grdPlan.SelectedRows == null || grdPlan.SelectedRows.Count < 1)
            {
                MsgBoxEx.Info("Please select the updated data");
                return;
            }

            string id   = grdPlan.SelectedRows[0].Cells["pid"].Value.ToString();
            var    data = grdPlan.DataSource as List <EMPLAN>;

            frm_planedit frm = new frm_planedit();

            frm.emPlan = data.FirstOrDefault(p => p.PID == id);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                tlPlanRefresh.PerformClick();
            }
        }
Beispiel #16
0
        private void tlPlanDelete_Click(object sender, EventArgs e)
        {
            if (grdPlan.SelectedRows == null || grdPlan.SelectedRows.Count < 1)
            {
                MsgBoxEx.Info("Please select Delete data");
                return;
            }

            if (MsgBoxEx.ConfirmYesNo("Are you sure to delete the record?") == DialogResult.No)
            {
                return;
            }

            string id = grdPlan.SelectedRows[0].Cells["pid"].Value.ToString();

            IwrService service = wrService.GetService();

            service.DeletePlan(id, DataCache.UserInfo.ID);

            tlPlanRefresh.PerformClick();
        }
Beispiel #17
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string userid = txtUser.Text.Trim();

            if (string.IsNullOrEmpty(userid))
            {
                MsgBoxEx.Info(MessageConst.frm_login_msg001);
                return;
            }

            string pwd = txtPwd.Text.Trim();

            if (string.IsNullOrEmpty(pwd))
            {
                MsgBoxEx.Info(MessageConst.frm_login_msg002);
                return;
            }

            btnOK.Enabled    = false;
            btnReset.Enabled = false;
            txtUser.Enabled  = false;
            txtPwd.Enabled   = false;

            lblMsg.Visible = true;

            var thr = new Thread(() =>
            {
                try
                {
                    Login(userid, pwd);
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                    //MsgBoxEx.Error(ex.Message);
                }
            });

            thr.Start();
        }
Beispiel #18
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtID.Text.Trim().Length < 1)
            {
                txtID.Focus();
                MsgBoxEx.Info("Please input ID");
                return;
            }

            if (txtName.Text.Trim().Length < 1)
            {
                txtName.Focus();
                MsgBoxEx.Info("Please input name");
                return;
            }

            IsysService service = sysService.GetService();
            string      res     = "";

            if (IsAdd)
            {
                res = service.AddUser(Guid.NewGuid().ToString("N").ToUpper(), txtID.Text.Trim(), txtPwd.Text.Trim(),
                                      txtName.Text.Trim(), txtPhone.Text.Trim(), txtEmail.Text.Trim(), txtRemark.Text.Trim(), (cbxRereview.Checked ? "1" : "0"), DataCache.UserInfo.ID);
            }
            else
            {
                res = service.UpdateUser(tbUser.ID, txtID.Text.Trim(), txtPwd.Text.Trim(),
                                         txtName.Text.Trim(), txtPhone.Text.Trim(), txtEmail.Text.Trim(), txtRemark.Text.Trim(), (cbxRereview.Checked ? "1" : "0"), DataCache.UserInfo.ID);
            }

            if (res != "1")
            {
                MsgBoxEx.Info(res);
                return;
            }

            DialogResult = DialogResult.OK;
        }
Beispiel #19
0
        private void btnWaferYield_Click(object sender, EventArgs e)
        {
            IsysService service = sysService.GetService();

            //yield
            var list = service.GetCmn("3010");

            if (list.Count > 0)
            {
                foreach (var l in list)
                {
                    switch (l.CODE)
                    {
                    case "0":
                        l.VALUE = nudLotYield.Value.ToString();
                        break;

                    case "1":
                        l.VALUE = nudWaferYield.Value.ToString();
                        break;

                    default:
                        break;
                    }
                }
            }

            var rs = service.UpdateDict(list);

            if (rs == "0")
            {
                DataCache.CmnDict = service.GetCmn("");
            }

            MsgBoxEx.Info("Save success, please refresh the data.");
        }
Beispiel #20
0
        private void Login(string userid, string pwd)
        {
            IsysService    service = sysService.GetService();
            UserInfoEntity ent     = service.Login(userid, pwd);

            if (ent.IsOK == 0)
            {
                DataCache.UserInfo = ent;
                LoadLocalSettings(DataCache.UserInfo);

                DataCache.CmnDict = service.GetCmn("");
                DataCache.Tbmenus = service.GetMenuByUserId(userid);

                var msg = GetExamInfo();

                if (!string.IsNullOrEmpty(msg))
                {
                    MsgBoxEx.Info(msg);
                    return;
                }

                //加载数据
                DataCache.RefreshCache();

                if (this.InvokeRequired)
                {
                    this.Invoke(new Action(() =>
                    {
                        System.Configuration.Configuration config = WR.Utils.Config.GetConfig();
                        config.AppSettings.Settings.Remove("userid");
                        config.AppSettings.Settings.Add("userid", userid);
                        config.Save();
                        WR.Utils.Config.Refresh();
                        frmMain.SetForm();
                    }));
                }
                else
                {
                    System.Configuration.Configuration config = WR.Utils.Config.GetConfig();
                    config.AppSettings.Settings.Remove("userid");
                    config.AppSettings.Settings.Add("userid", userid);
                    config.Save();
                    WR.Utils.Config.Refresh();
                    frmMain.SetForm();
                }
            }
            else
            {
                string msg = MessageConst.frm_login_msg003;
                switch (ent.IsOK)
                {
                case -99:
                    msg = MessageConst.frm_login_msg003;
                    break;

                case -1:
                    msg = MessageConst.const_msg001;
                    break;

                case -2:
                    msg = MessageConst.const_msg002;
                    break;

                case -3:
                    msg = MessageConst.const_msg003;
                    break;

                case -4:
                    msg = MessageConst.const_msg001;
                    break;

                default:
                    msg = MessageConst.const_msg001;
                    break;
                }

                if (this.InvokeRequired)
                {
                    this.Invoke(new Action(() =>
                    {
                        MsgBoxEx.Info(msg);
                        btnOK.Enabled    = true;
                        btnReset.Enabled = true;
                        lblMsg.Visible   = false;
                        txtUser.Enabled  = true;
                        txtPwd.Enabled   = true;
                        txtPwd.Focus();
                    }));
                }
                else
                {
                    MsgBoxEx.Info(msg);
                    btnOK.Enabled    = true;
                    btnReset.Enabled = true;
                    lblMsg.Visible   = false;
                    txtUser.Enabled  = true;
                    txtPwd.Enabled   = true;
                    txtPwd.Focus();
                }
            }
        }
Beispiel #21
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (cbxSpec.Checked)
            {
                double totalday = (dateTo.Value - dtDate.Value).TotalDays;
                if (totalday > 365)
                {
                    dateTo.Focus();
                    MsgBoxEx.Info("Please select the time period within 365 days.");
                    return;
                }
                else if (totalday < 0)
                {
                    dtDate.Focus();
                    MsgBoxEx.Info("From date selection error.");
                    return;
                }
            }

            if (cbxInterval.Checked && nudDay.Value <= 0)
            {
                MsgBoxEx.Info("date interval is greater than 0.");
                nudDay.Focus();
                return;
            }

            System.Configuration.Configuration config = WR.Utils.Config.GetConfig();
            config.AppSettings.Settings.Remove("notdone");
            config.AppSettings.Settings.Add("notdone", (cbxNotdone.Checked ? "0" : "1"));
            config.AppSettings.Settings.Remove("theday");
            config.AppSettings.Settings.Add("theday", (cbxDay.Checked ? "0" : "1"));
            config.AppSettings.Settings.Remove("lastday");
            config.AppSettings.Settings.Add("lastday", (cbxLast.Checked ? "0" : "1"));
            config.AppSettings.Settings.Remove("specifiedday");
            config.AppSettings.Settings.Add("specifiedday", (cbxSpec.Checked ? "0" : "1"));
            config.AppSettings.Settings.Remove("framday");
            config.AppSettings.Settings.Add("framday", dtDate.Value.ToString("yyyyMMdd"));
            config.AppSettings.Settings.Remove("today");
            config.AppSettings.Settings.Add("today", dateTo.Value.ToString("yyyyMMdd"));

            //设置间隔天
            config.AppSettings.Settings.Remove("intervalDays");
            config.AppSettings.Settings.Add("intervalDays", cbxInterval.Checked ? nudDay.Value.ToString() : "0");

            config.AppSettings.Settings.Remove("duplicate_data_visible");
            config.AppSettings.Settings.Add("duplicate_data_visible", (cbxFilter.Checked ? "0" : "1"));

            config.Save();

            WR.Utils.Config.Refresh();

            string done = WR.Utils.Config.GetAppSetting("notdone");

            if (string.IsNullOrEmpty(done) || done != "1")
            {
                DataCache.UserInfo.notdone = true;
            }
            else
            {
                DataCache.UserInfo.notdone = false;
            }

            string theday = WR.Utils.Config.GetAppSetting("theday");

            if (string.IsNullOrEmpty(theday) || theday != "1")
            {
                DataCache.UserInfo.theday = true;
            }
            else
            {
                DataCache.UserInfo.theday = false;
            }

            string lastday = WR.Utils.Config.GetAppSetting("lastday");

            if (!string.IsNullOrEmpty(lastday) && lastday == "0")
            {
                DataCache.UserInfo.lastday = true;
            }
            else
            {
                DataCache.UserInfo.lastday = false;
            }

            string specifiedday = WR.Utils.Config.GetAppSetting("specifiedday");

            if (!string.IsNullOrEmpty(specifiedday) && specifiedday == "0")
            {
                DataCache.UserInfo.specifiedday = true;

                string fromday = WR.Utils.Config.GetAppSetting("framday");
                int    day     = 0;
                if (int.TryParse(fromday, out day))
                {
                    DataCache.UserInfo.fromday = day;
                }
                else
                {
                    DataCache.UserInfo.fromday = int.Parse(DateTime.Today.ToString("yyyyMMdd"));
                }

                string today = WR.Utils.Config.GetAppSetting("today");
                int    tday  = 0;
                if (int.TryParse(today, out tday))
                {
                    DataCache.UserInfo.today = tday;
                }
                else
                {
                    DataCache.UserInfo.today = int.Parse(DateTime.Today.ToString("yyyyMMdd"));
                }
            }
            else
            {
                DataCache.UserInfo.specifiedday = false;
            }

            string intervalDays = WR.Utils.Config.GetAppSetting("intervalDays");

            if (!string.IsNullOrEmpty(intervalDays))
            {
                int idays = 0;
                if (int.TryParse(intervalDays, out idays))
                {
                    DataCache.UserInfo.IntervalDays = idays;
                }
            }

            string filterdata = WR.Utils.Config.GetAppSetting("duplicate_data_visible");

            if (string.IsNullOrEmpty(filterdata) || filterdata != "1")
            {
                DataCache.UserInfo.FilterData = true;
            }
            else
            {
                DataCache.UserInfo.FilterData = false;
            }

            MsgBoxEx.Info("Save success, please refresh the data.");
        }
Beispiel #22
0
        private void DataOperation(int type)
        {
            string sdate = string.Empty;
            string edate = string.Empty;

            if (type == 0)
            {
                if (rbtASpecified.Checked == true)
                {
                    if (dtpAfrom.Value > dtpAto.Value)
                    {
                        MsgBoxEx.Info("Start time cannot be greater than end time.");
                        return;
                    }

                    sdate = dtpAfrom.Value.ToString("yyyyMMdd");
                    edate = dtpAto.Value.ToString("yyyyMMdd");
                }
                else
                {
                    sdate = DateTime.MinValue.ToString("yyyyMMdd");
                    edate = dtpAless.Value.ToString("yyyyMMdd");
                }
            }
            else if (type == 1)
            {
                if (rbtRSpecified.Checked == true)
                {
                    if (dtpRfrom.Value > dtpRto.Value)
                    {
                        MsgBoxEx.Info("Start time cannot be greater than end time.");
                        return;
                    }

                    sdate = dtpRfrom.Value.ToString("yyyyMMdd");
                    edate = dtpRto.Value.ToString("yyyyMMdd");
                }
                else
                {
                    sdate = DateTime.MinValue.ToString("yyyyMMdd");
                    edate = dtpRless.Value.ToString("yyyyMMdd");
                }
            }
            else if (type == 2)
            {
                if (rbtDSpecified.Checked == true)
                {
                    if (dtpDfrom.Value > dtpDto.Value)
                    {
                        MsgBoxEx.Info("Start time cannot be greater than end time.");
                        return;
                    }

                    sdate = dtpDfrom.Value.ToString("yyyyMMdd");
                    edate = dtpDto.Value.ToString("yyyyMMdd");
                }
                else
                {
                    sdate = DateTime.MinValue.ToString("yyyyMMdd");
                    edate = dtpDless.Value.ToString("yyyyMMdd");
                }
            }

            try
            {
                ShowLoading(ToopEnum.loading);

                IwrService service = wrService.GetService();

                var msg = service.DataArchive(sdate, edate, type.ToString());

                MsgBoxEx.Info(msg);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //3020
                IsysService service = sysService.GetService();

                var list = service.GetCmn("3020");

                if (list[0].CODE == "1")
                {
                    list[0].CODE = "0";

                    service.UpdateDict(list);
                }

                CloseLoading();
            }
        }
Beispiel #23
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim().Length < 1)
            {
                txtName.Focus();
                MsgBoxEx.Info("Please input name");
                return;
            }

            int tdays = (int)(dtDate.Value - DateTime.Now.Date).TotalDays;

            if (tdays < 0)
            {
                dtDate.Focus();
                MsgBoxEx.Info("From date selection error.");
                return;
            }

            tdays = (int)(dtEndTime.Value - dtStartTime.Value).TotalMinutes;

            if (tdays <= 0)
            {
                dtEndTime.Focus();
                MsgBoxEx.Info("From date selection error.");
                return;
            }

            if (nudUser.Value <= 0)
            {
                nudUser.Focus();
                MsgBoxEx.Info("Number selection error.");
                return;
            }

            if (nudDefect.Value <= 0)
            {
                nudDefect.Focus();
                MsgBoxEx.Info("Defect Number selection error.");
                return;
            }

            IwrService service = wrService.GetService();
            var        res     = 0;

            var startTime = string.Format("{0} {1}:00", dtDate.Value.ToString("yyyy-MM-dd"), dtStartTime.Value.ToString("HH:mm"));
            var endTime   = string.Format("{0} {1}:00", dtDate.Value.ToString("yyyy-MM-dd"), dtEndTime.Value.ToString("HH:mm"));

            if (IsAdd)
            {
                res = service.AddPlan(LID, txtName.Text.Trim(), startTime, endTime, (int)nudUser.Value, (int)nudDefect.Value, txtRemark.Text, DataCache.UserInfo.ID);
            }
            else
            {
                res = service.UpdatePlan(emPlan.PID, txtName.Text.Trim(), startTime, endTime, (int)nudUser.Value, (int)nudDefect.Value, txtRemark.Text, DataCache.UserInfo.ID);
            }

            //if (res != 1)
            //{
            //    MsgBoxEx.Info(res.ToString());
            //    return;
            //}
            if (res == -1)
            {
                MsgBoxEx.Info("Name already exist");
                return;
            }
            else if (res != 1)
            {
                MsgBoxEx.Info("Save failed");
                return;
            }

            DialogResult = DialogResult.OK;
        }
Beispiel #24
0
        //合并SINF文件
        private void btnMerge_Click(object sender, EventArgs e)
        {
            try
            {
                if (clbSinfs.CheckedItems.Count < 2)
                {
                    MsgBoxEx.Info("Please select the merged file.");
                    return;
                }

                //权限判断
                if (clbSinfs.CheckedItems.Count > 2)
                {
                    var hasMerge = DataCache.Tbmenus.Count(s => s.MENUCODE == "40002") > 0;

                    if (!hasMerge)
                    {
                        MsgBoxEx.Info("Up to two files can be merged.");
                        return;
                    }
                }

                List <SINFModel> sinfList = new List <SINFModel>();
                int count = 0;

                for (int i = 0; i < clbSinfs.CheckedItems.Count; i++)
                {
                    var model = new SINFModel();

                    model.DieArray = File.ReadAllLines(clbSinfs.CheckedItems[i].ToString());
                    model.Path     = clbSinfs.CheckedItems[i].ToString();
                    model.Name     = model.Path.Substring(model.Path.LastIndexOf("\\") + 1);

                    if (model.DieArray.Length > 0)
                    {
                        if (!string.IsNullOrEmpty(model.DieArray[2]))
                        {
                            model.Wafer = model.DieArray[2].Split(':')[1];
                        }

                        if (!string.IsNullOrEmpty(model.DieArray[4]))
                        {
                            model.Rows = int.Parse(model.DieArray[4].Split(':')[1]);
                        }

                        if (!string.IsNullOrEmpty(model.DieArray[5]))
                        {
                            model.Cols = int.Parse(model.DieArray[5].Split(':')[1]);
                        }

                        //7,8
                        model.RefDie = string.Format("{0},{1}", model.DieArray[7].Split(':')[1], model.DieArray[8].Split(':')[1]);
                    }

                    sinfList.Add(model);
                }


                //判断wafer是否相同
                count = sinfList.Select(s => s.Wafer).Distinct().Count();

                if (count != 1)
                {
                    MsgBoxEx.Info("Wafer name is not equal.");
                    return;
                }

                //判断layout是否一致
                count = sinfList.Select(s => new { s.Wafer, s.Rows, s.Cols }).Distinct().Count();

                if (count != 1)
                {
                    MsgBoxEx.Info("The number of rows or columns is not equal.");
                    return;
                }

                //ref die
                count = sinfList.Select(s => new { s.Wafer, s.Rows, s.Cols, s.RefDie }).Distinct().Count();

                if (count != 1)
                {
                    MsgBoxEx.Info("The reference die is not equal.");
                    return;
                }

                var newSINF = new List <string>();

                //合并
                foreach (var sinf in sinfList)
                {
                    if (newSINF.Count == 0)
                    {
                        newSINF.AddRange(sinf.DieArray);
                    }
                    else
                    {
                        for (int i = 12; i < sinf.DieArray.Length; i++)
                        {
                            if (sinf.DieArray[i].Length == 0)
                            {
                                continue;
                            }

                            try
                            {
                                var newValue = MergeRow(newSINF[i], sinf.DieArray[i]);

                                if (newValue.Contains("error"))
                                {
                                    MsgBoxEx.Info(string.Format("Numbers cannot be merged with non-numbers(--,@@),In line:{0},File Name:{1}.", i + 1, sinf.Name));
                                    return;
                                }

                                newSINF[i] = newValue;
                            }
                            catch (Exception ex)
                            {
                                MsgBoxEx.Error(string.Format("{0},In line:{1},File Name:{2}", ex.Message, i + 1, sinf.Name));
                                return;
                            }
                        }
                    }
                }

                if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    File.WriteAllLines(saveFileDialog1.FileName, newSINF.ToArray());

                    MsgBoxEx.Info("Merge SINF file is complete.");
                }
            }
            catch (Exception ex)
            {
                MsgBoxEx.Error(ex.Message);
            }
        }