Browse Source

更改double为decimal

LT069288 3 months ago
parent
commit
d74d173294

+ 5 - 5
UniformMaterialManagementSystem/Entities/ContractDetail.cs

@@ -11,17 +11,17 @@ namespace UniformMaterialManagementSystem.Entities
 
         public Guid MaterialGuid { get; set; } 
 
-        public double ContractQty { get; set; }
+        public decimal ContractQty { get; set; }
 
-        public double ReduceQuantity { get; set; }
+        public decimal ReduceQuantity { get; set; }
 
         public DateTime DeliveryTime { get; set; }
 
-        public double InspectedQty { get; set; }
+        public decimal InspectedQty { get; set; }
 
-        public double UnitPrice { get; set; }
+        public decimal UnitPrice { get; set; }
 
-        public double ShippedQuantity { get; set; }
+        public decimal ShippedQuantity { get; set; }
 
         public bool ShippedStatus { get; set; }
 

+ 1 - 1
UniformMaterialManagementSystem/Entities/FactoryLicense.cs

@@ -20,7 +20,7 @@ namespace UniformMaterialManagementSystem.Entities
 
         public DateTime FactoryDate { get; set; }
 
-        public double FactoryQuantity { get; set; }
+        public decimal FactoryQuantity { get; set; }
 
         [StringLength(50)]
         public string Department { get; set; } = null!;

+ 1 - 1
UniformMaterialManagementSystem/Entities/InspectApply.cs

@@ -24,7 +24,7 @@ namespace UniformMaterialManagementSystem.Entities
         [StringLength(50)]
         public string Company { get; set; } = null!;
 
-        public double InspQuantity { get; set; }
+        public decimal InspQuantity { get; set; }
 
         public DateTime StartProductDate { get; set; } = DateTime.Now;
 

+ 2 - 2
UniformMaterialManagementSystem/Entities/InspectApplyContractDetail.cs

@@ -26,9 +26,9 @@ namespace UniformMaterialManagementSystem.Entities
         [StringLength(50)]
         public string SigningDate { get; set; } = null!;
 
-        public double UnInspectQty { get; set; }
+        public decimal UnInspectQty { get; set; }
 
-        public double InspectQty { get; set; }
+        public decimal InspectQty { get; set; }
 
         public InspectApply InspectApply { get; set; } = null!;
 

+ 1 - 1
UniformMaterialManagementSystem/Entities/InspectApplyDetail.cs

@@ -24,7 +24,7 @@ namespace UniformMaterialManagementSystem.Entities
         [StringLength(50)] 
         public string PacketNo { get; set; } = null!;
 
-        public double Quantity { get; set; }
+        public decimal Quantity { get; set; }
 
         [StringLength(50)]
         public string? Note { get; set; }

+ 1 - 1
UniformMaterialManagementSystem/Entities/SampleRegistration.cs

@@ -29,7 +29,7 @@ namespace UniformMaterialManagementSystem.Entities
         [StringLength(50)]
         public string PacketNo { get; set; } = null!;
 
-        public double Quantity { get; set; }
+        public decimal Quantity { get; set; }
 
         [StringLength(50)]
         public string TestingItem { get; set; } = null!;

+ 1 - 1
UniformMaterialManagementSystem/Models/FactoryLicenseModel.cs

@@ -22,7 +22,7 @@ namespace UniformMaterialManagementSystem.Models
         private DateTime _factoryDate;
 
         [ObservableProperty]
-        private double _factoryQuantity;
+        private decimal _factoryQuantity;
 
         [ObservableProperty]
         private string _department = null!;

+ 1 - 1
UniformMaterialManagementSystem/Models/SampleRegistrationModel.cs

@@ -36,7 +36,7 @@ namespace UniformMaterialManagementSystem.Models
         private string _packetNo = null!;
 
         [ObservableProperty]
-        private double _quantity;
+        private decimal _quantity;
 
         [ObservableProperty]
         private string _testingItem = null!;

+ 5 - 5
UniformMaterialManagementSystem/Models/SelectContractDetailModel.cs

@@ -27,16 +27,16 @@ namespace UniformMaterialManagementSystem.Models
         private string _materialName = null!;
 
         [ObservableProperty]
-        private double _contractQty;
+        private decimal _contractQty;
 
         [ObservableProperty]
-        private double _inspectedQty;
+        private decimal _inspectedQty;
 
         [ObservableProperty]
-        private double _unInspectQty;
+        private decimal _unInspectQty;
 
         [ObservableProperty]
