Files
U8-Import/NX.ERP.BLL/Store/SotreIn.cs
2021-01-21 13:42:23 +08:00

93 lines
3.2 KiB
C#

using NX.ERP.BLL.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NX.ERP.BLL.Store
{
public class SotreIn
{
public StoreResult AddVoucher(Model.Inbound inbound)
{
var deptCode = "52";
string ID = "";
if (inbound.InboundType == Model.InboundType.productIn)
{
var dal = new NX.ERP.U8.Store.PuStoreInDAL();
ID = dal.AddVocher(new ERP.Model.Request.PuStoreIn()
{
Date = inbound.InboundDate,
Source = inbound.SourceName,
SourceCode = inbound.SourceNo,
Whcode = inbound.WarehouseCode,
Deptcode = deptCode,
Maker = inbound.Maker,
Details = inbound.InboundDtlLst.ToList().ConvertAll(m =>
{
return new ERP.Model.Request.PuStoreInDetail()
{
Invcode = m.MaterialCode,
SorceDetailId = m.SourceDtlId,
Position = m.BinCode,
Quantity = m.Qty
};
})
});
}
if (inbound.InboundType == Model.InboundType.PurchaseIn)
{
var dal = new NX.ERP.U8.Store.ProductInDAL();
ID = dal.AddVoucher(new ERP.Model.Request.ProductStoreIn()
{
Date = inbound.InboundDate,
Source = inbound.SourceName,
SourceCode = inbound.SourceNo,
WhCode = inbound.WarehouseCode,
Deptcode = deptCode,
Maker = inbound.Maker,
Details = inbound.InboundDtlLst.ToList().ConvertAll(m =>
{
return new ERP.Model.Request.ProductStoreInDetail()
{
Batch = "",
InvCode = m.MaterialCode,
SourceDetailId = m.SourceDtlId,
Position = m.BinCode,
Quantity = m.Qty
};
})
});
}
if (inbound.InboundType == Model.InboundType.OtherIn)
{
var dal = new NX.ERP.U8.Store.OtherStoreInDAL();
ID = dal.AddVocher(new ERP.Model.Request.OtherStoreInOut()
{
Date = inbound.InboundDate,
WhCode = inbound.WarehouseCode,
Maker = inbound.Maker,
details = inbound.InboundDtlLst.ToList().ConvertAll(m =>
{
return new ERP.Model.Request.OtherStoreInOutDetail()
{
InvCode = m.MaterialCode,
Position = m.BinCode,
Quantity = m.Qty
};
})
});
}
return new StoreResult() { ID = int.Parse( ID) };
}
}
}