|
@@ -1423,6 +1423,16 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
// oldpos.BuyUserId = 0;
|
|
// oldpos.BuyUserId = 0;
|
|
|
// oldpos.UserId = 0;
|
|
// oldpos.UserId = 0;
|
|
|
oldpos.Status = -1;
|
|
oldpos.Status = -1;
|
|
|
|
|
+
|
|
|
|
|
+ //对应调整客小爽企业版数据
|
|
|
|
|
+ var posInfo = db.BusinessPartnerPos.FirstOrDefault(m => m.PosId == oldpos.Id);
|
|
|
|
|
+ if (posInfo != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ posInfo.PosSn = newpos.PosSn;
|
|
|
|
|
+ posInfo.PosId = newpos.Id;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == merchant.KqMerNo);
|
|
MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == merchant.KqMerNo);
|
|
|
if (forMerNo != null)
|
|
if (forMerNo != null)
|
|
|
{
|
|
{
|
|
@@ -1491,271 +1501,420 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[HttpPost]
|
|
[HttpPost]
|
|
|
- public string ChangeBadPosDo(string OldSn, string NewSn, int IsSend = 0)
|
|
|
|
|
|
|
+ public string ChangeBadPosDo(string ChangeType, string MakerCode, string StoreCode, string OldSn, string NewSn, string FromStoreNo, string BackStoreNo, int IsSend = 0)
|
|
|
{
|
|
{
|
|
|
- if (string.IsNullOrEmpty(OldSn))
|
|
|
|
|
- {
|
|
|
|
|
- return "请输入原机具SN";
|
|
|
|
|
- }
|
|
|
|
|
- if (string.IsNullOrEmpty(NewSn))
|
|
|
|
|
- {
|
|
|
|
|
- return "请输入新机具SN";
|
|
|
|
|
- }
|
|
|
|
|
- string[] OldSnList = OldSn.Split('\n');
|
|
|
|
|
- string[] NewSnList = NewSn.Split('\n');
|
|
|
|
|
- if (OldSnList.Length != NewSnList.Length)
|
|
|
|
|
- {
|
|
|
|
|
- return "原机具SN数量和新机具SN数量不一致";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ string[] OldSnList;
|
|
|
|
|
+ string[] NewSnList;
|
|
|
decimal amount = 0;
|
|
decimal amount = 0;
|
|
|
- for (int i = 0; i < OldSnList.Length; i++)
|
|
|
|
|
|
|
+ //创客坏机换新
|
|
|
|
|
+ if (ChangeType == "0")
|
|
|
{
|
|
{
|
|
|
- string OldSnNum = OldSnList[i];
|
|
|
|
|
- string NewSnNum = NewSnList[i];
|
|
|
|
|
- MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
|
|
|
|
|
- MachineForSnNo newForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == NewSnNum) ?? new MachineForSnNo();
|
|
|
|
|
- PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId && m.BindingState == 0);
|
|
|
|
|
- oldpos.Status = -1;
|
|
|
|
|
- var oldStore = db.StoreHouse.FirstOrDefault(m => m.Id == oldpos.StoreId);
|
|
|
|
|
- if (oldpos == null)
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(MakerCode))
|
|
|
{
|
|
{
|
|
|
- return "原机具SN不正确或者不符合换机条件";
|
|
|
|
|
|
|
+ return "请输入创客编号";
|
|
|
}
|
|
}
|
|
|
- PosMachinesTwo newpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == newForSnNo.SnId && m.BuyUserId == 0 && m.UserId == 0 && m.BindingState == 0);
|
|
|
|
|
- if (newpos == null)
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(OldSn))
|
|
|
{
|
|
{
|
|
|
- return "新机具SN不正确或者不为仓库机";
|
|
|
|
|
|
|
+ return "请输入坏机SN";
|
|
|
}
|
|
}
|
|
|
- if (oldpos.BrandId != newpos.BrandId)
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(NewSn))
|
|
|
{
|
|
{
|
|
|
- return "新机具和旧机具品牌不相同";
|
|
|
|
|
|
|
+ return "请输入新机SN";
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == newpos.BrandId) ?? new KqProducts();
|
|
|
|
|
- if (brandInfo.Name.Contains("大POS"))
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(FromStoreNo))
|
|
|
{
|
|
{
|
|
|
- amount = 300;
|
|
|
|
|
|
|
+ return "请输入新机发货仓库编号";
|
|
|
}
|
|
}
|
|
|
- if (brandInfo.Name.Contains("电签"))
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(BackStoreNo))
|
|
|
{
|
|
{
|
|
|
- amount = 200;
|
|
|
|
|
|
|
+ return "请输入坏机退回仓库编号";
|
|
|
}
|
|
}
|
|
|
- var storehouse = db.StoreHouse.FirstOrDefault(m => m.Id == newpos.StoreId) ?? new StoreHouse();
|
|
|
|
|
- storehouse.LaveNum -= 1;
|
|
|
|
|
- var userAcount = db.UserAccount.FirstOrDefault(m => m.Id == storehouse.UserId) ?? new UserAccount();
|
|
|
|
|
- if (oldpos.StoreId != newpos.StoreId)
|
|
|
|
|
|
|
+ OldSnList = OldSn.Split('\n');
|
|
|
|
|
+ NewSnList = NewSn.Split('\n');
|
|
|
|
|
+ if (OldSnList.Length != NewSnList.Length)
|
|
|
{
|
|
{
|
|
|
- userAcount.ValidAmount += amount;
|
|
|
|
|
- newpos.StoreId = oldpos.StoreId;
|
|
|
|
|
- newpos.BuyUserId = oldpos.BuyUserId;
|
|
|
|
|
- newpos.UserId = oldpos.UserId;
|
|
|
|
|
- newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
|
|
|
- newpos.PreUserId = oldpos.PreUserId;
|
|
|
|
|
- newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
- newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
|
|
+ return "原机具SN数量和新机具SN数量不一致";
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < OldSnList.Length; i++)
|
|
|
{
|
|
{
|
|
|
|
|
+ string OldSnNum = OldSnList[i];
|
|
|
|
|
+ string NewSnNum = NewSnList[i];
|
|
|
|
|
+ UserForMakerCode userForMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
|
|
|
|
|
+ StoreForCode storeForCodeFrom = db.StoreForCode.FirstOrDefault(m => m.Code == FromStoreNo) ?? new StoreForCode();
|
|
|
|
|
+ if (storeForCodeFrom.StoreId == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机发货仓库编号不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreForCode storeForCodeBack = db.StoreForCode.FirstOrDefault(m => m.Code == BackStoreNo) ?? new StoreForCode();
|
|
|
|
|
+ if (storeForCodeBack.StoreId == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的坏机退回仓库编号不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
|
|
|
|
|
+ MachineForSnNo newForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == NewSnNum) ?? new MachineForSnNo();
|
|
|
|
|
+ PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId && m.BindingState == 0 && m.BuyUserId == userForMakerCode.UserId) ?? new PosMachinesTwo();
|
|
|
|
|
+ if (oldpos.Id == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的坏机SN不存在或者不在" + MakerCode + "名下";
|
|
|
|
|
+ }
|
|
|
|
|
+ PosMachinesTwo newpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == newForSnNo.SnId && m.BindingState == 0) ?? new PosMachinesTwo();
|
|
|
|
|
+ if (newpos.Id == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机SN不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreHouse storeFrom = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCodeFrom.StoreId);
|
|
|
|
|
+ if (Convert.ToInt32(storeFrom.BrandId) != Convert.ToInt32(oldpos.BrandId))
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机发货仓库不符新机机具对应品牌";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (newpos.StoreId != storeFrom.Id)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机SN不在新机发货仓库";
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreHouse storeBack = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCodeBack.StoreId);
|
|
|
|
|
+ if (Convert.ToInt32(storeBack.BrandId) != Convert.ToInt32(oldpos.BrandId))
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的坏机退回仓库不符坏机机具对应品牌";
|
|
|
|
|
+ }
|
|
|
|
|
+ var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ if (brandInfo.Name.Contains("大POS"))
|
|
|
|
|
+ {
|
|
|
|
|
+ amount = 300;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (brandInfo.Name.Contains("电签"))
|
|
|
|
|
+ {
|
|
|
|
|
+ amount = 200;
|
|
|
|
|
+ }
|
|
|
|
|
+ // var storeUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == store.UserId) ?? new UserAccount();
|
|
|
|
|
+ var storeFromUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == storeFrom.UserId) ?? new UserAccount();
|
|
|
|
|
+ var storeBackUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == storeBack.UserId) ?? new UserAccount();
|
|
|
|
|
+ // storeUserAcount.ValidAmount += amount;
|
|
|
|
|
+ storeFromUserAcount.ValidAmount += amount;
|
|
|
|
|
+ storeBackUserAcount.ValidAmount -= amount;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
newpos.BuyUserId = oldpos.BuyUserId;
|
|
newpos.BuyUserId = oldpos.BuyUserId;
|
|
|
newpos.UserId = oldpos.UserId;
|
|
newpos.UserId = oldpos.UserId;
|
|
|
|
|
+ newpos.RecycEndDate = oldpos.RecycEndDate;
|
|
|
|
|
+ newpos.ScanQrTrade = oldpos.ScanQrTrade;
|
|
|
|
|
+ newpos.DebitCardTrade = oldpos.DebitCardTrade;
|
|
|
|
|
+ newpos.CreditTrade = oldpos.CreditTrade;
|
|
|
|
|
+ newpos.PosSnType = oldpos.PosSnType;
|
|
|
|
|
+ newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
+ newpos.IsPurchase = oldpos.IsPurchase;
|
|
|
|
|
+ newpos.BindingState = oldpos.BindingState;
|
|
|
|
|
+ newpos.ActivationState = oldpos.ActivationState;
|
|
|
|
|
+ newpos.BindingTime = oldpos.BindingTime;
|
|
|
|
|
+ newpos.ActivationTime = oldpos.ActivationTime;
|
|
|
|
|
+ newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
+ newpos.SeoKeyword = oldpos.SeoKeyword;
|
|
|
|
|
+ newpos.PrizeParams = oldpos.PrizeParams;
|
|
|
newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
|
|
|
+
|
|
|
|
|
+ newpos.StoreId = oldpos.StoreId;
|
|
|
|
|
+ newpos.UserId = oldpos.UserId;
|
|
|
newpos.PreUserId = oldpos.PreUserId;
|
|
newpos.PreUserId = oldpos.PreUserId;
|
|
|
- newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
- newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
- }
|
|
|
|
|
- db.SaveChanges();
|
|
|
|
|
|
|
|
|
|
- var oldPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
- var newPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == newpos.BrandId) ?? new KqProducts();
|
|
|
|
|
- var UserId = 0;
|
|
|
|
|
- if (oldpos.BuyUserId == 0)
|
|
|
|
|
|
|
+ oldpos.StoreId = storeBack.Id;
|
|
|
|
|
+ oldpos.BuyUserId = 0;
|
|
|
|
|
+ oldpos.UserId = 0;
|
|
|
|
|
+ oldpos.Status = -1;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+
|
|
|
|
|
+ BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
|
|
|
|
|
+ {
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
+ CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
+ ChangeNo = "BPC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(3), //转换单号
|
|
|
|
|
+ OutStoreId = storeFrom.Id,
|
|
|
|
|
+ BackStoreId = storeBack.Id,
|
|
|
|
|
+ OutProductType = newpos.BrandId,
|
|
|
|
|
+ BackProductType = oldpos.BrandId,
|
|
|
|
|
+ UserId = userForMakerCode.UserId, //创客
|
|
|
|
|
+ }).Entity;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+ BrokenMachineChangeDetail adds = db.BrokenMachineChangeDetail.Add(new BrokenMachineChangeDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
+ CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
+ OutSnNo = OldSnNum,
|
|
|
|
|
+ BackSnNo = NewSnNum,
|
|
|
|
|
+ ChangeNo = add.ChangeNo, //转换单号
|
|
|
|
|
+ ChangeId = add.Id, //转换记录Id
|
|
|
|
|
+ UserId = add.UserId, //创客
|
|
|
|
|
+ }).Entity;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+ var oldPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ if (IsSend == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
|
|
+ {
|
|
|
|
|
+ UserId = userForMakerCode.UserId, //接收创客
|
|
|
|
|
+ MsgType = 2,
|
|
|
|
|
+ Title = "坏机换新成功通知", //标题
|
|
|
|
|
+ Summary = "您的坏机 " + oldPosBrand.Name + " SN:" + OldSnNum + "已经成功为您换为" + oldPosBrand.Name + "SN:" + NewSnNum + "。",
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
+
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //仓库坏机换新
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (string.IsNullOrEmpty(StoreCode))
|
|
|
{
|
|
{
|
|
|
- UserId = oldStore.UserId;
|
|
|
|
|
|
|
+ return "请输入仓库编号";
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(OldSn))
|
|
|
{
|
|
{
|
|
|
- UserId = oldpos.BuyUserId;
|
|
|
|
|
|
|
+ return "请输入坏机SN";
|
|
|
}
|
|
}
|
|
|
- BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
|
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(NewSn))
|
|
|
{
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
|
|
- CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
- ChangeNo = "BPC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(3), //转换单号
|
|
|
|
|
- UserId = UserId, //创客
|
|
|
|
|
- }).Entity;
|
|
|
|
|
- db.SaveChanges();
|
|
|
|
|
- BrokenMachineChangeDetail adds = db.BrokenMachineChangeDetail.Add(new BrokenMachineChangeDetail()
|
|
|
|
|
|
|
+ return "请输入新机SN";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (string.IsNullOrEmpty(FromStoreNo))
|
|
|
{
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
|
|
- CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
- OutSnNo = OldSnNum,
|
|
|
|
|
- BackSnNo = NewSnNum,
|
|
|
|
|
- ChangeNo = add.ChangeNo, //转换单号
|
|
|
|
|
- ChangeId = add.Id, //转换记录Id
|
|
|
|
|
- UserId = add.UserId, //创客
|
|
|
|
|
- }).Entity;
|
|
|
|
|
- db.SaveChanges();
|
|
|
|
|
- if (IsSend == 1)
|
|
|
|
|
|
|
+ return "请输入新机发货仓库编号";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (string.IsNullOrEmpty(BackStoreNo))
|
|
|
{
|
|
{
|
|
|
- RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
|
|
|
|
+ return "请输入坏机退回仓库编号";
|
|
|
|
|
+ }
|
|
|
|
|
+ OldSnList = OldSn.Split('\n');
|
|
|
|
|
+ NewSnList = NewSn.Split('\n');
|
|
|
|
|
+ if (OldSnList.Length != NewSnList.Length)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "原机具SN数量和新机具SN数量不一致";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < OldSnList.Length; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ string OldSnNum = OldSnList[i];
|
|
|
|
|
+ string NewSnNum = NewSnList[i];
|
|
|
|
|
+ StoreHouse store = new StoreHouse();
|
|
|
|
|
+ StoreForCode storeForBadCode = db.StoreForCode.FirstOrDefault(m => m.Code == StoreCode) ?? new StoreForCode();
|
|
|
|
|
+ if (storeForBadCode.StoreId > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ store = db.StoreHouse.FirstOrDefault(m => m.Id == storeForBadCode.StoreId);
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreForCode storeForCodeFrom = db.StoreForCode.FirstOrDefault(m => m.Code == FromStoreNo) ?? new StoreForCode();
|
|
|
|
|
+ if (storeForCodeFrom.StoreId == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机发货仓库编号不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreForCode storeForCodeBack = db.StoreForCode.FirstOrDefault(m => m.Code == BackStoreNo) ?? new StoreForCode();
|
|
|
|
|
+ if (storeForCodeBack.StoreId == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的坏机退回仓库编号不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
|
|
|
|
|
+ MachineForSnNo newForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == NewSnNum) ?? new MachineForSnNo();
|
|
|
|
|
+ PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId && m.BindingState == 0 && m.StoreId == storeForBadCode.StoreId) ?? new PosMachinesTwo();
|
|
|
|
|
+ if (oldpos.Id == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的坏机SN不存在或者不在仓库" + StoreCode + "中";
|
|
|
|
|
+ }
|
|
|
|
|
+ PosMachinesTwo newpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == newForSnNo.SnId && m.BindingState == 0) ?? new PosMachinesTwo();
|
|
|
|
|
+ if (newpos.Id == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机SN不存在";
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreHouse storeFrom = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCodeFrom.StoreId);
|
|
|
|
|
+ if (Convert.ToInt32(storeFrom.BrandId) != Convert.ToInt32(oldpos.BrandId))
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机发货仓库不符新机机具对应品牌";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (newpos.StoreId != storeFrom.Id)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的新机SN不在新机发货仓库";
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreHouse storeBack = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCodeBack.StoreId);
|
|
|
|
|
+ if (Convert.ToInt32(storeBack.BrandId) != Convert.ToInt32(oldpos.BrandId))
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的坏机退回仓库不符坏机机具对应品牌";
|
|
|
|
|
+ }
|
|
|
|
|
+ var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ if (brandInfo.Name.Contains("大POS"))
|
|
|
|
|
+ {
|
|
|
|
|
+ amount = 300;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (brandInfo.Name.Contains("电签"))
|
|
|
|
|
+ {
|
|
|
|
|
+ amount = 200;
|
|
|
|
|
+ }
|
|
|
|
|
+ var storeUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == store.UserId) ?? new UserAccount();
|
|
|
|
|
+ var storeFromUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == storeFrom.UserId) ?? new UserAccount();
|
|
|
|
|
+ var storeBackUserAcount = db.UserAccount.FirstOrDefault(m => m.Id == storeBack.UserId) ?? new UserAccount();
|
|
|
|
|
+ // storeUserAcount.ValidAmount += amount;
|
|
|
|
|
+ storeFromUserAcount.ValidAmount += amount;
|
|
|
|
|
+ storeBackUserAcount.ValidAmount -= amount;
|
|
|
|
|
+ newpos.StoreId = oldpos.StoreId;
|
|
|
|
|
+ newpos.BuyUserId = oldpos.BuyUserId;
|
|
|
|
|
+ newpos.UserId = oldpos.UserId;
|
|
|
|
|
+ newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
|
|
|
+ newpos.PreUserId = oldpos.PreUserId;
|
|
|
|
|
+ newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
+ newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
+
|
|
|
|
|
+ oldpos.StoreId = storeBack.Id;
|
|
|
|
|
+ oldpos.BuyUserId = 0;
|
|
|
|
|
+ oldpos.UserId = 0;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+
|
|
|
|
|
+ BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
|
|
|
|
|
+ {
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
+ CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
+ ChangeNo = "BPC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(3), //转换单号
|
|
|
|
|
+ OutStoreId = storeFrom.Id,
|
|
|
|
|
+ BackStoreId = storeBack.Id,
|
|
|
|
|
+ OutProductType = newpos.BrandId,
|
|
|
|
|
+ BackProductType = oldpos.BrandId,
|
|
|
|
|
+ UserId = store.UserId, //创客
|
|
|
|
|
+ }).Entity;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+ BrokenMachineChangeDetail adds = db.BrokenMachineChangeDetail.Add(new BrokenMachineChangeDetail()
|
|
|
{
|
|
{
|
|
|
- UserId = UserId, //接收创客
|
|
|
|
|
- MsgType = 2,
|
|
|
|
|
- Title = "坏机换新成功通知", //标题
|
|
|
|
|
- Summary = "您的坏机 " + oldPosBrand.Name + " SN:" + OldSn + "已经成功为您换为" + newPosBrand.Name + "SN:" + NewSn + "。",
|
|
|
|
|
CreateDate = DateTime.Now,
|
|
CreateDate = DateTime.Now,
|
|
|
|
|
+ CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
+ OutSnNo = OldSnNum,
|
|
|
|
|
+ BackSnNo = NewSnNum,
|
|
|
|
|
+ ChangeNo = add.ChangeNo, //转换单号
|
|
|
|
|
+ ChangeId = add.Id, //转换记录Id
|
|
|
|
|
+ UserId = add.UserId, //创客
|
|
|
|
|
+ }).Entity;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+ var oldPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ if (IsSend == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
|
|
+ {
|
|
|
|
|
+ UserId = store.UserId, //接收创客
|
|
|
|
|
+ MsgType = 2,
|
|
|
|
|
+ Title = "坏机换新成功通知", //标题
|
|
|
|
|
+ Summary = "您的坏机 " + oldPosBrand.Name + " SN:" + OldSnNum + "已经成功为您换为" + oldPosBrand.Name + "SN:" + NewSnNum + "。",
|
|
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ }));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // for (int i = 0; i < OldSnList.Length; i++)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // string OldSnNum = OldSnList[i];
|
|
|
|
|
+ // string NewSnNum = NewSnList[i];
|
|
|
|
|
+ // StoreForCode storeForCode = db.StoreForCode.FirstOrDefault(m => m.Code == BackStoreNo) ?? new StoreForCode();
|
|
|
|
|
+ // MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
|
|
|
|
|
+ // MachineForSnNo newForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == NewSnNum) ?? new MachineForSnNo();
|
|
|
|
|
+ // StoreHouse oldStore = new StoreHouse();
|
|
|
|
|
+ // PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId && m.BindingState == 0);
|
|
|
|
|
+ // if (storeForCode.StoreId > 0)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == storeForCode.StoreId);
|
|
|
|
|
+ // if (Convert.ToInt32(store.BrandId) != Convert.ToInt32(oldpos.BrandId))
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "您输入的仓库不符机具对应品牌";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // oldStore = db.StoreHouse.FirstOrDefault(m => m.Id == oldpos.StoreId);
|
|
|
|
|
+ // oldpos.Status = -1;
|
|
|
|
|
+ // oldpos.StoreId = store.Id;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (oldpos == null)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "原机具SN不正确或者不符合换机条件";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // PosMachinesTwo newpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == newForSnNo.SnId && m.BuyUserId == 0 && m.UserId == 0 && m.BindingState == 0);
|
|
|
|
|
+ // if (newpos == null)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "新机具SN不正确或者不为仓库机";
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (oldpos.BrandId != newpos.BrandId)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // return "新机具和旧机具品牌不相同";
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ // var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == newpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ // if (brandInfo.Name.Contains("大POS"))
|
|
|
|
|
+ // {
|
|
|
|
|
+ // amount = 300;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // if (brandInfo.Name.Contains("电签"))
|
|
|
|
|
+ // {
|
|
|
|
|
+ // amount = 200;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // var storehouse = db.StoreHouse.FirstOrDefault(m => m.Id == newpos.StoreId) ?? new StoreHouse();
|
|
|
|
|
+ // storehouse.LaveNum -= 1;
|
|
|
|
|
+ // var userAcount = db.UserAccount.FirstOrDefault(m => m.Id == storehouse.UserId) ?? new UserAccount();
|
|
|
|
|
+ // if (oldpos.StoreId != newpos.StoreId)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // userAcount.ValidAmount += amount;
|
|
|
|
|
+ // newpos.StoreId = oldpos.StoreId;
|
|
|
|
|
+ // newpos.BuyUserId = oldpos.BuyUserId;
|
|
|
|
|
+ // newpos.UserId = oldpos.UserId;
|
|
|
|
|
+ // newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
|
|
|
+ // newpos.PreUserId = oldpos.PreUserId;
|
|
|
|
|
+ // newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
+ // newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // newpos.BuyUserId = oldpos.BuyUserId;
|
|
|
|
|
+ // newpos.UserId = oldpos.UserId;
|
|
|
|
|
+ // newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
|
|
|
+ // newpos.PreUserId = oldpos.PreUserId;
|
|
|
|
|
+ // newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
+ // newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // db.SaveChanges();
|
|
|
|
|
+
|
|
|
|
|
+ // var oldPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ // var newPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == newpos.BrandId) ?? new KqProducts();
|
|
|
|
|
+ // var UserId = 0;
|
|
|
|
|
+ // if (oldpos.BuyUserId == 0)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // UserId = oldStore.UserId;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // else
|
|
|
|
|
+ // {
|
|
|
|
|
+ // UserId = oldpos.BuyUserId;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
|
|
+ // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
+ // ChangeNo = "BPC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(3), //转换单号
|
|
|
|
|
+ // UserId = UserId, //创客
|
|
|
|
|
+ // }).Entity;
|
|
|
|
|
+ // db.SaveChanges();
|
|
|
|
|
+ // BrokenMachineChangeDetail adds = db.BrokenMachineChangeDetail.Add(new BrokenMachineChangeDetail()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
|
|
+ // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
+ // OutSnNo = OldSnNum,
|
|
|
|
|
+ // BackSnNo = NewSnNum,
|
|
|
|
|
+ // ChangeNo = add.ChangeNo, //转换单号
|
|
|
|
|
+ // ChangeId = add.Id, //转换记录Id
|
|
|
|
|
+ // UserId = add.UserId, //创客
|
|
|
|
|
+ // }).Entity;
|
|
|
|
|
+ // db.SaveChanges();
|
|
|
|
|
+ // if (IsSend == 1)
|
|
|
|
|
+ // {
|
|
|
|
|
+ // RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
|
|
+ // {
|
|
|
|
|
+ // UserId = UserId, //接收创客
|
|
|
|
|
+ // MsgType = 2,
|
|
|
|
|
+ // Title = "坏机换新成功通知", //标题
|
|
|
|
|
+ // Summary = "您的坏机 " + oldPosBrand.Name + " SN:" + OldSn + "已经成功为您换为" + newPosBrand.Name + "SN:" + NewSn + "。",
|
|
|
|
|
+ // CreateDate = DateTime.Now,
|
|
|
|
|
+
|
|
|
|
|
+ // }));
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
return "success";
|
|
return "success";
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // public string ChangeBadPosDo(string OldSn, string NewSn, string BackStoreNo, string OutStoreNo, string MakerCode = "", int IsSend = 0)
|
|
|
|
|
- // {
|
|
|
|
|
- // if (string.IsNullOrEmpty(OldSn))
|
|
|
|
|
- // {
|
|
|
|
|
- // return "请输入原机具SN";
|
|
|
|
|
- // }
|
|
|
|
|
- // if (string.IsNullOrEmpty(NewSn))
|
|
|
|
|
- // {
|
|
|
|
|
- // return "请输入新机具SN";
|
|
|
|
|
- // }
|
|
|
|
|
- // string[] OldSnList = OldSn.Split('\n');
|
|
|
|
|
- // string[] NewSnList = NewSn.Split('\n');
|
|
|
|
|
- // if (OldSnList.Length != NewSnList.Length)
|
|
|
|
|
- // {
|
|
|
|
|
- // return "原机具SN数量和新机具SN数量不一致";
|
|
|
|
|
- // }
|
|
|
|
|
- // WebCMSEntities db = new WebCMSEntities();
|
|
|
|
|
- // PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == OldSn);
|
|
|
|
|
- // StoreForCode storeForBack = db.StoreForCode.FirstOrDefault(m => m.Code == BackStoreNo) ?? new StoreForCode();
|
|
|
|
|
- // StoreForCode storeForOut = db.StoreForCode.FirstOrDefault(m => m.Code == OutStoreNo) ?? new StoreForCode();
|
|
|
|
|
- // StoreHouse BackStore = db.StoreHouse.FirstOrDefault(m => m.Id == storeForBack.StoreId) ?? new StoreHouse();
|
|
|
|
|
- // StoreHouse OutStore = db.StoreHouse.FirstOrDefault(m => m.Id == storeForOut.StoreId) ?? new StoreHouse();
|
|
|
|
|
- // string ChangeNo = "BPC" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(3);
|
|
|
|
|
- // KqProducts oldPosBrand = new KqProducts();
|
|
|
|
|
- // KqProducts newPosBrand = new KqProducts();
|
|
|
|
|
- // MachineChange add = db.MachineChange.Add(new MachineChange()
|
|
|
|
|
- // {
|
|
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
|
|
- // UpdateDate = DateTime.Now,
|
|
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
- // ChangeNo = ChangeNo, //转换单号
|
|
|
|
|
- // UserId = 0, //创客
|
|
|
|
|
- // ChangeTime = DateTime.Now, //转换时间
|
|
|
|
|
- // BackStoreId = BackStore.Id, //退回仓库
|
|
|
|
|
- // BackStoreName = BackStore.StoreName, //退回仓库名称
|
|
|
|
|
- // Remark = "坏机换新", //订单备注
|
|
|
|
|
- // BackStoreUserId = BackStore.UserId, //退回仓库归属人
|
|
|
|
|
- // OutProductType = int.Parse(OutStore.BrandId), //出库产品类型
|
|
|
|
|
- // OutProductName = OutStore.ProductName, //出库产品名称
|
|
|
|
|
- // OutStoreId = OutStore.Id, //出库仓库
|
|
|
|
|
- // OutStoreName = OutStore.StoreName, //出库仓库名称
|
|
|
|
|
- // OutStoreAreas = OutStore.Areas, //出库仓库所在地区
|
|
|
|
|
- // OutStoreAddress = OutStore.Address, //出库仓库地址
|
|
|
|
|
- // OutStoreManager = "", //出库仓库联系人
|
|
|
|
|
- // OutStoreManagerMobile = OutStore.ManageMobile, //出库仓库联系人手机号
|
|
|
|
|
- // }).Entity;
|
|
|
|
|
- // db.SaveChanges();
|
|
|
|
|
- // int BackProductType = 0;
|
|
|
|
|
- // string BackProductName = "";
|
|
|
|
|
- // string ChangeDeviceName = "";
|
|
|
|
|
- // string ChangeSnExpand = "";
|
|
|
|
|
- // for (int i = 0; i < OldSnList.Length; i++)
|
|
|
|
|
- // {
|
|
|
|
|
- // string OldSnNum = OldSnList[i];
|
|
|
|
|
- // string NewSnNum = NewSnList[i];
|
|
|
|
|
- // MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
|
|
|
|
|
- // MachineForSnNo newForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == NewSnNum) ?? new MachineForSnNo();
|
|
|
|
|
- // PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId);
|
|
|
|
|
- // if (oldpos == null)
|
|
|
|
|
- // {
|
|
|
|
|
- // return "原机具SN不正确";
|
|
|
|
|
- // }
|
|
|
|
|
- // PosMachinesTwo newpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == newForSnNo.SnId);
|
|
|
|
|
- // if (newpos == null)
|
|
|
|
|
- // {
|
|
|
|
|
- // return "新机具SN不正确";
|
|
|
|
|
- // }
|
|
|
|
|
- // oldPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == oldpos.BrandId) ?? new KqProducts();
|
|
|
|
|
- // newPosBrand = db.KqProducts.FirstOrDefault(m => m.Id == newpos.BrandId) ?? new KqProducts();
|
|
|
|
|
- // Users user = new Users();
|
|
|
|
|
- // if (!string.IsNullOrEmpty(MakerCode))
|
|
|
|
|
- // {
|
|
|
|
|
- // UserForMakerCode userForMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
|
|
|
|
|
- // user = db.Users.FirstOrDefault(m => m.Id == userForMakerCode.UserId) ?? new Users();
|
|
|
|
|
- // }
|
|
|
|
|
- // else
|
|
|
|
|
- // {
|
|
|
|
|
- // user = db.Users.FirstOrDefault(m => m.Id == oldpos.UserId) ?? new Users();
|
|
|
|
|
- // }
|
|
|
|
|
- // newpos.BuyUserId = oldpos.BuyUserId;
|
|
|
|
|
- // newpos.UserId = oldpos.UserId;
|
|
|
|
|
- // newpos.RecycEndDate = oldpos.RecycEndDate;
|
|
|
|
|
- // newpos.ScanQrTrade = oldpos.ScanQrTrade;
|
|
|
|
|
- // newpos.DebitCardTrade = oldpos.DebitCardTrade;
|
|
|
|
|
- // newpos.CreditTrade = oldpos.CreditTrade;
|
|
|
|
|
- // newpos.PosSnType = oldpos.PosSnType;
|
|
|
|
|
- // newpos.TransferTime = oldpos.TransferTime;
|
|
|
|
|
- // newpos.IsPurchase = oldpos.IsPurchase;
|
|
|
|
|
- // newpos.BindingState = oldpos.BindingState;
|
|
|
|
|
- // newpos.ActivationState = oldpos.ActivationState;
|
|
|
|
|
- // newpos.BindingTime = oldpos.BindingTime;
|
|
|
|
|
- // newpos.ActivationTime = oldpos.ActivationTime;
|
|
|
|
|
- // newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
- // newpos.SeoKeyword = oldpos.SeoKeyword;
|
|
|
|
|
- // newpos.PrizeParams = oldpos.PrizeParams;
|
|
|
|
|
- // newpos.LeaderUserId = oldpos.LeaderUserId;
|
|
|
|
|
- // newpos.IsFirst = oldpos.IsFirst;
|
|
|
|
|
- // oldpos.Status = -1;
|
|
|
|
|
- // db.MachineChangeDetail.Add(new MachineChangeDetail()
|
|
|
|
|
- // {
|
|
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
|
|
- // CreateMan = SysUserName + "-" + SysRealName,
|
|
|
|
|
- // ChangeNo = ChangeNo, //订单号
|
|
|
|
|
- // ChangeId = add.Id, //订单Id
|
|
|
|
|
- // BackProductType = oldpos.BrandId, //退回产品类型
|
|
|
|
|
- // BackProductName = oldPosBrand.Name, //退回产品名称
|
|
|
|
|
- // UserId = 0, //创客
|
|
|
|
|
- // BackSnNo = oldpos.PosSn, //设备SN编号
|
|
|
|
|
- // OutProductType = newpos.BrandId, //出库产品类型
|
|
|
|
|
- // OutProductName = newPosBrand.Name, //出库产品名称
|
|
|
|
|
- // OutSnNo = newpos.PosSn, //出库设备SN编号
|
|
|
|
|
- // OutSnType = newpos.PosSnType, //出库SN机具类型
|
|
|
|
|
- // Remark = "坏机换新", //备注
|
|
|
|
|
- // BackSnType = oldpos.PosSnType, //退回SN机具类型
|
|
|
|
|
- // });
|
|
|
|
|
- // db.SaveChanges();
|
|
|
|
|
- // BackProductType = oldpos.BrandId;
|
|
|
|
|
- // BackProductName = newPosBrand.Name;
|
|
|
|
|
- // ChangeDeviceName = oldpos.DeviceName;
|
|
|
|
|
- // ChangeSnExpand += oldpos.PosSn + "\n";
|
|
|
|
|
- // PublicFunction.SycnMachineCount(oldpos.BuyUserId, oldpos.BrandId);
|
|
|
|
|
- // }
|
|
|
|
|
- // add.BackProductType = BackProductType; //退回产品类型
|
|
|
|
|
- // add.BackProductName = BackProductName; //退回产品名称
|
|
|
|
|
- // add.ChangeDeviceName = ChangeDeviceName; //转换机具名称
|
|
|
|
|
- // add.ChangeDeviceNum = OldSnList.Length; //转换机具数量
|
|
|
|
|
- // add.ChangeSnExpand = ChangeSnExpand; //机具SN
|
|
|
|
|
- // BackStore.LaveNum += OldSnList.Length; //退回仓库库存
|
|
|
|
|
- // OutStore.LaveNum -= OldSnList.Length; //出货仓库库存
|
|
|
|
|
- // db.SaveChanges();
|
|
|
|
|
- // db.Dispose();
|
|
|
|
|
- // if (IsSend == 1)
|
|
|
|
|
- // {
|
|
|
|
|
- // RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
|
|
|
|
|
- // {
|
|
|
|
|
- // UserId = pos.BuyUserId, //接收创客
|
|
|
|
|
- // MsgType = 2,
|
|
|
|
|
- // Title = "坏机换新成功通知", //标题
|
|
|
|
|
- // Summary = "您的 " + oldPosBrand.Name + " SN:" + OldSn + "已经成功为您换为" + newPosBrand.Name + "SN:" + NewSn + "。",
|
|
|
|
|
- // CreateDate = DateTime.Now,
|
|
|
|
|
-
|
|
|
|
|
- // }));
|
|
|
|
|
- // }
|
|
|
|
|
- // return "success";
|
|
|
|
|
- // }
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
@@ -1829,6 +1988,18 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
if (merchant != null)
|
|
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.PosMerchantInfo.Remove(merchant);
|
|
|
}
|
|
}
|
|
|
db.MachineForMerNo.Remove(forMerNo);
|
|
db.MachineForMerNo.Remove(forMerNo);
|