zss
5 天以前 fc011f6c37eec357407640d6d087150fecb6f7e9
Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_NEW_pro
已修改2个文件
114 ■■■■■ 文件已修改
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionOrder/components/MaterialLedgerDialog.vue
@@ -312,12 +312,20 @@
        !item.materialName ||
        (Number(item.pickQty) > 0 &&
          (!item.batchNo || item.batchNo.length === 0)) ||
        (item.batchNo && item.batchNo.length > 0 && Number(item.pickQty) <= 0) ||
        item.demandedQuantity === null ||
        item.demandedQuantity === undefined ||
        item.pickQty === null ||
        item.pickQty === undefined
    );
    if (invalidRow) {
      if (
        invalidRow.batchNo &&
        invalidRow.batchNo.length > 0 &&
        Number(invalidRow.pickQty) <= 0
      ) {
        return { valid: false, message: "选择了批号时,领用数量必须大于零" };
      }
      return { valid: false, message: "请完善工序、原料、批号和数量后再保存" };
    }
    return { valid: true, message: "" };
src/views/salesManagement/salesLedger/index.vue
@@ -100,12 +100,10 @@
                               width="100px"
                               align="center">
                <template #default="scope">
                  <el-tag
                      v-if="scope.row.approveStatus === 1 "
                  <el-tag v-if="scope.row.approveStatus === 1 "
                      type="success">充足
                  </el-tag>
                  <el-tag
                      v-else-if="scope.row.approveStatus === 0 && scope.row.noQuantity === 0"
                  <el-tag v-else-if="scope.row.approveStatus === 0 && scope.row.noQuantity === 0"
                      type="success">已出库
                  </el-tag>
                  <el-tag v-else
@@ -640,12 +638,10 @@
                         placeholder="请选择"
                         clearable
                         @change="calculateFromTaxRate">
                <el-option
                  v-for="dict in tax_rate"
                <el-option v-for="dict in tax_rate"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
                           :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -762,7 +758,9 @@
    </FormDialog>
    <!-- // todo 附件预览相关 -->
    <!-- 附件列表弹窗 -->
    <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" record-type="sales_ledger"
    <FileList v-if="fileDialogVisible"
              v-model:visible="fileDialogVisible"
              record-type="sales_ledger"
              :record-id="recordId"/>
    <!-- 打印预览弹窗 -->
    <el-dialog v-model="printPreviewVisible"
@@ -908,6 +906,12 @@
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="待发货数量:">
              <el-input :model-value="currentDeliveryRow?.noQuantity"
                        disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="24">
@@ -989,7 +993,9 @@
import { getCurrentDate } from "@/utils/index.js";
import {listCustomer} from "@/api/basicData/customer.js";
const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
  const FileList = defineAsyncComponent(() =>
    import("@/components/Dialog/FileList.vue")
  );
