fix
zhangqian
2024-07-04 e7bc8bbe2fd47b348090552665233731d98fbaec
fix
3个文件已修改
10 ■■■■ 已修改文件
controllers/report_forms_controller.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/warehouse_month_forms.go 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
task/warehouse_month_stats.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/report_forms_controller.go
@@ -481,7 +481,7 @@
        for _, item := range result {
            productIds = append(productIds, item.ProductId)
        }
        statsRecords, err := service.GetCurrentWarehouseStats(params.Date, params.WarehouseID, productIds)
        statsRecords, err := service.GetCurrentWarehouseStats(params.Date, params.WarehouseID, productIds, true)
        if err != nil {
            util.ResponseFormat(c, code.InternalError, "内部错误")
            return
service/warehouse_month_forms.go
@@ -162,7 +162,7 @@
    return
}
func GetCurrentWarehouseStats(date string, warehouseId int, productIds []string) (statRecords []*models.WarehouseMonthStats, err error) {
func GetCurrentWarehouseStats(date string, warehouseId int, productIds []string, realTime bool) (statRecords []*models.WarehouseMonthStats, err error) {
    //本月期初数量/上月结余数量
    groupSumList, err := models.NewLocationProductAmountSearch().SetProductIds(productIds).GroupSum("product_id", "amount")
    productIds = make([]string, 0, len(groupSumList))
@@ -178,6 +178,10 @@
    //按配置取开始时间和结束时间
    beginTime, endTime, err := NewSystemConfigService().GetInventoryCutOffTime()
    if realTime {
        beginTime = endTime
        endTime = time.Now()
    }
    if err != nil {
        logx.Errorf("MonthStats GetCurrentStats get GetInventoryCutOffTime err:%v", err)
        return
task/warehouse_month_stats.go
@@ -51,7 +51,7 @@
        oldRecordsMap := models.WarehouseMonthStatsMap(oldRecords)
        //本月期初数量/上月结余数量
        statsRecords, err := service.GetCurrentWarehouseStats(date, warehouseId, nil)
        statsRecords, err := service.GetCurrentWarehouseStats(date, warehouseId, nil, false)
        if err != nil {
            continue
        }