|
@@ -35,7 +35,7 @@ public class StoreApplyHelper
|
|
if(string.IsNullOrEmpty(check))
|
|
if(string.IsNullOrEmpty(check))
|
|
{
|
|
{
|
|
function.WritePage("/StoreApply/", DateTime.Now.ToString("yyyyMM") + ".txt", DateTime.Now.ToString());
|
|
function.WritePage("/StoreApply/", DateTime.Now.ToString("yyyyMM") + ".txt", DateTime.Now.ToString());
|
|
-
|
|
|
|
|
|
+ // OtherMySqlConn.connstr =
|
|
db.SaveChanges();
|
|
db.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -64,23 +64,47 @@ public class StoreApplyHelper
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- string data = RedisDbconn.Instance.Get<string>("StoreApplyQueue");
|
|
|
|
|
|
+ string data = RedisDbconn.Instance.RPop<string>("StoreApplyQueue");
|
|
if(!string.IsNullOrEmpty(data))
|
|
if(!string.IsNullOrEmpty(data))
|
|
{
|
|
{
|
|
|
|
+ function.WriteLog("data:" + data, "分仓向总仓申请机具日志");
|
|
JsonData jsonObj = JsonMapper.ToObject(data);
|
|
JsonData jsonObj = JsonMapper.ToObject(data);
|
|
if(jsonObj["Kind"].ToString() == "1")
|
|
if(jsonObj["Kind"].ToString() == "1")
|
|
{
|
|
{
|
|
|
|
+ function.WriteLog("1", "分仓向总仓申请机具日志");
|
|
int OrderId = int.Parse(jsonObj["Data"]["OrderId"].ToString());
|
|
int OrderId = int.Parse(jsonObj["Data"]["OrderId"].ToString());
|
|
Orders order = db.Orders.FirstOrDefault(m => m.Id == OrderId);
|
|
Orders order = db.Orders.FirstOrDefault(m => m.Id == OrderId);
|
|
if(order != null)
|
|
if(order != null)
|
|
{
|
|
{
|
|
- decimal TotalPrice = order.TotalPrice;
|
|
|
|
|
|
+ function.WriteLog("2", "分仓向总仓申请机具日志");
|
|
UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == order.UserId);
|
|
UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == order.UserId);
|
|
- if(account != null)
|
|
|
|
|
|
+ if (account == null)
|
|
{
|
|
{
|
|
- account.TempAmount += TotalPrice;
|
|
|
|
- account.ValidAmount += TotalPrice;
|
|
|
|
|
|
+ account = db.UserAccount.Add(new UserAccount()
|
|
|
|
+ {
|
|
|
|
+ Id = order.UserId,
|
|
|
|
+ UserId = order.UserId,
|
|
|
|
+ }).Entity;
|
|
|
|
+ db.SaveChanges();
|
|
}
|
|
}
|
|
|
|
+ decimal TotalPrice = order.TotalPrice * 2;
|
|
|
|
+ decimal BeforeTotalAmount = account.TempAmount; //变更前总金额
|
|
|
|
+ account.TempAmount += TotalPrice;
|
|
|
|
+ account.ValidAmount += TotalPrice;
|
|
|
|
+ decimal AfterTotalAmount = account.TempAmount; //变更后总金额
|
|
|
|
+ StoreHouseAmountRecord record = db.StoreHouseAmountRecord.Add(new StoreHouseAmountRecord()
|
|
|
|
+ {
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
+ UpdateDate = DateTime.Now,
|
|
|
|
+ OperateType = 1,
|
|
|
|
+ AmountType = 1,
|
|
|
|
+ AfterAmount = AfterTotalAmount,
|
|
|
|
+ BeforeAmount = BeforeTotalAmount,
|
|
|
|
+ UseAmount = TotalPrice,
|
|
|
|
+ UserId = order.UserId,
|
|
|
|
+ QueryCount = order.Id,
|
|
|
|
+ }).Entity;
|
|
|
|
+ db.SaveChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
db.SaveChanges();
|
|
db.SaveChanges();
|
|
@@ -91,8 +115,6 @@ public class StoreApplyHelper
|
|
function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "分仓向总仓申请机具线程异常");
|
|
function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "分仓向总仓申请机具线程异常");
|
|
}
|
|
}
|
|
db.Dispose();
|
|
db.Dispose();
|
|
- function.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\n\n", "分仓向总仓申请机具线程日志");
|
|
|
|
- Thread.Sleep(60000);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|