Browse Source

天合修复bug

master
songguoqiang 7 months ago
parent
commit
f856e6a1ae
  1. 1
      win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/ErrorCodeConstants.java
  2. 1
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemBaseVO.java
  3. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java
  4. 20
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java
  5. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java
  6. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java

1
win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/ErrorCodeConstants.java

@ -116,6 +116,7 @@ public interface ErrorCodeConstants {
ErrorCode MAINTAIN_BACK_NOT_EXISTS = new ErrorCode(1_000_020_042, "设备保养变更记录不存在");
ErrorCode LOCATION_CAN_NOT_DELETE = new ErrorCode(1_000_020_043, "该库区已经存在于其他库位,不允许删除");
ErrorCode LOCATION_CAN_NOT_REPLACE = new ErrorCode(1_000_020_043, "该备件编号已存在于其他库位中!");
ErrorCode ITEM_REPLACE = new ErrorCode(1_000_020_043, "该备件编号已存在");
ErrorCode DEVICE_NO_EXISTS = new ErrorCode(1_000_020_044, "该设备不存在");
ErrorCode DEVICE_TYPE_NO_NORMAL = new ErrorCode(1_000_020_045, "该设备与类型不符");

1
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemBaseVO.java

@ -43,6 +43,7 @@ public class ItemBaseVO {
private Integer procurementCycle;
@Schema(description = "ABC分类")
@NotNull(message = "ABC分类不能为空")
private String classification;
@Schema(description = "使用地点")

2
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java

@ -114,7 +114,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
}
}
if (inQty.compareTo(BigDecimal.ZERO) == 0) {//账内库存不存在
if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(subtractOutQty) >= 0) {//新到货存在且足够差额
if (newQty.compareTo(BigDecimal.ZERO) > 0 && newQty.compareTo(subtractOutQty) >= 0) {//新到货存在且足够差额
BigDecimal subtractNewQty = newQty.subtract(subtractOutQty);//减去之后的数量
newLocation.setQty(subtractNewQty);
result = this.updateById(newLocation);

20
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java

@ -14,6 +14,7 @@ import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import com.win.module.eam.dal.dataobject.itemorder.ItemOrderDetailDO;
import com.win.module.eam.dal.dataobject.itemorder.ItemOrderMainDO;
import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO;
import com.win.module.eam.dal.mysql.item.ItemMapper;
import com.win.module.eam.dal.mysql.itemaccounts.ItemAccountsMapper;
import com.win.module.eam.dal.mysql.itemorder.ItemOrderDetailMapper;
@ -67,8 +68,15 @@ public class ItemServiceImpl implements ItemService {
public Long createItem(ItemCreateReqVO createReqVO) {
// 插入
ItemDO item = ItemConvert.INSTANCE.convert(createReqVO);
String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode());
item.setNumber(number);
//String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode());
//item.setNumber(number);
QueryWrapper<ItemDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", createReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0);
List<ItemDO> itemDOS = itemMapper.selectList(objectQueryWrapper);
if (itemDOS.size() > 0) {
throw exception(ITEM_REPLACE);
}
item.setCreateTime(LocalDateTime.now());
//是否全局,备件没匹配设备时,默认是全局的
itemMapper.insert(item);
@ -80,6 +88,14 @@ public class ItemServiceImpl implements ItemService {
public Integer updateItem(ItemUpdateReqVO updateReqVO) {
// 校验存在
validateItemExists(updateReqVO.getId());
QueryWrapper<ItemDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", updateReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0);
objectQueryWrapper.ne("id", updateReqVO.getId());
List<ItemDO> itemDOS = itemMapper.selectList(objectQueryWrapper);
if (itemDOS.size() > 0) {
throw exception(ITEM_REPLACE);
}
// 更新
ItemDO updateObj = ItemConvert.INSTANCE.convert(updateReqVO);
return itemMapper.updateById(updateObj);

10
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java

@ -56,7 +56,7 @@ public class LocationServiceImpl implements LocationService {
// 插入
LocationDO location = LocationConvert.INSTANCE.convert(createReqVO);
QueryWrapper<LocationDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", createReqVO.getNumber());
objectQueryWrapper.eq("number", createReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0);
List<LocationDO> locationDOList = locationMapper.selectList(objectQueryWrapper);
if (locationDOList.size() > 0) {
@ -73,6 +73,14 @@ public class LocationServiceImpl implements LocationService {
// 校验存在
validateLocationExists(updateReqVO.getId());
// 更新
QueryWrapper<LocationDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", updateReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0);
objectQueryWrapper.ne("id", updateReqVO.getId());
List<LocationDO> locationDOList = locationMapper.selectList(objectQueryWrapper);
if (locationDOList.size() > 0) {
throw ServiceExceptionUtil.exception(LOCATION_HAVE_EXISTS);
}
LocationDO updateObj = LocationConvert.INSTANCE.convert(updateReqVO);
return locationMapper.updateById(updateObj);
}

10
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java

@ -50,7 +50,7 @@ public class LocationAreaServiceImpl implements LocationAreaService {
// 插入
LocationAreaDO locationArea = LocationAreaConvert.INSTANCE.convert(createReqVO);
QueryWrapper<LocationAreaDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", createReqVO.getNumber());
objectQueryWrapper.eq("number", createReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0);
List<LocationAreaDO> locationAreaList = locationAreaMapper.selectList(objectQueryWrapper);
if (locationAreaList.size() > 0) {
@ -67,6 +67,14 @@ public class LocationAreaServiceImpl implements LocationAreaService {
// 校验存在
//validateLocationAreaExists(updateReqVO.getId());
// 更新
QueryWrapper<LocationAreaDO> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("number", updateReqVO.getNumber().trim());
objectQueryWrapper.eq("deleted", 0);
objectQueryWrapper.ne("id", updateReqVO.getId());
List<LocationAreaDO> locationAreaList = locationAreaMapper.selectList(objectQueryWrapper);
if (locationAreaList.size() > 0) {
throw exception(LOCATION_AREA_HAVE_EXISTS);
}
LocationAreaDO updateObj = LocationAreaConvert.INSTANCE.convert(updateReqVO);
return locationAreaMapper.updateById(updateObj);
}

Loading…
Cancel
Save