自动化立体仓库 - WMS系统
#
lty
2026-03-16 4efbf695ce0e0e6565e75305a57ea4c4bbc2c45d
src/main/webapp/views/orderCargoGrouping/orderCargoGroupingOperate.html
@@ -157,6 +157,18 @@
               <el-option label="重新下发" value="99"></el-option>
            </el-select>
         </div>
         <div class="search-item">
            <span class="search-label">创建日期:</span>
            <el-date-picker
                  v-model="selectedDate"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期"
                  clearable
                  style="width: 150px;"
                  @change="handleDateChange"
            ></el-date-picker>
         </div>
         <div class="search-actions">
            <el-button type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
            <el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
@@ -178,11 +190,24 @@
<!--         <el-table-column prop="itemName" label="组货单号" width="120" align="center" sortable="custom"></el-table-column>-->
         <el-table-column prop="cstmrName" label="货主" min-width="120" align="center"></el-table-column>
         <el-table-column prop="settle$" label="状态" min-width="100" align="center" :formatter="formatStatus"></el-table-column>
         <el-table-column prop="issueComplete" label="下发完成" width="100" align="center">
            <template slot-scope="scope">
               <el-tag v-if="scope.row.issueComplete === 1" type="success">已全下发</el-tag>
               <el-tag v-else type="info">未完成</el-tag>
            </template>
         </el-table-column>
         <el-table-column prop="createTime" label="创建时间" min-width="100" align="center" :formatter="formatDateColumn"></el-table-column>
         <el-table-column prop="updateTime" label="更新日期" min-width="100" align="center" :formatter="formatDateColumn"></el-table-column>
         <el-table-column label="操作" width="150" align="center" fixed="right">
         <el-table-column label="操作" width="220" align="center" fixed="right">
            <template slot-scope="scope">
               <div class="operation-cell">
                  <el-button
                        type="warning"
                        size="mini"
                        :disabled="scope.row.issueComplete === 1"
                        @click="oneKeyIssue(scope.row)">
                     一键下发
                  </el-button>
                  <el-button
                        type="primary"
                        size="mini"
@@ -284,6 +309,7 @@
            </el-table-column>
            <el-table-column prop="anfme" label="erp下发数量" min-width="80" align="center"></el-table-column>
            <el-table-column prop="sortingAnfme" label="待下发数量" min-width="80" align="center"></el-table-column>
               <el-table-column prop="beBatch" label="已下发数量" min-width="80" align="center"></el-table-column>
<!--            <el-table-column prop="status" label="状态" min-width="100" align="center" :formatter="formatStatusB"></el-table-column>-->
            <el-table-column prop="inspect" label="状态" min-width="100" align="center" :formatter="formatStatusC"></el-table-column>
            <!-- 修改为删除列 -->
