From 9d9c5593801ed3356f976ac499a61a6673bd67ca Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 17 9月 2025 11:06:18 +0800
Subject: [PATCH] 增加接口

---
 DEmon/iWareDataCore/iWareDataCore.csproj                    |    1 
 DEmon/iWareCommon/iWareCommon.csproj                        |    1 
 DEmon/iWareDataCore/BASE/Entity/MaterialViewForMesEntity.cs |   17 ++
 DEmon/iWareDataCore/BASE/Service/MaterialViewService.cs     |  205 +++++++++++++++++++++----
 DEmon/iWareCommon/Utils/ClassHelper.cs                      |   38 ++++
 DEmon/WebWIPAPI/Controllers/MesIntegrController.cs          |  208 +++++++++++++++++++++++++-
 6 files changed, 428 insertions(+), 42 deletions(-)

diff --git a/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs b/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs
index bab02f5..9cd7465 100644
--- a/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs
+++ b/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs
@@ -1,12 +1,16 @@
-锘縰sing iWareDataCore.BASE.Entity;
+锘縰sing iWareCommon.Common.Entity;
+using iWareCommon.Utils;
+using iWareDataCore.BASE.Entity;
 using iWareDataCore.BASE.Service;
 using Newtonsoft.Json;
+using System;
 using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
 using System.Web.Mvc;
 using WebWIPAPI.Models;
 using WebWIPAPI.Properties;
-using WebWIPAPI.Utils;
-
+using LogTextHelper = WebWIPAPI.Utils.LogTextHelper;
 
 namespace WebWIPAPI.Controllers
 {
@@ -19,11 +23,6 @@
         /// <summary>
         /// 鎻愪緵搴撳瓨淇℃伅
         /// </summary>
-        /// <param name="sysCode"></param>
-        /// <param name="wareHouseInfo"></param>
-        /// <param name="processCardNumber"></param>
-        /// <param name="wareHouseId"></param>
-        /// <param name="timestamp"></param>
         /// <returns></returns>
         [HttpPost]
         public ActionResult syncMaterialInfo()
@@ -58,6 +57,199 @@
             return Json(responseMessage, JsonRequestBehavior.DenyGet);
         }
 
