| | |
| | | const currentMaterialSelectRowIndex = ref(-1); |
| | | let materialTempId = 0; |
| | | |
| | | const createMaterialRow = (row = {}) => ({ |
| | | const getDefaultBatchNo = batchNoList => { |
| | | if (!Array.isArray(batchNoList) || batchNoList.length === 0) return []; |
| | | return [batchNoList[0]]; |
| | | }; |
| | | |
| | | const createMaterialRow = (row = {}) => { |
| | | const batchNoList = Array.isArray(row.batchNoList) ? row.batchNoList : []; |
| | | const batchNo = row.batchNo |
| | | ? typeof row.batchNo === "string" |
| | | ? row.batchNo.split(",") |
| | | : row.batchNo |
| | | : getDefaultBatchNo(batchNoList); |
| | | |
| | | return { |
| | | tempId: row.id || `temp_${++materialTempId}`, |
| | | id: row.id, |
| | | processId: row.processId || row.technologyOperationId, |
| | |
| | | demandedQuantity: Number(row.requiredQty ?? row.demandedQuantity ?? 0), |
| | | unit: row.unit || "", |
| | | pickQty: Number(row.pickQty ?? row.pickQuantity ?? row.requiredQty ?? row.demandedQuantity ?? 0), |
| | | batchNo: row.batchNo |
| | | ? typeof row.batchNo === "string" |
| | | ? row.batchNo.split(",") |
| | | : row.batchNo |
| | | : [], |
| | | batchNoList: row.batchNoList || [], |
| | | }); |
| | | batchNo, |
| | | batchNoList, |
| | | }; |
| | | }; |
| | | |
| | | const getProcessOptions = async () => { |
| | | if (!props.orderRow?.id) return; |
| | |
| | | product.materialName || product.productName || product.name || ""; |
| | | row.materialModel = product.materialModel || product.model || ""; |
| | | row.unit = product.unit || product.measureUnit || ""; |
| | | row.batchNoList = product.batchNoList; |
| | | row.batchNoList = Array.isArray(product.batchNoList) ? product.batchNoList : []; |
| | | row.batchNo = getDefaultBatchNo(row.batchNoList); |
| | | currentMaterialSelectRowIndex.value = -1; |
| | | materialProductDialogVisible.value = false; |
| | | }; |