using System; using System.Data; using System.IO; using System.Web; using System.Web.Mvc; using NFine.Code; using System.Data.SqlClient; using NFine.Data.Extensions; using System.Collections.Generic; using Newtonsoft.Json; using NFine.Application; //using System.Web.Http; namespace NFine.Web.Areas.SRM.Controllers { public class BasicSettingsController : ControllerBase { BasicSettingsApp App = new BasicSettingsApp(); /// /// 加载仓库 /// /// [HttpGet] public ActionResult Warehouse() { return View(); } /// /// 加载库位 /// /// [HttpGet] public ActionResult ICSStackWMS() { return View(); } /// /// 物料档案 /// /// [HttpGet] public ActionResult ICSINVENTORY() { return View(); } /// /// 不良代码组 /// /// [HttpGet] public ActionResult ICSECG() { return View(); } /// /// 加载仓库 /// /// [HttpGet] public ActionResult WarehouseApplyNegAdd() { return View(); } /// /// 加载仓库 /// /// [HttpGet] public ActionResult WarehouseApplyNegUpdate() { return View(); } /// /// /// /// [HttpGet] public ActionResult ICSVenderAdd() { return View(); } /// /// /// /// [HttpGet] public ActionResult ICSDepartmentAdd() { return View(); } /// /// 获取料品信息 /// /// /// [HttpGet] public ActionResult GetICSWarehouseInfoId(string ID, Pagination pagination) { DataTable ListData = App.GetICSWarehouseInfoId(ID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] public ActionResult ICSSDN() { return View(); } /// /// 不良代码维护 /// /// [HttpGet] public ActionResult ICSBadCode() { return View(); } /// /// 新增库位信息 /// /// [HttpGet] public ActionResult ICSStackWMSAdd() { return View(); } [HttpGet] /// /// 标签模板维护 /// /// public ActionResult ICSLableManage() { return View(); } public ActionResult ICSLableManageAdd() { return View(); } /// /// 新增不良代码 /// /// public ActionResult ICSBadCodeAdd() { return View(); } /// /// 类型维护 /// /// public ActionResult ICSTypeMaintain() { return View(); } /// /// 站点维护 /// /// public ActionResult Sys_WorkPoint() { return View(); } /// /// 新增站点 /// /// public ActionResult Sys_WorkPointAdd() { return View(); } /// 新增类型 /// /// [HttpGet] public ActionResult ICSTypeMaintainAdd() { return View(); } /// /// 配置参数维护 /// /// public ActionResult ICSConfiguration() { return View(); } /// /// 启用配置 /// /// public ActionResult ICSExtensionEnable() { return View(); } /// /// 单据启用配置 /// /// public ActionResult ICSColumnEnable() { return View(); } /// /// 新增启用配置 /// /// public ActionResult ICSExtensionEnableAdd() { return View(); } /// /// 新增单据启用配置 /// /// public ActionResult ICSColumnEnableAdd() { return View(); } /// 新增类型 /// /// [HttpGet] public ActionResult ICSConfigurationAdd() { return View(); } /// 不良原因组 /// /// [HttpGet] public ActionResult ICSBadReasonGroup() { return View(); } /// 新增不良原因组 /// /// [HttpGet] public ActionResult ICSBadReasonGroupAdd() { return View(); } /// 新增不良原因组 /// /// [HttpGet] public ActionResult ICSInventoryBadGroupAdd() { return View(); } //包装容器绑定 [HttpGet] public ActionResult ICSContainerBinding() { return View(); } //维护条码过期时间 [HttpGet] public ActionResult MaintainBarcodeTime() { return View(); } //维护条码过期时间 [HttpGet] public ActionResult MaintainBarcodeTimeUpdate() { return View(); } //维护批次过期时间 [HttpGet] public ActionResult MaintainBatchTime() { return View(); } //维护批次过期时间 [HttpGet] public ActionResult MaintainBatchTimeUpdate() { return View(); } //多语言 [HttpGet] public ActionResult ICSlanguage() { return View(); } [HttpGet] public ActionResult ICSlanguageAdd() { return View(); } [HttpGet] public ActionResult ICSInventoryInspectionRulesGroup() { return View(); } [HttpGet] public ActionResult ICSInventoryInspectionRulesGroupAdd() { return View(); } /// /// 检验规则 /// /// [HttpGet] public ActionResult ICSInspectionRulesGroup() { return View(); } [HttpGet] public ActionResult ICSInspectionRulesListAdd() { return View(); } [HttpGet] //不良代码 public ActionResult GetICSBadCodeGroup(Pagination pagination, string queryJson) { DataTable ListData = App.GetICSBadCodeGroup(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //不良原因() public ActionResult GetICSBadReasonGroup(Pagination pagination, string queryJson) { DataTable ListData = App.GetICSBadReasonGroup(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //不良代码子表 [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSBadCodeGroupdetil(string ID, Pagination pagination) { DataTable ListData = App.GetICSBadCodeGroupdetil(ID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] public ActionResult GetICSBadCodeGroupdetil2(string ID, Pagination pagination) { var data = App.GetICSBadCodeGroupdetil2(ID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = data, }; return Content(JsonData.ToJson()); } //不良原因子表 [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSBadReason(string BRGroupID, Pagination pagination) { DataTable ListData = App.GetICSBadReason(BRGroupID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] public ActionResult GetICSBadReason2(string BID, Pagination pagination) { var ListData = App.GetICSBadReason2(BID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); //return Content(data.ToJson()); } [HttpGet] public ActionResult ICSInspectionGroup() { return View(); } [HttpGet] public ActionResult ICSInspectionListAdd() { return View(); } [HttpGet] public ActionResult ICSINVEBTORYAdd() { return View(); } [HttpGet] public ActionResult ICSInventoryBatchEnable() { return View(); } [HttpGet] public ActionResult ICSInventoryBatchEnableAdd() { return View(); } [HttpGet] public ActionResult ICSInventoryBatchEnableUpadte() { return View(); } [HttpGet] public ActionResult ICSInventoryLocation() { return View(); } [HttpGet] public ActionResult ICSInventoryLocationAdd() { return View(); } [HttpGet] public ActionResult ICSInventoryLocationUpdate() { return View(); } [HttpGet] public ActionResult ICSContainer() { return View(); } [HttpGet] public ActionResult ICSContainerAdd() { return View(); } [HttpGet] public ActionResult ICSContainerLot() { return View(); } [HttpGet] public ActionResult ICSContainerLotAdd() { return View(); } [HttpGet] public ActionResult ICSInventoryBadGroup() { return View(); } [HttpGet] public ActionResult ICSInventoryBadGroupUpdate() { return View(); } [HttpGet] public ActionResult ICSLabelTemplate() { return View(); } [HttpGet] public ActionResult ICSLabelTemplateAdd() { return View(); } [HttpGet] public ActionResult ICSContainerLotBinding() { return View(); } //料品检验项目组 [HttpGet] public ActionResult ICSInventoryInspectionGroup() { return View(); } [HttpGet] public ActionResult ICSInventoryInspectionGroupAdd() { return View(); } [HttpGet] public ActionResult ICSSearchInventory() { return View(); } [HttpGet] public ActionResult Sys_WorkPointClone() { return View(); } public ActionResult CleanUpTableData() { return View(); } /// /// 删除库位 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteStack(string keyValue) { string msg = App.DeleteStack(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); //throw new Exception(msg); } } /// /// 删除不良原因 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteBadCode(string keyValue) { string msg = App.DeleteBadCode(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpPost] [HandlerAjaxOnly] public ActionResult InsertStack(string keyValue) { string msg = App.InsertStack(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } [HttpPost] [HandlerAjaxOnly] public ActionResult InsertBadCode(string keyValue) { string msg = App.InsertBadCode(keyValue); try { if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } catch (Exception ex) { return Error(ex.Message); } } [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateBadCode(string keyValue) { string msg = App.UpdateBadCode(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateStack(string keyValue) { string msg = App.UpdateStack(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 获取库位信息 /// /// public ActionResult GetWarehouse() { DataTable dt = App.GetWarehouse(); return Content(dt.ToJson()); } /// /// 新增类型 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSType(string keyValue) { string msg = App.InsertICSType(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改类型 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSType(string keyValue) { string msg = App.UpdateICSType(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 删除类型 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSType(string keyValue) { string msg = App.DeleteICSType(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 修改配置参数 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSConfiguration(string keyValue) { string msg = App.UpdateICSConfiguration(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 新增参数配置 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSConfiguration(string keyValue) { string msg = App.InsertICSConfiguration(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 删除参数配置 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSConfiguration(string keyValue) { string msg = App.DeleteICSConfiguration(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 修改启用配置 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSExtensionEnable(string keyValue) { string msg = App.UpdateICSExtensionEnable(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 修改启用配置 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSColumnEnable(string keyValue) { string msg = App.UpdateICSColumnEnable(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 新增启用配置 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSExtensionEnable(string keyValue) { string msg = App.InsertICSExtensionEnable(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 新增单据启用配置 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSColumnEnable(string keyValue) { string msg = App.InsertICSColumnEnable(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 删除启用配置 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSExtensionEnable(string keyValue) { string msg = App.DeleteICSExtensionEnable(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 删除单据启用配置 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSColumnEnable(string keyValue) { string msg = App.DeleteICSColumnEnable(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpGet] public ActionResult DeleteBCItem(string ID) { try { App.DeleteBCItem(ID); return Success("删除成功!"); } catch (Exception ex) { return Error(ex.Message); } } [HttpGet] public ActionResult DeleteINvItem(string ID) { try { App.DeleteItem(ID); return Success("删除成功!"); } catch (Exception ex) { return Error(ex.Message); } } /// /// 删除不良代码组 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSBadCodeGroup(string keyValue) { string msg = App.DeleteICSBadCodeGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 删除不良原因组 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSBadReasonGroup(string keyValue) { string msg = App.DeleteICSBadReasonGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpGet] public ActionResult GetICSInspectionGroup(Pagination pagination, string queryJson) { DataTable ListData = App.GetICSInspectionGroup(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult ICSInspectionList(string GroupCode, Pagination pagination) { DataTable ListData = App.ICSInspectionList(GroupCode, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //删除自动表 [HttpGet] public ActionResult DeleteList(string ID) { try { App.DeleteList(ID); return Success("删除成功!"); } catch (Exception ex) { return Error(ex.Message); } } /// /// 动态子表修改加载页面 /// /// /// [HttpGet] public ActionResult ICSInspectionList2(string GroupCode) { var data = App.ICSInspectionList2(GroupCode); return Content(data.ToJson()); } /// /// 删除不良原因组 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInspectionGroup(string keyValue) { string msg = App.DeleteICSInspectionGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 新增料品属性 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSInventory(string keyValue) { string msg = App.InsertICSInventory(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改料品属性 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSInventory(string keyValue) { string msg = App.UpdateICSInventory(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 新增部门 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSDeptment(string keyValue) { string msg = App.InsertICSDeptment(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改部门 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSDeptment(string keyValue) { string msg = App.UpdateICSDeptment(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 删除部门 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSDeptment(string keyValue) { string msg = App.DeleteICSDeptment(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 修改PDA版本 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdatePDAVersion(string keyValue) { string msg = App.UpdatePDAVersion(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 获取料品属性修改文本框值 /// /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult GetInputValue(string ID) { DataTable ListData = App.GetInputValue(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 获取部门修改文本框值 /// [HttpPost] [HandlerAjaxOnly] public ActionResult GetDepInputValue(string ID) { DataTable ListData = App.GetDepInputValue(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 删除料品属性 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInventory(string keyValue) { string msg = App.DeleteICSInventory(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 获取料品信息 /// /// /// [HttpGet] public ActionResult GetICSInventoryInfo(string queryJson, Pagination pagination) { DataTable ListData = App.GetICSInventoryInfo(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// 获取仓库信息 /// /// /// [HttpGet] public ActionResult GetICSWarehouseInfo(string queryJson, Pagination pagination) { DataTable ListData = App.GetICSWarehouseInfo(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 新增料品仓库批次 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSInventoryBatchEnable(string keyValue, string keyValue2) { string msg = App.InsertICSInventoryBatchEnable(keyValue, keyValue2); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改料品仓库批次关系 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSInventoryBatchEnable(string keyValue) { string msg = App.UpdateICSInventoryBatchEnable(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 删除料品仓库批次关系 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInventoryBatchEnable(string keyValue) { string msg = App.DeleteICSInventoryBatchEnable(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// 获取库位信息 /// /// /// [HttpGet] public ActionResult GetICSLocation(string queryJson, Pagination pagination) { DataTable ListData = App.GetICSLocation(queryJson, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 新增料品库位绑定关系 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSInventoryLocation(string keyValue, string keyValue2) { string msg = App.InsertICSInventoryLocation(keyValue, keyValue2); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改料品库位绑定关系 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSInventoryLocation(string keyValue) { string msg = App.UpdateICSInventoryLocation(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 删除料品仓库批次关系 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInventoryLocation(string keyValue) { string msg = App.DeleteICSInventoryLocation(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 新增包装、容器 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSContainer(string keyValue) { string msg = App.InsertICSContainer(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改包装、容器 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSContainer(string keyValue) { string msg = App.UpdateICSContainer(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 新增包装、容器 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSContainerLot(string keyValue) { string msg = App.InsertICSContainerLot(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改包装、容器 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSContainerLot(string keyValue) { string msg = App.UpdateICSContainerLot(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 获取物料信息 /// /// public ActionResult GetInvCode() { DataTable dt = App.GetInvCode(); return Content(dt.ToJson()); } /// /// 获取不良代码信息 /// /// public ActionResult GetBCGroup() { DataTable dt = App.GetBCGroup(); return Content(dt.ToJson()); } /// /// 获取不良原因信息 /// /// public ActionResult BRGroupID() { DataTable dt = App.BRGroupID(); return Content(dt.ToJson()); } [HttpPost] [HandlerAjaxOnly] public ActionResult InsertInventoryBadGroup(string keyValue) { string msg = App.InsertInventoryBadGroup(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateInventoryBadGroup(string keyValue) { string msg = App.UpdateInventoryBadGroup(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 删除料品不良信息 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteInventoryBadGroup(string keyValue) { string msg = App.DeleteInventoryBadGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } #region 打印 /// /// 打印数据参数:服务器的URL+打印的文件名,转化为Base64编码 /// protected string strPrintData; /// /// 标识是否安装了控件 /// protected bool bIsInstallPrintControl = true; /// /// 打印控件的Cookie值 /// protected string strPrintControlCookie = ""; /// /// 获取Url中去掉文件名的路径 /// /// private string GetUrlPath() { string strUrl = Request.Url.ToString(); int iEnd = strUrl.LastIndexOf("/"); strUrl = strUrl.Substring(0, iEnd + 1); return strUrl; } /// /// 设置控件调用的Cookie值,判断是否安装了打印控件 /// /// private void SetCookieAndURL(PrintJson pJson) { bIsInstallPrintControl = false; strPrintControlCookie = ""; HttpCookie pCookieInstall = Request.Cookies["InstallPrintControl"]; if (pCookieInstall != null) { //Cookie存在 strPrintControlCookie = pCookieInstall.Value.ToString(); //以Cookie值查找在数据表中是否存在 string strSql = @"Select * From sys_SRM_CheckInstall Where Cookie = @Cookie"; SqlParameter[] pmcCookie = { new SqlParameter("Cookie", strPrintControlCookie) }; using (SqlDataReader drCookie = DbHelper.ExecuteReader(DbHelper.ConnectionString, CommandType.Text, strSql, pmcCookie)) { if (drCookie.Read()) { //标识为已经安装 bIsInstallPrintControl = true; } drCookie.Close(); } //更新Cookie的保存时间 pCookieInstall.Expires = DateTime.Now.AddYears(10); Response.SetCookie(pCookieInstall); } else {//Cookie不存在,则新建Cookie strPrintControlCookie = System.Guid.NewGuid().ToString(); pCookieInstall = new HttpCookie("InstallPrintControl", strPrintControlCookie); pCookieInstall.Expires = DateTime.Now.AddYears(10); Response.Cookies.Add(pCookieInstall); } string strUrl = Server.MapPath("/PrintTemp/") + "IsCheckInstall"; pJson.SetCookieAndURL(strPrintControlCookie, strUrl); } [HttpPost] [HandlerAjaxOnly] public ActionResult PrintStack(string keyValue) { keyValue = keyValue.Substring(1, keyValue.Length - 2); string strPrintFileName = Server.MapPath("/ReportFile/") + "Stack.fr3"; PrintJson pJson = new PrintJson(Server.MapPath("./PrintTemp"), strPrintFileName); pJson.CheckRegister("苏州智合诚信息科技有限公司", "56DD3B4C172D0D140841CAC98A58A819F4E28EDA5D6E45711DDD64F6A439F68B6A7870CD7DAFD69A919CB870207FE4BB206F92BE3D53C221B019E0797E739EBA4"); //注册信息 pJson.MasterOptions(1, "STNO", false); //主从关系 SetCookieAndURL(pJson);// 设置控件调用的Cookie值,判断是否安装了打印控件 string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location; string strSql = @"select a.LocationCode, a.ID, a.LocationName, b.WarehouseCode, b.WarehouseName, a.Musername as 'MUSER', a.MTIME from ICSLocation a WITH (NOLOCK) inner join ICSWarehouse b WITH (NOLOCK) on a.WHID=b.ID where 1=1 and a.ID IN (" + keyValue.TrimEnd(',') + ")"; DataTable dtInInfo = DbHelper.ExecuteTable(DbHelper.ConnectionString, CommandType.Text, strSql, true, null); // strSql = @"SELECT Row_Number() OVER (partition BY a.STNO ORDER BY a.CREATETIME DESC) AS rowno,c.STNO, // c.PLANQTY,c.LotnoQTY,c.CartonNOQTY,c.ITEMCODE,b.INVNAME,b.INVSTD,b.INVPARSETYPE,d.StorageName, // CONVERT(VARCHAR,CAST(ISNULL(c.Qty,0) AS money),1) AS Qty, // CONVERT(VARCHAR,CAST(ISNULL(c.Meters,0) AS money),1) AS Meters, // c.STNO AS QRSTNO,c.TransNO,c.TransLine,c.MEMO,c.VenderLotNO,CONVERT(varchar(10), c.PRODUCTDATE, 23) as PRODUCTDATE,a.remark // FROM // (SELECT aa.STNO,aa.ITEMCODE,aa.WorkPoint,SUM(aa.PLANQTY) PLANQTY,SUM(cc.LOTQTY) Qty, // SUM(ISNULL(cc.Meters,0)) Meters,cc.TransNO,cc.TransLine,dd.MEMO,cc.VenderLotNO,cc.PRODUCTDATE, // COUNT(aa.LOTNO) LotnoQTY,COUNT(bb.CartonNO) CartonNOQTY // FROM ICSASNDETAIL aa // LEFT JOIN ICSITEMLot2Carton bb ON aa.LOTNO = bb.LotNO AND aa.WorkPoint = bb.WorkPoint // LEFT JOIN ICSITEMLot cc ON aa.LOTNO = cc.LotNO AND aa.WorkPoint = cc.WorkPoint // LEFT JOIN ICSPO_PoMain dd on dd.POCode=cc.TransNO and dd.PORow=cc.TransLine // GROUP BY aa.stno,aa.itemcode,aa.WorkPoint,cc.TransNO,cc.TransLine,dd.MEMO,cc.VenderLotNO,cc.PRODUCTDATE) c // LEFT JOIN ICSASN a on c.stno=a.stno AND c.WorkPoint=a.WorkPoint // LEFT JOIN dbo.ICSINVENTORY b ON c.ITEMCODE=b.INVCODE AND b.WorkPoint=c.WorkPoint // LEFT JOIN dbo.icsstorage d ON b.INVMACHINETYPE=d.StorageCode // WHERE c.STNO IN (" + keyValue.TrimEnd(',') + ") and c.WorkPoint='" + WorkPoint + "'"; // DataTable dtInMaterial = DbHelper.ExecuteTable(DbHelper.ConnectionString, CommandType.Text, strSql, true, null); string strPrintTempFile = pJson.ShowReport(dtInInfo, null); //产生JSON文件内容 //把服务器的URL + 此文件名 传递给控件,由控件下载还原数据进行打印 string strServerURL = Server.MapPath("/PrintTemp/"); string strData = strServerURL + strPrintTempFile; strPrintData = PrintFunction.EnBase64(strData); var JsonData = new { strPrintData_1 = strPrintData, bIsInstallPrintControl_1 = bIsInstallPrintControl, strPrintControlCookie_1 = strPrintControlCookie }; // string sql = @"UPDATE dbo.ICSASN // SET ADDITION1=ISNULL(ADDITION1,0)+1, // ADDITION2=CONVERT(varchar(100), GETDATE(), 21) // WHERE STNO in (" + keyValue.TrimEnd(',') + ") and WorkPoint='" + WorkPoint + "'"; // SqlHelper.ExecuteNonQuery(sql); return Content(JsonData.ToJson()); } /// /// 写日志(用于跟踪) /// private void WriteLog(string strMessage) { string strLogFile = Server.MapPath("./Cookie_Log.txt"); StreamWriter swLogFile = null; try { if (!System.IO.File.Exists(strLogFile)) { swLogFile = System.IO.File.CreateText(strLogFile); } else { swLogFile = System.IO.File.AppendText(strLogFile); } swLogFile.WriteLine(strMessage); } catch { } finally { if (swLogFile != null) swLogFile.Close(); } } /// ///判断数据表中是否存在,若不存在则新建一条记录,若存在则更新最后访问的时间 /// /// private void UpdateCheckInstall(string strCookie) { bool bIsExist = false; //判断记录是否存在 GetLastAccessTime(strCookie, ref bIsExist); string strSql = ""; SqlParameter[] pmcCookie = { new SqlParameter("Cookie", strCookie) }; if (bIsExist) { //存在则更新最后访问的时间 strSql = @"Update sys_SRM_CheckInstall Set LastAccessTime = getDate() Where Cookie = @Cookie"; } else { //不存在则新建一条记录 strSql = @"Insert into sys_SRM_CheckInstall(Cookie, LastAccessTime) Values( @Cookie, getDate() )"; } DbHelper.ExecuteNonQuery(DbHelper.ConnectionString, CommandType.Text, strSql, pmcCookie); } public DateTime ToDateTime(object SrcValue) { if (Convert.IsDBNull(SrcValue) == true) return DateTime.MinValue; else { try { return Convert.ToDateTime(SrcValue); } catch { return DateTime.MinValue; } } } /// /// 获取此Cookie的最后访问时间 /// /// /// private DateTime GetLastAccessTime(string strCookie, ref bool bIsExist) { DateTime dtLastAccessTime = DateTime.MinValue; bIsExist = false; string strSql = @"Select * From sys_SRM_CheckInstall Where Cookie = @Cookie"; SqlParameter[] pmcCookie = { new SqlParameter("Cookie", strCookie) }; using (SqlDataReader drCookie = DbHelper.ExecuteReader(DbHelper.ConnectionString, CommandType.Text, strSql, pmcCookie)) { if (drCookie.Read()) { dtLastAccessTime = ToDateTime(drCookie["LastAccessTime"]); bIsExist = true; } drCookie.Close(); } return dtLastAccessTime; } [HttpGet] [HandlerAjaxOnly] public ActionResult IsCheckInstall(string checkInstall) { string strValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss 访问,"); if (Request.QueryString["cookie"] != null) { //有控件上传的Cookie值 string strCookie = Request.QueryString["cookie"].ToString(); //判断数据表中是否存在,若不存在则新建一条记录,若存在则更新最后访问的时间 UpdateCheckInstall(strCookie); strValue = strValue + "上传的cookie:" + strCookie; } else if (checkInstall != null) {//Ajax检查控件是否安装了,防止那种客户把打印控件卸装了,打印时无法检测到的情况 string strCookie = checkInstall; //读取最后访问的时间 string strResult = "PrintControlInstall"; bool bIsExist = false; DateTime dtLastAccessTime = GetLastAccessTime(strCookie, ref bIsExist); if (!bIsExist || dtLastAccessTime.AddSeconds(30) < DateTime.Now) { strResult = "NOT"; } Response.Clear(); Response.Write(strResult); strValue = strValue + "检测安装的值:" + strCookie; } WriteLog(strValue); return null; } [HttpGet] [HandlerAjaxOnly] public ActionResult IsCheckInstall() { string strValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss 访问,"); if (Request.QueryString["cookie"] != null) { //有控件上传的Cookie值 string strCookie = Request.QueryString["cookie"].ToString(); //判断数据表中是否存在,若不存在则新建一条记录,若存在则更新最后访问的时间 UpdateCheckInstall(strCookie); strValue = strValue + "上传的cookie:" + strCookie; } else if (Request.QueryString["checkInstall"] != null) {//Ajax检查控件是否安装了,防止那种客户把打印控件卸装了,打印时无法检测到的情况 string strCookie = Request.QueryString["checkInstall"]; //读取最后访问的时间 string strResult = "PrintControlInstall"; bool bIsExist = false; DateTime dtLastAccessTime = GetLastAccessTime(strCookie, ref bIsExist); if (!bIsExist || dtLastAccessTime.AddSeconds(30) < DateTime.Now) { strResult = "NOT"; } Response.Clear(); Response.Write(strResult); strValue = strValue + "检测安装的值:" + strCookie; } WriteLog(strValue); return null; } #endregion [HttpGet] [HandlerAjaxOnly] public ActionResult GetTXT(string ID) { DataTable ListData = App.GetTXT(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } //修改标签数据源 [HttpPost] [HandlerAjaxOnly] public ActionResult updateLableDataSource(string Sys_LableDataSource) { string msg = App.updateLableDataSource(Sys_LableDataSource); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteLableDataSource(string keyValue) { string msg = App.DeleteLableDataSource(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetLableType() { DataTable dt = App.GetLableType(); return Content(dt.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetSys_LablesID() { DataTable dt = App.GetSys_LablesID(); return Content(dt.ToJson()); } //新增标签数据源 [HttpPost] [HandlerAjaxOnly] public ActionResult CreateLables(string txtLableName, string sel_LableType, string sel_LableSourceID) { string msg = App.CreateLables(txtLableName, sel_LableType, sel_LableSourceID); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetLabelTXT(string ID) { DataTable ListData = App.GetLabelTXT(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpPost] [HandlerAjaxOnly] public ActionResult updateLables(string ID, string txtLableName, string sel_LableType, string sel_LableSourceID) { string msg = App.updateLables(ID, txtLableName, sel_LableType, sel_LableSourceID); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSLabelTemplate(string keyValue) { string msg = App.DeleteICSLabelTemplate(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } //获取父容器 [HttpGet] [HandlerAjaxOnly] public ActionResult GetContainerID() { DataTable dt = App.GetContainerID(); return Content(dt.ToJson()); } //获取父容器 [HttpGet] [HandlerAjaxOnly] public ActionResult GetContainerType() { DataTable dt = App.GetContainerType(); return Content(dt.ToJson()); } [HttpPost] public ActionResult UpLoadLabelFile() { //获取上传的文件集合 HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files; //获取送货单号 string ID = Request.Form["ID"].ToString(); string LableName = Request.Form["LableName"].ToString(); string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName) + "_" + LableName + Path.GetExtension(httpFile[0].FileName); string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\LablesFile\\" + fileName); int iLen = httpFile[0].ContentLength; byte[] bData = new byte[iLen]; httpFile[0].InputStream.Read(bData, 0, iLen); FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate); fs.Write(bData, 0, bData.Length); fs.Flush(); fs.Close(); fs.Dispose(); int count = App.UpLoadLabelFile(ID, fileName); if (count > 0) { return Success("上传成功!"); } else { return Error("上传失败"); } } [HttpPost] public ActionResult UpLoadFileTxT() { //获取上传的文件集合 HttpFileCollection httpFile = System.Web.HttpContext.Current.Request.Files; //获取送货单号 string LotNo = Request.Form["LotNo"].ToString(); string fileName = Path.GetFileNameWithoutExtension(httpFile[0].FileName) + Path.GetExtension(httpFile[0].FileName); string filePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + fileName); int iLen = httpFile[0].ContentLength; byte[] bData = new byte[iLen]; httpFile[0].InputStream.Read(bData, 0, iLen); FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate); fs.Write(bData, 0, bData.Length); fs.Flush(); fs.Close(); fs.Dispose(); int count = App.UpLoadFiles(LotNo, fileName); if (count > 0) { return Success("上传成功!"); } else { return Error("上传失败"); } } //包装容器 public ActionResult GetSendContainer(Pagination pagination, string queryJson) { DataTable ListData = App.GetSendContainer(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetContainerInfo(string Code) { DataTable ListData = App.GetContainerInfo(Code); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetBindContainerID(string SireCode) { DataTable ListData = App.GetBindContainerID(SireCode); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } //包装容器关联条码 public ActionResult GetSendContainerLot(Pagination pagination, string queryJson) { DataTable ListData = App.GetSendContainerLot(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetContainerLotInfo(string LotNo) { DataTable ListData = App.GetContainerLotInfo(LotNo); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 删除站点 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteWorkPoint(string keyValue) { string msg = App.DeleteWorkPoint(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSInventoryLotInfo(string ID) { DataTable ListData = App.GetICSInventoryLotInfo(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSBatchInfo(string BatchCode, string INVCode) { DataTable ListData = App.GetICSBatchInfo(BatchCode, INVCode); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult UpdateExpirationDate(string ID, string ExpirationDate, string Inv, string LotNo, string InvCode, string Quantity) { int i = App.UpdateExpirationDate(ID, ExpirationDate, Inv, LotNo, InvCode, Quantity); if (i > 0) { return Success("维护成功!"); } else { return Error("维护失败!"); } } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult UpdateBatchExpirationDate(string ExpirationDate, string BatchCode, string InvCode) { try { int i = App.UpdateBatchExpirationDate(ExpirationDate, BatchCode, InvCode); if (i > 0) { return Success("维护成功!"); } else { return Error("维护失败!"); } } catch (Exception ex) { return Error(ex.Message); } } //修改多语言 [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateSys_Language(string keyValue) { string msg = App.UpdateSys_Language(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } //新增多语言 [HttpPost] [HandlerAjaxOnly] public ActionResult InsertSys_Language(string keyValue) { string msg = App.InsertSys_Language(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetSys_Language(string ID) { DataTable ListData = App.GetSys_Language(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteSys_Language(string keyValue) { string msg = App.DeleteSys_Language(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } //料品检验明细 public ActionResult GetICSInventoryInspectionGroup(Pagination pagination, string queryJson) { DataTable ListData = App.GetICSInventoryInspectionGroup(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //料品检验明细子表 [HttpGet] [HandlerAjaxOnly] public ActionResult ICSInventoryInspectionList(string ID, Pagination pagination) { DataTable ListData = App.ICSInventoryInspectionList(ID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //删除料品检验明细子表 [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInventoryInspectionGroup(string keyValue) { string msg = App.DeleteICSInventoryInspectionGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } //查询物料 [HttpGet] public ActionResult GetINv(string invcode, Pagination pagination) { DataTable ListData = App.Getinv(invcode, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetGroupCode() { DataTable dt = App.GetGroupCode(); return Content(dt.ToJson()); } [HttpGet] public ActionResult DeleteItem(string ID) { try { App.DeleteItem(ID); return Success("删除成功!"); } catch (Exception ex) { return Error(ex.Message); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSInventoryInspectionList(string BRGCode, Pagination pagination) { DataTable ListData = App.GetICSInventoryInspectionList(BRGCode, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetInspectionListInfo(string ID) { DataTable ListData = App.GetInspectionListInfo(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] public ActionResult GetICSInventoryInspectionList2(string BID) { var data = App.GetICSInventoryInspectionList2(BID); return Content(data.ToJson()); } //料品不良组导入 [HttpPost] /// /// 文件上传到本地 /// public string UploadFileInvBadGroup() { try { HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files; if (hpFiles != null && hpFiles.Count > 0) { string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回 } string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数 string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径 int iLen = hpFiles[0].ContentLength; if (Directory.Exists(savePath)) return "文件已存在"; byte[] bData = new byte[iLen]; hpFiles[0].InputStream.Read(bData, 0, iLen); FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate); newFile.Write(bData, 0, bData.Length); newFile.Flush(); int _FileSizeTemp = hpFiles[0].ContentLength; newFile.Close(); newFile.Dispose(); //bool del = false; string mess = ""; mess = App.UploadFileInvBadGroup(savePath); if (System.IO.File.Exists(savePath))//删除文件 { System.IO.File.Delete(savePath); } return mess; } else { return "获取文件失败"; } } catch (Exception ex) { return ex.ToString(); } } //根据ID获取其他站点 public ActionResult GetWorkPointNotInID(string WorkPointCode) { DataTable dt = App.GetWorkPointNotInID(WorkPointCode); return Content(dt.ToJson()); } //克隆站点 [HttpPost] [HandlerAjaxOnly] public ActionResult CloneWorkPointByCode(string WorkPoint, string WorkPointCode) { string msg = App.CloneWorkPointByCode(WorkPoint, WorkPointCode); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } [HttpPost] [HandlerAjaxOnly] public ActionResult DeleteTableByCode(string TableCode) { string msg = App.DeleteTableByCode(TableCode); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 获取抽样规则子表 /// /// /// /// [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSInspectionRulesList(string GroupCode, Pagination pagination) { DataTable ListData = App.GetICSInspectionRulesList(GroupCode, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 动态子表修改加载页面 /// /// /// [HttpGet] public ActionResult GetICSInspectionRulesList2(string RulesCode) { var data = App.GetICSInspectionRulesList2(RulesCode); return Content(data.ToJson()); } [HttpGet] public ActionResult GetICSInspectionRulesGroup(Pagination pagination, string queryJson) { DataTable ListData = App.GetICSInspectionRulesGroup(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 删除抽检规则 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInspectionRulesGroup(string keyValue) { string msg = App.DeleteICSInspectionRulesGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 获取抽样规则子表 /// /// /// /// [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSInspectionRulesListBYCode(string RulesCode, Pagination pagination) { DataTable ListData = App.GetICSInspectionRulesListBYCode(RulesCode, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //料品不良组导入 [HttpPost] /// /// 文件上传到本地 /// public string UploadFileInspectionRulesList() { try { HttpFileCollection hpFiles = System.Web.HttpContext.Current.Request.Files; if (hpFiles != null && hpFiles.Count > 0) { string IsXls = System.IO.Path.GetExtension(hpFiles[0].FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls" && IsXls != ".xlsx") { return "只可以选择Excel(.xls .xlsx)文件";//当选择的不是Excel文件时,返回 } string filename = DateTime.Now.ToString("yyyyMMddhhmmss") + Guid.NewGuid() + IsXls; //获取Execle文件名 DateTime日期函数 string savePath = System.Web.HttpContext.Current.Server.MapPath("~\\File\\UPLoadFile\\" + filename);//Server.MapPath 获得虚拟服务器相对路径 int iLen = hpFiles[0].ContentLength; if (Directory.Exists(savePath)) return "文件已存在"; byte[] bData = new byte[iLen]; hpFiles[0].InputStream.Read(bData, 0, iLen); FileStream newFile = new FileStream(savePath, FileMode.OpenOrCreate); newFile.Write(bData, 0, bData.Length); newFile.Flush(); int _FileSizeTemp = hpFiles[0].ContentLength; newFile.Close(); newFile.Dispose(); //bool del = false; string mess = ""; mess = App.UploadFileInspectionRulesList(savePath); if (System.IO.File.Exists(savePath))//删除文件 { System.IO.File.Delete(savePath); } return mess; } else { return "获取文件失败"; } } catch (Exception ex) { return ex.ToString(); } } //物料抽检规则绑定明细 public ActionResult GetICSInventoryInspectionRulesGroup(Pagination pagination, string queryJson) { DataTable ListData = App.GetICSInventoryInspectionRulesGroup(ref pagination, queryJson); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } ///物料抽检规则绑定明细子表 [HttpGet] [HandlerAjaxOnly] public ActionResult ICSInventoryInspectionRulesList(string ID, Pagination pagination) { DataTable ListData = App.ICSInventoryInspectionRulesList(ID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } //删除物料抽检规则绑定明细 [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSInventoryInspectionRulesGroup(string keyValue) { string msg = App.DeleteICSInventoryInspectionRulesGroup(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpGet] [HandlerAjaxOnly] public ActionResult GetRulesName() { DataTable dt = App.GetRulesName(); return Content(dt.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetInspectionListInfoByRules(string ID) { DataTable ListData = App.GetInspectionListInfoByRules(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSInventoryInspectionRulesList(string BID, Pagination pagination) { DataTable ListData = App.GetICSInventoryInspectionRulesList(BID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetICSInventoryInspectionRulesList2(string BID, Pagination pagination) { DataTable ListData = App.GetICSInventoryInspectionRulesList2(BID, ref pagination); var JsonData = new { total = pagination.total, page = pagination.page, records = pagination.records, rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 删除供应商 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSVender(string keyValue) { string msg = App.DeleteICSVender(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } /// /// 获取供应商修改文本框值 /// [HttpPost] [HandlerAjaxOnly] public ActionResult GetVenderInputValue(string ID) { DataTable ListData = App.GetVenderInputValue(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 新增部门 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSVender(string keyValue) { string msg = App.InsertICSVender(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改供应商 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSVender(string keyValue) { string msg = App.UpdateICSVender(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 获取仓库修改文本框值 /// [HttpPost] [HandlerAjaxOnly] public ActionResult GetWareHouseInputValue(string ID) { DataTable ListData = App.GetWareHouseInputValue(ID); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } /// /// 新增仓库 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult InsertICSWareHouse(string keyValue) { string msg = App.InsertICSWareHouse(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } /// /// 修改仓库 /// /// /// [HttpPost] [HandlerAjaxOnly] public ActionResult UpdateICSWareHouse(string keyValue) { string msg = App.UpdateICSWareHouse(keyValue); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("修改成功!"); } } /// /// 删除仓库 /// /// [HttpPost] [HandlerAjaxOnly] [ValidateAntiForgeryToken] public ActionResult DeleteICSWareHouse(string keyValue) { string msg = App.DeleteICSWareHouse(keyValue); if (string.IsNullOrEmpty(msg)) { return Success("删除成功!"); } else { return Error(msg); } } [HttpGet] public ActionResult SelectICSColumnEnableForTypeEnable() { var data = App.SelectICSColumnEnableForTypeEnable(); return Content(data.ToJson()); } [HttpGet] [HandlerAjaxOnly] public ActionResult GetLoadShowForColumn() { DataTable ListData = App.GetLoadShowForColumn(); var JsonData = new { rows = ListData, }; return Content(JsonData.ToJson()); } [HttpGet] public ActionResult SelectICSColumnEnableForEnablePulic(string TabName) { var data = App.SelectICSColumnEnableForEnablePulic(TabName); return Content(data.ToJson()); } //新增标签数据源 [HttpPost] [HandlerAjaxOnly] public ActionResult CreateLableDataSource(string Sys_LableDataSource) { string msg = App.CreateLableDataSource(Sys_LableDataSource); if (!string.IsNullOrEmpty(msg)) { return Error(msg); } else { return Success("添加成功!"); } } } }