Beispiel #1
0
        public void Delete(string idFamilyInfo, string editor)
        {
            string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            logger.DebugFormat("BEGIN: {0}(idFamilyInfo={1})", methodName, idFamilyInfo);
            try
            {
                IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                FamilyInfoDef cond = new FamilyInfoDef();
                cond.id = int.Parse(idFamilyInfo);

                IUnitOfWork uow = new UnitOfWork();

                familyRep.RemoveFamilyInfoDefered(uow, cond);

                uow.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.DebugFormat("END: {0}()", methodName);
            }
        }
Beispiel #2
0
 public IList<FamilyInfoDef> GetAllFamilyInfo()
 {
     IList<FamilyInfoDef> FamilyInfoLst = new List<FamilyInfoDef>();
     FamilyInfoDef NewFamilyInfoItem = new FamilyInfoDef(); 
     try 
     {
         FamilyInfoLst = (IList<FamilyInfoDef>)itemRepository.GetExistFamilyInfo(NewFamilyInfoItem);
     }
     catch(FisException fe)
     {
         logger.Error(fe.Message);
         throw fe;
     }
     catch(Exception e)
     {
         logger.Error(e.Message);
         throw e;
     }
     return FamilyInfoLst;
 }
Beispiel #3
0
        public void DeleteSelectedFamilyInfo(FamilyInfoDef FamilyInfoItem)
        {
              
            try 
            {
                itemRepository.RemoveFamilyInfo(FamilyInfoItem);
            }
            catch (FisException fe)
            {
                logger.Error(fe.Message);
                throw fe;
            }

            catch(Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            return ;
        }
Beispiel #4
0
 public void UpdateSelectedFamilyInfo(FamilyInfoDef FamilyInfoItem)
 {
     try 
     {
         FamilyInfoDef SetFamilyInfoItem =new FamilyInfoDef();
         FamilyInfoDef ConFamilyInfoItem = new FamilyInfoDef();
         SetFamilyInfoItem.family = FamilyInfoItem.family;
         SetFamilyInfoItem.name = FamilyInfoItem.name;
         SetFamilyInfoItem.value = FamilyInfoItem.value;
         SetFamilyInfoItem.descr = FamilyInfoItem.descr;
         SetFamilyInfoItem.editor = FamilyInfoItem.editor;
         SetFamilyInfoItem.udt = DateTime.Now;
         ConFamilyInfoItem.id = FamilyInfoItem.id;
         itemRepository.UpdateFamilyInfo(SetFamilyInfoItem, ConFamilyInfoItem);
     }
     catch(Exception e)
     {
         logger.Error(e.Message);
         throw e;
     }
     return ;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
          
        {
     //   cmbPdLine.InnerDropDownList.SelectedIndexChanged += new EventHandler(cmbPdLine_Selected);
        this.cmbFamily.InnerDropDownList.SelectedIndexChanged += new EventHandler(cmbFamily_Selected);
        cmbPdLine.InnerDropDownList.AutoPostBack = true;
        userId = Master.userInfo.UserId;
        customer = Master.userInfo.Customer;  
            if (!Page.IsPostBack)
            {
              
                InitLabel();
            
                this.cmbPdLine.Station = Request["Station"];
                this.cmbPdLine.Customer = customer;
                station = Request["Station"];
                pCode = Request["PCode"];
                cmbFamily.Service = "016";
				AccountId = Master.userInfo.AccountId.ToString();
                Login = Master.userInfo.Login;
                FamilyInfoDef def = new FamilyInfoDef();
                def.name = "Category";
                def.value = Request["FamilyCategory"];
                cmbFamily.FamilyInfoDefObj = def;
       
            }
        }
        catch (FisException ee)
        {
            writeToAlertMessage(ee.mErrmsg);
        }
        catch (Exception ex)
        {
            writeToAlertMessage(ex.Message);
        }
    }
Beispiel #6
0
        /// <summary>
        /// 向QCStatus寫入記錄
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
           
            IList<string> setList =new List<string>();
            string paqcStation = "PAQCStation";
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);

            #region Check PAQC Station Rule  by FamilyInfo.Category or BSam Model
            if ((string)CurrentSession.GetValue(ExtendSession.SessionKeys.IsBSamModel) == "Y")
            {
                paqcStation = "BSam" + paqcStation;
            }
            else
            {
                string family = product.Family;
                FamilyInfoDef fcond = new FamilyInfoDef();
                fcond.family = family;
                fcond.name = "Category";
                IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
                if (famValList.Count > 0)
                {
                    paqcStation = famValList[0].value.Trim() + paqcStation;
                }
            }
            #endregion

            setList = ipartRepository.GetValueFromSysSettingByName(paqcStation);
      //     setList= ipartRepository.GetValueFromSysSettingByName("PAQCStation");;

            IList<string> siteList = ipartRepository.GetValueFromSysSettingByName("Site");
            string site = (siteList != null && siteList.Count > 0 && !string.IsNullOrEmpty(siteList[0])) ? siteList[0].Trim() : "IPC";
            
            try
            {
              
                if (setList.Count > 0 && setList[0].Trim() == CurrentSession.Station.Trim())
                {
                    //IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
                    string writeStatus;
                    string remark = "";
                    int qcRatio = 0;
                    string lastQCStatus = "";                    
                    //string specialRuleQCStatus = "";
                    bool isQC = false;
                    CurrentSession.AddValue(Session.SessionKeys.QCStatus, false);
                    if (site != "ICC")
                    {
                        isQC = CalQCStatus(site, product, out qcRatio, out lastQCStatus);
                        if (isQC)
                        {
                            if (string.IsNullOrEmpty(lastQCStatus))
                            {
                                writeStatus = this.QCStatus;
                            }
                            else
                            {
                                writeStatus = lastQCStatus;
                            }

                            remark = this.Remark.Trim();
                        }
                        ////else if( site=="ICC" && qcRatio>0  && CalQCStatusForICC(product)){
                        //else if (site == "ICC" && qcRatio > 0 && CalQCStatusForICCSpecialRule(product, out specialRuleQCStatus))
                        //{
                        //    //writeStatus = string.IsNullOrEmpty(this.QCSpecialStatus)?this.QCStatus: this.QCSpecialStatus ;
                        //    writeStatus = specialRuleQCStatus;
                        //    remark = this.Remark.Trim();
                        //    isQC = true;
                        //}
                        else
                        {
                            writeStatus = this.NotQCStatus;
                        }
                    }
                    else  //for ICC Site
                    {
                        bool bByModel=false;
                        bool bByFamily =false;
                       isQC= CheckReworkQCStatusAndRatio(product, out qcRatio, out lastQCStatus, out bByModel, out bByFamily);
                       if (isQC)
                       {
                           if (string.IsNullOrEmpty(lastQCStatus))
                           {
                               writeStatus = this.QCStatus;
                           }
                           else
                           {
                               writeStatus = lastQCStatus;
                           }
                           remark = this.Remark.Trim();
                       }
                       else if (qcRatio == 0) //禁止抽檢
                       {
                           isQC = false;
                           writeStatus = this.NotQCStatus;
                       }
                       else
                       {
                           isQC = CalQCStatusForICCSP(product, bByModel, bByFamily, qcRatio, out writeStatus);
                       }


                    }

                    CurrentSession.AddValue(Session.SessionKeys.QCStatus, isQC);

                  
                    ProductQCStatus status = new ProductQCStatus(-1,
                                                                                                product.ProId,
                                                                                                Type,
                                                                                                string.IsNullOrEmpty(this.Line) ? product.Status.Line : this.Line,
                                                                                                product.Model,
                                                                                                writeStatus,
                                                                                                Editor,
                                                                                                DateTime.Now,
                                                                                                DateTime.Now);
                    status.Remark = remark;
                    product.AddQCStatus(status);


                    if (!string.IsNullOrEmpty(ProductAttrName))
                    {
                        product.SetAttributeValue(ProductAttrName, writeStatus, Editor, this.Station, remark);
                    }
                    else if (!string.IsNullOrEmpty(Type))
                    {
                        product.SetAttributeValue(Type + "_QCStatus", writeStatus, Editor, this.Station, remark);
                    }
                   

                    if (IsWriteProductLog && isQC)
                    {
                        WriteProductLog(product);
                    }

                    IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                    prodRep.Update(product, CurrentSession.UnitOfWork);
                
                }
            }
             catch (FisException fe)
            {
                fe.stopWF = IsStopWF;
                throw fe;
              
            }
            return base.DoExecute(executionContext);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            decimal actualCartonWeight = (decimal) CurrentSession.GetValue(ExtendSession.SessionKeys.ActualCartonWeight);
            decimal acturalWeight=0;
           
            Carton carton = (Carton)CurrentSession.GetValue(Session.SessionKeys.Carton);
            Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IBOMRepository bomRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
            
           
            //滿箱
            if (carton.Status == CartonStatusEnum.Full)
            {
                acturalWeight = decimal.Round(actualCartonWeight/carton.Qty,2);
            }
            else //未滿箱
            {
                              
                //② 填充物重量=ConstValue.Value where Type='FillerWeight' and Name=Family
                IList<ConstValueInfo>  valueList=partRepository.GetConstValueListByType("FillerWeight");
                var fillWeightList = (from p in valueList
                                      where p.name == currentProduct.Family
                                      select p.value).ToList();
                if (fillWeightList.Count == 0)
                {
                    throw new FisException("CHK986", new string[] {"FillerWeight","ConstValue",currentProduct.Family} );
                }

                //④ PartNo=Model下面Tp=PL and UPPER(Descr) LIKE ‘%Carton%'的PartNo
                IHierarchicalBOM curBOM = bomRepository.GetHierarchicalBOMByModel(currentProduct.Model);
                if (curBOM == null)
                {
                    throw new FisException("CHK986", new string[] { "Model ", "BOM", currentProduct.Model });
                }
                IList<IBOMNode> bomNodeLst = curBOM.FirstLevelNodes;

                //var partList = (from p in bomNodeLst
                //                       where p.Part.BOMNodeType == "PL" && p.Part.Descr.ToUpper().IndexOf("CARTON") >= 0
                //                        select p.Part.PN).ToList();
                // Modify by Benson for  Chen, Li Request at 2013-04-18
                //Descr=BSAM Carton

                IList<string> partList=null;
                IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
                FamilyInfoDef fcond = new FamilyInfoDef();
                fcond.family = currentProduct.Family;
                fcond.name = "Category";
                IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
                if (famValList.Count > 0 && famValList[0].value == "Tablet")
                {
                     partList = (from p in bomNodeLst
                                 where p.Part.BOMNodeType == "PL" && p.Part.Descr.Trim() == "Tablet Carton"
                                    select p.Part.PN).ToList();

                    if (partList.Count == 0)
                    {
                        // throw new FisException("CHK986", new string[] { "TP=PL and  Upper(Descr) like '%CARTON%'", "BOM", currentProduct.Model });
                        throw new FisException("CHK986", new string[] { "TP=PL and  p.Part.Descr.Trim()=='Tablet Carton'", "BOM", currentProduct.Model });

                    }
                }
                else
                {
                     partList = (from p in bomNodeLst
                                    where p.Part.BOMNodeType == "PL" && p.Part.Descr.Trim() == "BSAM Carton"
                                    select p.Part.PN).ToList();

                    if (partList.Count == 0)
                    {
                        // throw new FisException("CHK986", new string[] { "TP=PL and  Upper(Descr) like '%CARTON%'", "BOM", currentProduct.Model });
                        throw new FisException("CHK986", new string[] { "TP=PL and  p.Part.Descr.Trim()=='BSAM Carton'", "BOM", currentProduct.Model });

                    }
                }
              

                string partNo = partList[0];

                //③ 外箱重量=ConstValue.Value where Type='CartonWeight' and Name=PartNo

                decimal fillWeight =   decimal.Parse(fillWeightList[0]) * (carton.FullQty - carton.Qty);

                IList<ConstValueInfo> valueList1 = partRepository.GetConstValueListByType("CartonWeight");
                var cartonWeightList = (from p in valueList1
                                                      where p.name == partNo
                                                     select p.value).ToList();
                if (cartonWeightList.Count == 0)
                {
                    throw new FisException("CHK986", new string[] { "CartonWeight","ConstValue", partNo });
                }

                decimal cartonWeight = (decimal.Parse(cartonWeightList[0]) * (carton.FullQty - carton.Qty)) / carton.FullQty;

                acturalWeight = decimal.Round( (actualCartonWeight - fillWeight - cartonWeight) / carton.Qty,2);
            }

            CurrentSession.AddValue(Session.SessionKeys.ActuralWeight, acturalWeight);
            return base.DoExecute(executionContext);
          
        }
