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 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); }