cuilei
23 小时以前 ab497be6338bfdeaefbaebc60081ba18453da4ef
Merge remote-tracking branch 'origin/master'
已修改4个文件
386 ■■■■■ 文件已修改
.env.production 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/cms/CuttingInventoryList.vue 204 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/MesMaterialTransferRequestList.vue 172 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mes/modules/MesMaterialTransferRequestForm.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.production
@@ -1,4 +1,4 @@
NODE_ENV=production
VUE_APP_API_BASE_URL=http://127.0.0.1:9989
VUE_APP_API_BASE_URL=http://10.210.199.3:6099
VUE_APP_CAS_BASE_URL=http://localhost:8888/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
src/views/cms/CuttingInventoryList.vue
@@ -108,8 +108,23 @@
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- 库存统计表格 -->
    <div style="margin-top: 20px;">
      <a-card title="库存统计">
        <a-table
          :pagination="statisticsPagination"
          :columns="statisticsColumns"/>in
          :dataSource="statisticsData"
          :loading="statisticsLoading"
          bordered
          size="middle">
          <span slot="inventoryStatus" slot-scope="text">
            <a-tag :color="getTagColor(text)">{{ text }}</a-tag>
          </span>
        />
      </a-card>
    </div>
    <cutting-inventory-modal ref="modalForm" @ok="modalFormOk"></cutting-inventory-modal>
@@ -173,20 +188,80 @@
          //   scopedSlots: { customRender: 'action' }
          // }
        ],
        // 统计表格列定义
        statisticsColumns: [
          {
            title:'刀具编码',
            align:"center",
            dataIndex: 'cuttingCode',
            customRender: (text, record, index) => {
              const obj = {
                children: text,
                attrs: {}
              };
              // 设置合并逻辑
              if (record.rowSpan !== undefined) {
                obj.attrs.rowSpan = record.rowSpan;
              } else {
                obj.attrs.rowSpan = 1;
              }
              return obj;
            }
          },
          {
            title: '库存状态',
            dataIndex: 'inventoryStatus',
            align: "center",
          },
          {
            title: '数量',
            dataIndex: 'cuttingIdNumber',
            align: "center"
          }
        ],
        url: {
          list: "/cms/cuttingInventory/list",
          delete: "/cms/cuttingInventory/delete",
          deleteBatch: "/cms/cuttingInventory/deleteBatch",
          exportXlsUrl: "/cms/cuttingInventory/exportXls",
          importExcelUrl: "cms/cuttingInventory/importExcel",
          statistics: "/cms/cuttingInventory/statistics" // 添加统计接口地址
        },
        dictOptions:{},
        superFieldList:[],
        // 统计数据
        statisticsData: [],
        statisticsLoading: false,
        // 为主表格保留原有的分页配置
        ipagination: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        // 为统计表格添加单独的分页配置
        statisticsPagination: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' 共' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        }
      }
    },
    created() {
    this.getSuperFieldList();
      this.loadStatisticsData();
    },
    computed: {
      importExcelUrl: function(){
@@ -203,8 +278,133 @@
        fieldList.push({type:'string',value:'inventoryStatus',text:'库存状态'})
        fieldList.push({type:'number',value:'currentLife',text:'当前寿命(百分比)'})
        this.superFieldList = fieldList
      },
      // 加载统计信息
      loadStatisticsData() {
        this.statisticsLoading = true;
        // 调用后端接口获取统计数据
        this.$http({
          url: this.url.statistics,
          method: "get",
          params: {
            ...this.getQueryParams(),
            pageNo: this.statisticsPagination.current,
            pageSize: this.statisticsPagination.pageSize
      }
        }).then((res) => {
          if (res.success) {
            // 更新统计表格的分页总数
            this.statisticsPagination.total = res.result.total;
            // 对数据进行合并处理,使用 res.result.records 而不是 res.result
            this.statisticsData = this.mergeStatisticsData(res.result.records);
    }
          this.statisticsLoading = false;
        }).catch(() => {
          this.statisticsLoading = false;
        });
      },
      // 根据状态返回标签颜色
      getTagColor(status) {
        const colorMap = {
          '正常': 'green',
          '已出库': 'orange',
        };
        return colorMap[status];
      },
      // 重写搜索方法,在搜索完成后加载统计信息
      searchQuery() {
        this.loadData(1);
        // 搜索完成后加载统计信息
        this.$nextTick(() => {
          this.loadStatisticsData();
        });
      },
      // 重写重置方法
      searchReset() {
        this.queryParam = {};
        this.loadData(1);
        this.$nextTick(() => {
          this.loadStatisticsData();
        });
      },
      // 重写加载数据方法
      loadData(arg) {
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        this.loading = true;
        this.$http({
          url: this.url.list,
          method: "get",
          params: params
        }).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records;
            this.ipagination.total = res.result.total;
            // 加载统计信息
            this.loadStatisticsData();
          }
          this.loading = false;
        })
      },
      // 合并统计数据方法
      mergeStatisticsData(data) {
        if (!data || data.length === 0) return [];
        const grouped = {};
        // 按刀具编码分组
        data.forEach(item => {
          const key = item.cuttingCode;
          if (!grouped[key]) {
            grouped[key] = {
              cuttingCode: item.cuttingCode,
              cuttingId: item.cuttingId,
              statuses: []
            };
          }
          // 使用 item.inventoryStatus 和 item.cuttingIdNumber
          grouped[key].statuses.push({
            status: item.inventoryStatus,
            count: item.cuttingIdNumber
          });
        });
        // 转换为表格需要的格式,并添加行合并信息
        const result = [];
        Object.values(grouped).forEach(group => {
          const statuses = group.statuses;
          const totalCount = statuses.reduce((sum, s) => sum + s.count, 0);
          // 第一行显示刀具编码,设置rowSpan
          result.push({
            cuttingCode: group.cuttingCode,
            cuttingId: group.cuttingId,
            inventoryStatus: `${statuses[0].status}:${statuses[0].count}`,
            cuttingIdNumber: totalCount,
            rowSpan: statuses.length  // 合并的行数
          });
          // 剩余行只显示状态信息,刀具编码列rowSpan为0
          for (let i = 1; i < statuses.length; i++) {
            result.push({
              cuttingCode: group.cuttingCode,
              cuttingId: group.cuttingId,
              inventoryStatus: `${statuses[i].status}:${statuses[i].count}`,
              cuttingIdNumber: totalCount,
              rowSpan: 0  // 表示被合并
            });
          }
        });
        return result;
      }
    },
  }
