From 2044377679930e8580573322b2a62624a9b0e927 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期一, 13 四月 2026 08:40:42 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShiGe/HanDanLiKu

---
 项目代码/WMS/WMSServices/WIDESEA_InboundService/MoInboundOrderService.cs |  130 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_InboundService/MoInboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_InboundService/MoInboundOrderService.cs"
new file mode 100644
index 0000000..32aff98
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_InboundService/MoInboundOrderService.cs"
@@ -0,0 +1,130 @@
+锘縰sing SqlSugar.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Common.PLSEnum;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_DTO;
+using WIDESEA_DTO.PLS;
+using WIDESEA_IBasicRepository;
+using WIDESEA_IBasicService;
+using WIDESEA_IInboundRepository;
+using WIDESEA_IInboundService;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_InboundService
+{
+    public class MoInboundOrderService : ServiceBase<Dt_MoInboundOrder, IMoInboundOrderRepository>, IMoInboundOrderService
+    {
+
+        public IMoInboundOrderRepository Repository => BaseDal;
+
+        public MoInboundOrderService(IMoInboundOrderRepository BaseDal) : base(BaseDal)
+        {
+        }
+
+
+        /// <summary>
+        /// PLS鍚屾MO绁ㄤ俊鎭�
+        /// </summary>
+        public ApiResponseContent ReceiveMoStatus(MoInboundOrderDTO model)
+        {
+            // 1. 鍩虹鍙傛暟鏍¢獙
+            if (model == null || model.Data == null || !model.Data.Any())
+            {
+                return ApiResponseContent.Instance.Error("MO绁ㄤ紶鍏ュ弬鏁颁负绌�");
+            }
+
+            var dataList = new List<LabelNoData>();
+            int successCount = 0;
+            int totalCount = model.Data.Count;
+
+            try
+            {
+                foreach (var item in model.Data)
+                {
+                    var itemResult = new LabelNoData
+                    {
+                        LabelNo = item.LabelNo
+                    };
+                    try
+                    {
+                        // 鍙傛暟鏍¢獙
+                        if (string.IsNullOrWhiteSpace(item.LabelNo))
+                        {
+                            throw new Exception("鏍囩鍙� LabelNo 涓嶈兘涓虹┖");
+                        }
+
+                        // 鏌ヨMO绁ㄦ槸鍚﹀凡瀛樺湪
+                        var existMo = BaseDal.QueryFirst(x => x.LabelNo == item.LabelNo);
+
+                        if (existMo == null)
+                        {
+                            var addEntity = new Dt_MoInboundOrder()
+                            {
+                                OrgId = item.OrgId,
+                                LabelNo = item.LabelNo,
+                                Status = item.Status,
+                                BarcodeNumber = item.BarcodeNumber,
+                                SupplierCode = item.SupplierCode,
+                                ItemCode = item.ItemCode,
+                                Qty = item.Qty,
+                                WorkOrderName = item.WorkOrderName,
+                                DeleteFlag = item.DeleteFlag,
+                                ReturnToPlsStatus = ReturnToPlsStatusEnum.鏈帹閫�.ObjToInt(),
+                                CreateDate = item.CreateDate,
+                                Creater = item.CreateUser,
+                                Modifier = item.UpdateUser,
+                                ModifyDate = item.UpdateDate
+                            };
+                            BaseDal.AddData(addEntity);
+                        }
+                        else
+                        {
+                            existMo.OrgId = item.OrgId;
+                            existMo.Status = item.Status;
+                            existMo.BarcodeNumber = item.BarcodeNumber;
+                            existMo.SupplierCode = item.SupplierCode;
+                            existMo.ItemCode = item.ItemCode;
+                            existMo.Qty = item.Qty;
+                            existMo.WorkOrderName = item.WorkOrderName;
+                            existMo.DeleteFlag = item.DeleteFlag;
+                            existMo.Modifier = item.UpdateUser;
+                            existMo.ModifyDate = item.UpdateDate;
+
+                            BaseDal.UpdateData(existMo);
+                        }
+
+                        // 鍗曟潯澶勭悊鎴愬姛
+                        itemResult.Success = 0;
+                        successCount++;
+                    }
+                    catch (Exception ex)
+                    {
+                        // 鍗曟潯澶勭悊澶辫触
+                        itemResult.Success = 1;
+                        itemResult.Msg = ex.Message;
+                    }
+                    finally
+                    {
+                        // 姣忔潯鏃犺鎴愬姛/澶辫触锛岄兘鍔犲叆杩斿洖鍒楄〃
+                        dataList.Add(itemResult);
+                    }
+                }
+
+                // 鍏ㄩ儴澶勭悊瀹屾垚锛岃繑鍥炵粨鏋�
+                return ApiResponseContent.Instance.OK(
+                    dataList,
+                    $"澶勭悊瀹屾垚锛氬叡{totalCount}鏉★紝鎴愬姛{successCount}鏉★紝澶辫触{totalCount - successCount}鏉�"
+                );
+            }
+            catch (Exception ex)
+            {
+                return ApiResponseContent.Instance.Error($"MO绁ㄥ悓姝ユ暣浣撳紓甯革細{ex.Message}");
+            }
+        }
+
+    }
+}

--
Gitblit v1.9.3