Files
U8-Import/NX.ERP.BLL/Store/SotreOut.cs
2021-03-16 09:27:13 +08:00

96 lines
3.3 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 SotreOut
{
public StoreResult AddVoucher(Model.OutBound outBound)
{
string ID = "";
if (outBound.OutboundType == Model.OutBoundType.MaterialOut)
{
var dal = new U8.Store.MaterialStoreOutDAL();
ID = dal.SaveVoucher(new ERP.Model.Request.MaterialStoreOut()
{
Id = outBound.OutboundId,
Code = outBound.OutboundNo,
Date = outBound.OutboundDate,
Maker = outBound.Maker,
Source = outBound.SourceName,
SourceCode = outBound.SourceNo,
Whcode = outBound.WarehouseCode,
Details = outBound.OutboundDtlLst.ConvertAll(m =>
{
return new ERP.Model.Request.MaterialStoreOutDetail()
{
InvCode = m.MaterialCode,
Position = m.BinCode,
Quantity = m.Qty,
SorceDetailId = m.SourceDtlId
};
})
});
}
if (outBound.OutboundType == Model.OutBoundType.SaleOut)
{
var dal = new U8.Store.SaleOutDAL();
ID = dal.SaveVoucher(new ERP.Model.Request.SaleStoreOut()
{
Id = outBound.OutboundId,
Code = outBound.OutboundNo,
Date = outBound.OutboundDate,
WhCode = outBound.WarehouseCode,
Source = outBound.SourceName,
SourceCode = outBound.SourceNo,
Maker = outBound.Maker,
Details = outBound.OutboundDtlLst.ConvertAll(m =>
{
return new ERP.Model.Request.SaleStoreOutDetail()
{
InvCode = m.MaterialCode,
Position = m.BinCode,
Quantity = m.Qty,
SourceDetailId = m.SourceDtlId
};
})
});
}
if (outBound.OutboundType == Model.OutBoundType.OtherOut)
{
var dal = new U8.Store.OtherStoreOutDAL();
ID = dal.SaveVoucher(new ERP.Model.Request.OtherStoreInOut()
{
Date = outBound.OutboundDate,
WhCode = outBound.WarehouseCode,
Id = outBound.OutboundId,
Code = outBound.OutboundNo,
Maker = outBound.Maker,
details = outBound.OutboundDtlLst.ConvertAll(m =>
{
return new ERP.Model.Request.OtherStoreInOutDetail()
{
InvCode = m.MaterialCode,
Position = m.BinCode,
Quantity = m.Qty,
};
})
});
}
return new StoreResult() { ID = int.Parse(ID) };
}
}
}