Beispiel #1
0
        private void SaveItem()
        {
            // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames)
            List <int>             ids         = GetSelectedDataKeyIDs(Grid1);
            PartsInfo              goodsEntity = new PartsInfo();
            ContractHandWareDetail dbEntity    = new ContractHandWareDetail();

            // 执行数据库操作
            foreach (int ID in ids)
            {
                goodsEntity = Core.Container.Instance.Resolve <IServicePartsInfo>().GetEntity(ID);
                //判断是否已经添加改商品物品
                if (!IsExists(ID))
                {
                    dbEntity                = new ContractHandWareDetail();
                    dbEntity.ContractID     = OrderID;
                    dbEntity.GoodTypeID     = goodsEntity.PartsTypeID;
                    dbEntity.GoodsID        = goodsEntity.ID;
                    dbEntity.GoodsNumber    = 1;
                    dbEntity.GoodsUnit      = goodsEntity.PartsUnit;
                    dbEntity.GoodsUnitPrice = goodsEntity.UnitPrice;
                    dbEntity.GoodAmount     = goodsEntity.UnitPrice;
                    dbEntity.GoodsName      = goodsEntity.PartsName;
                    dbEntity.CostPrice      = goodsEntity.CostPrice;
                    dbEntity.CostAmount     = goodsEntity.CostPrice;
                    dbEntity.IsFree         = 1;
                    dbEntity.OrderType      = UserType;

                    Core.Container.Instance.Resolve <IServiceContractHandWareDetail>().Create(dbEntity);
                }
            }
        }
Beispiel #2
0
            internal void Backup()
            {
                int _coordinateIndex = ChaControl.fileStatus.coordinateType;

                List <ChaFileAccessory.PartsInfo> _parts = MoreAccessoriesSupport.ListPartsInfo(ChaControl, _coordinateIndex);

                PartsInfo.Clear();
                PartsResolveInfo.Clear();

                for (int i = 0; i < _parts.Count; i++)
                {
                    ChaFileAccessory.PartsInfo _part = MoreAccessoriesSupport.GetPartsInfo(ChaControl, _coordinateIndex, i);
                    if (_part.type > 120)
                    {
                        byte[] _byte = MessagePackSerializer.Serialize(_part);
                        PartsInfo[i] = MessagePackSerializer.Deserialize <ChaFileAccessory.PartsInfo>(_byte);

                        PartsResolveInfo[i] = UniversalAutoResolver.TryGetResolutionInfo((ChaListDefine.CategoryNo)_part.type, _part.id);
                    }
                }

                foreach (string _name in SupportList)
                {
                    Traverse.Create(this).Field(_name).Method("Backup").GetValue();
                }
            }