+        /// <summary>
+        /// 瀵煎叆鍏ュ簱鍗�
+        /// </summary>
+        /// <param name="inputmaterials"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public ActionResult importInOrder(List<MaterialViewForMesEntity> importMaterials)
+        {
+            var responseMessage = new ApiResponse<string>();
+            var msg = "";
+
+            #region 涓氬姟澶勭悊
+
+            //绗竴姝ワ細鍏堟柊澧炲埌鐗╂枡鍩虹琛�
+            List<MaterialViewEntity> materials = new List<MaterialViewEntity>();
+            materials = ClassHelper.RotationMapping<List<MaterialViewEntity>, List<MaterialViewForMesEntity>>(importMaterials);
+            MaterialViewService.GetInstance().ImportExcelFromMes(materials, out msg);
+
+            Thread.Sleep(400);//娉ㄦ剰锛氫紤鐪犳绉掞紝鐢ㄤ簬鏁版嵁搴撲簨鍔℃彁浜�
+
+            string typeName = "鍏ュ簱";
+            List<InputMaterialEntity> inputmaterials = new List<InputMaterialEntity>();
+            inputmaterials = ClassHelper.RotationMapping<List<InputMaterialEntity>, List<MaterialViewForMesEntity>>(importMaterials);
+            handler_importOutOrder(typeName, inputmaterials, out msg);
+
+            #endregion
+
+            if (!string.IsNullOrEmpty(msg))
+            {
+                responseMessage = new ApiResponse<string>()
+                {
+                    Code = 500,
+                    Success = false,
+                    Message = "寮傚父:" + msg,
+                    Data = null,
+                };
+            }
+            else
+            {
+                responseMessage = new ApiResponse<string>()
+                {
+                    Code = 200,
+                    Success = true,
+                    Message = "鎴愬姛",
+                    Data = null,
+                };
+            }
+
+            //灏嗗璞¤浆鍖栦负json鏍煎紡
+            var responseStr = JsonConvert.SerializeObject(responseMessage);
+            LogTextHelper.WriteLine(Resources.LogDir, "WIPAPI:{0},{1}, {2}", "importInOrder", "璇锋眰鍙傛暟锛�" + "", "鍝嶅簲淇℃伅;" + responseStr);
+            return Json(responseMessage, JsonRequestBehavior.DenyGet);
+        }
+
+
+        /// <summary>
+        /// 瀵煎叆鍑哄簱鍗�
+        /// </summary>
+        /// <param name="inputmaterials"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public ActionResult importOutOrder(List<InputMaterialEntity> inputmaterials)
+        {
+            var responseMessage = new ApiResponse<string>();
+            var msg = "";
+
+            #region 涓氬姟澶勭悊
+
+            string typeName = "鍑哄簱";
+            handler_importOutOrder(typeName, inputmaterials, out msg);
+
+            #endregion
+
+            if (!string.IsNullOrEmpty(msg))
+            {
+                responseMessage = new ApiResponse<string>()
+                {
+                    Code = 500,
+                    Success = false,
+                    Message = "寮傚父:" + msg,
+                    Data = null,
+                };
+            }
+            else
+            {
+                responseMessage = new ApiResponse<string>()
+                {
+                    Code = 200,
+                    Success = true,
+                    Message = "鎴愬姛",
+                    Data = null,
+                };
+            }
+
+            //灏嗗璞¤浆鍖栦负json鏍煎紡
+            var responseStr = JsonConvert.SerializeObject(responseMessage);
+            LogTextHelper.WriteLine(Resources.LogDir, "WIPAPI:{0},{1}, {2}", "importOutOrder", "璇锋眰鍙傛暟锛�" + "", "鍝嶅簲淇℃伅;" + responseStr);
+            return Json(responseMessage, JsonRequestBehavior.DenyGet);
+        }
+
+
+        /// <summary>
+        /// 鍏叡瀵煎叆 鍏ュ簱鍗曟垨鍑哄簱鍗�
+        /// </summary>
+        /// <param name="typeName"></param>
+        /// <param name="inputmaterials"></param>
+        /// <param name="msg"></param>
+        private void handler_importOutOrder(string typeName, List<InputMaterialEntity> inputmaterials, out string msg)
+        {
+            try
+            {
+                #region 涓氬姟澶勭悊
+
+                msg = "";
+                //var inputmaterials = InputMaterialService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Status", "鏈敓鎴�" } } }, out msg);
+                if (inputmaterials != null && inputmaterials.Count > 0)
+                {
+                    var placeMaterial = PlaceMaterialViewService.GetInstance().QueryByParam(new QueryParam { }, out msg);
+                    var inoutdetails = InOutListDetailViewService.GetInstance().QueryByParam(new QueryParam { }, out msg);
+                    List<string> codes = new List<string>();
+                    inputmaterials.ForEach(x => codes.Add(x.Code));
+                    List<int> ids = new List<int>();
+                    var materials = InputMaterialService.GetInstance().GetIds(codes);
+                    List<InOutListDetailEntity> detail = new List<InOutListDetailEntity>();
+                    for (int i = 0; i < materials.Count; i++)
+                    {
+                        if (typeName == "鍏ュ簱")
+                        {
+
+                            if (placeMaterial.Select(x => x.MaterialId).Contains(materials[i].id))
+                            {
+                                msg = materials[i].code + "宸插瓨鍦ㄧ珛搴撲腑锛屼笉鑳芥坊鍔犲埌鍏ュ簱鍗曟槑缁嗕腑锛�";
+                                break;
+                            }
+                            if (inoutdetails.Select(x => x.MaterialId).Contains(materials[i].id))
+                            {
+                                msg = materials[i].code + "宸插瓨鍦ㄤ箣鍓嶇殑鍏ュ簱鍗曟槑缁嗕腑锛屼笉鑳芥坊鍔犲埌褰撳墠鍏ュ簱鍗曟槑缁嗕腑锛�";
+                                break;
+                            }
+
+                        }
+                        else
+                        {
+                            if (!placeMaterial.Select(x => x.MaterialId).Contains(materials[i].id))
+                            {
+                                msg = materials[i].code + "涓嶅湪绔嬪簱涓紝涓嶈兘娣诲姞鍒板嚭搴撳崟鏄庣粏涓紒";
+                                break;
+                            }
+                            if (inoutdetails.Select(x => x.MaterialId).Contains(materials[i].id))
+                            {
+                                var inoutdeta = inoutdetails.FirstOrDefault(x => x.MaterialId == materials[i].id);
+                                if (inoutdeta.TypeName == "鍑哄簱")
+                                {
+                                    msg = materials[i].name + "宸插瓨鍦ㄤ箣鍓嶇殑鍑哄簱鍗曟槑缁嗕腑锛屼笉鑳芥坊鍔犲埌褰撳墠鍑哄簱鍗曟槑缁嗕腑锛�";
+                                    break;
+                                }
+                            }
+                        }
+                        InOutListDetailEntity inoutdetail = new InOutListDetailEntity()
+                        {
+                            MaterialId = materials[i].id,
+                            IsFinish = 0
+                        };
+                        detail.Add(inoutdetail);
+                    }
+                    if (!string.IsNullOrEmpty(msg))
+                    {
+                        return;
+                    }
+                    InOutListService.GetInstance().CreateListAndDetial(
+                        new InOutListEntity
+                        {
+                            ListNo = inputmaterials.First().ListNo,
+                            CreateTime = DateTime.Now,
+                            TypeName = typeName,
+                            Status = 0,
+                            Remark = "",
+                            InOutListDetail = detail
+                        }, out msg);
+                }
+                else
+                {
+                    msg = ("璇峰厛纭繚鍑哄叆搴撳崟鐗╂枡鏄庣粏涓嶄负绌猴紒");
+                }
+
+
+                #endregion
+            }
+            catch (Exception)
+            {
+                throw;
+            }
+        }
 
     }
 }
