diff --git a/NX.ERP.Model/Request/Materiel.cs b/NX.ERP.Model/Request/Materiel.cs index 4e6ed9d..c9c1a37 100644 --- a/NX.ERP.Model/Request/Materiel.cs +++ b/NX.ERP.Model/Request/Materiel.cs @@ -5,7 +5,7 @@ using System.Text; namespace NX.ERP.Model.Request { - public class Materiel + public class Materiel: BaseModel { private string _code; private string _name; diff --git a/NX.ERP.Model/Request/MaterielType.cs b/NX.ERP.Model/Request/MaterielType.cs index 361ef8f..34641f5 100644 --- a/NX.ERP.Model/Request/MaterielType.cs +++ b/NX.ERP.Model/Request/MaterielType.cs @@ -14,7 +14,7 @@ namespace NX.ERP.Model.Request public string MaterielTypeCode { get => materielTypeCode; set => materielTypeCode = value; } public string MaterielTypeName { get => materielTypeName; set => materielTypeName = value; } - public int? Level { get => _level; set => _level = value; } - public int? IsEnd { get => _isEnd; set => _isEnd = 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 3c30041..c2bbed3 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 + public class Materiel: BaseModel { private string _code; private string _name; diff --git a/NX.ERP.Model/Response/Base/MaterielType.cs b/NX.ERP.Model/Response/Base/MaterielType.cs index 52da440..46ccd80 100644 --- a/NX.ERP.Model/Response/Base/MaterielType.cs +++ b/NX.ERP.Model/Response/Base/MaterielType.cs @@ -9,12 +9,12 @@ namespace NX.ERP.Model { private string materielTypeCode; private string materielTypeName; - private int _level; - private bool _isEnd; + private int? _level; + private int? _isEnd; public string MaterielTypeCode { get => materielTypeCode; set => materielTypeCode = value; } public string MaterielTypeName { get => materielTypeName; set => materielTypeName = value; } - public int Level { get => _level; set => _level = value; } - public bool IsEnd { get => _isEnd; set => _isEnd = 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/Warehouse.cs b/NX.ERP.Model/Response/Base/Warehouse.cs index 16526e6..d42deec 100644 --- a/NX.ERP.Model/Response/Base/Warehouse.cs +++ b/NX.ERP.Model/Response/Base/Warehouse.cs @@ -10,7 +10,14 @@ namespace NX.ERP.Model private string _WarehouseCode; private string _WarehouseName; + + + public string WarehouseCode { get => _WarehouseCode; set => _WarehouseCode = value; } public string WarehouseName { get => _WarehouseName; set => _WarehouseName = value; } + + public string WarehouseAdmin { get; set; } + public string Contacts { get; set; } + public string Telephone { get; set; } } } diff --git a/NX.ERP.U8.App/FrmMain.Designer.cs b/NX.ERP.U8.App/FrmMain.Designer.cs index bfde03a..1626cd3 100644 --- a/NX.ERP.U8.App/FrmMain.Designer.cs +++ b/NX.ERP.U8.App/FrmMain.Designer.cs @@ -105,6 +105,7 @@ namespace U8AppMain this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem2.Text = "采购入库单"; + this.toolStripMenuItem2.Visible = false; this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); // // 材料出库单ToolStripMenuItem @@ -112,6 +113,7 @@ namespace U8AppMain this.材料出库单ToolStripMenuItem.Name = "材料出库单ToolStripMenuItem"; this.材料出库单ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.材料出库单ToolStripMenuItem.Text = "材料出库单"; + this.材料出库单ToolStripMenuItem.Visible = false; this.材料出库单ToolStripMenuItem.Click += new System.EventHandler(this.材料出库单ToolStripMenuItem_Click); // // 其他入库ToolStripMenuItem @@ -119,6 +121,7 @@ namespace U8AppMain this.其他入库ToolStripMenuItem.Name = "其他入库ToolStripMenuItem"; this.其他入库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.其他入库ToolStripMenuItem.Text = "其他入库"; + this.其他入库ToolStripMenuItem.Visible = false; this.其他入库ToolStripMenuItem.Click += new System.EventHandler(this.其他入库ToolStripMenuItem_Click); // // 其他出库ToolStripMenuItem @@ -126,6 +129,7 @@ namespace U8AppMain this.其他出库ToolStripMenuItem.Name = "其他出库ToolStripMenuItem"; this.其他出库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.其他出库ToolStripMenuItem.Text = "其他出库"; + this.其他出库ToolStripMenuItem.Visible = false; this.其他出库ToolStripMenuItem.Click += new System.EventHandler(this.其他出库ToolStripMenuItem_Click); // // 销售出库ToolStripMenuItem @@ -133,6 +137,7 @@ namespace U8AppMain this.销售出库ToolStripMenuItem.Name = "销售出库ToolStripMenuItem"; this.销售出库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.销售出库ToolStripMenuItem.Text = "销售出库"; + this.销售出库ToolStripMenuItem.Visible = false; this.销售出库ToolStripMenuItem.Click += new System.EventHandler(this.销售出库ToolStripMenuItem_Click); // // 成品入库ToolStripMenuItem @@ -140,6 +145,7 @@ namespace U8AppMain this.成品入库ToolStripMenuItem.Name = "成品入库ToolStripMenuItem"; this.成品入库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.成品入库ToolStripMenuItem.Text = "成品入库"; + this.成品入库ToolStripMenuItem.Visible = false; this.成品入库ToolStripMenuItem.Click += new System.EventHandler(this.成品入库ToolStripMenuItem_Click); // // 导入ToolStripMenuItem @@ -180,11 +186,12 @@ namespace U8AppMain this.打印ToolStripMenuItem.Name = "打印ToolStripMenuItem"; this.打印ToolStripMenuItem.Size = new System.Drawing.Size(45, 19); this.打印ToolStripMenuItem.Text = "打印"; + this.打印ToolStripMenuItem.Visible = false; // // 打印ToolStripMenuItem1 // this.打印ToolStripMenuItem1.Name = "打印ToolStripMenuItem1"; - this.打印ToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); + this.打印ToolStripMenuItem1.Size = new System.Drawing.Size(100, 22); this.打印ToolStripMenuItem1.Text = "打印"; this.打印ToolStripMenuItem1.Visible = false; this.打印ToolStripMenuItem1.Click += new System.EventHandler(this.打印ToolStripMenuItem1_Click); @@ -205,7 +212,7 @@ namespace U8AppMain // this.splitContainer1.Panel2.Controls.Add(this.richTextBox1); this.splitContainer1.Size = new System.Drawing.Size(1200, 722); - this.splitContainer1.SplitterDistance = 450; + this.splitContainer1.SplitterDistance = 556; this.splitContainer1.TabIndex = 0; // // dataGridView1 @@ -224,8 +231,9 @@ namespace U8AppMain this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1200, 450); + this.dataGridView1.Size = new System.Drawing.Size(1200, 556); this.dataGridView1.TabIndex = 0; + this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); // // richTextBox1 // @@ -236,7 +244,7 @@ namespace U8AppMain this.richTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.ReadOnly = true; - this.richTextBox1.Size = new System.Drawing.Size(1200, 268); + this.richTextBox1.Size = new System.Drawing.Size(1200, 162); this.richTextBox1.TabIndex = 0; this.richTextBox1.Text = ""; this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged); @@ -253,6 +261,7 @@ namespace U8AppMain this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.Name = "FrmMain"; this.Text = "U8导入"; + this.Load += new System.EventHandler(this.FrmMain_Load); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.splitContainer1.Panel1.ResumeLayout(false); diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index e37b416..9d8fa6d 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -20,7 +20,7 @@ namespace U8AppMain InitializeComponent(); } - + private void PrintLog(ResultEnity.ufinterface info) { @@ -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; @@ -167,9 +167,23 @@ namespace U8AppMain { return; } + + var bomLookup = new Dictionary(); try { + + //获取相关物料的信息 + + var list = new List(); + foreach (DataRow row in this.dataTable.Rows) + { + list.Add(row["存货编码"].ToString().Trim()); + } + + var InvInfo = new NX.ERP.U8.MaterielDAL().GetList(list).ToDictionary((m) => { return m.MaterielCode; }); + + //构造数据 foreach (DataRow row in this.dataTable.Rows) { var purchase = new Purchase.ufinterface(); @@ -190,7 +204,8 @@ namespace U8AppMain { bomLookup.Add(strKey, purchase); } - body.inventorycode = row["存货编码"].ToString(); + body.inventorycode = row["存货编码"].ToString().Trim(); + body.taxrate = InvInfo[body.inventorycode].TaxRate; body.requiredate = purchase.purchaseapp.header.date; body.quantity = decimal.Parse(row["数量"].ToString()); purchase.purchaseapp.body.Add(body); @@ -288,8 +303,8 @@ namespace U8AppMain private void 登录ToolStripMenuItem_Click(object sender, EventArgs e) { - - + + //u8LoginContext = new NX.ERP.U8.U8LoginContext(); //u8LoginContext.Login(true); @@ -441,6 +456,27 @@ namespace U8AppMain }); ; } - } + private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void FrmMain_Load(object sender, EventArgs e) + { + try + { + NX.ERP.U8.U8LoginContext.Instance.Login(); + this.Text =$"[{NX.ERP.U8.U8LoginContext.Instance.AccID}]{NX.ERP.U8.U8LoginContext.Instance.AccName}"; + } + + catch (Exception) + { + + this.Close(); + + } + + } + } } diff --git a/NX.ERP.U8.App/Purchase/EntryEnity.cs b/NX.ERP.U8.App/Purchase/EntryEnity.cs index 656a257..e05c85f 100644 --- a/NX.ERP.U8.App/Purchase/EntryEnity.cs +++ b/NX.ERP.U8.App/Purchase/EntryEnity.cs @@ -16,7 +16,7 @@ namespace U8AppMain.Purchase //public decimal price { get; set; } - //public decimal taxrate { get; set; } + public decimal taxrate { get; set; } //public decimal taxprice { get; set; } diff --git a/NX.ERP.U8.App/Voucher/VoucherDAL.cs b/NX.ERP.U8.App/Voucher/VoucherDAL.cs index 9ed4f34..518333d 100644 --- a/NX.ERP.U8.App/Voucher/VoucherDAL.cs +++ b/NX.ERP.U8.App/Voucher/VoucherDAL.cs @@ -37,7 +37,7 @@ namespace U8AppMain.Voucher public bool Add(Vouch vouch) { - string accid = NX.ERP.U8.U8LoginContext.Instance.cAcc_id; + string accid = NX.ERP.U8.U8LoginContext.Instance.AccID; var conn = new SqlConnection(this._connStr); diff --git a/NX.ERP.U8/Base/MaterielTypeDAL.cs b/NX.ERP.U8/Base/MaterielTypeDAL.cs index a73b9b8..662be6e 100644 --- a/NX.ERP.U8/Base/MaterielTypeDAL.cs +++ b/NX.ERP.U8/Base/MaterielTypeDAL.cs @@ -13,7 +13,7 @@ namespace NX.ERP.U8 { using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net)) { - var sql = @"select cInvCCode AS MaterielTypeCode,cInvCName AS MaterielTypeName,bInvCEnd as IsEnd,iInvCGrade as Level from InventoryClass "; + var sql = @"select cInvCCode AS MaterielTypeCode,cInvCName AS MaterielTypeName,bInvCEnd as MaterialTypeIsend,iInvCGrade as MaterialTypeGrade from InventoryClass "; if (!string.IsNullOrEmpty(strWhere)) { sql += $" where {strWhere}"; @@ -36,21 +36,21 @@ namespace NX.ERP.U8 where.Add(" cInvCName like @MaterielTypeName "); } - if (materielType.Level.HasValue) + if (materielType.MaterialTypeGrade.HasValue) { where.Add(" iInvCGrade=@Level "); } - if (materielType.IsEnd.HasValue) + if (materielType.MaterialTypeIsend.HasValue) { - where.Add(" bInvCEnd=@IsEnd "); + where.Add(" bInvCEnd=@MaterialTypeIsend "); } return this.GetList(string.Join(" and ", where.ToArray()), new { MaterielTypeCode=$"%{materielType.MaterielTypeCode}%", MaterielTypeName=$"%{materielType.MaterielTypeName}%", - materielType.Level, - materielType.IsEnd + materielType.MaterialTypeGrade, + materielType.MaterialTypeIsend }); } diff --git a/NX.ERP.U8/U8LoginContext.cs b/NX.ERP.U8/U8LoginContext.cs index 1468fec..597ffd1 100644 --- a/NX.ERP.U8/U8LoginContext.cs +++ b/NX.ERP.U8/U8LoginContext.cs @@ -123,8 +123,23 @@ namespace NX.ERP.U8 { this._accid = value; } + get { + + return this.ClsLogin.get_cAcc_Id(); + } } + public string AccName + { + get + { + return this.ClsLogin.cAccName; + } + } + + + + public string Serial { get; set; } public string EAIUrl @@ -207,7 +222,9 @@ namespace NX.ERP.U8 { if (!UiLogin.login("DP")) { + throw new Exception(UiLogin.ErrDescript); + } } else diff --git a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs index 2a87bb0..5c2aaff 100644 --- a/NX.ERP.WebAPi/App_Start/WebApiConfig.cs +++ b/NX.ERP.WebAPi/App_Start/WebApiConfig.cs @@ -17,16 +17,8 @@ using System.Web.Http.Filters; namespace NX.ERP.WebAPi { - - - - - - - public class JsonContentNegotiator : IContentNegotiator { - private readonly JsonMediaTypeFormatter _jsonFormatter; public JsonContentNegotiator(JsonMediaTypeFormatter formatter) @@ -60,7 +52,7 @@ namespace NX.ERP.WebAPi { //忽略循环引用,如果设置为Error,则遇到循环引用的时候报错 ReferenceLoopHandling = ReferenceLoopHandling.Ignore, - NullValueHandling = NullValueHandling.Ignore, + //NullValueHandling = NullValueHandling.Ignore, //Formatting = Newtonsoft.Json.Formatting.Indented, //小驼峰命名法 ContractResolver = new DefaultContractResolver()