出入库单oms;
This commit is contained in:
+179
@@ -0,0 +1,179 @@
|
||||
package com.mhd.oms.interfaces.facade.ReservationStockOutOrder;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDO;
|
||||
import com.mhd.oms.domain.reservationStockInOrder.repository.todo.ReservationStockInOrderDTO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.entity.ReservationStockOutOrder;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.facade.IReservationStockOutOrderService;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.po.ReservationStockOutOrderPO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.repository.todo.ReservationStockOutOrderDTO;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.service.ReservationStockOutOrderApplicationService;
|
||||
import com.mhd.oms.domain.reservationStockOutOrder.service.ReservationStockOutOrderAssembler;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库单Api
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-28
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/stockOutOrderApi")
|
||||
public class ReservationStockOutOrderApi extends BaseController {
|
||||
@Autowired
|
||||
private ReservationStockOutOrderApplicationService stockOutOrderApplicationService;
|
||||
|
||||
@Resource
|
||||
private ReservationStockOutOrderAssembler stockOutOrderAssembler;
|
||||
|
||||
@Autowired
|
||||
private IReservationStockOutOrderService stockOutOrderService;
|
||||
|
||||
/**
|
||||
* 分页查询出库单列表
|
||||
*/
|
||||
@ApiOperation("查询出库单列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ReservationStockOutOrderDTO stockOutOrderDTO)
|
||||
{
|
||||
//转换实体
|
||||
ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
|
||||
startPage();
|
||||
List<ReservationStockOutOrderPO> list = stockOutOrderApplicationService.queryList(stockOutOrderDO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑出库单
|
||||
*/
|
||||
@ApiOperation("编辑出库单")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody ReservationStockOutOrderDTO stockOutOrderDTO)
|
||||
{
|
||||
//转换实体
|
||||
ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDOByEdit(stockOutOrderDTO);
|
||||
if(stockOutOrderDTO.getOutOrderId() != null){
|
||||
return toAjax(stockOutOrderApplicationService.update(stockOutOrderDO));
|
||||
}else {
|
||||
return toAjax(stockOutOrderApplicationService.insert(stockOutOrderDO));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除出库单
|
||||
*/
|
||||
@ApiOperation("批量删除出库单")
|
||||
@DeleteMapping("/deleteByIds/{outOrderIds}")
|
||||
public AjaxResult delete(@PathVariable Long[] outOrderIds)
|
||||
{
|
||||
return toAjax(stockOutOrderApplicationService.delete(outOrderIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出库单详细信息
|
||||
*/
|
||||
@ApiOperation("获取出库单")
|
||||
@GetMapping(value = "/getInfo/{outOrderId}")
|
||||
public AjaxResult getInfo(@PathVariable("outOrderId") Long outOrderId)
|
||||
{
|
||||
return AjaxResult.success(stockOutOrderApplicationService.getInfoChildren(outOrderId));
|
||||
}
|
||||
/**
|
||||
* 根据出库单号获取出库单详细信息
|
||||
*/
|
||||
@ApiOperation("获取出库单")
|
||||
@GetMapping(value = "/getInfoOutOrderNumber")
|
||||
public AjaxResult getInfoOutOrderNumber(String outOrderNumber)
|
||||
{
|
||||
// 根据出库单号查询出库单,再按出库单ID查询详情,保证与出库管理页面一致
|
||||
ReservationStockOutOrder stockOutOrder = stockOutOrderService.getOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
||||
.eq(ReservationStockOutOrder::getOutOrderNumber, outOrderNumber));
|
||||
if (stockOutOrder == null) {
|
||||
return AjaxResult.error("出库单不存在");
|
||||
}
|
||||
return AjaxResult.success(stockOutOrderApplicationService.getInfoChildren(stockOutOrder.getOutOrderId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据来源单号/出库单号(orderNumber)获取出库单详细信息
|
||||
* 方便交接作业单等场景直接用 orderNumber 调用,内部仍然通过 outOrderNumber 精确匹配出库单
|
||||
*/
|
||||
@ApiOperation("根据orderNumber获取出库单详情")
|
||||
@GetMapping("/getInfoByOrderNumber")
|
||||
public AjaxResult getInfoByOrderNumber(@RequestParam("orderNumber") String orderNumber) {
|
||||
if (orderNumber == null || orderNumber.trim().isEmpty()) {
|
||||
return AjaxResult.error("orderNumber不能为空");
|
||||
}
|
||||
ReservationStockOutOrder stockOutOrder = stockOutOrderService.getOne(new LambdaQueryWrapper<ReservationStockOutOrder>()
|
||||
.eq(ReservationStockOutOrder::getOutOrderNumber, orderNumber));
|
||||
if (stockOutOrder == null) {
|
||||
return AjaxResult.error("出库单不存在");
|
||||
}
|
||||
return AjaxResult.success(stockOutOrderApplicationService.getInfoChildren(stockOutOrder.getOutOrderId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核出库单
|
||||
*/
|
||||
// @ApiOperation("审核出库单")
|
||||
// @PostMapping(value = "/auditState")
|
||||
// public AjaxResult auditState(@RequestBody ReservationStockOutOrderDTO stockOutOrderDTO) {
|
||||
// ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
|
||||
// return AjaxResult.success(stockOutOrderApplicationService.auditState(stockOutOrderDO));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取出库单复核详细信息
|
||||
*/
|
||||
// @ApiOperation("获取出库单复核详细信息")
|
||||
// @GetMapping(value = "/getCheckInfo")
|
||||
// public AjaxResult getCheckInfo(ReservationStockOutOrderDTO stockOutOrderDTO)
|
||||
// {
|
||||
// //转换实体
|
||||
// ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
|
||||
// return AjaxResult.success(stockOutOrderApplicationService.getCheckInfo(stockOutOrderDO));
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 审核出库单
|
||||
*/
|
||||
@ApiOperation("审核出库单")
|
||||
@PostMapping(value = "/auditState")
|
||||
public AjaxResult auditState(@RequestBody ReservationStockOutOrderDTO stockOutOrderDTO) {
|
||||
ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
|
||||
return AjaxResult.success(stockOutOrderApplicationService.auditState(stockOutOrderDO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发出库单
|
||||
*/
|
||||
@ApiOperation("下发出库单")
|
||||
@PostMapping(value = "/issueOrder")
|
||||
public AjaxResult issueOrder(@RequestBody ReservationStockOutOrderDTO stockOutOrderDTO) {
|
||||
ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDO(stockOutOrderDTO);
|
||||
return AjaxResult.success(stockOutOrderApplicationService.issueOrder(stockOutOrderDO));
|
||||
}
|
||||
|
||||
@ApiOperation("关闭出库单")
|
||||
@PostMapping("/close")
|
||||
public AjaxResult close(@RequestBody ReservationStockOutOrderDTO stockOutOrderDTO)
|
||||
{
|
||||
//转换实体
|
||||
ReservationStockOutOrderDO stockOutOrderDO = stockOutOrderAssembler.toDOByEdit(stockOutOrderDTO);
|
||||
return toAjax(stockOutOrderApplicationService.close(stockOutOrderDO));
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -105,6 +105,16 @@ public class ReservationStockInOrderApi extends BaseController {
|
||||
return AjaxResult.success(stockInOrderApplicationService.auditState(stockInOrderDO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发入库单
|
||||
*/
|
||||
@ApiOperation("下发入库单")
|
||||
@PostMapping(value = "/issueOrder")
|
||||
public AjaxResult issueOrder(@RequestBody ReservationStockInOrderDTO stockInOrderDTO) {
|
||||
ReservationStockInOrderDO stockInOrderDO = stockInOrderAssembler.toDO(stockInOrderDTO);
|
||||
return AjaxResult.success(stockInOrderApplicationService.issueOrder(stockInOrderDO));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消入库单
|
||||
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
package com.mhd.oms.interfaces.facade.sysTableConfig;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mhd.common.core.utils.sms.Result;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.oms.domain.sysTableConfig.entity.SysTableConfig;
|
||||
import com.mhd.oms.domain.sysTableConfig.repository.facade.ISysTableConfigService;
|
||||
import com.mhd.oms.domain.sysTableConfig.repository.todo.SysTableConfigDTO;
|
||||
import com.mhd.oms.domain.sysTableConfig.repository.vo.SysTableConfigVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gen
|
||||
* @date 2024-05-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysTableConfigApi")
|
||||
@Slf4j
|
||||
public class SysTableConfigApi extends BaseController {
|
||||
@Autowired
|
||||
private ISysTableConfigService sysTableConfigService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysTableConfigDTO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 分页列表查询", notes = "系统表配置 - 分页列表查询")
|
||||
@GetMapping(value = "/queryList")
|
||||
public Result<?> queryList(SysTableConfigDTO sysTableConfigDTO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Result<IPage<SysTableConfigVO>> result = new Result<>();
|
||||
Page<SysTableConfigVO> pageList = new Page<>(pageNo, pageSize);
|
||||
pageList = sysTableConfigService.queryList(pageList, sysTableConfigDTO);
|
||||
result.setResult(pageList);
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织 ID 和键查询配置
|
||||
*
|
||||
* @param organizationId 组织 ID
|
||||
* @param key 配置键
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 和键查询", notes = "系统表配置 - 根据组织 ID 和键查询")
|
||||
@GetMapping(value = "/getByOrgIdAndKey")
|
||||
public Result<?> getByOrgIdAndKey(@RequestParam(name="organizationId") Long organizationId,
|
||||
@RequestParam(name="warehouseId") Long warehouseId,
|
||||
@RequestParam(name="key") String key) {
|
||||
try {
|
||||
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key, warehouseId);
|
||||
if (config == null) {
|
||||
return Result.ok("未找到对应配置");
|
||||
}
|
||||
return Result.ok(config);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织 ID 查询所有配置
|
||||
*
|
||||
* @param organizationId 组织 ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 查询所有配置", notes = "系统表配置 - 根据组织 ID 查询所有配置")
|
||||
@GetMapping(value = "/listByOrgId")
|
||||
public Result<?> listByOrgId(@RequestParam(name="organizationId") Long organizationId,
|
||||
@RequestParam(name="warehouseId") Long warehouseId) {
|
||||
try {
|
||||
List<SysTableConfig> list = sysTableConfigService.listByOrgId(organizationId, warehouseId);
|
||||
return Result.ok(list);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return Result.error("查询失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加或更新配置
|
||||
*
|
||||
* @param sysTableConfigDTO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 添加或更新", notes = "系统表配置 - 添加或更新")
|
||||
@PostMapping(value = "/saveOrUpdate")
|
||||
public Result<?> saveOrUpdate(@RequestBody SysTableConfigDTO sysTableConfigDTO) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
boolean success = sysTableConfigService.saveOrUpdateConfig(sysTableConfigDTO);
|
||||
if (success) {
|
||||
result.success("保存成功!");
|
||||
} else {
|
||||
result.error500("保存失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 删除", notes = "系统表配置 - 删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
sysTableConfigService.delete(Arrays.asList(id));
|
||||
result.success("删除成功!");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 批量删除", notes = "系统表配置 - 批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
int count = sysTableConfigService.delete(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功,共删除" + count + "条记录");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据组织 ID 删除所有配置
|
||||
*
|
||||
* @param organizationId 组织 ID
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 根据组织 ID 删除所有配置", notes = "系统表配置 - 根据组织 ID 删除所有配置")
|
||||
@DeleteMapping(value = "/deleteByOrgId")
|
||||
public Result<?> deleteByOrgId(@RequestParam(name="organizationId",required=true) Long organizationId) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
int count = sysTableConfigService.deleteByOrgId(organizationId);
|
||||
result.success("删除成功,共删除" + count + "条记录");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
result.error500("操作失败:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 id 查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统表配置 - 通过 id 查询", notes = "系统表配置 - 通过 id 查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SysTableConfig config = sysTableConfigService.getById(id);
|
||||
if (config == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.ok(config);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user