diff --git a/DEmon/iWareCommon/Utils/ClassHelper.cs b/DEmon/iWareCommon/Utils/ClassHelper.cs
new file mode 100644
index 0000000..85fba25
--- /dev/null
+++ b/DEmon/iWareCommon/Utils/ClassHelper.cs
@@ -0,0 +1,38 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+
+namespace iWareCommon.Utils
+{
+    public class ClassHelper
+    {
+        /// <summary>
+        /// 瀹炰綋浜掕浆
+        /// </summary>
+        /// <typeparam name="T">鏂拌浆鎹㈢殑瀹炰綋</typeparam>
+        /// <typeparam name="S">瑕佽浆鎹㈢殑瀹炰綋</typeparam>
+        /// <param name="s"></param>
+        /// <returns></returns>
+        public static T RotationMapping<T, S>(S s)
+        {
+            T target = Activator.CreateInstance<T>();
+            var originalObj = s.GetType();
+            var targetObj = typeof(T);
+            foreach (PropertyInfo original in originalObj.GetProperties())
+            {
+                foreach (PropertyInfo t in targetObj.GetProperties())
+                {
+                    if (t.Name == original.Name)
+                    {
+                        t.SetValue(target, original.GetValue(s, null), null);
+                    }
+                }
+            }
+            return target;
+        }
+
+      
+        
+    }
+}
diff --git a/DEmon/iWareCommon/iWareCommon.csproj b/DEmon/iWareCommon/iWareCommon.csproj
index ac80c0d..88acdbf 100644
--- a/DEmon/iWareCommon/iWareCommon.csproj
+++ b/DEmon/iWareCommon/iWareCommon.csproj
@@ -106,6 +106,7 @@
       <DependentUpon>Resources.resx</DependentUpon>
     </Compile>
     <Compile Include="Utils\Base64Helper.cs" />
