Ver Fonte

新增检验报告功能:是否抽样根据检验申请表的抽样状态携带,检验情况携带抽样登记单数据

LT069288 há 3 meses atrás
pai
commit
29188537af

+ 2 - 0
UniformMaterialManagementSystem/Entities/InspectApply.cs

@@ -58,6 +58,8 @@ namespace UniformMaterialManagementSystem.Entities
 
         public bool ExportStatus { get; set; } = false;
 
+        public SampleRegistration? SampleRegistration { get; set; }
+
         public InspectionReport? InspectionReport { get; set; }
 
         public Material Material { get; set; } = null!;

+ 41 - 19
UniformMaterialManagementSystem/ViewModels/InspectionReportInputPageViewModel.cs

@@ -78,7 +78,7 @@ namespace UniformMaterialManagementSystem.ViewModels
 
         private InspectionReport? _inspectionReport;
 
-        public const string ReportDescOne = "共抽检()包,平均幅宽()厘米,与标样对比色差()级,抽检产品外观质量、实物质量及包装符合标准要求。\r\n备注:随机数(),随机抽取()米(生产日期(),批号(),包号())送()进行理化性能检测,另同包抽取2份备用。";
+        private readonly string _reportDescOne = "共抽检()包,平均幅宽()厘米,与标样对比色差()级,抽检产品外观质量、实物质量及包装符合标准要求。\r\n备注:随机数(),随机抽取()米(生产日期(),批号(),包号())送()进行理化性能检测,另同包抽取2份备用。";
         public const string ReportDescTwo = "共抽检()包,平均幅宽()厘米,与标样对比色差()级,抽检产品外观质量、实物质量及包装符合标准要求。\r\n备注:理化检测同(XXXX年XX月XX日)送检……";
         public const string ConclusionDescOne = "不合格检验情况说明……\r\n综合检验情况,该批抽样产品出厂检验不合格。按要求下达处理意见告知书,要求整改。整改完成后申请二次检验。";
         public const string ConclusionDescTwo = "经我单位对该批产品抽样检验,抽检产品外观实物质量符合规范要求,待理化检测合格具备出厂条件后,准予出厂。产品出厂后,材料企业依法承担产品生产质量责任。";
@@ -105,21 +105,11 @@ namespace UniformMaterialManagementSystem.ViewModels
             LoadData();
         }
 
-        /// <summary>
-        /// 是否抽样发生改变时触发
-        /// </summary>
-        partial void OnIsSampleChanged(bool value)
-        {
-            SetReportDesc(value);
-            SetConclusionDesc(value, Conclusion);
-        }
-
         /// <summary>
         /// 检验结论发生改变时触发
         /// </summary>
         partial void OnConclusionChanged(string value)
         {
-            SetReportDesc(IsSample);
             SetConclusionDesc(IsSample, value);
         }
 
@@ -132,6 +122,7 @@ namespace UniformMaterialManagementSystem.ViewModels
             var inspectApplyList = _inspectApplyService.QueryNoTracking()
                 .Include(x => x.Material)
                 .Include(x => x.InspectApplyContractDetails)
+                .Include(x => x.SampleRegistration)
                 .Where(x => x.Year == App.CurrentUser!.WorkYear && !x.ReportStatus).ToList();
 
             InspectApplies.Clear();
@@ -346,11 +337,47 @@ namespace UniformMaterialManagementSystem.ViewModels
             PurchaseCompanyNames = GetPurchaseCompanyNames(inspectApply);
             ContractNos = GetContractNos(inspectApply);
             ReportBasis = "依据" + inspectApply.Material.NormName;
-            IsSample = true;
             Conclusion = "合格";
-            ReportDesc = ReportDescOne;
-            ConclusionDesc = ConclusionDescTwo;
             EditUser = App.CurrentUser.UserName;
+
+            //是否抽样根据检验申请表的抽样状态携带
+            IsSample = inspectApply.SampleStatus;
+            if (IsSample)
+            {
+                ReportDesc = GetReportDesc(inspectApply.SampleRegistration);
+                ConclusionDesc = ConclusionDescTwo;
+            }
+            else
+            {
+                ReportDesc = ReportDescTwo;
+                ConclusionDesc = ConclusionDescThree;
+            }
+        }
+
+        private string GetReportDesc(SampleRegistration? sample)
+        {
+            if (sample == null) return _reportDescOne;
+            var inspectionOrganizations = sample.InspectionOrganization.Split("\r\n");
+            string random = string.Empty;
+            string inspectOrg = string.Empty;
+            if (inspectionOrganizations.Length > 0)
+            {
+                var randomStr = inspectionOrganizations[0].Split(':');
+                if (randomStr.Length > 1)
+                {
+                    random = randomStr[1];
+                }
+            }
+            if (inspectionOrganizations.Length > 1)
+            {
+                var inspectOrgStr = inspectionOrganizations[1].Split(':');
+                if (inspectOrgStr.Length > 1)
+                {
+                    inspectOrg = inspectOrgStr[1];
+                }
+            }
+
+            return $"共抽检()包,平均幅宽()厘米,与标样对比色差()级,抽检产品外观质量、实物质量及包装符合标准要求。\r\n备注:随机数{random},随机抽取{sample.Quantity}米(生产日期{sample.ProductDate.ToString("D")},批号{sample.BatchNo},包号{sample.PacketNo})送{inspectOrg}进行理化性能检测,另同包抽取2份备用。";
         }
 
         /// <summary>
