Commit 41b9c058 by 李小惠

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-lxh

# Conflicts:
#	jyzb-api/src/main/java/com/junmp/jyzb/api/exception/enums/InventoryExceptionEnum.java
parents 2bc058cc d0f6d648
......@@ -7,16 +7,17 @@ import lombok.Getter;
@Getter
public enum InventoryExceptionEnum implements IExceptionEnum {
INVENTORY_NOT_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"装备信息不存在"),
INVENTORY_NOT_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"装备信息不存),
INVENTORY_BEYOND_STOCK(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"填写的报废的装备数量大于实际能进行报废的数量"),
BROKENNUM_BEYOND_STOCK(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"审核中的数量已存在最大可报废数量,现提交失败"),
ORDER_NOT_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"盘点单据不存在"),
ORDER_NOT_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"盘点单据不存),
ORDER_Child_NOT_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"盘点子单据不存在"),
ORDER_HAS_START(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"单据已经开始,请勿重复操作"),
RUNNINGORDER_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"已存在盘点单据"),
RUNNINGORDER_EXIST(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"已存在盘点单),
ORDER_CLOSED(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"单据已结算,无法重复操作"),
INVERTORY_IS_NULL(CommonConstant.DEFAULT_USER_ERROR_CODE,"导入的装备为空"),
ACCOUNT_ERROR(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"人工新增物资未编辑,请先编辑物资信息"),
/**
* 装备不存
* 装备不存
*/
EQUIPMENT_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "{}")
;
......
......@@ -45,6 +45,8 @@ public class BussinessDetail implements Serializable {
@TableField(value = "type_name")
private String typeName;
@TableField(value = "has_count")
private Integer hasCount;
/**
* 单据编号
*/
......
......@@ -304,6 +304,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
rules=rules+"类别及号型盘点:"+sizes;
}
else
{
rules=rules+"整库盘点";
}
BIDto.setRules(rules);
List<EquipmentListDto> eqList = new ArrayList<>();
Integer totalNumber = 0;
......@@ -490,6 +494,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
public Boolean UploadStock(UploadInventoryReq req) {
//更新之前先把库存表的epc备份
BussinessInventory BI= this.getById(req.getOrderId());
if (BI==null)
{
throw new ServiceException(InventoryExceptionEnum.ORDER_NOT_EXIST);
}
if (BI.getInventoryState().equals("close"))
{
throw new ServiceException(InventoryExceptionEnum.ORDER_CLOSED);
......@@ -520,13 +528,22 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BussinessDetail eqDto = new BussinessDetail();
BeanPlusUtil.copyProperties(detail, eqDto);
eqDto.setNum(Integer.valueOf(priceEq.getNum()));
eqDto.setFixNumber(Integer.valueOf(priceEq.getNum()));
eqDto.setPrice(priceEq.getPrice());
eqDto.setFixPrice(detail.getFixPrice());
eqDto.setFixPrice(priceEq.getStockPrice());
eqDto.setStockPrice(priceEq.getStockPrice());
eqDto.setAccountNum(String.valueOf(priceEq.getAccountNumber()));
eqDto.setInventoryId(Long.valueOf(req.getOrderId()));
eqDto.setUpdateTime(DateTimeUtil.getCurrentDateTime());
eqDto.setCreateTime(DateTimeUtil.getCurrentDateTime());
if (String.valueOf(priceEq.getAccountNumber()).equals("0"))
{
eqDto.setHasCount(1);
}
else
{
eqDto.setHasCount(0);
}
Bussinessdetails.add(eqDto);
}
......@@ -552,6 +569,10 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BussinessDetail bd= bussinessInventoryDetailService.getById(req.getDetailId());
if (bd==null)
{
throw new ServiceException(InventoryExceptionEnum.ORDER_Child_NOT_EXIST);
}
List<BussinessInventoryChildrenDetail> ChildrenDetail = bussinessInventoryChildrenDetailService.list(
new LambdaQueryWrapper<BussinessInventoryChildrenDetail>().eq(BussinessInventoryChildrenDetail::getInvDetailId, req.getDetailId())
);
......@@ -566,11 +587,16 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BeanPlusUtil.copyProperties(eqInfo,Bcd);
Bcd.setInvDetailId(req.getDetailId());
Bcd.setPrice(bd.getPrice());
Bcd.setTotalPrice(bd.getStockPrice());
Integer num= Integer.valueOf(bd.getAccountNum());
// 计算总价并设置
BigDecimal totalPrice = bd.getPrice().multiply(BigDecimal.valueOf(num));
Bcd.setTotalPrice(totalPrice);
Bcd.setUpdateTime(DateTimeUtil.getCurrentDateTime());
Bcd.setCreateTime(DateTimeUtil.getCurrentDateTime());
AddChildrenDetail.add(Bcd);
}
bd.setHasCount(1);
bussinessInventoryDetailService.updateById(bd);
return bussinessInventoryChildrenDetailService.saveBatch(AddChildrenDetail);
......@@ -595,7 +621,13 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
List<BussinessDetail> bussinessDetail = bussinessInventoryDetailService.list(
new LambdaQueryWrapper<BussinessDetail>().eq(BussinessDetail::getInventoryId, req.getOrderId())
);
long countZeroOrNull = bussinessDetail.stream()
.filter(p -> p.getHasCount() == null || p.getHasCount() == 0)
.count();
if (countZeroOrNull>0)
{
throw new ServiceException(InventoryExceptionEnum.ACCOUNT_ERROR);
}
InventorySumReq sumreq=new InventorySumReq();
sumreq.setLocationType("0");
sumreq.setLocationId(BI.getWarehouseId());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论