连坤 林 2 years ago
parent
commit
68067ba19e
  1. 16
      BBWY.Client/APIServices/PackTaskService.cs
  2. 15
      BBWY.Client/App.xaml.cs
  3. 32
      BBWY.Client/BBWY.Client.csproj
  4. 668
      BBWY.Client/Helpers/BartenderHelper.cs
  5. 183
      BBWY.Client/Helpers/MyPrintHelper.cs
  6. 2
      BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs
  7. 11
      BBWY.Client/Models/APIModel/Response/PackTask/PackTaskResultResponse.cs
  8. 6
      BBWY.Client/Models/PackTask/IncreateServiceModel.cs
  9. 59
      BBWY.Client/Models/PackTask/PackTaskModel.cs
  10. BIN
      BBWY.Client/Resources/LabelNames/Cer3CDouble.btw
  11. BIN
      BBWY.Client/Resources/LabelNames/Cer3CSingle.btw
  12. BIN
      BBWY.Client/Resources/LabelNames/CerStanderDouble.btw
  13. BIN
      BBWY.Client/Resources/LabelNames/CerStanderSingle.btw
  14. BIN
      BBWY.Client/Resources/LabelNames/barsimplify.btw
  15. BIN
      BBWY.Client/Resources/LabelNames/barstander.btw
  16. 50
      BBWY.Client/ViewModels/MainViewModel.cs
  17. 6
      BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs
  18. 221
      BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs
  19. 113
      BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs
  20. 232
      BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs
  21. 52
      BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs
  22. 46
      BBWY.Client/ViewModels/ViewModelLocator.cs
  23. 2
      BBWY.Client/Views/MainWindow.xaml
  24. 2
      BBWY.Client/Views/PackTask/CreatePackTask.xaml
  25. 7
      BBWY.Client/Views/PackTask/CreatePackTask.xaml.cs
  26. 4
      BBWY.Client/Views/PackTask/LookCerWindow.xaml
  27. 2
      BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs
  28. 4
      BBWY.Client/Views/PackTask/PrintWindow.xaml
  29. 76
      BBWY.Client/Views/PackTask/PrintWindow.xaml.cs
  30. 13
      BBWY.Client/Views/PackTask/ServiceWindow.xaml
  31. 8
      BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs
  32. 4
      BBWY.Client/Views/PackTask/SetBarCode.xaml
  33. 6
      BBWY.Client/Views/PackTask/SetCerWindow.xaml
  34. 23
      BBWY.Client/Views/PackTask/TaskListControl.xaml
  35. 21
      BBWY.Client/Views/PackTask/WareHouseListControl.xaml

16
BBWY.Client/APIServices/PackTaskService.cs

