|
|
|
@ -2,13 +2,16 @@
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
using Aucma.Core.ProductOffLine.Models;
|
|
|
|
|
using Aucma.Core.ProductOffLine.Views;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using NPOI.POIFS.Properties;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
@ -24,47 +27,86 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public partial class SelectQualityViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public ICommand QueryCommand { get; set; }
|
|
|
|
|
public ICommand SaveCommand { get; set; }
|
|
|
|
|
private readonly IBaseQualityInspectionItemInfoServices? _baseQualityInspectionItemInfoServices;
|
|
|
|
|
|
|
|
|
|
public SelectQualityViewModel()
|
|
|
|
|
{
|
|
|
|
|
_baseQualityInspectionItemInfoServices = App.ServiceProvider.GetService<IBaseQualityInspectionItemInfoServices>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices;
|
|
|
|
|
public SelectQualityViewModel() {
|
|
|
|
|
_baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
|
|
|
|
|
QueryCommand = new RelayCommand(ExecuteQuery);
|
|
|
|
|
SaveCommand = new RelayCommand(ExecuteSave);
|
|
|
|
|
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 3.查询BASE_MATERIALINFO表存在的成品类型以供修改
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Init()
|
|
|
|
|
public async void Init()
|
|
|
|
|
{
|
|
|
|
|
ExecuteQuery();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void ExecuteQuery()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
List<BaseQualityInspectionItemInfo> list = await _baseQualityInspectionItemInfoServices.query();
|
|
|
|
|
qualityItemGrid.Clear();
|
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
qualityItemGrid.Add(new QualityInspectionModel() { No = i + 1, ObjId = list[i].ObjId, QualityDefectCode = list[i].QualityDefectCode, QualityDefectName = list[i].QualityDefectName, IsInSpection = list[i].IsInSpection == "0" ? "否" : "是" });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void ExecuteSave()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
List<BaseQualityInspectionItemInfo> list = new List<BaseQualityInspectionItemInfo>();
|
|
|
|
|
// 处理保存按钮点击事件
|
|
|
|
|
foreach (QualityInspectionModel item in qualityItemGrid)
|
|
|
|
|
{
|
|
|
|
|
if ((!"是".Equals(item.IsInSpection) && !"否".Equals(item.IsInSpection)))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("质检编号:" + item.QualityDefectCode + " 质检名称:" + item.QualityDefectName + " 是否质检应该是或者否");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
list.Add(new BaseQualityInspectionItemInfo()
|
|
|
|
|
{
|
|
|
|
|
ObjId = item.ObjId,
|
|
|
|
|
QualityDefectCode = item.QualityDefectCode,
|
|
|
|
|
QualityDefectName = item.QualityDefectName,
|
|
|
|
|
ParentId = "0",
|
|
|
|
|
IsFlag = 0,
|
|
|
|
|
IsInSpection = item.IsInSpection == "是" ? "1" : "0"
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
bool result = await _baseQualityInspectionItemInfoServices.UpdateAsync(list);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("保存成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("保存失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 初始化datagrid
|
|
|
|
|
private ObservableCollection<DirectionEditModel> materialDataGrid = new ObservableCollection<DirectionEditModel>();
|
|
|
|
|
public ObservableCollection<DirectionEditModel> MaterialDataGrid
|
|
|
|
|
private ObservableCollection<QualityInspectionModel> qualityItemGrid = new ObservableCollection<QualityInspectionModel>();
|
|
|
|
|
public ObservableCollection<QualityInspectionModel> QualityItemGrid
|
|
|
|
|
{
|
|
|
|
|
get { return materialDataGrid; }
|
|
|
|
|
get { return qualityItemGrid; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
materialDataGrid = value;
|
|
|
|
|
qualityItemGrid = value;
|
|
|
|
|
OnPropertyChanged();//属性通知
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|