BOM 和MO 添加名称个物料规格

This commit is contained in:
gongxh
2021-06-04 14:48:56 +08:00
parent 43b9e3473a
commit cd8d10ddae
8 changed files with 36 additions and 28 deletions

View File

@@ -39,6 +39,10 @@ namespace NX.ERP.Model.Response.MOM
public int BomId { get; set; }
public string SortSeq { get; set; }
public string ComponentCode { get; set; }
public string ComponentName { get; set; }
public string ComponentSpecsModel { get; set; }
public decimal BaseQtyN { get; set; }
public decimal BaseQtyD { get; set; }
public int WipType { get; set; }
@@ -69,6 +73,10 @@ namespace NX.ERP.Model.Response.MOM
public int Status { get; set; }
public string ParentCode { get; set; }
public string ParentName { get; set; }
public string ParentSpecsModel { get; set; }
public ICollection<OptionComponent> OptionComponents { get => optionComponents; set => optionComponents = value; }
private ICollection<OptionComponent> optionComponents = new List<OptionComponent>();

View File

@@ -16,6 +16,11 @@ namespace NX.ERP.Model.MOM
public int AllocateId { get => id; set => id = value; }
public string MaterialCode { get => invCode; set => invCode = value; }
public string MaterialName { get; set; }
public string MaterialSpecsModel { get; set; }
public double Qty { get => qty; set => qty = value; }
public int ProductOrderId { get => modid; set => modid = value; }
//public string UnitCode { get; set; }

View File

@@ -26,6 +26,9 @@ namespace NX.ERP.Model.MOM
public string ProductName { get; set; }
public string ProductCode { get; set; }
public string ProductSpecsModel { get; set; }
[Newtonsoft.Json.JsonIgnore]
public string MDeptCode { get; set; }
//public string BatchNo { get; set; }

View File

