Browse Source

调整,代码添加

DuGuYang 3 years ago
parent
commit
e427b85cc4

+ 71 - 133
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -4002,29 +4002,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;
+                    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, "划拨创客机具");
@@ -4157,88 +4157,6 @@ namespace MySystem.Areas.Admin.Controllers
         }
 
         [HttpPost]
-        public string BadPosToStoreDo(string OldSn)
-        {
-            string[] OldSnList;
-            OldSnList = OldSn.Replace("\r", "").Split('\n');
-            string error = "";
-            List<string> opData = new List<string>();
-            for (int i = 0; i < OldSnList.Length; i++)
-            {
-                string OldSnNum = OldSnList[i];
-                MachineForSnNo oldForSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == OldSnNum) ?? new MachineForSnNo();
-                PosMachinesTwo oldpos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == oldForSnNo.SnId) ?? new PosMachinesTwo();
-                if (!opData.Contains(oldpos.BuyUserId + ":" + oldpos.BrandId))
-                {
-                    opData.Add(oldpos.BuyUserId + ":" + oldpos.BrandId);
-                }
-                oldpos.Status = 1;
-                oldpos.PosSnType = 0;
-                oldpos.QueryCount = 0;
-                oldpos.UpdateDate = null;
-                oldpos.ActivityList = null;
-                oldpos.SeoKeyword = null;
-                oldpos.SeoDescription = null;
-                oldpos.OrderId = 0;
-                oldpos.RecycEndDate = null;
-                oldpos.RecycBackCount = 0;
-                oldpos.PrizeParams = null;
-                oldpos.ScanQrTrade = 0;
-                oldpos.BindMerchantId = 0;
-                oldpos.CreditTrade = 0;
-                oldpos.DebitCardTrade = 0;
-                oldpos.IsVip = 0;
-                oldpos.UserNav = null;
-                oldpos.TransferTime = null;
-                oldpos.IsPurchase = 0;
-                oldpos.Detail = null;
-                oldpos.BindingTime = null;
-                oldpos.BindingState = 0;
-                oldpos.ActivationTime = null;
-                oldpos.ActivationState = 0;
-                oldpos.LeaderUserId = 0;
-                oldpos.PreUserId = 0;
-                oldpos.IsFirst = 0;
-                oldpos.DownFeeMan = null;
-                oldpos.DownFeeFlag = 0;
-                oldpos.DownFeeDate = null;
-                oldpos.UpFeeMan = null;
-                oldpos.UpFeeFlag = 0;
-                oldpos.UpFeeDate = null;
-                oldpos.OpReserve1 = 0;
-                oldpos.OpReserve2 = 0;
-                oldpos.OpReserve3 = 0;
-                oldpos.OpId = 0;
-                oldpos.RecycStartDate = null;
-                oldpos.SourcePosSn = null;
-                oldpos.BuyUserId = 0;
-                oldpos.UserId = 0;
-                PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
-            }
-            if (!string.IsNullOrEmpty(error))
-            {
-                return "Warning|" + error;
-            }
-            db.SaveChanges();
-            foreach (string sub in opData)
-            {
-                string[] datalist = sub.Split(":");
-                PublicFunction.SycnMachineCount(int.Parse(datalist[0]), int.Parse(datalist[1]));
-            }
-            return "success";
-        }
-        #endregion
-
-        #region 划拨创客机具券
-
-        public IActionResult TransferPosCoupon(string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            return View();
-        }
-
         public string TransferPosCouponDo(string Kind, string PosCouponCodes, string FromMakerCode, string ToMakerCode, string LeaderMakerCode = "")
         {
             if (string.IsNullOrEmpty(Kind))
@@ -4299,39 +4217,59 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                     return "机具券" + PosCouponCode + "已使用";
                 }
+                if (item.QueryCount != int.Parse(Kind))
+                {
+                    return "机具券" + PosCouponCode + "类型和您选择的类型不同";
+                }
                 item.UserId = tUserId.Id;
                 if (LeaderUserId > 0 && item.LeaderUserId == 0)
                 {
                     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;
+                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 = int.Parse(Kind),
+                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;
+            PosCouponOrders tostat = db.PosCouponOrders.Add(new PosCouponOrders()
+            {
+                QueryCount = int.Parse(Kind),
+                CreateDate = DateTime.Now,
+                ChangeKind = 1,
+                ChangeCount = CouponCount,
+                // AfterOut = AfterOut,
+                // AfterTotal = AfterTotal,
+                // AfterStock = AfterStock,
+                // BeforeOut = BeforeOut,
+                // BeforeTotal = BeforeTotal,
+                // BeforeStock = BeforeStock,
+                OrderNo = ChangeRecordNo,
+                ToUserId = fUserId.Id,
+                FromUserId = tUserId.Id,
+            }).Entity;
             db.SaveChanges();
             db.Dispose();
 

+ 9 - 0
Areas/Admin/Views/MainServer/SysTools/TransferPosCoupon.cshtml

@@ -30,6 +30,15 @@
                         </ul>
                         <div class="layui-tab-content mt20">
                             <div class="layui-tab-item layui-show">
+                                <div class="layui-form-item">
+                                    <label class="layui-form-label">券类型</label>
+                                    <div class="layui-input-inline">
+                                        <select id="Kind" name="Kind" lay-search="">
+                                            <option value="1">电签券</option>
+                                            <option value="2">大POS券</option>
+                                        </select>
+                                    </div>
+                                </div>
                                 <div class="layui-form-item">
                                     <label class="layui-form-label">机具券码</label>
                                     <div class="layui-input-block">