From 777eb41b54602375bf6e7a0f26207f5fbaf27031 Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期一, 06 三月 2023 16:36:33 +0800
Subject: [PATCH] 1.节拍工价新增、编辑加工价类型字段区分自制、外协 2.工序编辑,工序类型切换保存时删除对应节拍工价表 3.工单派发时判断区分自制、外协工序 4.计件工资报表增加剔除工序参数

---
 VueWebApi/Controllers/SystemSettingController.cs |  228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 228 insertions(+), 0 deletions(-)

diff --git a/VueWebApi/Controllers/SystemSettingController.cs b/VueWebApi/Controllers/SystemSettingController.cs
index 10aaf39..d303ade 100644
--- a/VueWebApi/Controllers/SystemSettingController.cs
+++ b/VueWebApi/Controllers/SystemSettingController.cs
@@ -1,6 +1,9 @@
 锘縰sing Newtonsoft.Json.Linq;
 using System;
 using System.Collections.Generic;
+using System.Data;
+using System.Globalization;
+using System.IO;
 using System.Linq;
 using System.Net;
 using System.Net.Http;
@@ -13,11 +16,13 @@
 {
     [RoutePrefix(prefix: "api/SystemSetting")]
     [ControllerGroup("绯荤粺璁剧疆", "鍦ㄧ嚎鎺ュ彛")]
+    [ChannelActionFilter]
     public class SystemSettingController : ApiController
     {
         //瀹氫箟鍏ㄥ眬淇℃伅杩斿洖鍙橀噺
         ToMessage mes = new ToMessage();
         RedisHelper redis = new RedisHelper();
+        string FileIP = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
 
         #region[缂栫爜瑙勫垯鏌ヨ]
         /// <summary>
@@ -76,5 +81,228 @@
            return TJson.toJson(mes);
         }
         #endregion
+
+
+
+        #region[杞﹂棿鍏憡鍒楄〃]
+        /// <summary>
+        /// 杞﹂棿鍏憡鍒楄〃
+        /// </summary>
+        /// <param name="wkspcode">杞﹂棿缂栫爜</param>
+        /// <param name="ancetitle">鍏憡涓婚</param>
+        /// <param name="ancecont">鍏憡鍐呭</param>
+        /// <param name="cancel">鏄惁鎾ら攢</param>
+        /// <param name="level">鍏憡绛夌骇</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "SystemAnnouncementSearch")]
+        [HttpGet]
+        public HttpResponseMessage SystemAnnouncementSearch(string wkspcode = null, string ancetitle = null,string ancecont=null,string cancel=null,string level=null, int page = 0, int rows = 0, string prop = null, string order = null)
+        {
+            int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
+            int endNum = rows * page;   //缁撴潫璁板綍 rowNum
+            mes = SystemSettingBLL.SystemAnnouncementSearch(wkspcode, ancetitle, ancecont, cancel, level, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[杞﹂棿鍏憡鏂板缂栬緫鎻愪氦]
+        /// <summary>
+        /// 杞﹂棿鍏憡鏂板缂栬緫鎻愪氦
+        /// </summary>
+        /// <param name="id">id</param>
+        /// <param name="dt">杞﹂棿闆嗗悎</param>
+        /// <param name="ancetitle">鍏憡涓婚</param>
+        /// <param name="ancecont">鍏憡鍐呭</param>
+        /// <param name="level">鍏憡绛夌骇</param>
+        /// <param name="cancel">鏄惁鎾ら攢</param>
+        /// <param name="opertype">鎿嶄綔绫诲瀷</param>
+        /// <returns></returns>
+        [Route(template: "SystemAnnouncementAddUpdate")]
+        [HttpPost]
+        public HttpResponseMessage SystemAnnouncementAddUpdate(DataTable dt,string ancetitle,string ancecont,string level,string cancel,string opertype, string id = null)
+        {
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            mes = SystemSettingBLL.SystemAnnouncementAddUpdate(id,dt, ancetitle, ancecont, cancel, level, username, opertype);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[杞﹂棿鍏憡鍒犻櫎]
+        /// <summary>
+        /// 杞﹂棿鍏憡鍒犻櫎
+        /// </summary>
+        /// <param name="id">id</param>
+        /// <returns></returns>
+        [Route(template: "SystemAnnouncementDelete")]
+        [HttpPost]
+        public HttpResponseMessage SystemAnnouncementDelete(string id)
+        {
+            mes = SystemSettingBLL.SystemAnnouncementDelete(id);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+
+        #region[SOP鍒楄〃鏌ヨ]
+        /// <summary>
+        /// SOP鍒楄〃鏌ヨ
+        /// </summary>
+        /// <param name="search">鎼滅储鍏抽敭瀛�</param>
+        /// <param name="check">鏄惁閫変腑鏈�楂樼増鏈�</param>
+        /// <param name="page">椤电爜</param>
+        /// <param name="rows">姣忛〉鏄剧ず鏉℃暟</param>
+        /// <param name="prop">鎺掑簭瀛楁</param>
+        /// <param name="order">鎺掑簭瑙勫垯</param>
+        /// <returns></returns>
+        [Route(template: "SystemSopSearch")]
+        [HttpGet]
+        public HttpResponseMessage SystemSopSearch(string search = null, string check = null,int page = 0, int rows = 0, string prop = null, string order = null)
+        {
+            int startNum = rows * (page - 1) + 1;  //璧峰璁板綍rowNum
+            int endNum = rows * page;   //缁撴潫璁板綍 rowNum
+            mes = SystemSettingBLL.SystemSopSearch(search, check, startNum, endNum, prop, order);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[SOP鏂囦欢涓婁紶鏌ユ壘璁惧绫诲瀷鏁版嵁]
+        /// <summary>
+        /// SOP鏂囦欢涓婁紶鏌ユ壘璁惧绫诲瀷鏁版嵁
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "SystemSopDeviceSearch")]
+        [HttpGet]
+        public HttpResponseMessage SystemSopDeviceSearch()
+        {
+            mes = SystemSettingBLL.SystemSopDeviceSearch();
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[SOP鏂囦欢浣滀笟鏂囦欢涓婁紶鑾峰彇鏈�澶х増鏈彿]
+        /// <summary>
+        /// SOP鏂囦欢浣滀笟鏂囦欢涓婁紶鑾峰彇鏈�澶х増鏈彿
+        /// </summary>
+        /// <param name="devicetypecode">璁惧绫诲瀷缂栧彿</param>
+        /// <param name="filetypecode">鏂囦欢绫诲瀷缂栧彿</param>
+        /// <param name="partcode">鐗╂枡缂栫爜</param>
+        /// <returns></returns>
+        [Route(template: "SystemSopMaxVersion")]
+        [HttpGet]
+        public HttpResponseMessage SystemSopMaxVersion(string devicetypecode,string filetypecode,string partcode)
+        {
+            mes = SystemSettingBLL.SystemSopMaxVersion(devicetypecode, filetypecode, partcode);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[SOP鏂囦欢涓婁紶鎻愪氦]
+        /// <summary>
+        /// SOP鏂囦欢涓婁紶鎻愪氦
+        /// </summary>
+        /// <returns></returns>
+        [Route(template: "SystemSopSava")]
+        [HttpPost]
+        public HttpResponseMessage SystemSopSava()
+        {
+            string savePath = "";
+            HttpPostedFile files = HttpContext.Current.Request.Files[0];//鑾峰彇涓婁紶鐨勬枃浠�
+            string devicetypecode = HttpContext.Current.Request["devicetypecode"].ToString();//璁惧绫诲瀷缂栫爜
+            string partcode = HttpContext.Current.Request["partcode"].ToString();//鐗╂枡缂栫爜
+            string filetypecode = HttpContext.Current.Request["filetypecode"].ToString();//鏂囦欢绫诲瀷缂栫爜
+            string fileversion = HttpContext.Current.Request["fileversion"].ToString();//鏂囦欢鐗堟湰鍙�
+            string defilename = HttpContext.Current.Request["defilename"].ToString();//鏂囦欢鍚嶇О
+            var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
+            if (files == null || files.ContentLength <= 0)
+            {
+                mes.code = "300";
+                mes.Message = "鏂囦欢涓嶈兘涓虹┖锛�";
+            }
+            else
+            {
+
+                string file_name = DateTime.Now.ToString("yyyyMMddHHmmss", DateTimeFormatInfo.InvariantInfo) + Path.GetFileName(files.FileName); //鏃堕棿鎴冲姞鏂囦欢鍚�
+                int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
+                string fileEx = System.IO.Path.GetExtension(file_name);//鑾峰彇涓婁紶鏂囦欢鐨勬墿灞曞悕
+                int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
+                string FileType = ".pdf";//瀹氫箟涓婁紶鏂囦欢鐨勭被鍨嬪瓧绗︿覆
+                string FileType1 = ".mp4";//瀹氫箟涓婁紶鏂囦欢鐨勭被鍨嬪瓧绗︿覆
+
+                if (!FileType.Contains(fileEx) && !FileType1.Contains(fileEx))
+                {
+                    mes.code = "300";
+                    mes.Message = "鏂囦欢绫诲瀷涓嶅锛屽彧鑳藉鍏df鏍煎紡鐨勬枃浠跺拰mp4鏍煎紡鏂囦欢锛�";
+                }
+                else
+                {
+                    if (filesize >= Maxsize)
+                    {
+                        mes.code = "300";
+                        mes.Message = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼�!";
+                    }
+                    else
+                    {
+                        string path = System.Web.HttpContext.Current.Server.MapPath("/File/DeviceFile/");
+
+                        if (Directory.Exists(path) == false)//濡傛灉涓嶅瓨鍦ㄥ氨鍒涘缓file鏂囦欢澶�
+                        {
+                            Directory.CreateDirectory(path); //娣诲姞鏂囦欢澶�
+                        }
+                        savePath = Path.Combine(path, file_name);
+                        if (Directory.Exists(savePath) == true)  //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀�
+                        {
+                            mes.code = "300";
+                            mes.Message = "宸插瓨鍦ㄥ悓鍚嶆枃浠�!";
+                        }
+                        else
+                        {
+                            files.SaveAs(savePath);    //灏嗛�夋嫨鐨勬枃浠朵繚瀛樺埌鎸囧畾鏂囦欢澶逛笅
+                            string FilesName = System.Web.HttpContext.Current.Server.MapPath("/File/DeviceFile/" + file_name);
+                            string StrPath = "/File/DeviceFile/" + file_name;
+                            mes = SystemSettingBLL.SystemSopSava(devicetypecode, filetypecode, partcode,fileversion,file_name,defilename,username, StrPath);
+                        }
+                    }
+                }
+            }
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[SOP鏂囦欢鍒犻櫎]
+        /// <summary>
+        /// SOP鏂囦欢鍒犻櫎
+        /// </summary>
+        /// <param name="id">鏂囦欢id</param>
+        /// <param name="filepath">鏂囦欢鍦板潃</param>
+        /// <returns></returns>
+        [Route(template: "SystemSopDelete")]
+        [HttpPost]
+        public HttpResponseMessage SystemSopDelete(string id,string filepath)
+        {
+            mes = SystemSettingBLL.SystemSopDelete(id,filepath);
+            return TJson.toJson(mes);
+        }
+        #endregion
+
+        #region[SOP鏂囦欢棰勮]
+        /// <summary>
+        /// SOP鏂囦欢棰勮
+        /// </summary>
+        /// <param name="id">鏂囦欢id</param>
+        /// <param name="filepath">鏂囦欢鍦板潃</param>
+        /// <returns></returns>
+        [Route(template: "SystemSopView")]
+        [HttpPost]
+        public HttpResponseMessage SystemSopView(string id, string filepath)
+        {
+            mes.code = "200";
+            mes.data = Url.Content(FileIP + filepath);
+            return TJson.toJson(mes);
+        }
+        #endregion
     }
 }

--
Gitblit v1.9.3