feat(stock): 添加出入库记录的合同号查询功能
- 在 ApproveProcess 中新增采购单号字段用于审批流程查询
- 为 ApproveProcessMapper.xml 添加采购单号查询条件支持
- 在 StockInRecordDto 和 StockOutRecordDto 中新增合同号查询参数
- 为出入库记录导出功能添加采购合同号和销售单号字段映射
- 更新 StockInRecordMapper.xml 添加采购合同号关联查询和筛选条件
- 更新 StockOutRecordMapper.xml 添加销售单号关联查询和筛选条件
| | |
| | | @ApiModelProperty(value = "销售台账id") |
| | | private Long salesLedgerId; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "采购单号") |
| | | private String purchaseOrderNo; |
| | | |
| | | |
| | | @ApiModelProperty(value = "创建用户") |
| | | @TableField(fill = FieldFill.INSERT) |
| | |
| | | //现存量 |
| | | private String currentStock; |
| | | |
| | | /** |
| | | * 采购合同号(查询参数) |
| | | */ |
| | | private String purchaseContractNumber; |
| | | |
| | | } |
| | |
| | | * 合格自定义出库:备注 |
| | | */ |
| | | private String sourceNo; |
| | | |
| | | /** |
| | | * 销售单号(查询参数) |
| | | */ |
| | | private String salesContractNo; |
| | | } |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime createTime; |
| | | @Excel(name = "采购合同号") |
| | | private String purchaseContractNumber; |
| | | |
| | | @Excel(isExport = false) |
| | | private String type; |
| | |
| | | private String recordType; |
| | | @Excel(name = "来源单号") |
| | | private String sourceNo; |
| | | @Excel(name = "销售单号") |
| | | private String salesContractNo; |
| | | @Excel(name = "出库数量") |
| | | private String stockInNum; |
| | | @Excel(name = "出库时间") |
| | |
| | | and ap.approve_reason like concat('%销售单号:',#{req.salesContractNo},'%') |
| | | </if> |
| | | </if> |
| | | <if test="req.approveType == null or req.approveType != 7"> |
| | | <if test="req.approveType != null and req.approveType == 5"> |
| | | select ap.* from approve_process ap |
| | | where ap.approve_delete = 0 |
| | | <if test="req.approveId != null and req.approveId != ''"> |
| | | and ap.approve_id like concat('%',#{req.approveId},'%') |
| | | </if> |
| | | <if test="req.approveStatus != null or req.approveStatus == 0"> |
| | | and ap.approve_status = #{req.approveStatus} |
| | | </if> |
| | | and ap.approve_type = #{req.approveType} |
| | | <if test="req.purchaseOrderNo != null and req.purchaseOrderNo != ''"> |
| | | and ap.approve_reason like concat('%',#{req.purchaseOrderNo},'%') |
| | | </if> |
| | | </if> |
| | | <if test="req.approveType == null or (req.approveType != 7 and req.approveType != 5)"> |
| | | select * from approve_process ap where ap.approve_delete = 0 |
| | | <if test="req.approveId != null and req.approveId != ''"> |
| | | and ap.approve_id like concat('%',#{req.approveId},'%') |
| | |
| | | p.product_name as product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | u.nick_name as createBy, |
| | | pl.purchase_contract_number as purchaseContractNumber |
| | | FROM stock_in_record as sir |
| | | LEFT JOIN product_model as pm on sir.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sir.create_user = u.user_id |
| | | LEFT JOIN purchase_ledger as pl on sir.record_id = pl.id and sir.record_type = '7' |
| | | <where> |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sir.create_time like concat('%',#{params.timeStr},'%') |
| | |
| | | </if> |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sir.record_type = #{params.recordType} |
| | | </if> |
| | | <if test="params.purchaseContractNumber != null and params.purchaseContractNumber != ''"> |
| | | and pl.purchase_contract_number like concat('%',#{params.purchaseContractNumber},'%') |
| | | </if> |
| | | </where> |
| | | order by sir.id desc |
| | |
| | | p.product_name as product_name, |
| | | pm.model, |
| | | pm.unit, |
| | | u.nick_name as createBy |
| | | u.nick_name as createBy, |
| | | pl.purchase_contract_number as purchaseContractNumber |
| | | FROM stock_in_record as sir |
| | | LEFT JOIN product_model as pm on sir.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | | LEFT JOIN sys_user as u on sir.create_user = u.user_id |
| | | LEFT JOIN purchase_ledger as pl on sir.record_id = pl.id and sir.record_type = '7' |
| | | <where> |
| | | <if test="params.timeStr != null and params.timeStr != ''"> |
| | | and sir.create_time like concat('%',#{params.timeStr},'%') |
| | |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sir.record_type = #{params.recordType} |
| | | </if> |
| | | <if test="params.purchaseContractNumber != null and params.purchaseContractNumber != ''"> |
| | | and pl.purchase_contract_number like concat('%',#{params.purchaseContractNumber},'%') |
| | | </if> |
| | | </where> |
| | | order by sir.id desc |
| | | </select> |
| | |
| | | WHEN '1' THEN sor.remark |
| | | WHEN '10' THEN sor.remark |
| | | ELSE NULL |
| | | END as sourceNo |
| | | END as sourceNo, |
| | | CASE sor.record_type |
| | | WHEN '8' THEN sl.sales_contract_no |
| | | WHEN '13' THEN sl2.sales_contract_no |
| | | ELSE NULL |
| | | END as salesContractNo |
| | | FROM stock_out_record as sor |
| | | LEFT JOIN product_model as pm on sor.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | |
| | | </if> |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sor.record_type = #{params.recordType} |
| | | </if> |
| | | <if test="params.salesContractNo != null and params.salesContractNo != ''"> |
| | | and ((sor.record_type = '8' and sl.sales_contract_no like concat('%',#{params.salesContractNo},'%')) |
| | | or (sor.record_type = '13' and sl2.sales_contract_no like concat('%',#{params.salesContractNo},'%'))) |
| | | </if> |
| | | </where> |
| | | order by sor.id desc |
| | |
| | | WHEN '1' THEN sor.remark |
| | | WHEN '10' THEN sor.remark |
| | | ELSE NULL |
| | | END as sourceNo |
| | | END as sourceNo, |
| | | CASE sor.record_type |
| | | WHEN '8' THEN sl.sales_contract_no |
| | | WHEN '13' THEN sl2.sales_contract_no |
| | | ELSE NULL |
| | | END as salesContractNo |
| | | FROM stock_out_record as sor |
| | | LEFT JOIN product_model as pm on sor.product_model_id = pm.id |
| | | LEFT JOIN product as p on pm.product_id = p.id |
| | |
| | | <if test="params.recordType != null and params.recordType != ''"> |
| | | and sor.record_type = #{params.recordType} |
| | | </if> |
| | | <if test="params.salesContractNo != null and params.salesContractNo != ''"> |
| | | and ((sor.record_type = '8' and sl.sales_contract_no like concat('%',#{params.salesContractNo},'%')) |
| | | or (sor.record_type = '13' and sl2.sales_contract_no like concat('%',#{params.salesContractNo},'%'))) |
| | | </if> |
| | | </where> |
| | | order by sor.id desc |
| | | </select> |