public static string FinPreOrder(string userId, string orderId) { //判断是否已经提货 if (IsFined(userId, orderId)) { return("订单已经提货"); } var conn = GetConnect(userId); if (conn is null) { return("网络异常"); } var takeBill = new BuyTakeBill(conn); string err; takeBill.PreFin(orderId, out err); conn.Close(); return(err); }
public static void CreateBakOrder(OrderEntity entity, string type) { if (IsExistOrder(entity.UserId, entity.OrderId)) { return; } #region var master = new TakeMasterMeta(); master.BuyState = type == "Sale" ? BuyTakeBuyState.Sale : BuyTakeBuyState.Pre; master.State = BuyTakeState.Success; master.PayType = BuyTakePayType.Paid; master.OptTime = entity.OptTime.ToString(); master.MemoStr = entity.MemoStr; master.DeliverFee = entity.DeliverFee; master.DeliverAddress = entity.DeliverAddress; master.DeliverTime = entity.DeliverTime > entity.OptTime ? entity.DeliverTime.ToString() : entity.OptTime.ToString(); master.UserMobile = entity.UserMobile; master.UserName = entity.UserName; master.Consume = entity.Consume; master.TtlPrice = entity.TtlPrice; master.OrderType = type == "Sale" ? BuyTakeOrderType.Sale : BuyTakeOrderType.Pre; master.OrderId = entity.OrderId; master.TakeType = (BuyTakeType)entity.TakeType; var details = new BuyDetailList(); foreach (var dtl in entity.OrderDtls) { details.Add(new BuyDetailMeta { ProdName = dtl.ProdName, ProdNo = dtl.ProdNo, ProdUnit = dtl.ProdUnit, Price = dtl.Price, ItemCnt = dtl.ItemCnt, ItemSum = dtl.ItemSum }); } #endregion //处理远程创建订单死锁的问题,循环5次 //var times = 0; //int[] seconds = { 2000, 5000, 10000, 30000, 60000 }; //while (times < 5) //{ try { var conn = GetConnect(entity.UserId); if (conn is null) { return; } var takeBill = new BuyTakeBill(conn); string err; if (type == "Sale") { takeBill.SaleSave(entity.ShopNo, master, details, out err); } else { takeBill.PreSave(entity.ShopNo, master, details, out err); } conn.Close(); } catch (Exception e) { // ignored } //await Task.Delay(seconds[times]); //Thread.Sleep(seconds[times]); //times++; }