コード例 #1
0
ファイル: 070Unpack.cs プロジェクト: wra222/testgit
        ///<summary>
        /// 根据指定的DeliveryNo解除绑定
        /// 使用工作流070UnpackDNByDN.xoml
        /// </summary>
        public void UnpackDNByDN(string deliveryNo, bool bSuperUI, string line, string editor, string station, string customer)
        {
            if (bSuperUI)
            {
                logger.Debug("(UnpackDNByDN[Super])Unpack start, deliveryNo:" + deliveryNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
            else
            {
                logger.Debug("(UnpackDNByDN)Unpack start, deliveryNo:" + deliveryNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            }

            FisException ex;
            List<string> erpara = new List<string>();



            try
            {
                var currentDelivery = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, IMES.FisObject.PAK.DN.Delivery>().Find(deliveryNo);
                
                if (null == currentDelivery)
                {
                    throw new FisException("CHK190", new string[] { deliveryNo });//DN不存在
                }

                if (!bSuperUI && "98" == currentDelivery.Status)
                {
                    throw new FisException("CHK191", new string[] { deliveryNo });//DN已上传
                }

                string sessionKey = currentDelivery.DeliveryNo;


                station = "80";

                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);
           
                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, ProductSessionType, editor, station, line, customer);


                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", ProductSessionType);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackDNByDN.xoml", "UnpackDNByDN.rules", wfArguments);

                    currentSession.AddValue(Session.SessionKeys.DeliveryNo, currentDelivery.DeliveryNo);
                    currentSession.AddValue(Session.SessionKeys.Delivery, currentDelivery);

                    //Add by Benson for Mantis 0001555
                    string isSuper = "";
                    if (bSuperUI)
                    {
                        isSuper = "Y";
                        CommonImpl cmi = new CommonImpl();
                        IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("SAP", "Name").Where(x => x.value.Trim() != "").ToList(); ;
                        string isExcuteDeleteSAPsn = "";
                        string allowUnpackCode = "";
                        foreach (ConstValueInfo constV in lstConst)
                        {
                            if (constV.name == "ExcuteDeleteSNonSAP")
                            {
                                isExcuteDeleteSAPsn = constV.value;
                            }
                            if (constV.name == "AllowUnpackCode")
                            {
                                allowUnpackCode = constV.value;
                            }
                        }
                        string plant = System.Configuration.ConfigurationManager.AppSettings["PlantCode"];
                        currentSession.AddValue("IsSuper", isSuper);
                        currentSession.AddValue("ExcuteDeleteSNonSAP", isExcuteDeleteSAPsn);
                        currentSession.AddValue("AllowUnpackCode", allowUnpackCode);
                        currentSession.AddValue("PlantCode", plant);
                        currentSession.AddValue("DNStatus", currentDelivery.Status);
                         
                    }
                    //Add by Benson


                    
                    
                    currentSession.SetInstance(instance);




                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK192", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK193", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                if (bSuperUI)
                {
                    logger.Debug("(UnpackDNByDN[Super])Unpack end,  deliveryNo:" + deliveryNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
                }
                else
                {
                    logger.Debug("(UnpackDNByDN)Unpack end,  deliveryNo:" + deliveryNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
                }
            }
        }
コード例 #2
0
ファイル: 070Unpack.cs プロジェクト: wra222/testgit
        ///<summary>
        /// 根据指定的Custom Sn解除绑定
        /// 使用工作流070UnpackDNBySN.xoml
        /// </summary>
        public void UnpackDNbySNCheck(string prodSn, string pdline, string editor, string station, string customer)
        {
            logger.Debug("(UnpackDNbySNCheck)UnpackDNbySNCheck start, prodSn:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer);

            string currentSessionKey = prodSn;
            try
            {
               


                /*if (station == "91")
                {
                    station = "9U";
                }
                else
                {
                    station = "9P";
                }*/
                //Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, ProductSessionType);
                Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, ProductSessionType);


                if (currentCommonSession == null)
                {
                    //currentCommonSession = new Session(currentSessionKey, Session.SessionType.Common, editor, station, pdline, customer);
                    currentCommonSession = new Session(currentSessionKey, ProductSessionType, editor, station, pdline, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", currentSessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentCommonSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdline);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("070UnpackDNBySN.xoml", "", wfArguments);

                    currentCommonSession.AddValue(Session.SessionKeys.CN, "DN");
                    currentCommonSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentCommonSession.SetInstance(instance);
                    //Add for Call SAP service
                

                    CommonImpl cmi = new CommonImpl();
                    IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("SAP", "Name");
                    string isExcuteDeleteSAPsn = "";
                    string allowUnpackCode = "";
                    foreach (ConstValueInfo constV in lstConst)
                    {
                        if (constV.name == "ExcuteDeleteSNonSAP")
                        {
                            isExcuteDeleteSAPsn = constV.value;
                        }
                        if (constV.name == "AllowUnpackCode")
                        {
                            allowUnpackCode = constV.value;
                        }
                    }
                    string plant = System.Configuration.ConfigurationManager.AppSettings["PlantCode"];
                
                    currentCommonSession.AddValue("ExcuteDeleteSNonSAP", isExcuteDeleteSAPsn);
                    currentCommonSession.AddValue("AllowUnpackCode", allowUnpackCode);
                    currentCommonSession.AddValue("PlantCode", plant);
                   

                    //Add for Call SAP service



                    if (!SessionManager.GetInstance.AddSession(currentCommonSession))
                    {
                        currentCommonSession.WorkflowInstance.Terminate("Session:" + currentSessionKey + " Exists.");
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(currentSessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentCommonSession.WorkflowInstance.Start();
                    currentCommonSession.SetHostWaitOne();
                }
                else
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(currentSessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }

                if (currentCommonSession.Exception != null)
                {
                    if (currentCommonSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentCommonSession.ResumeWorkFlow();
                    }

                    throw currentCommonSession.Exception;
                }
            /*    
                Product newProduct = (Product)currentCommonSession.GetValue(Session.SessionKeys.Product);
                if (newProduct.PalletNo == null)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add("此机器尚未结合栈板,不能进行Unpack!");
                    ex = new FisException("CHK292", erpara);
                    throw ex;
                }
                currentCommonSession.AddValue(Session.SessionKeys.DeliveryNo, newProduct.DeliveryNo);
                */
               

                return ;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(UnpackDNbySN)UnpackDNbySNCheck end,  cartonNo:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
        }
コード例 #3
0
ファイル: PodLabelCheck.cs プロジェクト: wra222/testgit
        public ArrayList InputCustSnForCQ(string custsn, string pdLine, string editor, string station, string customer)
        {
            logger.Debug("(PodLabelCheckImpl)InputCustSnForCQ start, custsn:" + custsn + "pdLine:" + pdLine + "editor:" + editor + "station:" + station + "customer:" + customer);
            FisException ex;
            List<string> erpara = new List<string>();
            ArrayList retArr = new ArrayList();
            string label = "";
            try
            {
               
                var currentProduct = CommonImpl.GetProductByInput(custsn, CommonImpl.InputTypeEnum.CustSN);
                string sessionKey = currentProduct.ProId;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);
                CommonImpl2 cm2 = new CommonImpl2();
                label = cm2.CheckPodLabel(custsn);
                if (label == "")
                { label = cm2.CheckConfigLabel(custsn); }
                 if (string.IsNullOrEmpty(label))
                 {
                     throw new FisException("SFC013", new string[] { });
                 }

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, Session.SessionType.Product, editor, station, pdLine, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdLine);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "PodLabelCheck.xoml", "PodLabelCheck.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);
                    currentSession.AddValue(Session.SessionKeys.CustSN, custsn);
                    currentSession.AddValue(Session.SessionKeys.Product, currentProduct);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }
                CommonImpl cmi = new CommonImpl();
                IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("PODModel", "Name").Where(y => y.value != "").ToList();
                string countryCode = currentProduct.Model.Substring(9, 2);
                var s = lstConst.Where(x => x.name == countryCode).Select(x => x.value).ToList();
                IList<string> codeLst = null;
                List<string> modelLst = new List<string>();

                if (s.Count > 0)
                {
                    string code = s[0];
                    codeLst = code.Split('~').Where(x=>x.Trim()!="").ToList();
                    foreach (string m in codeLst)
                    { modelLst.Add(currentProduct.Model+m.Trim()); }
                }
                string NoNeedScanMAC = "";
                IList<ConstValueTypeInfo> typeinfo = cmi.GetConstValueTypeListByType("ConfigNoCheckMAC").ToList();
                if (typeinfo.Where(x => x.value == currentProduct.Family).Any())
                {
                    NoNeedScanMAC = "NoNeed";
                }
                   
             
          
                currentSession.AddValue(Session.SessionKeys.ifElseBranch, label);
                retArr.Add(currentProduct.ProId);
                retArr.Add(currentProduct.Model);
                retArr.Add(label);
                retArr.Add(modelLst);
                retArr.Add(NoNeedScanMAC);//0001583: 86站POD Label check修改
                return retArr;
            }
            catch (FisException e)
            {
                //logger.Error(e.mErrmsg, e);
                //throw new Exception(e.mErrmsg);
                logger.Error(e.mErrmsg, e);
                if (e.mErrcode == "CHK020") //序號已被刷入
                {
                    throw e;
                }
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PodLabelCheckImpl)InputCustSnForCQ end, custsn:" + custsn + "pdLine:" + pdLine + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
        
        
        
        }
コード例 #4
0
ファイル: PalletVerify.cs プロジェクト: wra222/testgit
 private bool CheckPODLabel(IMES.FisObject.FA.Product.IProduct product)
 {
    // string qc=product.GetAttributeValue("PAQC_QCStatus");
     //if (qc == null ) { return true; }
     bool IsOK = true;
     CommonImpl cmi = new CommonImpl();
     IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("CTO Check", "Name").Where(x => x.value.Trim() != "").ToList(); 
     if (lstConst.Count==0)
     {
         throw new FisException("PAK181", new string[]{"CTO Check"});   
       
     }
     if (lstConst[0].name == "CheckStation")
         {
             string[] stArr = lstConst[0].value.Split(',');
             return stArr.Contains(product.Status.StationId);
         }
    return IsOK;
  
         //if (lstConst.(product.Status.StationId) > -1)
         //{ IsOK = true; }
    
 }
コード例 #5
0
ファイル: CommonImpl.cs プロジェクト: wra222/testgit
 /// <summary>
 /// GetInstance
 /// </summary>
 /// <returns></returns>
 public static CommonImpl GetInstance()
 {
     if (_Instance == null)
     {
         _Instance = new CommonImpl();
     }
     return _Instance;
 }
コード例 #6
0
ファイル: PodLabelCheck.cs プロジェクト: wra222/testgit
        string IPodLabelCheck.InputCustPnOnPodLabel(string productIdValue, string custSnOnCooValue, string custPnOnPodValue, string pdLine, string editor, string station, string customer, out string Loc)
        {
            logger.Debug("(PodLabelCheckImpl)Save start, productIdValue:" + productIdValue + "custSnOnCooValue:" + custSnOnCooValue + "custPnOnPodValue" + custPnOnPodValue + "pdLine" + pdLine + "editor:" + editor + "station:" + station + "customer" + customer);
            string ret = "";
            Loc = "";
            FisException ex;
            List<string> erpara = new List<string>();
            string sessionKey = "";
            try
            {
                var currentProduct = CommonImpl.GetProductByInput(productIdValue, CommonImpl.InputTypeEnum.ProductIDOrCustSN);
                CommonImpl cmloc = new CommonImpl();
                IList<ConstValueInfo> lstloc = cmloc.GetConstValueListByType("TabletPODCheckLoc", "Name");
                var list = (from x in lstloc where x.name ==currentProduct.Model  select x.value).ToList();
                if (list != null && list.Count > 0)
                {
                    Loc = list[0];
                }
                      
                
                sessionKey = productIdValue;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);

                
                if (currentSession == null)
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK021", erpara);
                    throw ex;

                }

               else
                {
                    if (custSnOnCooValue == "")
                    {
                        currentSession.AddValue(Session.SessionKeys.IsComplete, true);
                        currentSession.Exception = null;
                        currentSession.SwitchToWorkFlow();

                        if (currentSession.Exception != null)
                        {
                            if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                            {
                                currentSession.ResumeWorkFlow();
                            }
                            throw currentSession.Exception;
                        }
                    }
                    else
                    {
                        bool check = false;
                        IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                        IList<ConstValueTypeInfo> familyList = iPartRepository.GetConstValueTypeList("CheckWMFamilyInPOD");
                        if (familyList != null && familyList.Count > 0 && Regex.IsMatch(currentProduct.Family, familyList[0].value))
                        {
                            string pf = currentProduct.ProductInfoes.Where(x => x.InfoType == "WM").Select(x => x.InfoValue).FirstOrDefault();
                            if (!string.IsNullOrEmpty(pf) && custSnOnCooValue.Replace(":", "").Trim() == pf.Replace(":", "").Trim())
                            {
                                ret = "mac";
                                check = true;
                            }
                        }
                        else if (custSnOnCooValue == currentProduct.MAC)
                        {
                            ret = "mac";
                            check = true;
                        }
                        if (check == false)
                        {
                            // IMES_FA..Product_Part 表中与当前Product 绑定的Parts 
                            IList<IProductPart> productParts = new List<IProductPart>();
                            productParts = currentProduct.ProductParts;
                            if (productParts == null || productParts.Count <= 0)
                            {
                                //List<string> errpara = new List<string>();
                                //errpara.Add(productIdValue);
                                //throw new FisException("PAK038", errpara);  //该Product尚未绑定Part!
                            }
                            else
                            {
                                foreach (ProductPart iprodpart in productParts)
                                {
                                    if (iprodpart.BomNodeType == "AT")
                                    {
                                        IPart curPart = ipartRepository.GetPartByPartNo(iprodpart.PartID);
                                        if (curPart.BOMNodeType == "AT")
                                        {
                                            if (custSnOnCooValue == iprodpart.PartSn)
                                            {
                                                ret = "tag";
                                                check = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (check == false)
                        {
                            //throw new FisException("CHK888", new string[] { });
                            return "checkwrong";
                        }
                        currentSession.AddValue(Session.SessionKeys.IsComplete, true);
                        currentSession.Exception = null;
                        currentSession.SwitchToWorkFlow();

                        if (currentSession.Exception != null)
                        {
                            if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                            {
                                currentSession.ResumeWorkFlow();
                            }
                            throw currentSession.Exception;
                        }
                    }

                }
                return ret;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PodLabelCheckImpl)Save end,productIdValue:" + productIdValue + "custSnOnCooValue:" + custSnOnCooValue + "custPnOnPodValue" + custPnOnPodValue + "pdLine" + pdLine + "editor:" + editor + "station:" + station + "customer" + customer);
                /*Session sessionDelete = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product); ;
                if (sessionDelete != null)
                {
                    SessionManager.GetInstance.RemoveSession(sessionDelete);
                }*/
            }
        }
コード例 #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ArrayList InputMBSN(string mbsn, bool isGetDn, string shipMode, string line, string editor, string station, string customer)
        {
            logger.Debug("(CombineCartonDNfor146MB)Inputmbsn start, shipMode:" + shipMode + " mbsn:" + mbsn + " line:" + line + " editor:" + editor + " station:" + station + " customer:" + customer);
            List<string> errpara = new List<string>();
            ArrayList retList = new ArrayList();
            string usedModel = "";
            
            try
            {
                bool shipModeIs146 = "RCTO".Equals(shipMode);
                bool shipModeIsFru = "FRU".Equals(shipMode);
                
                IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
                IMB mb = mbRepository.Find(mbsn);
                if (mb == null || mb.MBStatus == null)
                {
                    throw new FisException("SFC001", new string[] { mbsn });
                }

                if (!shipMode.Equals(mb.ShipMode))
                {
                    // 此MBSN:%1 非 %2 板子
                    throw new FisException("CQCHK0038", new string[] { mbsn, shipMode });
                }
                
                string mbcode = mbsn.Substring(0, 2);

                if (!(string.IsNullOrEmpty(mb.CartonSN) && string.IsNullOrEmpty(mb.DeliveryNo)))
                {
                    // PCB的 CartonSN & DeliveryNo 須為空
                    throw new FisException("CQCHK0022", new string[] { });
                }

                IList<string> lstUsedModel = new List<string>();

                if (shipModeIs146)
                {
                    //string strSQL = "select Model from ModelInfo where Name='Infor' and Value=@MBCode";
                     string strSQL =@"select distinct a.Material as Model from ModelBOM a, PartInfo b 
                                    where a.Component = b.PartNo and b.InfoType='MB' and a.Material like'146%' 
                                    and b.InfoValue =@MBCode";
                    SqlParameter paraName = new SqlParameter("@MBCode", SqlDbType.VarChar, 10);
                    paraName.Direction = ParameterDirection.Input;
                    paraName.Value = mbcode;
                    DataTable tb = SqlHelper.ExecuteDataFill(SqlHelper.ConnectionString_GetData, System.Data.CommandType.Text,
                        strSQL, paraName);
                    if (tb != null)
                    {
                        foreach (DataRow dr in tb.Rows)
                        {
                            string s = dr["Model"].ToString();
                            if (s.IndexOf("146") == 0)
                            {
                                lstUsedModel.Add(s);
                            }
                        }
                    }
                    if (lstUsedModel.Count == 0)
                    {
                        // MBCode帶出的Model 不是146XXXXXX機型
                        throw new FisException("CQCHK0041", new string[] { });
                    }

                    string biosConstType = "RCTOMBBIOSVer";
                    CommonImpl cmi = new CommonImpl();
                    IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType(biosConstType, "Name").Where(x => x.value.Trim() != "" && x.name == mbcode).ToList();
       
                    if (lstConst == null || lstConst.Count == 0)
                    {
                        // ConstValue 未设定 %1,请联系IE设定
                        throw new FisException("CQCHK0026", new string[] { biosConstType });
                    }

                    string mbrTestLog = "";
                    foreach (IMES.FisObject.Common.TestLog.TestLog tl in mb.TestLogs)
                    {
                        if ("MBR".Equals(tl.Type))
                        {
                            mbrTestLog = tl.Remark;
                            break;
                        }
                    }

                    if (mbrTestLog.IndexOf(lstConst[0].value) < 0)
                    {
                        // BIOS 匹配不對
                        throw new FisException("CQCHK0023", new string[] { });
                    }

                    bool isMatchMBCT = false;
                    foreach (IMES.FisObject.PCA.MB.MBInfo mbi in mb.MBInfos)
                    {
                        if ("MBCT".Equals(mbi.InfoType))
                        {
                            if (mbrTestLog.IndexOf(mbi.InfoValue) >= 0)
                            {
                                isMatchMBCT = true;
                            }
                            break;
                        }
                    }
                    if (!isMatchMBCT)
                    {
                        // MBCT 不相同
                        throw new FisException("CQCHK0024", new string[] { });
                    }
                }
                else if (shipModeIsFru)
                {
                    bool isFru = false;
                    string strSQL = @"select distinct a.Material as Model from ModelBOM a, PartInfo b 
where a.Component = b.PartNo and b.InfoType='MB' and a.Material not like 'PC%' 
and b.InfoValue =@MBCode";

                    SqlParameter paraName = new SqlParameter("@MBCode", SqlDbType.VarChar, 10);
                    paraName.Direction = ParameterDirection.Input;
                    paraName.Value = mbcode;
                    DataTable tb = SqlHelper.ExecuteDataFill(SqlHelper.ConnectionString_GetData, System.Data.CommandType.Text,
                        strSQL, paraName);
                    if (tb != null)
                    {
                        foreach (DataRow dr in tb.Rows)
                        {
                            //usedModel = dr["Model"].ToString();
                            lstUsedModel.Add(dr["Model"].ToString());
                            isFru = true;
                       }
                    }
                    if (!isFru)
                    {
                        throw new FisException("CQCHK0038", new string[] { mbsn, shipMode });
                    }

                }
                
                // 检查Process卡站
				CommonImpl.GetInstance().CheckProductBlockStation((MB)mb, line, editor, station, customer);

                IList<string> deliveryNos = new List<string>();
                IList<string> shipDatesOfDn = new List<string>();
                IList<string> modelsOfDn = new List<string>();
                IList<string> qtysOfDn = new List<string>();
                IList<string> shipwayOfDn = new List<string>();

                IList<string> lstMbsn = new List<string>();

				if (isGetDn)
                {
                    foreach (string m in lstUsedModel)
                    {
                        GetDeliveryNoList(m, line, editor, station, customer, ref deliveryNos, ref shipDatesOfDn, ref modelsOfDn, ref qtysOfDn, ref shipwayOfDn);
                    }
					
					if (deliveryNos == null || deliveryNos.Count == 0)
					{
						// DN %1 不存在!
						throw new FisException("CHK190", new string[] { "" });
					}

                    if (shipModeIsFru)
                    {
                        // 此機型下的所有MBCode清單
                        foreach (string m in lstUsedModel)
                        {
                            string strSQL = @"SELECT c.InfoValue as MBCode
FROM dbo.ModelBOM a, 
     Part b,
     PartInfo c 
WHERE a.Material=@Model and 
      a.Component = b.PartNo and
      b.PartNo =c.PartNo and
      b.Flag=1 and
      c.InfoType ='MB' and
      b.BomNodeType='MB'";
                            SqlParameter paraName = new SqlParameter("@Model", SqlDbType.VarChar, 255);
                            paraName.Direction = ParameterDirection.Input;
                            paraName.Value = m;
                            DataTable tb = SqlHelper.ExecuteDataFill(SqlHelper.ConnectionString_GetData, System.Data.CommandType.Text,
                                strSQL, paraName);
                            if (tb != null)
                            {
                                foreach (DataRow dr in tb.Rows)
                                {
                                    if (!lstMbsn.Contains(dr["MBCode"].ToString()))
                                        lstMbsn.Add(dr["MBCode"].ToString());
                                }
                            }
                        }
                    }
                }

                retList.Add(mbsn);
                retList.Add(""); // usedModel
                retList.Add(deliveryNos);
                retList.Add(shipDatesOfDn);
                retList.Add(modelsOfDn);
                retList.Add(qtysOfDn);
                retList.Add(lstMbsn);
                retList.Add(shipwayOfDn);
                return retList;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(CombineCartonDNfor146MB)Inputmbsn end, shipMode:" + shipMode + " mbsn:" + mbsn + " line:" + line + " editor:" + editor + " station:" + station + " customer:" + customer);
            }
        }
コード例 #8
0
ファイル: ESOPandAoiKbTest.cs プロジェクト: wra222/testgit
 private string GetAOI_Addr(string line)
 {
     //    各線別的AOI機台IP 請抓取 ConstValue Type='AOIServerIP' and Name='LineAlias' 
     CommonImpl cmi = new CommonImpl();
     IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("AOIServerIP", "Name").Where(y => y.name == line).ToList();
     return lstConst.Count == 0 ? "" : lstConst[0].value.Trim();
 }
コード例 #9
0
ファイル: CombineCartonInDN.cs プロジェクト: wra222/testgit
        public  ArrayList RePrintCartonLabel(string sn, string editor, string station,string customer, string reason,IList<PrintItem> printItems)
        {
            logger.Debug("(CombineCartonInDN)RePrintCartonLabel Start,Key:" + sn);
            List<string> erpara = new List<string>();
            ArrayList retLst = new ArrayList();
             FisException ex;
            try
            {
                CommonImpl cmi = new CommonImpl();
                IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("CTO Check", "Name").Where(x => x.value.Trim() != "").ToList(); 
                string line = "";
                string custsn = "";
                string dn = "";
                string flag = "";
                string descr = "";
                IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IFAPrd.IProduct>();
                IDeliveryRepository deliveryRepository = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
                ICartonRepository cartonRep = RepositoryFactory.GetInstance().GetRepository<ICartonRepository, Carton>();
                Carton objCarton=cartonRep.Find(sn);
                 if (objCarton == null)
                {
                    objCarton = cartonRep.GetCartonByBoxId(sn);
                    if (objCarton == null) // input = CUSTSN
                    {
                        IFAPrd.IProduct objPrd = productRep.GetProductByCustomSn(sn);
                        custsn = sn;
                        if (objPrd != null)
                        {
                            objCarton = cartonRep.Find(objPrd.CartonSN);
                        }

                    }

                }
           
                if (objCarton == null)
                {
                    throw new FisException("PAK084", new string[] { });
                }
                if (custsn == "")
                {
                    IList<CartonProduct> lstCartonPrd = objCarton.CartonProducts;
                    if (lstCartonPrd != null && lstCartonPrd.Count > 0)
                    {
                        string prdId = lstCartonPrd[0].ProductID;
                        IFAPrd.IProduct objPrd = productRep.Find(prdId);
                        line = objPrd.Status.Line.Substring(0, 1);
                        custsn = objPrd.CUSTSN;
                        dn = objPrd.DeliveryNo;
                     }
                }
                else
                {
                    IFAPrd.IProduct objPrd = productRep.GetProductByCustomSn(custsn);
                    line = objPrd.Status.Line.Substring(0, 1);
                    dn = objPrd.DeliveryNo;
                }
                Delivery dnObj = deliveryRepository.Find(dn);
                if (dnObj == null)
                { throw new FisException("CHK190", new string[] { dn }); }
                flag = (string)dnObj.GetExtendedProperty("Flag");
            
                //IList<CartonInfo> lstCartonInfo=objCarton.CartonInfos;
                //if (lstCartonInfo != null && lstCartonInfo.Count > 0)
                //{
                //    var infoList = (from p in lstCartonInfo
                //                    where p.InfoType == "PdfFileName"
                //                    select p.InfoValue).ToList();
                //    if (infoList .Count>0)
                //    {
                //        pdfFileName = infoList[0].ToString();
                //    }
                //}
                
             
         
                //Start Workflow
                string sessionKey = custsn;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, Session.SessionType.Product);
                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, Session.SessionType.Product, editor, station, "", customer);
                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", "");
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    currentSession.AddValue(Session.SessionKeys.DeliveryNo,dn);
                    currentSession.AddValue(Session.SessionKeys.Reason, reason);
                    currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentSession.AddValue(Session.SessionKeys.PrintLogName, "Carton Label");
                    currentSession.AddValue(Session.SessionKeys.PrintLogBegNo, sn);
                    currentSession.AddValue(Session.SessionKeys.PrintLogEndNo, sn);
                    currentSession.AddValue(Session.SessionKeys.PrintLogDescr, descr);        
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "ReprintCartonLabel.xoml", "", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }
                     currentSession.WorkflowInstance.Start();
                     currentSession.SetHostWaitOne();
                 }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }
                string templatename = "";
                if (flag == "N")
                {
                    IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
                    IList<string> docnumList = repPizza.GetDocSetNumListFromPakDashPakComnByLikeInternalID(dn.Substring(0, 10));
                    //SELECT @templatename = XSL_TEMPLATE_NAME 	FROM [PAK.PAKRT] WHERE DOC_CAT = @doctpye AND DOC_SET_NUMBER = @doc_set_number
                    if (docnumList.Count > 0)
                    {
                        IList<string> tempList = repPizza.GetXslTemplateNameListFromPakDashPakComnByDocCatAndDocSetNumer("Box Ship Label", docnumList[0]);
                        if (tempList.Count > 0)
                            templatename = tempList[0];
                    }
                
                }
             
                retLst.Add(custsn);
                retLst.Add(dn);
                retLst.Add(objCarton.CartonSN);
                retLst.Add(templatename);
                retLst.Add(line);
                retLst.Add(flag);
                retLst.Add((IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems));
                return retLst;
                           
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(CombineCartonInDN)RePrintCartonLabel end, key:" + sn);
            }
        }
コード例 #10
0
ファイル: 030IMAGEOutput.cs プロジェクト: wra222/testgit
        public ArrayList GetProdidLineVersion(string custsn, string editor, string stationId, string customerId)
        {
            string prodId = "";
            string version = "";
            try
            {
                    CommonImpl cmm = new CommonImpl();
                    IMES.FisObject.FA.Product.IProduct iProduct = CommonImpl.GetProductByInput(custsn, CommonImpl.InputTypeEnum.CustSN);
             
                    List<string> erpara = new List<string>();
                    prodId = iProduct.ProId;
                    // Add by Benson --For Get Pass code & Fail Code //IMPasscode/IMFailcode
                    string model = iProduct.Model;
                    IModelRepository myRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                    Model ModelObj = myRepository.Find(model);
                    string passcode = ModelObj.GetAttribute("IMPasscode");
                    string failcode = ModelObj.GetAttribute("IMFailcode");
                    if (string.IsNullOrEmpty(passcode) || string.IsNullOrEmpty(failcode))
                    {
                        erpara.Add(custsn);
                        throw new FisException("CHK179", erpara);
                    }

                    if (string.IsNullOrEmpty(prodId))
                    {
                        erpara.Add(custsn);
                        throw new FisException("SFC011", erpara);
                    }
                    IMES.DataModel.ProductStatusInfo prsinfo;
                    try
                    {
                        prsinfo = cmm.GetProductStatusInfo(prodId);
                    }
                    catch
                    {
                        logger.Error("No Product Status Data");
                        throw new Exception("No Product Status Data");

                    }
                    string pdLine = prsinfo.pdLine;
                    if (string.IsNullOrEmpty(pdLine))
                    {
                        erpara.Add(custsn);
                        throw new FisException("SFC011", erpara);
                    }
                    ILineRepository iline = RepositoryFactory.GetInstance().GetRepository<ILineRepository, Line>();
                    Line line = iline.Find(pdLine);
                    version = GetVersion(iProduct);
                    if (version == "")
                    {
                        erpara.Add(iProduct.Model);
                        throw new FisException("CHK167", erpara);
                    }

                    ArrayList retArray = new ArrayList();
                    retArray.Add(prodId);
                    retArray.Add(pdLine);
                    retArray.Add(line.Descr);
                    retArray.Add(version);
                    retArray.Add(passcode);
                    retArray.Add(failcode);
                     return retArray;
                // reList[0] : prodid    reList[1] : pdLine   reList[2] : line.Descr    reList[3] : version 
                   
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(_BoardInput)Save end, prodId:" + prodId);
            }
       
        }
コード例 #11
0
ファイル: AoiOfflineKbCheck.cs プロジェクト: wra222/testgit
        /// <summary>
        /// 输入Product Id相关信息并处理
        /// </summary>
        /// <param name="pdLine">Pd Line</param>
        /// <param name="custsn">Cust sn</param>
        /// <param name="editor">Editor</param>
        /// <param name="stationId">Station</param>
        /// <param name="customer">Customer</param>
        /// <returns>prestation</returns>
        public ArrayList InputCustSn(string pdLine, string custsn, string editor, string stationId, string customer)
        {
            logger.Debug("(AoiOfflineKbCheck)InputCustSn start, [pdLine]:" + pdLine
                + " [custsn]: " + custsn
                + " [editor]:" + editor
                + " [station]:" + stationId
                + " [customer]:" + customer);
            FisException ex;
            List<string> erpara = new List<string>();
            string sessionKey = custsn;

            try
            {
                Session session = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);

                if (session == null)
                {
                    session = new Session(sessionKey, ProductSessionType, editor, stationId, pdLine, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    //一个MB_SNo对应一个workflow
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", stationId);
                    wfArguments.Add("CurrentFlowSession", session);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdLine);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", ProductSessionType);

                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(stationId, "AoiOfflineKbCheck.xoml", "AoiOfflineKbCheck.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    session.AddValue(Session.SessionKeys.IsComplete, false);
                    session.AddValue(Session.SessionKeys.CustSN, sessionKey);
                    session.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(session))
                    {
                        session.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    session.WorkflowInstance.Start();
                    session.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }

                //check workflow exception
                if (session.Exception != null)
                {
                    if (session.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        session.ResumeWorkFlow();
                    }

                    throw session.Exception;
                }
                IProduct product = (IProduct)session.GetValue(Session.SessionKeys.Product);
                ArrayList arr = new ArrayList();
                arr.Add(product.ProId);
                arr.Add(product.Model);
                CommonImpl cmm = new CommonImpl();
                IList<DefectInfo> defectList  =cmm.GetDefectList("PRD");
                arr.Add(defectList);
                return arr;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(AoiOfflineKbCheck)InputCustSn end, [pdLine]:" + pdLine
                    + " [custsn]: " + custsn
                    + " [editor]:" + editor
                    + " [station]:" + stationId
                    + " [customer]:" + customer);
            }
        }
