提交代码
This commit is contained in:
@ -1,8 +1,13 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MiniExcelLibs;
|
||||
using NPOI.HPSF;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
@ -21,6 +26,85 @@ namespace WCS.WebApi.Controllers
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("uploadApp")]
|
||||
public async Task<ResponseBase> uploadApp([FromForm] IFormFile excelFile, [FromForm] string version, [FromForm] string content)
|
||||
{
|
||||
//文件校验
|
||||
if (excelFile == null || excelFile.Length == 0 || !excelFile.FileName.ToUpper().Contains("APK"))
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "上传失败:文件格式错误或文件为空!"
|
||||
};
|
||||
}
|
||||
//版本号输入参数的校验
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "上传失败:请输入上传文件的版本号version!"
|
||||
};
|
||||
}
|
||||
|
||||
//版本号输入参数的校验
|
||||
if (string.IsNullOrEmpty(content) || content.Length > 250)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"上传失败:请输入【更新内容】或者【更新内容】长度{content.Length}过长需要小于250!"
|
||||
};
|
||||
}
|
||||
|
||||
// 定义保存路径
|
||||
var savePath = Path.Combine(Directory.GetCurrentDirectory(), $"Files");
|
||||
// 确保文件夹存在
|
||||
if (!Directory.Exists(savePath))
|
||||
{
|
||||
Directory.CreateDirectory(savePath);
|
||||
}
|
||||
|
||||
// 构造文件完整路径
|
||||
var filePath = Path.Combine(savePath, excelFile.FileName);
|
||||
try
|
||||
{
|
||||
// 保存文件
|
||||
using (var stream = new FileStream(filePath, FileMode.Create))
|
||||
{
|
||||
await excelFile.CopyToAsync(stream);
|
||||
}
|
||||
|
||||
#region 保存数据
|
||||
var appVersion = new AppVersion()
|
||||
{
|
||||
AppName = excelFile.FileName,
|
||||
Version = version,
|
||||
Content = content,
|
||||
};
|
||||
DbHelp.db.Insertable(appVersion).ExecuteCommand();
|
||||
#endregion
|
||||
|
||||
// 文件上传成功,返回成功信息
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "上传成功!"
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 异常处理,返回错误信息
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "上传失败: " + ex.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("downloadApp")]
|
||||
public IActionResult downloadApp(string fileName)
|
||||
{
|
||||
@ -79,5 +163,49 @@ namespace WCS.WebApi.Controllers
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取最新的版本
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getLatestAppVersion")]
|
||||
public ResponseBase getLatestAppVersion()
|
||||
{
|
||||
try
|
||||
{
|
||||
var appVersion = DbHelp.db.Queryable<AppVersion>().OrderByDescending(t => t.Id).First(); ;
|
||||
if (appVersion != null)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = new
|
||||
{
|
||||
AppName = appVersion.AppName,
|
||||
Version = appVersion.Version,
|
||||
Content = appVersion.Content,
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "未获取到APK的最新版本",
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"请求失败:{ex.Message}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
ShelfId = t.ShelfId,
|
||||
ShelfCode = t.ShelfCode,
|
||||
CurrentCom = t.CurrentCom,
|
||||
SetCurrentModeTime = t.SetCurrentModeTime,
|
||||
CurentMode = (int)t.CurrentMode,
|
||||
ModulesStr = t.ModulesStr,
|
||||
GroupName = t.GroupName,
|
||||
@ -236,5 +238,56 @@ namespace WCS.WebApi.Controllers
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取货架对应的服务端的Ip和端口号
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Route("getShelfServer")]
|
||||
[HttpPost(Name = "getShelfServer")]
|
||||
public async Task<ResponseBase> getShelfServer(RequestBase request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _homerService.GetShelfServer(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "查询失败" + ex.Message,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Route("getWebSocketWarnings")]
|
||||
[HttpPost(Name = "getWebSocketWarnings")]
|
||||
public async Task<ResponseBase> getWebSocketWarnings(RequestBase request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "success",
|
||||
Data = WarningManager.Warnings
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<object>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "查询失败" + ex.Message,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using WCS.BLL;
|
||||
using WCS.BLL.HardWare;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
@ -34,18 +35,22 @@ namespace WebApi.Controllers
|
||||
string content = string.Empty;
|
||||
try
|
||||
{
|
||||
Logs.Write($"[request.IpAdress]{request.IpAdress}", LogsType.Instore);
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>IP<49><50>ַ
|
||||
var IPAdress = HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||
if (string.IsNullOrEmpty(IPAdress))
|
||||
if (string.IsNullOrEmpty(request.IpAdress))
|
||||
{
|
||||
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>IP<49><50>ַ
|
||||
//TO DO <20><>¼<EFBFBD><C2BC>־δ<D6BE><CEB4>ȡ<EFBFBD><C8A1>IP
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>Ip<49><70>ַ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>request
|
||||
request.IpAdress = IPAdress;
|
||||
var IPAdress = HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||
if (string.IsNullOrEmpty(IPAdress))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>Ip<49><70>ַ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>request
|
||||
request.IpAdress = IPAdress;
|
||||
}
|
||||
}
|
||||
Logs.Write($"[request.IpAdress]{request.IpAdress}", LogsType.Instore);
|
||||
return _instoreService.shelfGoInInStore(request);
|
||||
|
||||
}
|
||||
@ -140,7 +145,6 @@ namespace WebApi.Controllers
|
||||
[HttpPost(Name = "singleLightCommitInstore")]
|
||||
public async Task<ResponseBase> singleLightCommitInstore(QueryByMatSnRequestSingle request)
|
||||
{
|
||||
//TODO:<3A><><EFBFBD><EFBFBD> <20><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD>ύ<EFBFBD><E1BDBB><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
//var aa = Helper.Query();
|
||||
|
@ -13,7 +13,7 @@ using WCS.Model.WebSocketModel;
|
||||
namespace WCS.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 单灯单独控制亮灯接口 煤科院钻探分院项目
|
||||
/// 液晶面板 煤科院钻探分院项目
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
|
@ -294,7 +294,6 @@ namespace WebApi.Controllers
|
||||
[HttpPost(Name = "singleLightGoInOutstore")]
|
||||
public async Task<ResponseBase> singleLightGoInOutstore(GetOutOrderDetailRequest request)
|
||||
{
|
||||
//TODO:<3A><><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
return await _outstoreService.GoInOutstoreSingle(request);
|
||||
@ -342,7 +341,6 @@ namespace WebApi.Controllers
|
||||
[HttpPost(Name = "singleLightConfirmOutstore")]
|
||||
public async Task<ResponseBase> singleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
|
||||
{
|
||||
//TODO<44><4F><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
return await _outstoreService.SingleLightConfirmOutstore(request);
|
||||
|
@ -66,6 +66,13 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
return await _storeInfoService.queryModuleVoltage(request);
|
||||
}
|
||||
|
||||
[Route("calibrationSetOffset")]
|
||||
[HttpPost(Name = "calibrationSetOffset")]
|
||||
public async Task<ResponseBase> calibrationSetOffset(CalibrationSetOffsetRequest request)
|
||||
{
|
||||
return await _storeInfoService.calibrationSetOffset(request);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 库位管理
|
||||
|
BIN
WCS.WebApi/Files/智能货架.apk
Normal file
BIN
WCS.WebApi/Files/智能货架.apk
Normal file
Binary file not shown.
@ -28,7 +28,6 @@ namespace WebApi
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
||||
DbInit.InitDb();
|
||||
|
||||
|
||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
LocalFile.SaveConfig();
|
||||
|
||||
@ -46,9 +45,27 @@ namespace WebApi
|
||||
{
|
||||
MXBackgroundThread.InitBackgroundThread();
|
||||
var str = string.Empty;
|
||||
MXBackgroundThread.SendDingDingMsg("<EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>", new List<string> { "104379" }, ref str);
|
||||
MXBackgroundThread.SendDingDingMsg($"<22><>{LocalFile.Config.GroupName}<7D><><EFBFBD><EFBFBD>̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>", new List<string> { "104379" }, ref str);
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>־
|
||||
Task.Run(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>־
|
||||
WCS.BLL.Logs.Clear(TimeSpan.FromDays(92));
|
||||
//ÿһ<C3BF><D2BB>ִ<EFBFBD><D6B4>һ<EFBFBD><D2BB>
|
||||
await Task.Delay(1000 * 60 * 60 * 24);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
Reference in New Issue
Block a user