|
|
|
// 文件:Services/WarehouseDataApiService.cs
|
|
|
|
using IndustrialControl.Models;
|
|
|
|
using IndustrialControl.ViewModels;
|
|
|
|
using System.Net.Http;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text.Json;
|
|
|
|
using System.Text.Json.Nodes;
|
|
|
|
using IndustrialControl.Models;
|
|
|
|
using IndustrialControl.ViewModels;
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
|
|
namespace IndustrialControl.Services;
|
|
|
|
|
|
...
|
...
|
@@ -13,23 +13,25 @@ namespace IndustrialControl.Services; |
|
|
|
/// </summary>
|
|
|
|
public sealed class OutboundMaterialService : IOutboundMaterialService
|
|
|
|
{
|
|
|
|
private readonly HttpClient _http;
|
|
|
|
private readonly string _outboundListEndpoint;
|
|
|
|
private readonly string _detailEndpoint;
|
|
|
|
private readonly string _scanDetailEndpoint;
|
|
|
|
public readonly HttpClient _http;
|
|
|
|
public readonly string _outboundListEndpoint;
|
|
|
|
public readonly string _detailEndpoint;
|
|
|
|
public readonly string _scanDetailEndpoint;
|
|
|
|
// 新增:扫码入库端点
|
|
|
|
private readonly string _scanByBarcodeEndpoint;
|
|
|
|
private readonly string _scanConfirmEndpoint;
|
|
|
|
private readonly string _cancelScanEndpoint;
|
|
|
|
private readonly string _confirmOutstockEndpoint;
|
|
|
|
private readonly string _judgeScanAllEndpoint;
|
|
|
|
public readonly string _scanByBarcodeEndpoint;
|
|
|
|
public readonly string _scanConfirmEndpoint;
|
|
|
|
public readonly string _cancelScanEndpoint;
|
|
|
|
public readonly string _confirmOutstockEndpoint;
|
|
|
|
public readonly string _judgeScanAllEndpoint;
|
|
|
|
private readonly JsonSerializerOptions _opt;
|
|
|
|
private readonly JsonSerializerOptions _json = new() { PropertyNameCaseInsensitive = true };
|
|
|
|
|
|
|
|
public OutboundMaterialService(HttpClient http, IConfigLoader configLoader)
|
|
|
|
{
|
|
|
|
_http = http;
|
|
|
|
|
|
|
|
// 和 WorkOrderApi 一样从 appconfig.json 读取端点,留兼容键名 + 兜底硬编码
|
|
|
|
_opt = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
|
|
|
JsonNode cfg = configLoader.Load();
|
|
|
|
|
|
|
|
// ⭐ 新增:读取 baseUrl 或 ip+port
|
|
|
|
var baseUrl =
|
|
|
|
(string?)cfg?["server"]?["baseUrl"]
|
|
...
|
...
|
@@ -40,32 +42,43 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
|
|
|
|
if (_http.BaseAddress is null)
|
|
|
|
_http.BaseAddress = new Uri(baseUrl, UriKind.Absolute);
|
|
|
|
|
|
|
|
// 下面保持原来的相对路径读取(不变)
|
|
|
|
_outboundListEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["list"] ??
|
|
|
|
(string?)cfg?["apiEndpoints"]?["getOutStock"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/getOutStock";
|
|
|
|
_detailEndpoint = (string?)cfg?["apiEndpoints"]?["outbound"]?["detail"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/getOutStockDetail";
|
|
|
|
_scanDetailEndpoint = (string?)cfg?["apiEndpoints"]?["outbound"]?["scanDetail"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/getOutStockScanDetail";
|
|
|
|
|
|
|
|
_detailEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["detail"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/getOutStockDetail";
|
|
|
|
|
|
|
|
_scanDetailEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["scanDetail"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/getOutStockScanDetail";
|
|
|
|
|
|
|
|
_scanByBarcodeEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["scanByBarcode"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/getOutStockByBarcode";
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["scanByBarcode"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/getOutStockByBarcode";
|
|
|
|
|
|
|
|
_scanConfirmEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["scanConfirm"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/scanConfirm";
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["scanConfirm"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/scanOutConfirm";
|
|
|
|
|
|
|
|
_cancelScanEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["cancelScan"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/cancelScan";
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["cancelScan"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/cancelOutScan";
|
|
|
|
|
|
|
|
_confirmOutstockEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["confirm"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/confirm";
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["confirm"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/confirm";
|
|
|
|
|
|
|
|
_judgeScanAllEndpoint =
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["judgeScanAll"]
|
|
|
|
?? "/normalService/pda/wmsMaterialOutstock/judgeOutstockDetailScanAll";
|
|
|
|
(string?)cfg?["apiEndpoints"]?["outbound"]?["judgeScanAll"] ??
|
|
|
|
"/normalService/pda/wmsMaterialOutstock/judgeOutstockDetailScanAll";
|
|
|
|
}
|
|
|
|
|
|
|
|
// ====== 你当前页面会调用的方法 ======
|
|
|
|
// ⭐ 新增:拼接 ip + port → baseUrl
|
|
|
|
private static string? BuildBaseUrl(JsonNode? ipNode, JsonNode? portNode)
|
|
|
|
{
|
|
|
|
string? ip = ipNode?.ToString().Trim();
|
|
...
|
...
|
@@ -134,25 +147,21 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
|
|
|
|
return records.Select(x => new OutboundOrderSummary(
|
|
|
|
outstockId: x.id ?? "",
|
|
|
|
outstockNo: x.outstockNo ?? "",
|
|
|
|
orderType: x.orderType ?? "",
|
|
|
|
orderTypeName: x.orderTypeName ?? "",
|
|
|
|
purchaseNo: x.purchaseNo ?? "",
|
|
|
|
supplierName: x.supplierName ?? "",
|
|
|
|
arrivalNo: x.arrivalNo ?? "",
|
|
|
|
createdTime: x.createdTime ?? "",
|
|
|
|
deliveryNo: x.deliveryNo ?? "",
|
|
|
|
requisitionMaterialNo:x.requisitionMaterialNo ?? "",
|
|
|
|
returnNo: x.returnNo ?? "",
|
|
|
|
workOrderNo:x.workOrderNo ?? ""
|
|
|
|
|
|
|
|
|
|
|
|
workOrderNo: x.workOrderNo ?? "",
|
|
|
|
requisitionMaterialNo: x.requisitionMaterialNo ?? "",
|
|
|
|
returnNo:x.returnNo ?? "",
|
|
|
|
deliveryNo:x.deliveryNo ?? "",
|
|
|
|
createdTime: x.createdTime ?? ""
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<IReadOnlyList<OutboundPendingRow>> GetOutStockDetailAsync(
|
|
|
|
string outstockId, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
// ✅ 文档为 GET + x-www-form-urlencoded,参数名是小写 outstockId
|
|
|
|
var url = $"{_detailEndpoint}?outstockId={Uri.EscapeDataString(outstockId)}";
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Get, url);
|
|
|
|
|
|
...
|
...
|
@@ -166,27 +175,22 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
if (dto?.success != true || dto.result is null || dto.result.Count == 0)
|
|
|
|
return Array.Empty<OutboundPendingRow>();
|
|
|
|
|
|
|
|
static int ToIntSafe(string? s)
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(s)) return 0;
|
|
|
|
s = s.Trim().Replace(",", "");
|
|
|
|
return int.TryParse(s, out var v) ? v : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ⚠️ 接口没有 barcode,这里先用空串;如需展示可以改成 x.materialCode 或 x.stockBatch
|
|
|
|
var list = dto.result.Select(x => new OutboundPendingRow(
|
|
|
|
Barcode: string.Empty, // 或 $"{x.materialCode}" / $"{x.stockBatch}"
|
|
|
|
DetailId: x.id ?? string.Empty, // ← 改为接口的 id
|
|
|
|
Location: x.location ?? string.Empty,
|
|
|
|
MaterialName: x.materialName ?? string.Empty,
|
|
|
|
PendingQty: ToIntSafe(x.outstockQty), // ← 预计数量
|
|
|
|
ScannedQty: ToIntSafe(x.qty), // ← 已扫描量
|
|
|
|
Spec: x.spec ?? string.Empty
|
|
|
|
MaterialCode: x.materialCode ?? string.Empty,
|
|
|
|
Spec: x.spec ?? string.Empty,
|
|
|
|
Location: x.location ?? string.Empty,
|
|
|
|
ProductionBatch: x.productionBatch ?? string.Empty,
|
|
|
|
StockBatch: x.stockBatch ?? string.Empty,
|
|
|
|
OutstockQty: ToInt(x.outstockQty), // 此处再转 int
|
|
|
|
Qty: ToInt(x.qty) // ← 已扫描量
|
|
|
|
)).ToList();
|
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ToInt(decimal? v) => v.HasValue ? (int)Math.Round(v.Value, MidpointRounding.AwayFromZero) : 0;
|
|
|
|
public async Task<IReadOnlyList<OutboundScannedRow>> GetOutStockScanDetailAsync(
|
|
|
|
string outstockId,
|
|
|
|
CancellationToken ct = default)
|
|
...
|
...
|
@@ -206,21 +210,13 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
if (dto?.success != true || dto.result is null || dto.result.Count == 0)
|
|
|
|
return Array.Empty<OutboundScannedRow>();
|
|
|
|
|
|
|
|
static int ToIntSafe(string? s)
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(s)) return 0;
|
|
|
|
// 去除千分位、空格
|
|
|
|
s = s.Trim().Replace(",", "");
|
|
|
|
return int.TryParse(s, out var v) ? v : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 映射:OutstockId <- id(截图注释“入库单明细主键id”)
|
|
|
|
var list = dto.result.Select(x => new OutboundScannedRow(
|
|
|
|
Barcode: (x.barcode ?? string.Empty).Trim(),
|
|
|
|
DetailId: (x.id ?? string.Empty).Trim(),
|
|
|
|
Location: (x.location ?? string.Empty).Trim(),
|
|
|
|
MaterialName: (x.materialName ?? string.Empty).Trim(),
|
|
|
|
Qty: ToIntSafe(x.qty),
|
|
|
|
Qty: ToInt(x.qty),
|
|
|
|
Spec: (x.spec ?? string.Empty).Trim(),
|
|
|
|
ScanStatus: x.scanStatus ?? false,
|
|
|
|
WarehouseCode: x.warehouseCode?.Trim()
|
|
...
|
...
|
@@ -228,10 +224,13 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ========= 扫码入库实现 =========
|
|
|
|
public async Task<SimpleOk> OutStockByBarcodeAsync(string outstockId, string barcode, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var body = JsonSerializer.Serialize(new { barcode, outstockId });
|
|
|
|
// 注意:接口要的是 id 不是 outstockId
|
|
|
|
var body = JsonSerializer.Serialize(new { barcode, id = outstockId });
|
|
|
|
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, _scanByBarcodeEndpoint)
|
|
|
|
{
|
|
|
|
Content = new StringContent(body, Encoding.UTF8, "application/json")
|
|
...
|
...
|
@@ -239,16 +238,16 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
|
|
|
|
using var res = await _http.SendAsync(req, ct);
|
|
|
|
var json = await res.Content.ReadAsStringAsync(ct);
|
|
|
|
var opt = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
|
|
|
var dto = JsonSerializer.Deserialize<ScanByBarcodeResp>(json, opt);
|
|
|
|
|
|
|
|
// 按文档:以 success 判断;message 作为失败提示
|
|
|
|
var ok = dto?.success == true;
|
|
|
|
var dto = JsonSerializer.Deserialize<ScanByBarcodeResp>(json, _opt);
|
|
|
|
var ok = dto?.success == true || dto?.result?.ToString() == "true";
|
|
|
|
return new SimpleOk(ok, dto?.message);
|
|
|
|
}
|
|
|
|
public async Task<SimpleOk> ScanConfirmAsync(string outstockId, CancellationToken ct = default)
|
|
|
|
|
|
|
|
public async Task<SimpleOk> ScanConfirmAsync(IEnumerable<(string barcode, string id)> items, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var bodyJson = JsonSerializer.Serialize(new { outstockId });
|
|
|
|
var payload = items.Select(x => new { barcode = x.barcode, id = x.id });
|
|
|
|
var bodyJson = JsonSerializer.Serialize(payload);
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, _scanConfirmEndpoint)
|
|
|
|
{
|
|
|
|
Content = new StringContent(bodyJson, Encoding.UTF8, "application/json")
|
|
...
|
...
|
@@ -256,17 +255,16 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
|
|
|
|
using var res = await _http.SendAsync(req, ct);
|
|
|
|
var json = await res.Content.ReadAsStringAsync(ct);
|
|
|
|
var dto = JsonSerializer.Deserialize<ScanConfirmResp>(json, _opt);
|
|
|
|
|
|
|
|
var opt = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
|
|
|
var dto = JsonSerializer.Deserialize<ScanConfirmResp>(json, opt);
|
|
|
|
|
|
|
|
var ok = dto?.success == true;
|
|
|
|
var ok = dto?.success == true; // 你的接口:success=true 且 result=true
|
|
|
|
return new SimpleOk(ok, dto?.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<SimpleOk> CancelScanAsync(string outstockId, CancellationToken ct = default)
|
|
|
|
public async Task<SimpleOk> CancelScanAsync(IEnumerable<(string barcode, string id)> items, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var bodyJson = JsonSerializer.Serialize(new { outstockId });
|
|
|
|
var payload = items.Select(x => new { barcode = x.barcode, id = x.id });
|
|
|
|
var bodyJson = JsonSerializer.Serialize(payload);
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, _cancelScanEndpoint)
|
|
|
|
{
|
|
|
|
Content = new StringContent(bodyJson, Encoding.UTF8, "application/json")
|
|
...
|
...
|
@@ -274,17 +272,16 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
|
|
|
|
using var res = await _http.SendAsync(req, ct);
|
|
|
|
var json = await res.Content.ReadAsStringAsync(ct);
|
|
|
|
|
|
|
|
var opt = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
|
|
|
|
var dto = JsonSerializer.Deserialize<CancelScanResp>(json, opt);
|
|
|
|
var dto = JsonSerializer.Deserialize<CancelScanResp>(json, _opt);
|
|
|
|
|
|
|
|
var ok = dto?.success == true;
|
|
|
|
return new SimpleOk(ok, dto?.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<SimpleOk> ConfirmOutstockAsync(string outstockId, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var bodyJson = JsonSerializer.Serialize(new { outstockId });
|
|
|
|
var bodyJson = JsonSerializer.Serialize(new { id = outstockId });
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, _confirmOutstockEndpoint)
|
|
|
|
{
|
|
|
|
Content = new StringContent(bodyJson, Encoding.UTF8, "application/json")
|
|
...
|
...
|
@@ -299,6 +296,12 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
var ok = dto?.success == true;
|
|
|
|
return new SimpleOk(ok, dto?.message);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
|
|
/// 判断入库单明细是否已全部扫描确认
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="outstockId"></param>
|
|
|
|
/// <param name="ct"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<bool> JudgeOutstockDetailScanAllAsync(string outstockId, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var url = $"{_judgeScanAllEndpoint}?id={Uri.EscapeDataString(outstockId)}";
|
|
...
|
...
|
@@ -313,116 +316,147 @@ public sealed class OutboundMaterialService : IOutboundMaterialService |
|
|
|
return dto?.result == true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockReq
|
|
|
|
{
|
|
|
|
public string? createdTime { get; set; }
|
|
|
|
public string? endTime { get; set; }
|
|
|
|
public string? outstockNo { get; set; }
|
|
|
|
public string? orderType { get; set; }
|
|
|
|
public string? startTime { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockResp
|
|
|
|
{
|
|
|
|
public int code { get; set; }
|
|
|
|
public long costTime { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public bool success { get; set; }
|
|
|
|
public List<GetOutStockItem>? result { get; set; }
|
|
|
|
}
|
|
|
|
public async Task<SimpleOk> UpdateOutstockLocationAsync(
|
|
|
|
string detailId, string id, string outstockWarehouse, string outstockWarehouseCode, string location, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var url = "/normalService/pda/wmsMaterialOutstock/updateLocation";
|
|
|
|
var payload = new
|
|
|
|
{
|
|
|
|
detailId,
|
|
|
|
id,
|
|
|
|
outstockWarehouse,
|
|
|
|
outstockWarehouseCode,
|
|
|
|
location
|
|
|
|
};
|
|
|
|
|
|
|
|
public class GetOutStockItem
|
|
|
|
{
|
|
|
|
public string? arrivalNo { get; set; }
|
|
|
|
public string? createdTime { get; set; }
|
|
|
|
public string? outstockId { get; set; }
|
|
|
|
public string? outstockNo { get; set; }
|
|
|
|
public string? orderType { get; set; }
|
|
|
|
public string? purchaseNo { get; set; }
|
|
|
|
public string? supplierName { get; set; }
|
|
|
|
}
|
|
|
|
public sealed class GetOutStockDetailResp
|
|
|
|
{
|
|
|
|
public bool success { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public int? code { get; set; }
|
|
|
|
public List<GetOutStockDetailItem>? result { get; set; }
|
|
|
|
public int? costTime { get; set; }
|
|
|
|
}
|
|
|
|
public sealed class GetOutStockDetailItem
|
|
|
|
{
|
|
|
|
public string? id { get; set; } // 入库单明细主键id
|
|
|
|
public string? outstockNo { get; set; } // 入库单号
|
|
|
|
public string? materialCode { get; set; }
|
|
|
|
public string? materialName { get; set; }
|
|
|
|
public string? spec { get; set; }
|
|
|
|
public string? stockBatch { get; set; }
|
|
|
|
public string? outstockQty { get; set; } // 预计数量(字符串/可能为空)
|
|
|
|
public string? outstockWarehouseCode { get; set; } // 入库仓库编码
|
|
|
|
public string? location { get; set; } // 内点库位
|
|
|
|
public string? qty { get; set; } // 已扫描量(字符串/可能为空)
|
|
|
|
}
|
|
|
|
var json = JsonSerializer.Serialize(payload);
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, url)
|
|
|
|
{
|
|
|
|
Content = new StringContent(json, Encoding.UTF8, "application/json")
|
|
|
|
};
|
|
|
|
|
|
|
|
using var res = await _http.SendAsync(req, ct);
|
|
|
|
var body = await res.Content.ReadAsStringAsync(ct);
|
|
|
|
|
|
|
|
// 假设响应:{ code, message, result: true/false, success: true/false }
|
|
|
|
var dto = JsonSerializer.Deserialize<UpdateLocationResp>(body, _json);
|
|
|
|
var ok = dto?.success == true || dto?.result == true;
|
|
|
|
|
|
|
|
return new SimpleOk(ok, dto?.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
public async Task<SimpleOk> UpdateQuantityAsync(
|
|
|
|
string barcode, string detailId, string id, int quantity, CancellationToken ct = default)
|
|
|
|
{
|
|
|
|
var url = "/normalService/pda/wmsMaterialOutstock/updateQuantity";
|
|
|
|
var payload = new { barcode, detailId, id, quantity };
|
|
|
|
var json = JsonSerializer.Serialize(payload);
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, url)
|
|
|
|
{
|
|
|
|
Content = new StringContent(json, Encoding.UTF8, "application/json")
|
|
|
|
};
|
|
|
|
|
|
|
|
using var res = await _http.SendAsync(req, ct);
|
|
|
|
var body = await res.Content.ReadAsStringAsync(ct);
|
|
|
|
|
|
|
|
public class GetOutStockPageResp
|
|
|
|
{
|
|
|
|
public int code { get; set; }
|
|
|
|
public long costTime { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public bool success { get; set; }
|
|
|
|
public GetOutStockPageData? result { get; set; }
|
|
|
|
}
|
|
|
|
// 响应格式:{ success, message, code, result, ... }(与截图一致)
|
|
|
|
var dto = JsonSerializer.Deserialize<ConfirmResp>(body, _json);
|
|
|
|
var ok = dto?.success == true || dto?.result == true;
|
|
|
|
return new SimpleOk(ok, dto?.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockPageData
|
|
|
|
{
|
|
|
|
public int pageNo { get; set; }
|
|
|
|
public int pageSize { get; set; }
|
|
|
|
public long total { get; set; }
|
|
|
|
public List<GetOutStockRecord> records { get; set; } = new();
|
|
|
|
}
|
|
|
|
public class GetOutStockItem
|
|
|
|
{
|
|
|
|
public string? arrivalNo { get; set; }
|
|
|
|
public string? createdTime { get; set; }
|
|
|
|
public string? outstockId { get; set; }
|
|
|
|
public string? outstockNo { get; set; }
|
|
|
|
public string? orderType { get; set; }
|
|
|
|
public string? purchaseNo { get; set; }
|
|
|
|
public string? supplierName { get; set; }
|
|
|
|
}
|
|
|
|
public sealed class GetOutStockDetailResp
|
|
|
|
{
|
|
|
|
public bool success { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public int? code { get; set; }
|
|
|
|
public List<GetOutStockDetailItem>? result { get; set; }
|
|
|
|
public int? costTime { get; set; }
|
|
|
|
}
|
|
|
|
public sealed class GetOutStockDetailItem
|
|
|
|
{
|
|
|
|
public string? id { get; set; } // 入库单明细主键id
|
|
|
|
public string? outstockNo { get; set; } // 入库单号
|
|
|
|
public string? materialName { get; set; }
|
|
|
|
public string? outstockWarehouseCode { get; set; } // 入库仓库编码
|
|
|
|
public string? materialCode { get; set; } //产品编码
|
|
|
|
public string? spec { get; set; } //规格
|
|
|
|
public string? location { get; set; } //出库库位
|
|
|
|
public string? productionBatch { get; set; } //生产批号
|
|
|
|
|
|
|
|
public string? stockBatch { get; set; } //批次号
|
|
|
|
public int outstockQty { get; set; } //出库数量
|
|
|
|
public int qty { get; set; } //已扫描数
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockRecord
|
|
|
|
{
|
|
|
|
public string? id { get; set; }
|
|
|
|
public string? outstockNo { get; set; }
|
|
|
|
public string? orderType { get; set; }
|
|
|
|
public string? orderTypeName { get; set; }
|
|
|
|
public string? supplierName { get; set; }
|
|
|
|
public string? arrivalNo { get; set; }
|
|
|
|
public string? purchaseNo { get; set; }
|
|
|
|
public string? createdTime { get; set; }
|
|
|
|
public string? deliveryNo { get; set; }
|
|
|
|
public string? requisitionMaterialNo { get; set; }
|
|
|
|
public string? returnNo { get; set; }
|
|
|
|
public string? workOrderNo { get; set; }
|
|
|
|
}
|
|
|
|
public sealed class GetOutStockScanDetailResp
|
|
|
|
{
|
|
|
|
public bool success { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public int? code { get; set; }
|
|
|
|
public List<GetOutStockScanDetailItem>? result { get; set; }
|
|
|
|
public int? costTime { get; set; }
|
|
|
|
}
|
|
|
|
private sealed class UpdateLocationResp
|
|
|
|
{
|
|
|
|
public int code { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public bool? result { get; set; }
|
|
|
|
public bool? success { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public sealed class GetOutStockScanDetailItem
|
|
|
|
{
|
|
|
|
public string? id { get; set; } // 入库单明细主键 id
|
|
|
|
public string? barcode { get; set; }
|
|
|
|
public string? materialName { get; set; }
|
|
|
|
public string? spec { get; set; }
|
|
|
|
public string? qty { get; set; } // 可能是 null 或 “数字字符串”
|
|
|
|
public string? warehouseCode { get; set; }
|
|
|
|
public string? location { get; set; }
|
|
|
|
public bool? scanStatus { get; set; } // 可能为 null,按 false 处理
|
|
|
|
}
|
|
|
|
public class GetOutStockPageResp
|
|
|
|
{
|
|
|
|
public int code { get; set; }
|
|
|
|
public long costTime { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public bool success { get; set; }
|
|
|
|
public GetOutStockPageData? result { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockPageData
|
|
|
|
{
|
|
|
|
public int pageNo { get; set; }
|
|
|
|
public int pageSize { get; set; }
|
|
|
|
public long total { get; set; }
|
|
|
|
public List<GetOutStockRecord> records { get; set; } = new();
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockRecord
|
|
|
|
{
|
|
|
|
public string? id { get; set; }
|
|
|
|
public string? outstockNo { get; set; }
|
|
|
|
public string? orderType { get; set; }
|
|
|
|
public string? orderTypeName { get; set; }
|
|
|
|
public string? workOrderNo { get; set; }
|
|
|
|
public string? materialName { get; set; }
|
|
|
|
public string? requisitionMaterialNo { get; set; }
|
|
|
|
public string? returnNo { get; set; }
|
|
|
|
public string? deliveryNo { get; set; }
|
|
|
|
public string? createdTime { get; set; }
|
|
|
|
}
|
|
|
|
public sealed class GetOutStockScanDetailResp
|
|
|
|
{
|
|
|
|
public bool success { get; set; }
|
|
|
|
public string? message { get; set; }
|
|
|
|
public int? code { get; set; }
|
|
|
|
public List<GetOutStockScanDetailItem>? result { get; set; }
|
|
|
|
public int? costTime { get; set; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GetOutStockScanDetailItem
|
|
|
|
{
|
|
|
|
public string? id { get; set; } // 入库单明细主键 id
|
|
|
|
public string? barcode { get; set; }
|
|
|
|
public string? materialName { get; set; }
|
|
|
|
public string? spec { get; set; }
|
|
|
|
public decimal? qty { get; set; } // 可能是 null 或 “数字字符串”
|
|
|
|
public string? warehouseCode { get; set; }
|
|
|
|
public string? location { get; set; }
|
|
|
|
public bool? scanStatus { get; set; } // 可能为 null,按 false 处理
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|