+    <Compile Include="Utils\ClassHelper.cs" />
     <Compile Include="Utils\DESHelper.cs" />
     <Compile Include="Utils\EntityPropHelper.cs" />
     <Compile Include="Utils\FileHelper.cs" />
diff --git a/DEmon/iWareDataCore/BASE/Entity/MaterialViewForMesEntity.cs b/DEmon/iWareDataCore/BASE/Entity/MaterialViewForMesEntity.cs
new file mode 100644
index 0000000..ded5a70
--- /dev/null
+++ b/DEmon/iWareDataCore/BASE/Entity/MaterialViewForMesEntity.cs
@@ -0,0 +1,17 @@
+锘縰sing iWareCommon.Common.Entity;
+using iWareCommon.Utils;
+using iWareDataCore.ORM;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace iWareDataCore.BASE.Entity
+{
+    public class MaterialViewForMesEntity : MaterialViewEntity
+    {
+        /// 7鍑哄叆搴撳崟鍙�
+        /// </summary>
+        public string ListNo { get; set; }
+
+    }
+}
diff --git a/DEmon/iWareDataCore/BASE/Service/MaterialViewService.cs b/DEmon/iWareDataCore/BASE/Service/MaterialViewService.cs
index 28af57a..4e10090 100644
--- a/DEmon/iWareDataCore/BASE/Service/MaterialViewService.cs
+++ b/DEmon/iWareDataCore/BASE/Service/MaterialViewService.cs
@@ -73,7 +73,7 @@
                     var codes = new List<string>();
                     List<MaterialEntity> materlst = new List<MaterialEntity>();
                     var materialSaves = new List<MaterialEntity>();
-                    var existMaterialcodes = dbModel.BASEMaterials.Select(x =>x.code).ToList();
+                    var existMaterialcodes = dbModel.BASEMaterials.Select(x => x.code).ToList();
                     bool b1 = true;
                     foreach (MaterialViewEntity m in materials)
                     {
@@ -81,14 +81,14 @@
                         if (string.IsNullOrEmpty(m.Code))
                         {
                             msg = string.Format("鍦ㄧ{0}琛岋紝鐗╂枡鍙蜂笉鑳戒负绌猴紝璇蜂慨鏀瑰悗閲嶆柊瀵煎叆", i + 1);
-                            b1= false;
+                            b1 = false;
                             break;
                         }
 
                         if (string.IsNullOrEmpty(m.Wide))
                         {
                             msg = string.Format("鍦ㄧ{0}琛岋紝瀹戒笉鑳戒负绌猴紝璇蜂慨鏀瑰悗閲嶆柊瀵煎叆", i + 1);
-                            b1= false;
+                            b1 = false;
                             break;
                         }
                         var type = types.FirstOrDefault(x => x.name == m.TypeName);
@@ -96,7 +96,7 @@
                         {
                             m.MaterialType = 5;//鍏朵粬
                         }
-                        else 
+                        else
                         {
                             m.MaterialType = type.id;
                         }
@@ -107,8 +107,8 @@
                         codes.Add(m.Code);
                         if (string.IsNullOrEmpty(m.Name)) { m.Name = m.Description; }
                         if (string.IsNullOrEmpty(m.Version)) { m.Version = "00"; }
-                   
-                        MaterialEntity mt=new MaterialEntity()
+
+                        MaterialEntity mt = new MaterialEntity()
                         {
                             ClassificationSociety = m.ClassificationSociety,
                             Code = m.Code,
@@ -135,41 +135,41 @@
                             VerticalPosition = m.VerticalPosition,
                             Wide = m.Wide
                         };
-                         materialSaves.Add(mt); 
+                        materialSaves.Add(mt);
 
                     }
