| | |
| | | oldRecordsMap := models.WarehouseMonthStatsMap(oldRecords) |
| | | |
| | | //本月期初数量/上月结余数量 |
| | | statsRecords, err := service.GetCurrentWarehouseStats(date, warehouseId, nil) |
| | | statsRecords, err := service.GetCurrentWarehouseStats(date, warehouseId, nil, false) |
| | | if err != nil { |
| | | continue |
| | | } |
| | |
| | | } |
| | | |
| | | for _, record := range statsRecords { |
| | | if len(record.InputItems) == 0 { |
| | | continue |
| | | } |
| | | record.BeginAmount = record.EndAmount |
| | | err = models.WithTransaction(func(db *gorm.DB) error { |
| | | err = models.NewWarehouseMonthStatsSearch().SetOrm(db).Create(record) |
| | |
| | | } |
| | | } |
| | | if err == nil { |
| | | service.SendAlarm("按仓库月度统计执行成功", "") |
| | | //service.SendAlarm("按仓库月度统计执行成功", "") |
| | | } |
| | | |
| | | return |