| | |
| | | using Newtonsoft.Json; |
| | | using DBUtility; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | { |
| | | public class Gy_SettleStyleController : ApiController |
| | | { |
| | | //è·åç³»ç»åæ° |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | DataSet ds; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region [忥åºç¡èµæ] |
| | | [Route("Gy_SettleStyle/Gy_SettleStyleViewApi")] |
| | | [HttpGet] |
| | | public json Gy_SettleStyleViewApi(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_SETTLETYPE", 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_SettleStyle where HNumber = '" + Number + "'", "Gy_SettleStyle"); |
| | | 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 = "已使ç¨" |
| | | }; |
| | | #endregion |
| | | // å é¤ä¸»è¡¨å¯¹åºæ°æ® |
| | | sql = $"delete from Gy_SettleStyle where HItemID = " + jsonData.HItemID + " and HNumber = '" + Number + "'"; |
| | | oCN.RunProc(sql); |
| | | |
| | | sql = "set identity_insert Gy_SettleStyle on"; |
| | | oCN.RunProc(sql); |
| | | |
| | | //æå
¥è¡¨ |
| | | sql = $@" |
| | | insert into Gy_SettleStyle |
| | | (HItemID,HNumber,HName,HShortNumber,HParentID,HLevel |
| | | ,HEndFlag,HStopflag,HRemark,HUseFlag) |
| | | values |
| | | ({jsonData.HItemID},'{jsonData.HNumber}','{jsonData.HName}', |
| | | '{jsonData.HShortNumber}',{jsonData.HParentID},{jsonData.HLevel},{jsonData.HEndFlag},{jsonData.HStopflag},'{jsonData.HRemark}','{jsonData.HUseFlag}')"; |
| | | |
| | | oCN.RunProc(sql); |
| | | |
| | | sql = "set identity_insert Gy_SettleStyle 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 |
| | | |
| | | } |
| | | } |