|  | @@ -35,7 +35,11 @@ import org.jeecg.modules.cuspCode.service.ICuspSupplierProfileService;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.purCode.entity.*;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.purCode.service.*;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.purCode.vo.SupplierQuotationDetails;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.saleCode.entity.SaleInquiryForm;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.saleCode.entity.SaleInquiryFormProduct;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.saleCode.entity.SaleQuotationProduct;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.saleCode.service.ISaleInquiryFormProductService;
 | 
	
		
			
				|  |  | +import org.jeecg.modules.saleCode.service.ISaleInquiryFormService;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.saleCode.vo.SaleInquiryFormAlert;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.system.entity.SysUser;
 | 
	
		
			
				|  |  |  import org.jeecg.modules.system.service.ISysDictService;
 | 
	
	
		
			
				|  | @@ -110,6 +114,10 @@ public class PurInquiryFormController {
 | 
	
		
			
				|  |  |      private IPurPurchaseQuotationService purPurchaseQuotationService;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ISysDictService sysDictService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ISaleInquiryFormProductService saleInquiryFormProductService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ISaleInquiryFormService saleInquiryFormService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Value(value = "${jeecg.path.upload}")
 | 
	
		
			
				|  |  |      private String uploadpath;
 | 
	
	
		
			
				|  | @@ -244,7 +252,7 @@ public class PurInquiryFormController {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  | -     * 报价选定,通过项目查询船明细
 | 
	
		
			
				|  |  | +     * 报价选定,通过项目查询明细
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @GetMapping(value = "/getPurInquiryFormByProject")
 | 
	
		
			
				|  |  |      public PurInquiryFormPage getShipByProject(@RequestParam(name = "projectId", required = true) String projectId, HttpServletRequest req) {
 | 
	
	
		
			
				|  | @@ -295,6 +303,48 @@ public class PurInquiryFormController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            QueryWrapper<SaleInquiryForm> queryWrapper1 = new QueryWrapper();
 | 
	
		
			
				|  |  | +            queryWrapper1.eq("bill_code", list.get(0).getSourceCode());
 | 
	
		
			
				|  |  | +            queryWrapper1.eq("del_flag", "0");
 | 
	
		
			
				|  |  | +            queryWrapper1.orderByAsc("create_time");
 | 
	
		
			
				|  |  | +            List<SaleInquiryForm> list2 = saleInquiryFormService.list(queryWrapper1);
 | 
	
		
			
				|  |  | +            if(list2.size() > 0){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                List<SaleInquiryFormProduct> saleInquiryFormProductList = saleInquiryFormProductService.selectByMainId(list2.get(0).getId());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                // 创建映射关系:id(字符串) -> 在saleInquiryFormProductList中的索引位置
 | 
	
		
			
				|  |  | +                Map<String, Integer> saleProductIndexMap = new HashMap<>();
 | 
	
		
			
				|  |  | +                for (int i = 0; i < saleInquiryFormProductList.size(); i++) {
 | 
	
		
			
				|  |  | +                    SaleInquiryFormProduct saleProduct = saleInquiryFormProductList.get(i);
 | 
	
		
			
				|  |  | +                    saleProductIndexMap.put(saleProduct.getId(), i);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                // 对purInquiryFormProductList进行排序
 | 
	
		
			
				|  |  | +                purInquiryFormProductList.sort((p1, p2) -> {
 | 
	
		
			
				|  |  | +                    String sourceId1 = p1.getSourceId();
 | 
	
		
			
				|  |  | +                    String sourceId2 = p2.getSourceId();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    Integer index1 = saleProductIndexMap.get(sourceId1);
 | 
	
		
			
				|  |  | +                    Integer index2 = saleProductIndexMap.get(sourceId2);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    // 处理sourceId在sale列表中没有对应项的情况
 | 
	
		
			
				|  |  | +                    if (index1 == null && index2 == null) {
 | 
	
		
			
				|  |  | +                        // 如果两个都不存在,可以按其他规则排序,比如按createTime,这里保持原顺序
 | 
	
		
			
				|  |  | +                        return 0;
 | 
	
		
			
				|  |  | +                    } else if (index1 == null) {
 | 
	
		
			
				|  |  | +                        return 1; // p1不存在,排到后面
 | 
	
		
			
				|  |  | +                    } else if (index2 == null) {
 | 
	
		
			
				|  |  | +                        return -1; // p2不存在,排到后面
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                    // 按照saleInquiryFormProductList中的顺序排序
 | 
	
		
			
				|  |  | +                    return index1.compareTo(index2);
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              List<PurInquiryFormShip> purInquiryFormShipList = purInquiryFormShipService.selectByMainId(list.get(0).getId());
 | 
	
		
			
				|  |  |  //
 | 
	
		
			
				|  |  |              SupplierQuotationDetails saleInquiryForm = new SupplierQuotationDetails();
 | 
	
	
		
			
				|  | @@ -358,6 +408,11 @@ public class PurInquiryFormController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |                      if (productId.equals(productIdo) && (sourceId.equals(sourceId2) || sourceId2.equals("无"))) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +                        Map<String,String> mapSupplier = new HashMap<>();
 | 
	
		
			
				|  |  | +                        mapSupplier.put("label", o.getSuppilerName());
 | 
	
		
			
				|  |  | +                        mapSupplier.put("value", o.getQuotationSuppiler());
 | 
	
		
			
				|  |  | +                        a.getSupplierList().add(mapSupplier);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                          BigDecimal getTaxPriceUsd = o.getTaxPriceUsd();
 | 
	
		
			
				|  |  |                          if (taxPriceUsd != null && taxPriceUsd.compareTo(getTaxPriceUsd) < 0) {
 | 
	
		
			
				|  |  |                              continue;
 | 
	
	
		
			
				|  | @@ -397,7 +452,8 @@ public class PurInquiryFormController {
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -//
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              page.setPurInquiryFormProductList(purInquiryFormProductList);
 | 
	
		
			
				|  |  |              page.setPurInquiryFormShipList(purInquiryFormShipList);
 |