|
|
@@ -20,26 +20,34 @@ logger = logging.getLogger(__name__)
|
|
|
|
|
|
# Chinese header -> internal field mapping
|
|
|
CN_COL_MAP = {
|
|
|
- '\u5e8f\u53f7': 'seq_no',
|
|
|
- '\u63a8\u5e7f\u547d\u540d': 'promotion_name',
|
|
|
- '\u7248\u672c': 'version',
|
|
|
- '\u578b\u53f7': 'model_code',
|
|
|
- '\u8f66\u578b\u4ee3\u7801': 'model_code2',
|
|
|
- '\u53d1\u52a8\u673a': 'engine',
|
|
|
- '\u6392\u653e\u6807\u51c6': 'emission_std',
|
|
|
- '\u8f66\u8f86\u7c7b\u578b': 'vehicle_type',
|
|
|
- '\u914d\u7f6e\u4fe1\u606f': 'config',
|
|
|
- '\u56fe\u7247': 'picture',
|
|
|
- '\u91c7\u8d2d\u6570\u91cf': 'quantity',
|
|
|
- '\u52a0\u88c5\u4fe1\u606f': 'add_on_info',
|
|
|
- 'FCA\u4ef7\u683c(RMB)': 'fca_price_rmb',
|
|
|
- 'FCA\u4ef7\u683c(USD)': 'fca_price_usd',
|
|
|
- '\u8fd0\u8d39(RMB)': 'freight_rmb',
|
|
|
- '\u8fd0\u8d39(USD)': 'freight_usd',
|
|
|
- '\u52a0\u88c5(RMB)': 'installation_rmb',
|
|
|
- '\u52a0\u88c5(USD)': 'installation_usd',
|
|
|
- 'FCA\u5c0f\u8ba1(RMB)': 'fca_subtotal_rmb',
|
|
|
- 'FCA\u5c0f\u8ba1(USD)': 'fca_subtotal_usd',
|
|
|
+ '序号': 'seq_no',
|
|
|
+ '推广命名': 'promotion_name',
|
|
|
+ '版本': 'version',
|
|
|
+ '型号': 'model_code',
|
|
|
+ '车型代码': 'model_code2',
|
|
|
+ '发动机': 'engine',
|
|
|
+ '排放标准': 'emission_std',
|
|
|
+ '车辆类型': 'vehicle_type',
|
|
|
+ '配置信息': 'config',
|
|
|
+ '图片': 'picture',
|
|
|
+ '采购数量': 'quantity',
|
|
|
+ '加装信息': 'add_on_info',
|
|
|
+ 'FCA价格(RMB)': 'fca_price_rmb',
|
|
|
+ 'FCA价格(USD)': 'fca_price_usd',
|
|
|
+ 'FOB价格(RMB)': 'fob_price_rmb',
|
|
|
+ 'FOB价格(USD)': 'fob_price_usd',
|
|
|
+ 'EXW价格(RMB)': 'exw_price_rmb',
|
|
|
+ 'EXW价格(USD)': 'exw_price_usd',
|
|
|
+ '运费(RMB)': 'freight_rmb',
|
|
|
+ '运费(USD)': 'freight_usd',
|
|
|
+ '加装(RMB)': 'installation_rmb',
|
|
|
+ '加装(USD)': 'installation_usd',
|
|
|
+ 'FCA小计(RMB)': 'fca_subtotal_rmb',
|
|
|
+ 'FCA小计(USD)': 'fca_subtotal_usd',
|
|
|
+ 'FOB小计(RMB)': 'fob_subtotal_rmb',
|
|
|
+ 'FOB小计(USD)': 'fob_subtotal_usd',
|
|
|
+ 'EXW小计(RMB)': 'exw_subtotal_rmb',
|
|
|
+ 'EXW小计(USD)': 'exw_subtotal_usd',
|
|
|
}
|
|
|
|
|
|
# English header -> internal field mapping
|
|
|
@@ -58,12 +66,20 @@ EN_COL_MAP = {
|
|
|
'Add-on': 'add_on_info',
|
|
|
'FCA Price(RMB)': 'fca_price_rmb',
|
|
|
'FCA Price(USD)': 'fca_price_usd',
|
|
|
+ 'FOB Price(RMB)': 'fob_price_rmb',
|
|
|
+ 'FOB Price(USD)': 'fob_price_usd',
|
|
|
+ 'EXW Price(RMB)': 'exw_price_rmb',
|
|
|
+ 'EXW Price(USD)': 'exw_price_usd',
|
|
|
'Freight(RMB)': 'freight_rmb',
|
|
|
'Freight(USD)': 'freight_usd',
|
|
|
'Add-on(RMB)': 'installation_rmb',
|
|
|
'Add-on(USD)': 'installation_usd',
|
|
|
'FCA Subtotal(RMB)': 'fca_subtotal_rmb',
|
|
|
'FCA Subtotal(USD)': 'fca_subtotal_usd',
|
|
|
+ 'FOB Subtotal(RMB)': 'fob_subtotal_rmb',
|
|
|
+ 'FOB Subtotal(USD)': 'fob_subtotal_usd',
|
|
|
+ 'EXW Subtotal(RMB)': 'exw_subtotal_rmb',
|
|
|
+ 'EXW Subtotal(USD)': 'exw_subtotal_usd',
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -167,6 +183,11 @@ def load_quotation(excel_path: str) -> dict:
|
|
|
en_rows, _, _ = _parse_sheet(wb['English Quotation'])
|
|
|
en_by_model = {r['model_code']: r for r in en_rows if r.get('model_code')}
|
|
|
merged = []
|
|
|
+ price_type = meta.get('price_type', 'FCA').upper()
|
|
|
+ price_field = {
|
|
|
+ 'FOB': 'fob_price_usd',
|
|
|
+ 'EXW': 'exw_price_usd',
|
|
|
+ }.get(price_type, 'fca_price_usd')
|
|
|
for cr in cn_rows:
|
|
|
mc = cr.get('model_code')
|
|
|
er = en_by_model.get(mc, {})
|
|
|
@@ -175,8 +196,8 @@ def load_quotation(excel_path: str) -> dict:
|
|
|
'name_cn': cr.get('promotion_name', ''),
|
|
|
'name_en': er.get('promotion_name', ''),
|
|
|
'version': cr.get('version', ''),
|
|
|
- 'unit_price_usd': cr.get('fca_price_usd'),
|
|
|
- 'unit_price_rmb': cr.get('fca_price_rmb'),
|
|
|
+ 'unit_price_usd': cr.get(price_field) or cr.get('fca_price_usd'),
|
|
|
+ 'unit_price_rmb': cr.get(price_field.replace('usd', 'rmb')) or cr.get('fca_price_rmb'),
|
|
|
'freight_usd': cr.get('freight_usd'),
|
|
|
'installation_usd': cr.get('installation_usd', 0),
|
|
|
'config_desc_cn': cr.get('config', ''),
|