|  | @@ -24,13 +24,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang.StringUtils;
 | 
	
		
			
				|  |  |  import org.jeecg.common.aspect.annotation.PermissionData;
 | 
	
		
			
				|  |  |  import org.jeecg.common.util.DateUtils;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.baseCode.entity.BaseProductArchive;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.baseCode.entity.BaseProductClass;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.baseCode.entity.BaseShipArchive;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.baseCode.entity.BaseTemplates;
 | 
	
		
			
				|  |  | -import org.jeecg.modules.baseCode.service.IBaseProductClassService;
 | 
	
		
			
				|  |  | -import org.jeecg.modules.baseCode.service.IBaseShipArchiveService;
 | 
	
		
			
				|  |  | -import org.jeecg.modules.baseCode.service.IBaseTemplatesService;
 | 
	
		
			
				|  |  | -import org.jeecg.modules.baseCode.service.ISerialPatternService;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.baseCode.service.*;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.cuspCode.entity.CuspCustomerProfile;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.cuspCode.service.ICuspCustomerProfileService;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.purCode.entity.PurCommissionRequest;
 | 
	
	
		
			
				|  | @@ -114,6 +112,8 @@ public class SaleOrderController {
 | 
	
		
			
				|  |  |      private ICuspCustomerProfileService cuspCustomerProfileService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private IBaseShipArchiveService baseShipArchiveService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private IBaseProductArchiveService baseProductArchiveService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value(value = "${jeecg.path.upload}")
 | 
	
		
			
				|  |  |      private String uploadpath;
 | 
	
	
		
			
				|  | @@ -907,11 +907,32 @@ public class SaleOrderController {
 | 
	
		
			
				|  |  |                          saleOrder.setEmail(classEnt.getEmail());
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                // 获取计产品档案
 | 
	
		
			
				|  |  | +                List<BaseProductArchive> productArchiveList = new ArrayList<>();
 | 
	
		
			
				|  |  | +                if (oConvertUtils.listIsNotEmpty(productList)){
 | 
	
		
			
				|  |  | +                    LambdaQueryWrapper<BaseProductArchive> productWrapper = new LambdaQueryWrapper<>();
 | 
	
		
			
				|  |  | +                    productWrapper.in(BaseProductArchive::getId, productList.stream().map(SaleOrderProduct::getProductId).collect(Collectors.toList()));
 | 
	
		
			
				|  |  | +                    productArchiveList = baseProductArchiveService.list(productWrapper);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                // 产品设置
 | 
	
		
			
				|  |  | +                int rowNum = 1;
 | 
	
		
			
				|  |  |                  BigDecimal orderMoney = BigDecimal.ZERO;
 | 
	
		
			
				|  |  |                  for(SaleOrderProduct o:productList){
 | 
	
		
			
				|  |  |                      BigDecimal amount = o.getTaxAmount() == null ? BigDecimal.ZERO: o.getTaxAmount();
 | 
	
		
			
				|  |  |                      orderMoney = orderMoney.add(amount);
 | 
	
		
			
				|  |  | +                    o.setRowNumber(rowNum++);
 | 
	
		
			
				|  |  | +                    if (o.getDeliveryTime() != null){
 | 
	
		
			
				|  |  | +                        o.setDeliverDateText(DateUtils.date2Str(o.getDeliveryTime(), DateUtils.date_sdf.get()));
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    if (oConvertUtils.isNotEmpty(o.getDiscount())){
 | 
	
		
			
				|  |  | +                        o.setDiscountText(o.getDiscount().intValue()+"%");
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    BaseProductArchive findProduct = productArchiveList.stream().filter(e->e.getId().equals(o.getProductId())).findFirst().orElse(null);
 | 
	
		
			
				|  |  | +                    if (findProduct != null){
 | 
	
		
			
				|  |  | +                        o.setUnit(findProduct.getMeasurementUnit());
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                orderMoney = orderMoney.setScale(2);
 | 
	
		
			
				|  |  |                  saleOrder.setOrderMoney(orderMoney);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                  String shipname = "";
 | 
	
	
		
			
				|  | @@ -938,11 +959,11 @@ public class SaleOrderController {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  //
 | 
	
		
			
				|  |  |                  saleOrder.setBillDateText(DateUtils.date2Str(saleOrder.getBillDate(), DateUtils.date_sdf.get()));
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                int rowNum = 1;
 | 
	
		
			
				|  |  | -                for (SaleOrderProduct product : productList){
 | 
	
		
			
				|  |  | -                    product.setRowNumber(rowNum++);
 | 
	
		
			
				|  |  | +                if (oConvertUtils.isNotEmpty(saleOrder.getDoubleDiscount())){
 | 
	
		
			
				|  |  | +                    saleOrder.setDiscountText(saleOrder.getDoubleDiscount().intValue()+"%");
 | 
	
		
			
				|  |  | +                    saleOrder.setDiscountMoney(orderMoney.subtract(new BigDecimal(saleOrder.getConvertedAmount())).setScale(2));
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  // 制单人信息
 | 
	
		
			
				|  |  |                  SysUser sysUser = sysUserService.getUserByName(saleOrder.getCreateBy());
 | 
	
		
			
				|  |  |                  saleOrder.setSalesPhone(sysUser.getPhone());
 |