コード例 #12
0
 public void CheckCrSn(string sn,string line, string editor, string customer,string materialType,string station,string model)
 {
         IProductRepository iProductRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>();
         IProduct product = iProductRepository.GetProductByCustomSn(sn);
         if (product == null)
         {
             FisException fe = new FisException("CHK079", new string[] { sn });
             throw fe;
         }
         if (product.Model != model)
         { throw new FisException("The model of this product does not match input model!"); }
         CheckMaSn(sn,station);
         CommonImpl cmm = new CommonImpl();
         if (materialType == "146LCM")
         { cmm.CheckProductBlockStation((Product)product, line, editor, station, customer); }
         else
         { cmm.CheckProductBlockStation((Product)product, line, editor, "CR32", customer); }
    }
コード例 #13
0
        public void CheckPAQC(IProduct p)
        {
            CommonImpl cmi = new CommonImpl();
            bool noneedcheck = false;
            IList<ConstValueTypeInfo> lstConst = cmi.GetConstValueTypeListByType("RCTOCombinePOInCartonNoCheckQC");
            if (lstConst != null && lstConst.Count > 0)
            {
                noneedcheck = lstConst.Where(x => !string.IsNullOrEmpty(x.value) && (x.value == p.Model || x.value == p.Family)).Any(); 
            }
            if (noneedcheck)//维护机型或者Family不检查qcstatus
            {
                return;
            }
            IList<ProductQCStatus> qcsStatus = p.QCStatus;
            if (qcsStatus != null && qcsStatus.Count>0)
            {
                ProductQCStatus PQ = qcsStatus.Where(x => x.Type == "PAQC").OrderByDescending(y => y.Udt).First();
                if (PQ != null)
                {
                    switch (PQ.Status)
                    {
                        case "":
                            throw new FisException("PAK014", new string[] { });
                        case "8":
                            throw new FisException("PAK014", new string[] { });
                        case "B":
                            throw new FisException("PAK014", new string[] { });
                        case "C":
                            throw new FisException("PAK014", new string[] { });
                        case "A":
                            throw new FisException("PAK015", new string[] { });
                        case "9":
                            
                        default:
                            break;
                    }

                }
                else
                {
                    List<string> erpara = new List<string>();
                    erpara.Add(p.ProductID);
                    erpara.Add("PAQC");
                   throw new FisException("PAK051", erpara);    //QCStatus 中Product%1 的参数 %2 不存在!
                   
                }
            }
          
        }