@ -101,6 +101,22 @@ namespace BBWY.Client.APIServices
return JsonConvert.DeserializeObject<ApiResponse<ProductSkuResponse>>(data);
}
public ApiResponse<object> UpdateTask(CreateTaskRequest createTaskRequest)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/UpdatePackTask",
createTaskRequest
, null, HttpMethod.Post);
}
public ApiResponse<object> DeletedTask(CreateTaskRequest createTaskRequest)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/DeletedPackTask",
createTaskRequest
, null, HttpMethod.Post);
}
public ApiResponse<object> CreateTask(CreateTaskRequest createTaskRequest)
{
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/CreatePackTask",

15
BBWY.Client/App.xaml.cs

@ -41,23 +41,16 @@ namespace BBWY.Client
{
var isAdmin = IsAdministrator();
Console.WriteLine($"run as admin : {isAdmin}");
//System.Diagnostics.Debug.WriteLine($"run as admin : {isAdmin}");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var gl = new GlobalContext();
string userToken = string.Empty;
//var tokenResult = ReadMMF();
//if (tokenResult.isOk)
// userToken = tokenResult.content;
//else
//{
// MessageBox.Show($"读取内存数据失败\r\n{tokenResult.content}", "提示");
// Environment.Exit(0);
//}
#if DEBUG
//仓库组测试
// userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjM1OTMyMDAyMjcwMDU2NDQ4IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0IiwiZXhwIjoxNzEwNDk2NTQ1fQ.Sx2vGJcYGf98x99slQLU3vt7yWdjspptSpbUCcZgWek";
// userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjM1OTMyMDAyMjcwMDU2NDQ4IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0IiwiZXhwIjoxNzEwNDk2NTQ1fQ.Sx2vGJcYGf98x99slQLU3vt7yWdjspptSpbUCcZgWek";
//齐越山鸡
userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTM1MzMwMzI4ODkyMTQ5NzYwIiwidGVhbUlkIjoiMTUxNjk3NDI1MDU0MjUwMTg4OCIsInNvblRlYW1JZHMiOiIxNDM2Mjg4NTAwMjM1MjQzNTIwIiwiZXhwIjoxNjk0NjY5NjkxfQ.cSwro-7bGwOu92YejH9JhMenTai7Mvf99i2paQCmxIw";
@ -112,7 +105,7 @@ namespace BBWY.Client
IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient();
serviceCollection.AddTransient<CreatePackTaskViewModel>();
// serviceCollection.AddTransient<CreatePackTaskViewModel>();
serviceCollection.AddHttpClient("gzip").ConfigurePrimaryHttpMessageHandler(handler => new HttpClientHandler()
{
AutomaticDecompression = System.Net.DecompressionMethods.GZip

32
BBWY.Client/BBWY.Client.csproj

@ -18,7 +18,6 @@
<ItemGroup>
<None Remove="BBWYAppSettings.json" />
<None Remove="Resources\Images\3c.png" />
<None Remove="Resources\Images\barcode.png" />
<None Remove="Resources\Images\defaultItem.png" />
</ItemGroup>
@ -27,9 +26,6 @@
<Content Include="BBWYAppSettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\Images\3c.png">
<CopyToOutputDirectory></CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Images\barcode.png">
<CopyToOutputDirectory></CopyToOutputDirectory>
</Resource>
@ -37,6 +33,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BarcodeLib" Version="2.4.0" />
<PackageReference Include="HandyControl" Version="3.3.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.28" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
@ -60,12 +57,6 @@
<ProjectReference Include="..\QuanTan.SDK\QuanTan.SDK.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Interop.BarTender">
<HintPath>..\dll\Interop.BarTender.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\defaultItem.png">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
@ -85,24 +76,13 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Update="Resources\LabelNames\barsimplify.btw">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\LabelNames\barstander.btw">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\LabelNames\Cer3CDouble.btw">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\LabelNames\Cer3CSingle.btw">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\LabelNames\CerStanderDouble.btw">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\LabelNames\CerStanderSingle.btw">
<None Update="Resources\Images\3c.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\LabelNames\" />
</ItemGroup>
</Project>

668
BBWY.Client/Helpers/BartenderHelper.cs

@ -1,327 +1,341 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
namespace BBWY.Client.Helpers
{
public class BartenderHelper
{
#region BarTender打印方法
private static BarTender.Application btApp = new BarTender.Application();
private static BarTender.Format btFormat = new BarTender.Format();
public string TemplateFile { set; get; }
public string ErrorMsg { set; get; }
public bool Status { set; get; }
/// <summary>
/// 使用 BarTender进行打印,批量打印
/// </summary>
/// <param name="labelName"> BarTender模板标签</param>
/// <param name="labelParamsValuesList">打印数据</param>
/// <param name="msg">回调消息</param>
/// <param name="printQty">打印数量</param>
/// <returns>打印OK true</returns>
public bool BTPrint(string labelName, Dictionary<string, string> labelParamsValues, out string msg, int printQty = 1, string printer = "Deli DL-730C(NEW)")
{
try
{
bool checkLabelVar = true;
string tmpMsg = "";
this.TemplateFile = labelName;
if (!File.Exists(TemplateFile))
{
msg = "Error:Label File Not Exists" + TemplateFile;
this.ErrorMsg = msg;
return false;
}
if (!string.IsNullOrEmpty(printer))
{
bool printerFlag = false;
foreach (string sPrint in System.Drawing.Printing.PrinterSettings.InstalledPrinters)//获取所有打印机名称
{
if (sPrint.Equals(printer))
{
printerFlag = true;
}
}
if (!printerFlag)
{
msg = "Error:Printer Name Error";
return false;
}
}
//找到打印模板的标签页
btFormat = btApp.Formats.Open(labelName, false, "");
if (!string.IsNullOrEmpty(printer))
{
btFormat.Printer = printer;
}
if (btApp != null)
{
//btFormat.IdenticalCopiesOfLabel = printQty;
//btFormat.PrintOut(true, false);
//取模板所有的值
string strBT = btFormat.NamedSubStrings.GetAll("#", "$");
//将模板所有值进行拆分
strBT = strBT.Substring(0, strBT.Length - 1);
string[] strBTValue = strBT.Split(new char[] { '$' });
//循环将模板的值写入lbldicVar中
Dictionary<string, string> lbldicVar = new Dictionary<string, string>();
for (int i = 0; i < strBTValue.Length; i++)
{
string[] cc = strBTValue[i].Split(new char[] { '#' });
lbldicVar.Add(cc[0].ToString(), cc[1].ToString()); //0是模板的参数 1是参数值
}
if (labelParamsValues.Count > 0)
{
foreach (var item in lbldicVar)
{
if (labelParamsValues.Count(q => q.Key.ToUpper() == item.Key.ToUpper()) == 0)
{
tmpMsg = "数据源缺少参数: " + item.Key;
if (checkLabelVar)
{
this.ErrorMsg = tmpMsg;
checkLabelVar = false;
}
else
{
this.ErrorMsg = this.ErrorMsg + (char)10 + tmpMsg;
}
}
}
if (!checkLabelVar)
{
msg = this.ErrorMsg;
this.Status = false;
return false;
}
foreach (var param in labelParamsValues.Keys)
{
if (lbldicVar.Keys.Count(q => q.ToUpper() == param.ToUpper()) > 0)
{
var labvar = lbldicVar.Keys.First(q => q.ToUpper() == param.ToUpper());
if (string.IsNullOrEmpty(labelParamsValues[param]))
{
tmpMsg = "数据源参数值为空:" + labvar;
if (checkLabelVar)
{
this.ErrorMsg = tmpMsg;
checkLabelVar = false;
}
else
{
this.ErrorMsg = this.ErrorMsg + (char)10 + tmpMsg;
}
}
btFormat.SetNamedSubStringValue(param, labelParamsValues[param]);
}
}
if (!checkLabelVar)
{
msg = this.ErrorMsg;
this.Status = false;
return false;
}
btFormat.IdenticalCopiesOfLabel = printQty;
//第二个false设置打印时是否跳出打印属性
btFormat.PrintOut(true, false);
//退出是是否保存标签
btFormat.Close(BarTender.BtSaveOptions.btSaveChanges);
//lblDoc.FormFeed();
msg = "OK";
this.ErrorMsg = msg;
this.Status = true;
return true;
}
else
{
msg = "Print Data is null";
this.ErrorMsg = msg;
this.Status = false;
return false;
}
}
else
{
msg = "Error:CodeSoft Application can't boot up";
this.ErrorMsg = msg;
this.Status = false;
return false;
}
}
catch (Exception ex)
{
msg = ex.Message + ex.InnerException;
this.ErrorMsg = msg;
this.Status = false;
return false;
}
finally
{
if (btApp != null)
{
btApp.Quit(BarTender.BtSaveOptions.btSaveChanges);//界面退出时同步退出bartender进程
//lblApp.Documents.CloseAll(true);
//lblDoc = null;
}
GC.Collect();
}
}
#endregion
#region 数据库调用打印
/// <summary>
/// 打印从文本数据库中打
/// </summary>
/// <returns></returns>
public bool BTPrintByDataBase(string path, string filePath, string printer = "")
{
try
{
BarTender.Application btapp;
BarTender.Format btformat;
btapp = new BarTender.Application();
btformat = btapp.Formats.Open(path, false, "");
BarTender.Database database = btformat.Databases.GetDatabase(1);
if (!string.IsNullOrEmpty(printer))
{
btformat.Printer = printer;
}
database.TextFile.FileName = filePath;
//database.SQLStatement += $" where printID='{printId}' order by RIGHT(Var1,7)";//填写SQL语句附加条件
//database.Password = VSLoginInfo.SQLPassword;
//database.User = VSLoginInfo.SQLUser;
btformat.PrintOut(false, false); //第二个参数设置是否跳出打印属性;
btapp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);//退出时同步退出bartender进程(SQL条件会改变,不更新模板信息)
}
catch
{
return false;
}
return true;
}
/// <summary>
/// 打印从文本数据库中打
/// </summary>
/// <param name="templatepath">模板地址</param>
/// <param name="dataLine">数据行,一行一个标签,第一行为标题,多列逗号分割</param>
/// <returns></returns>
public bool BTPrintByDataBase(string templatepath, List<string> dataLine, string printer = "")
{
try
{
BarTender.Application btapp;
BarTender.Format btformat;
btapp = new BarTender.Application();
var filepath = WriteLog(dataLine, "", Guid.NewGuid().ToString());
btformat = btapp.Formats.Open(templatepath, false, "");
BarTender.Database database = btformat.Databases.GetDatabase(1);
if (!string.IsNullOrEmpty(printer))
{
btformat.Printer = printer;
}
database.TextFile.FileName = filepath;
//database.SQLStatement += $" where printID='{printId}' order by RIGHT(Var1,7)";//填写SQL语句附加条件
//database.Password = VSLoginInfo.SQLPassword;
//database.User = VSLoginInfo.SQLUser;
btformat.PrintOut(false, false); //第二个参数设置是否跳出打印属性;
btapp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);//退出时同步退出bartender进程(SQL条件会改变,不更新模板信息)
}
catch
{
return false;
}
return true;
}
/// <summary>
/// 写文本
/// </summary>
/// <param name="logStr"></param>
public static string WriteLog(List<string> lines, string fileDirectory = "", string guid = "")
{
try
{
string path1 = Environment.CurrentDirectory + Path.Combine("/printFile/") + fileDirectory;
if (!Directory.Exists(path1))
{
//创建索引目录
Directory.CreateDirectory(path1);
}
string path = path1 + "/" + DateTime.Now.ToString("yyyy-MM-dd") + guid + ".txt";
FileStream stream = null;
if (File.Exists(path))
{
File.Delete(path);
}
stream = new FileStream(path, FileMode.Create);
StreamWriter writer = new StreamWriter(stream);
for (var i = 0; i < lines.Count; i++)
{
writer.Write(lines[i] + Environment.NewLine);
}
writer.Flush();
writer.Close();
stream.Close();
return path;
}
catch
{
}
finally
{
}
return "";
}
#endregion
public static void ExportToFile(string btFileName, Dictionary<string, string> data)
{
//BarTender.Application btApp = new BarTender.Application();
//BarTender.Format btFormat;
btFormat = btApp.Formats.Open(btFileName);
foreach (var key in data.Keys)
{
btFormat.SetNamedSubStringValue(key, data[key]);
}
//btFormat.SaveAs(btFileName, true);
btFormat.ExportToFile(@"E:/temp.jpg", "jpg", BarTender.BtColors.btColors24Bit, BarTender.BtResolution.btResolutionPrinter, BarTender.BtSaveOptions.btSaveChanges);
btFormat.Close(BarTender.BtSaveOptions.btSaveChanges);
btApp.Quit(BarTender.BtSaveOptions.btSaveChanges);
}
}
}
//using System;
//using System.Collections.Generic;
//using System.IO;
//using System.Text;
//using System.Linq;
//using System.Threading.Tasks;
//namespace BBWY.Client.Helpers
//{
// public class BartenderHelper
// {
// #region BarTender打印方法
// private static BarTender.Application btApp = new BarTender.Application();
// private static BarTender.Format btFormat = new BarTender.Format();
// public string TemplateFile { set; get; }
// public string ErrorMsg { set; get; }
// public bool Status { set; get; }
// /// <summary>
// /// 使用 BarTender进行打印,批量打印
// /// </summary>
// /// <param name="labelName"> BarTender模板标签</param>
// /// <param name="labelParamsValuesList">打印数据</param>
// /// <param name="msg">回调消息</param>
// /// <param name="printQty">打印数量</param>
// /// <returns>打印OK true</returns>
// public bool BTPrint(string labelName, Dictionary<string, string> labelParamsValues, out string msg, int printQty = 1, string printer = "Deli DL-730C(NEW)")
// {
// try
// {
// bool checkLabelVar = true;
// string tmpMsg = "";
// this.TemplateFile = labelName;
// if (!File.Exists(TemplateFile))
// {
// msg = "Error:Label File Not Exists" + TemplateFile;
// this.ErrorMsg = msg;
// return false;
// }
// if (!string.IsNullOrEmpty(printer))
// {
// bool printerFlag = false;
// foreach (string sPrint in System.Drawing.Printing.PrinterSettings.InstalledPrinters)//获取所有打印机名称
// {
// if (sPrint.Equals(printer))
// {
// printerFlag = true;
// }
// }
// if (!printerFlag)
// {
// msg = "Error:Printer Name Error";
// return false;
// }
// }
// //找到打印模板的标签页
// btFormat = btApp.Formats.Open(labelName, false, "");
// if (!string.IsNullOrEmpty(printer))
// {
// btFormat.Printer = printer;
// }
// if (btApp != null)
// {
// //btFormat.IdenticalCopiesOfLabel = printQty;
// //btFormat.PrintOut(true, false);
// //取模板所有的值
// string strBT = btFormat.NamedSubStrings.GetAll("#", "$");
// //将模板所有值进行拆分
// strBT = strBT.Substring(0, strBT.Length - 1);
// string[] strBTValue = strBT.Split(new char[] { '$' });
// //循环将模板的值写入lbldicVar中
// Dictionary<string, string> lbldicVar = new Dictionary<string, string>();
// for (int i = 0; i < strBTValue.Length; i++)
// {
// string[] cc = strBTValue[i].Split(new char[] { '#' });
// lbldicVar.Add(cc[0].ToString(), cc[1].ToString()); //0是模板的参数 1是参数值
// }
// if (labelParamsValues.Count > 0)
// {
// foreach (var item in lbldicVar)
// {
// if (labelParamsValues.Count(q => q.Key.ToUpper() == item.Key.ToUpper()) == 0)
// {
// tmpMsg = "数据源缺少参数: " + item.Key;
// if (checkLabelVar)
// {
// this.ErrorMsg = tmpMsg;
// checkLabelVar = false;
// }
// else
// {
// this.ErrorMsg = this.ErrorMsg + (char)10 + tmpMsg;
// }
// }
// }
// if (!checkLabelVar)
// {
// msg = this.ErrorMsg;
// this.Status = false;
// return false;
// }
// foreach (var param in labelParamsValues.Keys)
// {
// if (lbldicVar.Keys.Count(q => q.ToUpper() == param.ToUpper()) > 0)
// {
// var labvar = lbldicVar.Keys.First(q => q.ToUpper() == param.ToUpper());
// if (string.IsNullOrEmpty(labelParamsValues[param]))
// {
// tmpMsg = "数据源参数值为空:" + labvar;
// if (checkLabelVar)
// {
// this.ErrorMsg = tmpMsg;
// checkLabelVar = false;
// }
// else
// {
// this.ErrorMsg = this.ErrorMsg + (char)10 + tmpMsg;
// }
// }
// btFormat.SetNamedSubStringValue(param, labelParamsValues[param]);
// }
// }
// if (!checkLabelVar)
// {
// msg = this.ErrorMsg;
// this.Status = false;
// return false;
// }
// btFormat.IdenticalCopiesOfLabel = printQty;
// //第二个false设置打印时是否跳出打印属性
// btFormat.PrintOut(true, false);
// //退出是是否保存标签
// btFormat.Close(BarTender.BtSaveOptions.btSaveChanges);
// //lblDoc.FormFeed();
// msg = "OK";
// this.ErrorMsg = msg;
// this.Status = true;
// return true;
// }
// else
// {
// msg = "Print Data is null";
// this.ErrorMsg = msg;
// this.Status = false;
// return false;
// }
// }
// else
// {
// msg = "Error:CodeSoft Application can't boot up";
// this.ErrorMsg = msg;
// this.Status = false;
// return false;
// }
// }
// catch (Exception ex)
// {
// msg = ex.Message + ex.InnerException;
// this.ErrorMsg = msg;
// this.Status = false;
// File.AppendAllText("c:/1.txt", msg);
// return false;
// }
// finally
// {
// if (btApp != null)
// {
// try
// {
// // File.AppendAllText("c:/1.txt","退出界面");
// btApp.Quit(BarTender.BtSaveOptions.btSaveChanges);//界面退出时同步退出bartender进程
// // File.AppendAllText("c:/1.txt", "退出成功");
// }
// catch (Exception ex)
// {
// //File.AppendAllText("c:/1.txt",ex.Message+"|||||"+ ex.ToString());
// }
// //lblApp.Documents.CloseAll(true);
// //lblDoc = null;
// }
// GC.Collect();
// }
// }
// #endregion
// #region 数据库调用打印
// /// <summary>
// /// 打印从文本数据库中打
// /// </summary>
// /// <returns></returns>
// public bool BTPrintByDataBase(string path, string filePath, string printer = "")
// {
// try
// {
// BarTender.Application btapp;
// BarTender.Format btformat;
// btapp = new BarTender.Application();
// btformat = btapp.Formats.Open(path, false, "");
// BarTender.Database database = btformat.Databases.GetDatabase(1);
// if (!string.IsNullOrEmpty(printer))
// {
// btformat.Printer = printer;
// }
// database.TextFile.FileName = filePath;
// //database.SQLStatement += $" where printID='{printId}' order by RIGHT(Var1,7)";//填写SQL语句附加条件
// //database.Password = VSLoginInfo.SQLPassword;
// //database.User = VSLoginInfo.SQLUser;
// btformat.PrintOut(false, false); //第二个参数设置是否跳出打印属性;
// btapp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);//退出时同步退出bartender进程(SQL条件会改变,不更新模板信息)
// }
// catch
// {
// return false;
// }
// return true;
// }
// /// <summary>
// /// 打印从文本数据库中打
// /// </summary>
// /// <param name="templatepath">模板地址</param>
// /// <param name="dataLine">数据行,一行一个标签,第一行为标题,多列逗号分割</param>
// /// <returns></returns>
// public bool BTPrintByDataBase(string templatepath, List<string> dataLine, string printer = "")
// {
// try
// {
// BarTender.Application btapp;
// BarTender.Format btformat;
// btapp = new BarTender.Application();
// var filepath = WriteLog(dataLine, "", Guid.NewGuid().ToString());
// btformat = btapp.Formats.Open(templatepath, false, "");
// BarTender.Database database = btformat.Databases.GetDatabase(1);
// if (!string.IsNullOrEmpty(printer))
// {
// btformat.Printer = printer;
// }
// database.TextFile.FileName = filepath;
// //database.SQLStatement += $" where printID='{printId}' order by RIGHT(Var1,7)";//填写SQL语句附加条件
// //database.Password = VSLoginInfo.SQLPassword;
// //database.User = VSLoginInfo.SQLUser;
// btformat.PrintOut(false, false); //第二个参数设置是否跳出打印属性;
// btapp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);//退出时同步退出bartender进程(SQL条件会改变,不更新模板信息)
// }
// catch
// {
// return false;
// }
// return true;
// }
// /// <summary>
// /// 写文本
// /// </summary>
// /// <param name="logStr"></param>
// public static string WriteLog(List<string> lines, string fileDirectory = "", string guid = "")
// {
// try
// {
// string path1 = Environment.CurrentDirectory + Path.Combine("/printFile/") + fileDirectory;
// if (!Directory.Exists(path1))
// {
// //创建索引目录
// Directory.CreateDirectory(path1);
// }
// string path = path1 + "/" + DateTime.Now.ToString("yyyy-MM-dd") + guid + ".txt";
// FileStream stream = null;
// if (File.Exists(path))
// {
// File.Delete(path);
// }
// stream = new FileStream(path, FileMode.Create);
// StreamWriter writer = new StreamWriter(stream);
// for (var i = 0; i < lines.Count; i++)
// {
// writer.Write(lines[i] + Environment.NewLine);
// }
// writer.Flush();
// writer.Close();
// stream.Close();
// return path;
// }
// catch
// {
// }
// finally
// {
// }
// return "";
// }
// #endregion
// public static void ExportToFile(string btFileName, Dictionary<string, string> data)
// {
// //BarTender.Application btApp = new BarTender.Application();
// //BarTender.Format btFormat;
// btFormat = btApp.Formats.Open(btFileName);
// foreach (var key in data.Keys)
// {
// btFormat.SetNamedSubStringValue(key, data[key]);
// }
// //btFormat.SaveAs(btFileName, true);
// btFormat.ExportToFile(@"E:/temp.jpg", "jpg", BarTender.BtColors.btColors24Bit, BarTender.BtResolution.btResolutionPrinter, BarTender.BtSaveOptions.btSaveChanges);
// btFormat.Close(BarTender.BtSaveOptions.btSaveChanges);
// btApp.Quit(BarTender.BtSaveOptions.btSaveChanges);
// }
// }
//}

183
BBWY.Client/Helpers/MyPrintHelper.cs

@ -0,0 +1,183 @@
using BarcodeLib;
using BBWY.Client.Models;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
namespace BBWY.Client.Helpers
{
public class MyPrintHelper
{
public static void PrintBarcode(ref PrintPageEventArgs args, BarCodeModel barCode, Font font)
{
args.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
args.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
var sige = args.Graphics.VisibleClipBounds;// 宽:236 高:157 打印可视化区域
args.Graphics.TranslateTransform((sige.Width - 236) / 2, 0);//设置起始位置
//args.Graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.Brushes.Black), 0, 0, sige.Width, sige.Height);//画出条码编辑区域
args.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
args.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
if (barCode.LabelModel == BarcodeLabelModel.barsimplify)
{
font = new Font("宋体", 10, System.Drawing.FontStyle.Regular);
SetBarSimplify(barCode, ref args, font);
}
else
{
font = new Font("宋体", 8, System.Drawing.FontStyle.Regular);
SetBarStander(barCode, ref args, font);
}
}
/// <summary>
/// 标准
/// </summary>
/// <param name="barCode"></param>
/// <param name="args"></param>
/// <param name="font"></param>
private static void SetBarStander(BarCodeModel barCode, ref PrintPageEventArgs args, Font font)
{
string barcodeSku = $"POP{barCode.SkuId}";
Barcode barcode = new Barcode();
System.Drawing.Image img = barcode.Encode(TYPE.CODE128, barcodeSku, 500, 40);
SizeF size = args.Graphics.MeasureString(barCode.BrandName, font);
var sizeHeight = size.Height;//字体高度
var heightSpace = 5;//间隔高度
args.Graphics.DrawString($"品牌: {barCode.Brand}", font, System.Drawing.Brushes.Black, new PointF(10, 10));
args.Graphics.DrawString($"品名: {barCode.BrandName}", font, System.Drawing.Brushes.Black, new PointF(10, 10 + heightSpace + sizeHeight));
args.Graphics.DrawString($"型号: {barCode.ProductNo}", font, System.Drawing.Brushes.Black, new PointF(10, 10 + 2 * (heightSpace + sizeHeight)));
args.Graphics.DrawString($"规格: {barCode.SkuName}", font, System.Drawing.Brushes.Black, new PointF(10, 10 + 3 * (heightSpace + sizeHeight)));
// g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
size = args.Graphics.MeasureString(barcodeSku, font);
args.Graphics.DrawString(barcodeSku, font, System.Drawing.Brushes.Black, new PointF((236 - size.Width) / 2, 10 + 4 * (heightSpace + sizeHeight) + 50 + 5));
args.Graphics.DrawImage(img, 1, 10 + 4 * (heightSpace + sizeHeight), 234, 50);
}
/// <summary>
/// 精简
/// </summary>
/// <param name="barCode"></param>
/// <param name="args"></param>
/// <param name="font"></param>
private static void SetBarSimplify(BarCodeModel barCode, ref PrintPageEventArgs args, Font font)
{
string barcodeSku = $"POP{barCode.SkuId}";
Barcode barcode = new Barcode();
System.Drawing.Image img = barcode.Encode(TYPE.CODE128, barcodeSku, 500, 60);
args.Graphics.DrawString($"品名: {barCode.BrandName}", font, System.Drawing.Brushes.Black, new PointF(10, 10));
args.Graphics.DrawString($"规格: {barCode.SkuName}", font, System.Drawing.Brushes.Black, new PointF(10, 40));
// g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
SizeF size = args.Graphics.MeasureString(barcodeSku, font);
args.Graphics.DrawString(barcodeSku, font, System.Drawing.Brushes.Black, new PointF((236 - size.Width) / 2, 130));
args.Graphics.DrawImage(img, 1, 68, 234, 60);
}
public static void PrintCertificate(ref PrintPageEventArgs args, CertificateModel certificate, Font font)
{
args.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
args.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
var sige = args.Graphics.VisibleClipBounds;// 宽:236 高:157 打印可视化区域
args.Graphics.TranslateTransform((sige.Width - 236) / 2, 0);//设置起始位置
args.Graphics.DrawRectangle(new System.Drawing.Pen(System.Drawing.Brushes.Black), 5, 5, sige.Width - 10, sige.Height - 10);//画出条码编辑区域
args.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
args.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
font = new Font("宋体", 6, System.Drawing.FontStyle.Regular);
SetCerStander(ref args, certificate, font);
}
private static void SetCerStander(ref PrintPageEventArgs args, CertificateModel certificate, Font font)
{
int bigJiange = 20;//合格证与品牌的高度差
var heightSpace = 4;//所有行间隔高度
int standerSpace = 1;//执行标准之间的
if (certificate.IsLogo == 1)//含图标
{
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string path = appPath + $"/Resources/Images/3c.png";
Image image = Image.FromFile(path);
args.Graphics.DrawImage(image, 190, 7, 28, 21);
args.Graphics.DrawString(certificate.FactoryNumber, font, System.Drawing.Brushes.Black, 188, 28);
}
var fontBig = new Font("宋体", 14, System.Drawing.FontStyle.Regular);
string cerName = "合格证";
SizeF bigSize = args.Graphics.MeasureString(cerName, fontBig);
float verHeight = bigJiange + bigSize.Height;
args.Graphics.DrawString(cerName, fontBig, System.Drawing.Brushes.Black, new PointF((236 - bigSize.Width) / 2, 10));
args.Graphics.DrawString($"品牌: {certificate.Brand}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight));
args.Graphics.DrawString($"型号: {certificate.ProductNo}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight));
var smallSize = args.Graphics.MeasureString(certificate.Brand, font);//小字体高度
verHeight += (smallSize.Height + heightSpace);
args.Graphics.DrawString($"品名: {certificate.BrandName}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight));
args.Graphics.DrawString($"材质: {certificate.Shader}", font, System.Drawing.Brushes.Black, new PointF(122, verHeight));
StringBuilder sb = new StringBuilder();
var excutes = certificate.ExcuteStander.Split(',', StringSplitOptions.RemoveEmptyEntries);
int hangCount = excutes.Count() / 2 + excutes.Count() % 2;//获取行数
for (int i = 0; i < excutes.Count(); i++)
{
if (i % 2 == 0 && i > 0)//间隔两个换行
{
sb.Append("\n");
}
sb.Append(excutes[i]).Append(" ");
}
sb.Remove(sb.Length - 3, 3);
var rows = sb.ToString().Split('\n');
string excuteStander = "执行标准: ";
smallSize = args.Graphics.MeasureString(excuteStander, font);
verHeight += (smallSize.Height + heightSpace);
args.Graphics.DrawString($"执行标准: {rows[0]}", font, System.Drawing.Brushes.Black, new PointF(10, verHeight));
for (int i = 1; i < rows.Count(); i++)
{
verHeight += (smallSize.Height + standerSpace);
args.Graphics.DrawString($"{rows[i]}", font, System.Drawing.Brushes.Black, new PointF(10 + smallSize.Width, verHeight));
}
verHeight += (smallSize.Height + heightSpace);
RectangleF rect = new RectangleF(10, verHeight, 220, smallSize.Height * 2 + heightSpace);
var productStr = $"生产商: {certificate.ProductShop}";
if (args.Graphics.MeasureString(productStr, font).Width <= 220)
{
args.Graphics.DrawString(productStr, font, System.Drawing.Brushes.Black,10,verHeight);
verHeight += smallSize.Height + heightSpace;
}
else
{
args.Graphics.DrawString(productStr, font, System.Drawing.Brushes.Black, rect);
verHeight += 2 * smallSize.Height + heightSpace;
}
//var format = new StringFormat
//{
// LineAlignment = StringAlignment.Far,
// // Alignment = StringAlignment.Center
//};
var rect1 = new RectangleF(10, verHeight, 220, smallSize.Height * 3 + heightSpace);
args.Graphics.DrawString($"地址: {certificate.ProductAdress}", font, System.Drawing.Brushes.Black, rect1 );
//certificate.ExcuteStander =;
//args.Graphics.DrawImage(img, 1, 68, 234, 60);
}
}
}

2
BBWY.Client/Models/APIModel/Request/CreateTaskRequest.cs

@ -6,6 +6,8 @@ namespace BBWY.Client.Models.APIModel.Request
{
public class CreateTaskRequest
{
public long TaskId { get; set; }
/// <summary>
/// skuid
/// </summary>

11
BBWY.Client/Models/APIModel/Response/PackTask/PackTaskResultResponse.cs

@ -159,6 +159,17 @@ namespace BBWY.Client.Models.APIModel.Response.PackTask
public BarCodeModel BarCodeDTO { get; set; }
public CertificateModel certificate { get; set; }
/// <summary>
/// 是否加急
/// </summary>
public int IsWorry { get; set; }
/// <summary>
/// 品牌
/// </summary>
public string Brand { get; set; }
}
//public class FeesItemTypeDTO :NotifyObject

6
BBWY.Client/Models/PackTask/IncreateServiceModel.cs

@ -1,12 +1,14 @@
using System;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Text;
namespace BBWY.Client.Models.PackTask
{
public class IncreateServiceModel
public class IncreateServiceModel:NotifyObject
{
public long Id { get; set; }
public string ServiceName { get; set; }
public decimal ServicePrice { get; set; }

59
BBWY.Client/Models/PackTask/PackTaskModel.cs

@ -38,9 +38,53 @@ namespace BBWY.Client.Models
IncreateServiceService increateServiceService;
public ConsumableService consumableService;
/// <summary>
/// 修改任务
/// </summary>
public ICommand UpdateTaskCommand { get; set; }
/// <summary>
/// 修改任务
/// </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()
{
ViewModelLocator viewModel = new ViewModelLocator();
var createViewModel = viewModel.CreateTaskView;
if (createViewModel.ReflashWindow == null)
{
createViewModel.ReflashWindow = ReflashTask;
}
CreatePackTask create = new CreatePackTask();
//ViewModelLocator viewModel = new ViewModelLocator();
//var createViewModel = viewModel.CreateTaskView;
//if (ReflashTask != null)
// createViewModel.ReflashWindow = ReflashTask;
create.SendData(this);
create.ShowDialog();
}
public PackTaskModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateServiceService)
{
@ -51,6 +95,8 @@ namespace BBWY.Client.Models
LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer);
SetServiceCommand = new RelayCommand(SetService);
UpdateTaskCommand = new RelayCommand(UpdateTask);
DeletedTaskCommand = new RelayCommand(DeletedTask);
this.packTaskService = packTaskService;
this.consumableService = consumableService;
this.workProcessService = workProcessService;
@ -61,7 +107,7 @@ namespace BBWY.Client.Models
{
//加载数据
ServiceWindow service = new ServiceWindow(packTaskService, TaskId, SkuCount, consumableService, workProcessService, increateServiceService);//设置
ServiceWindow service = new ServiceWindow(packTaskService, TaskId, SkuCount, consumableService, workProcessService, increateServiceService);//设置
service.model.SetAllFees = new Action<FeesItemResponse, List<string>>((feesItem, packUsers) =>
{
FeesItemResponse = feesItem;
@ -276,6 +322,12 @@ namespace BBWY.Client.Models
public TaskState Availability { get => availability; set { Set(ref availability, value); } }
private Worry isWorry;
/// <summary>
/// 到货情况(待收货=0,部分收货=1,已到货=2)
/// </summary>
public Worry IsWorry { get => isWorry; set { Set(ref isWorry, value); } }
private TaskStateType taskStatus;
/// <summary>
@ -448,9 +500,9 @@ namespace BBWY.Client.Models
public class SkuMessage : NotifyObject
{
private long id;
private string id;
public long Id { get => id; set { Set(ref id, value); } }
public string Id { get => id; set { Set(ref id, value); } }
/// <summary>
/// 店铺Sku图链接
@ -461,7 +513,6 @@ namespace BBWY.Client.Models
/// </summary>
public string Logo { get => logo; set { Set(ref logo, value); } }
/// <summary>
/// 采购Sku名称
/// </summary>

BIN
BBWY.Client/Resources/LabelNames/Cer3CDouble.btw

Binary file not shown.

BIN
BBWY.Client/Resources/LabelNames/Cer3CSingle.btw

Binary file not shown.

BIN
BBWY.Client/Resources/LabelNames/CerStanderDouble.btw

Binary file not shown.

BIN
BBWY.Client/Resources/LabelNames/CerStanderSingle.btw

Binary file not shown.

BIN
BBWY.Client/Resources/LabelNames/barsimplify.btw

Binary file not shown.

BIN
BBWY.Client/Resources/LabelNames/barstander.btw

Binary file not shown.

50
BBWY.Client/ViewModels/MainViewModel.cs

@ -122,10 +122,11 @@ namespace BBWY.Client.ViewModels
if (GlobalContext.User.TeamName == "打包组" || GlobalContext.User.TeamName == "发货组" || GlobalContext.User.TeamName == "仓储部")
{
App.Current.Dispatcher.Invoke(() => {
App.Current.Dispatcher.Invoke(() =>
{
MenuList.Add(new MenuModel()
{
Name = "齐库",
Name = "齐库仓库端",
ChildList = new List<MenuModel>()
{
new MenuModel(){ Name="打包任务",Url="/Views/PackTask/WareHouseList.xaml" },
@ -162,9 +163,6 @@ namespace BBWY.Client.ViewModels
}
});
MenuList.Add(new MenuModel()
{
Name = "商品管理",
@ -185,19 +183,26 @@ namespace BBWY.Client.ViewModels
}
});
MenuList.Add(new MenuModel()
{
Name = "设置",
ChildList = new List<MenuModel>()
{
new MenuModel(){ Name="店铺设置",Url="/Views/Setting/ShopSetting.xaml" },
new MenuModel(){ Name="团队配置",Url="/Views/Setting/TeamSetting.xaml" }
}
});
});
if (managerDepartment.Contains(GlobalContext.User.TeamName) || managerDepartment.Any(m => GlobalContext.User.SonDepartmentNames.Contains(m)))
{
App.Current.Dispatcher.Invoke(() =>
{
MenuList.Add(new MenuModel()
{
Name = "齐库仓库端",
ChildList = new List<MenuModel>()
{
new MenuModel(){ Name="打包任务",Url="/Views/PackTask/WareHouseList.xaml" },
new MenuModel(){ Name="耗材管理",Url="/Views/PackTask/Consumable.xaml" }
}
});
});
App.Current.Dispatcher.Invoke(() => MenuList.Add(new MenuModel()
{
Name = "财务端",
@ -209,6 +214,19 @@ namespace BBWY.Client.ViewModels
}));
}
App.Current.Dispatcher.Invoke(() =>
{
MenuList.Add(new MenuModel()
{
Name = "设置",
ChildList = new List<MenuModel>()
{
new MenuModel(){ Name="店铺设置",Url="/Views/Setting/ShopSetting.xaml" },
new MenuModel(){ Name="团队配置",Url="/Views/Setting/TeamSetting.xaml" }
}
});
});
}
@ -238,10 +256,6 @@ namespace BBWY.Client.ViewModels
CreateMenu();
//if (GlobalContext.User.TeamName == "刷单组")
// return;
if (GlobalContext.User.TeamName == "打包组" || GlobalContext.User.TeamName == "发货组" || GlobalContext.User.TeamName == "仓储部")
{
return;

6
BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs

@ -73,6 +73,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
LoadIndex(p.PageIndex);
});
SearchConsumable();
}
private void LoadIndex(int pageIndex)
{
@ -85,7 +86,7 @@ namespace BBWY.Client.ViewModels.PackTask
{
Task.Factory.StartNew(() =>
{
isLoading = true;
IsLoading = true;
var res = consumableService.Search(new Models.APIModel.Request.ConsumableSearchRequest
{
Name = searchName,
@ -118,8 +119,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
}
}
isLoading = false;
IsLoading = false;
});

221
BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs

@ -1,4 +1,5 @@
using BBWY.Client.APIServices;
using BarcodeLib;
using BBWY.Client.APIServices;
using BBWY.Client.Helpers;
using BBWY.Client.Models;
using BBWY.Client.Models.APIModel.Request;
@ -10,12 +11,14 @@ using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using NPOI.Util;
using Org.BouncyCastle.Asn1.Crmf;
using Org.BouncyCastle.Asn1.Ocsp;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -26,8 +29,10 @@ using System.Windows.Navigation;
namespace BBWY.Client.ViewModels.PackTask
{
public class CreatePackTaskViewModel : BaseVM
public class CreatePackTaskViewModel : BaseVM,IDenpendency
{
private bool isLoading = false;
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } }
@ -85,11 +90,11 @@ namespace BBWY.Client.ViewModels.PackTask
public string SkuName { get => skuName; set { Set(ref skuName, value); } }
private long barCodeId;
/// <summary>
/// 条形码id
/// </summary>
public long BarCodeId { get => barCodeId; set { Set(ref barCodeId, value); } }
//private long barCodeId;
///// <summary>
///// 条形码id
///// </summary>
//public long BarCodeId { get => barCodeId; set { Set(ref barCodeId, value); } }
private string brand;
/// <summary>
@ -260,6 +265,12 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public bool IsSetCertificate { get => isSetCertificate; set { Set(ref isSetCertificate, value); } }
private string saveTask;
/// <summary>
/// 设置显示(合格证)
/// </summary>
public string SaveTask { get => saveTask; set { Set(ref saveTask, value); } }
@ -346,44 +357,98 @@ namespace BBWY.Client.ViewModels.PackTask
public void InitData()
public void InitData(PackTaskModel model = null)
{
string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" };
IncreateList = new ObservableCollection<IncreateModel>();
if (model == null)
{
SaveTask = "发布";
TaskId = 0;
Logo = string.Empty;
SearchSkuId = "";
SkuId = "";
SkuCount = 0;
SkuName = string.Empty;
ProductNo = string.Empty;
Brand = string.Empty;
brandName = string.Empty;
this.MarkMessage = "";
IsSetBarCode = true;
IsSetCertificate = true;
BarCodeModel = null;
CertificateModel = null;
SkuTitle = string.Empty;
GoodsNumber = 0;
foreach (var item in increates)
{
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = false
});
}
return;
}
SaveTask = "保存";
Logo = model.ItemList[0].Logo;
SearchSkuId =model.SkuId ;
//Logo = string.Empty;
//SearchSkuId = "";
//SkuId = "";
//SkuCount = 0;
//SkuName = string.Empty;
//ProductNo= string.Empty;
//Brand =string.Empty;
//brandName = string.Empty;
//this.MarkMessage = "";
//IsSetBarCode = true;
//IsSetCertificate =true;
//BarCodeModel = null;
//CertificateModel = null;
//SkuTitle= string.Empty;
//GoodsNumber = 0;
//string[] increates = new string[] { "气泡纸", "气泡袋", "POP袋", "折纸箱", "气泡纸封边", "彩盒", "剪胶", "剪彩带", "快递袋", "收纳盒", "纸箱子", "装纸箱", "封边", "胶带", "折彩盒" };
//IncreateList = new ObservableCollection<IncreateModel>();
//foreach (var item in increates)
//{
// IncreateList.Add(new IncreateModel
// {
// IncreateName = item,
// IsSelected = false
// });
//}
SkuId = model.SkuId;
SkuCount = model.SkuCount;
SkuName = model.ItemList[0].SkuName;
ProductNo = model.ItemList[0].GoodsNo;
Brand = model.Brand;
BrandName = model.ItemList[0].BrandName;
this.MarkMessage = model.MarkMessage;
IsSetBarCode = model.BarCodeModel!=null ? false:true;
IsSetCertificate = model.CertificateModel!=null ? false : true;
BarCodeModel = model.BarCodeModel;
CertificateModel = model.CertificateModel;
SkuTitle = model.SkuTitle;
GoodsNumber = model.GoodsNumber;
Availability = model.Availability;
IsWorry = model.IsWorry;
PositionType = model.PositionType;
PackType =model.PackType;
BasicPack = model.BasicPack;
IsNeedBarCode = model.BarCodeModel != null ? "需要" : "不需要";
IsNeedCertificateModel = model.CertificateModel != null ? "需要" : "不需要";
CertificatePosition = model.CertificatePosition;
TaskId = model.TaskId;
string[] increateDatas =model.Increment1.Split(',');
bool isSelected = false;
foreach (var item in increates)
{
isSelected = false;
if (increateDatas.Contains(item))
{
isSelected = true;
}
IncreateList.Add(new IncreateModel
{
IncreateName = item,
IsSelected = isSelected
});
}
//SearchSku();
}
public CreatePackTaskViewModel(PackTaskService packTaskService, GlobalContext globalContext, ProductService productService)
{
Messenger.Default.Register<bool>(this, "InitData", message => {
Messenger.Default.Register<PackTaskModel>(this, "InitData", message =>
{
InitData();
InitData(message);
});
//RaisePropertyChanged(string.Empty);
//this.RaisePropertyChanged(nameof(CreatePackTaskViewModel));
this.productService = productService;
this.packTaskService = packTaskService;
@ -483,12 +548,12 @@ namespace BBWY.Client.ViewModels.PackTask
{
LookBarCodeWindow look = new LookBarCodeWindow(new BarCodeModel
{
Brand = Brand,
BrandName = BrandName,
LabelModel = LabelModel,
ProductNo = ProductNo,
SkuId = SkuId,
SkuName = SkuName
Brand = BarCodeModel. Brand,
BrandName = BarCodeModel.BrandName,
LabelModel = BarCodeModel.LabelModel,
ProductNo = BarCodeModel.ProductNo,
SkuId = BarCodeModel.SkuId,
SkuName = BarCodeModel.SkuName
});
look.Show();
}
@ -596,6 +661,7 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetCertificate = false;
return;
}
IsNeedCertificateModel = "需要";
CertificateModel.Id = resData.Data;
IsSetCertificate = false;
setCerWindow.Close();
@ -604,12 +670,20 @@ namespace BBWY.Client.ViewModels.PackTask
SetBarCodeWindow setBarCodeWindow = null; SetCerWindow setCerWindow = null;
private void SetBarCode()
{
if (BarCodeModel == null)
if (string.IsNullOrEmpty( SearchSkuId))
{
new TipsWindow("请先查询sku数据").ShowDialog();
new TipsWindow("请先查询skuId").Show();
return;
}
if (BarCodeModel == null)
{
BarCodeModel = new BarCodeModel();
BarCodeModel.ProductNo = ProductNo;
BarCodeModel.Brand = Brand;
BarCodeModel.SkuId = SkuId;
BarCodeModel.SkuName = SkuName;
}
BarCodeModel.BrandName = BrandName;
setBarCodeWindow = new SetBarCodeWindow();
@ -620,6 +694,17 @@ namespace BBWY.Client.ViewModels.PackTask
private void SaveBarCode()
{
if (LabelModel == BarcodeLabelModel.barstander)//标准版 判断数据是否异常
{
if (string.IsNullOrEmpty(ProductNo) || ProductNo == "待填写")
{
TipsWindow tips = new TipsWindow("该SKU无货号信息,将影响条形码打印\r\n请先设置好货号信息或调整打印模板类型");
tips.ShowDialog();
return;
}
}
//保存到服务器中 返回id
var resData = packTaskService.SaveBarCode(new BarCodeRequest
{
@ -636,8 +721,9 @@ namespace BBWY.Client.ViewModels.PackTask
IsSetBarCode = false;
return;
}
BarCodeId = resData.Data;
BarCodeModel.Id = BarCodeId;
BarCodeModel.Id = resData.Data;
IsNeedBarCode = "需要";
IsSetBarCode = false;
setBarCodeWindow.Close();
}
@ -646,16 +732,20 @@ namespace BBWY.Client.ViewModels.PackTask
public Action ReflashWindow { get; set; }
/// <summary>
/// 发布任务
/// </summary>
public void CreateTask(object obj)
{
if (string.IsNullOrEmpty(SkuId))
{
new TipsWindow("请先搜索SkuId!").ShowDialog();
new TipsWindow("请先搜索SkuId!").Show();
return;
}
if (SkuCount<=0)
{
new TipsWindow("请设置SKU任务数!").Show();
return;
}
string increateStr = "";
@ -664,10 +754,9 @@ namespace BBWY.Client.ViewModels.PackTask
{
increateStr = string.Join(",", increates);
}
var createTaskModel = new Models.APIModel.Request.CreateTaskRequest
{
TaskId=TaskId,
BrandName = BrandName,
Availability = (int)Availability,
BasicPack = (int)BasicPack,
@ -693,7 +782,7 @@ namespace BBWY.Client.ViewModels.PackTask
new TipsWindow("请设置条形码模板").ShowDialog();
return;
}
createTaskModel.BarCodeId = BarCodeId;
createTaskModel.BarCodeId = BarCodeModel.Id;
}
if (IsNeedCertificateModel == "需要")
{
@ -704,18 +793,21 @@ namespace BBWY.Client.ViewModels.PackTask
}
createTaskModel.CertificateId = CertificateModel.Id;//
}
var res = packTaskService.CreateTask(createTaskModel);
ApiResponse<object> res = null;
if (TaskId>0)//修改界面
{
res = packTaskService.UpdateTask(createTaskModel);
}
else
{
res = packTaskService.CreateTask(createTaskModel);
}
if (res.Success)
{
// Application.Current.Shutdown(0);
new TipsWindow("发布成功").ShowDialog();
if (ReflashWindow != null) ReflashWindow();//刷新主界面
var win = obj as System.Windows.Window;
win.Close();
//MessageBox.Success("发布成功");
}
}
@ -725,11 +817,6 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public void SearchSku()
{
IsLoading = true;
SkuId = searchSkuId;
ApiResponse<ProductListResponse> productApiResponse = null;

113
BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs

@ -8,9 +8,11 @@ using BBWY.Client.Models.PackTask;
using BBWY.Client.Views.PackTask;
using BBWY.Common.Models;
using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Text;
@ -42,22 +44,18 @@ namespace BBWY.Client.ViewModels.PackTask
ConsumableService consumableService;
public ObservableCollection<PackItemModel> IncreateList { get; set; } = new ObservableCollection<PackItemModel>();
public ObservableCollection<PackItemModel> PackList { get; set; } = new ObservableCollection<PackItemModel>();
public ObservableCollection<PackItemModel> ConsumableServiceList { get; set; } = new ObservableCollection<PackItemModel>();
//private ObservableCollection<IncreateServiceModel> increateServiceList = new ObservableCollection<IncreateServiceModel>();
public ObservableCollection<IncreateServiceModel> IncreateServiceList { get; set; } = new ObservableCollection<IncreateServiceModel>();
public ObservableCollection<PackUser> MemberList { get; set; } = new ObservableCollection<PackUser>();
public ObservableCollection<ConsumableModel> ConsumableList { get; set; } = new ObservableCollection<ConsumableModel>();
public ObservableCollection<WorkProcessModel> PackServiceList { get; set; } = new ObservableCollection<WorkProcessModel>();
IncreateServiceService increateService;
public PackServiceViewModel(PackTaskService packTaskService, ConsumableService consumableService, WorkProcessService workProcessService, IncreateServiceService increateService, long taskId)
{
@ -70,7 +68,6 @@ namespace BBWY.Client.ViewModels.PackTask
var increateRes = increateService.SearchAll();
if (increateRes.Success)
{
@ -86,6 +83,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
}
}
var result = workProcessService.SearchAll();
if (result.Success)
{
@ -101,6 +99,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
}
}
var res = packTaskService.GetPackMembers();
if (res.Success)
{
@ -114,6 +113,9 @@ namespace BBWY.Client.ViewModels.PackTask
}
}
var conRes = this.consumableService.SearchAll();
if (conRes.Success)
{
@ -140,22 +142,33 @@ namespace BBWY.Client.ViewModels.PackTask
}
AddIncreateServiceCommand = new RelayCommand(AddIncreateService);
AddPackServiceCommand = new RelayCommand(AddPackService);
AddConsumableCommand = new RelayCommand(AddConsumable);
UpLoadPackCommand = new RelayCommand<object>(UpLoadPack);
SetAllCountCommand = new RelayCommand<object>(SetAllCount);
//加载数据
Task.Factory.StartNew(() =>
//加载数据
LoadPackDatas();
}
/// <summary>
/// 加载任务数据
/// </summary>
private void LoadPackDatas()
{
Task task = Task.Factory.StartNew(() =>
{
var res = packTaskService.GetTaskService(TaskId);
var res = this.packTaskService.GetTaskService(TaskId);
if (res.Success)
{
if (res.Data.IncreateList != null)
{
IncreateList = new ObservableCollection<PackItemModel>();
foreach (var item in res.Data.IncreateList)
{
App.Current.Dispatcher.Invoke(() =>
@ -174,6 +187,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
if (res.Data.PackList != null)
{
PackList = new ObservableCollection<PackItemModel>();
foreach (var item in res.Data.PackList)
{
App.Current.Dispatcher.Invoke(() =>
@ -192,6 +206,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
if (res.Data.ConsumableServiceList != null)
{
ConsumableServiceList = new ObservableCollection<PackItemModel>();
foreach (var item in res.Data.ConsumableServiceList)
{
App.Current.Dispatcher.Invoke(() =>
@ -211,13 +226,10 @@ namespace BBWY.Client.ViewModels.PackTask
}
});
}
/// <summary>
/// 批量设置耗材数
/// 批量设置耗材数量
/// </summary>
/// <param name="obj"></param>
private void SetAllCount(object obj)
@ -238,12 +250,8 @@ namespace BBWY.Client.ViewModels.PackTask
item.ItemCount = s;
}
lbox.ItemsSource = serviceList;
});
set.Show();
}
private long taskId;
@ -253,35 +261,35 @@ namespace BBWY.Client.ViewModels.PackTask
private int taskCount;
public int TaskCount { get => taskCount; set { Set(ref taskCount, value); } } //
private string selectBox;
/// <summary>
/// 箱子类型
/// </summary>
public string SelectBox { get => selectBox; set { Set(ref selectBox, value); } }
//private string selectBox;
///// <summary>
///// 箱子类型
///// </summary>
//public string SelectBox { get => selectBox; set { Set(ref selectBox, value); } }
private int boxCount;
/// <summary>
/// 箱子数
/// </summary>
public int BoxCount { get => boxCount; set { Set(ref boxCount, value); } }
private int airPaperWidth;
/// <summary>
/// 气泡宽
/// </summary>
public int AirPaperWidth { get => airPaperWidth; set { Set(ref airPaperWidth, value); } }
//private int boxCount;
///// <summary>
///// 箱子数
///// </summary>
//public int BoxCount { get => boxCount; set { Set(ref boxCount, value); } }
//private int airPaperWidth;
///// <summary>
///// 气泡宽
///// </summary>
//public int AirPaperWidth { get => airPaperWidth; set { Set(ref airPaperWidth, value); } }
private decimal airPaperHeigth;
/// <summary>
/// 气泡长
/// </summary>
public decimal AirPaperHeigth { get => airPaperHeigth; set { Set(ref airPaperHeigth, value); } }
//private decimal airPaperHeigth;
///// <summary>
///// 气泡长
///// </summary>
//public decimal AirPaperHeigth { get => airPaperHeigth; set { Set(ref airPaperHeigth, value); } }
private string selectMemberId;
public string SelectMemberId { get => selectMemberId; set { Set(ref selectMemberId, value); } }
//private string selectMemberId;
//public string SelectMemberId { get => selectMemberId; set { Set(ref selectMemberId, value); } }
private decimal jiaoDai;
public decimal JiaoDai { get => jiaoDai; set { Set(ref jiaoDai, value); } }
//private decimal jiaoDai;
//public decimal JiaoDai { get => jiaoDai; set { Set(ref jiaoDai, value); } }
/// <summary>
/// 上传数据 (判断是否超量) 统一上传
@ -551,7 +559,7 @@ namespace BBWY.Client.ViewModels.PackTask
var res = packTaskService.UploadService(uploadService);
if (res != null && res.Success)
{
new TipsWindow("上传成功!").Show();
// new TipsWindow("上传成功!").Show();
var win = obj as System.Windows.Window;
feesItem.AllFees = AllFees;
feesItem.SingleFees = singleFees;
@ -571,17 +579,26 @@ namespace BBWY.Client.ViewModels.PackTask
private void AddPackService()
{
PackList.Add(new PackItemModel(null, MemberList, null, PackServiceList));
PackList.Add(new PackItemModel(null, MemberList, null, PackServiceList)
{
ItemCount = TaskCount
});
}
WorkProcessService workProcessService;
private void AddIncreateService()
{
IncreateList.Add(new PackItemModel(IncreateServiceList, MemberList));
IncreateList.Add(new PackItemModel(IncreateServiceList, MemberList)
{
ItemCount = TaskCount
});
}
private void AddConsumable()
{
ConsumableServiceList.Add(new PackItemModel(null, null, ConsumableList));
ConsumableServiceList.Add(new PackItemModel(null, null, ConsumableList)
{
ItemCount = TaskCount
});
}
}
}

232
BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs

@ -148,6 +148,22 @@ namespace BBWY.Client.ViewModels.PackTask
{
LoadIndex(p.PageIndex);
});
OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
CopyTextCommand = new RelayCommand<object>(s =>
{
try
{
Clipboard.SetText(s.ToString());
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
Console.ResetColor();
}
});
StartTime = DateTime.Now.Date;
EndTime = DateTime.Now.Date;
IsLoading = false;
@ -162,6 +178,9 @@ namespace BBWY.Client.ViewModels.PackTask
this.increateServiceService = increateServiceService;
}
private void IsLoadCount()
{
var packTaskResult = packTaskService.GetAllCount();
@ -209,6 +228,15 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public ICommand TaskPageIndexChangedCommand { get; set; }
/// <summary>
/// 打开图片链接
/// </summary>
public ICommand OpenSkuDetailCommand { get; set; }
/// <summary>
/// 复制
/// </summary>
public ICommand CopyTextCommand { get; set; }
public void SetTaskState(TaskState? taskState)
@ -242,6 +270,14 @@ namespace BBWY.Client.ViewModels.PackTask
}
private ConsumableService consumableService;
private IncreateServiceService increateServiceService;
public void ReflashTask()//刷新界面
{
SearchTaskList();
}
/// <summary>
/// 搜索任务列表
/// </summary>
@ -250,88 +286,103 @@ namespace BBWY.Client.ViewModels.PackTask
IsLoading = true;
Task.Factory.StartNew(() =>
{
PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据
var datas = packTaskService.GetOrderList(SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), taskStatus,
PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
try
{
var dataModel = datas.Data;
OrderCount = dataModel.TotalCount;
foreach (var item in dataModel.Items)
PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据
var datas = packTaskService.GetOrderList(SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), taskStatus,
PageIndex, PageSize);
if (datas != null && datas.Data != null && datas.Success)
{
var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService)
var dataModel = datas.Data;
OrderCount = dataModel.TotalCount;
foreach (var item in dataModel.Items)
{
AcceptName = item.UserName,
Availability = (TaskState)item.Availability,
BasicPack = (BasicPack)item.BasicPack,
DepartmentName = item.DepartmentName,
CertificatePosition = (CertificatePosition)item.CertificatePosition,
GoodsNumber = item.GoodsNumber,
Increment1 = item.Increment1,
Increment2 = (Increment)item.Increment2,
ItemList = new List<SkuMessage>() { new SkuMessage
var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService)
{
Brand = item.Brand,
SkuId = item.SkuId,
AcceptName = item.UserName,
Availability = (TaskState)item.Availability,
BasicPack = (BasicPack)item.BasicPack,
DepartmentName = item.DepartmentName,
CertificatePosition = (CertificatePosition)item.CertificatePosition,
GoodsNumber = item.GoodsNumber,
Increment1 = item.Increment1,
Increment2 = (Increment)item.Increment2,
ItemList = new List<SkuMessage>() { new SkuMessage
{ BrandName = item.BrandName,
GoodsNo = item.ProductItemNum, Logo= item.Logo,
ShopName = item.ShopName, SkuName = item.SkuName
ShopName = item.ShopName, SkuName = item.SkuName,
Id = item.SkuId
} },
MarkMessage = item.MarkMessage,
PackType = (PackType)item.PackType,
MarkMessage = item.MarkMessage,
PackType = (PackType)item.PackType,
PositionType = (PositionType)item.PositionType,
SkuCount = item.SkuCount,
SkuTitle = item.SkuGoodsTitle,
TaskId = item.TaskId,
TaskStatus = (TaskStateType)item.TaskStatus,
EndTime = item.CreateTime,
IsWorry = (Worry)item.IsWorry
};
if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0)
{
data.BarCodeModel = item.BarCodeDTO;
}
if (item.certificate != null)
{
data.CertificateModel = item.certificate;
}
if (item.FeesItemResponse != null)
{
data.FeesItemResponse = item.FeesItemResponse;
data.FeesMoney = item.FeesItemResponse.SingleFees;
data.IsShowFees = data.FeesMoney > 0 ? true : false;
}
else
{
data.IsShowFees = false;
}
if (item.PackUserName != null && item.PackUserName.Count() > 0)
{
data.PackUser = string.Join("\r\n", item.PackUserName);
}
data.ReflashTask = ReflashTask;
App.Current.Dispatcher.BeginInvoke(new Action(() =>
{
PackTaskList.Add(data);
}));
PositionType = (PositionType)item.PositionType,
SkuCount = item.SkuCount,
SkuTitle = item.SkuGoodsTitle,
TaskId = item.TaskId,
TaskStatus = (TaskStateType)item.TaskStatus,
EndTime = item.CreateTime
};
if (item.BarCodeDTO != null && item.BarCodeDTO.Id > 0)
{
data.BarCodeModel = item.BarCodeDTO;
}
if (item.certificate != null)
{
data.CertificateModel = item.certificate;
}
if (item.FeesItemResponse != null)
{
data.FeesItemResponse = item.FeesItemResponse;
data.FeesMoney = item.FeesItemResponse.SingleFees;
data.IsShowFees = data.FeesMoney > 0 ? true : false;
}
else
{
data.IsShowFees = false;
}
if (item.PackUserName != null && item.PackUserName.Count() > 0)
{
data.PackUser = string.Join("\r\n", item.PackUserName);
}
App.Current.Dispatcher.BeginInvoke(new Action(() =>
{
PackTaskList.Add(data);
}));
}
else
{
MessageBox.Show("查不到数据");
}
IsLoadCount();
}
else
catch (Exception ex)
{
MessageBox.Show("查不到数据");
}
IsLoadCount();
IsLoading = false;
});
@ -341,14 +392,30 @@ namespace BBWY.Client.ViewModels.PackTask
GlobalContext globalContext;
ProductService productService;
/// <summary>
/// 展示发布任务页面
/// </summary>
public void CreateTask()
{
ViewModelLocator viewModel = new ViewModelLocator();
var createViewModel = viewModel.CreateTaskView;
if (createViewModel.ReflashWindow==null)
{
createViewModel.ReflashWindow = ReflashTask;
}
CreatePackTask create = new CreatePackTask();
create.SendData();
create.Show();
}
@ -376,30 +443,25 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary>
public void SelectTaskStatus() { }
#endregion
//private void OpenSkuDetail(object param)
//{
// var paramList = (object[])param;
// var orderId = paramList[0].ToString();
// var skuId = paramList[1].ToString();
// var task = packTaskList.FirstOrDefault(o => o.TaskId == Convert.ToInt64( SearchTaskId));
// if (order.Platform == Platform.京东)
// {
// var url = $"https://item.jd.com/{skuId}.html";
// try
// {
// System.Diagnostics.Process.Start("explorer.exe", url);
// }
// catch (Exception ex)
// {
// Clipboard.SetText(url);
// MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
// }
// }
// else
// {
// }
//}
private void OpenSkuDetail(object param)
{
var paramList = (object[])param;
// var orderId = paramList[0].ToString();
var skuId = paramList[1].ToString();
var url = $"https://item.jd.com/{skuId}.html";
try
{
System.Diagnostics.Process.Start("explorer.exe", url);
}
catch (Exception ex)
{
Clipboard.SetText(url);
MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
}
}

52
BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs

@ -163,7 +163,20 @@ namespace BBWY.Client.ViewModels.PackTask
LoadIndex(p.PageIndex);
});
OpenSkuDetailCommand = new RelayCommand<object>(OpenSkuDetail);
CopyTextCommand = new RelayCommand<object>(s =>
{
try
{
Clipboard.SetText(s.ToString());
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex);
Console.ResetColor();
}
});
StartTime = DateTime.Now.Date;
EndTime = DateTime.Now.Date;
IsLoading = false;
@ -208,6 +221,16 @@ namespace BBWY.Client.ViewModels.PackTask
#region 事件绑定
/// <summary>
/// 打开图片链接
/// </summary>
public ICommand OpenSkuDetailCommand { get; set; }
/// <summary>
/// 复制
/// </summary>
public ICommand CopyTextCommand { get; set; }
/// <summary>
/// 筛选数据
/// </summary>
@ -281,7 +304,7 @@ namespace BBWY.Client.ViewModels.PackTask
foreach (var item in dataModel.Items)
{
var data = new PackTaskModel(packTaskService,consumableService,workProcessService, increateServiceService)
var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService)
{
AcceptName = item.UserName,
Availability = (TaskState)item.Availability,
@ -295,7 +318,8 @@ namespace BBWY.Client.ViewModels.PackTask
ItemList = new List<SkuMessage>() { new SkuMessage
{ BrandName = item.BrandName,
GoodsNo = item.ProductItemNum, Logo= item.Logo,
ShopName = item.ShopName, SkuName = item.SkuName
ShopName = item.ShopName, SkuName = item.SkuName,
Id = item.SkuId
} },
MarkMessage = item.MarkMessage,
@ -322,11 +346,11 @@ namespace BBWY.Client.ViewModels.PackTask
}
if (item.FeesItemResponse!=null)
if (item.FeesItemResponse != null)
{
data.FeesItemResponse = item.FeesItemResponse;
data.FeesMoney = item.FeesItemResponse.SingleFees;
data.IsShowFees = data.FeesMoney > 0 ? true : false;
}
@ -370,7 +394,25 @@ namespace BBWY.Client.ViewModels.PackTask
private void OpenSkuDetail(object param)
{
var paramList = (object[])param;
// var orderId = paramList[0].ToString();
var skuId = paramList[1].ToString();
var url = $"https://item.jd.com/{skuId}.html";
try
{
System.Diagnostics.Process.Start("explorer.exe", url);
}
catch (Exception ex)
{
Clipboard.SetText(url);
System.Windows.MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
}
}
#endregion

46
BBWY.Client/ViewModels/ViewModelLocator.cs

@ -28,32 +28,6 @@ namespace BBWY.Client.ViewModels
//public static PackServiceViewModel PackServiceViewModel => SimpleIoc.Default.GetInstance<PackServiceViewModel>();
//public static PackServiceViewModel CreateNewPackServiceViewModel()
//{
// SimpleIoc.Default.Unregister<PackServiceViewModel>();
// SimpleIoc.Default.Register<PackServiceViewModel>();
// return PackServiceViewModel;
//}
public MainViewModel Main
{
get
@ -126,7 +100,7 @@ namespace BBWY.Client.ViewModels
{
get
{
//IsCreateOrderList = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<TaskListViewModel>();
@ -137,7 +111,6 @@ namespace BBWY.Client.ViewModels
{
get
{
//IsCreateOrderList = true;
using (var s = sp.CreateScope())
{
return s.ServiceProvider.GetRequiredService<WareHouseListViewModel>();
@ -182,33 +155,16 @@ namespace BBWY.Client.ViewModels
}
}
//CreatePackTaskViewModel viewModel = null;
public CreatePackTaskViewModel CreateTaskView
{
get
{
// return sp.GetRequiredService<CreatePackTaskViewModel>();
using (var s = sp.CreateScope())
{
//if (viewModel == null)
// viewModel = s.ServiceProvider.GetRequiredService<CreatePackTaskViewModel>();
var viewModel = s.ServiceProvider.GetRequiredService<CreatePackTaskViewModel>();
//bool areSame = object.ReferenceEquals(viewModel, sp.GetRequiredService<CreatePackTaskViewModel>());
return viewModel;
}
}

2
BBWY.Client/Views/MainWindow.xaml

@ -26,7 +26,7 @@
<!--<TextBlock Text="{Binding GlobalContext.User.TeamName}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" Margin="5,0,0,0"/>-->
<TextBlock Text="{Binding GlobalContext.User.Shop.ShopName}" Margin="5,0,0,0"/>
<TextBlock Text="v10084" Margin="5,0,0,0"/>
<TextBlock Text="v10085" Margin="5,0,0,0"/>
</StackPanel>
</Border>
<Grid Grid.Row="1">

2
BBWY.Client/Views/PackTask/CreatePackTask.xaml

@ -331,7 +331,7 @@
<Grid Grid.Row="3">
<Button Content="发布" Width="100" HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,2,5,2"
<Button Content="{Binding SaveTask,Mode=TwoWay}" Width="100" HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,2,5,2"
Command="{Binding CreateTaskCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
Background="{StaticResource Button.Background}" BorderThickness="0" Foreground="White"/>

7
BBWY.Client/Views/PackTask/CreatePackTask.xaml.cs

@ -1,4 +1,5 @@
using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.ViewModels;
using BBWY.Client.ViewModels.PackTask;
using BBWY.Common.Models;
@ -39,12 +40,12 @@ namespace BBWY.Client.Views.PackTask
//DataContext = model;
}
public void SendData()
public void SendData(PackTaskModel model =null)
{
Messenger.Default.Send(true,"InitData");
Messenger.Default.Send(model, "InitData");
}

4
BBWY.Client/Views/PackTask/LookCerWindow.xaml

@ -85,10 +85,10 @@
<TextBlock Text="地址:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="33,246,0,0" />
<c:BTextBox IsReadOnly="True" BorderBrush="Transparent" TextWrapping ="Wrap" AcceptsReturn="True" Text="{Binding ProductAdress}" Height="44" Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,241,0,0"/>
<TextBlock Text="工厂编号:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="203,60,0,0" />
<!--<TextBlock Text="工厂编号:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="203,60,0,0" />-->
<c:BTextBox IsReadOnly="True" BorderBrush="Transparent" Text="{Binding FactoryNumber}" Height="25" Width="100" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="259,55,0,0"/>
<Image Source="/Resources/Images/3c.png" Width="54" Height="42" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="282,6,0,0" />
<Image Source="pack://siteoforigin:,,,/Resources/Images/3c.png" Width="54" Height="42" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="282,6,0,0" />
</Grid>
</Border>

2
BBWY.Client/Views/PackTask/LookCerWindow.xaml.cs

@ -55,7 +55,7 @@ namespace BBWY.Client.Views.PackTask
}
sb.Append(excutes[i]).Append(" ");
}
sb.Remove(sb.Length - 4, 4);
sb.Remove(sb.Length - 3, 3);
data.ExcuteStander = sb.ToString();
}

4
BBWY.Client/Views/PackTask/PrintWindow.xaml

@ -134,10 +134,10 @@
<TextBlock Text="地址:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="33,246,0,0" />
<c:BTextBox IsReadOnly="True" BorderBrush="Transparent" TextWrapping ="Wrap" AcceptsReturn="True" Text="{Binding ProductAdress}" Height="44" Width="296" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="63,241,0,0"/>
<TextBlock Text="工厂编号:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="203,60,0,0" />
<!--<TextBlock Text="工厂编号:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="203,60,0,0" />-->
<c:BTextBox IsReadOnly="True" BorderBrush="Transparent" Text="{Binding FactoryNumber}" Height="25" Width="100" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="259,55,0,0"/>
<Image Source="/Resources/Images/3c.png" Width="54" Height="42" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="282,6,0,0" />
<Image Source="pack://siteoforigin:,,,/Resources/Images/3c.png" Width="54" Height="42" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="282,6,0,0" />
</Grid>
</Border>

76
BBWY.Client/Views/PackTask/PrintWindow.xaml.cs

@ -3,9 +3,12 @@ using BBWY.Client.Models;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@ -94,7 +97,7 @@ namespace BBWY.Client.Views.PackTask
}
sb.Append(excutes[i]).Append(" ");
}
sb.Remove(sb.Length - 4, 4);
sb.Remove(sb.Length - 3, 3);
data.ExcuteStander = sb.ToString();
}
@ -147,11 +150,26 @@ namespace BBWY.Client.Views.PackTask
{
try
{
string path = Directory.GetCurrentDirectory()+ $"/Resources/LabelNames/{LabelName}.btw";
int printCount = Convert.ToInt32(tbCount.Text);
string printName =cbPrints.Text;
//string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
PrintBarCode(path,printCount,printName);
//string path = appPath + $"/Resources/LabelNames/{LabelName}.btw";
int printCount = Convert.ToInt32(tbCount.Text);//份数
string printName = cbPrints.Text;//选择的要打印的打印机名称
PrintDocument pd = new PrintDocument();
PrintDocument document = new PrintDocument();
document.PrinterSettings.PrinterName = printName;
document.PrintPage += Document_PrintPage;
document.PrinterSettings.Copies = (short)printCount;//打印份数
document.Print();
// Task.Factory.StartNew(() => {
// PrintBarCode(path, printCount, printName);
//});
}
catch (Exception ex)
{
@ -161,20 +179,46 @@ namespace BBWY.Client.Views.PackTask
}
/// <summary>
/// 打印条形码
/// </summary>
private void PrintBarCode(string labelPath,int printNums,string PrintName)
private void Document_PrintPage(object sender, PrintPageEventArgs args)
{
BartenderHelper helper = new BartenderHelper();
string msg = "";
helper.BTPrint(labelPath, Datas, out msg, printNums, PrintName);
if (msg == "OK")
Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular);
if (barCodeModel!=null)
{
return;
MyPrintHelper.PrintBarcode(ref args, barCodeModel, font);
}
if (certificateModel!=null)
{
MyPrintHelper.PrintCertificate(ref args, certificateModel, font);
}
new TipsWindow(msg).ShowDialog();//打印失败提示
}
/// <summary>
/// 打印条形码
/// </summary>
//private void PrintBarCode(string labelPath,int printNums,string PrintName)
//{
// BartenderHelper helper = new BartenderHelper();
// string msg = "";
// // File.AppendAllText("c:/1.txt", $"{PrintName}开始打印{printNums}份,{labelPath}");
// helper.BTPrint(labelPath, Datas, out msg, printNums, PrintName);
// // File.AppendAllText("c:/1.txt", "结束打印");
// //File.AppendAllText("c:/1.txt", msg);
// if (msg == "OK")
// {
// return;
// }
// App.Current.Dispatcher.Invoke(new Action(() => {
// new TipsWindow(msg).ShowDialog();//打印失败提示
// }));
//}
}
}

13
BBWY.Client/Views/PackTask/ServiceWindow.xaml

@ -14,6 +14,7 @@
CloseButtonVisibility="Visible"
WindowStartupLocation="CenterScreen"
CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0">
@ -58,7 +59,7 @@
<Label Content="操作" Width="40" Height="30" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="303,56,0,0" />
<StackPanel Grid.Row="1" Orientation="Vertical" MaxHeight="140" Width="322" Margin="19,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent">
<ListBox ItemsSource="{Binding IncreateList}" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
<ListBox ItemsSource="{Binding IncreateList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0" MaxHeight="100"
Foreground="{StaticResource Text.Color}"
@ -73,7 +74,7 @@
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<ComboBox VerticalContentAlignment="Center" Grid.Column="0" ItemsSource="{Binding IncreateServiceList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="ServiceName" SelectedValuePath="Id" SelectedValue="{Binding SelectId}" Text="{Binding ItemName}" Width="116" Height="30"/>
<ComboBox VerticalContentAlignment="Center" Grid.Column="1" ItemsSource="{Binding MemberList}" DisplayMemberPath="UserName" SelectedValuePath="Id" SelectedValue="{Binding SelectUserId}" Width="84" Height="30"/>
<ComboBox VerticalContentAlignment="Center" Grid.Column="1" ItemsSource="{Binding MemberList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="UserName" SelectedValuePath="Id" SelectedValue="{Binding SelectUserId}" Width="84" Height="30"/>
<TextBox VerticalContentAlignment="Center" Grid.Column="2" Height="30" Text="{Binding ItemCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="84"/>
<c:BButton Foreground="Blue" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DeleteServiceCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=ItemsSource}" Content="删除" Grid.Column="3"/>
@ -117,7 +118,7 @@
<StackPanel Grid.Row="1" Orientation="Vertical" MaxHeight="140" Width="322" Margin="19,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent">
<ListBox
ItemsSource="{Binding PackList}" MaxHeight="100"
ItemsSource="{Binding PackList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" MaxHeight="100"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0"
@ -135,7 +136,7 @@
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<ComboBox VerticalContentAlignment="Center" Grid.Column="0" DisplayMemberPath="ProcessName" ItemsSource="{Binding PackServiceList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectedValuePath="Id" SelectedValue="{Binding SelectId}" Text="{Binding ItemName}" Width="116" Height="30"/>
<ComboBox VerticalContentAlignment="Center" Grid.Column="1" ItemsSource="{Binding MemberList}" DisplayMemberPath="UserName" SelectedValuePath="Id" SelectedValue="{Binding SelectUserId}" Width="84" Height="30"/>
<ComboBox VerticalContentAlignment="Center" Grid.Column="1" ItemsSource="{Binding MemberList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="UserName" SelectedValuePath="Id" SelectedValue="{Binding SelectUserId}" Width="84" Height="30"/>
<TextBox VerticalContentAlignment="Center" Grid.Column="2" Height="30" Text="{Binding ItemCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="84"/>
<c:BButton Foreground="Blue" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DeleteServiceCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=ItemsSource}" Content="删除" Grid.Column="3"/>
@ -181,7 +182,7 @@
<StackPanel Grid.Row="1" Orientation="Vertical" MaxHeight="160" Width="260" Margin="19,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent">
<ListBox MaxHeight="120" Name="consumable_listBox"
ItemsSource="{Binding ConsumableServiceList}"
ItemsSource="{Binding ConsumableServiceList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0"
@ -197,7 +198,7 @@
<ColumnDefinition Width="104"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<ComboBox VerticalContentAlignment="Center" Text="{Binding ItemName}" Grid.Column="0" ItemsSource="{Binding ConsumableList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" SelectedValue="{Binding SelectId}" SelectedValuePath="Id" Width="116" Height="30"/>
<ComboBox VerticalContentAlignment="Center" Text="{Binding ItemName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Grid.Column="0" ItemsSource="{Binding ConsumableList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="Name" SelectedValue="{Binding SelectId}" SelectedValuePath="Id" Width="116" Height="30"/>
<TextBox VerticalContentAlignment="Center" Grid.Column="1" Height="30" Text="{Binding ItemCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="104"/>
<c:BButton Foreground="Blue" BorderThickness="1" BorderBrush="{StaticResource Border.Brush}" Background="Transparent" HorizontalAlignment="Stretch"
Command="{Binding DeleteServiceCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=ItemsSource}" Content="删除" Grid.Column="2"/>

8
BBWY.Client/Views/PackTask/ServiceWindow.xaml.cs

@ -42,13 +42,7 @@ namespace BBWY.Client.Views.PackTask
this.DataContext = model;
}
//public PackServiceViewModel model { get; set; }
//public ServiceWindow()
//{
// InitializeComponent();
// model = ViewModelLocator.CreateNewPackServiceViewModel();
// this.DataContext = model;
//}
}
}

