liulijun
2026-03-10 7583978e1c6046b4cdfe9e1a18efd328a3b73e5d
优化老厂排程单信息页面(添加物料编号和幅宽的数据显示)

优化老厂排程单信息页面(添加物料编号和幅宽的数据显示)
已修改3个文件
570 ■■■■ 文件已修改
项目代码/WMS/WMSClient/src/views/outbound/outSGOrder.vue 495 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS/WMSServices/WIDESEA_Model/Models/Outbound/Dt_OutSGOrder.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderService.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WMS/WMSClient/src/views/outbound/outSGOrder.vue
@@ -1,71 +1,137 @@
<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
          }
        ],
      ]);
      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([
  <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: "shortName",
        title: "客户简称",
        type: "string",
        width: 90,
        align: "left",
      },
      {
        field: "outSGOrderStatus",
        title: "出库单状态",
        type: "string",
        width: 110,
        align: "left",
        bind: { key: "outboundStatusEnum", data: [] },
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "left",
      },
      {
        field: "materialNoWidth",
        title: "物料编号(幅宽)",
        type: "string",
        width: 160,
        align: "left",
      },
    ]);
    const detail = ref({
      cnName: "出库明细单",
      table: "OutSGOrderDetail",
      columns: [
        {
          field: "id",
          title: "Id",
@@ -77,48 +143,114 @@
          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: "outBSTOrderDetailStatus",
          title: "订单明细状态",
          type: "string",
          width: 180,
          align: "left",
          bind: { key: "outboundStatusEnum", data: [] },
        },
@@ -128,156 +260,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>
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_Model/Models/Outbound/Dt_OutSGOrder.cs
@@ -1,4 +1,4 @@
using SqlSugar;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -67,15 +67,21 @@
        public int OutSGOrderStatus { get; set; }
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "备注")]
        public string Remark { get; set; }
    /// å¤‡æ³¨
    /// </summary>
    [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "备注")]
    public string Remark { get; set; }
        /// <summary>
        /// é‡‡è´­åˆ—表
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(Dt_OutSGOrderDetail.OutSGOrderId), nameof(Id))]
        public List<Dt_OutSGOrderDetail> Details { get; set; }
    /// <summary>
    /// ç‰©æ–™ç¼–号(幅宽)
    /// </summary>
    [SugarColumn(IsIgnore = true, ColumnDescription = "物料编号(幅宽)")]
    public string MaterialNoWidth { get; set; }
    /// <summary>
    /// é‡‡è´­åˆ—表
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(Dt_OutSGOrderDetail.OutSGOrderId), nameof(Id))]
    public List<Dt_OutSGOrderDetail> Details { get; set; }
    }
}
ÏîÄ¿´úÂë/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderService.cs
@@ -1,4 +1,4 @@
using AutoMapper;
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,6 +23,8 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Http;
using HslCommunication;
using SqlSugar;
using WIDESEA_Core.Enums;
namespace WIDESEA_OutboundService
{
@@ -45,6 +47,51 @@
            _mapper = mapper;
            _unitOfWorkManage = unitOfWorkManage;
        }
        public override PageGridData<Dt_OutSGOrder> GetPageData(PageDataOptions options)
        {
            // 1. è°ƒç”¨åŸºç±»æ–¹æ³•获取分页数据
            PageGridData<Dt_OutSGOrder> pageData = base.GetPageData(options);
            // 2. å¦‚果有数据,处理每个订单的物料编号和幅宽
            if (pageData.Rows != null && pageData.Rows.Count > 0)
            {
                // èŽ·å–æ‰€æœ‰è®¢å•ID
                var orderIds = pageData.Rows.Select(o => o.Id).ToList();
                // æ‰¹é‡æŸ¥è¯¢æ‰€æœ‰å…³è”的明细,过滤掉物料编号为空的数据
                var allDetails = BaseDal.Db.Queryable<Dt_OutSGOrderDetail>()
                    .Where(d => orderIds.Contains(d.OutSGOrderId) && !string.IsNullOrEmpty(d.MaterialNo))
                    .ToList();
                // æŒ‰è®¢å•ID分组
                var detailsByOrderId = allDetails.GroupBy(d => d.OutSGOrderId).ToDictionary(g => g.Key, g => g.ToList());
                // å¤„理每个订单
                foreach (var order in pageData.Rows)
                {
                    if (detailsByOrderId.TryGetValue(order.Id, out var details))
                    {
                        // æŒ‰ç‰©æ–™ç¼–号和幅宽的组合分组:若物料代码相同但幅宽不同,会被分成不同的组
                        var materialGroups = details
                            .GroupBy(d => new {
                                MaterialNo = d.MaterialNo,
                                Width = d.Width
                            })
                            .Select(g => $"{g.Key.MaterialNo}({g.Key.Width})").ToList();
                        // å°†åˆ†ç»„结果合并为一个字符串,多个组之间用逗号分隔
                        order.MaterialNoWidth = string.Join(",", materialGroups);
                    }
                    else
                    {
                        order.MaterialNoWidth = "";
                    }
                }
            }
            return pageData;
        }
        
        public WebResponseContent AddOutSGOrder(List<SGOutOrderDTO> outOrderDTOs)
        {