liulijun
2026-03-20 1c631b345aae30bb6aa7e9dc8d856a0f40d5f1e3
ÏîÄ¿´úÂë/WMS/WMSClient/src/views/outbound/outSGOrder.vue
@@ -1,71 +1,227 @@
<template>
    <view-grid
      ref="grid"
      :columns="columns"
      :detail="detail"
      :editFormFields="editFormFields"
      :editFormOptions="editFormOptions"
      :searchFormFields="searchFormFields"
      :searchFormOptions="searchFormOptions"
      :table="table"
      :extend="extend"
    >
    </view-grid>
  </template>
      <script>
  import extend from "@/extension/outbound/outSGOrder.js";
  import { ref, defineComponent } from "vue";
  export default defineComponent({
    setup() {
      const table = ref({
        key: "id",
        footer: "Foots",
        cnName: "生管排程单",
        name: "outSGOrder",
        url: "/OutSGOrder/",
        sortName: "id",
      });
      const editFormFields = ref({
        boardMpsNo:""
      });
      const editFormOptions = ref([
        [
          {
            field: "boardMpsNo",
            title: "单据编号",
            type: "string",
            readonly:true
  <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
    :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
    :table="table" :extend="extend">
  </view-grid>
</template>
<script>
import extend from "@/extension/outbound/outSGOrder.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
  setup() {
    const table = ref({
      key: "id",
      footer: "Foots",
      cnName: "生管排程单",
      name: "outSGOrder",
      url: "/OutSGOrder/",
      sortName: "id",
    });
    const editFormFields = ref({
      boardMpsNo: ""
    });
    const editFormOptions = ref([
      [
        {
          field: "boardMpsNo",
          title: "单据编号",
          type: "string",
          readonly: true
        }
      ],
    ]);
    const searchFormFields = ref({
      outSGOrderNo: "",
      boardMpsId: "",
      orderId: "",
      outSGOrderStatus: "",
      warehouseId: "",
      shortName: "",
    });
    const searchFormOptions = ref([
      [
        { title: "WMS单号", field: "outSGOrderNo", type: "like" },
        { title: "出库上游ID", field: "boardMpsId", type: "like" },
        { title: "上游生产单号", field: "orderId", type: "like" },
        {
          title: "单据状态",
          field: "outSGOrderStatus",
          type: "select",
          dataKey: "outboundStatusEnum",
          data: [],
        },
      ],
      [
        { title: "仓库", field: "warehouseId", type: "selectList", dataKey: "warehouses", data: [], },
        { title: "客户简称", field: "shortName", type: "like" },
      ],
    ]);
    const columns = ref([
      {
        field: "id",
        title: "Id",
        type: "int",
        width: 90,
        hidden: true,
        readonly: true,
        require: true,
        align: "left",
      },
      {
        field: "warehouseId",
        title: "仓库",
        type: "string",
        width: 90,
        align: "left",
        bind: { key: "warehouses", data: [] }
      },
      {
        field: "outSGOrderNo",
        title: "WMS单号",
        type: "string",
        width: 160,
        align: "left",
        // link: true,
      },
      {
        field: "boardMpsId",
        title: "上游单据ID",
        type: "int",
        width: 160,
        align: "left",
        // link: true,
      },
      {
        field: "orderId",
        title: "排程号",
        type: "string",
        width: 160,
        align: "left",
      },
      {
        field: "number",
        title: "用纸序号",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "shortName",
        title: "客户简称",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "outSGOrderStatus",
        title: "出库单状态",
        type: "tag",
        width: 110,
        align: "left",
        bind: { key: "outboundStatusEnum", data: [] },
        getColor: (row) => {
          const status = row.outSGOrderStatus;
          if (status === 3) { // ç¼ºæ–™
            return 'danger'; // çº¢è‰²
          } else if (status === 0) { // æœªå¼€å§‹
            return 'success'; // ç»¿è‰²
          } else if (status === 1) { // å‡ºåº“中
            return 'primary'; // è“è‰²
          }
        ],
      ]);
      const searchFormFields = ref({
        outSGOrderNo: "",
        boardMpsId: "",
        orderId: "",
        outSGOrderStatus: "",
        warehouseId: "",
        shortName: "",
      });
      const searchFormOptions = ref([
        [
          { title: "WMS单号", field: "outSGOrderNo", type: "like" },
          { title: "出库上游ID", field: "boardMpsId", type: "like" },
          { title: "上游生产单号", field: "orderId", type: "like" },
          {
            title: "单据状态",
            field: "outSGOrderStatus",
            type: "select",
            dataKey: "outboundStatusEnum",
            data: [],
          },
        ],
        [
          { title: "仓库", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],},
          { title: "客户简称", field: "shortName", type: "like" },
        ],
      ]);
      const columns = ref([
          return ''; // é»˜è®¤æ— é¢œè‰²
        }
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "materialNos",
        title: "物料编号",
        type: "string",
        width: 160,
        align: "left",
        formatter: (row) => {
          const materialNos = row.materialNos;
          if (!materialNos) return materialNos;
          // å¤„理物料编号,根据每个物料的实际状态显示颜色
          const materialList = materialNos.split('/');
          let formattedMaterials = [];
          // å¦‚果有物料缺料状态字符串,根据每个物料的状态显示颜色
          if (row.materialLackStatus) {
            // è§£æžç‰©æ–™ç¼ºæ–™çŠ¶æ€å­—ç¬¦ä¸²ï¼šç‰©æ–™ç¼–å·:状态,物料编号:状态
            const statusPairs = row.materialLackStatus.split(',');
            // èŽ·å–æ‰€æœ‰ç‰©æ–™çš„ç¼ºæ–™çŠ¶æ€åˆ—è¡¨ï¼Œä¿æŒåŽŸå§‹é¡ºåº
            const lackStatusList = statusPairs.map(pair => {
              const [, isLack] = pair.split(':');
              return isLack.trim() === 'true';
            });
            // ä¸ºæ¯ä¸ªç‰©æ–™ç¼–号设置颜色,保持原始顺序
            formattedMaterials = materialList.map((materialNo, index) => {
              const trimmedMaterialNo = materialNo.trim();
              const isLack = lackStatusList[index] || false;
              if (isLack) {
                return `<span style="color: red;">${trimmedMaterialNo}</span>`;
              }
              return trimmedMaterialNo;
            });
          } else {
            // å¦‚果没有物料缺料状态信息,使用订单级别的缺料状态
            const isLack = Boolean(row.isLackMaterial);
            if (isLack) {
              return `<span style="color: red;">${materialNos}</span>`;
            }
            formattedMaterials = materialList;
          }
          return formattedMaterials.join('/');
        }
      },
      {
        field: "materialWides",
        title: "幅宽",
        type: "string",
        width: 100,
        align: "left",
        formatter: (row) => {
          const value = row.materialWides;
          if (value && typeof value === 'string') {
            return value.replace(/\.\d+$/, '');
          }
          return value;
        }
      },
      {
        field: "boardFluteNos",
        title: "楞别",
        type: "string",
        width: 100,
        align: "left"
      },
      {
        field: "isLackMaterial",
        title: "是否缺料",
        type: "string",
        width: 100,
        align: "center",
        formatter: (row) => {
          const isLack = Boolean(row.isLackMaterial);
          const text = isLack ? "是" : "否";
          const bgColor = isLack ? '#ff4d4f' : '#52c41a';
          return `<div style="background-color: ${bgColor}; color: #ffffff; text-align: center; font-weight: bold; width: 100%; height: 100%; padding: 10px 0; display: flex; justify-content: center; align-items: center;">${text}</div>`;
        }
      },
    ]);
    const detail = ref({
      cnName: "出库明细单",
      table: "OutSGOrderDetail",
      columns: [
        {
          field: "id",
          title: "Id",
@@ -77,50 +233,128 @@
          align: "left",
        },
        {
          field: "warehouseId",
          title: "仓库",
          field: "outSGOrderId",
          title: "出库单主键",
          type: "string",
          width: 90,
          align: "left",
          bind:{key: "warehouses", data: []}
        },
        {
          field: "outSGOrderNo",
          title: "WMS单号",
          type: "string",
          width: 160,
          align: "left",
          // link: true,
          hidden: true,
        },
        {
          field: "boardMpsId",
          title: "上游单据ID",
          type: "int",
          width: 160,
          align: "left",
          // link: true,
        },
        {
          field: "orderId",
          title: "上游生产单号",
          type: "string",
          width: 160,
          align: "left",
        },
        {
          field: "shortName",
          title: "客户简称",
          title: "关联的主表ID(上游)",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "outSGOrderStatus",
          title: "出库单状态",
          field: "boardMpsDetailId",
          title: "关联明细ID(上游)",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "materialNo",
          title: "物料编号",
          type: "string",
          width: 150,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "materielName",
          title: "物料名称",
          type: "string",
          width: 150,
          align: "left",
          edit: { type: "string" },
        },
        {
          field: "boardFluteNo",
          title: "楞别",
          type: "string",
          width: 110,
          align: "left",
          edit: { type: "string" },
        },
        {
          field: "machineName",
          title: "机台位",
          type: "string",
          width: 110,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "width",
          title: "幅宽",
          type: "string",
          width: 110,
          align: "left",
          edit: { type: "string" },
          required: true,
        },
        {
          field: "xqLen",
          title: "需求长度",
          type: "string",
          width: 110,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "totalUsage",
          title: "总用量",
          type: "string",
          width: 90,
          align: "left",
          edit: { type: "number" },
          required: true,
        },
        {
          field: "procurementLength",
          title: "采购长度",
          type: "string",
          width: 110,
          align: "left",
        },
        {
          field: "assignTotalUsage",
          title: "已分配用量",
          type: "string",
          width: 110,
          align: "left",
        },
        {
          field: "outTotalUsage",
          title: "已出用量",
          type: "string",
          width: 110,
          align: "left",
        },
        {
          field: "outSGOrderDetailStatus",
          title: "订单明细状态",
          type: "tag",
          width: 180,
          align: "left",
          bind: { key: "outboundStatusEnum", data: [] },
          getColor: (row) => {
            const status = row.outSGOrderDetailStatus;
            if (status === 3) { // ç¼ºæ–™
              return 'danger'; // çº¢è‰²
            } else if (status === 0) { // æœªå¼€å§‹
              return 'success'; // ç»¿è‰²
            } else if (status === 1) { // å‡ºåº“中
              return 'primary'; // è“è‰²
            }
            return ''; // é»˜è®¤æ— é¢œè‰²
          }
        },
        {
          field: "createDate",
@@ -128,156 +362,21 @@
          type: "datetime",
          width: 160,
          align: "left",
        },
      ]);
      const detail = ref({
        cnName: "出库明细单",
        table: "OutSGOrderDetail",
        columns: [
          {
            field: "id",
            title: "Id",
            type: "int",
            width: 90,
            hidden: true,
            readonly: true,
            require: true,
            align: "left",
          },
          {
            field: "outSGOrderId",
            title: "出库单主键",
            type: "string",
            width: 90,
            align: "left",
            hidden: true,
          },
          {
            field: "boardMpsId",
            title: "关联的主表ID(上游)",
            type: "string",
            width: 90,
            align: "left",
          },
          {
            field: "boardMpsDetailId",
            title: "关联明细ID(上游)",
            type: "string",
            width: 90,
            align: "left",
          },
          {
            field: "materialNo",
            title: "物料编号",
            type: "string",
            width: 150,
            align: "left",
            edit: { type: "string" },
            required: true,
          },
          {
            field: "materielName",
            title: "物料名称",
            type: "string",
            width: 150,
            align: "left",
            edit: { type: "string" },
          },
          {
            field: "boardFluteNo",
            title: "楞别",
            type: "string",
            width: 110,
            align: "left",
            edit: { type: "string" },
          },
          {
            field: "machineName",
            title: "机台位",
            type: "string",
            width: 110,
            align: "left",
            edit: { type: "string" },
            required: true,
          },
          {
            field: "width",
            title: "幅宽",
            type: "string",
            width: 110,
            align: "left",
            edit: { type: "string" },
            required: true,
          },
          {
            field: "xqLen",
            title: "需求长度",
            type: "string",
            width: 110,
            align: "left",
            edit: { type: "number" },
            required: true,
          },
          {
            field: "totalUsage",
            title: "总用量",
            type: "string",
            width: 90,
            align: "left",
            edit: { type: "number" },
            required: true,
          },
          {
            field: "procurementLength",
            title: "采购长度",
            type: "string",
            width: 110,
            align: "left",
          },
          {
            field: "assignTotalUsage",
            title: "已分配用量",
            type: "string",
            width: 110,
            align: "left",
          },
          {
            field: "outTotalUsage",
            title: "已出用量",
            type: "string",
            width: 110,
            align: "left",
          },
          {
            field: "outBSTOrderDetailStatus",
            title: "订单明细状态",
            type: "string",
            width: 180,
            align: "left",
            bind: { key: "outboundStatusEnum", data: [] },
          },
          {
            field: "createDate",
            title: "创建时间",
            type: "datetime",
            width: 160,
            align: "left",
          }
        ],
        sortName: "id",
        key: "id",
      });
      return {
        table,
        extend,
        editFormFields,
        editFormOptions,
        searchFormFields,
        searchFormOptions,
        columns,
        detail,
      };
    },
  });
  </script>
        }
      ],
      sortName: "id",
      key: "id",
    });
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
    };
  },
});
</script>