From 4ceafb06c79925d95fd2c4261e5d3d5ab37accfe Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 27 11月 2024 09:44:53 +0800
Subject: [PATCH] 22
---
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Const/ApplicationConst.cs | 2
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs | 60 +++
LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOrder/Mes_BatchOrderUPI_New/Mes_BatchOrderUPI_NewService.cs | 862 ++++++++++++++++++++++++++---------------------------
3 files changed, 483 insertions(+), 441 deletions(-)
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Const/ApplicationConst.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Const/ApplicationConst.cs
index 587af35..c79fdd4 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Const/ApplicationConst.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Const/ApplicationConst.cs
@@ -61,8 +61,8 @@
public const string WmsSystemGroupName = "WMS绯荤粺绠$悊";
public const string WmsStockSnapshotDetailsGroupName = "搴撳瓨蹇収绠$悊";
public const string printCenterGroupName = "鎵撳嵃涓績";
-
+ public const string ThirdInterFaceServiceGroupName = "绗笁鏂规湇鍔℃帴鍙g鐞�";
}
\ No newline at end of file
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs
new file mode 100644
index 0000000..89d4870
--- /dev/null
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/ThirdInterFace/ThirdInterFaceService.cs
@@ -0,0 +1,60 @@
+锘縰sing Admin.NET.Core.Service;
+using Admin.NET.Application.Entity;
+using Microsoft.AspNetCore.Http;
+using System.Data;
+using System.Web;
+using System.Text;
+using Furion.DatabaseAccessor;
+using Admin.NET.Application.Service.WmsOrder.Mes_BatchOrderUPI_New.Dto;
+
+namespace Admin.NET.Application;
+/// <summary>
+/// 绗笁鏂规帴鍙f湇鍔�
+/// </summary>
+[ApiDescriptionSettings(ApplicationConst.ThirdInterFaceServiceGroupName, Order = 100)]
+public class ThirdInterFaceService : IDynamicApiController, ITransient
+{
+ private readonly SqlSugarRepository<Mes_BatchOrderUPI_New> _rep;
+ public ThirdInterFaceService(SqlSugarRepository<Mes_BatchOrderUPI_New> rep)
+ {
+ _rep = rep;
+ }
+
+ [HttpPost]
+ [ApiDescriptionSettings(Name = "GetBatchOrderUPIList")]
+ [UnitOfWork]
+ [AllowAnonymous]
+ public async Task GetBatchOrderUPIList(List<Mes_BatchOrderUPI_New> input)
+ {
+ if (input?.Count <= 0)
+ {
+ throw Oops.Oh($"鏁版嵁涓嶈兘涓虹┖");
+ }
+ //鏍¢獙upi鏄惁閲嶅 銆怑ditby shaocx,2022-12-13銆�
+ var myList = input.Select(x => x.UPI).ToList();
+ var result = myList.GroupBy(x => x)
+ .Where(g => g.Count() > 1)
+ .ToDictionary(x => x.Key, x => x.Count());
+ if (result != null && result.Count > 0)
+ {
+ var dit = result.First();
+ throw Oops.Oh("鏈鏈夐噸澶嶇殑UPI锛侀噸澶嶅彿涓�:" + dit.Key + ",閲嶅鏉℃暟:" + dit.Value);
+ }
+
+ List<string> upis = new List<string>();
+ input.ForEach(x => upis.Add(x.UPI));//upis鏄紶杩囨潵鐨剈pi瀛楁闆嗗悎
+
+ var batchOrderUPIs = await _rep.AsQueryable().Where(x => upis.Contains(x.UPI)).ToListAsync();//batchOrderUPIs鏄噸澶嶇殑upi闆嗗悎
+ //鎵归噺鍒犻櫎
+ await _rep.DeleteAsync(batchOrderUPIs);
+
+ foreach (var item in input)
+ {
+ item.AreaCode = AreaCodeEnum.鏃犲尯鍩�;
+ item.UpiStatus = UpiStatusEnum.鍒濆;
+ }
+ await _rep.InsertRangeAsync(input);
+ }
+
+}
+
diff --git a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOrder/Mes_BatchOrderUPI_New/Mes_BatchOrderUPI_NewService.cs b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOrder/Mes_BatchOrderUPI_New/Mes_BatchOrderUPI_NewService.cs
index 24dc311..d3bcc88 100644
--- a/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOrder/Mes_BatchOrderUPI_New/Mes_BatchOrderUPI_NewService.cs
+++ b/LA24030_LuLiPackageLine_Wms/Admin.NET.Application/Service/WmsOrder/Mes_BatchOrderUPI_New/Mes_BatchOrderUPI_NewService.cs
@@ -95,7 +95,7 @@
var entity = input.Adapt<Mes_BatchOrderUPI_New>();
//閲嶅鎬ч獙璇�
- await CheckExist(entity,true);
+ await CheckExist(entity, true);
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
@@ -118,7 +118,7 @@
#region 瀵煎叆
-
+
/// <summary>
/// Excel妯℃澘瀵煎叆鎵规鏁版嵁鍔熻兘
/// </summary>
@@ -128,15 +128,15 @@
[ApiDescriptionSettings(Name = "ImportExcel")]
[Description("Mes_BatchOrderUPI_New/ImportExcel")]
public async Task<int> ImportExcelAsync(IFormFile file)
- {
+ {
int _HeadStartLine = 2;//绗�1琛屾槸璇存槑,绗�2琛屾槸鍒楀悕
int _DataStartLine = 3;//绗�3琛屽紑濮嬫槸鏁版嵁
DataTable importDataTable = ExcelUtil.ImportExcelToDataTable(file, _HeadStartLine, _DataStartLine);
- var addList =await CommonImport(importDataTable, _DataStartLine);
+ var addList = await CommonImport(importDataTable, _DataStartLine);
await _rep.InsertRangeAsync(addList);
return addList.Count;
}
-
+
/// <summary>
/// DataTable杞崲瀹炰綋瀵硅薄鍒楄〃
/// </summary>
@@ -151,373 +151,373 @@
{
index++;
//瀵煎叆妯$増瀹氬埗鍖栦唬鐮侊紙鏇挎崲妯$増浣跨敤锛�
-
- var addItem = new Mes_BatchOrderUPI_New();
- #region 瀹氫箟鍙橀噺
- var _AreaCode = "";//鎵�鍦ㄥ尯鍩�
- var _UpiStatus = "";//鏉挎枡鐘舵��
- var _PlanNo = "";//鎵规鍙�
- var _OrderId = "";//璁㈠崟鍙�
- var _UPI = "";//閮ㄤ欢鏉$爜
- var _DetailName = "";//閮ㄤ欢鍚嶇О
- var _Length = "";//闀�
- var _Width = "";//瀹�
- var _Thk = "";//鍘�
- var _Matgrid = "";//閮ㄤ欢绾圭悊
- var _IsEB = "";//鏄惁灏佽竟
- var _DRNum = "";//鎵撳瓟璁惧缂栧彿
- var _IsPA = "";//鏄惁浼樺寲鍖呰
- var _MaterialIndeX = "";//閿垏鍥惧彿
- var _PackageCode = "";//鍖呰鍙�
- var _MachineXCenter = "";//鍖呰X鍧愭爣
- var _MachineYCenter = "";//鍖呰Y鍧愭爣
- var _MachineZCenter = "";//鍖呰Z鍧愭爣
- var _Sequence = "";//灞傛暟
- var _Shelf = "";//娆″簭
- var _Rotation = "";//杞悜瑙掑害
- var _Info1 = "";//绾哥闀�
- var _Info2 = "";//绾哥瀹�
- var _Info3 = "";//绾哥楂�
- var _Info4 = "";//閿�鍞悎鍚屽崟鍙�
- var _Info5 = "";//鐢熶骇鍗曞彿
- var _Info6 = "";//绗嚑鍖�
- var _Info7 = "";//缁忛攢搴楀悕绉�
- var _Info8 = "";//浜у搧鍚嶇О
- var _Info10 = "";//瀹㈡埛鍚嶇О
- var _Info9 = "";//鍖呰缂栫爜
- var _Info11 = "";//鑷彁or鍙戣揣
- var _Info12 = "";//鍖呰閮ㄤ欢鎬绘暟閲�
- var _Info13 = "";//鍖呰闈㈢Н
- var _Info14 = "";//閮ㄤ欢鍚嶇О
- var _Info15 = "";//閮ㄤ欢鏁伴噺
- var _Info16 = "";//閮ㄤ欢灏哄
- #endregion
-
-
- #region 鍙栧��
- _AreaCode = row["鎵�鍦ㄥ尯鍩�"]?.ToString() ;
- _UpiStatus = row["鏉挎枡鐘舵��"]?.ToString() ;
- _PlanNo = row["鎵规鍙�"]?.ToString() ;
- _OrderId = row["璁㈠崟鍙�"]?.ToString() ;
- _UPI = row["閮ㄤ欢鏉$爜"]?.ToString() ;
- _DetailName = row["閮ㄤ欢鍚嶇О"]?.ToString() ;
- _Length = row["闀�"]?.ToString() ;
- _Width = row["瀹�"]?.ToString() ;
- _Thk = row["鍘�"]?.ToString() ;
- _Matgrid = row["閮ㄤ欢绾圭悊"]?.ToString() ;
- _IsEB = row["鏄惁灏佽竟"]?.ToString() ;
- _DRNum = row["鎵撳瓟璁惧缂栧彿"]?.ToString() ;
- _IsPA = row["鏄惁浼樺寲鍖呰"]?.ToString() ;
- _MaterialIndeX = row["閿垏鍥惧彿"]?.ToString() ;
- _PackageCode = row["鍖呰鍙�"]?.ToString() ;
- _MachineXCenter = row["鍖呰X鍧愭爣"]?.ToString() ;
- _MachineYCenter = row["鍖呰Y鍧愭爣"]?.ToString() ;
- _MachineZCenter = row["鍖呰Z鍧愭爣"]?.ToString() ;
- _Sequence = row["灞傛暟"]?.ToString() ;
- _Shelf = row["娆″簭"]?.ToString() ;
- _Rotation = row["杞悜瑙掑害"]?.ToString() ;
- _Info1 = row["绾哥闀�"]?.ToString() ;
- _Info2 = row["绾哥瀹�"]?.ToString() ;
- _Info3 = row["绾哥楂�"]?.ToString() ;
- _Info4 = row["閿�鍞悎鍚屽崟鍙�"]?.ToString() ;
- _Info5 = row["鐢熶骇鍗曞彿"]?.ToString() ;
- _Info6 = row["绗嚑鍖�"]?.ToString() ;
- _Info7 = row["缁忛攢搴楀悕绉�"]?.ToString() ;
- _Info8 = row["浜у搧鍚嶇О"]?.ToString() ;
- _Info10 = row["瀹㈡埛鍚嶇О"]?.ToString() ;
- _Info9 = row["鍖呰缂栫爜"]?.ToString() ;
- _Info11 = row["鑷彁or鍙戣揣"]?.ToString() ;
- _Info12 = row["鍖呰閮ㄤ欢鎬绘暟閲�"]?.ToString() ;
- _Info13 = row["鍖呰闈㈢Н"]?.ToString() ;
- _Info14 = row["閮ㄤ欢鍚嶇О"]?.ToString() ;
- _Info15 = row["閮ㄤ欢鏁伴噺"]?.ToString() ;
- _Info16 = row["閮ㄤ欢灏哄"]?.ToString() ;
- #endregion
-
-
- #region 楠岃瘉
- if(!string.IsNullOrEmpty(_AreaCode))
- {
- Admin.NET.Application.AreaCodeEnum enumAreaCode = default(Admin.NET.Application.AreaCodeEnum);
-
- if(!Enum.TryParse<Admin.NET.Application.AreaCodeEnum>(_AreaCode, out enumAreaCode)&&!string.IsNullOrEmpty(_AreaCode))
- {
- throw Oops.Oh($"绗瑊index}琛孾鎵�鍦ㄥ尯鍩焆{_AreaCode}鍊间笉姝g‘锛�");
- }
- else
- {
- addItem.AreaCode = enumAreaCode;
- }
-
- }
-
- if (string.IsNullOrEmpty(_UpiStatus))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏉挎枡鐘舵�乚{_UpiStatus}涓嶈兘涓虹┖锛�");
- }
-
- if(!string.IsNullOrEmpty(_UpiStatus))
- {
- Admin.NET.Application.UpiStatusEnum enumUpiStatus = default(Admin.NET.Application.UpiStatusEnum);
-
- if(!Enum.TryParse<Admin.NET.Application.UpiStatusEnum>(_UpiStatus, out enumUpiStatus)&&!string.IsNullOrEmpty(_UpiStatus))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏉挎枡鐘舵�乚{_UpiStatus}鍊间笉姝g‘锛�");
- }
- else
- {
- addItem.UpiStatus = enumUpiStatus;
- }
-
- }
-
- if (string.IsNullOrEmpty(_PlanNo))
- {
- throw Oops.Oh($"绗瑊index}琛孾鎵规鍙穄{_PlanNo}涓嶈兘涓虹┖锛�");
- }
-
- if(!string.IsNullOrEmpty(_PlanNo))
- {
- addItem.PlanNo = (string)(_PlanNo.Trim());
- }
-
- if (string.IsNullOrEmpty(_OrderId))
- {
- throw Oops.Oh($"绗瑊index}琛孾璁㈠崟鍙穄{_OrderId}涓嶈兘涓虹┖锛�");
- }
-
- if(!string.IsNullOrEmpty(_OrderId))
- {
- addItem.OrderId = (string)(_OrderId.Trim());
- }
-
- if (string.IsNullOrEmpty(_UPI))
- {
- throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鏉$爜]{_UPI}涓嶈兘涓虹┖锛�");
- }
-
- if(!string.IsNullOrEmpty(_UPI))
- {
- addItem.UPI = (string)(_UPI.Trim());
- }
-
- if (string.IsNullOrEmpty(_DetailName))
- {
- throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鍚嶇О]{_DetailName}涓嶈兘涓虹┖锛�");
- }
-
- if(!string.IsNullOrEmpty(_DetailName))
- {
- addItem.DetailName = (string)(_DetailName.Trim());
- }
-
- if (string.IsNullOrEmpty(_Length))
- {
- throw Oops.Oh($"绗瑊index}琛孾闀縘{_Length}涓嶈兘涓虹┖锛�");
- }
-
- //if(!string.IsNullOrEmpty(_Length))
- //{
- // addItem.Length = (float)(_Length.Trim());
- // }
-
- //if (string.IsNullOrEmpty(_Width))
- //{
- // throw Oops.Oh($"绗瑊index}琛孾瀹絔{_Width}涓嶈兘涓虹┖锛�");
- //}
-
- //if(!string.IsNullOrEmpty(_Width))
- //{
- // addItem.Width = (float)(_Width.Trim());
- // }
-
- //if (string.IsNullOrEmpty(_Thk))
- //{
- // throw Oops.Oh($"绗瑊index}琛孾鍘歖{_Thk}涓嶈兘涓虹┖锛�");
- //}
-
- //if(!string.IsNullOrEmpty(_Thk))
- //{
- // addItem.Thk = (float)(_Thk.Trim());
- // }
- if(!string.IsNullOrEmpty(_Matgrid))
- {
- addItem.Matgrid = (string)(_Matgrid.Trim());
- }
- if(!string.IsNullOrEmpty(_IsEB))
- {
- if (!int.TryParse(_IsEB, out int outIsEB)&&!string.IsNullOrEmpty(_IsEB))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏄惁灏佽竟]{_IsEB}鍊间笉姝g‘锛�");
- }
- if (outIsEB <= 0&&!string.IsNullOrEmpty(_IsEB))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏄惁灏佽竟]{_IsEB}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.IsEB = outIsEB;
- }
-
- }
- if(!string.IsNullOrEmpty(_DRNum))
- {
- if (!int.TryParse(_DRNum, out int outDRNum)&&!string.IsNullOrEmpty(_DRNum))
- {
- throw Oops.Oh($"绗瑊index}琛孾鎵撳瓟璁惧缂栧彿]{_DRNum}鍊间笉姝g‘锛�");
- }
- if (outDRNum <= 0&&!string.IsNullOrEmpty(_DRNum))
- {
- throw Oops.Oh($"绗瑊index}琛孾鎵撳瓟璁惧缂栧彿]{_DRNum}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.DRNum = outDRNum;
- }
-
- }
- if(!string.IsNullOrEmpty(_IsPA))
- {
- if (!int.TryParse(_IsPA, out int outIsPA)&&!string.IsNullOrEmpty(_IsPA))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏄惁浼樺寲鍖呰]{_IsPA}鍊间笉姝g‘锛�");
- }
- if (outIsPA <= 0&&!string.IsNullOrEmpty(_IsPA))
- {
- throw Oops.Oh($"绗瑊index}琛孾鏄惁浼樺寲鍖呰]{_IsPA}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.IsPA = outIsPA;
- }
-
- }
- if(!string.IsNullOrEmpty(_MaterialIndeX))
- {
- if (!int.TryParse(_MaterialIndeX, out int outMaterialIndeX)&&!string.IsNullOrEmpty(_MaterialIndeX))
- {
- throw Oops.Oh($"绗瑊index}琛孾閿垏鍥惧彿]{_MaterialIndeX}鍊间笉姝g‘锛�");
- }
- if (outMaterialIndeX <= 0&&!string.IsNullOrEmpty(_MaterialIndeX))
- {
- throw Oops.Oh($"绗瑊index}琛孾閿垏鍥惧彿]{_MaterialIndeX}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.MaterialIndeX = outMaterialIndeX;
- }
-
- }
-
- if (string.IsNullOrEmpty(_PackageCode))
- {
- throw Oops.Oh($"绗瑊index}琛孾鍖呰鍙穄{_PackageCode}涓嶈兘涓虹┖锛�");
- }
-
- if(!string.IsNullOrEmpty(_PackageCode))
- {
- addItem.PackageCode = (string)(_PackageCode.Trim());
- }
-
- if(!string.IsNullOrEmpty(_Sequence))
- {
- if (!int.TryParse(_Sequence, out int outSequence)&&!string.IsNullOrEmpty(_Sequence))
- {
- throw Oops.Oh($"绗瑊index}琛孾灞傛暟]{_Sequence}鍊间笉姝g‘锛�");
- }
- if (outSequence <= 0&&!string.IsNullOrEmpty(_Sequence))
- {
- throw Oops.Oh($"绗瑊index}琛孾灞傛暟]{_Sequence}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.Sequence = outSequence;
- }
-
- }
- if(!string.IsNullOrEmpty(_Shelf))
- {
- if (!int.TryParse(_Shelf, out int outShelf)&&!string.IsNullOrEmpty(_Shelf))
- {
- throw Oops.Oh($"绗瑊index}琛孾娆″簭]{_Shelf}鍊间笉姝g‘锛�");
- }
- if (outShelf <= 0&&!string.IsNullOrEmpty(_Shelf))
- {
- throw Oops.Oh($"绗瑊index}琛孾娆″簭]{_Shelf}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.Shelf = outShelf;
- }
-
- }
-
- if(!string.IsNullOrEmpty(_Info4))
- {
- addItem.Info4 = (string)(_Info4.Trim());
- }
- if(!string.IsNullOrEmpty(_Info5))
- {
- addItem.Info5 = (string)(_Info5.Trim());
- }
- if(!string.IsNullOrEmpty(_Info6))
- {
- addItem.Info6 = (string)(_Info6.Trim());
- }
- if(!string.IsNullOrEmpty(_Info7))
- {
- addItem.Info7 = (string)(_Info7.Trim());
- }
- if(!string.IsNullOrEmpty(_Info8))
- {
- addItem.Info8 = (string)(_Info8.Trim());
- }
- if(!string.IsNullOrEmpty(_Info10))
- {
- addItem.Info10 = (string)(_Info10.Trim());
- }
- if(!string.IsNullOrEmpty(_Info9))
- {
- addItem.Info9 = (string)(_Info9.Trim());
- }
- if(!string.IsNullOrEmpty(_Info11))
- {
- addItem.Info11 = (string)(_Info11.Trim());
- }
- if(!string.IsNullOrEmpty(_Info12))
- {
- addItem.Info12 = (string)(_Info12.Trim());
- }
- if(!string.IsNullOrEmpty(_Info13))
- {
- addItem.Info13 = (string)(_Info13.Trim());
- }
- if(!string.IsNullOrEmpty(_Info14))
- {
- addItem.Info14 = (string)(_Info14.Trim());
- }
- if(!string.IsNullOrEmpty(_Info15))
- {
- if (!int.TryParse(_Info15, out int outInfo15)&&!string.IsNullOrEmpty(_Info15))
- {
- throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鏁伴噺]{_Info15}鍊间笉姝g‘锛�");
- }
- if (outInfo15 <= 0&&!string.IsNullOrEmpty(_Info15))
- {
- throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鏁伴噺]{_Info15}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
- }
- else
- {
- addItem.Info15 = outInfo15;
- }
-
- }
- if(!string.IsNullOrEmpty(_Info16))
- {
- addItem.Info16 = (string)(_Info16.Trim());
- }
- #endregion
-
+
+ var addItem = new Mes_BatchOrderUPI_New();
+ #region 瀹氫箟鍙橀噺
+ var _AreaCode = "";//鎵�鍦ㄥ尯鍩�
+ var _UpiStatus = "";//鏉挎枡鐘舵��
+ var _PlanNo = "";//鎵规鍙�
+ var _OrderId = "";//璁㈠崟鍙�
+ var _UPI = "";//閮ㄤ欢鏉$爜
+ var _DetailName = "";//閮ㄤ欢鍚嶇О
+ var _Length = "";//闀�
+ var _Width = "";//瀹�
+ var _Thk = "";//鍘�
+ var _Matgrid = "";//閮ㄤ欢绾圭悊
+ var _IsEB = "";//鏄惁灏佽竟
+ var _DRNum = "";//鎵撳瓟璁惧缂栧彿
+ var _IsPA = "";//鏄惁浼樺寲鍖呰
+ var _MaterialIndeX = "";//閿垏鍥惧彿
+ var _PackageCode = "";//鍖呰鍙�
+ var _MachineXCenter = "";//鍖呰X鍧愭爣
+ var _MachineYCenter = "";//鍖呰Y鍧愭爣
+ var _MachineZCenter = "";//鍖呰Z鍧愭爣
+ var _Sequence = "";//灞傛暟
+ var _Shelf = "";//娆″簭
+ var _Rotation = "";//杞悜瑙掑害
+ var _Info1 = "";//绾哥闀�
+ var _Info2 = "";//绾哥瀹�
+ var _Info3 = "";//绾哥楂�
+ var _Info4 = "";//閿�鍞悎鍚屽崟鍙�
+ var _Info5 = "";//鐢熶骇鍗曞彿
+ var _Info6 = "";//绗嚑鍖�
+ var _Info7 = "";//缁忛攢搴楀悕绉�
+ var _Info8 = "";//浜у搧鍚嶇О
+ var _Info10 = "";//瀹㈡埛鍚嶇О
+ var _Info9 = "";//鍖呰缂栫爜
+ var _Info11 = "";//鑷彁or鍙戣揣
+ var _Info12 = "";//鍖呰閮ㄤ欢鎬绘暟閲�
+ var _Info13 = "";//鍖呰闈㈢Н
+ var _Info14 = "";//閮ㄤ欢鍚嶇О
+ var _Info15 = "";//閮ㄤ欢鏁伴噺
+ var _Info16 = "";//閮ㄤ欢灏哄
+ #endregion
+
+
+ #region 鍙栧��
+ _AreaCode = row["鎵�鍦ㄥ尯鍩�"]?.ToString();
+ _UpiStatus = row["鏉挎枡鐘舵��"]?.ToString();
+ _PlanNo = row["鎵规鍙�"]?.ToString();
+ _OrderId = row["璁㈠崟鍙�"]?.ToString();
+ _UPI = row["閮ㄤ欢鏉$爜"]?.ToString();
+ _DetailName = row["閮ㄤ欢鍚嶇О"]?.ToString();
+ _Length = row["闀�"]?.ToString();
+ _Width = row["瀹�"]?.ToString();
+ _Thk = row["鍘�"]?.ToString();
+ _Matgrid = row["閮ㄤ欢绾圭悊"]?.ToString();
+ _IsEB = row["鏄惁灏佽竟"]?.ToString();
+ _DRNum = row["鎵撳瓟璁惧缂栧彿"]?.ToString();
+ _IsPA = row["鏄惁浼樺寲鍖呰"]?.ToString();
+ _MaterialIndeX = row["閿垏鍥惧彿"]?.ToString();
+ _PackageCode = row["鍖呰鍙�"]?.ToString();
+ _MachineXCenter = row["鍖呰X鍧愭爣"]?.ToString();
+ _MachineYCenter = row["鍖呰Y鍧愭爣"]?.ToString();
+ _MachineZCenter = row["鍖呰Z鍧愭爣"]?.ToString();
+ _Sequence = row["灞傛暟"]?.ToString();
+ _Shelf = row["娆″簭"]?.ToString();
+ _Rotation = row["杞悜瑙掑害"]?.ToString();
+ _Info1 = row["绾哥闀�"]?.ToString();
+ _Info2 = row["绾哥瀹�"]?.ToString();
+ _Info3 = row["绾哥楂�"]?.ToString();
+ _Info4 = row["閿�鍞悎鍚屽崟鍙�"]?.ToString();
+ _Info5 = row["鐢熶骇鍗曞彿"]?.ToString();
+ _Info6 = row["绗嚑鍖�"]?.ToString();
+ _Info7 = row["缁忛攢搴楀悕绉�"]?.ToString();
+ _Info8 = row["浜у搧鍚嶇О"]?.ToString();
+ _Info10 = row["瀹㈡埛鍚嶇О"]?.ToString();
+ _Info9 = row["鍖呰缂栫爜"]?.ToString();
+ _Info11 = row["鑷彁or鍙戣揣"]?.ToString();
+ _Info12 = row["鍖呰閮ㄤ欢鎬绘暟閲�"]?.ToString();
+ _Info13 = row["鍖呰闈㈢Н"]?.ToString();
+ _Info14 = row["閮ㄤ欢鍚嶇О"]?.ToString();
+ _Info15 = row["閮ㄤ欢鏁伴噺"]?.ToString();
+ _Info16 = row["閮ㄤ欢灏哄"]?.ToString();
+ #endregion
+
+
+ #region 楠岃瘉
+ if (!string.IsNullOrEmpty(_AreaCode))
+ {
+ Admin.NET.Application.AreaCodeEnum enumAreaCode = default(Admin.NET.Application.AreaCodeEnum);
+
+ if (!Enum.TryParse<Admin.NET.Application.AreaCodeEnum>(_AreaCode, out enumAreaCode) && !string.IsNullOrEmpty(_AreaCode))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鎵�鍦ㄥ尯鍩焆{_AreaCode}鍊间笉姝g‘锛�");
+ }
+ else
+ {
+ addItem.AreaCode = enumAreaCode;
+ }
+
+ }
+
+ if (string.IsNullOrEmpty(_UpiStatus))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏉挎枡鐘舵�乚{_UpiStatus}涓嶈兘涓虹┖锛�");
+ }
+
+ if (!string.IsNullOrEmpty(_UpiStatus))
+ {
+ Admin.NET.Application.UpiStatusEnum enumUpiStatus = default(Admin.NET.Application.UpiStatusEnum);
+
+ if (!Enum.TryParse<Admin.NET.Application.UpiStatusEnum>(_UpiStatus, out enumUpiStatus) && !string.IsNullOrEmpty(_UpiStatus))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏉挎枡鐘舵�乚{_UpiStatus}鍊间笉姝g‘锛�");
+ }
+ else
+ {
+ addItem.UpiStatus = enumUpiStatus;
+ }
+
+ }
+
+ if (string.IsNullOrEmpty(_PlanNo))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鎵规鍙穄{_PlanNo}涓嶈兘涓虹┖锛�");
+ }
+
+ if (!string.IsNullOrEmpty(_PlanNo))
+ {
+ addItem.PlanNo = (string)(_PlanNo.Trim());
+ }
+
+ if (string.IsNullOrEmpty(_OrderId))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾璁㈠崟鍙穄{_OrderId}涓嶈兘涓虹┖锛�");
+ }
+
+ if (!string.IsNullOrEmpty(_OrderId))
+ {
+ addItem.OrderId = (string)(_OrderId.Trim());
+ }
+
+ if (string.IsNullOrEmpty(_UPI))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鏉$爜]{_UPI}涓嶈兘涓虹┖锛�");
+ }
+
+ if (!string.IsNullOrEmpty(_UPI))
+ {
+ addItem.UPI = (string)(_UPI.Trim());
+ }
+
+ if (string.IsNullOrEmpty(_DetailName))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鍚嶇О]{_DetailName}涓嶈兘涓虹┖锛�");
+ }
+
+ if (!string.IsNullOrEmpty(_DetailName))
+ {
+ addItem.DetailName = (string)(_DetailName.Trim());
+ }
+
+ if (string.IsNullOrEmpty(_Length))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾闀縘{_Length}涓嶈兘涓虹┖锛�");
+ }
+
+ //if(!string.IsNullOrEmpty(_Length))
+ //{
+ // addItem.Length = (float)(_Length.Trim());
+ // }
+
+ //if (string.IsNullOrEmpty(_Width))
+ //{
+ // throw Oops.Oh($"绗瑊index}琛孾瀹絔{_Width}涓嶈兘涓虹┖锛�");
+ //}
+
+ //if(!string.IsNullOrEmpty(_Width))
+ //{
+ // addItem.Width = (float)(_Width.Trim());
+ // }
+
+ //if (string.IsNullOrEmpty(_Thk))
+ //{
+ // throw Oops.Oh($"绗瑊index}琛孾鍘歖{_Thk}涓嶈兘涓虹┖锛�");
+ //}
+
+ //if(!string.IsNullOrEmpty(_Thk))
+ //{
+ // addItem.Thk = (float)(_Thk.Trim());
+ // }
+ if (!string.IsNullOrEmpty(_Matgrid))
+ {
+ addItem.Matgrid = (string)(_Matgrid.Trim());
+ }
+ if (!string.IsNullOrEmpty(_IsEB))
+ {
+ if (!int.TryParse(_IsEB, out int outIsEB) && !string.IsNullOrEmpty(_IsEB))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏄惁灏佽竟]{_IsEB}鍊间笉姝g‘锛�");
+ }
+ if (outIsEB <= 0 && !string.IsNullOrEmpty(_IsEB))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏄惁灏佽竟]{_IsEB}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.IsEB = outIsEB;
+ }
+
+ }
+ if (!string.IsNullOrEmpty(_DRNum))
+ {
+ if (!int.TryParse(_DRNum, out int outDRNum) && !string.IsNullOrEmpty(_DRNum))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鎵撳瓟璁惧缂栧彿]{_DRNum}鍊间笉姝g‘锛�");
+ }
+ if (outDRNum <= 0 && !string.IsNullOrEmpty(_DRNum))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鎵撳瓟璁惧缂栧彿]{_DRNum}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.DRNum = outDRNum;
+ }
+
+ }
+ if (!string.IsNullOrEmpty(_IsPA))
+ {
+ if (!int.TryParse(_IsPA, out int outIsPA) && !string.IsNullOrEmpty(_IsPA))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏄惁浼樺寲鍖呰]{_IsPA}鍊间笉姝g‘锛�");
+ }
+ if (outIsPA <= 0 && !string.IsNullOrEmpty(_IsPA))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鏄惁浼樺寲鍖呰]{_IsPA}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.IsPA = outIsPA;
+ }
+
+ }
+ if (!string.IsNullOrEmpty(_MaterialIndeX))
+ {
+ if (!int.TryParse(_MaterialIndeX, out int outMaterialIndeX) && !string.IsNullOrEmpty(_MaterialIndeX))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾閿垏鍥惧彿]{_MaterialIndeX}鍊间笉姝g‘锛�");
+ }
+ if (outMaterialIndeX <= 0 && !string.IsNullOrEmpty(_MaterialIndeX))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾閿垏鍥惧彿]{_MaterialIndeX}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.MaterialIndeX = outMaterialIndeX;
+ }
+
+ }
+
+ if (string.IsNullOrEmpty(_PackageCode))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾鍖呰鍙穄{_PackageCode}涓嶈兘涓虹┖锛�");
+ }
+
+ if (!string.IsNullOrEmpty(_PackageCode))
+ {
+ addItem.PackageCode = (string)(_PackageCode.Trim());
+ }
+
+ if (!string.IsNullOrEmpty(_Sequence))
+ {
+ if (!int.TryParse(_Sequence, out int outSequence) && !string.IsNullOrEmpty(_Sequence))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾灞傛暟]{_Sequence}鍊间笉姝g‘锛�");
+ }
+ if (outSequence <= 0 && !string.IsNullOrEmpty(_Sequence))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾灞傛暟]{_Sequence}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.Sequence = outSequence;
+ }
+
+ }
+ if (!string.IsNullOrEmpty(_Shelf))
+ {
+ if (!int.TryParse(_Shelf, out int outShelf) && !string.IsNullOrEmpty(_Shelf))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾娆″簭]{_Shelf}鍊间笉姝g‘锛�");
+ }
+ if (outShelf <= 0 && !string.IsNullOrEmpty(_Shelf))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾娆″簭]{_Shelf}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.Shelf = outShelf;
+ }
+
+ }
+
+ if (!string.IsNullOrEmpty(_Info4))
+ {
+ addItem.Info4 = (string)(_Info4.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info5))
+ {
+ addItem.Info5 = (string)(_Info5.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info6))
+ {
+ addItem.Info6 = (string)(_Info6.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info7))
+ {
+ addItem.Info7 = (string)(_Info7.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info8))
+ {
+ addItem.Info8 = (string)(_Info8.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info10))
+ {
+ addItem.Info10 = (string)(_Info10.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info9))
+ {
+ addItem.Info9 = (string)(_Info9.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info11))
+ {
+ addItem.Info11 = (string)(_Info11.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info12))
+ {
+ addItem.Info12 = (string)(_Info12.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info13))
+ {
+ addItem.Info13 = (string)(_Info13.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info14))
+ {
+ addItem.Info14 = (string)(_Info14.Trim());
+ }
+ if (!string.IsNullOrEmpty(_Info15))
+ {
+ if (!int.TryParse(_Info15, out int outInfo15) && !string.IsNullOrEmpty(_Info15))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鏁伴噺]{_Info15}鍊间笉姝g‘锛�");
+ }
+ if (outInfo15 <= 0 && !string.IsNullOrEmpty(_Info15))
+ {
+ throw Oops.Oh($"绗瑊index}琛孾閮ㄤ欢鏁伴噺]{_Info15}鍊间笉鑳藉皬浜庣瓑浜�0锛�");
+ }
+ else
+ {
+ addItem.Info15 = outInfo15;
+ }
+
+ }
+ if (!string.IsNullOrEmpty(_Info16))
+ {
+ addItem.Info16 = (string)(_Info16.Trim());
+ }
+ #endregion
+
details.Add(addItem);
}
@@ -525,7 +525,7 @@
await CheckExisitForImport(details);
return details;
}
-
+
/// <summary>
/// 鏍规嵁鐗堟湰涓嬭浇鎵规鏁版嵁鐨凟xcel瀵煎叆妯℃澘
/// </summary>
@@ -539,7 +539,7 @@
var fileName = HttpUtility.UrlEncode($"瀵煎叆妯℃澘(鎵规鏁版嵁).xlsx", Encoding.GetEncoding("UTF-8"));
return new FileStreamResult(new FileStream(_path, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
}
-
+
#endregion
#region 绉佹湁鏂规硶
@@ -581,13 +581,13 @@
.WhereIF(!string.IsNullOrWhiteSpace(input.UPI), u => u.UPI.Contains(input.UPI.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.DetailName), u => u.DetailName.Contains(input.DetailName.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Matgrid), u => u.Matgrid.Contains(input.Matgrid.Trim()))
- .WhereIF(input.IsEB>0, u => u.IsEB == input.IsEB)
- .WhereIF(input.DRNum>0, u => u.DRNum == input.DRNum)
- .WhereIF(input.IsPA>0, u => u.IsPA == input.IsPA)
- .WhereIF(input.MaterialIndeX>0, u => u.MaterialIndeX == input.MaterialIndeX)
+ .WhereIF(input.IsEB > 0, u => u.IsEB == input.IsEB)
+ .WhereIF(input.DRNum > 0, u => u.DRNum == input.DRNum)
+ .WhereIF(input.IsPA > 0, u => u.IsPA == input.IsPA)
+ .WhereIF(input.MaterialIndeX > 0, u => u.MaterialIndeX == input.MaterialIndeX)
.WhereIF(!string.IsNullOrWhiteSpace(input.PackageCode), u => u.PackageCode.Contains(input.PackageCode.Trim()))
- .WhereIF(input.Sequence>0, u => u.Sequence == input.Sequence)
- .WhereIF(input.Shelf>0, u => u.Shelf == input.Shelf)
+ .WhereIF(input.Sequence > 0, u => u.Sequence == input.Sequence)
+ .WhereIF(input.Shelf > 0, u => u.Shelf == input.Shelf)
.WhereIF(!string.IsNullOrWhiteSpace(input.Info4), u => u.Info4.Contains(input.Info4.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Info5), u => u.Info5.Contains(input.Info5.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Info6), u => u.Info6.Contains(input.Info6.Trim()))
@@ -599,74 +599,56 @@
.WhereIF(!string.IsNullOrWhiteSpace(input.Info12), u => u.Info12.Contains(input.Info12.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Info13), u => u.Info13.Contains(input.Info13.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Info14), u => u.Info14.Contains(input.Info14.Trim()))
- .WhereIF(input.Info15>0, u => u.Info15 == input.Info15)
+ .WhereIF(input.Info15 > 0, u => u.Info15 == input.Info15)
.WhereIF(!string.IsNullOrWhiteSpace(input.Info16), u => u.Info16.Contains(input.Info16.Trim()))
.Select<Mes_BatchOrderUPI_NewOutput>();
return query;
- }
+ }
- /// <summary>
- /// 閲嶅鎬ч獙璇�
- /// </summary>
- /// <param name="input">楠岃瘉瀵硅薄</param>
- /// <param name="isEdit">鏄惁鏄紪杈�</param>
- /// <returns></returns>
- private async Task CheckExist( Mes_BatchOrderUPI_New input,bool isEdit=false)
+ /// <summary>
+ /// 閲嶅鎬ч獙璇�
+ /// </summary>
+ /// <param name="input">楠岃瘉瀵硅薄</param>
+ /// <param name="isEdit">鏄惁鏄紪杈�</param>
+ /// <returns></returns>
+ private async Task CheckExist(Mes_BatchOrderUPI_New input, bool isEdit = false)
+ {
+
+
+
+ //娌℃湁閰嶇疆缁勫悎鏍¢獙锛屼笉闇�瑕侀獙閲�
+
+
+ //娌℃湁閰嶇疆鍗曠嫭鏍¢獙锛屼笉闇�瑕侀獙閲�
+ }
+
+ /// <summary>
+ /// 鏍规嵁缁勫悎鏍¢獙鍜屽崟鐙牎楠岄獙璇佹暟鎹槸鍚﹀凡瀛樺湪-瀵煎叆鏃堕獙璇�
+ /// </summary>
+ /// <param name="inputs"></param>
+ /// <returns></returns>
+ private async Task CheckExisitForImport(List<Mes_BatchOrderUPI_New> inputs)
+ {
+ if (inputs?.Count <= 0)
{
-
-
-
- //娌℃湁閰嶇疆缁勫悎鏍¢獙锛屼笉闇�瑕侀獙閲�
-
-
- //娌℃湁閰嶇疆鍗曠嫭鏍¢獙锛屼笉闇�瑕侀獙閲�
- }
-
- /// <summary>
- /// 鏍规嵁缁勫悎鏍¢獙鍜屽崟鐙牎楠岄獙璇佹暟鎹槸鍚﹀凡瀛樺湪-瀵煎叆鏃堕獙璇�
- /// </summary>
- /// <param name="inputs"></param>
- /// <returns></returns>
- private async Task CheckExisitForImport(List<Mes_BatchOrderUPI_New> inputs)
- {
- if (inputs?.Count <= 0)
- {
- throw Oops.Oh($"瀵煎叆鏁版嵁涓嶈兘涓虹┖");
- }
- //鏍规嵁缁勫悎鏍¢獙楠岃瘉琛ㄦ牸涓腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
-
-
-
-
-
-
-
-
- //鏍规嵁鍗曠嫭鏍¢獙楠岃瘉琛ㄦ牸涓腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
-
-
-
+ throw Oops.Oh($"瀵煎叆鏁版嵁涓嶈兘涓虹┖");
}
+ //鏍规嵁缁勫悎鏍¢獙楠岃瘉琛ㄦ牸涓腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
+
+
+
+
+
+
+
+
+ //鏍规嵁鍗曠嫭鏍¢獙楠岃瘉琛ㄦ牸涓腑鏄惁宸插瓨鍦ㄧ浉鍚屾暟鎹�
+
+
+
+ }
#endregion
-
- [HttpPost]
- [ApiDescriptionSettings(Name = "GetBatchOrderUPIList")]
- [UnitOfWork]
- [AllowAnonymous]
- public async Task GetBatchOrderUPIList(List<GetBatchOrderUPIInput> input)
- {
- List<Mes_BatchOrderUPI_New> list = new List<Mes_BatchOrderUPI_New>();
- foreach (var item in input)
- {
- Mes_BatchOrderUPI_New task = new Mes_BatchOrderUPI_New();
- task = item.Adapt<Mes_BatchOrderUPI_New>();
- task.AreaCode = AreaCodeEnum.鏃犲尯鍩�;
- task.UpiStatus = UpiStatusEnum.鍒濆;
- list.Add(task);
- }
- await _rep.InsertRangeAsync(list);
- }
}
--
Gitblit v1.9.3