コード例 #14
0
ファイル: PalletVerifyFDEOnly.cs プロジェクト: wra222/testgit
 private void GetAndCheckOA3Setting(string Model, out string url, out string user, out string password, out bool bNoNeedCheckEOA)
 {
     CommonImpl cmmn1 = new CommonImpl();
     IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
     if (cmmn1.CheckModelByProcReg(Model, "ThinClient"))
     {
         IList<string> lstUrl = partRepository.GetValueFromSysSettingByName("TCOA3URL");
         IList<string> lstUser = partRepository.GetValueFromSysSettingByName("TCOA3User");
         IList<string> lstPwd = partRepository.GetValueFromSysSettingByName("TCOA3Password");
         url = lstUrl.Count == 0 ? "" : lstUrl[0];
         user = lstUser.Count == 0 ? "" : lstUser[0];
         password = lstPwd.Count == 0 ? "" : lstPwd[0];
         bNoNeedCheckEOA = partRepository.GetValueFromSysSettingByName("DisableOA3CheckOnPalletForTC").Any(x => x == "Y");
         if ("" == url || "" == user || "" == password)
         { throw new FisException("Wrong ThinClientOA3 setting"); }
     }
     else
     {
         IList<string> lstUrl = partRepository.GetValueFromSysSettingByName("OA3URL");
         IList<string> lstUser = partRepository.GetValueFromSysSettingByName("OA3User");
         IList<string> lstPwd = partRepository.GetValueFromSysSettingByName("OA3Password");
         url = lstUrl.Count == 0 ? "" : lstUrl[0];
         user = lstUser.Count == 0 ? "" : lstUser[0];
         password = lstPwd.Count == 0 ? "" : lstPwd[0];
         bNoNeedCheckEOA = partRepository.GetValueFromSysSettingByName("DisableOA3CheckOnPallet").Any(x => x == "Y");
         if ("" == url || "" == user || "" == password)
         { throw new FisException("Wrong OA3 setting"); }
     }
 }
