zzr99
2021-10-18 8552aecdfdf50a4eba5bb5df30bc32c8f5882763
Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
7个文件已添加
5个文件已修改
283 ■■■■ 已修改文件
LMES/obj/x86/Release/LMES.csprojAssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
LMES/obj/x86/Release/build.force 补丁 | 查看 | 原始文档 | blame | 历史
Model/obj/x86/Release/Model.csprojAssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
Model/obj/x86/Release/build.force 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/WebAPIController.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Menu.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ModelConvertHelper.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ToHierarchy.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/WebAPI.csproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WorkM/流转卡管理/Sc_ProcessExchangeBillQuery.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LMES/obj/x86/Release/LMES.csprojAssemblyReference.cache
Binary files differ
LMES/obj/x86/Release/build.force
Model/obj/x86/Release/Model.csprojAssemblyReference.cache
Binary files differ
Model/obj/x86/Release/build.force
WebAPI/Controllers/SBGL/Sb_EquipMaintainBillController.cs
@@ -162,36 +162,39 @@
                }
                //配件表体数据
                //按 },{来拆分数组 //去掉【和】
                msg4 = msg4.Substring(1, msg4.Length - 2);
                msg4 = msg4.Replace("\\", "");
                msg4 = msg4.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSb_EquipMaintainBillSub> ls1 = new List<Model.ClsSb_EquipMaintainBillSub>();
                ls1 = oListModels.getObjectByJson_Sb_EquipMaintainBillSub(msg4);
                int j = 0;
                foreach (Model.ClsSb_EquipMaintainBillSub oItemSub in ls1)
                if (msg4 != "undefined" && msg4 != "" && msg4 != "[]")
                {
                    msg4 = msg4.Substring(1, msg4.Length - 2);
                    msg4 = msg4.Replace("\\", "");
                    msg4 = msg4.Replace("\n", "");  //\n
                                                    //msg2 = msg2.Replace("'", "’");
                    List<Model.ClsSb_EquipMaintainBillSub> ls1 = new List<Model.ClsSb_EquipMaintainBillSub>();
                    ls1 = oListModels.getObjectByJson_Sb_EquipMaintainBillSub(msg4);
                    int j = 0;
                    foreach (Model.ClsSb_EquipMaintainBillSub oItemSub in ls1)
                    {
                    j++;
                    oItemSub.HEntryID = i;
                    //oItemSub.HCloseMan = "";       //行关闭
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    oItemSub.HSourceInterID = 0;     // æºå•主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
                    oItemSub.HRelationQty = 0;     //关联数量
                                                   //oItemSub.HRelationMoney = 0;   //关联金额
                                                   //HMaterID = "";//配件代码
                                                   //HUnitID = "";//单位代码
                                                   //HQty = "";//实际用量
                                                   //HQtyMust = "";//单位用量
                                                   //HRemark = "";//备注
                        j++;
                        oItemSub.HEntryID = i;
                        //oItemSub.HCloseMan = "";       //行关闭
                        oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                        oItemSub.HCloseType = false;   //关闭类型
                                                       //oItemSub.HRemark = "";         //备注
                        oItemSub.HSourceInterID = 0;     // æºå•主内码
                        oItemSub.HSourceEntryID = 0;   //源单子内码
                                                       //oItemSub.HSourceBillNo = "";  //源单单号
                                                       //oItemSub.HSourceBillType = ""; //源单类型
                        oItemSub.HRelationQty = 0;     //关联数量
                                                       //oItemSub.HRelationMoney = 0;   //关联金额
                                                       //HMaterID = "";//配件代码
                                                       //HUnitID = "";//单位代码
                                                       //HQty = "";//实际用量
                                                       //HQtyMust = "";//单位用量
                                                       //HRemark = "";//备注
                    oBill.DetailColl.Add(oItemSub);
                        oBill.DetailColl.Add(oItemSub);
                    }
                }
                //保存
                //保存完毕后处理
