| | |
| | | public List<YwOutinboundRecord> verifyData(YwOutinbound ywOutinbound){ |
| | | if(Objects.isNull(ywOutinbound) |
| | | || Objects.isNull(ywOutinbound.getType()) |
| | | // || (Objects.nonNull(ywOutinbound.getType()) && (!(ywOutinbound.getType() == Constants.ZERO || ywOutinbound.getType() == Constants.ONE))) |
| | | || ((ywOutinbound.getType() >= 5 && ywOutinbound.getType() <= 9 ) && Objects.isNull(ywOutinbound.getOutUserId()) ) |
| | | || Objects.isNull(ywOutinbound.getWarehouseId()) |
| | | || Objects.isNull(ywOutinbound.getDoneDate()) |
| | | || com.github.xiaoymin.knife4j.core.util.CollectionUtils.isEmpty(ywOutinbound.getRecordList()) |
| | |
| | | //出库 |
| | | if(Objects.isNull(ywStock) || ywStock.getStock().compareTo(ywOutinboundRecord.getStock()) < Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), ywMaterial.getName() + "库存不足,请刷新重试"); |
| | | }else if(ywStock.getStock().compareTo(ywOutinboundRecord.getStock()) == Constants.ZERO){ |
| | | }/*else if(ywStock.getStock().compareTo(ywOutinboundRecord.getStock()) == Constants.ZERO){ |
| | | ywStockMapper.deleteById(ywStock.getId()); |
| | | }else{ |
| | | }*/else{ |
| | | ywStockMapper.update(new UpdateWrapper<YwStock>().lambda() |
| | | .setSql(" stock = ( stock - "+ywOutinboundRecord.getStock()+") ") |
| | | .set(YwStock::getEditDate, DateUtil.getCurrDateTime()) |
| | |
| | | } |
| | | List<Integer> typeList = Constants.ywOutInType.getAllTypeKey(model.getInOut()); |
| | | queryWrapper.selectAll(YwOutinbound.class) |
| | | .selectAs(SystemUser::getRealname,YwOutinbound::getCreateUserName) |
| | | .select(" s1.realname ",YwOutinbound::getCreateUserName) |
| | | .select(" s2.realname ",YwOutinbound::getOutUserName) |
| | | .selectAs(YwWarehouse::getName,YwOutinbound::getWarehouseName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwOutinbound::getCreator) |
| | | .leftJoin(YwWarehouse.class,YwWarehouse::getId,YwOutinbound::getWarehouseId) |
| | | .leftJoin("system_user s1 on t.creator = s1.id") |
| | | .leftJoin("system_user s2 on t.out_user_id = s2.id") |
| | | .like(StringUtils.isNotBlank(model.getCode()),YwOutinbound::getCode,model.getCode()) |
| | | .eq(Objects.nonNull(model.getType()),YwOutinbound::getType,model.getType()) |
| | | .eq(Objects.nonNull(model.getWarehouseId()),YwOutinbound::getWarehouseId,model.getWarehouseId()) |
| | | .in(Objects.nonNull(model.getInOut()),YwOutinbound::getType,typeList) |
| | | ; |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(pageWrap.getSorts())){ |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | }else{ |
| | | queryWrapper.orderByDesc(YwOutinbound::getCode); |
| | | } |
| | | |
| | | IPage iPage = ywOutinboundMapper.selectJoinPage(page,YwOutinbound.class,queryWrapper); |
| | | if(Objects.nonNull(iPage.getRecords())){ |
| | | iPage.setRecords(this.getDetailData(iPage.getRecords())); |