public void AddCombineKPSetting(StationCheckInfo item)
 {
     try
     {
         stationRepository.InsertStationCheckInfo(item);
     }
     catch (Exception ee)
     {
         logger.Error(ee.Message);
         throw ee;
     }
 }
 protected void btnDelete_ServerClick(object sender, EventArgs e)
 {
     try
     {
         StationCheckInfo def = new StationCheckInfo();
         //调用删除方法.
         def.id = Convert.ToInt32(this.hidhidcol.Value.Trim());
         icombineKPSetting.RemoveCombineKPSetting(def);
     }
     catch (FisException fex)
     {
         showErrorMessage(fex.mErrmsg);
         return;
     }
     catch (System.Exception ex)
     {
         showErrorMessage(ex.Message);
         return;
     }
     showList();
     this.updatePanel2.Update();
     this.CmbCheckType.setSelected(0);
     ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();DeleteComplete();HideWait();", true);
 }
    protected void btnSave_ServerClick(object sender, EventArgs e)
    {
        if ( HStation.Value == this.CmbStation.InnerDropDownList.SelectedValue.Trim()
            && HLine.Value ==  this.CmbLine.InnerDropDownList.SelectedValue.Trim()
            && HCheckType.Value == this.CmbCheckType.InnerDropDownList.SelectedValue.Trim()
            && HFamily.Value == this.TxtFamily.Text.Trim()
            && HModel.Value == this.txtModel.Text.Trim())
        {
            return;
        }
        StationCheckInfo itcnd = new StationCheckInfo();
        StationCheckInfo cond = new StationCheckInfo();
        cond.id = Convert.ToInt32(this.hidhidcol.Value.Trim());
        itcnd.line = this.CmbLine.InnerDropDownList.SelectedValue.Trim();
        itcnd.station = this.CmbStation.InnerDropDownList.SelectedValue.Trim();
        itcnd.family = this.TxtFamily.Text.Trim();
        itcnd.model = this.txtModel.Text.Trim();
        itcnd.checkItemType = this.CmbCheckType.InnerDropDownList.SelectedValue.Trim();
        itcnd.customer = "HP";
        itcnd.editor = this.HiddenUserName.Value.Trim();
        itcnd.udt = DateTime.Now;

        try
        {
            //调用添加的方法 相同的key时需要抛出异常...
            icombineKPSetting.UpdateCombineKPSetting(itcnd, cond);
        }
        catch (FisException fex)
        {
            showErrorMessage(fex.mErrmsg);
            return;
        }
        catch (System.Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        showList();
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();SaveUpdateComplete('" + this.hidhidcol.Value + "');HideWait();", true);
    }
    protected void btnAdd_ServerClick(object sender, EventArgs e)
    {

        //this.CmbCheckType.setSelected(1);
        //this.CmbStation.clearContent();


        StationCheckInfo itcnd = new StationCheckInfo();
        itcnd.line = this.CmbLine.InnerDropDownList.SelectedValue.Trim();
        itcnd.station = this.CmbStation.InnerDropDownList.SelectedValue.Trim();
        itcnd.checkItemType = this.CmbCheckType.InnerDropDownList.SelectedValue.Trim();
        itcnd.family = this.TxtFamily.Text.Trim();
        itcnd.model = this.txtModel.Text.Trim();
        itcnd.customer = "HP";
        itcnd.editor = this.HiddenUserName.Value.Trim();
        itcnd.cdt = DateTime.Now;
        itcnd.udt = DateTime.Now;
        string con =  itcnd.station + itcnd.line + itcnd.checkItemType + itcnd.editor + itcnd.cdt.ToString("yyyy-MM-dd HH:mm:ss") + itcnd.udt.ToString("yyyy-MM-dd HH:mm:ss");
        con = con.Trim();
        try
        {
            //调用添加的方法 相同的key时需要抛出异常...
            icombineKPSetting.AddCombineKPSetting(itcnd);
        }
        catch (FisException fex)
        {
            showErrorMessage(fex.mErrmsg);
            return;
        }
        catch (System.Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
        showList();
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "addUpdate", "resetTableHeight();AddUpdateComplete(\"" + con + "\");HideWait();", true);
    }
 public IList<StationCheckInfo> GetAllCombineKPSettingItems()
 {
     IList<StationCheckInfo> dataLst = new List<StationCheckInfo>();
     try
     {
         StationCheckInfo cond = new StationCheckInfo();
         dataLst = stationRepository.GetStationCheckInfoList(cond);
     }
     catch (Exception ee)
     {
         logger.Error(ee.Message);
         throw ee;
     }
     return dataLst;
 }
 public void UpdateCombineKPSetting(StationCheckInfo item, StationCheckInfo cond)
 {
     try
     {
         stationRepository.UpdateStationCheckInfo(item, cond);
     }
     catch (Exception ee)
     {
         logger.Error(ee.Message);
         throw ee;
     }
 }
Beispiel #7
0
        private IList<string> getCheckItemTypeByPriority(string customer, string station, 
                                                                                  string line, string family,
                                                                                  string model)
        {
            IList<string> checkItemTypes = null;
              
            StationCheckInfo condition = new StationCheckInfo();
            condition.customer = customer;
            condition.station = station;
            var res = SttRepository.GetStationCheckInfoList(condition);
            if (res != null && res.Count > 0)
            {

                IList<CheckItemTypePriority> priorityList = new List<CheckItemTypePriority>();
                foreach (var item in res)
                {
                    //Line+Model
                    if (string.IsNullOrEmpty(item.family) &&
                        !string.IsNullOrEmpty(item.line) &&
                       (new Regex(item.line)).IsMatch(line) &&
                        !string.IsNullOrEmpty(item.model) &&
                        (new Regex(item.model)).IsMatch(model))
                    {
                        priorityList.Add(new CheckItemTypePriority() { Priority = 0, CheckItemType = item.checkItemType });
                        continue;
                    }
                    //Line+Family
                    if (string.IsNullOrEmpty(item.model) &&
                         !string.IsNullOrEmpty(item.line) &&
                        (new Regex(item.line)).IsMatch(line) &&
                        !string.IsNullOrEmpty(item.family) &&
                        (new Regex(item.family)).IsMatch(family))
                    {
                        priorityList.Add(new CheckItemTypePriority() { Priority = 1, CheckItemType = item.checkItemType });
                        continue;
                    }

                    //Model
                    if (string.IsNullOrEmpty(item.line) &&
                        string.IsNullOrEmpty(item.family) &&
                        !string.IsNullOrEmpty(item.model) &&
                        (new Regex(item.model)).IsMatch(model))
                    {
                        priorityList.Add(new CheckItemTypePriority() { Priority = 2, CheckItemType = item.checkItemType });
                        continue;
                    }

                    //Family
                    if (string.IsNullOrEmpty(item.line) &&
                         string.IsNullOrEmpty(item.model) &&
                        !string.IsNullOrEmpty(item.family) &&
                        (new Regex(item.family)).IsMatch(family))
                    {
                        priorityList.Add(new CheckItemTypePriority() { Priority = 3, CheckItemType = item.checkItemType });
                        continue;
                    }

                    //Line
                    if (!string.IsNullOrEmpty(item.line)
                        && (new Regex(item.line)).IsMatch(line)
                        && string.IsNullOrEmpty(item.family)
                        && string.IsNullOrEmpty(item.model))
                    {
                        priorityList.Add(new CheckItemTypePriority() { Priority = 4, CheckItemType = item.checkItemType });
                        continue;
                    }

                    //Line,Family,Model are all empty
                    if (string.IsNullOrEmpty(item.line)
                        && string.IsNullOrEmpty(item.family)
                        && string.IsNullOrEmpty(item.model))
                    {
                        priorityList.Add(new CheckItemTypePriority() { Priority = 5, CheckItemType = item.checkItemType });
                    }
                }

                //Vincent add Check Station/CheckItemType
                //Mantis 2499: StationCheck 檢查邏輯處理全部都不符合情況
                if (priorityList.Count > 0)
                {
                    int priority = priorityList.Min(x => x.Priority);

                    checkItemTypes = (from p in priorityList
                                      where p.Priority == priority
                                      select p.CheckItemType
                                                 ).Distinct().ToList();
                }
            }
            return checkItemTypes;
        }