@@ -356,6 +382,7 @@
            cstmrName: '',
            settle: ''
         },
         selectedDate: '',
         detailSearch: {
            standby3: '',
            boxType3: ''
@@ -455,6 +482,10 @@
            if (that.orderByField) {
               params.orderByField = that.orderByField;
               params.orderByType = that.orderByType;
            }
            if (that.selectedDate) {
               params['create_time'] = that.selectedDate + ' 00:00:00 - ' + that.selectedDate + ' 23:59:59';
            }
            Object.keys(that.searchForm).forEach(key => {
@@ -860,89 +891,77 @@
         confirmReport(orderNo, done) {
            this.reportLoading = true;
            // // 收集要上报的数据
            // const reportData = this.tableDataB.map(item => {
            //    const itemKey = this.getItemKey(item);
            //    return {
            //       orderNo: groupOrderNo,             // 组货单号
            //       matnr: item.matnr,                 // 商品编号
            //       maktx: item.maktx,                 // 商品名称
            //       standby1: item.standby1,           // 客户PO
            //       standby2: item.standby2,           // UPC
            //       standby3: item.standby3,           // 客户SKU
            //       boxType3: item.boxType3,           // 采购单号
            //       anfme: this.modifiedQuantities[itemKey] || item.anfme, // 数量(使用修改后的数量)
            //       erpAnfme: item.erpAnfme,           // ERP下架数量
            //       status: item.status,               // 状态
            //       batch: item.batch,                 // 箱号
            //       // 其他必要参数
            //       modified: this.modifiedQuantities[itemKey] !== undefined // 标记是否修改
            //    };
            // });
            //
            // // 收集删除记录
            // const deleteData = this.deletedRecords.map(record => ({
            //    orderNo: groupOrderNo,
            //    matnr: record.matnr,
            //    maktx: record.maktx,
            //    standby1: record.standby1,
            //    standby2: record.standby2,
            //    standby3: record.standby3,
            //    boxType3: record.boxType3,
            //    anfme: record.anfme,
            //    erpAnfme: record.erpAnfme,
            //    status: record.status,
            //    batch: record.batch,
            //    deleteTime: record.deleteTime
            // }));
            //
            // // 构建提交数据
            // const submitData = {
            //    orderNo: groupOrderNo,
            //    details: reportData,
            //    deletedDetails: deleteData,
            //    totalCount: reportData.length,
            //    modifiedCount: Object.keys(this.modifiedQuantities).length,
            //    deletedCount: deleteData.length
            // };
            const rowsToIssue = (this.tableDataB || []).filter(item => parseInt(item.inspect) === 1);
            if (rowsToIssue.length === 0) {
               this.reportLoading = false;
               if (typeof done === 'function') done();
               this.$message.error('没有待下发项');
               return;
            }
            // 调用后台API上报数据
            $.ajax({
               url: baseUrl + "/order/pakin/actual/shipment/order/report/auth",
               headers: {'token': localStorage.getItem('token')},
               data: {
                  orderNo: orderNo // 传递订单号
               },
               method: 'POST',
               success: (res) => {
            const updates = rowsToIssue.map(item => {
               const beBatchVal = Math.floor(parseFloat(item.sortingAnfme || 0));
               return new Promise((resolve) => {
                  $.ajax({
                     url: baseUrl + "/order/pakin/orderDetl/beBatch/update/auth",
                     headers: { 'token': localStorage.getItem('token') },
                     data: {
                        id: item.id,
                        beBatch: beBatchVal
                     },
                     method: 'POST',
                     success: (res) => {
                        if (res.code === 200 || res.success) {
                           this.$set(item, 'beBatch', beBatchVal);
                           resolve({ ok: true });
                        } else {
                           resolve({ ok: false, msg: res.msg || '更新失败' });
                        }
                     },
                     error: () => resolve({ ok: false, msg: '网络异常' })
                  });
               });
            });
            Promise.all(updates).then(results => {
               const failed = results.find(r => !r.ok);
               if (failed) {
                  this.reportLoading = false;
                  if (typeof done === 'function') {
                     done();
                  }
                  if (res.code === 200 || res.success) {
                     this.$message({
                        message: `订单号 ${orderNo} 下发成功`,
                        type: 'success',
                        duration: 5000,
                        dangerouslyUseHTMLString: true
                     });
                     // 下发成功后关闭弹窗并刷新数据
                     setTimeout(() => {
                        this.closeDetailDialog();
                        this.getTableDataA(); // 刷新主表数据
                     }, 1500);
                  } else {
                     this.$message.error(res.msg || '下发失败');
                  }
               },
               error: (error) => {
                  this.reportLoading = false;
                  if (typeof done === 'function') {
                     done();
                  }
                  console.error('下发失败:', error);
                  this.$message.error('下发失败,请检查网络连接');
                  if (typeof done === 'function') done();
                  this.$message.error(failed.msg || '同步beBatch失败');
                  return;
               }
               // 同步完成后调用后台API进行下发
               $.ajax({
                  url: baseUrl + "/order/pakin/actual/shipment/order/report/auth",
                  headers: {'token': localStorage.getItem('token')},
                  data: { orderNo: orderNo },
                  method: 'POST',
                  success: (res) => {
                     this.reportLoading = false;
                     if (typeof done === 'function') done();
                     if (res.code === 200 || res.success) {
                        this.$message({
                           message: `订单号 ${orderNo} 下发成功`,
                           type: 'success',
                           duration: 5000,
                           dangerouslyUseHTMLString: true
                        });
                        setTimeout(() => {
                           this.closeDetailDialog();
                           this.getTableDataA();
                        }, 1500);
                     } else {
                        this.$message.error(res.msg || '下发失败');
                     }
                  },
                  error: (error) => {
                     this.reportLoading = false;
                     if (typeof done === 'function') done();
                     console.error('下发失败:', error);
                     this.$message.error('下发失败,请检查网络连接');
                  }
               });
            });
         },
@@ -967,6 +986,11 @@
            this.getTableDataA();
         },
         handleDateChange() {
            this.currentPage = 1;
            this.getTableDataA();
         },
         // 重置搜索条件
         handleReset() {
            this.searchForm = {
@@ -974,10 +998,64 @@
               cstmrName: '',
               settle: ''
            };
            this.selectedDate = '';
            this.orderByField = '';
            this.orderByType = 'asc';
            this.currentPage = 1;
            this.getTableDataA();
         },
         oneKeyIssue(row) {
            if (!row || !row.orderNo) {
               this.$message.error('订单号为空');
               return;
            }
            const orderNo = row.orderNo;
            this.$confirm(
                  `确认一键下发订单号 <strong style="color: #F56C6C; font-size: 16px;">${orderNo}</strong> 的全部明细吗?`,
                  '一键下发',
                  {
                     confirmButtonText: '确认下发',
                     cancelButtonText: '取消',
                     type: 'warning',
                     dangerouslyUseHTMLString: true
                  }
            ).then(() => {
               const loadingInstance = this.$loading({
                  lock: true,
                  text: '下发中...',
                  spinner: 'el-icon-loading',
                  background: 'rgba(0, 0, 0, 0.7)'
               });
               $.ajax({
                  url: baseUrl + "/order/pakin/order/oneKey/issue/auth",
                  headers: {'token': localStorage.getItem('token')},
                  data: { orderNo: orderNo },
                  method: 'POST',
                  success: (res) => {
                     loadingInstance.close();
                     if (res.code === 200 || res.success) {
                        this.$message({
                           message: `订单号 ${orderNo} 下发成功`,
                           type: 'success',
                           duration: 3000
                        });
                        this.getTableDataA();
                     } else {
                        this.$message.error(res.msg || '下发失败');
                     }
                  },
                  error: () => {
                     loadingInstance.close();
                     this.$message.error('下发失败,请检查网络连接');
                  }
               });
            }).catch(() => {
               this.$message({
                  type: 'info',
                  message: '已取消操作'
               });
            });
         },
         // 显示详情弹窗
@@ -1162,4 +1240,4 @@
   });
</script>
</body>
</html>
</html>