Esempio n. 1
0
        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);
        }
Esempio n. 3
0
        internal static void Create(IncomingFormEntity entity, Database db, DbTransaction trans)
        {
            var sql = @"insert into incoming_form
(
id,order_id,order_form_no,order_detail_id,apply_unit_id,serial_id,product_id,incoming_count,
hospital_id,vendor_id,is_confirmed,created_id,created_time
)
values(
@p_id,@p_order_id,@p_order_form_no,@p_order_detail_id,@p_apply_unit_id,@p_serial_id,@p_product_id,@p_incoming_count,
@p_hospital_id,@p_vendor_id,@p_is_confirmed,@p_created_id,@p_created_time
)";

            entity.Id = Guid.NewGuid().ToString();

            var dc = db.GetSqlStringCommand(sql);

            db.AddInParameter(dc, "p_id", DbType.String, entity.Id);
            db.AddInParameter(dc, "p_order_id", DbType.String, entity.OrderId);
            db.AddInParameter(dc, "p_order_form_no", DbType.Int32, entity.OrderFormNo);
            db.AddInParameter(dc, "p_order_detail_id", DbType.String, entity.OrderDetailId);
            db.AddInParameter(dc, "p_apply_unit_id", DbType.String, entity.ApplyUnitId);
            db.AddInParameter(dc, "p_serial_id", DbType.String, entity.SerialId);
            db.AddInParameter(dc, "p_product_id", DbType.String, entity.ProductId);
            db.AddInParameter(dc, "p_incoming_count", DbType.Int32, entity.IncomingCount);
            db.AddInParameter(dc, "p_hospital_id", DbType.String, entity.HospitalId);
            db.AddInParameter(dc, "p_vendor_id", DbType.String, entity.VendorId);
            db.AddInParameter(dc, "p_is_confirmed", DbType.Boolean, entity.IsConfirmed);
            db.AddInParameter(dc, "p_created_id", DbType.String, entity.CreatedId);
            db.AddInParameter(dc, "p_created_time", DbType.DateTime, entity.CreatedTime);

            db.ExecuteNonQuery(dc, trans);

            GoodsSerialFormRepository.FlowNextForm(new GoodsSerialFormEntity
            {
                SerialId    = entity.SerialId,
                FormId      = entity.Id,
                FormKind    = FormKind.Incoming,
                CreatedId   = entity.CreatedId,
                CreatedTime = entity.CreatedTime
            }, db, trans);
        }