コード例 #15
0
        public void CheckFRUMBOA3(string mbsn,string usedmodel)
        {
            CommonImpl cmi = new CommonImpl();
            IList<ConstValueTypeInfo> lstConst = cmi.GetConstValueTypeListByType("RMAOA3CheckModel");
            bool needcheckoa3 = lstConst.Where(x => x.value == usedmodel).Any();
            if (needcheckoa3)
            {
                IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
                IMB mb = mbRepository.Find(mbsn);
                if (mb == null )
                {
                    throw new FisException("SFC001", new string[] { mbsn });
                }
                string mbct = (string)mb.GetExtendedProperty("MBCT");
                if (string.IsNullOrEmpty(mbct))
                {
                    throw new FisException("ICT024");
                }

                string strSQL = @"IF EXISTS(SELECT 1 from RMA_OA3Data where CT=@CT)
                                                         SELECT 1
                                                        ELSE
                                                         SELECT 0 ";
                SqlParameter sqlPara = new SqlParameter("@CT", SqlDbType.VarChar, 32);
                sqlPara.Direction = ParameterDirection.Input;
                sqlPara.Value = mbct;
                object data = SqlHelper.ExecuteScalar(SqlHelper.ConnectionString_GetData, System.Data.CommandType.Text, strSQL, sqlPara);
                if ((int)data == 0)
                {
                    throw new FisException("CQCHK50118", new string[] { mbct });
                }



               
            }

        }