Beispiel #8
0
        /// <summary>
        /// 根据母版号码和数量生成子板号码
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            //string ss = this.InfoName;
            string FamilyInfoName = InfoName;
            string FamilyInfoValue = InfoDefaultValue;
            string currentFamily = "";
            //bool IsGenMAC = true;
            try
            {
                switch (InputType)
                {
                    case InputTypeEnum.MB:
                        //IPartRepository iPartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository>();
                        MB currentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);
                        if (currentMB == null)
                        {
                            throw new FisException("SFC001", new string[] { "MB" });
                        }
                        //string PCBNo = currentMB.PCBModelID.ToString();
                        //IPart currentPart = iPartRepository.GetPartByPartNo(PCBNo);
                        //currentFamily = currentPart.Descr.ToString();
                        currentFamily = currentMB.Family;
                        if (string.IsNullOrEmpty(currentFamily))
                        {
                            throw new FisException("SFC001", new string[] { "Family" });
                        }
                        break;
                    case InputTypeEnum.Product:
                        //IModelRepository iModelRepository = RepositoryFactory.GetInstance().GetRepository<IModelRepository>();
                        Product currentProduct = ((Product)CurrentSession.GetValue(Session.SessionKeys.Product));
                        if (currentProduct == null)
                        {
                            throw new FisException("SFC002", new string[] { "Product" });
                        }
                        //string currentModel = currentProduct.Model;
                        //Model Model = iModelRepository.Find(currentModel);
                        //currentFamily = Model.FamilyName.ToString();
                        currentFamily = currentProduct.Family;
                        if (string.IsNullOrEmpty(currentFamily))
                        {
                            throw new FisException("SFC002", new string[] { "Family" });
                        }
                        break;
                    default:
                        break;
                }
                IFamilyRepository iFamilyRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
                FamilyInfoDef condition = new FamilyInfoDef();
                condition.name = FamilyInfoName;
                condition.family = currentFamily;

                IList<FamilyInfoDef> FamilyInfoLst = iFamilyRepository.GetExistFamilyInfo(condition);
                if (FamilyInfoLst == null || FamilyInfoLst.Count == 0)
                {
                    throw new FisException("CHK1024", new string[] { });
                }
                foreach (FamilyInfoDef item in FamilyInfoLst)
                {
                    FamilyInfoValue = item.value;
                }
                
                CurrentSession.AddValue(FamilyInfoName, FamilyInfoValue);
                //IFamilyRepository iFamilyRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();
                //IList<FamilyInfoDef> FamilyInfoLst  = iFamilyRepository.GeFamilyInfoByName(currentFamily, FamilyInfoName);
                

            }
            catch (FisException fe)
            {
                throw fe;
            }
            
            return base.DoExecute(executionContext);
        }
