Pārlūkot izejas kodu

销售订单 列表修改

yzc 1 gadu atpakaļ
vecāks
revīzija
3d9e7610d4

+ 199 - 194
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractVo.java

@@ -22,200 +22,205 @@ import java.util.List;
 @Setter
 public class ContractVo extends Contract {
 
-	/**
-	 * 交接单附件信息
-	 */
-	List<FileInfoVo> fileInfoVos;
-	/**
-	 * 交接单附件信息
-	 */
-	List<FileInfoVo> packageFileInfoVOList;
-	List<ContractProductVo> contractProductList;
-	List<EhsdPurchase> purchaseList;
-	List<ContractProject> contractProjectList;
-	List<ContractShipment> contractShipmentList;
-	/**
-	 * 历史毛利信息
-	 */
-	List<ContractBudgetVo.GrossProfitInfo> grossProfitInfoList;
-	/**
-	 * 买方名称
-	 */
-	private String buyCorporationName;
-	/**
-	 * 卖方名称
-	 */
-	private String sellCorporationName;
-	/**
-	 * 买方国家名称
-	 */
-	private String buyCountryName;
-	/**
-	 * 卖方国家名称
-	 */
-	private String sellCountryName;
-	/**
-	 * 买方省名称
-	 */
-	private String buyProvinceName;
-	/**
-	 * 卖方省名称
-	 */
-	private String sellProvinceName;
-	/**
-	 * 买方市名称
-	 */
-	private String buyCityName;
-	/**
-	 * 卖方市名称
-	 */
-	private String sellCityName;
-	/**
-	 * 时间
-	 */
-	private String time;
-	/**
-	 * 合同产品数量
-	 */
-	private BigDecimal cpQuantity;
-	/**
-	 * 已包装数量
-	 */
-	private BigDecimal sumPackQuantity;
-	/**
-	 * 总额
-	 */
-	private BigDecimal sumAmount;
-	/**
-	 * 合同产品ID
-	 */
-	private Long contractProductId;
-	/**
-	 * 合同个数
-	 */
-	private Long contractCount;
-	/**
-	 * 总到账认领金额
-	 */
-	private BigDecimal sumClaimMoney;
-	/**
-	 * 客户标签(存在多个用逗号隔开)
-	 */
-	private String tag;
-	/**
-	 * 客户名称
-	 */
-	private String customerName;
-	/**
-	 * 金额CNY
-	 */
-	private BigDecimal amountCNY;
-	/**
-	 * 新到款状态
-	 */
-	private String refundStatusNew;
-	private BigDecimal refundMoney;
-	/**
-	 * 合同类型字典值
-	 */
-	private String contractTypeVal;
-
-	/**
-	 * 数据来源 类型 1合同 2ehsd样品单
-	 */
-	private Integer dataType;
-
-	/**
-	 * 合同模板名称
-	 */
-	private String contractTemplateName;
-
-	/**
-	 * 收款账号
-	 */
-	private String shroffAccountName;
-
-	/**
-	 * 定金
-	 */
-	private BigDecimal earnest;
-
-	/**
-	 * 尾款
-	 */
-	private BigDecimal finalPayment;
-
-	/**
-	 * 到账时间
-	 */
-	private Date claimTime;
-
-	/**
-	 * 包装条数
-	 */
-	private Integer packCount;
-
-	/**
-	 * 采购条数
-	 */
-	private Integer purchaseCount;
-
-	/**
-	 * 跟单条数
-	 */
-	private Integer documentaryCount;
-
-	/**
-	 * 订单状态
-	 */
-	private Integer orderStatus;
-
-	/**
-	 * 业务员名称
-	 */
-	private String salesmanName;
-
-	/**
-	 * 合同到账金额(根据合同币种)
-	 */
-	private BigDecimal sumContractClaimMoney;
-
-	/**
-	 * 合同未到账金额(未结清金额)(根据合同币种)
-	 */
-	private BigDecimal sumContractNotClaimMoney;
-	/**
-	 * 生产公司名称
-	 */
-	private String companyName;
-	/**
-	 * 销售部门名称
-	 */
-	private String deptName;
-	/**
-	 * 生产状态
-	 */
-	private Integer produceStatus;
-	/**
-	 * 待入库数量
-	 */
-	private BigDecimal waitStockQuantity;
-
-	/**
-	 * 跟单员名称
-	 */
-	private String merchUserName;
-
-	private String ofCompanyName;
-	private String createUserName;
-	/**
-	 * 已入库数量
-	 */
-	private BigDecimal receiptStockQuantity;
-
-	public BigDecimal getRefundMoney() {
-		return sumClaimMoney;
-	}
+    /**
+     * 交接单附件信息
+     */
+    List<FileInfoVo> fileInfoVos;
+    /**
+     * 交接单附件信息
+     */
+    List<FileInfoVo> packageFileInfoVOList;
+    List<ContractProductVo> contractProductList;
+    List<EhsdPurchase> purchaseList;
+    List<ContractProject> contractProjectList;
+    List<ContractShipment> contractShipmentList;
+    /**
+     * 历史毛利信息
+     */
+    List<ContractBudgetVo.GrossProfitInfo> grossProfitInfoList;
+    /**
+     * 买方名称
+     */
+    private String buyCorporationName;
+    /**
+     * 卖方名称
+     */
+    private String sellCorporationName;
+    /**
+     * 买方国家名称
+     */
+    private String buyCountryName;
+    /**
+     * 卖方国家名称
+     */
+    private String sellCountryName;
+    /**
+     * 买方省名称
+     */
+    private String buyProvinceName;
+    /**
+     * 卖方省名称
+     */
+    private String sellProvinceName;
+    /**
+     * 买方市名称
+     */
+    private String buyCityName;
+    /**
+     * 卖方市名称
+     */
+    private String sellCityName;
+    /**
+     * 时间
+     */
+    private String time;
+    /**
+     * 合同产品数量
+     */
+    private BigDecimal cpQuantity;
+    /**
+     * 已包装数量
+     */
+    private BigDecimal sumPackQuantity;
+    /**
+     * 总额
+     */
+    private BigDecimal sumAmount;
+    /**
+     * 合同产品ID
+     */
+    private Long contractProductId;
+    /**
+     * 合同个数
+     */
+    private Long contractCount;
+    /**
+     * 总到账认领金额
+     */
+    private BigDecimal sumClaimMoney;
+    /**
+     * 客户标签(存在多个用逗号隔开)
+     */
+    private String tag;
+    /**
+     * 客户名称
+     */
+    private String customerName;
+    /**
+     * 金额CNY
+     */
+    private BigDecimal amountCNY;
+    /**
+     * 新到款状态
+     */
+    private String refundStatusNew;
+    private BigDecimal refundMoney;
+    /**
+     * 合同类型字典值
+     */
+    private String contractTypeVal;
+
+    /**
+     * 数据来源 类型 1合同 2ehsd样品单
+     */
+    private Integer dataType;
+
+    /**
+     * 合同模板名称
+     */
+    private String contractTemplateName;
+
+    /**
+     * 收款账号
+     */
+    private String shroffAccountName;
+
+    /**
+     * 定金
+     */
+    private BigDecimal earnest;
+
+    /**
+     * 尾款
+     */
+    private BigDecimal finalPayment;
+
+    /**
+     * 到账时间
+     */
+    private Date claimTime;
+
+    /**
+     * 包装条数
+     */
+    private Integer packCount;
+
+    /**
+     * 采购条数
+     */
+    private Integer purchaseCount;
+
+    /**
+     * 跟单条数
+     */
+    private Integer documentaryCount;
+
+    /**
+     * 订单状态
+     */
+    private Integer orderStatus;
+
+    /**
+     * 业务员名称
+     */
+    private String salesmanName;
+
+    /**
+     * 合同到账金额(根据合同币种)
+     */
+    private BigDecimal sumContractClaimMoney;
+
+    /**
+     * 合同未到账金额(未结清金额)(根据合同币种)
+     */
+    private BigDecimal sumContractNotClaimMoney;
+    /**
+     * 生产公司名称
+     */
+    private String companyName;
+    /**
+     * 销售部门名称
+     */
+    private String deptName;
+    /**
+     * 生产状态
+     */
+    private Integer produceStatus;
+    /**
+     * 待入库数量
+     */
+    private BigDecimal waitStockQuantity;
+
+    /**
+     * 跟单员名称
+     */
+    private String merchUserName;
+
+    private String ofCompanyName;
+    private String createUserName;
+    /**
+     * 已入库数量
+     */
+    private BigDecimal receiptStockQuantity;
+
+    /**
+     * 已结算金额
+     */
+    private BigDecimal settledAmount;
+    /**
+     * 未结算金额
+     */
+    private BigDecimal unsettledAmount;
 
 }
 

+ 9 - 2
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -11,7 +11,8 @@
                          WHEN t1.sumClaimMoney = 0 THEN
                              0
                          ELSE 10
-                         END                                   AS refundStatusNew
+                         END                                   AS refundStatusNew,
+                     (t1.amount - t1.settledAmount)            as unsettledAmount
               FROM (SELECT t1.*,
                            c.name                            customerName,
                            us.nick_name                      salesmanName,
@@ -21,7 +22,13 @@
                             WHERE cc.contract_id = t1.id) AS sumClaimMoney,
                            po.produce_status,
                            IFNULL(t3.quantity, 0)         AS waitStockQuantity,
-                           IFNULL(t3.receipt_quantity, 0) AS receiptStockQuantity
+                           IFNULL(t3.receipt_quantity, 0) AS receiptStockQuantity,
+                           IFNULL(
+                                   (SELECT sum(pod.finish_quantity * cp.price)
+                                    FROM contract_product cp
+                                             JOIN production_order_detail pod ON pod.contract_detail_id = cp.id
+                                    WHERE cp.contract_id = t1.id)
+                               , 0)                       AS settledAmount
                     FROM contract t1
                              left join customer c on t1.buy_corporation_id = c.id
                              left join sys_user us on c.user_id = us.user_id