|
|
@@ -1711,7 +1711,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
newpos.UserId = oldpos.UserId;
|
|
|
newpos.PreUserId = oldpos.PreUserId;
|
|
|
|
|
|
- if(!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
|
|
|
+ if (!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
|
|
|
{
|
|
|
opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
|
|
|
}
|
|
|
@@ -1905,7 +1905,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
newpos.IsFirst = oldpos.IsFirst;
|
|
|
newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
|
- if(!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
|
|
|
+ if (!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
|
|
|
{
|
|
|
opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
|
|
|
}
|
|
|
@@ -2103,7 +2103,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
// }));
|
|
|
// }
|
|
|
// }
|
|
|
- foreach(string sub in opData)
|
|
|
+ foreach (string sub in opData)
|
|
|
{
|
|
|
string[] datalist = sub.Split(":");
|
|
|
PublicFunction.SycnMachineCount(int.Parse(datalist[0]), int.Parse(datalist[1]));
|
|
|
@@ -2113,6 +2113,134 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
+ // #region 机具解绑
|
|
|
+
|
|
|
+ // public IActionResult Unbind(string right)
|
|
|
+ // {
|
|
|
+ // ViewBag.RightInfo = RightInfo;
|
|
|
+ // ViewBag.right = right;
|
|
|
+
|
|
|
+ // return View();
|
|
|
+ // }
|
|
|
+
|
|
|
+ // [HttpPost]
|
|
|
+ // public string UnbindDo(string PosSn, string MakerCode, string MerNo, int IsSend = 0)
|
|
|
+ // {
|
|
|
+ // if (string.IsNullOrEmpty(PosSn))
|
|
|
+ // {
|
|
|
+ // return "请输入机具SN";
|
|
|
+ // }
|
|
|
+ // if (string.IsNullOrEmpty(MakerCode))
|
|
|
+ // {
|
|
|
+ // return "请输入创客编号";
|
|
|
+ // }
|
|
|
+ // MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == PosSn);
|
|
|
+ // if (forSnNo == null)
|
|
|
+ // {
|
|
|
+ // return "机具SN不存在";
|
|
|
+ // }
|
|
|
+ // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId);
|
|
|
+ // if (pos == null)
|
|
|
+ // {
|
|
|
+ // return "机具SN不存在";
|
|
|
+ // }
|
|
|
+ // if (string.IsNullOrEmpty(MerNo) && pos.BrandId != 1 && pos.BrandId != 3)
|
|
|
+ // {
|
|
|
+ // return "请输入商户编号";
|
|
|
+ // }
|
|
|
+ // UserForMakerCode forMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
+ // if (forMakerCode == null)
|
|
|
+ // {
|
|
|
+ // return "创客不存在";
|
|
|
+ // }
|
|
|
+ // MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == MerNo);
|
|
|
+ // if (forMerNo == null && pos.BrandId != 1 && pos.BrandId != 3)
|
|
|
+ // {
|
|
|
+ // return "商户编号不存在";
|
|
|
+ // }
|
|
|
+ // if (pos.BuyUserId != forMakerCode.UserId)
|
|
|
+ // {
|
|
|
+ // return "机具SN和创客不匹配";
|
|
|
+ // }
|
|
|
+ // if (pos.ActivationState == 1)
|
|
|
+ // {
|
|
|
+ // return "机具已激活,不能解绑";
|
|
|
+ // }
|
|
|
+ // if (pos.BuyUserId == 0)
|
|
|
+ // {
|
|
|
+ // return "机具是仓库机,不支持解绑";
|
|
|
+ // }
|
|
|
+ // if (pos.BindingState == 0)
|
|
|
+ // {
|
|
|
+ // return "机具未绑定,不支持解绑";
|
|
|
+ // }
|
|
|
+ // if (pos.BindingTime < DateTime.Now.AddDays(-30) && SysUserName != "admin")
|
|
|
+ // {
|
|
|
+ // return "机具绑定已超过30天,不支持解绑";
|
|
|
+ // }
|
|
|
+ // if (pos.CreditTrade > 0 || !string.IsNullOrEmpty(pos.SeoKeyword))
|
|
|
+ // {
|
|
|
+ // return "该机具已交易,无法解绑";
|
|
|
+ // }
|
|
|
+ // if (forMerNo != null)
|
|
|
+ // {
|
|
|
+ // PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
+ // if (merchant != null)
|
|
|
+ // {
|
|
|
+ // //机具解绑删除客小爽企业版对应数据
|
|
|
+ // var merInfo = db.BusinessPartnerMerchant.FirstOrDefault(m => m.MerchantId == merchant.Id);
|
|
|
+ // if (merInfo != null)
|
|
|
+ // {
|
|
|
+ // db.BusinessPartnerMerchant.Remove(merInfo);
|
|
|
+ // }
|
|
|
+ // var posInfo = db.BusinessPartnerPos.FirstOrDefault(m => m.PosId == pos.Id);
|
|
|
+ // if (posInfo != null)
|
|
|
+ // {
|
|
|
+ // db.BusinessPartnerPos.Remove(posInfo);
|
|
|
+ // }
|
|
|
+
|
|
|
+ // db.PosMerchantInfo.Remove(merchant);
|
|
|
+ // }
|
|
|
+ // db.MachineForMerNo.Remove(forMerNo);
|
|
|
+ // db.SaveChanges();
|
|
|
+ // }
|
|
|
+ // db.MachineUnBind.Add(new MachineUnBind()
|
|
|
+ // {
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
+ // SeoTitle = SysUserName + "-" + SysRealName,
|
|
|
+ // MerchantId = pos.BindMerchantId,
|
|
|
+ // AuditDate = DateTime.Now,
|
|
|
+ // AuditDesc = "平台操作解绑",
|
|
|
+ // AuditStatus = 1,
|
|
|
+ // SnNo = pos.PosSn,
|
|
|
+ // BrandId = pos.BrandId,
|
|
|
+ // UserId = pos.BuyUserId,
|
|
|
+ // ApplyNo = "U" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8),
|
|
|
+ // });
|
|
|
+ // pos.BindMerchantId = 0;
|
|
|
+ // pos.BindingState = 0;
|
|
|
+ // pos.BindingTime = DateTime.Parse("1900-01-01");
|
|
|
+ // pos.UserId = pos.BuyUserId;
|
|
|
+ // string IdBrand = pos.BuyUserId + "_" + pos.BrandId;
|
|
|
+ // db.SaveChanges();
|
|
|
+ // PublicFunction.SycnMachineCount(pos.BuyUserId, pos.BrandId);
|
|
|
+ // if (IsSend == 1)
|
|
|
+ // {
|
|
|
+ // RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
+ // {
|
|
|
+ // UserId = pos.BuyUserId, //接收创客
|
|
|
+ // MsgType = 2,
|
|
|
+ // Title = "解绑成功通知", //标题
|
|
|
+ // Summary = "" + PosSn + "机具已成功解绑,当前机具如需绑定同一客户请再2个工作日后再进行绑定,直接绑定会导致数控异常,相关损失由您本人承担。",
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
+ // }));
|
|
|
+ // }
|
|
|
+ // return "success";
|
|
|
+ // }
|
|
|
+ // #endregion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#region 机具解绑
|
|
|
|
|
|
public IActionResult Unbind(string right)
|
|
|
@@ -2130,10 +2258,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
return "请输入机具SN";
|
|
|
}
|
|
|
- if (string.IsNullOrEmpty(MakerCode))
|
|
|
- {
|
|
|
- return "请输入创客编号";
|
|
|
- }
|
|
|
MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == PosSn);
|
|
|
if (forSnNo == null)
|
|
|
{
|
|
|
@@ -2144,24 +2268,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
return "机具SN不存在";
|
|
|
}
|
|
|
- if (string.IsNullOrEmpty(MerNo) && pos.BrandId != 1 && pos.BrandId != 3)
|
|
|
- {
|
|
|
- return "请输入商户编号";
|
|
|
- }
|
|
|
- UserForMakerCode forMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
- if (forMakerCode == null)
|
|
|
- {
|
|
|
- return "创客不存在";
|
|
|
- }
|
|
|
- MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == MerNo);
|
|
|
- if (forMerNo == null && pos.BrandId != 1 && pos.BrandId != 3)
|
|
|
- {
|
|
|
- return "商户编号不存在";
|
|
|
- }
|
|
|
- if (pos.BuyUserId != forMakerCode.UserId)
|
|
|
- {
|
|
|
- return "机具SN和创客不匹配";
|
|
|
- }
|
|
|
if (pos.ActivationState == 1)
|
|
|
{
|
|
|
return "机具已激活,不能解绑";
|
|
|
@@ -2182,13 +2288,64 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
return "该机具已交易,无法解绑";
|
|
|
}
|
|
|
- if (forMerNo != null)
|
|
|
+ if (pos.BrandId != 10 || pos.BrandId != 11)
|
|
|
{
|
|
|
- PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
- if (merchant != null)
|
|
|
+ if (string.IsNullOrEmpty(MakerCode))
|
|
|
{
|
|
|
+ return "请输入创客编号";
|
|
|
+ }
|
|
|
+ // if (string.IsNullOrEmpty(MerNo) && pos.BrandId != 1 && pos.BrandId != 3)
|
|
|
+ if (string.IsNullOrEmpty(MerNo))
|
|
|
+ {
|
|
|
+ return "请输入商户编号";
|
|
|
+ }
|
|
|
+ UserForMakerCode forMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
+ if (forMakerCode == null)
|
|
|
+ {
|
|
|
+ return "创客不存在";
|
|
|
+ }
|
|
|
+ MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == MerNo);
|
|
|
+ // if (forMerNo == null && pos.BrandId != 1 && pos.BrandId != 3)
|
|
|
+ if (forMerNo == null)
|
|
|
+ {
|
|
|
+ return "商户编号不存在";
|
|
|
+ }
|
|
|
+ if (pos.BuyUserId != forMakerCode.UserId)
|
|
|
+ {
|
|
|
+ return "机具SN和创客不匹配";
|
|
|
+ }
|
|
|
+ if (forMerNo != null)
|
|
|
+ {
|
|
|
+ PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
+ if (merchant != null)
|
|
|
+ {
|
|
|
+ //机具解绑删除客小爽企业版对应数据
|
|
|
+ var merInfo = db.BusinessPartnerMerchant.FirstOrDefault(m => m.MerchantId == merchant.Id);
|
|
|
+ if (merInfo != null)
|
|
|
+ {
|
|
|
+ db.BusinessPartnerMerchant.Remove(merInfo);
|
|
|
+ }
|
|
|
+ var posInfo = db.BusinessPartnerPos.FirstOrDefault(m => m.PosId == pos.Id);
|
|
|
+ if (posInfo != null)
|
|
|
+ {
|
|
|
+ db.BusinessPartnerPos.Remove(posInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ db.PosMerchantInfo.Remove(merchant);
|
|
|
+ }
|
|
|
+ db.MachineForMerNo.Remove(forMerNo);
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var posMerchantInfo = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
|
|
|
+ MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == MerNo);
|
|
|
+ if (forMerNo != null && posMerchantInfo != null)
|
|
|
+ {
|
|
|
+
|
|
|
//机具解绑删除客小爽企业版对应数据
|
|
|
- var merInfo = db.BusinessPartnerMerchant.FirstOrDefault(m => m.MerchantId == merchant.Id);
|
|
|
+ var merInfo = db.BusinessPartnerMerchant.FirstOrDefault(m => m.MerchantId == posMerchantInfo.Id);
|
|
|
if (merInfo != null)
|
|
|
{
|
|
|
db.BusinessPartnerMerchant.Remove(merInfo);
|
|
|
@@ -2199,10 +2356,10 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
db.BusinessPartnerPos.Remove(posInfo);
|
|
|
}
|
|
|
|
|
|
- db.PosMerchantInfo.Remove(merchant);
|
|
|
+ db.PosMerchantInfo.Remove(posMerchantInfo);
|
|
|
+ db.MachineForMerNo.Remove(forMerNo);
|
|
|
+ db.SaveChanges();
|
|
|
}
|
|
|
- db.MachineForMerNo.Remove(forMerNo);
|
|
|
- db.SaveChanges();
|
|
|
}
|
|
|
db.MachineUnBind.Add(new MachineUnBind()
|
|
|
{
|
|
|
@@ -4100,7 +4257,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
error += "以下操作失败" + OldSnNum + ',' + "该机具不在坏机仓或不存在" + '\n';
|
|
|
}
|
|
|
- if(!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
|
|
|
+ if (!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
|
|
|
{
|
|
|
opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
|
|
|
}
|
|
|
@@ -4151,7 +4308,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
return "Warning|" + error;
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
- foreach(string sub in opData)
|
|
|
+ foreach (string sub in opData)
|
|
|
{
|
|
|
string[] datalist = sub.Split(":");
|
|
|
PublicFunction.SycnMachineCount(int.Parse(datalist[0]), int.Parse(datalist[1]));
|
|
|
@@ -4412,8 +4569,8 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
var userMachineDatas = db.UserMachineData.FirstOrDefault(m => m.IdBrand == fInfo) ?? new UserMachineData();
|
|
|
userMachineDatas.TotalMachineCount -= 1;
|
|
|
userMachineDatas.UnBindCount -= 1;
|
|
|
-
|
|
|
- if(!opData.Contains(pos.BuyUserId + ":" + pos.BrandId))
|
|
|
+
|
|
|
+ if (!opData.Contains(pos.BuyUserId + ":" + pos.BrandId))
|
|
|
{
|
|
|
opData.Add(pos.BuyUserId + ":" + pos.BrandId);
|
|
|
}
|
|
|
@@ -4498,7 +4655,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
- foreach(string sub in opData)
|
|
|
+ foreach (string sub in opData)
|
|
|
{
|
|
|
string[] datalist = sub.Split(":");
|
|
|
PublicFunction.SycnMachineCount(int.Parse(datalist[0]), int.Parse(datalist[1]));
|