Ejemplo n.º 1
0
        public override void Delete(BomHeader entity)
        {
            var endpoint = WebService.GetServiceEndpoint <BOMs_PortChannel>();
            var client   = new BOMs_PortClient(endpoint.Binding, endpoint.Address);

            var bom = client.Read(entity.Number);

            client.Delete(bom.Key);
        }
Ejemplo n.º 2
0
        public override void Update(BomHeader entity)
        {
            var endpoint = WebService.GetServiceEndpoint <BOMs_PortChannel>();
            var client   = new BOMs_PortClient(endpoint.Binding, endpoint.Address);

            var items = Materials.GetItemsByNumbers(entity.BomRows.Select(l => l.ChildNumber).ToArray());
            var bom   = client.Read(entity.Number);

            bom = entity.ToErpObject(bom, items);
            client.Update(ref bom);
        }
        public override void Delete(BomRow entity)
        {
            var endpoint = WebService.GetServiceEndpoint <BOMs_PortChannel>();
            var client   = new BOMs_PortClient(endpoint.Binding, endpoint.Address);

            var bom = client.Read(entity.ParentNumber);

            var line = bom?.ProdBOMLine?.FirstOrDefault(p =>
                                                        p.No.Equals(entity.ChildNumber) && Convert.ToInt32(p.Position).Equals(entity.Position));

            if (line != null)
            {
                client.Delete_ProdBOMLine(line.Key);
            }
        }
Ejemplo n.º 4
0
        public static List <BomHeader> GetBomHeaders(string number)
        {
            var bomHeaders = new List <BomHeader>();

            var endpoint = WebService.GetServiceEndpoint <BOMs_PortChannel>();
            var client   = new BOMs_PortClient(endpoint.Binding, endpoint.Address);

            var bom = client.Read(number);

            if (bom != null)
            {
                bomHeaders.Add(bom.ToPowerGateObject());
            }

            return(bomHeaders);
        }
        public override void Update(BomRow entity)
        {
            var endpoint = WebService.GetServiceEndpoint <BOMs_PortChannel>();
            var client   = new BOMs_PortClient(endpoint.Binding, endpoint.Address);

            var bom  = client.Read(entity.ParentNumber);
            var line = bom?.ProdBOMLine?.FirstOrDefault(p => p.No.Equals(entity.ChildNumber) && Convert.ToInt32(p.Position).Equals(entity.Position));

            if (line != null)
            {
                var item    = Materials.GetItemsByNumbers(new[] { line.No }).First();
                var bomList = bom.ProdBOMLine.ToList();
                bomList.Remove(line);
                bomList.Add(entity.ToErpObject(line, item));
                bom.ProdBOMLine = bomList.ToArray();
                client.Update(ref bom);
            }
        }
        public override void Create(BomRow entity)
        {
            var endpoint = WebService.GetServiceEndpoint <BOMs_PortChannel>();
            var client   = new BOMs_PortClient(endpoint.Binding, endpoint.Address);

            var bom = client.Read(entity.ParentNumber);

            if (bom == null)
            {
                return;
            }

            var item    = Materials.GetItemsByNumbers(new[] { entity.ChildNumber }).First();
            var bomList = bom.ProdBOMLine.ToList();

            bomList.Add(entity.ToErpObject(new Production_BOM_Lines(), item));
            bom.ProdBOMLine = bomList.ToArray();
            client.Update(ref bom);
        }