1.修改仓位信息列表接口
2.新增仓库库位基础资料接口
3.修改模具出入库提交接口(增加库位) 、模具清单增加库位
4.新增模具上下机记录报表、模具借还记录报表
已添加1个文件
已修改10个文件
690 ■■■■■ 文件已修改
VueWebCoreApi/Controllers/BasicSettingController.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/GeneralBasicDataController.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/MouldManagerController.cs 131 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/BasicSettingBLL.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/GeneralBasicDataBLL.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/MouldManagerBLL.cs 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/MouldManagerDAL.cs 327 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Models/WareHouseLocation.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Startup.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/BasicSettingController.cs
@@ -694,6 +694,7 @@
        /// <summary>
        /// ä»“位信息列表
        /// </summary>
        /// <param name="flag">选中左侧树型是否仓库(Y/N)</param>
        /// <param name="stckcode">仓库编码字符串集</param>
        /// <param name="locacode">仓位编码</param>
        /// <param name="locaname">仓位名称</param>
@@ -704,13 +705,13 @@
        /// <returns></returns>
        [Route(template: "TSecLocaData")]
        [HttpGet]
        public JsonResult TSecLocaData(string stckcode, string locacode, string locaname, int page = 0, int rows = 0, string prop = null, string order = null)
        public JsonResult TSecLocaData(string flag, string stckcode, string locacode, string locaname, int page = 0, int rows = 0, string prop = null, string order = null)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            User us = JwtTools.Denocode(token.ToString());
            int startNum = rows * (page - 1) + 1;  //起始记录rowNum
            int endNum = rows * page;   //结束记录 rowNum
            mes = BasicSettingBLL.TSecLocaData(stckcode, locacode, locaname, startNum, endNum, prop, order);
            mes = BasicSettingBLL.TSecLocaData(flag,stckcode, locacode, locaname, startNum, endNum, prop, order);
            return Json(mes);
        }
        #endregion
VueWebCoreApi/Controllers/GeneralBasicDataController.cs
@@ -183,6 +183,35 @@
        }
        #endregion
        #region[仓库库位基础资料]
        /// <summary>
        /// ä»“库库位基础资料
        /// </summary>
        /// <returns></returns>
        [Route(template: "WareHouseLocation")]
        [HttpGet]
        public JsonResult WareHouseLocation()
        {
            mes = GeneralBasicDataBLL.WareHouseLocation();
            return Json(mes);
        }
        #endregion
        #region[仓库查找仓位信息]
        /// <summary>
        /// ä»“库查找仓位信息
        /// </summary>
        /// <param name="warhousecode">仓库编码</param>
        /// <returns></returns>
        [Route(template: "WareHouseSelectLocation")]
        [HttpGet]
        public JsonResult WareHouseSelectLocation(string warhousecode)
        {
            mes = GeneralBasicDataBLL.WareHouseSelectLocation(warhousecode);
            return Json(mes);
        }
        #endregion
        #region[工序基础资料]
        /// <summary>
        /// å·¥åºåŸºç¡€èµ„æ–™
VueWebCoreApi/Controllers/MouldManagerController.cs
@@ -945,8 +945,9 @@
            User us = JwtTools.Denocode(token.ToString());
            string mouldcode = obj["mouldcode"].ToString(); //模具编码
            string warehousecode = obj["warehousecode"].ToString(); //仓库编码
            string locationcode = obj["locationcode"].ToString(); //库位编码
            string description = obj["description"].ToString(); //入库描述
            mes = MouldManagerBLL.MouldInWareHouseSave(mouldcode, warehousecode,description, us);
            mes = MouldManagerBLL.MouldInWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
            return Json(mes);
        }
        #endregion
@@ -981,8 +982,9 @@
            User us = JwtTools.Denocode(token.ToString());
            string mouldcode = obj["mouldcode"].ToString(); //模具编码
            string warehousecode = obj["warehousecode"].ToString(); //仓库编码
            string locationcode = obj["locationcode"].ToString(); //库位编码
            string description = obj["description"].ToString(); //出库描述
            mes = MouldManagerBLL.MouldOutWareHouseSave(mouldcode, warehousecode, description, us);
            mes = MouldManagerBLL.MouldOutWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
            return Json(mes);
        }
        #endregion
