1. 盘点增加根据物料信息的二次判断。

2. 物料信息增加盘点指示器,1/3。
This commit is contained in:
梁州 2025-11-24 14:34:44 +08:00
parent 4df1d073c7
commit f56df06fea
9 changed files with 119 additions and 17 deletions

View File

@ -1,14 +1,12 @@
package com.wms.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wms.annotation.MyLog;
import com.wms.constants.enums.ResponseCode;
import com.wms.entity.app.ResponseEntity;
import com.wms.entity.app.dto.GoodsDto;
import com.wms.entity.app.dto.PageDto;
import com.wms.entity.app.dto.extend.VehicleDetailInfo;
import com.wms.entity.app.request.GoodsQuery;
@ -107,7 +105,6 @@ public class GoodsController {
*/
@PostMapping("/updateGoodsInfo")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "更新物料信息", logMethod = "updateGoodsInfo")
public String updateGoodsInfo(@RequestBody GoodsQuery goodsQuery) {
logger.info("接收到更新物料信息请求:{}请求ip{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
@ -133,9 +130,6 @@ public class GoodsController {
}
return convertJsonString(rsp);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
e.printStackTrace();
logger.error("更新物料信息发生异常:{}", e.getMessage());
// 返回其他异常
rsp.setCode(ResponseCode.ERROR.getCode());
@ -168,10 +162,8 @@ public class GoodsController {
rsp.setReturnData(goodsList);
return convertJsonString(rsp);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// 返回其他异常
logger.error("查询物料信息发生错误{}", e.getMessage());
logger.error("查询物料信息发生异常:{}", e.getMessage());
rsp.setCode(ResponseCode.ERROR.getCode());
rsp.setMessage("查询物料发生异常");
return convertJsonString(rsp);
@ -218,7 +210,6 @@ public class GoodsController {
*/
@PostMapping("/deleteGoodsInfo")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "删除物料信息", logMethod = "deleteGoodsInfo")
public String deleteVehicle(@RequestBody GoodsQuery goodsQuery) {
logger.info("接收到删除物料信息请求:{}请求ip地址{}", convertJsonString(goodsQuery), HttpUtils.getIpAddr(servletRequest));
@ -231,7 +222,7 @@ public class GoodsController {
rsp.setMessage("请求删除的物料编码为空");
return convertJsonString(rsp);
}
if (goodsService.remove(new LambdaQueryWrapper<Goods>().eq(Goods::getGoodsId, goodsQuery.getGoodsId()))) {
if (goodsService.removeById(goodsQuery.getGoodsId())) {
logger.info("删除物料信息成功");
rsp.setCode(ResponseCode.OK.getCode());
rsp.setMessage("删除物料信息成功");
@ -243,8 +234,6 @@ public class GoodsController {
}
return convertJsonString(rsp);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.error("删除物料信息发生异常:{}", e.getMessage());
// 返回其他异常
rsp.setCode(ResponseCode.ERROR.getCode());
@ -261,7 +250,6 @@ public class GoodsController {
*/
@PostMapping("/genGoods")
@ResponseBody
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
@MyLog(logTitle = "生成物料表", logMethod = "genGoods")
public String genGoods(@RequestBody GoodsQuery goodsQuery) {
// 9*64*22
@ -296,8 +284,6 @@ public class GoodsController {
rsp.setMessage("生成测试物料成功。");
return convertJsonString(rsp);
} catch (Exception e) {
// 回滚事务
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
logger.info("生成测试物料异常:{}", convertJsonString(e));
// 返回其他异常
rsp.setCode(ResponseCode.ERROR.getCode());

View File

@ -2845,7 +2845,8 @@ public class TaskController {
}
} else if (Objects.equals(tempStock.getStockStatus(), StockStatus.OUT.getCode())
|| Objects.equals(tempStock.getStockStatus(), StockStatus.PICKING.getCode())) {
|| Objects.equals(tempStock.getStockStatus(), StockStatus.PICKING.getCode())
|| Objects.equals(tempStock.getStockStatus(), StockStatus.OUTED.getCode())) {
// 查询这个箱子的拣选任务
List<PickTask> thisVehiclePickTasks = pickTaskService.list(new LambdaQueryWrapper<PickTask>()
.eq(PickTask::getVehicleId, tempStock.getVehicleId()));
@ -3389,8 +3390,27 @@ public class TaskController {
// 更新库存数量
if (existStock != null && existStock.getGoodsRelated() != null) {
if (confirmRequest.getConfirmNum().compareTo(existStock.getGoodsRelated().getRemainNum()) != 0) {
// 原始库存数量
Stock originStock = BeanUtil.copyProperties(existStock, Stock.class);
BigDecimal quantityBefore = originStock.getGoodsRelated().getRemainNum();
// 判断前后数量差距
BigDecimal diffQuantity = confirmRequest.getConfirmNum().subtract(quantityBefore);
BigDecimal diffPercent = diffQuantity.divide(quantityBefore, 2, RoundingMode.HALF_UP).abs();
if (diffPercent.compareTo(BigDecimal.valueOf(0.05)) > 0) {
// 查询物料信息
Goods goods = goodsService.getById(confirmRequest.getGoodsId());
if (goods != null) {
if (goods.getIndicator() == 3) {
// 判断是否已经盘点三次
if (confirmRequest.getInvIndex() < 3) {
logger.info("确认数量与原数量差距超过5%,请再次确认。");
response.setCode(ResponseCode.WARNING.getCode());
response.setMessage("确认数量与原数量差距超过5%,请再次确认。");
return convertJsonString(response);
}
}
}
}
StockDetailInfo goodsDetail = existStock.getGoodsRelated();
// 更新库存
goodsDetail.setRemainNum(confirmRequest.getConfirmNum());

View File

@ -16,96 +16,119 @@ public class GoodsDto {
/**
* 物料编号
*/
@JsonProperty("goodsId")
private String goodsId;
/**
* 物料名称/描述
*/
@JsonProperty("goodsName")
private String goodsName;
/**
* 单位
*/
@JsonProperty("goodsUnit")
private String goodsUnit;
/**
* 物料分类
*/
@JsonProperty("goodsType")
private String goodsType;
/**
* 供应商分类
*/
@JsonProperty("providerType")
private String providerType;
/**
* 重量
*/
@JsonProperty("weight")
private BigDecimal weight;
/**
* 重量单位
*/
@JsonProperty("weightUnit")
private String weightUnit;
/**
* 每盒数量
*/
@JsonProperty("quantityPerBox")
private BigDecimal quantityPerBox;
/**
* 拆包方式
*/
@JsonProperty("unpackingType")
private String unpackingType;
/**
* 载具类型
*/
@JsonProperty("vehicleType")
private String vehicleType;
/**
* 载具类型描述
*/
@JsonProperty("vehicleTypeDescription")
private String vehicleTypeDescription;
/**
* 物料载具类型
*/
@JsonProperty("goodsInVehicleType")
private String goodsInVehicleType;
/**
* 补料方式
* PULL有看板
* PUSH无看板
*/
@JsonProperty("feedingType")
private String feedingType;
/**
* 每个看板包含物料数量
*/
@JsonProperty("quantityPerKanban")
private BigDecimal quantityPerKanban;
/**
* 看板的数量
*/
@JsonProperty("kanbanNum")
private BigDecimal kanbanNum;
/**
* 看板详细信息
*/
@JsonProperty("kanbanList")
private List<KanbanEntity> kanbanList;
/**
* 补货点
*/
@JsonProperty("feedingValue")
private BigDecimal feedingValue;
/**
* 备注1
*/
@JsonProperty("remark1")
private String remark1;
/**
* 备注2
*/
@JsonProperty("remark2")
private String remark2;
/**
* 备注3
*/
@JsonProperty("remark3")
private String remark3;
/**
* 数据来源
*/
@JsonProperty("dataSource")
private String dataSource;
/**
* 最后更新日期
*/
@JsonProperty("lastUpdateTime")
private LocalDateTime lastUpdateTime;
/**
* 最后更新用户
*/
@JsonProperty("lastUpdateUser")
private String lastUpdateUser;
/**
* 热度
@ -117,4 +140,9 @@ public class GoodsDto {
*/
@JsonProperty("releasePoint")
private String releasePoint;
/**
* 盘点指示器
*/
@JsonProperty("indicator")
private Integer indicator;
}

View File

@ -1,6 +1,7 @@
package com.wms.entity.app.request;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms.entity.app.dto.extend.KanbanEntity;
@ -148,6 +149,30 @@ public class GoodsQuery extends PageQuery {
*/
@JsonProperty("releasePoint")
private String releasePoint;
/**
* 盘点管理
* YES
* NO
*/
@JsonProperty("needInventory")
private String needInventory;
/**
* SLED管理
* YES
* NO
*/
@TableField("haveSled")
private String haveSled;
/**
* SLED天数
*/
@TableField("sledDays")
private Integer sledDays;
/**
* 盘点指示器
*/
@JsonProperty("indicator")
private Integer indicator;
/**

View File

@ -29,6 +29,11 @@ public class InventoryRequest {
*/
@JsonProperty("confirmNum")
private BigDecimal confirmNum;
/**
* 盘点次数
*/
@JsonProperty("invIndex")
private Integer invIndex;
/**
* 操作人员
*/

View File

@ -1,5 +1,6 @@
package com.wms.entity.app.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms.entity.app.dto.extend.KanbanEntity;
@ -141,4 +142,28 @@ public class GoodsVo {
*/
@JsonProperty("releasePoint")
private String releasePoint;
/**
* 盘点管理
* YES
* NO
*/
@JsonProperty("needInventory")
private String needInventory;
/**
* SLED管理
* YES
* NO
*/
@TableField("haveSled")
private String haveSled;
/**
* SLED天数
*/
@TableField("sledDays")
private Integer sledDays;
/**
* 盘点指示器
*/
@JsonProperty("indicator")
private Integer indicator;
}

View File

@ -163,4 +163,11 @@ public class Goods {
*/
@TableField("sled_days")
private Integer SledDays;
/**
* 盘点指示器
* 1成本小于2.5$盘点至多1遍
* 3: 成本大于2.5$盘点至多3遍
*/
@TableField("indicator")
private Integer indicator;
}

View File

@ -102,6 +102,7 @@ public class UploadBaseGoodsListener implements ReadListener<BaseGoodsExcelVo> {
tempGoods.setNeedInventory(goodsExcelVo.getNeedInventory());
tempGoods.setHaveSled(goodsExcelVo.getHaveSled());
tempGoods.setSledDays(goodsExcelVo.getSledDays());
tempGoods.setIndicator(goodsExcelVo.getIndicator());
tempGoods.setLastUpdateTime(LocalDateTime.now());
tempGoods.setLastUpdateUser(uploadUser);
goodsList.add(tempGoods);

View File

@ -91,4 +91,9 @@ public class BaseGoodsExcelVo {
*/
@ExcelProperty("补料方式")
private String feedingType;
/**
* 盘点指示器
*/
@ExcelProperty("indicator")
private Integer indicator;
}