VueWebApi/DLL/DAL/DeviceManagerDAL.cs
@@ -663,27 +663,27 @@
            {
                if (checkitemcode != "" && checkitemcode != null)
                {
                    search += "and code like '%'+@checkitemcode+'%' ";
                    search += "and A.code like '%'+@checkitemcode+'%' ";
                    dynamicParams.Add("@checkitemcode", checkitemcode);
                }
                if (checkitemname != "" && checkitemname != null)
                {
                    search += "and name like '%'+@checkitemname+'%' ";
                    search += "and A.name like '%'+@checkitemname+'%' ";
                    dynamicParams.Add("@checkitemname", checkitemname);
                }
                if (checkdescr != "" && checkdescr != null)
                {
                    search += "and description=@checkdescr ";
                    search += "and A.description=@checkdescr ";
                    dynamicParams.Add("@checkdescr", checkdescr);
                }
                if (isqrcode != "" && isqrcode != null)
                {
                    search += "and isscan=@isqrcode ";
                    search += "and A.isscan=@isqrcode ";
                    dynamicParams.Add("@isqrcode", isqrcode);
                }
                if (cycle != "" && cycle != null)
                {
                    search += "and isscan=@cycle ";
                    search += "and A.cycle=@cycle ";
                    dynamicParams.Add("@cycle", cycle);
                }
                if (search == "")
@@ -693,8 +693,10 @@
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select id,code,name,description,isscan,cycle,lm_user,lm_date
                            from TEqpchk_Item where is_delete<>'1' " + search;
                var sql = @"select A.id,A.code,A.name,A.description,A.isscan,A.cycle,U.username as lm_user,A.lm_date
                            from TEqpchk_Item A
                            left join TUser U on A.lm_user=U.usercode
                            where A.is_delete<>'1' " + search;
                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                mes.code = "200";
                mes.Message = "查询成功!";
@@ -842,7 +844,7 @@
        #region[设备保养项列表查询]
        public static ToMessage DeviceMaiItemSearch(string maiitemcode, string maiitemname, string maidescr, string isqrcode, string cycle, int startNum, int endNum, string prop, string order)
        public static ToMessage DeviceMaiItemSearch(string maiitemcode, string maiitemname, string maidescr, string isqrcode, int startNum, int endNum, string prop, string order)
        {
            var dynamicParams = new DynamicParameters();
            string search = "";
@@ -850,28 +852,23 @@
            {
                if (maiitemcode != "" && maiitemcode != null)
                {
                    search += "and code like '%'+@maiitemcode+'%' ";
                    search += "and A.code like '%'+@maiitemcode+'%' ";
                    dynamicParams.Add("@maiitemcode", maiitemcode);
                }
                if (maiitemname != "" && maiitemname != null)
                {
                    search += "and name like '%'+@maiitemname+'%' ";
                    search += "and A.name like '%'+@maiitemname+'%' ";
                    dynamicParams.Add("@maiitemname", maiitemname);
                }
                if (maidescr != "" && maidescr != null)
                {
                    search += "and description=@maidescr ";
                    search += "and A.description=@maidescr ";
                    dynamicParams.Add("@maidescr", maidescr);
                }
                if (isqrcode != "" && isqrcode != null)
                {
                    search += "and isscan=@isqrcode ";
                    search += "and A.isscan=@isqrcode ";
                    dynamicParams.Add("@isqrcode", isqrcode);
                }
                if (cycle != "" && cycle != null)
                {
                    search += "and isscan=@cycle ";
                    dynamicParams.Add("@cycle", cycle);
                }
                if (search == "")
                {
@@ -880,8 +877,10 @@
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select id,code,name,description,isscan,cycle,lm_user,lm_date
                            from TEqpmai_Item where is_delete<>'1' " + search;
                var sql = @"select A.id,A.code,A.name,A.description,A.isscan,U.username as lm_user,A.lm_date
                            from TEqpmai_Item A
                            left join TUser U on A.lm_user=U.usercode
                            where A.is_delete<>'1' " + search;
                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                mes.code = "200";
                mes.Message = "查询成功!";
@@ -900,20 +899,19 @@
        #endregion
        #region[设备保养项新增编辑]
        public static ToMessage AddUpdateDeviceMaiItem(string maiitemid, string maiitemcode, string maiitemname, string maiitemdescr, string cycle, string isqrcode, string usercode, string operType)
        public static ToMessage AddUpdateDeviceMaiItem(string maiitemid, string maiitemcode, string maiitemname, string maiitemdescr, string isqrcode, string usercode, string operType)
        {
            var dynamicParams = new DynamicParameters();
            try
            {
                if (operType == "Add")
                {
                    var sql = @"insert into TEqpmai_Item(code,name,description,isscan,cycle,lm_user,lm_date)
                              values(@maiitemcode,@maiitemname,@checkitemdescr,@isqrcode,@cycle,@usercode,@CreateDate)";
                    var sql = @"insert into TEqpmai_Item(code,name,description,isscan,lm_user,lm_date)
                              values(@maiitemcode,@maiitemname,@checkitemdescr,@isqrcode,@usercode,@CreateDate)";
                    dynamicParams.Add("@maiitemcode", maiitemcode);
                    dynamicParams.Add("@maiitemname", maiitemname);
                    dynamicParams.Add("@maiitemdescr", maiitemdescr);
                    dynamicParams.Add("@isqrcode", isqrcode);
                    dynamicParams.Add("@cycle", cycle);
                    dynamicParams.Add("@usercode", usercode);
                    dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
                    int cont = DapperHelper.SQL(sql, dynamicParams);
@@ -934,14 +932,13 @@
                }
                if (operType == "Update")
                {
                    var sql = @"update TEqpmai_Item set name=@maiitemname,description=@maiitemdescr,isscan=@isqrcode,cycle=@cycle,
                    var sql = @"update TEqpmai_Item set name=@maiitemname,description=@maiitemdescr,isscan=@isqrcode,
                                lm_user=@usercode,lm_date=@CreateDate
                                where id=@maiitemid";
                    dynamicParams.Add("@maiitemid", maiitemid);
                    dynamicParams.Add("@maiitemname", maiitemname);
                    dynamicParams.Add("@maiitemdescr", maiitemdescr);
                    dynamicParams.Add("@isqrcode", isqrcode);
                    dynamicParams.Add("@cycle", cycle);
                    dynamicParams.Add("@usercode", usercode);
                    dynamicParams.Add("@CreateDate", DateTime.Now.ToString());
                    int cont = DapperHelper.SQL(sql, dynamicParams);
@@ -1132,7 +1129,7 @@
                //根据设备点检标准编码获取关联的检验项目信息
                sql = @"select B.code,B.name,A.chkdesc,A.isscan,A.cycle  from TEqpchk_Deta A
                        left join TEqpchk_Item  B on A.code=B.code
                        where  A.eqpcheck_main_code=@checkstaned_code order by A.seq asc";
                        where  A.eqpchk_main_code=@checkstaned_code order by A.seq asc";
                dynamicParams.Add("@checkstaned_code", rout.code);
                var data0 = DapperHelper.selectdata(sql, dynamicParams);
                rout.Data = data0;
@@ -1210,7 +1207,7 @@
                    list.Add(new { str = sql, parm = new { checkstaned_code = json.code } });
                    //修改点检标准主表
                    sql = @"update  TEqpchk_Main set name=@checkstaned_name,description=@checkstaned_desc,iscontr=@iscontr where code=@checkstaned_code";
                    list.Add(new { str = sql, parm = new { checkstaned_code = json.code, checkstaned_name = json.name, checkstaned_desc = json.description } });
                    list.Add(new { str = sql, parm = new { checkstaned_code = json.code, checkstaned_name = json.name, checkstaned_desc = json.description,iscontr = json.enable } });
                    //新增点检标准关联点检项目子表
                    for (int i = 0; i < json.Data.Rows.Count; i++)
                    {
@@ -1350,7 +1347,7 @@
                    //        where A.eqpchkmain_code=@checkstand_code and A.is_delete<>'1' and B.is_delete<>'1'
                    //        ) B on A.code=B.eqp_code where A.wksp_code=@wkspcode and A.is_delete<>'1'";
                    sql = @"select *  from(
                            select AA.code,AA.name,(case when BB.eqpchkmain_code is null then 'N' else 'Y' end) flag,(case when AA.eqpchkmain_code  is null then 'N' else 'Y' end) flage1
                            select AA.code,AA.name,'E' as type,(case when BB.eqpchkmain_code is null then 'N' else 'Y' end) flag,(case when AA.eqpchkmain_code  is null then 'N' else 'Y' end) flage1
                            from(
                            select A.code,A.name,B.eqpchkmain_code
                            from TEqpInfo A
@@ -1494,7 +1491,7 @@
                //search = search.Substring(3);//截取索引2后面的字符
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select id,code,name,description,is_repaireqp,lm_user,lm_date
                var sql = @"select id,code,name,description,is_repaireqp,main_cycle,lm_user,lm_date
                            from TEqpmai_Main where is_delete<>'1' " + search;
                var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                mes.code = "200";
@@ -1550,11 +1547,12 @@
                        where code=@repairstand_code and is_delete<>'1'";
                dynamicParams.Add("@repairstand_code", repairstand_code);
                var data = DapperHelper.selectdata(sql, dynamicParams);
                RoutEdit rout = new RoutEdit();
                EqpRepair rout = new EqpRepair();
                if (data.Rows.Count > 0)
                {
                    rout.code = data.Rows[0]["CODE"].ToString();
                    rout.name = data.Rows[0]["NAME"].ToString();
                    rout.repaircycle= data.Rows[0]["MAIN_CYCLE"].ToString();
                    rout.description = data.Rows[0]["DESCRIPTION"].ToString();
                }
                else
@@ -1589,7 +1587,7 @@
        #endregion
        #region[设备保养标准新增编辑]
        public static ToMessage AddUpdateDeviceRepairStandArd(string opertype, RoutEdit json, string username)
        public static ToMessage AddUpdateDeviceRepairStandArd(string opertype, EqpRepair json, string username)
        {
            var sql = "";
            var dynamicParams = new DynamicParameters();
@@ -1599,13 +1597,13 @@
                if (opertype == "Add")
                {
                    //新增设备保养标准主表
                    sql = @"insert into TEqpmai_Main(code,name,description,lm_user,lm_date) values(@code,@name,@descr,@lm_user,@lm_date)";
                    list.Add(new { str = sql, parm = new { code = json.code, name = json.name, descr = json.description, lm_user = username, lm_date = DateTime.Now.ToString() } });
                    sql = @"insert into TEqpmai_Main(code,name,description,main_cycle,lm_user,lm_date) values(@code,@name,@descr,@lm_user,@lm_date)";
                    list.Add(new { str = sql, parm = new { code = json.code, name = json.name, descr = json.description,main_cycle=json.repaircycle, lm_user = username, lm_date = DateTime.Now.ToString() } });
                    for (int i = 0; i < json.Data.Rows.Count; i++)
                    {
                        //新增设备保养标准关联保养项子表
                        sql = @"insert TEqpmai_Deta (seq,code,name,eapmai_code,cycle,chk_desc,isscan,lm_user,lm_date)
                                values(@repairitem_seq,@repairitem_code,@repairitem_name,@code,@cycle,@repairdesc,@isscan,@lm_user,@lm_date)";
                        sql = @"insert TEqpmai_Deta (seq,code,name,eapmai_code,chk_desc,isscan,lm_user,lm_date)
                                values(@repairitem_seq,@repairitem_code,@repairitem_name,@code,@repairdesc,@isscan,@lm_user,@lm_date)";
                        list.Add(new
                        {
                            str = sql,
@@ -1615,7 +1613,6 @@
                                repairitem_code = json.Data.Rows[i]["REPAIRITEM_CODE"].ToString(),
                                repairitem_name = json.Data.Rows[i]["REPAIRITEM_NAME"].ToString(),
                                code = json.code,
                                cycle = json.Data.Rows[i]["CYCLE"].ToString(),
                                repairdesc = json.Data.Rows[i]["REPAIRITEM_DESCR"].ToString(),
                                isscan = json.Data.Rows[i]["ISSCAN"].ToString(),
                                lm_user = username,
@@ -1645,13 +1642,13 @@
                    sql = @"delete from TEqpmai_Deta where eapmai_code=@repairstaned_code";
                    list.Add(new { str = sql, parm = new { repairstaned_code = json.code } });
                    //修改保养标准主表
                    sql = @"update  TEqpmai_Main set name=@repairstaned_name,description=@repairstaned_desc where code=@repairstaned_code";
                    list.Add(new { str = sql, parm = new { repairstaned_code = json.code, repairstaned_name = json.name, repairstaned_desc = json.description } });
                    sql = @"update  TEqpmai_Main set name=@repairstaned_name,description=@repairstaned_desc,main_cycle=@main_cycle where code=@repairstaned_code";
                    list.Add(new { str = sql, parm = new { repairstaned_code = json.code, repairstaned_name = json.name, repairstaned_desc = json.description, main_cycle =json.repaircycle} });
                    //新增点检标准关联点检项目子表
                    for (int i = 0; i < json.Data.Rows.Count; i++)
                    {
                        sql = @"insert TEqpmai_Deta (seq,code,name,eapmai_code,cycle,chk_desc,isscan,lm_user,lm_date)
                                values(@repairitem_seq,@repairitem_code,@repairitem_name,@code,@cycle,@repairdesc,@isscan,@lm_user,@lm_date)";
                        sql = @"insert TEqpmai_Deta (seq,code,name,eapmai_code,chk_desc,isscan,lm_user,lm_date)
                                values(@repairitem_seq,@repairitem_code,@repairitem_name,@code,@repairdesc,@isscan,@lm_user,@lm_date)";
                        list.Add(new
                        {
                            str = sql,
@@ -1661,7 +1658,6 @@
                                repairitem_code = json.Data.Rows[i]["REPAIRITEM_CODE"].ToString(),
                                repairitem_name = json.Data.Rows[i]["REPAIRITEM_NAME"].ToString(),
                                code = json.code,
                                cycle = json.Data.Rows[i]["CYCLE"].ToString(),
                                repairdesc = json.Data.Rows[i]["REPAIRITEM_DESCR"].ToString(),
                                isscan = json.Data.Rows[i]["ISSCAN"].ToString(),
                                lm_user = username,
@@ -1787,7 +1783,7 @@
                    //        where A.eapmai_code=@repairstand_code and A.is_delete<>'1' and B.is_delete<>'1'
                    //        ) B on A.code=B.eqp_code where A.wksp_code=@wkspcode and A.is_delete<>'1'";
                    sql = @"select *  from(
                            select AA.code,AA.name,(case when BB.eapmai_code is null then 'N' else 'Y' end) flag,(case when AA.eapmai_code  is null then 'N' else 'Y' end) flage1
                            select AA.code,AA.name,'E' as type,(case when BB.eapmai_code is null then 'N' else 'Y' end) flag,(case when AA.eapmai_code  is null then 'N' else 'Y' end) flage1
                            from(
                            select A.code,A.name,B.eapmai_code
                            from TEqpInfo A