111
pzy
2024-10-03 2ec1b01d8a5e076eba607d83b902846876957a3e
111
9个文件已修改
5个文件已添加
981 ■■■■■ 已修改文件
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_CustomerController.cs 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs 242 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs 242 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CKGL/TMZD/Gy_BarCodeBillListController.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/LMESController.cs 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/基础资料/基础资料/Gy_MaterTypeBillController.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Exceptions/EmptyException.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Exceptions/ExcelException.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/Query/QueryModel.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/QueryModel.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/BaseSet/Gy_BadReasonController.cs
@@ -4529,7 +4529,7 @@
                }
                string sql1 = "select * from  h_v_Gy_CusType where 1 = 1";
                string sql = sql1 + sWhere + " order by HNumber ";
                string sql = sql1 + sWhere;
                ds = oCN.RunProcReturn(sql, "h_v_Gy_CusType");
                //添加列名
WebAPI/Controllers/BaseSet/Gy_CustomerController.cs
@@ -9,6 +9,12 @@
using System.Web.Http;
using WebAPI.Models;
using System.Text.RegularExpressions;
using SyntacticSugar.constant;
using System.Web;
using WebAPI.Controllers.SCGL.日计划管理;
using WebAPI.WebBLL.JCJM.GYZL;
using WebAPI.WebBLL.JCJM.IMPL;
using System.IO;
namespace WebAPI.Controllers
{
    public class Gy_CustomerController : ApiController
@@ -19,9 +25,10 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        private Gy_CustomerService customerService = new Gy_CustomerImpl();
        DataSet ds;
        #region è¿”回客户列表
        /// <summary>
        /// è¿”回客户列表
        ///参数:string sql。
@@ -93,6 +100,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·å­è¡¨[关联用户] æŸ¥è¯¢
        /// <summary>
@@ -137,6 +145,7 @@
        }
        #endregion
        #region å®¢æˆ·åˆ—表修改按钮方法
        /// <summary>
        /// å®¢æˆ·åˆ—表修改按钮方法
        ///参数:string sql。
@@ -174,7 +183,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region èŽ·å–å½“å‰æœ€å¤§çš„å®¢æˆ·ä»£ç 
        [Route("Gy_Customer/getMaxCusNumber")]
@@ -214,6 +223,7 @@
        }
        #endregion
        #region èŽ·å–æœ€å¤§èµ„æ–™ID参数
        /// <summary>
        /// èŽ·å–æœ€å¤§åŸºç¡€èµ„æ–™ID
        ///参数:string sql。
@@ -242,6 +252,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·æ ¹æ®åˆ†ç±»èŽ·å–æœ€å¤§å®¢æˆ·ç¼–ç 
        [Route("Gy_Customer/getMaxNum")]
@@ -320,7 +331,7 @@
        }
        #endregion
        #region å®¢æˆ·åˆ—表树形结构
        /// <summary>
        /// å®¢æˆ·åˆ—表树形结构
        ///参数:string sql。
@@ -350,7 +361,9 @@
                return objJsonResult;
            }
        }
        #endregion
        #region æ–°å¢žå•据
        /// <summary>
        /// æ–°å¢žå•据-保存按钮
        ///参数:string sql。
@@ -506,9 +519,14 @@
                return objJsonResult;
            }
        }
        #endregion
        #region ä¿å­˜å®¢æˆ·åˆ—表
        /// <summary>
        /// ä¿å­˜å®¢æˆ·åˆ—表
        /// </summary>
        /// <param name="oMain"></param>
        /// <returns></returns>
        [Route("Gy_Customer/SaveGy_CustomerListApi")]
        [HttpPost]
        public object SaveGy_CustomerListApi([FromBody] JObject oMain)
@@ -632,9 +650,9 @@
                return objJsonResult;
            }
        }
        #endregion
        #region ä¿®æ”¹å•据-保存按钮
        /// <summary>
        /// ä¿®æ”¹å•据-保存按钮
        ///参数:string sql。
@@ -805,9 +823,9 @@
                return objJsonResult;
            }
        }
        #endregion
        # region å®¢æˆ·åˆ—表删除按钮
        /// <summary>
        /// å®¢æˆ·åˆ—表删除按钮
        ///参数:string sql。
@@ -898,7 +916,7 @@
                return objJsonResult;
            }
        }
        #endregion
        #region å®¢æˆ·å®¡æ ¸ã€åå®¡æ ¸
        /// <summary>
