Qc 之前

This commit is contained in:
qianhao.xu 2024-12-17 18:31:31 +08:00
parent ac20efae2f
commit f4f612a39e
11 changed files with 79 additions and 17 deletions

View File

@ -12,6 +12,7 @@ using DOAN.Common.DynamicApiSimple.Extens;
using DOAN.Infrastructure.WebExtensions;
using DOAN.ServiceCore.Signalr;
using DOAN.ServiceCore.SqlSugar;
using Microsoft.Extensions.FileProviders;
var builder = WebApplication.CreateBuilder(args);
// NLog: Setup NLog for Dependency injection
@ -134,6 +135,19 @@ app.Use((context, next) =>
return next();
});
//开启访问静态文件/wwwroot目录文件要放在UseRouting前面
var fileProvider = new PhysicalFileProvider(InternalApp.Configuration.GetSection("Upload").GetSection("rootDirectory").Get<string>());
var requestPath = "/device";
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = fileProvider,
RequestPath = requestPath
});
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = fileProvider
});
app.UseStaticFiles();
//开启路由访问
app.UseRouting();
@ -165,5 +179,14 @@ app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.MapControllers();
app.UseDirectoryBrowser(new DirectoryBrowserOptions
{
FileProvider = fileProvider,
RequestPath = requestPath
});
app.Run();

View File

@ -3,7 +3,7 @@
{
//
"Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;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 = 3PgSql = 4
"ConfigId": "0", //
"IsAutoCloseConnection": true
@ -19,6 +19,15 @@
"DbName": "bzfm_mes" //,Oracle
},
"ShowDbLog": true, //db
"urls": "http://localhost:8888", //urldevServer
"corsUrls": [ "http://localhost:8887", "http://localhost:8886", "http://localhost:9090", "http://localhost:8080" ] //","
"urls": "http://0.0.0.0:8888", //urldevServer
"corsUrls": [ "http://localhost:8887", "http://localhost:8886", "http://localhost:9090", "http://localhost:8080" ], //","
"Upload": {
"rootDirectory": "D:/MES/file",
"uploadUrl": "http://172.18.32.1:8888", //访
"localSavePath": "", // wwwroot
"maxSize": 30, // 15M
"notAllowedExt": [ ".bat", ".exe", ".jar", ".js" ],
"requestLimitSize": 100 //body
}
}

View File

@ -24,13 +24,7 @@
"SingleLogin": false, ///
"workId": 1, //id
"sqlExecutionTime": 5, //Sql
"Upload": {
"uploadUrl": "http://127.0.0.1:8888", //访
"localSavePath": "", // wwwroot
"maxSize": 30, // 15M
"notAllowedExt": [ ".bat", ".exe", ".jar", ".js" ],
"requestLimitSize": 100 //body
},
//
"ALIYUN_OSS": {
"REGIONID": "", //egcn-hangzhou

View File

@ -27,7 +27,7 @@ namespace DOAN.Model.MES.base_.Dto
/// </summary>
public class BaseDeviceDto
{
[Required(ErrorMessage = "主键不能为空")]
// [Required(ErrorMessage = "主键不能为空")]
public int Id { get; set; }
public int? FkWorkStation { get; set; }

View File

@ -16,7 +16,7 @@ namespace DOAN.Model.MES.dev.Dto
/// </summary>
public class DeviceFormConfigDto
{
[Required(ErrorMessage = "id 雪花不能为空")]
//[Required(ErrorMessage = "id 雪花不能为空")]
public string Id { get; set; }
public int FkDeviceInspectId { get; set; }

View File

@ -46,7 +46,7 @@ namespace DOAN.Model.MES.dev.Dto
/// </summary>
public class DeviceInspectDto
{
[Required(ErrorMessage = "id不能为空")]
// [Required(ErrorMessage = "id不能为空")]
public int Id { get; set; }
public string Image { get; set; }

View File

@ -14,7 +14,7 @@ namespace DOAN.Model.MES.dev.Dto
/// </summary>
public class DeviceMaintenanceRecordDto
{
[Required(ErrorMessage = "id不能为空")]
// [Required(ErrorMessage = "id不能为空")]
public string Id { get; set; }
public string FkRepairId { get; set; }

View File

@ -19,7 +19,7 @@ namespace DOAN.Model.MES.dev.Dto
/// </summary>
public class DevicePointInspectionPlanDto
{
[Required(ErrorMessage = "id不能为空")]
// [Required(ErrorMessage = "id不能为空")]
public string Id { get; set; }
public string Name { get; set; }

View File

@ -41,7 +41,7 @@ namespace DOAN.Model.MES.dev.Dto
/// </summary>
public class DeviceRepairDto
{
[Required(ErrorMessage = "雪花id不能为空")]
// [Required(ErrorMessage = "雪花id不能为空")]
public string Id { get; set; }
public string RepairOrder { get; set; }

View File

@ -20,7 +20,7 @@ namespace DOAN.Model.MES.dev.Dto
/// </summary>
public class DeviceRouteInspectionPlanDto
{
[Required(ErrorMessage = "id不能为空")]
// [Required(ErrorMessage = "id不能为空")]
public string Id { get; set; }
public string Name { get; set; }

View File

@ -48,5 +48,41 @@ public class PrintHelper
}
/// <summary>
/// 打印二维码
/// </summary>
/// <param name="message"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public static byte[] CreateQcCode(string message, int width, int height)
{
if (string.IsNullOrWhiteSpace(message))
{
return null;
}
var w = new ZXing.OneD.Code128Writer();
BitMatrix b = w.encode(message, BarcodeFormat.QR_CODE, width, height);
var zzb = new ZXing.ZKWeb.BarcodeWriter();
zzb.Options = new EncodingOptions()
{
Margin = 0,
PureBarcode = false
};
Bitmap b2 = zzb.Write(b);
using (var ms = new System.IO.MemoryStream())
{
b2.Save(ms, ImageFormat.Png);
var bytes = ms.ToArray();
return bytes;
}
}
}