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.PurchaseIn) { var dal = new NX.ERP.U8.Store.PuStoreInDAL(); ID = dal.SaveVoucher(new ERP.Model.Request.PuStoreIn() { Id = inbound.Id, Code = inbound.InboundNo, 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.productIn) { var dal = new NX.ERP.U8.Store.ProductInDAL(); ID = dal.SaveVoucher(new ERP.Model.Request.ProductStoreIn() { Id = inbound.Id, Code = inbound.InboundNo, 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.SaveVoucher(new ERP.Model.Request.OtherStoreInOut() { Id = inbound.Id, Code = inbound.InboundNo, 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) }; } } }