@@ -408,11 +435,6 @@ namespace UniformMaterialManagementSystem.ViewModels
             return sb.ToString();
         }
 
-        private void SetReportDesc(bool isSample)
-        {
-            ReportDesc = isSample ? ReportDescOne : ReportDescTwo;
-        }
-
         private void SetConclusionDesc(bool isSample, string conclusion)
         {
             if (isSample && (conclusion == "合格" || conclusion == "合格(初测不合格,复测合格)"))

+ 12 - 2
UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportInputPage.xaml

@@ -574,7 +574,17 @@
                             <ColumnDefinition Width="Auto" />
                             <ColumnDefinition Width="*" />
                         </Grid.ColumnDefinitions>
-                        <RadioButton
+
+                        <CheckBox
+                            Grid.Row="0"
+                            Grid.Column="0"
+                            VerticalContentAlignment="Center"
+                            Content="是否抽样送检"
+                            FontSize="13"
+                            Foreground="Red"
+                            IsChecked="{Binding IsSample, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                            IsEnabled="False" />
+                        <!--<RadioButton
                             x:Name="SampleRadioButton"
                             Grid.Row="0"
                             Grid.Column="0"
@@ -593,7 +603,7 @@
                             VerticalContentAlignment="Center"
                             Content="未抽样送检"
                             GroupName="IsSampleGroup"
-                            IsChecked="True" />
+                            IsChecked="True" />-->
                         <TextBox
                             Grid.Row="1"
                             Grid.Column="0"

+ 4 - 4
UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportInputPage.xaml.cs

@@ -16,9 +16,9 @@ namespace UniformMaterialManagementSystem.Views.InspectionReport
             this.DataContext = App.Current.Services.GetService<InspectionReportInputPageViewModel>();
         }
 
-        private void RadioButton_Unchecked(object sender, System.Windows.RoutedEventArgs e)
-        {
-            NotSampleRadioButton.IsChecked = !SampleRadioButton.IsChecked;
-        }
+        //private void RadioButton_Unchecked(object sender, System.Windows.RoutedEventArgs e)
+        //{
+        //    NotSampleRadioButton.IsChecked = !SampleRadioButton.IsChecked;
+        //}
     }
 }

+ 11 - 2
UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportManagePage.xaml

@@ -624,7 +624,16 @@
                             <ColumnDefinition Width="Auto" />
                             <ColumnDefinition Width="*" />
                         </Grid.ColumnDefinitions>
-                        <RadioButton
+                        <CheckBox
+                            Grid.Row="0"
+                            Grid.Column="0"
+                            VerticalContentAlignment="Center"
+                            Content="是否抽样送检"
+                            FontSize="13"
+                            Foreground="Red"
+                            IsChecked="{Binding SelectedInspectionReport.IsSample, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                            IsEnabled="False" />
+                        <!--<RadioButton
                             x:Name="IsSampleRadioButton"
                             Grid.Row="0"
                             Grid.Column="0"
@@ -645,7 +654,7 @@
                             Content="未抽样送检"
                             GroupName="IsSampleGroup"
                             IsChecked="True"
-                            IsEnabled="False" />
+                            IsEnabled="False" />-->
                         <TextBox
                             Grid.Row="1"
                             Grid.Column="0"

+ 4 - 5
UniformMaterialManagementSystem/Views/InspectionReport/InspectionReportManagePage.xaml.cs

@@ -15,7 +15,6 @@ namespace UniformMaterialManagementSystem.Views.InspectionReport
             InitializeComponent();
 
             this.DataContext = App.Current.Services.GetService<InspectionReportManagePageViewModel>();
-
         }
 
         private void Name_OnLostFocus(object sender, RoutedEventArgs e)
@@ -34,9 +33,9 @@ namespace UniformMaterialManagementSystem.Views.InspectionReport
             DataGridDetail.CommitEdit();
         }
 
-        private void IsSampleRadioButton_Unchecked(object sender, RoutedEventArgs e)
-        {
-            NotSampleRadioButton.IsChecked = !IsSampleRadioButton.IsChecked;
-        }
+        //private void IsSampleRadioButton_Unchecked(object sender, RoutedEventArgs e)
+        //{
+        //    NotSampleRadioButton.IsChecked = !IsSampleRadioButton.IsChecked;
+        //}
     }
 }