@@ -88,7 +88,7 @@ const editable = computed(() => plan.value?.canEdit === true)
const assignable = computed ( ( ) => plan . value ? . canAssign === true )
const selectedPlanStatus = computed ( ( ) => selectedContainer . value ? . planStatus || null )
const assignedInboundIds = computed ( ( ) => new Set ( ( plan . value ? . items || [ ] ) . map ( ( item ) => item . inboundId ) ) )
type SmartLoadingCandidateRow = SmartLoadingCandidate & { sourceCandidates : SmartLoadingCandidate [ ] ; memberInboundCodes : string [ ] ; memberOrderSummaries : string [ ] ; memberOrderCount : number ; inboundFragmentCount : number }
type SmartLoadingCandidateRow = SmartLoadingCandidate & { sourceCandidates : SmartLoadingCandidate [ ] ; memberInboundCodes : string [ ] ; memberOrderSummaries : string [ ] ; memberOrderCount : number ; inboundFragmentCount : number ; totalGrossWeightKg : number ; totalVolumeCbm : number }
function memberOrderSummaries < T extends { orderId : string ; orderNo ? : string | null ; inboundCode ? : string | null } > ( members : T [ ] ) {
const orders = new Map < string , { label : string ; inboundCodes : string [ ] } > ( )
for ( const member of members ) {
@@ -104,12 +104,20 @@ function groupMemberLabel(group: SmartLoadingPlanCoLoadGroup) {
? ` ${ group . memberOrderCount } 票 `
: ` ${ group . memberOrderCount } 票 · ${ group . inboundFragmentCount } 个入仓片段 `
}
function candidateTotalGrossWeight ( candidate : SmartLoadingCandidate ) {
return Number ( candidate . unitGrossWeightKg || 0 ) * Number ( candidate . availablePackageCount || 0 )
}
function candidateTotalVolume ( candidate : SmartLoadingCandidate ) {
return candidate . availableVolumeCbm == null
? Number ( candidate . averageUnitVolumeCbm || 0 ) * Number ( candidate . availablePackageCount || 0 )
: Number ( candidate . availableVolumeCbm )
}
const displayedCandidates = computed < SmartLoadingCandidateRow [ ] > ( ( ) => {
const rows : SmartLoadingCandidateRow [ ] = [ ]
const groups = new Map < string , SmartLoadingCandidate [ ] > ( )
for ( const candidate of candidates . value ) {
if ( ! candidate . coLoadGroupId ) {
rows . push ( { ... candidate , sourceCandidates : [ candidate ] , memberInboundCodes : [ candidate . inboundCode || '入仓码暂缺' ] , memberOrderSummaries : memberOrderSummaries ( [ candidate ] ) , memberOrderCount : 1 , inboundFragmentCount : 1 } )
rows . push ( { ... candidate , sourceCandidates : [ candidate ] , memberInboundCodes : [ candidate . inboundCode || '入仓码暂缺' ] , memberOrderSummaries : memberOrderSummaries ( [ candidate ] ) , memberOrderCount : 1 , inboundFragmentCount : 1 , totalGrossWeightKg : candidateTotalGrossWeight ( candidate ) , totalVolumeCbm : candidateTotalVolume ( candidate ) } )
continue
}
groups . set ( candidate . coLoadGroupId , [ ... ( groups . get ( candidate . coLoadGroupId ) || [ ] ) , candidate ] )
@@ -128,6 +136,8 @@ const displayedCandidates = computed<SmartLoadingCandidateRow[]>(() => {
memberOrderSummaries : memberOrderSummaries ( members ) ,
memberOrderCount : new Set ( members . map ( ( member ) => member . orderId ) ) . size ,
inboundFragmentCount : Number ( first . memberCount || members . length ) ,
totalGrossWeightKg : members . reduce ( ( sum , member ) => sum + candidateTotalGrossWeight ( member ) , 0 ) ,
totalVolumeCbm : members . reduce ( ( sum , member ) => sum + candidateTotalVolume ( member ) , 0 ) ,
} )
}
return rows
@@ -241,13 +251,15 @@ function preferredContainerId() {
const candidateColumns : DataTableColumn [ ] = [
{ key : 'actions' , label : '操作' , width : 92 , fixed : 'left' , slotName : 'actions' } ,
{ key : 'inboundCode' , prop : 'inboundCode' , label : '入仓码' , minWidth : 190 , fixed : 'left' , showOverflowTooltip : true } ,
{ key : 'coLoadGroup' , label : '同柜不可拆 ' , minWidth : 210 , slotName : 'coLoadGroup' } ,
{ key : 'customerName' , prop : 'customerName' , label : '客户' , minWidth : 140 } ,
{ key : 'availablePackageCount' , prop : 'availablePackageCount' , label : '可用箱数' , width : 100 } ,
{ key : 'cartonIdentityStatus' , label : '箱号归属' , width : 105 , slotName : 'cartonIdentityStatus' } ,
{ key : 'unitGrossWeightKg' , label : '平均单箱毛重' , width : 135 , slotName : 'unitGrossWeight' } ,
{ key : 'averageUnitVolumeCbm ' , label : '平均单箱体积 ' , width : 145 , slotName : 'averageUnitVolume ' } ,
{ key : 'inboundCode' , prop : 'inboundCode' , label : '入仓码' , minWidth : 140 , fixed : 'left' , showOverflowTooltip : true } ,
{ key : 'coLoadGroup' , label : '同柜' , minWidth : 80 , slotName : 'coLoadGroup' } ,
{ key : 'customerName' , prop : 'customerName' , label : '客户' , minWidth : 70 } ,
{ key : 'availablePackageCount' , prop : 'availablePackageCount' , label : '可用箱数' , width : 80 } ,
// { key: 'cartonIdentityStatus', label: '箱号归属', width: 105, slotName: 'cartonIdentityStatus' },
{ key : 'unitGrossWeightKg' , label : '平均单箱毛重' , width : 100 , slotName : 'unitGrossWeight' } ,
{ key : 'totalGrossWeightKg ' , label : '总重量 ' , width : 90 , slotName : 'candidateTotalWeight ' } ,
{ key : 'averageUnitVolumeCbm' , label : '平均单箱体积' , width : 100 , slotName : 'averageUnitVolume' } ,
{ key : 'totalVolumeCbm' , label : '总体积' , width : 90 , slotName : 'candidateTotalVolume' } ,
]
const itemColumns : DataTableColumn [ ] = [
{ key : 'actions' , label : '操作' , width : 170 , fixed : 'left' , slotName : 'actions' } ,
@@ -627,7 +639,9 @@ onMounted(() => { void load(); void loadCustomers() })
< / template >
< template # coLoadGroup = "{ row }" > < div v-if = "row.coLoadGroupId" class="candidate-group"><el-tag size="small" type="warning">{{ row.groupNo }} · {{ row.memberOrderCount }} 票 · {{ row.inboundFragmentCount }} 个入仓片段</el-tag><span v-for="summary in row.memberOrderSummaries" :key="summary">{{ summary }}</span><span>整组 {{ row.groupTotalBoxes }} 箱,必须全量进入同一柜</span><small v-if="row.blockReason" class="candidate-block">{{ row.blockReason }}</small><small v-else-if="row.locked" > 该组已锁定 , 不能重复分配 < / small > < / div > < span v-else > 普通单票 < / span > < / template >
< template # unitGrossWeight = "{ row }" > { { formatNumber ( Number ( row . unitGrossWeightKg || 0 ) , 1 ) } } kg < / template >
< template # candidateTotalWeight = "{ row }" > { { formatNumber ( Number ( row . totalGrossWeightKg || 0 ) , 1 ) } } kg < / template >
< template # averageUnitVolume = "{ row }" > { { formatNumber ( Number ( row . averageUnitVolumeCbm || 0 ) ) } } m³ < / template >
< template # candidateTotalVolume = "{ row }" > { { formatNumber ( Number ( row . totalVolumeCbm || 0 ) ) } } m³ < / template >
< template # cartonIdentityStatus > < el-tag size = "small" type = "info" effect = "plain" > 未核验 < / el-tag > < / template >
< / DataTable >
< / section >