private static string CreateGoodsSerial(GoodsSerialEntity parent, ReceiveFormItemEntity formItem, IList <string> barcodes, Database db, DbTransaction trans) { var goodsSerial = GoodsSerialRepository.CreateSub(parent, barcodes, formItem.ConfirmedId, db, trans); GoodsSerialFormRepository.Create(new GoodsSerialFormEntity { SerialId = goodsSerial.Id, FormId = formItem.Id, FormKind = FormKind.ReceiveItem, CreatedId = formItem.ConfirmedId, CreatedTime = formItem.ConfirmedTime, }, db, trans); return(goodsSerial.Id); }
private static string DispatchGoods(DispatchFormEntity form, DispatchFormItemEntity formItem, Database db, DbTransaction trans) { var orderDetail = OrderFormRepository.GetItem(form.OrderDetailId); var goodsSerial = new GoodsSerialEntity { ProductId = form.ProductId, DispatchedCount = formItem.Count, HospitalId = form.HospitalId, VendorId = form.VendorId, NeedAudit = orderDetail.NeedAudit, NeedCheck = orderDetail.NeedCheck, NeedSplit = orderDetail.NeedSplit, SplitCopies = orderDetail.SplitCopies, SplitUnit = orderDetail.SplitUnit, SplitCapacity = orderDetail.SplitCapacity, SplitPackageCount = orderDetail.SplitPackageCount, ValidDays = orderDetail.ValidDays, BatchNo = formItem.BatchNo, ExpiredDate = formItem.ExpiredDate, IsClosed = false, CreatedId = form.CreatedId, CreatedTime = DateTime.Now, UpdatedId = form.CreatedId, UpdatedTime = DateTime.Now }; GoodsSerialRepository.Create(goodsSerial, db, trans); GoodsSerialFormRepository.Create(new GoodsSerialFormEntity { SerialId = goodsSerial.Id, FormId = form.Id, FormKind = FormKind.DispatchItem, CreatedId = form.CreatedId, CreatedTime = DateTime.Now, }, new GoodsSerialFormEntity { SerialId = goodsSerial.Id, FormId = form.OrderDetailId, FormKind = FormKind.OrderDetail, CreatedId = form.CreatedId, CreatedTime = DateTime.Now, }, db, trans); return(goodsSerial.Id); }