|
|
@@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using MySystem.Models;
|
|
|
+using System.Data;
|
|
|
using Library;
|
|
|
using LitJson;
|
|
|
using MySystemLib;
|
|
|
@@ -3933,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();
|
|
|
@@ -3956,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机具类型
|
|
|
@@ -3970,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, "划拨创客机具");
|
|
|
@@ -4064,7 +4090,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
+
|
|
|
CustomTagSet set = db.CustomTagSet.FirstOrDefault(m => m.Tags == "CashWithoutUser") ?? new CustomTagSet();
|
|
|
ViewBag.set = set;
|
|
|
|
|
|
@@ -4184,8 +4210,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
- public string TransferPosCouponDo(string PosCouponCodes, string FromMakerCode, string ToMakerCode, string LeaderMakerCode = "")
|
|
|
+ public string TransferPosCouponDo(string Kind, string PosCouponCodes, string FromMakerCode, string ToMakerCode, string LeaderMakerCode = "")
|
|
|
{
|
|
|
+ if (string.IsNullOrEmpty(PosCouponCodes))
|
|
|
+ {
|
|
|
+ return "请输入机具券码";
|
|
|
+ }
|
|
|
if (string.IsNullOrEmpty(PosCouponCodes))
|
|
|
{
|
|
|
return "请输入机具券码";
|
|
|
@@ -4222,6 +4252,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)
|
|
|
@@ -4244,7 +4275,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 = 1,//类型(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 = 2,
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
+ // ChangeKind = 2,
|
|
|
+ // 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();
|
|
|
|
|
|
@@ -4801,5 +4859,149 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
+ #region 直营团队数据
|
|
|
+
|
|
|
+ public IActionResult Team1Info(string right)
|
|
|
+ {
|
|
|
+ ViewBag.RightInfo = RightInfo;
|
|
|
+ ViewBag.right = right;
|
|
|
+
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ #region 直营团队数据
|
|
|
+ public JsonResult Team1InfoDo(string MakerCode, string BindingTime, string ActivationTime, string PosFeeSelect, string BrandId, int page = 1, int limit = 30)
|
|
|
+ {
|
|
|
+ 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(PosFeeSelect))
|
|
|
+ {
|
|
|
+ if (PosFeeSelect == "0")
|
|
|
+ {
|
|
|
+ condition += " and tb.SeoKeyword is null";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ condition += " and tb.SeoKeyword=" + PosFeeSelect;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(BrandId))
|
|
|
+ {
|
|
|
+ condition += " and tb.BrandId=" + BrandId;
|
|
|
+ }
|
|
|
+
|
|
|
+ DataTable dt = CustomerSqlConn.dtable("select wname,k.`Name`,PosSnType,PosSn,(CASE WHEN tb.SeoKeyword IS NULL AND tb.PrizeParams=0 THEN 0 ELSE tb.SeoKeyword END) SeoKeyword,TransferTime,BindingTime,ActivationTime,PrizeParams 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, conn);
|
|
|
+ foreach (DataRow item in dt.Rows)
|
|
|
+ {
|
|
|
+ Dictionary<string, object> curData = new Dictionary<string, object>();
|
|
|
+ curData.Add("wname", item["wname"].ToString()); //伙伴名称
|
|
|
+ curData.Add("Name", item["Name"].ToString()); //机具品牌
|
|
|
+ curData.Add("PosSn", item["PosSn"].ToString()); //机具Sn
|
|
|
+ curData.Add("SeoKeyword", item["SeoKeyword"].ToString()); //服务费
|
|
|
+ curData.Add("BindingTime", string.IsNullOrEmpty(item["BindingTime"].ToString()) ? "" : Convert.ToDateTime(item["BindingTime"]).ToString("yyyy-MM-dd HH:mm:ss")); //绑定时间
|
|
|
+ curData.Add("ActivationTime", string.IsNullOrEmpty(item["ActivationTime"].ToString()) ? "" : Convert.ToDateTime(item["ActivationTime"]).ToString("yyyy-MM-dd HH:mm:ss")); //激活时间
|
|
|
+ dataList.Add(curData);
|
|
|
+ }
|
|
|
+ Dictionary<string, object> obj = new Dictionary<string, object>();
|
|
|
+ obj.Add("code", 0);
|
|
|
+ obj.Add("msg", "");
|
|
|
+ obj.Add("count", dataList.Count);
|
|
|
+ obj.Add("data", dataList);
|
|
|
+ return Json(obj);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+ #region 直营团队数据导出
|
|
|
+ public IActionResult ExportTeam1InfoExcel(string right)
|
|
|
+ {
|
|
|
+ ViewBag.RightInfo = RightInfo;
|
|
|
+ ViewBag.right = right;
|
|
|
+
|
|
|
+ return View();
|
|
|
+ }
|
|
|
+
|
|
|
+ [HttpPost]
|
|
|
+ public string ExportTeam1InfoExcelDo(string MakerCode, string BindingTime, string ActivationTime, string PosFeeSelect, 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(PosFeeSelect))
|
|
|
+ {
|
|
|
+ if (PosFeeSelect == "0")
|
|
|
+ {
|
|
|
+ condition += " and tb.SeoKeyword is null";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ condition += " and tb.SeoKeyword=" + PosFeeSelect;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty(BrandId))
|
|
|
+ {
|
|
|
+ condition += " and tb.BrandId=" + BrandId;
|
|
|
+ }
|
|
|
+ var Sql = "select wname '伙伴名称',k.`Name` '机具品牌',PosSn '机具Sn',(CASE WHEN tb.SeoKeyword IS NULL AND tb.PrizeParams=0 THEN 0 ELSE tb.SeoKeyword END) '服务费',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
|
|
|
+
|
|
|
}
|
|
|
}
|