You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
226 lines
9.9 KiB
226 lines
9.9 KiB
using BBWY.Client.Models.SealBox;
|
|
using BBWY.Client.ViewModels.SealBox;
|
|
using BBWY.Controls;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Collections.ObjectModel;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
using AutoMapper.Internal;
|
|
using BBWY.Client.APIServices;
|
|
using MathNet.Numerics.LinearAlgebra.Factorization;
|
|
|
|
namespace BBWY.Client.Views.SealBox
|
|
{
|
|
/// <summary>
|
|
/// SetSealBoxPolicyWindow.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class SetSealBoxPolicyWindow : BWindow
|
|
{
|
|
public SetSealBoxPolicyWindow(IList<SealBoxConfigureModel> sealBoxWaitConfigureModels, Action ReflashWindow, long sealboxId = 0)
|
|
{
|
|
InitializeComponent();
|
|
var sealBoxConfigureVM = this.DataContext as SealBoxConfigureViewModel;
|
|
sealBoxConfigureVM.SealBoxConfigureModelList = sealBoxWaitConfigureModels.ToList();
|
|
sealBoxConfigureVM.JdConfigureModelList = new ObservableCollection<SealBoxConfigureModel>();
|
|
sealBoxConfigureVM.CloudConfigureModelList = new ObservableCollection<SealBoxConfigureModel>();
|
|
sealBoxConfigureVM.JstConfigureModelList = new ObservableCollection<SealBoxConfigureModel>();
|
|
sealBoxConfigureVM.StoreConfigureModelList = new ObservableCollection<SealBoxConfigureModel>();
|
|
sealBoxConfigureVM.SealBoxId = sealboxId;
|
|
sealBoxConfigureVM.ReflashWindow = ReflashWindow;
|
|
LoadData(sealBoxWaitConfigureModels, sealboxId, sealBoxConfigureVM);
|
|
|
|
sealBoxConfigureVM.LoadCount();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载数据
|
|
/// </summary>
|
|
/// <param name="sealBoxWaitConfigureModels"></param>
|
|
/// <param name="sealboxId"></param>
|
|
/// <param name="sealBoxConfigureVM"></param>
|
|
private void LoadData(IList<SealBoxConfigureModel> sealBoxWaitConfigureModels, long sealboxId, SealBoxConfigureViewModel sealBoxConfigureVM)
|
|
{
|
|
|
|
|
|
if (sealboxId == 0)//设置
|
|
{
|
|
sealBoxConfigureVM.JstWareHourseHeaderList = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
new SealBoxConfigureWareHourseModel{
|
|
WareName = "齐越聚水潭",WareId="qiyuejushuitan"
|
|
}
|
|
};
|
|
var storeListRes = sealBoxConfigureVM.logisticsService.GetStoreList();
|
|
|
|
if (storeListRes.Success)
|
|
{
|
|
//加载商家仓 全国仓
|
|
var storeList = storeListRes.Data.Where(s=>s.Status== Models.StockStatus.使用);
|
|
|
|
var store = storeList.FirstOrDefault(s => s.Id == "0");//商家全国仓
|
|
if (store != null)
|
|
{
|
|
sealBoxConfigureVM.StoreWareHourseHeaderList = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
new SealBoxConfigureWareHourseModel{
|
|
WareName = store.Name,WareId=store.Id
|
|
}
|
|
};
|
|
}
|
|
|
|
|
|
//加载 泉州齐越云仓3号库
|
|
var cloud = storeList.FirstOrDefault(s => s.Id == "800009450");//商家全国仓
|
|
if (cloud != null)
|
|
{
|
|
sealBoxConfigureVM.CloudWareHourseHeaderList = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
new SealBoxConfigureWareHourseModel{
|
|
WareName = cloud.Name,WareId=cloud.Id
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
//sealBoxConfigureVM.CloudWareHourseHeaderList = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
// new SealBoxConfigureWareHourseModel{
|
|
// WareName = "泉州齐越云仓3号库",WareId="800009450"
|
|
// }
|
|
//};
|
|
}
|
|
|
|
|
|
|
|
foreach (var sealBoxWaitConfigureModel in sealBoxWaitConfigureModels)
|
|
{
|
|
if (sealBoxWaitConfigureModel.WareHourseDatas != null && sealBoxWaitConfigureModel.WareHourseDatas.Count > 0)//修改数据
|
|
{
|
|
sealBoxWaitConfigureModel.WaitConfigureCount = 0;
|
|
sealBoxWaitConfigureModel.WareHourseDatas.ForAll(w => { w.TotalWareCount = sealBoxConfigureVM.TotalCount; w.TaskId = sealBoxWaitConfigureModel.TaskId; });
|
|
}
|
|
else
|
|
{
|
|
sealBoxWaitConfigureModel.WaitConfigureCount = sealBoxWaitConfigureModel.SkuCount;
|
|
}
|
|
|
|
|
|
switch (sealBoxWaitConfigureModel.WareType.Value)
|
|
{
|
|
case Models.WareType.商家仓:
|
|
|
|
if (sealboxId == 0)
|
|
{
|
|
if (sealBoxConfigureVM.StoreWareHourseHeaderList != null && sealBoxConfigureVM.StoreWareHourseHeaderList.Count > 0)
|
|
{
|
|
sealBoxConfigureVM.StoreWareHourseHeaderList.ForAll(s =>
|
|
{
|
|
|
|
sealBoxWaitConfigureModel.WareHourseDatas = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
new SealBoxConfigureWareHourseModel{
|
|
WareName = s.WareName,
|
|
WareId=s.WareId,
|
|
TaskId=sealBoxWaitConfigureModel.TaskId,
|
|
TaskIdRemark=sealBoxWaitConfigureModel.TaskIdRemark,
|
|
TotalWareCount=sealBoxConfigureVM.TotalCount,
|
|
|
|
}
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
sealBoxConfigureVM.StoreConfigureModelList.Add(sealBoxWaitConfigureModel);
|
|
sealBoxConfigureVM.StoreWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas;
|
|
break;
|
|
case Models.WareType.云仓:
|
|
if (sealboxId == 0)
|
|
{
|
|
if (sealBoxConfigureVM.CloudWareHourseHeaderList != null && sealBoxConfigureVM.CloudWareHourseHeaderList.Count > 0)
|
|
{
|
|
sealBoxConfigureVM.CloudWareHourseHeaderList.ForAll(s =>
|
|
{
|
|
|
|
sealBoxWaitConfigureModel.WareHourseDatas = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
new SealBoxConfigureWareHourseModel{
|
|
WareName = s.WareName,
|
|
WareId=s.WareId,
|
|
TaskId=sealBoxWaitConfigureModel.TaskId,
|
|
TaskIdRemark=sealBoxWaitConfigureModel.TaskIdRemark,
|
|
TotalWareCount=sealBoxConfigureVM.TotalCount,
|
|
|
|
}
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
sealBoxConfigureVM.CloudConfigureModelList.Add(sealBoxWaitConfigureModel);
|
|
sealBoxConfigureVM.CloudWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas;
|
|
break;
|
|
case Models.WareType.京仓:
|
|
sealBoxConfigureVM.JdConfigureModelList.Add(sealBoxWaitConfigureModel);
|
|
sealBoxConfigureVM.JdWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas;
|
|
break;
|
|
case Models.WareType.聚水潭:
|
|
sealBoxConfigureVM.JstConfigureModelList.Add(sealBoxWaitConfigureModel);
|
|
if (sealboxId == 0)
|
|
{
|
|
sealBoxWaitConfigureModel.WareHourseDatas = new ObservableCollection<SealBoxConfigureWareHourseModel> {
|
|
new SealBoxConfigureWareHourseModel{
|
|
WareName = "齐越聚水潭",WareId="qiyuejushuitan", TaskId=sealBoxWaitConfigureModel.TaskId, TotalWareCount=sealBoxConfigureVM.TotalCount,
|
|
|
|
}
|
|
};
|
|
}
|
|
|
|
sealBoxConfigureVM.JstWareHourseHeaderList = sealBoxWaitConfigureModel.WareHourseDatas;
|
|
|
|
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void list_sealbox_jddata_ScrollChanged(object sender, ScrollChangedEventArgs e)
|
|
{
|
|
System.Windows.Controls.ScrollViewer sv = e.OriginalSource as System.Windows.Controls. ScrollViewer;
|
|
|
|
if (sv != null)
|
|
{
|
|
jd_header.ScrollToHorizontalOffset(sv.HorizontalOffset);
|
|
}
|
|
|
|
//if (e.HorizontalChange != 0)
|
|
//{
|
|
|
|
|
|
// ScrollViewer sv = e.OriginalSource as ScrollViewer;
|
|
|
|
// if (sv != null)
|
|
// {
|
|
// jd_header.ScrollToVerticalOffset(sv.VerticalOffset);
|
|
// }
|
|
|
|
// double offset = this.list_sealbox_jddata;
|
|
// this.scrollViewer2.ScrollToVerticalOffset(offset);
|
|
// jd_header.ScrollIntoView(jd_header.SelectedItem);
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
|