|
@@ -1650,34 +1650,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- // DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
|
|
|
- // if (startPosDt.Rows.Count > 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
|
|
|
- // if (minPosId == "0")
|
|
|
|
|
- // {
|
|
|
|
|
- // startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
|
|
|
- // if (startPosDt.Rows.Count > 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
|
|
|
- // if (endPosDt.Rows.Count > 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
|
|
|
- // if (maxPosId == "0")
|
|
|
|
|
- // {
|
|
|
|
|
- // endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
|
|
|
- // if (endPosDt.Rows.Count > 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where Id>=" + minPosId + " and Id<=" + maxPosId + " and ActivationState=1 and ActivationTime>='" + sCreateDate + "' and ActivationTime<='" + eCreateDate + "' and StoreId=s.Id) as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where (c1>0 or c2>0 or c3>0) " + condtion);
|
|
|
|
|
-
|
|
|
|
|
DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.MakerCode,u.RealName,u.Mobile,s.ManageMobile,s.Address,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1, (select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2, (select ActCount from KxsStatServer.StoreAct202211 where StoreId=s.Id) as c3, ua.FixedAmount, ua.ValidAmount, ua.TempAmount, (select sum(PromissAmount) from StoreHouseAmountPromiss where ToUserId=s.UserId and `Status`=1) as PromissAmount from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id left join UserAccount ua on s.UserId=ua.Id) tb where (c1>0 or c2>0 or c3>0)" + condtion + "");
|
|
DataTable list = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.MakerCode,u.RealName,u.Mobile,s.ManageMobile,s.Address,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1, (select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2, (select ActCount from KxsStatServer.StoreAct202211 where StoreId=s.Id) as c3, ua.FixedAmount, ua.ValidAmount, ua.TempAmount, (select sum(PromissAmount) from StoreHouseAmountPromiss where ToUserId=s.UserId and `Status`=1) as PromissAmount from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id left join UserAccount ua on s.UserId=ua.Id) tb where (c1>0 or c2>0 or c3>0)" + condtion + "");
|
|
|
int recordcount = list.Rows.Count;
|
|
int recordcount = list.Rows.Count;
|
|
|
List<Dictionary<string, object>> diclist = new List<Dictionary<string, object>>();
|
|
List<Dictionary<string, object>> diclist = new List<Dictionary<string, object>>();
|
|
@@ -1735,7 +1707,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
public string StatQuickExportExcelDo(string MakerCode, string StoreNo, string CreateDateData)
|
|
public string StatQuickExportExcelDo(string MakerCode, string StoreNo, string CreateDateData)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- string SqlString = " and Status>-1";
|
|
|
|
|
string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
|
string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
|
if (!string.IsNullOrEmpty(CreateDateData))
|
|
if (!string.IsNullOrEmpty(CreateDateData))
|
|
@@ -1744,13 +1715,14 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
sCreateDate = datelist[0] + " 00:00:00";
|
|
sCreateDate = datelist[0] + " 00:00:00";
|
|
|
eCreateDate = datelist[1] + " 23:59:59";
|
|
eCreateDate = datelist[1] + " 23:59:59";
|
|
|
}
|
|
}
|
|
|
|
|
+ var condtion = "";
|
|
|
if (!string.IsNullOrEmpty(MakerCode))
|
|
if (!string.IsNullOrEmpty(MakerCode))
|
|
|
{
|
|
{
|
|
|
- SqlString += "and MakerCode='" + MakerCode + "'";
|
|
|
|
|
|
|
+ condtion += "and MakerCode='" + MakerCode + "'";
|
|
|
}
|
|
}
|
|
|
if (!string.IsNullOrEmpty(StoreNo))
|
|
if (!string.IsNullOrEmpty(StoreNo))
|
|
|
{
|
|
{
|
|
|
- SqlString += "and StoreNo='" + StoreNo + "'";
|
|
|
|
|
|
|
+ condtion += "and StoreNo='" + StoreNo + "'";
|
|
|
}
|
|
}
|
|
|
string minId = "0";
|
|
string minId = "0";
|
|
|
string maxId = "0";
|
|
string maxId = "0";
|
|
@@ -1780,9 +1752,9 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- var Sql = "SELECT c.MakerCode '创客编号',c.RealName '创客姓名',DATE_FORMAT(c.CreateDate,'%Y-%m-%d %H:%i:%s') '创建时间',c.Remark '变动类型',c.Type1Num '电签兑换券张数',c.Type2Num '大POS兑换券张数',d.LeaderBalanceAmount '可提现余额',c.ChangeAmt '使用额度',c.BeforeAmt '使用前剩余额度',c.AfterAmt '使用后剩余额度' FROM(SELECT a.*,b.MakerCode,b.RealName FROM(SELECT Id,UserId,CreateDate,ChangeAmt,BeforeAmt,AfterAmt,Remark,REPLACE (JSON_EXTRACT (SeoTitle, '$[0].Num'),'\\\"','') AS 'Type1Num', REPLACE (JSON_EXTRACT (SeoTitle, '$[1].Num'),'\\\"','') AS 'Type2Num' FROM LeaderReserveRecord WHERE 1=1 " + SqlString + ") a LEFT JOIN Users b ON a.UserId=b.Id) c LEFT JOIN UserAccount d ON c.UserId=d.Id";
|
|
|
|
|
|
|
+ var Sql = "select * from (select s.StoreName '仓库名称',s.StoreNo '仓库编号',u.MakerCode '仓库所属人编码',u.RealName '仓库所属人名称',u.Mobile '仓库所属人手机号',s.ManageMobile '仓库管理员手机号',s.Address '地址',k.Name '品牌',s.LaveNum '当前库存',(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType=1) as c1 '出库(调拨)量', (select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + sCreateDate + "' and CreateDate<='" + eCreateDate + "' and StoreId=s.Id and TransType in (10,11,2)) as c2 '出货(发货到创客)量', (select ActCount from KxsStatServer.StoreAct202211 where StoreId=s.Id) as c3 '激活量', ua.FixedAmount '固定额度', ua.ValidAmount '可用额度', ua.TempAmount '临时额度', (select sum(PromissAmount) from StoreHouseAmountPromiss where ToUserId=s.UserId and `Status`=1) as PromissAmount '担保额度' from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id left join UserAccount ua on s.UserId=ua.Id) tb where (c1>0 or c2>0 or c3>0)" + condtion + "";
|
|
|
var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
|
|
var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
|
|
|
- var FileName = "盟主储蓄金变动记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
+ var FileName = "仓库统计管理记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
|
|
string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
|
|
|
RedisDbconn.Instance.AddList("ExportQueue", SendData);
|
|
RedisDbconn.Instance.AddList("ExportQueue", SendData);
|
|
|
return "success";
|
|
return "success";
|