From 925394b1b7f61a2c2a15fdaa0ecd0763214ccda1 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期二, 30 五月 2023 18:01:29 +0800
Subject: [PATCH] 增加App报工、工序检验功能

---
 VueWebApi/DLL/DAL/SystemSettingDAL.cs |  214 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 212 insertions(+), 2 deletions(-)

diff --git a/VueWebApi/DLL/DAL/SystemSettingDAL.cs b/VueWebApi/DLL/DAL/SystemSettingDAL.cs
index 2bb643f..dcad43d 100644
--- a/VueWebApi/DLL/DAL/SystemSettingDAL.cs
+++ b/VueWebApi/DLL/DAL/SystemSettingDAL.cs
@@ -43,9 +43,9 @@
                 //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
                 // --------------鏌ヨ鎸囧畾鏁版嵁--------------
                 var total = 0; //鎬绘潯鏁�
-                var sql = @"select A.right_code,A.right_name,B.prefix,B.filingdate,B.incbit  from TRight A
+                var sql = @"select A.right_code,A.right_name,B.prefix,B.filingdate,B.incbit,A.Type  from TRight A
 							left join T_CodeRules B on A.right_code=B.rightcode
-							where A.Type='PC' and A.parent_id<>'0' " + search + "";
+							where  A.parent_id<>'0' and A.is_delete<>'1' " + search + "";
                 var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total);
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -153,5 +153,215 @@
             return mes;
         }
         #endregion
+
+
+        #region[鐢熸垚绯荤粺鏉$爜(鑷畾涔�)]
+        public static ToMessage LabelBarCode(string rightcode, string partcode, string qty, string onelabqty)
+        {
+            mes = AppLableBarCode.EncodingSeach(rightcode, partcode, qty, onelabqty);
+            return mes;
+        }
+        #endregion
+
+
+        #region[杞﹂棿鍏憡鍒楄〃]
+        public static ToMessage SystemAnnouncementSearch(string wkspcode, string ancetitle, string ancecont, string cancel, string level, int startNum, int endNum, string prop, string order)
+        {
+            var dynamicParams = new DynamicParameters();
+            string search = "";
+            try
+            {
+                if (wkspcode != "" && wkspcode != null)
+                {
+                    search += "and A.wksp_code=@wkspcode ";
+                    dynamicParams.Add("@wkspcode", wkspcode);
+                }
+                if (ancetitle != "" && ancetitle != null)
+                {
+                    search += "and A.title like '%'+@ancetitle+'%' ";
+                    dynamicParams.Add("@ancetitle", ancetitle);
+                }
+                if (ancecont != "" && ancecont != null)
+                {
+                    search += "and A.contents like '%'+@ancecont+'%' ";
+                    dynamicParams.Add("@ancecont", ancecont);
+                }
+                if (cancel != "" && cancel != null)
+                {
+                    search += "and A.if_cancel=@cancel ";
+                    dynamicParams.Add("@cancel", cancel);
+                }
+                if (level != "" && level != null)
+                {
+                    search += "and A.priority=@level ";
+                    dynamicParams.Add("@level", level);
+                }
+                if (search == "")
+                {
+                    search = "and 1=1 ";
+                }
+                //search = search.Substring(3);//鎴彇绱㈠紩2鍚庨潰鐨勫瓧绗�
+                // --------------鏌ヨ鎸囧畾鏁版嵁--------------
+                var total = 0; //鎬绘潯鏁�
+                var sql = @"select A.id,A.wksp_code,T.org_name as wksp_name,A.title,A.contents,U.username as lm_user,A.lm_date,A.if_cancel,A.cancel_date,A.priority
+                            from TSystemAnnouncement A
+                            left join TOrganization T on A.wksp_code=T.org_code
+                            left join TUser U on A.lm_user=U.usercode
+                            where T.description='W' and A.is_delete='0' " + 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 SystemAnnouncementAddUpdate(string id,DataTable dt, string ancetitle, string ancecont, string cancel, string level,string username, string opertype)
+        {
+            var sql = "";
+            var dynamicParams = new DynamicParameters();
+            List<object> list = new List<object>();
+            string cancel_date = "";
+            try
+            {
+                if (cancel == "Y")
+                {
+                    cancel_date = DateTime.Now.ToString();
+                }
+                if (opertype == "Add")
+                {
+                    for (int i = 0; i < dt.Rows.Count; i++)
+                    {
+                        //鍐欏叆宸ュ崟琛�
+                        sql = @"insert into TSystemAnnouncement(wksp_code,title,contents,if_cancel,cancel_date,lm_user,lm_date,priority)
+                                values(@wksp_code,@title,@contents,@if_cancel,@cancel_date,@lm_user,@lm_date,@priority)";
+                        list.Add(new
+                        {
+                            str = sql,
+                            parm = new
+                            {
+                                wksp_code = dt.Rows[i]["WKSP_CODE"].ToString(),
+                                title = ancetitle,
+                                contents = ancecont,
+                                if_cancel = cancel,
+                                cancel_date = cancel_date,
+                                lm_user = username,
+                                lm_date = DateTime.Now.ToString(),
+                                priority = level
+                            }
+                        });
+                    }
+
+                    bool aa = DapperHelper.DoTransaction(list);
+                    if (aa)
+                    {
+                        mes.code = "200";
+                        mes.count = 0;
+                        mes.Message = "鎿嶄綔鎴愬姛!";
+                        mes.data = null;
+                    }
+                    else
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "鎿嶄綔澶辫触!";
+                        mes.data = null;
+                    }
+                }
+                if (opertype == "Update")
+                {
+                    sql = @"update TSystemAnnouncement set wksp_code=@wksp_code,title=@title,contents=@contents,if_cancel=@if_cancel,cancel_date=@cancel_date,lm_user=@lm_user,lm_date=@lm_date,priority=@priority where id=@id";
+                    list.Add(new
+                    {
+                        str = sql,
+                        parm = new
+                        {
+                            id=id,
+                            wksp_code = dt.Rows[0]["WKSP_CODE"].ToString(),
+                            title = ancetitle,
+                            contents = ancecont,
+                            if_cancel = cancel,
+                            cancel_date = cancel_date,
+                            lm_user = username,
+                            lm_date = DateTime.Now.ToString(),
+                            priority = level
+                        }
+                    });
+                    bool aa = DapperHelper.DoTransaction(list);
+                    if (aa)
+                    {
+                        mes.code = "200";
+                        mes.count = 0;
+                        mes.Message = "淇敼鎿嶄綔鎴愬姛!";
+                        mes.data = null;
+                    }
+                    else
+                    {
+                        mes.code = "300";
+                        mes.count = 0;
+                        mes.Message = "淇敼鎿嶄綔澶辫触!";
+                        mes.data = null;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
+
+        #region[杞﹂棿鍏憡鍒犻櫎]
+        public static ToMessage SystemAnnouncementDelete(string id)
+        {
+            var sql = "";
+            List<object> list = new List<object>();
+            var dynamicParams = new DynamicParameters();
+            try
+            {
+                list.Clear();
+                sql = @"delete TSystemAnnouncement where id=@id";
+                list.Add(new { str = sql, parm = new { id = id } });
+
+                bool aa = DapperHelper.DoTransaction(list);
+                if (aa)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "鎿嶄綔鎴愬姛!";
+                    mes.data = null;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.Message = "鎿嶄綔澶辫触!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3