Example #1
0
        public IList<ConstValueInfo> GetGotoStationList(string Type)
        {
            try
            {
                IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                ConstValueInfo condition = new ConstValueInfo();
                condition.type = Type;
                IList<ConstValueInfo> list = iPartRepository.GetConstValueInfoList(condition);
                //List<ConstValueInfo> list = new List<ConstValueInfo>();
                //foreach (ConstValueInfo items in aa)
                //{

                //    string[] valuelist = items.value.Split(new char[] { ',', '~', ';' });
                //    foreach (string str in valuelist)
                //    {
                //        ConstValueInfo item = new ConstValueInfo();
                //        item.value = str;
                //        list.Add(item);
                //    }
                    
                //}
                return list;
            }
            catch (Exception)
            {
                throw;
            }
        }
 public IList<ConstValueInfo> GetProductionCauseList()
 {
     logger.Debug("(ActualProductionTimeManager) GetProductionCauseList begins.");
     try
     {
         IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
         ConstValueInfo cond = new ConstValueInfo();
         cond.type = "SMTCauseTable";
         return partRep.GetConstValueInfoList(cond);
     }
     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("(ActualProductionTimeManager) GetProductionCauseList ends.");
     }
 }
Example #3
0
 public IList<ConstValueInfo> GetMOTypeList(string Type)
 {
     try
     {
         IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
         ConstValueInfo condition = new ConstValueInfo();
         condition.type = Type;
         return iPartRepository.GetConstValueInfoList(condition);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #4
0
        private IList<ProductPart> GetNowParts(IProduct currentProduct, string keyConstType)
        {
            IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();

            List<ProductPart> nowParts = new List<ProductPart>();
            List<string> errpara = new List<string>();
            IList<ConstValueInfo> cvInfo = new List<ConstValueInfo>();

            ConstValueInfo cvCond = new ConstValueInfo();
            cvCond.type = keyConstType;
            cvCond.name = currentProduct.Model;
            cvInfo = partRepository.GetConstValueInfoList(cvCond);

            if (cvInfo == null || cvInfo.Count == 0)
            {
                cvCond = new ConstValueInfo();
                cvCond.type = keyConstType;
                cvCond.name = currentProduct.Family;
                cvInfo = partRepository.GetConstValueInfoList(cvCond);
            }
            if (cvInfo == null || cvInfo.Count == 0)
            {
                //throw new FisException("CHK1026", errpara); // 此机器没有要解的料
				return nowParts;
            }

            ConstValueInfo tmp = cvInfo[0];
            string[] wantRemovePartTypes = tmp.value.Split(',');
            foreach (string wantRemovePartType in wantRemovePartTypes)
            {
                ProductPart cond = new ProductPart();
                cond.ProductID = currentProduct.ProId;
                cond.CheckItemType = wantRemovePartType;
                IList<ProductPart> list = productRepository.GetProductPartList(cond);
                //if (list == null || list.Count == 0)
                //{
                //    errpara.Add(wantRemovePartType);
                //    throw new FisException("CHK1027", errpara); // 该机器没有结合@KP,不能过此站
                //}
                if (list != null)
                    nowParts.AddRange(list);
            }
            return nowParts;
        }
Example #5
0
        /*
        public const String MACRANGE_STATUS_R = "R";
        public const String MACRANGE_STATUS_R_TEXT = "Created";
        public const String MACRANGE_STATUS_A = "A";
        public const String MACRANGE_STATUS_A_TEXT = "Active";
        public const String MACRANGE_STATUS_C = "C";
        public const String MACRANGE_STATUS_C_TEXT = "Closed";
        */

        #region Implementation of IConstValueMaintain


        /// <summary>
        /// 取得所有ConstValue数据的list(按Type栏位排序)
        /// </summary>
        /// <returns></returns>
        public IList<ConstValueInfo> GetConstValueTypeList()
        {
            try
            {
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                ConstValueInfo temp = new ConstValueInfo();
                temp.type = "SYS";
                ConstValueInfo temp2 = new ConstValueInfo();
                temp2.name = "";
                IList<ConstValueInfo> retLst = itemRepository.GetConstValueListByType(temp, temp2);

                return retLst;
            }
            catch (Exception)
            {
                throw;
            } 
        }
Example #6
0
        /// <summary>
        /// CheckPrdIDorSNList
        /// </summary>
        /// <param name="snorproidlist"></param>
        /// <param name="sDismantleType"></param>
        /// <param name="sKeyparts"></param>
        /// <param name="sReturnStation"></param>
        /// <param name="line"></param>
        /// <param name="pCode"></param>
        /// <param name="editor"></param>
        /// <param name="station"></param>
        /// <param name="customer"></param>
        /// <returns></returns>
        public string CheckPrdIDorSNList(IList<string> snorproidlist, string sDismantleType, string sKeyparts, string sReturnStation, string line, string pCode, string editor, string station, string customer)
        {
            logger.Debug("(DismantleFA)CheckPrdIDorSNList start,"
                       + " [line]:" + line
                      + " [editor]:" + editor
                      + " [station]:" + station
                      + " [customer]:" + customer);
           // FisException ex;
            List<string> erpara = new List<string>();
            int rtnValue = 0;
            string snorproid = "";
            string prddidstation = "";
            IList<ProductLog> prodLogLst = new List<ProductLog>();
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
            try
            {
                //Get ConstValue 
                //-----------------------------------------------------------------------------------
                IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                ConstValueInfo info = new ConstValueInfo();
                info.type = "FAStation";
                info.name = "FADismantleStation";
                IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);

                ConstValueInfo infoAst = new ConstValueInfo();
                infoAst.type = "FAStation";
                infoAst.name = "FAATDismantleStation";
                IList<ConstValueInfo> retListAst = partRepository.GetConstValueInfoList(infoAst);
                //-----------------------------------------------------------------------------------

                for (int i = 0; i < snorproidlist.Count; i++)
                {
                    snorproid = snorproidlist[i];
                    rtnValue = rtnValue + 1;
                    var currentProduct = CommonImpl.GetProductByInput(snorproid, CommonImpl.InputTypeEnum.ProductIDOrCustSN);
                    ProductStatusInfo productStatus = productRepository.GetProductStatusInfo(currentProduct.ProId);
                    /*
                    if ((productStatus.station == station) && (productStatus.status == 1))
                    {
                        //已经做过Dismantle的Product,再次进入此站,报提示
                        FisException fe = new FisException("CHK150", new string[] { snorproid });
                        throw fe;
                    }
                     */
                    prddidstation = productStatus.station.Trim();
                    //Modify 2012/03/09:	Station in ('71','73''74') 提示“Please scan PIA/EPIA OutPut First!”-〉保留73
                    //if ((prddidstation == "71") || (prddidstation == "73") || (prddidstation == "74"))
                    //2012/10/18  --UC Update Dismantle 不检查机器状态
                    //---------------------------------------------------
                    //if (prddidstation == "73")
                    //{
                    //    //提示“Please scan PIA/EPIA OutPut First!”  
                    //    FisException fe = new FisException("CHK280", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                    //    throw fe;
                    //}
                    //---------------------------------------------------
                    //int numStation = Convert.ToInt32(productStatus.station);
                    //prodLogLst = productRepository.GetProductLogs(currentProduct.ProId, "69");
                    //if (prodLogLst.Count > 0)
                    //{
                    //    //提示“已经到包装,不能dismantle!”
                    //    FisException fe = new FisException("CHK281", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                    //    throw fe;
                    //}
                    //若ProductStatus.Station 不在 (ConstValue.Value( Condtion: ConstValue.Name = ‘FADismantleStation’  and Type=’FAStation’))之中,则提示:“不在Dismantle的Station中,请Check”
                    //Note:
                    //ConstValue.Value格式如下:Station1, Station2, Station3…..
                    //挪到循环之外,取一次即可
                    //IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                    //ConstValueInfo info = new ConstValueInfo();
                    //info.type = "FAStation";
                    //info.name = "FADismantleStation";
                    //IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
                    if (retList != null && retList.Count > 0)
                    {
                        var iloc = retList[0].value.IndexOf(prddidstation);
                        if (iloc == -1)
                        {
                            //不在Dismantle的Station中,请Check  
                            FisException fe = new FisException("CHK306", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                            throw fe;
                        }
                        else if (prddidstation.Trim() == "")
                        {
                            //不在Dismantle的Station中,请Check  
                            FisException fe = new FisException("CHK306", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                            throw fe;
                        }
                    }
                    else
                    {
                        //请联系IE,维护Dismantle的Station
                        FisException fe = new FisException("CHK307", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                        throw fe;
                    }
                    //2012/11/12 Mantis:1503 - 对于过65站后的机器去FA Dismantle解掉资产标签后系统应支持将机器状态分配到60或64站,以便机器重新去CA站结合新的AST
                    //若[Dismantle Type]=’AST’,ProductStatus.Station 不在 (ConstValue.Value( Condtion: ConstValue.Name = ‘FAASTDismantleStation’  and Type=’FAStation’))之中,则报错:“AST不在Dismantle的Station中,请Check”
                    //Note:
                    //ConstValue.Value格式如下:Station1, Station2, Station3….
                    if (sDismantleType.ToUpper() == "AST")
                    {
                        //ConstValueInfo infoAst = new ConstValueInfo();
                        //infoAst.type = "FAStation";
                        //infoAst.name = "FAASTDismantleStation";
                        //IList<ConstValueInfo> retListAst = partRepository.GetConstValueInfoList(infoAst);
                        if (retListAst != null && retListAst.Count > 0)
                        {
                            var ilocAst = retListAst[0].value.IndexOf(prddidstation);
                            if (ilocAst == -1)
                            {
                                //AST不在Dismantle的Station中,请Check  
                                FisException fe = new FisException("CHK570", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                                throw fe;
                            }
                            else if (prddidstation.Trim() == "")
                            {
                                //AST不在Dismantle的Station中,请Check  
                                FisException fe = new FisException("CHK570", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                                throw fe;
                            }
                        }
                        else
                        {
                            //请联系IE,维护Dismantle的Station
                            FisException fe = new FisException("CHK571", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                            throw fe;
                        }
                    }
                    else if (sDismantleType.ToUpper().Equals("PRODUCT"))
                    {
                        ChkCOA(snorproid);

                        IList<IMES.FisObject.FA.Product.ProductInfo> pis = currentProduct.ProductInfoes;
                        if (pis != null)
                            ChkWin8(snorproid, ref pis);
                    }
                    //-------------------------------------------------------------------------------

                    //Modify 2012/03/09:UC Station=75-〉6A Status=0 “此台为PIA/EPIA检测不良,请与QC联系”
                    //if ((prddidstation == "75") && (productStatus.status == 0))
                    //2012/10/18  --UC Update Dismantle 不检查机器状态
                    //---------------------------------------------------
                    //if ((prddidstation == "6A") && (productStatus.status == 0))
                    //{
                    //    //提示此台为PIA/EPIA检测不良,请与QC联系  
                    //    FisException fe = new FisException("CHK282", new string[] { currentProduct.ProId, currentProduct.CUSTSN });
                    //    throw fe;
                    //}
                    //---------------------------------------------------
                }
                return "OK";
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                return e.mErrmsg;
                //throw new Exception(e.Message); ;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(DismantleFA)CheckPrdIDorSNList End,"
                      + " [line]:" + line
                      + " [editor]:" + editor
                      + " [station]:" + station
                      + " [customer]:" + customer);

            }
        }
        /// <summary>
        /// Dismantle
        /// </summary>
        /// <param name="snorproid"></param>
        /// <param name="sDismantleType"></param>
        /// <param name="sKeyparts"></param>
        /// <param name="sReturnStation"></param>
        /// <param name="line"></param>
        /// <param name="editor"></param>
        /// <param name="station"></param>
        /// <param name="customer"></param>
        public void Dismantle(string snorproid, string sDismantleType, string sKeyparts, string sReturnStation, string line, string pCode, string editor, string station, string customer)
        {

            logger.Debug("(DismantleDocking)Dismantle start,"
                      + " [CustSN or ProductId]:" + snorproid
                       + " [line]:" + line
                      + " [editor]:" + editor
                      + " [station]:" + station
                      + " [customer]:" + customer);
            FisException ex;
            //IList<string> retLst = null;
            List<string> erpara = new List<string>();
            try
            {
                var inputProdID = false;
                //var productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                IProduct currentProduct;
                string inputString = snorproid.Trim();
                if ((inputString.Length == 10) || (inputString.Substring(0, 3) == "CNU" || inputString.Substring(0, 3) == "5CG"))
                {
                    inputProdID = false; //CustSN
                    currentProduct = productRepository.GetProductByCustomSn(inputString);
                }
                else 
                {
                    inputProdID = true;
                    if (inputString.Length == 10)
                        inputString = inputString.Substring(0, 9);
                    currentProduct = productRepository.Find(inputString);

                }
                //var currentProduct = CommonImpl.GetProductByInput(snorproid, CommonImpl.InputTypeEnum.ProductIDOrCustSN);
                //	若Product/PruductStatus不存在该Product信息,则报错:“Product:XXX不存在”
                if (currentProduct == null)
                {
                    if (inputProdID)
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add(snorproid);
                        throw new FisException("SFC002", errpara);
                    }
                    else
                    {
                        List<string> errpara = new List<string>();
                        errpara.Add(snorproid);
                        //throw new FisException("PAK042", errpara);
                        throw new FisException("CHK144", errpara);
                    }
                }
                ProductStatusInfo productStatus = productRepository.GetProductStatusInfo(currentProduct.ProId);
                if (productStatus.station == null)
                {
                    erpara.Add(currentProduct.ProId);
                    ex = new FisException("PAK026", erpara);    //没有Product Status 站数据!
                    throw ex;

                }
                //UC Update 2012/08/27 去除固定站点的检查;
                ////	若ProductLog存在’69’或者’80’或者’81’的记录,则报错:“Product:XXX已流入包装,不能Dismantle”
                //if (currentProduct.ProductLogs != null)
                //{
                //    foreach (var log in currentProduct.ProductLogs)
                //    {
                //        if ((log.Station == "69") || (log.Station == "80") || (log.Station == "81"))
                //        {
                //            //FisException fe = new FisException("CHK139", new string[] { snorproid });
                //            FisException fe = new FisException("CHK141", new string[] { snorproid });
                //            throw fe;
                //        }
                //    }
                //}
                //	若ProductStatus.Station=’38’,则报错:“Product:XXX已Dismantle,不需再次执行”
                string prddidstation = productStatus.station.Trim();
                //UC update 2012/08/27--若ProductStatus.Station 不在 (ConstValue.Value( Condtion: ConstValue.Name = ‘FADismantleStation’  
                //and Type=’FAStation’))之中,则提示:“不在Dismantle的Station中,请Check”
                //------------------------------------------------------------------------------------
                IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                ConstValueInfo info = new ConstValueInfo();
                info.type = "FAStation";
                info.name = "FADismantleStation";
                IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
                if (retList != null && retList.Count > 0)
                {
                    var iloc = retList[0].value.IndexOf(prddidstation);
                    if (iloc == -1)
                    {
                        //不在Dismantle的Station中,请Check  
                        FisException fe = new FisException("CHK308", new string[] { snorproid });
                        throw fe;
                    }
                    else if (prddidstation.Trim() == "")
                    {
                        //不在Dismantle的Station中,请Check  
                        FisException fe = new FisException("CHK308", new string[] { snorproid });
                        throw fe;
                    }
                }
                else
                {
                    //请联系IE,维护Dismantle的Station
                    FisException fe = new FisException("CHK307", new string[] { snorproid });
                    throw fe;
                }
                //------------------------------------------------------------------------------------
                //if ((prddidstation == "38") ||(productStatus.status==1))
                if (prddidstation == "38")
                {
                    //已经做过Dismantle的Product,再次进入此站,报提示
                    //FisException fe = new FisException("CHK150", new string[] { snorproid });
                    FisException fe = new FisException("CHK142", new string[] { snorproid });
                    throw fe;
                }
                //	若ProductStatus.Station等于’71’或者’73’,则报错:“Product:XXX为抽检抽中机器,请先刷PIA Output”
                if ((prddidstation == "71") || (prddidstation == "73"))
                {
                    //提示“Please scan PIA/EPIA OutPut First!”  
                    //FisException fe = new FisException("CHK151", new string[] { snorproid });//--error message要修改
                     FisException fe = new FisException("CHK143", new string[] { snorproid });
                    throw fe;
                }
                
                string sessionKey = currentProduct.ProId;
                Session sessionInfo = SessionManager.GetInstance.GetSession(sessionKey, theType);
                if (sessionInfo == null)
                {
                    sessionInfo = new Session(sessionKey, theType, editor, station, line, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();

                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("CurrentFlowSession", sessionInfo);
                    wfArguments.Add("SessionType", theType);
                    
                    sessionInfo.AddValue(Session.SessionKeys.Product, currentProduct);
                    //sessionInfo.AddValue(Session.SessionKeys.PCode, pCode);
                    
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "ProdIDDismantleDocking.xoml", null, out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);
                    sessionInfo.SetInstance(instance);
             
                    if (!SessionManager.GetInstance.AddSession(sessionInfo))
                    {
                        sessionInfo.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }
                    sessionInfo.WorkflowInstance.Start();
                    sessionInfo.SetHostWaitOne();

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

                //check workflow exception
                if (sessionInfo.Exception != null)
                {
                    if (sessionInfo.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        sessionInfo.ResumeWorkFlow();
                    }
                    throw sessionInfo.Exception;
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(DismantleDocking)Dismantle End,"
                      + " [CustSN or ProductId]:" + snorproid
                       + " [line]:" + line
                      + " [editor]:" + editor
                      + " [station]:" + station
                      + " [customer]:" + customer);

            }
        }  
    private void UpdateAndInsertLabelTypetoConstValue()
    {
        try
        {
            ConstValueInfo item = new ConstValueInfo();
            IList<ConstValueInfo> List = iConstValue.GetConstValueListByType(LabelType);
            string Name = this.txtInfoName.Value.Trim();
            int count = (from q in List
                        where q.name == Name
                        select q).Count();

            item.name = Name;
            item.type = LabelType;
            item.value = this.txtInfoValue.Value.Trim();
            item.description = this.txtDescription.Value.Trim();
            item.editor = this.HiddenUserName.Value;

            if (count == 0)
            {
                iConstValue.AddConstValue(item);
            }
            else
            {
                iConstValue.SaveConstValue(item);
            }
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }
    }
Example #9
0
        /// <summary>
        /// 获取记入c:\serial.txt的信息
        /// </summary>
        /// <param name="dns">DN list</param>
        public IList<string> GetFileData(IList<S_DnUdt> dns, string editor)
        {

            logger.Debug("(_UploadShipmentData)GetFileData start");
            bool bNeedCheckEOA = false;
            bool bNeedCheckOA3 = false;
            string fkiPath = "";
            //ignore the certificate check (FOR CQ)
            ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);
            CredentialCache FKICredentialCache = new CredentialCache();

            try
            {
                fkiPath = System.Configuration.ConfigurationManager.AppSettings["FKIServicePath"].Trim();
                if (fkiPath != "")
                {
                    try
                    {
                        string fkiUser = System.Configuration.ConfigurationManager.AppSettings["FKIAuthUser"].Trim();
                        string fkiPwd = System.Configuration.ConfigurationManager.AppSettings["FKIAuthPassword"].Trim();
                        if (fkiUser != "")
                        {
                            if (fkiUser.Contains("\\"))
                            {
                                string user = fkiUser.Substring(fkiUser.IndexOf('\\') + 1);
                                string domain = fkiUser.Substring(0, fkiUser.IndexOf('\\'));
                                FKICredentialCache.Add(new System.Uri(fkiPath), "NTLM", new System.Net.NetworkCredential(user, fkiPwd, domain));
                            }
                            else
                            {
                                FKICredentialCache.Add(new System.Uri(fkiPath), "NTLM", new System.Net.NetworkCredential(fkiUser, fkiPwd));
                            }
                        }
                    }
                    catch { }
                    bNeedCheckEOA = true;
                }
            }
            catch { }


            try
            {
                IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                IList<ConstValueInfo> cvInfo = new List<ConstValueInfo>();

                ConstValueInfo cvCond = new ConstValueInfo();
                cvCond.type = "CheckOA3State";
                cvCond.name = "OA3UpSAP";
                cvInfo = partRepository.GetConstValueInfoList(cvCond);
                if (cvInfo == null || cvInfo.Count == 0)
                {
                    bNeedCheckOA3 = true;
                }
                else
                {

                    bool findN = false;
                    foreach (ConstValueInfo tmp in cvInfo)
                    {
                        if (tmp.value.ToUpper() == "N")
                        {
                            findN = true;
                            bNeedCheckOA3 = false;
                            break;
                        }
                    }
                    if (findN == false)
                    {
                        bNeedCheckOA3 = true;
                    }
                }
            }
            catch { }

            try
            {
                UnitOfWork uow = new UnitOfWork();
                IList<string> ret = new List<string>();
                string tmpDn;

                IList<Regex> lstRegexTablet = CommonImpl.GetInstance().GetRegexByProcReg("Tablet");
                IList<Regex> lstRegexSKUorThinClient = CommonImpl.GetInstance().GetRegexByProcReg("SKU,ThinClient");

                foreach (S_DnUdt sDnUdt in dns)
                {
                    tmpDn = sDnUdt.dn;
                    IList<string> subRet = new List<string>();
                    int caseNoByDN = 2; //0 - case A; 1 - case B; 2 - case C

                    Delivery dlv = deliveryRepository.Find(tmpDn);
                    //Check Udt..
                    if (sDnUdt.udt != dlv.Udt)
                    {
                        throw new FisException("PAK173", new string[] { tmpDn });

                    }
                    //Check Udt..


                    //GetBom,与BOM相关的都尚未确定
                    IList<DNInfoForUI> dlvInfoList = deliveryRepository.GetDNInfoList(tmpDn);
                    string SW = "";
                    foreach (DNInfoForUI tmpInfo in dlvInfoList)
                    {
                        //SW:DeliveryInfo.InfoType=’PartNo’对应的InfoValue值,14位开始取7位
                        if (tmpInfo.InfoType.Equals("PartNo"))
                        {
                            //Add by Benson for Mantis0001733: UpLoad Shipment Data to SAP页面在save的时候报错提示不准确
                            string infoV = tmpInfo.InfoValue.Trim();
                            if (infoV.Length < 14 || string.IsNullOrEmpty(infoV.Substring(13, 7)))
                            { throw new FisException("PAK178", new string[] { tmpDn }); }
                            SW = tmpInfo.InfoValue.Substring(13, 7);

                            //SW = tmpInfo.InfoValue.Substring(13, 7);
                        }
                        if (tmpInfo.InfoType.Equals("Flag") && tmpInfo.InfoValue.Equals("N"))
                        {
                            caseNoByDN = 1;
                        }
                    }

                    IList<IProduct> proList = productRepository.GetProductListByDeliveryNo(tmpDn);
                    foreach (IProduct p in proList)
                    {
                        bool isTablet = CommonImpl.GetInstance().CheckModelByProcReg(p.Model, ref lstRegexTablet);
                        bool isSKUorThinClient = CommonImpl.GetInstance().CheckModelByProcReg(p.Model, ref lstRegexSKUorThinClient);

                        int caseNo = caseNoByDN;
                        IHierarchicalBOM bom = bomRep.GetHierarchicalBOMByModel(p.Model);
                        IList<IBOMNode> PLBomNodeList = bom.GetFirstLevelNodesByNodeType("PL");
                        foreach (IBOMNode bomNode in PLBomNodeList)
                        {
                            if (bomNode.Part.Descr == "ATT LABEL" || bomNode.Part.Descr == "VERIZON LABEL")
                            {
                                caseNo = 0;
                                break;
                            }
                        }

                        string s = "";

                        string palletNo = "";
                        //UC Exception 1
                        if (p.PalletNo.Equals(""))
                        {
                            throw new FisException("PAK111", new string[] { tmpDn });
                            //subRet.Clear();
                            //subRet.Add(tmpDn + " Pallet Qty is error!");
                            //break;
                        }
                        else
                        {
                            //PalletNo:若Product.PalletNo的前两位等于NA or BA时,PalletNo=’~’+Product.PalletNo从第3位开始取10位;否则PalletNo=Product.PalletNo+’~’
                            if (p.PalletNo.StartsWith("NA") || p.PalletNo.StartsWith("BA"))
                            {
                                palletNo = "~" + p.PalletNo.Substring(2, 10);
                            }
                            else
                            {
                                palletNo = p.PalletNo + "~";
                            }
                        }

                        if (isSKUorThinClient) // mantis 2061, Tablet機型不檢查 COA&OA3 狀態
                        {
                            if (!CheckCOACombine(bom, p, tmpDn))
                            {
                                //For Mantis0001733: UpLoad Shipment Data to SAP页面在save的时候报错提示不准确
                                throw new FisException("PAK179", new string[] { p.CUSTSN, tmpDn });
                                //throw new FisException("PAK158", new string[] { p.CUSTSN, tmpDn });
                            }
                            if (bNeedCheckOA3)
                            {
                                if (bNeedCheckEOA && !CheckOA3Key(bom, p, fkiPath, FKICredentialCache, editor, uow))
                                {
                                    throw new FisException("PAK158", new string[] { p.CUSTSN, tmpDn });
                                }
                            }
                        }

                        string boxId = "";
                        string MEID = "";
                        string UUID = "";
                        string WM = "";
                        string IMEI = "";
                        string ICCID = "";

                        IList<IMES.FisObject.FA.Product.ProductInfo> pInfoList = new List<IMES.FisObject.FA.Product.ProductInfo>();
                        IProduct tmpPrd = productRepository.Find(p.ProId);
                        if (tmpPrd != null)
                        {
                            pInfoList = tmpPrd.ProductInfoes;
                        }

                        foreach (IMES.FisObject.FA.Product.ProductInfo tmpInfo in pInfoList)
                        {
                            //Boxid:ProductInfo里InfoType=BoxId或UCC对应的InfoValue
                            if (tmpInfo.InfoType.Equals("BoxId") || tmpInfo.InfoType.Equals("UCC"))
                            {
                                boxId = tmpInfo.InfoValue;
                                continue;
                            }

                            //MEID:ProductInfo.InfoValue where infoType=’MEID’ (情况B和情况C为空)
                            if (tmpInfo.InfoType.Equals("MEID"))
                            {
                                MEID = (caseNo == 0) ? tmpInfo.InfoValue : "";
                                continue;
                            }

                            //UUID:ProductInfo.InfoValue where infoType=’UUID’ (情况B和情况C为空)
                            if (tmpInfo.InfoType.Equals("UUID"))
                            {
                                UUID = (caseNo == 0) ? tmpInfo.InfoValue : "";
                                continue;
                            }

                            //WM:ProductInfo.InfoValue where infoType=’WM’ (情况B和情况C为空)
                            if (tmpInfo.InfoType.Equals("WM"))
                            {
                                WM = (caseNo == 0) ? tmpInfo.InfoValue : "";
                                continue;
                            }

                            //IMEI:ProductInfo.InfoValue where infoType=’IMEI’(情况B和情况C为空)
                            if (tmpInfo.InfoType.Equals("IMEI"))
                            {
                                IMEI = (caseNo == 0) ? tmpInfo.InfoValue : "";
                                continue;
                            }

                            //ICCID:ProductInfo.InfoValue where infoType=’ICCID’ (情况B和情况C为空)
                            if (tmpInfo.InfoType.Equals("ICCID"))
                            {
                                ICCID = (caseNo == 0) ? tmpInfo.InfoValue : "";
                                continue;
                            }
                        }

                        //Descr:不知道如何获取?? 暂时写””
                        string Descr = "";

                        //ODD:
                        string ODD = "";
                        //try
                        //{
                        ODD = GetODD(bom, tmpDn);
                        //}
                        //catch (FisException e)
                        //{
                        //subRet.Clear();
                        /*
                         * Answer to: ITC-1360-0910
                         * Description: Should use mErrmsg to get error msg of FisException.
                         */
                        //subRet.Add(e.mErrmsg);
                        //break;
                        //}

                        //Wireless and FCCID:
                        string Wireless = "";
                        string FCCID = "";
                        //try
                        //{
                        IList<string> wlAndFcc = GetWirelessAndFCCID(bom, p, tmpDn);
                        Wireless = wlAndFcc[0];
                        FCCID = wlAndFcc[1];
                        //}
                        //catch (FisException e)
                        //{
                        //subRet.Clear();
                        /*
                         * Answer to: ITC-1360-0903, ITC-1360-0913, ITC-1360-0914, ITC-1360-0916, ITC-1360-0922
                         * Description: Should use mErrmsg to get error msg of FisException.
                         */
                        //subRet.Add(e.mErrmsg);
                        //break;
                        //}

                        //ODD_Accession and ODD_Mftld
                        string ODD_Accession = "";
                        string ODD_Mftld = "";
                        //try
                        //{
                        IList<string> oddAccAndMft = GetODDAccessionAndMftId(p);
                        ODD_Accession = oddAccAndMft[0];
                        ODD_Mftld = oddAccAndMft[1];

                        //Add by Benson for fix Mantis 1543


                        foreach (IProductPart ele in p.ProductParts)
                        {
                            if (ele.CheckItemType == "ODD")
                            {
                                if (string.IsNullOrEmpty(ODD_Accession) || string.IsNullOrEmpty(ODD_Mftld) || string.IsNullOrEmpty(ODD))
                                {
                                    throw new FisException("PAK169", new string[] { tmpDn });

                                }

                            }
                        }




                        //Add by Benson for fix Mantis 1543

                        //}
                        //catch (FisException e)
                        //{
                        //subRet.Clear();
                        //subRet.Add(e.mErrmsg);
                        //break;
                        //}

                        //UC Exception 4 (deleted UC)
                        /*  Delete by kaisheng --2012/03/20:miniRun need --
                        if (ODD != "" && (ODD_Accession == "" || ODD_Mftld == ""))
                        {
                            subRet.Clear();
                            subRet.Add("ODD Accession No. or ManufactureId missing!!" + tmpDn);
                            break;
                        }
                        */
                        //AST:unit绑定的AST sn,IMES_FA.Product_Part.PartSn where BomNodeType=’AT’
                        string AST = "";
                        foreach (IProductPart ele in p.ProductParts)
                        {
                            if (ele.BomNodeType == "AT")
                            {
                                AST = ele.PartSn;
                                break;
                            }
                        }

                        //MFD:机器产生CustomerSN的时间,格式为YYYYMMDD。数据获取方法ProductLog.Cdt where Station=’58’(情况B为空)
                        string MFD = "";
                        if (caseNo != 1)
                        {
                            /*
                             * Answer to: ITC-1360-1449
                             * Description: Get logs by station.
                             */
                            IList<ProductLog> logs = productRepository.GetProductLogs(p.ProId, "58");
                            if (logs.Count > 0)
                            {
                                MFD = logs[0].Cdt.ToString("yyyyMMdd");
                            }
                        }

                        s += dlv.DeliveryNo.Substring(0, 10);
                        s += "~";
                        s += dlv.DeliveryNo.Substring(dlv.DeliveryNo.Length - 6);
                        s += "~";
                        s += dlv.PoNo;
                        s += "~";
                        s += palletNo;
                        s += "~";
                        s += p.CUSTSN;
                        s += "~";
                        s += boxId;
                        s += "~1~";

                        // mantis 2061
                        //s += p.Model.StartsWith("PC") ? "C" : "O";
                        //if (isSKUorThinClient || isTablet)
                        //    s += "C";
                        //else
                        //    s += "O";
                        if (p.Model.Substring(1,1)=="C")
                            s += "C";
                        else
                            s += "O";

                        s += "~";
                        s += Descr;
                        s += "~";
                        s += AST;
                        s += "~";
                        s += Wireless;
                        s += "~";
                        s += ODD;
                        s += "~";
                        s += ODD_Accession;
                        s += "~";
                        s += ODD_Mftld;
                        s += "~";
                        s += FCCID;
                        s += "~~~";
                        s += (caseNo == 0) ? p.MAC : "";
                        s += "~~~~~";
                        s += MEID;
                        s += "~";
                        s += MFD;
                        s += "~";
                        s += UUID;
                        s += "~";
                        s += WM;
                        s += "~";
                        s += IMEI;
                        s += "~";
                        s += (caseNo == 0) ? "1.0" : "";
                        s += "~";
                        s += (caseNo == 0) ? "EMBDSIM" : "";
                        s += "~";
                        s += (caseNo == 0) ? SW : "";
                        s += "~";
                        s += ICCID;
                        s += "~";
                        subRet.Add(s);
                    }
                    foreach (string ele in subRet)
                    {
                        ret.Add(ele);
                    }
                }
                //   Check Udt again
                foreach (S_DnUdt dnUdt in dns)
                {
                    Delivery dnObj = deliveryRepository.Find(dnUdt.dn);
                    if (dnUdt.udt != dnObj.Udt || (dnObj.Status != "98" && dnObj.Status != "88"))
                    {
                        throw new FisException("PAK173", new string[] { dnUdt.dn });

                    }

                }


                //Check Udt again

                uow.Commit();
                return ret;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }

            catch (System.Net.WebException)
            {
                throw new SystemException("無法連接HP OA3 Server,請聯繫測試PE處理");
            }

            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(_UploadShipmentData)GetFileData end");
            }
        }
Example #10
0
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {
        ConstValueInfo item = new ConstValueInfo();
        item.name = this.dName.Text.Trim();
        //item.type = this.cmbConstValueType.InnerDropDownList.SelectedItem.Text;
        item.type = selecttype.Value;
        item.value = this.dValue.Text.Trim();
        item.description = this.dDescr.Text.Trim();
        item.editor = this.HiddenUserName.Value; 
        //string oldCode = this.dOldCode.Value.Trim();
        try
        {
            iConstValueMaintain.SaveConstValue(item); //,oldCode);
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }

        ShowListByType();
        ShowTypeDescriptionByType();              
        String itemId = replaceSpecialChart(item.name);
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + itemId + "');DealHideWait();", true);
    }
Example #11
0
        /// <summary>
        /// Generate ATSN7 label
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            var partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            IList<string> pnList = CurrentSession.GetValue("PnListOfATSN7") as IList<string>;
            bool bCDSI = (bool)CurrentSession.GetValue("bCDSI");

            if (bCDSI == true)
            {
                string AST1 = "";
                CdsiastInfo cdi = new CdsiastInfo();
                cdi.tp = "ASSET_TAG";
                cdi.snoId = curProduct.ProId;
                IList<CdsiastInfo> cdsiastInfoList = productRepository.GetCdsiastInfoList(cdi);
                if (cdsiastInfoList != null && cdsiastInfoList.Count > 0)
                {
                    AST1 = cdsiastInfoList[0].sno;
                }

                string AST2 = "";
                CdsiastInfo cdi2 = new CdsiastInfo();
                cdi2.tp = "ASSET_TAG2";
                cdi2.snoId = curProduct.ProId;
                IList<CdsiastInfo> cdsiastInfoList2 = productRepository.GetCdsiastInfoList(cdi2);
                if (cdsiastInfoList2 != null && cdsiastInfoList2.Count > 0)
                {
                    AST2 = cdsiastInfoList2[0].sno;
                }

                if ((AST1 == "") && (AST2 == ""))
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK203", errpara);
                }
                else
                {
                    //不为空则存入
                    //保存product和Asset SN的绑定关系
                    foreach (string tmp in pnList)
                    {
                        if (AST1 != "")
                        {
                            IProductPart assetTag1 = new ProductPart();
                            assetTag1.ProductID = curProduct.ProId;
                            assetTag1.PartID = tmp;
                            assetTag1.PartType = "ATSN7";
                            assetTag1.Iecpn = "";
                            assetTag1.CustomerPn = "";
                            assetTag1.PartSn = AST1;
                            assetTag1.Station = Station;
                            assetTag1.Editor = Editor;
                            assetTag1.Cdt = DateTime.Now;
                            assetTag1.Udt = DateTime.Now;
                            assetTag1.BomNodeType = "AT";

                            curProduct.AddPart(assetTag1);
                            productRepository.Update(curProduct, CurrentSession.UnitOfWork);
                        }

                        if (AST2 != "")
                        {
                            IProductPart assetTag2 = new ProductPart();
                            assetTag2.ProductID = curProduct.ProId;
                            assetTag2.PartID = tmp;
                            assetTag2.PartType = "ATSN7";
                            assetTag2.Iecpn = "";
                            assetTag2.CustomerPn = "";
                            assetTag2.PartSn = AST2;
                            assetTag2.Station = Station;
                            assetTag2.Editor = Editor;
                            assetTag2.Cdt = DateTime.Now;
                            assetTag2.Udt = DateTime.Now;
                            assetTag2.BomNodeType = "AT";

                            curProduct.AddPart(assetTag2);
                            productRepository.Update(curProduct, CurrentSession.UnitOfWork);
                        }
                    }
                }
            }
            else    //Not CDSI
            {
                string custNum = "";

                string cust = curProduct.ModelObj.GetAttribute("Cust");
                IList<AssetRangeInfo> assetRangeList = partRepository.GetAssetRangesByCode(cust);
                if (assetRangeList.Count == 0)  //No AssetRange found
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK200", errpara);
                }
                AssetRangeInfo assetRange = assetRangeList[0];

                if (assetRange.begin.Length != assetRange.end.Length)   //Length of Begin and End mismatch
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK201", errpara);
                }
                
                try
                {
                    SqlTransactionManager.Begin();
                    lock (_syncRoot_GetSeq)
                    {
                        INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                        string largestCustNum = numCtrlRepository.GetMaxAssetNumber("AST", cust, "HP");

                        if (string.IsNullOrEmpty(largestCustNum))
                        {
                            custNum = assetRange.begin;
                            //Save current custNum to numControl
                            NumControl item = new NumControl(0, "AST", assetRange.code, custNum, "HP");
                            numCtrlRepository.SaveMaxAssetNumber(item, true);
                            SqlTransactionManager.Commit();
                        }
                        else
                        {
                            if (largestCustNum.Length != assetRange.begin.Length)   //Length of largestCustNum and assetRange.begin mismatch
                            {
                                List<string> errpara = new List<string>();
                                throw new FisException("CHK201", errpara);
                            }

                            string prePartCur = "";
                            string numPartCur = "";
                            ParseAst(largestCustNum, out prePartCur, out numPartCur);
                            if (numPartCur == "")
                            {
                                List<string> errpara = new List<string>();
                                throw new FisException("CHK201", errpara);
                            }

                            string prePartMax = "";
                            string numPartMax = "";
                            ParseAst(assetRange.end, out prePartMax, out numPartMax);
                            if (numPartMax == "")
                            {
                                List<string> errpara = new List<string>();
                                throw new FisException("CHK201", errpara);
                            }

                            if (prePartCur != prePartMax)   //Prefix of largestCustNum and assetRange.end mismatch
                            {
                                List<string> errpara = new List<string>();
                                throw new FisException("CHK201", errpara);
                            }

                            long numCur = long.Parse(numPartCur);
                            long numMax = long.Parse(numPartMax);
                            if (numCur >= numMax)
                            {
                                List<string> errpara = new List<string>();
                                throw new FisException("CHK201", errpara);
                            }

                            numCur++;

                            custNum = prePartCur;
                            int fillZeroCount = numPartCur.Length - numCur.ToString().Length;
                            for (int i = 0; i < fillZeroCount; i++)
                            {
                                custNum += "0";
                            }
                            custNum += numCur.ToString();

                            //Save current custNum to numControl
                            NumControl item = new NumControl(0, "AST", assetRange.code, custNum, "HP");
                            numCtrlRepository.SaveMaxAssetNumber(item, false);
                            SqlTransactionManager.Commit();
                        }
                    }
                }
                catch (Exception e)
                {
                    SqlTransactionManager.Rollback();
                    throw e;
                }
                finally
                {
                    SqlTransactionManager.Dispose();
                    SqlTransactionManager.End();
                }

                //Update custNum
                if (cust == "SCUSTA-1")
                {
                    custNum = "000" + custNum.Trim() + "00";
                }
                /*
                else if (cust == "CUSTW-1")
                {
                    custNum = custNum.Trim() + " HQ P47";
                }
                else if (cust == "CUSTW-2")
                {
                    custNum = custNum.Trim() + " HQ P49";
                }
                 */

                ConstValueInfo cond = new ConstValueInfo();
                cond.type = "AST";
                cond.name = cust;
                IList<ConstValueInfo> valList = partRepository.GetConstValueInfoList(cond);
                if (valList.Count > 0 && !String.IsNullOrEmpty(valList[0].value))
                {
                    custNum += valList[0].value.Trim();
                }

                //保存product和Asset SN的绑定关系
                foreach (string tmp in pnList)
                {
                    IProductPart assetTag = new ProductPart();
                    assetTag.ProductID = curProduct.ProId;
                    assetTag.PartID = tmp;
                    assetTag.PartType = "ATSN7";
                    assetTag.Iecpn = "";
                    assetTag.CustomerPn = "";
                    assetTag.PartSn = custNum;
                    assetTag.Station = Station;
                    assetTag.Editor = Editor;
                    assetTag.Cdt = DateTime.Now;
                    assetTag.Udt = DateTime.Now;
                    assetTag.BomNodeType = "AT";

                    curProduct.AddPart(assetTag);
                    productRepository.Update(curProduct, CurrentSession.UnitOfWork);
                }
            }

            return base.DoExecute(executionContext);
        }
