diff --git a/NX.ERP.Model/BaseModel.cs b/NX.ERP.Model/BaseModel.cs index ee95e34..c0d23a8 100644 --- a/NX.ERP.Model/BaseModel.cs +++ b/NX.ERP.Model/BaseModel.cs @@ -7,17 +7,17 @@ namespace NX.ERP.Model { public class BaseModel { - private string remark1; - private string remark2; - private string remark3; - private string remark4; - private string remark5; + //private string remark1; + //private string remark2; + //private string remark3; + //private string remark4; + //private string remark5; - public string Remark1 { get => remark1; set => remark1 = value; } - public string Remark2 { get => remark2; set => remark2 = value; } - public string Remark3 { get => remark3; set => remark3 = value; } - public string Remark4 { get => remark4; set => remark4 = value; } - public string Remark5 { get => remark5; set => remark5 = value; } + //public string Remark1 { get => remark1; set => remark1 = value; } + //public string Remark2 { get => remark2; set => remark2 = value; } + //public string Remark3 { get => remark3; set => remark3 = value; } + //public string Remark4 { get => remark4; set => remark4 = value; } + //public string Remark5 { get => remark5; set => remark5 = value; } // remark1 //remark2 diff --git a/NX.ERP.Model/NX.ERP.Model.csproj b/NX.ERP.Model/NX.ERP.Model.csproj index fa7f83f..fd5da50 100644 --- a/NX.ERP.Model/NX.ERP.Model.csproj +++ b/NX.ERP.Model/NX.ERP.Model.csproj @@ -62,6 +62,8 @@ + + diff --git a/NX.ERP.Model/Request/BinChange.cs b/NX.ERP.Model/Request/BinChange.cs new file mode 100644 index 0000000..88934eb --- /dev/null +++ b/NX.ERP.Model/Request/BinChange.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Request +{ + + public class BinChangeDetail + { + + public string InvCode; + public string SoucePositon; + public string DestPostion; + public float Qty; + + + } + + + public class BinChange + { + public string whCode { get; set; } + + + public IList binChangeDetails = new List(); + + } +} diff --git a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs index 29a8ae6..8142930 100644 --- a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs +++ b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs @@ -45,6 +45,10 @@ namespace NX.ERP.Model.Purchase public double oritaxprice { get; set; } [Newtonsoft.Json.JsonIgnore] public double orisum { get; set; } + [Newtonsoft.Json.JsonIgnore] + + public double sum { get; set; } + [Newtonsoft.Json.JsonIgnore] public int Iverifystateex { get => iverifystateex; set => iverifystateex = value; } diff --git a/NX.ERP.Model/Response/Store/Stock.cs b/NX.ERP.Model/Response/Store/Stock.cs new file mode 100644 index 0000000..602d539 --- /dev/null +++ b/NX.ERP.Model/Response/Store/Stock.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.Model.Response.Store +{ + public class Stock + { + //a.cInvCode,a.cPosCode,c.cPosName,(isnull(a.iQuantity,0)-isnull(b.iQuantity,0)) as iQuantity + + private string materialCode; + private string binName; + private string _Qty; + + public string MaterialCode { get => materialCode; set => materialCode = value; } + public string BinName { get => binName; set => binName = value; } + public string Qty { get => _Qty; set => _Qty = value; } + } + + +} diff --git a/NX.ERP.U8.App/FrmMain.Designer.cs b/NX.ERP.U8.App/FrmMain.Designer.cs index 1626cd3..ab274be 100644 --- a/NX.ERP.U8.App/FrmMain.Designer.cs +++ b/NX.ERP.U8.App/FrmMain.Designer.cs @@ -88,14 +88,14 @@ namespace U8AppMain // BtnReadExcel // this.BtnReadExcel.Name = "BtnReadExcel"; - this.BtnReadExcel.Size = new System.Drawing.Size(180, 22); + this.BtnReadExcel.Size = new System.Drawing.Size(139, 22); this.BtnReadExcel.Text = "读取Excel"; this.BtnReadExcel.Click += new System.EventHandler(this.BtnReadExcel_Click); // // 登录ToolStripMenuItem // this.登录ToolStripMenuItem.Name = "登录ToolStripMenuItem"; - this.登录ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.登录ToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.登录ToolStripMenuItem.Text = "登录"; this.登录ToolStripMenuItem.Visible = false; this.登录ToolStripMenuItem.Click += new System.EventHandler(this.登录ToolStripMenuItem_Click); @@ -103,7 +103,7 @@ namespace U8AppMain // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem2.Size = new System.Drawing.Size(139, 22); this.toolStripMenuItem2.Text = "采购入库单"; this.toolStripMenuItem2.Visible = false; this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); @@ -111,7 +111,7 @@ namespace U8AppMain // 材料出库单ToolStripMenuItem // this.材料出库单ToolStripMenuItem.Name = "材料出库单ToolStripMenuItem"; - this.材料出库单ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.材料出库单ToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.材料出库单ToolStripMenuItem.Text = "材料出库单"; this.材料出库单ToolStripMenuItem.Visible = false; this.材料出库单ToolStripMenuItem.Click += new System.EventHandler(this.材料出库单ToolStripMenuItem_Click); @@ -119,7 +119,7 @@ namespace U8AppMain // 其他入库ToolStripMenuItem // this.其他入库ToolStripMenuItem.Name = "其他入库ToolStripMenuItem"; - this.其他入库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.其他入库ToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.其他入库ToolStripMenuItem.Text = "其他入库"; this.其他入库ToolStripMenuItem.Visible = false; this.其他入库ToolStripMenuItem.Click += new System.EventHandler(this.其他入库ToolStripMenuItem_Click); @@ -127,7 +127,7 @@ namespace U8AppMain // 其他出库ToolStripMenuItem // this.其他出库ToolStripMenuItem.Name = "其他出库ToolStripMenuItem"; - this.其他出库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.其他出库ToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.其他出库ToolStripMenuItem.Text = "其他出库"; this.其他出库ToolStripMenuItem.Visible = false; this.其他出库ToolStripMenuItem.Click += new System.EventHandler(this.其他出库ToolStripMenuItem_Click); @@ -135,7 +135,7 @@ namespace U8AppMain // 销售出库ToolStripMenuItem // this.销售出库ToolStripMenuItem.Name = "销售出库ToolStripMenuItem"; - this.销售出库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.销售出库ToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.销售出库ToolStripMenuItem.Text = "销售出库"; this.销售出库ToolStripMenuItem.Visible = false; this.销售出库ToolStripMenuItem.Click += new System.EventHandler(this.销售出库ToolStripMenuItem_Click); @@ -143,7 +143,7 @@ namespace U8AppMain // 成品入库ToolStripMenuItem // this.成品入库ToolStripMenuItem.Name = "成品入库ToolStripMenuItem"; - this.成品入库ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.成品入库ToolStripMenuItem.Size = new System.Drawing.Size(139, 22); this.成品入库ToolStripMenuItem.Text = "成品入库"; this.成品入库ToolStripMenuItem.Visible = false; this.成品入库ToolStripMenuItem.Click += new System.EventHandler(this.成品入库ToolStripMenuItem_Click); @@ -161,21 +161,21 @@ namespace U8AppMain // ImportBom // this.ImportBom.Name = "ImportBom"; - this.ImportBom.Size = new System.Drawing.Size(180, 22); + this.ImportBom.Size = new System.Drawing.Size(113, 22); this.ImportBom.Text = "BOM"; this.ImportBom.Click += new System.EventHandler(this.ImportBom_Click); // // BtnPurchaseImport // this.BtnPurchaseImport.Name = "BtnPurchaseImport"; - this.BtnPurchaseImport.Size = new System.Drawing.Size(180, 22); + this.BtnPurchaseImport.Size = new System.Drawing.Size(113, 22); this.BtnPurchaseImport.Text = "请购单"; this.BtnPurchaseImport.Click += new System.EventHandler(this.BtnPurchaseImport_Click); // // 领料单ToolStripMenuItem // this.领料单ToolStripMenuItem.Name = "领料单ToolStripMenuItem"; - this.领料单ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.领料单ToolStripMenuItem.Size = new System.Drawing.Size(113, 22); this.领料单ToolStripMenuItem.Text = "领料单"; this.领料单ToolStripMenuItem.Click += new System.EventHandler(this.领料单ToolStripMenuItem_Click); // diff --git a/NX.ERP.U8/FormatHelp.cs b/NX.ERP.U8/FormatHelp.cs index d03a0b4..0723c89 100644 --- a/NX.ERP.U8/FormatHelp.cs +++ b/NX.ERP.U8/FormatHelp.cs @@ -23,21 +23,21 @@ namespace NX.ERP.U8 } - public static void GetOriPriceByTaxCost(double iQuan, double itaxcost, double itaxrate, out double iorimoney, out double ioritaxprice, out double iorisum, out double iunitcost) - { - try - { - var info = new Account.Accinformation(); - iorimoney = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iQuan); - ioritaxprice = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iQuan * (itaxrate / 100.0)); - iorisum = info.FormatMoney(itaxcost * iQuan); - iunitcost = info.FormatUPrice(itaxcost / (1.0 + itaxrate / 100.0)); - } - catch (Exception) - { - throw; - } - } + //public static void GetOriPriceByTaxCost(double iQuan, double itaxcost, double itaxrate, out double iorimoney, out double ioritaxprice, out double iorisum, out double iunitcost) + //{ + // try + // { + // var info = new Account.Accinformation(); + // iorimoney = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iQuan); + // ioritaxprice = info.FormatMoney(itaxcost / (1.0 + itaxrate / 100.0) * iQuan * (itaxrate / 100.0)); + // iorisum = info.FormatMoney(itaxcost * iQuan); + // iunitcost = info.FormatUPrice(itaxcost / (1.0 + itaxrate / 100.0)); + // } + // catch (Exception) + // { + // throw; + // } + //} public static void GetOriPriceByCost(double iQuan, double iunitcost, double itaxrate, out double iorimoney, out double ioritaxprice, out double iorisum, out double itaxcost) @@ -45,10 +45,11 @@ namespace NX.ERP.U8 try { var info = new Account.Accinformation(); - iorimoney = info.FormatMoney(iunitcost * iQuan); - ioritaxprice = info.FormatMoney(iunitcost * iQuan * (itaxrate / 100.0)); - iorisum = info.FormatMoney(iunitcost * (1.0 + itaxrate / 100.0) * iQuan); - itaxcost = info.FormatUPrice(iunitcost * (1.0 + itaxrate / 100.0)); + // iorimoney = info.FormatMoney(iunitcost * iQuan); + ioritaxprice = info.FormatMoney(iunitcost * iQuan * (itaxrate / 100.0f)); + iorisum = info.FormatMoney(iunitcost * (1.0f + itaxrate / 100.0f) * iQuan); + itaxcost = info.FormatUPrice(iunitcost * (1.0f + itaxrate / 100.0f)); + iorimoney = info.FormatMoney(iorisum - ioritaxprice); } catch (Exception) { @@ -63,9 +64,10 @@ namespace NX.ERP.U8 try { var info = new NX.ERP.U8.Account.Accinformation(); - iprice = info.FormatMoney(iunitcost * iExchRate * iQuan); - itaxprice = info.FormatMoney(iunitcost * iExchRate * iQuan * (itaxrate / 100.0)); - isum = info.FormatMoney(iunitcost * iExchRate * (1.0 + itaxrate / 100.0) * iQuan); + // iprice = info.FormatMoney(iunitcost * iExchRate * iQuan); + itaxprice = info.FormatMoney(iunitcost * iExchRate * iQuan * (itaxrate / 100.0f)); + isum = info.FormatMoney(iunitcost * iExchRate * (1.0f + itaxrate / 100.0f) * iQuan); + iprice = info.FormatMoney(isum - itaxprice); } catch (Exception) { diff --git a/NX.ERP.U8/NX.ERP.U8.csproj b/NX.ERP.U8/NX.ERP.U8.csproj index aab9b9b..101a0c9 100644 --- a/NX.ERP.U8/NX.ERP.U8.csproj +++ b/NX.ERP.U8/NX.ERP.U8.csproj @@ -46,12 +46,14 @@ + + diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index f2dcecb..0c5be8d 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -16,7 +16,7 @@ namespace NX.ERP.U8.Purchase b.cInvCode AS MaterialCode, b.cBatch AS BatchNo, b.fvalidinquan as RealQuantity, - b.ccomunitcode 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.ccomunitcode 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.isum as sum, B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate FROM pu_ArrBody b inner join pu_ArrHead a on a.id=b.id inner join (select cinvcode as cinvcode1,iId from inventory) inventory on b.cinvcode=inventory.cinvcode1 diff --git a/NX.ERP.U8/Store/ApplyMaterialDAL.cs b/NX.ERP.U8/Store/ApplyMaterialDAL.cs new file mode 100644 index 0000000..8ee0a03 --- /dev/null +++ b/NX.ERP.U8/Store/ApplyMaterialDAL.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.U8.Store +{ + class ApplyMaterialDAL + { + } +} diff --git a/NX.ERP.U8/Store/BinChangeDAL.cs b/NX.ERP.U8/Store/BinChangeDAL.cs new file mode 100644 index 0000000..a674ca6 --- /dev/null +++ b/NX.ERP.U8/Store/BinChangeDAL.cs @@ -0,0 +1,52 @@ +using MSXML2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.U8.Store +{ + public class BinChangeDAL : VoucherBase + { + public BinChangeDAL() : base("19", "U8API/BinChange") + { + + } + + public string AddVocher(Model.Request.BinChange binChange) + { + VoucherParameter voucherParameter = new VoucherParameter + { + VoucherType = this.VoucherID, + DomHead = new DOMDocumentClass(), + DomBody = new DOMDocumentClass() + }; + DOMDocument domHead = voucherParameter.DomHead; + DOMDocument domBody = voucherParameter.DomBody; + voucherParameter.DomHead.loadXML(HeadTemplate); + voucherParameter.DomBody.loadXML(BodyTemplate); + IXMLDOMElement headXml = domHead.createElement("z:row"); + headXml.setAttribute("id", 0); + headXml.setAttribute("ddate", DateTime.Now.ToShortDateString()); + headXml.setAttribute("ddate", DateTime.Now.ToShortDateString()); + headXml.setAttribute("cwhcode", binChange.whCode); + headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0313")); + headXml.setAttribute("cvouchcode", "00000009998"); + foreach (var item in binChange.binChangeDetails) + { + var bodyXml = domBody.createElement("z:row"); + bodyXml.setAttribute("cinvcode", item.InvCode); + bodyXml.setAttribute("cbposcode", item.SoucePositon); + + bodyXml.setAttribute("caposcode", item.DestPostion); + bodyXml.setAttribute("iquantity", item.Qty); + domBody.selectSingleNode("//rs:data").appendChild(bodyXml); + + } + domHead.selectSingleNode("//rs:data").appendChild(headXml); + + return this.AddRdVoucher(voucherParameter); + } + + } +} diff --git a/NX.ERP.U8/Store/PuStoreInDAL.cs b/NX.ERP.U8/Store/PuStoreInDAL.cs index 5cb3944..44d6aae 100644 --- a/NX.ERP.U8/Store/PuStoreInDAL.cs +++ b/NX.ERP.U8/Store/PuStoreInDAL.cs @@ -106,17 +106,18 @@ namespace NX.ERP.U8.Store bodyXml.setAttribute("iposid", arrivalDetail.posId); bodyXml.setAttribute("itaxrate", Arrival.TaxRate); var info = new Account.Accinformation(); - FormatHelp.GetUnitPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, Arrival.ExchRate, out double iprice2, out double itaxprice2, out double isum2); + var _oricost = (arrivalDetail.orisum / (1 + (Arrival.TaxRate / 100f)) / arrivalDetail.Qty); + FormatHelp.GetUnitPriceByCost(detail.Quantity, _oricost /*arrivalDetail.oricost*/, Arrival.TaxRate, Arrival.ExchRate, out double iprice2, out double itaxprice2, out double isum2); bodyXml.setAttribute("iunitcost", arrivalDetail.cost); - bodyXml.setAttribute("iprice", iprice2); + bodyXml.setAttribute("iprice", iprice2);// bodyXml.setAttribute("facost", arrivalDetail.cost); - bodyXml.setAttribute("iaprice", iprice2); + bodyXml.setAttribute("iaprice", iprice2);// bodyXml.setAttribute("itaxprice", itaxprice2); bodyXml.setAttribute("isum", isum2); - FormatHelp.GetOriPriceByCost(detail.Quantity, arrivalDetail.oricost, Arrival.TaxRate, out double iorimoney2, out double ioritaxprice2, out double iorisum2, out double iunitcost2); + FormatHelp.GetOriPriceByCost(detail.Quantity, _oricost /*arrivalDetail.oricost*/, Arrival.TaxRate, out double iorimoney2, out double ioritaxprice2, out double iorisum2, out double iunitcost2); bodyXml.setAttribute("ioricost", arrivalDetail.oricost); bodyXml.setAttribute("ioritaxcost", arrivalDetail.oritaxcost); - bodyXml.setAttribute("iorimoney", iorimoney2); + bodyXml.setAttribute("iorimoney", iorimoney2);// bodyXml.setAttribute("ioritaxprice", ioritaxprice2); bodyXml.setAttribute("iorisum", iorisum2); bodyXml.setAttribute("irowno", domBody.selectSingleNode("//rs:data").childNodes.length + 1); diff --git a/NX.ERP.U8/Store/StockDAL.cs b/NX.ERP.U8/Store/StockDAL.cs new file mode 100644 index 0000000..d945ae2 --- /dev/null +++ b/NX.ERP.U8/Store/StockDAL.cs @@ -0,0 +1,31 @@ +using Dapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace NX.ERP.U8.Store +{ + public class StockDAL + { + public IEnumerable GetList(string strwhere = "", object Params = null) + { + using (var conn = U8LoginContext.Instance.Connection) + { + var sql = @"select a.cInvCode as MaterialCode ,c.cPosName as BinName,(isnull(a.iQuantity,0)-isnull(b.iQuantity,0)) as Qty from ( +select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=1 group by cInvCode,cPosCode +)a full join ( +select cInvCode,cPosCode , sum(iQuantity)as iQuantity from InvPosition where bRdFlag=0 group by cInvCode,cPosCode) +b on isnull(a.cInvCode,'')=isnull(b.cInvCode,'') and a.cPosCode=b.cPosCode +left join Position c on a.cPosCode=c.cPosCode +where a.cPosCode like '021%'"; + if (!string.IsNullOrEmpty(strwhere)) + { + sql += $" where {strwhere}"; + } + return conn.Query(sql, Params); + } + } + + } +} diff --git a/NX.ERP.WebAPi/Controllers/Store/BinChangeController.cs b/NX.ERP.WebAPi/Controllers/Store/BinChangeController.cs new file mode 100644 index 0000000..6b6fec9 --- /dev/null +++ b/NX.ERP.WebAPi/Controllers/Store/BinChangeController.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; + +namespace NX.ERP.WebAPi.Controllers.Store +{ + public class BinChangeController: ApiController + { + + [Route("api/BinChange/Add")] + [HttpPost] + + public string AddVoucher([FromBody] Model.Request.BinChange storeIn) + { + var dal = new NX.ERP.U8.Store.BinChangeDAL(); + return dal.AddVocher(new Model.Request.BinChange() + { + whCode = "2", + binChangeDetails = new List() + { + new Model.Request.BinChangeDetail() + { + InvCode="511153", + SoucePositon="A1Y1H002", + DestPostion="A1Y1H003", + Qty=1 + + } + + } + + + }); ; + } + + + + } +} \ No newline at end of file diff --git a/NX.ERP.WebAPi/Controllers/Store/StockController.cs b/NX.ERP.WebAPi/Controllers/Store/StockController.cs new file mode 100644 index 0000000..f97eeed --- /dev/null +++ b/NX.ERP.WebAPi/Controllers/Store/StockController.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Http; + +namespace NX.ERP.WebAPi.Controllers.Store +{ + public class StockController: ApiController + { + [HttpPost] + [Route("api/Stock/GetStock")] + public IEnumerable GetList() + { + return new U8.Store.StockDAL().GetList(); + } + } +} \ No newline at end of file diff --git a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj index 15b70ec..6eaf383 100644 --- a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj +++ b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj @@ -158,12 +158,14 @@ + + diff --git a/NX.ERP.WebAPi/NX.ERP.WebAPi.zip b/NX.ERP.WebAPi/NX.ERP.WebAPi.zip deleted file mode 100644 index 9099a35..0000000 Binary files a/NX.ERP.WebAPi/NX.ERP.WebAPi.zip and /dev/null differ diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 3c461db..d326e0f 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -6,7 +6,7 @@ - +