Beispiel #9
0
        private bool checkIsTablet(IMES.FisObject.FA.Product.IProduct product)
        {
            IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
            FamilyInfoDef fcond = new FamilyInfoDef();
            fcond.family = product.Family;
            fcond.name = "Category";
            IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
            return (famValList.Count > 0 && famValList[0].value == "Tablet");

        }
Beispiel #10
0
        /// <summary>
        /// Check RMN
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product curProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            IList<IBOMNode> bomNodeList = (IList<IBOMNode>)CurrentSession.GetValue(Session.SessionKeys.SessionBom);
            String curCode = (String)CurrentSession.GetValue(Session.SessionKeys.MBCode);
            
            string ID = (string)CurrentSession.GetValue(Session.SessionKeys.RMN);
            string spno = string.Empty;
            string model = string.Empty;
            string family = string.Empty;
            string family2 = string.Empty;
            string family3 = string.Empty;
            string size = string.Empty;
            string pno = string.Empty;

            //string pattern = "SS09";

            IList<WipBufferDef> wipBufferList = new List<WipBufferDef>();
            IProductRepository productRep =RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IPalletRepository palletRep = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();
            IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
            IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IBOMRepository bomRep = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
            IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
                        
            pno = curProduct.Model.Trim();
            family = modelRep.Find(pno).FamilyName;
            
             //4.Get #wipbuffer
             //CREATE TABLE #wipbuffer (partno nvarchar(20),Tp nvarchar(50),Qty char(2))
            //a)	当@Code 为'PD PA label-1' / 'PA A Label-1' / 'PA B Label-1' / 'PA C Label-1' /
            //'PA D Label-1' / 'PA E Label-1' / 'PA F Label-1' / 'PA G Label-1' / 'PA H Label-1' / 
            //'PA J Label-1' / 'PA K Label-1' / 'PA L Label-1' / 'PA M Label-1' / 'SS11PA-1' / 'SS11PA-2'值时,
            string[] codeArray = { "PD PA label-1", "PA A Label-1", "PA B Label-1", "PA C Label-1", 
                                     "PA D Label-1", "PA E Label-1", "PA F Label-1", "PA G Label-1", "PA H Label-1", 
                                     "PA J Label-1", "PA K Label-1", "PA L Label-1", "PA M Label-1", "SS11PA-1", "SS11PA-2"};

            Boolean codeflag = false;
            for (int i = 0; i < codeArray.Length; i++)
            {
                if (curCode.Contains(codeArray[i]))
                {
                    codeflag = true;
                    break;
                }
            }

            Boolean bomTypeFlag = false;
            List<string> PnList = new List<string>();
            foreach (BOMNode bomNode in bomNodeList)
            {
                PnList.Add(bomNode.Part.PN);
                if (bomNode.Part.BOMNodeType == "PL")
                {
                    bomTypeFlag = true;
                }
            }

            IList<WipBuffer> defList = (IList<WipBuffer>)productRep.GetWipBufferByPnoListAndCode(PnList.ToArray(), curCode);

            if (codeflag)
            {
                //按照如下方法获取#wipbuffer 
                //i.取@family 第一个空格前的字串赋值给变量@family3
                string[] splitpattern = family.Split(' ');
                if (splitpattern.Length < 1)
                {
                    FisException fe = new FisException("PAK069", new string[] { });   //此机器Family不符合条件!
                    throw fe;
                }
                family3 = splitpattern[0].Trim();

                //ii.如果使用Model LIKE @family3 + '%' 查询IMES_FA..PAK_CHN_TW_Light 表存在记录,
                //并且ModelBOM 中Model 直接下阶中存在在IMES_FA..PAK_CHN_TW_Light 存在的Part 
                //(IMES_FA..PAK_CHN_TW_Light.PartNo)时,则按照如下方法继续:

                IList<PakChnTwLightInfo> infoList = palletRep.GetPakChnTwLightInfoListByLikeModel(family3);
                bool bomflag = bomRep.CheckExistMaterialByPno(pno);
                /*if (infoList.Count == 0)
                {
                    FisException fe = new FisException("PAK069", new string[] { });   //此机器Family不符合条件!
                    throw fe;
                    //......需要歸納一下SQL
                }*/
                if (infoList.Count > 0 && bomflag)
                {

                    //1.首先在IMES_FA..Product_Part 表中取PartSn 以字符'C' 开头BomNodeType 为'KP' 的记录Part
                    IList<ProductPart> partList = partRep.GetProductPart("C", "KP", curProduct.ProId);
                    if (partList.Count == 0)
                    {
                        CurrentSession.AddValue("WipBuffer", wipBufferList);
                        return base.DoExecute(executionContext);
                    }
                    
                    //2.查询IMES_GetData..Part表,得到该Part 的IMES_GetData..Part.Descr 字段值,并将Descr第5,6位字符串赋值给变量@size
                    IPart parttmp = partRep.Find(partList[0].PartID);
                    size = parttmp.Descr.Substring(4, 2);

                    //3.当@family 的LCMSize 属性(FamilyInfo.Value,Condition:Name = ‘LCMSize’)等于Y时
                    //参考如下方法Insert #wipbuffer
                    bool famFlag = false;
                    FamilyInfoDef fcond = new FamilyInfoDef();
                    fcond.family= family;
                    fcond.name ="LCMSize";
                    IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
                    if (famValList.Count > 0)
                    {
                        if (famValList[0].value == "Y")
                        {
                            famFlag = true;
                        }
                    }
                    if (famFlag)
                    {
                        //SELECT @family2=LEFT(@family,CHARINDEX(' ',@family)-1)+' '+@size

                        //INSERT #wipbuffer
                        //SELECT a.PartNo, a.Descr, 1
                        //FROM PAK_CHN_TW_Light a (nolock), ModelBOM b (nolock)
                        //WHERE a.Model = @family2 AND b.Material = @Pno AND b.Component = a.PartNo
                        family2 = splitpattern[0] + " " + size;
                    }
                    else
                    {
                        //4. 当@family 的LCMSize 属性不等于Y时,参考如下方法Insert
                        //INSERT #wipbuffer
	                    //SELECT a.LightNo, a.PartNo, a.Descr, 1
		                //FROM PAK_CHN_TW_Light a (nolock), ModelBOM b (nolock)
		                //WHERE a.Model = LEFT(@family,CHARINDEX(' ',@family)-1) AND b.Material = @Pno AND b.Component = a.PartNo                      
                        family2 = splitpattern[0];                        
                    }
                
                    IList<PakChnTwLightInfo> pakCTLInfoLst = new List<PakChnTwLightInfo>();
                    pakCTLInfoLst = palletRep.GetPakChnTwLightInfoListByModelAndPno(family2, pno);

                
                    foreach (PakChnTwLightInfo infoNode in pakCTLInfoLst)
                    {
                        WipBufferDef wipItem = new WipBufferDef();
                        wipItem.PartNo = infoNode.partNo;
                        wipItem.LightNo = infoNode.lightNo;
                        wipItem.Tp = infoNode.descr;
                        wipItem.Qty = "1";
                        wipBufferList.Add(wipItem);

                    }
                }

                if (defList.Count > 0)
                {
                    //iii.	使用PartNo in (SELECT SPno FROM #Bom) AND Code=RTRIM(@Code)
                    //查询IMES_FA..WipBuffer 表存在记录的时候,
                    //执行如下操作后,退出,#wipbuffer 中的数据即Label List:
                    //参考方法:
                    //INSERT #wipbuffer
                    //SELECT PartNo,Tp,Qty FROM WipBuffer (nolock) 
                    //WHERE PartNo in (SELECT SPno FROM #Bom) AND Code=RTRIM(@Code)
                    //SELECT * FROM #wipbuffer
                    //#wipbuffer 此时没有记录也是正常的,表示此站没有可以粘贴的Label,不需要报错。
                    foreach (WipBuffer defNode in defList)
                    {
                        WipBufferDef wipItem = new WipBufferDef();
                        wipItem.PartNo = defNode.PartNo;
                        wipItem.Tp = defNode.Tp;
                        wipItem.Qty = Convert.ToString(defNode.Qty);
                        wipItem.LightNo = defNode.LightNo;
                        wipBufferList.Add(wipItem);
                    }
                }
                else
                {
                    //iv.	使用PartNo in (SELECT SPno FROM #Bom) AND Code=RTRIM(@Code) 
                    //查询IMES_FA..WipBuffer 表不存在记录的时候,
                    //如果ModelBOM 直接下阶中没有BomNodeType 为'PL' 的Part 存在时,则报告错误:“Maintain 错误!”后,退出;
                    //如果ModelBOM 直接下阶中有BomNodeType 为'PL' 的Part 存在时,则,执行如下操作后,退出,
                    //#wipbuffer 中的数据即Label List:
                    //参考方法:
                    //SELECT * FROM #wipbuffer
                    if (!bomTypeFlag)
                    {
                        FisException fe = new FisException("PAK070", new string[] { });   //Maintain 错误
                        throw fe;
                    }
                }
            }
            else
            {
                //b)当@Code 不为上述值时,按照如下方法获取#wipbuffer
                if (defList.Count > 0)
                {
                    //i.使用PartNo in (SELECT SPno FROM #Bom) AND Code=RTRIM(@Code) 
                    //查询IMES_FA..WipBuffer 表存在记录的时候,执行如下操作后,退出,#wipbuffer 中的数据即Label List:

                    //参考方法:
                    //IF EXISTS (SELECT SPno FROM #Bom WHERE SPno='6060B0483201')
                    //BEGIN
                    //INSERT #wipbuffer SELECT '6060B0483201','HITACH Label',1
                    //END 
                    //INSERT #wipbuffer
                    //SELECT PartNo,Tp,Qty FROM WipBuffer (nolock) 
                    //WHERE PartNo in (SELECT SPno FROM #Bom) AND Code=RTRIM(@Code)
                    //SELECT * FROM #wipbuffer
                    //#wipbuffer 此时没有记录也是正常的,表示此站没有可以粘贴的Label,不需要报错。
                    foreach (BOMNode bomNode in bomNodeList)
                    {
                        if (bomNode.Part.PN == "6060B0483201")
                        {
                            WipBufferDef wipItem = new WipBufferDef();
                            wipItem.PartNo = "6060B0483201";
                            wipItem.Tp = "HITACH Label";
                            wipItem.Qty = "1";
                            wipBufferList.Add(wipItem);
                        }
                    }

                    foreach (WipBuffer defNode in defList)
                    {
                        WipBufferDef wipItem = new WipBufferDef();
                        wipItem.PartNo = defNode.PartNo;
                        wipItem.Tp = defNode.Tp;
                        wipItem.Qty = Convert.ToString(defNode.Qty);
                        wipItem.LightNo = defNode.LightNo;
                        wipBufferList.Add(wipItem);
                    }
                    
                }
                else
                {
                    //ii.使用PartNo in (SELECT SPno FROM #Bom) AND Code=RTRIM(@Code) 
                    //查询IMES_FA..WipBuffer 表不存在记录的时候,如果ModelBOM 直接下阶中没有BomNodeType 为'PL' 的Part 存在时,
                    //则报告错误:“Maintain 错误!”后,退出;
                    if (!bomTypeFlag)
                    {
                        FisException fe = new FisException("PAK070", new string[] { });   //Maintain 错误
                        throw fe;
                    }
                }

              }
            
            CurrentSession.AddValue("WipBuffer",wipBufferList);

	        return base.DoExecute(executionContext);
        }
