MesController.java 26.8 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 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
package com.huaheng.api.mes.controller;

import com.huaheng.api.mes.domain.*;
import com.huaheng.api.mes.service.MesService;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.task.taskHeader.service.WorkTaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;

/**
 * @author 游杰
 */
@RestController
@RequestMapping("/API/WMS/v2")
public class MesController extends BaseController {

    @Resource
    private WorkTaskService workTaskService;
    @Resource
    private MesService mesService;

    /**
     * 空盛具入库
     */
    @PostMapping("/receiptEmptyContainer")
    @ApiOperation("空盛具入库")
    @ApiLogger(apiName = "空盛具入库", from = "MES")
    public AjaxResult receiptEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
        String taskNo = mesEmptyContainer.getTaskNo();
        String fromPort = mesEmptyContainer.getFromPort();
        // 交换载具和盛具的值
        String containerCode = mesEmptyContainer.getVehicleCode();
        String vehicleCode = mesEmptyContainer.getContainerCode();
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
        }
        /*if (!isEmptyVehBack && StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("containerCode 为空");
        }*/
        // 因MES传的载具和盛具码是反的,此处交换载具与盛具的值 反着入参
        return handleMultiProcess(() -> workTaskService.createEmptyIn(
                taskNo, fromPort, containerCode, vehicleCode, null));
    }

    /**
     * 空盛具出库
     */
    @PostMapping("/shipmentEmptyContainer")
    @ApiOperation("空盛具出库")
    @ApiLogger(apiName = "空盛具出库", from = "MES")
    public AjaxResult shipmentEmptyContainer(@RequestBody MesEmptyContainer mesEmptyContainer) {
        String taskNo = mesEmptyContainer.getTaskNo();
        String orderCode = mesEmptyContainer.getOrderCode();
        String toPort = mesEmptyContainer.getToPort();
        String vehicleTypeCode = mesEmptyContainer.getVehicleTypeCode();
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(toPort)) {
            return AjaxResult.error("toPort 为空");
        }
        if (StringUtils.isEmpty(vehicleTypeCode)) {
            return AjaxResult.error("containerTypeCode 为空");
        }
        return handleMultiProcess(() -> workTaskService.shipmentEmptyContainer(
                taskNo, orderCode, toPort, vehicleTypeCode));
    }

    /**
     * 查询库存
     */
    @PostMapping("/searchInventory")
    @ApiOperation("查询库存")
    @ApiLogger(apiName = "查询库存", from = "MES")
    public AjaxResult searchInventory(@RequestBody MesSearch mesSearch) {
        String taskNo = mesSearch.getTaskNo();
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        try {
            return mesService.searchInventory(mesSearch);
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 主工单下发
     */
    @PostMapping("/workOrder")
    @ApiOperation("主工单下发")
    @ApiLogger(apiName = "主工单下发", from = "MES")
    public AjaxResult workOrder(@RequestBody MesWorkOrder workOrder) {
        if (StringUtils.isEmpty(workOrder.getTaskNo())) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(workOrder.getOrderCode())) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(workOrder.getBatchNumber())) {
            return AjaxResult.error("batchNumber 为空");
        }
        if (StringUtils.isEmpty(workOrder.getOrderNumber())) {
            return AjaxResult.error("orderNumber 为空");
        }
        if (workOrder.getOrderStatus() == null) {
            return AjaxResult.error("orderStatus 为空");
        }
        if (StringUtils.isEmpty(workOrder.getMaterialDataList()) || workOrder.getMaterialDataList().isEmpty()) {
            return AjaxResult.error("materialDataList 为空");
        }
        return mesService.workOrder(workOrder);
    }

    /**
     * 工单状态同步
     */
    @PostMapping("/syncWorkOrder")
    @ApiOperation("工单状态同步")
    @ApiLogger(apiName = "工单状态同步", from = "MES")
    public AjaxResult syncWorkOrder(@RequestBody MesWorkOrder workOrder) {
        if (StringUtils.isEmpty(workOrder.getTaskNo())) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(workOrder.getOrderCode())) {
            return AjaxResult.error("orderCode 为空");
        }
        if (workOrder.getOrderStatus() == null) {
            return AjaxResult.error("orderStatus 为空");
        }
        return mesService.syncWorkOrder(workOrder);
    }

    /**
     * MES工单入库单(弃用)
     * 已经取消该接口 9
     *
     * @return
     */
    /*@Deprecated
    @PostMapping("/receiptOrder")
    @ApiOperation("MES工单入库单")
    @ApiLogger(apiName = "MES工单入库单", from = "MES")
    public AjaxResult receiptOrder(@RequestBody MesOrder mesOrder) {
        String orderCode = mesOrder.getOrderCode();
        String taskNo = mesOrder.getTaskNo();
        List<MesOrderMaterial> list = mesOrder.getMaterialDataList();
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
            return AjaxResult.error("chidOrderCode 为空");
        }
        if (mesOrder.getOrderStatus() == null) {
            return AjaxResult.error("orderStatus 为空");
        }
        if (StringUtils.isEmpty(mesOrder.getReceiptReferCode())) {
            return AjaxResult.error("receiptReferCode 为空");
        }
        if (StringUtils.isEmpty(list) || list.isEmpty()) {
            return AjaxResult.error("materialDataList 为空");
        }
        return handleMultiProcess(() -> mesService.receiptOrder(mesOrder));
    }*/

    /**
     * 3 MES工单领料单出库单 (弃用)
     *
     * @return
     */
    /*@PostMapping("/shipmentOrder")
    @ApiOperation("MES工单领料单出库单")
    @ApiLogger(apiName = "3 MES工单领料单出库单", from = "MES")
    public AjaxResult shipmentOrder(@RequestBody MesShipmentOrder mesOrder) {
        String orderCode = mesOrder.getOrderCode();
        String taskNo = mesOrder.getTaskNo();
        BigDecimal orderQty = mesOrder.getOrderQty();
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(mesOrder.getChidOrderCode())) {
            return AjaxResult.error("childOrderCode 为空");
        }
        if (StringUtils.isEmpty(mesOrder.getProductCode())) {
            return AjaxResult.error("productCode 为空");
        }
        if (orderQty == null) {
            return AjaxResult.error("orderQty 为空");
        }
        if (StringUtils.isEmpty(mesOrder.getMaterialDataList())) {
            return AjaxResult.error("materialDataList 为空");
        }
        return handleMultiProcess(() -> mesService.shipmentOrder(mesOrder));
    }*/

    /**
     * MES成品出库(弃用)
     *
     * @return
     */
    /*@PostMapping("/shipmentProduct")
    @ApiOperation("MES成品出库")
    @ApiLogger(apiName = "MES成品出库", from = "MES")
    public AjaxResult shipmentProduct(@RequestBody MesShipmentProduct mesShipmentProduct) {
        String containerCode = mesShipmentProduct.getContainerCode();
        String fromPort = mesShipmentProduct.getFromPort();
        String toPort = mesShipmentProduct.getToPort();
        String taskNo = mesShipmentProduct.getTaskNo();
        String vehicleCode = mesShipmentProduct.getVehicleCode();
        String orderCode = mesShipmentProduct.getOrderCode();
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
        }
        if (StringUtils.isEmpty(toPort)) {
            return AjaxResult.error("toPort 为空");
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        return handleMultiProcess(() -> mesService.shipmentProduct(mesShipmentProduct));
    }*/

    /**
     * 载具流转
     */
    @PostMapping("/overStation")
    @ApiOperation("载具流转")
    @ApiLogger(apiName = "载具流转", from = "MES")
    public AjaxResult overStation(@RequestBody MesOverStationDto mesOverStationDto) {
        String containerCode = mesOverStationDto.getContainerCode();
        String fromPort = mesOverStationDto.getFromPort();
        String toPort = mesOverStationDto.getToPort();
        String taskNo = mesOverStationDto.getTaskNo();
        String vehicleCode = mesOverStationDto.getVehicleCode();
        Double solidifyTime = mesOverStationDto.getSolidifyTime();
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
        }
        if (StringUtils.isEmpty(toPort)) {
            return AjaxResult.error("toPort 为空");
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (Objects.isNull(solidifyTime)) {
            return AjaxResult.error("solidifyTime 为空");
        }
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesOverStationDto.setContainerCode(vehicleCode);
        mesOverStationDto.setVehicleCode(containerCode);
        return handleMultiProcess(() -> mesService.createOverStation(mesOverStationDto));
    }

    /**
     * 物料入库
     */
    @PostMapping("/receipt")
    @ApiOperation("物料入库")
    @ApiLogger(apiName = "物料入库", from = "MES")
    public AjaxResult receipt(@RequestBody MesReceipt mesReceipt) {
        String taskNo = mesReceipt.getTaskNo();
        String orderCode = mesReceipt.getOrderCode();
        String containerCode = mesReceipt.getContainerCode();
        String fromPort = mesReceipt.getFromPort();
        String vehicleCode = mesReceipt.getVehicleCode();
        String receiptType = mesReceipt.getReceiptType();
        Double solidifyTime = mesReceipt.getSolidifyTime();
        List<ReceiptMaterialData> materialDataList = mesReceipt.getReceiptMaterialDataList();

        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(receiptType)) {
            return AjaxResult.error("receiptType 为空");
        }
        if (Objects.isNull(solidifyTime)) {
            return AjaxResult.error("solidifyTime 为空");
        }
        if (StringUtils.isEmpty(materialDataList)) {
            return AjaxResult.error("materialDataList 为空");
        }
        HashMap<String, String> quTest = new HashMap<>();
        for (ReceiptMaterialData data : mesReceipt.getReceiptMaterialDataList()) {
            if (data.getLocationNoX() == null || data.getLocationNoY() == null) {
                return AjaxResult.error("物料信息坐标为空");
            }
            if (data.getLocationNoX() == -1 || data.getLocationNoY() == -1) {
                return AjaxResult.error("物料信息坐标错误");
            }
            String key = data.getLocationNoX() + "  " + data.getLocationNoY();
            if (quTest.get(key) == null) {
                quTest.put(key, key);
            } else {
                return AjaxResult.error("坐标重复: " + key);
            }
        }
        // 交换载具盛具的值,MES给的与WMS的是反的
        mesReceipt.setContainerCode(vehicleCode);
        mesReceipt.setVehicleCode(containerCode);
        return handleMultiProcess(() -> mesService.receipt(mesReceipt));
    }

    /**
     * 余料回库(弃用)
     *
     * @return
     */
    /*@PostMapping("/rawReceipt")
    @ApiOperation("余料回库")
    @ApiLogger(apiName = "余料回库", from = "MES")
    public AjaxResult rawReceipt(@RequestBody MesReceipt mesReceipt) {

        //mes调用接口时,代表入库单类型为余料退库
        mesReceipt.setReceiptType(QuantityConstant.RECEIPT_TYPE_BACK);

        String taskNo = mesReceipt.getTaskNo();
        String containerCode = mesReceipt.getContainerCode();
        String fromPort = mesReceipt.getFromPort();
        String vehicleCode = mesReceipt.getVehicleCode();
        List<ReceiptMaterialData> materialData = mesReceipt.getReceiptMaterialDataList();
        HashMap<String, String> quTest = new HashMap<>();
        for (ReceiptMaterialData data : mesReceipt.getReceiptMaterialDataList()) {
            Integer locationNoY = data.getLocationNoY();
            Integer locationNoX = data.getLocationNoX();
            if (locationNoX == null || locationNoY == null) {
                return AjaxResult.error("物料信息坐标为空");
            }
            if (locationNoX == -1 || locationNoY == -1) {
                return AjaxResult.error("物料信息坐标错误");
            }
            String key = locationNoX + "  " + locationNoY;
            if (quTest.get(key) == null) {
                quTest.put(key, key);
            } else {
                return AjaxResult.error("坐标重复: " + key);
            }
        }
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(materialData)) {
            return AjaxResult.error("materialData 为空");
        }

        // 交换载具盛具的值,MES给的与WMS的是反的
        mesReceipt.setContainerCode(vehicleCode);
        mesReceipt.setVehicleCode(containerCode);
        return handleMultiProcess(() -> mesService.receipt(mesReceipt));
    }*/

    /**
     * 原材料入库
     *
     * @return
     */
    @PostMapping("/wmsReceipt")
    public AjaxResult wmsReceipt(@RequestBody MesReceipt mesReceipt) {
        String taskNo = mesReceipt.getTaskNo();
        String receiptType = mesReceipt.getReceiptType();
        String orderCode = mesReceipt.getOrderCode();
        String orderNumber = mesReceipt.getOrderNumber();
        String batchNumber = mesReceipt.getBatchNumber();
        List<ReceiptMaterialData> materialData = mesReceipt.getReceiptMaterialDataList();
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(receiptType)) {
            return AjaxResult.error("receiptType 为空");
        }
        if (StringUtils.isEmpty(materialData)) {
            return AjaxResult.error("materialData 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(orderNumber)) {
            return AjaxResult.error("orderNumber 为空");
        }
        if (StringUtils.isEmpty(batchNumber)) {
            return AjaxResult.error("batchNumber 为空");
        }
        return handleMultiProcess(() -> mesService.wmsReceipt(mesReceipt));
    }

    /**
     * 物料出库
     */
    @PostMapping("/shipment")
    @ApiOperation("物料出库")
    @ApiLogger(apiName = "物料出库", from = "MES")
    public AjaxResult shipment(@RequestBody MesShipment mesShipment) {
        if (StringUtils.isEmpty(mesShipment.getTaskNo())) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(mesShipment.getOrderCode())) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(mesShipment.getToPort())) {
            return AjaxResult.error("toPort 为空");
        }
        if (StringUtils.isEmpty(mesShipment.getShipmentMaterialDataList())) {
            return AjaxResult.error("materialData 为空");
        }
        if (mesShipment.getSequenceCount() <= 0) {
            return AjaxResult.error("sequenceCount 为空");
        }
        if (StringUtils.isEmpty(mesShipment.getSequenceGroup())) {
            return AjaxResult.error("sequenceGroup 为空");
        }
        return handleMultiProcess(() -> mesService.shipment(mesShipment));
    }

    /**
     * 入库回传
     */
    @PostMapping("/backReceipt")
    public AjaxResult backReceipt(Integer id) {
        if (StringUtils.isNull(id)) {
            return AjaxResult.error("id不能为空");
        }
        return mesService.backReceipt(id);
    }

    /**
     * 出库回传
     */
    @PostMapping("/backShipment")
    public AjaxResult backShipment(Integer id) {
        if (Objects.isNull(id)) {
            return AjaxResult.error("id不能为空");
        }
        return mesService.backShipment(id);
    }

    /**
     * 换站回传
     */
    @PostMapping("/backChangeStation")
    public AjaxResult backEmpty(Integer id) {
        if (Objects.isNull(id)) {
            return AjaxResult.error("任务id不能为空");
        }
        return mesService.backChangeStation(id);
    }

    /**
     * 质检抽样查询(取消)
     */
    @PostMapping("/searchInventoryByQC")
    @ApiOperation("质检抽样查询")
    @ApiLogger(apiName = "质检抽样查询", from = "MES")
    public AjaxResult searchInventoryByQC(@RequestBody MesSearchRequestByQCDto mesSearchRequestByQCDto) {
        String taskNo = mesSearchRequestByQCDto.getTaskNo();
        String orderCode = mesSearchRequestByQCDto.getOrderCode();
        String materialCode = mesSearchRequestByQCDto.getMaterialCode();
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(materialCode)) {
            return AjaxResult.error("materialCode 为空");
        }
        try {
            return mesService.searchInventoryByQC(mesSearchRequestByQCDto);
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 质检抽样出库
     */
    @PostMapping("/shipmentByQC")
    @ApiOperation("质检抽样出库")
    @ApiLogger(apiName = "质检抽样出库", from = "MES")
    public AjaxResult shipmentByQC(@RequestBody MesShipmentByQCDto mesShipmentByQCDto) {
        String taskNo = mesShipmentByQCDto.getTaskNo();
        String toPort = mesShipmentByQCDto.getToPort();
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(toPort)) {
            return AjaxResult.error("toPort 为空");
        }
        try {
            return mesService.shipmentByQC(mesShipmentByQCDto);
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 质检抽样入库
     */
    @PostMapping("/receiptByQC")
    @ApiOperation("质检抽样入库")
    @ApiLogger(apiName = "质检抽样入库", from = "MES")
    public AjaxResult receiptByQC(@RequestBody MesReceiptByQCDto mesReceiptByQCDto) {
        String taskNo = mesReceiptByQCDto.getTaskNo();
        String fromPort = mesReceiptByQCDto.getFromPort();
        String orderCode = mesReceiptByQCDto.getOrderCode();
        String containerCode = mesReceiptByQCDto.getContainerCode();
        String vehicleCode = mesReceiptByQCDto.getVehicleCode();
        List<ReceiptMaterialData> materialDataList = mesReceiptByQCDto.getMaterialDataList();
        if (StringUtils.isEmpty(taskNo)) {
            return AjaxResult.error("taskNo 为空");
        }
        if (StringUtils.isEmpty(fromPort)) {
            return AjaxResult.error("fromPort 为空");
        }
        if (StringUtils.isEmpty(orderCode)) {
            return AjaxResult.error("orderCode 为空");
        }
        if (StringUtils.isEmpty(containerCode)) {
            return AjaxResult.error("containerCode 为空");
        }
        if (StringUtils.isEmpty(vehicleCode)) {
            return AjaxResult.error("vehicleCode 为空");
        }
        if (StringUtils.isEmpty(materialDataList)) {
            return AjaxResult.error("materialDataList 为空");
        }
        try {
            return mesService.receiptByQC(mesReceiptByQCDto);
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 获取MES入库条码
     */
    @Log(title = "入库组盘-获取MES入库追溯码", operating = "获取MES入库追溯码", action = BusinessType.INSERT)
    @GetMapping("/getMesTracingCode")
    public AjaxResult getMesTracingCode(String zs) {
        if (StringUtils.isEmpty(zs)) {
            return AjaxResult.error("追溯码不能为空");
        }
        return mesService.getMesTracingCode(zs);
    }

    /**
     * 清/退库
     */
    @Log(title = "清/退库", action = BusinessType.INSERT)
    @ApiOperation("清/退库")
    @ApiLogger(apiName = "同步物料信息", from="MES")
    @PostMapping("/clearStock")
    public AjaxResult clearStock(@RequestBody ClearStockDto clearStockDto) {
        return mesService.clearStock(clearStockDto);
    }

    /**
     * 在制品/产出品出库
     */
    @Log(title = "在制品/产出品出库", action = BusinessType.INSERT)
    @ApiOperation("在制品/产出品出库")
    @ApiLogger(apiName = "在制品/产出品出库", from="MES")
    @PostMapping("/productShipment")
    public AjaxResult productShipment(@RequestBody ProductShipmentDto productShipmentDto) {
        return mesService.productShipmentDto(productShipmentDto);
    }

    /**
     * 查询空库位
     */
    @Log(title = "查询空库位", action = BusinessType.INSERT)
    @ApiOperation("查询空库位")
    @ApiLogger(apiName = "查询空库位", from="MES")
    @GetMapping("/queryEmptyLocation")
    public AjaxResult<List<EmptyLocationDto>> queryEmptyLocation() {
        return mesService.queryEmptyLocation();
    }

    /**
     * 查询药量
     */
    @Log(title = "查询药量", action = BusinessType.INSERT)
    @ApiOperation("查询药量")
    @ApiLogger(apiName = "查询药量", from="MES")
    @GetMapping("/queryPowder")
    public AjaxResult<?> queryPowder() {
        return mesService.queryPowder();
    }

    /**
     * 查询固化时间
     */
    @Log(title = "查询固化时间", action = BusinessType.INSERT)
    @ApiOperation("查询固化时间")
    @ApiLogger(apiName = "查询固化时间", from="MES")
    @PostMapping("/querySolidifyTime")
    public AjaxResult<?> querySolidifyTime(@RequestBody QuerySolidifyTimeDto querySolidifyTimeDto) {
        return mesService.querySolidifyTime(querySolidifyTimeDto);
    }

    /**
     * 同步物料信息
     */
    @Log(title = "同步物料信息", action = BusinessType.INSERT)
    @ApiOperation("同步物料信息")
    @ApiLogger(apiName = "同步物料信息", from="MES")
    @PostMapping("/syncMaterial")
    public AjaxResult syncMaterial(@RequestBody List<SyncMaterialDto> syncMaterialDtoList) {
        return mesService.syncMaterial(syncMaterialDtoList);
    }

    /**
     * 同步供应商信息
     */
    @Log(title = "同步供应商信息", action = BusinessType.INSERT)
    @ApiOperation("同步供应商信息")
    @ApiLogger(apiName = "同步供应商信息", from="MES")
    @PostMapping("/syncSupplier")
    public AjaxResult syncSupplier(@RequestBody List<SyncSupplierDto> syncSupplierDtoList) {
        return mesService.syncSupplier(syncSupplierDtoList);
    }

    /**
     * 同步盛具类型信息
     */
    @Log(title = "同步盛具类型信息", action = BusinessType.INSERT)
    @ApiOperation("同步盛具类型信息")
    @ApiLogger(apiName = "同步盛具类型信息", from="MES")
    @PostMapping("/syncVehicleType")
    public AjaxResult syncVehicleType(@RequestBody List<SyncVehicleTypeDto> syncVehicleTypeDtoList) {
        return mesService.syncVehicleType(syncVehicleTypeDtoList);
    }

    /**
     * 质检查询盛具编码
     */
    @Log(title = "质检查询盛具编码", action = BusinessType.INSERT)
    @ApiOperation("质检查询盛具编码")
    @ApiLogger(apiName = "质检查询盛具编码", from="MES")
    @PostMapping("/queryVehicleCodeByQC")
    public AjaxResult queryVehicleCodeByQC(@RequestBody List<QueryVehicleCodeByQCDto> queryVehicleCodeByQCList) {
        return mesService.queryVehicleCodeByQC(queryVehicleCodeByQCList);
    }

    /**
     * 更新物料质检状态
     */
    @Log(title = "更新物料质检状态", action = BusinessType.INSERT)
    @ApiOperation("更新物料质检状态")
    @ApiLogger(apiName = "更新物料质检状态", from="MES")
    @PostMapping("/updateMaterialInspectStatus")
    public AjaxResult updateMaterialInspectStatus(@RequestBody @Validated UpdateMaterialInspectStatusDto updateMaterialInspectStatusDto) {
        return mesService.updateMaterialInspectStatus(updateMaterialInspectStatusDto);
    }
}