MES.Service/Dto/base/UpdateCheckRequest.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@  namespace MES.Service.Dto.@base; public class UpdateCheckRequest { public string version { get; set; } public string platform { get; set; } } MES.Service/Dto/base/VersionInfo.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,9 @@ namespace MES.Service.Dto.@base; public class VersionInfo { public string Version { get; set; } public string UpdateInfo { get; set; } public string WgtUrl { get; set; } public bool IsForceUpdate { get; set; } } MES.Service/Dto/service/UserPermission.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,17 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MES.Service.Dto.service { public class UserPermission { public string Name { get; set; } public string IconType { get; set; } public string Category { get; set; } public string Path { get; set; } public string Color { get; set; } } } MES.Service/Dto/service/WarehouseQuery.cs
@@ -35,4 +35,5 @@ public string? daa001 { get; set; } public decimal? Num { get; set; } } MES.Service/Dto/webApi/ErpItems.cs
@@ -33,4 +33,5 @@ public string? Expirationdate { get; set; } public string? Reviewperiod { get; set; } public decimal? FLeadDays { get; set; } } MES.Service/Dto/webApi/ErpRohIn.cs
@@ -41,6 +41,7 @@ public string? FApproveDate { get; set; } public string? FCHANGEREASON { get; set; } MES.Service/Dto/webApi/ErpRohinData.cs
@@ -49,6 +49,7 @@ public string? FDepotCode { get; set; } public string? FDepotName { get; set; } public string? FUrgent_material { get; set; } //public string? PurchaseOrderLineNumber { get; set; } //public string? Demand { get; set; } //public string? Receiving { get; set; } MES.Service/Modes/MesItems.cs
@@ -317,7 +317,11 @@ public decimal? ItemId { get; set; } /// <summary> /// åºå®åç½®å¤©æ° /// </summary> [SugarColumn(ColumnName = "LEAD_DAYS")] public decimal? LeadDays { get; set; } MES.Service/Modes/MesRohIn.cs
@@ -243,7 +243,7 @@ /// èªå®ä¹å段1 /// </summary> [SugarColumn(ColumnName = "REMARK1")] public string? Remark1 { get; set; } public decimal? Remark1 { get; set; } /// <summary> /// èªå®ä¹å段2 @@ -268,4 +268,6 @@ /// </summary> [SugarColumn(ColumnName = "REMARK5")] public string? Remark5 { get; set; } } MES.Service/Modes/MesRohInData.cs
@@ -357,5 +357,9 @@ [SugarColumn(ColumnName = "BILLNOTYPE")] public string? Billnotype { get; set; } /// <summary> /// æ¥æ /// </summary> [SugarColumn(ColumnName = "URGENT_MATERIAL")] public string? URGENT_MATERIAL { get; set; } } MES.Service/bin/Debug/net8.0/MES.Service.dllBinary files differ
MES.Service/bin/Debug/net8.0/MES.Service.pdbBinary files differ
MES.Service/service/BasicData/MesItemsManager.cs
@@ -159,7 +159,8 @@ Type = item.Type, Inspectionmethod = item.Inspectionmethod, Expirationdate = item.Expirationdate, Reviewperiod = item.Reviewperiod Reviewperiod = item.Reviewperiod, LeadDays = item.FLeadDays }; } MES.Service/service/BasicData/MesRohInManager.cs
@@ -186,7 +186,6 @@ mesRohIn.ErpCheckBy = rohIn.FApproverId; mesRohIn.ErpCheckDate = rohIn.FApproveDate; mesRohIn.Changereason = rohIn.FCHANGEREASON; return mesRohIn; } @@ -228,8 +227,9 @@ SourceDocumentId = s.FSrcBillNo, DemandTrackingId = s.FReqTraceNo, DepotCode = s.FDepotCode, DepotName = s.FDepotName }; DepotName = s.FDepotName, URGENT_MATERIAL = s.FUrgent_material }; MES.Service/service/SysUserService.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,330 @@ using MES.Service.DB; using MES.Service.Dto.service; using MES.Service.Dto.webApi; using MES.Service.Modes; using MES.Service.util; using Microsoft.Data.SqlClient; using SqlSugar; using System.Data; using System.Dynamic; namespace MES.Service.service { public class SysUserService : Repository<SysUser> { public List<UserPermission> QueryPurview(string userNo) { // è·åç¨æ·æéå表 List<string> purviewData = this.DoPurview(userNo); List<UserPermission> resultList = new List<UserPermission>(); if (purviewData.Count > 0) { string purviewString = purviewData[0]; string[] splitResult = purviewString.Split(new string[] { "[" }, StringSplitOptions.None); if (splitResult.Length > 2) { for (int i = 2; i < splitResult.Length; i++) { string trimmedStr = splitResult[i].Trim(); // å»æç©ºæ ¼ string[] itemArray = trimmedStr.Split(new char[] { '#' }); UserPermission permission = new UserPermission { Name = itemArray[0], Category = "å ¨é¨åºç¨", IconType = itemArray[1], Path = "input" , Color = itemArray[2] }; resultList.Add(permission); } } } // æ·»å éåºé项 /* resultList.Add(new UserPermission { Name = "éåº", Category = "å ¨é¨åºç¨", IconType = "close", Path = "/logout", Color = "red" });*/ return resultList; } private List<string> DoPurview(string userNo) { List<string> resultList = new List<string>(); try { // å®ä¹è¾å ¥åæ° var inputParam1 = new SugarParameter("c_User_No", userNo.ToUpper()); var inputParam2 = new SugarParameter("c_MachType", "AN"); // å®ä¹è¾åºåæ° var outParam = new SugarParameter("c_Result", null, true); // 使ç¨SqlSugaræ§è¡åå¨è¿ç¨ Db.Ado.ExecuteCommand("BEGIN Prc_rf_j2_user_login(:c_User_No, :c_MachType, :c_Result); END;", inputParam1, inputParam2, outParam); // è·åè¾åºåæ°çå¼ string result = outParam.Value == DBNull.Value ? string.Empty : (string)outParam.Value; // æ·»å å°ç»æå表 if (!string.IsNullOrEmpty(result)) { resultList.Add(result); } } catch (Exception ex) { // è®°å½å¼å¸¸ Console.WriteLine($"è·åç¨æ·æé失败: {ex.Message}"); // å¯ä»¥éæ©æåºå¼å¸¸æè¿å空å表 } return resultList; } /// <summary> /// è·ååè½çé¢è®¾ç½® /// </summary> /// <param name="functionName">åè½åç§°</param> /// <summary> /// è·ååè½çé¢è®¾ç½® /// </summary> /// <param name="functionName">åè½åç§°</param> /// <returns>åè½çé¢è®¾ç½®ä¿¡æ¯</returns> public ResponseResult GetRfSetup(string functionName) { try { List<string> setupData = DoRfSetup(functionName); if (setupData.Count > 0 && !string.IsNullOrEmpty(setupData[0])) { dynamic resultInfos = new ExpandoObject(); resultInfos.setupData = setupData[0]; return new ResponseResult { status = 0, message = "æ¥è¯¢åè½ç颿åï¼", data = resultInfos }; } else { return new ResponseResult { status = 1, message = "æªæ¾å°åè½çé¢è®¾ç½®ï¼" }; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); return new ResponseResult { status = 1, message = "æ¥è¯¢åè½çé¢å¤±è´¥ï¼" }; } } /// <summary> /// è·ååè½çé¢è®¾ç½®æ°æ® /// </summary> /// <param name="functionName">åè½åç§°</param> /// <returns>åè½çé¢è®¾ç½®æ°æ®å表</returns> private List<string> DoRfSetup(string functionName) { List<string> resultList = new List<string>(); try { // å®ä¹è¾å ¥åæ° var inputParam1 = new SugarParameter("functionName", functionName); var inputParam2 = new SugarParameter("deviceType", "AN"); // å®ä¹è¾åºåæ° var outParam = new SugarParameter("result", null, true); // 使ç¨SqlSugaræ§è¡åå¨è¿ç¨ Db.Ado.ExecuteCommand("BEGIN Prc_rf_setup(:functionName, :deviceType, :result); END;", inputParam1, inputParam2, outParam); // è·åè¾åºåæ°çå¼ string result = outParam.Value == DBNull.Value ? string.Empty : (string)outParam.Value; // æ·»å å°ç»æå表 if (!string.IsNullOrEmpty(result)) { resultList.Add(result); } } catch (Exception ex) { // è®°å½å¼å¸¸ Console.WriteLine($"è·ååè½çé¢è®¾ç½®å¤±è´¥: {ex.Message}"); // å¯ä»¥éæ©æåºå¼å¸¸æè¿å空å表 } return resultList; } public ResponseResult GetExcProc(string functionName, string fileName, string pmachtype, string fileValue, string outFiles) { try { List<string> resultList = DoExcProc(functionName, fileName, pmachtype, fileValue); Console.WriteLine(string.Join(", ", resultList)); if (resultList.Count > 0) { string s = resultList[0]; string[] strs = s.Split('['); if (strs.Length < 1) { return new ResponseResult { status = 1, message = "è¿åå¼çæ ¼å¼ä¸æ£ç¡®!" + string.Join(", ", resultList) }; } // 夿å弿¯å¦æå string str = strs[0]; if (str.Equals("002")) { return new ResponseResult { status = 1, message = strs[1] }; } else { if (string.IsNullOrEmpty(outFiles)) { if (strs.Length < 2) { return new ResponseResult { status = 0, data = "" }; } return new ResponseResult { status = 0, data = strs[1] }; } else { List<string[]> at = new List<string[]>(); // [001[4500108372,80000123,100,ç©æ80000123仿¥å·²æ¶è´§ 100] string[] files = outFiles.Split(','); string[] res = strs[1].Split(new char[] { ',' }, StringSplitOptions.None); for (int i = 0; i < files.Length; i++) { string[] temp = new string[2]; temp[0] = files[i]; temp[1] = res[i]; at.Add(temp); } return new ResponseResult { status = 0, data = at }; } } } return new ResponseResult { status = 0, data = resultList }; } catch (Exception ex) { Console.WriteLine(ex.ToString()); return new ResponseResult { status = 1, message = "æ§è¡åå¨è¿ç¨å¤±è´¥ï¼" + ex.Message }; } } /// <summary> /// æ§è¡åå¨è¿ç¨ /// </summary> /// <param name="functionName">åè½åç§°</param> /// <param name="fileName">åæ®µå</param> /// <param name="pmachtype">设å¤ç±»å</param> /// <param name="fileValue">åæ°å¼</param> /// <returns>åå¨è¿ç¨æ§è¡ç»æ</returns> private List<string> DoExcProc(string functionName, string fileName, string pmachtype, string fileValue) { List<string> resultList = new List<string>(); try { // å®ä¹è¾å ¥åæ° var inputParam1 = new SugarParameter("functionName", functionName); var inputParam2 = new SugarParameter("fileName", fileName?.Trim()); var inputParam3 = new SugarParameter("pmachtype", "AN"); // 设å¤ç±»å wince5,wmb5,wmb6 var inputParam4 = new SugarParameter("fileValue", fileValue); // åæ°å¼[第ä¸ä½æ¯ç¨æ·] // å®ä¹è¾åºåæ° var outParam = new SugarParameter("result", null, true); // 使ç¨SqlSugaræ§è¡åå¨è¿ç¨ Db.Ado.ExecuteCommand("BEGIN Prc_rf_setup_ExcProc(:functionName, :fileName, :pmachtype, :fileValue, :result); END;", inputParam1, inputParam2, inputParam3, inputParam4, outParam); // è·åè¾åºåæ°çå¼ string result = outParam.Value == DBNull.Value ? string.Empty : (string)outParam.Value; // æ·»å å°ç»æå表 if (!string.IsNullOrEmpty(result)) { resultList.Add(result); } } catch (Exception ex) { // è®°å½å¼å¸¸ Console.WriteLine($"æ§è¡åå¨è¿ç¨å¤±è´¥: {ex.Message}"); // å¯ä»¥éæ©æåºå¼å¸¸æè¿å空å表 } return resultList; } } } MESApplication/Controllers/Base/UpdateController.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,80 @@ using System.Dynamic; using MES.Service.Dto.@base; using MES.Service.service; using MES.Service.util; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; namespace MESApplication.Controllers.Base; [ApiController] [Route("api/[controller]")] public class UpdateController : ControllerBase { [HttpPost] [Route("checkUpdate")] public ResponseResult CheckUpdate([FromBody] UpdateCheckRequest request) { try { // ä»é ç½®æä»¶ææ°æ®åºè·åææ°çæ¬ä¿¡æ¯ var latestVersion = GetLatestVersion(request.platform); // æ¯è¾çæ¬å· if (CompareVersion(request.version, latestVersion.Version) < 0) { // éè¦æ´æ° return new ResponseResult { status = 0, message = "åç°æ°çæ¬", data = new { hasUpdate = true, version = latestVersion.Version, updateInfo = latestVersion.UpdateInfo, wgtUrl = latestVersion.WgtUrl, isForceUpdate = latestVersion.IsForceUpdate } }; } else { // ä¸éè¦æ´æ° return new ResponseResult { status = 0, message = "å½åå·²æ¯ææ°çæ¬", data = new { hasUpdate = false } }; } } catch (Exception ex) { return ResponseResult.ResponseError(ex); } } // è·åææ°çæ¬ä¿¡æ¯ public VersionInfo GetLatestVersion(string platform) { // è¿éå¯ä»¥ä»æ°æ®åºæé ç½®æä»¶ä¸è¯»å // 示ä¾ä¸ç´æ¥è¿å硬ç¼ç ççæ¬ä¿¡æ¯ return new VersionInfo { Version = "1.0.1", UpdateInfo = "1. ä¿®å¤äºä¸äºå·²ç¥é®é¢\n2. ä¼åäºç¨æ·ä½éª\n3. æ°å¢äºä¸äºåè½", WgtUrl = "https://192.168.1.223:8085/updates/app_update_1.0.1.wgt", IsForceUpdate = false }; } // æ¯è¾çæ¬å· private int CompareVersion(string version1, string version2) { var v1 = new Version(version1); var v2 = new Version(version2); return v1.CompareTo(v2); } } MESApplication/Controllers/BasicData/ModulesController.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,132 @@  using System.Dynamic; using System.Net; using MES.Service.Dto.service; using MES.Service.Modes; using MES.Service.service; using MES.Service.util; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; namespace MESApplication.Controllers.BasicData; [Route("api/[controller]")] [ApiController] public class ModulesController : ControllerBase { private readonly SysUserService _sysUserService = new SysUserService(); /// <summary> /// æ¥è¯¢æé /// </summary> /// <param name="userno">ç¨æ·Id</param> /// <returns>æéä¿¡æ¯</returns> [HttpPost("queryPurview")] public ResponseResult QueryPurview([FromBody] JObject data) { var userno = data["userno"]?.ToString(); try { List<UserPermission> userForBase = _sysUserService.QueryPurview(userno); if (userForBase.Count == 0) { return new ResponseResult { status = 1, message = "æéä¸åå¨ï¼" }; } else { dynamic resultInfos = new ExpandoObject(); resultInfos.tbBillList = userForBase; return new ResponseResult { status = 0, message = "æ¥è¯¢æéæåï¼", data = resultInfos }; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); return new ResponseResult { status = 1, message = "æ¥è¯¢æé失败ï¼" }; } } /// <summary> /// åè½çé¢ /// </summary> /// <param name="functionName">æ¹æ³åç§°</param> /// <returns>åè½çé¢ä¿¡æ¯</returns> [HttpPost("getRfSetup")] public ResponseResult GetRfSetup([FromBody] JObject data) { var functionName = data["functionName"]?.ToString(); try { Console.WriteLine(functionName); string decodedFunctionName = WebUtility.UrlDecode(functionName); return _sysUserService.GetRfSetup(functionName); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return new ResponseResult { status = 1, message = "æ¥è¯¢åè½çé¢å¤±è´¥ï¼" }; } } /// <summary> /// åè½æ§è¡åå¨è¿ç¨ /// </summary> /// <param name="data">请æ±åæ°</param> /// <returns>APIååºç»æ</returns> [HttpPost("getExcProc")] public ResponseResult GetExcProc([FromBody] JObject data) { var functionName = data["functionName"]?.ToString(); var fileName = data["fileName"]?.ToString(); var pmachtype = data["pmachtype"]?.ToString(); var fileValue = data["fileValue"]?.ToString(); var outFiles = data["outFiles"]?.ToString(); try { Console.WriteLine(functionName); string decodedFunctionName = WebUtility.UrlDecode(functionName); return _sysUserService.GetExcProc(decodedFunctionName, fileName, pmachtype, fileValue, outFiles); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return new ResponseResult { status = 1, message = "æ¥è¯¢åè½çé¢å¤±è´¥ï¼" }; } } } MESApplication/Properties/launchSettings.json
@@ -25,7 +25,7 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://192.168.1.164:10054", "applicationUrl": "http://localhost:10054", "sslPort": 0 } } MESApplication/bin/Debug/net8.0/MES.Service.dllBinary files differ
MESApplication/bin/Debug/net8.0/MES.Service.pdbBinary files differ
MESApplication/bin/Debug/net8.0/MESApplication.dllBinary files differ
MESApplication/bin/Debug/net8.0/MESApplication.exeBinary files differ
MESApplication/bin/Debug/net8.0/MESApplication.pdbBinary files differ
MESApplication/bin/Debug/net8.0/MESApplication.xml
@@ -498,6 +498,27 @@ </summary> <returns></returns> </member> <member name="M:MESApplication.Controllers.BasicData.ModulesController.QueryPurview(Newtonsoft.Json.Linq.JObject)"> <summary> æ¥è¯¢æé </summary> <param name="userno">ç¨æ·Id</param> <returns>æéä¿¡æ¯</returns> </member> <member name="M:MESApplication.Controllers.BasicData.ModulesController.GetRfSetup(Newtonsoft.Json.Linq.JObject)"> <summary> åè½çé¢ </summary> <param name="functionName">æ¹æ³åç§°</param> <returns>åè½çé¢ä¿¡æ¯</returns> </member> <member name="M:MESApplication.Controllers.BasicData.ModulesController.GetExcProc(Newtonsoft.Json.Linq.JObject)"> <summary> åè½æ§è¡åå¨è¿ç¨ </summary> <param name="data">请æ±åæ°</param> <returns>APIååºç»æ</returns> </member> <member name="M:MESApplication.Controllers.BasicData.SalesOrderController.GetList"> <summary> è·åææ