const router = useRouter();
const route = useRoute();
@@ -1112,12 +1118,13 @@
const deliveryFormVisible = ref(false);
const currentDeliveryRow = ref(null);
const getDeliveryBatchQuantity = item => {
  const quantity = item?.qualitity
      ?? item?.quantity
      ?? item?.unLockedQuantity
      ?? item?.qualifiedUnLockedQuantity
      ?? item?.qualifiedQuantity
      ?? item?.stockQuantity;
    const quantity =
      item?.qualitity ??
      item?.quantity ??
      item?.unLockedQuantity ??
      item?.qualifiedUnLockedQuantity ??
      item?.qualifiedQuantity ??
      item?.stockQuantity;
  return quantity ?? 0;
};
const getCurrentDeliveryRowQuantity = () => {
@@ -1140,11 +1147,27 @@
  return Math.max(0, Math.min(batchQuantity, remainingProductQuantity));
};
const handleDeliveryBatchQuantityChange = row => {
  const max = getDeliveryBatchDeliveryMax(row);
    const productQuantity = getCurrentDeliveryRowQuantity();
    const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
    const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
      (sum, item) => {
        if (item?.id === row?.id) return sum;
        return sum + Number(item?.deliveryQuantity || 0);
      },
      0
    );
    const remainingProductQuantity = Math.max(
      0,
      productQuantity - otherBatchTotal
    );
  const currentValue = Number(row?.deliveryQuantity || 0);
  if (currentValue > max) {
    row.deliveryQuantity = max;
    proxy.$modal.msgWarning("发货数量不能超过这个产品的数量");
    if (currentValue > batchQuantity) {
      row.deliveryQuantity = batchQuantity;
      proxy.$modal.msgWarning("发货数量不能大于库存数量");
    } else if (currentValue > remainingProductQuantity) {
      row.deliveryQuantity = remainingProductQuantity;
      proxy.$modal.msgWarning("所有批次发货数量之和不能大于待发货数量");
  }
};
const getSelectedDeliveryBatchRows = () => {
@@ -1159,13 +1182,15 @@
      ? res.data
      : res?.data?.records || res?.data?.rows || [];
  const seenIds = new Set();
  return rawList.filter(item => {
    return rawList
      .filter(item => {
    if (!item?.id || !item?.batchNo || seenIds.has(item.id)) {
      return false;
    }
    seenIds.add(item.id);
    return true;
  }).map(item => ({
      })
      .map(item => ({
    ...item,
    deliveryQuantity: 0,
  }));
@@ -2145,8 +2170,10 @@
                                                              <tbody>
                                                                ${
        item.products &&
        item.products
            .length > 0
                                                                              item
                                                                                .products
                                                                                .length >
                                                                                0
            ? item.products
                .map(
                    product => `
@@ -2178,7 +2205,9 @@
                                                                    </tr>
                                                                  `
                )
                .join("")
                                                                                    .join(
                                                                                      ""
                                                                                    )
            : '<tr><td colspan="6" style="text-align: center; color: #999;">暂无产品数据</td></tr>'
    }
                                                              </tbody>
@@ -2568,14 +2597,14 @@
};
// 打开附件弹窗
const recordId = ref(0)
const fileDialogVisible = ref(false)
  const recordId = ref(0);
  const fileDialogVisible = ref(false);
// 打开附件弹框
const openFileDialog = async (row) => {
  recordId.value = row.id
  fileDialogVisible.value = true
}
  const openFileDialog = async row => {
    recordId.value = row.id;
    fileDialogVisible.value = true;
  };
// 打开发货弹框
const openDeliveryForm = async row => {
@@ -2612,16 +2641,23 @@
          (sum, item) => sum + Number(item.deliveryQuantity || 0),
          0
      );
      const currentRowQuantity = Number(currentDeliveryRow.value?.quantity || 0);
      if (currentRowQuantity > 0 && totalDeliveryQuantity > currentRowQuantity) {
        proxy.$modal.msgWarning("批号发货总数不能超过当前产品数量");
        const currentRowNoQuantity = Number(
          currentDeliveryRow.value?.noQuantity || 0
        );
        if (
          currentRowNoQuantity > 0 &&
          totalDeliveryQuantity > currentRowNoQuantity
        ) {
          proxy.$modal.msgWarning("批号发货总数不能超过待发货数量");
        return;
      }
      // 保存当前展开的行ID,以便发货后重新加载子表格数据
      const currentExpandedKeys = [...expandedRowKeys.value];
      const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
      deliveryForm.value.batchNo = selectedBatchRows.map(item => item.id);
      const productModelId = currentDeliveryRow.value.productModelId || currentDeliveryRow.value.modelId;
        const productModelId =
          currentDeliveryRow.value.productModelId ||
          currentDeliveryRow.value.modelId;
      addShippingInfo({
        salesLedgerId: salesLedgerId,
        salesLedgerProductId: currentDeliveryRow.value.id,