From 2f12959be0152f9b6c1e6046ac97c9860ae8f7e9 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 28 Jan 2021 10:10:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=90=8D=E7=A7=B0=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NX.ERP.BLL/Model/OutBound.cs | 2 +- NX.ERP.BLL/Model/OutBoundType.cs | 2 +- NX.ERP.BLL/Store/SotreOut.cs | 12 +++--- NX.ERP.Model/Request/Materiel.cs | 8 ++-- NX.ERP.Model/Request/MaterielStoreOut.cs | 6 +-- .../Request/MaterielStoreOutDetail.cs | 2 +- NX.ERP.Model/Request/MaterielType.cs | 10 ++--- NX.ERP.Model/Response/Base/Materiel.cs | 8 ++-- NX.ERP.Model/Response/Base/MaterielType.cs | 10 ++--- .../Response/Purchase/ArrivalDetail.cs | 4 +- .../Response/Store/MaterielStoreOut.cs | 6 +-- .../Response/Store/MaterielStoreOutDetail.cs | 2 +- NX.ERP.U8.App/FrmMain.cs | 10 ++--- NX.ERP.U8/Base/MaterielDAL.cs | 40 +++++++++---------- NX.ERP.U8/Base/MaterielTypeDAL.cs | 30 +++++++------- NX.ERP.U8/Mom/MomOrderDAL.cs | 4 +- NX.ERP.U8/Purchase/ArrivalDAL.cs | 2 +- NX.ERP.U8/Store/MaterielStoreOutDAL.cs | 6 +-- NX.ERP.U8/Store/ProductInDAL.cs | 2 +- NX.ERP.U8/U8LoginContext.cs | 33 ++++++++++++--- NX.ERP.WebAPi/App_Start/WebApiConfig.cs | 28 +++++++------ .../Controllers/Base/MaterielController.cs | 18 ++++----- .../Base/MaterielTypeController.cs | 18 ++++----- .../Store/MaterielStoreOutController.cs | 6 +-- 24 files changed, 147 insertions(+), 122 deletions(-) diff --git a/NX.ERP.BLL/Model/OutBound.cs b/NX.ERP.BLL/Model/OutBound.cs index 11e6be8..0375e53 100644 --- a/NX.ERP.BLL/Model/OutBound.cs +++ b/NX.ERP.BLL/Model/OutBound.cs @@ -9,7 +9,7 @@ namespace NX.ERP.BLL.Model { public string OutboundNo { get; set; } public DateTime OutboundDate { get; set; } - public OutBoundType OutBoundType { get; set; } + public OutBoundType OutboundType { get; set; } public string WarehouseCode { get; set; } diff --git a/NX.ERP.BLL/Model/OutBoundType.cs b/NX.ERP.BLL/Model/OutBoundType.cs index 2840c41..875b6ea 100644 --- a/NX.ERP.BLL/Model/OutBoundType.cs +++ b/NX.ERP.BLL/Model/OutBoundType.cs @@ -8,7 +8,7 @@ namespace NX.ERP.BLL.Model public enum OutBoundType { SaleOut=1, - MaterielOut=2, + MaterialOut=2, OtherOut=3 //1:销售出库;2:原材料出库;3:其它出库 diff --git a/NX.ERP.BLL/Store/SotreOut.cs b/NX.ERP.BLL/Store/SotreOut.cs index 5125d1f..cc88d00 100644 --- a/NX.ERP.BLL/Store/SotreOut.cs +++ b/NX.ERP.BLL/Store/SotreOut.cs @@ -12,10 +12,10 @@ namespace NX.ERP.BLL.Store { string ID = ""; - if (outBound.OutBoundType == Model.OutBoundType.MaterielOut) + if (outBound.OutboundType == Model.OutBoundType.MaterialOut) { - var dal = new U8.Store.MaterielStoreOutDAL(); - ID = dal.AddVocher(new ERP.Model.Request.MaterielStoreOut() + var dal = new U8.Store.MaterialStoreOutDAL(); + ID = dal.AddVocher(new ERP.Model.Request.MaterialStoreOut() { Code= "191000000007", Date = outBound.OutboundDate, @@ -26,7 +26,7 @@ namespace NX.ERP.BLL.Store Details = outBound.OutboundDtlLst.ConvertAll(m => { - return new ERP.Model.Request.MaterielStoreOutDetail() + return new ERP.Model.Request.MaterialStoreOutDetail() { InvCode = m.MaterialCode, @@ -39,7 +39,7 @@ namespace NX.ERP.BLL.Store }); } - if (outBound.OutBoundType == Model.OutBoundType.SaleOut) + if (outBound.OutboundType == Model.OutBoundType.SaleOut) { var dal = new U8.Store.SaleOutDAL(); ID = dal.AddVoucher(new ERP.Model.Request.SaleStoreOut() @@ -63,7 +63,7 @@ namespace NX.ERP.BLL.Store }); } - if (outBound.OutBoundType == Model.OutBoundType.OtherOut) + if (outBound.OutboundType == Model.OutBoundType.OtherOut) { var dal = new U8.Store.OtherStoreOutDAL(); ID = dal.AddVocher(new ERP.Model.Request.OtherStoreInOut() diff --git a/NX.ERP.Model/Request/Materiel.cs b/NX.ERP.Model/Request/Materiel.cs index c9c1a37..73cb11e 100644 --- a/NX.ERP.Model/Request/Materiel.cs +++ b/NX.ERP.Model/Request/Materiel.cs @@ -5,16 +5,16 @@ using System.Text; namespace NX.ERP.Model.Request { - public class Materiel: BaseModel + public class Material: BaseModel { private string _code; private string _name; - public string MaterielCode { get => _code; set => _code = value; } - public string MaterielName { get => _name; set => _name = value; } + public string MaterialCode { get => _code; set => _code = value; } + public string MaterialName { get => _name; set => _name = value; } - public string MaterielTypeCode { get; set; } + public string MaterialTypeCode { get; set; } public string SpecsModel { get; set; } diff --git a/NX.ERP.Model/Request/MaterielStoreOut.cs b/NX.ERP.Model/Request/MaterielStoreOut.cs index bb04d8a..552652e 100644 --- a/NX.ERP.Model/Request/MaterielStoreOut.cs +++ b/NX.ERP.Model/Request/MaterielStoreOut.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model.Request { - public class MaterielStoreOut + public class MaterialStoreOut { private int id; private string code; @@ -15,7 +15,7 @@ namespace NX.ERP.Model.Request private string sourceCode; private string source; private string maker; - private IList details; + private IList details; public int Id { get => id; set => id = value; } public string Code { get => code; set => code = value; } @@ -23,7 +23,7 @@ namespace NX.ERP.Model.Request public string SourceCode { get => sourceCode; set => sourceCode = value; } public string Source { get => source; set => source = value; } public DateTime Date { get => date; set => date = value; } - public IList Details { get => details; set => details = value; } + public IList Details { get => details; set => details = value; } public string Maker { get => maker; set => maker = value; } } } diff --git a/NX.ERP.Model/Request/MaterielStoreOutDetail.cs b/NX.ERP.Model/Request/MaterielStoreOutDetail.cs index 3e495cf..ccbee9e 100644 --- a/NX.ERP.Model/Request/MaterielStoreOutDetail.cs +++ b/NX.ERP.Model/Request/MaterielStoreOutDetail.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model.Request { - public class MaterielStoreOutDetail + public class MaterialStoreOutDetail { private double quantity; diff --git a/NX.ERP.Model/Request/MaterielType.cs b/NX.ERP.Model/Request/MaterielType.cs index 34641f5..229bf90 100644 --- a/NX.ERP.Model/Request/MaterielType.cs +++ b/NX.ERP.Model/Request/MaterielType.cs @@ -5,15 +5,15 @@ using System.Text; namespace NX.ERP.Model.Request { - public class MaterielType: BaseModel + public class MaterialType: BaseModel { - private string materielTypeCode; - private string materielTypeName; + private string _MaterialTypeCode; + private string _MaterialTypeName; private int? _level; private int? _isEnd; - public string MaterielTypeCode { get => materielTypeCode; set => materielTypeCode = value; } - public string MaterielTypeName { get => materielTypeName; set => materielTypeName = value; } + public string MaterialTypeCode { get => _MaterialTypeCode; set => _MaterialTypeCode = value; } + public string MaterialTypeName { get => _MaterialTypeName; set => _MaterialTypeName = value; } public int? MaterialTypeGrade { get => _level; set => _level = value; } public int? MaterialTypeIsend { get => _isEnd; set => _isEnd = value; } } diff --git a/NX.ERP.Model/Response/Base/Materiel.cs b/NX.ERP.Model/Response/Base/Materiel.cs index 626d526..fd84e7b 100644 --- a/NX.ERP.Model/Response/Base/Materiel.cs +++ b/NX.ERP.Model/Response/Base/Materiel.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model { - public class Materiel: BaseModel + public class Material: BaseModel { private string _code; private string _name; @@ -21,11 +21,11 @@ namespace NX.ERP.Model private int minStock; private int aql; private int invccode; - public string MaterielCode { get => _code; set => _code = value; } - public string MaterielName { get => _name; set => _name = value; } + public string MaterialCode { get => _code; set => _code = value; } + public string MaterialName { get => _name; set => _name = value; } - public string MaterielTypeCode { get; set; } + public string MaterialTypeCode { get; set; } public string SpecsModel { get; set; } diff --git a/NX.ERP.Model/Response/Base/MaterielType.cs b/NX.ERP.Model/Response/Base/MaterielType.cs index 46ccd80..2ff578f 100644 --- a/NX.ERP.Model/Response/Base/MaterielType.cs +++ b/NX.ERP.Model/Response/Base/MaterielType.cs @@ -5,15 +5,15 @@ using System.Text; namespace NX.ERP.Model { - public class MaterielType: BaseModel + public class MaterialType: BaseModel { - private string materielTypeCode; - private string materielTypeName; + private string _MaterialTypeCode; + private string _MaterialTypeName; private int? _level; private int? _isEnd; - public string MaterielTypeCode { get => materielTypeCode; set => materielTypeCode = value; } - public string MaterielTypeName { get => materielTypeName; set => materielTypeName = value; } + public string MaterialTypeCode { get => _MaterialTypeCode; set => _MaterialTypeCode = value; } + public string MaterialTypeName { get => _MaterialTypeName; set => _MaterialTypeName = value; } public int? MaterialTypeGrade { get => _level; set => _level = value; } public int? MaterialTypeIsend { get => _isEnd; set => _isEnd = value; } } diff --git a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs index d6fb63e..9407616 100644 --- a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs +++ b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs @@ -11,10 +11,10 @@ namespace NX.ERP.Model.Purchase public class ArrivalDetail { private int id; - private string materielCode; + private string _MaterialCode; public int ArrivalDtlId { get => id; set => id = value; } public int ArrivalID { get => arrivalID; set => arrivalID = value; } - public string MaterialCode { get => materielCode; set => materielCode = value; } + public string MaterialCode { get => _MaterialCode; set => _MaterialCode = value; } public string BatchNo { get => batchNo; set => batchNo = value; } public string UnitCode { get => unitCode; set => unitCode = value; } public double Qty { get => quantity; set => quantity = value; } diff --git a/NX.ERP.Model/Response/Store/MaterielStoreOut.cs b/NX.ERP.Model/Response/Store/MaterielStoreOut.cs index fbe5f19..fe11414 100644 --- a/NX.ERP.Model/Response/Store/MaterielStoreOut.cs +++ b/NX.ERP.Model/Response/Store/MaterielStoreOut.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model.Store { - public class MaterielStoreOut + public class MaterialStoreOut { private int id; private string code; @@ -14,7 +14,7 @@ namespace NX.ERP.Model.Store private DateTime date; private string sourceCode; private string source; - private IList details; + private IList details; public int Id { get => id; set => id = value; } public string Code { get => code; set => code = value; } @@ -23,6 +23,6 @@ namespace NX.ERP.Model.Store public string SourceCode { get => sourceCode; set => sourceCode = value; } public string Source { get => source; set => source = value; } public DateTime Date { get => date; set => date = value; } - public IList Details { get => details; set => details = value; } + public IList Details { get => details; set => details = value; } } } diff --git a/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs b/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs index 409efca..48cae46 100644 --- a/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs +++ b/NX.ERP.Model/Response/Store/MaterielStoreOutDetail.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model.Store { - public class MaterielStoreOutDetail + public class MaterialStoreOutDetail { private double quantity; diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index b08a464..bfacba7 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -181,7 +181,7 @@ namespace U8AppMain list.Add(row["存货编码"].ToString().Trim()); } - var InvInfo = new NX.ERP.U8.MaterielDAL().GetList(list).ToDictionary((m) => { return m.MaterielCode; }); + var InvInfo = new NX.ERP.U8.MaterialDAL().GetList(list).ToDictionary((m) => { return m.MaterialCode; }); //构造数据 foreach (DataRow row in this.dataTable.Rows) @@ -343,8 +343,8 @@ namespace U8AppMain //var a = new STVocher(); //a.AddVocher(); - var a = new NX.ERP.U8.Store.MaterielStoreOutDAL(); - a.AddVocher(new NX.ERP.Model.Request.MaterielStoreOut() + var a = new NX.ERP.U8.Store.MaterialStoreOutDAL(); + a.AddVocher(new NX.ERP.Model.Request.MaterialStoreOut() { Id = 1111, Code = "2222", @@ -353,9 +353,9 @@ namespace U8AppMain Whcode = "2", Date = DateTime.Now, - Details = new List() + Details = new List() { - new NX.ERP.Model.Request.MaterielStoreOutDetail() + new NX.ERP.Model.Request.MaterialStoreOutDetail() { Position="002070206", InvCode="218174", diff --git a/NX.ERP.U8/Base/MaterielDAL.cs b/NX.ERP.U8/Base/MaterielDAL.cs index fc03326..f0917bc 100644 --- a/NX.ERP.U8/Base/MaterielDAL.cs +++ b/NX.ERP.U8/Base/MaterielDAL.cs @@ -7,9 +7,9 @@ using NX.ERP.Model; namespace NX.ERP.U8 { - public class MaterielDAL + public class MaterialDAL { - public IEnumerable GetList(string strWhere = "", object Param = null) + public IEnumerable GetList(string strWhere = "", object Param = null) { @@ -18,9 +18,9 @@ namespace NX.ERP.U8 { var sql = @"select - cInvCode AS MaterielCode , + cInvCode AS MaterialCode , cInvAddCode AS 存货代码, - cInvName AS MaterielName , + cInvName AS MaterialName , fLength AS Length, fWidth AS Wide, fHeight AS Height, @@ -38,7 +38,7 @@ namespace NX.ERP.U8 iMassDate AS 保质期数, cMassUnit AS 保质期单位, iWarnDays AS 保质期预警天数, - cInvCCode AS MaterielTypeCode, + cInvCCode AS MaterialTypeCode, cReplaceItem AS 替换件, cPosition AS 货位编码, bSale AS 是否销售, @@ -270,56 +270,56 @@ namespace NX.ERP.U8 { sql += $" where {strWhere}"; } - return conn.Query(sql, Param); + return conn.Query(sql, Param); } } - public Materiel GetModel(string Code) + public Material GetModel(string Code) { return this.GetList(" cInvCode=@Code ", new { Code }).FirstOrDefault(); } - public IEnumerable GetList(IEnumerable codes) + public IEnumerable GetList(IEnumerable codes) { return this.GetList(" cInvCode in @codes ",new { codes }); } - public IEnumerable GetList(NX.ERP.Model.Request.Materiel materiel) + public IEnumerable GetList(NX.ERP.Model.Request.Material Material) { List where = new List(); - if (!string.IsNullOrEmpty(materiel.MaterielCode)) + if (!string.IsNullOrEmpty(Material.MaterialCode)) { - where.Add(" cInvCode like @MaterielCode "); + where.Add(" cInvCode like @MaterialCode "); } - if (!string.IsNullOrEmpty(materiel.MaterielName)) + if (!string.IsNullOrEmpty(Material.MaterialName)) { - where.Add(" cInvName like @MaterielName "); + where.Add(" cInvName like @MaterialName "); } - if (!string.IsNullOrEmpty(materiel.SpecsModel)) + if (!string.IsNullOrEmpty(Material.SpecsModel)) { where.Add(" cInvStd like @SpecsModel "); } - if (!string.IsNullOrEmpty(materiel.MaterielTypeCode)) + if (!string.IsNullOrEmpty(Material.MaterialTypeCode)) { - where.Add(" cInvCCode = @MaterielTypeCode "); + where.Add(" cInvCCode = @MaterialTypeCode "); } return this.GetList(string.Join(" and ", where.ToArray()), new { - MaterielCode = $"%{materiel.MaterielCode}%", - MaterielName = $"%{materiel.MaterielName}%", - SpecsModel = materiel.SpecsModel, - MaterielTypeCode = materiel.MaterielTypeCode + MaterialCode = $"%{Material.MaterialCode}%", + MaterialName = $"%{Material.MaterialName}%", + SpecsModel = Material.SpecsModel, + MaterialTypeCode = Material.MaterialTypeCode }); ; diff --git a/NX.ERP.U8/Base/MaterielTypeDAL.cs b/NX.ERP.U8/Base/MaterielTypeDAL.cs index cc148e4..6766e46 100644 --- a/NX.ERP.U8/Base/MaterielTypeDAL.cs +++ b/NX.ERP.U8/Base/MaterielTypeDAL.cs @@ -7,50 +7,50 @@ using NX.ERP.Model; namespace NX.ERP.U8 { - public class MaterielTypeDAL + public class MaterialTypeDAL { - public IEnumerable GetList(string strWhere = "", object Param = null) + public IEnumerable GetList(string strWhere = "", object Param = null) { using (var conn = U8LoginContext.Instance.Connection) { - var sql = @"select cInvCCode AS MaterielTypeCode,cInvCName AS MaterielTypeName,bInvCEnd as MaterialTypeIsend,iInvCGrade as MaterialTypeGrade from InventoryClass "; + var sql = @"select cInvCCode AS MaterialTypeCode,cInvCName AS MaterialTypeName,bInvCEnd as MaterialTypeIsend,iInvCGrade as MaterialTypeGrade from InventoryClass "; if (!string.IsNullOrEmpty(strWhere)) { sql += $" where {strWhere}"; } - return conn.Query(sql, Param); + return conn.Query(sql, Param); } } - public IEnumerable GetList(NX.ERP.Model.Request.MaterielType materielType) + public IEnumerable GetList(NX.ERP.Model.Request.MaterialType MaterialType) { List where = new List(); - if (!string.IsNullOrEmpty(materielType.MaterielTypeCode)) + if (!string.IsNullOrEmpty(MaterialType.MaterialTypeCode)) { - where.Add(" cInvCCode like @MaterielTypeCode "); + where.Add(" cInvCCode like @MaterialTypeCode "); } - if (!string.IsNullOrEmpty(materielType.MaterielTypeName)) + if (!string.IsNullOrEmpty(MaterialType.MaterialTypeName)) { - where.Add(" cInvCName like @MaterielTypeName "); + where.Add(" cInvCName like @MaterialTypeName "); } - if (!materielType.MaterialTypeGrade.HasValue) + if (MaterialType.MaterialTypeGrade.HasValue) { where.Add(" iInvCGrade=@Level "); } - if (!materielType.MaterialTypeIsend.HasValue) + if (MaterialType.MaterialTypeIsend.HasValue) { where.Add(" bInvCEnd=@MaterialTypeIsend "); } return this.GetList(string.Join(" and ", where.ToArray()), new { - MaterielTypeCode=$"%{materielType.MaterielTypeCode}%", - MaterielTypeName=$"%{materielType.MaterielTypeName}%", - materielType.MaterialTypeGrade, - materielType.MaterialTypeIsend + MaterialTypeCode=$"%{MaterialType.MaterialTypeCode}%", + MaterialTypeName=$"%{MaterialType.MaterialTypeName}%", + MaterialType.MaterialTypeGrade, + MaterialType.MaterialTypeIsend }); } diff --git a/NX.ERP.U8/Mom/MomOrderDAL.cs b/NX.ERP.U8/Mom/MomOrderDAL.cs index 08af6cb..b91cbcb 100644 --- a/NX.ERP.U8/Mom/MomOrderDAL.cs +++ b/NX.ERP.U8/Mom/MomOrderDAL.cs @@ -67,7 +67,7 @@ namespace NX.ERP.U8.Mom if (!string.IsNullOrEmpty(Params.ProductCode)) { - where.Add(" b.InvCode like @ ProductCode"); + where.Add(" b.InvCode like @ProductCode"); } if (!string.IsNullOrEmpty(Params.ProductOrderNo)) { @@ -128,7 +128,7 @@ namespace NX.ERP.U8.Mom if (!string.IsNullOrEmpty(Params.ProductCode)) { - where.Add(" b.InvCode like @ ProductCode"); + where.Add(" b.InvCode like @ProductCode"); } if (!string.IsNullOrEmpty(Params.ProductOrderNo)) { diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index 07686e2..55a060f 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -13,7 +13,7 @@ namespace NX.ERP.U8.Purchase { string strSQL = @"select a.id AS ArrivalId,a.cCode as ArrivalCode,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,a.dDate as ArrivalDate,A.cVenCode AS SupplierCode, B.Autoid as id,b.ID as ArrivalID, - b.cInvCode AS MaterielCode, + b.cInvCode AS MaterialCode, b.cBatch AS BatchNo, b.cUnitID AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum, B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid from diff --git a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs index 7f6325a..0dab4a7 100644 --- a/NX.ERP.U8/Store/MaterielStoreOutDAL.cs +++ b/NX.ERP.U8/Store/MaterielStoreOutDAL.cs @@ -11,17 +11,17 @@ using UFIDA.U8.U8MOMAPIFramework; namespace NX.ERP.U8.Store { - public class MaterielStoreOutDAL : VoucherBase + public class MaterialStoreOutDAL : VoucherBase { - public MaterielStoreOutDAL() : base("11", "U8API/MaterialOut") + public MaterialStoreOutDAL() : base("11", "U8API/MaterialOut") { } - public string AddVocher(Model.Request.MaterielStoreOut storeOut) + public string AddVocher(Model.Request.MaterialStoreOut storeOut) { VoucherParameter voucherParameter = new VoucherParameter { diff --git a/NX.ERP.U8/Store/ProductInDAL.cs b/NX.ERP.U8/Store/ProductInDAL.cs index 476c8f7..979d201 100644 --- a/NX.ERP.U8/Store/ProductInDAL.cs +++ b/NX.ERP.U8/Store/ProductInDAL.cs @@ -56,7 +56,7 @@ namespace NX.ERP.U8.Store var detail = storeIn.Details[n]; bodyXml.setAttribute("cinvcode", detail.InvCode); bodyXml.setAttribute("iquantity", detail.Quantity); - var _cost = new MaterielDAL().GetCost(detail.InvCode, 0); + var _cost = new MaterialDAL().GetCost(detail.InvCode, 0); bodyXml.setAttribute("iunitcost", _cost); bodyXml.setAttribute("iprice", new Account.Accinformation().FormatMoney(_cost * detail.Quantity)); bodyXml.setAttribute("irowno", n + 1); diff --git a/NX.ERP.U8/U8LoginContext.cs b/NX.ERP.U8/U8LoginContext.cs index af53c47..1fcb8ff 100644 --- a/NX.ERP.U8/U8LoginContext.cs +++ b/NX.ERP.U8/U8LoginContext.cs @@ -10,6 +10,7 @@ namespace NX.ERP.U8 { public class U8LoginContext : IDisposable { + private static readonly object locker = new object(); private static U8LoginContext _u8LoginContext; private string EaiPort = System.Configuration.ConfigurationManager.AppSettings["EaiPort"]; private string EaiPath = System.Configuration.ConfigurationManager.AppSettings["EaiPath"]; @@ -19,7 +20,14 @@ namespace NX.ERP.U8 { if (_u8LoginContext == null) { - _u8LoginContext = new U8LoginContext(); + lock (locker) + { + if (_u8LoginContext == null) + { + _u8LoginContext = new U8LoginContext(); + } + } + } return _u8LoginContext; } @@ -39,15 +47,26 @@ namespace NX.ERP.U8 public U8LoginContext() { } + private static readonly object locker1 = new object(); + public clsLogin ClsLogin { get { + + if (this._clslogin == null) { - this.Login(); + lock (locker1) + { + if (this._clslogin == null) + { + this.Login(); + } + } } return this._clslogin; + } } @@ -59,7 +78,7 @@ namespace NX.ERP.U8 return new System.Data.SqlClient.SqlConnection(this.Constr4Net); } } - + @@ -160,7 +179,7 @@ namespace NX.ERP.U8 get { - + return $"http://{this.ClsLogin.cServer}:{EaiPort}/{EaiPath}"; @@ -218,6 +237,7 @@ namespace NX.ERP.U8 { get { + if (uiLogin == null) { uiLogin = new UFSoft.U8.Framework.Login.UI.clsLogin(); @@ -246,6 +266,10 @@ namespace NX.ERP.U8 public void Login() { + + + + if (NeedUiLogin) { if (!UiLogin.login("DP")) @@ -275,7 +299,6 @@ namespace NX.ERP.U8 } _clslogin.set_TaskId(UiLogin.GetTaskID("ST")); - } diff --git a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs index e47b881..10e01f5 100644 --- a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs +++ b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs @@ -17,21 +17,21 @@ using System.Web.Http.Filters; namespace NX.ERP.WebAPi { - //public class JsonContentNegotiator : IContentNegotiator - //{ - // private readonly JsonMediaTypeFormatter _jsonFormatter; + public class JsonContentNegotiator : IContentNegotiator + { + private readonly JsonMediaTypeFormatter _jsonFormatter; - // public JsonContentNegotiator(JsonMediaTypeFormatter formatter) - // { - // _jsonFormatter = formatter; - // } + public JsonContentNegotiator(JsonMediaTypeFormatter formatter) + { + _jsonFormatter = formatter; + } - // public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable formatters) - // { - // var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); - // return result; - // } - //} + public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable formatters) + { + var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); + return result; + } + } public static class WebApiConfig { public static void Register(HttpConfiguration config) @@ -45,6 +45,8 @@ namespace NX.ERP.WebAPi NX.ERP.U8.U8LoginContext.Instance.Server= System.Configuration.ConfigurationManager.AppSettings["Server"]; + //optional: set serializer settings here + //System.Web.Http.Filters.IExceptionFilter config.Filters.Add(new ExceptionFilter()); config.Filters.Add(new ApiResultAttribute()); diff --git a/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs b/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs index 91d4a69..d3c78e5 100644 --- a/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/MaterielController.cs @@ -8,23 +8,23 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers { - public class MaterielController : ApiController + public class MaterialController : ApiController { [Obsolete] - [Route("api/Materiel/List")] + [Route("api/Material/List")] [HttpGet] - public IEnumerable List() + public IEnumerable List() { - var materielDAL = new MaterielDAL(); - return materielDAL.GetList(); + var MaterialDAL = new MaterialDAL(); + return MaterialDAL.GetList(); } - [Route("api/Materiel/Query")] + [Route("api/Material/Query")] [HttpPost] - public IEnumerable Query(NX.ERP.Model.Request.Materiel Param) + public IEnumerable Query(NX.ERP.Model.Request.Material Param) { - var materielDAL = new MaterielDAL(); - return materielDAL.GetList(Param); + var MaterialDAL = new MaterialDAL(); + return MaterialDAL.GetList(Param); } diff --git a/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs b/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs index 4eebf98..8537677 100644 --- a/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs +++ b/NX.ERP.WebAPi/Controllers/Base/MaterielTypeController.cs @@ -8,23 +8,23 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers { - public class MaterielTypeController:ApiController + public class MaterialTypeController:ApiController { [Obsolete] - [Route("api/MaterielType/List")] + [Route("api/MaterialType/List")] [HttpGet] - public IEnumerable List() + public IEnumerable List() { - var materielType = new MaterielTypeDAL(); - return materielType.GetList(); + var MaterialType = new MaterialTypeDAL(); + return MaterialType.GetList(); } - [Route("api/MaterielType/Query")] + [Route("api/MaterialType/Query")] [HttpPost] - public IEnumerable Query(NX.ERP.Model.Request.MaterielType Param) + public IEnumerable Query(NX.ERP.Model.Request.MaterialType Param) { - var materielType = new MaterielTypeDAL(); - return materielType.GetList(Param); + var MaterialType = new MaterialTypeDAL(); + return MaterialType.GetList(Param); } diff --git a/NX.ERP.WebAPi/Controllers/Store/MaterielStoreOutController.cs b/NX.ERP.WebAPi/Controllers/Store/MaterielStoreOutController.cs index 51f901e..cd180bd 100644 --- a/NX.ERP.WebAPi/Controllers/Store/MaterielStoreOutController.cs +++ b/NX.ERP.WebAPi/Controllers/Store/MaterielStoreOutController.cs @@ -7,15 +7,15 @@ using System.Web.Http; namespace NX.ERP.WebAPi.Controllers.Store { - public class MaterielStoreOutController:ApiController + public class MaterialStoreOutController:ApiController { [Obsolete] [Route("api/MaterialOut/Add")] [HttpPost] - public string AddVoucher([FromBody] Model.Request.MaterielStoreOut storeIn) + public string AddVoucher([FromBody] Model.Request.MaterialStoreOut storeIn) { - var dal = new NX.ERP.U8.Store.MaterielStoreOutDAL(); + var dal = new NX.ERP.U8.Store.MaterialStoreOutDAL(); return dal.AddVocher(storeIn); } }