514 lines
16 KiB
Java
514 lines
16 KiB
Java
package com.ruoyi.pda.controller;
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.ObjUtil;
|
|
import com.ruoyi.bas.stock.domain.BasStock;
|
|
import com.ruoyi.bas.stock.service.IBasStockInfoService;
|
|
import com.ruoyi.bas.stock.service.IBasStockService;
|
|
import com.ruoyi.common.TaskType;
|
|
import com.ruoyi.common.Utils.DecimalUtil;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.in.bind.domain.InTrayMsg;
|
|
import com.ruoyi.in.job.domain.MydoJob;
|
|
import com.ruoyi.in.job.service.IMydoJobService;
|
|
import com.ruoyi.in.jobdetail.domain.MydoJobDetail;
|
|
import com.ruoyi.in.stockin.domain.InStockin;
|
|
import com.ruoyi.in.stockin.service.IInStockinService;
|
|
import com.ruoyi.in.stockindetail.domain.InStockinDetail;
|
|
import com.ruoyi.in.stockindetail.service.IInStockinDetailService;
|
|
import com.ruoyi.out.stockoutdetail.domain.OutStockoutDetail;
|
|
import com.ruoyi.pda.domain.AddInJobRequest;
|
|
import com.ruoyi.pda.domain.TrayMsgBinding;
|
|
import com.ruoyi.pda.domain.BindTrayRequest;
|
|
import com.ruoyi.pda.service.IPdaService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 手持机 Controller
|
|
*
|
|
* @author ruoyi
|
|
* @date 2026-05-11
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/pda")
|
|
public class PdaController extends BaseController {
|
|
|
|
@Autowired
|
|
private IPdaService pdaService;
|
|
@Autowired
|
|
IMydoJobService mydoJobService;
|
|
@Autowired
|
|
IInStockinService inStockinService;
|
|
@Autowired
|
|
IInStockinDetailService inStockinDetailService;
|
|
@Autowired
|
|
IBasStockService basStockService;
|
|
|
|
|
|
/**
|
|
* 入库待处理任务列表
|
|
*/
|
|
@GetMapping("/inboundTaskList")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:task:list')")
|
|
public TableDataInfo list(InStockinDetail inStockinDetail) {
|
|
startPage();
|
|
List<InStockinDetail> list = pdaService.inboundTaskList(inStockinDetail);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库待处理单据列表
|
|
*/
|
|
@GetMapping("/inboundStockList")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:stock:list')")
|
|
public TableDataInfo list(InStockin inStockin) {
|
|
startPage();
|
|
List<InStockin> list = pdaService.inboundStockList(inStockin);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
|
|
/**
|
|
* 出库待处理任务列表
|
|
*/
|
|
@GetMapping("/outboundStockList")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:stock:list')")
|
|
public TableDataInfo list(OutStockoutDetail outStockoutDetail) {
|
|
startPage();
|
|
List<OutStockoutDetail> list = pdaService.outboundTaskList(outStockoutDetail);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
|
|
/**
|
|
* 出库待处理任务列表
|
|
*/
|
|
@GetMapping("/outboundTaskList")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:list')")
|
|
public TableDataInfo listTask(MydoJob mydoJob) {
|
|
startPage();
|
|
List<MydoJob> list = pdaService.selectMydoJobToDealList(mydoJob);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑盘(支持一托多料)
|
|
* <p>
|
|
* 请求体示例:
|
|
* {
|
|
* "trayCode": "T001",
|
|
* "warehouseId": "WH01",
|
|
* "items": [
|
|
* { "stockinDetailId": "D001", "productId": "P001", "quantity": 10 },
|
|
* { "stockinDetailId": "D002", "productId": "P002", "quantity": 20 }
|
|
* ]
|
|
* }
|
|
*/
|
|
@PostMapping("/bindTray")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:msg:add')")
|
|
public AjaxResult bindTray(@RequestBody BindTrayRequest request) {
|
|
try {
|
|
String res = pdaService.bindTray(request);
|
|
if (StringUtils.isEmpty(res)){
|
|
return AjaxResult.success();
|
|
}else {
|
|
return AjaxResult.error(res);
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑盘
|
|
*/
|
|
@PostMapping("/bindTrayMsg")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:msg:add')")
|
|
public AjaxResult bindTray(@RequestBody TrayMsgBinding bindTray) {
|
|
try {
|
|
if (bindTray == null) {
|
|
return AjaxResult.error();
|
|
}
|
|
|
|
return pdaService.bindingTrayMsg(bindTray);
|
|
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑盘
|
|
*/
|
|
@PostMapping("/bindTrayMsgs")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:msg:add')")
|
|
public AjaxResult bindTrays(@RequestBody BindTrayRequest bindTray) {
|
|
try {
|
|
if (bindTray == null) {
|
|
return AjaxResult.error();
|
|
}
|
|
|
|
return pdaService.bindingTrayMsg(bindTray);
|
|
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 取消入库绑盘
|
|
*/
|
|
@PostMapping("/cancelTrayMsgs")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:msg:cancel')")
|
|
public AjaxResult cancelTrays(@RequestBody String rollerNumber) {
|
|
try {
|
|
return pdaService.cancelTrayMsg(rollerNumber);
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 生成入库作业
|
|
* @param request
|
|
* @return
|
|
*/
|
|
@PostMapping("/addInJob")
|
|
@PreAuthorize("@ss.hasPermi('in:job:add')")
|
|
public AjaxResult addInJob(@RequestBody AddInJobRequest request){
|
|
try {
|
|
String res = pdaService.addInJob(request);
|
|
return AjaxResult.success(res);
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 生成空托盘入库绑定信息
|
|
* @param request
|
|
* @return
|
|
*/
|
|
@PostMapping("/addEmptyTrayJob")
|
|
@PreAuthorize("@ss.hasPermi('in:job:add')")
|
|
public AjaxResult addEmptyTrayJob(@RequestBody AddInJobRequest request){
|
|
try {
|
|
return pdaService.addEmptyTrayJob(request);
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑盘-查询物料信息(子单号查询)
|
|
* @param detailId 子单号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getProductInfoByInDetailId")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:task:info')")
|
|
public AjaxResult getProductInfoByInDetailId(String detailId) {
|
|
try {
|
|
InStockinDetail info = pdaService.getProductInfoByInDetailId(detailId);
|
|
return AjaxResult.success(info);
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑盘-查询物料信息(辊号查询)
|
|
* @param rollerNumber 辊号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getStockinInfoByRollerNumber")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:task:info')")
|
|
public AjaxResult getStockinInfoByRollerNumber(String rollerNumber) {
|
|
try {
|
|
InStockinDetail info = pdaService.getStockinInfoByRollerNumber(rollerNumber);
|
|
if(ObjUtil.isNull(info)){
|
|
return AjaxResult.error("找不到当前辊号信息,请检查入库单据明细");
|
|
}else{
|
|
if (DecimalUtil.eq(info.getScanNum(), BigDecimal.valueOf(0))) {
|
|
return AjaxResult.success(info);
|
|
}else{
|
|
return AjaxResult.warn("该版辊已经执行过绑定操作,请确认绑定信息");
|
|
}
|
|
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑盘作废-查询物料信息(辊号查询)
|
|
* @param rollerNumber 辊号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getTrayMsgByRollerNumber")
|
|
@PreAuthorize("@ss.hasPermi('in:bound:task:info')")
|
|
public AjaxResult getTrayMsgByRollerNumber(String rollerNumber) {
|
|
try {
|
|
InTrayMsg msg = pdaService.getTrayMsgByRollerNumber(rollerNumber);
|
|
if(ObjUtil.isNull(msg)){
|
|
return AjaxResult.error("找不到当前辊号信息,请检查入库单据明细");
|
|
}else{
|
|
return pdaService.cancelTrayMsg(rollerNumber);
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 出库确认-查询物料信息(辊号查询)
|
|
* @param rollerNumber 辊号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getStockoutInfoByRollerNumber")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult getStockoutInfoByRollerNumber(String rollerNumber) {
|
|
try {
|
|
OutStockoutDetail info = pdaService.getStockoutInfoByRollerNumber(rollerNumber);
|
|
if(ObjUtil.isNull(info)){
|
|
return AjaxResult.error("找不到当前辊号信息,请检查出库单据明细");
|
|
}else{
|
|
if (info.getAssignNum().equals(BigDecimal.valueOf(0))){
|
|
return AjaxResult.success(info);
|
|
}else{
|
|
return AjaxResult.warn("该版辊已经执行过出库确认操作");
|
|
}
|
|
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 出库确认-查询物料信息(托盘号查询) - 仅查询出库单中包含的版辊信息
|
|
* @param trayCode 托盘号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getStockoutInfoByTrayCode")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult getStockoutInfoByTrayCode(String trayCode) {
|
|
try {
|
|
MydoJob job = mydoJobService.selectMydoJobByTrayCode(trayCode);
|
|
List<MydoJobDetail> info = pdaService.getStockoutInfoByTrayCode(trayCode);
|
|
if(ObjUtil.isNull(job) || info.isEmpty()){
|
|
return AjaxResult.error("找不到当前托盘出库明细,请检查作业状态");
|
|
}else{
|
|
return AjaxResult.success(info);
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 出库确认-查询物料信息(托盘号查询) - 仅查询出库单中包含的版辊信息
|
|
* @param trayCode 托盘号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getManualStockoutInfoByTrayCode")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult getManualStockoutInfoByTrayCode(String trayCode) {
|
|
try {
|
|
MydoJob job = mydoJobService.selectMydoJobByTrayCode(trayCode);
|
|
List<MydoJobDetail> info = pdaService.getStockoutInfoByTrayCode(trayCode);
|
|
if(ObjUtil.isNull(job) || info.isEmpty() || job.getInOrOut() != TaskType.TASKTYPE_STOCKOUT_MANUAL){
|
|
return AjaxResult.error("找不到当前<手动>出库作业明细,请检查作业状态");
|
|
}else{
|
|
return AjaxResult.success(info);
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 入库绑定 - 通过入库单据号获取所有版辊信息集合
|
|
* @param stockinId 托盘号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getDetailListByStockinId")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult getDetailListByStockinId(String stockinId) {
|
|
try {
|
|
List<InStockinDetail> details = inStockinDetailService.selectInStockinDetailByStockinId(stockinId);
|
|
if(details.isEmpty()){
|
|
return AjaxResult.error();
|
|
}else{
|
|
return AjaxResult.success(details);
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 呼叫空托出库
|
|
* @param params 货位区域,托盘类型
|
|
* @return
|
|
*/
|
|
@PostMapping("/callStockOutForContainer")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult callStockOutForContainer(@RequestBody Map<String, Object> params) {
|
|
return pdaService.callContainerStockOut(params);
|
|
}
|
|
|
|
|
|
/**
|
|
* 物料(版辊)手动强制出库
|
|
* @param params
|
|
* @return
|
|
*/
|
|
@PostMapping("/rollerNumberComplete")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult rollerNumberComplete(@RequestBody Map<String, Object> params) {
|
|
return pdaService.rollerNumberComplete(params);
|
|
}
|
|
|
|
|
|
/**
|
|
* 物料(版辊)出库确认
|
|
* @param params
|
|
* @return
|
|
*/
|
|
@PostMapping("/stockoutDetailComplete")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult stockoutDetailComplete(@RequestBody Map<String, Object> params) {
|
|
return pdaService.stockoutDetailComplete(params);
|
|
}
|
|
|
|
|
|
/**
|
|
* 物料(版辊)单据出库确认 - 版辊单独确认
|
|
* @param trayCode
|
|
* @return
|
|
*/
|
|
@PostMapping("/stockoutTrayCodeComplete")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult stockoutTrayCodeComplete(String trayCode) {
|
|
return pdaService.stockoutTrayCodeComplete(trayCode);
|
|
}
|
|
|
|
|
|
/**
|
|
* 手动指定出库确认 - 版辊单独确认
|
|
* @param trayCode
|
|
* @return
|
|
*/
|
|
@PostMapping("/stockoutTrayCodeCompleteManual")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult stockoutTrayCodeCompleteManual(String trayCode) {
|
|
return pdaService.stockoutTrayCodeCompleteManual(trayCode);
|
|
}
|
|
|
|
|
|
/**
|
|
* 物料(版辊)出库确认 - 一键确认
|
|
* @param trayCode
|
|
* @return
|
|
*/
|
|
@PostMapping("/stockoutTrayCodeCompleteAll")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult stockoutTrayCodeCompleteAll(String trayCode) {
|
|
return pdaService.stockoutTrayCodeCompleteAll(trayCode);
|
|
}
|
|
|
|
|
|
|
|
|
|
//==================================== 盘点 ========================================
|
|
//==================================== 盘点 ========================================
|
|
//==================================== 盘点 ========================================
|
|
|
|
|
|
/**
|
|
* 盘点出库待处理任务列表
|
|
*/
|
|
@GetMapping("/inventoryOutTaskList")
|
|
@PreAuthorize("@ss.hasPermi('inventory:task:list')")
|
|
public TableDataInfo listInventoryTask(MydoJob mydoJob) {
|
|
mydoJob.setInOrOut(TaskType.TASKTYPE_STOCKOUT_INVENTORY);
|
|
startPage();
|
|
List<MydoJob> list = mydoJobService.selectMydoJobList(mydoJob);
|
|
return getDataTable(list);
|
|
}
|
|
|
|
|
|
/**
|
|
* 盘点-查询物料库存(托盘号查询)
|
|
* @param trayCode 托盘号
|
|
* @return
|
|
*/
|
|
@GetMapping("/getInventoryOutInfoByTrayCode")
|
|
@PreAuthorize("@ss.hasPermi('out:inventory:task:info')")
|
|
public AjaxResult getInventoryOutInfoByTrayCode(String trayCode) {
|
|
try {
|
|
MydoJob job = mydoJobService.selectMydoJobByTrayCode(trayCode);
|
|
// List<MydoJobDetail> info = pdaService.getStockoutInfoByTrayCode(trayCode);
|
|
List<BasStock> stocks = basStockService.selectBasStockListByTrayCode(trayCode);
|
|
if(ObjUtil.isNull(job) || stocks.isEmpty()){
|
|
return AjaxResult.error("找不到当前托盘出库明细,请检查作业状态");
|
|
}else{
|
|
return AjaxResult.success(stocks);
|
|
}
|
|
} catch (RuntimeException e) {
|
|
return AjaxResult.error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* 物料(版辊)库存【产品状态】异常标记
|
|
* @param params
|
|
* @return
|
|
*/
|
|
@PostMapping("/inventoryStockExcetion")
|
|
@PreAuthorize("@ss.hasPermi('out:inventory:task:info')")
|
|
public AjaxResult inventoryStockExcetion(@RequestBody Map<String, Object> params) {
|
|
return pdaService.inventoryStockExcetion(params);
|
|
}
|
|
|
|
|
|
/**
|
|
* 手动指定出库确认 - 版辊单独确认
|
|
* @param params
|
|
* @return
|
|
*/
|
|
@PostMapping("/inventoryTrayCodeComplete")
|
|
@PreAuthorize("@ss.hasPermi('out:bound:task:info')")
|
|
public AjaxResult inventoryTrayCodeComplete(Map<String, Object> params) {
|
|
return pdaService.inventoryTrayCodeComplete(params);
|
|
}
|
|
|
|
|
|
}
|