4
BBWY.Client/Views/PackTask/SetBarCode.xaml

@ -36,7 +36,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" >
<RadioButton GroupName="bar" IsChecked="True" Command="{Binding BarLabelCheckCommand}" CommandParameter="{x:Static cmodel:BarcodeLabelModel.barsimplify}" Content="精简" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<RadioButton GroupName="bar" IsChecked="{Binding BarCodeModel.LabelModel,Converter={StaticResource objConverter},ConverterParameter=barsimplify:true:false }" Command="{Binding BarLabelCheckCommand}" CommandParameter="{x:Static cmodel:BarcodeLabelModel.barsimplify}" Content="精简" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="220" Margin="5">
<StackPanel Orientation="Vertical" >
@ -64,7 +64,7 @@
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical" >
<RadioButton GroupName="bar" Content="标准" Command="{Binding BarLabelCheckCommand}" CommandParameter="{x:Static cmodel:BarcodeLabelModel.barstander}" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<RadioButton GroupName="bar" IsChecked="{Binding BarCodeModel.LabelModel,Converter={StaticResource objConverter},ConverterParameter=barstander:true:false }" Content="标准" Command="{Binding BarLabelCheckCommand}" CommandParameter="{x:Static cmodel:BarcodeLabelModel.barstander}" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="220" Margin="5">
<StackPanel Orientation="Vertical" >

