| | |
| | | using System.Data.SqlClient; |
| | | using System.Web.Http; |
| | | using WebAPI.Models; |
| | | using SyntacticSugar.constant; |
| | | |
| | | namespace WebAPI.Controllers |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | oItem.HMaker = msg4; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "2003"; |
| | | oItem.HBillSubType = "2003"; |
| | |
| | | { |
| | | bResult = false; |
| | | } |
| | | |
| | | //自动审核设置 |
| | | if (refSav == "Add") |
| | | { |
| | | objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID |
| | | //系统参数 自动审核 |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | if (oSystemParameter.omodel.YS_ReceiveBill_AutoCheck == "Y") //系统参数 自动审核 |
| | | { |
| | | objJsonResult.Verify = "Y"; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | } |
| | | } |
| | | else if (refSav == "Update") |
| | | { |
| | | objJsonResult.HInterID = oBill.omodel.HInterID.ToString(); //返回主ID |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveBillList where hmainid=" + HInterID, "h_v_YS_ReceiveBillList"); |
| | | string hSourceBillType = ds.Tables[0].Rows[0]["源单类型"].ToString(); |
| | | if (hSourceBillType == "1426") |
| | | { |
| | | //收款单 删除回填 应付单关联数量 |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_ReceiveToReceivableIn_Del " + HInterID); |
| | | } |
| | | |
| | | oCN.RunProc("delete from YS_ReceiveBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("delete from YS_ReceiveBillSub where HInterID= " + HInterID); |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 收款单查询列表 |
| | | [Route("YS_ReceiveBill/QueryList")] |
| | | [HttpGet] |
| | | public object QueryList(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //判断是否有查询权限 |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBillQuery", 1, false, user)) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "无权限查看!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string sql = "select * from h_v_YS_ReceiveBillQuery where 1 = 1 "; |
| | | |
| | | if (sWhere == "" || sWhere == null) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_YS_ReceiveBillQuery order by hmainid desc", "h_v_YS_ReceiveBillQuery"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn(sql + sWhere + " order by hmainid desc", "h_v_YS_ReceiveBillQuery"); |
| | | } |
| | | |
| | | |
| | | |
| | | 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 = CountConstant.SUCCEED; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 收款单查询子列表 |
| | | [Route("YS_ReceiveBill/QuerySubList")] |
| | | [HttpGet] |
| | | public object QuerySubList(string hmainid, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //判断是否有查询权限 |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("YS_ReceiveBillQuery", 1, false, user)) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "无权限查看!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | string sql = "select * from h_v_YS_ReceiveBillQuerySub where hmainid = " + hmainid; |
| | | |
| | | ds = oCN.RunProcReturn(sql + " order by hsubid desc", "h_v_YS_ReceiveBillQuerySub"); |
| | | |
| | | |
| | | 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 = CountConstant.SUCCEED; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = CodeConstant.FAIL; |
| | | objJsonResult.count = CountConstant.FAIL; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |