Shinodari / Warehouse-IO

0 stars 0 forks source link

Model #2

Open Shinodari opened 3 months ago

Shinodari commented 3 months ago

Conversate about Model Package

Shinodari commented 2 months ago

Transport Class Bug ที่ Child Class ลองทบทวน Access Modifier ของ field และ property อีกครั้ง

        protected int id;
        public int ID { get { return id; } }
        protected string invoiceno;
        public string InvoiceNo { get { return invoiceno; } set { invoiceno = value; } }
        protected DateTime deliverydate;
        public DateTime DeliveryDate { get { return deliverydate; } set { deliverydate = value; } }
        protected Supplier supplier;
        public Supplier Supplier { get { return supplier; } set { supplier = value; } }
        protected List<Truck> trucklist;
        public List<Truck> TruckList { get { return trucklist; } }
        protected Storage storage;
        public Storage Storage { get { return storage; } }
        protected Dictionary <Product,int> quantityofproductlist;
        public Dictionary<Product, int> QuantityOfProductList { get { return quantityofproductlist; }set { quantityofproductlist = value; } }

field ต้องไม่มี Access Modifier Property ตาม Diagram ต้องเป็น protected

ตาม code ข้างล่างนี้

        protected virtual string TableName { get { return GetType().Name.ToLower(); } }
        protected virtual string TableName1 { get { return GetType().Name.ToLower()+"truck"; } }
        protected virtual string TableName2 { get { return GetType().Name.ToLower() + "quantityofproductlist"; } }
        protected virtual string ColumnName
        {
            get
            {
                string typeName = GetType().Name;
                string tableName = typeName.Substring(0, 1).ToUpper() + typeName.Substring(1).ToLower() + "ID";
                return tableName;
            }
        }

คาดน่าจะเป็น local variable ดังนั้นไม่ควรใช้ protected modifier และ virtual ใช้สำหรับ Inheritance เรื่อง Polymorphism ดังนั้นไม่ควรใช้ เพราะจะมีผลกับ child class get method ไม่ควรใช้กับ variable ที่ไม่ได้เป็น property

แต่เมื่อดู code โดยละเอียด พบว่ามีความพยายามใช้ super class ทำหน้าที่แทน child class ซึ่งตามหลัก OOP ไม่ควรทำ

ตามความเห็นข้างต้น จึงพบว่า Create, Change, Remove ไม่ได้เป็น abstraction ตาม Diagram

คิดว่าจะน่าต้องทำใหม่

Hibino02 commented 2 months ago
  1. แก้ใข Modifier protected
  2. แก้ใข และ สร้างเพิ่ม Transport Class: Method ใช้กับ Field
    • AddTruck()
    • RemoveTruck()
    • AddProduct()
    • RemoveProduct()
    • ChangeQuantityOfProduct()

Abstract method

Inbound & Outbound Class: สร้าง Abstract method ตามหน้าที่บนคราสลูก ref: 074c27159d75bad5efc7ae6870dfea877605700e

Hibino02 commented 2 months ago

Transport Class Bug ที่ Child Class ลองทบทวน Access Modifier ของ field และ property อีกครั้ง

        protected int id;
        public int ID { get { return id; } }
        protected string invoiceno;
        public string InvoiceNo { get { return invoiceno; } set { invoiceno = value; } }
        protected DateTime deliverydate;
        public DateTime DeliveryDate { get { return deliverydate; } set { deliverydate = value; } }
        protected Supplier supplier;
        public Supplier Supplier { get { return supplier; } set { supplier = value; } }
        protected List<Truck> trucklist;
        public List<Truck> TruckList { get { return trucklist; } }
        protected Storage storage;
        public Storage Storage { get { return storage; } }
        protected Dictionary <Product,int> quantityofproductlist;
        public Dictionary<Product, int> QuantityOfProductList { get { return quantityofproductlist; }set { quantityofproductlist = value; } }

field ต้องไม่มี Access Modifier Property ตาม Diagram ต้องเป็น protected

ไม่สามารถประกาศ Modifier เป็น Protect ได้ เนื่องจาก Class ที่ไม่ได้สืบทอดจะไม่สามารถเข้าถึง property เหล่านี้ได้ ref: 950c7543d9df2df3eff6819a3dc7e3c6bbb77502

Shinodari commented 2 months ago

จากการแก้ไขล่าสุด 5466f037b07d7695c68700768083ae1d5fa97f2a ดูคราวๆ น่าจะ ok ละ

Hibino02 commented 2 months ago

ขออณุญาติเพิ่ม Back-End ลงใน Branch UI เนื่องจาก Back-End Branch ถูก Merge ไปหมดแล้ว

Shinodari commented 2 months ago

ขออณุญาติเพิ่ม Back-End ลงใน Branch UI เนื่องจาก Back-End Branch ถูก Merge ไปหมดแล้ว

  • รายละเอียดการเพิ่ม : สร้าง Method GetM3 ลงใน คราส Dimension เพื่อคำณวน M3 ให้กับ UI ref : e0c947c

:ok_hand:

4 acknowledge

Hibino02 commented 2 months ago

แก้ใขคราส Transport ให้สอดคล้องกับ Database ref: https://github.com/Shinodari/Warehouse-IO/commit/e7bb0874114de1b8ab3f54bebf70de7cf2a6c972

Hibino02 commented 2 months ago

แก้ใขคราส Inbound & Outbound ใน Method gettrucklist & UpdateTruck ref: https://github.com/Shinodari/Warehouse-IO/commit/db2c553e5d82cc88fd76d7ac4b76e7027b47d375

Hibino02 commented 2 months ago

สร้าง Method ใน Back-End เพิ่มใน Class Transport สำหรับทำงานกับ Key ของ Dictionary ref : https://github.com/Shinodari/Warehouse-IO/commit/721c9af2544db313f20bc114c9a5099aad5172e0

Hibino02 commented 2 months ago

สร้าง Class Deliveryplace ใน Back-End (Model) เพื่อให้สอดคล้องกับ ER-Diagram ref: https://github.com/Shinodari/Warehouse-IO/commit/08c2dd936f63719de3b8f403141252a21621ce5d

Hibino02 commented 2 months ago

สร้าง Class Deliveryplace ใน Back-End (Model) เพื่อให้สอดคล้องกับ ER-Diagram ref: 08c2dd9

เพิ่มเติม Constructor ที่เกี่ยวข้อง กับ Property Inter ลงใน Back-End Transport Inbound Outbound ref: https://github.com/Shinodari/Warehouse-IO/commit/e43baec2fe04678cf82880095c72f618c964d4a8

Hibino02 commented 2 months ago

เพิ่ม Method GetQuantity() ลงในคราส Product สำหรับแปลงหน่วยในการเบิกสินค้า เช่น กิโลกรัม เป็นจำนวนนับ ref: https://github.com/Shinodari/Warehouse-IO/commit/79e626179bca79812f91941b1c207c5836d5f86d

Hibino02 commented 2 months ago

เปลี่ยน field ID จาก Int เป็น String และปรับ Constructor , Method ที่เกี่ยวข้องให้สอดคล้องกัน ref : https://github.com/Shinodari/Warehouse-IO/commit/1242e1cb409cfb91ef4377abc44062b4adf901c6