Exemplo n.º 1
0
        private void combineCDSI(Session session,IProduct product, IPart part, string checkItemType, string avPartNo )
            {
                var prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

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

                string AST2 = "";
                CdsiastInfo cdi2 = new CdsiastInfo();
                cdi2.tp = "ASSET_TAG2";
                cdi2.snoId = product.ProId;
                IList<CdsiastInfo> cdsiastInfoList2 = prodRep.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的绑定关系
                   if (AST1 != "")
                   {
                           IProductPart assetTag1 = new ProductPart();
                            assetTag1.ProductID = product.ProId;
                            assetTag1.PartID = part.PN;
                            assetTag1.PartType = part.Descr;
                            assetTag1.Iecpn = "";
                            assetTag1.CustomerPn = avPartNo;
                            assetTag1.PartSn = AST1;
                            assetTag1.Station = this.Station;
                            assetTag1.Editor = this.Editor;
                            assetTag1.Cdt = DateTime.Now;
                            assetTag1.Udt = DateTime.Now;
                            assetTag1.BomNodeType = part.BOMNodeType;
                            assetTag1.CheckItemType = checkItemType;

                            product.AddPart(assetTag1);
                            prodRep.Update(product, session.UnitOfWork);
                    }

                    if (AST2 != "")
                    {
                        IProductPart assetTag2 = new ProductPart();
                        assetTag2.ProductID = product.ProId;
                        assetTag2.PartID = part.PN;
                        assetTag2.PartType = part.Descr;
                        assetTag2.Iecpn = "";
                        assetTag2.CustomerPn = avPartNo;
                        assetTag2.PartSn = AST2;
                        assetTag2.Station = this.Station;
                        assetTag2.Editor = this.Editor;
                        assetTag2.Cdt = DateTime.Now;
                        assetTag2.Udt = DateTime.Now;
                        assetTag2.BomNodeType = part.BOMNodeType;
                        assetTag2.CheckItemType = checkItemType;

                        product.AddPart(assetTag2);
                        prodRep.Update(product, session.UnitOfWork);
                    }

                    session.AddValue("AST1", AST1);
                    session.AddValue("AST2", AST2);

                    //2012-5-2
                    string ASTinfo = "";
                    if (!string.IsNullOrEmpty(AST1) && !string.IsNullOrEmpty(AST2))
                    {
                        ASTinfo += AST1 + ", " + AST2;
                    }
                    else if (!string.IsNullOrEmpty(AST1) && string.IsNullOrEmpty(AST2))
                    {
                        ASTinfo = AST1;
                    }
                    else if (string.IsNullOrEmpty(AST1) && !string.IsNullOrEmpty(AST2))
                    {
                        ASTinfo = AST2;
                    }
                    session.AddValue("ASTInfo", ASTinfo);
                }
            }
Exemplo n.º 2
0
 public void BuildPartA(string partName)
 {
     Product.AddPart(partName);
 }