예제 #1
0
        private  IList<BomItemInfo> GetCheckItemList(Session Session, string MBSN, string MBModel)
        {
            try
            {
            
                BOM BOMItem = (BOM)Session.GetValue(Session.SessionKeys.SessionBom);
                IList<IMES.FisObject.Common.CheckItem.ICheckItem> checkItems = (IList<IMES.FisObject.Common.CheckItem.ICheckItem>)Session.GetValue(Session.SessionKeys.ExplicityCheckItemList);
                IList<IMES.DataModel.BomItemInfo> retLst = new List<BomItemInfo>();
                if (BOMItem != null)
                {
                    foreach (BOMItem item in BOMItem.Items)
                    {
                        BomItemInfo ItemInfo = new BomItemInfo();
                        ItemInfo.qty = item.Qty;
                        if (item.StationPreCheckedPart != null)
                        {
                            ItemInfo.scannedQty = item.StationPreCheckedPart.Count();
                            ItemInfo.collectionData = new List<pUnit>();
                            foreach (PartUnit preItem in item.StationPreCheckedPart)
                            {
                                pUnit temp = new pUnit();
                                temp.sn = preItem.Sn;
                                temp.pn = preItem.Pn;
                                temp.valueType = item.ValueType;
                                ItemInfo.collectionData.Add(temp);
                            }
                        }

                        else
                        {
                            ItemInfo.scannedQty = 0;
                            ItemInfo.collectionData = new List<pUnit>();
                        }

                        List<PartNoInfo> allPart = new List<PartNoInfo>();


                        foreach (BOMPart part in item.AlterParts)
                        {
                            PartNoInfo aPart = new PartNoInfo();

                            aPart.description = part.Descr2;
                            aPart.id = part.PN;
                            aPart.friendlyName = aPart.id;
                            aPart.partTypeId = part.Type;
                            aPart.iecPartNo = part.PN;
                            aPart.valueType = item.ValueType;
                            allPart.Add(aPart);
                            if (!string.IsNullOrEmpty(MBModel) &&
                                !string.IsNullOrEmpty(MBSN) &&
                                aPart.id == MBModel)
                            {
                                ItemInfo.scannedQty = 1; //item.StationPreCheckedPart.Count();
                                ItemInfo.collectionData = new List<pUnit>();

                                pUnit temp = new pUnit();
                                temp.sn = MBSN;
                                temp.pn = MBModel;
                                temp.valueType = "SN"; //item.ValueType;
                                ItemInfo.collectionData.Add(temp);

                                
                            }


                        }
                        allPart.Sort(delegate(PartNoInfo p1, PartNoInfo p2) { return p1.iecPartNo.CompareTo(p2.iecPartNo); });

                        ItemInfo.parts = allPart;
                        retLst.Add(ItemInfo);
                    }

                }

                if (checkItems != null)
                {
                    foreach (ICheckItem item in checkItems)
                    {
                        BomItemInfo checkItemInfo = new BomItemInfo();
                        checkItemInfo.qty = 1;
                        checkItemInfo.scannedQty = 0;

                        IList<PartNoInfo> allPart = new List<PartNoInfo>();
                        PartNoInfo aPart = new PartNoInfo();
                        aPart.description = string.Empty;
                        aPart.id = item.ItemDisplayName;
                        aPart.friendlyName = aPart.id;
                        aPart.partTypeId = string.Empty;
                        aPart.iecPartNo = aPart.id;
                        allPart.Add(aPart);
                        checkItemInfo.parts = allPart;

                        retLst.Add(checkItemInfo);
                    }

                }
                return retLst;
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
파일: FlatBOM.cs 프로젝트: wra222/testgit
        public IList<BomItemInfo> ToBOMItemInfoList()
        {
            IList<BomItemInfo> retLst = new List<BomItemInfo>();
            foreach (IFlatBOMItem item in _bomItems)
            {
                BomItemInfo ItemInfo = new BomItemInfo();
                ItemInfo.qty = item.Qty;
                ItemInfo.description = item.Descr ?? string.Empty;
                ItemInfo.PartNoItem = item.PartNoItem ?? string.Empty;
                ItemInfo.type = item.CheckItemType ?? string.Empty;
                ItemInfo.tp = item.Tp ?? string.Empty;
                ItemInfo.GUID = item.GUID;
                if (item.StationPreCheckedPart != null)
                {
                    ItemInfo.scannedQty = item.StationPreCheckedPart.Count;
                    ItemInfo.collectionData = new List<pUnit>();
                    foreach (PartUnit preItem in item.StationPreCheckedPart)
                    {
                        pUnit temp = new pUnit();
                        temp.sn = preItem.Sn;
                        temp.pn = preItem.Pn;
                        temp.valueType = item.CheckItemType;
                        ItemInfo.collectionData.Add(temp);
                    }
                }
                else
                {
                    ItemInfo.scannedQty = 0;
                    ItemInfo.collectionData = new List<pUnit>();
                }

                List<PartNoInfo> allPart = new List<PartNoInfo>();

                ItemInfo.parts = new List<PartNoInfo>();
                if (item.AlterParts != null)
                {
                    foreach (IPart part in item.AlterParts)
                    {
                        PartNoInfo aPart = new PartNoInfo();
                        aPart.description = part.Descr ?? string.Empty;
                        aPart.id = part.PN ?? string.Empty;
                        aPart.friendlyName = aPart.id ?? string.Empty;
                        aPart.partTypeId = part.Type ?? string.Empty;
                        aPart.iecPartNo = part.PN;
                        aPart.valueType = item.CheckItemType ?? string.Empty;
                        IList<NameValueInfo> properties = new List<NameValueInfo>();
                        foreach (PartInfo property in part.Attributes)
                        {
                            var tempProperty = new NameValueInfo();
                            tempProperty.Name = property.InfoType;
                            tempProperty.Value = property.InfoValue;
                            properties.Add(tempProperty);
                        }
                        aPart.properties = properties;
                        allPart.Add(aPart);
                    }
                    allPart.Sort(delegate(PartNoInfo p1, PartNoInfo p2) { return p1.id.CompareTo(p2.id); });

                    ItemInfo.parts = allPart;
                }
                retLst.Add(ItemInfo);
            }
            return retLst;
        }
예제 #3
0
        /// <summary>
        /// 获取所有需要扫描的Parts和CheckItem,在调用inputUUT成功开启工作流之后调用
        /// 本站为CustSN,Model,PizzaID,MMIID属性
        /// 用productID获取Session
        /// 调用ICollectionData.GetCheckItemList 
        /// </summary>
        /// <param name="productID">product id</param>
        /// <returns>Parts和CheckItem</returns>
        public IList<BomItemInfo> GetNeedCheckPartAndItem(string prodId)
        {
            logger.Debug("(_FGShippingLabel)GetNeedCheckPartAndItem prodId:" + prodId);

            FisException ex;
            List<string> erpara = new List<string>();
            string sessionKey = prodId;
            Session Session = SessionManager.GetInstance.GetSession(sessionKey, TheType);
            if (Session == null)
            {
                erpara.Add(sessionKey);
                ex = new FisException("CHK021", erpara);
                throw ex;
            }
            try
            {

                
                IList<IMES.FisObject.Common.CheckItem.ICheckItem> checkItems = (IList<IMES.FisObject.Common.CheckItem.ICheckItem>)Session.GetValue(Session.SessionKeys.ExplicityCheckItemList);
                IList<IMES.DataModel.BomItemInfo> retLst = new List<BomItemInfo>();
              
                if (checkItems != null)
                {
                    foreach (ICheckItem item in checkItems)
                    {
                        BomItemInfo checkItemInfo = new BomItemInfo();
                        checkItemInfo.qty = 1;
                        checkItemInfo.scannedQty = 0;

                        IList<PartNoInfo> allPart = new List<PartNoInfo>();
                        PartNoInfo aPart = new PartNoInfo();
                        aPart.description = string.Empty;
                        //    <bug>
                        //                BUG NO:ITC-1155-0194
                        //                REASON:获取displayname
                        //    </bug>
                        aPart.id = item.ItemDisplayName;
                        aPart.friendlyName = aPart.id;
                        aPart.partTypeId = string.Empty;
                        aPart.iecPartNo = aPart.id;
                        allPart.Add(aPart);
                        checkItemInfo.parts = allPart;

                        retLst.Add(checkItemInfo);
                    }

                }
                return retLst;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(_FGShippingLabel)GetNeedCheckPartAndItem end, prodId:" + prodId);
            }

        }