From b23a6dbb1b36fc52f37d8423c294140563e157c8 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期三, 15 一月 2025 17:34:53 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs | 2
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 70 +++++++++++++++++++++++++++++++++-
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs | 7 +++
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 2
4 files changed, 75 insertions(+), 6 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
index 153dccf..feaaf20 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
@@ -101,7 +101,7 @@
return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiAddress, agvPodModel.Serialize());
AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>();
- if (agvContent.Code == "0")
+ if (agvContent.Code == "1")
{
content.OK(agvContent.Message);
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs"
index 4ce7903..f270e87 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/CodeConfigEnum/RuleCodeEnum.cs"
@@ -39,6 +39,11 @@
/// 鍙戞枡鍗曞彿缂栫爜瑙勫垯
/// </summary>
[Description("鍙戞枡鍗曞彿缂栫爜瑙勫垯")]
- FLCodeRule
+ FLCodeRule,
+ /// <summary>
+ /// 鍏ユ枡鍗曞彿缂栫爜瑙勫垯
+ /// </summary>
+ [Description("鍏ユ枡鍗曞彿缂栫爜瑙勫垯")]
+ RLCodeRule
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 3a03b44..672b088 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -18,8 +18,10 @@
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.CodeConfigEnum;
+using WIDESEA_Core.DB;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
+using WIDESEA_Core.Seed;
using WIDESEA_Core.Utilities;
using WIDESEA_DTO;
using WIDESEA_DTO.Basic;
@@ -340,6 +342,7 @@
List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
List<int> detailKeys = new List<int>();
+ int newCount = 0;
foreach (var model in models)
{
if (purchaseOrderNos.FirstOrDefault(x => x == model.PurchaseOrderNo) == null)
@@ -370,6 +373,7 @@
EffectiveDate = model.EffectiveDate,
InboundOrderRowNo = notGroupDetail.RowNo,
};
+ newCount++;
if (stockInfo.Id > 0)
{
@@ -385,7 +389,7 @@
}
//鍏ュ簱鏄庣粏鏂板瀹屾垚鏁伴噺
- int newCount = inboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
+ //int newCount = inboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
if (inboundOrder.Details.Count == (newCount + oldCount))
{
inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
@@ -428,7 +432,7 @@
}
ERPInboundModel eRPInboundModel = new ERPInboundModel()
{
- Code = inboundOrder.InboundOrderNo,
+ Code = CreateCodeByRule(nameof(RuleCodeEnum.RLCodeRule)),
CreatorCode = inboundOrder.Creater,
EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
@@ -786,7 +790,7 @@
ERPInboundModel model = new ERPInboundModel()
{
- Code = inboundOrder.InboundOrderNo,
+ Code = CreateCodeByRule(nameof(RuleCodeEnum.RLCodeRule)),
CreatorCode = inboundOrder.Creater,//娴嬭瘯
EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
@@ -809,6 +813,66 @@
return content;
}
+ static object lock_code = new object();
+ public string CreateCodeByRule(string ruleCode)
+ {
+ lock (lock_code)
+ {
+
+ string code = string.Empty;
+ DateTime dateTime = DateTime.Now;
+ DateTime now = DateTime.Now;
+ try
+ {
+ if (string.IsNullOrEmpty(ruleCode))
+ throw new ArgumentNullException(nameof(ruleCode));
+ SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig
+ {
+ IsAutoCloseConnection = false,
+ DbType = DbType.SqlServer,
+ ConnectionString = DBContext.ConnectionString
+ });
+ Dt_CodeRuleConfig codeRuleConfig = sugarClient.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First();
+ if (codeRuleConfig == null)
+ throw new ArgumentNullException(nameof(codeRuleConfig));
+ if (codeRuleConfig.ModifyDate != null)
+ {
+ dateTime = Convert.ToDateTime(codeRuleConfig.ModifyDate);
+ }
+ else
+ {
+ dateTime = Convert.ToDateTime(codeRuleConfig.CreateDate);
+ }
+
+ if (now.Year == dateTime.Year && now.Month == dateTime.Month && now.Day == dateTime.Day)
+ {
+ now = dateTime;
+ codeRuleConfig.CurrentVal = Convert.ToInt32(codeRuleConfig.CurrentVal) + 1;
+ }
+ else
+ {
+ codeRuleConfig.CurrentVal = 1;
+ }
+ codeRuleConfig.ModifyDate = DateTime.Now;
+ code = codeRuleConfig.Format;
+ code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0'));
+ code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0'));
+ code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0'));
+ code = code.Replace($"[{CodeFormatTypeEnum.ST}]", codeRuleConfig.StartStr?.ToString() ?? "");
+ code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", codeRuleConfig.CurrentVal.ToString().PadLeft(codeRuleConfig.Length, '0'));
+ Dictionary<string, object> keyValuePairs = new Dictionary<string, object>() { { nameof(codeRuleConfig.CurrentVal), codeRuleConfig.CurrentVal }, { nameof(codeRuleConfig.Id), codeRuleConfig.Id }, { nameof(codeRuleConfig.ModifyDate), DateTime.Now } };
+ sugarClient.Updateable(keyValuePairs).AS(MainDb.CodeRuleConfig).WhereColumns(nameof(codeRuleConfig.Id)).ExecuteCommand();
+ sugarClient.Updateable(codeRuleConfig);
+
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return code;
+ }
+ }
+
/// <summary>
/// 鍏ュ簱瀹屾垚鍥炰紶鍒癊RP
/// </summary>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index cd411f7..5d14e40 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -249,7 +249,7 @@
return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task));
}
- if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null)
+ if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null && stationCode != "8005")//杈呮枡浠撲笉闄愬埗鍏ュ簱浠诲姟
{
return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�");
}
--
Gitblit v1.9.3