feat(sales): 优化发货和销售台账相关功能
- 在CustomerServiceImpl新增客户默认字段初始化,包含纳税人识别号、地址、电话、维护人及维护时间
- 修正SalesLedgerMapper中发货状态判断逻辑,将字段unshipped_count更正为shipped_type,并新增部分发货数量统计
- 在SalesLedgerProduct中新增部分发货数量字段partSendAmount,支持部分发货信息展示
- 扩展SalesLedgerProductMapper,关联查询部分发货数量,实现动态显示部分发货数据
- ShippingInfo新增是否全部发货标识isAllSend和部分发货数量partSendAmount字段,完善发货状态描述
- 更新ShippingInfoMapper查询字段,增加is_all_send和part_send_amount字段支持多条件筛选发货信息
| | |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | Long tenantId = loginUser.getTenantId(); |
| | | customer.setTenantId(tenantId); |
| | | customer.setTaxpayerIdentificationNumber(""); |
| | | customer.setCompanyAddress(""); |
| | | customer.setCompanyPhone(""); |
| | | customer.setMaintainer(""); |
| | | customer.setMaintenanceTime(new Date()); |
| | | return customerMapper.insert(customer); |
| | | } |
| | | |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | |
| | | // 可用数量 quantity - returnQuality |
| | | @TableField(exist = false) |
| | | private BigDecimal availableQuality; |
| | | |
| | | @TableField(exist = false) |
| | | // 部分发货数量 |
| | | private BigDecimal partSendAmount; |
| | | } |
| | |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long tenantId; |
| | | |
| | | @TableField(value = "is_all_send") |
| | | @ApiModelProperty(value = "是否全部发货 1全部发货 0不全部发货") |
| | | private Integer isAllSend; |
| | | |
| | | @ApiModelProperty(value = "部分发货数量") |
| | | @TableField(value = "part_send_amount") |
| | | private BigDecimal partSendAmount; |
| | | |
| | | } |
| | |
| | | DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | CASE |
| | | WHEN shipping_status_counts.total_count = 0 THEN false |
| | | WHEN shipping_status_counts.unshipped_count = 0 THEN true |
| | | WHEN shipping_status_counts.shipped_type = 0 THEN true |
| | | ELSE false |
| | | END AS is_fh |
| | | FROM sales_ledger T1 |
| | |
| | | LEFT JOIN ( |
| | | SELECT sales_ledger_id, |
| | | COUNT(*) as total_count, |
| | | SUM(CASE WHEN status != '已发货' THEN 1 ELSE 0 END) as unshipped_count |
| | | SUM(CASE WHEN status != '已发货' THEN 1 ELSE 0 END) as shipped_type, |
| | | sum(part_send_amount) as part_send_amount |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id |
| | | ) shipping_status_counts ON T1.id = shipping_status_counts.sales_ledger_id |
| | |
| | | CASE |
| | | WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1 |
| | | ELSE 0 |
| | | END as has_sufficient_stock |
| | | END as has_sufficient_stock, |
| | | t3.part_send_amount |
| | | FROM |
| | | sales_ledger_product T1 |
| | | LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id |
| | | |
| | | LEFT JOIN ( |
| | | SELECT sales_ledger_id, |
| | | sum(part_send_amount) as part_send_amount |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id |
| | | ) as t3 on t3.sales_ledger_id = T1.sales_ledger_id |
| | | <where> |
| | | <if test="salesLedgerProduct.salesLedgerId != null"> |
| | | AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId} |
| | |
| | | sl.sales_contract_no, |
| | | slp.specification_model, |
| | | p.product_name, |
| | | sl.customer_name |
| | | sl.customer_name, |
| | | s.is_all_send, |
| | | s.part_send_amount |
| | | FROM shipping_info s |
| | | LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id |
| | | LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1 |
| | |
| | | <if test="req.salesContractNo != null and req.salesContractNo != ''"> |
| | | AND sl.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%') |
| | | </if> |
| | | <if test="req.salesLedgerId != null"> |
| | | AND s.sales_ledger_id = #{req.salesLedgerId} |
| | | </if> |
| | | <if test="req.shippingCarNumber != null and req.shippingCarNumber != ''"> |
| | | AND s.shipping_car_number LIKE CONCAT('%',#{req.shippingCarNumber},'%') |
| | | </if> |