diff --git a/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java b/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java index 6f7b197..6c9bbc1 100644 --- a/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java +++ b/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java @@ -32,10 +32,15 @@ import com.huaheng.pc.inventory.inventoryTransaction.service.InventoryTransactio import com.huaheng.pc.momLog.service.IMomLogService; import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; +import com.huaheng.pc.receipt.receiptDetailHistory.domain.ReceiptDetailHistory; +import com.huaheng.pc.receipt.receiptDetailHistory.service.ReceiptDetailHistoryService; import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader; import com.huaheng.pc.receipt.receiptHeader.service.ReceiptHeaderService; +import com.huaheng.pc.receipt.receiptHeaderHistory.service.ReceiptHeaderHistoryService; import com.huaheng.pc.shipment.shipmentDetail.domain.ShipmentDetail; import com.huaheng.pc.shipment.shipmentDetail.service.ShipmentDetailService; +import com.huaheng.pc.shipment.shipmentDetailHistory.domain.ShipmentDetailHistory; +import com.huaheng.pc.shipment.shipmentDetailHistory.service.ShipmentDetailHistoryService; import com.huaheng.pc.shipment.shipmentHeader.domain.ShipmentHeader; import com.huaheng.pc.shipment.shipmentHeader.service.ShipmentHeaderService; import com.huaheng.pc.shipment.shipmentHeaderHistory.domain.ShipmentHeaderHistory; @@ -84,13 +89,18 @@ public class MesReceiptController extends BaseController { @Resource private TaskDetailService taskDetailService; - + @Resource + private ShipmentDetailHistoryService shipmentDetailHistoryService; + @Resource + private ReceiptDetailHistoryService receiptDetailHistoryService; @Resource private InventoryTransactionService inventoryTransactionService; @Resource private ShipmentHeaderHistoryService shipmentHeaderHistoryService; @Resource + private ReceiptHeaderHistoryService receiptHeaderHistoryService; + @Resource private MaterialService materialService; @Resource @@ -997,35 +1007,48 @@ public class MesReceiptController extends BaseController { List<ReceiptDetail> snno = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getSNNO, code)); if (!snno.isEmpty()) { code = snno.get(0).getReceiptCode(); + } else { + List<ReceiptDetail> list = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptCode, code)); + return AjaxResult.success(list); } - - List<ReceiptDetail> list = receiptDetailService.list(new LambdaQueryWrapper<ReceiptDetail>().eq(ReceiptDetail::getReceiptCode, code)); - if (list.isEmpty()) { + List<ReceiptDetailHistory> snno2 = receiptDetailHistoryService.list(new LambdaQueryWrapper<ReceiptDetailHistory>().eq(ReceiptDetailHistory::getSNNO, code)); + if (!snno2.isEmpty()) { + code = snno2.get(0).getReceiptCode(); + } + List<ReceiptDetailHistory> list2 = receiptDetailHistoryService.list(new LambdaQueryWrapper<ReceiptDetailHistory>().eq(ReceiptDetailHistory::getReceiptCode, code)); + if (list2.isEmpty()) { return AjaxResult.error("没有查询到数据"); } - return AjaxResult.success(list); + return AjaxResult.success(list2); } /** * 蓝牙打印出库物料明细 */ - //@RequiresPermissions("receipt:receiptDetail:printList") - //@Log(title = "入库-入库单明细管理", operating = "查看入库单明细", action = BusinessType.GRANT) @PostMapping("/shipment/printList") - //@ApiLogger(apiName = "蓝牙打印出库物料明细", from = "PDA") @ResponseBody public AjaxResult shipmentPrintList(String code) { List<ShipmentDetail> list = shipmentDetailService.list(new LambdaQueryWrapper<ShipmentDetail>().eq(ShipmentDetail::getShipmentCode, code)); - if (list.isEmpty()) { - return AjaxResult.error("没有查询到数据"); + if (!list.isEmpty()) { + for (ShipmentDetail shipmentDetail : list) { + ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentDetail.getShipmentId()); + shipmentDetail.setWarehouse(shipmentHeader.getWarehouse()); + shipmentDetail.setWarehouseName(shipmentHeader.getWarehouseName()); + } + return AjaxResult.success(list); } - for (ShipmentDetail shipmentDetail : list) { - ShipmentHeader shipmentHeader = shipmentHeaderService.getById(shipmentDetail.getShipmentId()); - shipmentDetail.setWarehouse(shipmentHeader.getWarehouse()); - shipmentDetail.setWarehouseName(shipmentHeader.getWarehouseName()); + + List<ShipmentDetailHistory> list2 = shipmentDetailHistoryService.list(new LambdaQueryWrapper<ShipmentDetailHistory>().eq(ShipmentDetailHistory::getShipmentCode, code)); + if (!list2.isEmpty()) { + for (ShipmentDetailHistory shipmentDetail : list2) { + ShipmentHeaderHistory shipmentHeader = shipmentHeaderHistoryService.getById(shipmentDetail.getShipmentId()); + shipmentDetail.setWarehouse(shipmentHeader.getWarehouse()); + shipmentDetail.setWarehouseName(shipmentHeader.getWarehouseName()); + } + return AjaxResult.success(list); } - return AjaxResult.success(list); + return AjaxResult.error("没有查询到数据"); } } diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/domain/ShipmentDetailHistory.java b/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/domain/ShipmentDetailHistory.java index da010a7..38a584c 100644 --- a/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/domain/ShipmentDetailHistory.java +++ b/src/main/java/com/huaheng/pc/shipment/shipmentDetailHistory/domain/ShipmentDetailHistory.java @@ -387,4 +387,16 @@ public class ShipmentDetailHistory implements Serializable { @TableField(value = "preMergerWorkshop") @ApiModelProperty(value = "合并前车间") private String preMergerWorkshop; + + /** + * 原仓库编码 + */ + @TableField(exist = false) + private String warehouse; + + /** + * 原仓库名称 + */ + @TableField(exist = false) + private String warehouseName; }