Simple Web Scraper

namespace XboxChecker
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var handler = new HttpClientHandler()
                {
                    AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
                };

                var client = new HttpClient(handler);

                var request = new HttpRequestMessage()
                {
                    RequestUri = new Uri("http://www.elgiganten.dk/product/gaming/spillekonsol/xbox/xbox-spillekonsol/xbox-series-x-1-tb-sort/218667"),
                    Method = HttpMethod.Get,
                };

                client.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
                client.DefaultRequestHeaders.Add("Accept-Language", "en-US,en;q=0.5");
                client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36");
                client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));


                var response = client.SendAsync(request).GetAwaiter().GetResult();

                response.EnsureSuccessStatusCode();

                string responseBody = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();

                Console.WriteLine(responseBody);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("Stopped!");
        }
    }
}

Create a self-signed certificate

New-SelfSignedCertificate -DnsName myDns.com -Subject "CN=MyNewCert" -certstorelocation cert:\localmachine\my

$pwd = ConvertTo-SecureString -String "Some-Strong-Password" -Force -AsPlainText

Export-PfxCertificate -cert cert:\localMachine\my\<thumbprint>  -FilePath root-authority.pfx -Password $pwd

Export-Certificate -Cert cert:\localMachine\my\<thumbprint> -FilePath root-authority.crt

 

 

Product Configuration: What's new in 2018

In this post we will summarize what is new in Product configuration for Microsoft Dynamics 365 for Finance & Operations in 2018.

Performance

The Z3 Solver strategy is now available in  Microsoft Dynamics 365 for Finance & Operations.

For details on the Z3 Sovler strategy read the dedicated blog post here: LINK

Usability

The configuration dialog can now be configured to have a multi column layout.

For details on the multi column layout read the dedicated blog post here: LINK

 

 

 

Unboxing Dell U3417W

For a while now I been looking into getting a new desktop setup for the home office.

The primary work I will be doing is coding and a little bit of photo and video editing.

At work I have been using a dual monitor setup for the past 10, or so years, so I was thinking I would go for that at home as well, but when I started to look into I came across the ‘new’ 21:9 widescreens.

After doing a bit of research, I have ended up with the Dell Ultrasharp 3417w.

Using the handheld device for reporting serial numbers as finished in production 

Introduction

A new flow for the handheld device has been released with KB article: 3148600. This flow enables the user to register the finished good serial number when reporting as finished in production. This flow is targeting a process where the finished good serial number is generated under the following conditions:

  • It is assigned by the system at the time when the production or batch order is created.
  • It is configured to be unique per one single unit of the production order. If, for example, a production order of five pieces is created, five unique serial numbers are created.

Configuration of the flow

This section provides information about how the flow is configured.

Create a new Mobile device menu item, and name it, for example, Register serial number. In the field Work creation process select Register report as finished by serial number.

mobile-device

The menu item can be added to a menu, for example, the Production menu, as shown below.

mobile-menu

Use the flow in production

This section provides information about how the new flow can be used in production.

Create a finished good

Create a new finished good that is controlled by serial number.

createfg

As this is an item enabled for the new warehouse processes, make sure the Number sequence group ID is added the product. Note: This flow is only applicable for a product that is enabled for a managed warehouse.

Associate a Serial number group, with this setup, with the released product.

numgroup

With this setting, a serial number per quantity of the finished good will be created, when the production or batch order is created.

Create a production order

Create a production order for the finished product.

createprod

When the production order is created, open the Transactions form and notice each of five transactions has a serial number assigned.

transactions

Estimate and start the production order

startstate

Open the menu for the handheld device and register report as finished for the serial number: 000006.

rafflow1

Open the Transactions form again and notice that the serial number has been reported as finished to the inventory.

transactions2

Open the Work details form and notice that work of type Finished goods put away has been created.

workdetails

 

Using the Work Policy for warehouse processes in production

Warehouse processes don’t always include warehouse work. By using the new warehouse work policy introduced with KB3184505, you can omit work warehouse processes in production for specific products and locations.

Below figure shows a scenario how the Work Policy can be used (double-click on the figures to make them bigger).

Scenario

In this scenario, we have two production orders; one for painting Comp-1 and one for the assembly of Fg-1. The production order for Comp-1 is reported as finished to the location 001. The production order for Fg-1 is later consuming Comp-1 and Rm-1 from location 001. When the production order for Fg-1 is released, warehouse work for raw material picking is generated to move Rm-1 from the Bulk locations to 001.

