public GarmentSewingOutDetailDto(GarmentSewingOutDetail garmentSewingOutDetail) { Id = garmentSewingOutDetail.Identity; SewingOutItemId = garmentSewingOutDetail.SewingOutItemId; Size = new SizeValueObject(garmentSewingOutDetail.SizeId.Value, garmentSewingOutDetail.SizeName); Quantity = garmentSewingOutDetail.Quantity; Uom = new Uom(garmentSewingOutDetail.UomId.Value, garmentSewingOutDetail.UomUnit); }
public GarmentCuttingOutDetailDto(GarmentCuttingOutDetail garmentCuttingOutDetail) { Id = garmentCuttingOutDetail.Identity; CutOutItemId = garmentCuttingOutDetail.CutOutItemId; Size = new SizeValueObject(garmentCuttingOutDetail.SizeId.Value, garmentCuttingOutDetail.SizeName); CuttingOutQuantity = garmentCuttingOutDetail.CuttingOutQuantity; CuttingOutUom = new Uom(garmentCuttingOutDetail.CuttingOutUomId.Value, garmentCuttingOutDetail.CuttingOutUomUnit); Color = garmentCuttingOutDetail.Color; RemainingQuantity = garmentCuttingOutDetail.RemainingQuantity; BasicPrice = garmentCuttingOutDetail.BasicPrice; Price = garmentCuttingOutDetail.Price; }
public GarmentSubconCuttingDto(GarmentSubconCutting s) { Id = s.Identity; RONo = s.RONo; Size = new SizeValueObject(s.SizeId.Value, s.SizeName); Quantity = s.Quantity; Product = new Product(s.ProductId.Value, s.ProductCode, s.ProductName); Comodity = new GarmentComodity(s.ComodityId.Value, s.ComodityCode, s.ComodityName); DesignColor = s.DesignColor; Remark = s.Remark; BasicPrice = s.BasicPrice; FinishingInQuantity = s.FinishingInQuantity; }
public GarmentExpenditureGoodItemDto(GarmentExpenditureGoodItem garmentExpenditureGoodItem) { Id = garmentExpenditureGoodItem.Identity; ExpenditureGoodId = garmentExpenditureGoodItem.ExpenditureGoodId; FinishedGoodStockId = garmentExpenditureGoodItem.FinishedGoodStockId; Size = new SizeValueObject(garmentExpenditureGoodItem.SizeId.Value, garmentExpenditureGoodItem.SizeName); Quantity = garmentExpenditureGoodItem.Quantity; Uom = new Uom(garmentExpenditureGoodItem.UomId.Value, garmentExpenditureGoodItem.UomUnit); Description = garmentExpenditureGoodItem.Description; BasicPrice = garmentExpenditureGoodItem.BasicPrice; Price = garmentExpenditureGoodItem.Price; ReturQuantity = garmentExpenditureGoodItem.ReturQuantity; }
public GarmentFinishedGoodStockDto(GarmentFinishedGoodStock finishedGoodStock) { Id = finishedGoodStock.Identity; FinishedGoodStockNo = finishedGoodStock.FinishedGoodStockNo; RONo = finishedGoodStock.RONo; Article = finishedGoodStock.Article; Unit = new UnitDepartment(finishedGoodStock.UnitId.Value, finishedGoodStock.UnitCode, finishedGoodStock.UnitName); Comodity = new GarmentComodity(finishedGoodStock.ComodityId.Value, finishedGoodStock.ComodityCode, finishedGoodStock.ComodityName); Size = new SizeValueObject(finishedGoodStock.SizeId.Value, finishedGoodStock.SizeName); Quantity = finishedGoodStock.Quantity; Uom = new Uom(finishedGoodStock.UomId.Value, finishedGoodStock.UomUnit); BasicPrice = finishedGoodStock.BasicPrice; Price = finishedGoodStock.Price; }
public GarmentFinishingInItemDto(GarmentFinishingInItem garmentFinishingInItem) { Id = garmentFinishingInItem.Identity; Product = new Product(garmentFinishingInItem.ProductId.Value, garmentFinishingInItem.ProductCode, garmentFinishingInItem.ProductName); DesignColor = garmentFinishingInItem.DesignColor; Size = new SizeValueObject(garmentFinishingInItem.SizeId.Value, garmentFinishingInItem.SizeName); Quantity = garmentFinishingInItem.Quantity; Uom = new Uom(garmentFinishingInItem.UomId.Value, garmentFinishingInItem.UomUnit); Color = garmentFinishingInItem.Color; RemainingQuantity = garmentFinishingInItem.RemainingQuantity; SewingOutItemId = garmentFinishingInItem.SewingOutItemId; FinishingInId = garmentFinishingInItem.FinishingInId; BasicPrice = garmentFinishingInItem.BasicPrice; Price = garmentFinishingInItem.Price; }
public GarmentAdjustmentItemDto(GarmentAdjustmentItem garmentAdjustmentItem) { Id = garmentAdjustmentItem.Identity; Product = new Product(garmentAdjustmentItem.ProductId.Value, garmentAdjustmentItem.ProductCode, garmentAdjustmentItem.ProductName); DesignColor = garmentAdjustmentItem.DesignColor; Size = new SizeValueObject(garmentAdjustmentItem.SizeId.Value, garmentAdjustmentItem.SizeName); Quantity = garmentAdjustmentItem.Quantity; Uom = new Uom(garmentAdjustmentItem.UomId.Value, garmentAdjustmentItem.UomUnit); Color = garmentAdjustmentItem.Color; BasicPrice = garmentAdjustmentItem.BasicPrice; SewingDOItemId = garmentAdjustmentItem.SewingDOItemId; AdjustmentId = garmentAdjustmentItem.AdjustmentId; Price = garmentAdjustmentItem.Price; FinishedGoodStockId = garmentAdjustmentItem.FinishedGoodStockId; }
public async Task <GarmentAvalComponent> Handle(PlaceGarmentAvalComponentCommand request, CancellationToken cancellationToken) { GarmentComodity garmentComodity = request.Comodity ?? new GarmentComodity(0, null, null); var avalComponentNo = GenerateNo(request); GarmentAvalComponent garmentAvalComponent = new GarmentAvalComponent( Guid.NewGuid(), avalComponentNo, new UnitDepartmentId(request.Unit.Id), request.Unit.Code, request.Unit.Name, request.AvalComponentType, request.RONo, request.Article, new GarmentComodityId(garmentComodity.Id), garmentComodity.Code, garmentComodity.Name, request.Date.GetValueOrDefault() ); foreach (var item in request.Items.Where(w => w.IsSave)) { SizeValueObject sizeValueObject = item.Size ?? new SizeValueObject(0, null); GarmentAvalComponentItem garmentAvalComponentItem = new GarmentAvalComponentItem( Guid.NewGuid(), garmentAvalComponent.Identity, item.CuttingInDetailId, item.SewingOutItemId, item.SewingOutDetailId, new ProductId(item.Product.Id), item.Product.Code, item.Product.Name, item.DesignColor, item.Color, item.Quantity, item.Quantity, new SizeId(sizeValueObject.Id), sizeValueObject.Size, item.Price, item.BasicPrice ); await _garmentAvalComponentItemRepository.Update(garmentAvalComponentItem); if (garmentAvalComponent.AvalComponentType == "CUTTING") { var cuttingInDetail = _garmentCuttingInDetailRepository.Find(f => f.Identity == garmentAvalComponentItem.CuttingInDetailId).SingleOrDefault(); if (cuttingInDetail == null) { throw new Exception($"CuttingInDetail {garmentAvalComponentItem.CuttingInDetailId} not found"); } else { cuttingInDetail.SetRemainingQuantity(cuttingInDetail.RemainingQuantity - garmentAvalComponentItem.Quantity); cuttingInDetail.Modify(); await _garmentCuttingInDetailRepository.Update(cuttingInDetail); } } else if (garmentAvalComponent.AvalComponentType == "SEWING") { //if (item.IsDifferentSize) //{ // var sewingOutDetail = _garmentSewingOutDetailRepository.Find(f => f.Identity == garmentAvalComponentItem.SewingOutDetailId).SingleOrDefault(); // if (sewingOutDetail == null) // { // throw new Exception($"SewingOutDetail {garmentAvalComponentItem.SewingOutDetailId} not found"); // } // //else // //{ // // sewingOutDetail.Modify(); // // await _garmentSewingOutDetailRepository.Update(sewingOutDetail); // //} //} //else //{ var sewingOutItem = _garmentSewingOutItemRepository.Find(f => f.Identity == garmentAvalComponentItem.SewingOutItemId).SingleOrDefault(); if (sewingOutItem == null) { throw new Exception($"SewingOutItem {garmentAvalComponentItem.SewingOutItemId} not found"); } else { sewingOutItem.SetRemainingQuantity(sewingOutItem.RemainingQuantity - garmentAvalComponentItem.Quantity); sewingOutItem.Modify(); await _garmentSewingOutItemRepository.Update(sewingOutItem); } //} } } await _garmentAvalComponentRepository.Update(garmentAvalComponent); _storage.Save(); return(garmentAvalComponent); }