/// <summary> /// /// </summary> /// <returns></returns> public IList<MBCodeDef> getAllUniteMB() { List<MBCodeDef> result = new List<MBCodeDef>(); try { IList<MBCode> getData = MBrepository.GetAllUniteMB(); if (getData != null && getData.Count > 0) { foreach (MBCode mbc in getData) { MBCodeDef mbcDef = new MBCodeDef(); mbcDef = convertToMbCodeDef(mbc); result.Add(mbcDef); } } else { return null; } } catch (Exception) { throw; } return result; }
/// <summary> /// a. 生成 MBSno, b. Insert [PCB], c. Insert [PCBStatus] d. Insert [PCBLog] ,e. Update [PCBStatus] ,f. Insert [PCBLog] ,g. Insert [PCBLog] /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { FisException ex; List<string> erpara = new List<string>(); string mbsno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN).ToString(); IMBRepository imbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); if ((bool)CurrentSession.GetValue(Session.SessionKeys.IsCheckPass)) { //MBCodeDef mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2)); MBCodeDef mbcode = new MBCodeDef(); if (mbsno.Substring(5, 1) == "M") mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 3)); else mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2)); if (mbcode == null) { erpara.Add(mbsno); ex = new FisException("PAK080", erpara); //没有找到MBSno %1 对应的PCB! throw ex; } int unitQty = mbcode.Qty; if (unitQty<=0) { erpara.Add(mbsno); ex = new FisException("PAK081", erpara); // MBCode数据维护不全! throw ex; } // a. 生成 MBSno:a. 生成@unitqty[@i=1..@unitqty]个MBSno, @NewMBSno = left([刷入的MBSno],5) + @i + right([刷入的MBSno],4) string PCBModelID=(string)CurrentSession.GetValue(Session.SessionKeys.PCBModelID); string newMBSno = string.Empty; var MBObjectList = new List<IMB>(); CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList); var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB); IList<string> newMBSnoList = new List<string>(); for (int i = 1; i <= unitQty; i++) { newMBSno = mbsno.Substring(0, 5) + i.ToString() + mbsno.Substring(mbsno.Length - 4, 4); //b. Insert [PCB], PCBModelID = [Model]: //c. Insert [PCBStatus] For Every New MB, Status=’1’ Station=’09’: string moNo = CurrentMB.SMTMO; string custSn = ""; string model = CurrentMB.Model; string dateCode = CurrentMB.DateCode; string mac = ""; string uuid = ""; string ecr = ""; string iecVer = ""; string custVer = ""; string cvsn = ""; MB mb = new MB(newMBSno, moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(newMBSno, this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; imbRepository.Add(mb, CurrentSession.UnitOfWork); MBObjectList.Add(mb); newMBSnoList.Add(newMBSno); } //d. Insert [PCBLog] For Every New MB, Status=’1’,Station=’09’: 调 WriteMBLog, 成批加入 CurrentSession.AddValue(Session.SessionKeys.MBList, MBObjectList); //e. Update [PCBStatus] For Old MB, Status =2,Station = ‘CL’ --Close : 调 UpdateMBStatus //f. Insert [PCBLog] For Old MB, Status =2,Station = ‘CL’ –Close : 调 WriteMBLog, 单条加入 // g. Insert [IMES_GetData..PrintLog]: CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "MB"); CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, MBObjectList[0].Sn); CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, MBObjectList[MBObjectList.Count-1].Sn); CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, this.Line +" "+ PCBModelID); CurrentSession.AddValue(Session.SessionKeys.MBSNOList, newMBSnoList); } else { erpara.Add(mbsno); ex = new FisException("CHK161", erpara); //MB号:%1错误! throw ex; } // CurrentSession.AddValue(Session.SessionKeys. return base.DoExecute(executionContext); }
/// <summary> /// 检查MB是不是连板的子板,且已经做了先切后测(MBCode.Type=1)的设置 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { string mbsno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN).ToString(); IMBRepository imbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); CurrentSession.AddValue(Session.SessionKeys.IsCheckPass, false); string number = "0123456789"; string bit = mbsno.Substring(5, 1); if (mbsno.Substring(5, 1) == "M") { bit = mbsno.Substring(6, 1); } if (!number.Contains(bit)) //MBSno第6位不是数字 { //MBCodeDef mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2)); MBCodeDef mbcode = new MBCodeDef(); if (mbsno.Substring(5, 1) == "M") mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 3)); else mbcode = imbRepository.GetMBCode(mbsno.Substring(0, 2)); if (mbcode == null) { List<string> errpara = new List<string>(); errpara.Add(mbsno); FisException ex = new FisException("PAK080", errpara); //没有找到MBSno %1 对应的PCB! throw ex; } string type = mbcode.Type; //IMES2012_GetData..MBCode if (type == "1") //先切后测 { CurrentSession.AddValue(Session.SessionKeys.IsCheckPass, true); } else if (type == "0") { FisException fe = new FisException("PAK078", new string[] { }); //该MB需先去做ICT测试,刷ICT Input! throw fe; } else { FisException fe = new FisException("PAK081", new string[] { }); //MBCode数据维护不全! throw fe; } CurrentSession.AddValue(Session.SessionKeys.MultiQty, mbcode.Qty); if (mbcode.Qty <= 1) { CurrentSession.AddValue(Session.SessionKeys.PrintLogName, "MB"); CurrentSession.AddValue(Session.SessionKeys.PrintLogBegNo, mbsno); CurrentSession.AddValue(Session.SessionKeys.PrintLogEndNo, mbsno); string model = CurrentSession.GetValue(Session.SessionKeys.PCBModelID) as string; CurrentSession.AddValue(Session.SessionKeys.PrintLogDescr, this.Line+" " + model); IList<string> newMBSnoList = new List<string>(); newMBSnoList.Add(mbsno); CurrentSession.AddValue(Session.SessionKeys.MBSNOList, newMBSnoList); } } else { List<string> errpara = new List<string>(); errpara.Add(mbsno); FisException ex = new FisException("CHK161", errpara); //MB号:%1错误! throw ex; } return base.DoExecute(executionContext); }
public MBCode convertToMBcode(MBCodeDef mbcDef) { MBCode mbc = new MBCode(mbcDef.MBCode, mbcDef.Description, (short)mbcDef.Qty, mbcDef.editor, mbcDef.cdt, mbcDef.udt, mbcDef.Type); return mbc; }
public MBCodeDef convertToMbCodeDef(MBCode mbc) { MBCodeDef mbcDef = new MBCodeDef(); mbcDef.MBCode = mbc.MbCode; mbcDef.Description = mbc.Description; mbcDef.Type = mbc.Type; mbcDef.Qty = (int)mbc.MultQty; mbcDef.editor = mbc.Editor; mbcDef.cdt = mbc.Cdt; mbcDef.udt = mbc.Udt; return mbcDef; }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <param name="MBCode"></param> public void updateUniteMB(MBCodeDef obj, string MBCode) { IList<MBCode> mbcLst = MBrepository.GetLstByMB(MBCode); MBCode mbc = new MBCode(); MBCode mbcUpdate = new MBCode(); try { if (mbcLst != null && mbcLst.Count > 0) { mbc = mbcLst.First(); obj.cdt = mbc.Cdt; mbcUpdate = convertToMBcode(obj); } if (!MBCode.Equals(obj.MBCode)) { IList<MBCode> lstMBC = MBrepository.GetLstByMB(obj.MBCode); if (lstMBC != null && lstMBC.Count > 0) { //已经存在具有相同MBCode的MBCode记录 List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT120", erpara); throw ex; } else { MBrepository.UpdateUniteMB(mbcUpdate, MBCode); } } else { MBrepository.UpdateUniteMB(mbcUpdate,MBCode); } } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="obj"></param> public void addUniteMB(MBCodeDef obj) { try { IList<MBCode> mbLst = MBrepository.GetLstByMB(obj.MBCode); if (mbLst.Count > 0) { //已经存在具有相同MBCode的MBCode记录 List<string> erpara = new List<string>(); FisException ex; ex = new FisException("DMT120", erpara); throw ex; } else { MBCode mbc = convertToMBcode(obj); MBrepository.AddUniteMB(mbc); } } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// 删除一条数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_ServerClick(Object sender, EventArgs e) { MBCodeDef mbcDef = new MBCodeDef(); string mbcode = this.hidMBcode.Value; try { uniteMB.deleteUniteMB(mbcode); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } ShowUniteMBList(); this.UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();", true); }
/// <summary> /// 添加数据方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_serverClick(Object sender, EventArgs e) { MBCodeDef mbcDef = new MBCodeDef(); string mbCode = this.dMB.Text.Trim().ToUpper(); string qty = this.dQty.Text; string desc = this.dRemark.Text; string type = this.drpType.SelectedIndex.ToString(); mbcDef.MBCode = mbCode; mbcDef.Description = desc; mbcDef.Type = type; mbcDef.Qty = Convert.ToInt32(qty); mbcDef.editor = this.HiddenUsername.Value; mbcDef.cdt = DateTime.Now; mbcDef.udt = DateTime.Now; try { uniteMB.addUniteMB(mbcDef); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { //show error showErrorMessage(ex.Message); return; } ShowUniteMBList(); this.UpdatePanel2.Update(); mbCode = replaceSpecialChart(mbCode); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + mbCode + "');", true); }
/// <summary> /// 删除一条数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_ServerClick(Object sender, EventArgs e) { MBCodeDef mbcDef = new MBCodeDef(); string code = this.hidCode.Value; string dType = this.hidType.Value; bool type = false; if (dType == "Image") { type = true; } string family = this.hidFamily.Value; try { iTestMb.deleteMB_Test(code, family, type); } catch (FisException ex) { showErrorMessage(ex.mErrmsg); return; } catch (Exception ex) { showErrorMessage(ex.Message); return; } ShowMBTestCodeList(); this.UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "deleteComplete", "DeleteComplete();", true); }