Commit df926fa15e0a42f50c869a37ebe751795e62bf42

Authored by 房远帅
1 parent 422ee31d

统计报表:订单明细

@@ -282,7 +282,10 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -282,7 +282,10 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
282 private void createOrderDetailReport(String businessId) { 282 private void createOrderDetailReport(String businessId) {
283 PurchaseOrderInfo purchaseOrderInfo = this.findById(businessId); 283 PurchaseOrderInfo purchaseOrderInfo = this.findById(businessId);
284 ContractDistributorStandard standard = contractDistributorStandardService.findById(purchaseOrderInfo.getContractId()); 284 ContractDistributorStandard standard = contractDistributorStandardService.findById(purchaseOrderInfo.getContractId());
285 - CustomerCredit customerCredit = customerCreditService.findById(purchaseOrderInfo.getCustomerCreditId()); 285 + CustomerCredit customerCredit = null;
  286 + if (StringUtils.isNotEmpty(purchaseOrderInfo.getCustomerCreditId())) {
  287 + customerCredit = customerCreditService.findById(purchaseOrderInfo.getCustomerCreditId());
  288 + }
286 QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo(); 289 QueryPurchaseOrderLineVo vo1 = new QueryPurchaseOrderLineVo();
287 vo1.setPurchaseOrderId(purchaseOrderInfo.getId()); 290 vo1.setPurchaseOrderId(purchaseOrderInfo.getId());
288 List<PurchaseOrderLine> lineVoList = purchaseOrderLineService.query(vo1); 291 List<PurchaseOrderLine> lineVoList = purchaseOrderLineService.query(vo1);
@@ -326,9 +329,13 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -326,9 +329,13 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
326 } 329 }
327 vo.setDeliveryDate(line.getDeliveryDate()); 330 vo.setDeliveryDate(line.getDeliveryDate());
328 vo.setAssessmentExceedsAgreement(line.getAssessmentExceedsAgreement()); 331 vo.setAssessmentExceedsAgreement(line.getAssessmentExceedsAgreement());
329 - vo.setSalesPrice(line.getSalesPrice().toPlainString()); 332 + if (line.getSalesPrice() != null) {
  333 + vo.setSalesPrice(line.getSalesPrice().toPlainString());
  334 + }
330 vo.setPriceListNo(purchaseOrderInfo.getPriceListNo()); 335 vo.setPriceListNo(purchaseOrderInfo.getPriceListNo());
331 - vo.setPackagingFee(line.getPackagingFee().toPlainString()); 336 + if (line.getPackagingFee() != null) {
  337 + vo.setPackagingFee(line.getPackagingFee().toPlainString());
  338 + }
