|
|
@@ -3934,6 +3934,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ var ChangeRecordNo = "HBJJ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8); //变更记录单号
|
|
|
foreach (int SnId in SnIds)
|
|
|
{
|
|
|
var posInfo = db.PosMachinesTwo.FirstOrDefault(m => m.Id == SnId) ?? new PosMachinesTwo();
|
|
|
@@ -3957,7 +3958,8 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
CreateDate = DateTime.Now,
|
|
|
UserId = fUserId.Id, //创客
|
|
|
BrandId = posInfo.BrandId,//产品类型
|
|
|
- ChangeRecordNo = "HBJJ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), //变更记录单号
|
|
|
+ // ChangeRecordNo = "HBJJ" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8), //变更记录单号
|
|
|
+ ChangeRecordNo = ChangeRecordNo, //变更记录单号
|
|
|
TransType = 1, //交易类型
|
|
|
SnNo = posInfo.PosSn, //SN编号
|
|
|
SnType = posInfo.PosSnType, //SN机具类型
|
|
|
@@ -3971,6 +3973,29 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
SourceStoreId = posInfo.SourceStoreId, //源仓库
|
|
|
ToUserId = tUserId.Id,//收货创客
|
|
|
});
|
|
|
+ UserStoreChange userstore = db.UserStoreChange.Add(new UserStoreChange()
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UserId = fUserId.Id, //创客
|
|
|
+ BrandId = posInfo.BrandId, //产品类型
|
|
|
+ ChangeRecordNo = ChangeRecordNo, //变更记录单号
|
|
|
+ TransType = 0, //交易类型
|
|
|
+ SnNo = posInfo.PosSn, //SN编号
|
|
|
+ SnType = posInfo.PosSnType, //SN机具类型
|
|
|
+ StockOpDirect = 0, //库存操作方向
|
|
|
+ DeviceVendor = posInfo.DeviceName, //设备厂商
|
|
|
+ DeviceType = posInfo.DeviceKind, //设备类型
|
|
|
+ DeviceModel = posInfo.DeviceType, //设备型号
|
|
|
+ ToUserId = tUserId.Id, //收货创客
|
|
|
+ ToDate = DateTime.Now, //入库时间
|
|
|
+ SourceStoreId = posInfo.SourceStoreId, //源仓库
|
|
|
+ SnStatus = 1, //SN状态
|
|
|
+ BindStatus = (int)posInfo.BindingState, //绑定状态
|
|
|
+ BindMerchantId = posInfo.BindMerchantId, //绑定商户
|
|
|
+ ActiveStatus = (int)posInfo.ActivationState, //激活状态
|
|
|
+ ActRewardUserId = posInfo.BuyUserId, //激活奖励创客
|
|
|
+ BrandType = posInfo.DeviceType, //品牌类型
|
|
|
+ }).Entity;
|
|
|
}
|
|
|
var query = SnIds + ";" + FromMakerCode + ";" + ToMakerCode;
|
|
|
function.WriteLog(DateTime.Now.ToString() + ":请求参数," + query + ":" + SysUserName + "-" + SysRealName, "划拨创客机具");
|
|
|
@@ -4223,6 +4248,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
LeaderUserId = leaderuser.UserId;
|
|
|
}
|
|
|
|
|
|
+ string ChangeRecordNo = "SC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8);
|
|
|
var query = PosCouponCodes + "\n" + FromMakerCode + "," + ToMakerCode;
|
|
|
string[] PosCouponList = PosCouponCodes.Replace("\r", "").Replace("\n", ",").Split(',');
|
|
|
foreach (string PosCouponCode in PosCouponList)
|
|
|
@@ -4245,7 +4271,34 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
item.LeaderUserId = LeaderUserId;
|
|
|
}
|
|
|
+ PosCouponRecord posCouponRecord = db.PosCouponRecord.Add(new PosCouponRecord()
|
|
|
+ {
|
|
|
+ QueryCount = item.QueryCount,//券类型(1 电签 2 大POS)
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ ChangeKind = 3,//类型(0购买,1划拨,2使⽤,3申请机具循环驳回)
|
|
|
+ OrderNo = ChangeRecordNo,
|
|
|
+ ToUserId = tUserId.Id,
|
|
|
+ FromUserId = fUserId.Id,
|
|
|
+ PosCouponId = item.Id,
|
|
|
+ }).Entity;
|
|
|
}
|
|
|
+ int CouponCount = PosCouponList.Length;
|
|
|
+ PosCouponOrders stat = db.PosCouponOrders.Add(new PosCouponOrders()
|
|
|
+ {
|
|
|
+ QueryCount = 3,
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ ChangeKind = 3,//类型(0购买,1划拨,2使⽤,3申请机具循环驳回)
|
|
|
+ ChangeCount = CouponCount,
|
|
|
+ // AfterOut = AfterOut,
|
|
|
+ // AfterTotal = AfterTotal,
|
|
|
+ // AfterStock = AfterStock,
|
|
|
+ // BeforeOut = BeforeOut,
|
|
|
+ // BeforeTotal = BeforeTotal,
|
|
|
+ // BeforeStock = BeforeStock,
|
|
|
+ OrderNo = ChangeRecordNo,
|
|
|
+ ToUserId = tUserId.Id,
|
|
|
+ FromUserId = fUserId.Id,
|
|
|
+ }).Entity;
|
|
|
db.SaveChanges();
|
|
|
db.Dispose();
|
|
|
|
|
|
@@ -4802,7 +4855,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
- #region 直营团队数据导出
|
|
|
+ #region 直营团队数据
|
|
|
|
|
|
public IActionResult Team1Info(string right)
|
|
|
{
|
|
|
@@ -4813,7 +4866,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- #region 直营团队数据导出
|
|
|
+ #region 直营团队数据
|
|
|
public JsonResult Team1InfoDo(string MakerCode, string BindingTime, string ActivationTime, string PosFee, string BrandId, int page = 1, int limit = 30)
|
|
|
{
|
|
|
string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
@@ -4876,26 +4929,62 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
- // #region 快捷导出Excel
|
|
|
- // public IActionResult QuickExportExcel(string right)
|
|
|
- // {
|
|
|
- // ViewBag.RightInfo = RightInfo;
|
|
|
- // ViewBag.right = right;
|
|
|
+ #region 直营团队数据导出
|
|
|
+ public IActionResult ExportTeam1InfoExcel(string right)
|
|
|
+ {
|
|
|
+ ViewBag.RightInfo = RightInfo;
|
|
|
+ ViewBag.right = right;
|
|
|
|
|
|
- // return View();
|
|
|
- // }
|
|
|
+ return View();
|
|
|
+ }
|
|
|
|
|
|
- // [HttpPost]
|
|
|
- // public string QuickExportExcelDo(string UserIdMakerCode, string SourceMakerCode, string RemarkSelect, string CreateDateData, string SeoKeyword)
|
|
|
- // {
|
|
|
- // 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 sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
|
|
|
- // var FileName = "盟主储蓄金变动记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
- // string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
|
|
|
- // RedisDbconn.Instance.AddList("ExportQueue", SendData);
|
|
|
- // return "success";
|
|
|
- // }
|
|
|
- // #endregion
|
|
|
+ [HttpPost]
|
|
|
+ public string ExportTeam1InfoExcelDo(string MakerCode, string BindingTime, string ActivationTime, string PosFee, string BrandId)
|
|
|
+ {
|
|
|
+ string conn = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
+ List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
+ string condition = " where 1=1";
|
|
|
+ var UserId = 0;
|
|
|
+ var bstart = "";
|
|
|
+ var bend = "";
|
|
|
+ var astart = "";
|
|
|
+ var aend = "";
|
|
|
+ if (!string.IsNullOrEmpty(MakerCode))
|
|
|
+ {
|
|
|
+ var user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new Users();
|
|
|
+ UserId = user.Id;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(BindingTime))
|
|
|
+ {
|
|
|
+ string[] datelist = BindingTime.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
+ bstart = datelist[0] + " 00:00:00";
|
|
|
+ bend = datelist[1] + " 23:59:59";
|
|
|
+ condition += "and tb.BindingTime>='" + bstart + "' and tb.BindingTime<'" + bend + "'";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(ActivationTime))
|
|
|
+ {
|
|
|
+ string[] datelist = ActivationTime.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
+ astart = datelist[0] + " 00:00:00";
|
|
|
+ aend = datelist[1] + " 23:59:59";
|
|
|
+ condition += " and tb.ActivationTime>='" + astart + "' and tb.ActivationTime<'" + aend + "'";
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(PosFee))
|
|
|
+ {
|
|
|
+ condition += " and tb.SeoKeyword=" + PosFee;
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(BrandId))
|
|
|
+ {
|
|
|
+ condition += " and tb.BrandId=" + BrandId;
|
|
|
+ }
|
|
|
+ var Sql = "select wname '伙伴名称',k.`Name` '机具品牌',PosSn '机具Sn',tb.SeoKeyword '押金',DATE_FORMAT(BindingTime,'%Y-%m-%d %H:%i:%s') '绑定时间',DATE_FORMAT(ActivationTime,'%Y-%m-%d %H:%i:%s') '激活时间' from (select (select Name from BusinessPartner where Id=(select PartnerId from BusinessPartnerPos where PosId=pos.Id and `Status`>-1 limit 1)) wname,BrandId,PosSnType,PosSn,(CASE WHEN BrandId not in(2,7,10,11) THEN ROUND(CAST(SeoKeyword AS DECIMAL)/100, 2) ELSE SeoKeyword end) SeoKeyword,TransferTime,BindingTime,ActivationTime,PrizeParams from PosMachinesTwo pos where BindingState=1 and `Status`>=-1 and BuyUserId=" + UserId + " and Id in (select PosId from BusinessPartnerPos)) tb left join KqProducts k on tb.BrandId=k.Id" + condition;
|
|
|
+
|
|
|
+ var sysAdmin = bsdb.SysAdmin.FirstOrDefault(m => m.AdminName == SysUserName && m.Status > -1);
|
|
|
+ var FileName = "直营团队数据记录" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
+ string SendData = "{\"Operater\":\"" + sysAdmin.Id + "\",\"SqlString\":\"" + Sql + "\",\"FileName\":\"" + FileName + "\",\"MaxCount\":\"0\"}";
|
|
|
+ RedisDbconn.Instance.AddList("ExportQueue", SendData);
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
|
|
|
}
|
|
|
}
|