仓库数据看板
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
@@ -7,6 +9,56 @@ namespace ZR.Service.Utils
|
||||
public class MaterialUtils : BaseService<WmMaterial>
|
||||
{
|
||||
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// 解析测试
|
||||
/// </summary>
|
||||
/// <param name="str">测试字符串</param>
|
||||
/// <returns></returns>
|
||||
public string ResolutionTestUtil(string str)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 定义正则表达式模式
|
||||
string partnumberPattern = @"ERP(\w+)PQ"; // 产品零件号
|
||||
string quantityPattern = @"PQ(\d+)D"; // 产品数量
|
||||
string batchCodePattern = @"D(\d+)S"; // 产品生产批次
|
||||
|
||||
// 使用正则表达式进行匹配
|
||||
Match partnumberMatch = Regex.Match(str, partnumberPattern);
|
||||
Match quantityMatch = Regex.Match(str, quantityPattern);
|
||||
Match batchCodeMatch = Regex.Match(str, batchCodePattern);
|
||||
|
||||
// 创建接收
|
||||
string partnumber = "";
|
||||
string quantity = "";
|
||||
string batchCode = "";
|
||||
// 判断解析是否成功
|
||||
if (!partnumberMatch.Success) {
|
||||
throw new Exception("解析零件号失败");
|
||||
}
|
||||
if (!quantityMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品数量失败");
|
||||
}
|
||||
if (!batchCodeMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品生产批次失败");
|
||||
}
|
||||
partnumber = partnumberMatch.Groups[1].Value;
|
||||
quantity = quantityMatch.Groups[1].Value;
|
||||
batchCode = batchCodeMatch.Groups[1].Value;
|
||||
return batchCode;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
throw new Exception("解析失败" + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//解析外箱标签码
|
||||
public ResultionPackageCodeDto ResolutionPackage(string code)
|
||||
{
|
||||
@@ -138,5 +190,6 @@ namespace ZR.Service.Utils
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user