Merge branch 'master' of https://code.gxhnet.com/gongxh/u8-import
This commit is contained in:
16
NX.ERP.BLL/Model/MomOrder.cs
Normal file
16
NX.ERP.BLL/Model/MomOrder.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace NX.ERP.BLL.Model
|
||||||
|
{
|
||||||
|
public class MomOrder
|
||||||
|
{
|
||||||
|
|
||||||
|
public string product_order_no { get; set; }
|
||||||
|
public string product_code { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
<Compile Include="Model\InboundDetail.cs" />
|
<Compile Include="Model\InboundDetail.cs" />
|
||||||
<Compile Include="Model\InboundType.cs" />
|
<Compile Include="Model\InboundType.cs" />
|
||||||
<Compile Include="Model\Inbound.cs" />
|
<Compile Include="Model\Inbound.cs" />
|
||||||
|
<Compile Include="Model\MomOrder.cs" />
|
||||||
<Compile Include="Model\OutBound.cs" />
|
<Compile Include="Model\OutBound.cs" />
|
||||||
<Compile Include="Model\OutBoundDetail.cs" />
|
<Compile Include="Model\OutBoundDetail.cs" />
|
||||||
<Compile Include="Model\OutBoundType.cs" />
|
<Compile Include="Model\OutBoundType.cs" />
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace NX.ERP.BLL.Store
|
|||||||
var dal = new NX.ERP.U8.Store.PuStoreInDAL();
|
var dal = new NX.ERP.U8.Store.PuStoreInDAL();
|
||||||
ID = dal.AddVocher(new ERP.Model.Request.PuStoreIn()
|
ID = dal.AddVocher(new ERP.Model.Request.PuStoreIn()
|
||||||
{
|
{
|
||||||
|
Code = "190700000050",
|
||||||
Date = inbound.InboundDate,
|
Date = inbound.InboundDate,
|
||||||
Source = inbound.SourceName,
|
Source = inbound.SourceName,
|
||||||
SourceCode = inbound.SourceNo,
|
SourceCode = inbound.SourceNo,
|
||||||
@@ -44,6 +45,9 @@ namespace NX.ERP.BLL.Store
|
|||||||
var dal = new NX.ERP.U8.Store.ProductInDAL();
|
var dal = new NX.ERP.U8.Store.ProductInDAL();
|
||||||
ID = dal.AddVoucher(new ERP.Model.Request.ProductStoreIn()
|
ID = dal.AddVoucher(new ERP.Model.Request.ProductStoreIn()
|
||||||
{
|
{
|
||||||
|
Code= "19100002",
|
||||||
|
|
||||||
|
|
||||||
Date = inbound.InboundDate,
|
Date = inbound.InboundDate,
|
||||||
Source = inbound.SourceName,
|
Source = inbound.SourceName,
|
||||||
SourceCode = inbound.SourceNo,
|
SourceCode = inbound.SourceNo,
|
||||||
@@ -68,6 +72,7 @@ namespace NX.ERP.BLL.Store
|
|||||||
var dal = new NX.ERP.U8.Store.OtherStoreInDAL();
|
var dal = new NX.ERP.U8.Store.OtherStoreInDAL();
|
||||||
ID = dal.AddVocher(new ERP.Model.Request.OtherStoreInOut()
|
ID = dal.AddVocher(new ERP.Model.Request.OtherStoreInOut()
|
||||||
{
|
{
|
||||||
|
Code= "19100028",
|
||||||
Date = inbound.InboundDate,
|
Date = inbound.InboundDate,
|
||||||
WhCode = inbound.WarehouseCode,
|
WhCode = inbound.WarehouseCode,
|
||||||
Maker = inbound.Maker,
|
Maker = inbound.Maker,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace NX.ERP.BLL.Store
|
|||||||
var dal = new U8.Store.MaterielStoreOutDAL();
|
var dal = new U8.Store.MaterielStoreOutDAL();
|
||||||
ID = dal.AddVocher(new ERP.Model.Request.MaterielStoreOut()
|
ID = dal.AddVocher(new ERP.Model.Request.MaterielStoreOut()
|
||||||
{
|
{
|
||||||
|
Code= "191000000007",
|
||||||
Date = outBound.OutboundDate,
|
Date = outBound.OutboundDate,
|
||||||
Maker = outBound.Maker,
|
Maker = outBound.Maker,
|
||||||
Source = outBound.SourceName,
|
Source = outBound.SourceName,
|
||||||
@@ -43,6 +44,7 @@ namespace NX.ERP.BLL.Store
|
|||||||
var dal = new U8.Store.SaleOutDAL();
|
var dal = new U8.Store.SaleOutDAL();
|
||||||
ID = dal.AddVoucher(new ERP.Model.Request.SaleStoreOut()
|
ID = dal.AddVoucher(new ERP.Model.Request.SaleStoreOut()
|
||||||
{
|
{
|
||||||
|
Code = "191000000003",
|
||||||
Date = outBound.OutboundDate,
|
Date = outBound.OutboundDate,
|
||||||
WhCode = outBound.Maker,
|
WhCode = outBound.Maker,
|
||||||
Source = outBound.SourceName,
|
Source = outBound.SourceName,
|
||||||
@@ -68,7 +70,7 @@ namespace NX.ERP.BLL.Store
|
|||||||
{
|
{
|
||||||
Date = outBound.OutboundDate,
|
Date = outBound.OutboundDate,
|
||||||
WhCode = outBound.Maker,
|
WhCode = outBound.Maker,
|
||||||
|
Code= "19100032",
|
||||||
Maker = outBound.Maker,
|
Maker = outBound.Maker,
|
||||||
details = outBound.OutboundDtlLst.ConvertAll(m =>
|
details = outBound.OutboundDtlLst.ConvertAll(m =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,6 +67,7 @@
|
|||||||
<Compile Include="Request\Dispatch.cs" />
|
<Compile Include="Request\Dispatch.cs" />
|
||||||
<Compile Include="Request\Materiel.cs" />
|
<Compile Include="Request\Materiel.cs" />
|
||||||
<Compile Include="Request\MaterielType.cs" />
|
<Compile Include="Request\MaterielType.cs" />
|
||||||
|
<Compile Include="Request\MomOrder.cs" />
|
||||||
<Compile Include="Request\OtherStoreIn.cs" />
|
<Compile Include="Request\OtherStoreIn.cs" />
|
||||||
<Compile Include="Request\OtherStoreInDetail.cs" />
|
<Compile Include="Request\OtherStoreInDetail.cs" />
|
||||||
<Compile Include="Request\OtherStoreOut.cs" />
|
<Compile Include="Request\OtherStoreOut.cs" />
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NX.ERP.Model.Request
|
namespace NX.ERP.Model.Request
|
||||||
{
|
{
|
||||||
public class Dispatch
|
public class Dispatch:BaseModel
|
||||||
{
|
{
|
||||||
public string SalesOrderNo { get; set; }
|
public string SalesOrderNo { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
16
NX.ERP.Model/Request/MomOrder.cs
Normal file
16
NX.ERP.Model/Request/MomOrder.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace NX.ERP.Model.Request
|
||||||
|
{
|
||||||
|
public class MomOrder: BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
public string ProductOrderNo { get; set; }
|
||||||
|
public string ProductCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,8 +5,9 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NX.ERP.Model.Request
|
namespace NX.ERP.Model.Request
|
||||||
{
|
{
|
||||||
public class ProductStoreIn
|
public class ProductStoreIn: BaseModel
|
||||||
{
|
{
|
||||||
|
public string Code { get; set; }
|
||||||
public string Maker { get; set; }
|
public string Maker { get; set; }
|
||||||
public string Deptcode { get; set; }
|
public string Deptcode { get; set; }
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace NX.ERP.Model
|
|||||||
public int MinStock { get => minStock; set => minStock = value; }
|
public int MinStock { get => minStock; set => minStock = value; }
|
||||||
|
|
||||||
|
|
||||||
|
public int SafeStock { get; set; }
|
||||||
|
|
||||||
public int Aql { get => aql; set => aql = value; }
|
public int Aql { get => aql; set => aql = value; }
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,21 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NX.ERP.Model.MOM
|
namespace NX.ERP.Model.MOM
|
||||||
{
|
{
|
||||||
public class MoAllocate
|
public class MoAllocate:BaseModel
|
||||||
{
|
{
|
||||||
private int id;
|
private int id;
|
||||||
private string invCode;
|
private string invCode;
|
||||||
private double qty;
|
private double qty;
|
||||||
private int modid;
|
private int modid;
|
||||||
|
|
||||||
public int Id { get => id; set => id = value; }
|
public int ProductOrderDtlId { get; set; }
|
||||||
public string InvCode { get => invCode; set => invCode = value; }
|
|
||||||
|
public int AllocateId { get => id; set => id = value; }
|
||||||
|
public string MaterialCode { get => invCode; set => invCode = value; }
|
||||||
public double Qty { get => qty; set => qty = value; }
|
public double Qty { get => qty; set => qty = value; }
|
||||||
public int ModId { get => modid; set => modid = value; }
|
public int ProductOrderId { get => modid; set => modid = value; }
|
||||||
|
//public string UnitCode { get; set; }
|
||||||
|
|
||||||
|
public double Issqty { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,34 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NX.ERP.Model.MOM
|
namespace NX.ERP.Model.MOM
|
||||||
{
|
{
|
||||||
public class MomDetail
|
|
||||||
|
public class MomDetail: BaseModel
|
||||||
{
|
{
|
||||||
private int id;
|
private int id;
|
||||||
private double qty;
|
private double qty;
|
||||||
private int modid;
|
private int modid;
|
||||||
[JsonIgnore]
|
|
||||||
public ICollection<MoAllocate> moAllocates { get; set; } = new List<MoAllocate>();
|
public ICollection<MoAllocate> ProductAllocateOrderLst { get; set; } = new List<MoAllocate>();
|
||||||
public int Id { get => id; set => id = value; }
|
public int ProductOrderDtlId { get => id; set => id = value; }
|
||||||
|
public int ProductOrderId { get => modid; set => modid = value; }
|
||||||
|
|
||||||
|
public string ProductOrderNo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DateTime ProductOrderDate { get; set; }
|
||||||
|
|
||||||
|
public string ProductCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
//public string BatchNo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public double Qty { get => qty; set => qty = value; }
|
public double Qty { get => qty; set => qty = value; }
|
||||||
public int Modid { get => modid; set => modid = value; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,23 @@ using System.Text;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
namespace NX.ERP.Model.MOM
|
namespace NX.ERP.Model.MOM
|
||||||
{
|
{
|
||||||
public class MomOrder
|
public class MomOrder: BaseModel
|
||||||
{
|
{
|
||||||
private int id;
|
private int id;
|
||||||
private string code;
|
private string code;
|
||||||
public DateTime Date { get; set; }
|
//public DateTime Date { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public ICollection<MomDetail> Details { get; set; } = new List<MomDetail>();
|
public ICollection<MomDetail> ProductDtlLst { get; set; } = new List<MomDetail>();
|
||||||
public int Id { get => id; set => id = value; }
|
|
||||||
public string Code { get => code; set => code = value; }
|
public int ProductOrderId { get => id; set => id = value; }
|
||||||
|
public string ProductOrderNo { get => code; set => code = value; }
|
||||||
|
|
||||||
|
public DateTime ProductDate { get; set; }
|
||||||
|
public string PreparedBy { get; set; }
|
||||||
|
[Newtonsoft.Json.JsonIgnore]
|
||||||
public ICollection<MoAllocate> Allocates { get; set; } = new List<MoAllocate>();
|
public ICollection<MoAllocate> Allocates { get; set; } = new List<MoAllocate>();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NX.ERP.Model.Sale
|
namespace NX.ERP.Model.Sale
|
||||||
{
|
{
|
||||||
public class DispatchList
|
public class DispatchList:BaseModel
|
||||||
{
|
{
|
||||||
public int SalesOrderId { get; set; }
|
public int SalesOrderId { get; set; }
|
||||||
public string SalesOrderNo { get; set; }
|
public string SalesOrderNo { get; set; }
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ using System.Text;
|
|||||||
|
|
||||||
namespace NX.ERP.Model.Sale
|
namespace NX.ERP.Model.Sale
|
||||||
{
|
{
|
||||||
public class DispatchListDetail
|
|
||||||
|
public class DispatchListDetail : BaseModel
|
||||||
|
|
||||||
{
|
{
|
||||||
private int sales_order_dtl_id;
|
private int sales_order_dtl_id;
|
||||||
private string invCode;
|
private string invCode;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace NX.ERP.U8
|
|||||||
cGroupCode AS 计量单位组编码,
|
cGroupCode AS 计量单位组编码,
|
||||||
cAssComUnitCode AS 辅计量单位编码,
|
cAssComUnitCode AS 辅计量单位编码,
|
||||||
cInvStd AS SpecsModel,
|
cInvStd AS SpecsModel,
|
||||||
iSafeNum AS 安全库存量,
|
iSafeNum AS SafeStock,
|
||||||
iTopSum AS MaxStock,
|
iTopSum AS MaxStock,
|
||||||
iLowSum AS MinStock,
|
iLowSum AS MinStock,
|
||||||
iMassDate AS 保质期数,
|
iMassDate AS 保质期数,
|
||||||
|
|||||||
@@ -7,13 +7,18 @@ namespace NX.ERP.U8.Mom
|
|||||||
{
|
{
|
||||||
public class MomOrderDAL
|
public class MomOrderDAL
|
||||||
{
|
{
|
||||||
|
|
||||||
public IEnumerable<Model.MOM.MomOrder> GetList(string strWhere = "", object param = null)
|
public IEnumerable<Model.MOM.MomOrder> GetList(string strWhere = "", object param = null)
|
||||||
{
|
{
|
||||||
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
||||||
{
|
{
|
||||||
string strSQL = @"select a.MoId as id,a.moCode as Code,a.CreateDate as date,a.*,b.MoDId as id ,b.*,c.AllocateId as id ,c.* from mom_order as a
|
string strSQL = @"select
|
||||||
left join mom_orderdetail as b on a.MoId=b.MoId
|
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.CreateDate as ProductDate,a.CreateUser as PreparedBy,
|
||||||
left join mom_moallocate as c on b.MoDId=c.MoDId";
|
b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty,
|
||||||
|
c.AllocateId as id ,c.AllocateId as AllocateId,c.MoDId as ProductOrderDtlId,c.InvCode as MaterialCode,b.MoId as ProductOrderId, c.IssQty as IssQty,c.Qty
|
||||||
|
from mom_order as a
|
||||||
|
left join mom_orderdetail as b on a.MoId=b.MoId
|
||||||
|
left join mom_moallocate as c on b.MoDId=c.MoDId ";
|
||||||
if (!string.IsNullOrEmpty(strWhere))
|
if (!string.IsNullOrEmpty(strWhere))
|
||||||
{
|
{
|
||||||
strSQL += $" where {strWhere} ";
|
strSQL += $" where {strWhere} ";
|
||||||
@@ -23,9 +28,9 @@ namespace NX.ERP.U8.Mom
|
|||||||
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
|
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
|
||||||
var list = conn.Query<Model.MOM.MomOrder, Model.MOM.MomDetail, Model.MOM.MoAllocate, Model.MOM.MomOrder>(strSQL, (Order, OrderDetail, MoAllocate) =>
|
var list = conn.Query<Model.MOM.MomOrder, Model.MOM.MomDetail, Model.MOM.MoAllocate, Model.MOM.MomOrder>(strSQL, (Order, OrderDetail, MoAllocate) =>
|
||||||
{
|
{
|
||||||
if (!lookupOrder.TryGetValue(Order.Id, out var _order))
|
if (!lookupOrder.TryGetValue(Order.ProductOrderId, out var _order))
|
||||||
{
|
{
|
||||||
lookupOrder.Add(Order.Id, Order);
|
lookupOrder.Add(Order.ProductOrderId, Order);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -33,17 +38,17 @@ namespace NX.ERP.U8.Mom
|
|||||||
Order = _order;
|
Order = _order;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lookupDetail.TryGetValue(OrderDetail.Id, out var momDetail))
|
if (!lookupDetail.TryGetValue(OrderDetail.ProductOrderDtlId, out var momDetail))
|
||||||
{
|
{
|
||||||
lookupDetail.Add(OrderDetail.Id, OrderDetail);
|
lookupDetail.Add(OrderDetail.ProductOrderDtlId, OrderDetail);
|
||||||
Order.Details.Add(OrderDetail);
|
Order.ProductDtlLst.Add(OrderDetail);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OrderDetail = momDetail;
|
OrderDetail = momDetail;
|
||||||
}
|
}
|
||||||
Order.Allocates.Add(MoAllocate);
|
Order.Allocates.Add(MoAllocate);
|
||||||
OrderDetail.moAllocates.Add(MoAllocate);
|
OrderDetail.ProductAllocateOrderLst.Add(MoAllocate);
|
||||||
return Order;
|
return Order;
|
||||||
}, param, null, true, "id", 10, System.Data.CommandType.Text);
|
}, param, null, true, "id", 10, System.Data.CommandType.Text);
|
||||||
return lookupOrder.Values;
|
return lookupOrder.Values;
|
||||||
@@ -52,6 +57,126 @@ namespace NX.ERP.U8.Mom
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<Model.MOM.MomOrder> QueryOrders(NX.ERP.Model.Request.MomOrder Params)
|
||||||
|
{
|
||||||
|
if (Params == null)
|
||||||
|
{
|
||||||
|
return this.GetOrders();
|
||||||
|
}
|
||||||
|
List<string> where = new List<string>();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Params.ProductCode))
|
||||||
|
{
|
||||||
|
where.Add(" b.InvCode like @ ProductCode");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(Params.ProductOrderNo))
|
||||||
|
{
|
||||||
|
where.Add(" a.moCode like @ProductOrderNo ");
|
||||||
|
}
|
||||||
|
return this.GetOrders(string.Join(" and ", where.ToArray()), new
|
||||||
|
{
|
||||||
|
ProductCode = $"%{Params.ProductCode}%",
|
||||||
|
ProductOrderNo = $"{Params.ProductOrderNo}"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<Model.MOM.MomOrder> GetOrders(string strWhere = "", object Param = null)
|
||||||
|
{
|
||||||
|
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
||||||
|
{
|
||||||
|
string strSQL = @"select
|
||||||
|
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,a.CreateDate as ProductDate,a.CreateUser as PreparedBy,
|
||||||
|
b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty
|
||||||
|
from mom_order as a
|
||||||
|
left join mom_orderdetail as b on a.MoId=b.MoId
|
||||||
|
left join mom_moallocate as c on b.MoDId=c.MoDId
|
||||||
|
";
|
||||||
|
if (!string.IsNullOrEmpty(strWhere))
|
||||||
|
{
|
||||||
|
strSQL += $" where {strWhere} ";
|
||||||
|
}
|
||||||
|
var lookupDetail = new Dictionary<int, Model.MOM.MomDetail>();
|
||||||
|
var lookupOrder = new Dictionary<int, Model.MOM.MomOrder>();
|
||||||
|
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
|
||||||
|
var list = conn.Query<Model.MOM.MomOrder, Model.MOM.MomDetail, Model.MOM.MomOrder>(strSQL, (Order, OrderDetail) =>
|
||||||
|
{
|
||||||
|
if (!lookupOrder.TryGetValue(Order.ProductOrderId, out var _order))
|
||||||
|
{
|
||||||
|
lookupOrder.Add(Order.ProductOrderId, Order);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Order = _order;
|
||||||
|
}
|
||||||
|
Order.ProductDtlLst.Add(OrderDetail);
|
||||||
|
return Order;
|
||||||
|
}, Param, null, true, "id", 10, System.Data.CommandType.Text);
|
||||||
|
return lookupOrder.Values;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<Model.MOM.MomDetail> QueryDetails(NX.ERP.Model.Request.MomOrder Params)
|
||||||
|
{
|
||||||
|
if (Params == null)
|
||||||
|
{
|
||||||
|
return this.GetDetails();
|
||||||
|
}
|
||||||
|
List<string> where = new List<string>();
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Params.ProductCode))
|
||||||
|
{
|
||||||
|
where.Add(" b.InvCode like @ ProductCode");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(Params.ProductOrderNo))
|
||||||
|
{
|
||||||
|
where.Add(" a.moCode like @ProductOrderNo ");
|
||||||
|
}
|
||||||
|
return this.GetDetails(string.Join(" and ", where.ToArray()), new
|
||||||
|
{
|
||||||
|
ProductCode = $"%{Params.ProductCode}%",
|
||||||
|
ProductOrderNo = $"{Params.ProductOrderNo}"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<Model.MOM.MomDetail> GetDetails(string strWhere = "", object Param = null)
|
||||||
|
{
|
||||||
|
var strSql = @"select
|
||||||
|
b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,a.MoCode as ProductOrderNo,a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty,
|
||||||
|
c.AllocateId as id ,c.AllocateId as AllocateId,c.MoDId as ProductOrderDtlId,c.InvCode as MaterialCode,b.MoId as ProductOrderId, c.IssQty as IssQty,c.Qty
|
||||||
|
from mom_order as a
|
||||||
|
left join mom_orderdetail as b on a.MoId=b.MoId
|
||||||
|
left join mom_moallocate as c on b.MoDId=c.MoDId ";
|
||||||
|
var lookup = new Dictionary<int, Model.MOM.MomDetail>();
|
||||||
|
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
conn.Query<Model.MOM.MomDetail, Model.MOM.MoAllocate, Model.MOM.MomDetail>(strSql, (OrderDetail, MoAllocate) =>
|
||||||
|
{
|
||||||
|
if (!lookup.TryGetValue(OrderDetail.ProductOrderDtlId, out var _OrderDetail))
|
||||||
|
{
|
||||||
|
lookup.Add(OrderDetail.ProductOrderDtlId, OrderDetail);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OrderDetail = _OrderDetail;
|
||||||
|
}
|
||||||
|
OrderDetail.ProductAllocateOrderLst.Add(MoAllocate);
|
||||||
|
|
||||||
|
return OrderDetail;
|
||||||
|
}, Param, null, true, "id", 100, System.Data.CommandType.Text);
|
||||||
|
|
||||||
|
}
|
||||||
|
return lookup.Values;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Model.MOM.MomOrder GetModel(string Code)
|
public Model.MOM.MomOrder GetModel(string Code)
|
||||||
{
|
{
|
||||||
return this.GetList("a.moCode=@Code", new { Code }).FirstOrDefault();
|
return this.GetList("a.moCode=@Code", new { Code }).FirstOrDefault();
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ namespace NX.ERP.U8.Store
|
|||||||
{
|
{
|
||||||
throw new Exception($"未知订单:{storeOut.SourceCode}");
|
throw new Exception($"未知订单:{storeOut.SourceCode}");
|
||||||
}
|
}
|
||||||
headXml.setAttribute("iproorderid", Order.Id);
|
headXml.setAttribute("iproorderid", Order.ProductOrderId);
|
||||||
headXml.setAttribute("cmpocode", Order.Code);
|
headXml.setAttribute("cmpocode", Order.ProductOrderNo);
|
||||||
headXml.setAttribute("cpspcode", "");
|
headXml.setAttribute("cpspcode", "");
|
||||||
headXml.setAttribute("crdname", "材料出库");
|
headXml.setAttribute("crdname", "材料出库");
|
||||||
headXml.setAttribute("cdepcode", "24");
|
headXml.setAttribute("cdepcode", "24");
|
||||||
@@ -69,20 +69,20 @@ namespace NX.ERP.U8.Store
|
|||||||
for (var n = 0; n < storeOut.Details.Count(); n++)
|
for (var n = 0; n < storeOut.Details.Count(); n++)
|
||||||
{
|
{
|
||||||
var detail = storeOut.Details[n];
|
var detail = storeOut.Details[n];
|
||||||
var alllocate = Order.Allocates.FirstOrDefault(m => { return m.Id == detail.SorceDetailId; });
|
var alllocate = Order.Allocates.FirstOrDefault(m => { return m.AllocateId == detail.SorceDetailId; });
|
||||||
if (alllocate == null)
|
if (alllocate == null)
|
||||||
{
|
{
|
||||||
throw new Exception($"未知订单明细行:{detail.SorceDetailId}");
|
throw new Exception($"未知订单明细行:{detail.SorceDetailId}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alllocate.InvCode != detail.InvCode)
|
if (alllocate.MaterialCode != detail.InvCode)
|
||||||
{
|
{
|
||||||
throw new Exception($"订单明细存货编号与出库存货编号不符:{detail.InvCode}");
|
throw new Exception($"订单明细存货编号与出库存货编号不符:{detail.InvCode}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var moomDetail = Order.Details.FirstOrDefault(m => { return m.Id == alllocate.ModId; });
|
var moomDetail = Order.ProductDtlLst.FirstOrDefault(m => { return m.ProductOrderDtlId == alllocate.ProductOrderId; });
|
||||||
bodyXml = domBody.createElement("z:row");
|
bodyXml = domBody.createElement("z:row");
|
||||||
bodyXml.setAttribute("autoid", n);
|
bodyXml.setAttribute("autoid", n);
|
||||||
bodyXml.setAttribute("cinvcode", detail.InvCode);
|
bodyXml.setAttribute("cinvcode", detail.InvCode);
|
||||||
@@ -97,7 +97,7 @@ namespace NX.ERP.U8.Store
|
|||||||
bodyXml.setAttribute("id", storeOut.Id);
|
bodyXml.setAttribute("id", storeOut.Id);
|
||||||
|
|
||||||
bodyXml.setAttribute("impoids", detail.SorceDetailId);
|
bodyXml.setAttribute("impoids", detail.SorceDetailId);
|
||||||
bodyXml.setAttribute("cmocode", Order.Code);
|
bodyXml.setAttribute("cmocode", Order.ProductOrderNo);
|
||||||
bodyXml.setAttribute("invcode", "904008");//产品编码
|
bodyXml.setAttribute("invcode", "904008");//产品编码
|
||||||
bodyXml.setAttribute("cwhcode", storeOut.Whcode);
|
bodyXml.setAttribute("cwhcode", storeOut.Whcode);
|
||||||
bodyXml.setAttribute("imoseq", 1);
|
bodyXml.setAttribute("imoseq", 1);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace NX.ERP.U8.Store
|
|||||||
headXml.setAttribute("bomfirst", "0");
|
headXml.setAttribute("bomfirst", "0");
|
||||||
headXml.setAttribute("biafirst", "0");
|
headXml.setAttribute("biafirst", "0");
|
||||||
headXml.setAttribute("brdflag", 1);
|
headXml.setAttribute("brdflag", 1);
|
||||||
headXml.setAttribute("ccode", "11");
|
headXml.setAttribute("ccode", storeIn.Code);
|
||||||
headXml.setAttribute("ddate", storeIn.Date);
|
headXml.setAttribute("ddate", storeIn.Date);
|
||||||
headXml.setAttribute("cmaker", storeIn.Maker);
|
headXml.setAttribute("cmaker", storeIn.Maker);
|
||||||
headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0411"));
|
headXml.setAttribute("vt_id", new VT().GetDefaltVTID("0411"));
|
||||||
@@ -63,9 +63,9 @@ namespace NX.ERP.U8.Store
|
|||||||
bodyXml.setAttribute("editprop", "A");
|
bodyXml.setAttribute("editprop", "A");
|
||||||
bodyXml.setAttribute("cbatch", detail.Batch);
|
bodyXml.setAttribute("cbatch", detail.Batch);
|
||||||
bodyXml.setAttribute("cposition", detail.Position);
|
bodyXml.setAttribute("cposition", detail.Position);
|
||||||
var momOrderDetail = momOrder.Details.First(m => { return m.Id == detail.SourceDetailId; });
|
var momOrderDetail = momOrder.ProductDtlLst.First(m => { return m.ProductOrderDtlId == detail.SourceDetailId; });
|
||||||
headXml.setAttribute("cmpocode", momOrder.Code);
|
headXml.setAttribute("cmpocode", momOrder.ProductOrderNo);
|
||||||
headXml.setAttribute("iproorderid", momOrder.Id);
|
headXml.setAttribute("iproorderid", momOrder.ProductOrderId);
|
||||||
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
|
domBody.selectSingleNode("//rs:data").appendChild(bodyXml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,7 @@ namespace NX.ERP.U8
|
|||||||
{
|
{
|
||||||
var strSql= "select DEF_ID from vouchers_base where CardNumber=@CardNumber";
|
var strSql= "select DEF_ID from vouchers_base where CardNumber=@CardNumber";
|
||||||
return conn.ExecuteScalar<string>(strSql, new { CardNumber }, null, 100, System.Data.CommandType.Text);
|
return conn.ExecuteScalar<string>(strSql, new { CardNumber }, null, 100, System.Data.CommandType.Text);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
|
|||||||
{
|
{
|
||||||
public class MomOrderController : ApiController
|
public class MomOrderController : ApiController
|
||||||
{
|
{
|
||||||
[Obsolete]
|
|
||||||
[Route("api/MomOrder/List")]
|
[Route("api/MomOrder/List")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<Model.MOM.MomOrder> List()
|
public IEnumerable<Model.MOM.MomOrder> List()
|
||||||
@@ -34,5 +34,23 @@ namespace NX.ERP.WebAPi.Controllers.MOM
|
|||||||
return customerDAL.GetModel(Code);
|
return customerDAL.GetModel(Code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Route("api/ProductOrder/QueryOrders")]
|
||||||
|
[HttpPost]
|
||||||
|
public IEnumerable<Model.MOM.MomOrder> OrderQuery(NX.ERP.Model.Request.MomOrder momOrder)
|
||||||
|
{
|
||||||
|
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
|
||||||
|
return customerDAL.QueryOrders(momOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Route("api/ProductOrder/QueryDetails")]
|
||||||
|
[HttpPost]
|
||||||
|
public IEnumerable<Model.MOM.MomDetail> OrderDetails(NX.ERP.Model.Request.MomOrder momOrder)
|
||||||
|
{
|
||||||
|
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
|
||||||
|
return customerDAL.QueryDetails(momOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
|||||||
Reference in New Issue
Block a user