333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<template>
  <div class="dialog-container">
    <el-dialog v-dialogDrag :visible.sync="currentVisible" width="1200px" title="拣选更新">
      <el-alert title="拣选更新" type="success"></el-alert>
      <el-table :data="listtableData" stripe style="width: 100%" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55">
        </el-table-column>
        <el-table-column prop="productCode" label="物料编号" width="100">
        </el-table-column>
        <el-table-column prop="productName" label="物料名称" width="150">
        </el-table-column>
        <el-table-column prop="pickUpNum" label="取货数量" width="110">
          <template slot-scope="{$idnex, row, col}">
            <el-input-number v-model.number="row.pickUpNum" :max="row.validQuantity" controls-position="right" class="w-100" @change="changeEnterQuantity(row, col)"></el-input-number>
          </template>
        </el-table-column>
        <el-table-column prop="quantityOrder" label="预出库数量" width="150">
        </el-table-column>
        <el-table-column prop="quantityOuted" label="已出货数量" width="150">
        </el-table-column>
        <el-table-column prop="weight" label="单位重量" width="150">
        </el-table-column>
        <el-table-column prop="totalWeight" label="单位重量" width="150">
        </el-table-column>
        <el-table-column prop="batchNumber" label="生产批次" width="150">
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <!-- <el-switch v-model="isSorting" active-color="#13ce66" inactive-color="#ff4949" active-text="是否分拣"></el-switch> -->
        <el-button @click="currentVisible = false">取 消</el-button>
        <el-button type="primary" @click="saveCheck">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
import InputSelect from "@/components/base/InputSelect";
export default {
  name: "picking-reload",
  components: { InputSelect },
  props: {
    // 显示对话框
    visible: {
      type: Boolean,
      default: false,
      required: true
    }
  },
  data() {
    return {
      // 明细数据
      listtableData: [],
      isSorting: false,
      show: false,
      // 获取验证员
      creatorlist: [],
      // 获取货位
      positionlist: [],
      creator: "",
      positionName: "",
      // 物料属性
      productnature: "",
      // 物料属性
      dropDownList_DestAttr: [
        {
          value: "合格",
          label: "合格"
        },
        {
          value: "冲压待返修",
          label: "冲压待返修"
        }
      ],
      // 当前订单ID
      order_Id: 0,
      // 当前仓库ID
      storage_Id: 0
    };
  },
  computed: {
    currentVisible: {
      get: function() {
        return this.visible;
      },
      set: function(val) {
        this.$emit("update:visible", val);
      }
    }
  },
  mounted() {
    this.getCreater();
  },
  methods: {
    // 收货位触发的实践
    elDropdownSelect(scope, data) {
      scope.row.shelvePositionName = data;
    },
    elDropdownChange(scope, data) {
      scope.row.shelvePositionName = data;
    },
    elDropdownKeyup(scope, data) {
      try {
        this.getVagueName(data);
        if (!data) {
          scope.row.choosePositionNameArray = scope.row.shelvePositionNameArray.filter(item => {
            return true;
          });
          return;
        }
        const filterItems = scope.row.shelvePositionNameArray.filter(item => {
          if (!item.label) return false;
          return item.label.indexOf(data) >= 0;
        });
        scope.row.choosePositionNameArray = filterItems;
      } catch (error) {
        // console.log(error.message);
      }
    },
    // 初始化数据
    initData(order_Id) {
      this.order_Id = order_Id;
      const url = "/api/outbound/order/getOrderDetails";
      const params = {
        order_Id: order_Id
      };
      this.common.ajax(url, params, res => {
        this.common.showMsg(res);
        if (res.result) {
          this.listtableData = res.data.map(row => {
            row.pickUpNum = parseInt(row.validQuantity);
            return row;
          });
        }
      });
    },
    // 拣选更新提交数据
    saveCheck() {
      const the = this;
      const jsonDetails = this.listtableData.filter(v => v.selected);
      if (jsonDetails.length === 0) {
        this.$message.error("请选中需要提交的单据");
        return false;
      }
      if (jsonDetails.filter(v => v.pickUpNum === 0 && v.selected).length !== 0) {
        this.$message.error("选中提交的单据数量不能为0");
        return false;
      }
      const url = "/api/outbound/order/saveCheck";
      const params = {
        order_Id: this.order_Id,
        jsonDetails: jsonDetails
      };
      const ref = this.$parent.dataList;
      var callback = res => {
        the.common.showMsg(res);
        if (res.result) {
          this.listtableData = []; // 重置
          this.currentVisible = false; // 关闭弹框
          ref.loadData(); // 刷新
        }
      };
      the.common.ajax(url, params, callback, true);
    },
    // 验货员获取用户管理中的用户
    getCreater() {
      const url = "/api/sys/user/getList";
      const params = {};
      var callback = res => {
        if (res.result) {
          this.creatorlist = res.data;
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    // 获取当前订单的收货位
    getPositionName(storage_Id) {
      const url = "/api/basicInfo/base/position/getPositionName";
      const params = {
        storage_Id: storage_Id
      };
      var callback = res => {
        if (res.result) {
          this.positionlist = res.data.map(item => {
            item.label = item.positionName;
            item.value = item.positionName;
            return item;
          });
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    // 根据仓库和货位名称模糊查询
    getVagueName(positionName) {
      const url = "/api/basicInfo/base/position/getVaguePositionName";
      const params = {
        storage_Id: this.storage_Id,
        positionName: positionName
      };
      var callback = res => {
        if (res.result) {
          this.positionlist = [];
          this.positionlist = res.data.map(item => {
            item.label = item.positionName;
            item.value = item.positionName;
            return item;
          });
        }
      };
      this.common.ajax(url, params, callback, true);
    },
    handleSelectionChange(val) {
      this.listtableData.forEach(v => {
        v.selected = false;
      });
      val.forEach(v => {
        var info = this.listtableData.find(z => z.orderList_Id === v.orderList_Id);
        if (info) {
          info.selected = true;
        }
      });
    }
  }
};
</script>