| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using Vbdsm.Common;
- namespace Vbdsm.Gen
- {
- public class TerminalData
- {
- public TerminalData()
- {
- CompanyId = "";
- TerminalId = "";
- }
- public TerminalData(string? companyId, string terminalId)
- {
- CompanyId = companyId;
- TerminalId = terminalId;
- }
- public long GenDateTime { get; set; } = 0;
- public string? CompanyId { get; set; }
- public string TerminalId { get; set; }
- public Dictionary<string, decimal> DayTotal_P { get; set; } = new Dictionary<string, decimal>();
- public decimal Total_P { get; set; }
- public Dictionary<string, decimal> DayTotal_E { get; set; } = new Dictionary<string, decimal>();
- public decimal Total_E { get; set; }
- private string Key => $"{DateTime.Now:yyyyMMdd}";
- public decimal GetCurMonthTotal_P()
- {
- if (!DayTotal_P.TryGetValue(Key, out var d))
- {
- d = 0;
- }
- return d;
- }
- public decimal GetCurMonthTotal_E()
- {
- if (!DayTotal_E.TryGetValue(Key, out var d))
- {
- d = 0;
- }
- return d;
- }
- public TerminalData SetTotal_P(decimal d)
- {
- Total_P = d;
- return this;
- }
- public TerminalData SetMouthTotal_P(decimal d)
- {
- if (DayTotal_P.ContainsKey(Key))
- {
- DayTotal_P.Remove(Key);
- }
- DayTotal_P.Add(Key, d);
- return this;
- }
- public TerminalData SetTotal_E(decimal d)
- {
- Total_E = d;
- return this;
- }
- public TerminalData SetMouthTotal_E(decimal d)
- {
- if (DayTotal_E.ContainsKey(Key))
- {
- DayTotal_E.Remove(Key);
- }
- DayTotal_E.Add(Key, d);
- return this;
- }
- public TerminalData SetGenDateTime(long time)
- {
- GenDateTime = time;
- return this;
- }
- public TerminalData Save()
- {
- FileHelper.SaveFileInfo(this, $"{CompanyId}@{TerminalId}");
- return this;
- }
- }
- }
|