步步为盈
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.

551 lines
17 KiB

2 years ago
using BBWY.Client.APIServices;
using BBWY.Client.Models.APIModel.Response.PackTask;
using BBWY.Client.ViewModels;
using BBWY.Client.Views.PackTask;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Input;
namespace BBWY.Client.Models
{
/// <summary>
/// 打包任务 数据绑定
/// </summary>
public class PackTaskModel : BaseVM
{
private bool isShowFees;
public bool IsShowFees { get => isShowFees; set { Set(ref isShowFees, value); } }
private long id;
public long Id { get => id; set { Set(ref id, value); } }
private readonly PackTaskService packTaskService;
2 years ago
readonly WorkProcessService workProcessService;
readonly IncreateServiceService increateServiceService;
2 years ago
public ICommand SetTaskStatusCommand { get; set; }
public ICommand PrintBarcodeCommand { get; set; }
public ICommand PrintCerCommand { get; set; }
public ICommand LookCerCommand { get; set; }
public ICommand LookBarCommand { get; set; }
public ICommand SetServiceCommand { get; set; }
2 years ago
2 years ago
public ConsumableService consumableService;
2 years ago
/// <summary>
/// 修改任务
/// </summary>
public ICommand UpdateTaskCommand { get; set; }
/// <summary>
/// 删除任务
2 years ago
/// </summary>
public ICommand DeletedTaskCommand { get; set; }
public Action ReflashTask { get; set; }
private void DeletedTask()
{
packTaskService.DeletedTask(new APIModel.Request.CreateTaskRequest
{
TaskId = TaskId
});
if (ReflashTask != null)
ReflashTask();//刷新界面
}
private void UpdateTask()
{
2 years ago
2 years ago
CreatePackTask create = new CreatePackTask();
2 years ago
2 years ago
ViewModelLocator viewModel = new ViewModelLocator();
var createViewModel = viewModel.CreateTaskView;
if (createViewModel.ReflashWindow == null)
{
createViewModel.ReflashWindow = ReflashTask;
}
2 years ago
create.SendData(this);//初始化数据
2 years ago
create.ShowDialog();
2 years ago
2 years ago
}
2 years ago
public PackTaskModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService)
{
SetTaskStatusCommand = new RelayCommand<long>(SetTaskStatus);
PrintBarcodeCommand = new RelayCommand(PrintBarcode);
PrintCerCommand = new RelayCommand(PrintCer);
LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer);
SetServiceCommand = new RelayCommand(SetService);
2 years ago
UpdateTaskCommand = new RelayCommand(UpdateTask);
DeletedTaskCommand = new RelayCommand(DeletedTask);
2 years ago
this.packTaskService = packTaskService;
this.consumableService = consumableService;
this.workProcessService = workProcessService;
this.increateServiceService = increateServiceService;
}
private void SetService()
{
2 years ago
ServiceWindow service = new ServiceWindow();
2 years ago
//加载数据
2 years ago
ViewModelLocator viewModelLocator = new ViewModelLocator();
var serviceViewModel = viewModelLocator.PackServiceList;
serviceViewModel.TaskCount = SkuCount;
serviceViewModel.TaskId = TaskId;
serviceViewModel.LoadPackDatas();
serviceViewModel.SetAllFees = new Action<FeesItemResponse, List<string>>((feesItem, packUsers) =>
{
FeesItemResponse = feesItem;
PackUser = string.Join("\r\n", packUsers);
IsShowFees = feesItem.AllFees > 0 ? true : false;
});
2 years ago
service.Show();
}
/// <summary>
/// 查看合格证
/// </summary>
private void LookCer()
{
if (CertificateModel == null)
{
new TipsWindow("该任务无设置合格证信息,无法查看!").ShowDialog();
return;
}
LookCerWindow lookCerWindow = new LookCerWindow(CertificateModel);
lookCerWindow.Show();
}
/// <summary>
/// 查看条形码
/// </summary>
private void LookBar()
{
if (BarCodeModel == null)
{
new TipsWindow("该任务无设置条形码信息,无法查看!").ShowDialog();
return;
}
LookBarCodeWindow look = new LookBarCodeWindow(new BarCodeModel
{
Brand = BarCodeModel.Brand,
BrandName = BarCodeModel.BrandName,
LabelModel = BarCodeModel.LabelModel,
ProductNo = BarCodeModel.ProductNo,
SkuId = BarCodeModel.SkuId,
SkuName = BarCodeModel.SkuName
});
look.Show();
}
private void PrintCer()
{
if (CertificateModel == null)
{
2 years ago
new TipsWindow("该任务无设置合格证信息,无法打印!").Show();
2 years ago
return;
}
PrintWindow printWindow = new PrintWindow();
2 years ago
printWindow.CertificateModel = certificateModel;
2 years ago
printWindow.LoadData();
2 years ago
//printWindow.Datas = LoadCerLabelModels();
2 years ago
printWindow.Show();
}
/// <summary>
/// 打印条形码
/// </summary>
private void PrintBarcode()
{
if (BarCodeModel == null)
{
2 years ago
new TipsWindow("该任务无设置条形码信息,无法打印!").Show();
2 years ago
return;
}
2 years ago
PrintWindow printWindow = new PrintWindow();
2 years ago
printWindow.barCodeModel = new BarCodeModel
{
Brand = BarCodeModel.Brand,
BrandName = BarCodeModel.BrandName,
LabelModel = BarCodeModel.LabelModel,
ProductNo = BarCodeModel.ProductNo,
SkuId = BarCodeModel.SkuId,
SkuName = BarCodeModel.SkuName
};
printWindow.LoadData();
2 years ago
//printWindow.Datas = LoadBarLabelModels();
2 years ago
printWindow.Show();
}
public void SetTaskStatus(long taskId)
{
if (this.TaskStatus == TaskStateType.)
{
return;
}
///修改完成
var model = packTaskService.UpdateTaskStatus(taskId, 1);
if (model != null && model.Success)
{
this.TaskStatus = TaskStateType.;
2 years ago
new TipsWindow("修改成功").Show();
2 years ago
}
}
2 years ago
/*
public Dictionary<string, string> LoadBarLabelModels()
{
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("pinming", $"品名: {BarCodeModel.BrandName}");
data.Add("guige", $"规格: {BarCodeModel.SkuName}");
data.Add("pop", $"POP{BarCodeModel.SkuId}");
switch (BarCodeModel.LabelModel)
{
case BarcodeLabelModel.barstander:
data.Add("pinpai", $"品牌: {BarCodeModel.Brand}");
data.Add("xinghao", $"型号: {BarCodeModel.ProductNo}");
return data;
case BarcodeLabelModel.barsimplify:
return data;
default:
break;
}
return data;
}
public Dictionary<string, string> LoadCerLabelModels()
{
Dictionary<string, string> data = new Dictionary<string, string>();
data.Add("pinming", $"品名: {CertificateModel.BrandName}");
data.Add("pinpai", $"品牌: {CertificateModel.Brand}");
data.Add("xinghao", $"型号: {CertificateModel.ProductNo}");
data.Add("dizhi", $"地址: {CertificateModel.ProductAdress}");
data.Add("caizhi", $"材质: {CertificateModel.Shader}");
data.Add("changshang", $"生产商: {CertificateModel.ProductShop}");
switch (CertificateModel.IsLogo)
{
case 0://无图
data.Add("gongchangid", $"无");
break;
case 1://有图
data.Add("gongchangid", $"{CertificateModel.FactoryNumber}");
break;
default:
break;
}
string[] excutes = CertificateModel.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries);
StringBuilder sb = new StringBuilder();
sb.Append("执行标准: ");
for (int i = 0; i < excutes.Count(); i++)
{
if (i % 2 == 0 && i > 0)//间隔两个换行
{
sb.Append("\r\n").Append(" ");
}
sb.Append(excutes[i]).Append(" ");
}
sb.Remove(sb.Length - 3, 3);
data.Add("biaozhun", sb.ToString());
return data;
}
*/
2 years ago
private DateTime endTime;
/// <summary>
/// 提交时间
/// </summary>
public DateTime EndTime { get => endTime; set { Set(ref endTime, value); } }
private long taskId;
/// <summary>
2 years ago
/// 任务id
2 years ago
/// </summary>
public long TaskId { get => taskId; set { Set(ref taskId, value); } }
private string departmentName;
/// <summary>
/// 部门名称
/// </summary>
public string DepartmentName { get => departmentName; set { Set(ref departmentName, value); } }
private string acceptName;
/// <summary>
/// 对接人
/// </summary>
public string AcceptName { get => acceptName; set { Set(ref acceptName, value); } }
private int skuCount;
/// <summary>
/// sku数量
/// </summary>
public int SkuCount { get => skuCount; set { Set(ref skuCount, value); } }
private TaskState availability;
/// <summary>
/// 到货情况(待收货=0,部分收货=1,已到货=2)
/// </summary>
public TaskState Availability { get => availability; set { Set(ref availability, value); } }
2 years ago
private Worry isWorry;
/// <summary>
/// 到货情况(待收货=0,部分收货=1,已到货=2)
/// </summary>
public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } }
2 years ago
private TaskStateType taskStatus;
/// <summary>
/// 任务状态(未完成=0,已完成=1)
/// </summary>
public TaskStateType TaskStatus { get => taskStatus; set { Set(ref taskStatus, value); } }
private PackType packType;
/// <summary>
/// 打包类型(单件=0,多件=1)
/// </summary>
public PackType PackType { get => packType; set { Set(ref packType, value); } }
private int goodsNumber;
/// <summary>
/// 配件数
/// </summary>
public int GoodsNumber { get => goodsNumber; set { Set(ref goodsNumber, value); } }
private string skuTitle;
/// <summary>
/// sku配件商品名称
/// </summary>
public string SkuTitle { get => skuTitle; set { Set(ref skuTitle, value); } }
private BasicPack basicPack;
/// <summary>
/// 基础包装(快递袋=0,纸箱=1,麻袋=2)
/// </summary>
public BasicPack BasicPack { get => basicPack; set { Set(ref basicPack, value); } }
private string increment1;
/// <summary>
/// 增量1()
/// </summary>
public string Increment1 { get => increment1; set { Set(ref increment1, value); } }
private Increment increment2;
/// <summary>
/// 增量2()
/// </summary>
public Increment Increment2 { get => increment2; set { Set(ref increment2, value); } }
private PositionType positionType;
/// <summary>
/// 落仓(本地仓=0,齐越仓=1,京东仓=2)
/// </summary>
public PositionType PositionType { get => positionType; set { Set(ref positionType, value); } }
#region 条形码数据
/// <summary>
/// 条形码id
/// </summary>
public long BarCodeId { get; set; }
/// <summary>
/// 标签模板
/// </summary>
public BarcodeLabelModel LabelModel { get; set; }
private string brand;
/// <summary>
/// 品牌
/// </summary>
public string Brand { get => brand; set { Set(ref brand, value); } }
private string brandName;
/// <summary>
/// 品名
/// </summary>
public string BrandName { get => brandName; set { Set(ref brandName, value); } }
private string producNo;
/// <summary>
/// 货号
/// </summary>
public string ProductNo { get => producNo; set { Set(ref producNo, value); } }
private string skuName;
/// <summary>
/// sku名称
/// </summary>
public string SkuName { get => skuName; set { Set(ref skuName, value); } }
private string skuId;
/// <summary>
/// skuId(条形码号=POP+SkuId)
/// </summary>
public string SkuId { get => skuId; set { Set(ref skuId, value); } }
private string modelNo;
/// <summary>
/// 型号
/// </summary>
public string ModelNo { get => modelNo; set { Set(ref modelNo, value); } }
#endregion
private BarCodeModel barCodeModel;
/// <summary>
/// 合格证
/// </summary>
public BarCodeModel BarCodeModel { get => barCodeModel; set { Set(ref barCodeModel, value); } }
private CertificateModel certificateModel;
/// <summary>
/// 合格证
/// </summary>
public CertificateModel CertificateModel { get => certificateModel; set { Set(ref certificateModel, value); } }
/// <summary>
/// 合格证位置(外部包装=0,产品包装=1)
/// </summary>
private CertificatePosition certificatePosition;
/// <summary>
/// 合格证位置(外部包装=0,产品包装=1)
/// </summary>
public CertificatePosition CertificatePosition { get => certificatePosition; set { Set(ref certificatePosition, value); } }
/// <summary>
/// 注意事项(对接备注)
/// </summary>
private string markMessage;
/// <summary>
/// 注意事项(对接备注)
/// </summary>
public string MarkMessage { get => markMessage; set { Set(ref markMessage, value); } }
/// <summary>
/// 服务收费 (单个任务id 消耗的总费用)
/// </summary>
private decimal feesMoney;
/// <summary>
/// 服务收费 (单个任务id 消耗的总费用)
/// </summary>
public decimal FeesMoney { get => feesMoney; set { Set(ref feesMoney, value); } }
/// <summary>
/// 打包员
/// </summary>
private string packUser;
/// <summary>
/// 打包员
/// </summary>
public string PackUser { get => packUser; set { Set(ref packUser, value); } }
//public FeesItemTypeDTO FeesItemTypeDTO { get; set; }
private FeesItemResponse feesItemResponse;
public FeesItemResponse FeesItemResponse { get => feesItemResponse; set { Set(ref feesItemResponse, value); } }
public IList<SkuMessage> ItemList { get; set; }
}
public class SkuMessage : NotifyObject
{
2 years ago
private string id;
2 years ago
2 years ago
public string Id { get => id; set { Set(ref id, value); } }
2 years ago
/// <summary>
/// 店铺Sku图链接
/// </summary>
private string logo;
/// <summary>
/// 店铺Sku图链接
/// </summary>
public string Logo { get => logo; set { Set(ref logo, value); } }
/// <summary>
/// 采购Sku名称
/// </summary>
private string skuName;
/// <summary>
/// 采购Sku名称
/// </summary>
public string SkuName { get => skuName; set { Set(ref skuName, value); } }
/// <summary>
/// 货号品名(手写上传)
/// </summary>
private string brandName;
/// <summary>
/// 货号品名(手写上传)
/// </summary>
public string BrandName { get => brandName; set { Set(ref brandName, value); } }
/// <summary>
/// 需求方店铺id
/// </summary>
private string shopName;
/// <summary>
/// 需求方店铺id
/// </summary>
public string ShopName { get => shopName; set { Set(ref shopName, value); } }
/// <summary>
/// 货号
/// </summary>
private string goodsNo;
/// <summary>
/// 货号
/// </summary>
public string GoodsNo { get => goodsNo; set { Set(ref goodsNo, value); } }
}
}