コード例 #16
0
ファイル: PizzaKitting.cs プロジェクト: wra222/testgit
        public List<string> UploadSnForSorting(List<string> snList,string station,string editor,string line,string customer)
        {
            string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            logger.DebugFormat("BEGIN: {0}(snList:{1},station:{2},editor:{3},line:{4},customer:{5})", 
                                                        methodName,string.Join(",",snList.ToArray()),station,editor,line,customer);
            try
            {
                List<string> rst = new List<string>();
                IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                string preStation = "";
                int success = 0;
                int fail = 0;
                CommonImpl com = new CommonImpl();
                List<string> failMsg = new List<string>();
                List<IMES.FisObject.FA.Product.IProduct> prdList = new List<IMES.FisObject.FA.Product.IProduct>();
                IList<IMES.DataModel.ConstValueTypeInfo> lstConst = partRep.GetConstValueTypeList("AllowSortingStation");

                foreach (string sn in snList)
                {
                    IMES.FisObject.FA.Product.IProduct product = productRepository.GetProductByIdOrSn(sn);
                    if (product == null)
                    { throw new FisException(sn + " is not correct ProductID or CustomerSN!!"); }
                    if (!lstConst.Any(x => x.value.Equals(product.Status.StationId)))
                    {
                        throw new FisException(sn + " has to do pizzakitting before sorting!!");
                    }
                    prdList.Add(product);

                }


                // foreach (string sn in snList)
                foreach (IMES.FisObject.FA.Product.IProduct prdObj in prdList)
                {
                    try
                    {
                        //    IProduct product = productRepository.GetProductByIdOrSn(sn);
                        if (prdObj != null)
                        {
                            ForceNWCInfo cond = new ForceNWCInfo();
                            cond.productID = prdObj.ProId;
                            preStation = prdObj.Status.StationId;
                            if (partRep.CheckExistForceNWC(cond))
                            {
                                partRep.UpdateForceNWCByProductID(station, preStation, prdObj.ProId);
                            }
                            else
                            {
                                ForceNWCInfo newinfo = new ForceNWCInfo();
                                newinfo.editor = editor;
                                newinfo.forceNWC = station;
                                newinfo.preStation = preStation;
                                newinfo.productID = prdObj.ProId;
                                partRep.InsertForceNWC(newinfo);

                            }
                            success++;
                        }
                        else
                        {
                            rst.Add(prdObj.CUSTSN + " Fail: Product not exist");
                            fail++;
                        }
                    }
                    catch (Exception e)
                    {
                        failMsg.Add(prdObj.CUSTSN + " error:" + e.Message);
                    }
                }
                rst.AddRange(failMsg.ToArray());


                rst.Insert(0, "Success: " + success.ToString() + " sn");
                if (fail > 0)
                { rst.Insert(1, "Fail: " + fail.ToString() + " sn"); }

                return rst;  

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.DebugFormat("END: {0}()", methodName);
            }
                
        }