Beispiel #11
0
        /// <summary>
        /// 误差有两种情况,百分比和误差值
        /// 根据是否含有%来区别
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {


            String Tolerance = (String)CurrentSession.GetValue(Session.SessionKeys.Tolerance);
            if (CurrentSession.GetValue(Session.SessionKeys.StandardWeight) != null)
            {
                decimal StandardWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.StandardWeight);


                decimal ActuralWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);

                if (Tolerance.Contains("%"))
                {
                    decimal tolerancePercent;
                    if (decimal.TryParse(Tolerance.Replace("%", ""), out tolerancePercent))
                    {
                        if (tolerancePercent < 100 * System.Math.Abs((StandardWeight - ActuralWeight) / StandardWeight))
                        {
                            if (WeightErrorForceNwc)
                            {
                                IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
                                SaveForceNWC(product);
                            }
                            FisException ex;
                            List<string> erpara = new List<string>();
                            erpara.Add(StandardWeight.ToString());
                            erpara.Add(Tolerance.ToString());
                            erpara.Add(ActuralWeight.ToString());
                            ex = new FisException("CHK016", erpara);
                            if (NotStopWF)
                            {
                                ex.stopWF = false;
                            }
                            throw ex;
                        }
                    }
                    else
                    {
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(Tolerance);
                        ex = new FisException("CHK017", erpara);
                        throw ex;
                    }

                }
                else
                {
                    decimal toleranceAbs;
                    if (decimal.TryParse(Tolerance, out toleranceAbs))
                    {
                        if (toleranceAbs < System.Math.Abs(StandardWeight - ActuralWeight))
                        {
                            FisException ex;
                            List<string> erpara = new List<string>();
                            erpara.Add(StandardWeight.ToString());
                            erpara.Add(Tolerance.ToString());
                            erpara.Add(ActuralWeight.ToString());
                            ex = new FisException("CHK016", erpara);
                            if (NotStopWF)
                            {
                                ex.stopWF = false;
                            }
                            throw ex;
                        }
                    }
                    else
                    {
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(Tolerance);
                        ex = new FisException("CHK017", erpara);
                        throw ex;
                    }
                }
            }
            else  //mantis1780: weight站页面增加重量防呆
            {
                IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                               
                IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
                IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
                string minUnitWeightName = "MinUnitWeight";
                IList<string> minUnitWeigtList = null;

                #region for Tablet or BSam Model or another family category, get min unit weight
                if ((string)CurrentSession.GetValue(ExtendSession.SessionKeys.IsBSamModel) == "Y")
                {
                    minUnitWeightName = "BSam" + minUnitWeightName;
                }
                else
                {
                    string family = product.Family;
                    FamilyInfoDef fcond = new FamilyInfoDef();
                    fcond.family = family;
                    fcond.name = "Category";
                    IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);                   
                    if (famValList.Count > 0)
                    {
                        minUnitWeightName = famValList[0].value.Trim() + minUnitWeightName;
                    }
                }
                minUnitWeigtList = ipartRepository.GetValueFromSysSettingByName(minUnitWeightName);
                #endregion

                //if ((string)CurrentSession.GetValue(ExtendSession.SessionKeys.IsBSamModel) == "Y")
                //{
                //    minUnitWeigtList = ipartRepository.GetValueFromSysSettingByName("BSamMinUnitWeight");
                //}

                if (minUnitWeigtList == null || minUnitWeigtList.Count == 0)
                {
                    throw new FisException("PAK183", new string[] { minUnitWeightName });
                }
                decimal minUnitWeight = decimal.Parse(minUnitWeigtList[0]);

                decimal ActuralWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);
                if (ActuralWeight <= minUnitWeight)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(minUnitWeight.ToString());
                    erpara.Add("Min unit weight");
                    erpara.Add(ActuralWeight.ToString());
                    ex = new FisException("CHK016", erpara);
                    if (NotStopWF)
                    {
                        ex.stopWF = false;
                    }
                    throw ex;
                }


            }
            return base.DoExecute(executionContext);
        }
