Ver código fonte

代码补充

yuansh 1 semana atrás
pai
commit
4be031578a

+ 58 - 2
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java

@@ -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);

+ 38 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurQuotationSelectionController.java

@@ -84,6 +84,8 @@ public class PurQuotationSelectionController {
     private ISysDictService sysDictService;
     @Autowired
     private IPurPaymentRequestService purPaymentRequestService;
+    @Autowired
+    private IPurPurchaseQuotationProductService purPurchaseInquiryProductService;
 
     /**
      * 分页列表查询
@@ -547,6 +549,42 @@ public class PurQuotationSelectionController {
     @GetMapping(value = "/queryPurQuotationSelectionProductByMainId")
     public Result<List<PurQuotationSelectionProduct>> queryPurQuotationSelectionProductListByMainId(@RequestParam(name = "id", required = true) String id) {
         List<PurQuotationSelectionProduct> purQuotationSelectionProductList = purQuotationSelectionProductService.selectByMainId(id);
+
+
+        PurQuotationSelection purQuotationSelection = purQuotationSelectionService.getById(id);
+
+        QueryWrapper<SupplierQuotationDetails> querySupplierQuotationDetails = new QueryWrapper<>();
+//        querySupplierQuotationDetails.eq("status",0);
+        querySupplierQuotationDetails.eq("submit","1");
+        querySupplierQuotationDetails.eq("quotation_Project",purQuotationSelection.getInquiryProject());
+        String source = purQuotationSelection.getSourceId();
+        querySupplierQuotationDetails.in("source_code", Arrays.asList(source.split(",")));
+
+        Page<SupplierQuotationDetails> page2 = new Page<>(-1, -1);
+
+        IPage<SupplierQuotationDetails> pageList = purPurchaseInquiryProductService.supplierQuotationDetails(page2, querySupplierQuotationDetails);
+
+        for(PurQuotationSelectionProduct a:purQuotationSelectionProductList){
+            // String sourceId = a.getSourceId();//询价单子表id
+            String productId = a.getProductId();//产品
+
+            for (SupplierQuotationDetails o : pageList.getRecords()) {
+
+                String productIdo = o.getProductId();
+                //    String sourceId2 = o.getSourceId2()==null||o.getSourceId2()=="" ? "无" : o.getSourceId2();//销售询价单子表主键
+
+                if (productId.equals(productIdo)) {
+                    Map<String,String> mapSupplier = new HashMap<>();
+                    mapSupplier.put("label", o.getSuppilerName());
+                    mapSupplier.put("value", o.getQuotationSuppiler());
+                    a.getSupplierList().add(mapSupplier);
+                }
+
+            }
+
+        }
+
+
         return Result.OK(purQuotationSelectionProductList);
     }
 

+ 6 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurInquiryFormProduct.java

@@ -11,10 +11,13 @@ import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import java.io.UnsupportedEncodingException;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 采购询价单子表 - 产品明细
@@ -191,4 +194,7 @@ public class PurInquiryFormProduct implements Serializable {
     @TableField(exist = false)
     private Integer rowNumber;
 
+    @TableField(exist = false)
+    private List<Map<String,String>> supplierList = new ArrayList<>();
+
 }

+ 9 - 4
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurQuotationSelectionProduct.java

@@ -1,20 +1,22 @@
 package org.jeecg.modules.purCode.entity;
 
 import java.io.Serializable;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.baomidou.mybatisplus.annotation.TableLogic;
+
+import com.baomidou.mybatisplus.annotation.*;
 import org.jeecg.common.constant.ProvinceCityArea;
 import org.jeecg.common.util.SpringContextUtils;
 import lombok.Data;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.ArrayList;
 import java.util.Date;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import java.io.UnsupportedEncodingException;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 采购报价选定子表 - 产品明细
@@ -180,4 +182,7 @@ public class PurQuotationSelectionProduct implements Serializable {
     private java.math.BigDecimal taxAmountOriginal;
     //折扣
     private java.math.BigDecimal discount;
+
+    @TableField(exist = false)
+    private List<Map<String,String>> supplierList = new ArrayList<>();
 }

+ 11 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleInquiryFormController.java

@@ -192,6 +192,17 @@ public class SaleInquiryFormController {
             saleInquiryForm.setBillCode(result.getMessage());
         }
 
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        saleInquiryForm.setSalesman(sysUser.getUsername());
+        saleInquiryForm.setSalesmanName(sysUser.getRealname());
+        saleInquiryForm.setSaleDepartment(sysUser.getOrgCode());
+
+        if (StringUtils.isNotBlank(saleInquiryForm.getSaleDepartmentName())) {
+            SysDepart dept = sysDepartService.queryDeptByCode(sysUser.getOrgCode());
+            if (dept != null) {
+                saleInquiryForm.setSaleDepartmentName(dept.getDepartName());
+            }
+        }
 
         saleInquiryFormService.saveMain(saleInquiryForm, saleInquiryFormPage.getSaleInquiryFormShipList(), saleInquiryFormPage.getSaleInquiryFormProductList());
         return Result.OK("添加成功!");

+ 15 - 1
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleInvoiceController.java

@@ -26,6 +26,7 @@ import com.alibaba.excel.write.metadata.fill.FillWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.DictModel;
 import org.jeecg.common.util.DateUtils;
@@ -564,7 +565,8 @@ public class SaleInvoiceController {
     @ApiOperation(value = "销售发票-通过id查询", notes = "销售发票-通过id查询")
     @GetMapping(value = "/queryBySourceId")
     public Result<Object> queryBySourceId(@RequestParam(name = "id", required = true) String id,
-                                          @RequestParam(name = "type", required = true) String type) {
+                                          @RequestParam(name = "type", required = true) String type,
+                                         String pur) {
 
         SaleInvoice saleInvoice = saleInvoiceService.getById(id);
         if (saleInvoice == null) {
@@ -614,7 +616,19 @@ public class SaleInvoiceController {
             QueryWrapper<PurOrder> queryPurOrder = new QueryWrapper();
             queryPurOrder.likeRight("source_code2", xsCode);
             queryPurOrder.eq("close", "0");
+            if(StringUtils.isNotBlank(pur) && !pur.equals("pur")){
+                queryPurOrder.eq("bill_code", pur);
+            }
             List<PurOrder> cgList = purOrderService.list(queryPurOrder);
+            if(cgList.size() > 1 && StringUtils.isNotBlank(pur) && pur.equals("pur")){
+
+                Result<Object> r = new Result<>();
+                r.setSuccess(true);
+                r.setCode(800);
+                r.setResult(cgList);
+
+                return r;
+            }
             if (cgList.size() > 0) {
 
                 return Result.OK(cgList.get(0));

+ 17 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleQuotationController.java

@@ -50,7 +50,9 @@ import org.jeecg.modules.saleCode.entity.*;
 import org.jeecg.modules.saleCode.service.*;
 import org.jeecg.modules.saleCode.util.EasyExcelUtil;
 import org.jeecg.modules.saleCode.vo.SaleQuotationAlert;
+import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysDictService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.utils.ExcelExportUtils;
@@ -135,6 +137,8 @@ public class SaleQuotationController {
     private ISaleInquiryFormProductService saleInquiryFormProductService;
     @Autowired
     private ISaleInquiryFormService saleInquiryFormService;
+    @Autowired
+    private ISysDepartService sysDepartService;
 
     @Value(value = "${jeecg.path.upload}")
     private String uploadpath;
@@ -271,6 +275,19 @@ public class SaleQuotationController {
         }
 
         saleQuotation.setVersion("1");
+
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        saleQuotation.setSalesman(sysUser.getUsername());
+        saleQuotation.setSalesmanName(sysUser.getRealname());
+        saleQuotation.setSaleDepartment(sysUser.getOrgCode());
+
+        if (StringUtils.isNotBlank(saleQuotation.getSaleDepartmentName())) {
+            SysDepart dept = sysDepartService.queryDeptByCode(sysUser.getOrgCode());
+            if (dept != null) {
+                saleQuotation.setSaleDepartmentName(dept.getDepartName());
+            }
+        }
+
         saleQuotationService.saveMain(saleQuotation, saleQuotationPage.getSaleQuotationShipList(), saleQuotationPage.getSaleQuotationProductList());
         return Result.OK("添加成功!");
     }