For this scenario, we can set up following requirements for the warehouse processes:

  • No warehouse work for Finished goods put away should be created when reporting as finished Comp-1 to location 001 because Comp-1 is later consumed on the same location by the Assembly operation.
  • No Work for Raw Material Picking should be generated for Comp-1 when releasing the Assembly operation to the warehouse.
  • Work for Raw material picking should be generated for Rm-1 when releasing the production order for the Assembly operation to the warehouse.
  • It should be possible to define location 001 as non-license plate controlled, as it acts both as a production input location and a production output location (so far it has not been possible to define the production output location as non-license plate controlled).

The following walkthrough shows how these requirements are supported by the Work Policy. First we will set up a Work policy named NoPickPutAway-001-FG1 as shown below

work policy

As it can be seen from the figure, the Work policy uses the following three criteria to define work creation:

  • The Work Order Type
  • The Location
  • The Product (selected or all products)

Above policy will prevent Finished good put away work to be generated when Reporting as finished product Comp-1 to location 001 in warehouse 51.

The policy will also prevent Work for raw material picking to be generated when releasing a production order that is consuming product Comp-1 from production input location 001.

Location 001 is defined as a non-license plate controlled location. It is pre requisite for defining a non-license plate output location, that a work policy exists for the location that prevents work for Finished goods put-away from being created.

Let’s take a closer look at the setup of the products and then how the work policy works in this scenario. Product Comp-1 has a Painting operation which is associated a resource group with output location 001

Resource group

The Assembly operation for the production order for FG-1 is consuming the products Comp-1 and RM-1 from the input location 001. The input location is setup on the resource requirements for the Assembly operation

resource

The active bill of material version for Fg-1 is setup for materials Comp-1 and Rm-1

bom version

Now we create a production order for Comp-1 for 20 pieces

CreateProdComp-1

The production order is Started

ProdStart

The production order is Reported as finished from the hand-held device in the below flow

RafFlow

In this case Comp-1 was reported as finished directly to location 001 and no put-away work was generated because of the Work policy.

Now we create a production order for FG-1

ProdCreateFG1

The production order is Estimated and Released

ProdRelease

Work for raw material picking has been generated for Rm-1, because the Work policy is only preventing work for raw material picking for product Comp-1 to be generated from location 001

WareHouseWork

In the first release of the Work policy only the following three Work order types for production are supported

  • Raw material picking
  • Finished goods put away
  • Co-product and by-product put away

Use the hand-held device to register raw material consumption in production

With KB-3164415 a new mobile device work flow for registration of raw material consumption has been introduced.

Material consumption, for production or batch orders, is in Dynamics AX done with the use of the production picking list journal. A material can be configured to be consumed either as a manual or automatic process with the use of the Flushing principle on the Bill of material or Formula lines. By selecting the principle Start or Finish it is indicated that materials should be consumed automatically, either by production order Start or when Reporting as finished. By selecting the principle Manual, it is indicated that the user should manual account for the material consumption. The reason why manual registration is sometimes required, is to secure that the actual time of the consumption corresponds with the time of registration, so material traceabiltiy can be maintained. Traceabiltiy is a typical requirement in the food industry, where all food ingredients and packaging materials that are in contact with the food ingredients, must be traceable.

The new hand-held flow works as an interface to the production picking list journal. With the hand-held device the users scans the materials on the locations and accounts for the quantity and dimensions. For each registration a production picking list journal line is created for the production order. When the user confirms the registration as completed the picking list journal is posted.

Let’s walk through a simple scenario that shows how the new work flow is configured and how it works.

The figure below shows a production process that is consuming a batch controlled raw material RM-100. The material is on-hand on location Bulk-001 on license plate PL-1 with two batches b1 and b2 both with a quantity of 100 Lbs. Warehouse work is released and processed for RM-100, picking the material from Bulk-001 to the production input location PIL-01. From the production input location consumption of the material is registered as a manual operation by the machine operator.

First create a new Mobile device menu item with the activity code Register material consumption

Add the menu item to the Production Mobile device menu

Create a production order for the finished product

The flushing principle on the bill of material line is set to Manual

The production order is Estimated and Released and warehouse work is created. After the work is processed the material is in status: Picked at the production input location.

After the production order is Started, material consumption can be registred with the new work flow. We start by consuming 25 ea of Batch B1 and after that 50 ea of batch B2:

