/* * Copyright (c) 2018-2025, ztt All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the pig4cloud.com developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: ztt */ package com.chinaztt.mes.warehouse.controller; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.chinaztt.mes.basic.entity.Part; import com.chinaztt.mes.basic.service.PartService; import com.chinaztt.mes.common.wrapper.QueryWrapperUtil; import com.chinaztt.mes.warehouse.dto.InventoryMainDTO; import com.chinaztt.mes.warehouse.entity.InventoryDetail; import com.chinaztt.mes.warehouse.entity.InventoryMain; import com.chinaztt.mes.warehouse.service.InventoryDetailService; import com.chinaztt.mes.warehouse.service.InventoryMainService; import com.chinaztt.ztt.common.core.util.R; import com.chinaztt.ztt.common.log.annotation.SysLog; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; /** * 新盘点主表 * * @author yangyao * @date 2022-10-13 11:06:00 */ @RestController @AllArgsConstructor @RequestMapping("/inventoryMain" ) @Api(value = "inventoryMain", tags = "新盘点主表管理") public class InventoryMainController { private final InventoryMainService inventoryMainService; private final InventoryDetailService inventoryDetailService; private final PartService partService; /** * 盘点主表分页查询 * * @param page 分页对象 * @param inventoryMain 盘点主表 * @return */ @ApiOperation(value = "分页查询", notes = "分页查询") @GetMapping("/page") public R getInventoryMainPage(Page page, InventoryMain inventoryMain) { return R.ok(inventoryMainService.page(page, QueryWrapperUtil.gen(inventoryMain).orderByDesc("create_time"))); } /** * 通过id删除盘点主表记录 * * @param id id * @return R */ @ApiOperation(value = "通过id删除盘点主表记录", notes = "通过id删除盘点主表记录") @SysLog("通过id删除盘点主表记录") @DeleteMapping("/{id}") public R removeById(@PathVariable Long id) { return R.ok(inventoryMainService.remove(id)); } /** * 通过id修改盘点主表记录 * * @param inventoryMain 盘点主表 * @return R */ @ApiOperation(value = "通过id修改盘点主表记录", notes = "通过id修改盘点主表记录") @SysLog("通过id修改盘点主表记录") @PutMapping public R updateById(@RequestBody InventoryMain inventoryMain) { return R.ok(inventoryMainService.updateById(inventoryMain)); } /** * 新增盘点 * * @param inventoryMainDTO 新增盘点 * @return R */ @ApiOperation(value = "新增盘点", notes = "新增盘点") @SysLog("新增盘点") @PostMapping public R save(@RequestBody InventoryMainDTO inventoryMainDTO) { return R.ok(inventoryMainService.fullSave(inventoryMainDTO)); } /** * 盘点明细分页查询 * * @param page 分页对象 * @param inventoryDetail 盘点明细 * @return */ @ApiOperation(value = "盘点明细分页查询", notes = "盘点明细分页查询") @GetMapping("/detail/page") public R getInventoryDetailPage(Page page, InventoryDetail inventoryDetail) { return R.ok(inventoryDetailService.page(page, QueryWrapperUtil.gen(inventoryDetail))); } /** * 新增盘点明细 * * @param inventoryDetail 盘点明细 * @return R */ @ApiOperation(value = "新增盘点明细", notes = "新增盘点明细") @SysLog("新增盘点明细") @PostMapping("/detail") public R saveInventoryDetail(@RequestBody InventoryDetail inventoryDetail) { return R.ok(inventoryDetailService.fullSave(inventoryDetail)); } /** * 批量删除盘点明细 * * @param ids ids * @return R */ @ApiOperation(value = "批量删除盘点明细", notes = "批量删除盘点明细") @SysLog("批量删除盘点明细") @DeleteMapping("/detail") public R batchDeleteDetail(@RequestBody List ids) { return R.ok(inventoryDetailService.removeByIds(ids)); } /** * 批量编辑盘点明细 * * @param id id * @return R */ @ApiOperation(value = "批量编辑盘点明细", notes = "批量编辑盘点明细") @SysLog("批量编辑盘点明细") @PutMapping("/detail") public R batchUpdateDetail(@RequestBody List inventoryDetails) { return R.ok(inventoryDetailService.updateBatch(inventoryDetails)); } /** * 盘点没有差异按钮 * * @param id id * @return R */ @ApiOperation(value = "盘点没有差异按钮", notes = "盘点没有差异按钮") @SysLog("盘点没有差异按钮") @PostMapping("/detail/noDiff") public R noDiff(@RequestBody List ids) { return R.ok(inventoryDetailService.noDiff(ids)); } /** * 取消未盘点的行 * * @param id id * @return R */ @ApiOperation(value = "取消未盘点的行", notes = "取消未盘点的行") @SysLog("取消未盘点的行") @PostMapping("/detail/cancelNoIny") public R cancelNoIny(@RequestBody List ids) { return R.ok(inventoryDetailService.cancelNoIny(ids)); } /** * 新增pda盘点前check * * @param inventoryDetail 新增pda盘点前check * @return R */ @ApiOperation(value = "新增pda盘点前check", notes = "新增pda盘点前check") @SysLog("新增pda盘点前check") @PostMapping("/checkSavePda") public R checkSavePda(@RequestBody InventoryDetail inventoryDetail) { return R.ok(inventoryDetailService.checkSavePda(inventoryDetail)); } /** * 新增pda盘点 * * @param inventoryDetail pda盘点 * @return R */ @ApiOperation(value = "新增pda盘点", notes = "新增pda盘点") @SysLog("新增pda盘点") @PostMapping("/pda") public R savePda(@RequestBody InventoryDetail inventoryDetail) { return R.ok(inventoryDetailService.savePda(inventoryDetail)); } /** * 导出 * * @return */ @ApiOperation(value = "导出", notes = "导出") @GetMapping("/export") public void export(HttpServletResponse response,@RequestParam List ids) throws IOException { inventoryMainService.export(response, ids); } @ApiOperation(value = "根据零件号获取零件信息", notes = "根据零件号获取零件信息") @GetMapping("/getPartNo") public R getPartNo(@RequestParam("partNo")String partNo) { return R.ok(partService.getOne(Wrappers.lambdaQuery().eq(Part::getPartNo, partNo))); } @ApiOperation(value = "判断标签是否是盘点时打印", notes = "判断标签是否是盘点时打印") @PostMapping("/judgeLabelMark") public R judgeLabelMark(@RequestBody List snList) { return R.ok(inventoryDetailService.judgeLabelMark(snList)); } }