Skip to content

ShawnWon/ShawnsLogisticSystemLocal

 
 

Repository files navigation

ShawnsLogisticSystemLocal

Major Challenges and solutions: a. The largest challenge in business logic is how to deal with discrepancy during disbursement process. After long time analysis, I realised there are only two stages need to consider the discrepancy. First stage is when store clerks find the stock balance cannot meet demand quantity; second stage is when dep representative sign in not enough quantity items. For the first occasion, I created a view for store-clerk to balance the collected quantity to different departments. For the second occasion, it can be another view for dep representative to balance the received quantity to different employees, but this view can be very user-unfriendly when there are numbers of employee in a department, and due to limited time, I proposed this idea as an “extendable” feature. As the solution, I calculate the discrepancy between overall dep demanding and actual delivered quantity, and system automatically creates a new ReqItem for store clerk to refill in future.

b. Another challenge in business logic is the confusion between ReqItem and SRequisition. Since majority time of the system process is dealing ReqItems, but it requires manager to approve/reject SRequisition which contains a list of ReqItem. At beginning stage, I was trying to create SRequisition when there is delivery discrepancy, which led to a bunch of unexpected error. Until I realized we only need change status of “ReqItem” when delivering, the SRequisition need not to worry about delivered/not. For Discrepancy, we only create new ReqItem instead of SRequisition, which is a much clearer way (turn 40 lines code into 1 line and no error).

c. About warehouse management, at initial stage, I only set an attribute of stock balance for each item. Then I realized we need tracking the cost delivered to departments, and items purchased from different supplier got different unit price, so I set an attribute of stock balance in “ItemSup” class along with the unit price. Then I realized this is still not good enough to track which department the item was delivered to, and it’s better to keep history stock balance for trend analysis. So, I removed the attribute of “stock balance”, create a table of “StockCard”, to record any changes to an item’s stock balance. When we need the latest stock balance of a certain item, we just read the latest record of the item.

d. The tricky part came in when I try to do trend analysis feature with above stock management. Because we need monthly stock balance, but there might be no stock changes for a certain item in that month. So, I have to do a recursive coding to go back to the previous month until I got the stock balance. this can be time-consuming.

e. I also used “group by” to aggregate the records of StockCard to have the trend analysis feature. The respond speed is slow. So, I created a table of “MonthlyReport” and had a scheduled task to write down the consumed quant and stock balance for each item for a certain month at the last day of that month. Expecting the trend analysis view can response faster. But the result is on the contrary, the page responses even slower than before. Guess it’s due to reading from database is more time consuming than aggregate and recursively looking for stock balance. Had to roll back to previous code.

f. One big problem at beginning stage is I don’t know how to post a size-unknow dictionary to controller through json, because many occasions in this project need to do so such as submit Srequisition and store clerk collect item from warehouse etc. Then when I was doing the code, I came up with this idea that I don’t have to submit the dictionary in one post, I just put a button after each item and let user click confirm to post the demanding quantity one by one. Then confirm the overall list in a later stage. It’s more user friendly and easier to code.

g. The most popular error I met in database is that Entity Framework always creates a new row when I only want to change one of attributes. For example, when I try to set status of “ReqItem” to be “approved”, it creates a new object of “ReqItem”, and even creates a new record in “Item” and a new record in “Employee”. Spent a lot of time tracking down step by step, discovered the solution is to let “reqitem.item=db.Item.Where(x=>x.Id=itemId).FirstOrDefault();”, instead of “reqitem.item=ItemData.GetItemById(itemId);” to tell EF the exactly which ReqItem object that you are operating. After solved this error, majority of the problems within EF were cleared.

h. Regarding the delegation feature, we started with a simple new thread task to change attribute state of Employee. Then I realized we need track the delegation status, so created a new table to record the delegation. Then I realized I can hardly kill the backstage thread when manager cancel delegation before start date. Then I searched and discovered the package Fluent Scheduler. Use it to run “CheckDelegation()” on daily basis, which solved the problem.

i. Regarding the time-serious prediction, I spent many of time trying to find the predictor. Trained a model with date as predictor, the result is meaningless. Then learned from web post about the measurement of “look-back”. This solved the question of “where is the predictor?”. Not much trouble to train the neural networks. Then spent some time to convert the string data received from controller into the format that fits the neural network. After successfully displayed the first predicted value on user view, the team manager suggested we want to display prediction of coming 3 months. Googled to discover one usual way is to append the prediction value after the feed array of predictors, didn’t meet much trouble to successfully displayed predictions of 3 months. The next question is how to tell python server which item we want to predict. Tried to send multiple request parameters but failed. Then I came up to append the itemId to the head of history data array, convert into string to pass to python server, then parse it back at python end, succeed. The last problem is python doesn’t have “switch()”, searched and found the solution to define a dictionary, which key is itemId and value is the lambda expression of target model. Prediction feature accomplished.

j. When doing trend analysis feature, I was trying to draw a chart to enrich the user interface. Tested a lot of textbook code on-line, the effect was not good. Then realized ASP.Net was not designed to build front end view. Searched Java script open source of drawing a chart. There really are a lot of good design. The question left was how to pass array parameters to java script code. Came up with this simple solution, just list the array values in html file, then let the JavaScript to read from innerHTML() value. Problem solved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 42.0%
  • C# 31.6%
  • HTML 23.6%
  • Python 2.1%
  • Other 0.7%