Some additional comments to the flow:

  • If the user cancels the flow after a journal line is created, then the journal is in an un-posted state.
  • If the same user starts up the flow again, for the same production order, then any new line will be created in the existing open journal.
  • The new flow is also supporting the registration of serial numbers.
  • It is only possible to register an item number that is defined in the bill of material or formula for the selected production or batch order.
  • It is possible to over-consume a material. If a material for example is estimated to be consumed with the quantity of 100 lbs., then it is possible to over-consume with a quantity of for example 105 lbs.
  • In this example material that was in status Picked or Reserved physical on the production input location, but it is also possible to register consumption of material that is not picked or reserved from a location.
  • It is not possible to register a negative quantity

Microsoft Dynamics AX 2012 Product Configuration : Enterprise Portal

In this blog post I will explain how on user interactions are handled by the product configuration module for Microsoft Dynamics AX 2012 on the Enterprise portal.

EP_1

 

 

The figure above, is a high level illustration of how user interactions in general are processed on the Enterprise Portal (EP) for Microsoft Dynamics AX 2012. The clients access the AOS through EP, which is a web implementation built on top of Microsoft Sharepoint, hosted on a web server (IIS). The communication between EP and the AOS is synchronous using the .NET Business Connector RPC call. Each RPC call must be completed and returned, before http request timeout is exceed on the IIS.

To understand what implications the above has, when using the Product configuration module, we will go through the sequence of events, which take place when the user loads a configuration model and assigns a value to an attribute.SequenceDiagram_EP

The above illustrates the sequence of loading a configuration model and assigning an attribute a value on the Enterprise portal.

 

Loading a configuration model

 

When the user wants to configure a product, e.g. from a sales order, the requests will be handled by EP.  The EPPCConfigurator web control will be loaded, inside the web control a proxy Instance of the PCEnterprisePortalMain class is created. This proxy is used to interact with the AOS Product configuration logic.

On the AOS, the XML representation for the specific configuration model is retrieved from the database. Then the XML string is passed as argument to Product Configuration Server API, which unlike the Client API is design to support synchronous execution. In the creation of the ProductConfigurationServer instance, the XML is parsed and supporting data structures are created, just like on the Windows client implementation.

 

Once the data structures have been created, the configurator instance can start processing the constraints and calculations of the configuration model. Unlike the Windows client however, the processing on EP needs to respect a fixed time limit, in order not to cause a timeout on the web server.

 

Another difference between the Windows client an EP is the way the model is being processed. The EP implementation will attempt populate all visible enumeration and Boolean attributes. This is the equivalent of opening all the visible attribute controls on the active component in the form, and letting the configurator deduce feasibility of the values of each attribute.

The more attributes that are visible, the less time that is available to process each attribute. For components with over 20 enumeration and boolean attributes, it can happen that there is not enough time to process the feasibility of all values within the domain of the attribute.

 

Assigning values to attributes

When the user   makes an assignment to an attribute, the web form is then posted back to EP and  a request to assign the attribute is made on to the AOS. On the AOS, each call from EP executes in its own context, this implies that a new instance of the configurator is created. This instance must again parse the XML representation of the configuration model, before being able to process the user assignment. After this, the instance is disposed and a new one is created to process the assignment , same as before.

 

The main problem can be seen from the diagram in Figure 2, is the activation line of the ProductConfigurationServer object. Unlike the Windows client implementation , the configurator instance is not kept alive throughout the configuration session. The synchronous execution combined with the time limitation is the main limiting factor, which forces us to create and dispose instances of the configurator for each request.

 

The consequence of this is that the EP implementation of the configuration module, is not able to deliver a user experience which is similar to that of the Windows client for models of medium to high complexity.

 

Please keep this in mind when considering implementations of the Product Configuration module on Enterprise Portal for Microsoft Dynamics AX 2012.

 

 

 

 

Microsoft Dynamics AX 2012 Product Configuration: Windows client processing

In this blog post I will elaborate on the processing of configuration models in Microsoft Dynamics AX 2012 R2 and R3.

Win1

Figure 1

Client 1 loads a configuration model using an RPC call to the AOS to retrieve an XML representation of the configuration model. After this the processing of the configuration session happens on the client.

When Client 2 wants to load a configuration model, it goes through the same process as Client 1, by retrieving its own XML representation of the configuration model, which it wants to load. Then processing of this model happens solely on Client 2. In this way processing is distributed on the hardware of the different clients.

However, the reality for many of our customers and partners is a bit different to the picture shown Figure 1.

Win2

Figure 2

The setup in Figure 2 should be more familiar to those of you who have experience with Microsoft Dynamics AX 2012. Instead of having fat clients as in Figure 1, the users are instead connecting to the Dynamics AX windows client, using a remote desktop session, set up on a Windows server running Terminal services.