WebAPI/Controllers/SBGL/Sb_EquipMaintainPlanBillController.cs
@@ -157,36 +157,39 @@
                }
                //配件项表体数据
                //按 },{来拆分数组 //去掉【和】
                msg4 = msg4.Substring(1, msg4.Length - 2);
                msg4 = msg4.Replace("\\", "");
                msg4 = msg4.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSb_EquipMaintainPlanBillSub> ls1 = new List<Model.ClsSb_EquipMaintainPlanBillSub>();
                ls1 = oListModels.getObjectByJson_Sb_EquipMaintainPlanBillSub(msg4);
                int j = 0;
                foreach (Model.ClsSb_EquipMaintainPlanBillSub oItemSub in ls1)
                if (msg4 != "undefined" && msg4 != "" && msg4 != "[]")
                {
                    msg4 = msg4.Substring(1, msg4.Length - 2);
                    msg4 = msg4.Replace("\\", "");
                    msg4 = msg4.Replace("\n", "");  //\n
                                                    //msg2 = msg2.Replace("'", "’");
                    List<Model.ClsSb_EquipMaintainPlanBillSub> ls1 = new List<Model.ClsSb_EquipMaintainPlanBillSub>();
                    ls1 = oListModels.getObjectByJson_Sb_EquipMaintainPlanBillSub(msg4);
                    int j = 0;
                    foreach (Model.ClsSb_EquipMaintainPlanBillSub oItemSub in ls1)
                    {
                    j++;
                    oItemSub.HEntryID = j;
                    //oItemSub.HCloseMan = "";       //行关闭
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    oItemSub.HSourceInterID = 0;     // æºå•主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
                    oItemSub.HRelationQty = 0;     //关联数量
                                                   //oItemSub.HRelationMoney = 0;   //关联金额
                                                   //HMaterID = "";//配件代码
                                                   //HUnitID = "";//单位代码
                                                   //HQty = "";//实际用量
                                                   //HQtyMust = "";//单位用量
                                                   //HRemark = "";//备注
                        j++;
                        oItemSub.HEntryID = j;
                        //oItemSub.HCloseMan = "";       //行关闭
                        oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                        oItemSub.HCloseType = false;   //关闭类型
                                                       //oItemSub.HRemark = "";         //备注
                        oItemSub.HSourceInterID = 0;     // æºå•主内码
                        oItemSub.HSourceEntryID = 0;   //源单子内码
                                                       //oItemSub.HSourceBillNo = "";  //源单单号
                                                       //oItemSub.HSourceBillType = ""; //源单类型
                        oItemSub.HRelationQty = 0;     //关联数量
                                                       //oItemSub.HRelationMoney = 0;   //关联金额
                                                       //HMaterID = "";//配件代码
                                                       //HUnitID = "";//单位代码
                                                       //HQty = "";//实际用量
                                                       //HQtyMust = "";//单位用量
                                                       //HRemark = "";//备注
                    oBill.DetailColl.Add(oItemSub);
                        oBill.DetailColl.Add(oItemSub);
                    }
                }
                //保存
                //保存完毕后处理