6
BBWY.Client/Views/PackTask/SetCerWindow.xaml

@ -38,7 +38,7 @@
</Grid.ColumnDefinitions>
<Grid >
<!--CommandParameter="{x:Static cmodel:CerHave3C.No3C}"-->
<RadioButton GroupName="cer" IsChecked="True" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CerHave3C.No3C}" Content="标准" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.IsLogo,Converter={StaticResource objConverter},ConverterParameter=0:true:false}" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CerHave3C.No3C}" Content="标准" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid>
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
@ -63,7 +63,7 @@
</Grid>
<Grid Grid.Column="1" >
<RadioButton GroupName="cer" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CerHave3C.Is3C}" Content="带3c标" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<RadioButton GroupName="cer" IsChecked="{Binding CertificateModel.IsLogo,Converter={StaticResource objConverter},ConverterParameter=1:true:false}" Command="{Binding CerLabelCheckCommand}" CommandParameter="{x:Static cmodel:CerHave3C.Is3C}" Content="带3c标" Margin="10,20,0,0" Height="30" VerticalAlignment="Top"/>
<Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid >
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
@ -84,7 +84,7 @@
<TextBlock Text="工厂编号:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="203,60,0,0" />
<c:BTextBox Text="{Binding CertificateModel.FactoryNumber,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="25" Width="100" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="259,55,0,0"/>
<Image Source="/Resources/Images/3c.png" Width="54" Height="42" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="282,6,0,0" />
<Image Source="pack://siteoforigin:,,,/Resources/Images/3c.png" Width="54" Height="42" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="282,6,0,0" />
</Grid>
</Border>

