gongchunyi
11 小时以前 b7bd9b9dfe27a188e72dd0c00163587a4a956cba
test: 默认选择第一个领料
已修改1个文件
47 ■■■■■ 文件已修改
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
@@ -189,26 +189,36 @@
  const currentMaterialSelectRowIndex = ref(-1);
  let materialTempId = 0;
  const createMaterialRow = (row = {}) => ({
    tempId: row.id || `temp_${++materialTempId}`,
    id: row.id,
    processId: row.processId || row.technologyOperationId,
    technologyOperationId: row.technologyOperationId || row.processId,
    operationName: row.operationName || "",
    bom: row.bom === true,
    materialModelId: row.materialModelId || row.productModelId,
    materialName: row.materialName || row.productName || "",
    materialModel: row.materialModel || row.model || "",
    demandedQuantity: Number(row.requiredQty ?? row.demandedQuantity ?? 0),
    unit: row.unit || "",
    pickQty: Number(row.pickQty ?? row.pickQuantity ?? row.requiredQty ?? row.demandedQuantity ?? 0),
    batchNo: row.batchNo
  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
      : [],
    batchNoList: row.batchNoList || [],
  });
      : getDefaultBatchNo(batchNoList);
    return {
      tempId: row.id || `temp_${++materialTempId}`,
      id: row.id,
      processId: row.processId || row.technologyOperationId,
      technologyOperationId: row.technologyOperationId || row.processId,
      operationName: row.operationName || "",
      bom: row.bom === true,
      materialModelId: row.materialModelId || row.productModelId,
      materialName: row.materialName || row.productName || "",
      materialModel: row.materialModel || row.model || "",
      demandedQuantity: Number(row.requiredQty ?? row.demandedQuantity ?? 0),
      unit: row.unit || "",
      pickQty: Number(row.pickQty ?? row.pickQuantity ?? row.requiredQty ?? row.demandedQuantity ?? 0),
      batchNo,
      batchNoList,
    };
  };
  const getProcessOptions = async () => {
    if (!props.orderRow?.id) return;
@@ -329,7 +339,8 @@
      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;
  };