Пример #1
0
        /// <summary>
        /// Get Aid from Garp and build Aid definition with all parts
        /// </summary>
        /// <param name="ordernr">order number</param>
        /// <returns>Array of New Aid Definitions</returns>
        private Aid[] getAids(string ordernr, string aidid)
        {
            HelpClasses.Table oProdStat = new HelpClasses.Table("1R");
            Aid[] aup = new Aid[1];
            ArrayList sAidList = new ArrayList();
            ArrayList parts = new ArrayList();
            Ortoped.GarpFunctions.OrderRowFunc orf = new Ortoped.GarpFunctions.OrderRowFunc();
            OrderRowDefinitions.OrderRow[] or;

            or = orf.getAid(ordernr, aidid, false).OrderRows.ToArray();

            if (or.Length > 0)
            {
                //första orderrad till sista orderrad
                foreach (OrderRowDefinitions.OrderRow mor in or)
                {
                    if (mor.ViewInList) // AID
                    {
                        // aup.externalaidid = mOGR.Fields.Item("ANR").Value;
                        string externalaidid = mor.AidDate + mor.OrderNo.PadRight(6) + mor.AidNr + mor.Rad.PadLeft(3);
                        aup[0].name = mor.ProductName;

                        //garpaidid bör inte ligga i description, var skall det ligga?
                        aup[0].description = externalaidid;

                        if (mAGA.Find(mor.Artikel))
                        {
                            //hämta aidtypeoid!
                            aup[0].aidtypeoidSpecified = true;
                            aup[0].aidtypeoid = mAGA_SES.Value == null ? 0 : Int32.Parse(mAGA_SES.Value);
                            aup[0].aidoid = mor.AidOid;
                            aup[0].CreatedInThord = mor.CreatedInThord;
                            aup[0].orderno = mor.OrderNo;
                            aup[0].row = mor.Rad;
                            aup[0].isonumber = mAGA_STA.Value == null ? "" : mAGA_STA.Value;
                            aup[0].externalaidid = externalaidid;
                            aup[0].ProdStat = oProdStat.getIdByTX1(mor.Prodstatus);
                            aup[0].needstepSpecified = true;
                            aup[0].FirstTimePatient = mor.FirstTimePatient;
                            if (!mor.Thord_NeedStep.Equals(""))
                                aup[0].needstep = int.Parse(mor.Thord_NeedStep);
                            else
                                MessageBox.Show("Behovstrappa är inte angiven på detta hjälpmedel", "Behovstrappa");
                        }
                    }

                    Part p = new Part();

                    p.CreatedInThord = mor.CreatedInThord;
                    p.orderno = mor.OrderNo;
                    p.row = mor.Rad;
                    p.partoid = mor.PartOid;
                    p.countSpecified = true;
                    p.count = Convert.ToDecimal(mor.Antal.Replace(".", ","));

                    if (mAGT.Find(mor.Artikel))
                    {
                        p.positionid = mor.Artikel; //mAGT_TX15.Value == null ? "" : mAGT_TX15.Value;
                        if (mAGA.Find(mor.Artikel))
                        {
                            if (ECS.noNULL(mAGA_KD6.Value).Equals("N")) // If KD6 = "N" then the part have no price in Garp
                            {
                                p.priceSpecified = true;
                                p.price = Convert.ToDecimal(mor.APris.Replace(".", ","));
                            }
                            else
                            {
                                p.priceSpecified = false;
                                p.price = 0;
                            }
                        }
                        parts.Add(p);
                    }
                }
            }
            else
            {
                MessageBox.Show(null, "Order: " + ordernr + " saknas", "Finns ej", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            aup[0].parts = (Part[])parts.ToArray(typeof(Part));

            return aup;
        }
Пример #2
0
        private RemovePartDefinition[] createPartRemoveDefinition(Part[] parts)
        {
            ArrayList al = new ArrayList();
            RemovePartDefinition pr;

            foreach (Part p in parts)
            {
                if (p.CreatedInThord && p.RemoveMe)
                {
                    if (p.partoid != 0)
                    {
                        pr = new RemovePartDefinition();
                        pr.partoid = p.partoid;
                        pr.partoidSpecified = true;
                        al.Add(pr);
                    }
                    else
                        MessageBox.Show("Artikeln (" + p.positionid + ") saknar identitet i Thord (PartOid). Denna artikel kan inte\nuppdateras till Thord utan måste hanteras manuellt", "Kan inte posta till Thord");
                }
            }

            return (RemovePartDefinition[])al.ToArray(typeof(RemovePartDefinition));
        }
Пример #3
0
        private PartUpdateDefinition[] createPartUpdateDefinition(Part[] parts)
        {
            ArrayList al = new ArrayList();
            PartUpdateDefinition pu;

            foreach (Part p in parts)
            {
                if (p.CreatedInThord && !p.RemoveMe)
                {
                    if (p.partoid != 0)
                    {
                        pu = new PartUpdateDefinition();
                        pu.positionid = p.positionid;
                        pu.partoid = p.partoid;
                        pu.partoidSpecified = true;
                        pu.count = p.count;
                        pu.countSpecified = p.countSpecified;
                        pu.price = p.price;
                        pu.priceSpecified = p.priceSpecified;
                        pu.externalpartid = p.orderno.PadRight(6, '_') + p.row.Trim();
                        al.Add(pu);
                    }
                    else
                        MessageBox.Show("Artikeln (" + p.positionid + ") saknar identitet i Thord (PartOid). Denna artikel kan inte\nuppdateras till Thord utan måste hanteras manuellt", "Kan inte posta till Thord");

                }
            }

            return (PartUpdateDefinition[])al.ToArray(typeof(PartUpdateDefinition));
        }
Пример #4
0
        private NewPartDefinition[] createPartNewDefinition(Part[] parts)
        {
            ArrayList al = new ArrayList();
            NewPartDefinition np;

            if (parts == null)
                return null;

            foreach (Part p in parts)
            {
                if (!p.CreatedInThord && !p.RemoveMe)
                {
                    np = new NewPartDefinition();
                    np.positionid = p.positionid;
                    np.count = p.count;
                    np.countSpecified = p.countSpecified;
                    np.price = p.price;
                    np.priceSpecified = p.priceSpecified;
                    np.externalpartid = p.orderno.PadRight(6, '_') + p.row.Trim();
                    al.Add(np);
                }
            }

            return (NewPartDefinition[])al.ToArray(typeof(NewPartDefinition));
        }