Example #12
0
        /// <summary>
        /// 获取DCode
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            DateTime dt = DateTime.Now;
            string year = string.Empty;
            string month = string.Empty;
            string siteCode = string.Empty;
            string dataCode = (string)CurrentSession.GetValue(Session.SessionKeys.WarrantyCode);

            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IList<string> valueList = partRepository.GetValueFromSysSettingByName("Site");
            if (valueList.Count == 0)
            { 
                throw new FisException("PAK095", new string[] { "Site" });
            }
            if (valueList[0] == "ICC")//重慶
            {
                string shipMode = this.CQSideCodeMBShipMode.ToString();
                ConstValueInfo condition = new ConstValueInfo() {
                     type="SiteCodeOfDCode",
                     name =shipMode
                };

                IList<ConstValueInfo> siteCodeList = partRepository.GetConstValueInfoList(condition);
               
                if (siteCodeList == null || siteCodeList.Count == 0)
                {
                    throw new FisException("PAK095", new string[] { "SiteCodeOfDCode/" + shipMode });
                }
                siteCode = siteCodeList[0].value.Trim();
            }
            else
            {
                IList<string> partLst = partRepository.GetValueFromSysSettingByName("SITECODE");
                if (partLst.Count() > 0)
                {
                    siteCode = partLst[0].ToString();
                }
            }

            IWarrantyRepository wr =
                    RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository, Warranty>();
            IList<Warranty> warrantys = wr.GetDCodeRuleListForMB("Customer");

            var wrList = (from warranty in warrantys
                         where (warranty.Id.ToString() == dataCode)
                       select new { WarrantyFormat = warranty.WarrantyFormat.ToString(), WarrantyCode = warranty.WarrantyCode.ToString() }).ToArray();
            if (wrList.Count() > 0)
            {
                if (wrList[0].WarrantyFormat.ToUpper() == "YYM")
                {
                    year = dt.Year.ToString().Substring(dt.Year.ToString().Length - 2, 2);
                    switch (dt.Month.ToString())
                    {
                        case "10":
                            month = "A";
                            break;
                        case "11":
                            month = "B";
                            break;
                        case "12":
                            month = "C";
                            break;
                        default:
                            month = dt.Month.ToString().Substring(dt.Month.ToString().Length - 1, 1);
                            break;
                    }
                }
                else if (wrList[0].WarrantyFormat.ToUpper() == "YMM")
                {
                    year = dt.Year.ToString().Substring(dt.Year.ToString().Length - 1, 1);
                    //month = dt.Month.ToString().Substring(dt.Month.ToString().Length - 2, 2);
                    if (dt.Month.ToString().Length == 2)
                    {
                        month = dt.Month.ToString();
                    }
                    else
                    {
                        month = "0" + dt.Month.ToString();
                    }
                }
            }

            var dCode = siteCode + year + month + wrList[0].WarrantyCode;
            CurrentSession.AddValue(Session.SessionKeys.DCode, dCode);

            return base.DoExecute(executionContext);
        }
