refactor: [shipment] 출하 shipping 상태 수정 허용 + 배차관리 수주 정보 매핑 개선
- 출하 상세 shipping 상태에서도 수정 허용 - 배차관리 현장명/발주처/작성자를 수주 정보에서 매핑 - 배차 상태를 freight_cost_type 기반으로 판단
This commit is contained in:
@@ -27,13 +27,15 @@ interface PaginationMeta {
|
||||
function transformToListItem(data: any): VehicleDispatchItem {
|
||||
const options = data.options || {};
|
||||
const shipment = data.shipment || {};
|
||||
const order = shipment.order || {};
|
||||
const orderInfo = shipment.order_info || {};
|
||||
return {
|
||||
id: String(data.id),
|
||||
dispatchNo: options.dispatch_no || `DC-${data.id}`,
|
||||
shipmentNo: shipment.shipment_no || '',
|
||||
lotNo: shipment.lot_no || '',
|
||||
siteName: shipment.site_name || '',
|
||||
orderCustomer: shipment.customer_name || '',
|
||||
siteName: orderInfo.site_name || order.site_name || shipment.site_name || '',
|
||||
orderCustomer: orderInfo.customer_name || order.client_name || shipment.customer_name || '',
|
||||
logisticsCompany: data.logistics_company || '',
|
||||
tonnage: data.tonnage || '',
|
||||
supplyAmount: options.supply_amount || 0,
|
||||
@@ -42,9 +44,9 @@ function transformToListItem(data: any): VehicleDispatchItem {
|
||||
freightCostType: options.freight_cost_type || 'prepaid',
|
||||
vehicleNo: data.vehicle_no || '',
|
||||
driverContact: data.driver_contact || '',
|
||||
writer: options.writer || '',
|
||||
writer: shipment.creator?.name || order.writer?.name || options.writer || '',
|
||||
arrivalDateTime: data.arrival_datetime || '',
|
||||
status: options.status || 'draft',
|
||||
status: options.freight_cost_type ? 'completed' : 'draft',
|
||||
remarks: data.remarks || '',
|
||||
};
|
||||
}
|
||||
@@ -53,16 +55,18 @@ function transformToListItem(data: any): VehicleDispatchItem {
|
||||
function transformToDetail(data: any): VehicleDispatchDetail {
|
||||
const options = data.options || {};
|
||||
const shipment = data.shipment || {};
|
||||
const order = shipment.order || {};
|
||||
const orderInfo = shipment.order_info || {};
|
||||
return {
|
||||
id: String(data.id),
|
||||
dispatchNo: options.dispatch_no || `DC-${data.id}`,
|
||||
shipmentNo: shipment.shipment_no || '',
|
||||
lotNo: shipment.lot_no || '',
|
||||
siteName: shipment.site_name || '',
|
||||
orderCustomer: shipment.customer_name || '',
|
||||
siteName: orderInfo.site_name || order.site_name || shipment.site_name || '',
|
||||
orderCustomer: orderInfo.customer_name || order.client_name || shipment.customer_name || '',
|
||||
freightCostType: options.freight_cost_type || 'prepaid',
|
||||
status: options.status || 'draft',
|
||||
writer: options.writer || '',
|
||||
status: options.freight_cost_type ? 'completed' : 'draft',
|
||||
writer: shipment.creator?.name || order.writer?.name || options.writer || '',
|
||||
logisticsCompany: data.logistics_company || '',
|
||||
arrivalDateTime: data.arrival_datetime || '',
|
||||
tonnage: data.tonnage || '',
|
||||
|
||||
Reference in New Issue
Block a user