@@ -1090,7 +1108,6 @@
        }
        #endregion
        #region [同步基础资料]
        [Route("Gy_Customer/Gy_CustomerViewApi")]
        [HttpGet]
@@ -1253,7 +1270,7 @@
        }
        #endregion
         #region å®¢æˆ·åˆ†ç±» æ ‘形图(根据代码展开树状图)
        #region å®¢æˆ·åˆ†ç±» æ ‘形图(根据代码展开树状图)
        [Route("Gy_BadReason/Gy_CusrTypeTreeList")]
        [HttpGet]
@@ -1309,7 +1326,7 @@
        {
            try
            {
                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber");
                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_CusType order by hnumber ");
                ds = oCN.RunProcReturn(sql1, "Gy_CusType");
@@ -1349,7 +1366,77 @@
        }
        #endregion
        #region å®¢æˆ·åˆ—表 æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_Customer/Gy_Process_Excel")]
        [HttpPost]
        public json Gy_Department_Excel()
        {
            json res = new json();
            try
            {
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
                DataTable provisional = customerService.UploadExcel(ExcelDs);
                res.code = CodeConstant.SUCCEED;
                res.count = CountConstant.SUCCEED;
                res.Message = "上传成功";
                res.data = provisional;
                return res;
            }
            catch (Exception e)
            {
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        /// <summary>
        /// åˆ¤æ–­å½“前职员是否存在
        /// </summary>
        /// <param name="HEmpNumber"></param>
        /// <param name="HEmpName"></param>
        /// <returns></returns>
        private bool JudgeEmp(string HEmpNumber, string HEmpName)
        {
            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
            {
                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
            }
            return false;
        }
        /// <summary>
        /// åˆ¤æ–­åˆ—
        /// </summary>
        /// <param name="provisional"></param>
        /// <returns></returns>
        private static string JudgmentColumns(DataTable provisional)
        {
            var error = "";
            //查询没有的列
            if (!provisional.Columns.Contains("部门代码"))
                error += "没有找到【部门代码】的标题,";
            if (!provisional.Columns.Contains("部门名称"))
                error += "没有找到【部门名称】的标题,";
            return error;
        }
        #endregion
        #region ç‰©æ–™åˆ†ç±» æ ‘形图(根据代码展开树状图)
@@ -1375,7 +1462,6 @@
                    getTreeByLevel(dt, tree[m].children, num + 1);//再次用子集去循环,拿出子集的子集
                }
            }
        }
        public class TreeModel
        {
@@ -1386,6 +1472,7 @@
        #endregion
        #region é€’归函数
        /// <summary>
        /// é€’归函数
        /// </summary>
@@ -1415,4 +1502,5 @@
        }
    }
    #endregion
}
WebAPI/Controllers/BaseSet/Gy_DepartmentController.cs
@@ -1,12 +1,16 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using SyntacticSugar.constant;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web;
using System.Web.Http;
using WebAPI.Controllers.SCGL.日计划管理;
using WebAPI.Models;
namespace WebAPI.Controllers
{
@@ -1161,5 +1165,243 @@
        }
        #endregion
        #region éƒ¨é—¨åˆ—表 æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_Department/Gy_Process_Excel")]
        [HttpPost]
        public json Gy_Department_Excel()
        {
            json res = new json();
            try
            {
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
                //创建临时表
                DataTable provisional = new DataTable("dt2");
                //添加列名
                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
                {
                    provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
                }
                //添加数据
                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
                {
                    DataRow row = provisional.NewRow();
                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
                    {
                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
                    }
                    provisional.Rows.Add(row);
                }
                //判断列
                string error = JudgmentColumns(provisional);
                if (error.Length > 0)
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = $"Excel模板存在错误,{error}\r\n";
                    res.data = null;
                    return res;
                }
                for (int i = 0; i <= provisional.Rows.Count - 1; i++)
                {
                    string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["部门代码"].ToString());
                    string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["部门名称"].ToString());
                    string HEmpNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["负责人代码"].ToString());
                    string HEmpName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["负责人名称"].ToString());
                    string HBarCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["条形码"].ToString());
                    string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["助记码"]);
                    string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString());
                    //判断负责人是否存在
                    if (JudgeEmp(HEmpNumber, HEmpName))
                    {
                        res.code = CodeConstant.FAIL;
                        res.count = CountConstant.FAIL;
                        res.Message = "当前职员不存在";
                        res.data = null;
                        return res;
                    }
                    //获取真实行数
                    int line = i + 1;
                }
                res.code = "1";
                res.count = 1;
                res.Message = error;
                res.data = provisional;
                return res;
            }
            catch (Exception e)
            {
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        /// <summary>
        /// åˆ¤æ–­å½“前职员是否存在
        /// </summary>
        /// <param name="HEmpNumber"></param>
        /// <param name="HEmpName"></param>
        /// <returns></returns>
        private bool JudgeEmp(string HEmpNumber, string HEmpName)
        {
            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
            {
                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
            }
            return false;
        }
        /// <summary>
        /// åˆ¤æ–­åˆ—
        /// </summary>
        /// <param name="provisional"></param>
        /// <returns></returns>
        private static string JudgmentColumns(DataTable provisional)
        {
            var error = "";
            //查询没有的列
            if (!provisional.Columns.Contains("部门代码"))
                error += "没有找到【部门代码】的标题,";
            if (!provisional.Columns.Contains("部门名称"))
                error += "没有找到【部门名称】的标题,";
            return error;
        }
        #endregion
        #region éƒ¨é—¨åˆ—表 å¯¼å…¥(保存)
        [Route("Gy_Department/Gy_Process_btnSave")]
        [HttpPost]
        public object Gy_InspectBasis_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { "&和" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();
            string organ = sArray[2].ToString();
            json res = new json();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = "无保存权限!";
                    res.data = null;
                    return res;
                }
                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
                foreach (JObject item in Excel)
                {
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    foreach (var itm in item.Properties())
                    {
                        dic.Add(itm.Name, itm.Value.ToString());
                    }
                    list.Add(dic);
                }
                oCN.BeginTran();
                int i = 1;
                foreach (Dictionary<string, string> item in list)
                {
                    string HNumber = item["部门代码"].ToString();
                    string HName = item["部门名称"].ToString();
                    string HEmpNumber = item["负责人代码"].ToString();
                    string HEmpName = item["负责人名称"].ToString();
                    string HBarCode = item["条形码"].ToString();
                    string HHelpCode = item["助记码"].ToString();
                    string HRemark = item["备注"].ToString();
                    int HEmpID = 0;
                    if (!String.IsNullOrEmpty(HEmpName) && !String.IsNullOrEmpty(HEmpNumber))
                    {
                        DataSet emp = oCN.RunProcReturn("select HItemID from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
                        HEmpID = (int)emp.Tables[0].Rows[0]["HItemID"];
                    }
                    string sShortNumber;
                    sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//短代码
                    if (sShortNumber.Trim() == "")
                    {
                        res.code = "0";
                        res.count = 0;
                        res.Message = "保存失败!短代码为空!";
                        res.data = 1;
                        return res;
                    }
                    int HEndFlag = 1;//末级标志
                    int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //等级
                    if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
                    {
                        res.code = "0";
                        res.count = 0;
                        res.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        res.data = 1;
                        return res;
                    }
                    ds = oCN.RunProcReturn("select * from Gy_Department where HNumber='" + HNumber + "'", "Gy_InspectInstruMent");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        string sql = "insert into Gy_Department (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HEmpID, HBarCodeForBase)" +
                            $"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '未使用', '{organ}', '{organ}', '{HEmpID}', '{HBarCode}')";
                        oCN.RunProc(sql);
                    }
                    else
                    {
                        oCN.RunProc("update Gy_Department  set  HName ='" + HName + "' , HHelpCode = '" + HHelpCode + " ', HBarCodeForBase = '" + HBarCode + "', HEmpID = '" + HEmpID + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "' where HNumber= '" + HNumber + "'");
                    }
                    i++;
                }
                oCN.Commit();
                res.code = "1";
                res.count = 1;
                res.Message = "导入成功!";
                res.data = null;
                return res;
            }
            catch (Exception e)
            {
                LogService.Write(e);
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/BaseSet/Gy_WarehouseController.cs
@@ -2,11 +2,14 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using SyntacticSugar.constant;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Web;
using System.Web.Http;
using WebAPI.Controllers.SCGL.日计划管理;
using WebAPI.Models;
@@ -781,8 +784,6 @@
        }
        #endregion
        #region ç‰©æ–™åˆ†ç±»å®¡æ ¸ã€åå®¡æ ¸
        /// <summary>
        /// 
