This commit is contained in:
gongxh
2021-03-23 15:06:34 +08:00
parent 7e48441739
commit 27fccb1674
18 changed files with 267 additions and 50 deletions

View File

@@ -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

View File

@@ -62,6 +62,8 @@
<ItemGroup>
<Compile Include="BaseBill.cs" />
<Compile Include="BaseModel.cs" />
<Compile Include="Request\BinChange.cs" />
<Compile Include="Response\Store\Stock.cs" />
<Compile Include="TimestampConverter.cs" />
<Compile Include="Request\Arrival.cs" />
<Compile Include="Request\Bin.cs" />

View File

@@ -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<BinChangeDetail> binChangeDetails = new List<BinChangeDetail>();
}
}

View File

@@ -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; }

View File

@@ -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; }
}
}

View File

@@ -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);
//

View File

@@ -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)
{

View File

@@ -46,12 +46,14 @@
<Compile Include="Purchase\ArrivalDAL.cs" />
<Compile Include="Sale\DispatchListDAL.cs" />
<Compile Include="Store\BaseBill.cs" />
<Compile Include="Store\BinChangeDAL.cs" />
<Compile Include="Store\MaterielStoreOutDAL.cs" />
<Compile Include="Store\OtherStoreInDAL.cs" />
<Compile Include="Store\OtherStoreOutDAL.cs" />
<Compile Include="Store\ProductInDAL.cs" />
<Compile Include="Store\PuStoreInDAL.cs" />
<Compile Include="Store\SaleOutDAL.cs" />
<Compile Include="Store\StockDAL.cs" />
<Compile Include="Store\VoucherBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Base\SupplierDAL.cs" />

View File

@@ -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

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.U8.Store
{
class ApplyMaterialDAL
{
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);

View File

@@ -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<Model.Response.Store.Stock> 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<Model.Response.Store.Stock>(sql, Params);
}
}
}
}

View File

@@ -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<Model.Request.BinChangeDetail>()
{
new Model.Request.BinChangeDetail()
{
InvCode="511153",
SoucePositon="A1Y1H002",
DestPostion="A1Y1H003",
Qty=1
}
}
}); ;
}
}
}

View File

@@ -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<Model.Response.Store.Stock> GetList()
{
return new U8.Store.StockDAL().GetList();
}
}
}

View File

@@ -158,12 +158,14 @@
<Compile Include="Controllers\Base\UnitController.cs" />
<Compile Include="Controllers\Base\WarehouseController.cs" />
<Compile Include="Controllers\Sale\DispatchController.cs" />
<Compile Include="Controllers\Store\BinChangeController.cs" />
<Compile Include="Controllers\Store\MaterielStoreOutController.cs" />
<Compile Include="Controllers\Store\OtherStoreInController.cs" />
<Compile Include="Controllers\Store\OtherStoreOutController.cs" />
<Compile Include="Controllers\Store\ProductStoreInController.cs" />
<Compile Include="Controllers\Store\PuStoreInController.cs" />
<Compile Include="Controllers\Store\SaleStoreOutController.cs" />
<Compile Include="Controllers\Store\StockController.cs" />
<Compile Include="Controllers\Store\StoreController.cs" />
<Compile Include="Filters\ApiResultAttribute.cs" />
<Compile Include="Filters\ExceptionFilter.cs" />

Binary file not shown.

View File

@@ -6,7 +6,7 @@
<configuration>
<appSettings>
<add key="server" value="10.0.0.12"/>
<add key="AccId" value="u8-2@001"/>
<add key="AccId" value="u8-2@003"/>
<add key="UserId" value="wx997"/>
<add key="Password" value="1"/>
<add key="EaiPort" value="80"/>