From b784d019c3848718eb95eb0d34dde34c6a262b06 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 13 四月 2026 11:14:18 +0800
Subject: [PATCH] 组盘表添加供方代码
---
代码管理/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/BoxingDetailService.cs | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/BoxingDetailService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/BoxingDetailService.cs"
index fa9372b..a0ef361 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/BoxingDetailService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/BoxingDetailService.cs"
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.PLCEnum;
@@ -25,7 +26,7 @@
private readonly IFormulaDetailService _formulaDetailService;
private readonly IProcessInfoDetailService _processInfoDetailService;
private readonly IScanStationService _scanStationService;
-
+
private readonly IUnitOfWorkManage _unitOfWorkManage;
@@ -45,7 +46,7 @@
_processInfoDetailService = processInfoDetailService;
_scanStationService = scanStationService;
_unitOfWorkManage = unitOfWorkManage;
-
+
}
public IRepository<Dt_BoxingDetail> Repository => BaseDal;
@@ -152,25 +153,31 @@
{
return WebResponseContent.Instance.Error("鎻愪氦鍙傛暟涓嶈兘涓虹┖");
}
- string productCode = toolingBoardSubmitDto.FinishedProductCode?.Trim();
+ string productCode = toolingBoardSubmitDto.FinishedProductCode.Trim();
string proCode = string.Empty;
string proOther = string.Empty;
+ string supplierCode = string.Empty;
if (!string.IsNullOrWhiteSpace(productCode))
{
- var proCodeMatch = System.Text.RegularExpressions.Regex.Match(productCode, @"TX(\d+)(?=\s|\||$)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
+ var proCodeMatch = Regex.Match(productCode, @"TX(\d+)(?=\s|\||$)", RegexOptions.IgnoreCase);
if (proCodeMatch.Success)
{
proCode = $"TX{proCodeMatch.Groups[1].Value.Trim()}";
}
// 姝e垯2锛氬尮閰嶈繛缁殑10浣嶇函鏁板瓧锛堝叏灞�鍖归厤锛屽彇绗竴涓鍚堢殑鍗冲彲锛�
- var proOtherMatch = System.Text.RegularExpressions.Regex.Match(productCode, @"\d{10}");
+ var proOtherMatch = Regex.Match(productCode, @"\d{10}");
if (proOtherMatch.Success)
{
proOther = proOtherMatch.Value.Trim();
+ }
+ var supplierCodeMatch = Regex.Match(productCode, @"[A-Z]+$", RegexOptions.IgnoreCase);
+ if (supplierCodeMatch.Success)
+ {
+ supplierCode = supplierCodeMatch.Value.Trim();
}
toolingBoardSubmitDto.PartsList = toolingBoardSubmitDto.PartsList.Where(code => !string.IsNullOrEmpty(code)).ToList();
// 2. 鏌ヨ鎴愬搧閰嶆柟淇℃伅
@@ -181,7 +188,7 @@
}
Dt_ScanStation dt_ScanStation = _scanStationService.Repository.QueryFirst(x => x.StationCode == "001");
- if (dt_ScanStation.StationEndProduct != proCode)
+ if (dt_ScanStation.StationEndProduct != proCode)
{
return WebResponseContent.Instance.Error("鎴愬搧缂栧彿閿欒");
}
@@ -194,10 +201,10 @@
return WebResponseContent.Instance.Error($"鐗╂枡銆恵IsCode}銆戦敊璇紝璇锋牳瀵圭墿鏂欑紪鍙�");
}
-
-
+
+
//Dt_Boxing existBoxinModel = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
-
+
//if (existBoxinModel == null)
//{
// return WebResponseContent.Instance.Error($"鎵樼洏鏈坊鍔狅紝璇风◢鍚庨噸璇�");
@@ -214,7 +221,7 @@
throw new InvalidOperationException("鎵樼洏鐮佹湭鎵埌锛岃閲嶈瘯");
}
Dt_Boxing dt_Boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
- if(dt_Boxing != null)
+ if (dt_Boxing != null)
{
throw new InvalidOperationException("鎵樼洏鐮侀噸澶嶆壂鎻�");
}
@@ -222,6 +229,7 @@
existBoxinModel.PalletCode = PalletCode;
existBoxinModel.ProductCode = proCode;
existBoxinModel.BoxingNo = proOther;
+ existBoxinModel.SupplierCode = supplierCode;
int id = _boxingService.Repository.AddData(existBoxinModel);
@@ -240,7 +248,7 @@
uow.Commit();
}
-
+
OtherDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceName == "涓绘帶PLC") as OtherDevice;
if (device == null) throw new Exception("鏈壘鍒颁富鎺LC璁惧淇℃伅");
@@ -355,7 +363,7 @@
.QueryData(x => x.ProductSn == proOther && x.ProductCode == proCode).ToList();
// 3. 鍒ゆ柇鏌ヨ缁撴灉锛屽瓨鍦ㄥ垯璧嬪�兼彁绀轰俊鎭�
- if (dt_ProcessInfoDetail.Count<=3 && dt_ProcessInfoDetail.Count != 0)
+ if (dt_ProcessInfoDetail.Count <= 3 && dt_ProcessInfoDetail.Count != 0)
{
msg = "宸叉湁娴佹按鍙�";
}
--
Gitblit v1.9.3