Example #13
0
        /// <summary>
        /// 取得Type数据的Descrip(按Type栏位排序)
        /// </summary>
        /// <returns></returns>
        public string GetConstValueDescriptionByType(string Type)
        {
            try
            {
                string ret = "";
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                ConstValueInfo temp = new ConstValueInfo();
                temp.type = "SYS";
                temp.value = Type;
                ConstValueInfo temp2 = new ConstValueInfo();
                temp2.name = "";
                IList<ConstValueInfo> retLst = itemRepository.GetConstValueListByType(temp, temp2);
                if (retLst == null || retLst.Count == 0)
                {
                    ret = "暫無資料...";
                }
                else
                {
                    ret = (retLst[0].description.ToString().Trim() != "") ? retLst[0].description.ToString().Trim() : "暫無資料...";
                }

                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #14
0
 public void DeleteConstValueByCondition(ConstValueInfo obj)
 {
     try
     {
         IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
         itemRepository.RemoveConstValue(obj);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #15
0
 public void DeleteConstValue(IList<string> ids)
 {
     try
     {
         IMiscRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>();
         IUnitOfWork uow = new UnitOfWork();
         foreach (string id in ids)
         {
             ConstValueInfo item = new ConstValueInfo();
             item.id = int.Parse(id);
             itemRepository.DeleteDataDefered<IMES.Infrastructure.Repository._Metas.ConstValue, ConstValueInfo>(uow, item);
         }
         uow.Commit();
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #16
0
        /// <summary>
        /// 保存一条ConstValue的记录数据(update/insert)
        /// </summary>
        /// <param name="obj">更新ConstValueInfo结构</param>
        public void SaveConstValue(ConstValueInfo obj)
        {
            try
            {
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();

                ConstValueInfo tempConstValue = new ConstValueInfo();
                tempConstValue.name = obj.name;
                tempConstValue.type = obj.type;
                IList<ConstValueInfo> exists = itemRepository.GetConstValueInfoList(tempConstValue);
                if (exists != null && exists.Count > 0)
                {
                    //若Name+Type数据已出现在ConstValue表的记录中,则更新到ConstValue表中
                    itemRepository.UpdateConstValue(obj, tempConstValue);
                }
                else
                {
                    //若Name+Type数据在ConstValue表的记录不存在,则Insert
                    itemRepository.AddConstValue(obj);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 public IList<ConstValueInfo> GetConstValueList()
 {
     try
     {
         IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
         ConstValueInfo condition = new ConstValueInfo();
         condition.type = "ExpressionObject";
         return itemRepository.GetConstValueInfoList(condition);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #18
0
 private void DeleteConstValue(string LabelType)
 {
     string[] LabelTypeRuleConstValueName = { "Model_", "Delivery_", "PartInfo_" };
     foreach (string LabelTypeItem in LabelTypeRuleConstValueName)
     {
         ConstValueInfo item = new ConstValueInfo();
         item.type = LabelTypeItem + LabelType;
         iConstValue.DeleteConstValueByCondition(item);
     }
 }
Example #19
0
 private string GetConstVal(string type, string name)
 {
     IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
     ConstValueInfo info = new ConstValueInfo();
     info.type = type;
     info.name = name;
     IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
     if (retList != null && retList.Count > 0)
     {
         return retList[0].value;
     }
     return "";
 }
Example #20
0
        /// <summary>
        /// Dismantle
        /// </summary>
        /// <param name="snorproid"></param>
        /// <param name="sDismantleType"></param>
        /// <param name="sKeyparts"></param>
        /// <param name="sReturnStation"></param>
        /// <param name="line"></param>
        /// <param name="editor"></param>
        /// <param name="station"></param>
        /// <param name="customer"></param>
        public void Dismantle(string snorproid, string sDismantleType, string sKeyparts, string sReturnStation, string line, string pCode, string editor, string station, string customer)
        {

            logger.Debug("(DismantleFA)Dismantle start,"
                      + " [CustSN or ProductId]:" + snorproid
                       + " [line]:" + line
                      + " [editor]:" + editor
                      + " [station]:" + station
                      + " [customer]:" + customer);
            FisException ex;
            //IList<string> retLst = null;
            List<string> erpara = new List<string>();
            try
            {
                var currentProduct = CommonImpl.GetProductByInput(snorproid, CommonImpl.InputTypeEnum.ProductIDOrCustSN);
               
                /*
                  if (!string.IsNullOrEmpty(currentProduct.CartonSN))
                  {
                      //已经包装,不能进行Dismantle!
                      FisException fe = new FisException("CHK139", new string[] { snorproid });
                      throw fe;
                  }
                
                  var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                  IList<string> productRepairLst = productRepository.GetProductRepairByProIdAndStatus(currentProduct.ProId, 0);
                  if (productRepairLst.Count > 0)
                  {
                      //去ProductRepair表中去找,找到status等于0的,代表未修完(也就是维修过程中的),就报错
                      FisException fe = new FisException("CHK140", new string[] { snorproid });
                      throw fe;
                  }
                  */
                //ITC-1268-0019
                var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                ProductStatusInfo productStatus = productRepository.GetProductStatusInfo(currentProduct.ProId);
                /*
                if ((productStatus.station == station) && (productStatus.status == 1))
                {
                    //已经做过Dismantle的Product,再次进入此站,报提示
                    FisException fe = new FisException("CHK150", new string[] { snorproid });
                    throw fe;
                }
                 */
                string prddidstation = productStatus.station.Trim();
                //Modify 2012/03/09:	Station in ('71','73''74') 提示“Please scan PIA/EPIA OutPut First!”-〉保留73
                //if ((prddidstation == "71") || (prddidstation == "73") || (prddidstation == "74"))
                //2012/10/18  --UC Update Dismantle 不检查机器状态
                //---------------------------------------------------
                //if (prddidstation == "73")
                //{
                //    //提示“Please scan PIA/EPIA OutPut First!”  
                //    FisException fe = new FisException("CHK151", new string[] { snorproid });
                //    throw fe;
                //}
                //--------------------------------------------------
                //int numStation = Convert.ToInt32(productStatus.station);
                //IList<ProductLog> prodLogLst = new List<ProductLog>();
                //prodLogLst = productRepository.GetProductLogs(currentProduct.ProId, "69");

                //if (prodLogLst.Count > 0)
                //{
                //    //提示“已经到包装,不能dismantle!”
                //    FisException fe = new FisException("CHK139", new string[] { snorproid });
                //    throw fe;
                //}
                //----Modify 2012/08/24----------------------------------------------------------
                //若ProductStatus.Station 不在 (ConstValue.Value( Condtion: ConstValue.Name = ‘FADismantleStation’  and Type=’FAStation’))之中,则提示:“不在Dismantle的Station中,请Check”
                //Note:
                //ConstValue.Value格式如下:Station1, Station2, Station3…..
                IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                ConstValueInfo info = new ConstValueInfo();
                info.type = "FAStation";
                info.name = "FADismantleStation";
                IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
                if (retList != null && retList.Count > 0)
                {
                    var iloc = retList[0].value.IndexOf(prddidstation);
                    if (iloc == -1)
                    {
                        //不在Dismantle的Station中,请Check  
                        FisException fe = new FisException("CHK308", new string[] { snorproid });
                        throw fe;
                    }
                    else if (prddidstation.Trim() == "")
                    {
                        //不在Dismantle的Station中,请Check  
                        FisException fe = new FisException("CHK308", new string[] { snorproid });
                        throw fe;
                    }
                }
                else
                {
                    //请联系IE,维护Dismantle的Station
                    FisException fe = new FisException("CHK307", new string[] { snorproid });
                    throw fe;
                }
                //2012/11/12 Mantis:1503 - 对于过65站后的机器去FA Dismantle解掉资产标签后系统应支持将机器状态分配到60或64站,以便机器重新去CA站结合新的AST
                //若[Dismantle Type]=’AST’,ProductStatus.Station 不在 (ConstValue.Value( Condtion: ConstValue.Name = ‘FAASTDismantleStation’  and Type=’FAStation’))之中,则报错:“AST不在Dismantle的Station中,请Check”
                //Note:
                //ConstValue.Value格式如下:Station1, Station2, Station3….
                if (sDismantleType.ToUpper() =="AST")
                {
                    ConstValueInfo infoAst = new ConstValueInfo();
                    infoAst.type = "FAStation";
                    infoAst.name = "FAATDismantleStation";
                    IList<ConstValueInfo> retListAst = partRepository.GetConstValueInfoList(infoAst);
                    if (retListAst != null && retListAst.Count > 0)
                    {
                        var ilocAst = retListAst[0].value.IndexOf(prddidstation);
                        if (ilocAst == -1)
                        {
                            //AST不在Dismantle的Station中,请Check  
                            FisException fe = new FisException("CHK309", new string[] { snorproid });
                            throw fe;
                        }
                        else if (prddidstation.Trim() == "")
                        {
                            //AST不在Dismantle的Station中,请Check  
                            FisException fe = new FisException("CHK309", new string[] { snorproid });
                            throw fe;
                        }
                    }
                    else
                    {
                        //请联系IE,维护Dismantle的Station
                        FisException fe = new FisException("CHK571", new string[] { snorproid });
                        throw fe;
                    }
                }
                else if (sDismantleType.ToUpper().Equals("PRODUCT"))
                {
                    ChkCOA(snorproid);

                    IList<IMES.FisObject.FA.Product.ProductInfo> pis = currentProduct.ProductInfoes;
                    if (pis != null)
                        ChkWin8(snorproid, ref pis);
                }
                //-------------------------------------------------------------------------------

                //if ((prddidstation == "75") || (productStatus.status == 0))
                //Modify 2012/03/09:UC Station=75-〉6A Status=0 “此台为PIA/EPIA检测不良,请与QC联系”
                //if ((prddidstation == "75") && (productStatus.status == 0))
                //2012/10/18  --UC Update Dismantle 不检查机器状态
                //---------------------------------------------------
                //if ((prddidstation == "6A") && (productStatus.status == 0))
                //{
                //    //提示此台为PIA/EPIA检测不良,请与QC联系  
                //    FisException fe = new FisException("CHK153", new string[] { snorproid });
                //    throw fe;
                //}
                //---------------------------------------------------
                string sessionKey = currentProduct.ProId;
                Session sessionInfo = SessionManager.GetInstance.GetSession(sessionKey, theType);

                if (sessionInfo == null)
                {
                    sessionInfo = new Session(sessionKey, theType, editor, station, line, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();

                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("CurrentFlowSession", sessionInfo);
                    wfArguments.Add("SessionType", theType);


                    sessionInfo.AddValue(Session.SessionKeys.Product, currentProduct);
                    //sessionInfo.AddValue(Session.SessionKeys.PCode, pCode);
                    if (sDismantleType.ToUpper().Trim() == "KP")
                    {
                        sessionInfo.AddValue(Session.SessionKeys.ReturnStation, sReturnStation);
                        sessionInfo.AddValue(Session.SessionKeys.KPType, sKeyparts);
                    }
                    sessionInfo.AddValue("Dismantletype", sDismantleType.ToUpper());
                    /*
                    if (dismantletype.toUpperCase() == "PRODUCT")
                    {
                        idismantle = 1;
                    }
                    else if (dismantletype.toUpperCase() == "KP")
                    {
                        idismantle = 2;
                    }
                    else if (dismantletype.toUpperCase() == "IMEI")
                    {
                        idismantle = 3;
                    }
                    else if (dismantletype.toUpperCase() == "AST")
                    {
                        idismantle = 4;
                    }
                    else
                    {
                        idismantle = 0;
                    }
                    */
                    sessionInfo.AddValue(Session.SessionKeys.Carton, currentProduct.CartonSN);
                    sessionInfo.AddValue(Session.SessionKeys.PalletNo, currentProduct.PalletNo);
                    sessionInfo.AddValue(Session.SessionKeys.DeliveryNo, currentProduct.DeliveryNo);
                    string getv = (string)sessionInfo.GetValue("Dismantletype");


                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "FADismantle.xoml", "fadismantle.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);
                    sessionInfo.SetInstance(instance);
             

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

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

                //check workflow exception
                if (sessionInfo.Exception != null)
                {
                    if (sessionInfo.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        sessionInfo.ResumeWorkFlow();
                    }
                    throw sessionInfo.Exception;
                }
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(DismantleFA)Dismantle End,"
                      + " [CustSN or ProductId]:" + snorproid
                       + " [line]:" + line
                      + " [editor]:" + editor
                      + " [station]:" + station
                      + " [customer]:" + customer);

            }
        }
Example #21
0
        /// <summary>
        /// 產生CustomerSN號相关逻辑
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        {
            Session session = CurrentSession;
            IProduct product = (IProduct)session.GetValue(Session.SessionKeys.Product);
            IMB mb = (IMB)session.GetValue(Session.SessionKeys.MB);
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IMBRepository mbRep = RepositoryFactory.GetInstance().GetRepository<IMBRepository>();
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IModelRepository modelRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
            ActivityCommonImpl utl = ActivityCommonImpl.Instance;

            string customSN = null;
            string customer = null;
           string family =null;
           if (product==null)
           {
               if (mb == null)
               {
                   family = utl.IsNull<string>(session, Session.SessionKeys.FamilyName);
               }
               else
               {
                   family = mb.MBCode;
                   customer = mb.Customer;
               }
            }
            else
            {
                family =  product.Family;
                customer = product.Customer;
            }

           if (string.IsNullOrEmpty(customer))
           {
               customer = this.Customer;
           }

            ConstValueInfo info = new ConstValueInfo();
            info.type = "CustSNExceptRule";
            info.name = family;
            IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
            if (retList == null || retList.Count == 0)
            {
                // 請维护 ConstValue的 CustSNExceptRule
                //throw new FisException("CHK1076", new string[] { "ConstValue", "CustSNExceptRule" });
                string seqFormat = null;
              
                IList<ConstValueInfo> valueList = utl.ConstValue("CustSNRule", family, out seqFormat);
                string nextNum = utl.GenSN.GetNextSequence(product, customer, "CUSTSN",
                                                                           seqFormat);
                customSN = nextNum;
                if (product!=null)
                {
                    productRep.ExistsCustomSnThrowErrorDefered(session.UnitOfWork, product.ProId, customSN);
                    product.CUSTSN = nextNum;
                    productRep.Update(product, session.UnitOfWork);
                }
                else if (mb != null)
                {
                    mbRep.ExistsCustomSnThrowErrorDefered(session.UnitOfWork,mb.Sn,customSN);
                    mb.CustSn = nextNum;
                    mbRep.Update(mb, session.UnitOfWork);
                }

            }
            else
            {
                #region for Skoda model
                if (product == null)
                {
                    throw new FisException("CHK975", new List<string> { Session.SessionKeys.Product });
                }

                string skodaFamily4 = retList[0].value;
                if (string.IsNullOrEmpty(skodaFamily4) || skodaFamily4.Length != 4)
                {
                    throw new FisException("CHK1076", new string[] { "ConstValue", "CustSNExceptRule" });
                }

                IList<IMES.FisObject.Common.Model.ModelInfo> infoModel = modelRepository.GetModelInfoByModelAndName(product.Model, "Country");
                if (infoModel == null || infoModel.Count == 0)
                {
                    throw new FisException("CHK1076", new string[] { "ModelInfo", "Country" });
                }

                info = new ConstValueInfo();
                info.type = "SKODAConutryCode";
                info.name = infoModel[0].Value;
                retList = partRepository.GetConstValueInfoList(info);
                if (retList == null || retList.Count == 0)
                {
                    // 請维护 ConstValue的 SKODAConutryCode
                    throw new FisException("CHK1076", new string[] { "ConstValue", "SKODAConutryCode" });
                }

                string skodaCountry = retList[0].value;
                if (string.IsNullOrEmpty(skodaCountry) || skodaCountry.Length != 5)
                {
                    throw new FisException("CHK1076", new string[] { "ConstValue", "SKODAConutryCode" });
                }

                DateTime curDate = DateTime.Now;
                string year = curDate.Year.ToString();

                string prestr = ""; ;
                // 1~4位:是Family4内容
                prestr = skodaFamily4;

                //  5~9位:根据国别判断,如果不足5位末尾补0
                prestr += skodaCountry;

                // 第10位:年份最后一码
                prestr += year.Substring(year.Length - 1, 1);

                // 第11位:1-9月是数字,10月为A,11月B,12月C
                if (curDate.Month <= 9)
                    prestr += curDate.Month.ToString();
                else if (curDate.Month == 10)
                    prestr += "0";
                else if (curDate.Month == 11)
                    prestr += "A";
                else if (curDate.Month == 12)
                    prestr += "B";

                bool addflag = false;
                string custSn = "";

                try
                {
                    SqlTransactionManager.Begin();
                    lock (_syncRoot_GetSeq)
                    {
                        //从NumControl中获取流水号
                        //GetMaxNumber
                        INumControlRepository numControl = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                        //maxnum = numControl.GetMaxNumber("CPQSNO", prestr + "{0}");
                        //var maxObj = numControl.GetMaxNumberObj("CPQSNO", prestr + "{0}");

                        string maxnum = "";
                        var maxObj = numControl.GetMaxValue("SkodaSN", prestr);
                        //檢查有沒有lock index, 沒有lock index, 改變查詢條件
                        if (maxObj == null)
                        {
                            //lock NoType='CPQSNO' and NoName='Lock'
                            var data = numControl.GetMaxValue("SkodaSN", "Lock");
                            maxObj = numControl.GetMaxValue("SkodaSN", prestr);
                        }
                        if (maxObj != null)
                            maxnum = maxObj.Value;



                        if (string.IsNullOrEmpty(maxnum))
                        {
                            maxnum = "000000";    //起始值:000000
                            addflag = true;
                        }
                        else
                        {
                            //maxnum="CNU248000Y";
                            string temstr = "000000"; //起始值:000000

                            string numstr = maxnum.Substring(maxnum.Length - 6);
                            temstr = numstr;

                            if (numstr.ToUpper() == "999999")
                            {
                                FisException fe = new FisException("CHK867", new string[] { });   //流水号已满!
                                throw fe;
                            }

                            maxnum = GetSN(temstr);
                        }

                        custSn = prestr + maxnum.ToUpper();


                        // 自己管理事务开始
                        IUnitOfWork uof = new UnitOfWork();//使用自己的UnitOfWork

                        NumControl item = null;// new NumControl();

                        if (addflag)
                        {
                            item = new NumControl();
                            item.NOType = "SkodaSN";
                            item.Value = custSn;
                            item.NOName = prestr;
                            item.Customer = this.Customer;
                        }
                        else
                        {
                            item = maxObj;
                            item.Value = custSn;
                        }

                        //numControl.SaveMaxNumber(item, addflag, prestr + "{0}");
                        numControl.SaveMaxNumber(item, addflag);
                        customSN = custSn;
                        if (product != null)
                        {
                            product.CUSTSN = custSn;
                            productRep.Update(product, uof);
                        }
                        else if (mb != null)
                        {
                            mb.CustSn = custSn;
                            mbRep.Update(mb, uof);
                        }
                        uof.Commit();  //立即提交UnitOfWork更新NumControl里面的最大值

                        // [Customer SN Print]保存结果:增加更新[CustomerSN_Qty]. CustomerSN_Qty栏位
                        //UPDATE [HPIMES].[dbo].[MO]
                        //SET [CustomerSN_Qty] =[ CustomerSN_Qty]+1
                        //From Product a,MO b  WHERE a.MO=b.MO and a.ProductID=ProductID#
                        if (product != null)
                        {
                            IMORepository moRepository = RepositoryFactory.GetInstance().GetRepository<IMORepository, MO>();
                            moRepository.UpdateMoForIncreaseCustomerSnQty(product.ProId, 1);
                        }
                    }
                    SqlTransactionManager.Commit();//提交事物,释放行级更新锁

                }
                catch (Exception)
                {
                    SqlTransactionManager.Rollback();
                    throw;
                }
                finally
                {
                    SqlTransactionManager.Dispose();
                    SqlTransactionManager.End();
                }
                #endregion
            }

            session.AddValue(Session.SessionKeys.CustSN, customSN);
            if (product != null)
            {
                session.AddValue(Session.SessionKeys.PrintLogName, product.Customer + "SNO");
                session.AddValue(Session.SessionKeys.PrintLogBegNo, product.CUSTSN);
                session.AddValue(Session.SessionKeys.PrintLogEndNo, product.CUSTSN);
                session.AddValue(Session.SessionKeys.PrintLogDescr, product.ProId);
            }
            else
            {
                session.AddValue(Session.SessionKeys.PrintLogName, this.Customer + "SNO");
                session.AddValue(Session.SessionKeys.PrintLogBegNo, customSN);
                session.AddValue(Session.SessionKeys.PrintLogEndNo, customSN);
                session.AddValue(Session.SessionKeys.PrintLogDescr, family);
            }

            return base.DoExecute(executionContext);
        }
Example #22
0
        /// <summary>
        /// 增加一条ConstValue的记录数据(update/insert)
        /// </summary>
        /// <param name="obj">增加ConstValueInfo结构</param>
        public void AddConstValue(ConstValueInfo obj)
        {
            try
            {
                IPartRepository itemRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();

                itemRepository.AddConstValue(obj);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #23
0
        /// <summary>
        /// 产生Asset SN 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) 
        {
            var currenProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            string customerSN = (string)CurrentSession.GetValue(Session.SessionKeys.CustSN);

            string custNum = "";
            string cust = currenProduct.ModelObj.GetAttribute("Cust");
            //if(string.IsNullOrEmpty(cust)){
            //    return base.DoExecute(executionContext);
            //}

            IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IList<AssetRangeInfo> assetSNRange = ipartRepository.GetAssetRangesByCode(cust);

            if (assetSNRange.Count == 0)
            {
                List<string> errpara = new List<string>();

                errpara.Add(customerSN);

                throw new FisException("CHK200", errpara);
            }

            AssetRangeInfo assetRange = null;
            foreach (AssetRangeInfo tempAssetRange in assetSNRange)
            {
                assetRange = tempAssetRange;
            }

            try         //2012-7-19
            {
                SqlTransactionManager.Begin();  //2012-7-19
                lock (_syncRoot_GetSeq)         //2012-7-19
                {
                    INumControlRepository numCtrlRepository = RepositoryFactory.GetInstance().GetRepository<INumControlRepository, NumControl>();
                    //ITC-1360-0495, Jessica Liu, 2012-2-22
                    //string largestCustNum = numCtrlRepository.GetMaxNumber("AST", cust + "{0}");
                    string largestCustNum = numCtrlRepository.GetMaxAssetNumber("AST", cust, "HP");

                    if (string.IsNullOrEmpty(largestCustNum))
                    {
                        custNum = assetRange.begin;

                        NumControl item = new NumControl(0, "AST", assetRange.code, custNum, "HP");
                        
                        //numCtrlRepository.SaveMaxNumber(item, true, string.Empty);
                        numCtrlRepository.SaveMaxAssetNumber(item, true);

                        //2012-7-19
                        SqlTransactionManager.Commit();
                    }
                    else
                    {
                        string numInLargestCustNum = "";
                        string numInEnd = "";
                        string preString = "";
                        string preEndString = "";
                        bool bHasNumber = false;

                        string s = largestCustNum;
                        int s_idx = 0;
                        bool bFoundDigit = false;
                        for (int i = 0; i < s.Length; i++)
                        {
                            if (s[i] < '0' || s[i] > '9')
                            {
                                bFoundDigit = false;
                            }
                            else if (bFoundDigit == false)
                            {
                                bFoundDigit = true;
                                s_idx = i;
                            }
                        }

                        if (bFoundDigit == true)
                        {
                            numInLargestCustNum = s.Substring(s_idx);
                            preString = s.Substring(0, s_idx);   
                            bHasNumber = true;
                        }

                        string t = assetRange.end;
                        int t_idx = 0;
                        bool bFoundDigit2 = false;
                        for (int i = 0; i < t.Length; i++)
                        {
                            if (t[i] < '0' || t[i] > '9')
                            {
                                bFoundDigit2 = false;
                            }
                            else if (bFoundDigit2 == false)
                            {
                                bFoundDigit2 = true;
                                t_idx = i;
                            }
                        }

                        if ((bFoundDigit2 == true) && (bHasNumber == true))
                        {
                            numInEnd = t.Substring(t_idx);
                            preEndString = t.Substring(0, t_idx);
                        }
                        else
                        {
                            bHasNumber = false;
                        }

                        if (bHasNumber == true)
                        {
                            if (preString == preEndString)
                            {
                                long largestNum = long.Parse(numInLargestCustNum);
                                long end = long.Parse(numInEnd);

                                if (largestNum >= end)
                                {
                                    List<string> errpara = new List<string>();

                                    errpara.Add(customerSN);

                                    throw new FisException("CHK201", errpara);
                                }
                                else
                                {
                                    largestNum++;
                                    //custNum = preString + largestNum.ToString();
                                    int largestNumCount = numInLargestCustNum.Length;
                                    string strNewLargestCustNum = largestNum.ToString();
                                    int newlargestNumCount = strNewLargestCustNum.Length;
                                    string strPreZero = "";
                                    if (numInLargestCustNum.Substring(0, 1) == "0")
                                    {
                                        for (int i = 0; i < (largestNumCount - newlargestNumCount); i++)
                                        {
                                            strPreZero += "0";
                                        }

                                        strNewLargestCustNum = strPreZero + strNewLargestCustNum;
                                    }
                                    custNum = preString + strNewLargestCustNum;

                                    NumControl item = new NumControl(0, "AST", assetRange.code, custNum, "HP");
                                    //numCtrlRepository.SaveMaxNumber(item, false, string.Empty);
                                    numCtrlRepository.SaveMaxAssetNumber(item, false);

                                    //2012-7-19
                                    SqlTransactionManager.Commit();
                                }
                            }
                            else
                            {
                                List<string> errpara = new List<string>();

                                errpara.Add(customerSN);

                                throw new FisException("CHK201", errpara);
                            }                        
                        }
                        else
                        {
                            List<string> errpara = new List<string>();

                            errpara.Add(customerSN);

                            throw new FisException("CHK201", errpara);
                        }                    
                    }
                }
            }
            catch (Exception e)     //2012-7-19
            {
                SqlTransactionManager.Rollback();
                throw e;
            }
            finally                 //2012-7-19
            {
                SqlTransactionManager.Dispose();
                SqlTransactionManager.End();
            }
            /*
            else
            {
                long largestNum = long.Parse(largestCustNum);
                long end = long.Parse(assetRange.end);

                if (largestNum == end)
                {
                    List<string> errpara = new List<string>();

                    errpara.Add(customerSN);

                    throw new FisException("CHK201", errpara);
                }

                largestNum++;
                custNum = largestNum.ToString();

                NumControl item = new NumControl(0, "AST", assetRange.code, custNum, "HP");
                //numCtrlRepository.SaveMaxNumber(item, false, string.Empty);
                numCtrlRepository.SaveMaxAssetNumber(item, false);
            } 
            */

            /* 2012-7-14, Jessica Liu, for mantis
            if (cust == "SCUSTA-1")
            {
                custNum = "000" + custNum.Trim() + "00";
            }
            else if (cust == "CUSTW-1")
            {
                custNum = custNum.Trim() + " HQ P47";
            }
            else if (cust == "CUSTW-2")
            {
                custNum = custNum.Trim() + " HQ P49";
            }
            */
            if (cust == "SCUSTA-1")
            {
                custNum = "000" + custNum.Trim() + "00";
            }
            ConstValueInfo info = new ConstValueInfo();
            info.type = "AST";
            info.name = cust;
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
            if (retList != null && retList.Count != 0)
            {
                if (string.IsNullOrEmpty(retList[0].value) == false)
                {
                    custNum += retList[0].value;
                }
            }

            CurrentSession.AddValue("AssetSN", custNum);

            return base.DoExecute(executionContext);
        }
 protected void btnSave_ServerClick(Object sender, EventArgs e)
 {
     ConstValueInfo item = new ConstValueInfo();
     
     try
     {
         switch (labelList)
         {
             case "Model":
                 UpdateAndInsertLabelTypetoConstValue();
                 iLabelTypeRuleMaintain.UpdateAndInsertModelConstValue(labelTypeName, LabelType, userName);
                 this.hidLabelType.Value = LabelType;
                 this.updatePanel1.Update();
                 break;
             case "Delivery":
                 UpdateAndInsertLabelTypetoConstValue();
                 iLabelTypeRuleMaintain.UpdateAndInsertDeliveryConstValue(labelTypeName, LabelType, userName);
                 this.hidLabelType.Value = LabelType;
                 this.updatePanel1.Update();
                 break;
             case "PartInfo":
                 if (BomLevel != "")
                 {
                     UpdateAndInsertLabelTypetoConstValue();
                     iLabelTypeRuleMaintain.UpdateAndInsertPartConstValue(labelTypeName, Convert.ToInt32(BomLevel), LabelType, userName);
                     this.hidLabelType.Value = LabelType;
                     this.updatePanel1.Update();
                 }
                 else
                 {
                     showErrorMessage("沒有傳入BomLevel...");
                 }
                 break;
             default:
                 break;
         }
     }
     catch (FisException ex)
     {
         showErrorMessage(ex.mErrmsg);
         return;
     }
     catch (Exception ex)
     {
         showErrorMessage(ex.Message);
         return;
     }
     ShowList();
     this.updatePanel.Update();
     ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "AddUpdateComplete('" + this.hidID.Value + "');DealHideWait();", true);
 }
Example #25
0
        /// <summary>
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Pallet CurrentPallet = (Pallet)CurrentSession.GetValue(Session.SessionKeys.Pallet);
            string palletType = (string)CurrentSession.GetValue("PalletType");
            IPalletRepository palletRep = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();

            decimal standWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.StandardWeight);
            decimal acturalWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight); 
            WhPltWeightInfo setValue = new WhPltWeightInfo() ; 
            WhPltWeightInfo condition = new WhPltWeightInfo();

            //4.Update WH_PltWeight
            //ActualPltWeight – 实际重量 (From UI)
           //PltWeightInaccuracy – ABS((实际重量 – 标准重量(ForecasetPltWeight))/ 实际重量)

            setValue.actualPltWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);
            setValue.pltWeightInaccuracy = Math.Abs(acturalWeight - standWeight) / acturalWeight;

            condition.plt = CurrentPallet.PalletNo;
            palletRep.UpdateWhPltWeight(setValue, condition);

            //5.Update Pallet
            //Weight – 实际重量
            //Weight_L – (实际重量 – 栈板重量)
            //Station – Pallet Weight 站号
            
            //栈板重量是根据用户选择的[Pallet Type] 查询IMES_GetData..ConstValue 表,得到记录的Value 字段值
            //Condition: IMES_GetData..ConstValue.Name = @PalletType and [Type] = 'PT'
            //当用户没有选择[Pallet Type] 的时候,栈板重量视为0.0
            //Remark: @PalletType – UI 上选择的Pallet Type
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            
            ConstValueInfo info = new ConstValueInfo();
            info.type ="PT";
            info.name = palletType;
            
            decimal pweight =0.0m;
            if (CurrentSession.GetValue("Site") != null && CurrentSession.GetValue("Site").ToString() == "ICC")
            {
                pweight = Convert.ToDecimal(CurrentSession.GetValue(Session.SessionKeys.PalletWeight));
            }
            else
            {
                if (!string.IsNullOrEmpty(palletType))
                {
                    IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
                    pweight = Convert.ToDecimal(retList[0].value);
                }
            }

            if (NeedUpdatePltWeight(CurrentPallet, acturalWeight))
            {
                CurrentPallet.Weight = acturalWeight;
                CurrentPallet.Weight_L = acturalWeight - pweight;
                CurrentPallet.Station = this.Station;
                CurrentPallet.Editor = this.Editor;
                CurrentPallet.Udt = DateTime.Now;

                IPalletRepository PalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
                PalletRepository.Update(CurrentPallet, CurrentSession.UnitOfWork);

                //Vincent: Add or Update PalletAttr.Name="SendStatus", PalletAttr.Value=""
                PalletRepository.UpdateAttrDefered(CurrentSession.UnitOfWork, CurrentPallet.PalletNo, "SendStatus", "", "", this.Editor);
            }
            //7.Insert WH_PLTLog
            WhPltLogInfo newLog = new WhPltLogInfo();
            newLog.plt = CurrentPallet.PalletNo;
            newLog.editor = this.Editor;
            newLog.wc = "99";
            newLog.cdt = DateTime.Now;

            palletRep.InsertWhPltLogDefered(CurrentSession.UnitOfWork, newLog);

            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            IPalletRepository palletRep = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            IDeliveryRepository deliveryRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
            IPalletWeightRepository pltWeightRep = RepositoryFactory.GetInstance().GetRepository<IPalletWeightRepository, PalletWeight>();

            Pallet CurrentPallet = (Pallet)CurrentSession.GetValue(Session.SessionKeys.Pallet);

            //为了支持FRU 出货,当Pallet 结合的Delivery 的Model 是PF 开头时,
            //不需要录入Customer S/N 和Check Customer S/N
            bool fruFLag = false;
            IList<DeliveryPallet> dnList = palletRep.GetDeliveryPallet(CurrentPallet.PalletNo);
            if (dnList.Count > 0)
            {
                Delivery dn = deliveryRep.Find(dnList[0].DeliveryID);
                string modelstr = dn.ModelName;
                if (!string.IsNullOrEmpty(modelstr) && modelstr.Length >= 2)
                {
                    if (modelstr.Substring(0, 2) == "PF")
                    {
                        fruFLag = true;
                    }
                }

            }
            CurrentSession.AddValue("FRUFlag", fruFLag);

            //基于UI 选择的Pallet Type 查询ConstValue 表得到Value 值
            string palletType = (string)CurrentSession.GetValue("PalletType");
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            ConstValueInfo info = new ConstValueInfo();
            info.type = "PT";
            info.name = palletType;
            IList<ConstValueInfo> retList = partRepository.GetConstValueInfoList(info);
            decimal palletWeight = 0;
            palletWeight = Convert.ToDecimal(retList[0].value);

            //a.	Get Pallet Standard Weight
            //SELECT @ProductsWeight = AVG(UnitWeight) FROM Product nolock WHERE PalletNo = @PalletNo AND ISNULL(UnitWeight, 0.000) <> 0.000
            int count = 0;
            decimal productWeight = 0;
            IProductRepository productRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IList<IProduct> productList = productRep.GetProductByPalletNo(CurrentPallet.PalletNo);
            foreach (Product node in productList)
            {
                if (node.UnitWeight != 0)
                {
                    count++;
                    productWeight = productWeight + node.UnitWeight;
                }
            }

            if (count > 0)
            {
                productWeight = productWeight / count;
            }

            //SELECT @PalletQty = SUM(a.DeliveryQty * CONVERT(INT, CONVERT(Float, ISNULL(b.InfoValue, ''))))
	        //FROM Delivery_Pallet a (NOLOCK) LEFT JOIN DeliveryInfo b (NOLOCK)
		    //ON a.DeliveryNo = b.DeliveryNo AND b.InfoType = 'CQty'
	        //WHERE a.PalletNo = @PalletNo
	        //GROUP BY a.PalletNo
            int PalletQty =0;
            IList<DeliveryPallet> dpList = palletRep.GetDeliveryPallet(CurrentPallet.PalletNo);
            foreach (var node in dpList)
            {
                var dev = deliveryRep.Find(node.DeliveryID);
                string cQtyStr = (string)dev.GetExtendedProperty("CQty");
                int cqty;
                if (string.IsNullOrEmpty(cQtyStr))
                {
                    cqty = 0;
                }
                else
                {
                    decimal tmp = Convert.ToDecimal(cQtyStr);
                    cqty = Convert.ToInt32(tmp);
                }

                PalletQty = PalletQty + node.DeliveryQty * cqty;
            }

            //SELECT @ProductsWeight = @ProductsWeight * @PalletQty
            productWeight = productWeight * PalletQty;

            CurrentSession.AddValue("ProductWeight", productWeight);

            decimal tolerance = 0; 
            IList<string> valueList = new List<string>();
            valueList = partRepository.GetValueFromSysSettingByName("PltWeightTolerance");
            if (valueList.Count == 0)
            {
                tolerance = 2;
            }
            else
            {
                tolerance =Convert.ToDecimal(valueList[0]);
            }

            CurrentSession.AddValue(Session.SessionKeys.Tolerance, tolerance);
            
            decimal standWeight = productWeight + palletWeight;
            if (fruFLag)
            {
                standWeight = 0;
            }

            CurrentSession.AddValue(Session.SessionKeys.StandardWeight, standWeight);
            CurrentSession.AddValue("PalletWeight", palletWeight);

            return base.DoExecute(executionContext);
        }
Example #27
0
    protected void btnDelete_ServerClick(Object sender, EventArgs e)
    {
        //string oldCode = this.dOldCode.Value.Trim();
        //string type = this.cmbConstValueType.InnerDropDownList.SelectedItem.Text;
        string type = selecttype.Value;
        try
        {
            ConstValueInfo item = new ConstValueInfo();
            if (this.hidSelectId.Value != "")
            {
                string SelectID = this.hidSelectId.Value.Substring(0, this.hidSelectId.Value.Length - 1);
                IList<string> idList = SelectID.Split(',').Where(x => x != "").ToList();
                iConstValueMaintain.DeleteConstValue(idList);
            }
            else
            {
                item.name = this.dName.Text.Trim(); //oldCode;
                item.type = type;
                iConstValueMaintain.DeleteConstValue(item);
            }
        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }

        ShowListByType();
        ShowTypeDescriptionByType();
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();DealHideWait();", true);
    }
Example #28
0
        /// <summary>
        /// Generate ATSN7 label
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Session session = CurrentSession;
            ActivityCommonImpl utl = ActivityCommonImpl.Instance;
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            var partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IProduct curProduct = utl.IsNull<IProduct>(session, Session.SessionKeys.Product);
           // Product curProduct = (Product)session.GetValue(Session.SessionKeys.Product);
           // IList<string> pnList = session.GetValue("PnListOfATSN7") as IList<string>;
            IList<string> pnList = utl.IsNull<IList<string>>(session, "PnListOfATSN7");
            bool bCDSI = false;
            if (session.GetValue("bCDSI") != null)
            {
                bCDSI = (bool)session.GetValue("bCDSI");
            }

            if (pnList.Count == 0)
            {
                throw new FisException("CQCHK1089", new List<string> { curProduct.ProId,"BOM", "ATSN7" });               
            }

            if (bCDSI == true)
            {
                string AST1 = "";
                CdsiastInfo cdi = new CdsiastInfo();
                cdi.tp = "ASSET_TAG";
                cdi.snoId = curProduct.ProId;
                IList<CdsiastInfo> cdsiastInfoList = productRepository.GetCdsiastInfoList(cdi);
                if (cdsiastInfoList != null && cdsiastInfoList.Count > 0)
                {
                    AST1 = cdsiastInfoList[0].sno;
                }

                string AST2 = "";
                CdsiastInfo cdi2 = new CdsiastInfo();
                cdi2.tp = "ASSET_TAG2";
                cdi2.snoId = curProduct.ProId;
                IList<CdsiastInfo> cdsiastInfoList2 = productRepository.GetCdsiastInfoList(cdi2);
                if (cdsiastInfoList2 != null && cdsiastInfoList2.Count > 0)
                {
                    AST2 = cdsiastInfoList2[0].sno;
                }

                if ((AST1 == "") && (AST2 == ""))
                {
                    List<string> errpara = new List<string>();
                    throw new FisException("CHK203", errpara);
                }
                else
                {
                    //不为空则存入
                    //保存product和Asset SN的绑定关系
                    foreach (string tmp in pnList)
                    {
                        if (AST1 != "")
                        {
                            IProductPart assetTag1 = new ProductPart();
                            assetTag1.ProductID = curProduct.ProId;
                            assetTag1.PartID = tmp;
                            assetTag1.PartType = "ATSN7";
                            assetTag1.Iecpn = "";
                            assetTag1.CustomerPn = "";
                            assetTag1.PartSn = AST1;
                            assetTag1.Station = Station;
                            assetTag1.Editor = Editor;
                            assetTag1.Cdt = DateTime.Now;
                            assetTag1.Udt = DateTime.Now;
                            assetTag1.BomNodeType = "AT";
                            assetTag1.CheckItemType = "CDSI";

                            curProduct.AddPart(assetTag1);
                            productRepository.Update(curProduct,session.UnitOfWork);
                        }

                        if (AST2 != "")
                        {
                            IProductPart assetTag2 = new ProductPart();
                            assetTag2.ProductID = curProduct.ProId;
                            assetTag2.PartID = tmp;
                            assetTag2.PartType = "ATSN7";
                            assetTag2.Iecpn = "";
                            assetTag2.CustomerPn = "";
                            assetTag2.PartSn = AST2;
                            assetTag2.Station = Station;
                            assetTag2.Editor = Editor;
                            assetTag2.Cdt = DateTime.Now;
                            assetTag2.Udt = DateTime.Now;
                            assetTag2.BomNodeType = "AT";
                            assetTag2.CheckItemType = "CDSI";

                            curProduct.AddPart(assetTag2);
                            productRepository.Update(curProduct, session.UnitOfWork);
                        }
                    }
                }
            }
            else    //Not CDSI
            {                
                #region 產生ATSN7 需要
                    string cust = curProduct.ModelObj.GetAttribute("Cust");
                    string custNum = ActivityCommonImpl.Instance.AstNum.CheckAndGetUsedAst(session, curProduct.ProId, cust, "AST", this.Station, this.Editor);
                    if (custNum == null)
                    {
                        custNum = ActivityCommonImpl.Instance.AstNum.CheckAndSetReleaseAstNumber(curProduct.ProId, cust, "AST", this.Station, this.Editor);
                    }
                    if (string.IsNullOrEmpty(custNum))
                    {
                        custNum = GenerateCodeNew(cust);

                        //Update custNum
                        //if (cust == "SCUSTA-1")
                        //{
                        //    custNum = "000" + custNum.Trim() + "00";
                        //}
                        /*
                        else if (cust == "CUSTW-1")
                        {
                            custNum = custNum.Trim() + " HQ P47";
                        }
                        else if (cust == "CUSTW-2")
                        {
                            custNum = custNum.Trim() + " HQ P49";
                        }
                         */

                        // Checksum
                        custNum = ActivityCommonImpl.Instance.GetAstChecksum(cust, custNum);

                        custNum = ActivityCommonImpl.Instance.CheckAndAddPreFixDateAst(cust, custNum);

                        ConstValueInfo cond = new ConstValueInfo();
                        cond.type = "AST";
                        cond.name = cust;
                        IList<ConstValueInfo> valList = partRepository.GetConstValueInfoList(cond);
                        if (valList.Count > 0 && !String.IsNullOrEmpty(valList[0].value))
                        {
                            custNum += valList[0].value.Trim();
                        }
                        ActivityCommonImpl.Instance.AstNum.InsertCombinedAstNumber(curProduct.ProId, cust, "AST", custNum, this.Station, this.Editor);
                    }
                    //保存product和Asset SN的绑定关系
                    foreach (string tmp in pnList)
                    {
                        IProductPart assetTag = new ProductPart();
                        assetTag.ProductID = curProduct.ProId;
                        assetTag.PartID = tmp;
                        assetTag.PartType = "ATSN7";
                        assetTag.Iecpn = "";
                        assetTag.CustomerPn = "";
                        assetTag.PartSn = custNum;
                        assetTag.Station = Station;
                        assetTag.Editor = Editor;
                        assetTag.Cdt = DateTime.Now;
                        assetTag.Udt = DateTime.Now;
                        assetTag.BomNodeType = "AT";
                        assetTag.CheckItemType = "GenASTSN";
                        curProduct.AddPart(assetTag);
                        productRepository.Update(curProduct, session.UnitOfWork);
                    }
                    #endregion              
            }

            return base.DoExecute(executionContext);
        }
Example #29
0
 public IList<ConstValueInfo> GetExList()
 {
     IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
     ConstValueInfo info = new ConstValueInfo();
     info.type = "FaException";
     IList<ConstValueInfo> list = new List<ConstValueInfo>();
     list = partRepository.GetConstValueInfoList(info);
     return list;
 }
 protected void btnDelete_ServerClick(Object sender, EventArgs e)
 {
     try
     {
         ConstValueInfo item = new ConstValueInfo();
         item.id = Convert.ToInt32(this.hidID.Value);
         iConstValue.DeleteConstValue(item);
     }
     catch (FisException ex)
     {
         showErrorMessage(ex.mErrmsg);
         return;
     }
     catch (Exception ex)
     {
         showErrorMessage(ex.Message);
         return;
     }
     ShowList();
     this.updatePanel.Update();
     ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "saveUpdate", "DeleteComplete();DealHideWait();", true);
 }