Beispiel #1
0
        public async Task <GarmentUnitDeliveryOrder> GetNewData(GarmentUnitReceiptNote unitReceiptNote1 = null)
        {
            DateTimeOffset now      = DateTimeOffset.Now;
            long           nowTicks = now.Ticks;

            var garmentUnitReceiptNote = unitReceiptNote1 ?? await Task.Run(() => UNDataUtil.GetTestDataWithStorage(nowTicks));

            GarmentUnitDeliveryOrder garmentUnitDeliveryOrder = new GarmentUnitDeliveryOrder
            {
                UnitDOType      = "SAMPLE",
                UnitDODate      = DateTimeOffset.Now,
                UnitSenderId    = garmentUnitReceiptNote.UnitId,
                UnitRequestCode = garmentUnitReceiptNote.UnitCode,
                UnitRequestName = garmentUnitReceiptNote.UnitName,
                UnitRequestId   = garmentUnitReceiptNote.UnitId,
                UnitSenderCode  = garmentUnitReceiptNote.UnitCode,
                UnitSenderName  = garmentUnitReceiptNote.UnitName,
                StorageId       = garmentUnitReceiptNote.StorageId,
                StorageCode     = garmentUnitReceiptNote.StorageCode,
                StorageName     = garmentUnitReceiptNote.StorageName,
                RONo            = garmentUnitReceiptNote.Items.Select(i => i.RONo).FirstOrDefault(),
                Article         = $"Article{nowTicks}",
                Items           = new List <GarmentUnitDeliveryOrderItem>()
            };

            foreach (var item in garmentUnitReceiptNote.Items)
            {
                var garmentDOItems = UNDataUtil.ReadDOItemsByURNItemId((int)item.Id);
                garmentUnitDeliveryOrder.Items.Add(
                    new GarmentUnitDeliveryOrderItem
                {
                    IsSave         = true,
                    DODetailId     = item.DODetailId,
                    EPOItemId      = item.EPOItemId,
                    POItemId       = item.POItemId,
                    PRItemId       = item.PRItemId,
                    FabricType     = "FABRIC",
                    URNId          = garmentUnitReceiptNote.Id,
                    URNItemId      = item.Id,
                    URNNo          = garmentUnitReceiptNote.URNNo,
                    POSerialNumber = item.POSerialNumber,
                    RONo           = item.RONo,
                    ProductId      = item.ProductId,
                    ProductCode    = item.ProductCode,
                    ProductName    = item.ProductName,
                    Quantity       = (double)(item.SmallQuantity - item.OrderQuantity),
                    UomId          = item.UomId,
                    UomUnit        = item.UomUnit,
                    ReturUomId     = item.UomId,
                    ReturUomUnit   = item.UomUnit,
                    DOItemsId      = (int)garmentDOItems.Id,
                    DOCurrencyRate = 1
                });
            }

            return(garmentUnitDeliveryOrder);
        }
        public async Task <GarmentUnitDeliveryOrder> GetNewData()
        {
            DateTimeOffset now      = DateTimeOffset.Now;
            long           nowTicks = now.Ticks;

            var garmentUnitReceiptNote = await Task.Run(() => UNDataUtil.GetTestDataWithStorage(nowTicks));

            GarmentUnitDeliveryOrder garmentUnitDeliveryOrder = new GarmentUnitDeliveryOrder
            {
                UnitDOType     = "RETUR",
                UnitDODate     = DateTimeOffset.Now,
                UnitSenderId   = garmentUnitReceiptNote.UnitId,
                UnitSenderCode = garmentUnitReceiptNote.UnitCode,
                UnitSenderName = garmentUnitReceiptNote.UnitName,
                StorageId      = garmentUnitReceiptNote.StorageId,
                StorageCode    = garmentUnitReceiptNote.StorageCode,
                StorageName    = garmentUnitReceiptNote.StorageName,
                DONo           = garmentUnitReceiptNote.DONo,
                Items          = new List <GarmentUnitDeliveryOrderItem>()
            };

            foreach (var item in garmentUnitReceiptNote.Items)
            {
                garmentUnitDeliveryOrder.Items.Add(
                    new GarmentUnitDeliveryOrderItem
                {
                    IsSave            = true,
                    DODetailId        = item.DODetailId,
                    EPOItemId         = item.EPOItemId,
                    POItemId          = item.POItemId,
                    PRItemId          = item.PRItemId,
                    URNId             = garmentUnitReceiptNote.Id,
                    URNItemId         = item.Id,
                    URNNo             = garmentUnitReceiptNote.URNNo,
                    POSerialNumber    = item.POSerialNumber,
                    RONo              = item.RONo,
                    ProductId         = item.ProductId,
                    ProductCode       = item.ProductCode,
                    ProductName       = item.ProductName,
                    Quantity          = (double)(item.SmallQuantity - item.OrderQuantity),
                    UomId             = item.UomId,
                    UomUnit           = item.UomUnit,
                    ReturQuantity     = 20,
                    ReturUomId        = item.UomId,
                    ReturUomUnit      = item.UomUnit,
                    DefaultDOQuantity = 20
                });
            }

            return(garmentUnitDeliveryOrder);
        }