修正项目结构

This commit is contained in:
admin
2021-01-15 09:26:17 +08:00
parent 62bd133757
commit a2fd7eca0b
44 changed files with 230 additions and 73 deletions

View File

@@ -49,6 +49,9 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -57,33 +60,40 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MOM\MoAllocate.cs" />
<Compile Include="MOM\MomDetail.cs" />
<Compile Include="MOM\MomOrder.cs" />
<Compile Include="Purchase\Arrival.cs" />
<Compile Include="Purchase\ArrivalDetail.cs" />
<Compile Include="Base\Bin.cs" />
<Compile Include="Base\Customer.cs" />
<Compile Include="Base\Materiel.cs" />
<Compile Include="Base\MaterielType.cs" />
<Compile Include="Base\Supplier.cs" />
<Compile Include="Base\Unit.cs" />
<Compile Include="Base\Warehouse.cs" />
<Compile Include="Response\Store\MaterielStoreOut.cs" />
<Compile Include="Response\Store\MaterielStoreOutDetail.cs" />
<Compile Include="Request\PuStoreIn.cs" />
<Compile Include="Request\PuStoreInDetail.cs" />
<Compile Include="Response\MOM\MoAllocate.cs" />
<Compile Include="Response\MOM\MomDetail.cs" />
<Compile Include="Response\MOM\MomOrder.cs" />
<Compile Include="Response\Purchase\Arrival.cs" />
<Compile Include="Response\Purchase\ArrivalDetail.cs" />
<Compile Include="Response\Base\Bin.cs" />
<Compile Include="Response\Base\Customer.cs" />
<Compile Include="Response\Base\Materiel.cs" />
<Compile Include="Response\Base\MaterielType.cs" />
<Compile Include="Response\Base\Supplier.cs" />
<Compile Include="Response\Base\Unit.cs" />
<Compile Include="Response\Base\Warehouse.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sale\DispatchList.cs" />
<Compile Include="Sale\DispatchListDetail.cs" />
<Compile Include="Store\MaterielStoreOut.cs" />
<Compile Include="Store\MaterielStoreOutDetail.cs" />
<Compile Include="Store\OtherStoreIn.cs" />
<Compile Include="Store\OtherStoreInDetail.cs" />
<Compile Include="Store\OtherStoreOut.cs" />
<Compile Include="Store\OtherStoreOutDetail.cs" />
<Compile Include="Store\ProductStoreIn.cs" />
<Compile Include="Store\ProductStoreInDetail.cs" />
<Compile Include="Store\PuStoreIn.cs" />
<Compile Include="Store\PuStoreInDetail.cs" />
<Compile Include="Store\SaleStoreOut.cs" />
<Compile Include="Store\SaleStoreOutDetail.cs" />
<Compile Include="Response\Sale\DispatchList.cs" />
<Compile Include="Response\Sale\DispatchListDetail.cs" />
<Compile Include="Request\MaterielStoreOut.cs" />
<Compile Include="Request\MaterielStoreOutDetail.cs" />
<Compile Include="Response\Store\OtherStoreIn.cs" />
<Compile Include="Response\Store\OtherStoreInDetail.cs" />
<Compile Include="Response\Store\OtherStoreOut.cs" />
<Compile Include="Response\Store\OtherStoreOutDetail.cs" />
<Compile Include="Response\Store\ProductStoreIn.cs" />
<Compile Include="Response\Store\ProductStoreInDetail.cs" />
<Compile Include="Response\Store\PuStoreIn.cs" />
<Compile Include="Response\Store\PuStoreInDetail.cs" />
<Compile Include="Response\Store\SaleStoreOut.cs" />
<Compile Include="Response\Store\SaleStoreOutDetail.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

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 MaterielStoreOut
{
private int id;
private string code;
private string whcode;
private DateTime date;
private string sourceCode;
private string source;
private string maker;
private IList<MaterielStoreOutDetail> details;
public int Id { get => id; set => id = value; }
public string Code { get => code; set => code = value; }
public string Whcode { get => whcode; set => whcode = value; }
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<MaterielStoreOutDetail> Details { get => details; set => details = value; }
public string Maker { get => maker; set => maker = value; }
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class PuStoreIn
{
private int id;
private string code;
private DateTime date;
private string depcode;
private string whcode;
private IList<PuStoreInDetail> puStoreInDetails = new List<PuStoreInDetail>();
private string _puCode;
private string maker;
private string personCode;
public IList<PuStoreInDetail> Details { get => puStoreInDetails; set => puStoreInDetails = value; }
public int Id { get => id; set => id = value; }
public string Code { get => code; set => code = value; }
public DateTime Date { get => date; set => date = value; }
public string Depcode { get => depcode; set => depcode = value; }
public string Whcode { get => whcode; set => whcode = value; }
public string Maker { get => maker; set => maker = value; }
public string PersonCode { get => personCode; set => personCode = value; }
/// <summary>
/// 源单类别
/// </summary>
public string Source { get; set; }
/// <summary>
/// 源单编号
/// </summary>
public string SourceCode { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class PuStoreInDetail
{
private int id;
private int puStoreInId;
private string invcode;
private string unit;
private double quantity;
public string Batch { get; set; }
public int Id { get => id; set => id = value; }
public string Invcode { get => invcode; set => invcode = value; }
public double Quantity { get => quantity; set => quantity = value; }
public string Position { get; set; }
public int SorceDetailId { get; set; }
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,6 +11,7 @@ namespace NX.ERP.Model.MOM
private int id;
private double qty;
private int modid;
[JsonIgnore]
public ICollection<MoAllocate> moAllocates { get; set; } = new List<MoAllocate>();
public int Id { get => id; set => id = value; }
public double Qty { get => qty; set => qty = value; }

View File

@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
namespace NX.ERP.Model.MOM
{
public class MomOrder
@@ -12,10 +12,11 @@ namespace NX.ERP.Model.MOM
/// <summary>
///
/// </summary>
public ICollection<MomDetail> momDetails { get; set; } = new List<MomDetail>();
public ICollection<MomDetail> Details { get; set; } = new List<MomDetail>();
public int Id { get => id; set => id = value; }
public string Code { get => code; set => code = value; }
public ICollection<MoAllocate> moAllocates { get; set; } = new List<MoAllocate>();
public ICollection<MoAllocate> Allocates { get; set; } = new List<MoAllocate>();
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.Model.Request
{
public class MaterielStoreOutDetail
{
private double quantity;
private string binCode;
private string cinvcode;
public int sorceDetailId { get; set; }
public double Quantity { get => quantity; set => quantity = value; }
public string Position { get => binCode; set => binCode = value; }
public string Cinvcode { get => cinvcode; set => cinvcode = value; }
}
}

View File

@@ -20,6 +20,7 @@ namespace NX.ERP.Model.Store
public string Unit { get => unit; set => unit = value; }
public double Quantity { get => quantity; set => quantity = value; }
public string Position { get; set; }
public int SorceDetailId { get; set; }
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net35" />
</packages>

View File

@@ -298,22 +298,22 @@ namespace U8AppMain
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
var a = new NX.ERP.U8.Store.PuStoreInDAL();
var id = a.AddVocher(new NX.ERP.Model.Store.PuStoreIn()
var id = a.AddVocher(new NX.ERP.Model.Request.PuStoreIn()
{
Code = "0001",
Date = DateTime.Today,
RdCode = "101",
Depcode = "24",
Whcode = "1",
Source = "采购到货单",
SourceCode = "CGDH210100187",
Details = new List<NX.ERP.Model.Store.PuStoreInDetail>() {
new NX.ERP.Model.Store.PuStoreInDetail(){
Details = new List<NX.ERP.Model.Request.PuStoreInDetail>() {
new NX.ERP.Model.Request.PuStoreInDetail(){
Quantity=1,
Invcode="201763",
SorceDetailId=1000023624,
Position=""
}
}
});
@@ -327,7 +327,7 @@ namespace U8AppMain
//var a = new STVocher();
//a.AddVocher();
var a = new NX.ERP.U8.Store.MaterielStoreOutDAL();
a.AddVocher(new NX.ERP.Model.Store.MaterielStoreOut()
a.AddVocher(new NX.ERP.Model.Request.MaterielStoreOut()
{
Id = 1111,
Code = "2222",
@@ -336,13 +336,12 @@ namespace U8AppMain
Whcode = "2",
Date = DateTime.Now,
Details = new List<NX.ERP.Model.Store.MaterielStoreOutDetail>()
Details = new List<NX.ERP.Model.Request.MaterielStoreOutDetail>()
{
new NX.ERP.Model.Store.MaterielStoreOutDetail()
new NX.ERP.Model.Request.MaterielStoreOutDetail()
{
BinCode="002070206",
Position="002070206",
Cinvcode="218174",
sorceDetailId=1000200145,
Quantity=1,
}

View File

@@ -38,13 +38,13 @@ namespace NX.ERP.U8.Mom
if (!lookupDetail.TryGetValue(OrderDetail.Id, out var momDetail))
{
lookupDetail.Add(OrderDetail.Id, OrderDetail);
Order.momDetails.Add(OrderDetail);
Order.Details.Add(OrderDetail);
}
else
{
OrderDetail = momDetail;
}
Order.moAllocates.Add(MoAllocate);
Order.Allocates.Add(MoAllocate);
OrderDetail.moAllocates.Add(MoAllocate);
return Order;
}, param, null, true, "id", 10, System.Data.CommandType.Text);

View File

@@ -14,6 +14,11 @@ namespace NX.ERP.U8.Sale
from DispatchList as a
left join DispatchLists as b on a.DLID = b.DLID";
if (!string.IsNullOrEmpty(strWhere))
{
strSql += $" where {strWhere} ";
}
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{
var lookup = new Dictionary<int, Model.Sale.DispatchList>();
@@ -43,7 +48,7 @@ namespace NX.ERP.U8.Sale
/// <returns></returns>
public Model.Sale.DispatchList GetModel(int id)
{
return this.GetList(" a.cDLCode=@id", new { id }).FirstOrDefault();
return this.GetList(" a.DLID=@id", new { id }).FirstOrDefault();
}
@@ -53,9 +58,9 @@ namespace NX.ERP.U8.Sale
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public Model.Sale.DispatchList GetModel(string Code)
public Model.Sale.DispatchList GetModel(string Code)
{
return this.GetList(" a.DLID=@Code", new { Code }).FirstOrDefault();
return this.GetList(" a.cDLCode=@Code", new { Code }).FirstOrDefault();
}
/// <summary>

View File

@@ -21,7 +21,7 @@ namespace NX.ERP.U8.Store
public string AddVocher(MaterielStoreOut storeOut)
public string AddVocher(Model.Request.MaterielStoreOut storeOut)
{
VoucherParameter voucherParameter = new VoucherParameter
{
@@ -65,8 +65,8 @@ namespace NX.ERP.U8.Store
for (var n = 0; n < storeOut.Details.Count(); n++)
{
var detail = storeOut.Details[n];
var alllocate = Order.moAllocates.First(m => { return m.Id == detail.sorceDetailId; });
var moomDetail = Order.momDetails.First(m => { return m.Id == alllocate.ModId; });
var alllocate = Order.Allocates.First(m => { return m.Id == detail.sorceDetailId; });
var moomDetail = Order.Details.First(m => { return m.Id == alllocate.ModId; });
bodyXml = domBody.createElement("z:row");
bodyXml.setAttribute("autoid", n);
bodyXml.setAttribute("cinvcode", detail.Cinvcode);
@@ -74,7 +74,7 @@ namespace NX.ERP.U8.Store
bodyXml.setAttribute("irowno", n + 1);
bodyXml.setAttribute("cbatch", "");
bodyXml.setAttribute("cvmivencode", "");
bodyXml.setAttribute("cposition", detail.BinCode);
bodyXml.setAttribute("cposition", detail.Position);
bodyXml.setAttribute("editprop", "A");
bodyXml.setAttribute("innum", 10);
bodyXml.setAttribute("autoid", storeOut.Id);

View File

@@ -62,7 +62,7 @@ namespace NX.ERP.U8.Store
bodyXml.setAttribute("editprop", "A");
bodyXml.setAttribute("cbatch", detail.Batch);
bodyXml.setAttribute("cposition", detail.Position);
var momOrderDetail = momOrder.momDetails.First(m => { return m.Id == detail.SourceDetailId; });
var momOrderDetail = momOrder.Details.First(m => { return m.Id == detail.SourceDetailId; });
headXml.setAttribute("cmpocode", momOrder.Code);
headXml.setAttribute("iproorderid", momOrder.Id);
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);

View File

@@ -19,7 +19,7 @@ namespace NX.ERP.U8.Store
/// 保存一个采购到货单
/// </summary>
/// <param name="puStoreIn"></param>
public string AddVocher(Model.Store.PuStoreIn puStoreIn)
public string AddVocher(Model.Request.PuStoreIn puStoreIn)
{
VoucherParameter voucherParameter = new VoucherParameter
@@ -43,13 +43,13 @@ namespace NX.ERP.U8.Store
headXml.setAttribute("bpufirst", "0"); //DomHead[0]["bpufirst"] = ""; //采购期初标志,string类型
headXml.setAttribute("brdflag", 1); //DomHead[0]["brdflag"] = ""; //收发标志,int类型
headXml.setAttribute("csource", puStoreIn.Source); //DomHead[0]["csource"] = ""; //单据来源,int类型
headXml.setAttribute("cmaker", U8LoginContext.Instance.LoginUserName);//DomHead[0]["cmaker"] = ""; //制单人,string类型
headXml.setAttribute("cmaker", puStoreIn.Maker);//DomHead[0]["cmaker"] = ""; //制单人,string类型
headXml.setAttribute("vt_id", "27");
headXml.setAttribute("editprop", "A");
headXml.setAttribute("cdepcode", puStoreIn.Depcode);
headXml.setAttribute("cpersoncode", puStoreIn.PersonCode);
headXml.setAttribute("crdcode", puStoreIn.RdCode);
headXml.setAttribute("cwhcode", "1");
headXml.setAttribute("crdcode", "101" /*puStoreIn.RdCode*/);
headXml.setAttribute("cwhcode", puStoreIn.Whcode);
headXml.setAttribute("bisstqc", "0");
if (puStoreIn.Source == "采购到货单")
{
@@ -74,11 +74,13 @@ namespace NX.ERP.U8.Store
bodyXml = domBody.createElement("z:row");
bodyXml.setAttribute("cinvcode", detail.Invcode);
bodyXml.setAttribute("iquantity", detail.Quantity);
bodyXml.setAttribute("irowno", n+1);
bodyXml.setAttribute("irowno", n + 1);
bodyXml.setAttribute("cbvencode", "10001");
bodyXml.setAttribute("inquantity", detail.Quantity); //应收数量,double类型
bodyXml.setAttribute("cbatch", detail.Batch);
bodyXml.setAttribute("innum", 0);
bodyXml.setAttribute("cposition", detail.Position);
// bodyXml.setAttribute("cposname", "B1Y1H001"); //货位,string类型
//iXMLDOMElement.setAttribute("carvcode", Arrival.ArrivalCode);
bodyXml.setAttribute("cbarvcode", Arrival.ArrivalCode);
bodyXml.setAttribute("ipurarriveid", Arrival.Id);
@@ -107,7 +109,7 @@ namespace NX.ERP.U8.Store
}
domHead.selectSingleNode("//rs:data").appendChild(headXml);
try
{
return AddRdVoucher(voucherParameter);

View File

@@ -90,11 +90,11 @@ namespace NX.ERP.WebAPi
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Formatting = Newtonsoft.Json.Formatting.Indented,
//小驼峰命名法
ContractResolver = new DefaultContractResolver()
{
//ContractResolver = new DefaultContractResolver()
//{
NamingStrategy = new SnakeCaseNamingStrategy()
}
// NamingStrategy = new SnakeCaseNamingStrategy()
//}
//格式化日期时间
//空值处理

View File

@@ -8,6 +8,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
{
public class MomOrderController : ApiController
{
[Route("api/MomOrder/List")]
[HttpGet]
public IEnumerable<Model.MOM.MomOrder> List()
{
@@ -15,14 +16,21 @@ namespace NX.ERP.WebAPi.Controllers.MOM
return customerDAL.GetList();
}
[Route("api/MomOrder/list/{id}")]
[HttpGet]
public IEnumerable<Model.MOM.MomOrder> GetListByLastID(int Code)
public IEnumerable<Model.MOM.MomOrder> GetListByLastID(int id)
{
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.GetListByLastID(Code);
return customerDAL.GetListByLastID(id);
}
[Route("api/MomOrder/{Code}")]
[HttpGet]
public Model.MOM.MomOrder GetModel(string Code)
{
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.GetModel(Code);
}
}
}

View File

@@ -9,7 +9,7 @@ namespace NX.ERP.WebAPi.Controllers
{
public class ArrivalController : ApiController
{
[Route("api/Arrival/List")]
// GET api/values
[HttpGet]
public IEnumerable<Model.Purchase.Arrival> List()
@@ -18,18 +18,20 @@ namespace NX.ERP.WebAPi.Controllers
return customerDAL.GetList();
}
[Route("api/Arrival/{Code}")]
[HttpGet]
public Model.Purchase.Arrival Model(string Code)
{
var customerDAL = new ArrivalDAL();
return customerDAL.GetModel(Code);
}
[Route("api/Arrival/list/{id}")]
[HttpGet]
public IEnumerable<Model.Purchase.Arrival> GetListByLastID(int Code)
public IEnumerable<Model.Purchase.Arrival> GetListByLastID(int id)
{
var customerDAL = new ArrivalDAL();
return customerDAL.GetListByLastId(Code);
return customerDAL.GetListByLastId(id);
}

View File

@@ -10,6 +10,7 @@ namespace NX.ERP.WebAPi.Controllers.Sale
{
public class DispatchController : ApiController
{
[Route("api/Dispatch/List")]
// GET api/values
[HttpGet]
public IEnumerable<Model.Sale.DispatchList> List()
@@ -24,18 +25,19 @@ namespace NX.ERP.WebAPi.Controllers.Sale
var customerDAL = new DispatchListDAL();
return customerDAL.GetModel(id);
}
[Route("api/Dispatch/{Code}")]
[HttpGet]
public Model.Sale.DispatchList ModelByCode(string Code)
{
var customerDAL = new DispatchListDAL();
return customerDAL.GetModel(Code);
}
[Route("api/Dispatch/List/{id}")]
[HttpGet]
public IEnumerable<Model.Sale.DispatchList> GetListByLastID(int Code)
public IEnumerable<Model.Sale.DispatchList> GetListByLastID(int id)
{
var customerDAL = new DispatchListDAL();
return customerDAL.GetListByLastID(Code);
return customerDAL.GetListByLastID(id);
}
}

View File

@@ -8,8 +8,10 @@ namespace NX.ERP.WebAPi.Controllers.Store
{
public class MaterielStoreOutController:ApiController
{
[Route("api/MaterialOut/Add")]
[HttpPost]
public string AddVoucher([FromBody] Model.Store.MaterielStoreOut storeIn)
public string AddVoucher([FromBody] Model.Request.MaterielStoreOut storeIn)
{
var dal = new NX.ERP.U8.Store.MaterielStoreOutDAL();
return dal.AddVocher(storeIn);

View File

@@ -8,11 +8,12 @@ namespace NX.ERP.WebAPi.Controllers.Store
{
public class PuStoreInController : ApiController
{
[Route("api/PuStoreIn/Add")]
[HttpPost]
public string AddVoucher([FromBody] Model.Store.PuStoreIn storeIn)
public object AddVoucher([FromBody] Model.Request.PuStoreIn storeIn)
{
var dal = new NX.ERP.U8.Store.PuStoreInDAL();
return dal.AddVocher(storeIn);
return new { Id = dal.AddVocher(storeIn) };
}
}
}