23
BBWY.Client/Views/PackTask/TaskListControl.xaml

@ -106,14 +106,24 @@
<TextBlock VerticalAlignment="Center" Text="提交时间:" Margin="14,0,0,0" />
<TextBlock Text="{Binding EndTime,StringFormat=yyyy-MM-dd HH:mm}" VerticalAlignment="Center" Margin="5,0,0,0"/>
<TextBlock VerticalAlignment="Center" Text="任务ID:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding TaskId}" Margin="5,0,0,0" />
<c:BButton Content="{Binding TaskId}" Style="{StaticResource LinkButton}" HorizontalAlignment="Left" VerticalAlignment="Center"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding TaskId}"
Margin=" 5,0,0,0"/>
<Label Width="94" Height="25" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" VerticalAlignment="Center" Content="{Binding TaskStatus}" Foreground="White" Background="{Binding TaskStatus,Converter={StaticResource objConverter} , ConverterParameter=未完成:#facd91:#02a7f0 }" Margin="5,0,0,0"/>
<TextBlock VerticalAlignment="Center" Text="部门:" Margin="14,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding DepartmentName}" Margin="5,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="对接人:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" />
</StackPanel>
<StackPanel Grid.Column="11" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" >
<c:BButton Command="{Binding UpdateTaskCommand}"
Style="{StaticResource LinkButton}" Content="修改" />
<c:BButton Command="{Binding DeletedTaskCommand}"
Margin="5,0,0,0" Style="{StaticResource LinkButton}" Content="删除" />
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
@ -151,7 +161,7 @@
Cursor="Hand">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction >
<b:InvokeCommandAction Command="{Binding DataContext.OpenSkuDetailCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/>
@ -187,11 +197,14 @@
<Run Text="{Binding ShopName}"/>
</TextBlock>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Vertical" Margin="20,11,0,5">
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="20,11,0,5">
<TextBlock Foreground="{StaticResource Text.Gray}">
<Run Text="货号:" />
<Run Text="{Binding GoodsNo}"/>
</TextBlock>
<c:BButton Content="{Binding GoodsNo}" HorizontalAlignment="Left" VerticalAlignment="Top" Style="{StaticResource LinkButton}"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding GoodsNo}"
Margin=" 5,0,0,0"/>
</StackPanel>
</Grid>
</DataTemplate>

