---
# System prepended metadata

title: DADA_SHOP的ERP系統規劃
tags: [Project Document]

---

# DADA_SHOP的ERP系統規劃
我們是一間蝦皮賣場，此系統針對DADA_SHOP商店客製化開發ERP系統，可登錄商品資料及進出貨明細，以及進行即時庫存查詢、銷貨報表查詢等功能。
```mermaid
gantt
%% 宣告這是甘特圖
    title ERP系統時間排程
		%% 給它一個標題
    dateFormat  YYYY-MM-DD
		%% 日期格式
		axisFormat  %m-%d
		%% 縱軸的日期格式
		
		section .NET WebSite
		%% 宣告一個區塊
		  規劃 : crit, done, plan, 2024-07-30, 5d
			%%語法：
			%%甘特圖上的任務名稱 : [crit], [active|done], 任務名稱, [日期|after 任務名稱], 長度
			專案時長 : active, work, after plan, 90d
			測試 : test, 2024-09-15, 45d		
        section 架構開發
          DB : crit ,active, CodeFirst, 2024-08-05, 10d
        section 商品管理
          API撰寫 : crit, active, productAPI, after CodeFirst, 13d
          DB設計 :crit , active, after CodeFirst, 10d
          前端設計 : active, after productAPI, 10d
        section 進出貨管理
          API撰寫 : crit ,active, StockAPI, after CodeFirst, 13d
          DB設計 :crit , active, after CodeFirst, 10d
          前端設計 : active, after StockAPI, 10d
        section 訂單管理
          API撰寫 : crit ,active, InAndOutGoodsAPI, 2024-09-10,13d
          DB設計 :crit , active, 2024-09-10, 10d
          前端設計 : active, after InAndOutGoodsAPI, 10d
        section 報表檢視
          API撰寫 : crit ,active, ReportAPI, 2024-9-30,13d
          DB設計 :crit , active, 2024-9-30, 10d
          前端設計 : active, after ReportAPI, 10d
        section 使用者權限
          API撰寫 : crit ,active, UserAPI, 2024-10-10,13d
          DB設計 :crit , active, 2024-10-10, 10d
          前端設計 : active, after UserAPI, 10d
		section 文案
		  撰寫文案  : copyright, 2024-07-29, 100d
		  %%todayMarker off
```
## 主要功能
* 商品資料管理
* 訂單明細
* 報表檢視
* 成本管理
* 促銷活動檢視
* 資料設定(目前只需要設定人民幣匯率)

## 架構
| Website Framework | Database | Cache |
|:-----------------:|:--------:|:-----:|
|     .Net Core     |  MySQL   | Redis |

## 資料表規劃
:::spoiler 登入(admin)
```json
"admin" : {
    "id": 1, // key
    "name": "Linda",
    "password": "ajfkjsdhg",
    "role_id": "1",
}
```
:::

:::spoiler 權限(role)
```json
"role" : {
    "id": 1, // key
    "name": "Administrator"
}
```
```json
"role_list" : {
    "id": 1, // key
    "role_id": 1,
    "role_menu_id": 1
}
//role_list Sample
[
    {
        "id": 1, // key
        "role_id": 1,
        "role_menu_id": 1
    },
    {
        "id": 2, // key
        "role_id": 1,
        "role_menu_id": 2
    }
]
```
```json
"role_menu" : {
    "id": 1, // key
    "name": "商品管理",
    "path": "/Product/Index",
    "parent_id": 0
}
//role_menu Sample
[
    {
        "id": 1, // key
        "name": "商品管理",
        "path": "/Product/Index",
        "parent_id": 0
    },
    {
        "id": 2, // key
        "name": "新增商品",
        "path": "/Product/Insert",
        "parent_id": 1
    }
]
```
:::


:::spoiler 商品資料(Product)

product_main
| Column Name | Datatype     |  KEY  | AI  |
|:----------- |:------------ |:-----:|:---:|
| id          | int(50)      |  PY   |  Y  |
| p_id        | varchar(12)  | index |     |
| name        | varchar(60)  |       |     |
| description | varchar(500) |       |     |
| cost_cny    | double       |       |     |
| cost_twd    | double       |       |     |
| link        | varchar(100) |       |     |
| launch_date | DateTime     |       |     |
| image_path  | varchar(50)  |       |     |

product_spec
| Column Name  | Datatype      | KEY   | AI    |
| :----------- | :------------ | :---: | :---: |
| id           | int(50)       | PY    | Y     |
| p_id         | varchar(12)   |       |       |
| name         | varchar(12)   |       |       |
| price        | double        |       |       |
| image_path   | varchar(50)   |       |       |
| stock_count  | int(5)        |       |       |
| restock_count| int(5)        |       |       |
| sold_count   | int(5)        |       |       |

```json
"product_main" : {
    "id": 1, // key
    "p_id": "2024_01_0001", // key
    "name": "韓系 糖果色 純色 薄款 春夏季 中筒襪 女生襪子 女襪 襪子推薦",
    "description": "馬卡龍色系，繽紛可愛，穿搭好夥伴~",
    "cost_cny": 2.5,
    "cost_twd": 15.0,
    "link": "https://detail.1688.com/offer/723794100043.html?spm=a360q.7751291.0.0.507829a8bDBS1J&sk=common",
    "launch_date": "2024-01-25",
    "image_path": "1.png",
    "product_category": "1",
}
"product_spec" : {
    "id": 1, // key
    "p_id": "2024_01_0001",
    "name": "白色",
    "price": 30,
    "image_path": "1.png",
    "stock_count": 4,
    "restock_count": 20,
    "sold_count": 16,
}
```
:::
:::spoiler 訂單資料(order)
```json
"order_main" : {
    "id": 1, // key
    "order_date": "2024-03-06",
    "shopee_order_id": "240306CM83XJQS",
    "count": 7,
    "price": 292.0,
    "platform_fees": 109.0,
    "income": 183.0,
    "cost": 130.0,
    "other_cost": 3.0,
    "sales_net": 50.0,
    "gross_profit_margin": 0.22,
    "is_ship": true,
    "ship_way": "全家", 
    "is_collection": true,
    "collection_date": "2024-03-12",
    "is_cancel": false,
    "memo": "",
}
"order_detail" : {
    "id": 1, // key
    "order_id": 1,
    "p_id": "2024_01_0001",
    "spec_id": 1,
    "count": 5,
}
```
:::
:::spoiler 進貨資料(Restock)
```json
"restock_main" : {
    "id": 1, // key
    "date": "2024-02-26",
    "price": 1552.0,
    "memo": "商品進貨",
}
"restock_detail" : {
    "id": 1, // key
    "restock_id": 1,
    "p_id": "2024_01_0001",
    "spec_id": 1,
    "count": 5,
}
```
:::