Beispiel #12
0
        public FamilyInfoDef GetFamilyInfoDef(string strFamilyInfoId)
        {
            try
            {
                FamilyInfoDef item = new FamilyInfoDef();

                SqlParameter[] paramsArray = new SqlParameter[1];
                paramsArray[0] = new SqlParameter("@Value", SqlDbType.Int);
                paramsArray[0].Value = Convert.ToInt32( strFamilyInfoId);

                string SQLStatement = "Select ID, Name, Value, Descr, Editor, Cdt, Udt, Family from FamilyInfo with(NOLOCK) where ID=@Value";
                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_GetData,
                                                                                                                             CommandType.Text, SQLStatement, paramsArray))
                {
                    while (sqlR != null && sqlR.Read())
                    {
                        item.id = GetValue_Int32(sqlR, 0);
                        item.name = GetValue_Str(sqlR, 1);
                        item.value = GetValue_Str(sqlR, 2);
                        item.descr = GetValue_Str(sqlR, 3);
                        item.editor = GetValue_Str(sqlR, 4);
                        item.cdt = GetValue_DateTime(sqlR, 5);
                        item.udt = GetValue_DateTime(sqlR, 6);
                        item.family = GetValue_Str(sqlR, 7);
                    }
                }
                return item;
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #13
0
        /// <summary>
        /// 执行逻辑
        /// 标准误差如果Model没有,再按Custormer找
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            string defaultTolerance = (string)CurrentSession.GetValue(Session.SessionKeys.Tolerance);
            Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            IModelWeightRepository currentModelWeightRepository = RepositoryFactory.GetInstance().GetRepository<IModelWeightRepository, ModelWeight>();
            ModelWeight currentModelWeight = currentModelWeightRepository.Find(currentProduct.Model);
            IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();

            IModelToleranceRepository currentModelToleranceRepository = RepositoryFactory.GetInstance().GetRepository<IModelToleranceRepository, ModelTolerance>();
            ModelTolerance currentModelTolerance = currentModelToleranceRepository.Find(currentProduct.Model);
            if (currentModelTolerance == null)
            {
                currentModelTolerance = currentModelToleranceRepository.Find(Customer);
            }

            if (WeightType == WeightTypeEnum.Unit)
            {
                //if (currentModelTolerance == null || currentModelTolerance.UnitTolerance == null)
                //{
                //    List<string> errpara = new List<string>();

                //    errpara.Add(currentProduct.Model);

                //    throw new FisException("CHK004", errpara);
                //}

                //UC Revision:6912:修改误差可以配置( UnitWeight称重 新方案: 缺省是2)
                if (currentModelTolerance == null || currentModelTolerance.UnitTolerance == null)
                {
                    currentModelTolerance = new ModelTolerance();
                  //  currentModelTolerance.UnitTolerance = "2";

                    //ITC-1360-1204: 改由sysSeting配置
                    IList<string> ToleranceLst = new List<string>();
                    ToleranceLst = ipartRepository.GetValueFromSysSettingByName("UnitWeightTolerance");
                    //For BSAM
              //       BSamUnitWeightTolerance
                    if( (string)CurrentSession.GetValue(ExtendSession.SessionKeys.IsBSamModel)=="Y")
                    { ToleranceLst = ipartRepository.GetValueFromSysSettingByName("BSamUnitWeightTolerance"); }
                    //For BSAM

                   //For Tablet

                    FamilyInfoDef fcond = new FamilyInfoDef();
                    fcond.family = currentProduct.Family;
                    fcond.name = "Category";
                    IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
                    if (famValList.Count > 0)
                    {
                        string sysName = famValList[0].value.Trim() + "UnitWeightTolerance";
                        ToleranceLst = ipartRepository.GetValueFromSysSettingByName(sysName);
                        if (ToleranceLst.Count == 0)
                        {
                            throw new FisException("PAK095", new string[] { sysName });
                        }
                    }

                   //For Tablet
                    
                    if (ToleranceLst != null && ToleranceLst.Count > 0)
                    {
                        // ITC-1360-1465 : 2%
                        if (!ToleranceLst[0].ToString().Contains("%"))
                        {
                            string sysSettingUnitTolerance = ToleranceLst[0].ToString() + "%";
                            currentModelTolerance.UnitTolerance = sysSettingUnitTolerance;
                        }
                        else
                        {
                            currentModelTolerance.UnitTolerance = ToleranceLst[0].ToString();
                        }
                    }
                    else
                    {
                        //List<string> errpara = new List<string>();
                        //errpara.Add("UnitWeightTolerance");
                        //throw new FisException("PAK095", errpara);

                        // ITC-1360-1465 : 2%
                        /*
                         * Answer to: ITC-1414-0105
                         * Description: Set default tolerance properly.
                         */
                        if (defaultTolerance != null && defaultTolerance != "")
                        {
                            currentModelTolerance.UnitTolerance = defaultTolerance;
                        }
                        else
                        {
                            currentModelTolerance.UnitTolerance = "2%";
                        }

                    }
                }



                //// UnitWeight称重 新方案:	Standard Weight – IMES_GetData..ModelWeight.UnitWeight(需转换为decimal(10,2)) – 如果没有取到,则标准重量为NULL (这台机器后面就不需要进行标准重量的比较了)
                if (currentModelWeight == null)
                {
                    //currentModelWeight = new ModelWeight();
                    //currentModelWeight.Model = currentProduct.Model;
                    //currentModelWeight.UnitWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);
                    //currentModelWeight.Editor = Editor;
                    //currentModelWeight.Udt = DateTime.Now;

                    //currentModelWeightRepository.Add(currentModelWeight, CurrentSession.UnitOfWork);


                    CurrentSession.AddValue(Session.SessionKeys.StandardWeight, null);


                }
                else if (currentModelWeight.UnitWeight.Equals(0))
                {
                    //currentModelWeight.UnitWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);
                    //currentModelWeight.Editor = Editor;
                    //currentModelWeight.Udt = DateTime.Now;

                    //currentModelWeightRepository.Update(currentModelWeight, CurrentSession.UnitOfWork);

                    //5.	如果称取的重量为0,则报告错误:“Unit weight should not be 0!”
                    List<string> errpara = new List<string>();
                    errpara.Add(currentProduct.Model);
                    throw new FisException("PAK072", errpara);
                   
                }
                else
                {
                    CurrentSession.AddValue(Session.SessionKeys.StandardWeight, currentModelWeight.UnitWeight);
                }

                CurrentSession.AddValue(Session.SessionKeys.Tolerance, currentModelTolerance.UnitTolerance);

            }
            else
            {
                if (currentModelTolerance == null || currentModelTolerance.CartonTolerance == null)
                {
                    List<string> errpara = new List<string>();

                    errpara.Add(currentProduct.Model);

                    throw new FisException("CHK005", errpara);
                }
                if (currentModelWeight == null )
                {
                    currentModelWeight = new ModelWeight();
                    currentModelWeight.Model = currentProduct.Model;
                    currentModelWeight.CartonWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);
                    currentModelWeight.SendStatus = "";
                    currentModelWeight.Remark = "New";
                    currentModelWeight.Editor = Editor;
                    currentModelWeight.Udt = DateTime.Now;

                    currentModelWeightRepository.Add(currentModelWeight, CurrentSession.UnitOfWork);
                }
                else if (currentModelWeight.CartonWeight.Equals(0))
                {
                    currentModelWeight.CartonWeight = (decimal)CurrentSession.GetValue(Session.SessionKeys.ActuralWeight);
                    currentModelWeight.SendStatus = "";
                    currentModelWeight.Remark = "0";
                    currentModelWeight.Editor = Editor;
                    currentModelWeight.Udt = DateTime.Now;

                    currentModelWeightRepository.Update(currentModelWeight, CurrentSession.UnitOfWork);
                }

                CurrentSession.AddValue(Session.SessionKeys.Tolerance, currentModelTolerance.CartonTolerance);
                CurrentSession.AddValue(Session.SessionKeys.StandardWeight, currentModelWeight.CartonWeight);
            }

            return base.DoExecute(executionContext);
        }