</script>
<style scoped>
src/views/mes/MesMaterialTransferRequestList.vue
@@ -14,7 +14,15 @@
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
          <a-menu-item key="1" @click="batchPublish">
            <a-icon type="check-circle" theme="filled" />
            发布
          </a-menu-item>
          <a-menu-item key="2" @click="batchRequest">
            <a-icon type="check-square" theme="filled" />
            请求WMS
          </a-menu-item>
          <a-menu-item key="3" @click="batchDel">
            <a-icon type="delete" />
            删除
          </a-menu-item>
@@ -47,16 +55,23 @@
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a @click="handleEdit(record)" v-if="record.publishStatus === 'WAIT_PUBLISH'">编辑</a>
          <a-divider type="vertical" v-if="record.publishStatus === 'WAIT_PUBLISH'" />
          <a-popconfirm title="确定发布吗?" @confirm="() => handlePublish(record.id)" v-if="record.publishStatus === 'WAIT_PUBLISH'">
            <a>发布</a>
          </a-popconfirm>
          <a-divider type="vertical" v-if="record.publishStatus === 'WAIT_PUBLISH'" />
          <a-popconfirm title="确定请求WMS吗?" @confirm="() => handleRequest(record.id)" v-if="record.publishStatus === 'PUBLISHED' && record.requestStatus === 'WAIT_REQUEST'">
            <a>请求WMS</a>
          </a-popconfirm>
          <a-divider type="vertical" v-if="record.publishStatus === 'PUBLISHED' && record.requestStatus === 'WAIT_REQUEST'" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
              <a-menu-item v-if="record.publishStatus === 'WAIT_PUBLISH'">
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
@@ -78,6 +93,7 @@
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import MesMaterialTransferRequestModal from './modules/MesMaterialTransferRequestModal'
import { putAction } from '@api/manage'
export default {
  name: 'MesMaterialTransferRequestList',
@@ -187,14 +203,156 @@
      url: {
        list: '/mes/mesMaterialTransferRequest/list',
        delete: '/mes/mesMaterialTransferRequest/delete',
        deleteBatch: '/mes/mesMaterialTransferRequest/deleteBatch'
        deleteBatch: '/mes/mesMaterialTransferRequest/deleteBatch',
        publish: '/mes/mesMaterialTransferRequest/publish',
        publishBatch: '/mes/mesMaterialTransferRequest/publishBatch',
        request: '/mes/mesMaterialTransferRequest/request',
        requestBatch: '/mes/mesMaterialTransferRequest/requestBatch'
      }
    }
  },
  created() {
  },
  computed: {},
  methods: {}
  methods: {
    handlePublish(id) {
      if(!this.url.publish){
        this.$message.error("请设置url.publish属性!")
        return
      }
      let that = this;
      putAction(that.url.publish, {id: id}).then((res) => {
        if (res.success) {
          // that.$message.success(res.message);
          that.$notification.success({
            message:'消息',
            description:res.message
          });
          that.loadData();
        } else {
          // that.$message.warning(res.message);
          that.$notification.warning({
            message:'消息',
            description:res.message
          });
        }
      });
    },
    handleRequest(id) {
      if(!this.url.request){
        this.$message.error("请设置url.request属性!")
        return
      }
      let that = this;
      putAction(that.url.request, {id: id}).then((res) => {
        if (res.success) {
          // that.$message.success(res.message);
          that.$notification.success({
            message:'消息',
            description:res.message
          });
          that.loadData();
        } else {
          // that.$message.warning(res.message);
          that.$notification.warning({
            message:'消息',
            description:res.message
          });
        }
      });
    },
    batchPublish() {
      if (!this.url.publishBatch) {
        this.$message.error('请设置url.publishBatch属性!')
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        // this.$message.warning('请选择一条记录!');
        this.$notification.warning({
          message: '消息',
          description: '请选择一条记录'
        })
      } else {
        let ids = ''
        for (let a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        let that = this
        this.$confirm({
          title: '确认发布',
          content: '是否发布选中数据?',
          onOk: function() {
            that.loading = true
            putAction(that.url.publishBatch, { ids: ids }).then((res) => {
              if (res.success) {
                // that.$message.success(res.message);
                that.$notification.success({
                  message: '消息',
                  description: res.message
                })
                that.loadData()
                that.onClearSelected()
              } else {
                // that.$message.warning(res.message);
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.loading = false
            })
          }
        })
      }
    },
    batchRequest() {
      if (!this.url.requestBatch) {
        this.$message.error('请设置url.requestBatch属性!')
        return
      }
      if (this.selectedRowKeys.length <= 0) {
        // this.$message.warning('请选择一条记录!');
        this.$notification.warning({
          message: '消息',
          description: '请选择一条记录'
        })
      } else {
        let ids = ''
        for (let a = 0; a < this.selectedRowKeys.length; a++) {
          ids += this.selectedRowKeys[a] + ','
        }
        let that = this
        this.$confirm({
          title: '确认请求WMS',
          content: '是否将选中数据请求WMS?',
          onOk: function() {
            that.loading = true
            putAction(that.url.requestBatch, { ids: ids }).then((res) => {
              if (res.success) {
                // that.$message.success(res.message);
                that.$notification.success({
                  message: '消息',
                  description: res.message
                })
                that.loadData()
                that.onClearSelected()
              } else {
                // that.$message.warning(res.message);
                that.$notification.warning({
                  message: '消息',
                  description: res.message
                })
              }
            }).finally(() => {
              that.loading = false
            })
          }
        })
      }
    }
  }
}
</script>
<style scoped>
src/views/mes/modules/MesMaterialTransferRequestForm.vue
@@ -12,12 +12,12 @@
            <a-form-model-item label="起始库存地点" :labelCol="labelCol" :wrapperCol="wrapperCol"
                               prop="originalWarehouseId">
              <j-dict-select-tag type="list" v-model="model.originalWarehouseId" dictCode="original_warehouse_list"
                                 placeholder="请选择起始库存地点" />
                                 placeholder="请选择起始库存地点" :disabled="formDisabled || editable" />
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="任务号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workOrderCode">
              <work-order-select-modal :workOrder="workOrderObj" :submitDisabled="formDisabled"
              <work-order-select-modal :workOrder="workOrderObj" :submitDisabled="formDisabled || editable"
                                       orderStatus="PUBLISHED" @ok="selectConfirm"></work-order-select-modal>
            </a-form-model-item>
          </a-col>
@@ -91,6 +91,7 @@
        sm: { span: 16 }
      },
      confirmLoading: false,
      editable: false,
      validatorRules: {
        originalWarehouseId: [
          { required: true, message: '起始库存地点必选', trigger: 'change' }
@@ -139,6 +140,7 @@
      this.model.workOrderCode = this.model.workOrderId_dictText
      this.visible = true
      if (this.model.workOrderId) {
        this.editable = true;
        let workOrderRes = await this.loadProductionWorkOrder(this.model.workOrderId)
        if(!workOrderRes.success || !workOrderRes.result) {
          return;
@@ -161,6 +163,8 @@
          this.model.targetWarehouseId = undefined
          this.model.warehouseName = ''
        }
      }else {
        this.editable = false;
      }
    },
    async selectConfirm(rows) {