连坤 林 2 years ago
parent
commit
68067ba19e
  1. 16
      BBWY.Client/APIServices/PackTaskService.cs
  2. 13
      BBWY.Client/App.xaml.cs
  3. 32
      BBWY.Client/BBWY.Client.csproj
  4. 664
      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. 57
      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. 42
      BBWY.Client/ViewModels/MainViewModel.cs
  17. 6
      BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs
  18. 225
      BBWY.Client/ViewModels/PackTask/CreatePackTaskViewModel.cs
  19. 109
      BBWY.Client/ViewModels/PackTask/PackServiceViewModel.cs
  20. 118
      BBWY.Client/ViewModels/PackTask/TaskListViewModel.cs
  21. 46
      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. 5
      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. 21
      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); 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) public ApiResponse<object> CreateTask(CreateTaskRequest createTaskRequest)
{ {
return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/CreatePackTask", return SendRequest<object>(globalContext.QKApiHost, "api/PackTask/CreatePackTask",

13
BBWY.Client/App.xaml.cs

@ -41,20 +41,13 @@ namespace BBWY.Client
{ {
var isAdmin = IsAdministrator(); var isAdmin = IsAdministrator();
Console.WriteLine($"run as admin : {isAdmin}"); Console.WriteLine($"run as admin : {isAdmin}");
//System.Diagnostics.Debug.WriteLine($"run as admin : {isAdmin}");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var gl = new GlobalContext(); var gl = new GlobalContext();
string userToken = string.Empty; 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 #if DEBUG
//仓库组测试 //仓库组测试
// userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjM1OTMyMDAyMjcwMDU2NDQ4IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0IiwiZXhwIjoxNzEwNDk2NTQ1fQ.Sx2vGJcYGf98x99slQLU3vt7yWdjspptSpbUCcZgWek"; // userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNjM1OTMyMDAyMjcwMDU2NDQ4IiwidGVhbUlkIjoiMTU0MDg4NTU3MDYyNzA0NzQyNCIsInNvblRlYW1JZHMiOiIxNTQwODg1NTcwNjI3MDQ3NDI0IiwiZXhwIjoxNzEwNDk2NTQ1fQ.Sx2vGJcYGf98x99slQLU3vt7yWdjspptSpbUCcZgWek";
@ -112,7 +105,7 @@ namespace BBWY.Client
IServiceCollection serviceCollection = new ServiceCollection(); IServiceCollection serviceCollection = new ServiceCollection();
serviceCollection.AddHttpClient(); serviceCollection.AddHttpClient();
serviceCollection.AddTransient<CreatePackTaskViewModel>(); // serviceCollection.AddTransient<CreatePackTaskViewModel>();
serviceCollection.AddHttpClient("gzip").ConfigurePrimaryHttpMessageHandler(handler => new HttpClientHandler() serviceCollection.AddHttpClient("gzip").ConfigurePrimaryHttpMessageHandler(handler => new HttpClientHandler()
{ {
AutomaticDecompression = System.Net.DecompressionMethods.GZip AutomaticDecompression = System.Net.DecompressionMethods.GZip

32
BBWY.Client/BBWY.Client.csproj

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

664
BBWY.Client/Helpers/BartenderHelper.cs

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

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

@ -38,7 +38,51 @@ namespace BBWY.Client.Models
IncreateServiceService increateServiceService; IncreateServiceService increateServiceService;
public ConsumableService consumableService; 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();
}
@ -51,6 +95,8 @@ namespace BBWY.Client.Models
LookBarCommand = new RelayCommand(LookBar); LookBarCommand = new RelayCommand(LookBar);
LookCerCommand = new RelayCommand(LookCer); LookCerCommand = new RelayCommand(LookCer);
SetServiceCommand = new RelayCommand(SetService); SetServiceCommand = new RelayCommand(SetService);
UpdateTaskCommand = new RelayCommand(UpdateTask);
DeletedTaskCommand = new RelayCommand(DeletedTask);
this.packTaskService = packTaskService; this.packTaskService = packTaskService;
this.consumableService = consumableService; this.consumableService = consumableService;
this.workProcessService = workProcessService; this.workProcessService = workProcessService;
@ -276,6 +322,12 @@ namespace BBWY.Client.Models
public TaskState Availability { get => availability; set { Set(ref availability, value); } } 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; private TaskStateType taskStatus;
/// <summary> /// <summary>
@ -448,9 +500,9 @@ namespace BBWY.Client.Models
public class SkuMessage : NotifyObject 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> /// <summary>
/// 店铺Sku图链接 /// 店铺Sku图链接
@ -461,7 +513,6 @@ namespace BBWY.Client.Models
/// </summary> /// </summary>
public string Logo { get => logo; set { Set(ref logo, value); } } public string Logo { get => logo; set { Set(ref logo, value); } }
/// <summary> /// <summary>
/// 采购Sku名称 /// 采购Sku名称
/// </summary> /// </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.

42
BBWY.Client/ViewModels/MainViewModel.cs

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

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

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

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

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

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

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

@ -148,6 +148,22 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
LoadIndex(p.PageIndex); 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; StartTime = DateTime.Now.Date;
EndTime = DateTime.Now.Date; EndTime = DateTime.Now.Date;
IsLoading = false; IsLoading = false;
@ -162,6 +178,9 @@ namespace BBWY.Client.ViewModels.PackTask
this.increateServiceService = increateServiceService; this.increateServiceService = increateServiceService;
} }
private void IsLoadCount() private void IsLoadCount()
{ {
var packTaskResult = packTaskService.GetAllCount(); var packTaskResult = packTaskService.GetAllCount();
@ -209,6 +228,15 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary> /// </summary>
public ICommand TaskPageIndexChangedCommand { get; set; } public ICommand TaskPageIndexChangedCommand { get; set; }
/// <summary>
/// 打开图片链接
/// </summary>
public ICommand OpenSkuDetailCommand { get; set; }
/// <summary>
/// 复制
/// </summary>
public ICommand CopyTextCommand { get; set; }
public void SetTaskState(TaskState? taskState) public void SetTaskState(TaskState? taskState)
@ -242,6 +270,14 @@ namespace BBWY.Client.ViewModels.PackTask
} }
private ConsumableService consumableService; private ConsumableService consumableService;
private IncreateServiceService increateServiceService; private IncreateServiceService increateServiceService;
public void ReflashTask()//刷新界面
{
SearchTaskList();
}
/// <summary> /// <summary>
/// 搜索任务列表 /// 搜索任务列表
/// </summary> /// </summary>
@ -249,6 +285,9 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
IsLoading = true; IsLoading = true;
Task.Factory.StartNew(() => Task.Factory.StartNew(() =>
{
try
{ {
PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据 PackTaskList = new ObservableCollection<PackTaskModel>();//初始化数据
var datas = packTaskService.GetOrderList(SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), taskStatus, var datas = packTaskService.GetOrderList(SearchSkuId, SearchTaskId, StartTime, EndTime, (this.TaskState), taskStatus,
@ -262,6 +301,8 @@ namespace BBWY.Client.ViewModels.PackTask
var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService) var data = new PackTaskModel(packTaskService, consumableService, workProcessService, increateServiceService)
{ {
Brand = item.Brand,
SkuId = item.SkuId,
AcceptName = item.UserName, AcceptName = item.UserName,
Availability = (TaskState)item.Availability, Availability = (TaskState)item.Availability,
BasicPack = (BasicPack)item.BasicPack, BasicPack = (BasicPack)item.BasicPack,
@ -274,7 +315,8 @@ namespace BBWY.Client.ViewModels.PackTask
ItemList = new List<SkuMessage>() { new SkuMessage ItemList = new List<SkuMessage>() { new SkuMessage
{ BrandName = item.BrandName, { BrandName = item.BrandName,
GoodsNo = item.ProductItemNum, Logo= item.Logo, GoodsNo = item.ProductItemNum, Logo= item.Logo,
ShopName = item.ShopName, SkuName = item.SkuName ShopName = item.ShopName, SkuName = item.SkuName,
Id = item.SkuId
} }, } },
MarkMessage = item.MarkMessage, MarkMessage = item.MarkMessage,
@ -285,7 +327,9 @@ namespace BBWY.Client.ViewModels.PackTask
SkuTitle = item.SkuGoodsTitle, SkuTitle = item.SkuGoodsTitle,
TaskId = item.TaskId, TaskId = item.TaskId,
TaskStatus = (TaskStateType)item.TaskStatus, TaskStatus = (TaskStateType)item.TaskStatus,
EndTime = item.CreateTime EndTime = item.CreateTime,
IsWorry = (Worry)item.IsWorry
}; };
@ -307,14 +351,13 @@ namespace BBWY.Client.ViewModels.PackTask
{ {
data.IsShowFees = false; data.IsShowFees = false;
} }
if (item.PackUserName != null && item.PackUserName.Count() > 0) if (item.PackUserName != null && item.PackUserName.Count() > 0)
{ {
data.PackUser = string.Join("\r\n", item.PackUserName); data.PackUser = string.Join("\r\n", item.PackUserName);
} }
data.ReflashTask = ReflashTask;
App.Current.Dispatcher.BeginInvoke(new Action(() => App.Current.Dispatcher.BeginInvoke(new Action(() =>
{ {
PackTaskList.Add(data); PackTaskList.Add(data);
@ -332,6 +375,14 @@ namespace BBWY.Client.ViewModels.PackTask
} }
IsLoadCount(); IsLoadCount();
}
catch (Exception ex)
{
}
IsLoading = false; IsLoading = false;
}); });
@ -341,14 +392,30 @@ namespace BBWY.Client.ViewModels.PackTask
GlobalContext globalContext; GlobalContext globalContext;
ProductService productService; ProductService productService;
/// <summary> /// <summary>
/// 展示发布任务页面 /// 展示发布任务页面
/// </summary> /// </summary>
public void CreateTask() public void CreateTask()
{ {
ViewModelLocator viewModel = new ViewModelLocator();
var createViewModel = viewModel.CreateTaskView;
if (createViewModel.ReflashWindow==null)
{
createViewModel.ReflashWindow = ReflashTask;
}
CreatePackTask create = new CreatePackTask(); CreatePackTask create = new CreatePackTask();
create.SendData(); create.SendData();
create.Show(); create.Show();
} }
@ -376,30 +443,25 @@ namespace BBWY.Client.ViewModels.PackTask
/// </summary> /// </summary>
public void SelectTaskStatus() { } public void SelectTaskStatus() { }
#endregion #endregion
//private void OpenSkuDetail(object param) private void OpenSkuDetail(object param)
//{ {
// var paramList = (object[])param; var paramList = (object[])param;
// var orderId = paramList[0].ToString(); // var orderId = paramList[0].ToString();
// var skuId = paramList[1].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";
// var url = $"https://item.jd.com/{skuId}.html"; try
// try {
// { System.Diagnostics.Process.Start("explorer.exe", url);
// System.Diagnostics.Process.Start("explorer.exe", url); }
// } catch (Exception ex)
// catch (Exception ex) {
// { Clipboard.SetText(url);
// Clipboard.SetText(url); MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示");
// MessageBox.Show($"{ex.Message}\r\n调用浏览器失败,网页链接已复制到剪切板,请手动打开浏览器访问", "提示"); }
// }
// } }
// else
// {
// }
//}

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

@ -163,7 +163,20 @@ namespace BBWY.Client.ViewModels.PackTask
LoadIndex(p.PageIndex); 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; StartTime = DateTime.Now.Date;
EndTime = DateTime.Now.Date; EndTime = DateTime.Now.Date;
IsLoading = false; IsLoading = false;
@ -208,6 +221,16 @@ namespace BBWY.Client.ViewModels.PackTask
#region 事件绑定 #region 事件绑定
/// <summary>
/// 打开图片链接
/// </summary>
public ICommand OpenSkuDetailCommand { get; set; }
/// <summary>
/// 复制
/// </summary>
public ICommand CopyTextCommand { get; set; }
/// <summary> /// <summary>
/// 筛选数据 /// 筛选数据
/// </summary> /// </summary>
@ -295,7 +318,8 @@ namespace BBWY.Client.ViewModels.PackTask
ItemList = new List<SkuMessage>() { new SkuMessage ItemList = new List<SkuMessage>() { new SkuMessage
{ BrandName = item.BrandName, { BrandName = item.BrandName,
GoodsNo = item.ProductItemNum, Logo= item.Logo, GoodsNo = item.ProductItemNum, Logo= item.Logo,
ShopName = item.ShopName, SkuName = item.SkuName ShopName = item.ShopName, SkuName = item.SkuName,
Id = item.SkuId
} }, } },
MarkMessage = item.MarkMessage, MarkMessage = item.MarkMessage,
@ -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 #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 public MainViewModel Main
{ {
get get
@ -126,7 +100,7 @@ namespace BBWY.Client.ViewModels
{ {
get get
{ {
//IsCreateOrderList = true;
using (var s = sp.CreateScope()) using (var s = sp.CreateScope())
{ {
return s.ServiceProvider.GetRequiredService<TaskListViewModel>(); return s.ServiceProvider.GetRequiredService<TaskListViewModel>();
@ -137,7 +111,6 @@ namespace BBWY.Client.ViewModels
{ {
get get
{ {
//IsCreateOrderList = true;
using (var s = sp.CreateScope()) using (var s = sp.CreateScope())
{ {
return s.ServiceProvider.GetRequiredService<WareHouseListViewModel>(); return s.ServiceProvider.GetRequiredService<WareHouseListViewModel>();
@ -182,33 +155,16 @@ namespace BBWY.Client.ViewModels
} }
} }
//CreatePackTaskViewModel viewModel = null;
public CreatePackTaskViewModel CreateTaskView public CreatePackTaskViewModel CreateTaskView
{ {
get get
{ {
// return sp.GetRequiredService<CreatePackTaskViewModel>();
using (var s = sp.CreateScope()) using (var s = sp.CreateScope())
{ {
//if (viewModel == null)
// viewModel = s.ServiceProvider.GetRequiredService<CreatePackTaskViewModel>();
var viewModel = s.ServiceProvider.GetRequiredService<CreatePackTaskViewModel>(); var viewModel = s.ServiceProvider.GetRequiredService<CreatePackTaskViewModel>();
//bool areSame = object.ReferenceEquals(viewModel, sp.GetRequiredService<CreatePackTaskViewModel>()); //bool areSame = object.ReferenceEquals(viewModel, sp.GetRequiredService<CreatePackTaskViewModel>());
return viewModel; 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.TeamName}" Margin="5,0,0,0"/>
<TextBlock Text="{Binding GlobalContext.User.Shop.Platform}" 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="{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> </StackPanel>
</Border> </Border>
<Grid Grid.Row="1"> <Grid Grid.Row="1">

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

@ -331,7 +331,7 @@
<Grid Grid.Row="3"> <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}" Command="{Binding CreateTaskCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
Background="{StaticResource Button.Background}" BorderThickness="0" Foreground="White"/> Background="{StaticResource Button.Background}" BorderThickness="0" Foreground="White"/>

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

@ -1,4 +1,5 @@
using BBWY.Client.APIServices; using BBWY.Client.APIServices;
using BBWY.Client.Models;
using BBWY.Client.ViewModels; using BBWY.Client.ViewModels;
using BBWY.Client.ViewModels.PackTask; using BBWY.Client.ViewModels.PackTask;
using BBWY.Common.Models; using BBWY.Common.Models;
@ -39,9 +40,9 @@ namespace BBWY.Client.Views.PackTask
//DataContext = model; //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" /> <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"/> <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"/> <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> </Grid>
</Border> </Border>

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

@ -55,7 +55,7 @@ namespace BBWY.Client.Views.PackTask
} }
sb.Append(excutes[i]).Append(" "); sb.Append(excutes[i]).Append(" ");
} }
sb.Remove(sb.Length - 4, 4); sb.Remove(sb.Length - 3, 3);
data.ExcuteStander = sb.ToString(); 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" /> <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"/> <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"/> <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> </Grid>
</Border> </Border>

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

@ -3,9 +3,12 @@ using BBWY.Client.Models;
using BBWY.Controls; using BBWY.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
@ -94,7 +97,7 @@ namespace BBWY.Client.Views.PackTask
} }
sb.Append(excutes[i]).Append(" "); sb.Append(excutes[i]).Append(" ");
} }
sb.Remove(sb.Length - 4, 4); sb.Remove(sb.Length - 3, 3);
data.ExcuteStander = sb.ToString(); data.ExcuteStander = sb.ToString();
} }
@ -147,11 +150,26 @@ namespace BBWY.Client.Views.PackTask
{ {
try try
{ {
string path = Directory.GetCurrentDirectory()+ $"/Resources/LabelNames/{LabelName}.btw"; //string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
int printCount = Convert.ToInt32(tbCount.Text);
string printName =cbPrints.Text; //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);
//});
PrintBarCode(path,printCount,printName);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -161,20 +179,46 @@ namespace BBWY.Client.Views.PackTask
} }
/// <summary>
/// 打印条形码 private void Document_PrintPage(object sender, PrintPageEventArgs args)
/// </summary> {
private void PrintBarCode(string labelPath,int printNums,string PrintName)
Font font = new Font("宋体", 6, System.Drawing.FontStyle.Regular);
if (barCodeModel!=null)
{ {
BartenderHelper helper = new BartenderHelper(); MyPrintHelper.PrintBarcode(ref args, barCodeModel, font);
string msg = ""; }
helper.BTPrint(labelPath, Datas, out msg, printNums, PrintName); if (certificateModel!=null)
if (msg == "OK")
{ {
return; 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" CloseButtonVisibility="Visible"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
CloseButtonColor="{StaticResource WindowButtonColor}" CloseButtonColor="{StaticResource WindowButtonColor}"
MinButtonVisibility="Collapsed" MinButtonVisibility="Collapsed"
MaxButtonVisibility="Collapsed" MaxButtonVisibility="Collapsed"
RightButtonGroupMargin="0,5,5,0"> 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" /> <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"> <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}" BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0" MaxHeight="100" BorderThickness="1,1,1,0" MaxHeight="100"
Foreground="{StaticResource Text.Color}" Foreground="{StaticResource Text.Color}"
@ -73,7 +74,7 @@
<ColumnDefinition Width="40"/> <ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions> </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="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"/> <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" <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"/> 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"> <StackPanel Grid.Row="1" Orientation="Vertical" MaxHeight="140" Width="322" Margin="19,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent">
<ListBox <ListBox
ItemsSource="{Binding PackList}" MaxHeight="100" ItemsSource="{Binding PackList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" MaxHeight="100"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}" BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0" BorderThickness="1,1,1,0"
@ -135,7 +136,7 @@
<ColumnDefinition Width="40"/> <ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions> </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="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"/> <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" <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"/> 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"> <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" <ListBox MaxHeight="120" Name="consumable_listBox"
ItemsSource="{Binding ConsumableServiceList}" ItemsSource="{Binding ConsumableServiceList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}" ItemContainerStyle="{StaticResource NoBgListBoxItemStyle}"
BorderBrush="{StaticResource Border.Brush}" BorderBrush="{StaticResource Border.Brush}"
BorderThickness="1,1,1,0" BorderThickness="1,1,1,0"
@ -197,7 +198,7 @@
<ColumnDefinition Width="104"/> <ColumnDefinition Width="104"/>
<ColumnDefinition Width="40"/> <ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions> </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"/> <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" <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"/> 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; 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/> <ColumnDefinition/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" > <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"> <Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="220" Margin="5">
<StackPanel Orientation="Vertical" > <StackPanel Orientation="Vertical" >
@ -64,7 +64,7 @@
</StackPanel> </StackPanel>
<StackPanel Grid.Column="1" Orientation="Vertical" > <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"> <Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" Height="220" Margin="5">
<StackPanel Orientation="Vertical" > <StackPanel Orientation="Vertical" >

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

@ -38,7 +38,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid > <Grid >
<!--CommandParameter="{x:Static cmodel:CerHave3C.No3C}"--> <!--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"> <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid> <Grid>
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" /> <TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" />
@ -63,7 +63,7 @@
</Grid> </Grid>
<Grid Grid.Column="1" > <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"> <Border BorderBrush="Black" BorderThickness="1" Width="380" Height="297" Margin="13,50" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid > <Grid >
<TextBlock VerticalAlignment="Top" HorizontalAlignment="Left" Text="合格证" FontSize="18" Margin="157,12" /> <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" /> <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"/> <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> </Grid>
</Border> </Border>

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

@ -106,13 +106,23 @@
<TextBlock VerticalAlignment="Center" Text="提交时间:" Margin="14,0,0,0" /> <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 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="任务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"/> <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="部门:" Margin="14,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding DepartmentName}" Margin="5,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="对接人:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" /> <TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" />
</StackPanel> </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 Grid.Row="1"> <Grid Grid.Row="1">
@ -151,7 +161,7 @@
Cursor="Hand"> Cursor="Hand">
<b:Interaction.Triggers> <b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown"> <b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction > <b:InvokeCommandAction Command="{Binding DataContext.OpenSkuDetailCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
<b:InvokeCommandAction.CommandParameter> <b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}"> <MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/> <Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/>
@ -187,11 +197,14 @@
<Run Text="{Binding ShopName}"/> <Run Text="{Binding ShopName}"/>
</TextBlock> </TextBlock>
</StackPanel> </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}"> <TextBlock Foreground="{StaticResource Text.Gray}">
<Run Text="货号:" /> <Run Text="货号:" />
<Run Text="{Binding GoodsNo}"/>
</TextBlock> </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> </StackPanel>
</Grid> </Grid>
</DataTemplate> </DataTemplate>

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

@ -106,12 +106,19 @@
<TextBlock VerticalAlignment="Center" Text="提交时间:" Margin="14,0,0,0" /> <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 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="任务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"/> <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="部门:" 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="对接人:" Margin="16,0,0,0" />
<TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" /> <TextBlock VerticalAlignment="Center" Text="{Binding AcceptName}" Margin="5,0,0,0" />
</StackPanel> </StackPanel>
@ -152,7 +159,7 @@
Cursor="Hand"> Cursor="Hand">
<b:Interaction.Triggers> <b:Interaction.Triggers>
<b:EventTrigger EventName="PreviewMouseLeftButtonDown"> <b:EventTrigger EventName="PreviewMouseLeftButtonDown">
<b:InvokeCommandAction > <b:InvokeCommandAction Command="{Binding DataContext.OpenSkuDetailCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type Page}}}">
<b:InvokeCommandAction.CommandParameter> <b:InvokeCommandAction.CommandParameter>
<MultiBinding Converter="{StaticResource mptConverter}"> <MultiBinding Converter="{StaticResource mptConverter}">
<Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/> <Binding Path="DataContext.Id" RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox},AncestorLevel=1}"/>
@ -190,11 +197,14 @@
</TextBlock> </TextBlock>
</StackPanel> </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}"> <TextBlock Foreground="{StaticResource Text.Gray}">
<Run Text="货号:" /> <Run Text="货号:" />
<Run Text="{Binding GoodsNo}"/>
</TextBlock> </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> </StackPanel>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
@ -554,6 +564,7 @@
<c:BButton HorizontalAlignment="Center" Height="20" VerticalAlignment="Center" Background="White" Foreground="Black" Grid.Row="1" Content="设置" <c:BButton HorizontalAlignment="Center" Height="20" VerticalAlignment="Center" Background="White" Foreground="Black" Grid.Row="1" Content="设置"
Command="{Binding SetServiceCommand}" Command="{Binding SetServiceCommand}"
Visibility="Visible" /> Visibility="Visible" />
</Grid> </Grid>
</Grid> </Grid>

Loading…
Cancel
Save