|  | @@ -9,10 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.domain.AuditItems;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.mapper.AuditItemsMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.approvalFlow.service.impl.AuditItemsServiceImpl;
 | 
	
		
			
				|  |  | -import com.ruoyi.basicData.domain.TCorps;
 | 
	
		
			
				|  |  | -import com.ruoyi.basicData.domain.TFees;
 | 
	
		
			
				|  |  | -import com.ruoyi.basicData.domain.TGoods;
 | 
	
		
			
				|  |  | -import com.ruoyi.basicData.domain.TWarehouseArea;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.domain.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.basicData.mapper.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.basicData.service.impl.TWarehouseServiceImpl;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.config.RuoYiConfig;
 | 
	
	
		
			
				|  | @@ -33,7 +30,6 @@ import com.ruoyi.quotation.domain.TSeaprice;
 | 
	
		
			
				|  |  |  import com.ruoyi.quotation.mapper.TSeapriceMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 | 
	
		
			
				|  |  |  import com.ruoyi.reportManagement.domain.TWhgenleg;
 | 
	
		
			
				|  |  | -import com.ruoyi.reportManagement.domain.vo.WhgenlegVO;
 | 
	
		
			
				|  |  |  import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 | 
	
		
			
				|  |  |  import com.ruoyi.shipping.domain.*;
 | 
	
		
			
				|  |  |  import com.ruoyi.shipping.excel.DeriveInventoryExcel;
 | 
	
	
		
			
				|  | @@ -7184,15 +7180,25 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |              tWhgenleg.setfWarehouseid(warehousebillsDTO.getWarehouseId());
 | 
	
		
			
				|  |  |              List<TWhgenleg> tWhgenlegs = tWhgenlegMapper.selectTWhgenlegList(tWhgenleg);
 | 
	
		
			
				|  |  |              if (CollectionUtils.isNotEmpty(tWhgenlegs)) {
 | 
	
		
			
				|  |  | -                List<WhgenlegVO> voList = new ArrayList<>();
 | 
	
		
			
				|  |  | -                tWhgenlegs.forEach(vo -> {
 | 
	
		
			
				|  |  | -                    WhgenlegVO whgenlegVO = new WhgenlegVO();
 | 
	
		
			
				|  |  | -                    whgenlegVO.setfMarks(vo.getfMarks());
 | 
	
		
			
				|  |  | -                    whgenlegVO.setfGoodsid(vo.getfGoodsid());
 | 
	
		
			
				|  |  | -                    whgenlegVO.setfBusinessType(vo.getfBusinessType());
 | 
	
		
			
				|  |  | -                    voList.add(whgenlegVO);
 | 
	
		
			
				|  |  | -                });
 | 
	
		
			
				|  |  | -                billsVO.setWhgenlegVOList(voList);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                List<Long> goodsIds = tWhgenlegs.stream().filter(l -> Objects.nonNull(l.getfGoodsid())).map(TWhgenleg::getfGoodsid).distinct()
 | 
	
		
			
				|  |  | +                        .collect(toList());
 | 
	
		
			
				|  |  | +                if (CollectionUtils.isNotEmpty(goodsIds)) {
 | 
	
		
			
				|  |  | +                    List<TGoods> goodsList = tGoodsMapper.selectByIds(goodsIds);
 | 
	
		
			
				|  |  | +                    List<GoodsVO> voList = new ArrayList<>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    goodsList.forEach(vo -> {
 | 
	
		
			
				|  |  | +//                        TGoods goods = goodsList.stream().filter(li -> Objects.equals(vo.getfGoodsid(), li.getfId())).findFirst()
 | 
	
		
			
				|  |  | +//                                .orElseThrow(() -> new WarehouseException("商品信息找不到"));
 | 
	
		
			
				|  |  | +                        GoodsVO goodsVO = new GoodsVO();
 | 
	
		
			
				|  |  | +                        goodsVO.setfId(vo.getfId());
 | 
	
		
			
				|  |  | +                        goodsVO.setfName(vo.getfName());
 | 
	
		
			
				|  |  | +//                        goodsVO.setFMarks(vo.getfMarks());
 | 
	
		
			
				|  |  | +//                        goodsVO.setFBusinessType(vo.getfBusinessType());
 | 
	
		
			
				|  |  | +                        voList.add(goodsVO);
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    billsVO.setGoodsVOList(voList);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  return AjaxResult.success(billsVO);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -7226,7 +7232,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          // 遍历进行入库、出库确认
 | 
	
		
			
				|  |  |          List<TWarehousebillsitems> itemList = warehousebillsDTO.getWarehousebillsitemsList();
 | 
	
		
			
				|  |  |          int line = 1;
 | 
	
		
			
				|  |  | +        Long qty = 0L;
 | 
	
		
			
				|  |  | +        BigDecimal volumn = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +        BigDecimal netweight = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +        BigDecimal grossweight = BigDecimal.ZERO;
 | 
	
		
			
				|  |  |          for (TWarehousebillsitems li : itemList) {
 | 
	
		
			
				|  |  | +            qty +=li.getfQty();
 | 
	
		
			
				|  |  | +            volumn = volumn.add(li.getfVolumn());
 | 
	
		
			
				|  |  | +            netweight = netweight.add(li.getfNetweight());
 | 
	
		
			
				|  |  | +            grossweight = grossweight.add(li.getfGrossweight());
 | 
	
		
			
				|  |  | +            grossweight = grossweight.add(li.getfGrossweight());
 | 
	
		
			
				|  |  |              // 如果业务时间超出当前时间则不允许
 | 
	
		
			
				|  |  |              if (li.getfBsdate().after(new Date())) {
 | 
	
		
			
				|  |  |                  throw new WarehouseException("业务日期不得超出当前日期");
 | 
	
	
		
			
				|  | @@ -7242,6 +7257,16 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |                  line++;
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfPlanqty(qty);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfPlanvolumn(volumn);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfPlannetweight(netweight);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfPlangrossweight(grossweight);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfQty(qty);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfVolumn(volumn);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfNetweight(netweight);
 | 
	
		
			
				|  |  | +        warehousebillsDTO.setfGrossweight(grossweight);
 | 
	
		
			
				|  |  | +        tWarehouseBillsMapper.updateTWarehousebills(warehousebillsDTO);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          return AjaxResult.success();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -7304,7 +7329,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          // 查询总账是否存在
 | 
	
		
			
				|  |  |          TWhgenleg tWhgenle = queryTWhgenleg(warehousebillsDTO, item, goods.getIfCntrno());
 | 
	
		
			
				|  |  | -        if (Objects.nonNull(tWhgenle) && item.getfBsdate().before(warehousebillsDTO.getfChargedate())) {
 | 
	
		
			
				|  |  | +        if (Objects.nonNull(tWhgenle) && item.getfBsdate().before(item.getfChargedate())) {
 | 
	
		
			
				|  |  |              throw new WarehouseException("出库明细第" + line + "行业务日期不得超出库存总帐日期");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (Objects.isNull(tWhgenle)) {
 |