using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; using System.Windows.Forms; using SyntacticSugar.constant; namespace WebAPI.Controllers { public class Sc_MouldProdOutBillController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus; public const string ModName = "3802"; //单据类型 public const string ModCaption = "器具领用出库单"; //单据名称 public const string ModRightName = "Sc_MouldProdOutBill"; public const string ModRightNameList = ModRightName + "List"; //列表 public const string ModRightNameEdit = ModRightName + "_Edit"; //编辑 public const string ModRightNameCheck = ModRightName + "_Check"; //审核 public const string ModRightNameClose = ModRightName + "_Close"; //关闭 public const string ModRightNameDelete = ModRightName + "_Delete"; //作废 public const string ModRightNameDrop = ModRightName + "_Drop"; //删除 public DataSet ds = new DataSet(); private json objJsonResult = new json(); SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public DAL.ClsSc_MouldProdOutBill oBill = new DAL.ClsSc_MouldProdOutBill(); #region 器具领用出库单分页列表 [Route("Sc_MouldProdOutBillController/page")] [HttpGet] public json Sc_MouldProdOutBillPage(string sWhere, string user, int page, int size, string Type) { try { List columnNameList = new List(); //列表进入时判断权限,选源单进入不判断权限 if (Type == ModName) { if (!DBUtility.ClsPub.Security_Log(ModRightNameList, 3, false, user)) { objJsonResult.code = CodeConstant.FAIL; objJsonResult.count = CountConstant.FAIL; objJsonResult.Message = "您没有该模块权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } } sWhere = sWhere.Replace("'", "''"); if (sWhere == null || sWhere.Equals("")) { ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutBillList " + page + "," + size + ",'','" + Type + "'", "h_p_Sc_MouldProdOutBillList"); } else { ds = oCn.RunProcReturn("exec h_p_Sc_MouldProdOutBillList " + page + "," + size + ",'" + sWhere + "','" + Type + "'", "h_p_Sc_MouldProdOutBillList"); } //添加列名 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 = CodeConstant.SUCCEED; objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); objJsonResult.Message = "成功!"; objJsonResult.list = columnNameList; objJsonResult.data = ds.Tables[0]; return objJsonResult; } catch (Exception e) { objJsonResult.code = CodeConstant.FAIL; objJsonResult.count = CountConstant.FAIL; objJsonResult.Message = "查询列表信息失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 器具领用出库单 删除 /// /// 删除器具领用出库单 /// /// [Route("Sc_MouldProdOutBillController/GetSc_MouldProdOutBill_Delete_Json")] [HttpGet] public object GetSc_MouldProdOutBill_Delete_Json(Int64 HInterID, string HMaker) { try { //判断权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameDrop, 3, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块删除功能权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } //判断存在性 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) { //删除前控制 DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Sc_MouldProdOutBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + oBill.omodel.HBillNo + "','" + HMaker + "'", "h_p_Sc_MouldProdOutBill_BeforeDelCtrl"); if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "删除前判断失败!"; objJsonResult.data = null; return objJsonResult; } else { if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); objJsonResult.data = null; return objJsonResult; } } //删除单据(包含删除后控制、写入日志) if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Sc_MouldProdOutBill_AfterDelCtrl", HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "删除失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "删除器具领用出库单成功!"; objJsonResult.data = null; return objJsonResult; } } else { objJsonResult.code = "0"; objJsonResult.count = 0; 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; } } #endregion #region 器具领用出库单 审核/反审核 /// /// 审核/反审核器具领用出库单 /// /// 单据ID /// 审核(1),反审核(2) /// 审核人 /// [Route("Sc_MouldProdOutBillController/GetSc_MouldProdOutBill_Check_Json")] [HttpGet] public object GetSc_MouldProdOutBill_Check_Json(Int64 HInterID, int Type, string HMaker) { try { //判断权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 3, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块审核/反审核功能权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } //判断存在性 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) { //Type 1 审核 2 反审核 if (Type == 1) { if (oBill.omodel.HChecker.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核,不能再次审核!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭,不能再次审核!"; objJsonResult.data = null; return objJsonResult; } if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废,不能再次审核!"; objJsonResult.data = null; return objJsonResult; } //审核前控制 DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Sc_MouldProdOutBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + oBill.omodel.HBillNo + "','" + HMaker + "'", "h_p_Sc_MouldProdOutBill_BeforeCheckCtrl"); if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核前判断失败!"; objJsonResult.data = null; return objJsonResult; } else { if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); objJsonResult.data = null; return objJsonResult; } } //审核单据 if (!oBill.CheckBill(HInterID, oBill.omodel.HBillNo, "h_p_Sc_MouldProdOutBill_AfterCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 审核成功!"; objJsonResult.data = null; return objJsonResult; ; } } else { if (oBill.omodel.HChecker.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核,不需要反审核!"; objJsonResult.data = null; return objJsonResult; } //反审核前控制 DataSet BeforeDs = oCn.RunProcReturn("Exec h_p_Sc_MouldProdOutBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + oBill.omodel.HBillNo + "','" + HMaker + "'", "h_p_Sc_MouldProdOutBill_BeforeUnCheckCtrl"); if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核前判断失败!"; objJsonResult.data = null; return objJsonResult; } else { if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); objJsonResult.data = null; return objJsonResult; } } //反审核单据 if (!oBill.AbandonCheck(HInterID, oBill.omodel.HBillNo, "h_p_Sc_MouldProdOutBill_AfterUnCheckCtrl", HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反审核失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 反审核成功!"; objJsonResult.data = null; return objJsonResult; ; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; 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; } } #endregion #region 器具领用出库单 批量审核 /// /// 批量审核/反审核器具领用出库单 /// /// 单据ID /// 审核(1),反审核(2) /// 审核人 /// [Route("Sc_MouldProdOutBillController/CheckAll")] [HttpGet] public object CheckAll(string ids, int Type, string HMaker) { try { //处理字符串 if (!string.IsNullOrEmpty(ids)) { long[] idArray = Array.ConvertAll(ids.Split(','), long.Parse); // 处理idArray... oCn.BeginTran(); for (int i = 0; i < idArray.Length; i++) { objJsonResult = (json)GetSc_MouldProdOutBill_Check_Json(idArray[i], Type, HMaker);//审核执行 if (objJsonResult.count == 0) { oCn.RollBack(); objJsonResult.Message += "第" + (i + 1) + "行出现问题无法继续完成"; return objJsonResult; } } oCn.Commit(); } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "请选择正确行"; objJsonResult.data = null; return objJsonResult; } objJsonResult.code = CodeConstant.SUCCEED; objJsonResult.count = CountConstant.SUCCEED; objJsonResult.Message = "执行成功!"; objJsonResult.data = null; return objJsonResult; } catch (Exception e) { oCn.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核或反审核器具领用出库单失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 器具领用出库单 关闭/反关闭 /// /// 关闭/反关闭器具领用出库单 /// /// 单据ID /// 关闭(1),反关闭(2) /// 关闭人 /// [Route("Sc_MouldProdOutBillController/GetSc_MouldProdOutBill_Close_Json")] [HttpGet] public object GetSc_MouldProdOutBill_Close_Json(Int64 HInterID, int Type, string HMaker) { try { //判断权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameClose, 3, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块关闭/反关闭功能权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } //判断存在性 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) { //Type 1 关闭 2 反关闭 if (Type == 1) { if (oBill.omodel.HCloseMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已关闭,不能再次关闭!"; objJsonResult.data = null; return objJsonResult; } //关闭单据 if (!oBill.CloseBill(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 关闭成功!"; objJsonResult.data = null; return objJsonResult; ; } } else { if (oBill.omodel.HCloseMan.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未关闭,不需要反关闭!"; objJsonResult.data = null; return objJsonResult; } //反关闭单据 if (!oBill.CancelClose(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 反关闭成功!"; objJsonResult.data = null; return objJsonResult; ; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; 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; } } #endregion #region 器具领用出库单 作废/反作废 /// /// 作废/反作废 器具领用出库单 /// /// 单据ID /// 作废(1),反作废(2) /// 作废人 /// [Route("Sc_MouldProdOutBillController/GetSc_MouldProdOutBill_Cancelltion_Json")] [HttpGet] public object GetSc_MouldProdOutBill_Cancelltion_Json(Int64 HInterID, int Type, string HMaker) { try { //判断权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 3, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块作废/反作废功能权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } //判断存在性 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) { //Type 1 作废 2 反作废 if (Type == 1) { if (oBill.omodel.HDeleteMan.Trim() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已作废,不能再次作废!"; objJsonResult.data = null; return objJsonResult; } //作废单据 if (!oBill.Cancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 作废成功!"; objJsonResult.data = null; return objJsonResult; ; } } else { if (oBill.omodel.HDeleteMan.Trim() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未作废,不需要反作废!"; objJsonResult.data = null; return objJsonResult; } //反作废单据 if (!oBill.AbandonCancelltion(HInterID, oBill.omodel.HBillNo, HMaker, ref ClsPub.sExeReturnInfo)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + " 反作废成功!"; objJsonResult.data = null; return objJsonResult; ; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; 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; } } #endregion #region 器具出入库单模块 从列表选中打开单据,返回单据信息时调用 /// ///器具出入库单编辑时,根据单据ID获取单据信息 /// /// [Route("Sc_MouldStockBillController/GetSc_MouldStockBill_Json")] [HttpGet] public object GetSc_MouldStockBill_Json(Int64 HInterID, string HMaker) { List list = new List(); try { //判断权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 3, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块编辑权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } //返回列表信息 ds = oCn.RunProcReturn("exec h_p_Sc_MouldStockBill_EditInit " + HInterID, "h_p_Sc_MouldStockBill_EditInit"); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "未查询到该器具出入库单,请刷新数据后重新选择!"; objJsonResult.data = null; return objJsonResult; } else { list.Add(ds.Tables[0]); list.Add(ds.Tables[1]); objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "成功!"; objJsonResult.data = list; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "返回器具出入库单信息失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 器具领用出库单 保存 /// /// 器具领用出库单保存 /// [Route("Sc_MouldProdOutBillController/GetSc_MouldProdOutBill_Save_Json")] [HttpPost] public object GetSc_MouldProdOutBill_Save_Json([FromBody] JObject sMainSub) { var _value = sMainSub["sMainSub"].ToString(); string msg1 = _value.ToString(); string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); string sMainStr = sArray[0].ToString(); //主表数据 string sSubStr = sArray[1].ToString(); //子表数据 string OperationType = sArray[2].ToString(); //操作类型(1新增、2编辑) string HMaker = sArray[3].ToString(); //制单人 try { //判断权限 if (OperationType == "1") { BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew; //判断新增权限 if (!DBUtility.ClsPub.Security_Log(ModRightName, 1, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块新增权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } } else { BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify; //判断编辑权限 if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, false, HMaker)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "您没有该模块编辑权限,请与管理员联系!"; objJsonResult.data = null; return objJsonResult; } } //表头赋值 sMainStr = sMainStr.Replace("\\", ""); sMainStr = sMainStr.Replace("\n", ""); sMainStr = "[" + sMainStr.ToString() + "]"; List lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject>(sMainStr); foreach (Model.ClsSc_MouldProdOutBillMain oItem in lsmain) { //单据号是否重复 if (oBill.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, oItem.HInterID)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据号重复!不允许保存!"; objJsonResult.data = null; return objJsonResult; } //判断会计期是否合理 string s = ""; int sYear = 0; int sPeriod = 0; if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(oItem.HDate, ref sYear, ref sPeriod, ref s) == false) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = s; objJsonResult.data = null; return objJsonResult; } oItem.HYear = sYear; oItem.HPeriod = sPeriod; DBUtility.ClsPub.CurUserName = oItem.HMaker; oBill.omodel = oItem; } //表体赋值 //按 },{来拆分数组 //去掉【和】 sSubStr = sSubStr.Substring(1, sSubStr.Length - 2); sSubStr = sSubStr.Replace("\\", ""); sSubStr = sSubStr.Replace("\n", ""); sSubStr = "[" + sSubStr.ToString() + "]"; List ls = Newtonsoft.Json.JsonConvert.DeserializeObject>(sSubStr); int i = 0; foreach (Model.ClsSc_MouldProdOutBillSub oItemSub in ls) { i++; oItemSub.HEntryID = i; oBill.DetailColl.Add(oItemSub); } //保存 bool bResult; if (OperationType == "1") //新增保存 { bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); } else //编辑保存 { bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); } if (bResult) { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; //成功! objJsonResult.data = null; objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; objJsonResult.data = null; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "保存失败!" + e.Message; objJsonResult.data = null; return objJsonResult; } } #endregion #region 器具领用出库单 返回源单数据 /// /// 返回源单数据 /// /// [Route("Sc_MouldProdOutBillController/GetSourceBill_MouldProdOut_Json")] [HttpGet] public object GetSourceBill_MouldProdOut_Json(Int64 HInterID, Int64 HEntryID, string HBillType) { try { string sViewName = ""; //器具领用申请单 if (HBillType== "3849") { sViewName = "h_p_Sc_MouldOutRequestBill_Source_MouldProdOut"; } if (sViewName == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "不支持该源单类型!"; objJsonResult.data = null; return objJsonResult; } ds = oCn.RunProcReturn("exec " + sViewName + " " + HInterID.ToString() + "," + HEntryID.ToString(), sViewName); if (ds == null || ds.Tables[0].Rows.Count == 0) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "未查询到源单信息!"; objJsonResult.data = null; return objJsonResult; } else { objJsonResult.code = "0"; objJsonResult.count = 1; objJsonResult.Message = "成功!"; objJsonResult.data = ds.Tables[0]; return objJsonResult; } } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "获取源单信息失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }