|
@@ -24,8 +24,8 @@ public class StoreApplyHelper
|
|
|
|
|
|
// 每月1号重置仓库额度
|
|
|
// 固定额度=上月出货额度与保底额度之间的最高值
|
|
|
- // 已用额度=仓库中机具占用额度+小分仓机具占用额度+申请补货订单占用额度
|
|
|
- // 可用额度=重置后的固定额度+被担保额度+临时额度-已用额度-小分仓未授权额度
|
|
|
+ // 已用额度=仓库中机具占用额度+小分仓机具占用额度+申请补货订单占用额度-小分仓中带“授”标记机具占用额度
|
|
|
+ // 可用额度=重置后的固定额度+被担保额度+临时额度-已用额度
|
|
|
private void DoWorks()
|
|
|
{
|
|
|
while (true)
|
|
@@ -44,21 +44,8 @@ public class StoreApplyHelper
|
|
|
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 end = DateTime.Parse(start).AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- // DataTable dts = OtherMySqlConn.dtable("select UserId from StoreHouse where CreateDate>='" + pre + "' and CreateDate<'" + end + "' and UserId in (select UserId from (select UserId,count(Id) from StoreHouse group by UserId HAVING count(Id)=1) tb)");
|
|
|
- // foreach(DataRow dr in dts.Rows)
|
|
|
- // {
|
|
|
- // int UserId = int.Parse(function.CheckInt(dr["UserId"].ToString()));
|
|
|
- // if(!dataDic.ContainsKey(UserId))
|
|
|
- // {
|
|
|
- // dataDic.Add(UserId, 20000);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // dataDic[UserId] += 20000;
|
|
|
- // }
|
|
|
- // }
|
|
|
//上月出货额度
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select StoreId,count(Id) from StoreStockChange where CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (1,2,4,6,7,8) and TransType in (10,11,2) and StoreId>0 group by StoreId");
|
|
|
+ DataTable dt = OtherMySqlConn.dtable("select StoreId,count(Id) from StoreStockChange where Id>=528358 and CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (1,2,4,6,7,8) and TransType in (10,11,2) and StoreId>0 group by StoreId");
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
{
|
|
|
int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
|
|
@@ -74,7 +61,7 @@ public class StoreApplyHelper
|
|
|
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 Id>=528358 and CreateDate>='" + start + "' and CreateDate<'" + end + "' and BrandId in (3,5,9) and TransType in (10,11,2) and StoreId>0 group by StoreId");
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
{
|
|
|
int StoreId = int.Parse(function.CheckInt(dr["StoreId"].ToString()));
|
|
@@ -122,7 +109,7 @@ public class StoreApplyHelper
|
|
|
dt = OtherMySqlConn.dtable("select PromissAmount from StoreHouseAmountPromiss where ToUserId=" + UserId + " and Status=1");
|
|
|
foreach(DataRow dr in dt.Rows)
|
|
|
{
|
|
|
- PromissAmount = decimal.Parse(function.CheckNum(dr["PromissAmount"].ToString()));
|
|
|
+ PromissAmount += decimal.Parse(function.CheckNum(dr["PromissAmount"].ToString()));
|
|
|
}
|
|
|
decimal AmountMore = 0;
|
|
|
//仓库中机具占用额度+小分仓机具占用额度
|
|
@@ -136,13 +123,13 @@ public class StoreApplyHelper
|
|
|
{
|
|
|
AmountMore += decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
|
}
|
|
|
- //除开小分仓未授权机具
|
|
|
- dtmore = OtherMySqlConn.dtable("select count(Id)*200 from PreSendStockDetail pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BrandId in (1,2,4,6,7,8) and `Status`=1");
|
|
|
+ //除开小分仓中带“授”标记机具占用额度
|
|
|
+ dtmore = OtherMySqlConn.dtable("select count(Id)*200 from PreSendStockDetail pos where FromStoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BrandId in (1,2,4,6,7,8) and AuthFlag=1 and ApplyFlag=0 and `Status`>-1 and `Status`<2");
|
|
|
if(dtmore.Rows.Count > 0)
|
|
|
{
|
|
|
AmountMore -= decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
|
}
|
|
|
- dtmore = OtherMySqlConn.dtable("select count(Id)*300 from PreSendStockDetail pos where StoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BrandId in (3,5,9) and `Status`=1");
|
|
|
+ dtmore = OtherMySqlConn.dtable("select count(Id)*300 from PreSendStockDetail pos where FromStoreId in (select Id from StoreHouse where UserId=" + UserId + ") and BrandId in (3,5,9) and AuthFlag=1 and ApplyFlag=0 and `Status`>-1 and `Status`<2");
|
|
|
if(dtmore.Rows.Count > 0)
|
|
|
{
|
|
|
AmountMore -= decimal.Parse(function.CheckNum(dtmore.Rows[0][0].ToString()));
|
|
@@ -479,6 +466,7 @@ public class StoreApplyHelper
|
|
|
ids.Add(28538);
|
|
|
ids.Add(2927);
|
|
|
ids.Add(584);
|
|
|
+ ids.Add(6659);
|
|
|
return ids;
|
|
|
}
|
|
|
}
|