WebAPI/Controllers/WebAPIController.cs
@@ -1,6 +1,8 @@
using DAL;
using DBUtility;
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using SQLHelper;
using System;
@@ -2195,6 +2197,55 @@
            }
        }
        #region [查询菜单列表]
        [Route("Web/MenuList")]
        [HttpGet]
        public object MenuList()
        {
            try
            {
                List<Menu> mu = new List<Menu>();
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                ds = oCn.RunProcReturn("Select * from Gy_Menu Order by HItemID ", "Gy_Menu");
                //List<Menu> mu1 = ds.Tables[0].AsEnumerable().Select(t => new Menu()).ToList();
                //List<Menu> users = ModelConvertHelper<Menu>.ConvertToModel(ds.Tables[0]);
                //var dd = ToHierarchy.ToHierarchyList(users);
                //string json = JsonConvert.SerializeObject(dd);
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)   //这里是循环所有
                {
                    if (ds.Tables[0].Rows[i]["HPartentID"].ToString()=="0" || ds.Tables[0].Rows[i]["HitemID"].ToString() == ds.Tables[0].Rows[i]["HPartentID"].ToString())  //判断是否最外层根节点
                    {
                        Menu tbj = new Menu();
                        tbj.HitemID = ds.Tables[0].Rows[i]["HitemID"].ToString();
                        tbj.HNumber = ds.Tables[0].Rows[i]["HNumber"].ToString();
                        tbj.HName = ds.Tables[0].Rows[i]["HName"].ToString();
                        tbj.HPartentID =ds.Tables[0].Rows[i]["HPartentID"].ToString();
                        tbj.HLevel = int.Parse(ds.Tables[0].Rows[i]["HLevel"].ToString());
                        tbj.Hurl = ds.Tables[0].Rows[i]["Hurl"].ToString();
                        mu.Add(tbj);
                    }
                }
                ToHierarchy.digui(ds.Tables[0], mu);
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "删除成功!";
                objJsonResult.data =Newtonsoft.Json.JsonConvert.SerializeObject(mu);
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!";
                objJsonResult.data = e.ToString();
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Models/Menu.cs
New file
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class Menu
    {
        //public int HitemID { get; set; }
        public string HitemID { get; set; }
        //public int? HPartentID { get; set; }
        public string HPartentID { get; set; }
        public string HNumber { get; set; }
        public string HName { get; set; }
        public int HLevel { get; set; }
        public string Hurl { get; set; }
        public List<Menu> childMenus { get; set; }
    }
}
WebAPI/Models/ModelConvertHelper.cs
New file
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Web;
namespace WebAPI.Models
{
    public class ModelConvertHelper<T> where T : new()
    {
        public static List<T> ConvertToModel(DataTable dt)
        {
            // å®šä¹‰é›†åˆ
            List<T> ts = new List<T>();
            // èŽ·å¾—æ­¤æ¨¡åž‹çš„ç±»åž‹
            Type type = typeof(T);
            string tempName = "";
            foreach (DataRow dr in dt.Rows)
            {
                T t = new T();
                // èŽ·å¾—æ­¤æ¨¡åž‹çš„å…¬å…±å±žæ€§
                PropertyInfo[] propertys = t.GetType().GetProperties();
                foreach (PropertyInfo pi in propertys)
                {
                    tempName = pi.Name;  // æ£€æŸ¥DataTable是否包含此列
                    if (dt.Columns.Contains(tempName))
                    {
                        // åˆ¤æ–­æ­¤å±žæ€§æ˜¯å¦æœ‰Setter
                        if (!pi.CanWrite) continue;
                        object value = dr[tempName];
                        if (value != DBNull.Value)
                            pi.SetValue(t, value, null);
                    }
                }
                ts.Add(t);
            }
            return ts;
        }
    }
}
WebAPI/Models/ToHierarchy.cs
New file
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
namespace WebAPI.Models
{
    public class ToHierarchy
    {
        public static List<Menu> ToHierarchyList(List<Menu> limits, string HPartentID/*int? HPartentID = 0*/)
        {
            List<Menu> newLimitList = new List<Menu>();
            newLimitList = limits.Where(t => t.HPartentID == HPartentID).ToList();
            for (int i = 0; i < newLimitList.Count; i++)
            {
                newLimitList[i].childMenus = ToHierarchyList(limits, newLimitList[i].HPartentID);//下一层级
            }
            return newLimitList;
        }
        public static void digui(DataTable dt, List<Menu> tree)
        {
            for (int m = 0; m < tree.Count; m++)
            {
                tree[m].childMenus = new List<Menu>();
                for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集
                {
                    if (tree[m].HitemID.ToString() == dt.Rows[i]["HPartentID"].ToString() && dt.Rows[i]["HitemID"].ToString() != dt.Rows[i]["HPartentID"].ToString())
                    {
                        Menu tbjson = new Menu();
                        tbjson.HitemID = dt.Rows[i]["HitemID"].ToString();
                        tbjson.HPartentID = dt.Rows[i]["HPartentID"].ToString();
                        tbjson.HNumber = dt.Rows[i]["HNumber"].ToString();
                        tbjson.HName = dt.Rows[i]["HName"].ToString();
                        tbjson.HLevel = tree[m].HLevel;
                        tbjson.Hurl = dt.Rows[i]["Hurl"].ToString();
                        tree[m].childMenus.Add(tbjson);
                    }
                }
                for (int i = 0; i < tree[m].childMenus.Count; i++)
                {
                    digui(dt, tree[m].childMenus);//再次用子集去循环,拿出子集的子集
                }
            }
        }
    }
}
WebAPI/WebAPI.csproj
@@ -437,12 +437,15 @@
    <Compile Include="Models\ClsSc_MouldRepairOutBillMain.cs" />
    <Compile Include="Models\ClsSc_MouldRepairOutBillSub.cs" />
    <Compile Include="Models\ClsGy_ProcPrice.cs" />
    <Compile Include="Models\Menu.cs" />
    <Compile Include="Models\ModelConvertHelper.cs" />
    <Compile Include="Models\Pay_OtherBalBill.cs" />
    <Compile Include="Models\Pay_WorkTimesBillSub.cs" />
    <Compile Include="Models\Pay_WorkTimesBill.cs" />
    <Compile Include="Models\Pay_SingleBalBill.cs" />
    <Compile Include="Models\Pay_OtherBalBillSub.cs" />
    <Compile Include="Models\Pay_SingleBalBillSub.cs" />
    <Compile Include="Models\ToHierarchy.cs" />
    <Compile Include="Models\Xt_ORGANIZATIONS.cs" />
    <Compile Include="Models\ClsSb_EquipRepairWorkBillSub.cs" />
    <Compile Include="Models\ClsSc_ICMOBillWorkQtyStatus_Tmp.cs" />
WorkM/Á÷ת¿¨¹ÜÀí/Sc_ProcessExchangeBillQuery.cs
@@ -1168,6 +1168,10 @@
        private void cf_Click(object sender, EventArgs e)
        {
            //智见特别控制
            MessageBox.Show("单据拆分功能已控制,请与管理员联系", "提示");
            return;
            //
            Int64 lngBillKey = 0;
            if (grdMain.CurrentRow == null)
                return;