コード例 #17
0
ファイル: UnpackDNByCarton.cs プロジェクト: wra222/testgit
        public void Unpack(string proid, string line, string editor, string station, string customer)
        {

            logger.Debug("(UnpackDNByCarton)Unpack start, ProdID:" + proid + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            FisException ex;
            List<string> erpara = new List<string>();
            try
            {
                string sessionKey = proid;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);
                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, ProductSessionType, editor, station, line, customer);


                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", ProductSessionType);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackDNByCarton.xoml", "UnpackDNByCarton.rules", wfArguments);

                    // ********** Add by Benson at 2013/10/09
                    CommonImpl cmi = new CommonImpl();
                    IList<ConstValueInfo> lstConst = cmi.GetConstValueListByType("SAP", "Name").Where(x => x.value.Trim() != "").ToList(); ;
                    string isExcuteDeleteSAPsn = "";
                    string allowUnpackCode = "";
                    foreach (ConstValueInfo constV in lstConst)
                    {
                        if (constV.name == "ExcuteDeleteSNonSAP")
                        {
                            isExcuteDeleteSAPsn = constV.value;
                        }
                        if (constV.name == "AllowUnpackCode")
                        {
                            allowUnpackCode = constV.value;
                        }
                    }
                    string plant = System.Configuration.ConfigurationManager.AppSettings["PlantCode"];
                    currentSession.AddValue("ExcuteDeleteSNonSAP", isExcuteDeleteSAPsn);
                    currentSession.AddValue("AllowUnpackCode", allowUnpackCode);
                    currentSession.AddValue("PlantCode", plant);
                    // ********** Add by Benson at 2013/10/09

                    
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK192", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK193", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }

                    throw currentSession.Exception;
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(UnpackAllByDN)Unpack end, ProdID:" + proid + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
        }