123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Common.TeachingMaterial;
- using EMIS.ViewModel.TeachingMaterial;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel;
- using EMIS.Entities;
- using EMIS.DataLogic.Repositories;
- using EMIS.DataLogic.UniversityManage.TeacherManage;
- using System.Linq.Expressions;
- using System.Web;
- using Bowin.Common.Linq;
- using EMIS.CommonLogic.SystemServices;
- using System.Text.RegularExpressions;
- namespace EMIS.CommonLogic.TeachingMaterial
- {
- public class StockOutServices : BaseServices, IStockOutServices
- {
- public TeachersOrderRepository TeachersOrderRepository { get; set; }
- public StockOutRepository StockOutRepository { get; set; }
- public StockOutDetailRepository StockOutDetailRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public Lazy<StaffDAL> staffDAL { get; set; }
- public TeachingMaterialPoolRepository TeachingMaterialPoolRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public PublishRepository PublishRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public TeachingMateriaInventoryRepository TeachingMateriaInventoryRepository { get; set; }
- public StockOutDAL StockOutDAL { get; set; }
- public StockOutDetailDAL StockOutDetailDAL { get; set; }
- public Lazy<IParameterServices> ParameterServices { get; set; }
- public Lazy<ISerialNumberServices> SerialNumberServices { get; set; }
- #region 1.0 查询出库信息
- public IGridResultSet<StockOutView> GetStockOutViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, IList<int> stockOutTypeList, Guid? supplierID, DateTime? stockOutTimeStart, DateTime? stockOutTimeEnd, int pageIndex, int pageSize)
- {
- if (stockOutTimeStart == null)
- {
- stockOutTimeStart = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
- }
- var query = StockOutDAL.GetStockOutGridView(x => stockOutTypeList.Contains(x.StockOutType));
- if (schoolyearID.HasValue)
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- if (supplierID.HasValue)
- query = query.Where(x => x.SupplierID == supplierID);
- if (stockOutTimeStart.HasValue)
- query = query.Where(x => x.StockOutTime >= stockOutTimeStart);
- if (stockOutTimeEnd.HasValue)
- {
- DateTime newStockOutTimeEnd = stockOutTimeEnd.Value.AddDays(1);//取起止日期一天、
- query = query.Where(x => x.StockOutTime <= newStockOutTimeEnd);
- }
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderByDescending(x => x.StockOutTime).ToGridResultSet<StockOutView>(pageIndex, pageSize);
- return query.OrderBy(x => x.SchoolyearName).OrderBy(x => x.StockOutNo).OrderByDescending(x => x.StockOutTime).ToGridResultSet<StockOutView>(pageIndex, pageSize);
- }
- #endregion
- #region 2.0 查询出库Excel导出信息
- //查询并导出
- public IList<StockOutView> GetStockOutViewList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, IList<int> stockOutTypeList, Guid? supplierID, DateTime? stockOutTimeStart, DateTime? stockOutTimeEnd)
- {
- DateTime newStockOutTimeEnd = stockOutTimeEnd.Value.AddDays(1);//取起止日期一天、
- var query = StockOutDAL.GetStockOutGridView(x => stockOutTypeList.Contains(x.StockOutType));
- if (schoolyearID.HasValue)
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- if (supplierID.HasValue)
- query = query.Where(x => x.SupplierID == supplierID);
- if (stockOutTimeStart.HasValue)
- query = query.Where(x => x.StockOutTime >= stockOutTimeStart);
- if (stockOutTimeEnd.HasValue)
- query = query.Where(x => x.StockOutTime <= newStockOutTimeEnd);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.StockOutTime).ToList();
- return query.OrderBy(x => x.StockOutTime).ToList();
- }
- #endregion
- #region 3.0 删除出库信息
- //删除出库信息
- public void Delete(List<Guid> stockOutIDs)
- {
- try
- {
- bool? IsOrdered = false;//是否包含出库信息!
- var stockOutList = StockOutRepository.GetList(x => stockOutIDs.Contains(x.StockOutID)).ToList();
- foreach (var stockOut in stockOutList)
- {
- if (stockOut.RecordStatus == (int)SYS_STATUS.USABLE)
- {
- throw new Exception("选择的信息已出库,无法删除。");
- }
- }
- if (stockOutIDs.Count > 0)
- {
- //删除入库数据、及该单号下挂钩的明细数据
- StockOutDetailRepository.UnitOfWork.Delete<ET_StockOutDetail>(x => stockOutIDs.Contains(x.StockOutID));
- StockOutRepository.UnitOfWork.Delete<ET_StockOut>(x => stockOutIDs.Contains(x.StockOutID));
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- #region 4.0 根据ID、获取出库编辑信息
- public StockOutView GetSingleStockOut(Guid stockOutID)
- {
- return StockOutDAL.GetSingleStockOut(stockOutID);
- }
- #endregion
- #region 5.0 检查编号唯一
- //验证出库单据号是否存在
- public bool IsExistStockOutNo(string stockOutNo)
- {
- return StockOutDAL.IsExistStockOutNo(stockOutNo);
- }
- #endregion
- #region 6.0 出库信息保存
- //注:折合价=单价*折扣率、码洋=单价*数量、总价(实洋)=折合价*数量(码洋*折扣率、单价*折扣率*数量)
- public void Save(StockOutView stockOutView, IList<TeachingMaterialPoolView> tmList, Guid? userId, string type)
- {
- //var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;//提取当前用户信息
- //Expression<Func<CF_Staff, bool>> exp = (x => true);
- //if (curUser.CollegeID.HasValue)
- //{
- // exp = exp.And(x => x.CollegeID == curUser.CollegeID);
- //}
- //var staffInfo =staffDAL.Value.GetStaffViewQueryable(exp);//所选用户对应院系的所有老师、
- if (this.StockOutRepository.GetList(x => x.StockOutNo == stockOutView.StockOutNo
- && x.StockOutID != stockOutView.StockOutID).Count() > 0)
- {
- throw new Exception("出库单号已经存在,请重新输入!");
- }
- int RecordStatusType = (int)CF_GeneralPurpose.IsNo;
- Guid? GetBookUserId = stockOutView.RecipientUserID;
- if ((int)stockOutView.StockOutTypeID == (int)CF_StockOutType.TeachingMaterialRetail)
- {
- GetBookUserId = Guid.Empty;//如果是教材零售
- }
- if (type == "Submit")//如果是Save 那么状态默认为0、 如果是Submit 那么状态默认1
- {
- RecordStatusType = (int)CF_GeneralPurpose.IsYes;
- }
- ET_StockOut stockOutEntity = GetStockOut(stockOutView.StockOutID);
- if (stockOutEntity != null)//更新数据
- {
- stockOutEntity.SchoolyearID = (Guid)stockOutView.SchoolyearID;
- stockOutEntity.StockOutNo = stockOutView.StockOutNo;
- stockOutEntity.StockOutType = (int)stockOutView.StockOutTypeID;
- stockOutEntity.Desc = stockOutView.Desc;
- stockOutEntity.RecipientUserID = GetBookUserId;
- stockOutEntity.StockOutTime = stockOutView.StockOutTime;
- stockOutView.RecordStatus = RecordStatusType;
- stockOutEntity.GetBookNo = stockOutView.GetBookNo;
- StockOutRepository.UnitOfWork.Update(stockOutEntity);
- //StockOutRepository.UnitOfWork.Commit();//更新数据
- //删除出库明细数据、重新插入一次
- StockOutDetailRepository.UnitOfWork.Delete<ET_StockOutDetail>(x => x.StockOutID == stockOutView.StockOutID);
- //对数据进行分组、单价、教材ID一致、数量累加
- GetTMPList(tmList, userId, stockOutView.StockOutID);
- }
- else
- {
- ET_StockOut stockOut = new ET_StockOut()
- {
- StockOutID = Guid.NewGuid(),
- Desc = stockOutView.Desc,
- StockOutType = (int)stockOutView.StockOutTypeID,
- CreateTime = DateTime.Now,
- CreateUserID = userId,
- SchoolyearID = (Guid)stockOutView.SchoolyearID,
- ModifyTime = DateTime.Now,
- ModifyUserID = userId,
- RecordStatus = RecordStatusType,
- GetBookNo = stockOutView.GetBookNo,
- RecipientUserID = GetBookUserId == Guid.Empty ? userId : GetBookUserId,
- StockOutTime = stockOutView.StockOutTime,
- OutNumber = stockOutView.OutNumber,
- StockOutNo = stockOutView.StockOutNo
- };
- StockOutRepository.UnitOfWork.Add(stockOut);//添加出库信息
- UnitOfWork.Commit();
- GetTMPList(tmList, userId, stockOut.StockOutID);
- // UnitOfWork.BulkInsert(tpList);//统一写入
- }
- }
- #endregion
- #region 7.0 获取出库的教材信息
- public IList<TeachingMaterialPoolView> GetStockOutByTMViewList(Guid stockOutID)
- {
- return StockOutDAL.GetTeachingMaterialView(stockOutID);
- }
- #endregion
- #region 8.0 提交出库单
- //提交出库单
- public void Submit(List<Guid> stockOutIDs, Guid userId)
- {
- try
- {
- if (stockOutIDs.Count > 0)
- {
- IList<ET_StockOut> stockOutList = StockOutRepository.GetList(x => stockOutIDs.Contains(x.StockOutID), (x => x.ET_StockOutDetail)).ToList();
- foreach (var stockOutEntity in stockOutList)
- {
- if (stockOutEntity.RecordStatus == (int)CF_GeneralPurpose.IsYes)
- {
- throw new Exception("选择的信息已提交,无法重复提交。");
- }
- }
- foreach (var stockOutEntity in stockOutList)
- {
- stockOutEntity.RecordStatus = (int)CF_GeneralPurpose.IsYes;
- stockOutEntity.ModifyUserID = userId;
- StockOutRepository.UnitOfWork.Update(stockOutEntity);
- // StockOutRepository.UnitOfWork.Commit();
- IList<ET_StockOutDetail> stockOutDetailList = stockOutEntity.ET_StockOutDetail.ToList();
- //1.0 提取当前库存量、
- foreach (var stockOutDetailEntity in stockOutDetailList)
- {
- int? stockOutQuantity = stockOutDetailEntity.StockOutQuantity;
- List<ET_TeachingMateriaInventory> teachingMateriaInventorylist = GetTeachingMateriaInventory(stockOutDetailEntity.TeachingMaterialPoolID, stockOutDetailEntity.Discount).OrderBy(x => x.CreateTime).ToList();
- int count = 0;
- int Inventorysum = 0;
- int needQuantity = (int)stockOutQuantity;
- int oldInventory = 0;
- if (teachingMateriaInventorylist.Count > 0)
- {
- foreach (ET_TeachingMateriaInventory teachingMateriaInventory in teachingMateriaInventorylist)
- {
- Inventorysum = Inventorysum + (teachingMateriaInventory.PresentInventory ?? 0);
- count++;
- if (Inventorysum >= stockOutQuantity)
- {
- if (count == 1)
- {
- teachingMateriaInventory.PresentInventory = teachingMateriaInventory.PresentInventory - stockOutQuantity;
- teachingMateriaInventory.ModifyTime = DateTime.Now;
- TeachingMateriaInventoryRepository.UnitOfWork.Update(teachingMateriaInventory);//更新库存数量
- break;
- }
- else
- {
- for (int i = 0; i < count; i++)
- {
-
- var view = teachingMateriaInventorylist[i];
- oldInventory = (int)view.PresentInventory;
- view.PresentInventory = (view.PresentInventory - needQuantity) <= 0 ? 0 : (view.PresentInventory - needQuantity);
- view.ModifyTime = DateTime.Now;
- TeachingMateriaInventoryRepository.UnitOfWork.Update(view);//更新库存数量
- if (oldInventory - needQuantity <= 0)
- {
- needQuantity = needQuantity - oldInventory;
- }
- }
- break;
- }
- }
-
- }
- }
- if (Inventorysum < stockOutQuantity)
- {
- throw new Exception("出库数量大于当前库存量!");
- }
- }
- //BalanceInventory(stockInDetailList, userId);//提交平衡库存
- }
- }
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- #region 9.0 查询出库明细列表
- //出库明细列表
- public IGridResultSet<StockOutView> GetStockOutDetailViewGrid(Guid? stockOutId, int pageIndex, int pageSize)
- {
- var query = StockOutDetailDAL.GetStockOutDetailGridView(x => x.StockOutID == stockOutId);
- return query.OrderBy(x => x.StockOutTime).ToGridResultSet<StockOutView>(pageIndex, pageSize);
- }
- #endregion
- #region 10. 出库明细列表导出Excel
- //出库明细Excel导出
- public IList<StockOutView> GetStockOutDetailViewList(Guid? stockOutId)
- {
- var query = StockOutDetailDAL.GetStockOutDetailGridView(x => x.StockOutID == stockOutId);
- return query.OrderBy(x => x.StockOutTime).ToList();
- }
- #endregion
- #region 11. 获取教材信息
- public IGridResultSet<TeachingMaterialPoolView> GetStockInByTeachingMaterialPoolViewGrid(ViewModel.ConfiguretView configuretView, bool? isLate, Guid? teachingMaterialPoolID, Guid? coursematerialID, bool isSelectMax, int pageIndex, int pageSize)
- {
- Expression<Func<CF_TeachingMaterialPool, bool>> exp = (x => true);
- if (teachingMaterialPoolID.HasValue)
- {
- exp = exp.And(x => x.TeachingMaterialPoolID == teachingMaterialPoolID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- }
- var query = StockOutDAL.GetTeachersOrderByTeachingMaterial(exp);
- //if (isLate.HasValue)
- //{
- // query = query.Where(x => x.IsLate == isLate);
- //}
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<TeachingMaterialPoolView>(pageIndex, pageSize);
- var result = query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<TeachingMaterialPoolView>(pageIndex, pageSize);
- if (isSelectMax)
- {
- result.rows.ForEach(x => x.OrderQty = x.PresentInventory);
- }
- return result;
- }
- #endregion
- public IGridResultSet<TeachingMaterialPoolView> GetTeachingMaterialViewForRefundGrid(ViewModel.ConfiguretView configuretView, bool? isLate, Guid? teachingMaterialPoolID, Guid? coursematerialID, bool isSelectMax, int pageIndex, int pageSize)
- {
- Expression<Func<CF_TeachingMaterialPool, bool>> exp = (x => true);
- if (teachingMaterialPoolID.HasValue)
- {
- exp = exp.And(x => x.TeachingMaterialPoolID == teachingMaterialPoolID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- }
- //if (isLate.HasValue)
- //{
- // exp = exp.And(x => x.IsLate == isLate);
- //}
- var query = StockOutDAL.GetTeachersOrderByTeachingMaterial(exp);
- //if (isLate.HasValue)
- //{
- // query = query.Where(x => x.IsLate == isLate);
- //}
- query = query.Where(x => x.PresentInventory > 0);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<TeachingMaterialPoolView>(pageIndex, pageSize);
- var result = query.OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<TeachingMaterialPoolView>(pageIndex, pageSize);
- if (isSelectMax)
- {
- result.rows.ForEach(x => x.OrderQty = x.PresentInventory);
- }
- return result;
- }
- #region 13.0 平衡教材库存数量(适用与出库、入库)
- //public void BalanceInventory(IList<ET_StockOutDetail> stockOutDetailList, Guid userId)
- //{
- // //1.0 提取当前库存量、
- // foreach (var stockOutDetailEntity in stockOutDetailList)
- // {
- // int? stockOutQuantity = stockOutDetailEntity.StockOutQuantity;
- // ET_TeachingMateriaInventory teachingMateriaInventoryEntity = GetTeachingMateriaInventory(stockOutDetailEntity.TeachingMaterialPoolID, stockOutDetailEntity.Discount);
- // if (teachingMateriaInventoryEntity != null)
- // {
- // if (teachingMateriaInventoryEntity.PresentInventory <= 0)
- // {
- // throw new Exception("该教材库存量为0,不能进行出库!");
- // }
- // if (teachingMateriaInventoryEntity.PresentInventory < stockOutQuantity)
- // {
- // throw new Exception("出库数量大于当前库存量!");
- // }
- // //2.0 当前库存量+入库数量 当前库存量-出库数量
- // teachingMateriaInventoryEntity.PresentInventory = teachingMateriaInventoryEntity.PresentInventory - stockOutQuantity;
- // teachingMateriaInventoryEntity.ModifyTime = DateTime.Now;
- // TeachingMateriaInventoryRepository.UnitOfWork.Update(teachingMateriaInventoryEntity);//更新库存数量
- // }
- // }
- // UnitOfWork.Commit();
- //}
- #endregion
- #region 14.0 教材分组
- public void GetTMPList(IList<TeachingMaterialPoolView> tmList, Guid? userId, Guid? stockOutID)
- {
- //对数据进行分组、单价、教材ID一致、数量累加
- var tmListGroupBy = (from tm in tmList
- group new { tm } by new
- {
- tm.TeachingMaterialPoolID,
- tm.TeachingMaterialCode,
- tm.TeachingMaterialName,
- tm.ISBN,
- tm.PublishTime,
- tm.PublishName,
- tm.Author,
- tm.Price,
- tm.Discount,
- tm.DiscountPrice
- } into h
- select new TeachingMaterialPoolView
- {
- TeachingMaterialPoolID = h.Key.TeachingMaterialPoolID,
- TeachingMaterialCode = h.Key.TeachingMaterialCode,
- TeachingMaterialName = h.Key.TeachingMaterialName,
- ISBN = h.Key.ISBN,
- PublishTime = h.Key.PublishTime,
- PublishName = h.Key.PublishName,
- Author = h.Key.Author,
- Price = h.Key.Price,
- Discount = h.Key.Discount,
- DiscountPrice = h.Key.DiscountPrice,
- OrderQty = h.Sum(x => x.tm.OrderQty)
- }).ToList();
- List<ET_StockOutDetail> stockOutDetailList = new List<ET_StockOutDetail>();
- foreach (var item in tmListGroupBy)
- {
- ET_StockOutDetail stockOutDetail = new ET_StockOutDetail()
- {
- CreateTime = DateTime.Now,
- CreateUserID = userId,
- DiscountPrice = item.Discount,//折扣率
- Discount = item.DiscountPrice,//折合价
- ModifyTime = DateTime.Now,
- ModifyUserID = userId,
- RecordStatus = 1,
- StockOutDetailID = Guid.NewGuid(),
- StockOutID = (Guid)stockOutID,
- StockOutQuantity = item.OrderQty,
- TeachingMaterialPoolID = item.TeachingMaterialPoolID
- };
- this.UnitOfWork.Add(stockOutDetail);
- }
- UnitOfWork.Commit();
- }
- #endregion
- #region 15.0 检查库存
- //验证出库单据号是否存在
- public bool CheckInventoryQty(int qty, Guid teachingMaterialPoolID)
- {
- return StockOutDAL.CheckInventoryQty(qty, teachingMaterialPoolID);
- }
- #endregion
- public ET_StockOut GetStockOut(Guid? stockOutID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<ET_StockOut, bool>> expression =
- (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expression = (x => x.StockOutID == stockOutID);
- return StockOutDAL.StockOutRepository.GetSingle(expression);
- }
- public ET_StockOutDetail GetStockOutDetail(Guid? stockOutDetailID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<ET_StockOutDetail, bool>> expression =
- (x => true);
- expression = (x => x.StockOutDetailID == stockOutDetailID);
- return StockOutDAL.StockOutDetailRepository.GetSingle(expression);
- }
- public List<ET_TeachingMateriaInventory> GetTeachingMateriaInventory(Guid? teachingMaterialPoolID, decimal? price)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<ET_TeachingMateriaInventory, bool>> expression =
- (x => true);
- expression = (x => x.TeachingMaterialPoolID == teachingMaterialPoolID && x.PresentInventory > 0);//出库不按折合价去扣减库存量
- return StockOutDAL.TeachingMateriaInventoryRepository.GetList(expression,(x => x.CF_TeachingMaterialPool)).ToList();
- }
- public string GetStockOutNo(CF_StockOutType stockOutType)
- {
- string prefix = "";
- DateTime nowTime = DateTime.Now;
- switch (stockOutType)
- {
- case CF_StockOutType.StudentBook:
- prefix = ParameterServices.Value.GetParameterValue(CF_ParameterType.StudentMaterialStockOutPrifix);
- break;
- case CF_StockOutType.TeacherBook:
- prefix = ParameterServices.Value.GetParameterValue(CF_ParameterType.TeacherMaterialStockOutPrifix);
- break;
- case CF_StockOutType.StudentPutOut:
- prefix = ParameterServices.Value.GetParameterValue(CF_ParameterType.DistributeMaterialStockOutPrifix);
- break;
- case CF_StockOutType.TeacherPutOut:
- prefix = ParameterServices.Value.GetParameterValue(CF_ParameterType.TeacherDistributeMaterialStockOutPrifix);
- break;
- case CF_StockOutType.TeachingMaterialRetail:
- prefix = ParameterServices.Value.GetParameterValue(CF_ParameterType.MaterialSaleStockOutPrifix);
- break;
- case CF_StockOutType.Refund:
- prefix = ParameterServices.Value.GetParameterValue(CF_ParameterType.MaterialRefundStockOutPrifix);
- break;
- }
- var matchFormatterList = Regex.Matches(prefix, @"\{[\S]*\}");
- for (int i = 0; i < matchFormatterList.Count; i++)
- {
- var formatter = matchFormatterList[i].Value.TrimStart('{').TrimEnd('}');
- var dateString = nowTime.ToString(formatter);
- prefix = prefix.Replace(matchFormatterList[i].Value, dateString);
- }
- string stockOutNo = SerialNumberServices.Value.SetSN(prefix, 4);
- return stockOutNo;
- }
- }
- }
|