mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-24 15:25:43 +00:00
feat(BE): fix delete project flock budget and uniformity, and fix uniformity with update purchase document
This commit is contained in:
@@ -333,13 +333,6 @@ func (s recordingService) UpdateOne(c *fiber.Ctx, req *validation.Update, id uin
|
||||
s.Log.Errorf("Failed to list existing stocks: %+v", err)
|
||||
return err
|
||||
}
|
||||
if s.Log != nil && s.Log.IsLevelEnabled(logrus.DebugLevel) {
|
||||
s.Log.WithFields(logrus.Fields{
|
||||
"recording_id": recordingEntity.Id,
|
||||
"existing": summarizeExistingStocks(existingStocks),
|
||||
"incoming": summarizeIncomingStocks(req.Stocks),
|
||||
}).Debug("recording update stock comparison")
|
||||
}
|
||||
if stocksMatch(existingStocks, req.Stocks) {
|
||||
hasStockChanges = false
|
||||
}
|
||||
@@ -698,16 +691,6 @@ func (s *recordingService) consumeRecordingStocks(ctx context.Context, tx *gorm.
|
||||
}
|
||||
desiredTotal := desired + pending
|
||||
|
||||
if s.Log != nil && s.Log.IsLevelEnabled(logrus.DebugLevel) {
|
||||
s.Log.WithFields(logrus.Fields{
|
||||
"recording_stock_id": stock.Id,
|
||||
"product_warehouse_id": stock.ProductWarehouseId,
|
||||
"desired_usage_qty": desired,
|
||||
"desired_pending_qty": pending,
|
||||
"desired_total_qty": desiredTotal,
|
||||
}).Debug("recording fifo consume start")
|
||||
}
|
||||
|
||||
result, err := s.FifoSvc.Consume(ctx, commonSvc.StockConsumeRequest{
|
||||
UsableKey: recordingStockUsableKey,
|
||||
UsableID: stock.Id,
|
||||
@@ -721,17 +704,6 @@ func (s *recordingService) consumeRecordingStocks(ctx context.Context, tx *gorm.
|
||||
return err
|
||||
}
|
||||
|
||||
if s.Log != nil && s.Log.IsLevelEnabled(logrus.DebugLevel) {
|
||||
s.Log.WithFields(logrus.Fields{
|
||||
"recording_stock_id": stock.Id,
|
||||
"product_warehouse_id": stock.ProductWarehouseId,
|
||||
"result_usage_qty": result.UsageQuantity,
|
||||
"result_pending_qty": result.PendingQuantity,
|
||||
"released_qty": result.ReleasedQuantity,
|
||||
"added_allocations": len(result.AddedAllocations),
|
||||
}).Debug("recording fifo consume result")
|
||||
}
|
||||
|
||||
if err := s.Repository.UpdateStockUsage(tx, stock.Id, result.UsageQuantity, result.PendingQuantity); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -754,23 +726,6 @@ func (s *recordingService) releaseRecordingStocks(ctx context.Context, tx *gorm.
|
||||
continue
|
||||
}
|
||||
|
||||
var usage float64
|
||||
var pending float64
|
||||
if stock.UsageQty != nil {
|
||||
usage = *stock.UsageQty
|
||||
}
|
||||
if stock.PendingQty != nil {
|
||||
pending = *stock.PendingQty
|
||||
}
|
||||
if s.Log != nil && s.Log.IsLevelEnabled(logrus.DebugLevel) {
|
||||
s.Log.WithFields(logrus.Fields{
|
||||
"recording_stock_id": stock.Id,
|
||||
"product_warehouse_id": stock.ProductWarehouseId,
|
||||
"current_usage_qty": usage,
|
||||
"current_pending_qty": pending,
|
||||
}).Debug("recording fifo release start")
|
||||
}
|
||||
|
||||
if err := s.FifoSvc.ReleaseUsage(ctx, commonSvc.StockReleaseRequest{
|
||||
UsableKey: recordingStockUsableKey,
|
||||
UsableID: stock.Id,
|
||||
|
||||
Reference in New Issue
Block a user