Compare commits
2 Commits
a102ed46f2
...
SCADA系统测试
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67ca5287e2 | ||
|
|
50b74f484f |
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8888
|
||||||
tomcat:
|
tomcat:
|
||||||
max-swallow-size: -1
|
max-swallow-size: -1
|
||||||
error:
|
error:
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ VITE_PUBLIC_PATH = /
|
|||||||
|
|
||||||
# 跨域代理:前缀须与 VITE_GLOB_API_URL 一致,且 rewrite 后路径需包含后端 context-path(/jeecg-boot)
|
# 跨域代理:前缀须与 VITE_GLOB_API_URL 一致,且 rewrite 后路径需包含后端 context-path(/jeecg-boot)
|
||||||
# 详见 build/vite/proxy.ts
|
# 详见 build/vite/proxy.ts
|
||||||
VITE_PROXY = [["/jeecg-boot","http://localhost:8080/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
|
VITE_PROXY = [["/jeecg-boot","http://localhost:8888/jeecg-boot"],["/upload","http://localhost:3300/upload"]]
|
||||||
|
|
||||||
#后台接口全路径地址(必填)
|
#后台接口全路径地址(必填)
|
||||||
VITE_GLOB_DOMAIN_URL=http://localhost:8080/jeecg-boot
|
VITE_GLOB_DOMAIN_URL=http://localhost:8888/jeecg-boot
|
||||||
|
|
||||||
#后台接口父地址(必填),与 server.servlet.context-path 一致,避免仅去掉别名前缀后缺少 /jeecg-boot
|
#后台接口父地址(必填),与 server.servlet.context-path 一致,避免仅去掉别名前缀后缺少 /jeecg-boot
|
||||||
VITE_GLOB_API_URL=/jeecg-boot
|
VITE_GLOB_API_URL=/jeecg-boot
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public interface IRawMaterialEntryService
|
|||||||
Task<bool> DeleteAsync(string id, CancellationToken ct = default);
|
Task<bool> DeleteAsync(string id, CancellationToken ct = default);
|
||||||
Task<bool> DeleteBatchAsync(string ids, CancellationToken ct = default);
|
Task<bool> DeleteBatchAsync(string ids, CancellationToken ct = default);
|
||||||
|
|
||||||
/// <summary>调用后端接口生成条码/批次号(格式:QH+物料编码+yyMMdd+序号)</summary>
|
/// <summary>生成条码/批次号(优先后端,离线回退本地;格式:QH+物料编码+yyMMdd+序号)</summary>
|
||||||
Task<string?> GenerateBarcodeAsync(string materialCode, CancellationToken ct = default);
|
Task<string?> GenerateBarcodeAsync(string materialCode, CancellationToken ct = default);
|
||||||
|
|
||||||
/// <summary>按业务打印绑定准备模板 JSON 与 printData(与后端 prepareNativePrint 一致,免密 anon)。</summary>
|
/// <summary>按业务打印绑定准备模板 JSON 与 printData(与后端 prepareNativePrint 一致,免密 anon)。</summary>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
using System.Globalization;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using YY.Admin.Core;
|
using YY.Admin.Core;
|
||||||
@@ -151,6 +152,7 @@ public class RawMaterialEntryService : IRawMaterialEntryService, ISingletonDepen
|
|||||||
if (!entry.TenantId.HasValue || entry.TenantId.Value <= 0) entry.TenantId = DefaultTenantId;
|
if (!entry.TenantId.HasValue || entry.TenantId.Value <= 0) entry.TenantId = DefaultTenantId;
|
||||||
var local = Clone(entry);
|
var local = Clone(entry);
|
||||||
if (string.IsNullOrWhiteSpace(local.Id)) local.Id = $"local-{Guid.NewGuid():N}";
|
if (string.IsNullOrWhiteSpace(local.Id)) local.Id = $"local-{Guid.NewGuid():N}";
|
||||||
|
EnsureBarcodeAndBatchNo(local);
|
||||||
|
|
||||||
if (_networkMonitor.IsOnline)
|
if (_networkMonitor.IsOnline)
|
||||||
{
|
{
|
||||||
@@ -228,6 +230,11 @@ public class RawMaterialEntryService : IRawMaterialEntryService, ISingletonDepen
|
|||||||
|
|
||||||
public async Task<string?> GenerateBarcodeAsync(string materialCode, CancellationToken ct = default)
|
public async Task<string?> GenerateBarcodeAsync(string materialCode, CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
|
if (!_networkMonitor.IsOnline)
|
||||||
|
{
|
||||||
|
return GenerateLocalBarcode(materialCode);
|
||||||
|
}
|
||||||
|
|
||||||
var url = $"{BaseUrl}/xslmes/mesXslRawMaterialEntry/anon/generateBarcode?materialCode={Uri.EscapeDataString(materialCode ?? "")}";
|
var url = $"{BaseUrl}/xslmes/mesXslRawMaterialEntry/anon/generateBarcode?materialCode={Uri.EscapeDataString(materialCode ?? "")}";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -243,7 +250,46 @@ public class RawMaterialEntryService : IRawMaterialEntryService, ISingletonDepen
|
|||||||
{
|
{
|
||||||
_logger.Warning($"[原料入场] 生成条码失败: {ex.Message}");
|
_logger.Warning($"[原料入场] 生成条码失败: {ex.Message}");
|
||||||
}
|
}
|
||||||
return null;
|
return GenerateLocalBarcode(materialCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 桌面端离线兜底产号:保持与服务端一致的格式 QH + 物料编码 + yyMMdd + 3位流水。
|
||||||
|
/// 流水号口径与服务端一致:按当前前缀匹配条码计数 + 1(非 max+1)。
|
||||||
|
/// </summary>
|
||||||
|
private string GenerateLocalBarcode(string materialCode)
|
||||||
|
{
|
||||||
|
var normalizedCode = (materialCode ?? string.Empty).Trim();
|
||||||
|
var dateStr = DateTime.Now.ToString("yyMMdd", CultureInfo.InvariantCulture);
|
||||||
|
var prefix = $"QH{normalizedCode}{dateStr}";
|
||||||
|
|
||||||
|
int sequence;
|
||||||
|
lock (_cacheLock)
|
||||||
|
{
|
||||||
|
var snapshot = ApplyPendingOpsSnapshotUnsafe(_localCache.Select(Clone).ToList());
|
||||||
|
var count = snapshot.Count(x =>
|
||||||
|
!string.IsNullOrWhiteSpace(x.Barcode) &&
|
||||||
|
x.Barcode!.StartsWith(prefix, StringComparison.OrdinalIgnoreCase));
|
||||||
|
sequence = count + 1;
|
||||||
|
}
|
||||||
|
return $"{prefix}{sequence:000}";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 新增入场记录时保证条码和批次号本地可用:
|
||||||
|
/// 条码为空时本地生成,批次号为空时回填为条码。
|
||||||
|
/// </summary>
|
||||||
|
private void EnsureBarcodeAndBatchNo(MesXslRawMaterialEntry entry)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(entry.Barcode))
|
||||||
|
{
|
||||||
|
entry.Barcode = GenerateLocalBarcode(entry.MaterialCode ?? string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(entry.BatchNo))
|
||||||
|
{
|
||||||
|
entry.BatchNo = entry.Barcode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<(string templateJson, string printDataJson, string? errorMessage)> PrepareNativePrintAsync(string id, CancellationToken ct = default)
|
public async Task<(string templateJson, string printDataJson, string? errorMessage)> PrepareNativePrintAsync(string id, CancellationToken ct = default)
|
||||||
|
|||||||
@@ -688,6 +688,11 @@ public class RawMaterialEntryOperationViewModel : RawMaterialEntryEditDialogView
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!await EnsureEntryBarcodeAndBatchNoAsync())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 库位必填仅校验本批待生成行;行号取在原集合的真实索引,避免编号偏移误导
|
// 库位必填仅校验本批待生成行;行号取在原集合的真实索引,避免编号偏移误导
|
||||||
foreach (var row in pendingRows)
|
foreach (var row in pendingRows)
|
||||||
{
|
{
|
||||||
@@ -865,6 +870,42 @@ public class RawMaterialEntryOperationViewModel : RawMaterialEntryEditDialogView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成原材料卡片前确保入场记录已有条码/批次号。
|
||||||
|
/// 规则:条码优先沿用现有值;为空时调用入场服务生成(在线优先,离线本地兜底);
|
||||||
|
/// 批次号为空则回填为条码。
|
||||||
|
/// </summary>
|
||||||
|
private async Task<bool> EnsureEntryBarcodeAndBatchNoAsync()
|
||||||
|
{
|
||||||
|
if (Entry == null) return false;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(Entry.Barcode))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(Entry.MaterialCode))
|
||||||
|
{
|
||||||
|
HandyControl.Controls.MessageBox.Warning("当前记录缺少物料编码,无法生成原材料卡片条码。");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var code = await EntryService.GenerateBarcodeAsync(Entry.MaterialCode);
|
||||||
|
if (string.IsNullOrWhiteSpace(code))
|
||||||
|
{
|
||||||
|
HandyControl.Controls.MessageBox.Warning("未能生成入场条码,请检查网络或稍后重试。");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entry.Barcode = code.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(Entry.BatchNo))
|
||||||
|
{
|
||||||
|
Entry.BatchNo = Entry.Barcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
RaisePropertyChanged(nameof(Entry));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private List<RawMaterialCardGeneratePlanItem> BuildPlannedRawMaterialCards(
|
private List<RawMaterialCardGeneratePlanItem> BuildPlannedRawMaterialCards(
|
||||||
MesXslRawMaterialEntry entry,
|
MesXslRawMaterialEntry entry,
|
||||||
IReadOnlyList<RawMaterialSplitDetailItem> pendingRows,
|
IReadOnlyList<RawMaterialSplitDetailItem> pendingRows,
|
||||||
|
|||||||
Binary file not shown.
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#define MyAppName "智能制造MES工控"
|
#define MyAppName "智能制造MES工控"
|
||||||
#define MyAppExeName "YY.Admin.exe"
|
#define MyAppExeName "YY.Admin.exe"
|
||||||
#define MyAppVersion "1.1.0"
|
#define MyAppVersion "1.1.4"
|
||||||
#define MyPublisher "星数连科技科技有限公司"
|
#define MyPublisher "星数连科技科技有限公司"
|
||||||
; 相对本 .iss 文件位置(installer\ 下的上一级为 yy-admin-master)
|
; 相对本 .iss 文件位置(installer\ 下的上一级为 yy-admin-master)
|
||||||
#define PublishRoot "..\YY.Admin\bin\Release\net8.0-windows10.0.19041\win-x64\publish"
|
#define PublishRoot "..\YY.Admin\bin\Release\net8.0-windows10.0.19041\win-x64\publish"
|
||||||
|
|||||||
Reference in New Issue
Block a user