@@ -973,5 +974,242 @@
        }
        #endregion
        #region æ£€éªŒä¾æ®åˆ—表 æ–‡ä»¶ä¸Šä¼ 
        [Route("Gy_Warehouse/Gy_Process_Excel")]
        [HttpPost]
        public json Gy_InspectBasis_Excel()
        {
            json res = new json();
            try
            {
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0");
                //删除文件
                File.Delete(ExcelPath);
                //创建临时表
                DataTable provisional = new DataTable("dt2");
                //添加列名
                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
                {
                    provisional.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
                }
                //添加数据
                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
                {
                    DataRow row = provisional.NewRow();
                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
                    {
                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
                    }
                    provisional.Rows.Add(row);
                }
                //判断列
                string error = JudgmentColumns(provisional);
                if (error.Length > 0)
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = $"Excel模板存在错误,{error}\r\n";
                    res.data = null;
                    return res;
                }
                for (int i = 0; i <= provisional.Rows.Count - 1; i++)
                {
                    string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["仓库代码"].ToString());
                    string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["仓库名称"].ToString());
                    string phone = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["联系电话"].ToString());
                    string HEmpNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["职员代码"].ToString());
                    string HEmpName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["职员名称"].ToString());
                    string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["助记码"]);
                    string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString());
                    if(JudgeEmp(HEmpNumber, HEmpName))
                    {
                        res.code = CodeConstant.FAIL;
                        res.count = CountConstant.FAIL;
                        res.Message = "当前职员不存在";
                        res.data = null;
                        return res;
                    }
                    //获取真实行数
                    int line = i + 1;
                }
                res.code = "1";
                res.count = 1;
                res.Message = error;
                res.data = provisional;
                return res;
            }
            catch (Exception e)
            {
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        /// <summary>
        /// åˆ¤æ–­å½“前职员是否存在
        /// </summary>
        /// <param name="HEmpNumber"></param>
        /// <param name="HEmpName"></param>
        /// <returns></returns>
        private bool JudgeEmp(string HEmpNumber, string HEmpName)
        {
            if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName))
            {
                DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
                return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false;
            }
            return false;
        }
        /// <summary>
        /// åˆ¤æ–­åˆ—
        /// </summary>
        /// <param name="provisional"></param>
        /// <returns></returns>
        private static string JudgmentColumns(DataTable provisional)
        {
            var error = "";
            //查询没有的列
            if (!provisional.Columns.Contains("仓库代码"))
                error += "没有找到【仓库代码】的标题,";
            if (!provisional.Columns.Contains("仓库名称"))
                error += "没有找到【仓库名称】的标题,";
            return error;
        }
        #endregion
        #region æ£€éªŒä¾æ®åˆ—表 å¯¼å…¥(保存)
        [Route("Gy_Warehouse/Gy_Process_btnSave")]
        [HttpPost]
        public object Gy_InspectBasis_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { "&和" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string user = sArray[1].ToString();
            string organ = sArray[2].ToString();
            json res = new json();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user))
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = "无保存权限!";
                    res.data = null;
                    return res;
                }
                List<object> Excel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<object>>(msg2);
                List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
                foreach (JObject item in Excel)
                {
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    foreach (var itm in item.Properties())
                    {
                        dic.Add(itm.Name, itm.Value.ToString());
                    }
                    list.Add(dic);
                }
                oCN.BeginTran();
                int i = 1;
                foreach (Dictionary<string, string> item in list)
                {
                    string HNumber = item["仓库代码"].ToString();
                    string HName = item["仓库名称"].ToString();
                    string phone = item["联系电话"].ToString();
                    string HEmpNumber = item["职员代码"].ToString();
                    string HEmpName = item["职员名称"].ToString();
                    string HHelpCode = item["助记码"].ToString();
                    string HRemark = item["备注"].ToString();
                    int HEmpID = 0;
                    if (!String.IsNullOrEmpty(HEmpName) && !String.IsNullOrEmpty(HEmpNumber))
                    {
                        DataSet emp = oCN.RunProcReturn("select HItemID from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee");
                        HEmpID = (int)emp.Tables[0].Rows[0]["HItemID"];
                    }
                    string sShortNumber;
                    sShortNumber = DBUtility.ClsPub.GetShortNumber(HNumber);//短代码
                    if (sShortNumber.Trim() == "")
                    {
                        res.code = "0";
                        res.count = 0;
                        res.Message = "保存失败!短代码为空!";
                        res.data = 1;
                        return res;
                    }
                    int HEndFlag = 1;//末级标志
                    int HLevel = DBUtility.ClsPub.GetLevel(HNumber); //等级
                    if (!DBUtility.ClsPub.AllowNumber(HNumber.Trim()))
                    {
                        res.code = "0";
                        res.count = 0;
                        res.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                        res.data = 1;
                        return res;
                    }
                    ds = oCN.RunProcReturn("select * from Gy_Warehouse where HNumber='" + HNumber + "'", "Gy_InspectInstruMent");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        string sql = "insert into Gy_Warehouse (HName,HNumber,HShortNumber,HLevel,HHelpCode,HParentID,HStopflag,HEndFlag,HRemark,HUseFlag, HUSEORGID, HCREATEORGID, HEmpID, HPhone)" +
                            $"values('{HName}', '{HNumber}', '{sShortNumber}',{HLevel},'',0,'0','0','{HRemark}', '未使用', '{organ}', '{organ}', '{HEmpID}', '{phone}')";
                        oCN.RunProc(sql);
                    }
                    else
                    {
                        oCN.RunProc("update Gy_Warehouse  set  HName ='" + HName + "' , HHelpCode = '" + HHelpCode + " ', HPhone= '" + phone + "', HEmpID = '" + HEmpID + "', HModifyEmp = '" + user + "', HModifyTime = '" + System.DateTime.Now.ToString("G") + "' where HNumber= '" + HNumber + "'");
                    }
                    i++;
                }
                oCN.Commit();
                res.code = "1";
                res.count = 1;
                res.Message = "导入成功!";
                res.data = null;
                return res;
            }
            catch (Exception e)
            {
                LogService.Write(e);
                res.code = "0";
                res.count = 0;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -2,6 +2,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using SyntacticSugar.constant;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -1715,6 +1716,58 @@
        }
        #endregion
        #region å·¥åºå‡ºç«™æ±‡æŠ¥å•列表
        [Route("Cj_StationOutBill/page")]
        [HttpGet]
        public json page(string sWhere, string user, int page, int size)
        {
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                    //判断是否有查询权限
             if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user))
                    {
                        res.code = "0";
                        res.count = 0;
                        res.Message = "出站单无查询权限!";
                        res.data = null;
                        return res;
                    }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",''", "h_p_MES_StationOutBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_MES_StationOutBillList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥åºå‡ºç«™æ±‡æŠ¥å• å­è¡¨æŸ¥è¯¢
        [Route("Cj_StationOutBill/get_SubDisplay")]
        [HttpGet]
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using SyntacticSugar.constant;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -1911,6 +1912,59 @@
        }
        #endregion
        #region å·¥åºæµè½¬å¡åˆ†é¡µåˆ—表
        [Route("Sc_ProcessExchangeBillList/page")]
        [HttpGet]
        public json page(string sWhere, string user, int page, int size)
        {
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Sc_ProcessExchangeBill_SubQuery", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",''", "h_p_Sc_ProcessExchangeBillList_Query");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Sc_ProcessExchangeBillList_Query " + page + "," + size + ",'" + sWhere + "'", "h_p_Sc_ProcessExchangeBillList_Query");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥åºæµè½¬å¡åˆ—表
        /// <summary>
        /// èŽ·å–å·¥åºæµè½¬å¡åˆ—è¡¨ä¿¡æ¯
