diff --git a/NX.ERP.Model/Response/Purchase/Arrival.cs b/NX.ERP.Model/Response/Purchase/Arrival.cs index 1f994b4..e40ba21 100644 --- a/NX.ERP.Model/Response/Purchase/Arrival.cs +++ b/NX.ERP.Model/Response/Purchase/Arrival.cs @@ -19,7 +19,7 @@ namespace NX.ERP.Model.Purchase public int Id { get => id; set => id = value; } public string ArrivalCode { get => arrivalCode; set => arrivalCode = value; } public DateTime Date { get => _date; set => _date = value; } - public ICollection ArrivalDetails { get => arrivalDetails; set => arrivalDetails = value; } + public ICollection Details { get => arrivalDetails; set => arrivalDetails = value; } public string SupplierCode { get => supplierCode; set => supplierCode = value; } public double ExchRate { get; set; } public string ExchName { get; set; } diff --git a/NX.ERP.U8.App/App.config b/NX.ERP.U8.App/App.config index 5151d4e..2d4fed1 100644 --- a/NX.ERP.U8.App/App.config +++ b/NX.ERP.U8.App/App.config @@ -6,7 +6,7 @@ - + diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index 474c59c..47af224 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -73,7 +73,7 @@ namespace U8AppMain } private string url = ConfigurationManager.AppSettings.Get("url"); - private string connStr = ConfigurationManager.AppSettings.Get("connStr"); + // private string connStr = ConfigurationManager.AppSettings.Get("connStr"); private DataTable dataTable; @@ -288,8 +288,8 @@ namespace U8AppMain private void 登录ToolStripMenuItem_Click(object sender, EventArgs e) { - - + + //u8LoginContext = new NX.ERP.U8.U8LoginContext(); //u8LoginContext.Login(true); diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index 2a56a5b..a7b8a85 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -39,7 +39,7 @@ namespace NX.ERP.U8.Purchase arrival = _arrival; } - arrival.ArrivalDetails.Add(ArrivalDetail); + arrival.Details.Add(ArrivalDetail); return arrival; }, param, null, true, "id", 10, System.Data.CommandType.Text); return lookup.Values; diff --git a/NX.ERP.U8/Store/PuStoreInDAL.cs b/NX.ERP.U8/Store/PuStoreInDAL.cs index 8844d83..a8df80d 100644 --- a/NX.ERP.U8/Store/PuStoreInDAL.cs +++ b/NX.ERP.U8/Store/PuStoreInDAL.cs @@ -68,7 +68,7 @@ namespace NX.ERP.U8.Store for (var n = 0; n < puStoreIn.Details.Count; n++) { var detail = puStoreIn.Details[n]; - var arrivalDetail = Arrival.ArrivalDetails.First(m => { return m.Id == detail.SorceDetailId; }); + var arrivalDetail = Arrival.Details.First(m => { return m.Id == detail.SorceDetailId; }); headXml.setAttribute("cordercode", arrivalDetail.OrderCode); // headXml.setAttribute("ipurorderid", arrivalDetail.PoId); bodyXml = domBody.createElement("z:row"); diff --git a/NX.ERP.U8/U8LoginContext.cs b/NX.ERP.U8/U8LoginContext.cs index bb1d6a1..5ededc4 100644 --- a/NX.ERP.U8/U8LoginContext.cs +++ b/NX.ERP.U8/U8LoginContext.cs @@ -78,18 +78,52 @@ namespace NX.ERP.U8 { if (uiLogin != null) { - uiLogin.SubLogout(AccID); + uiLogin.SubLogout(this._accid); uiLogin.ShutDown(); uiLogin = null; } } - public string UserId { get; set; } = "003"; - public string PassWord { get; set; } = "123456"; + private string _userId = ""; - public string Server { get; set; } = "192.168.0.250"; - public string AccID { get; set; } = "(default)@001"; + public string UserId + { + set + { + this._userId = value; + } + } + private string _password = ""; + + public string PassWord + { + set + { + this._password = value; + + } + } + + + private string _server; + + public string Server + { + set + { + this._server = value; + } + } + + private string _accid; + public string AccID + { + set + { + this._accid = value; + } + } public string Serial { get; set; } /// @@ -140,10 +174,24 @@ namespace NX.ERP.U8 } } - - public void Login(bool showlogin = false) + public bool NeedUiLogin { - if (showlogin) + get + { + + return string.IsNullOrEmpty(this._userId) || + string.IsNullOrEmpty(this._password) || + string.IsNullOrEmpty(this._server) || + string.IsNullOrEmpty(this._accid); + + + } + } + + + public void Login() + { + if (NeedUiLogin) { if (!UiLogin.login("DP")) { @@ -152,8 +200,7 @@ namespace NX.ERP.U8 } else { - - if (!UiLogin.login("DP", "wx999", "!@#qwe123", "192.168.0.168", DateTime.Today.ToString("yyyy-MM-dd"), AccID, Serial)) + if (!UiLogin.login("DP", this._userId, this._password, this._server, DateTime.Today.ToString("yyyy-MM-dd"), this._accid, Serial)) { throw new Exception(UiLogin.ErrDescript); } @@ -175,9 +222,9 @@ namespace NX.ERP.U8 } - - + + diff --git a/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs b/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs index e377201..65499b7 100644 --- a/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs +++ b/NX.ERP.WebAPi/App_Start/SwaggerConfig.cs @@ -101,7 +101,7 @@ namespace NX.ERP.WebAPi // those comments into the generated docs and UI. You can enable this by providing the path to one or // more Xml comment files. // - c.IncludeXmlComments(string.Format("{0}/bin/NX.ERP.WebAPi.xml", System.AppDomain.CurrentDomain.BaseDirectory)); + // c.IncludeXmlComments(string.Format("{0}/bin/NX.ERP.WebAPi.xml", System.AppDomain.CurrentDomain.BaseDirectory)); // Swashbuckle makes a best attempt at generating Swagger compliant JSON schemas for the various types // exposed in your API. However, there may be occasions when more control of the output is needed. diff --git a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs index a1bf8c2..22fa74e 100644 --- a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs +++ b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs @@ -27,7 +27,7 @@ namespace NX.ERP.WebAPi actionExecutedContext.Response.Content = new System.Net.Http.ObjectContent(typeof(ResultModel), new ResultModel { ErrCode = 500, ErrMsg = ex.Message, Data = null }, - new JsonMediaTypeFormatter()); + GlobalConfiguration.Configuration.Formatters.JsonFormatter); return Task.FromResult(0); } @@ -47,11 +47,11 @@ namespace NX.ERP.WebAPi result.Data = actionExecutedContext.ActionContext.Response.Content.ReadAsAsync().Result; //请求是否成功 - // result.IsSuccess = actionExecutedContext.ActionContext.Response.IsSuccessStatusCode; + //result.IsSuccess = actionExecutedContext.ActionContext.Response.IsSuccessStatusCode; //结果转为自定义消息格式 - HttpResponseMessage httpResponseMessage = new HttpResponseMessage() { Content = new ObjectContent>(result, new JsonMediaTypeFormatter()) }; + actionExecutedContext.Response.Content = new ObjectContent>( result, GlobalConfiguration.Configuration.Formatters.JsonFormatter); // 重新封装回传格式 - actionExecutedContext.Response = httpResponseMessage; + // actionExecutedContext.Response = httpResponseMessage; } } } @@ -80,9 +80,16 @@ namespace NX.ERP.WebAPi { public static void Register(HttpConfiguration config) { + + NX.ERP.U8.U8LoginContext.Instance.AccID = System.Configuration.ConfigurationManager.AppSettings["AccId"]; + NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"]; + + NX.ERP.U8.U8LoginContext.Instance.UserId = System.Configuration.ConfigurationManager.AppSettings["UserId"]; + NX.ERP.U8.U8LoginContext.Instance.Server= System.Configuration.ConfigurationManager.AppSettings["Server"]; + //System.Web.Http.Filters.IExceptionFilter config.Filters.Add(new ExceptionFilter()); - config.Filters.Add(new ApiResultAttribute()); + //config.Filters.Add(new ApiResultAttribute()); Console.WriteLine(config.Filters.Count); // Web API 配置和服务 GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings @@ -92,11 +99,11 @@ namespace NX.ERP.WebAPi NullValueHandling = NullValueHandling.Ignore, //Formatting = Newtonsoft.Json.Formatting.Indented, //小驼峰命名法 - //ContractResolver = new DefaultContractResolver() - //{ + ContractResolver = new DefaultContractResolver() + { - // NamingStrategy = new SnakeCaseNamingStrategy() - //} + NamingStrategy = new SnakeCaseNamingStrategy() + } //格式化日期时间 //空值处理 diff --git a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj index d72b5c7..935cc8b 100644 --- a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj +++ b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj @@ -37,7 +37,8 @@ 4 x86 false - bin\NX.ERP.WebAPi.xml + + true diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index b5067ed..6d8aa25 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -5,6 +5,10 @@ --> + + + +