添加报工人

This commit is contained in:
qianhao.xu
2024-12-16 13:46:46 +08:00
parent 73b6acd375
commit ac20efae2f
12 changed files with 188 additions and 52 deletions

View File

@@ -92,17 +92,16 @@ namespace DOAN.Admin.WebApi.Controllers
/// 存储文件
/// </summary>
/// <param name="uploadDto">自定义文件名</param>
/// <param name="file"></param>
/// <param name="storeType">上传类型1、保存到本地 2、保存到阿里云</param>
/// <returns></returns>
[HttpPost()]
[Verify]
[ActionPermissionFilter(Permission = "common")]
public async Task<IActionResult> UploadFile([FromForm] UploadDto uploadDto, IFormFile file, StoreType storeType = StoreType.LOCAL)
public async Task<IActionResult> UploadFile([FromForm] UploadDto2 uploadDto, StoreType storeType = StoreType.LOCAL)
{
if (file == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
SysFile sysfile = new();
IFormFile formFile = file;
IFormFile formFile = uploadDto.File;
if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
SysFile file = new();
string fileExt = Path.GetExtension(formFile.FileName);//文件后缀
double fileSize = Math.Round(formFile.Length / 1024.0, 2);//文件大小KB
@@ -121,12 +120,27 @@ namespace DOAN.Admin.WebApi.Controllers
switch (storeType)
{
case StoreType.LOCAL:
string savePath = Path.Combine(WebHostEnvironment.WebRootPath);
string savePath = null;
if (string.IsNullOrEmpty(OptionsSetting.Upload.rootDirectory))
{
savePath = Path.Combine(WebHostEnvironment.WebRootPath);
}
else
{
savePath = Path.Combine(OptionsSetting.Upload.rootDirectory);
if (!Directory.Exists(savePath))
{
Directory.CreateDirectory(savePath);
}
}
if (uploadDto.FileDir.IsEmpty())
{
uploadDto.FileDir = OptionsSetting.Upload.LocalSavePath;
}
sysfile = await SysFileService.SaveFileToLocal(savePath, uploadDto.FileName, uploadDto.FileDir, HttpContext.GetName(), formFile);
//savePath 根目录 uploadDto.FileName uploadDto.FileName
file = await SysFileService.SaveFileToLocal(savePath, uploadDto.FileName, uploadDto.FileName, HttpContext.GetName(), formFile, uploadDto.filePath);
break;
case StoreType.REMOTE:
break;
@@ -140,14 +154,14 @@ namespace DOAN.Admin.WebApi.Controllers
{
return ToResponse(ResultCode.CUSTOM_ERROR, "上传文件过大,不能超过 " + AlimaxContentLength + " MB");
}
sysfile = new(formFile.FileName, uploadDto.FileName, fileExt, fileSize + "kb", uploadDto.FileDir, HttpContext.GetName())
file = new(formFile.FileName, uploadDto.FileName, fileExt, fileSize + "kb", uploadDto.FileDir, HttpContext.GetName())
{
StoreType = (int)StoreType.ALIYUN,
FileType = formFile.ContentType
};
sysfile = await SysFileService.SaveFileToAliyun(sysfile, formFile);
file = await SysFileService.SaveFileToAliyun(file, formFile);
if (sysfile.Id <= 0) { return ToResponse(ApiResult.Error("阿里云连接失败")); }
if (file.Id <= 0) { return ToResponse(ApiResult.Error("阿里云连接失败")); }
break;
case StoreType.TENCENT:
break;
@@ -158,12 +172,31 @@ namespace DOAN.Admin.WebApi.Controllers
}
return SUCCESS(new
{
url = sysfile.AccessUrl,
fileName = sysfile.FileName,
fileId = sysfile.Id.ToString()
url = file.AccessUrl,
fileName = file.FileName,
fileId = file.Id.ToString()
});
}
public class UploadDto2
{
/// <summary>
/// 自定文件名
/// </summary>
public string? FileName { get; set; }
/// <summary>
/// 存储目录
/// </summary>
public string? FileDir { get; set; }
/// <summary>
/// 文件名生成类型 1 原文件名 2 自定义 3 自动生成
/// </summary>
public int FileNameType { get; set; }
/// <summary>
/// 存储目录 比FileDir 优先
/// </summary>
public string filePath { get; set; }
public IFormFile? File { get; set; }
}
#endregion
/// <summary>

View File

@@ -56,14 +56,14 @@ public class ReportFlowController : BaseController
}
//TODO 领料工序
[HttpGet("feed_process_reportwork")]
public IActionResult FeedProcessReportwork(string workorder, int processId, int finish_num,string stove_code,string feed_order)
public IActionResult FeedProcessReportwork(string workorder, int processId, int finish_num,string stove_code,string feed_order,string process_operator)
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.FeedProcessReportwork(workorder, processId, finish_num, stove_code, feed_order, HttpContext.GetNickName()));
return SUCCESS(_reportFlowService.FeedProcessReportwork(workorder, processId, finish_num, stove_code, feed_order, process_operator));
}
//TODO 工序报工
@@ -77,26 +77,26 @@ public class ReportFlowController : BaseController
/// <returns></returns>
/// <exception cref="CustomException"></exception>
[HttpGet("process_reportwork")]
public IActionResult ProcessReportWork(string workorder, int processId, int finish_num,int bad_num)
public IActionResult ProcessReportWork(string workorder, int processId, int finish_num,int bad_num,string process_operator)
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.ProcessReportWork(workorder, processId, finish_num,bad_num,HttpContext.GetNickName()));
return SUCCESS(_reportFlowService.ProcessReportWork(workorder, processId, finish_num,bad_num, process_operator));
}
//TODO 出货工序
[HttpGet("shipment_process_reportwork")]
public IActionResult ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order)
public IActionResult ShipmentProcessReportwork(string workorder, int processId, int finish_num, int bad_num, string customer_order, string process_operator)
{
if (string.IsNullOrEmpty(workorder))
{
throw new CustomException("workorder or process is null");
}
return SUCCESS(_reportFlowService.ShipmentProcessReportwork(workorder, processId, finish_num, bad_num, customer_order, HttpContext.GetNickName()));
return SUCCESS(_reportFlowService.ShipmentProcessReportwork(workorder, processId, finish_num, bad_num, customer_order, process_operator));
}
//TODO 获取工单下的报工列表

View File

@@ -0,0 +1,7 @@
### GET request to example server
GET https://examples.http-client.intellij.net/get
?generated-in=JetBrains Rider
### 工单打印接口
GET http://localhost:8888/mes/productManagement/ProWorkorder/print?workorderArray=20241210_3A_1_001
##

View File

@@ -2,7 +2,8 @@
"dbConfigs": [
{
// 远程测试服务器
"Conn": "Data Source=192.168.0.58;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=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

View File

@@ -19,5 +19,13 @@
},
"ShowDbLog": false, //是否打印db日志
"urls": "http://0.0.0.0:8888", //项目启动url如果改动端口前端对应devServer也需要进行修改
"corsUrls": [ "http://localhost:8887", "http://localhost:8886", "http://localhost:9090", "http://localhost:8080" ] //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
"corsUrls": [ "http://localhost:8887", "http://localhost:8886", "http://localhost:9090", "http://localhost:8080" ], //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
"Upload": {
"rootDirectory": "D:/MES/file",
"uploadUrl": "http://127.0.0.1:7000", //本地存储资源访问路径
"localSavePath": "", //本地上传默认文件存储目录 wwwroot+localSavePath
"maxSize": 15, //上传文件大小限制 15M
"notAllowedExt": [ ".bat", ".exe", ".jar", ".js" ]
}
}