@@ -18,8 +18,8 @@ namespace NX.ERP.U8.Mom
/// <returns></returns>
public IEnumerable<NX.ERP.Model.Response.MOM.Bom> GetList(string strWhere="", object Params = null)
{
var strSQL = @"select ISNULL(a.ModifyDate,CreateDate) ModifyDate,CONVERT(BIGINT,a.Ufts) AS pubufts,a.BomId,a.Version,a.Status, a.VersionDesc,a.BomType,c.InvCode as ParentCode ,' ' as id ,d.BomId, d.SortSeq,
e.InvCode as ComponentCode ,d.BaseQtyN, d.BaseQtyD ,f.WIPType,d.EffBegDate,d.EffEndDate from bom_bom as a
var strSQL = @"select ISNULL(a.ModifyDate,CreateDate) ModifyDate,CONVERT(BIGINT,a.Ufts) AS pubufts,a.BomId,a.Version,a.Status, a.VersionDesc,a.BomType,c.InvCode as ParentCode ,x.cInvName as ParentName ,x.cInvStd as ParentSpecsModel,' ' as id ,d.BomId, d.SortSeq,
e.InvCode as ComponentCode ,y.cInvName as ComponentName,y.cInvStd as ComponentSpecsModel ,d.BaseQtyN, d.BaseQtyD ,f.WIPType,d.EffBegDate,d.EffEndDate from bom_bom as a
left join bom_parent as b on a.BomId=b.BomId
left join bas_part as c on b.ParentId=c.PartId
left join Inventory as x on c.InvCode=x.cInvCode

View File

@@ -20,20 +20,21 @@ namespace NX.ERP.U8.Mom
{
using (var conn = U8LoginContext.Instance.Connection)
{
string strSQL = @"select
a.MoId as ProductOrderId,a.moCode as ProductOrderNo,ISNULL( ModifyDate,createDate) as ModifyDate,CONVERT(BIGINT,a.Ufts) AS pubufts,a.CreateDate as ProductDate,a.CreateUser as PreparedBy,
string strSQL = @" select a.MoId as ProductOrderId,a.moCode as ProductOrderNo,ISNULL( ModifyDate,createDate) as ModifyDate,CONVERT(BIGINT,a.Ufts) AS pubufts,a.CreateDate as ProductDate,a.CreateUser as PreparedBy,
b.MoId as id ,b.MoDId as ProductOrderDtlId,b.MoId as ProductOrderId,b.MoTypeId,d.DueDate,ISNULL( b.MDeptCode,'53') as MDeptCode,a.MoCode as ProductOrderNo,
a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty,b.SortSeq,b.SoCode,b.Status,
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,
a.CreateDate as ProductOrderDate,b.InvCode as ProductCode,b.Qty as Qty,b.SortSeq,b.SoCode,b.Status,InvDetail.cInvName as ProductName ,InvDetail.cInvStd ProductSpecsModel,
c.AllocateId as id ,c.AllocateId as AllocateId,c.MoDId as ProductOrderDtlId,c.InvCode as MaterialCode,InvLocate.cInvName as MaterialName,InvLocate.cInvStd as MaterialSpecsModel,b.MoId as ProductOrderId, c.IssQty as IssQty,c.Qty,
e.cInvSN as ID
from mom_order as a
left join mom_orderdetail as b on a.MoId=b.MoId
left join mom_morder as d on b.MoDId=d.MoDId
left join mom_SNDetail as e on b.MoDId=e.iVouchsID
left join mom_moallocate as c on b.MoDId=c.MoDId ";
left join mom_moallocate as c on b.MoDId=c.MoDId
left join Inventory as InvDetail on b.InvCode =InvDetail.cInvCode
left join Inventory as InvLocate on c.InvCode =InvLocate.cInvCode where b.Status<>'4' ";
if (!string.IsNullOrEmpty(strWhere))
{
strSQL += $" where {strWhere} ";
strSQL += $" and {strWhere} ";
}
var lookupDetail = new Dictionary<int, Model.MOM.MomDetail>();
var lookupOrder = new Dictionary<int, Model.MOM.MomOrder>();
@@ -98,7 +99,7 @@ namespace NX.ERP.U8.Mom
if (!string.IsNullOrEmpty(Params.ProductCode))
{
where.Add(" a.InvCode like @ProductCode");
where.Add(" b.InvCode like @ProductCode");
}
if (!string.IsNullOrEmpty(Params.ProductOrderNo))
{
@@ -111,7 +112,7 @@ namespace NX.ERP.U8.Mom
if (Params.ModifyDate != null)
{
where.Add(" ISNULL( a.ModifyDate,createDate) >= @ModifyDate or a.RelsTime>=@ModifyDate ");
where.Add(" ISNULL( b.ModifyDate,createDate) >= @ModifyDate or b.RelsTime>=@ModifyDate ");
}

View File

@@ -86,7 +86,7 @@ left join (SELECT cinvcode, STUFF(( SELECT ','+ cPosName FROM ( select b.cPosNam
}
var lookup = new Dictionary<int, Model.Purchase.Arrival>();
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
var list = conn.Query<Model.Purchase.Arrival, Model.Purchase.ArrivalDetail, Model.Purchase.Arrival>(strSQL, (arrival, ArrivalDetail) =>
{
if (!lookup.TryGetValue(arrival.ArrivalId, out var _arrival))
@@ -125,12 +125,9 @@ left join (SELECT cinvcode, STUFF(( SELECT ','+ cPosName FROM ( select b.cPosNam
public Model.Purchase.Arrival GetModel(int id)
{
List<string> where = new List<string>();
where.Add("a.id=@Id");
return this.GetList(where, new { id }).FirstOrDefault();
return this.GetList("a.id=@Id", new { id }).FirstOrDefault();
}
@@ -158,21 +155,17 @@ left join (SELECT cinvcode, STUFF(( SELECT ','+ cPosName FROM ( select b.cPosNam
public IEnumerable<Model.Purchase.Arrival> GetListByLastId(int Id)
{
List<string> where = new List<string>();
where.Add(" a.id>=@Id ");
return this.GetList(where, new { Id });
return this.GetList("a.id>=@Id", new { Id });
}
public Model.Purchase.Arrival GetModel(string Code)
{
List<string> where = new List<string>();
where.Add(" a.cCode=@Code ");
return this.GetList(where, new { Code }).FirstOrDefault();
return this.GetList("a.cCode=@Code", new { Code }).FirstOrDefault();
}

View File

@@ -22,7 +22,6 @@ namespace NX.ERP.U8.Sale
using (var conn = U8LoginContext.Instance.Connection)
{
var lookup = new Dictionary<int, Model.Sale.DispatchList>();
// return conn.Query<Model.Purchase.Arrival>(strSQL,null);
var list = conn.Query<NX.ERP.Model.Sale.DispatchList, NX.ERP.Model.Sale.DispatchListDetail, NX.ERP.Model.Sale.DispatchList>(strSql, (Dispatch, DispatchDetail) =>
{
if (!lookup.TryGetValue(Dispatch.SalesOrderId, out var _Dispatch))
@@ -33,7 +32,6 @@ namespace NX.ERP.U8.Sale
{
Dispatch = _Dispatch;
}
Dispatch.SalesOrderDtlLst.Add(DispatchDetail);
return Dispatch;
}, Params, null, true, "id", 10, System.Data.CommandType.Text);

View File

@@ -49,7 +49,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
[Route("api/ProductOrder/QueryOrders")]
[HttpPost]
public IEnumerable<Model.MOM.MomOrder> OrderQuery(NX.ERP.Model.Request.MomOrder momOrder)
public IEnumerable<Model.MOM.MomOrder> OrderQuery(Model.Request.MomOrder momOrder)
{
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.QueryOrders(momOrder);
@@ -57,7 +57,7 @@ namespace NX.ERP.WebAPi.Controllers.MOM
[Route("api/ProductOrder/QueryDetails")]
[HttpPost]
public IEnumerable<Model.MOM.MomDetail> OrderDetails(NX.ERP.Model.Request.MomOrder momOrder)
public IEnumerable<Model.MOM.MomDetail> OrderDetails(Model.Request.MomOrder momOrder)
{
var customerDAL = new NX.ERP.U8.Mom.MomOrderDAL();
return customerDAL.QueryDetails(momOrder);