Beispiel #1
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5IN_SIJPSCaTI_1418 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();
            returnValue.Result = false;

            //Put your code here
            if (Parameter.InvJobProcessShelfID != null && Parameter.ProductTrackingInstanceID != null && Parameter.ShelfContentID != null)
            {
                var processShelfContent = new ORM_LOG_WRH_INJ_InventoryJob_Process_ShelfContent();
                processShelfContent.LOG_WRH_INJ_InventoryJob_Process_ShelfContentID = Guid.NewGuid();
                processShelfContent.LOG_WRH_INJ_InventoryJob_Process_Shelf_RefID    = Parameter.InvJobProcessShelfID;
                processShelfContent.LOG_WRH_Shelf_Content_RefID    = Parameter.ShelfContentID;
                processShelfContent.ExpectedQuantityOnShelfContent = Parameter.ShelfExpectedQuantity;
                processShelfContent.Tenant_RefID       = securityTicket.TenantID;
                processShelfContent.Creation_Timestamp = DateTime.Now;
                processShelfContent.Save(Connection, Transaction);

                var shelfContentsTrackingInstance = new ORM_LOG_WRH_INJ_Process_ShelfContents_TrackingInstance();
                shelfContentsTrackingInstance.ExpectedQuantityOnTrackingInstance = Parameter.TrackingInstanceExpectedQuantity;
                shelfContentsTrackingInstance.LOG_ProductTrackingInstance_RefID  = Parameter.ProductTrackingInstanceID;
                shelfContentsTrackingInstance.LOG_WRH_INJ_Process_ShelfContents_TrackingInstanceID = Guid.NewGuid();
                shelfContentsTrackingInstance.LOG_WRH_INJ_InventoryJob_Process_ShelfContent_RefID  = processShelfContent.LOG_WRH_INJ_InventoryJob_Process_ShelfContentID;
                shelfContentsTrackingInstance.Tenant_RefID       = securityTicket.TenantID;
                shelfContentsTrackingInstance.Creation_Timestamp = DateTime.Now;
                shelfContentsTrackingInstance.Save(Connection, Transaction);

                returnValue.Result = true;
            }

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6IN_SCR_1430 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();

            var paramShelves = new CL5_APOLogistic_Inventory.Atomic.Retrieval.P_L5IN_GSCwQfIJP_1023();
            paramShelves.ProcessID = Parameter.InventoryJob_Process_RefID;
            var shelves = CL5_APOLogistic_Inventory.Atomic.Retrieval.cls_Get_ShelfContent_with_Quantity_for_InventoryJob_ProcessID.Invoke(Connection, Transaction, paramShelves, securityTicket).Result;

            ORM_LOG_WRH_INJ_InventoryJob_CountingRun countingRun = new ORM_LOG_WRH_INJ_InventoryJob_CountingRun();
            countingRun.Load(Connection, Transaction, Parameter.LOG_WRH_INJ_InventoryJob_CountingRunID);
            countingRun.IsCounting_Started = true;
            countingRun.Save(Connection, Transaction);

            ORM_LOG_WRH_INJ_InventoryJob_Process_ShelfContent      processShelfContent = null;
            ORM_LOG_WRH_INJ_Process_ShelfContents_TrackingInstance processShelfContentsTrackingInstance = null;


            foreach (var itemShelfContentID in shelves.Select(x => x.LOG_WRH_Shelf_ContentID).Distinct())
            {
                var shelfContent = shelves.Single(x => x.LOG_WRH_Shelf_ContentID == itemShelfContentID);
                ORM_LOG_WRH_Shelf_Content shelfContentOrm = new ORM_LOG_WRH_Shelf_Content();
                shelfContentOrm.Load(Connection, Transaction, itemShelfContentID);
                shelfContentOrm.IsLocked = true;
                shelfContentOrm.Save(Connection, Transaction);

                processShelfContent = new ORM_LOG_WRH_INJ_InventoryJob_Process_ShelfContent();
                processShelfContent.LOG_WRH_INJ_InventoryJob_Process_ShelfContentID = Guid.NewGuid();
                processShelfContent.LOG_WRH_INJ_InventoryJob_Process_Shelf_RefID    = shelfContent.LOG_WRH_INJ_InventoryJob_Process_ShelfID;
                processShelfContent.LOG_WRH_Shelf_Content_RefID    = shelfContent.LOG_WRH_Shelf_ContentID;
                processShelfContent.ExpectedQuantityOnShelfContent = shelfContent.ShelfContent_Quantity;
                processShelfContent.Tenant_RefID       = securityTicket.TenantID;
                processShelfContent.Creation_Timestamp = DateTime.Now;
                processShelfContent.Save(Connection, Transaction);

                foreach (var ti in shelves.Where(x => x.LOG_WRH_Shelf_ContentID == itemShelfContentID))
                {
                    processShelfContentsTrackingInstance = new ORM_LOG_WRH_INJ_Process_ShelfContents_TrackingInstance();
                    processShelfContentsTrackingInstance.ExpectedQuantityOnTrackingInstance = ti.TrackingInstance_Quantity;
                    processShelfContentsTrackingInstance.LOG_ProductTrackingInstance_RefID  = ti.LOG_ProductTrackingInstanceID;
                    processShelfContentsTrackingInstance.LOG_WRH_INJ_Process_ShelfContents_TrackingInstanceID = Guid.NewGuid();
                    processShelfContentsTrackingInstance.LOG_WRH_INJ_InventoryJob_Process_ShelfContent_RefID  = processShelfContent.LOG_WRH_INJ_InventoryJob_Process_ShelfContentID;
                    processShelfContentsTrackingInstance.Tenant_RefID       = securityTicket.TenantID;
                    processShelfContentsTrackingInstance.Creation_Timestamp = DateTime.Now;
                    processShelfContentsTrackingInstance.Save(Connection, Transaction);
                }
            }

            return(returnValue);

            #endregion UserCode
        }