后台信息国际化

This commit is contained in:
liuhanqing
2025-07-29 16:59:06 +08:00
parent 2e79e1a04e
commit 59aa1b8b3e
12 changed files with 207 additions and 90 deletions

View File

@@ -11,6 +11,7 @@ import cn.hutool.core.util.StrUtil;
import com.ruoyi.bas.basJobId.service.IBasJobIdService;
import com.ruoyi.bas.warehouse.domain.BasWarehouse;
import com.ruoyi.bas.warehouse.service.IBasWarehouseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils;
@@ -44,6 +45,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/check/difference")
@Slf4j
public class CheckDifferenceRecordController extends BaseController {
@Autowired
private ICheckDifferenceRecordService checkDifferenceRecordService;
@@ -140,7 +142,8 @@ public class CheckDifferenceRecordController extends BaseController {
if ("1".equals(recordType)) { // 更新数据
// 根据stockId、trayCode、oldQuantity查找库存记录
if (StrUtil.isEmpty(record.getStockId())) {
return AjaxResult.error("没有找到该库存ID:" + record.getStockId());
log.error("没有找到该库存ID:{}" , record.getStockId());
return AjaxResult.error();
}
BasStock queryStock = new BasStock();
@@ -148,7 +151,8 @@ public class CheckDifferenceRecordController extends BaseController {
List<BasStock> stocks = basStockService.selectBasStockList(queryStock);
if (stocks.isEmpty()) {
return AjaxResult.error("没有在库存中找到该条记录:库存ID=" + record.getStockId() + ", 托盘号=" + record.getTrayCode());
log.error("没有在库存中找到该条记录:库存ID {}, 托盘号 {}", record.getStockId() , record.getTrayCode());
return AjaxResult.error();
}
// 更新库存数量和状态
@@ -159,7 +163,8 @@ public class CheckDifferenceRecordController extends BaseController {
} else if ("2".equals(recordType)) { // 新增数据
// 检查物料ID是否存在
if (record.getProductId() == null || record.getProductId().trim().isEmpty()) {
return AjaxResult.error("物料ID不能为空");
log.error("物料ID不能为空");
return AjaxResult.error();
}
// 创建新的库存记录
@@ -208,7 +213,8 @@ public class CheckDifferenceRecordController extends BaseController {
List<BasStock> stocks = basStockService.selectBasStockList(queryStock);
if (stocks.isEmpty()) {
return AjaxResult.error("没有在库存中找到该条记录:库存ID=" + record.getStockId() + ", 托盘号=" + record.getTrayCode());
log.error("要删除的库存不存在");
return AjaxResult.error();
}

View File

@@ -11,6 +11,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.stock.stock.domain.BasStock;
import com.ruoyi.stock.stock.service.IBasStockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.check.difference.mapper.CheckDifferenceRecordMapper;
@@ -24,6 +25,7 @@ import com.ruoyi.check.difference.service.ICheckDifferenceRecordService;
* @date 2025-05-28
*/
@Service
@Slf4j
public class CheckDifferenceRecordServiceImpl implements ICheckDifferenceRecordService
{
@Autowired
@@ -73,7 +75,8 @@ public class CheckDifferenceRecordServiceImpl implements ICheckDifferenceRecordS
String stockId = checkDifferenceRecord.getStockId();
BasStock basStock = basStockService.selectBasStockByStockId(stockId);
if (!"1".equals(basStock.getProductStatus())){
return AjaxResult.warn("库存非正常状态");
log.warn("库存非正常状态{}",basStock.getStockId());
return AjaxResult.error();
}
if (basStock.getQuantity().equals(checkDifferenceRecord.getNewQuantity())){
return AjaxResult.success();
@@ -92,20 +95,23 @@ public class CheckDifferenceRecordServiceImpl implements ICheckDifferenceRecordS
queryStock.setWarehouseId(checkDifferenceRecord.getWarehouseId());
List<BasStock> stocks = basStockService.selectBasStockList(queryStock);
if (!stocks.isEmpty()) {
return AjaxResult.error("该物料已存在");
log.warn("该物料已存在{}",checkDifferenceRecord.getProductId());
return AjaxResult.error();
}
BasCargoSpace queryCargoSpace = new BasCargoSpace();
queryCargoSpace.setWarehouseId(checkDifferenceRecord.getWarehouseId());
List<BasCargoSpace> cargoSpaces = basCargoSpaceService.selectBasCargoSpaceList(queryCargoSpace);
if (cargoSpaces.isEmpty()){
return AjaxResult.error("没有货位");
log.warn("没有货位");
return AjaxResult.error();
}
checkDifferenceRecord.setCargoSpaceId(cargoSpaces.get(0).getCargoSpaceId());
checkDifferenceRecord.setOldQuantity("0");
}else if (checkDifferenceRecord.getRecordType()==3){
BasStock basStock = basStockService.selectBasStockByStockId(checkDifferenceRecord.getStockId());
if (!"1".equals(basStock.getProductStatus())){
return AjaxResult.warn("库存非正常状态");
log.warn("库存非正常状态 productId:{} status:{}",basStock.getProductId(),basStock.getProductStatus());
return AjaxResult.error();
}
basStock.setProductStatus("2");
basStockService.updateBasStock(basStock);
@@ -120,7 +126,7 @@ public class CheckDifferenceRecordServiceImpl implements ICheckDifferenceRecordS
checkDifferenceRecord.setCheckGuid(IdUtil.fastSimpleUUID());
checkDifferenceRecord.setStatus("0");
checkDifferenceRecordMapper.insertCheckDifferenceRecord(checkDifferenceRecord);
return AjaxResult.success("操作成功");
return AjaxResult.success();
}
/**

View File

@@ -29,6 +29,7 @@ import com.ruoyi.out.outStockout.domain.OutStockoutVo;
import com.ruoyi.out.outStockoutDetail.domain.OutStockoutDetail;
import com.ruoyi.stock.stock.domain.BasStock;
import com.ruoyi.stock.stock.service.IBasStockService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
@@ -44,6 +45,7 @@ import org.springframework.transaction.annotation.Transactional;
* @date 2025-05-29
*/
@Service
@Slf4j
public class CheckStockinServiceImpl implements ICheckStockinService
{
@Autowired
@@ -108,25 +110,29 @@ public class CheckStockinServiceImpl implements ICheckStockinService
if ("5".equals(checkStockin.getStatus())){
//作废
if (!"1".equals(old.getStatus())){
return AjaxResult.error("单据状态非未执行状态!");
log.error("单据状态非未执行状态!");
return AjaxResult.error();
}
checkStockinMapper.updateCheckStockin(checkStockin);
//插入历史单据
insertCheckStockinHistory(checkStockin);
}else if ("2".equals(checkStockin.getStatus())){
if (StrUtil.isEmpty(checkStockin.getSpare1())){
return AjaxResult.error("请选择出口!");
log.error("请选择出口!");
return AjaxResult.error();
}
//审核
if (!"1".equals(old.getStatus())){
return AjaxResult.error("单据状态非未执行状态!");
log.error("单据状态非未执行状态!");
return AjaxResult.error();
}
checkStockinMapper.updateCheckStockin(checkStockin);
}else if ("4".equals(checkStockin.getStatus())){
//确认
if (!"3".equals(old.getStatus())){
return AjaxResult.error("单据状态非正执行状态!");
log.error("单据状态非正执行状态!");
return AjaxResult.error();
}
checkStockinMapper.updateCheckStockin(checkStockin);
insertCheckStockinHistory(checkStockin);
@@ -224,13 +230,14 @@ public class CheckStockinServiceImpl implements ICheckStockinService
public AjaxResult autoAllocation(CheckStockin checkStockin) {
CheckStockin currentCheckStock = selectCheckStockinByStockGuid(checkStockin.getStockGuid());
if (ObjUtil.isNull(currentCheckStock)){
return AjaxResult.warn("单据不存在!");
log.warn("单据不存在! stockGudi:{}",checkStockin.getStockGuid());
return AjaxResult.error();
}
HashMap<String, String> map = new HashMap<>();
map.put("v_stock_check_id", currentCheckStock.getStockCheckId());
checkStockinMapper.autoAllot(map);
if ("10".equals(map.get("v_result"))){
return AjaxResult.success("自动分配成功");
return AjaxResult.success();
}else {
return AjaxResult.warn(map.get("v_resultmsg"));
}