From cfd2e350f5d92ba5b9d0cdf0f3e455497210c9ce Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期五, 16 八月 2024 16:59:01 +0800
Subject: [PATCH] 11
---
WebAPI/Controllers/BaseSet/Gy_CustomerController.cs | 78 +++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
index f507d8a..61379b9 100644
--- a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_CustomerController.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_CustomerController : ApiController
@@ -242,6 +243,83 @@
}
}
+ #region 瀹㈡埛鏍规嵁鍒嗙被鑾峰彇鏈�澶у鎴风紪鐮�
+ [Route("Gy_Customer/getMaxNum")]
+ [HttpGet]
+ public object getMaxNum(int HCusTypeID, string user, string Organization)
+ {
+ try
+ {
+ List<object> columnNameList = new List<object>();
+ //缂栬緫鏉冮檺
+ if (!DBUtility.ClsPub.Security_Log_second("Gy_Customer", 1, false, user))
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ if (HCusTypeID == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁閫夋嫨鍏蜂綋鍒嗙被锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ ds = oCN.RunProcReturn(@"select * from h_v_Gy_CustomerList where 缁勭粐鍚嶇О='" + Organization + "'" + "and HCusTypeID = '" + HCusTypeID + "'" + " order by 瀹㈡埛浠g爜 desc", "h_v_Gy_CustomerList");
+ 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]["瀹㈡埛浠g爜"].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>
/// 瀹㈡埛鍒楄〃鏍戝舰缁撴瀯
--
Gitblit v1.9.1