コード例 #1
0
        private static IList <string> CreateSerialBarcodes(string serialId, int count, Database db, DbTransaction trans)
        {
            var barcodes = new List <string>();

            var baseKey = IdentityCreatorRepository.Get(IdentityKey.GOODS_BARCODE, count);

            var sql = @"insert into goods_serial_barcodes(id,serial_id,barcode,is_printed,out) values(@p_id,@p_serial_id,@p_barcode,@p_is_printed,@p_out)";

            for (var i = 0; i < count; i++)
            {
                var barcode = StringHelper.Barcode(baseKey + i);
                barcodes.Add(barcode);

                var dc = db.GetSqlStringCommand(sql);
                db.AddInParameter(dc, "p_id", DbType.String, Guid.NewGuid().ToString());
                db.AddInParameter(dc, "p_serial_id", DbType.String, serialId);
                db.AddInParameter(dc, "p_barcode", DbType.String, barcode);
                db.AddInParameter(dc, "p_is_printed", DbType.Boolean, false);
                db.AddInParameter(dc, "p_out", DbType.Boolean, false);

                db.ExecuteNonQuery(dc, trans);
            }

            return(barcodes);
        }
コード例 #2
0
        public static IList <string> GetBarcodes(int count)
        {
            var barcodes = new List <string>();

            var baseKey = IdentityCreatorRepository.Get(IdentityKey.GOODS_BARCODE, count);

            for (var i = 0; i < count; i++)
            {
                barcodes.Add(FormatBarcode(baseKey + i));
            }

            return(barcodes);
        }
コード例 #3
0
        public static IList <string> Create(GoodsSerialEntity entity, Database db, DbTransaction trans)
        {
            var sql = @"insert into goods_serial(
id,serial_no,product_id,dispatched_count,batch_no,expired_date,
need_audit,need_check,need_split,split_copies,split_unit,split_capacity,split_package_count,valid_days,
hospital_id,vendor_id,is_closed,created_id,created_time,updated_id,updated_time)
values(
    @p_id,@p_serial_no,@p_product_id,@p_dispatched_count,@p_batch_no,@p_expired_date,
    @p_need_audit,@p_need_check,@p_need_split,@p_split_copies,@p_split_unit,@p_split_capacity,@p_split_package_count,@p_valid_days,
    @p_hospital_id,@p_vendor_id,@p_is_closed,@p_created_id,@p_created_time,@p_updated_id,@p_updated_time)";

            entity.Id       = Guid.NewGuid().ToString();
            entity.SerialNo = FormatSerialNo(IdentityCreatorRepository.Get(GetSerialKey(), 1));

            var cmd = db.GetSqlStringCommand(sql);

            db.AddInParameter(cmd, "p_id", DbType.String, entity.Id);
            db.AddInParameter(cmd, "p_serial_no", DbType.String, entity.SerialNo);
            db.AddInParameter(cmd, "p_product_id", DbType.String, entity.ProductId);
            db.AddInParameter(cmd, "p_dispatched_count", DbType.Int64, entity.DispatchedCount);
            db.AddInParameter(cmd, "p_hospital_id", DbType.String, entity.HospitalId);
            db.AddInParameter(cmd, "p_vendor_id", DbType.String, entity.VendorId);
            db.AddInParameter(cmd, "p_batch_no", DbType.String, entity.BatchNo);
            db.AddInParameter(cmd, "p_expired_date", DbType.DateTime, entity.ExpiredDate);

            db.AddInParameter(cmd, "p_need_audit", DbType.Boolean, entity.NeedAudit);
            db.AddInParameter(cmd, "p_need_check", DbType.Boolean, entity.NeedCheck);
            db.AddInParameter(cmd, "p_need_split", DbType.Boolean, entity.NeedSplit);
            db.AddInParameter(cmd, "p_split_copies", DbType.Int32, entity.SplitCopies);
            db.AddInParameter(cmd, "p_split_unit", DbType.String, entity.SplitUnit);
            db.AddInParameter(cmd, "p_split_capacity", DbType.String, entity.SplitCapacity);
            db.AddInParameter(cmd, "p_split_package_count", DbType.Int32, entity.SplitPackageCount);
            db.AddInParameter(cmd, "p_valid_days", DbType.Decimal, entity.ValidDays);

            db.AddInParameter(cmd, "p_is_closed", DbType.Boolean, entity.IsClosed);
            db.AddInParameter(cmd, "p_created_id", DbType.String, entity.CreatedId);
            db.AddInParameter(cmd, "p_created_time", DbType.DateTime, entity.CreatedTime);
            db.AddInParameter(cmd, "p_updated_id", DbType.String, entity.UpdatedId);
            db.AddInParameter(cmd, "p_updated_time", DbType.DateTime, entity.UpdatedTime);

            db.ExecuteNonQuery(cmd, trans);

            return(CreateSerialBarcodes(entity.Id, entity.DispatchedCount, db, trans));
        }
コード例 #4
0
        public static string GetBarcode()
        {
            var baseKey = IdentityCreatorRepository.Get(IdentityKey.GOODS_BARCODE, 1);

            return(FormatBarcode(baseKey));
        }