| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //编辑权限 |
| | | //if (!DBUtility.ClsPub.Security_Log_second("Gy_MateMould", 1, false, user)) |
| | | //{ |
| | |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_MateMouldInfoList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | 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 = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | bResult = BillNew.ModifyByID(DBUtility.ClsPub.isLong(mainList[0].HItemID)); |
| | | bResult = BillNew.ModifyByID(DBUtility.ClsPub.isLong(subList[0].HItemID)); |
| | | } |
| | | //提示 |
| | | if (bResult == true) |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //ds = oCN.RunProcReturn("select " + |
| | | // "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HRelationID) 模具产品对应表代码,a.HUnitID,b.HName HRelationNameCol" + |
| | | // ",b.HNumber HRelationNumberCol,a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" + |
| | | // ",a.HRelationID HRelationIDCol,d.HNumber HUnitNumberCol,d.HName HUnitNameCol" + |
| | | // ",a.HUnitID HUnitIDCol" + |
| | | // ",a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" + |
| | | // ",a.HRemark HRemarkCol " + |
| | | // " from Gy_MateMouldInfo a " + |
| | | // " left join h_v_Gy_Mould b on a.HRelationID = b.HItemID " + |
| | | // " left join Gy_Material c on a.HMaterID = c.HItemID " + |
| | | // " left join Gy_Unit d on a.HUnitID = d.HItemID where a.HItemID = " + HItemID, "Gy_MateMouldInfo"); |
| | | ds = oCN.RunProcReturn("select " + |
| | | "a.HItemID,ltrim(a.HMaterID)+'-'+ltrim(a.HRelationID) 模具产品对应表代码,a.HUnitID,b.HName HRelationNameCol" + |
| | | ",b.HNumber HRelationNumberCol,a.HMaterID HMaterIDCol,c.HNumber HMaterNumberCol,c.HName HMaterNameCol,c.HModel HMaterModelCol" + |
| | | ",a.HRelationID HRelationIDCol,d.HNumber HUnitNumberCol,d.HName HUnitNameCol" + |
| | | "a.HItemID,a.模具产品对应表代码,a.HUnitID,b.hitemid HMouldIDCol,b.HNumber 模具代码" + |
| | | ",b.HName 模具名称,a.HMaterID HMaterIDCol,c.HNumber 物料代码,c.HName 物料名称,c.HModel 规格型号" + |
| | | ",a.HRelationID HRelationIDCol,d.HNumber 单位代码,d.HName 单位名称" + |
| | | ",a.HUnitID HUnitIDCol" + |
| | | ",a.HBeginDate HBeginDateCol,a.HEndDate HEndDateCol" + |
| | | ",a.HRemark HRemarkCol " + |
| | | " from Gy_MateMouldInfo a " + |
| | | ",a.开始日期,a.结束日期" + |
| | | ",a.备注 " + |
| | | " from h_v_Gy_MateMouldInfoList a " + |
| | | " left join h_v_Gy_Mould b on a.HRelationID = b.HItemID " + |
| | | " left join Gy_Material c on a.HMaterID = c.HItemID " + |
| | | " left join Gy_Unit d on a.HUnitID = d.HItemID where a.HItemID = " + HItemID, "Gy_MateMouldInfo"); |
| | |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "false!"; |
| | | objJsonResult.Message = "无列表信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | //添加列名 |
| | | 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 = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 产品器具列表删除功能 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("DeltetGy_MateMould")] |
| | | [HttpGet] |
| | | public object DeltetGy_MateMould(string HItemID) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (string.IsNullOrWhiteSpace(HItemID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HItemID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | oCN.BeginTran();//开始事务 |
| | | ds = oCN.RunProcReturn("select * from Gy_MateMouldInfo where HItemID=" + HItemID, "Gy_MateMouldInfo"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有数据,无法删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | |
| | | oCN.RunProc("delete from Gy_MateMouldInfo where HItemID=" + HItemID); |
| | | oCN.Commit();//提交事务 |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "* 数据删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |