|
@@ -5,7 +5,6 @@ using System.Collections.ObjectModel;
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
using System.Text;
|
|
|
using System.Windows;
|
|
|
-using UniformMaterialManagementSystem.Custom;
|
|
|
using UniformMaterialManagementSystem.Entities;
|
|
|
using UniformMaterialManagementSystem.Models;
|
|
|
using UniformMaterialManagementSystem.Services;
|
|
@@ -79,6 +78,13 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
|
|
|
private InspectionReport? _inspectionReport;
|
|
|
|
|
|
+ public const string ReportDescOne = "共抽检()包,平均幅宽()厘米,与标样对比色差()级,抽检产品外观质量、实物质量及包装符合标准要求。\r\n备注:随机数(),随机抽取()米(生产日期(),批号(),包号())送()进行理化性能检测,另同包抽取2份备用。";
|
|
|
+ public const string ReportDescTwo = "共抽检()包,平均幅宽()厘米,与标样对比色差()级,抽检产品外观质量、实物质量及包装符合标准要求。\r\n备注:理化检测同(XXXX年XX月XX日)送检……";
|
|
|
+ public const string ConclusionDescOne = "不合格检验情况说明……\r\n综合检验情况,该批抽样产品出厂检验不合格。按要求下达处理意见告知书,要求整改。整改完成后申请二次检验。";
|
|
|
+ public const string ConclusionDescTwo = "经我单位对该批产品抽样检验,抽检产品外观实物质量符合规范要求,待理化检测合格具备出厂条件后,准予出厂。产品出厂后,材料企业依法承担产品生产质量责任。";
|
|
|
+ public const string ConclusionDescThree = "经我单位对该批出厂产品抽样检验,确认具备出厂条件,准予出厂。产品出厂后,材料企业依法承担产品生产质量责任。";
|
|
|
+ public const string ConclusionDescFour = "未抽样,不合格的检验结论描述……";
|
|
|
+
|
|
|
public InspectionReportInputPageViewModel(IDataBaseService<InspectApply> inspectApplyService, IDataBaseService<User> userService, IDataBaseService<InspectionReport> inspectionReportService)
|
|
|
{
|
|
|
_inspectApplyService = inspectApplyService;
|
|
@@ -90,7 +96,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
|
|
|
//姓名
|
|
|
var users = userService.QueryNoTracking(
|
|
|
- x => x.IsEnabled && x.SupervisionUnitGuid == App.CurrentUser.SupervisionUnitGuid).ToList();
|
|
|
+ x => x.IsEnabled && x.SupervisionUnitGuid == App.CurrentUser!.SupervisionUnitGuid).ToList();
|
|
|
foreach (var user in users)
|
|
|
{
|
|
|
UserNames.Add(user.UserName);
|
|
@@ -99,6 +105,24 @@ 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);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 刷新
|
|
|
/// </summary>
|
|
@@ -108,7 +132,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
var inspectApplyList = _inspectApplyService.QueryNoTracking()
|
|
|
.Include(x => x.Material)
|
|
|
.Include(x => x.InspectApplyContractDetails)
|
|
|
- .Where(x => x.Year == App.CurrentUser.WorkYear && !x.ReportStatus).ToList();
|
|
|
+ .Where(x => x.Year == App.CurrentUser!.WorkYear && !x.ReportStatus).ToList();
|
|
|
|
|
|
InspectApplies.Clear();
|
|
|
foreach (var inspectApply in inspectApplyList)
|
|
@@ -179,7 +203,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
|
|
|
private void GenerateDocument()
|
|
|
{
|
|
|
- if (_inspectionReport == null) return;
|
|
|
+ if (_inspectionReport == null || SelectedInspectApply == null) return;
|
|
|
|
|
|
_inspectionReport.InspectApply = SelectedInspectApply;
|
|
|
|
|
@@ -208,6 +232,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
|
|
|
private void AddInspectionReportAndDetail()
|
|
|
{
|
|
|
+ if (SelectedInspectApply == null) return;
|
|
|
_inspectionReport = new()
|
|
|
{
|
|
|
InspectApplyGuid = SelectedInspectApply.Guid,
|
|
@@ -242,7 +267,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
|
|
|
//校验验收组
|
|
|
var details = InspectionReportDetails;
|
|
|
- if (details == null || details.Count == 0)
|
|
|
+ if (details.Count == 0)
|
|
|
{
|
|
|
errorMessage.Append("验收组不允许为空!\n");
|
|
|
}
|
|
@@ -288,7 +313,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
}
|
|
|
|
|
|
var isRepeat = InspectionReportDetails.GroupBy(x => x.Inspector).Any(g => g.Count() > 1);
|
|
|
- if (isRepeat != null && (bool)isRepeat)
|
|
|
+ if (isRepeat)
|
|
|
{
|
|
|
errorMessage.Append("验收组姓名有重复,请检查!\n");
|
|
|
}
|
|
@@ -297,9 +322,9 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 选择检验申请单行改变事件
|
|
|
- /// </summary>
|
|
|
+ ///// <summary>
|
|
|
+ ///// 选择检验申请单行改变事件
|
|
|
+ ///// </summary>
|
|
|
//[RelayCommand]
|
|
|
//private void InspectApplySelectionChanged(InspectApply inspectApply)
|
|
|
//{
|
|
@@ -323,8 +348,8 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
ReportBasis = "依据" + inspectApply.Material.NormName;
|
|
|
IsSample = true;
|
|
|
Conclusion = "合格";
|
|
|
- ReportDesc = "检验情况及主要问题";
|
|
|
- ConclusionDesc = "请录入检验结论";
|
|
|
+ ReportDesc = ReportDescOne;
|
|
|
+ ConclusionDesc = ConclusionDescTwo;
|
|
|
EditUser = App.CurrentUser.UserName;
|
|
|
}
|
|
|
|
|
@@ -336,7 +361,7 @@ namespace UniformMaterialManagementSystem.ViewModels
|
|
|
{
|
|
|
InspectionReportDetail detail = new InspectionReportDetail()
|
|
|
{
|
|
|
- SupervisionUnit = App.CurrentUser.SupervisionUnit.Name,
|
|
|
+ SupervisionUnit = App.CurrentUser!.SupervisionUnit.Name,
|
|
|
};
|
|
|
|
|
|
InspectionReportDetails.Add(detail);
|
|
@@ -383,5 +408,29 @@ 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 == "合格(初测不合格,复测合格)"))
|
|
|
+ {
|
|
|
+ ConclusionDesc = ConclusionDescTwo;
|
|
|
+ }
|
|
|
+ else if (isSample && conclusion == "不合格")
|
|
|
+ {
|
|
|
+ ConclusionDesc = ConclusionDescOne;
|
|
|
+ }
|
|
|
+ else if (!isSample && (conclusion == "合格" || conclusion == "合格(初测不合格,复测合格)"))
|
|
|
+ {
|
|
|
+ ConclusionDesc = ConclusionDescThree;
|
|
|
+ }
|
|
|
+ else if (!isSample && conclusion == "不合格")
|
|
|
+ {
|
|
|
+ ConclusionDesc = ConclusionDescFour;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|