-        private double _shareInspectQty;//分摊报检数量
+        private decimal _shareInspectQty;//分摊报检数量
 
         [ObservableProperty]
         private string _signingDate;
@@ -45,7 +45,7 @@ namespace UniformMaterialManagementSystem.Models
         private string _inspectStatus = null!;
 
         [ObservableProperty]
-        private double _shippedQuantity;
+        private decimal _shippedQuantity;
 
         [ObservableProperty]
         private bool _shippedStatus;

+ 8 - 8
UniformMaterialManagementSystem/ViewModels/InspectApplyPageViewModel.cs

@@ -52,7 +52,7 @@ namespace UniformMaterialManagementSystem.ViewModels
 
         [ObservableProperty]
         [Range(0.1, 100000000, ErrorMessage = "报检数量不能小于等于0")]
-        private double _inspQuantity; //报检数量
+        private decimal _inspQuantity; //报检数量
 
         [ObservableProperty]
         private int _totalPackage; //总包数
@@ -222,7 +222,7 @@ namespace UniformMaterialManagementSystem.ViewModels
             }
 
             /*将累计报检数量(含本次)、累计报检次数附加到“申请检验准备情况说明”中*/
-            double totalInspectedQuantity = InspQuantity + CalculateInspectedQuantity(WorkYear, SelectedCompany?.Guid, SelectedMaterial?.Guid);
+            decimal totalInspectedQuantity = InspQuantity + CalculateInspectedQuantity(WorkYear, SelectedCompany?.Guid, SelectedMaterial?.Guid);
             ApplyDescription += $"该品种累计报检数量:{totalInspectedQuantity}米(含此次报检数量){Environment.NewLine}";
 
             //int totalTimes = CalculateSampleTimes(WorkYear, SelectedCompany?.Guid, SelectedMaterial?.Guid);
@@ -257,9 +257,9 @@ namespace UniformMaterialManagementSystem.ViewModels
         /// <param name="companyGuid">生产企业</param>
         /// <param name="materialGuid">产品</param>
         /// <returns></returns>
-        private double CalculateInspectedQuantity(int year, Guid? companyGuid, Guid? materialGuid)
+        private decimal CalculateInspectedQuantity(int year, Guid? companyGuid, Guid? materialGuid)
         {
-            double totalInspectedQty = 0;
+            decimal totalInspectedQty = 0;
             if (companyGuid == null || materialGuid == null) return 0;
 
             var inspectApplies = _inspectService.Query(x => x.Year == year && x.CompanyGuid == companyGuid && x.MaterialGuid == materialGuid).ToList();
@@ -463,7 +463,7 @@ namespace UniformMaterialManagementSystem.ViewModels
 
                 if (dt.Columns.Contains("数量"))
                 {
-                    double quantity = double.Parse(dr["数量"].ToString() ?? string.Empty);
+                    decimal quantity = decimal.Parse(dr["数量"].ToString() ?? string.Empty);
                     applyDetail.Quantity = Math.Round(quantity, 1);
                 }
 
@@ -574,7 +574,7 @@ namespace UniformMaterialManagementSystem.ViewModels
             {
                 errorMessage.Append("合同信息不允许为空!\n");
             }
-            double sum = 0;
+            decimal sum = 0;
             foreach (var detail in ContractDetails)
             {
                 sum += detail.UnInspectQty;
@@ -686,7 +686,7 @@ namespace UniformMaterialManagementSystem.ViewModels
         /// <summary>
         /// 根据规则分摊报检数量
         /// </summary>
-        private void ShareInspectQty(ObservableCollection<SelectContractDetailModel> contractDetails, double remainQty)
+        private void ShareInspectQty(ObservableCollection<SelectContractDetailModel> contractDetails, decimal remainQty)
         {
             //分摊报检数量
             if (contractDetails.Count == 0) return;
@@ -760,7 +760,7 @@ namespace UniformMaterialManagementSystem.ViewModels
         /// </summary>
         private void CalculateDetailSummary()
         {
-            double sum = 0;
+            decimal sum = 0;
             foreach (var detail in InspectApplyDetails)
             {
                 sum += detail.Quantity;

+ 1 - 1
UniformMaterialManagementSystem/Views/InspectApplyPage.xaml.cs

@@ -90,7 +90,7 @@ namespace UniformMaterialManagementSystem.Views
         {
             if (e.Column.Header?.ToString() != "数量*")  return; 
 
-            double sum = 0;
+            decimal sum = 0;
             for (int i = 0; i < DataGridDetail.Items.Count; i++)
             {
                 InspectApplyDetail? detail = DataGridDetail.Items.GetItemAt(i) as InspectApplyDetail;