WebAPI/Controllers/CKGL/TMZD/Gy_BarCodeBillListController.cs
New file
@@ -0,0 +1,77 @@
using Newtonsoft.Json;
using SyntacticSugar.constant;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using WebAPI.Models;
namespace WebAPI.Controllers.CKGL.TMZD
{
    public class Gy_BarCodeBillListController : ApiController
    {
        //获取系统参数
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public string sWhere = "";
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        #region æ¡ç ä¸»æ¡£åˆ†é¡µåˆ—表
        [Route("Gy_BarCodeBillList/page")]
        [HttpGet]
        public json page(string sWhere, string user, int page, int size)
        {
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_Material", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size  + ",''", "h_p_IF_BarCodeBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size  +  ",'" + sWhere + "'", "h_p_IF_BarCodeBillList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}
WebAPI/Controllers/LMESController.cs
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pub_Class;
using SyntacticSugar.constant;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -1114,6 +1115,60 @@
        #region å·¥è‰ºè·¯çº¿
        #region å·¥è‰ºè·¯çº¿åˆ†é¡µåˆ—表
        [Route("Gy_RoutingBill/page")]
        [HttpGet]
        public json Gy_RoutingBillPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Gy_RoutingBill_Query", 1, false, user))
                {
                    res.code = "0";
                    res.count = 0;
                    res.Message = "无查看权限!";
                    res.data = null;
                    return res;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_Gy_RoutingBillList " + page + "," + size + ",''", "h_p_Gy_RoutingBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_Gy_RoutingBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_RoutingBillList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥è‰ºè·¯çº¿åˆ—表
        /// <summary>
        /// è¿”回工艺路线列表
@@ -1676,6 +1731,59 @@
            return GetObjectJson(ds);
        }
        #region ç”Ÿäº§è®¢å•分页列表
        [Route("LEMS/MES_IF_ICMOBillListPage")]
        [HttpGet]
        public object MES_IF_ICMOBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            try
            {
                List<object> columnNameList = new List<object>();
                //编辑权限
                if (!DBUtility.ClsPub.Security_Log_second("Sc_ICMOBillQuery", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无查看权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_IF_ICMOBillList " + page + "," + size + ",''", "h_p_IF_ICMOBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_IF_ICMOBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_IF_ICMOBillList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                objJsonResult.code = "1";
                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥åºæµè½¬å¡ä¸‹æŽ¨ç”Ÿäº§è´¨é‡æ±‡æŠ¥å•
        [Route("LEMS/MES_IF_ProcessBillList_Json")]
        [HttpGet]
WebAPI/Controllers/SBGL/SBBB/Sb_EquipMentCollectionTechParam_TempController.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Model;
using Newtonsoft.Json;
using SyntacticSugar.constant;
using System;
using System.Collections.Generic;
@@ -36,6 +37,8 @@
                string sql = "select * from h_v_Sb_EquipMentCollectionTechParam_TempList where 1 = 1" + sWhere;
                DataSet ds = oCN.RunProcReturn(sql, "h_v_Sb_EquipMentCollectionTechParam_TempList");
                //数据遍历, èŽ·å–åˆ—å
                List<object> columnNameList = new List<object>();
                foreach (DataColumn col in ds.Tables[0].Columns)
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_MaterTypeBillController.cs
@@ -544,11 +544,11 @@
        [Route("Gy_MaterType/Gy_MaterTypeTreeListByLevel")]
        [HttpGet]
        public object Gy_MaterTypeTreeListByLevel()
        public object Gy_MaterTypeTreeListByLevel(string HOrgID)
        {
            try
            {
                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_MaterType order by hnumber");
                string sql1 = string.Format("select hitemid,hnumber,hname,hparentid,hlevel from Gy_MaterType where HUSEORGID = '" + HOrgID + "' order by hnumber");
                ds = oCN.RunProcReturn(sql1, "Gy_MaterType");
WebAPI/Exceptions/EmptyException.cs
New file
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Exceptions
{
    /// <summary>
    /// ç©ºæ•°æ®å¼‚常
    /// </summary>
    public class EmptyException : Exception
    {
        public EmptyException(string message): base(message)
        {
        }
    }
}
WebAPI/Exceptions/ExcelException.cs
New file
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Exceptions
{
    /// <summary>
    /// EXCEL异常报错类
    /// </summary>
    public class ExcelException : Exception
    {
        public ExcelException(string message) : base(message)
        {
        }
    }
}
WebAPI/Models/Query/QueryModel.cs
New file
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebAPI.Models.Query
{
    /// <summary>
    /// æŸ¥è¯¢ç±»
    /// </summary>
    public class QueryModel
    {
        /// <summary>
        /// sql查询语句
        /// </summary>
        public string sWhere { get; set; }
        /// <summary>
        /// æŸ¥è¯¢ç”¨æˆ·
        /// </summary>
        public string user { get; set; }
    }
}
WebAPI/Models/QueryModel.cs
New file
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
    public class QueryModel
    {
        /// <summary>
        /// sql查询语句
        /// </summary>
        public string sWhere { get; set; }
        /// <summary>
        /// æŸ¥è¯¢ç”¨æˆ·
        /// </summary>
        public string user { get; set; }
    }
}