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 | 233 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 231 insertions(+), 2 deletions(-)
diff --git a/VueWebApi/Controllers/SystemSettingController.cs b/VueWebApi/Controllers/SystemSettingController.cs
index 1d22ee6..d303ade 100644
--- a/VueWebApi/Controllers/SystemSettingController.cs
+++ b/VueWebApi/Controllers/SystemSettingController.cs
@@ -1,9 +1,13 @@
锘縰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;
+using System.Web;
using System.Web.Http;
using VueWebApi.DLL.BLL;
using VueWebApi.Tools;
@@ -12,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>
@@ -29,7 +35,7 @@
/// <param name="prop">鎺掑簭瀛楁</param>
/// <param name="order">鎺掑簭瑙勫垯</param>
/// <returns></returns>
- [Route(template: "EncodingRules ")]
+ [Route(template: "EncodingRules")]
[HttpGet]
public HttpResponseMessage EncodingRules(string rightname = null, string prefix = null, int page = 0, int rows = 0, string prop = null, string order = null)
{
@@ -55,7 +61,7 @@
string prefix = obj["prefix"].ToString(); //鍥哄畾瀛楃
string filingdate = obj["filingdate"].ToString(); //鎻愪氦鏃ユ湡
string incbit = obj["incbit"].ToString(); //鑷浣嶆暟
- string lm_user = obj["lm_user"].ToString(); //鎿嶄綔浜哄憳
+ var lm_user = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //鎿嶄綔浜哄憳
mes = SystemSettingBLL.SaveEncodingRules(rightcode, rightname,prefix, filingdate, incbit, lm_user);
return TJson.toJson(mes);
}
@@ -75,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