Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var mb = CurrentSession.GetValue(Session.SessionKeys.MB) as IMB;

            //若该MB的PCBStatus.Status=0,则报错:“MBSN:XXX已经存在不良,请去修护区修护”
            if (mb.MBStatus.Status == MBStatusEnum.Fail)
            {
                List<string> errpara = new List<string>();
                errpara.Add(mb.Sn);
                throw new FisException("CHK905", errpara);
            }

            //若该MB存在PCBRepair.Status=0的记录,则报错:“请先Key出修护的MB,再刷画面”
            IList<Repair> repairs = new List<Repair>();
            repairs = mb.Repairs;
            foreach (Repair temp in repairs)
            {
                if (temp.Status == Repair.RepairStatus.NotFinished)
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK907", errpara);
                }
            }


            //若该MB的PCBStatus.Station 非(15或者16或者17或者31A或者31或者30),则报错:“MBSN:XXX不该出现在Q区”
            if (!(mb.MBStatus.Station == "15" || mb.MBStatus.Station == "16"
                || mb.MBStatus.Station == "17" || mb.MBStatus.Station == "31A"
                || mb.MBStatus.Station == "31" || mb.MBStatus.Station == "30"))
            {
                List<string> errpara = new List<string>();
                errpara.Add(mb.Sn);
                throw new FisException("CHK906", errpara);
            }


            var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();

            //[Station] = PCBStatus.Station + ‘  ’ + Station.Descr
            IList<string> stationLst = new List<string>();
            stationLst = mbRepository.GetStationListFromPcbStatus(mb.Sn);
            if (stationLst != null && stationLst.Count > 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.StationDescr, stationLst[0]);
            }
            else
            {
                CurrentSession.AddValue(Session.SessionKeys.StationDescr, "");
            }

            //[LotNo] = Top 1 PCBLot.LotNo where PCBNo=@MBSn and Status=1 order by Cdt desc
            IList<PcblotInfo> lots = new List<PcblotInfo>();
            PcblotInfo cond = new PcblotInfo();
            cond.pcbno = mb.Sn;
            cond.status = "1";
            lots = mbRepository.GetPcblotInfoList(cond);
            if (lots != null && lots.Count > 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.LotNo, lots[0].lotNo);
            }
            else
            {
                CurrentSession.AddValue(Session.SessionKeys.LotNo, "");
            }


            //[PdLine]=PCBStatus.Line + ‘  ’ +Line.Descr
            IList<string> lineLst = new List<string>();
            lineLst = mbRepository.GetLineListFromPcbStatus(mb.Sn);
            if (lineLst != null && lineLst.Count > 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.LineCode, lineLst[0]);
            }
            else
            {
                CurrentSession.AddValue(Session.SessionKeys.LineCode, "");
            }

            //若PCBOQCRepair中存在(Status=0 and PCBNo=@MBSN order by Cdt desc),获取Top 1数据,显示如下:
            IList<PcboqcrepairInfo> repairLst = new List<PcboqcrepairInfo>();
            PcboqcrepairInfo cond1 = new PcboqcrepairInfo();
            cond1.status = "0";
            cond1.pcbno = mb.Sn;
            repairLst = mbRepository.GetPcboqcrepairInfoListOrderByCdtDesc(cond1);
            if (repairLst != null && repairLst.Count > 0)
            {
                CurrentSession.AddValue(Session.SessionKeys.Remark, repairLst[0].remark);
                CurrentSession.AddValue(Session.SessionKeys.RepairDefectID, repairLst[0].id);

                //获取如下数据,显示在Defect List
                //Select * from PCBOQCRepair_DefectInfo where PCBOQCRepairID = @PCBOQCRepairID order by Cdt 
                IList<Pcboqcrepair_DefectinfoInfo> infoLst = new List<Pcboqcrepair_DefectinfoInfo>();
                Pcboqcrepair_DefectinfoInfo cond2 = new Pcboqcrepair_DefectinfoInfo();
                cond2.pcboqcrepairid = repairLst[0].id;
                infoLst = mbRepository.GetPcboqcrepairDefectinfoInfoList(cond2);


                IDefectRepository defectRepository = RepositoryFactory.GetInstance().GetRepository<IDefectRepository, Defect>();
                IList<string> defectLst = new List<string>();
                IList<string> descLst = new List<string>();
                foreach (Pcboqcrepair_DefectinfoInfo temp in infoLst)
                {
                    defectLst.Add(temp.defect);
                    IList<DefectCodeInfo> defectcodeLst = new List<DefectCodeInfo>();
                    DefectCodeInfo cond3 = new DefectCodeInfo();
                    cond3.Defect = temp.defect;
                    defectcodeLst = defectRepository.GetDefectCodeInfoList(cond3);
                    if (defectcodeLst != null && defectcodeLst.Count > 0)
                    {
                        descLst.Add(defectcodeLst[0].Descr);
                    }
                    else
                    {
                        descLst.Add("");
                    }
                }
                CurrentSession.AddValue("DefectLst", defectLst);
                CurrentSession.AddValue("DescLst", descLst);
            }
            else
            {
                IList<string> defectLst = new List<string>();
                IList<string> descLst = new List<string>();
                CurrentSession.AddValue(Session.SessionKeys.Remark, "");
                CurrentSession.AddValue(Session.SessionKeys.RepairDefectID, -1);
                CurrentSession.AddValue("DefectLst", defectLst);
                CurrentSession.AddValue("DescLst", descLst);
            }


            return base.DoExecute(executionContext);
        }
        public ArrayList Query()
        {
            logger.Debug("(PCAOQCCosmetic)Query start");
            ArrayList retValue = new ArrayList();
            try
            {
                var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
                IList<PcboqcrepairInfo> list = new List<PcboqcrepairInfo>();

                //参考方法:Select * from PCBOQCRepair where Status=0 order by Cdt
                PcboqcrepairInfo cond = new PcboqcrepairInfo();
                cond.status = "0";
                list = mbRepository.GetPcboqcrepairInfoList(cond);

                IList<string> lotNoLst = new List<string>();
                IList<string> pcbNoLst = new List<string>();
                IList<string> editorLst = new List<string>();
                IList<string> cdtLst = new List<string>();

                foreach (PcboqcrepairInfo temp in list)
                {
                    lotNoLst.Add(temp.lotNo);
                    pcbNoLst.Add(temp.pcbno);
                    editorLst.Add(temp.editor);
                    cdtLst.Add(temp.cdt.ToString());
                }

                retValue.Add(lotNoLst);
                retValue.Add(pcbNoLst);
                retValue.Add(editorLst);
                retValue.Add(cdtLst);

                return retValue;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(PCAOQCCosmetic)Query end");
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var mb = CurrentSession.GetValue(Session.SessionKeys.MB) as IMB;
            var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            int RepairID = 0;

            IList<PcboqcrepairInfo> repairLst = new List<PcboqcrepairInfo>();
            PcboqcrepairInfo cond1 = new PcboqcrepairInfo();
            cond1.status = "0";
            cond1.pcbno = mb.Sn;
            repairLst = mbRepository.GetPcboqcrepairInfoListOrderByCdtDesc(cond1);
            if (repairLst != null && repairLst.Count > 0)
            {
                PcboqcrepairInfo cond = new PcboqcrepairInfo();
                PcboqcrepairInfo setValue = new PcboqcrepairInfo();
                cond.id = repairLst[0].id;

                setValue.pcbno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN);
                setValue.lotNo = (string)CurrentSession.GetValue(Session.SessionKeys.LotNo);
                setValue.station = mb.MBStatus.Station;
                setValue.remark = (string)CurrentSession.GetValue(Session.SessionKeys.Remark);
                setValue.status = (string)CurrentSession.GetValue(Session.SessionKeys.VCode);
                setValue.editor = this.Editor;
                setValue.udt = DateTime.Now;

                mbRepository.UpdatePcboqcrepairInfo(setValue, cond);
                RepairID = repairLst[0].id;
            }
            else
            {
                PcboqcrepairInfo item = new PcboqcrepairInfo();
                item.pcbno = (string)CurrentSession.GetValue(Session.SessionKeys.MBSN);
                item.lotNo = (string)CurrentSession.GetValue(Session.SessionKeys.LotNo);
                item.station = mb.MBStatus.Station;
                item.remark = (string)CurrentSession.GetValue(Session.SessionKeys.Remark);
                item.status = (string)CurrentSession.GetValue(Session.SessionKeys.VCode);
                item.cdt = item.udt = DateTime.Now;
                item.editor = this.Editor;

                mbRepository.InsertPcboqcrepairInfo(item);
                RepairID = item.id;
            }




            Pcboqcrepair_DefectinfoInfo cond2 = new Pcboqcrepair_DefectinfoInfo();
            cond2.pcboqcrepairid = RepairID;

            IList<Pcboqcrepair_DefectinfoInfo> infoLst = new List<Pcboqcrepair_DefectinfoInfo>();
            infoLst = mbRepository.GetPcboqcrepairDefectinfoInfoList(cond2);
            if (infoLst != null && infoLst.Count > 0)
            {
                mbRepository.DeletePcboqcrepairDefectinfo(cond2);
            }


            IList<string> defectLst = (IList<string>)CurrentSession.GetValue(Session.SessionKeys.DefectList);
            foreach (string temp in defectLst)
            {
                Pcboqcrepair_DefectinfoInfo it = new Pcboqcrepair_DefectinfoInfo();
                it.defect = temp;
                it.cdt = DateTime.Now;
                it.editor = this.Editor;
                it.status = (string)CurrentSession.GetValue(Session.SessionKeys.VCode);
                it.pcboqcrepairid = RepairID;

                mbRepository.InsertPcboqcrepairDefectinfo(it);
            }

            return base.DoExecute(executionContext);
        }