Beispiel #14
0
 public void DeleteFamilyInfoDefered(IUnitOfWork uow, FamilyInfoDef model)
 {
     Action deferAction = () => { DeleteFamilyInfo(model); };
     AddOneInvokeBody(uow, deferAction);
 }
Beispiel #15
0
        public void DeleteFamilyInfo(FamilyInfoDef model)
        {
            try
            {

                _Schema.SQLContext sqlCtx = null;
                lock (MethodBase.GetCurrentMethod())
                {
                    if (!_Schema.Func.PeerTheSQL(MethodBase.GetCurrentMethod().MetadataToken, out sqlCtx))
                    {
                        sqlCtx = new _Schema.SQLContext();
                        sqlCtx.Sentence = @"delete from FamilyInfo where ID=@NameKey";

                        sqlCtx.Params.Add("NameKey", new SqlParameter("@NameKey", SqlDbType.VarChar));

                        _Schema.Func.InsertIntoCache(MethodBase.GetCurrentMethod().MetadataToken, sqlCtx);
                    }
                }

                sqlCtx.Params["NameKey"].Value = model.id;

                _Schema.SqlHelper.ExecuteNonQuery(_Schema.SqlHelper.ConnectionString_GetData,
                                                                                CommandType.Text,
                                                                                 sqlCtx.Sentence,
                                                                                sqlCtx.Params.Values.ToArray<SqlParameter>());
            }
            catch (Exception)
            {
                throw;
            }

            partRep.InsertCacheUpdate(CacheTypeEnum.Family, model.family);
        }