Beispiel #3
0
        private void SaveItem()
        {
            PartsInfo PartsInfoInfo = new PartsInfo();

            if (InfoID > 0)
            {
                PartsInfoInfo = Core.Container.Instance.Resolve <IServicePartsInfo>().GetEntity(InfoID);
            }

            PartsInfoInfo.PartsName   = txtCostName.Text;                               //配件名称
            PartsInfoInfo.PartsTypeID = int.Parse(ddlCostType.SelectedValue);           //配件类别
            PartsInfoInfo.IsUsed      = ddlIsUsed.SelectedValue;                        //是否启用
            PartsInfoInfo.PartsUnit   = ddlUnit.SelectedValue;                          //标准单位
            PartsInfoInfo.Remark      = txtRemark.Text;                                 //备注
            PartsInfoInfo.UnitPrice   = decimal.Parse(nbPrice.Text);
            PartsInfoInfo.CostPrice   = decimal.Parse(nbCost.Text);
            if (InfoID > 0)
            {
                Core.Container.Instance.Resolve <IServicePartsInfo>().Update(PartsInfoInfo);
            }
            else
            {
                Core.Container.Instance.Resolve <IServicePartsInfo>().Create(PartsInfoInfo);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Enumerates the PIC names contained in the current database.
 /// </summary>
 /// <param name="filter">A filter predicate to select categories of PIC names.</param>
 /// <returns>
 /// An enumerator that allows <code lang="C#">foreach</code> to be used to process PIC names list in this collection.
 /// </returns>
 /// <remarks>
 /// Only PIC16 and PIC18 are listed whatever database and filter used.
 /// </remarks>
 public IEnumerable <string> EnumPICList(Func <string, bool> filter)
 {
     if (PartsInfo == null)
     {
         yield break;
     }
     foreach (var part in PartsInfo.PICNamesList(filter))
     {
         yield return(part);
     }
 }
Beispiel #5
0
            internal void Reset()
            {
                FunctionEnable  = false;
                AutoCopyToBlank = false;
                ReferralIndex   = RefMax;
                PartsInfo.Clear();
                PartsResolveInfo.Clear();

                foreach (string _name in SupportList)
                {
                    Traverse.Create(this).Field(_name).Method("Reset").GetValue();
                }
            }
        private void SetSelectedUsersEnableStatus(bool enabled)
        {
            string isUsed = enabled ? "1" : "0";
            // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames)
            List <int> ids = GetSelectedDataKeyIDs(Grid1);

            // 执行数据库操作
            foreach (int ID in ids)
            {
                PartsInfo entity = Core.Container.Instance.Resolve <IServicePartsInfo>().GetEntity(ID);
                entity.IsUsed = isUsed;
                Core.Container.Instance.Resolve <IServicePartsInfo>().Update(entity);
            }
            // 重新绑定表格
            BindGrid();
        }
Beispiel #7
0
 public void Bind()
 {
     if (InfoID > 0)
     {
         PartsInfo PartsInfo = Core.Container.Instance.Resolve <IServicePartsInfo>().GetEntity(InfoID);
         txtCostName.Text          = PartsInfo.PartsName;                        //配件名称
         ddlCostType.SelectedValue = PartsInfo.PartsTypeID.ToString();           //配件类别
         ddlIsUsed.SelectedValue   = PartsInfo.IsUsed.ToString();                //是否启用
         ddlUnit.SelectedValue     = PartsInfo.PartsUnit;                        //标准单位
         txtRemark.Text            = PartsInfo.Remark;                           //备注
         nbPrice.Text = PartsInfo.UnitPrice.ToString();
         nbCost.Text  = PartsInfo.CostPrice.ToString();;
     }
     if (IsView > 0)
     {
         btnSaveClose.Visible = false;
     }
 }
Beispiel #8
0
    private void AddEquipment( int itemUID, PartsInfo parts)
    {
        if (parts.DicParts.ContainsKey (itemUID) == false) {
            return;
        }

        parts.CurrentUID = itemUID;

        GameObject partsObj = parts.DicParts [itemUID];

        partsObj.SetActiveRecursively( true );

        // Here, boneObj must be instatiated and active (at least the one with the renderer),
        // or else GetComponentsInChildren won't work.
        SkinnedMeshRenderer[] BonedObjects = partsObj.GetComponentsInChildren<SkinnedMeshRenderer>();
        foreach( SkinnedMeshRenderer smr in BonedObjects )
            ProcessBonedObject(out parts.OnceWorn,   smr );

        // We don't need the old obj, we make it disappear.
        partsObj.SetActiveRecursively( false );
    }
Beispiel #9
0
    public void Read()
    {
        XmlDocument xmldoc  = new XmlDocument();
        string      xmlText = xLoad("Parts");

        xmldoc.LoadXml(xmlText);
        XmlNodeList nodelist = xmldoc.SelectSingleNode("root").ChildNodes;

        foreach (XmlNode node in nodelist)
        {
            XmlAttributeCollection xAC = node.Attributes;
            GetAttribute           g   = new GetAttribute(xAC);
            int       id   = int.Parse(node.Name.Replace("ID", ""));
            PartsInfo info = new PartsInfo();
            info.ID        = id;
            info.CnName    = g.getString("CnName");
            info.ATK       = g.getInt("ATK");
            info.CnContent = g.getString("CnContent");
            info.EnName    = g.getString("EnName");
            info.EnContent = g.getString("EnContent");
            info.JpName    = g.getString("JpName");
            info.JpContent = g.getString("JpContent");
            info.Score     = g.getInt("Score");
            info.GemPrice  = g.getInt("GemPrice");
            info.HP        = g.getInt("HP");
            info.Mass      = g.getInt("Mass");
            info.Price     = g.getInt("Price");
            info.SPD       = g.getInt("SPD");
            info.Type      = g.getInt("Type");
            if (!dicParts.ContainsKey(id))
            {
                dicParts.Add(id, info);
            }
        }
        HasReadToMemory = true;
        Debug.Log("TablePartsLoadDone!");
    }
Beispiel #10
0
    public void AddEquipParts(PartsInfo parts, int itemUID)
    {
        if (ItemManager.Instance.GetItemByUID(itemUID) == null)
            return;

        //이미 장착한 놈을 장착 하려 한다면 쌩..
        if(parts.IsAlreadyEquiped(itemUID))
            return;

        //이미 생성된 파츠 인스턴스가 씬에 없다면 Instantiate 한다.
        if (parts.HasInstance(itemUID) == false) {

            GameObject instance = (GameObject)Instantiate(ItemManager.Instance.GetItemPrefab(itemUID));

            parts.AddInstance( instance, itemUID, false);
        }

        //장착한 Parts가 있다면, 고놈은 지워준다.
        if(parts.IsOnceWorn())
            RemoveEquipment(parts);

        //Parts 를 장착한다
        AddEquipment(itemUID, parts);
    }
        private void SaveItem()
        {
            ContractDoorInfo contractDoorInfo = new ContractDoorInfo();

            if (InfoID > 0)
            {
                contractDoorInfo.ContractInfo = Core.Container.Instance.Resolve <IServiceContractInfo>().GetEntity(InfoID);
            }
            contractDoorInfo.GoodsLocation = txtAddress.Text;
            contractDoorInfo.Remark        = taRemark.Text;
            contractDoorInfo.OtherAmount   = decimal.Parse(nbOtherAmount.Text);
            //商品类型及名称
            contractDoorInfo.TypeClass      = int.Parse(ddlGoodType.SelectedValue);
            contractDoorInfo.TypeName       = ddlGoodType.SelectedText;
            contractDoorInfo.GoodsID        = int.Parse(ddlGood.SelectedValue);
            contractDoorInfo.GoodsName      = ddlGood.SelectedText;
            contractDoorInfo.GStandardPrice = 0;
            contractDoorInfo.OrderNumber    = 1;
            contractDoorInfo.DoorColor      = tbColor.Text;
            contractDoorInfo.LineName       = tbLine.Text;
            contractDoorInfo.GlassRemark    = tbGlass.Text;
            contractDoorInfo.SupplyID       = int.Parse(ddlSupply.SelectedValue);
            contractDoorInfo.ModelName      = tbModel.Text;
            contractDoorInfo.DoorDirection  = ddlDirection.SelectedValue;
            //锁具
            contractDoorInfo.HardWareAmount = 0;
            contractDoorInfo.LockID         = 0;
            if (!ddlParts.SelectedValue.Equals("0"))
            {
                contractDoorInfo.LockID = int.Parse(ddlParts.SelectedValue);
                PartsInfo partsInfo = Core.Container.Instance.Resolve <IServicePartsInfo>().GetEntity(contractDoorInfo.LockID);

                //获取门收费五金总金额
                decimal hwNumber = 0;
                string  sqlHW    = string.Format(@"select isnull(sum(GoodAmount),0) as GoodAmount from ContractHandWareDetail where ContractID ={0} and IsFree=1 and OrderType=1 ", InfoID);
                DataSet dsHW     = DbHelperSQL.Query(sqlHW);
                if (dsHW.Tables[0] != null)
                {
                    hwNumber = decimal.Parse(dsHW.Tables[0].Rows[0]["GoodAmount"].ToString());
                }
                //更新门五金总价
                contractDoorInfo.HardWareAmount = hwNumber + (partsInfo != null ? partsInfo.UnitPrice : 0);
            }
            //尺寸
            contractDoorInfo.GHeight    = int.Parse(nbHeight.Text);
            contractDoorInfo.GWide      = int.Parse(nbWide.Text);
            contractDoorInfo.GThickness = int.Parse(nbCount.Text);
            /*-------------------根据基本录入尺寸信息计算超标和费用---------------------*/
            //计算面积
            contractDoorInfo.GArea = ((decimal)contractDoorInfo.GHeight / 1000) * ((decimal)contractDoorInfo.GWide / 1000);
            //计算尺寸超标和金额
            EquipmentInfo equipmentInfo = Core.Container.Instance.Resolve <IServiceEquipmentInfo>().GetEntity(contractDoorInfo.GoodsID);

            if (equipmentInfo != null)
            {
                contractDoorInfo.InstallCost          = equipmentInfo.InstallCost;
                contractDoorInfo.GStandardPrice       = equipmentInfo.UnitPrice;
                contractDoorInfo.PassPriceAmount      = 0;
                contractDoorInfo.GPrice               = equipmentInfo.UnitPrice;
                contractDoorInfo.GPassHeightAmount    = 0;
                contractDoorInfo.GPassWideAmount      = 0;
                contractDoorInfo.GPassThicknessAmount = 0;
                contractDoorInfo.GPassAreaAmount      = 0;
                // 商品单位 1:樘  2:米  3:平方米
                contractDoorInfo.GoodUnit = equipmentInfo.EquipmentUnit == "1" ? "樘" : equipmentInfo.EquipmentUnit == "2" ? "米" : "平方米";
                //计算尺寸面积超标
                contractDoorInfo.GPassHeight    = contractDoorInfo.GHeight > equipmentInfo.EHeight ? contractDoorInfo.GHeight - equipmentInfo.EHeight : 0;
                contractDoorInfo.GPassWide      = contractDoorInfo.GWide > equipmentInfo.EWide ? contractDoorInfo.GWide - equipmentInfo.EWide : 0;
                contractDoorInfo.GPassThickness = contractDoorInfo.GThickness > equipmentInfo.EThickness ? contractDoorInfo.GThickness - equipmentInfo.EThickness : 0;
                decimal standerArea = ((decimal)equipmentInfo.EHeight / 1000) * ((decimal)equipmentInfo.EWide / 1000);
                contractDoorInfo.GPassArea = contractDoorInfo.GArea > standerArea ? contractDoorInfo.GArea - standerArea : 0;
            }
            //计算各项超标金额 【超标计算 1:按公分计算 2:单价加价  3:面积加价】
            switch (equipmentInfo.PassCalcType)
            {
            case 1:         //按公分计算
                contractDoorInfo.GPassHeightAmount    = contractDoorInfo.GPassHeight / 10 * equipmentInfo.PassHeight;
                contractDoorInfo.GPassWideAmount      = contractDoorInfo.GPassWide / 10 * equipmentInfo.PassWide;
                contractDoorInfo.GPassThicknessAmount = contractDoorInfo.GPassThickness / 10 * equipmentInfo.PassThckness;
                break;

            case 2:         //单价加价
                contractDoorInfo.GPassHeightAmount    = contractDoorInfo.GPassHeight > 0 ? equipmentInfo.PassHeight : 0;
                contractDoorInfo.GPassWideAmount      = contractDoorInfo.GPassWide > 0 ? equipmentInfo.PassWide : 0;
                contractDoorInfo.GPassThicknessAmount = contractDoorInfo.GPassThickness > 0 ? equipmentInfo.PassThckness : 0;
                //计算单价加价
                contractDoorInfo.PassPriceAmount = contractDoorInfo.GPassHeightAmount + contractDoorInfo.GPassWideAmount + contractDoorInfo.GPassThicknessAmount;
                contractDoorInfo.GPrice          = contractDoorInfo.GStandardPrice + contractDoorInfo.PassPriceAmount;
                break;

            case 3:         //面积加价
                contractDoorInfo.GPassAreaAmount = contractDoorInfo.GPassArea * equipmentInfo.PassArea;
                break;
            }
            //计算商品数量 1:单位数量 2:三方周长  3:四方周长 4:面积
            switch (equipmentInfo.CalcUnitType)
            {
            case 1:         //单位数量
                contractDoorInfo.OrderNumber = 1;
                break;

            case 2:         //三方周长
                contractDoorInfo.OrderNumber = ((decimal)contractDoorInfo.GHeight * 2 + (decimal)contractDoorInfo.GWide) / 1000;
                break;

            case 3:         //四方周长
                contractDoorInfo.OrderNumber = ((decimal)contractDoorInfo.GHeight * 2 + (decimal)contractDoorInfo.GWide * 2) / 1000;
                break;

            case 4:         //面积
                contractDoorInfo.OrderNumber = contractDoorInfo.GArea;
                break;
            }
            //计算商品总价
            contractDoorInfo.PassAmount = contractDoorInfo.GPassHeightAmount
                                          + contractDoorInfo.GPassWideAmount
                                          + contractDoorInfo.GPassThicknessAmount
                                          + contractDoorInfo.GPassAreaAmount;
            contractDoorInfo.GoodsAmount = contractDoorInfo.GPrice * contractDoorInfo.OrderNumber;
            contractDoorInfo.OrderAmount = contractDoorInfo.GoodsAmount
                                           + contractDoorInfo.PassAmount
                                           + contractDoorInfo.OtherAmount
                                           + contractDoorInfo.InstallCost
                                           + contractDoorInfo.HardWareAmount;
            //保存商品信息
            Core.Container.Instance.Resolve <IServiceContractDoorInfo>().Create(contractDoorInfo);
            //更新合同门总金额及合同总金额信息
            UpdateTotalAmount(contractDoorInfo.HardWareAmount);
            //保存厂家成本信息
            CreateCostInfo();
        }
Beispiel #12
0
 private void RemoveEquipment(PartsInfo parts)
 {
     Destroy (parts.OnceWorn);
 }
Beispiel #13
0
        /*****************************************************************************************/
        /*****************************************************************************************/

        // Pre-Processor Assembly
        private void button3_Click_1(object sender, EventArgs e)
        {
            int constraint_num = 0;

            ConstraintInfo[] a1_constraint = new ConstraintInfo[100]; //조만간 제거할거임.

            //Assembly file: bring CATScript and address
            string CATAssem = CATScriptOpenDialog(); //Assembly CATScript address   -> 수정필요

            if (CATAssem == "")
            {
                return;
            }
            string folder_address = CATAssem.Substring(0, CATAssem.LastIndexOf("\\"));

            Console.WriteLine(folder_address); //Assembly folder address.

            string line;
            string search2 = "AddBiEltCst";

            //Part file: bring address of parts folder
            string CATAssem2 = CATScriptOpenDialog();  //-> 수정 필요

            if (CATAssem2 == "")
            {
                return;
            }
            string folder_address_parts = CATAssem2.Substring(0, CATAssem2.LastIndexOf("\\"));

            Console.WriteLine(folder_address_parts); //part folder address.

            //constraint type parsing  //조만간 지울거임.
            using (StreamReader sr = new StreamReader(CATAssem, System.Text.Encoding.Default))
            {
                while ((line = sr.ReadLine()) != null)
                {
                    if (line.Length > 10)  //수정 가능
                    {
                        if (line.IndexOf(search2) != -1)
                        {
                            //constraint type parsing
                            a1_constraint[constraint_num].type = line.Substring(line.IndexOf("(") + 1, line.IndexOf(",") - line.IndexOf("(") - 1);
                            //Console.WriteLine(a1_constraint[constraint_num].type);
                            //master_ref parsing(numbering)
                            a1_constraint[constraint_num].master_ref = line.Substring(line.IndexOf(",") + 2, line.LastIndexOf(",") - line.IndexOf(",") - 2);
                            //Console.WriteLine(a1_constraint[constraint_num].master_ref);
                            //slave_ref parsing(numbering)
                            a1_constraint[constraint_num].slave_ref = line.Substring(line.LastIndexOf(",") + 2, line.IndexOf(")") - line.LastIndexOf(",") - 2);
                            //Console.WriteLine(a1_constraint[constraint_num].slave_ref);

                            //number of constraints
                            constraint_num++;
                        }
                    }
                }
            }

            // reparsing master_ref, slave_ref(contents)  //조만간 지울거임.
            using (StreamReader sr = new StreamReader(CATAssem, System.Text.Encoding.Default))
            {
                while ((line = sr.ReadLine()) != null)
                {
                    for (int n = 0; n < constraint_num; n++)
                    {
                        if (line.IndexOf("CreateReference") != -1)
                        {
                            if (line.IndexOf(a1_constraint[n].master_ref) != -1)
                            {
                                a1_constraint[n].master_ref = line.Substring(line.IndexOf("\"") + 1, line.LastIndexOf("\"") - line.IndexOf("\"") - 1);
                                //Console.WriteLine(a1_constraint[n].master_ref);
                            }
                            else if (line.IndexOf(a1_constraint[n].slave_ref) != -1)
                            {
                                a1_constraint[n].slave_ref = line.Substring(line.IndexOf("\"") + 1, line.LastIndexOf("\"") - line.IndexOf("\"") - 1);
                                //Console.WriteLine(a1_constraint[n].slave_ref);
                            }
                        }
                    }
                }
            }


            //part information storage
            List <PartsInfo>      part_collect  = new List <PartsInfo>();
            List <ConstraintInfo> const_collect = new List <ConstraintInfo>();

            //CATProduct location
            Assembly Product1        = new Assembly();
            string   product_address = folder_address + "\\A2.CATProduct"; //수정 필요.

            Console.WriteLine(product_address);

            //CATProduct 열어서 part number, instance name, address 가져오기.
            //constraint 갯수, 종류, master ref, slave ref 구하기.
            int part_numb  = 0;
            int const_numb = 0;

            if (Product1.InitializeCATIA(product_address, (int)0))
            {
                Console.WriteLine("working!");
                Console.WriteLine(Product1.cProduct.get_Name()); //product name

                part_numb = Product1.cProducts.Count;            // # of parts
                Console.WriteLine(part_numb);

                const_numb = Product1.cConstraints.Count; // # of constraints
                Console.WriteLine(const_numb);

                if (part_numb > 0)  //파트 정보
                {
                    for (int i = 1; i <= part_numb; i++)
                    {
                        Console.WriteLine("");

                        string first = Product1.cProducts.Item(i).get_Name(); //instance name
                        Console.WriteLine(first);

                        string first_part = Product1.cProducts.Item(i).get_PartNumber(); //part number
                        Console.WriteLine(first_part);

                        string first_address = Product1.cProducts.Item(i).ReferenceProduct.GetMasterShapeRepresentationPathName(); //address of part 수정 필요!!!!
                        Console.WriteLine(first_address);

                        string first_transcad = first_address.Substring(first_address.LastIndexOf("\\") + 1, first_address.LastIndexOf(".") - first_address.LastIndexOf("\\") - 1);
                        Console.WriteLine(first_transcad);

                        PartsInfo temp = new PartsInfo();
                        temp.ins_name = first; temp.catname = first_part; temp.address = first_address; temp.transname = first_transcad;

                        part_collect.Add(temp);
                    }
                }

                if (const_numb > 0)  //구속 정보
                {
                    Console.WriteLine("");
                    string second = Product1.cConstraints.Name;
                    Console.WriteLine(second);

                    string second2 = Product1.cConstraints.Item(1).get_Name();
                    Console.WriteLine(second2);

                    for (int i = 1; i <= const_numb; i++)
                    {
                        //Console.WriteLine("");

                        //constraint name
                        //constraint type
                        //master ref
                        //slave ref
                    }
                }

                Product1.UninitializeCATIA();
            }

            ///////////////////////
            //파트 번역..CATParts//
            ///////////////////////


            //parts information
            PreStack stack = new PreStack();

            stack.Clear();
            for (int i = 0; i < part_numb; i++)
            {
                stack.StackItem(part_collect[i].address, part_collect[i].catname, part_collect[i].transname);
            }

            int modeya = 0; //constraint 번역 못하게 막음.

            if (modeya != 0)
            {
                //constraint information
                ReferenceClass.ref_Pre m_refer = new ReferenceClass.ref_Pre(stack);
                //Set constraint1 = constraints1.AddBiEltCst(catCstTypeOn, reference1, reference2)
                m_refer.SetConstraint(stack, stack.GetSize(), a1_constraint[0].type, a1_constraint[0].master_ref, a1_constraint[0].slave_ref, "move", 0); //수정 필요. "move"???
                m_refer.SetConstraint(stack, stack.GetSize(), a1_constraint[1].type, a1_constraint[1].master_ref, a1_constraint[1].slave_ref, "", 0);     //수정 필요.
            }
        }
        public string GetLock(string lockID)
        {
            PartsInfo partsInfo = Core.Container.Instance.Resolve <IServicePartsInfo>().GetEntity(int.Parse(lockID));

            return(partsInfo != null ? partsInfo.PartsName : "");
        }
Beispiel #15
0
        /*****************************************************************************************/
        /*****************************************************************************************/

        // Pre-Processor Assembly
        private void button3_Click_1(object sender, EventArgs e)
        {
            //Assembly file: bring CATScript and address
            string CATAssem = CATProductOpenDialog(); //Assembly CATProduct address

            if (CATAssem == "")
            {
                return;
            }

            string product_address = CATAssem;

            Console.WriteLine(product_address);
            string folder_address = CATAssem.Substring(0, CATAssem.LastIndexOf("\\"));

            Console.WriteLine(folder_address); //Assembly folder address.

            //Part file: bring address of parts folder
            string CATAssem2 = CATScriptOpenDialog();  //-> 수정 필요/ 아무 파트나 선택하면 됌.

            if (CATAssem2 == "")
            {
                return;
            }
            string folder_address_parts = CATAssem2.Substring(0, CATAssem2.LastIndexOf("\\"));

            Console.WriteLine(folder_address_parts); //part folder address.

            //part information storage
            List <PartsInfo>      part_collect  = new List <PartsInfo>();
            List <ConstraintInfo> const_collect = new List <ConstraintInfo>();

            //CATProduct location
            Assembly Product1 = new Assembly();


            //CATProduct 열어서 part number, instance name, address 가져오기.
            //constraint 갯수, 종류, master ref, slave ref 구하기.
            int part_numb  = 0;
            int const_numb = 0;

            if (Product1.InitializeCATIA(product_address, (int)0))
            {
                Console.WriteLine("working!");
                Console.WriteLine(Product1.cProduct.get_Name()); //product name

                part_numb = Product1.cProducts.Count;            // # of parts
                Console.WriteLine(part_numb);

                const_numb = Product1.cConstraints.Count; // # of constraints
                Console.WriteLine(const_numb);

                //파트 정보 가져오기
                if (part_numb > 0)  //파트 정보
                {
                    for (int i = 1; i <= part_numb; i++)
                    {
                        Console.WriteLine("");

                        string first = Product1.cProducts.Item(i).get_Name(); //instance name
                        Console.WriteLine(first);

                        string first_part = Product1.cProducts.Item(i).get_PartNumber(); //part number
                        Console.WriteLine(first_part);

                        string first_address = Product1.cProducts.Item(i).ReferenceProduct.GetMasterShapeRepresentationPathName(); //address of part 수정 필요!!!!
                        Console.WriteLine(first_address);

                        string first_transcad = first_address.Substring(first_address.LastIndexOf("\\") + 1, first_address.LastIndexOf(".") - first_address.LastIndexOf("\\") - 1);
                        Console.WriteLine(first_transcad);

                        PartsInfo temp = new PartsInfo();
                        temp.ins_name = first; temp.catname = first_part; temp.address = first_address; temp.transname = first_transcad;

                        part_collect.Add(temp);
                    }
                }

                //구속 정보 가져오기
                if (const_numb > 0)  //구속 정보
                {
                    Console.WriteLine("");
                    string second = Product1.cConstraints.Name;
                    Console.WriteLine(second);

                    for (int i = 1; i <= const_numb; i++)
                    {
                        Console.WriteLine("");
                        ConstraintInfo temp = new ConstraintInfo();

                        //constraint name
                        string second2 = Product1.cConstraints.Item(i).get_Name();
                        temp.name = second2;
                        Console.WriteLine(second2);

                        //constraint type
                        string second2t = Product1.cConstraints.Item(i).Type.ToString();
                        temp.type = second2t;
                        Console.WriteLine(second2t);

                        //master ref
                        string mas = Product1.cConstraints.Item(i).GetConstraintElement(1).DisplayName;
                        temp.master_ref = mas;
                        Console.WriteLine(mas);

                        //slave ref
                        string slv = Product1.cConstraints.Item(i).GetConstraintElement(2).DisplayName;
                        temp.slave_ref = slv;
                        Console.WriteLine(slv);

                        const_collect.Add(temp);
                    }
                }

                Product1.UninitializeCATIA();
            }

            ///////////////////////
            //파트 번역..CATParts//
            ///////////////////////


            //parts information
            PreStack stack = new PreStack();

            stack.Clear();
            for (int i = 0; i < part_numb; i++)
            {
                //수정필요
                //string trans = part_collect[i].ins_name;

                //stack.StackItem(part_collect[i].address, part_collect[i].catname, part_collect[i].ins_name);

                ///[Edit]For test A1 TestRally 20190712
                stack.StackItem(part_collect[i].address, part_collect[i].catname, part_collect[i].transname);
            }

            int modeya = 1; //constraint 번역 못하게 막음.

            if (modeya != 0)
            {
                //constraint information
                ReferenceClass.ref_Pre m_refer = new ReferenceClass.ref_Pre(stack);
                //Set constraint1 = constraints1.AddBiEltCst(catCstTypeOn, reference1, reference2)
                //m_refer.SetConstraint(stack, stack.GetSize(), a1_constraint[0].type, a1_constraint[0].master_ref, a1_constraint[0].slave_ref, "move", 0); //수정 필요. "move"???
                //m_refer.SetConstraint(stack, stack.GetSize(), a1_constraint[1].type, a1_constraint[1].master_ref, a1_constraint[1].slave_ref, "", 0); //수정 필요.

                //new Set Constraints
                for (int i = 0; i < const_numb; i++) //const_numb
                {
                    m_refer.SetConstraint(stack, stack.GetSize(), const_collect[i].type, const_collect[i].master_ref, const_collect[i].slave_ref, "", 0);
                }
            }
        }