From 19d0afadbe1c90e227b852db0a97ae413e90691f Mon Sep 17 00:00:00 2001 From: wtt <1985833171@qq.com> Date: 星期日, 29 九月 2024 19:13:25 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/BaseSet/Gy_SupplierController.cs | 79 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 79 insertions(+), 0 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_SupplierController.cs b/WebAPI/Controllers/BaseSet/Gy_SupplierController.cs index 348db1d..11b96af 100644 --- a/WebAPI/Controllers/BaseSet/Gy_SupplierController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_SupplierController.cs @@ -8,6 +8,7 @@ using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; +using System.Text.RegularExpressions; namespace WebAPI.Controllers { public class Gy_SupplierController : ApiController @@ -109,6 +110,83 @@ return objJsonResult; } } + + #region 瀹㈡埛鏍规嵁鍒嗙被鑾峰彇鏈�澶у鎴风紪鐮� + [Route("Gy_Supplier/getMaxNum")] + [HttpGet] + public object getMaxNum(int HSupTypeID, string user, string Organization) + { + try + { + List<object> columnNameList = new List<object>(); + //缂栬緫鏉冮檺 + if (!DBUtility.ClsPub.Security_Log_second("Gy_Supplier", 1, false, user)) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒"; + objJsonResult.data = null; + return objJsonResult; + } + if (HSupTypeID == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "娌℃湁閫夋嫨鍏蜂綋鍒嗙被锛�"; + objJsonResult.data = null; + return objJsonResult; + } + else + { + ds = oCN.RunProcReturn(@"select * from h_v_Gy_SupplierList where 缁勭粐鍚嶇О='" + Organization + "'" + "and HSupTypeID = '" + HSupTypeID + "'" + " order by 渚涘簲鍟嗕唬鐮� desc", "h_v_Gy_SupplierList"); + if (ds == null || ds.Tables[0].Rows.Count == 0) + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "娌℃湁鎵惧埌璇ュ垎绫荤殑瀹㈡埛缂栫爜璇蜂娇鐢ㄦ櫘閫氭柊澧�"; + objJsonResult.data = null; + return objJsonResult; + } + string HNumber = ds.Tables[0].Rows[0]["渚涘簲鍟嗕唬鐮�"].ToString(); + // 浣跨敤姝e垯琛ㄨ揪寮忔壘鍒版暟瀛楅儴鍒� (?<=\D)鏄竴涓浂瀹芥柇瑷�锛岃〃绀哄墠闈㈢殑瀛楃涓嶆槸鏁板瓧 (\d+)$琛ㄧず鍚庨潰璺熺潃涓�杩炰覆瀛楃涓茬煡閬撴湯灏� + Match match = Regex.Match(HNumber, @"(?<=\D)(\d+)$"); + if (match.Success) + { + string prefix = HNumber.Substring(0, HNumber.Length - match.Length); // 鎻愬彇鍓嶇紑 + int number = int.Parse(match.Value); // 瑙f瀽鏁板瓧 + // 鏁板瓧+1 + number++; + // 鏍煎紡鍖栨暟瀛楋紝淇濇寔鍘熼暱搴� + string formattedNumber = number.ToString().PadLeft(match.Length, '0'); + // 閲嶆柊缁勫悎瀛楃涓� + string result = prefix + formattedNumber; + + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "success"; + objJsonResult.data = result; + return objJsonResult; + } + else + { + objJsonResult.code = "0"; + objJsonResult.count = 1; + objJsonResult.Message = "姝ゅ垎绫讳緵搴斿晢缂栫爜鏍煎紡鏈夎"; + objJsonResult.data = null; + return objJsonResult; + } + } + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "Exception锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion /// <summary> /// 渚涘簲鍟嗗垪琛ㄤ慨鏀规寜閽柟娉� @@ -336,6 +414,7 @@ ///鍙傛暟锛歴tring sql銆� ///杩斿洖鍊硷細object銆� /// </summary> + [Route("Gy_Supplier/AddBill1")] [HttpPost] public object AddBill1([FromBody] JObject oMain) -- Gitblit v1.9.1