Beispiel #16
0
    //删除操组
    protected void btnDelete_ServerClick(Object sender, EventArgs e)
    {

        string itemId = this.itemId.Value.Trim();
        FamilyInfoDef item = new FamilyInfoDef();
        item.id = int.Parse(itemId);//Convert.ToInt32(itemId);
        try
        {
            //执行删除
            iFamilyInfo.DeleteSelectedFamilyInfo(item);
        }
        catch (FisException ex)
        {
            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "DealHideWait", "DealHideWait();", true);
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "DealHideWait", "DealHideWait();", true);
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        ShowFamilyInfo();
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "resetTableHeight();DeleteComplete();DealHideWait();", true);

    }
Beispiel #17
0
    //更新操作
    protected void btnSave_ServerClick(Object sender, EventArgs e)
    {

        string itemId = this.itemId.Value.Trim();
        //string fullQty = "";//this.ddlFamily.Text.Trim();
        try
        {
            FamilyInfoDef FamilyInfo = new FamilyInfoDef();
            FamilyInfo.family = this.ddlFamily.InnerDropDownList.SelectedValue;
            FamilyInfo.name = this.hidFamilyInfoName.Value.Trim();
            FamilyInfo.value = this.txtValue.Text.Trim();
            FamilyInfo.descr = this.txtDescr.Text.Trim();
            FamilyInfo.editor = this.hiddenUserName.Value;
            FamilyInfo.id = int.Parse(itemId); 
            iFamilyInfo.UpdateSelectedFamilyInfo(FamilyInfo);
        }
        catch (FisException ex)
        {
            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "DealHideWait", "DealHideWait();", true);
            showErrorMessage(ex.mErrmsg);
            return;
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.updatePanelAll, typeof(System.Object), "DealHideWait", "DealHideWait();", true);
            //show error
            showErrorMessage(ex.Message);
            return;
        }
        //读取并显示列表信息
        ShowFamilyInfo();
        //fullQty = replaceSpecialChart(fullQty);
        this.updatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.updatePanel2, typeof(System.Object), "saveUpdate", "resetTableHeight();AddUpdateComplete('" + itemId + "');DealHideWait();", true);
    }
Beispiel #18
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
             IDeliveryRepository dnRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>();
             IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
             FamilyInfoDef fcond = new FamilyInfoDef();
             if (currentProduct != null)
             {
                 fcond.family = currentProduct.Family;
             }
             else
             {
                 Delivery delivery = (Delivery)CurrentSession.GetValue(Session.SessionKeys.Delivery);
                 string model = delivery.ModelName;
                 IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                 Model modelObj= modelRep.Find(model);
                 fcond.family = modelObj.FamilyName.Trim();
             }
           
             fcond.name = "Category";
             IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
             CurrentSession.AddValue("IsTablet", false);
             if (famValList.Count > 0 && famValList[0].value=="Tablet")
             {
                 CurrentSession.AddValue("IsTablet", true);
                 CurrentSession.AddValue(ExtendSession.SessionKeys.IsBSamModel, "N");
                 return base.DoExecute(executionContext);
             }
         

             IBSamRepository bsamRepository = RepositoryFactory.GetInstance().GetRepository<IBSamRepository,BSamLocation>();
             string modelName = ""; 
            if (CurrentSession.GetValue(Session.SessionKeys.ModelName) != null)
             {
                 modelName = (string)CurrentSession.GetValue(Session.SessionKeys.ModelName); 
             }
            else if (CurrentSession.GetValue(Session.SessionKeys.DeliveryNo) != null)
            {
                string dnNo=(string)CurrentSession.GetValue(Session.SessionKeys.DeliveryNo) ;
                Delivery dn= dnRep.Find(dnNo);
                if (dn == null)
                {
                    FisException e = new FisException("CHK190", new string[] { dnNo });
                    throw e;
                }
                modelName = dn.ModelName;
                CurrentSession.AddValue(Session.SessionKeys.Delivery,dn);
            }
            else
             {
                 modelName = currentProduct.Model;
             }
            BSamModel bsamModel = bsamRepository.GetBSamModel(modelName);

            CurrentSession.AddValue(ExtendSession.SessionKeys. IsBSamModel,"N");

            if (bsamModel != null)
            {
                if (this.ExistException)
                {
                    FisException e = new FisException("CHK988", new string[] { modelName });
                    e.stopWF = IsStopWF;
                    throw e;
                }
                CurrentSession.AddValue(ExtendSession.SessionKeys.IsBSamModel, "Y");
                CurrentSession.AddValue(ExtendSession.SessionKeys.BSamModel, bsamModel);
            }
            else if (NotExistException)
            {
                FisException e = new FisException("CHK983", new string[] { modelName });
                e.stopWF = IsStopWF;
                throw e;
            }
            return base.DoExecute(executionContext);
          
        }
    protected void btnSave_Click(Object sender, EventArgs e)
    {
        string name = hidItem.Value;
        string value = txtValue.Text;
        string modelInfoId = hidModelInfoId.Value;

        FamilyInfoDef model = new FamilyInfoDef();

        model.name = name;
        model.value = value;
        model.family = strModelName;
        model.editor = editor;

        try
        {

            if (modelInfoId.Length != 0)
            {
                model.id = Int32.Parse(modelInfoId);
            }

            if (Int32.Parse(modelInfoId) == 0)//no id
            {
                if (value.Length != 0)
                {

                    modelInfoId = iFamilyInfo.AddSelectedFamilyInfo(model).ToString();
                }
            }
            else
            {
                if (value.Length == 0)
                {
                    //iFamilyInfo.DeleteSelectedFamilyInfo(model);
                    iFamilyInfo.DeleteFamilyInfo(model);
                    modelInfoId = "-1";
                }
                else
                {
                    iFamilyInfo.UpdateSelectedFamilyInfo(model);
                }
            }

        }
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;

        }
        catch (Exception ex)
        {
            showErrorMessage(ex.Message);
            return;
        }

        bindTable();
        ScriptManager.RegisterStartupScript(this.updatePanel3, typeof(System.Object), "SaveComplete", "SaveComplete(\"" + modelInfoId + "\");", true);
    }
