1.采购订单列表增加制单时间查询;

2.库存调拨明细totalAllotAmount扫描优化;
This commit is contained in:
chenlin 2025-04-29 15:08:07 +08:00
parent 190379942e
commit 8bdedaf5a2
2 changed files with 18 additions and 1 deletions

View File

@ -1313,7 +1313,7 @@ func (m *InventoryReportAllotDetailReq) ReportAllotDetailList(c *gin.Context) (*
// Calculate the sum of allot_amount
var totalAllotAmount float64
err = countQuery.Select("SUM(erp_inventory_allot_commodity.amount) as total_allot_amount").
err = countQuery.Select("COALESCE(SUM(erp_inventory_allot_commodity.amount), 0) as total_allot_amount").
Pluck("total_allot_amount", &totalAllotAmount).Error
if err != nil {
logger.Error("Failed to calculate TotalAllotAmount", logger.Field("err", err))

View File

@ -167,6 +167,8 @@ type ErpPurchaseOrderListReq struct {
PurchaseType string `json:"purchase_type"` // 采购类型procure-采购 reject-退货
StoreId uint32 `json:"store_id"` // 门店id
ErpSupplierId uint32 `json:"erp_supplier_id"` // 供应商id
MakeTimeStart string `json:"make_time_start"` // 制单开始时间
MakeTimeEnd string `json:"make_time_end"` // 制单结束时间
AuditTimeStart string `json:"audit_time_start"` // 审核开始时间
AuditTimeEnd string `json:"audit_time_end"` // 审核结束时间
AuditFlag string `json:"audit_flag"` // 审核标记默认展示所有ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成/入库中
@ -638,6 +640,21 @@ func (m *ErpPurchaseOrderListReq) List(c *gin.Context) (*ErpPurchaseOrderListRes
//parse = parse.AddDate(0, 0, 1)
qs = qs.Where("audit_time < ?", parse)
}
if m.MakeTimeStart != "" {
parse, err := time.Parse(QueryTimeFormat, m.MakeTimeStart)
if err != nil {
logger.Errorf("err:", err)
}
qs = qs.Where("maker_time > ?", parse)
}
if m.MakeTimeEnd != "" {
parse, err := time.Parse(QueryTimeFormat, m.MakeTimeEnd)
if err != nil {
logger.Errorf("err:", err)
}
//parse = parse.AddDate(0, 0, 1)
qs = qs.Where("maker_time < ?", parse)
}
if m.HandlerId != 0 {
qs = qs.Where("handler_id=?", m.HandlerId)
}