|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using AduSkin.Controls.Metro;
|
|
|
|
|
using AduSkin.Controls;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
|
using Prism.Events;
|
|
|
|
|
using SlnMesnac.Model.domain;
|
|
|
|
@ -12,6 +14,7 @@ using System.Collections.ObjectModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using static MaterialDesignThemes.Wpf.Theme.ToolBar;
|
|
|
|
|
|
|
|
|
|
namespace SlnMesnac.WPF.ViewModel.ProductDetails
|
|
|
|
@ -150,62 +153,108 @@ namespace SlnMesnac.WPF.ViewModel.ProductDetails
|
|
|
|
|
[RelayCommand]
|
|
|
|
|
private void SavePrdouctInfo()
|
|
|
|
|
{
|
|
|
|
|
var info = ProductInfo;
|
|
|
|
|
|
|
|
|
|
if(info != null)
|
|
|
|
|
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
|
|
|
|
|
{
|
|
|
|
|
info.productImage = productImage;
|
|
|
|
|
info.featureImage = featureImage;
|
|
|
|
|
info.analyzeImage = analyzeImage;
|
|
|
|
|
info.sizeLeftImage = sizeLeftImage;
|
|
|
|
|
info.sizeRightImage = sizeRightImage;
|
|
|
|
|
_product_infoServices.Update(info);
|
|
|
|
|
Title = "通知",
|
|
|
|
|
Content = $"保存产品信息",
|
|
|
|
|
NotifiactionType = EnumPromptType.Success
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var productFeatureInfo = ProductFeature.ToList();
|
|
|
|
|
//productFeatureInfo.ToList().ForEach(x => x.productCode = info.productCode);
|
|
|
|
|
|
|
|
|
|
foreach(var item in productFeatureInfo)
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
item.productCode = info.productCode;
|
|
|
|
|
if (item.objid != 0)
|
|
|
|
|
var info = ProductInfo;
|
|
|
|
|
|
|
|
|
|
if (info != null)
|
|
|
|
|
{
|
|
|
|
|
_product_featureServices.Update(item);
|
|
|
|
|
info.productImage = productImage;
|
|
|
|
|
info.featureImage = featureImage;
|
|
|
|
|
info.analyzeImage = analyzeImage;
|
|
|
|
|
info.sizeLeftImage = sizeLeftImage;
|
|
|
|
|
info.sizeRightImage = sizeRightImage;
|
|
|
|
|
_product_infoServices.Update(info);
|
|
|
|
|
|
|
|
|
|
var productFeatureInfo = ProductFeature.ToList();
|
|
|
|
|
//productFeatureInfo.ToList().ForEach(x => x.productCode = info.productCode);
|
|
|
|
|
|
|
|
|
|
foreach (var item in productFeatureInfo)
|
|
|
|
|
{
|
|
|
|
|
item.productCode = info.productCode;
|
|
|
|
|
if (item.objid != 0)
|
|
|
|
|
{
|
|
|
|
|
_product_featureServices.Update(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_product_featureServices.Insert(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var productDescribeInfo = ProductDescribe.ToList();
|
|
|
|
|
//productDescribeInfo.ToList().ForEach(x => x.productCode = info.productCode);
|
|
|
|
|
foreach (var item in productDescribeInfo)
|
|
|
|
|
{
|
|
|
|
|
item.productCode = info.productCode;
|
|
|
|
|
if (item.objid != 0)
|
|
|
|
|
{
|
|
|
|
|
_product_describeServices.Update(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_product_describeServices.Insert(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var productParamsInfo = ProductParams.ToList();
|
|
|
|
|
//productParamsInfo.ToList().ForEach(x => x.productCode = info.productCode);
|
|
|
|
|
foreach (var item in productParamsInfo)
|
|
|
|
|
{
|
|
|
|
|
item.productCode = info.productCode;
|
|
|
|
|
if (item.objid != 0)
|
|
|
|
|
{
|
|
|
|
|
_product_paramServices.Update(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_product_paramServices.Insert(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
|
|
|
|
|
{
|
|
|
|
|
Title = "通知",
|
|
|
|
|
Content = $"{info.productName}产品信息更新完成",
|
|
|
|
|
NotifiactionType = EnumPromptType.Success
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_product_featureServices.Insert(item);
|
|
|
|
|
App.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
|
|
|
|
|
{
|
|
|
|
|
Title = "通知",
|
|
|
|
|
Content = $"产品信息保存失败,基本信息为空",
|
|
|
|
|
NotifiactionType = EnumPromptType.Error
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var productDescribeInfo = ProductDescribe.ToList();
|
|
|
|
|
//productDescribeInfo.ToList().ForEach(x => x.productCode = info.productCode);
|
|
|
|
|
foreach (var item in productDescribeInfo)
|
|
|
|
|
{
|
|
|
|
|
item.productCode = info.productCode;
|
|
|
|
|
if (item.objid != 0)
|
|
|
|
|
{
|
|
|
|
|
_product_describeServices.Update(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_product_describeServices.Insert(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var productParamsInfo = ProductParams.ToList();
|
|
|
|
|
//productParamsInfo.ToList().ForEach(x => x.productCode = info.productCode);
|
|
|
|
|
foreach (var item in productParamsInfo)
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
|
|
|
|
|
{
|
|
|
|
|
item.productCode = info.productCode;
|
|
|
|
|
if (item.objid != 0)
|
|
|
|
|
{
|
|
|
|
|
_product_paramServices.Update(item);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_product_paramServices.Insert(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Title = "通知",
|
|
|
|
|
Content = $"产品信息保存异常:{ex.Message}",
|
|
|
|
|
NotifiactionType = EnumPromptType.Error
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|