| | |
| | | siteNo: defaultSiteNo, |
| | | staNos: item.staNos || [], |
| | | sourceId: item.sourceId, |
| | | source: item.source |
| | | source: item.source, |
| | | pickingStatus: item.pickingStatus || null |
| | | }; |
| | | } |
| | | // 如果数据已经是扁平结构,直接返回 |
| | |
| | | { field: 'unit', headerName: '单位', width: 60 }, |
| | | { field: 'outQty', headerName: '出库数量', width: 110, valueFormatter: (v) => formatQuantity(v) }, |
| | | { |
| | | field: 'anfme', headerName: '库存数量', width: 110, |
| | | field: 'anfme', headerName: '库存数量', width: 160, |
| | | renderCell: (params) => ( |
| | | <OutStockAnfme value={params.value} /> |
| | | <OutStockAnfme value={params.value} row={params.row} /> |
| | | ) |
| | | }, |
| | | { |
| | |
| | | } |
| | | |
| | | const OutStockAnfme = React.memo(function OutStockAnfme(props) { |
| | | const { value } = props; |
| | | const { value, row } = props; |
| | | const pickingStatus = row?.pickingStatus; |
| | | const num = Number(value); |
| | | const hasStock = typeof num === 'number' && !Number.isNaN(num) && num > 1e-6; |
| | | if (pickingStatus) { |
| | | return ( |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', justifyContent: 'center' }}> |
| | | <span style={{ color: '#1976d2' }}>{pickingStatus}</span> |
| | | {!hasStock && <span style={{ color: 'red', fontSize: '0.85em' }}>{translate('common.edit.title.insuffInventory')}</span>} |
| | | </Box> |
| | | ); |
| | | } |
| | | return ( |
| | | hasStock ? ( |
| | | <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> |