21
BBWY.Client/Views/PackTask/WareHouseListControl.xaml

@ -106,12 +106,19 @@
<TextBlock VerticalAlignment="Center" Text="提交时间:" Margin="14,0,0,0" />
<TextBlock Text="{Binding EndTime,StringFormat=yyyy-MM-dd HH:mm}" VerticalAlignment="Center" Margin="5,0,0,0"/>
<TextBlock VerticalAlignment="Center" Text="任务ID:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding TaskId}" Margin="5,0,0,0" />
<c:BButton Content="{Binding TaskId}" Style="{StaticResource LinkButton}" HorizontalAlignment="Left" VerticalAlignment="Center"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding TaskId}"
Margin=" 5,0,0,0"/>
<Label Width="94" Height="25" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" VerticalAlignment="Center" Content="{Binding TaskStatus}" Foreground="White" Background="{Binding TaskStatus,Converter={StaticResource objConverter} , ConverterParameter=未完成:#facd91:#02a7f0 }" Margin="5,0,0,0"/>
<TextBlock VerticalAlignment="Center" Text="部门:" Margin="14,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding DepartmentName}" Margin="5,0,0,0" />
<c:BButton Content="{Binding DepartmentName}" Style="{StaticResource LinkButton}" HorizontalAlignment="Left" VerticalAlignment="Center"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding DepartmentName}"
Margin=" 5,0,0,0"/>
<TextBlock VerticalAlignment="Center" Text="对接人:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" />
</StackPanel>
@ -152,7 +159,7 @@
Cursor="Hand">
<b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction >
<b:InvokeCommandAction Command="{Binding DataContext.OpenSkuDetailCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
<b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/>
@ -190,11 +197,14 @@
</TextBlock>
</StackPanel>
<StackPanel Grid.Column="2" Orientation="Vertical" Margin="20,11,0,5">
<StackPanel Grid.Column="2" Orientation="Horizontal" Margin="20,11,0,5">
<TextBlock Foreground="{StaticResource Text.Gray}">
<Run Text="货号:" />
<Run Text="{Binding GoodsNo}"/>
</TextBlock>
<c:BButton Content="{Binding GoodsNo}" Style="{StaticResource LinkButton}" HorizontalAlignment="Left" VerticalAlignment="Top"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Page}}}"
CommandParameter="{Binding GoodsNo}"
Margin=" 5,0,0,0"/>
</StackPanel>
</Grid>
</DataTemplate>
@ -554,6 +564,7 @@
<c:BButton HorizontalAlignment="Center" Height="20" VerticalAlignment="Center" Background="White" Foreground="Black" Grid.Row="1" Content="设置"
Command="{Binding SetServiceCommand}"
Visibility="Visible" />
</Grid>
</Grid>

Loading…
Cancel
Save