|
@@ -0,0 +1,324 @@
|
|
|
|
+import time
|
|
|
|
+from fastapi import FastAPI
|
|
|
|
+import sys
|
|
|
|
+import os
|
|
|
|
+import datetime
|
|
|
|
+import ast
|
|
|
|
+from fastapi.responses import JSONResponse, FileResponse
|
|
|
|
+from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
+from pydantic import BaseModel
|
|
|
|
+import uvicorn
|
|
|
|
+
|
|
|
|
+app = FastAPI(description="長慶運通系統設計")
|
|
|
|
+
|
|
|
|
+origins = [
|
|
|
|
+ "http://www.googo.org",
|
|
|
|
+ "http://www.googo.org:8080",
|
|
|
|
+ "http://0.0.0.0:8080",
|
|
|
|
+ "http://googo.org:8080",
|
|
|
|
+ "http://googo.org",
|
|
|
|
+ "http://139.162.121.30"
|
|
|
|
+]
|
|
|
|
+#uvicorn main:app --host 0.0.0.0 --port 8001
|
|
|
|
+app.add_middleware(
|
|
|
|
+ CORSMiddleware,
|
|
|
|
+ allow_origins=origins,
|
|
|
|
+ allow_credentials=True,
|
|
|
|
+ allow_methods=["*"],
|
|
|
|
+ allow_headers=["*"],
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+class q_req(BaseModel):
|
|
|
|
+ domain_name: str
|
|
|
|
+
|
|
|
|
+class kw_req(BaseModel):
|
|
|
|
+ fullurl: str
|
|
|
|
+ shorturl: str
|
|
|
|
+
|
|
|
|
+class upload_orders_item(BaseModel):
|
|
|
|
+ objtype: str
|
|
|
|
+ channel_id: str
|
|
|
|
+ customer_contract_id: str
|
|
|
|
+ shipment_type:str
|
|
|
|
+ ship_date:str
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class shipping_details(BaseModel):
|
|
|
|
+ filed_date: str
|
|
|
|
+ channel_id: str
|
|
|
|
+ customer_contract_id: str
|
|
|
|
+ shipment_type:str
|
|
|
|
+ ship_date:str
|
|
|
|
+
|
|
|
|
+@app.post("/op_doc/upload_orders",
|
|
|
|
+summary="訂單明細上傳",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 訂單明細上傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 客契代碼
|
|
|
|
+ - shipment_type: 運單種類
|
|
|
|
+ - ship_date: 出貨日期
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def upload_orders(req:upload_orders_item):
|
|
|
|
+ return "OK"
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/op_doc/query_shipping_details",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="出貨明細查詢",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 建檔日期
|
|
|
|
+ - channel_id: 入單營業所
|
|
|
|
+ - customer_contract_id: 收單營業所
|
|
|
|
+ - shipment_type: 配送類別
|
|
|
|
+ - ship_date: 通路商
|
|
|
|
+ - ship_date: 運單種類
|
|
|
|
+ - ship_date: 二配
|
|
|
|
+ - ship_date: 建檔人
|
|
|
|
+ - ship_date: 檔案名稱
|
|
|
|
+ - ship_date: 上傳時間
|
|
|
|
+ - ship_date: 傳送帳號
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def query_shipping_details():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/shipment_out",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="出貨面單",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 運單號碼
|
|
|
|
+ - shipment_type: 收貨人
|
|
|
|
+ - ship_date: 收貨人電話
|
|
|
|
+ - ship_date: 收貨人地址
|
|
|
|
+ - ship_date: 發貨人
|
|
|
|
+ - ship_date: 發貨人電話
|
|
|
|
+ - ship_date: 發貨人地址
|
|
|
|
+ - ship_date: 品名
|
|
|
|
+ - ship_date: 貨件重量
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def shipment_out():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/bag_in",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="袋進倉",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 外袋條碼
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def bag_in():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/wh_in",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="進站",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - objtype: 通路代碼
|
|
|
|
+ - objtype: 配送單號
|
|
|
|
+ - objtype: 運單號碼
|
|
|
|
+ - objtype: 配送營業站
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def wh_in():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/wh_out",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="出站",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - objtype: 通路代碼
|
|
|
|
+ - nextstop: 下一站
|
|
|
|
+ - objtype: 配送單號
|
|
|
|
+ - objtype: 運單號碼
|
|
|
|
+ - objtype: 配送營業站
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def wh_out():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/deliver_out",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="配送",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - objtype: 通路代碼
|
|
|
|
+ - objtype: 配送單號
|
|
|
|
+ - objtype: 運單號碼
|
|
|
|
+ - objtype: 配送營業站
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def deliver_out():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/sign",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="簽收",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - objtype: 簽收類別
|
|
|
|
+ - objtype: 簽收人
|
|
|
|
+ - objtype: 運單號碼
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def sign():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/whout_again",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="二次出貨",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 運單號碼
|
|
|
|
+ - shipment_type: 收貨人
|
|
|
|
+ - ship_date: 收貨人電話
|
|
|
|
+ - ship_date: 收貨人地址
|
|
|
|
+ - ship_date: 發貨人
|
|
|
|
+ - ship_date: 發貨人電話
|
|
|
|
+ - ship_date: 發貨人地址
|
|
|
|
+ - ship_date: 品名
|
|
|
|
+ - ship_date: 貨件重量
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def whout_again():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/s_return",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="退貨",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 營業所
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 倉別
|
|
|
|
+ - shipment_type: 儲區
|
|
|
|
+ - ship_date: 運單號碼
|
|
|
|
+ - ship_date: 其他說明
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def s_return():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/reprint",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="重印面單",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 運單號碼
|
|
|
|
+ - shipment_type: 收貨人
|
|
|
|
+ - ship_date: 收貨人電話
|
|
|
|
+ - ship_date: 收貨人地址
|
|
|
|
+ - ship_date: 發貨人
|
|
|
|
+ - ship_date: 發貨人電話
|
|
|
|
+ - ship_date: 發貨人地址
|
|
|
|
+ - ship_date: 品名
|
|
|
|
+ - ship_date: 貨件重量
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def reprint():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/batch_print",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="面單批次列印",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 運單號碼
|
|
|
|
+ - shipment_type: 收貨人
|
|
|
|
+ - ship_date: 收貨人電話
|
|
|
|
+ - ship_date: 收貨人地址
|
|
|
|
+ - ship_date: 發貨人
|
|
|
|
+ - ship_date: 發貨人電話
|
|
|
|
+ - ship_date: 發貨人地址
|
|
|
|
+ - ship_date: 已列印次數
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def batch_print():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@app.post("/stock_taking/print_return",
|
|
|
|
+response_model=shipping_details,
|
|
|
|
+summary="刷退條碼",
|
|
|
|
+description=
|
|
|
|
+ """
|
|
|
|
+ 回傳:
|
|
|
|
+
|
|
|
|
+ - objtype: 配送類別
|
|
|
|
+ - channel_id: 通路代碼
|
|
|
|
+ - customer_contract_id: 運單號碼
|
|
|
|
+ - shipment_type: 收貨人
|
|
|
|
+ - ship_date: 收貨人電話
|
|
|
|
+ - ship_date: 收貨人地址
|
|
|
|
+ - ship_date: 發貨人
|
|
|
|
+ - ship_date: 發貨人電話
|
|
|
|
+ - ship_date: 發貨人地址
|
|
|
|
+ - ship_date: 已列印次數
|
|
|
|
+ """
|
|
|
|
+)
|
|
|
|
+async def print_return():
|
|
|
|
+ return None
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+if __name__ == "__main__":
|
|
|
|
+ uvicorn.run("main:app", host="0.0.0.0", port=9898)
|
|
|
|
+
|