@@ -1256,5 +1258,130 @@
            return Json(mes);
        }
        #endregion
        #region[模具上下机记录查询]
        /// <summary>
        /// æ¨¡å…·ä¸Šä¸‹æœºè®°å½•查询
        /// </summary>
        /// <param name="mouldcode">模具编码</param>
        /// <param name="mouldname">模具名称</param>
        /// <param name="mouldspec">规格型号</param>
        /// <param name="type">操作类型(上机:UP ä¸‹æœº:DOWN)</param>
        /// <param name="devicecode">设备编码</param>
        /// <param name="operuser">操作人员</param>
        /// <param name="operdate">操作时间</param>
        /// <param name="page">页码</param>
        /// <param name="rows">每页显示条数</param>
        /// <param name="prop">排序字段</param>
        /// <param name="order">排序规格</param>
        /// <returns></returns>
        [Route(template: "MouldUpDownMachinesSearch")]
        [HttpGet]
        public JsonResult MouldUpDownMachinesSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null,string devicecode=null,string operuser=null, string operdate = null)
        {
            string opendate = "";  //开始时间
            string closedate = "";  //结束时间
            if (operdate != "" && operdate != null)
            {
                opendate = operdate.Split('~')[0].ToString();
                closedate = operdate.Split('~')[1].ToString();
            }
            int startNum = rows * (page - 1) + 1;  //起始记录rowNum
            int endNum = rows * page;   //结束记录 rowNum
            mes = MouldManagerBLL.MouldUpDownMachinesSearch(mouldcode, mouldname, mouldspec,type,devicecode,operuser,opendate,closedate, startNum, endNum, prop, order);
            return Json(mes);
        }
        #endregion
        #region[模具上下机记导出]
        /// <summary>
        /// æ¨¡å…·ä¸Šä¸‹æœºè®°å¯¼å‡º
        /// </summary>
        /// <param name="mouldcode">模具编码</param>
        /// <param name="mouldname">模具名称</param>
        /// <param name="mouldspec">规格型号</param>
        /// <param name="type">操作类型(上机:UP ä¸‹æœº:DOWN)</param>
        /// <param name="devicecode">设备编码</param>
        /// <param name="operuser">操作人员</param>
        /// <param name="operdate">操作时间</param>
        /// <returns></returns>
        [Route(template: "MouldUpDownMachinesOutExcel")]
        [HttpGet]
        public JsonResult MouldUpDownMachinesOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string devicecode = null, string operuser = null, string operdate = null)
        {
            string opendate = "";  //开始时间
            string closedate = "";  //结束时间
            if (operdate != "" && operdate != null)
            {
                opendate = operdate.Split('~')[0].ToString();
                closedate = operdate.Split('~')[1].ToString();
            }
            mes = MouldManagerBLL.MouldUpDownMachinesOutExcel(mouldcode, mouldname, mouldspec, type, devicecode, operuser, opendate, closedate);
            return Json(mes);
        }
        #endregion
        #region[模具借还记录查询]
        /// <summary>
        /// æ¨¡å…·å€Ÿè¿˜è®°å½•查询
        /// </summary>
        /// <param name="mouldcode">模具编码</param>
        /// <param name="mouldname">模具名称</param>
        /// <param name="mouldspec">规格型号</param>
        /// <param name="type">操作类型</param>
        /// <param name="operuser">操作人员</param>
        /// <param name="operdate">操作时间</param>
        /// <param name="page">页码</param>
        /// <param name="rows">每页显示条数</param>
        /// <param name="prop">排序字段</param>
        /// <param name="order">排序规格</param>
        /// <returns></returns>
        [Route(template: "MouldCirculateMachinesSearch")]
        [HttpGet]
        public JsonResult MouldCirculateMachinesSearch(int page, int rows, string prop, string order, string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string operuser = null, string operdate = null)
        {
            string opendate = "";  //开始时间
            string closedate = "";  //结束时间
            if (operdate != "" && operdate != null)
            {
                opendate = operdate.Split('~')[0].ToString();
                closedate = operdate.Split('~')[1].ToString();
            }
            int startNum = rows * (page - 1) + 1;  //起始记录rowNum
            int endNum = rows * page;   //结束记录 rowNum
            mes = MouldManagerBLL.MouldCirculateMachinesSearch(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate, startNum, endNum, prop, order);
            return Json(mes);
        }
        #endregion
        #region[模具借还记录导出]
        /// <summary>
        /// æ¨¡å…·å€Ÿè¿˜è®°å½•导出
        /// </summary>
        /// <param name="mouldcode">模具编码</param>
        /// <param name="mouldname">模具名称</param>
        /// <param name="mouldspec">规格型号</param>
        /// <param name="type">操作类型</param>
        /// <param name="operuser">操作人员</param>
        /// <param name="operdate">操作时间</param>
        /// <returns></returns>
        [Route(template: "MouldCirculateMachinesOutExcel")]
        [HttpGet]
        public JsonResult MouldCirculateMachinesOutExcel(string mouldcode = null, string mouldname = null, string mouldspec = null, string type = null, string operuser = null, string operdate = null)
        {
            string opendate = "";  //开始时间
            string closedate = "";  //结束时间
            if (operdate != "" && operdate != null)
            {
                opendate = operdate.Split('~')[0].ToString();
                closedate = operdate.Split('~')[1].ToString();
            }
            mes = MouldManagerBLL.MouldCirculateMachinesOutExcel(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate);
            return Json(mes);
        }
        #endregion
    }
}
VueWebCoreApi/DLL/BLL/BasicSettingBLL.cs
@@ -352,9 +352,9 @@
        #endregion
        #region[仓位信息列表]
        public static ToMessage TSecLocaData(string stckcode, string locacode, string locaname, int startNum, int endNum, string prop, string order)
        public static ToMessage TSecLocaData(string flag, string stckcode, string locacode, string locaname, int startNum, int endNum, string prop, string order)
        {
            return BasicSettingDAL.TSecLocaData(stckcode, locacode, locaname, startNum, endNum, prop, order);
            return BasicSettingDAL.TSecLocaData(flag,stckcode, locacode, locaname, startNum, endNum, prop, order);
        }
        #endregion
