From 98c5fbdce57cf9f0914ca5fb2c659c9396d3aed6 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期三, 03 十二月 2025 22:53:01 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs | 114 +++++++++++++--------------------------------------------
1 files changed, 26 insertions(+), 88 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs"
index eb43ee1..3848d23 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs"
@@ -27,31 +27,7 @@
using WIDESEA_Model.Models;
namespace WIDESEA_BasicService
-{
- public class TransferDataDto
- {
- public DateTime TransferTime { get; set; }
- public List<TransferItemDto> Items { get; set; }
- }
-
- public class TransferItemDto
- {
- public string MaterialCode { get; set; }
- public decimal TotalQuantity { get; set; }
- public List<LocationInfoDto> Locations { get; set; }
- }
- public class LocationInfoDto
- {
- public string LocationCode { get; set; }
- public decimal Quantity { get; set; }
- public List<BarcodeInfoDto> Barcodes { get; set; }
- }
-
- public class BarcodeInfoDto
- {
- public string Barcode { get; set; }
- public decimal Quantity { get; set; }
- }
+{
public class InvokeMESService : IInvokeMESService
{
private readonly IHttpClientFactory _httpClientFactory;
@@ -129,7 +105,7 @@
_client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Add("Accept", "application/json");
- _logger.LogInformation("InvokeMESService FeedbackOutbound : " + json);
+ _logger.LogInformation("InvokeMESService FeedbackOutbound : "+ model.orderNo +" , " + json);
var response = await _client.PostAsync("AldMaterialOutbound/MaterialOutbound", content);
string body = await response.Content.ReadAsStringAsync();
@@ -139,7 +115,7 @@
throw new HttpRequestException(body);
}
-
+ _logger.LogInformation("InvokeMESService FeedbackOutbound body: " + body);
return JsonConvert.DeserializeObject<ResponseModel>(body);
}
@@ -248,58 +224,7 @@
}
}
- /// <summary>
- /// 鍑嗗鍥炰紶鏁版嵁
- /// </summary>
- private TransferDataDto PrepareTransferData(List<Dt_PickingRecord> pickingRecords)
- {
- var transferData = new TransferDataDto
- {
- TransferTime = DateTime.Now,
- Items = new List<TransferItemDto>()
- };
-
- // 鎸夌墿鏂欏垎缁�
- var materialGroups = pickingRecords
- .GroupBy(x => x.MaterielCode)
- .ToList();
-
- foreach (var group in materialGroups)
- {
- var item = new TransferItemDto
- {
- MaterialCode = group.Key,
- TotalQuantity = group.Sum(x => x.PickQuantity),
- Locations = new List<LocationInfoDto>()
- };
-
- // 鎸夎揣浣嶅垎缁�
- var locationGroups = group
- .GroupBy(x => x.LocationCode)
- .ToList();
-
- foreach (var locationGroup in locationGroups)
- {
- var location = new LocationInfoDto
- {
- LocationCode = locationGroup.Key,
- Quantity = locationGroup.Sum(x => x.PickQuantity),
- Barcodes = locationGroup.Select(x => new BarcodeInfoDto
- {
- Barcode = x.Barcode,
- Quantity = x.PickQuantity
- }).ToList()
- };
-
- item.Locations.Add(location);
- }
-
- transferData.Items.Add(item);
- }
-
- return transferData;
- }
-
+
/// <summary>
///
/// </summary>
@@ -489,7 +414,7 @@
business_type = outboundOrder.BusinessType,
factoryArea = outboundOrder.FactoryArea,
operationType = 1,
- Operator = outboundOrder.Operator,
+ Operator = outboundOrder.Operator!=""? outboundOrder.Operator:App.User.UserName,
orderNo = outboundOrder.UpperOrderNo,
documentsNO = documentNo,
status = outboundOrder.OrderStatus,
@@ -511,7 +436,7 @@
materialCode = detail.MaterielCode,
lineNo = detail.lineNo,
warehouseCode = detail.WarehouseCode,
- qty = 0,
+ qty = detail.BarcodeQty,
currentDeliveryQty = 0,
unit = detail.BarcodeUnit,
barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
@@ -544,8 +469,7 @@
else
{
barModel.qty = item.PickQuantity;
- }
- detailModel.qty += barModel.qty;
+ }
detailModel.currentDeliveryQty += barModel.qty;
detailModel.barcodes.Add(barModel);
}
@@ -553,12 +477,12 @@
feedModel.details.Add(detailModel);
}
- feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit }).Select(group => new FeedbackOutboundDetailsModel
+ feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit,item.qty }).Select(group => new FeedbackOutboundDetailsModel
{
materialCode = group.Key.materialCode,
lineNo = group.Key.lineNo,
warehouseCode = group.Key.warehouseCode,
- qty = group.Sum(x => x.qty),
+ qty = group.Key.qty,
currentDeliveryQty = group.Sum(x => x.currentDeliveryQty),
unit = group.Key.unit,
barcodes = group.SelectMany(x => x.barcodes.GroupBy(o => new { o.barcode, o.supplyCode, o.batchNo, o.unit }).Select(row => new WIDESEA_DTO.Outbound.BarcodesModel
@@ -829,6 +753,11 @@
.Where(x => x.OrderNo == orderNo)
.ExecuteCommandAsync();
+ await _pickingRecoreRepository.Db.Updateable<Dt_PickingRecord>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderNo == orderNo)
+ .ExecuteCommandAsync();
+
return WebResponseContent.Instance.OK("鍥炰紶MES鎴愬姛");
}
else
@@ -848,7 +777,7 @@
return WebResponseContent.Instance.Error("澶勭悊鍥炰紶MES鏃跺彂鐢熷紓甯革紝璇疯仈绯荤鐞嗗憳");
}
}
- }
+ }
public static class UniqueValueGenerator
{
@@ -862,14 +791,23 @@
public static string Generate()
{
var now = DateTime.Now;
- string datePart = now.ToString("yyyyMMdd");
+ string datePart = now.ToString("MMdd");
long ticksPart = now.Ticks;
+ // 鎷兼帴锛氳鏁板櫒琛�0涓�3浣嶏紙閬垮厤浣嶆暟涓嶄竴鑷达級
+ return $"{datePart}{ticksPart}";
+ }
+
+ public static string GenerateCount()
+ {
+ var now = DateTime.Now;
+ string datePart = now.ToString("yyyyMMddHHmmss");
+
// 鍘熷瓙閫掑璁℃暟鍣紙鍙栨ā1000锛岀‘淇濊鏁板櫒浠�3浣嶏紝鎺у埗闀垮害锛�
long counterPart = Interlocked.Increment(ref _counter) % 1000;
// 鎷兼帴锛氳鏁板櫒琛�0涓�3浣嶏紙閬垮厤浣嶆暟涓嶄竴鑷达級
- return $"{datePart}{ticksPart}{counterPart:D3}";
+ return $"{datePart}{counterPart:D3}";
}
}
}
--
Gitblit v1.9.3