-                    if (!b1) 
+                    if (!b1)
                     {
                         return b1;
                     }
                     var sql = string.Format("INSERT INTO BASEMaterial(status, name, code, materialno, version, typeid, guaranteeperiod, cost, classificationsociety, unit, serialno, description, remark, verticalposition, weight, issueprojectno, procurementprojectno, cuttingtype, pageno, thick, wide, length, markingpen, laneseparation) VALUES");
-                    for (var j = 0; j < materialSaves.Count ; j++)
+                    for (var j = 0; j < materialSaves.Count; j++)
                     {
-                               sql += string.Format("({0}, '{1}', '{2}', '{3}', {4}, '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}','{16}' ,'{17}', '{18}', '{19}', '{20}', '{21}','{22}','{23}' ),",
-                                materialSaves[j].Status,
-                                StringHelper.RelpaceQuot(materialSaves[j].Name),
-                                StringHelper.RelpaceQuot(materialSaves[j].Code),
-                                StringHelper.RelpaceQuot(materialSaves[j].MaterialNo),
-                                StringHelper.RelpaceQuot(materialSaves[j].Version),
-                                materialSaves[j].TypeId,
-                                StringHelper.RelpaceQuot(materialSaves[j].GuaranteePeriod),
-                                materialSaves[j].Cost,
-                                StringHelper.RelpaceQuot(materialSaves[j].ClassificationSociety),
-                                StringHelper.RelpaceQuot(materialSaves[j].Unit),
-                                StringHelper.RelpaceQuot(materialSaves[j].SerialNo),
-                                StringHelper.RelpaceQuot(materialSaves[j].Description),
-                                StringHelper.RelpaceQuot(materialSaves[j].Remark),
-                                StringHelper.RelpaceQuot(materialSaves[j].VerticalPosition),
-                                StringHelper.RelpaceQuot(materialSaves[j].Weight),
-                                StringHelper.RelpaceQuot(materialSaves[j].IssueProjectNo),
-                                StringHelper.RelpaceQuot(materialSaves[j].ProcurementProjectNo),
-                                StringHelper.RelpaceQuot(materialSaves[j].CuttingType),
-                                StringHelper.RelpaceQuot(materialSaves[j].PageNo),
-                                StringHelper.RelpaceQuot(materialSaves[j].Thick),
-                                StringHelper.RelpaceQuot(materialSaves[j].Wide),
-                                StringHelper.RelpaceQuot(materialSaves[j].Length),
-                                StringHelper.RelpaceQuot(materialSaves[j].MarkingPen),
-                                StringHelper.RelpaceQuot(materialSaves[j].LaneSeparation));
+                        sql += string.Format("({0}, '{1}', '{2}', '{3}', {4}, '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}','{16}' ,'{17}', '{18}', '{19}', '{20}', '{21}','{22}','{23}' ),",
+                         materialSaves[j].Status,
+                         StringHelper.RelpaceQuot(materialSaves[j].Name),
+                         StringHelper.RelpaceQuot(materialSaves[j].Code),
+                         StringHelper.RelpaceQuot(materialSaves[j].MaterialNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].Version),
+                         materialSaves[j].TypeId,
+                         StringHelper.RelpaceQuot(materialSaves[j].GuaranteePeriod),
+                         materialSaves[j].Cost,
+                         StringHelper.RelpaceQuot(materialSaves[j].ClassificationSociety),
+                         StringHelper.RelpaceQuot(materialSaves[j].Unit),
+                         StringHelper.RelpaceQuot(materialSaves[j].SerialNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].Description),
+                         StringHelper.RelpaceQuot(materialSaves[j].Remark),
+                         StringHelper.RelpaceQuot(materialSaves[j].VerticalPosition),
+                         StringHelper.RelpaceQuot(materialSaves[j].Weight),
+                         StringHelper.RelpaceQuot(materialSaves[j].IssueProjectNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].ProcurementProjectNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].CuttingType),
+                         StringHelper.RelpaceQuot(materialSaves[j].PageNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].Thick),
+                         StringHelper.RelpaceQuot(materialSaves[j].Wide),
+                         StringHelper.RelpaceQuot(materialSaves[j].Length),
+                         StringHelper.RelpaceQuot(materialSaves[j].MarkingPen),
+                         StringHelper.RelpaceQuot(materialSaves[j].LaneSeparation));
                     }
                     if (sql.EndsWith(","))
                     {
@@ -190,7 +190,144 @@
         }
 
 