Beispiel #20
0
        public void Save(string idFamilyInfo, string family, string modelType, string moLimitQty, string editor)
        {
            string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            logger.DebugFormat("BEGIN: {0}(family={1}, modelType={2}, moLimitQty={3})", methodName, family, modelType, moLimitQty);
            try
            {
                IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>();

                FamilyInfoDef cond = new FamilyInfoDef();
                cond.family = family;
                cond.name = "FAI";
                cond.value = modelType;

                IList<FamilyInfoDef> lstFamilyInfo = familyRep.GetExistFamilyInfo(cond);
                if (null != lstFamilyInfo && lstFamilyInfo.Count > 0)
                {
                    if (lstFamilyInfo[0].id.ToString() != idFamilyInfo)
                    {
                        // 紀錄已存在! 請重新輸入!
                        throw new FisException("CQCHK1098", new string[] { });
                    }

                }

                IUnitOfWork uow = new UnitOfWork();
                cond.descr = moLimitQty;
                cond.editor = editor;
                cond.udt = DateTime.Now;
                
                if (null != lstFamilyInfo && lstFamilyInfo.Count > 0)
                {
                    FamilyInfoDef condFind = new FamilyInfoDef();
                    condFind.id = int.Parse(idFamilyInfo);

                    familyRep.UpdateFamilyInfoDefered(uow, cond, condFind);
                }
                else
                {
                    if (string.IsNullOrEmpty(idFamilyInfo))
                    {
                        cond.cdt = DateTime.Now;
                        familyRep.AddFamilyInfoDefered(uow, cond);
                    }
                    else
                    {
                        FamilyInfoDef condFind = new FamilyInfoDef();
                        condFind.id = int.Parse(idFamilyInfo);

                        familyRep.UpdateFamilyInfoDefered(uow, cond, condFind);
                    }
                }
                uow.Commit();

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.DebugFormat("END: {0}()", methodName);
            }
        }
Beispiel #21
0
 public void DeleteFamilyInfo(FamilyInfoDef model)
 {
     logger.Info("DeleteFamilyInfo ID="+model.id+", Name="+model.name+", Editor="+model.editor);
     IFamilyRepositoryEx itemRepositoryEx = RepositoryFactory.GetInstance().GetRepository<IFamilyRepositoryEx>();
     itemRepositoryEx.DeleteFamilyInfo(model);
 }
Beispiel #22
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="customer"></param>
        /// <returns></returns>
        public List<string> GetFamilyByFamilyInfo(FamilyInfoDef familyDef)
        {
            IFamilyRepository familyRepository = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
            IList<FamilyInfoDef> lst = familyRepository.GetExistFamilyInfo(familyDef);
            var result = (from p in lst
                          select p.family).Distinct().ToList();
            return result;

        }
Beispiel #23
0
        public int AddSelectedFamilyInfo(FamilyInfoDef FamilyInfoItem)
        {

            FamilyInfoDef NewFamilyInfoItem = new FamilyInfoDef();
            NewFamilyInfoItem.family = FamilyInfoItem.family;
            NewFamilyInfoItem.name = FamilyInfoItem.name;
            NewFamilyInfoItem.value = FamilyInfoItem.value;
            NewFamilyInfoItem.descr = FamilyInfoItem.descr;
            IList<FamilyInfoDef> FamilyInfoLst = new List<FamilyInfoDef>();
            int getID = -1;
            try 
            {
                itemRepository.AddFamilyInfo(FamilyInfoItem);
                getID = FamilyInfoItem.id;
                FamilyInfoLst = (IList<FamilyInfoDef>)itemRepository.GetExistFamilyInfo(NewFamilyInfoItem);
                if (FamilyInfoLst != null && FamilyInfoLst.Count != 0)
                {
                    getID = FamilyInfoLst[0].id;
                }
            }
            catch(Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            return getID;
        }
Beispiel #24
0
        public IList<FamilyInfoDef> GetFamilyInfoDefList(string strFamilyName)
        {
            try
            {
                IList<FamilyInfoDef> ret = new List<FamilyInfoDef>();

                SqlParameter[] paramsArray = new SqlParameter[1];
                paramsArray[0] = new SqlParameter("@Value", SqlDbType.VarChar);
                paramsArray[0].Value = strFamilyName;

                string SQLStatement = @"select A.ID as ID, B.Name as Name, isNull(A.Value, '') as Value, B.Description as Description,
                    A.Editor as Editor, A.Cdt as Cdt, A.Udt as Udt
                    From (select Family, Name, Value, Editor, Cdt, Udt, ID from FamilyInfo with(NOLOCK) where Family = @Value) as A 
                    Right Outer Join FamilyInfoName as B with(NOLOCK)
                    On A.Name = B.Name";
                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_GetData,
                                                                                                                             CommandType.Text, SQLStatement, paramsArray))
                {
                    while (sqlR != null && sqlR.Read())
                    {
                        FamilyInfoDef item = new FamilyInfoDef();
                        item.id = GetValue_Int32(sqlR, 0);
                        item.family = strFamilyName;
                        item.name = GetValue_Str(sqlR, 1);
                        item.value = GetValue_Str(sqlR, 2);
                        item.descr = GetValue_Str(sqlR, 3);
                        item.editor = GetValue_Str(sqlR, 4);
                        item.cdt = GetValue_DateTime(sqlR, 5);
                        item.udt = GetValue_DateTime(sqlR, 6);
                        ret.Add(item);
                    }
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }