移除BarTender依赖并更新数据库配置
移除了对BarTender的COM引用及相关代码逻辑,更新了 `appsettings.Development.json`中的数据库连接配置,替换为 新的远程服务器信息。新增`global.json`文件以指定.NET SDK 版本为8.0.416,确保项目运行环境一致性。保留了对NPOI和 QuestPDF的依赖支持。 切换数据库连接并移除BarTender依赖,锁定SDK版本 本次提交主要内容: - 数据库连接切换至 115.190.214.62,并同步更新代码生成连接字符串。 - 移除 BarTender 相关 COM 组件依赖及打印实现,PrintTicketsByTemplate 方法暂时返回 null。 - 新增 global.json,锁定 .NET SDK 版本为 8.0.416,确保开发环境一致性。
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
"dbConfigs": [
|
"dbConfigs": [
|
||||||
{
|
{
|
||||||
// 远程测试服务器
|
// 远程测试服务器
|
||||||
// "Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=bzfm_mes;Port=3306",
|
// "Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog=bzfm_mes;Port=3306",
|
||||||
"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog=bzfm_mes;Port=3308",
|
"Conn": "Data Source=115.190.214.62;User ID=bzfm_mes;Password=rSRGTzccN2ZQtnas;Initial Catalog=bzfm_mes;Port=3308",
|
||||||
// "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog=bzfm_mes;Port=3306",
|
// "Conn": "Data Source=192.168.0.58;User ID=root;Password=123456;Initial Catalog=bzfm_mes;Port=3306",
|
||||||
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
||||||
"ConfigId": "0", //多租户唯一标识
|
"ConfigId": "0", //多租户唯一标识
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
//代码生成数据库配置
|
//代码生成数据库配置
|
||||||
"CodeGenDbConfig": {
|
"CodeGenDbConfig": {
|
||||||
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
|
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
|
||||||
"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog={dbName};Port=3308",
|
"Conn": "Data Source=115.190.214.62;User ID=root;Password=rSRGTzccN2ZQtnas;Initial Catalog={dbName};Port=3308",
|
||||||
"DbType": 0,
|
"DbType": 0,
|
||||||
"IsAutoCloseConnection": true,
|
"IsAutoCloseConnection": true,
|
||||||
"DbName": "bzfm_mes" //代码生成默认连接数据库,Oracle库是实例的名称
|
"DbName": "bzfm_mes" //代码生成默认连接数据库,Oracle库是实例的名称
|
||||||
|
|||||||
@@ -8,17 +8,6 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<NoWarn>1591</NoWarn>
|
<NoWarn>1591</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
|
||||||
<COMReference Include="BarTender">
|
|
||||||
<WrapperTool>tlbimp</WrapperTool>
|
|
||||||
<VersionMinor>1</VersionMinor>
|
|
||||||
<VersionMajor>10</VersionMajor>
|
|
||||||
<Guid>d58562c1-e51b-11cf-8941-00a024a9083f</Guid>
|
|
||||||
<Lcid>0</Lcid>
|
|
||||||
<Isolated>false</Isolated>
|
|
||||||
<EmbedInteropTypes>true</EmbedInteropTypes>
|
|
||||||
</COMReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NPOI" Version="2.7.2" />
|
<PackageReference Include="NPOI" Version="2.7.2" />
|
||||||
<PackageReference Include="QuestPDF" Version="2024.12.1" />
|
<PackageReference Include="QuestPDF" Version="2024.12.1" />
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using System;
|
|||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using BarTender;
|
//using BarTender;
|
||||||
using DOAN.Infrastructure.Helper;
|
using DOAN.Infrastructure.Helper;
|
||||||
using DOAN.Model;
|
using DOAN.Model;
|
||||||
using DOAN.Model.MES.base_;
|
using DOAN.Model.MES.base_;
|
||||||
@@ -1505,50 +1505,51 @@ namespace DOAN.Service.MES.product
|
|||||||
ProWorkorderExportDto param
|
ProWorkorderExportDto param
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
var dataList = await Context
|
return null;
|
||||||
.Queryable<ProWorkorder>()
|
//var dataList = await Context
|
||||||
.Where(p => param.WorkorderArray.Contains(p.Workorder))
|
// .Queryable<ProWorkorder>()
|
||||||
.ToListAsync();
|
// .Where(p => param.WorkorderArray.Contains(p.Workorder))
|
||||||
if (dataList.Count == 0)
|
// .ToListAsync();
|
||||||
{
|
//if (dataList.Count == 0)
|
||||||
return new CustomException(500, "未找到匹配的工单数据");
|
//{
|
||||||
}
|
// return new CustomException(500, "未找到匹配的工单数据");
|
||||||
Application bartenderApp = null;
|
//}
|
||||||
Format bartenderFormat = null;
|
//Application bartenderApp = null;
|
||||||
try
|
//Format bartenderFormat = null;
|
||||||
{
|
//try
|
||||||
bartenderApp = new Application { Visible = false };
|
//{
|
||||||
bartenderFormat = bartenderApp.Formats.Open(param.Path);
|
// bartenderApp = new Application { Visible = false };
|
||||||
// 4. 遍历数据并打印
|
// bartenderFormat = bartenderApp.Formats.Open(param.Path);
|
||||||
foreach (var data in dataList)
|
// // 4. 遍历数据并打印
|
||||||
{
|
// foreach (var data in dataList)
|
||||||
bartenderFormat.SetNamedSubStringValue("workorder", data.Workorder);
|
// {
|
||||||
bartenderFormat.SetNamedSubStringValue("stoveCode", data.StoveCode);
|
// bartenderFormat.SetNamedSubStringValue("workorder", data.Workorder);
|
||||||
bartenderFormat.SetNamedSubStringValue("qty", data.PlanNum.ToString());
|
// bartenderFormat.SetNamedSubStringValue("stoveCode", data.StoveCode);
|
||||||
await Task.Delay(500);
|
// bartenderFormat.SetNamedSubStringValue("qty", data.PlanNum.ToString());
|
||||||
bartenderFormat.PrintOut(false, false); // 静默打印
|
// await Task.Delay(500);
|
||||||
}
|
// bartenderFormat.PrintOut(false, false); // 静默打印
|
||||||
|
// }
|
||||||
|
|
||||||
return new CustomException(200, "标签打印成功");
|
// return new CustomException(200, "标签打印成功");
|
||||||
}
|
//}
|
||||||
catch (Exception ex)
|
//catch (Exception ex)
|
||||||
{
|
//{
|
||||||
// 5. 错误处理(记录日志)
|
// // 5. 错误处理(记录日志)
|
||||||
Console.WriteLine($"打印标签时出错: {ex.Message}");
|
// Console.WriteLine($"打印标签时出错: {ex.Message}");
|
||||||
return new CustomException(500, $"打印标签失败: {ex.Message}");
|
// return new CustomException(500, $"打印标签失败: {ex.Message}");
|
||||||
}
|
//}
|
||||||
finally
|
//finally
|
||||||
{
|
//{
|
||||||
// 6. 确保资源释放(逆序关闭)
|
// // 6. 确保资源释放(逆序关闭)
|
||||||
if (bartenderFormat != null)
|
// if (bartenderFormat != null)
|
||||||
{
|
// {
|
||||||
bartenderFormat.Close(BtSaveOptions.btDoNotSaveChanges);
|
// bartenderFormat.Close(BtSaveOptions.btDoNotSaveChanges);
|
||||||
}
|
// }
|
||||||
if (bartenderApp != null)
|
// if (bartenderApp != null)
|
||||||
{
|
// {
|
||||||
bartenderApp.Quit(BtSaveOptions.btDoNotSaveChanges);
|
// bartenderApp.Quit(BtSaveOptions.btDoNotSaveChanges);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
global.json
Normal file
6
global.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"sdk": {
|
||||||
|
"version": "8.0.416",
|
||||||
|
"rollForward": "patch"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user