public void RecordLocationTransaction(OrderLocationTransaction orderLocationTransaction, InventoryTransaction inventoryTransaction, Receipt receipt, User user)
        {
            LocationTransaction locationTransaction = GenerateOrderLocationTransaction(orderLocationTransaction, orderLocationTransaction.Location, user);

            if (inventoryTransaction.Hu != null)
            {
                locationTransaction.HuId = inventoryTransaction.Hu.HuId;
                locationTransaction.LotNo = inventoryTransaction.Hu.LotNo;
            }
            if (locationTransaction.LotNo == null || locationTransaction.LotNo == string.Empty)
            {
                locationTransaction.LotNo = inventoryTransaction.LotNo;
            }
            locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.ReceiptNo = receipt.ReceiptNo;
            locationTransaction.IpNo = receipt.ReferenceIpNo;
            locationTransaction.Qty = inventoryTransaction.Qty;
            locationTransaction.EffectiveDate = DateTime.Parse(receipt.CreateDate.ToString("yyyy-MM-dd"));
            if (orderLocationTransaction.OrderDetail.OrderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER)
            {
                OrderLocationTransaction outOrderLocationTransaction = this.orderLocationTransactionMgrE.GetOrderLocationTransaction(orderLocationTransaction.OrderDetail.Id, BusinessConstants.IO_TYPE_OUT)[0];
                locationTransaction.RefLocation = outOrderLocationTransaction.Location.Code;
                locationTransaction.RefLocationName = outOrderLocationTransaction.Location.Name;
            }

            this.CreateLocationTransaction(locationTransaction);
        }
        public void RecordLocationTransaction(OrderLocationTransaction orderLocationTransaction, InventoryTransaction inventoryTransaction, InProcessLocation inProcessLocation, User user)
        {
            LocationTransaction locationTransaction = GenerateOrderLocationTransaction(orderLocationTransaction, inventoryTransaction.Location, user);

            if (inventoryTransaction.Hu != null)
            {
                locationTransaction.HuId = inventoryTransaction.Hu.HuId;
                locationTransaction.LotNo = inventoryTransaction.Hu.LotNo;
            }
            if (locationTransaction.LotNo == null || locationTransaction.LotNo == string.Empty)
            {
                locationTransaction.LotNo = inventoryTransaction.LotNo;
            }
            locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.IpNo = inProcessLocation.IpNo;
            locationTransaction.Qty = inventoryTransaction.Qty;
            locationTransaction.EffectiveDate = DateTime.Parse(inProcessLocation.CreateDate.ToString("yyyy-MM-dd"));

            this.CreateLocationTransaction(locationTransaction);
        }
        public static InventoryTransaction CreateInventoryTransaction(LocationLotDetail locationLotDetail, decimal qty, bool isBillSettled)
        {
            InventoryTransaction inventoryTransaction = new InventoryTransaction();
            inventoryTransaction.LocationLotDetailId = locationLotDetail.Id;
            inventoryTransaction.Location = locationLotDetail.Location;
            inventoryTransaction.StorageBin = locationLotDetail.StorageBin;
            inventoryTransaction.Item = locationLotDetail.Item;
            inventoryTransaction.Hu = locationLotDetail.Hu;
            inventoryTransaction.LotNo = locationLotDetail.LotNo;
            if (!isBillSettled && locationLotDetail.IsConsignment)
            {
                inventoryTransaction.IsConsignment = locationLotDetail.IsConsignment;
                inventoryTransaction.PlannedBill = locationLotDetail.PlannedBill;
            }
            else
            {
                inventoryTransaction.IsConsignment = false;
            }
            inventoryTransaction.Qty = qty;

            return inventoryTransaction;
        }
        public void RecordLocationTransaction(InventoryTransaction inventoryTransaction, string transType, User user, string orderNo, Location refLocation, Flow productLine, string receiptNo, int? orderDetailId)
        {
            LocationTransaction locationTransaction = new LocationTransaction();

            if (inventoryTransaction.Hu != null)
            {
                locationTransaction.HuId = inventoryTransaction.Hu.HuId;
                locationTransaction.LotNo = inventoryTransaction.Hu.LotNo;
            }
            if (locationTransaction.LotNo == null || locationTransaction.LotNo == string.Empty)
            {
                locationTransaction.LotNo = inventoryTransaction.LotNo;
            }
            locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.Item = inventoryTransaction.Item.Code;
            locationTransaction.ItemDescription = inventoryTransaction.Item.Description;
            locationTransaction.Uom = inventoryTransaction.Item.Uom.Code;
            locationTransaction.Qty = inventoryTransaction.Qty;
            locationTransaction.PartyFrom = inventoryTransaction.Location.Region.Code;
            locationTransaction.PartyFromName = inventoryTransaction.Location.Region.Name;
            locationTransaction.PartyTo = inventoryTransaction.Location.Region.Code;
            locationTransaction.PartyToName = inventoryTransaction.Location.Region.Name;
            locationTransaction.Location = inventoryTransaction.Location.Code;
            locationTransaction.LocationName = inventoryTransaction.Location.Name;
            if (inventoryTransaction.StorageBin != null)
            {
                locationTransaction.StorageArea = inventoryTransaction.StorageBin.Area.Code;
                locationTransaction.StorageAreaDescription = inventoryTransaction.StorageBin.Area.Description;
                locationTransaction.StorageBin = inventoryTransaction.StorageBin.Code;
                locationTransaction.StorageBinDescription = inventoryTransaction.StorageBin.Description;
            }
            locationTransaction.TransactionType = transType;
            locationTransaction.CreateDate = DateTime.Now;
            locationTransaction.CreateUser = user.Code;
            locationTransaction.EffectiveDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
            locationTransaction.OrderNo = orderNo;
            locationTransaction.ReceiptNo = receiptNo;
            if (orderDetailId.HasValue)
            {
                locationTransaction.OrderDetailId = orderDetailId.Value;

            }
            if (refLocation != null)
            {
                locationTransaction.RefLocation = refLocation.Code;
                locationTransaction.RefLocationName = refLocation.Name;
            }
            else if (productLine != null)
            {
                locationTransaction.RefLocation = productLine.Code;
                locationTransaction.RefLocationName = productLine.Description;
            }

            this.CreateLocationTransaction(locationTransaction);
        }
 public void RecordLocationTransaction(InventoryTransaction inventoryTransaction, string transType, User user, string orderNo, Location refLocation, Flow productLine, string receiptNo)
 {
     this.RecordLocationTransaction(inventoryTransaction, transType, user, orderNo, refLocation, null, null, null);
 }
 public void RecordLocationTransaction(InventoryTransaction inventoryTransaction, string transType, User user, string orderNo, Location refLocation)
 {
     this.RecordLocationTransaction(inventoryTransaction, transType, user, orderNo, refLocation, null);
 }
 public void RecordLocationTransaction(InventoryTransaction inventoryTransaction, string transType, User user)
 {
     this.RecordLocationTransaction(inventoryTransaction, transType, user, null);
 }
        public void RecordLocationTransaction(MiscOrderDetail miscOrderDetail, InventoryTransaction inventoryTransaction, User user)
        {
            LocationTransaction locationTransaction = new LocationTransaction();
            MiscOrder miscOrder = miscOrderDetail.MiscOrder;

            locationTransaction.OrderNo = miscOrder.OrderNo;
            if (inventoryTransaction.Hu != null)
            {
                locationTransaction.HuId = inventoryTransaction.Hu.HuId;
                locationTransaction.LotNo = inventoryTransaction.Hu.LotNo;
            }
            if (locationTransaction.LotNo == null || locationTransaction.LotNo == string.Empty)
            {
                locationTransaction.LotNo = inventoryTransaction.LotNo;
            }
            locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.Item = miscOrderDetail.Item.Code;
            locationTransaction.ItemDescription = miscOrderDetail.Item.Description;
            locationTransaction.Uom = miscOrderDetail.Item.Uom.Code;
            locationTransaction.Qty = inventoryTransaction.Qty;
            locationTransaction.PartyFrom = miscOrder.Location.Region.Code;
            locationTransaction.PartyFromName = miscOrder.Location.Region.Name;
            locationTransaction.PartyTo = miscOrder.Location.Region.Code;
            locationTransaction.PartyToName = miscOrder.Location.Region.Name;
            locationTransaction.Location = miscOrder.Location.Code;
            if (locationTransaction.Location == BusinessConstants.SYSTEM_LOCATION_INSPECT)
            {
                throw new BusinessErrorException("Invalided.Location.Inspect");
            }
            if (locationTransaction.Location == BusinessConstants.SYSTEM_LOCATION_REJECT)
            {
                locationTransaction.RefLocation = inventoryTransaction.RefLocation;
            }

            locationTransaction.LocationName = miscOrder.Location.Name;
            locationTransaction.LocInOutReason = miscOrder.Reason;
            // CodeMaster codeMaster = null;
            if (miscOrder.Type == BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GI)
            {
                locationTransaction.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_UNP;
                //codeMaster = codeMasterMgr.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_STOCK_IN_REASON, miscOrder.Reason);
            }
            else if (miscOrder.Type == BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GR)
            {
                locationTransaction.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_UNP;
                //codeMaster = codeMasterMgr.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_STOCK_OUT_REASON, miscOrder.Reason);
            }
            else if (miscOrder.Type == BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_ADJ)
            {
                locationTransaction.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_CYC_CNT;
                //codeMaster = codeMasterMgr.GetCachedCodeMaster(BusinessConstants.CODE_MASTER_STOCK_ADJUST_REASON, miscOrder.Reason);
            }
            //if (codeMaster != null)
            //{
            //    locationTransaction.LocInOutReasonDescription = codeMaster.Description;
            //}
            locationTransaction.CreateDate = DateTime.Now;
            locationTransaction.CreateUser = user.Code;
            locationTransaction.EffectiveDate = DateTime.Parse(miscOrder.EffectiveDate.ToString("yyyy-MM-dd"));

            this.CreateLocationTransaction(locationTransaction);
        }