public void InsertFruMBVer(FruMBVerInfo item) { logger.Debug("(FRUMBVersionManager)InsertFruMBVer, [PartNo]:" + item.partNo); IEcrVersionRepository ier = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository, EcrVersion>(); try { FruMBVerInfo con = new FruMBVerInfo { partNo = item.partNo, mbCode = item.mbCode, ver = item.ver }; IList<FruMBVerInfo> lst = ier.GetFruMBVer(con); if (lst.Count > 0) { throw new FisException("Duplicate data"); } ier.InsertFruMBVer(item); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } finally { logger.Debug("(FRUMBVersionManager)InsertFruMBVer, [PartNo]:" + item.partNo); } }
public IList<FruMBVerInfo> GetFruMBVer(string partNo) { IEcrVersionRepository ipr = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository, EcrVersion>(); try { FruMBVerInfo condition = new FruMBVerInfo() { partNo = partNo }; return ipr.GetFruMBVer(condition); } catch (FisException e) { logger.Error(e.mErrmsg); throw e; } catch (Exception e) { logger.Error(e.Message); throw; } }
/// <summary> /// CheckRCTOMBECR /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string checkRCTOMBFRUMB = (string)CurrentSession.GetValue(Session.SessionKeys.CN); string FRUNO = "FRUNO"; MB currentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB); string mbSNo = this.Key; IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); IEcrVersionRepository iEcrVersionRepository = RepositoryFactory.GetInstance().GetRepository<IEcrVersionRepository>(); IMBRepository currentMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository>(); #region Check this Station if (checkRCTOMBFRUMB == "FRU") { IList<MBLog> mbLogListtemp = currentMBRepository.GetMBLog(mbSNo, CheckStation, 1); IList<MBLog> mbLogList = (from q in mbLogListtemp orderby q.Cdt descending select q).ToList<MBLog>(); if (mbLogList == null || mbLogList.Count == 0) { throw new FisException("CHK1068", new string[] { CheckStation });//沒有 1A Pass PCBLog記錄,不可FRU 出貨 } if (mbLogList[0].StationID != CheckStation && mbLogList[0].Status != 1) { throw new FisException("CHK1068", new string[] { CheckStation });//沒有 1A Pass PCBLog記錄,不可FRU 出貨 } } //if (checkRCTOMBFRUMB == "FRU" && currentMB.MBStatus.Station.ToString() != CheckStation) //{ // //FRU 出貨站點必須為%1,當前站為 %2 // throw new FisException("CHK1064", new string[] { CheckStation, currentMB.MBStatus.Station.ToString() }); //} #endregion #region Check ECR VERsion IList<EcrVersion> ecrList = iEcrVersionRepository.GetECRVersionByFamilyMBCodeAndECR(currentMB.Family, currentMB.MBCode, currentMB.ECR); if (ecrList == null || ecrList.Count == 0) { throw new FisException("CHK090", new string[] { }); //error EcrVersion is not found CHK090 } #endregion #region FruMBVer //1. if (currentMB.MBStatus.Station != CheckStation) { return base.DoExecute(executionContext); } string fruNo = iPartRepository.GetPartInfoValue(currentMB.PCBModelID, FRUNO); if (string.IsNullOrEmpty(fruNo)) { throw new FisException("CHK1058", new string[] { currentMB.PCBModelID }); //此Model:[%1],查無FRUNo } FruMBVerInfo condition = new FruMBVerInfo(); condition.partNo = fruNo; condition.mbCode = currentMB.MBCode; IList<FruMBVerInfo> fruInfoList = iEcrVersionRepository.GetFruMBVer(condition); if (fruInfoList == null || fruInfoList.Count == 0) { throw new FisException("CHK1059", new string[] { currentMB.MBCode }); //此MB:[%1],查無 FRU MB Ver } string verFirstCode = ecrList[0].IECVer.Substring(0, 1); string verEndCode = ecrList[0].IECVer.Substring(ecrList[0].IECVer.Length - 2, 2); IList<FruMBVerInfo> checkFRUMBVerList = (from q in fruInfoList where q.ver.StartsWith(verFirstCode) orderby q.ver descending select q).ToList<FruMBVerInfo>(); if (checkFRUMBVerList == null || checkFRUMBVerList.Count == 0) { throw new FisException("CHK1065", new string[] { verFirstCode }); //查無FRU MB Ver,輸入VER版本為 %1 } if (string.Compare(verEndCode, checkFRUMBVerList[0].ver.Substring(checkFRUMBVerList[0].ver.Length - 2, 2)) < 0) { throw new FisException("CHK1060", new string[] { verEndCode, checkFRUMBVerList[0].ver.Substring(checkFRUMBVerList[0].ver.Length - 2, 2) }); //Expired Version 此MB版本低於可控版本,輸入版本為 %1 ,設定版本為 %2 } #endregion return base.DoExecute(executionContext); }
protected void btnSave_ServerClick(object sender, EventArgs e) { string id = this.dOldId.Value.Trim(); FruMBVerInfo info = new FruMBVerInfo() { editor = this.HiddenUserName.Value.Trim(), partNo = this.ttPartNo.Text.Trim(), remark = this.ttRemark.Text.Trim(), ver = this.ttVer.Text.Trim(), mbCode = this.ttMBCode.Text.Trim(), cdt = DateTime.Now, udt = DateTime.Now, id = Convert.ToInt32(this.dOldId.Value.Trim()) }; try { iFRUMBVersion.UpdateFruMBVer(info); } catch (FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch (System.Exception ex) { showErrorMessage(ex.Message); return; } //根据ac acdaptor list的数据加载表格中的数据 //... initCodeTopSelect(info.partNo); showListByAssetRangeList(); updatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + -1 + "');HideWait();", true); }
protected void btnAdd_ServerClick(object sender, EventArgs e) { string id = ""; FruMBVerInfo info = new FruMBVerInfo() { editor = this.HiddenUserName.Value.Trim(), partNo = this.ttPartNo.Text.Trim(), remark = this.ttRemark.Text.Trim(), ver = this.ttVer.Text.Trim(), mbCode = this.ttMBCode.Text.Trim(), cdt = DateTime.Now, udt = DateTime.Now, }; try { iFRUMBVersion.InsertFruMBVer(info); } catch (FisException fex) { showErrorMessage(fex.mErrmsg); return; } catch (System.Exception ex) { showErrorMessage(ex.Message); return; } //按照ac adaptor list加载表格中的数据 //... initCodeTopSelect(info.partNo); showListByAssetRangeList(); this.updatePanel2.Update(); // string assemblyId = replaceSpecialChart(adaptor.assemb); ScriptManager.RegisterStartupScript(this.updatePanel, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + id + "');HideWait();", true); }