From 75c4ed0d3c640e66bc95dc170de52b753629e3ed Mon Sep 17 00:00:00 2001
From: 雷神教育集团 <2244205553@qq.com>
Date: 星期五, 06 三月 2026 09:09:14 +0800
Subject: [PATCH] 最新

---
 项目代码/WCS/WCSServices/WIDESEAWCS_PackInfoService/PackaxisService.cs |  129 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 129 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_PackInfoService/PackaxisService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_PackInfoService/PackaxisService.cs"
index 47edd25..74cea7d 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_PackInfoService/PackaxisService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_PackInfoService/PackaxisService.cs"
@@ -15,13 +15,27 @@
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_IPackInfoService;
+<<<<<<< HEAD
+=======
+using WIDESEAWCS_IBasicInfoRepository;
+
+>>>>>>> main
 
 namespace WIDESEAWCS_PackInfoService
 {
     public class PackaxisService : ServiceBase<Dt_Packaxis, IPackaxisRepository>, IPackaxisService
     {
+<<<<<<< HEAD
         public PackaxisService(IPackaxisRepository BaseDal) : base(BaseDal)
         {
+=======
+        private readonly IPackTypeRepository _packTypeRepository;
+        private readonly IStationMangerRepository _stationMangerRepository;
+        public PackaxisService(IPackaxisRepository BaseDal, IPackTypeRepository packTypeRepository, IStationMangerRepository stationMangerRepository) : base(BaseDal)
+        {
+            _packTypeRepository = packTypeRepository;
+            _stationMangerRepository = stationMangerRepository;
+>>>>>>> main
         }
         public override WebResponseContent Import(List<IFormFile> files)
         {
@@ -56,7 +70,11 @@
                 using (ImportExcelHelper excelHelper = new ImportExcelHelper(fullPath))
                 {
                     dtExcel = excelHelper.ExcelToDataTable();
+<<<<<<< HEAD
                     
+=======
+
+>>>>>>> main
                 }
                 List<Dt_Packaxis> addAxis = new List<Dt_Packaxis>();
                 List<Dt_Packaxis> updateAxis = new List<Dt_Packaxis>();
@@ -82,7 +100,11 @@
                     string AxisZCount = row["AxisZCount"]?.ToString() ?? string.Empty;
                     string AxisZSpacing = row["AxisZSpacing"]?.ToString() ?? string.Empty;
                     var axis = BaseDal.QueryFirst(x => x.DeviceCode == DeviceCode && x.StationCode == StationCode && x.PackType == PackType);
+<<<<<<< HEAD
                     if(axis == null)
+=======
+                    if (axis == null)
+>>>>>>> main
                     {
                         Dt_Packaxis packaxis = new Dt_Packaxis()
                         {
@@ -136,5 +158,112 @@
 
             return content;
         }
+<<<<<<< HEAD
+=======
+        /// <summary>
+        /// 娣诲姞鍧愭爣鏁版嵁
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public override WebResponseContent AddData(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string json = JsonConvert.SerializeObject(saveModel.MainData);
+                Dt_Packaxis dt_Pack = JsonConvert.DeserializeObject<Dt_Packaxis>(json);
+                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == dt_Pack.StationCode  && x.StackerCraneCode == dt_Pack.DeviceCode);
+                Dt_PackType packTyp = _packTypeRepository.QueryFirst(x => x.Id == dt_Pack.PackType);
+
+                int w = 1200;//杩欎釜鏄爜鍨涙墭鐩樺1.2绫�
+                int h = 1500;//鎵樼洏鐨勯珮搴﹂檺楂�1.5绫�
+                int AxisXCountMax = w / packTyp.PackLength;//X鍧愭爣鏈�澶氭斁鐮佸灈鏁伴噺
+                int AxisYCountMax = w / packTyp.PackWidth;//Y鍧愭爣鏈�澶氭斁鐮佸灈鏁伴噺
+                int AxisZCountMax = h / packTyp.PackHeight;//Z鍧愭爣鏈�澶氭斁鐮佸灈鏁伴噺
+
+
+                if (dt_Pack.AxisXCount <= 0 || dt_Pack.AxisXCount > AxisXCountMax || dt_Pack.AxisYCount <= 0 || dt_Pack.AxisYCount > AxisYCountMax || dt_Pack.AxisZCount <= 0 || dt_Pack.AxisZCount > AxisZCountMax)
+                {
+                    return WebResponseContent.Instance.Error($"娣诲姞澶辫触锛岃杈撳叆X鍧愭爣鐮佸灈鏁板ぇ浜�0涓斿皬浜巤AxisXCountMax + 1}涓擸鍧愭爣鐮佸灈鏁板ぇ浜�0涓斿皬浜巤AxisYCountMax + 1}涓擹鍧愭爣鐮佸灈鏁板ぇ浜�0涓斿皬浜巤AxisZCountMax + 1}");
+                }
+
+                if (stationManger.IsNullOrEmpty())
+                {
+                    return WebResponseContent.Instance.Error($"娣诲姞澶辫触锛岃鐮佸灈鏈哄櫒杈撻�佺嚎宸ヤ綅閫夐敊锛�");
+                }
+
+                Dt_Packaxis packaxis = BaseDal.QueryFirst(x => x.DeviceCode == dt_Pack.DeviceCode && x.StationCode == dt_Pack.StationCode && x.PackType == dt_Pack.PackType);
+
+               
+
+                if (packaxis.IsNullOrEmpty())
+                {
+                    
+                    saveModel.MainData["PackNum"] = dt_Pack.AxisXCount * dt_Pack.AxisYCount * dt_Pack.AxisZCount;
+
+                    return base.AddData(saveModel);
+                }
+                return WebResponseContent.Instance.Error($"娣诲姞澶辫触,璇ョ爜鍨涘潗鏍囨暟鎹凡瀛樺湪!");
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+
+            return content;
+
+        }
+        /// <summary>
+        /// 淇敼鍧愭爣鏁版嵁
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public override WebResponseContent UpdateData(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string json = JsonConvert.SerializeObject(saveModel.MainData);
+                Dt_Packaxis dt_Pack = JsonConvert.DeserializeObject<Dt_Packaxis>(json);
+
+                Dt_PackType packTyp = _packTypeRepository.QueryFirst(x => x.Id == dt_Pack.PackType);
+
+                int w = 1200;//杩欎釜鏄爜鍨涙墭鐩樺1.2绫�
+                int h = 1500;//鎵樼洏鐨勯珮搴﹂檺楂�1.5绫�
+                int AxisXCountMax = w / packTyp.PackLength;//X鍧愭爣鏈�澶氭斁鐮佸灈鏁伴噺
+                int AxisYCountMax = w / packTyp.PackWidth;//Y鍧愭爣鏈�澶氭斁鐮佸灈鏁伴噺
+                int AxisZCountMax = h / packTyp.PackHeight;//Z鍧愭爣鏈�澶氭斁鐮佸灈鏁伴噺
+
+
+                if (dt_Pack.AxisXCount <= 0 || dt_Pack.AxisXCount > AxisXCountMax || dt_Pack.AxisYCount <= 0 || dt_Pack.AxisYCount > AxisYCountMax || dt_Pack.AxisZCount <= 0 || dt_Pack.AxisZCount > AxisZCountMax)
+                {
+                    return WebResponseContent.Instance.Error($"淇敼澶辫触锛岃杈撳叆X鍧愭爣鐮佸灈鏁板ぇ浜�0涓斿皬浜巤AxisXCountMax + 1}涓擸鍧愭爣鐮佸灈鏁板ぇ浜�0涓斿皬浜巤AxisYCountMax + 1}涓擹鍧愭爣鐮佸灈鏁板ぇ浜�0涓斿皬浜巤AxisZCountMax + 1}");
+                }
+
+                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == dt_Pack.StationCode && x.StackerCraneCode == dt_Pack.DeviceCode);
+                if (stationManger.IsNullOrEmpty())
+                {
+                    return WebResponseContent.Instance.Error($"淇敼澶辫触锛岃鐮佸灈鏈哄櫒杈撻�佺嚎宸ヤ綅閫夐敊锛�");
+                }
+                Dt_Packaxis packaxis = BaseDal.QueryFirst(x => x.Id != dt_Pack.Id && x.DeviceCode == dt_Pack.DeviceCode && x.StationCode == dt_Pack.StationCode && x.PackType == dt_Pack.PackType);
+                if (packaxis.IsNullOrEmpty())
+                {
+                
+                    saveModel.MainData["PackNum"] = dt_Pack.AxisXCount * dt_Pack.AxisYCount * dt_Pack.AxisZCount;
+
+                    return base.UpdateData(saveModel);
+                }
+
+                return WebResponseContent.Instance.Error($"淇敼澶辫触,璇ョ爜鍨涘潗鏍囨暟鎹凡瀛樺湪!");
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+
+            return content;
+
+        }
+>>>>>>> main
     }
 }

--
Gitblit v1.9.3