/// <summary> /// 单据号生成算法 /// </summary> /// <param name="billIdentity"></param> /// <returns></returns> public string GenerateNewCode(BillIdentity billIdentity) { // 生成一个新的 Code 序列号 var billId = ((int)billIdentity).ToString(); billId = billId.Substring(0, 2); var codeSequence = new BillSequence(); _db.Insert <BillSequence>(codeSequence); _db.SaveChange(); codeSequence = _db.Table.Find <BillSequence>(n => n.GuidCode == codeSequence.GuidCode); var sequenceId = codeSequence.Id > 99999999 ? codeSequence.Id.ToString() : codeSequence.Id.ToString().PadLeft(8, '0'); return(billId + sequenceId); }
public StoreInventoryHistory(int productId, int storeId, int quantity, int changeQuantity, decimal price, long batchNo, int billId, string billCode, BillIdentity billType, int createdBy, int supplierId) { this.ProductId = productId; this.StoreId = storeId; this.Quantity = quantity; this.ChangeQuantity = changeQuantity; this.Price = price; this.BatchNo = batchNo; this.BillId = billId; this.BillCode = billCode; this.BillType = billType; this.CreatedBy = createdBy; this.CreatedOn = DateTime.Now; this.SupplierId = supplierId; }