|
@@ -38,8 +38,6 @@ public class StoreApplyHelper
|
|
{
|
|
{
|
|
function.WritePage("/StoreApply/", DateTime.Now.ToString("yyyyMM") + ".txt", DateTime.Now.ToString());
|
|
function.WritePage("/StoreApply/", DateTime.Now.ToString("yyyyMM") + ".txt", DateTime.Now.ToString());
|
|
Dictionary<int, decimal> dataDic = new Dictionary<int, decimal>();
|
|
Dictionary<int, decimal> dataDic = new Dictionary<int, decimal>();
|
|
- Dictionary<int, decimal> dataDic1 = new Dictionary<int, decimal>();
|
|
|
|
- Dictionary<int, decimal> dataDic2 = new Dictionary<int, decimal>();
|
|
|
|
string pre = DateTime.Now.AddMonths(-2).ToString("yyyy-MM") + "-01 00:00:00";
|
|
string pre = DateTime.Now.AddMonths(-2).ToString("yyyy-MM") + "-01 00:00:00";
|
|
string start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01 00:00:00";
|
|
string start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01 00:00:00";
|
|
string end = DateTime.Parse(start).AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss");
|
|
string end = DateTime.Parse(start).AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss");
|
|
@@ -61,14 +59,15 @@ public class StoreApplyHelper
|
|
{
|
|
{
|
|
int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
|
|
int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
|
|
int Count = int.Parse(function.CheckInt(dr[1].ToString()));
|
|
int Count = int.Parse(function.CheckInt(dr[1].ToString()));
|
|
|
|
+ decimal AmountMore = Count * 200;
|
|
StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
|
|
StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
|
|
- if(!dataDic1.ContainsKey(store.UserId))
|
|
|
|
|
|
+ if(!dataDic.ContainsKey(store.UserId))
|
|
{
|
|
{
|
|
- dataDic1.Add(store.UserId, Count * 200);
|
|
|
|
|
|
+ dataDic.Add(store.UserId, AmountMore);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- dataDic1[store.UserId] += Count * 200;
|
|
|
|
|
|
+ dataDic[store.UserId] += AmountMore;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dt = OtherMySqlConn.dtable("select StoreId,count(Id) from StoreStockChange where CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (3,5,9) and TransType in (10,11,2) and StoreId>0 group by StoreId");
|
|
dt = OtherMySqlConn.dtable("select StoreId,count(Id) from StoreStockChange where CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (3,5,9) and TransType in (10,11,2) and StoreId>0 group by StoreId");
|
|
@@ -76,64 +75,30 @@ public class StoreApplyHelper
|
|
{
|
|
{
|
|
int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
|
|
int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
|
|
int Count = int.Parse(function.CheckInt(dr[1].ToString()));
|
|
int Count = int.Parse(function.CheckInt(dr[1].ToString()));
|
|
|
|
+ decimal AmountMore = Count * 300;
|
|
StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
|
|
StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
|
|
- if(!dataDic2.ContainsKey(store.UserId))
|
|
|
|
|
|
+ if(!dataDic.ContainsKey(store.UserId))
|
|
{
|
|
{
|
|
- dataDic2.Add(store.UserId, Count * 300);
|
|
|
|
|
|
+ dataDic.Add(store.UserId, AmountMore);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- dataDic2[store.UserId] += Count * 300;
|
|
|
|
|
|
+ dataDic[store.UserId] += AmountMore;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
foreach(int UserId in dataDic.Keys)
|
|
foreach(int UserId in dataDic.Keys)
|
|
{
|
|
{
|
|
decimal Amount = dataDic[UserId];
|
|
decimal Amount = dataDic[UserId];
|
|
- UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
|
|
- if (account == null)
|
|
|
|
- {
|
|
|
|
- account = db.UserAccount.Add(new UserAccount()
|
|
|
|
- {
|
|
|
|
- Id = UserId,
|
|
|
|
- UserId = UserId,
|
|
|
|
- }).Entity;
|
|
|
|
- db.SaveChanges();
|
|
|
|
- }
|
|
|
|
- account.FixedAmount = Amount;
|
|
|
|
- account.ValidAmount = Amount + account.TempAmount;
|
|
|
|
- function.WriteLog("UserId:" + UserId + ";Amount:" + Amount, "计算分仓申请机具额度日志");
|
|
|
|
- }
|
|
|
|
- foreach(int UserId in dataDic1.Keys)
|
|
|
|
- {
|
|
|
|
- decimal Amount = dataDic1[UserId];
|
|
|
|
decimal AmountMore = 0;
|
|
decimal AmountMore = 0;
|
|
// DataTable dtmore = OtherMySqlConn.dtable("select count(Id)*200 from PosMachinesTwo pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BuyUserId=0 and BrandId in (1,2,4,6,7,8) and `Status`>-1");
|
|
// DataTable dtmore = OtherMySqlConn.dtable("select count(Id)*200 from PosMachinesTwo pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BuyUserId=0 and BrandId in (1,2,4,6,7,8) and `Status`>-1");
|
|
// if(dtmore.Rows.Count > 0)
|
|
// if(dtmore.Rows.Count > 0)
|
|
// {
|
|
// {
|
|
- // AmountMore = decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
|
|
|
|
+ // AmountMore += decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
// }
|
|
// }
|
|
- UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
|
|
- if (account == null)
|
|
|
|
- {
|
|
|
|
- account = db.UserAccount.Add(new UserAccount()
|
|
|
|
- {
|
|
|
|
- Id = UserId,
|
|
|
|
- UserId = UserId,
|
|
|
|
- }).Entity;
|
|
|
|
- db.SaveChanges();
|
|
|
|
- }
|
|
|
|
- account.FixedAmount = Amount;
|
|
|
|
- account.ValidAmount = Amount + account.TempAmount - AmountMore;
|
|
|
|
- function.WriteLog("UserId:" + UserId + ";Amount:" + Amount, "计算分仓申请机具额度日志");
|
|
|
|
- }
|
|
|
|
- foreach(int UserId in dataDic2.Keys)
|
|
|
|
- {
|
|
|
|
- decimal Amount = dataDic2[UserId];
|
|
|
|
- decimal AmountMore = 0;
|
|
|
|
- // DataTable dtmore = OtherMySqlConn.dtable("select count(Id)*300 from PosMachinesTwo pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BuyUserId=0 and BrandId in (3,5,9) and `Status`>-1");
|
|
|
|
|
|
+ // dtmore = OtherMySqlConn.dtable("select count(Id)*300 from PosMachinesTwo pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BuyUserId=0 and BrandId in (3,5,9) and `Status`>-1");
|
|
// if(dtmore.Rows.Count > 0)
|
|
// if(dtmore.Rows.Count > 0)
|
|
// {
|
|
// {
|
|
- // AmountMore = decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
|
|
|
|
+ // AmountMore += decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
// }
|
|
// }
|
|
UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == UserId);
|
|
if (account == null)
|
|
if (account == null)
|