| | |
| | | using Model; |
| | | using DBUtility; |
| | | using Model; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | |
| | | { |
| | | public class Gy_TaxMIXController : ApiController |
| | | { |
| | | //è·åç³»ç»åæ° |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | | |
| | | //#region ç¨çç»å å表 |
| | | //[Route("Gy_TaxMIX/TaxMIXList")] |
| | | //[HttpGet] |
| | | //public object TaxMIXList(string sWhere, string user, string Organization) |
| | | //{ |
| | | // try |
| | | // { |
| | | // List<object> columnNameList = new List<object>(); |
| | | // //ç¼è¾æé |
| | | // //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user)) |
| | | // //{ |
| | | // // objJsonResult.code = "0"; |
| | | // // objJsonResult.count = 0; |
| | | // // objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | // // objJsonResult.data = null; |
| | | // // return objJsonResult; |
| | | // //} |
| | | // string sql1 = string.Format(@"select * from h_v_Gy_TaxMIXList where 使ç¨ç»ç»='" + Organization + "'"); |
| | | #region ç¨çç»å å表 |
| | | [Route("Gy_TaxMIX/TaxMIXList")] |
| | | [HttpGet] |
| | | public object TaxMIXList(string sWhere, string user, string Organization) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //ç¼è¾æé |
| | | //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Query", 1, false, user)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ æ¥çæéï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | string sql1 = string.Format(@"select * from h_v_Gy_TaxMIXList where 使ç¨ç»ç»='" + Organization + "'"); |
| | | |
| | | // string sql = sql1 + sWhere; |
| | | // ds = oCN.RunProcReturn(sql, "h_v_Gy_TaxMIXList"); |
| | | string sql = sql1 + sWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_TaxMIXList"); |
| | | |
| | | // //æ·»å åå |
| | | // 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å对象çåå |
| | | // } |
| | | //æ·»å åå |
| | | 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.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 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | 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("Gy_TaxMIX/TaxMIXEdit")] |
| | | //[HttpPost] |
| | | //public object TaxMIXEdit([FromBody] JObject msg) |
| | | //{ |
| | | // DataSet ds; |
| | | // var _value = msg["msg"].ToString(); |
| | | // string msg3 = _value.ToString(); |
| | | // string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | // string msg1 = sArray[0].ToString(); |
| | | // string msg2 = sArray[1].ToString(); |
| | | // //string msg_HUSEORGID = sArray[2].ToString(); |
| | | // Int64 HItemID = 0; |
| | | // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | #region ç¨çç»å ç¼è¾ |
| | | [Route("Gy_TaxMIX/TaxMIXEdit")] |
| | | [HttpPost] |
| | | public object TaxMIXEdit([FromBody] JObject msg) |
| | | { |
| | | DataSet ds; |
| | | var _value = msg["msg"].ToString(); |
| | | string msg3 = _value.ToString(); |
| | | string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg1 = sArray[0].ToString(); |
| | | string msg2 = sArray[1].ToString(); |
| | | //string msg_HUSEORGID = sArray[2].ToString(); |
| | | Int64 HItemID = 0; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | // //ç¼è¾æé |
| | | // //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2)) |
| | | // //{ |
| | | // // objJsonResult.code = "0"; |
| | | // // objJsonResult.count = 0; |
| | | // // objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | // // objJsonResult.data = null; |
| | | // // return objJsonResult; |
| | | // //} |
| | | //ç¼è¾æé |
| | | //if (!DBUtility.ClsPub.Security_Log_second("Gy_TaxRate_Edit", 1, false, msg2)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ ä¿åæéï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | // //è·åæå¤§IDå¼èµå¼ |
| | | // //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate"); |
| | | // //if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) |
| | | // //{ |
| | | // // //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] |
| | | // // var maxid = Convert.ToInt32((Maxds.Tables[0].Rows[0]["HItemID"].ToString()==""?0: Maxds.Tables[0].Rows[0]["HItemID"])); |
| | | // // maxid += 1; |
| | | // // HItemID = maxid; |
| | | // //} |
| | | // ListModels oListModels = new ListModels(); |
| | | //è·åæå¤§IDå¼èµå¼ |
| | | //DataSet Maxds = oCN.RunProcReturn("select MAX(HItemID) HItemID from Gy_TaxRate ", "Gy_TaxRate"); |
| | | //if (Maxds != null || Maxds.Tables[0].Rows.Count > 0) |
| | | //{ |
| | | // //HItemID= Maxds.Tables[0].Rows[0]["HItemID"] |
| | | // var maxid = Convert.ToInt32((Maxds.Tables[0].Rows[0]["HItemID"].ToString()==""?0: Maxds.Tables[0].Rows[0]["HItemID"])); |
| | | // maxid += 1; |
| | | // HItemID = maxid; |
| | | //} |
| | | ListModels oListModels = new ListModels(); |
| | | |
| | | // try |
| | | // { |
| | | // DAL.ClsGy_TaxMIX_Ctl oBill = new DAL.ClsGy_TaxMIX_Ctl(); |
| | | // List<Model.ClsGy_TaxMIX_Model> lsmain = new List<Model.ClsGy_TaxMIX_Model>(); |
| | | // msg1 = msg1.Replace("\\", ""); |
| | | // msg1 = msg1.Replace("\n", ""); //\n |
| | | // lsmain = oListModels.getObjectByJson_Gy_TaxMIX(msg1); |
| | | // foreach (Model.ClsGy_TaxMIX_Model oItem in lsmain) |
| | | // { |
| | | // if (oItem.HNumber.Trim() == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ä»£ç ä¸è½ä¸ºç©ºï¼"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // if (oItem.HName.Trim() == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼åç§°ä¸è½ä¸ºç©ºï¼"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | try |
| | | { |
| | | DAL.ClsGy_TaxMIX_Ctl oBill = new DAL.ClsGy_TaxMIX_Ctl(); |
| | | List<Model.ClsGy_TaxMIXMain_Model> lsmain = new List<Model.ClsGy_TaxMIXMain_Model>(); |
| | | msg1 = msg1.Replace("\\", ""); |
| | | msg1 = msg1.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_TaxMIXMain(msg1); |
| | | foreach (Model.ClsGy_TaxMIXMain_Model oItem in lsmain) |
| | | { |
| | | if (oItem.HNumber.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ä»£ç ä¸è½ä¸ºç©ºï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (oItem.HName.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼åç§°ä¸è½ä¸ºç©ºï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | // //æ¥è¯¢æ°æ®ä¸æ¯å¦åå¨éå¤ä»£ç |
| | | // ds = oCN.RunProcReturn("select * from Gy_TaxMIX where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_TaxMIX"); |
| | | // if (oItem.HItemID == 0) |
| | | // { |
| | | // if (ds.Tables[0].Rows.Count > 0) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // if (ds.Tables[0].Rows.Count > 0) |
| | | // { |
| | | // if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString()) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // } |
| | | //æ¥è¯¢æ°æ®ä¸æ¯å¦åå¨éå¤ä»£ç |
| | | ds = oCN.RunProcReturn("select * from Gy_TaxMIXMain where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_TaxMIXMain"); |
| | | if (oItem.HItemID == 0) |
| | | { |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HItemID"].ToString() != oItem.HItemID.ToString()) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // //æ°å¢æ¶å¤æ |
| | | // #region ç¶çº§æ ¡éªæ¹æ³ï¼apiè°ç¨å
注éæï¼ï¼ |
| | | // /* |
| | | // if (oItem.HItemID == 0) |
| | | // { |
| | | // if (ds == null || ds.Tables[0].Rows.Count > 0) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // //æ£æ¥ç¶çº§æ¯å¦åå¨ |
| | | // string sParent; |
| | | // sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); |
| | | // if (sParent.Trim() == "") |
| | | // { |
| | | // oBill.oModel.HParentID = 0; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (oBill.HavParentCode(sParent.Trim(), HItemID)) |
| | | // { |
| | | // oBill.oModel.HParentID = oBill.oModel.HItemID; |
| | | // } |
| | | // else |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ä¸çº§ä»£ç ä¸åå¨æè¢«ç¦ç¨ï¼"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // } |
| | | // else//ç¼è¾æ¶å¤æ |
| | | // { |
| | | // //æ£æ¥ç¶çº§æ¯å¦åå¨ |
| | | // string sParent; |
| | | // sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); |
| | | // if (sParent.Trim() == "") |
| | | // { |
| | | // oBill.oModel.HParentID = 0; |
| | | // } |
| | | // else |
| | | // { |
| | | // if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) |
| | | // { |
| | | // oBill.oModel.HParentID = oBill.oModel.HItemID; |
| | | // } |
| | | // else |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ä¸çº§ä»£ç ä¸åå¨æè¢«ç¦ç¨ï¼"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // } |
| | | // */ |
| | | // #endregion |
| | | // //å¾å°ç代ç |
| | | // string sShortNumber; |
| | | // sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); |
| | | // if (sShortNumber.Trim() == "") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼ç代ç 为空ï¼"; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //ç»ç»id |
| | | // oItem.HShortNumber = sShortNumber;//ç代ç |
| | | // oItem.HEndFlag = true;//æ«çº§æ å¿ |
| | | // oItem.HLevel = 1; //ç级 DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()) |
| | | // oBill.oModel = oItem; |
| | | // } |
| | | // //ä¿å |
| | | // //ä¿å宿¯åå¤ç |
| | | // bool bResult; |
| | | // if (oBill.oModel.HItemID == 0) |
| | | // { |
| | | // bResult = oBill.AddNew(); |
| | | // } |
| | | // else |
| | | // { |
| | | // bResult = oBill.ModifyByID(oBill.oModel.HItemID); |
| | | // } |
| | | // if (bResult) |
| | | // { |
| | | // objJsonResult.code = "1"; |
| | | // objJsonResult.count = 1; |
| | | // objJsonResult.Message = "ä¿åæåï¼"; |
| | | // //WebAPIController.Add_Log("éè´§å䏿¨", UserName, "çæéè´§å"); |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // else |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼" + DBUtility.ClsPub.sExeReturnInfo; |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "ä¿å失败ï¼" + e.ToString(); |
| | | // objJsonResult.data = 1; |
| | | // return objJsonResult; |
| | | // } |
| | | //} |
| | | //#endregion |
| | | //æ°å¢æ¶å¤æ |
| | | #region ç¶çº§æ ¡éªæ¹æ³ï¼apiè°ç¨å
注éæï¼ï¼ |
| | | /* |
| | | if (oItem.HItemID == 0) |
| | | { |
| | | if (ds == null || ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ä»£ç éå¤ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //æ£æ¥ç¶çº§æ¯å¦åå¨ |
| | | string sParent; |
| | | sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); |
| | | if (sParent.Trim() == "") |
| | | { |
| | | oBill.oModel.HParentID = 0; |
| | | } |
| | | else |
| | | { |
| | | if (oBill.HavParentCode(sParent.Trim(), HItemID)) |
| | | { |
| | | oBill.oModel.HParentID = oBill.oModel.HItemID; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ä¸çº§ä»£ç ä¸åå¨æè¢«ç¦ç¨ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else//ç¼è¾æ¶å¤æ |
| | | { |
| | | //æ£æ¥ç¶çº§æ¯å¦åå¨ |
| | | string sParent; |
| | | sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); |
| | | if (sParent.Trim() == "") |
| | | { |
| | | oBill.oModel.HParentID = 0; |
| | | } |
| | | else |
| | | { |
| | | if (oBill.HavParentCode(sParent.Trim(), oItem.HItemID)) |
| | | { |
| | | oBill.oModel.HParentID = oBill.oModel.HItemID; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ä¸çº§ä»£ç ä¸åå¨æè¢«ç¦ç¨ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | #endregion |
| | | //å¾å°ç代ç |
| | | string sShortNumber; |
| | | sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); |
| | | if (sShortNumber.Trim() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼ç代ç 为空ï¼"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //oItem.HUSEORGID = Convert.ToInt32(msg_HUSEORGID); //ç»ç»id |
| | | oItem.HShortNumber = sShortNumber;//ç代ç |
| | | oItem.HEndFlag = true;//æ«çº§æ å¿ |
| | | oItem.HLevel = 1; //ç级 DBUtility.ClsPub.GetLevel(oItem.HNumber.Trim()) |
| | | oBill.oModel = oItem; |
| | | } |
| | | //ä¿å |
| | | //ä¿å宿¯åå¤ç |
| | | bool bResult; |
| | | if (oBill.oModel.HItemID == 0) |
| | | { |
| | | bResult = oBill.AddNew(); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyByID(oBill.oModel.HItemID); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¿åæåï¼"; |
| | | //WebAPIController.Add_Log("éè´§å䏿¨", UserName, "çæéè´§å"); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | //#region ç¨çç»å å é¤ |
| | | //[Route("Gy_TaxMIX/Delete")] |
| | | //[HttpGet] |
| | | //public object Delete(string HItemID, string user) |
| | | //{ |
| | | // DataSet ds; |
| | | // try |
| | | // { |
| | | // SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | // //å 餿é |
| | | // //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user)) |
| | | // //{ |
| | | // // objJsonResult.code = "0"; |
| | | // // objJsonResult.count = 0; |
| | | // // objJsonResult.Message = "æ å 餿é"; |
| | | // // objJsonResult.data = null; |
| | | // // return objJsonResult; |
| | | // //} |
| | | // 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_TaxMIX where HItemID=" + HItemID, "Gy_TaxMIX"); |
| | | // if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; ; |
| | | // } |
| | | // var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); |
| | | // if (HStopflag) |
| | | // { |
| | | // oCN.RollBack();//åæ»äºå¡ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ°æ®å·²ç¦ç¨æ æ³å é¤ï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | [Route("Gy_TaxMIX/Delete")] |
| | | [HttpGet] |
| | | public object Delete(string HItemID, string user) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | //å 餿é |
| | | //if (!DBUtility.ClsPub.Security_Log("Gy_TaxRate_Drop", 1, false, user)) |
| | | //{ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "æ å 餿é"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | 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_TaxMIXMain where HItemID=" + HItemID, "Gy_TaxMIXMain"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ²¡ææ°æ®ï¼æ æ³å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | } |
| | | var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); |
| | | if (HStopflag) |
| | | { |
| | | oCN.RollBack();//åæ»äºå¡ |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ°æ®å·²ç¦ç¨æ æ³å é¤ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | // oCN.RunProc("delete from Gy_TaxMIX where HItemID=" + HItemID); |
| | | // oCN.Commit();//æäº¤äºå¡ |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 1; |
| | | // objJsonResult.Message = "* æ°æ®å 餿åï¼"; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; ; |
| | | oCN.RunProc("delete from Gy_TaxMIXMain where HItemID=" + HItemID); |
| | | oCN.RunProc("delete from Gy_TaxMIXSub where HTaxMixID=" + 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; |
| | | // } |
| | | //} |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "å é¤å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //#endregion |
| | | |
| | | #region ç¨çç»å éè¶åæ¥ |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region [忥åºç¡èµæ] |
| | | [Route("Gy_TaxMIX/Gy_TaxMIXViewApi")] |
| | | [HttpGet] |
| | | public json Gy_TaxMIXViewApi(string Number, string Type) |
| | | { |
| | | string sql = string.Empty; |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | | { |
| | | //ç³»ç»åæ°æ¯å¦ä¸ºç§æäºæ¨¡å¼,N为å
¬æäºæ¨¡å¼ï¼Yä¸ºç§æäºæ¨¡å¼ |
| | | if (oSystemParameter.omodel.WMS_CloudMode == "Y") |
| | | { |
| | | #region [ç§æäºæ¨¡å¼ï¼ç´æ¥è°ç¨æ°æ®åºåå¨è¿ç¨æ´æ°] |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | DataSet DS = oCn.RunProcReturn("exec h_p_WMS_ERPBasicInfoToLocal '" + Number + "','" + Type + "'", "h_p_WMS_ERPBasicInfoToLocal"); |
| | | if (DS == null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åºç¡èµæåæ¥å¤±è´¥"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HBack"]) == "2") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ERPä¸ä¸åå¨è¯¥ä»£ç "; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "åºç¡èµæåæ¥æå"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | } |
| | | else |
| | | { |
| | | #region [å
¬æäºæ¨¡å¼ï¼è°ç¨WEBAPIçæ¹å¼è¿è¡æ´æ°] |
| | | var json = new |
| | | { |
| | | CreateOrgId = 0, |
| | | Number = Number, |
| | | Id = "" |
| | | }; |
| | | #region [éè¶é¨å] |
| | | //ç»å½éè¶ |
| | | var loginRet = InvokeHelper.Login(); |
| | | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); |
| | | //夿æ¯å¦ç»å½æå |
| | | if (isSuccess < 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = loginRet; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //æ¥ç è·åæ°æ® |
| | | var _result = InvokeHelper.View("BD_TAXMIX", JsonConvert.SerializeObject(json)); |
| | | var _saveObj = JObject.Parse(_result); |
| | | //å¤ææ°æ®æ¯å¦è·åæå |
| | | if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "éè¶ç¨ç»ååæ¥å¤±è´¥jsonRootï¼" + _result; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | #endregion |
| | | //è·åæ°æ® |
| | | DataSet Ds; |
| | | Ds = oCN.RunProcReturn("select * from Gy_TaxMIXMain where HNumber = '" + Number + "'", "Gy_TaxMIXMain"); |
| | | if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemID"].ToString()) != 0) |
| | | { |
| | | |
| | | } |
| | | #region [ä¸»è¡¨æ°æ®èµå¼] |
| | | var jsonData = new |
| | | { |
| | | HItemID = _saveObj["Result"]["Result"]["Id"], |
| | | HNumber = _saveObj["Result"]["Result"]["Number"], |
| | | HName = _saveObj["Result"]["Result"]["Name"][0]["Value"], |
| | | HShortNumber = _saveObj["Result"]["Result"]["Number"], |
| | | HParentID = 0, |
| | | HLevel = 1, |
| | | HEndFlag = 1, |
| | | HStopflag = _saveObj["Result"]["Result"]["ForbidStatus"].ToString() == "A" ? 0 : 1, |
| | | HRemark = "CLD-ERP导å
¥", |
| | | HUseFlag = "已使ç¨", |
| | | HUSEORGID = 0, |
| | | HCREATEORGID = 0, |
| | | HMakeEmp = _saveObj["Result"]["Result"]["CreatorId_Id"], |
| | | HMakeTime = _saveObj["Result"]["Result"]["CreateDate"], |
| | | HCheckEmp = _saveObj["Result"]["Result"]["AuditorID_Id"], |
| | | HCheckTime = _saveObj["Result"]["Result"]["AuditDate"], |
| | | HModifyEmp = _saveObj["Result"]["Result"]["ModifierId_Id"], |
| | | HModifyTime = _saveObj["Result"]["Result"]["FModifyDate"], |
| | | HStopEmp = _saveObj["Result"]["Result"]["ForbidderID_Id"], |
| | | HStopTime = _saveObj["Result"]["Result"]["ForbidDate"] |
| | | }; |
| | | #endregion |
| | | // å é¤ä¸»è¡¨å¯¹åºæ°æ® |
| | | sql = $"delete from Gy_TaxMIXMain where HItemID = " + jsonData.HItemID + " and HNumber = '" + Number + "'"; |
| | | oCN.RunProc(sql); |
| | | |
| | | sql = "set identity_insert Gy_TaxMIXMain on"; |
| | | oCN.RunProc(sql); |
| | | |
| | | //æå
¥è¡¨ |
| | | sql = $@" |
| | | insert into Gy_TaxMIXMain |
| | | (HItemID,HNumber,HName,HShortNumber,HParentID,HLevel |
| | | ,HEndFlag,HStopflag,HRemark,HUseFlag,HUSEORGID,HCREATEORGID |
| | | ,HMakeEmp,HMakeTime,HCheckEmp,HCheckTime,HModifyEmp,HModifyTime,HStopEmp,HStopTime) |
| | | values |
| | | ({jsonData.HItemID},'{jsonData.HNumber}','{jsonData.HName}', |
| | | '{jsonData.HShortNumber}',{jsonData.HParentID},{jsonData.HLevel},{jsonData.HEndFlag},{jsonData.HStopflag},'{jsonData.HRemark}','{jsonData.HUseFlag}','{jsonData.HUSEORGID}', |
| | | '{jsonData.HCREATEORGID}','{jsonData.HMakeEmp}','{jsonData.HMakeTime}','{jsonData.HCheckEmp}', |
| | | '{jsonData.HCheckTime}','{jsonData.HModifyEmp}','{jsonData.HModifyTime}','{jsonData.HStopEmp}','{jsonData.HStopTime}')"; |
| | | |
| | | oCN.RunProc(sql); |
| | | |
| | | sql = "set identity_insert Gy_TaxMIXMain off"; |
| | | oCN.RunProc(sql); |
| | | |
| | | #region [å表åé] |
| | | var dataArr = _saveObj["Result"]["Result"]["BD_TAXMIXENTRY"]; |
| | | #endregion |
| | | |
| | | // å é¤åè¡¨å¯¹åºæ°æ® |
| | | sql = $"delete from Gy_TaxMIXSub where HTaxMixID = " + jsonData.HItemID; |
| | | oCN.RunProc(sql); |
| | | |
| | | foreach (var oSub in dataArr) |
| | | { |
| | | #region [åè¡¨æ°æ®èµå¼] |
| | | var subData = new |
| | | { |
| | | HItemID = oSub["Id"], |
| | | HTAXBENCHMARK = oSub["TaxBenchMark_Id"], |
| | | FTAXRATEID = oSub["TaxRateID_Id"], |
| | | FTAXBENCHMARKCORRVALUE = oSub["TaxBenchMarkCorrValue"], |
| | | HTaxMixID = jsonData.HItemID |
| | | }; |
| | | #endregion |
| | | |
| | | sql = "set identity_insert Gy_TaxMIXSub on"; |
| | | oCN.RunProc(sql); |
| | | |
| | | //æå
¥å表 |
| | | sql = $@" |
| | | insert into Gy_TaxMIXSub |
| | | (HItemID,HTAXBENCHMARK,FTAXRATEID,FTAXBENCHMARKCORRVALUE,HTaxMixID) |
| | | values |
| | | ({subData.HItemID},'{subData.HTAXBENCHMARK}',{subData.FTAXRATEID},'{subData.FTAXBENCHMARKCORRVALUE}',{subData.HTaxMixID})"; |
| | | |
| | | oCN.RunProc(sql); |
| | | |
| | | sql = "set identity_insert Gy_TaxMIXSub off"; |
| | | oCN.RunProc(sql); |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ç¨ç»å忥æåï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "åºç¡èµæè¯»å失败ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |