xiazhengtongxue
15 小时以前 0aed9c9ee65bd8a17837d83ec05e756d11fab297
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
//此js文件是用来自定义扩展业务代码,可以扩展一些自定义页面或者重新配置生成的代码
import RobotSelect from './extend/RobotSelect.vue';
 
let extension = {
  components: {
    //查询界面扩展组件
    gridHeader: '',
    gridBody: RobotSelect,
    gridFooter: '',
    //新建、编辑弹出框扩展组件
    modelHeader: "",
    modelBody: "",
    modelFooter: "",
  },
  tableAction: "",
  buttons: { view: [], box: [], detail: [] },
  methods: {
    onInit() {
      // 添加MES操作列
      this.columns.push({
        title: "操作",
        field: "操作",
        align: "center",
        width: 200,
        fixed: "right",
        render: (h, { row, column, index }) => {
          return (
            <div>
              <el-button
                type="primary"
                size="small"
                onClick={($e) => { this.handleBind(row); }}
              >绑定</el-button>
              <el-button
                type="primary"
                size="small"
                onClick={($e) => { this.handleInbound(row); }}
              >进站</el-button>
              <el-button
                type="success"
                size="small"
                style="margin-left: 8px"
                onClick={($e) => { this.handleOutbound(row); }}
              >出站</el-button>
              <el-button
                type="success"
                size="small"
                style="margin-left: 8px"
                onClick={($e) => { this.handleUnbind(row); }}
              >解绑</el-button>
            </div>
          );
        },
      });
    },
 
    // 托盘组盘操作
    handleBind(row) {
      this.$refs.gridBody.open('bind', row);
    },
 
    // 托盘进站操作
    async handleInbound(row) {
      try {
        await this.$confirm(
          `确认执行托盘进站操作?\n托盘编号:${row.palletCode}`,
          "进站确认",
          {
            confirmButtonText: "确认",
            cancelButtonText: "取消",
            type: "warning",
          },
        );
 
        const result = await this.http.post(
          "/api/StockInfo/inboundInContainer",
          {
            palletCode: row.palletCode,
            stockId: row.id,
          },
          "正在调用MES接口...",
        );
 
        if (result.status) {
          this.$Message.success(result.message || "托盘进站成功");
          this.$refs.table.load();
        } else {
          this.$error(result.message || "托盘进站失败");
        }
      } catch (error) {
        if (error !== "cancel") {
          this.$error(error.message || "网络错误,请稍后重试");
        }
      }
    },
 
    // 托盘出站操作
    async handleOutbound(row) {
      try {
        await this.$confirm(
          `确认执行托盘出站操作?\n托盘编号:${row.palletCode}`,
          "出站确认",
          {
            confirmButtonText: "确认",
            cancelButtonText: "取消",
            type: "warning",
          },
        );
 
        const result = await this.http.post(
          "/api/StockInfo/outboundInContainer",
          {
            palletCode: row.palletCode,
            stockId: row.id,
          },
          "正在调用MES接口...",
        );
 
        if (result.status) {
          this.$Message.success(result.message || "托盘出站成功");
          this.$refs.table.load();
        } else {
          this.$error(result.message || "托盘出站失败");
        }
      } catch (error) {
        if (error !== "cancel") {
          this.$error(error.message || "网络错误,请稍后重试");
        }
      }
    },
 
    // 托盘拆盘操作
    handleUnbind(row) {
      this.$refs.gridBody.open('unbind', row);
    },
 
    onInited() {
      // 框架初始化配置后
    },
    searchBefore(param) {
      const stockStatusFilter = {
        name: "stockStatus",
        value: "1",
        displayType: "notequal",
      };
      if (!param.wheres) {
        param.wheres = [];
      }
      // 将过滤条件添加到查询参数中
      param.wheres.push(stockStatusFilter);
      return true;
    },
    searchAfter(result) {
      return result;
    },
    addBefore(formData) {
      return true;
    },
    updateBefore(formData) {
      return true;
    },
    rowClick({ row, column, event }) {
      this.$refs.table.$refs.table.toggleRowSelection(row);
    },
    modelOpenAfter(row) {
      // 点击编辑、新建按钮弹出框后
    },
  },
};
 
export default extension;