VueWebCoreApi/DLL/BLL/GeneralBasicDataBLL.cs
@@ -95,6 +95,20 @@
        }
        #endregion
        #region[仓库库位基础资料]
        public static ToMessage WareHouseLocation()
        {
            return GeneralBasicDataDAL.WareHouseLocation();
        }
        #endregion
        #region[仓库查找仓位信息]
        public static ToMessage WareHouseSelectLocation(string warhousecode)
        {
            return GeneralBasicDataDAL.WareHouseSelectLocation(warhousecode);
        }
        #endregion
        #region[工序基础资料]
        public static ToMessage StepData()
        {
VueWebCoreApi/DLL/BLL/MouldManagerBLL.cs
@@ -370,9 +370,9 @@
        #endregion
        #region[模具入库提交]
        public static ToMessage MouldInWareHouseSave(string mouldcode, string warehousecode, string description, User us)
        public static ToMessage MouldInWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
        {
            return MouldManagerDAL.MouldInWareHouseSave(mouldcode, warehousecode, description, us);
            return MouldManagerDAL.MouldInWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
        }
        #endregion
@@ -385,9 +385,9 @@
        #endregion
        #region[模具出库提交]
        public static ToMessage MouldOutWareHouseSave(string mouldcode, string warehousecode, string description, User us)
        public static ToMessage MouldOutWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
        {
            return MouldManagerDAL.MouldOutWareHouseSave(mouldcode, warehousecode, description, us);
            return MouldManagerDAL.MouldOutWareHouseSave(mouldcode, warehousecode, locationcode, description, us);
        }
        #endregion
@@ -456,5 +456,35 @@
            return MouldManagerDAL.MouldUpdateSearch(mouldcode, mouldname, mouldspec, reportuser, repairuser, vrifcatuser, reportopendate, reportclosedate, repairopendate, repairclosedate, vrifcatopendate, vrifcatclosedate);
        }
        #endregion
        #region[模具上下机记录查询]
        public static ToMessage MouldUpDownMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
        {
            return MouldManagerDAL.MouldUpDownMachinesSearch(mouldcode, mouldname, mouldspec, type, devicecode, operuser, opendate, closedate, startNum, endNum, prop, order);
        }
        #endregion
        #region[模具上下机记导出Excel]
        public static ToMessage MouldUpDownMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate)
        {
            return MouldManagerDAL.MouldUpDownMachinesOutExcel(mouldcode, mouldname, mouldspec, type, devicecode, operuser, opendate, closedate);
        }
        #endregion
        #region[模具借还记录查询]
        public static ToMessage MouldCirculateMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
        {
            return MouldManagerDAL.MouldCirculateMachinesSearch(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate, startNum, endNum, prop, order);
        }
        #endregion
        #region[模具借还记录导出]
        public static ToMessage MouldCirculateMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate)
        {
            return MouldManagerDAL.MouldCirculateMachinesOutExcel(mouldcode, mouldname, mouldspec, type, operuser, opendate, closedate);
        }
        #endregion
    }
}
VueWebCoreApi/DLL/DAL/BasicSettingDAL.cs
@@ -3011,10 +3011,10 @@
            try
            {
                //获取开启仓位管控的仓库信息
                sql = @"select S.code,S.name,'-1' as idparent   from TSecStck S where S.ishasPosition='1'
                        union all
                        select L.code,L.name,case when L.idparent is NULL or L.idparent='' then L.idwarehouse else L.idparent end as idparent
                        from TSecLoca L ";
                sql = @"select S.code,S.name,'-1' as idparent,S.code as warhouse   from TSecStck S where S.ishasPosition='1'
                        union all
                        select L.code,L.name,case when L.idparent is NULL or L.idparent='' then L.idwarehouse else L.idparent end as idparent,L.idwarehouse as warhouse
                        from TSecLoca L ";
                var data = DapperHelper.selecttable(sql);
                mes.code = "200";
                mes.Message = "查询成功!";
@@ -3032,18 +3032,32 @@
        #endregion
        #region[仓位信息列表]
        public static ToMessage TSecLocaData(string stckcode, string locacode, string locaname, int startNum, int endNum, string prop, string order)
        public static ToMessage TSecLocaData(string flag, string stckcode, string locacode, string locaname, int startNum, int endNum, string prop, string order)
        {
            var dynamicParams = new DynamicParameters();
            string search = "", sql = "";
            IEnumerable<object> data;
            try
            {
                if (stckcode != "" && stckcode != null)
                if (flag == "Y")
                {
                    string[] classcode = Array.ConvertAll<string, string>(stckcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                    search += "and C.idparent in @classcode ";
                    dynamicParams.Add("@classcode", classcode);
                    if (stckcode != "" && stckcode != null)
                    {
                        string[] classcode = Array.ConvertAll<string, string>(stckcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                        search += "and C.idparent in @classcode ";
                        dynamicParams.Add("@classcode", classcode);
                    }
                }
                if (flag == "N")
                {
                    if (stckcode != "" && stckcode != null)
                    {
                        string[] classcode = Array.ConvertAll<string, string>(stckcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[]
                        search += "and C.idparent in @classcode and C.endpnt=@endpnt";
                        dynamicParams.Add("@classcode", classcode);
                        dynamicParams.Add("@endpnt", classcode);
                    }
                }
                if (locacode != "" && locacode != null)
                {
@@ -3055,10 +3069,10 @@
                    search += "and C.name like '%'+@locaname+'%' ";
                    dynamicParams.Add("@locaname", locaname);
                }
                sql = @"select C.code,C.name,C.status,C.description,C.idwarehouse as stckcode,T.name as stckname,C.idparent as parentcode,L.name as parentname,
                sql = @"select C.code,C.name,C.status,C.description,C.idwarehouse as stckcode,T.name as stckname,C.idparent as parentcode,L.name as parentname,C.endpnt,
                        C.lm_user as usercode,U.username,C.lm_date,C.data_sources   
                        from (
                        select L.code,L.name,L.idwarehouse,L.status,L.description,L.lm_user,L.lm_date,L.data_sources,case when L.idparent is NULL or L.idparent='' then L.idwarehouse else L.idparent end as idparent
                        select L.code,L.name,L.idwarehouse,L.status,L.description,L.lm_user,L.lm_date,L.data_sources,case when L.idparent is NULL or L.idparent='' then L.idwarehouse else L.idparent end as idparent,L.idparent as endpnt
                        from TSecLoca L
                        ) as C
                        left join TSecStck T  on C.idwarehouse=T.code
@@ -3157,6 +3171,15 @@
                }
                if (OperType == "Update")
                {
                    //判断上级货位编码是否等于货位编码
                    if (locacode == parentlocacode)
                    {
                        mes.code = "300";
                        mes.count = 0;
                        mes.Message = "上级货位不能是库位本身!";
                        mes.data = null;
                        return mes;
                    }
                    //判断往来单位名称是否重复
                    sql = @"select *  from TSecLoca where  code<>@code and name=@name";
                    dynamicParams.Add("@code", locacode);
VueWebCoreApi/DLL/DAL/GeneralBasicDataDAL.cs
@@ -5,6 +5,7 @@
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using VueWebCoreApi.Models;
using VueWebCoreApi.Models.UnitMaterial;
using VueWebCoreApi.Tools;
@@ -363,6 +364,76 @@
        }
        #endregion
        #region[仓库库位基础资料]
        public static ToMessage WareHouseLocation()
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
            List<WareHouseLocation> list = new List<WareHouseLocation>();
            try
            {
                //获取仓库数据
                sql = @"select code,name from TSecStck where status='0'";
                var data = DapperHelper.selecttable(sql);
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    WareHouseLocation warhouse = new WareHouseLocation();
                    warhouse.value = data.Rows[i]["code"].ToString();
                    warhouse.text = data.Rows[i]["name"].ToString();
                    warhouse.children = new List<LocationData>();
                    //获取库位
                    sql = @"select code,name from TSecLoca where status='0' and idwarehouse=@idwarehouse";
                    dynamicParams.Add("@idwarehouse", data.Rows[i]["code"].ToString());
                    var data0 = DapperHelper.selectdata(sql, dynamicParams);
                    for (int j = 0; j < data0.Rows.Count; j++)
                    {
                        LocationData  locat = new LocationData();
                        locat.value = data0.Rows[j]["code"].ToString();
                        locat.text = data0.Rows[j]["name"].ToString();
                        warhouse.children.Add(locat);
                    }
                    list.Add(warhouse);
                }
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.data = list;
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[仓库查找仓位信息]
        public static ToMessage WareHouseSelectLocation(string warhousecode)
        {
            var sql = "";
            var dynamicParams = new DynamicParameters();
            try
            {
                sql = @"select code,name from TSecLoca where status='0' and idwarehouse=@idwarehouse";
                dynamicParams.Add("@idwarehouse", warhousecode);
                var data = DapperHelper.selectdata(sql, dynamicParams);
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.data = data;
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[工序基础资料]
        public static ToMessage StepData()
        {
VueWebCoreApi/DLL/DAL/MouldManagerDAL.cs
@@ -68,7 +68,7 @@
                }
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.status,A.usestatus,A.code,A.name,A.spec,A.warehousecode,S.name as warehousename,
                var sql = @"select A.status,A.usestatus,A.code,A.name,A.spec,A.warehousecode,S.name as warehousename,A.location_code,L.name as location_name,
                           A.surp_life,(select isnull(sum(usecount_life),0)   from TMould_UpDownReord R where R.mould_code=A.code) as serlife,
                           A.resi_life,(case when isnull(M.mouldcode,'')='' then 'N' else 'Y' end) as is_part,
                           STUFF((SELECT ',' + B.partcode
@@ -78,6 +78,7 @@
                           A.lm_user as usercode,U.username,A.lm_date   
                           from TMouldInfo A
                           left join TSecStck S on A.warehousecode=S.code
                           left join TSecLoca L on A.location_code=L.code
                           left join (
                           select distinct mouldcode from TMouldInfoPart 
                           )  M on A.code=M.mouldcode
@@ -3252,7 +3253,7 @@
        #endregion
        #region[模具入库提交]
        public static ToMessage MouldInWareHouseSave(string mouldcode, string warehousecode, string description, User us)
        public static ToMessage MouldInWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
        {
            var sql = "";
            List<object> list = new List<object>();
@@ -3261,8 +3262,8 @@
            {
                list.Clear();
                //写入模具出入库记录表(入库操作)
                sql = @"insert into  TMould_InOutReord(mould_code,type,warehouse_code,description,lm_user,lm_date)
                        values(@mould_code,@type,@warehouse_code,@description,@lm_user,@lm_date)";
                sql = @"insert into  TMould_InOutReord(mould_code,type,warehouse_code,location_code,description,lm_user,lm_date)
                        values(@mould_code,@type,@warehouse_code,@location_code,@description,@lm_user,@lm_date)";
                list.Add(new
                {
                    str = sql,
@@ -3271,6 +3272,7 @@
                        mould_code = mouldcode,
                        type = "IN",
                        warehouse_code = warehousecode,
                        location_code = locationcode,
                        description = description,
                        lm_user = us.usercode,
                        lm_date = DateTime.Now.ToString()
@@ -3278,8 +3280,8 @@
                });
                //回写模具清单,使用状态(入库),仓库编码
                sql = @"update TMouldInfo set usestatus='0',warehousecode=@warehousecode  where code=@mouldcode";
                list.Add(new { str = sql, parm = new { mouldcode = mouldcode, warehousecode = warehousecode } });
                sql = @"update TMouldInfo set usestatus='0',warehousecode=@warehousecode,location_code=@location_code  where code=@mouldcode";
                list.Add(new { str = sql, parm = new { mouldcode = mouldcode, warehousecode = warehousecode, location_code = locationcode } });
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
@@ -3329,9 +3331,10 @@
                    {
                        //判断当前模具是否在外借状态
                        sql = @"select M.code as mould_code,M.name as mould_name,M.spec as mould_spec,
                                M.surp_life,M.resi_life,M.warehousecode,C.name as  warehousename
                                M.surp_life,M.resi_life,M.warehousecode,C.name as  warehousename,M.location_code,L.name as location_name
                                from TMouldInfo M 
                                left join TSecStck C on M.warehousecode=C.code
                                left join TSecLoca L on M.location_code=L.code
                                where M.code=@mouldcode and M.usestatus='0'";
                        dynamicParams.Add("@mouldcode", mouldcode);
                        var data = DapperHelper.selectdata(sql, dynamicParams);
@@ -3379,7 +3382,7 @@
        #endregion
        #region[模具出库提交]
        public static ToMessage MouldOutWareHouseSave(string mouldcode, string warehousecode, string description, User us)
        public static ToMessage MouldOutWareHouseSave(string mouldcode, string warehousecode,string locationcode, string description, User us)
        {
            var sql = "";
            List<object> list = new List<object>();
@@ -3388,8 +3391,8 @@
            {
                list.Clear();
                //写入模具出入库记录表(出库操作)
                sql = @"insert into  TMould_InOutReord(mould_code,type,warehouse_code,description,lm_user,lm_date)
                        values(@mould_code,@type,@warehouse_code,@description,@lm_user,@lm_date)";
                sql = @"insert into  TMould_InOutReord(mould_code,type,warehouse_code,location_code,description,lm_user,lm_date)
                        values(@mould_code,@type,@warehouse_code,@location_code,@description,@lm_user,@lm_date)";
                list.Add(new
                {
                    str = sql,
@@ -3398,6 +3401,7 @@
                        mould_code = mouldcode,
                        type = "OUT",
                        warehouse_code = warehousecode,
                        location_code= locationcode,
                        description = description,
                        lm_user = us.usercode,
                        lm_date = DateTime.Now.ToString()
@@ -3405,8 +3409,8 @@
                });
                //回写模具清单,使用状态(出库),清除仓库编码
                sql = @"update TMouldInfo set usestatus='1',warehousecode=@warehousecode  where code=@mouldcode";
                list.Add(new { str = sql, parm = new { mouldcode = mouldcode, warehousecode ="" } });
                sql = @"update TMouldInfo set usestatus='1',warehousecode=@warehousecode,location_code=@location_code  where code=@mouldcode";
                list.Add(new { str = sql, parm = new { mouldcode = mouldcode, warehousecode ="", location_code="" } });
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
@@ -3695,14 +3699,9 @@
                    search += "and A.maint_result=@repairresult ";
                    dynamicParams.Add("@repairresult", repairresult);
                }
                if (search == "")
                {
                    search = "and 1=1 ";
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.bywo,A.mould_code,E.name as mould_name,E.spec as mould_spec,M.code as stanedcode,M.name as stanedname,
                var sql = @"select A.id,A.bywo,A.mould_code,E.name as mould_name,E.spec as mould_spec,M.code as stanedcode,M.name as stanedname,
                            U.username as maint_user,A.maint_result,A.maint_date
                            from TMouldmaint_Proc_Main A
                            left join TMouldInfo E on A.mould_code=E.code
@@ -3802,10 +3801,6 @@
                {
                    search += "and A.maint_result=@repairresult ";
                    dynamicParams.Add("@repairresult", repairresult);
                }
                if (search == "")
                {
                    search = "and 1=1 ";
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
@@ -3920,11 +3915,6 @@
                    search += "and A.verify_date between @vrifcatopendate and @vrifcatclosedate ";
                    dynamicParams.Add("@vrifcatopendate", vrifcatopendate + " 00:00:00");
                    dynamicParams.Add("@vrifcatclosedate", vrifcatclosedate + " 23:59:59");
                }
                if (search == "")
                {
                    search = "and 1=1 ";
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
@@ -4080,11 +4070,6 @@
                    dynamicParams.Add("@vrifcatopendate", vrifcatopendate + " 00:00:00");
                    dynamicParams.Add("@vrifcatclosedate", vrifcatclosedate + " 23:59:59");
                }
                if (search == "")
                {
                    search = "and 1=1 ";
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
@@ -4117,5 +4102,283 @@
            return mes;
        }
        #endregion
        #region[模具上下机记录查询]
        public static ToMessage MouldUpDownMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
            try
            {
                if (mouldcode != "" && mouldcode != null)
                {
                    search += "and A.mould_code like '%'+@mouldcode+'%' ";
                    dynamicParams.Add("@mouldcode", mouldcode);
                }
                if (mouldname != "" && mouldname != null)
                {
                    search += "and M.name like '%'+@mouldname+'%' ";
                    dynamicParams.Add("@mouldname", mouldname);
                }
                if (mouldspec != "" && mouldspec != null)
                {
                    search += "and M.spec like '%'+@mouldspec+'%' ";
                    dynamicParams.Add("@mouldspec", mouldspec);
                }
                if (type != "" && type != null)
                {
                    search += "and A.type=@type ";
                    dynamicParams.Add("@type", type);
                }
                if (devicecode != "" && devicecode != null)
                {
                    search += "and A.eqp_code=@devicecode ";
                    dynamicParams.Add("@devicecode", devicecode);
                }
                if (operuser != "" && operuser != null)
                {
                    search += "and U.username like '%'+@operuser+'%' ";
                    dynamicParams.Add("@operuser", operuser);
                }
                if (opendate != "" && opendate != null)
                {
                    search += "and A.lm_date between @opendate and @closedate ";
                    dynamicParams.Add("@opendate", opendate + " 00:00:00");
                    dynamicParams.Add("@closedate", closedate + " 23:59:59");
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,
                            (case when A.type='UP' then '上机' else '下机' end) as type,A.usecount_life,
                            A.eqp_code,E.name as eqp_name,U.username as lm_user,A.lm_date
                            from TMould_UpDownReord A
                            left join TMouldInfo M on A.mould_code=M.code
                            left join TEqpInfo E on A.eqp_code=E.code
                            left join TUser U on A.lm_user=U.usercode
                            where 1=1 " + search;
                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.count = total;
                mes.data = data.ToList();
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[模具上下机记导出Excel]
        public static ToMessage MouldUpDownMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string devicecode, string operuser, string opendate, string closedate)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
            try
            {
                if (mouldcode != "" && mouldcode != null)
                {
                    search += "and A.mould_code like '%'+@mouldcode+'%' ";
                    dynamicParams.Add("@mouldcode", mouldcode);
                }
                if (mouldname != "" && mouldname != null)
                {
                    search += "and M.name like '%'+@mouldname+'%' ";
                    dynamicParams.Add("@mouldname", mouldname);
                }
                if (mouldspec != "" && mouldspec != null)
                {
                    search += "and M.spec like '%'+@mouldspec+'%' ";
                    dynamicParams.Add("@mouldspec", mouldspec);
                }
                if (type != "" && type != null)
                {
                    search += "and A.type=@type ";
                    dynamicParams.Add("@type", type);
                }
                if (devicecode != "" && devicecode != null)
                {
                    search += "and A.eqp_code=@devicecode ";
                    dynamicParams.Add("@devicecode", devicecode);
                }
                if (operuser != "" && operuser != null)
                {
                    search += "and U.username like '%'+@operuser+'%' ";
                    dynamicParams.Add("@operuser", operuser);
                }
                if (opendate != "" && opendate != null)
                {
                    search += "and A.lm_date between @opendate and @closedate ";
                    dynamicParams.Add("@opendate", opendate + " 00:00:00");
                    dynamicParams.Add("@closedate", closedate + " 23:59:59");
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.mould_code as '模具编码',M.name as '模具名称',M.spec as '模具规格',
                            (case when A.type='UP' then '上机' else '下机' end) as '操作类型',A.usecount_life as '本次使用',
                            A.eqp_code as '设备编码',E.name as '设备名称',U.username as '操作人员',A.lm_date as '操作时间'
                            from TMould_UpDownReord A
                            left join TMouldInfo M on A.mould_code=M.code
                            left join TEqpInfo E on A.eqp_code=E.code
                            left join TUser U on A.lm_user=U.usercode
                            where 1=1 " + search;
                DataTable data = DapperHelper.selectdata(sql, dynamicParams);
                data.TableName = "Table"; //设置DataTable的名称
                string msg = DownLoad.DataTableToExcel(data, "模具上下机记录报表");
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.count = total;
                mes.data = msg;
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[模具借还记录查询]
        public static ToMessage MouldCirculateMachinesSearch(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate, int startNum, int endNum, string prop, string order)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
            try
            {
                if (mouldcode != "" && mouldcode != null)
                {
                    search += "and A.mould_code like '%'+@mouldcode+'%' ";
                    dynamicParams.Add("@mouldcode", mouldcode);
                }
                if (mouldname != "" && mouldname != null)
                {
                    search += "and M.name like '%'+@mouldname+'%' ";
                    dynamicParams.Add("@mouldname", mouldname);
                }
                if (mouldspec != "" && mouldspec != null)
                {
                    search += "and M.spec like '%'+@mouldspec+'%' ";
                    dynamicParams.Add("@mouldspec", mouldspec);
                }
                if (type != "" && type != null)
                {
                    search += "and A.type=@type ";
                    dynamicParams.Add("@type", type);
                }
                if (operuser != "" && operuser != null)
                {
                    search += "and U.username like '%'+@operuser+'%' ";
                    dynamicParams.Add("@operuser", operuser);
                }
                if (opendate != "" && opendate != null)
                {
                    search += "and A.lm_date between @opendate and @closedate ";
                    dynamicParams.Add("@opendate", opendate + " 00:00:00");
                    dynamicParams.Add("@closedate", closedate + " 23:59:59");
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.mould_code,M.name as mould_name,M.spec as mould_spec,
                            (case when A.type='OUT' then '外借' else '归还' end) as type,
                            A.description,U.username as lm_user,A.lm_date
                            from TMould_LendOutReord A
                            left join TMouldInfo M on A.mould_code=M.code
                            left join TUser U on A.lm_user=U.usercode
                            where 1=1 " + search;
                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.count = total;
                mes.data = data.ToList();
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[模具借还记录导出]
        public static ToMessage MouldCirculateMachinesOutExcel(string mouldcode, string mouldname, string mouldspec, string type, string operuser, string opendate, string closedate)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
            try
            {
                if (mouldcode != "" && mouldcode != null)
                {
                    search += "and A.mould_code like '%'+@mouldcode+'%' ";
                    dynamicParams.Add("@mouldcode", mouldcode);
                }
                if (mouldname != "" && mouldname != null)
                {
                    search += "and M.name like '%'+@mouldname+'%' ";
                    dynamicParams.Add("@mouldname", mouldname);
                }
                if (mouldspec != "" && mouldspec != null)
                {
                    search += "and M.spec like '%'+@mouldspec+'%' ";
                    dynamicParams.Add("@mouldspec", mouldspec);
                }
                if (type != "" && type != null)
                {
                    search += "and A.type=@type ";
                    dynamicParams.Add("@type", type);
                }
                if (operuser != "" && operuser != null)
                {
                    search += "and U.username like '%'+@operuser+'%' ";
                    dynamicParams.Add("@operuser", operuser);
                }
                if (opendate != "" && opendate != null)
                {
                    search += "and A.lm_date between @opendate and @closedate ";
                    dynamicParams.Add("@opendate", opendate + " 00:00:00");
                    dynamicParams.Add("@closedate", closedate + " 23:59:59");
                }
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select A.mould_code as '模具编码',M.name as '模具名称',M.spec as '规格型号',
                            (case when A.type='OUT' then '外借' else '归还' end) as '操作类型',
                            A.description as '描述',U.username as '操作人员',A.lm_date as '操作时间'
                            from TMould_LendOutReord A
                            left join TMouldInfo M on A.mould_code=M.code
                            left join TUser U on A.lm_user=U.usercode
                            where 1=1 " + search;
                DataTable data = DapperHelper.selectdata(sql, dynamicParams);
                data.TableName = "Table"; //设置DataTable的名称
                string msg = DownLoad.DataTableToExcel(data, "模具借还记录报表");
                mes.code = "200";
                mes.Message = "查询成功!";
                mes.count = total;
                mes.data = msg;
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.Message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
    }
}
VueWebCoreApi/Models/WareHouseLocation.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace VueWebCoreApi.Models
{
    public class WareHouseLocation
    {
        public string text { get; set; }
        public string value { get; set; }
        public List<LocationData> children { get; set; }
    }
    public class LocationData
    {
        public string text { get; set; }
        public string value { get; set; }
    }
}
VueWebCoreApi/Startup.cs
@@ -20,6 +20,7 @@
using Quartz;
using Quartz.Impl;
using Quartz.Spi;
using Swashbuckle.AspNetCore.SwaggerUI;
using System;
using System.Collections.Generic;
using System.IO;
@@ -60,19 +61,20 @@
            {
                typeof(OpenApiGroup).GetEnumNames().ToList().ForEach(version =>
                {
                    c.SwaggerDoc(version, new OpenApiInfo()
                    {
                        Title = $"新凯迪MesApi文档:{version}",
                        Version = version,
                        Description = $"Panda.Sewerage :  {version}  "
                        Description = $"Panda.Sewerage :  {version}  ",
                    });
                });
                string basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
                string xmlPath = Path.Combine(basePath, "VueWebCoreApi.xml");
                c.IncludeXmlComments(xmlPath, true);
            });
            #endregion
            // è®¾ç½®é…ç½®
            AppSetting.SetAppSetting(Configuration.GetSection("ConnectionStrings"));
            //log4net配置
@@ -134,6 +136,7 @@
                {
                    c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"{version}");
                });
            });
            #endregion
            app.UseHttpsRedirection();