Ejemplo n.º 1
0
        /// <summary>
        /// 获取Product的Model和BOM信息
        /// </summary>
        public IList<BomItemInfo> InputProductIDorCustSN(string input, string line, string editor, string station, string customer, out string prodID, out string model)
        {
            logger.Debug("(_AFTMVS)InputProductIDorCustSN start, input:" + input + " pdLine:" + line + " editor:" + editor + " stationId:" + station + " customerId:" + customer);

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


            try
            {
                string sessionKey = input;

                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, TheType);

                if (currentSession == null)
                {
                    currentSession = 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("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", TheType);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("SaveProductQC.xoml", "SaveProductQC.rules", wfArguments);

                    currentSession.SetInstance(instance);
                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);

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

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

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

                    throw currentSession.Exception;
                }

                prodID = ((Product)currentSession.GetValue(Session.SessionKeys.Product)).ProId;
                model = ((Product)currentSession.GetValue(Session.SessionKeys.Product)).Model;
                IList<BomItemInfo> bom = currentSession.GetValue(Session.SessionKeys.SessionBom) as List<BomItemInfo>;
                IList<BomItemInfo> ret = new List<BomItemInfo>();

                BomItemInfo item = new BomItemInfo();
                item.type = "Customer SN";
                item.description = "Customer SN";
                item.PartNoItem = "";
                item.qty = 1;
                ret.Add(item);

                BomItemInfo item1 = new BomItemInfo();
                item1.type = "Product ID";
                item1.description = "Product ID";
                item1.PartNoItem = "";
                item1.qty = 1;
                ret.Add(item1);

                foreach (BomItemInfo tmp in bom)
                {
                    ret.Add(tmp);
                }
                return ret;
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(_AFTMVS)InputProductIDorCustSN end, input:" + input + " pdLine:" + line + " editor:" + editor + " stationId:" + station + " customerId:" + customer);
            }
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
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);
            }

        }