| 对比新文件 |
| | |
| | | import { |
| | | CONTRACT_KIND, |
| | | QUALITY_TYPE, |
| | | } from "../scanOut/scanOut.constants"; |
| | | import { |
| | | scanInboundSales, |
| | | scanInboundSalesUnqualified, |
| | | } from "@/api/salesManagement/salesLedger"; |
| | | import { |
| | | scanInboundPurchase, |
| | | scanInboundPurchaseUnqualified, |
| | | } from "@/api/procurementManagement/procurementLedger"; |
| | | |
| | | type AnyRow = Record<string, any>; |
| | | type AnyRef<T> = { value: T }; |
| | | |
| | | type SubmitConfig = { |
| | | runApi: (data: any) => Promise<any>; |
| | | payloadBuilder: (list: AnyRow[]) => any; |
| | | }; |
| | | |
| | | export function createSubmitConfig(scanLedgerIdRef: AnyRef<string | number | null>) { |
| | | const cfg: Record<string, SubmitConfig> = { |
| | | [`${CONTRACT_KIND.sales}-${QUALITY_TYPE.qualified}`]: { |
| | | runApi: scanInboundSales, |
| | | payloadBuilder: (list: AnyRow[]) => ({ |
| | | salesLedgerId: scanLedgerIdRef.value, |
| | | salesLedgerProductList: list, |
| | | }), |
| | | }, |
| | | [`${CONTRACT_KIND.sales}-${QUALITY_TYPE.unqualified}`]: { |
| | | runApi: scanInboundSalesUnqualified, |
| | | payloadBuilder: (list: AnyRow[]) => ({ |
| | | salesLedgerId: scanLedgerIdRef.value, |
| | | salesLedgerProductList: list, |
| | | }), |
| | | }, |
| | | [`${CONTRACT_KIND.purchase}-${QUALITY_TYPE.qualified}`]: { |
| | | runApi: scanInboundPurchase, |
| | | payloadBuilder: (list: AnyRow[]) => ({ |
| | | purchaseLedgerId: scanLedgerIdRef.value, |
| | | salesLedgerProductList: list, |
| | | }), |
| | | }, |
| | | [`${CONTRACT_KIND.purchase}-${QUALITY_TYPE.unqualified}`]: { |
| | | runApi: scanInboundPurchaseUnqualified, |
| | | payloadBuilder: (list: AnyRow[]) => ({ |
| | | purchaseLedgerId: scanLedgerIdRef.value, |
| | | salesLedgerProductList: list, |
| | | }), |
| | | }, |
| | | }; |
| | | return cfg; |
| | | } |