+        /// <summary>
+        /// 瀵煎叆鐗╂枡鍩虹鏁版嵁锛屾潵婧怣ES 銆怑ditby shaocx,2025-09-17銆�
+        /// </summary>
+        /// <param name="materials"></param>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public bool ImportExcelFromMes(List<MaterialViewEntity> materials, out string msg)
+        {
+            using (var dbModel = new DbModelCore())
+            {
+                try
+                {
+                    msg = "";
+                    if (materials.Count < 1)
+                    {
+                        msg = "鐗╂枡璁板綍鏁颁负0锛岃淇敼鍚庨噸鏂板鍏�";
+                        return false;
+                    }
+                    var types = dbModel.BASEMaterialTypes.Where(x => 1 == 1).ToList();
+                    var i = 0;
+                    var codes = new List<string>();
+                    List<MaterialEntity> materlst = new List<MaterialEntity>();
+                    var materialSaves = new List<MaterialEntity>();
+                    var existMaterialcodes = dbModel.BASEMaterials.Select(x => x.code).ToList();
+                    bool b1 = true;
+                    foreach (MaterialViewEntity m in materials)
+                    {
+                        i += 1;
+                        if (string.IsNullOrEmpty(m.Code))
+                        {
+                            msg = string.Format("鍦ㄧ{0}琛岋紝鐗╂枡鍙蜂笉鑳戒负绌猴紝璇蜂慨鏀瑰悗閲嶆柊瀵煎叆", i + 1);
+                            b1 = false;
+                            break;
+                        }
 
+                        if (string.IsNullOrEmpty(m.Wide))
+                        {
+                            msg = string.Format("鍦ㄧ{0}琛岋紝瀹戒笉鑳戒负绌猴紝璇蜂慨鏀瑰悗閲嶆柊瀵煎叆", i + 1);
+                            b1 = false;
+                            break;
+                        }
+                        var type = types.FirstOrDefault(x => x.name == m.TypeName);
+                        if (type == null)
+                        {
+                            m.MaterialType = 5;//鍏朵粬
+                        }
+                        else
+                        {
+                            m.MaterialType = type.id;
+                        }
+                        if (existMaterialcodes.Contains(m.Code))
+                        {
+                            continue;
+                        }
+                        codes.Add(m.Code);
+                        if (string.IsNullOrEmpty(m.Name)) { m.Name = m.Description; }
+                        if (string.IsNullOrEmpty(m.Version)) { m.Version = "00"; }
+
+                        MaterialEntity mt = new MaterialEntity()
+                        {
+                            ClassificationSociety = m.ClassificationSociety,
+                            Code = m.Code,
+                            MaterialNo = m.MaterialNo,
+                            Cost = m.Cost,
+                            CuttingType = m.CuttingType,
+                            Description = m.Description,
+                            GuaranteePeriod = m.GuaranteePeriod,
+                            IssueProjectNo = m.IssueProjectNo,
+                            Length = m.Length,
+                            SerialNo = m.SerialNo,
+                            Name = m.Name,
+                            LaneSeparation = m.Laneseparation,
+                            MarkingPen = m.MarkingPen,
+                            PageNo = m.PageNo,
+                            Status = 1,
+                            Thick = m.Thick,
+                            Unit = m.Unit,
+                            Remark = m.Remark,
+                            ProcurementProjectNo = m.ProcurementProjectNo,
+                            TypeId = m.MaterialType,
+                            Version = m.Version,
+                            Weight = m.Weight,
+                            VerticalPosition = m.VerticalPosition,
+                            Wide = m.Wide
+                        };
+                        materialSaves.Add(mt);
+
+                    }
+                    if (!b1)
+                    {
+                        return b1;
+                    }
+                    var sql = string.Format("INSERT INTO BASEMaterial(status, name, code, materialno, version, typeid, guaranteeperiod, cost, classificationsociety, unit, serialno, description, remark, verticalposition, weight, issueprojectno, procurementprojectno, cuttingtype, pageno, thick, wide, length, markingpen, laneseparation) VALUES");
+                    for (var j = 0; j < materialSaves.Count; j++)
+                    {
+                        sql += string.Format("({0}, '{1}', '{2}', '{3}', {4}, '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}','{16}' ,'{17}', '{18}', '{19}', '{20}', '{21}','{22}','{23}' ),",
+                         materialSaves[j].Status,
+                         StringHelper.RelpaceQuot(materialSaves[j].Name),
+                         StringHelper.RelpaceQuot(materialSaves[j].Code),
+                         StringHelper.RelpaceQuot(materialSaves[j].MaterialNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].Version),
+                         materialSaves[j].TypeId,
+                         StringHelper.RelpaceQuot(materialSaves[j].GuaranteePeriod),
+                         materialSaves[j].Cost,
+                         StringHelper.RelpaceQuot(materialSaves[j].ClassificationSociety),
+                         StringHelper.RelpaceQuot(materialSaves[j].Unit),
+                         StringHelper.RelpaceQuot(materialSaves[j].SerialNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].Description),
+                         StringHelper.RelpaceQuot(materialSaves[j].Remark),
+                         StringHelper.RelpaceQuot(materialSaves[j].VerticalPosition),
+                         StringHelper.RelpaceQuot(materialSaves[j].Weight),
+                         StringHelper.RelpaceQuot(materialSaves[j].IssueProjectNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].ProcurementProjectNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].CuttingType),
+                         StringHelper.RelpaceQuot(materialSaves[j].PageNo),
+                         StringHelper.RelpaceQuot(materialSaves[j].Thick),
+                         StringHelper.RelpaceQuot(materialSaves[j].Wide),
+                         StringHelper.RelpaceQuot(materialSaves[j].Length),
+                         StringHelper.RelpaceQuot(materialSaves[j].MarkingPen),
+                         StringHelper.RelpaceQuot(materialSaves[j].LaneSeparation));
+                    }
+                    if (sql.EndsWith(","))
+                    {
+                        sql = sql.Substring(0, sql.Length - 1);
+                    }
+                    var num = dbModel.Database.ExecuteSqlCommand(sql);
+
+                    return string.IsNullOrEmpty(msg);
+
+                }
+                catch (Exception ex)
+                {
+                    msg = ex.Message;
+                    LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "ImportExcel", ex.Message);
+                    return false;
+                }
+            }
+        }
 
 
     }
diff --git a/DEmon/iWareDataCore/iWareDataCore.csproj b/DEmon/iWareDataCore/iWareDataCore.csproj
index 2a73e32..d18b11a 100644
--- a/DEmon/iWareDataCore/iWareDataCore.csproj
+++ b/DEmon/iWareDataCore/iWareDataCore.csproj
@@ -77,6 +77,7 @@
     <Compile Include="BASE\Entity\InOutListEntity.cs" />
     <Compile Include="BASE\Entity\EmptyPlaceViewEntity.cs" />
     <Compile Include="BASE\Entity\InputMaterialEntity.cs" />
+    <Compile Include="BASE\Entity\MaterialViewForMesEntity.cs" />
     <Compile Include="BASE\Entity\WebOrderDetailViewEntity.cs" />
     <Compile Include="BASE\Entity\WebOrderDetailEntity.cs" />
     <Compile Include="BASE\Entity\MaterialClassEntity.cs" />

--
Gitblit v1.9.3