index.vue 15.9 KB
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 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="10">
        <el-card class="box-card">
          <el-form
            :model="queryBillParams"
            ref="queryBillForm"
            :inline="true"
            v-show="showBillSearch"
            label-width="68px"
          >
            <el-form-item label="收货单号" prop="code">
              <el-input
                v-model="queryBillParams.code"
                placeholder="请输入收货单号"
                clearable
                size="small"
                @keyup.enter.native="billQuery"
              />
            </el-form-item>
            <el-form-item>
              <el-button
                type="cyan"
                icon="el-icon-search"
                size="mini"
                @click="billQuery"
                >搜索</el-button
              >
            </el-form-item>
          </el-form>

          <el-row :gutter="10" class="mb8">
            <right-toolbar
              :showSearch.sync="showBillSearch"
              @queryTable="getScanBillList"
            ></right-toolbar>
          </el-row>
          <el-table
            v-loading="billLoading"
            :data="scanBillList"
            :summary-method="getSummaries"
            show-summary
            @row-click="rowClick"
          >
            <el-table-column label="明细id" align="center" prop="id" />
            <el-table-column
              label="物料编码"
              align="center"
              prop="materialCode"
              width="120"
            />
            <el-table-column
              label="名称"
              align="center"
              prop="materialName"
              width="200"
              :show-overflow-tooltip="true"
            />
            <el-table-column label="单数据量" align="center" prop="totalQty" />
            <el-table-column label="已入数量" align="center" prop="openQty" />
            <el-table-column
              label="库存状态"
              align="center"
              prop="inventorySts"
            />
            <el-table-column label="项目号" align="center" prop="projectNo" />
            <el-table-column label="单位" align="center" prop="materialUnit" />
          </el-table>

          <pagination
            v-show="billTotal > 0"
            :total="billTotal"
            :page.sync="queryBillParams.pageNum"
            :limit.sync="queryBillParams.pageSize"
            @pagination="getScanBillList"
          />
        </el-card>
      </el-col>
      <el-col :span="14">
        <el-card class="box-card">
          <el-form
            :model="queryReceiptParams"
            ref="queryInfoForm"
            :inline="true"
            v-show="showInfoSearch"
            label-width="68px"
          >
            <el-form-item label="收货数量" prop="qty">
              <el-input
                v-model="queryReceiptParams.qty"
                placeholder="请输入收货数量"
                clearable
                size="small"
                @keyup.enter.native="receipt"
              />
            </el-form-item>
            <el-form-item label="容器编号" prop="containerCode">
              <el-input
                v-model="queryReceiptParams.containerCode"
                placeholder="请输入容器编号"
                clearable
                size="small"
                @keyup.enter.native="receipt"
              />
            </el-form-item>
            <el-form-item>
              <el-button
                type="cyan"
                icon="el-icon-search"
                size="mini"
                @click="receipt"
                >组盘</el-button
              >
            </el-form-item>
          </el-form>

          <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
              <el-button
                type="primary"
                icon="el-icon-place"
                size="mini"
                :disabled="multiple"
                @click="positioning"
                >定位</el-button
              >
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="success"
                icon="el-icon-close"
                size="mini"
                :disabled="multiple"
                @click="cancelPositioning"
                v-hasPermi="['receipt:receiptContainer:canalPosition']"
                >取消定位</el-button
              >
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="danger"
                icon="el-icon-delete"
                size="mini"
                :disabled="multiple"
                @click="handleDelete"
                >取消收货</el-button
              >
            </el-col>
            <el-col :span="1.5">
              <el-button
                type="warning"
                icon=""
                size="mini"
                :disabled="multiple"
                @click="createTask"
                >生成任务</el-button
              >
            </el-col>
            <right-toolbar
              :showSearch.sync="showInfoSearch"
              @queryTable="getReceiptInfoList"
            ></right-toolbar>
          </el-row>

          <el-table
            v-loading="infoLoading"
            :data="receiptInfoList"
            @selection-change="handleSelectionChange"
          >
            <el-table-column type="selection" width="55" align="center" />
            <el-table-column
              label="容器编号"
              align="center"
              prop="containerCode"
              min-width="100"
              :show-overflow-tooltip="true"
            />
            <el-table-column
              label="库位编号"
              align="center"
              prop="locationCode"
            />
            <el-table-column
              label="物料编码"
              align="center"
              prop="materialCode"
              min-width="120"
              :show-overflow-tooltip="true"
            />
            <el-table-column
              label="物料名称"
              align="center"
              prop="materialName"
            />

            <el-table-column
              label="物料规格"
              align="center"
              prop="materialSpec"
            />
            <el-table-column label="数量" align="center" prop="qty" />
            <el-table-column label="组盘状态" align="center" prop="status" />
            <el-table-column
              label="入库单明细id"
              align="center"
              prop="receiptDetailId"
              width="100"
            />
            <el-table-column
              label="创建时间"
              align="center"
              prop="createTime"
              min-width="160"
            >
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.created) }}</span>
              </template>
            </el-table-column>
            <el-table-column label="创建人" align="center" prop="createdBy" />
            <el-table-column
              label="操作"
              align="center"
              class-name="small-padding fixed-width"
              width="120"
            >
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.row)"
                  >取消</el-button
                >
              </template>
            </el-table-column>
          </el-table>

          <el-row :gutter="10" class="mb8" style="margin-top: 50px">
            <span class="title">本物料库存</span>
            <right-toolbar
              :showSearch.sync="showInventorySearch"
              @queryTable="getInventoryList"
            ></right-toolbar>
          </el-row>
          <el-table v-loading="inventoryLoading" :data="inventoryList">
            <el-table-column
              label="容器编号"
              align="center"
              prop="containerCode"
            />
            <el-table-column
              label="存货编码"
              align="center"
              prop="materialCode"
            />
            <el-table-column
              label="物料名称"
              align="center"
              prop="materialName"
            />
            <el-table-column
              label="物料规格"
              align="center"
              prop="materialSpec"
            />
            <el-table-column label="数量" align="center" prop="qty" />
            <el-table-column label="货主" align="center" prop="companyName" />
            <el-table-column
              label="库位编号"
              align="center"
              prop="locationCode"
            />
            <el-table-column label="库存状态" align="center" prop="status" />
          </el-table>

          <el-row :gutter="10" class="mb8" style="margin-top: 50px">
            <span class="title">空料盒</span>
            <right-toolbar
              :showSearch.sync="showContainerSearch"
              @queryTable="getContainerList"
            ></right-toolbar>
          </el-row>
          <el-table v-loading="containerLoading" :data="containerList">
            <el-table-column label="容器编号" align="center" prop="code" />
            <el-table-column
              label="库位编号"
              align="center"
              prop="locationCode"
            />
          </el-table>

          <pagination
            v-show="containerTotal > 0"
            :total="containerTotal"
            :page.sync="queryContainerParams.pageNum"
            :limit.sync="queryContainerParams.pageSize"
            @pagination="getContainerList"
          />
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {
  listScanBill,
  listReceiptInfo,
  receiving,
  position,
  delReceipt,
  createTask,
} from "@/api/receipt/receiving";
import { getInventoryByMaterialCode } from "@/api/inventory/inventoryHeader/detail";
import { getEmptyContainer } from "@/api/config/InventoryInfo/container";
export default {
  name: "Notice",

  data() {
    return {
      // 遮罩层
      billLoading: true,
      infoLoading: true,
      inventoryLoading: true,
      containerLoading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showBillSearch: true,
      showInfoSearch: true,
      showInventorySearch: true,
      showContainerSearch: true,
      // 订单明细总条数
      billTotal: 0,

      // 空料盒总条数
      containerTotal: 0,
      // 订单明细表格数据
      scanBillList: [],
      // 收货信息表格数据
      receiptInfoList: [],
      // 物料库存表格数据
      inventoryList: [],
      // 空料盒表格数据
      containerList: [],
      // 查询订单明细参数
      queryBillParams: {
        pageNum: 1,
        pageSize: 10,
        code: this.$route.query.code,
      },

      // 查询收货信息参数
      queryInfoParams: {
        code: undefined,
      },
      // 组盘参数
      queryReceiptParams: {
        receiptCode: this.$route.query.code,
        qty: undefined,
        receiptDetailId: undefined,
        containerCode: undefined,
      },
      // 查询物料库存参数
      queryInventoryParams: {
        code: this.$route.query.code,
        count: 3,
      },
      // 查询空料盒参数
      queryContainerParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  created() {
    this.getScanBillList();
    this.getReceiptInfoList();
    this.getInventoryList();
    this.getContainerList();
  },
  methods: {
    /** 查询订单明细列表 */
    getScanBillList() {
      this.billLoading = true;
      listScanBill(this.queryBillParams).then((response) => {
        this.scanBillList = response.data;
        this.billTotal = response.data.length;
        this.billLoading = false;
      });
    },

    /** 订单明细搜索按钮操作 */
    billQuery() {
      this.queryBillParams.pageNum = 1;
      this.getScanBillList();
    },
    /** 订单明细表尾合计 */
    getSummaries(param) {
      console.log(param);
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "总价";
          return;
        } else if (index >= 3) {
          const values = data.map((item) => Number(item[column.property]));
          if (!values.every((value) => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                return prev + curr;
              } else {
                return prev;
              }
            }, 0);
          }
        } else {
          sums[index] = "";
        }
      });

      return sums;
    },

    /** 订单明细表格行点击 */
    rowClick(row, column, event) {
      console.log(row);
      this.queryReceiptParams.qty = row.totalQty;

      this.queryReceiptParams.receiptDetailId = row.id;
      this.getInventoryList();
    },

    /** 获取收货信息 */
    getReceiptInfoList() {
      this.infoLoading = true;
      this.queryInfoParams.code = this.$route.query.code;
      listReceiptInfo(this.queryInfoParams).then((response) => {
        console.log(response);
        this.receiptInfoList = response.data;

        this.infoLoading = false;
      });
    },
    /** 收货信息组盘按钮操作 */
    receipt() {
      receiving(this.queryReceiptParams).then((response) => {
        console.log(response);
      });
    },

    // 收货信息多选框选中数据
    handleSelectionChange(selection) {
      console.log(selection);
      this.ids = selection.map((item) => item.id);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },
    /** 定位按钮操作 */
    positioning() {
      position(this.ids.toString()).then((response) => {
        if (response.code == 200) {
          this.getReceiptInfoList();
          this.msgSuccess(response.msg);
        } else {
          this.msgError(response.msg);
        }
      });
    },
    /** 取消定位按钮操作 */
    cancelPositioning() {
      // position(this.ids.toString()).then((response)=> {
      //   if(response.code == 200) {
      //     this.getReceiptInfoList();
      //     this.msgSuccess(response.msg)
      //   }else{
      //     this.msgError(response.msg)
      //   }
      // })
    },
    /** 取消按钮操作 */
    handleDelete(row) {
      console.log(row);
      const Ids = row.id || this.ids;
      this.$confirm('是否确认取消收货id为"' + Ids + '"的数据项?', "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(function () {
          return delReceipt(Ids);
        })
        .then(() => {
          this.getReceiptInfoList();
          this.msgSuccess("取消成功");
        });
    },
    /** 生成任务按钮操作 */
    createTask() {
      createTask(this.ids).then((response) => {
        if (response.code == 200) {
          this.getReceiptInfoList();
          this.msgSuccess(response.msg);
        } else {
          this.msgError(response.msg);
        }
      });
    },

    /** 获取物料库存 */
    getInventoryList() {
      this.inventoryLoading = true;
      getInventoryByMaterialCode(this.queryInventoryParams).then((response) => {
        console.log(response);
        this.inventoryList = response.data;

        this.inventoryLoading = false;
      });
    },

    /** 查询空料盒列表 */
    getContainerList() {
      this.containerLoading = true;
      getEmptyContainer(this.queryContainerParams).then((response) => {
        console.log(response);
        this.containerList = response.rows;
        this.containerTotal = response.total;
        this.containerLoading = false;
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.title {
  font-size: 15px;
}
</style>