|
|
@ -432,6 +432,81 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 修改保存入库-采购单(仓库入库) |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public int updateStoragePurchaseWarehouseSave(WarehouseStorageOrder warehouseStorageOrder) { |
|
|
|
String loginName = ShiroUtils.getLoginName(); |
|
|
|
|
|
|
|
//假设全部入库
|
|
|
|
warehouseStorageOrder.setWarehouseStorageStatus("4"); |
|
|
|
warehouseStorageOrder.setUpdateBy(loginName); |
|
|
|
warehouseStorageOrder.setUpdateTime(new Date()); |
|
|
|
//记录一下入库时间
|
|
|
|
warehouseStorageOrder.setStorageTime(new Date()); |
|
|
|
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); |
|
|
|
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){ |
|
|
|
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList); |
|
|
|
throw new BusinessException("入库单详情数据为空"); |
|
|
|
} |
|
|
|
|
|
|
|
//入库数
|
|
|
|
Integer storageNum = 0; |
|
|
|
|
|
|
|
// 检查storageNum是否含有null值
|
|
|
|
boolean hasThisStorageNumNull = warehouseStorageOrderDetailList.stream() |
|
|
|
.anyMatch(item -> item.getStorageNum() == null); |
|
|
|
|
|
|
|
if (hasThisStorageNumNull) { |
|
|
|
throw new BusinessException("存在入库数为空,请检查!"); |
|
|
|
} |
|
|
|
// 计算各个字段的总和
|
|
|
|
storageNum = warehouseStorageOrderDetailList.stream() |
|
|
|
.mapToInt(WarehouseStorageOrderDetail::getStorageNum) |
|
|
|
.sum(); |
|
|
|
|
|
|
|
//插入主表入库数量
|
|
|
|
warehouseStorageOrder.setStorageNum(storageNum); |
|
|
|
//更新生产单数据
|
|
|
|
int updateMakeOrderResult = sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder, warehouseStorageOrderDetailList); |
|
|
|
if (updateMakeOrderResult <= 0){ |
|
|
|
throw new BusinessException("更新生产订单失败,未影响任何行"); |
|
|
|
} |
|
|
|
|
|
|
|
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) { |
|
|
|
//更新入库单详情的数据
|
|
|
|
warehouseStorageOrderDetail.setUpdateBy(loginName); |
|
|
|
warehouseStorageOrderDetail.setUpdateTime(new Date()); |
|
|
|
//更新已入库数
|
|
|
|
warehouseStorageOrderDetail.setHasStorageNum(warehouseStorageOrderDetail.getStorageNum()); |
|
|
|
int updateWarehouseStorageOrderDetailResult = storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail); |
|
|
|
if (updateWarehouseStorageOrderDetailResult <= 0){ |
|
|
|
throw new BusinessException("更新仓库入库单详情失败,未影响任何行"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//更新开发修改单数据
|
|
|
|
String relatedOrderCode = warehouseStorageOrder.getRelatedOrderCode(); |
|
|
|
ErpDevelopModifyorder erpDevelopModifyorder = developModifyorderMapper.selectErpDevelopModifyorderByCode(relatedOrderCode); |
|
|
|
if (erpDevelopModifyorder != null){ |
|
|
|
erpDevelopModifyorder.setPurchaseStorageStatus("8"); |
|
|
|
developModifyorderMapper.updateErpDevelopModifyorder(erpDevelopModifyorder); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//更新入库单的数据
|
|
|
|
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder); |
|
|
|
|
|
|
|
if (updateResult <= 0){ |
|
|
|
log.warn("更新入库单失败,未影响任何行"); |
|
|
|
} |
|
|
|
return updateResult; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 通用入库单详情保存接口 |
|
|
|
* */ |
|
|
|