Thus when Client 1 wants to load a configuration model, it happens via the Terminal service, which is then retrieving the XML representation of the configuration model from the AOS. The processing of the configuration session then happens in the context of the remote desktop session, which is on the host of the terminal services.

The same thing repeats itself when Client 2 wants to load a configuration model. The difference between this and the previous setup is, that processing for both configuration sessions are now centralized on the host of Terminal services. This processing includes not only the processing of the underlying configuration model, but also the processing related to handling the rendering of the UI.

When we look at what is happening at a lower level, with more details, the picture looks like this:

Win3

Figure 3

The diagram in Figure 3 shows what happens when the XML representation of the configuration model has already been retrieved from the AOS. From the Xpp client it is then passed on to the Product Configuration .NET component crossing the CLR interop. In the loading phase of the configuration model inside the .NET component, the following action are executed:

  • Parsing the XML representation of the configuration model
  • Creation of supporting data structures

After these processes the .NET component starts to process the loaded model and then starts to issue events whenever it is able to deduce that an attribute must take on a certain value. These events are send back to the Xpp client which updates the page accordingly.

At some point the user will want to accept the configuration and this is done by pressing the OK button on the dialog. When this happens a method is invoked on the .NET component, which aborts any running task, and starts a new task which verifies whether the configuration is complete. The definition of a complete configuration is that all mandatory attributes have been assigned a value.

If the verification fails in the first attempt, the configurator will issue a new task to attempt to deduce any unassigned mandatory attributes. In the illustrated example, the configurator is not able to deduce all mandatory attributes, and so a message will be shown that informs the user that additional assignments are required. The user must then assign values to the remaining mandatory attributes. Here the user makes a new assignment and then presses the Ok button again, to complete the configuration. This time the verification passes as all mandatory attributes now have a value.

An important thing to notice is that the configurator instance is active or ‘alive’ throughout the configuration session. As you may know, the .NET configuration component uses a background thread to process the configuration model without locking the UI. In this way the configurator is always able to act on new user input.

 

 

Round up work for raw material picking to match the handling unit

This blog post describes the functionality of a new hofix that is released in the Microsoft Knowledge base (KB) in article 3120530.

 After installing this hotfix it is now possible to configure the location directive for raw material picking, so work can be rounded up to the nearest handling unit in which the material is picked for production.

Consider following scenario:

A food manufacturer uses a special flour for making a powdered soup mix. The flour is stored on pallets in 50 lb bags in the bulk warehouse. For making 4,475 lb of the powdered soup mix 510.15 lb of flour is needed. This corresponds to 10 x 50 lb bags + 10.15 lb. As the material is always picked in bags (the handling unit), the warehouse worker will in this case pick 11 bags. After the 11 bags are moved to the production floor, the bags are broken and 510.15 lb is weighed off and applied to the production process. The remaining quantity from the last bag will remain on the input location and either be consumed by the next batch order or moved back to the warehouse.

Before the release of this hotfix it was possible to set up in which handling unit the material should be picked, but it was not possible to round-up the quantity to the nearest handling unit. In the above example, work for raw material picking would have been created for 10 x 50 lb bags and 10 lb i.e. for the same work the material would be picked in two different units. This scenario is still supported, and is relevant for some customers who wants to weigh of the material at the warehouse location (in this case the remaining 10.15 lb).

Let us take a closer look at how the mechanism to round up work to the nearest handling unit has been enabled.

Setting up the location directive for raw material picking

In the location directive for raw material picking a new field Round up to handling unit has been introduced:

This field works together with the field Restrict by unit. In this example the location directive is set up to pick in the unit of Bag, and selecting Round up to handling unit indicates that the work generated out of the directive should be rounded up to a multiple of one handling unit.

Setting up formula and ingredient

In this example a formula version for making the soup mix is set up with a batch size of 4475 lb, consuming 510.15 lb of Flour

A unit conversion has been set up for the Flour ingredient between the unit’s bag and lb.

The following Unit sequence group is used for the item. The inventory unit must be the first unit in the sequence group, in this case lb.

Releasing work for raw material picking

A batch order is now created and released for the batch size of 4475 and warehouse work for raw material picking is generated.


As it can be seen from the work details work is in this case rounded up to 11 bags. The batch order is still only reserving the required quantity 510.15 which can be seen from the work transactions form that can be opened from the work details form:

If the rounding option had not been used on the location directive, then the resulting work would have looked like this:

In this case the warehouse worker would have to pick 10 bags and weigh of the remaining 10.15 lb on a warehouse location. This process is enabled in the location directive by adding a line that is not restricted by unit. This line will make work for the remaining quantity.