332 vo.setInvoicingStatus(purchaseOrderInfo.getInvoicingStatus()); 339 vo.setInvoicingStatus(purchaseOrderInfo.getInvoicingStatus());
333 vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader()); 340 vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader());
334 vo.setSurface(purchaseOrderInfo.getSurface()); 341 vo.setSurface(purchaseOrderInfo.getSurface());
@@ -74,7 +74,7 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR @@ -74,7 +74,7 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR
74 @Override 74 @Override
75 public OrderDetailReport findById(String id) { 75 public OrderDetailReport findById(String id) {
76 76
77 - return getBaseMapper().selectById(id); 77 + return getBaseMapper().findById(id);
78 } 78 }
79 79
80 @OpLog(type = OtherOpLogType.class, name = "新增订单明细,ID:{}", params = {"#id"}) 80 @OpLog(type = OtherOpLogType.class, name = "新增订单明细,ID:{}", params = {"#id"})
@@ -15,10 +15,19 @@ import java.util.List; @@ -15,10 +15,19 @@ import java.util.List;
15 */ 15 */
16 public interface OrderDetailReportMapper extends BaseMapper<OrderDetailReport> { 16 public interface OrderDetailReportMapper extends BaseMapper<OrderDetailReport> {
17 17
18 - /** 18 + /**
19 * 查询列表 19 * 查询列表
  20 + *
20 * @param vo 21 * @param vo
21 * @return 22 * @return
22 */ 23 */
23 List<OrderDetailReport> query(@Param("vo") QueryOrderDetailReportVo vo); 24 List<OrderDetailReport> query(@Param("vo") QueryOrderDetailReportVo vo);
  25 +
  26 + /**
  27 + * 查询
  28 + *
  29 + * @param id
  30 + * @return OrderDetailReport
  31 + */
  32 + OrderDetailReport findById(@Param("id") String id);
24 } 33 }
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 <result column="performance" property="performance"/> 38 <result column="performance" property="performance"/>
39 <result column="packaging" property="packaging"/> 39 <result column="packaging" property="packaging"/>
40 <result column="remarks" property="remarks"/> 40 <result column="remarks" property="remarks"/>
41 - <result column="shipping_fee" property="shippingFee"/> 41 + <result column="shipping_cost" property="shippingCost"/>
42 <result column="return_shipping_cost" property="returnShippingCost"/> 42 <result column="return_shipping_cost" property="returnShippingCost"/>
43 <result column="customer_type" property="customerType"/> 43 <result column="customer_type" property="customerType"/>
44 <result column="quality" property="quality"/> 44 <result column="quality" property="quality"/>
@@ -91,7 +91,7 @@ @@ -91,7 +91,7 @@
91 tb.performance, 91 tb.performance,
92 tb.packaging, 92 tb.packaging,
93 tb.remarks, 93 tb.remarks,
94 - tb.shipping_fee, 94 + tb.shipping_cost,
95 tb.return_shipping_cost, 95 tb.return_shipping_cost,
96 tb.customer_type, 96 tb.customer_type,
97 tb.quality, 97 tb.quality,
@@ -109,9 +109,93 @@ @@ -109,9 +109,93 @@
109 left join base_data_workshop as ws on ws.id = tb.workshop_id 109 left join base_data_workshop as ws on ws.id = tb.workshop_id
110 </sql> 110 </sql>
111 111
112 - <select id="query" resultMap="OrderDetailReport"> 112 +<!-- <select id="query" resultMap="OrderDetailReport">-->
  113 +<!-- <include refid="OrderDetailReport_sql"/>-->
  114 +<!-- <where>-->
  115 +<!-- <if test="vo.purchaseOrderLineId != null and vo.purchaseOrderLineId != ''">-->
  116 +<!-- AND tb.purchase_order_line_id = #{vo.purchaseOrderLineId}-->
  117 +<!-- </if>-->
  118 +<!-- <if test="vo.orderNo != null and vo.orderNo != ''">-->
  119 +<!-- AND tb.order_no LIKE CONCAT('%', #{vo.orderNo}, '%')-->
  120 +<!-- </if>-->
  121 +<!-- <if test="vo.workshopId != null and vo.workshopId != ''">-->
  122 +<!-- AND tb.workshop_id = #{vo.workshopId}-->
  123 +<!-- </if>-->
  124 +<!-- <if test="vo.deptName != null and vo.deptName != ''">-->
  125 +<!-- AND tb.dept_name LIKE CONCAT('%', #{vo.deptName}, '%')-->
  126 +<!-- </if>-->
  127 +<!-- <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">-->
  128 +<!-- AND tb.ordering_unit_name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')-->
  129 +<!-- </if>-->
  130 +<!-- </where>-->
  131 +<!-- </select>-->
  132 +
  133 + <select id="findById" resultType="com.lframework.xingyun.sc.entity.OrderDetailReport">
113 <include refid="OrderDetailReport_sql"/> 134 <include refid="OrderDetailReport_sql"/>
114 <where> 135 <where>
  136 + <if test="id != null and id != ''">
  137 + AND tb.id = #{id}
  138 + </if>
  139 + </where>
  140 + </select>
  141 +
  142 + <select id="query" resultMap="OrderDetailReport">
  143 + SELECT *
  144 + FROM (
  145 + SELECT
  146 + tb.id,
  147 + tb.purchase_order_line_id,
  148 + tb.order_no,
  149 + tb.order_date,
  150 + tb.workshop_id,
  151 + ws.name AS workshop_name,
  152 + tb.dept_name,
  153 + tb.region_name,
  154 + tb.ordering_unit_name,
  155 + tb.industry,
  156 + tb.brand,
  157 + tb.thickness,
  158 + tb.thickness_tol_pos,
  159 + tb.thickness_tol_neg,
  160 + tb.width,
  161 + tb.width_tol_pos,
  162 + tb.width_tol_neg,
  163 + tb.length,
  164 + tb.length_tol_pos,
  165 + tb.length_tol_neg,
  166 + tb.status,
  167 + tb.quantity,
  168 + tb.suggested_price,
  169 + tb.delivery_date,
  170 + tb.assessment_exceeds_agreement,
  171 + tb.sales_price,
  172 + tb.price_list_no,
  173 + tb.packaging_fee,
  174 + tb.invoicing_status,
  175 + tb.piece_weight_header,
  176 + tb.surface,
  177 + tb.tolerance,
  178 + tb.performance,
  179 + tb.packaging,
  180 + tb.remarks,
  181 + tb.shipping_cost,
  182 + tb.return_shipping_cost,
  183 + tb.customer_type,
  184 + tb.quality,
  185 + tb.contract_type,
  186 + tb.stock_up_company_name,
  187 + tb.order_type,
  188 + tb.show_order,
  189 + tb.create_by_id,
  190 + tb.create_by,
  191 + tb.update_by_id,
  192 + tb.update_by,
  193 + tb.create_time,
  194 + tb.update_time,
  195 + MAX(tb.create_time) OVER (PARTITION BY tb.order_no, tb.purchase_order_line_id) AS group_latest_time
  196 + FROM order_detail_report tb
  197 + LEFT JOIN base_data_workshop ws ON ws.id = tb.workshop_id
  198 + <where>
115 <if test="vo.purchaseOrderLineId != null and vo.purchaseOrderLineId != ''"> 199 <if test="vo.purchaseOrderLineId != null and vo.purchaseOrderLineId != ''">
116 AND tb.purchase_order_line_id = #{vo.purchaseOrderLineId} 200 AND tb.purchase_order_line_id = #{vo.purchaseOrderLineId}
117 </if> 201 </if>
@@ -121,12 +205,18 @@ @@ -121,12 +205,18 @@
121 <if test="vo.workshopId != null and vo.workshopId != ''"> 205 <if test="vo.workshopId != null and vo.workshopId != ''">
122 AND tb.workshop_id = #{vo.workshopId} 206 AND tb.workshop_id = #{vo.workshopId}
123 </if> 207 </if>
124 - <if test="vo.deptName != null and vo.deptName != ''"> 208 + <if test="vo.deptName != null and vo.dedeptName != ''">
125 AND tb.dept_name LIKE CONCAT('%', #{vo.deptName}, '%') 209 AND tb.dept_name LIKE CONCAT('%', #{vo.deptName}, '%')
126 </if> 210 </if>
127 <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''"> 211 <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
128 AND tb.ordering_unit_name LIKE CONCAT('%', #{vo.orderingUnitName}, '%') 212 AND tb.ordering_unit_name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')
129 </if> 213 </if>
130 </where> 214 </where>
  215 + ) t
  216 + ORDER BY
  217 + t.group_latest_time DESC,
  218 + t.order_no ASC,
  219 + t.purchase_order_line_id ASC,
  220 + t.show_order ASC
131 </select> 221 </select>
132 </mapper> 222 </mapper>