Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace SyntacticSugar.constant |
| | | { |
| | | public static class EmptyConstant |
| | | { |
| | | /// <summary> |
| | | /// 空 |
| | | /// </summary> |
| | | public static int EMPTY = 0; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | 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"); |
| | | |
| | | //æ·»å åå |
| | |
| | | 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 |
| | |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | private Gy_CustomerService customerService = new Gy_CustomerImpl(); |
| | | DataSet ds; |
| | | |
| | | |
| | | #region è¿å客æ·å表 |
| | | /// <summary> |
| | | /// è¿å客æ·å表 |
| | | ///åæ°ï¼string sqlã |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 客æ·å表[å
³èç¨æ·] æ¥è¯¢ |
| | | /// <summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 客æ·åè¡¨ä¿®æ¹æé®æ¹æ³ |
| | | /// <summary> |
| | | /// 客æ·åè¡¨ä¿®æ¹æé®æ¹æ³ |
| | | ///åæ°ï¼string sqlã |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region è·åå½åæå¤§ç客æ·ä»£ç |
| | | [Route("Gy_Customer/getMaxCusNumber")] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region è·åæå¤§èµæIDåæ° |
| | | /// <summary> |
| | | /// è·åæå¤§åºç¡èµæID |
| | | ///åæ°ï¼string sqlã |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region å®¢æ·æ ¹æ®åç±»è·åæå¤§å®¢æ·ç¼ç |
| | | [Route("Gy_Customer/getMaxNum")] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 客æ·å表æ å½¢ç»æ |
| | | /// <summary> |
| | | /// 客æ·å表æ å½¢ç»æ |
| | | ///åæ°ï¼string sqlã |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ°å¢åæ® |
| | | /// <summary> |
| | | /// æ°å¢åæ®-ä¿åæé® |
| | | ///åæ°ï¼string sqlã |
| | |
| | | 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) |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region ä¿®æ¹åæ®-ä¿åæé® |
| | | /// <summary> |
| | | /// ä¿®æ¹åæ®-ä¿åæé® |
| | | ///åæ°ï¼string sqlã |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | # region 客æ·å表å é¤æé® |
| | | /// <summary> |
| | | /// 客æ·å表å é¤æé® |
| | | ///åæ°ï¼string sqlã |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 客æ·å®¡æ ¸ãåå®¡æ ¸ |
| | | /// <summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region [忥åºç¡èµæ] |
| | | [Route("Gy_Customer/Gy_CustomerViewApi")] |
| | | [HttpGet] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 客æ·åç±» æ å½¢å¾(æ ¹æ®ä»£ç å±å¼æ ç¶å¾) |
| | | #region 客æ·åç±» æ å½¢å¾(æ ¹æ®ä»£ç å±å¼æ ç¶å¾) |
| | | |
| | | [Route("Gy_BadReason/Gy_CusrTypeTreeList")] |
| | | [HttpGet] |
| | |
| | | { |
| | | 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"); |
| | | |
| | |
| | | } |
| | | #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 ç©æåç±» æ å½¢å¾(æ ¹æ®ä»£ç å±å¼æ ç¶å¾) |
| | | |
| | |
| | | getTreeByLevel(dt, tree[m].children, num + 1);//忬¡ç¨åéå»å¾ªç¯ï¼æ¿åºåéçåé |
| | | } |
| | | } |
| | | |
| | | } |
| | | public class TreeModel |
| | | { |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region éå½å½æ° |
| | | /// <summary> |
| | | /// éå½å½æ° |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | 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 |
| | | { |
| | |
| | | } |
| | | #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 |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region ç©æåç±»å®¡æ ¸ãåå®¡æ ¸ |
| | | /// <summary> |
| | | /// |
| | |
| | | } |
| | | #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 |
| | | |
| | | } |
| | | } |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region è¿åå·¥åºåºç«æ±æ¥åå表 20240926æ°å¢ |
| | | [Route("Cj_StationOutBillController/GetSc_StationOutBillList_Json")] |
| | | #region å·¥åºåºç«æ±æ¥åå表 |
| | | [Route("Cj_StationOutBill/page")] |
| | | [HttpGet] |
| | | public object GetSc_StationOutBillList_Json(string sWhere, string HMaker, string HBillSubType, string OperationType, string ViewName) |
| | | public json page(string sWhere, string user, int page, int size) |
| | | { |
| | | json res = new json(); |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //夿æé |
| | | if (HBillSubType == "SUB") |
| | | { |
| | | //夿æ¯å¦ææ¥è¯¢æé |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Query", 1, false, HMaker)) |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å®å·¥åæ æ¥è¯¢æé!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | res.code = "0"; |
| | | res.count = 0; |
| | | res.Message = "åºç«åæ æ¥è¯¢æé!"; |
| | | res.data = null; |
| | | return res; |
| | | } |
| | | } |
| | | else if(OperationType == "1") |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | //夿æ¯å¦ææ¥è¯¢æé |
| | | if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åºç«åæ æ¥è¯¢æé!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",''", "h_p_MES_StationOutBillList"); |
| | | } |
| | | |
| | | //è·åç³»ç»åæ° |
| | | string Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | else |
| | | { |
| | | //夿客æ·ä¸ºé¾å±±æ±½é
|
| | | if (oSystemParameter.omodel.WMS_CampanyName == "é¾å±±æ±½é
") |
| | | { |
| | | //è·åéè¦æ¼æ¥çå符串 |
| | | string sql_splice = DBUtility.ClsPub.SpliceSQL(HMaker, "å·¥åºæ±æ¥åå表"); |
| | | |
| | | if (sql_splice == "æ²¡ææ¥è¯¢å°ç¸å
³ç¨æ·ä¿¡æ¯") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ²¡ææ¥è¯¢å°ç¸å
³ç¨æ·ä¿¡æ¯!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | sWhere += sql_splice; |
| | | } |
| | | } |
| | | ds = oCN.RunProcReturn("exec h_p_MES_StationOutBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_MES_StationOutBillList"); |
| | | } |
| | | |
| | | //è¿ååè¡¨ä¿¡æ¯ |
| | | ds = oCN.RunProcReturn("select * from " + ViewName + " where 1=1 " + sWhere + " order by hmainid desc", ViewName); |
| | | |
| | | //æ·»å åå |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//è·åå°DataColumnå对象çåå |
| | | } |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æåï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | |
| | | 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) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¥è¯¢å表信æ¯å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | 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] |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | } |
| | | #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> |
| | | /// è·åå·¥åºæµè½¬å¡åè¡¨ä¿¡æ¯ |
New file |
| | |
| | | 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 |
| | | } |
| | | } |
| | |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | |
| | | #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> |
| | | /// è¿åå·¥èºè·¯çº¿å表 |
| | |
| | | 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] |
| | |
| | | using Newtonsoft.Json; |
| | | using Model; |
| | | using Newtonsoft.Json; |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | 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) |
| | |
| | | |
| | | [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"); |
| | | |
New file |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | 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; } |
| | | } |
| | | } |
New file |
| | |
| | | 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; } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Web; |
| | | |
| | | namespace WebAPI.Utility |
| | | { |
| | | public class TreeUtil |
| | | { |
| | | public class TreeModel |
| | | { |
| | | public string id { get; set; } |
| | | public string title { get; set; } |
| | | public List<TreeModel> children = new List<TreeModel>(); |
| | | } |
| | | |
| | | #region éå½å½æ° |
| | | /// <summary> |
| | | /// éå½å½æ° |
| | | /// </summary> |
| | | public void digui(DataTable dt, List<TreeModel> tree, int num) |
| | | { |
| | | for (int m = 0; m < tree.Count; m++) |
| | | { |
| | | tree[m].children = new List<TreeModel>(); |
| | | for (int i = 0; i < dt.Rows.Count; i++)//ç¬¬ä¸æ¬¡å¾ªç¯ï¼å¾å°æææ ¹èç¹çåé |
| | | { |
| | | var strLen = dt.Rows[i]["hnumber"].ToString().Split('.'); |
| | | if (strLen.Length == num && dt.Rows[i]["hnumber"].ToString().Contains(tree[m].id + ".")) |
| | | { |
| | | TreeModel tbjson = new TreeModel(); |
| | | tbjson.id = dt.Rows[i]["hitemid"].ToString(); |
| | | tbjson.title = dt.Rows[i]["hname"].ToString(); |
| | | tree[m].children.Add(tbjson); |
| | | } |
| | | } |
| | | var strLens = tree[m].id.Split('.'); |
| | | for (int i = 0; i < tree[m].children.Count; i++) |
| | | { |
| | | digui(dt, tree[m].children, strLens.Length + 2);//忬¡ç¨åéå»å¾ªç¯ï¼æ¿åºåéçåé |
| | | } |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region åç±» æ å½¢å¾(æ ¹æ®ä»£ç å±å¼æ ç¶å¾) |
| | | public void getTreeByLevel(DataTable dt, List<TreeModel> tree, int num) |
| | | { |
| | | for (int m = 0; m < tree.Count; m++) |
| | | { |
| | | tree[m].children = new List<TreeModel>(); |
| | | for (int i = 0; i < dt.Rows.Count; i++)//ç¬¬ä¸æ¬¡å¾ªç¯ï¼å¾å°æææ ¹èç¹çåé |
| | | { |
| | | var HLevel = (int)dt.Rows[i]["hlevel"]; |
| | | var HParentID = dt.Rows[i]["hparentid"].ToString(); |
| | | if (HLevel == num && HParentID == tree[m].id) |
| | | { |
| | | TreeModel tbjson = new TreeModel(); |
| | | tbjson.id = dt.Rows[i]["hitemid"].ToString(); |
| | | tbjson.title = dt.Rows[i]["hname"].ToString(); |
| | | tree[m].children.Add(tbjson); |
| | | } |
| | | } |
| | | for (int i = 0; i < tree[m].children.Count; i++) |
| | | { |
| | | getTreeByLevel(dt, tree[m].children, num + 1);//忬¡ç¨åéå»å¾ªç¯ï¼æ¿åºåéçåé |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | <NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile> |
| | | <NameOfLastUsedPublishProfile>D:\Git\houduan\WebAPI\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> |
| | | <NameOfLastUsedPublishProfile>C:\Users\86130\Desktop\æºäºè¿æ\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfilewtt.pubxml</NameOfLastUsedPublishProfile> |
| | | <LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig> |
| | | <NameOfLastUsedPublishProfile>D:\ç½ç«åå¸\å端代ç \MES-WEB-API\MES-WEB-API\WebAPI\Properties\PublishProfiles\FolderProfile10.pubxml</NameOfLastUsedPublishProfile> |
| | | <LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig> |
| | | <UseIISExpress>true</UseIISExpress> |
| | | <Use64BitIISExpress /> |
| | | <IISExpressSSLPort /> |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WebAPI.WebBLL.JCJM.GYZL |
| | | { |
| | | interface Gy_CustomerService |
| | | { |
| | | /// <summary> |
| | | /// 导å
¥excel |
| | | /// </summary> |
| | | void ImportExcel(); |
| | | |
| | | /// <summary> |
| | | /// ä¸ä¼ excel |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | DataTable UploadExcel(DataSet ExcelDs); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | using SyntacticSugar.constant; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using System.Web; |
| | | using WebAPI.Exceptions; |
| | | using WebAPI.WebBLL.JCJM.GYZL; |
| | | |
| | | namespace WebAPI.WebBLL.JCJM.IMPL |
| | | { |
| | | public class Gy_CustomerImpl : Gy_CustomerService |
| | | { |
| | | // 线ç¨è®¡æ°å¨ |
| | | List<Task> taskList = new List<Task>(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | #region 导å
¥EXCEL |
| | | public void ImportExcel() |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | /// <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; |
| | | } |
| | | |
| | | #region ä¸ä¼ EXCEL |
| | | public DataTable UploadExcel(DataSet ExcelDs) |
| | | { |
| | | //å建临æ¶è¡¨ |
| | | 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) |
| | | { |
| | | throw new ExcelException($"Excel模æ¿åå¨é误,{error}\r\n"); |
| | | } |
| | | |
| | | for (int i = 0; i <= provisional.Rows.Count - 1; i++) |
| | | { |
| | | string HRegionNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["å°åºä»£ç "].ToString()); |
| | | string HRegionName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["å°åºåç§°"].ToString()); |
| | | string HCurrencyNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["é»è®¤è´§å¸ä»£ç "].ToString()); |
| | | string HCurrencyName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["é»è®¤è´§å¸åç§°"].ToString()); |
| | | //string HBillingNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["ç»ç®æ¹å¼ä»£ç "].ToString()); |
| | | //string HBillingName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["ç»ç®æ¹å¼åç§°"].ToString()); |
| | | |
| | | string HCusTypeNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["客æ·å类代ç "].ToString()); |
| | | string HCusTypeName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["客æ·åç±»åç§°"].ToString()); |
| | | |
| | | //è®°å½ä»»å¡ |
| | | var tasks = new List<Task>(); |
| | | |
| | | //妿å½åå°åºä»£ç åå°åºåç§°ä¸ä¸ºç©ºå夿æ¯å¦åå¨ |
| | | if (!String.IsNullOrEmpty(HRegionName) || !String.IsNullOrEmpty(HRegionNumber)) |
| | | { |
| | | tasks.Add(JudgeRegion(HRegionNumber, HRegionName)); |
| | | } |
| | | |
| | | // 妿å½åè´§å¸ä»£ç åè´§å¸åç§°ä¸ä¸ºç©ºå夿æ¯å¦åå¨ |
| | | if (!String.IsNullOrEmpty(HCurrencyName) || !String.IsNullOrEmpty(HCurrencyNumber)) |
| | | { |
| | | tasks.Add(JudgeCurrency(HCurrencyNumber, HCurrencyName)); |
| | | } |
| | | |
| | | //妿å½å客æ·å类代ç ååç§° |
| | | if (!String.IsNullOrEmpty(HCusTypeName) || !String.IsNullOrEmpty(HCusTypeNumber)) |
| | | { |
| | | tasks.Add(JudgeCusType(HCusTypeNumber, HCusTypeName)); |
| | | } |
| | | try |
| | | { |
| | | //çå¾
ä»»å¡å®æ |
| | | Task.WaitAll(tasks.ToArray()); |
| | | } |
| | | catch (AggregateException ae) |
| | | { |
| | | string msg = ae.Message; |
| | | ae.Handle(ex => { |
| | | if (ex is EmptyException) |
| | | msg = ex.Message; |
| | | Console.WriteLine(ex.Message); |
| | | return ex is EmptyException; |
| | | }); |
| | | throw new Exception("第" + i +1 +"æé®é¢: " +msg); |
| | | } |
| | | |
| | | |
| | | //è·åçå®è¡æ° |
| | | int line = i + 1; |
| | | } |
| | | return provisional; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿å°åºæ¯å¦æ£ç¡® |
| | | /// </summary> |
| | | private Task<int> JudgeRegion(string HNumber, string HName) |
| | | { |
| | | return Task<int>.Factory.StartNew(() => |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_AreaSet where HNumber = '" + HNumber + "' and HName = '" + HName + "'", "Gy_AreaSet"); |
| | | if (ds.Tables[0].Rows.Count == EmptyConstant.EMPTY) |
| | | { |
| | | throw new EmptyException("å½åå°åºä¸åå¨ï¼è¯·éæ°éæ©"); |
| | | } |
| | | return (int)ds.Tables[0].Rows[0][0]; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new EmptyException(e.Message); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å¤æè´§å¸æ¯å¦æ£ç¡® |
| | | /// </summary> |
| | | private Task<int> JudgeCurrency(string HNumber, string HName) |
| | | { |
| | | { |
| | | return Task<int>.Factory.StartNew(() => |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_Currency where HNumber = '" + HNumber + "' and HName = '" + HName + "'", "Gy_Currency"); |
| | | if (ds.Tables[0].Rows.Count == EmptyConstant.EMPTY) |
| | | { |
| | | throw new EmptyException("å½åè´§å¸ä¸åå¨ï¼è¯·éæ°éæ©"); |
| | | } |
| | | return (int)ds.Tables[0].Rows[0][0]; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new EmptyException(e.Message); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 夿客æ·åç±» |
| | | /// </summary> |
| | | private Task<int> JudgeCusType(string HNumber, string HName) |
| | | { |
| | | { |
| | | return Task<int>.Factory.StartNew(() => |
| | | { |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds = oCN.RunProcReturn("select * from Gy_CusType where HNumber = '" + HNumber + "' and HName = '" + HName + "'", "Gy_CusType"); |
| | | if (ds.Tables[0].Rows.Count == EmptyConstant.EMPTY) |
| | | { |
| | | throw new EmptyException("å½ååç±»ä¸åå¨ï¼è¯·éæ°éæ©"); |
| | | } |
| | | return (int)ds.Tables[0].Rows[0][0]; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new EmptyException(e.Message); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | } |