Просмотр исходного кода

增加分仓向总仓申请机具的数据表和字段

lichunlei 4 лет назад
Родитель
Сommit
1933e3e2a4

+ 778 - 778
Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs

@@ -1,779 +1,779 @@
-using System;
-using System.Web;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-using MySystem.Models;
-using Library;
-using LitJson;
-using MySystemLib;
-
-/// <summary>
-/// 机具申请记录
-/// </summary>
-namespace MySystem.Areas.Admin.Controllers
-{
-    [Area("Admin")]
-    [Route("Admin/[controller]/[action]")]
-    public class StoreMachineApplyController : BaseController
-    {
-        public StoreMachineApplyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
-        {
-            OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
-        }
-
-        #region 机具申请记录列表
-
-        /// <summary>
-        /// 机具申请记录列表
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Index(StoreMachineApply data, string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            return View();
-        }
-
-        #endregion
-
-        #region 根据条件查询机具申请记录列表
-
-        /// <summary>
-        /// 机具申请记录列表
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult IndexData(StoreMachineApply data, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string SendStatusSelect, string StoreTypeSelect, int page = 1, int limit = 30)
-        {
-
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Fields.Add("ApplyNo", "1"); //申请单号
-            Fields.Add("BrandId", "1"); //品牌
-            Fields.Add("ExpressNo", "1"); //快递单号
-
-            string condition = " and Status>-1";
-            //创客编号
-            if (!string.IsNullOrEmpty(MakerCode))
-            {
-                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
-            }
-            //创客名称
-            if (!string.IsNullOrEmpty(RealName))
-            {
-                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
-            }
-            //仓库编号
-            if (!string.IsNullOrEmpty(StoreNo))
-            {
-                condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreNo + "')";
-            }
-            //仓库名称
-            if (!string.IsNullOrEmpty(StoreName))
-            {
-                condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreName + "')";
-            }
-            //仓库归属创客编号
-            if (!string.IsNullOrEmpty(StoreMakerCode))
-            {
-                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
-            }
-            //订单状态
-            if (!string.IsNullOrEmpty(StatusSelect))
-            {
-                condition += " and Status=" + StatusSelect;
-            }
-            //发货状态
-            if (!string.IsNullOrEmpty(SendStatusSelect))
-            {
-                condition += " and SendStatus=" + SendStatusSelect;
-            }
-            //仓库类型
-            if (!string.IsNullOrEmpty(StoreTypeSelect))
-            {
-                condition += " and StoreType=" + StoreTypeSelect;
-            }
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreMachineApply", Fields, "Id desc", "0", page, limit, condition);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            foreach (Dictionary<string, object> dic in diclist)
-            {
-                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
-
-                //申请仓库信息
-                int StoreId = int.Parse(dic["StoreId"].ToString());
-                StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-                dic["StoreInfo"] = store.StoreNo + "<br />" + store.StoreName;
-
-                //仓库收货地址
-                dic["StoreAddressInfo"] = store.Areas + "<br />" + store.Address;
-
-                //仓库联系人信息
-                //dic["StoreContact"] = dic["StoreManagerMobile"].ToString() + "<br />" + dic["StoreManager"].ToString();
-
-                //仓库归属信息
-                // int StoreUserId = int.Parse(dic["StoreUserId"].ToString());
-                // Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
-                // int StoreType = int.Parse(dic["StoreType"].ToString());
-                // string StoreTypeName = "";
-                // if(StoreType == 0) StoreTypeName = "总仓";
-                // if(StoreType == 1) StoreTypeName = "分仓";
-                // dic["StoreUser"] = storeUser.MakerCode + "<br />" + StoreTypeName;
-
-                //创客信息
-                int UserId = int.Parse(dic["UserId"].ToString());
-                Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-                dic["UserInfo"] = puser.MakerCode + "<br />" + puser.RealName;
-
-                //顶级创客
-                // int TopUserId = int.Parse(dic["TopUserId"].ToString());
-                // Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
-                // dic["TopUserInfo"] = tuser.MakerCode + "<br />" + tuser.RealName;
-
-                //申请状态
-                int Status = int.Parse(dic["Status"].ToString());
-                if (Status == 0) dic["Status"] = "待审核";
-                if (Status == 1) dic["Status"] = "申请成功";
-                if (Status == 2) dic["Status"] = "申请失败";
-            }
-            Dictionary<string, object> other = new Dictionary<string, object>();
-            other.Add("ApplyNum", 0);
-            other.Add("SendNum", 0);
-            obj.Add("other", other);
-            return Json(obj);
-        }
-
-        #endregion
-
-        #region 增加机具申请记录
-
-        /// <summary>
-        /// 增加或修改机具申请记录信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Add(string right)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            return View();
-        }
-
-        #endregion
-
-        #region 增加机具申请记录
-
-        /// <summary>
-        /// 增加或修改机具申请记录信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Add(StoreMachineApply data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-
-            Fields.Add("SeoTitle", data.SeoTitle);
-            Fields.Add("SeoKeyword", data.SeoKeyword);
-            Fields.Add("SeoDescription", data.SeoDescription);
-            int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreMachineApply", Fields, 0);
-            AddSysLog(data.Id.ToString(), "StoreMachineApply", "add");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 修改机具申请记录信息
-
-        /// <summary>
-        /// 增加或修改机具申请记录信息
-        /// </summary>
-        /// <returns></returns>
-        public IActionResult Edit(string right, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-            StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
-            ViewBag.data = editData;
-
-            KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == editData.BrandId);
-            ViewBag.BrandName = kqProducts.Name;
-
-            Users user = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
-            ViewBag.MakerCode = user.MakerCode;
-            ViewBag.RealName = user.RealName;
-
-            int Status = editData.Status;
-            if (Status == 0) ViewBag.Status = "待审核";
-            if (Status == 1) ViewBag.Status = "申请成功";
-            if (Status == 2) ViewBag.Status = "申请失败";
-            return View();
-        }
-
-        #endregion
-
-        #region 修改机具申请记录
-
-        /// <summary>
-        /// 增加或修改机具申请记录信息
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost]
-        public string Edit(StoreMachineApply data)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-
-            Fields.Add("ApplyNo", data.ApplyNo); //申请单号
-            // Fields.Add("BrandId", data.BrandId); //产品Id
-            Fields.Add("ApplyNum", data.ApplyNum); //申请箱数
-            Fields.Add("SendNum", data.SendNum); //发货箱数
-            // Fields.Add("UserId", data.UserId); //创客ID
-            Fields.Add("Status", data.Status); //申请状态
-            Fields.Add("SwapSnExpand", data.SwapSnExpand);//已发货机具SN
-            Fields.Add("SeoDescription", data.SeoDescription); //申请描述
-
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "StoreMachineApply", "update");
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 删除机具申请记录信息
-
-        /// <summary>
-        /// 删除机具申请记录信息
-        /// </summary>
-        /// <returns></returns>
-        public string Delete(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "StoreMachineApply", "del");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", -1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
-            }
-            db.SaveChanges();
-
-            return "success";
-        }
-
-        #endregion
-
-        #region 取消机具申请记录信息
-
-        /// <summary>
-        /// 取消机具申请记录信息
-        /// </summary>
-        /// <returns></returns>
-        public string Cancel(int Id)
-        {
-            StoreMachineApply storeMachineApply = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id);
-            Orders order = db.Orders.FirstOrDefault(m => m.Id == storeMachineApply.OrderId);
-            if (storeMachineApply != null && order != null)
-            {
-                function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(storeMachineApply) + "#cut#" + Newtonsoft.Json.JsonConvert.SerializeObject(order) + "#cut#" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "机具申请订单取消日志");
-                db.StoreMachineApply.Remove(storeMachineApply);
-                db.Orders.Remove(order);
-                db.SaveChanges();
-            }
-            AddSysLog(Id, "StoreMachineApply", "cancel");
-            AddSysLog(Id, "Orders", "cancel");
-            return "success";
-        }
-
-        #endregion
-
-        #region 开启
-
-        /// <summary>
-        /// 开启
-        /// </summary>
-        /// <returns></returns>
-        public string Open(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "StoreMachineApply", "open");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 1);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 关闭
-
-        /// <summary>
-        /// 关闭
-        /// </summary>
-        /// <returns></returns>
-        public string Close(string Id)
-        {
-            string[] idlist = Id.Split(new char[] { ',' });
-            AddSysLog(Id, "StoreMachineApply", "close");
-            foreach (string subid in idlist)
-            {
-                int id = int.Parse(subid);
-                Dictionary<string, object> Fields = new Dictionary<string, object>();
-                Fields.Add("Status", 0);
-                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
-            }
-            db.SaveChanges();
-            return "success";
-        }
-
-        #endregion
-
-        #region 排序
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="Id"></param>
-        public string Sort(int Id, int Sort)
-        {
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("StoreMachineApply", Sort, Id);
-
-            AddSysLog(Id.ToString(), "StoreMachineApply", "sort");
-            return "success";
-        }
-        #endregion
-
-        #region 导入数据
-
-        public IActionResult Import(string right, string ExcelKind)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-            ViewBag.ExcelKind = ExcelKind;
-            return View();
-        }
-        /// <summary>
-        /// 导入数据
-        /// </summary>
-        /// <param name="ExcelData"></param>
-        [HttpPost]
-        public string ImportPost(string ExcelData)
-        {
-            // // RedisDbconn.Instance.AddList("ExcelImport", ExcelPath + "#cut#" + Kind);
-            // string key = function.MD5_16(Guid.NewGuid().ToString());
-            // RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key);
-            // return "success|" + key;
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-                // string SwapSnExpand = dr[0].ToString();
-                var temp = dr[0].ToString();
-                temp = temp.Substring(1);
-                temp = temp.Substring(0, temp.Length - 1);
-                var SwapSnExpand = temp.Split(",,");
-                // StoreMachineApply storeMachineApply = db.StoreMachineApply.FirstOrDefault(m => m.MakerCode == MakerCode);
-                // if (UserCode != null)
-                // {
-                //     Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
-                //     if (User != null)
-                //     {
-                //         User.SettleAmount = decimal.Parse(function.CheckInt(SettleAmount));
-                //     }
-                // }
-            }
-            db.SaveChanges();
-            return "success";
-        }
-        #endregion
-
-        #region 导出Excel
-
-        /// <summary>
-        /// 导出Excel
-        /// </summary>
-        /// <returns></returns>
-        public JsonResult ExportExcel(StoreMachineApply data, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string SendStatusSelect, string StoreTypeSelect)
-        {
-            Dictionary<string, string> Fields = new Dictionary<string, string>();
-
-            Fields.Add("ApplyNo", "1"); //申请单号
-            Fields.Add("BrandId", "1"); //品牌
-            Fields.Add("ApplyTime", "3"); //申请时间
-            Fields.Add("ExpressNo", "1"); //快递单号
-
-            string condition = " and Status>-1";
-            //创客编号
-            if (!string.IsNullOrEmpty(MakerCode))
-            {
-                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
-            }
-            //创客名称
-            if (!string.IsNullOrEmpty(RealName))
-            {
-                condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
-            }
-            //仓库编号
-            if (!string.IsNullOrEmpty(StoreNo))
-            {
-                condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreNo + "')";
-            }
-            //仓库名称
-            if (!string.IsNullOrEmpty(RealName))
-            {
-                condition += " and StoreId in (select StoreId from StoreForName where Name='" + RealName + "')";
-            }
-            //仓库归属创客编号
-            if (!string.IsNullOrEmpty(StoreMakerCode))
-            {
-                condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
-            }
-            //订单状态
-            if (!string.IsNullOrEmpty(StatusSelect))
-            {
-                condition += " and Status=" + StatusSelect;
-            }
-            //发货状态
-            if (!string.IsNullOrEmpty(SendStatusSelect))
-            {
-                condition += " and SendStatus=" + SendStatusSelect;
-            }
-            //仓库类型
-            if (!string.IsNullOrEmpty(StoreTypeSelect))
-            {
-                condition += " and StoreType=" + StoreTypeSelect;
-            }
-
-            Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineApply", Fields, "Id desc", "0", 1, 20000, condition, "ApplyNo,UserId,TopUserId,BrandId,Areas,Address,RealName,Mobile,ApplyDeviceName,ApplyDeviceNum,ApplyTime,SendStatus,ExpressNo,ExpressName,DeliveryType,StoreId,StoreName,StoreManager,StoreManagerMobile,Remark,StoreUserId,SendDate,StoreType,Status", false);
-            List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
-            foreach (Dictionary<string, object> dic in diclist)
-            {
-                dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
-
-                //申请仓库信息
-                int StoreId = int.Parse(dic["StoreId"].ToString());
-                StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-                dic["StoreInfo"] = store.StoreNo + "<br />" + store.StoreName;
-
-                //仓库联系人信息
-                //dic["StoreContact"] = dic["StoreManagerMobile"].ToString() + "<br />" + dic["StoreManager"].ToString();
-
-                //仓库归属信息
-                // int StoreUserId = int.Parse(dic["StoreUserId"].ToString());
-                // Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
-                // int StoreType = int.Parse(dic["StoreType"].ToString());
-                // string StoreTypeName = "";
-                // if(StoreType == 0) StoreTypeName = "总仓";
-                // if(StoreType == 1) StoreTypeName = "分仓";
-                // dic["StoreUser"] = storeUser.MakerCode + "<br />" + StoreTypeName;
-
-                //创客信息
-                int UserId = int.Parse(dic["UserId"].ToString());
-                Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
-                dic["UserInfo"] = puser.MakerCode + "<br />" + puser.RealName;
-
-                //顶级创客
-                // int TopUserId = int.Parse(dic["TopUserId"].ToString());
-                // Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
-                // dic["TopUserInfo"] = tuser.MakerCode + "<br />" + tuser.RealName;
-
-                //申请状态
-                int Status = int.Parse(dic["Status"].ToString());
-                if (Status == 0) dic["Status"] = "待审核";
-                if (Status == 1) dic["Status"] = "申请成功";
-                if (Status == 2) dic["Status"] = "申请失败";
-
-                dic.Remove("BrandId");
-                dic.Remove("StoreInfo");
-                dic.Remove("UserInfo");
-                dic.Remove("Status");
-            }
-
-            Dictionary<string, object> result = new Dictionary<string, object>();
-            result.Add("Status", "1");
-            result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
-            result.Add("Obj", diclist);
-            Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
-            ReturnFields.Add("ApplyNo", "申请单号");
-            ReturnFields.Add("BrandId", "产品类型");
-            ReturnFields.Add("StoreId", "申请仓库");
-            ReturnFields.Add("StoreMakerCode", "仓库归属创客编号");
-            ReturnFields.Add("StoreRealName", "仓库归属创客名称");
-            ReturnFields.Add("MakerCode", "创客编号");
-            ReturnFields.Add("MakerName", "创客名称");
-            ReturnFields.Add("Status", "申请状态");
-            ReturnFields.Add("ApplyTime", "申请时间");
-            ReturnFields.Add("ApplyNum", "申请箱数");
-            ReturnFields.Add("SendNum", "发货箱数");
-            ReturnFields.Add("SwapSnExpand", "已发货SN号");
-            ReturnFields.Add("SeoDescription", "申请描述");
-
-            result.Add("Fields", ReturnFields);
-            AddSysLog("0", "StoreMachineApply", "ExportExcel");
-            return Json(result);
-        }
-
-        #endregion
-
-
-
-
-
-        #region 审核发货
-
-        public IActionResult AuditSend(string right, int Id = 0)
-        {
-            ViewBag.RightInfo = RightInfo;
-            ViewBag.right = right;
-
-
-            StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
-            ViewBag.data = editData;
-
-            Users users = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
-            StoreHouse storeHouse = db.StoreHouse.FirstOrDefault(m => m.Id == editData.StoreId) ?? new StoreHouse();
-            ViewBag.MakerCode = users.MakerCode;
-            ViewBag.RealName = users.RealName;
-
-            return View();
-        }
-
-        #endregion
-
-        #region 审核发货
-
-        [HttpPost]
-        public string AuditSend(StoreMachineApply data, string ExcelData)
-        {
-            Dictionary<string, object> Fields = new Dictionary<string, object>();
-            Fields.Add("ApplyNum", data.ApplyNum); //申请箱数
-            Fields.Add("SendNum", data.SendNum); //发货箱数
-            Fields.Add("SeoDescription", data.SeoDescription); //申请描述
-            Fields.Add("Status", data.Status);
-            new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
-            AddSysLog(data.Id.ToString(), "StoreMachineApply", "AuditSend");
-            StoreMachineApply apply = db.StoreMachineApply.FirstOrDefault(m=>m.Id == data.Id) ?? new StoreMachineApply();
-            StoreHouse tostore = db.StoreHouse.FirstOrDefault(m=>m.Id == apply.StoreId) ?? new StoreHouse();
-            int BrandId = apply.BrandId.Value;
-            var FromStoreId = 0;
-            if (BrandId==1)
-            {
-                FromStoreId=7;
-            }
-            else if (BrandId==2)
-            {
-                FromStoreId=721;
-            }
-            else if (BrandId==3)
-            {
-                FromStoreId=697;
-            }
-            else if (BrandId==4)
-            {
-                FromStoreId=774;
-            }
-            else if (BrandId==5)
-            {
-                FromStoreId=775;
-            }
-            else if (BrandId==6)
-            {
-                FromStoreId=871;
-            }
-            else if (BrandId==7)
-            {
-                FromStoreId=0;
-            }
-            ExcelData = HttpUtility.UrlDecode(ExcelData);
-            JsonData list = JsonMapper.ToObject(ExcelData);            
-            Dictionary<string, int> storeData = new Dictionary<string, int>();
-            Dictionary<string, int> toStoreData = new Dictionary<string, int>();
-            for (int i = 1; i < list.Count; i++)
-            {
-                JsonData dr = list[i];
-                string itemJson = dr.ToJson();
-                string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
-                string BatchNo = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
-                string OutNote = itemJson.Contains("\"C\"") ? dr["B"].ToString() : "";
-                StoreMachineApply storeMachineApply = db.StoreMachineApply.FirstOrDefault(m=>m.Id == data.Id);
-                if (storeMachineApply != null)
-                {
-                    storeMachineApply.SwapSnExpand = function.CheckString(SnNo)+',';
-                }
-                MachineForSnNo machinefor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new MachineForSnNo();
-                PosMachinesTwo machine = db.PosMachinesTwo.FirstOrDefault(m => m.Id == machinefor.SnId && m.StoreId != apply.StoreId && m.BuyUserId == 0 && m.UserId == 0) ?? new PosMachinesTwo();
-                if (machine.Id > 0)
-                {
-                    StoreStockChange stockchange = db.StoreStockChange.Add(new StoreStockChange()
-                    {
-                        CreateDate = DateTime.Now,
-                        StoreId = FromStoreId, //出货仓库
-                        BrandId = BrandId, //产品类型
-                        ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
-                        BizBatchNo = BatchNo, //业务批次号
-                        TransType = 1, //交易类型
-                        SnNo = SnNo, //SN编号
-                        StockOpDirect = 1, //库存操作方向
-                        SnStatus = 1, //SN状态
-                        DeviceVendor = machine.DeviceName, //设备厂商
-                        DeviceModel = machine.DeviceKind, //设备型号
-                        DeviceType = machine.DeviceType, //设备类型
-                        FromUserId = tostore.UserId, //出货人
-                        FromDate = DateTime.Now, //出库时间
-                        FromRemark = OutNote, //出库备注
-                        ToUserId = tostore.UserId, //收货人
-                        ToStoreId = tostore.Id, //退货收货仓库                        
-                        SourceStoreId = machine.SourceStoreId, //源仓库编号
-                        BrandType = machine.DeviceType, //品牌类型
-                    }).Entity;
-                    db.SaveChanges();
-                    string ChangeNo = "SC";
-                    int StoreStockChangeId = stockchange.Id;
-                    string StoreStockChangeIdString = StoreStockChangeId.ToString();
-                    for (int j = 0; j < 18 - StoreStockChangeId.ToString().Length; j++)
-                    {
-                        StoreStockChangeIdString = "0" + StoreStockChangeIdString;
-                    }
-                    ChangeNo += StoreStockChangeIdString;
-                    stockchange.ChangeNo = ChangeNo; //交易流水编号
-                    machine.StoreId = tostore.Id;
-
-                    db.StoreChangeHistory.Add(new StoreChangeHistory()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = tostore.UserId, //创客
-                        BrandId = BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        BizBatchNo = BatchNo, //业务批次号
-                        TransType = 1, //交易类型
-                        SnNo = SnNo, //SN编号
-                        SnType = machine.PosSnType, //SN机具类型
-                        StockOpDirect = 1, //库存操作方向
-                        DeviceVendor = machine.DeviceName, //设备厂商
-                        DeviceModel = machine.DeviceKind, //设备型号
-                        DeviceType = machine.DeviceType, //设备类型
-                        FromUserId = tostore.UserId, //出货创客
-                        FromDate = DateTime.Now, //出库时间
-                        FromRemark = OutNote, //出库备注
-                        SourceStoreId = machine.SourceStoreId, //源仓库
-                        StoreId = tostore.Id, //仓库
-                    });
-
-                    db.StoreChangeHistory.Add(new StoreChangeHistory()
-                    {
-                        CreateDate = DateTime.Now,
-                        UserId = tostore.UserId, //创客
-                        BrandId = BrandId, //产品类型
-                        ChangeRecordNo = ChangeNo, //变更记录单号
-                        BizBatchNo = BatchNo, //业务批次号
-                        TransType = 1, //交易类型
-                        SnNo = SnNo, //SN编号
-                        SnType = machine.PosSnType, //SN机具类型
-                        StockOpDirect = 0, //库存操作方向
-                        DeviceVendor = machine.DeviceName, //设备厂商
-                        DeviceModel = machine.DeviceKind, //设备型号
-                        DeviceType = machine.DeviceType, //设备类型
-                        ToUserId = tostore.UserId, //收货创客
-                        ToStoreId = tostore.Id, //创客退货收货仓库
-                        ToDate = DateTime.Now, //入库时间
-                        ToRemark = OutNote, //入库备注
-                        SourceStoreId = machine.SourceStoreId, //源仓库
-                        StoreId = tostore.Id, //仓库
-                    });
-                    db.SaveChanges();
-                }
-            }
-            db.SaveChanges();
-
-            int StoreId = FromStoreId;
-            int OpStoreNum = list.Count - 1;
-            StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
-            StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
-            {
-                CreateDate = DateTime.Now,
-                StoreId = StoreId, //仓库
-                TransType = 1, //交易类型
-                BrandId = BrandId, //产品类型
-                OpStoreNum = OpStoreNum, //操作库存数
-                OpSymbol = "-", //操作符
-                BeforeTotalNum = store.TotalNum, //操作前总库存数
-                AfterTotalNum = store.TotalNum, //操作后总库存数
-                BeforeLaveNum = store.LaveNum, //操作前剩余库存数
-                AfterLaveNum = store.LaveNum - OpStoreNum, //操作后剩余库存数
-                BeforeOutNum = store.OutNum, //操作前出库数
-                AfterOutNum = store.OutNum + OpStoreNum, //操作后出库数
-            }).Entity;
-            db.SaveChanges();
-            string ChangeNo1 = "SC";
-            int StoreStockChangeId1 = balance.Id;
-            string StoreStockChangeId1String = StoreStockChangeId1.ToString();
-            for (int i = 0; i < 18 - StoreStockChangeId1.ToString().Length; i++)
-            {
-                StoreStockChangeId1String = "0" + StoreStockChangeId1String;
-            }
-            ChangeNo1 += StoreStockChangeId1String;
-            balance.TransRecordNo = ChangeNo1; //交易流水编号
-            store.LaveNum -= OpStoreNum;
-            store.OutNum += OpStoreNum;
-            db.SaveChanges();
+// using System;
+// using System.Web;
+// using System.Collections.Generic;
+// using System.Diagnostics;
+// using System.Linq;
+// using System.Threading.Tasks;
+// using Microsoft.AspNetCore.Mvc;
+// using Microsoft.AspNetCore.Http;
+// using Microsoft.Extensions.Logging;
+// using Microsoft.Extensions.Options;
+// using MySystem.Models;
+// using Library;
+// using LitJson;
+// using MySystemLib;
+
+// /// <summary>
+// /// 机具申请记录
+// /// </summary>
+// namespace MySystem.Areas.Admin.Controllers
+// {
+//     [Area("Admin")]
+//     [Route("Admin/[controller]/[action]")]
+//     public class StoreMachineApplyController : BaseController
+//     {
+//         public StoreMachineApplyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
+//         {
+//             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
+//         }
+
+//         #region 机具申请记录列表
+
+//         /// <summary>
+//         /// 机具申请记录列表
+//         /// </summary>
+//         /// <returns></returns>
+//         public IActionResult Index(StoreMachineApply data, string right)
+//         {
+//             ViewBag.RightInfo = RightInfo;
+//             ViewBag.right = right;
+
+//             return View();
+//         }
+
+//         #endregion
+
+//         #region 根据条件查询机具申请记录列表
+
+//         /// <summary>
+//         /// 机具申请记录列表
+//         /// </summary>
+//         /// <returns></returns>
+//         public JsonResult IndexData(StoreMachineApply data, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string SendStatusSelect, string StoreTypeSelect, int page = 1, int limit = 30)
+//         {
+
+//             Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+//             Fields.Add("ApplyNo", "1"); //申请单号
+//             Fields.Add("BrandId", "1"); //品牌
+//             Fields.Add("ExpressNo", "1"); //快递单号
+
+//             string condition = " and Status>-1";
+//             //创客编号
+//             if (!string.IsNullOrEmpty(MakerCode))
+//             {
+//                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+//             }
+//             //创客名称
+//             if (!string.IsNullOrEmpty(RealName))
+//             {
+//                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+//             }
+//             //仓库编号
+//             if (!string.IsNullOrEmpty(StoreNo))
+//             {
+//                 condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreNo + "')";
+//             }
+//             //仓库名称
+//             if (!string.IsNullOrEmpty(StoreName))
+//             {
+//                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + StoreName + "')";
+//             }
+//             //仓库归属创客编号
+//             if (!string.IsNullOrEmpty(StoreMakerCode))
+//             {
+//                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
+//             }
+//             //订单状态
+//             if (!string.IsNullOrEmpty(StatusSelect))
+//             {
+//                 condition += " and Status=" + StatusSelect;
+//             }
+//             //发货状态
+//             if (!string.IsNullOrEmpty(SendStatusSelect))
+//             {
+//                 condition += " and SendStatus=" + SendStatusSelect;
+//             }
+//             //仓库类型
+//             if (!string.IsNullOrEmpty(StoreTypeSelect))
+//             {
+//                 condition += " and StoreType=" + StoreTypeSelect;
+//             }
+
+//             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreMachineApply", Fields, "Id desc", "0", page, limit, condition);
+//             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+//             foreach (Dictionary<string, object> dic in diclist)
+//             {
+//                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+
+//                 //申请仓库信息
+//                 int StoreId = int.Parse(dic["StoreId"].ToString());
+//                 StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
+//                 dic["StoreInfo"] = store.StoreNo + "<br />" + store.StoreName;
+
+//                 //仓库收货地址
+//                 dic["StoreAddressInfo"] = store.Areas + "<br />" + store.Address;
+
+//                 //仓库联系人信息
+//                 //dic["StoreContact"] = dic["StoreManagerMobile"].ToString() + "<br />" + dic["StoreManager"].ToString();
+
+//                 //仓库归属信息
+//                 // int StoreUserId = int.Parse(dic["StoreUserId"].ToString());
+//                 // Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
+//                 // int StoreType = int.Parse(dic["StoreType"].ToString());
+//                 // string StoreTypeName = "";
+//                 // if(StoreType == 0) StoreTypeName = "总仓";
+//                 // if(StoreType == 1) StoreTypeName = "分仓";
+//                 // dic["StoreUser"] = storeUser.MakerCode + "<br />" + StoreTypeName;
+
+//                 //创客信息
+//                 int UserId = int.Parse(dic["UserId"].ToString());
+//                 Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+//                 dic["UserInfo"] = puser.MakerCode + "<br />" + puser.RealName;
+
+//                 //顶级创客
+//                 // int TopUserId = int.Parse(dic["TopUserId"].ToString());
+//                 // Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
+//                 // dic["TopUserInfo"] = tuser.MakerCode + "<br />" + tuser.RealName;
+
+//                 //申请状态
+//                 int Status = int.Parse(dic["Status"].ToString());
+//                 if (Status == 0) dic["Status"] = "待审核";
+//                 if (Status == 1) dic["Status"] = "申请成功";
+//                 if (Status == 2) dic["Status"] = "申请失败";
+//             }
+//             Dictionary<string, object> other = new Dictionary<string, object>();
+//             other.Add("ApplyNum", 0);
+//             other.Add("SendNum", 0);
+//             obj.Add("other", other);
+//             return Json(obj);
+//         }
+
+//         #endregion
+
+//         #region 增加机具申请记录
+
+//         /// <summary>
+//         /// 增加或修改机具申请记录信息
+//         /// </summary>
+//         /// <returns></returns>
+//         public IActionResult Add(string right)
+//         {
+//             ViewBag.RightInfo = RightInfo;
+//             ViewBag.right = right;
+
+
+//             return View();
+//         }
+
+//         #endregion
+
+//         #region 增加机具申请记录
+
+//         /// <summary>
+//         /// 增加或修改机具申请记录信息
+//         /// </summary>
+//         /// <returns></returns>
+//         [HttpPost]
+//         public string Add(StoreMachineApply data)
+//         {
+//             Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+
+//             Fields.Add("SeoTitle", data.SeoTitle);
+//             Fields.Add("SeoKeyword", data.SeoKeyword);
+//             Fields.Add("SeoDescription", data.SeoDescription);
+//             int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreMachineApply", Fields, 0);
+//             AddSysLog(data.Id.ToString(), "StoreMachineApply", "add");
+//             db.SaveChanges();
+
+//             return "success";
+//         }
+
+//         #endregion
+
+//         #region 修改机具申请记录信息
+
+//         /// <summary>
+//         /// 增加或修改机具申请记录信息
+//         /// </summary>
+//         /// <returns></returns>
+//         public IActionResult Edit(string right, int Id = 0)
+//         {
+//             ViewBag.RightInfo = RightInfo;
+//             ViewBag.right = right;
+
+//             StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
+//             ViewBag.data = editData;
+
+//             KqProducts kqProducts = db.KqProducts.FirstOrDefault(m => m.Id == editData.BrandId);
+//             ViewBag.BrandName = kqProducts.Name;
+
+//             Users user = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
+//             ViewBag.MakerCode = user.MakerCode;
+//             ViewBag.RealName = user.RealName;
+
+//             int Status = editData.Status;
+//             if (Status == 0) ViewBag.Status = "待审核";
+//             if (Status == 1) ViewBag.Status = "申请成功";
+//             if (Status == 2) ViewBag.Status = "申请失败";
+//             return View();
+//         }
+
+//         #endregion
+
+//         #region 修改机具申请记录
+
+//         /// <summary>
+//         /// 增加或修改机具申请记录信息
+//         /// </summary>
+//         /// <returns></returns>
+//         [HttpPost]
+//         public string Edit(StoreMachineApply data)
+//         {
+//             Dictionary<string, object> Fields = new Dictionary<string, object>();
+
+//             Fields.Add("ApplyNo", data.ApplyNo); //申请单号
+//             // Fields.Add("BrandId", data.BrandId); //产品Id
+//             Fields.Add("ApplyNum", data.ApplyNum); //申请箱数
+//             Fields.Add("SendNum", data.SendNum); //发货箱数
+//             // Fields.Add("UserId", data.UserId); //创客ID
+//             Fields.Add("Status", data.Status); //申请状态
+//             Fields.Add("SwapSnExpand", data.SwapSnExpand);//已发货机具SN
+//             Fields.Add("SeoDescription", data.SeoDescription); //申请描述
+
+//             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
+//             AddSysLog(data.Id.ToString(), "StoreMachineApply", "update");
+//             db.SaveChanges();
+
+//             return "success";
+//         }
+
+//         #endregion
+
+//         #region 删除机具申请记录信息
+
+//         /// <summary>
+//         /// 删除机具申请记录信息
+//         /// </summary>
+//         /// <returns></returns>
+//         public string Delete(string Id)
+//         {
+//             string[] idlist = Id.Split(new char[] { ',' });
+//             AddSysLog(Id, "StoreMachineApply", "del");
+//             foreach (string subid in idlist)
+//             {
+//                 int id = int.Parse(subid);
+//                 Dictionary<string, object> Fields = new Dictionary<string, object>();
+//                 Fields.Add("Status", -1);
+//                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
+//             }
+//             db.SaveChanges();
+
+//             return "success";
+//         }
+
+//         #endregion
+
+//         #region 取消机具申请记录信息
+
+//         /// <summary>
+//         /// 取消机具申请记录信息
+//         /// </summary>
+//         /// <returns></returns>
+//         public string Cancel(int Id)
+//         {
+//             StoreMachineApply storeMachineApply = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id);
+//             Orders order = db.Orders.FirstOrDefault(m => m.Id == storeMachineApply.OrderId);
+//             if (storeMachineApply != null && order != null)
+//             {
+//                 function.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(storeMachineApply) + "#cut#" + Newtonsoft.Json.JsonConvert.SerializeObject(order) + "#cut#" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "机具申请订单取消日志");
+//                 db.StoreMachineApply.Remove(storeMachineApply);
+//                 db.Orders.Remove(order);
+//                 db.SaveChanges();
+//             }
+//             AddSysLog(Id, "StoreMachineApply", "cancel");
+//             AddSysLog(Id, "Orders", "cancel");
+//             return "success";
+//         }
+
+//         #endregion
+
+//         #region 开启
+
+//         /// <summary>
+//         /// 开启
+//         /// </summary>
+//         /// <returns></returns>
+//         public string Open(string Id)
+//         {
+//             string[] idlist = Id.Split(new char[] { ',' });
+//             AddSysLog(Id, "StoreMachineApply", "open");
+//             foreach (string subid in idlist)
+//             {
+//                 int id = int.Parse(subid);
+//                 Dictionary<string, object> Fields = new Dictionary<string, object>();
+//                 Fields.Add("Status", 1);
+//                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
+//             }
+//             db.SaveChanges();
+//             return "success";
+//         }
+
+//         #endregion
+
+//         #region 关闭
+
+//         /// <summary>
+//         /// 关闭
+//         /// </summary>
+//         /// <returns></returns>
+//         public string Close(string Id)
+//         {
+//             string[] idlist = Id.Split(new char[] { ',' });
+//             AddSysLog(Id, "StoreMachineApply", "close");
+//             foreach (string subid in idlist)
+//             {
+//                 int id = int.Parse(subid);
+//                 Dictionary<string, object> Fields = new Dictionary<string, object>();
+//                 Fields.Add("Status", 0);
+//                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
+//             }
+//             db.SaveChanges();
+//             return "success";
+//         }
+
+//         #endregion
+
+//         #region 排序
+//         /// <summary>
+//         /// 排序
+//         /// </summary>
+//         /// <param name="Id"></param>
+//         public string Sort(int Id, int Sort)
+//         {
+//             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("StoreMachineApply", Sort, Id);
+
+//             AddSysLog(Id.ToString(), "StoreMachineApply", "sort");
+//             return "success";
+//         }
+//         #endregion
+
+//         #region 导入数据
+
+//         public IActionResult Import(string right, string ExcelKind)
+//         {
+//             ViewBag.RightInfo = RightInfo;
+//             ViewBag.right = right;
+//             ViewBag.ExcelKind = ExcelKind;
+//             return View();
+//         }
+//         /// <summary>
+//         /// 导入数据
+//         /// </summary>
+//         /// <param name="ExcelData"></param>
+//         [HttpPost]
+//         public string ImportPost(string ExcelData)
+//         {
+//             // // RedisDbconn.Instance.AddList("ExcelImport", ExcelPath + "#cut#" + Kind);
+//             // string key = function.MD5_16(Guid.NewGuid().ToString());
+//             // RedisDbconn.Instance.AddList("ExcelImportV2", ExcelPath + "#cut#" + Kind + "#cut#" + key);
+//             // return "success|" + key;
+//             ExcelData = HttpUtility.UrlDecode(ExcelData);
+//             JsonData list = JsonMapper.ToObject(ExcelData);
+//             for (int i = 1; i < list.Count; i++)
+//             {
+//                 JsonData dr = list[i];
+//                 // string SwapSnExpand = dr[0].ToString();
+//                 var temp = dr[0].ToString();
+//                 temp = temp.Substring(1);
+//                 temp = temp.Substring(0, temp.Length - 1);
+//                 var SwapSnExpand = temp.Split(",,");
+//                 // StoreMachineApply storeMachineApply = db.StoreMachineApply.FirstOrDefault(m => m.MakerCode == MakerCode);
+//                 // if (UserCode != null)
+//                 // {
+//                 //     Users User = db.Users.FirstOrDefault(m => m.Id == UserCode.UserId);
+//                 //     if (User != null)
+//                 //     {
+//                 //         User.SettleAmount = decimal.Parse(function.CheckInt(SettleAmount));
+//                 //     }
+//                 // }
+//             }
+//             db.SaveChanges();
+//             return "success";
+//         }
+//         #endregion
+
+//         #region 导出Excel
+
+//         /// <summary>
+//         /// 导出Excel
+//         /// </summary>
+//         /// <returns></returns>
+//         public JsonResult ExportExcel(StoreMachineApply data, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string SendStatusSelect, string StoreTypeSelect)
+//         {
+//             Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+//             Fields.Add("ApplyNo", "1"); //申请单号
+//             Fields.Add("BrandId", "1"); //品牌
+//             Fields.Add("ApplyTime", "3"); //申请时间
+//             Fields.Add("ExpressNo", "1"); //快递单号
+
+//             string condition = " and Status>-1";
+//             //创客编号
+//             if (!string.IsNullOrEmpty(MakerCode))
+//             {
+//                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + MakerCode + "')";
+//             }
+//             //创客名称
+//             if (!string.IsNullOrEmpty(RealName))
+//             {
+//                 condition += " and UserId in (select UserId from UserForRealName where RealName='" + RealName + "')";
+//             }
+//             //仓库编号
+//             if (!string.IsNullOrEmpty(StoreNo))
+//             {
+//                 condition += " and StoreId in (select StoreId from StoreForCode where Code='" + StoreNo + "')";
+//             }
+//             //仓库名称
+//             if (!string.IsNullOrEmpty(RealName))
+//             {
+//                 condition += " and StoreId in (select StoreId from StoreForName where Name='" + RealName + "')";
+//             }
+//             //仓库归属创客编号
+//             if (!string.IsNullOrEmpty(StoreMakerCode))
+//             {
+//                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
+//             }
+//             //订单状态
+//             if (!string.IsNullOrEmpty(StatusSelect))
+//             {
+//                 condition += " and Status=" + StatusSelect;
+//             }
+//             //发货状态
+//             if (!string.IsNullOrEmpty(SendStatusSelect))
+//             {
+//                 condition += " and SendStatus=" + SendStatusSelect;
+//             }
+//             //仓库类型
+//             if (!string.IsNullOrEmpty(StoreTypeSelect))
+//             {
+//                 condition += " and StoreType=" + StoreTypeSelect;
+//             }
+
+//             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("MachineApply", Fields, "Id desc", "0", 1, 20000, condition, "ApplyNo,UserId,TopUserId,BrandId,Areas,Address,RealName,Mobile,ApplyDeviceName,ApplyDeviceNum,ApplyTime,SendStatus,ExpressNo,ExpressName,DeliveryType,StoreId,StoreName,StoreManager,StoreManagerMobile,Remark,StoreUserId,SendDate,StoreType,Status", false);
+//             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+//             foreach (Dictionary<string, object> dic in diclist)
+//             {
+//                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
+
+//                 //申请仓库信息
+//                 int StoreId = int.Parse(dic["StoreId"].ToString());
+//                 StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
+//                 dic["StoreInfo"] = store.StoreNo + "<br />" + store.StoreName;
+
+//                 //仓库联系人信息
+//                 //dic["StoreContact"] = dic["StoreManagerMobile"].ToString() + "<br />" + dic["StoreManager"].ToString();
+
+//                 //仓库归属信息
+//                 // int StoreUserId = int.Parse(dic["StoreUserId"].ToString());
+//                 // Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
+//                 // int StoreType = int.Parse(dic["StoreType"].ToString());
+//                 // string StoreTypeName = "";
+//                 // if(StoreType == 0) StoreTypeName = "总仓";
+//                 // if(StoreType == 1) StoreTypeName = "分仓";
+//                 // dic["StoreUser"] = storeUser.MakerCode + "<br />" + StoreTypeName;
+
+//                 //创客信息
+//                 int UserId = int.Parse(dic["UserId"].ToString());
+//                 Users puser = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+//                 dic["UserInfo"] = puser.MakerCode + "<br />" + puser.RealName;
+
+//                 //顶级创客
+//                 // int TopUserId = int.Parse(dic["TopUserId"].ToString());
+//                 // Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
+//                 // dic["TopUserInfo"] = tuser.MakerCode + "<br />" + tuser.RealName;
+
+//                 //申请状态
+//                 int Status = int.Parse(dic["Status"].ToString());
+//                 if (Status == 0) dic["Status"] = "待审核";
+//                 if (Status == 1) dic["Status"] = "申请成功";
+//                 if (Status == 2) dic["Status"] = "申请失败";
+
+//                 dic.Remove("BrandId");
+//                 dic.Remove("StoreInfo");
+//                 dic.Remove("UserInfo");
+//                 dic.Remove("Status");
+//             }
+
+//             Dictionary<string, object> result = new Dictionary<string, object>();
+//             result.Add("Status", "1");
+//             result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
+//             result.Add("Obj", diclist);
+//             Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
+//             ReturnFields.Add("ApplyNo", "申请单号");
+//             ReturnFields.Add("BrandId", "产品类型");
+//             ReturnFields.Add("StoreId", "申请仓库");
+//             ReturnFields.Add("StoreMakerCode", "仓库归属创客编号");
+//             ReturnFields.Add("StoreRealName", "仓库归属创客名称");
+//             ReturnFields.Add("MakerCode", "创客编号");
+//             ReturnFields.Add("MakerName", "创客名称");
+//             ReturnFields.Add("Status", "申请状态");
+//             ReturnFields.Add("ApplyTime", "申请时间");
+//             ReturnFields.Add("ApplyNum", "申请箱数");
+//             ReturnFields.Add("SendNum", "发货箱数");
+//             ReturnFields.Add("SwapSnExpand", "已发货SN号");
+//             ReturnFields.Add("SeoDescription", "申请描述");
+
+//             result.Add("Fields", ReturnFields);
+//             AddSysLog("0", "StoreMachineApply", "ExportExcel");
+//             return Json(result);
+//         }
+
+//         #endregion
+
+
+
+
+
+//         #region 审核发货
+
+//         public IActionResult AuditSend(string right, int Id = 0)
+//         {
+//             ViewBag.RightInfo = RightInfo;
+//             ViewBag.right = right;
+
+
+//             StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
+//             ViewBag.data = editData;
+
+//             Users users = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
+//             StoreHouse storeHouse = db.StoreHouse.FirstOrDefault(m => m.Id == editData.StoreId) ?? new StoreHouse();
+//             ViewBag.MakerCode = users.MakerCode;
+//             ViewBag.RealName = users.RealName;
+
+//             return View();
+//         }
+
+//         #endregion
+
+//         #region 审核发货
+
+//         [HttpPost]
+//         public string AuditSend(StoreMachineApply data, string ExcelData)
+//         {
+//             Dictionary<string, object> Fields = new Dictionary<string, object>();
+//             Fields.Add("ApplyNum", data.ApplyNum); //申请箱数
+//             Fields.Add("SendNum", data.SendNum); //发货箱数
+//             Fields.Add("SeoDescription", data.SeoDescription); //申请描述
+//             Fields.Add("Status", data.Status);
+//             new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
+//             AddSysLog(data.Id.ToString(), "StoreMachineApply", "AuditSend");
+//             StoreMachineApply apply = db.StoreMachineApply.FirstOrDefault(m=>m.Id == data.Id) ?? new StoreMachineApply();
+//             StoreHouse tostore = db.StoreHouse.FirstOrDefault(m=>m.Id == apply.StoreId) ?? new StoreHouse();
+//             int BrandId = apply.BrandId.Value;
+//             var FromStoreId = 0;
+//             if (BrandId==1)
+//             {
+//                 FromStoreId=7;
+//             }
+//             else if (BrandId==2)
+//             {
+//                 FromStoreId=721;
+//             }
+//             else if (BrandId==3)
+//             {
+//                 FromStoreId=697;
+//             }
+//             else if (BrandId==4)
+//             {
+//                 FromStoreId=774;
+//             }
+//             else if (BrandId==5)
+//             {
+//                 FromStoreId=775;
+//             }
+//             else if (BrandId==6)
+//             {
+//                 FromStoreId=871;
+//             }
+//             else if (BrandId==7)
+//             {
+//                 FromStoreId=0;
+//             }
+//             ExcelData = HttpUtility.UrlDecode(ExcelData);
+//             JsonData list = JsonMapper.ToObject(ExcelData);            
+//             Dictionary<string, int> storeData = new Dictionary<string, int>();
+//             Dictionary<string, int> toStoreData = new Dictionary<string, int>();
+//             for (int i = 1; i < list.Count; i++)
+//             {
+//                 JsonData dr = list[i];
+//                 string itemJson = dr.ToJson();
+//                 string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
+//                 string BatchNo = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
+//                 string OutNote = itemJson.Contains("\"C\"") ? dr["B"].ToString() : "";
+//                 StoreMachineApply storeMachineApply = db.StoreMachineApply.FirstOrDefault(m=>m.Id == data.Id);
+//                 if (storeMachineApply != null)
+//                 {
+//                     storeMachineApply.SwapSnExpand = function.CheckString(SnNo)+',';
+//                 }
+//                 MachineForSnNo machinefor = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == SnNo) ?? new MachineForSnNo();
+//                 PosMachinesTwo machine = db.PosMachinesTwo.FirstOrDefault(m => m.Id == machinefor.SnId && m.StoreId != apply.StoreId && m.BuyUserId == 0 && m.UserId == 0) ?? new PosMachinesTwo();
+//                 if (machine.Id > 0)
+//                 {
+//                     StoreStockChange stockchange = db.StoreStockChange.Add(new StoreStockChange()
+//                     {
+//                         CreateDate = DateTime.Now,
+//                         StoreId = FromStoreId, //出货仓库
+//                         BrandId = BrandId, //产品类型
+//                         ProductName = RelationClass.GetKqProductBrandInfo(BrandId), //产品名称
+//                         BizBatchNo = BatchNo, //业务批次号
+//                         TransType = 1, //交易类型
+//                         SnNo = SnNo, //SN编号
+//                         StockOpDirect = 1, //库存操作方向
+//                         SnStatus = 1, //SN状态
+//                         DeviceVendor = machine.DeviceName, //设备厂商
+//                         DeviceModel = machine.DeviceKind, //设备型号
+//                         DeviceType = machine.DeviceType, //设备类型
+//                         FromUserId = tostore.UserId, //出货人
+//                         FromDate = DateTime.Now, //出库时间
+//                         FromRemark = OutNote, //出库备注
+//                         ToUserId = tostore.UserId, //收货人
+//                         ToStoreId = tostore.Id, //退货收货仓库                        
+//                         SourceStoreId = machine.SourceStoreId, //源仓库编号
+//                         BrandType = machine.DeviceType, //品牌类型
+//                     }).Entity;
+//                     db.SaveChanges();
+//                     string ChangeNo = "SC";
+//                     int StoreStockChangeId = stockchange.Id;
+//                     string StoreStockChangeIdString = StoreStockChangeId.ToString();
+//                     for (int j = 0; j < 18 - StoreStockChangeId.ToString().Length; j++)
+//                     {
+//                         StoreStockChangeIdString = "0" + StoreStockChangeIdString;
+//                     }
+//                     ChangeNo += StoreStockChangeIdString;
+//                     stockchange.ChangeNo = ChangeNo; //交易流水编号
+//                     machine.StoreId = tostore.Id;
+
+//                     db.StoreChangeHistory.Add(new StoreChangeHistory()
+//                     {
+//                         CreateDate = DateTime.Now,
+//                         UserId = tostore.UserId, //创客
+//                         BrandId = BrandId, //产品类型
+//                         ChangeRecordNo = ChangeNo, //变更记录单号
+//                         BizBatchNo = BatchNo, //业务批次号
+//                         TransType = 1, //交易类型
+//                         SnNo = SnNo, //SN编号
+//                         SnType = machine.PosSnType, //SN机具类型
+//                         StockOpDirect = 1, //库存操作方向
+//                         DeviceVendor = machine.DeviceName, //设备厂商
+//                         DeviceModel = machine.DeviceKind, //设备型号
+//                         DeviceType = machine.DeviceType, //设备类型
+//                         FromUserId = tostore.UserId, //出货创客
+//                         FromDate = DateTime.Now, //出库时间
+//                         FromRemark = OutNote, //出库备注
+//                         SourceStoreId = machine.SourceStoreId, //源仓库
+//                         StoreId = tostore.Id, //仓库
+//                     });
+
+//                     db.StoreChangeHistory.Add(new StoreChangeHistory()
+//                     {
+//                         CreateDate = DateTime.Now,
+//                         UserId = tostore.UserId, //创客
+//                         BrandId = BrandId, //产品类型
+//                         ChangeRecordNo = ChangeNo, //变更记录单号
+//                         BizBatchNo = BatchNo, //业务批次号
+//                         TransType = 1, //交易类型
+//                         SnNo = SnNo, //SN编号
+//                         SnType = machine.PosSnType, //SN机具类型
+//                         StockOpDirect = 0, //库存操作方向
+//                         DeviceVendor = machine.DeviceName, //设备厂商
+//                         DeviceModel = machine.DeviceKind, //设备型号
+//                         DeviceType = machine.DeviceType, //设备类型
+//                         ToUserId = tostore.UserId, //收货创客
+//                         ToStoreId = tostore.Id, //创客退货收货仓库
+//                         ToDate = DateTime.Now, //入库时间
+//                         ToRemark = OutNote, //入库备注
+//                         SourceStoreId = machine.SourceStoreId, //源仓库
+//                         StoreId = tostore.Id, //仓库
+//                     });
+//                     db.SaveChanges();
+//                 }
+//             }
+//             db.SaveChanges();
+
+//             int StoreId = FromStoreId;
+//             int OpStoreNum = list.Count - 1;
+//             StoreHouse store = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();
+//             StoreBalance balance = db.StoreBalance.Add(new StoreBalance()
+//             {
+//                 CreateDate = DateTime.Now,
+//                 StoreId = StoreId, //仓库
+//                 TransType = 1, //交易类型
+//                 BrandId = BrandId, //产品类型
+//                 OpStoreNum = OpStoreNum, //操作库存数
+//                 OpSymbol = "-", //操作符
+//                 BeforeTotalNum = store.TotalNum, //操作前总库存数
+//                 AfterTotalNum = store.TotalNum, //操作后总库存数
+//                 BeforeLaveNum = store.LaveNum, //操作前剩余库存数
+//                 AfterLaveNum = store.LaveNum - OpStoreNum, //操作后剩余库存数
+//                 BeforeOutNum = store.OutNum, //操作前出库数
+//                 AfterOutNum = store.OutNum + OpStoreNum, //操作后出库数
+//             }).Entity;
+//             db.SaveChanges();
+//             string ChangeNo1 = "SC";
+//             int StoreStockChangeId1 = balance.Id;
+//             string StoreStockChangeId1String = StoreStockChangeId1.ToString();
+//             for (int i = 0; i < 18 - StoreStockChangeId1.ToString().Length; i++)
+//             {
+//                 StoreStockChangeId1String = "0" + StoreStockChangeId1String;
+//             }
+//             ChangeNo1 += StoreStockChangeId1String;
+//             balance.TransRecordNo = ChangeNo1; //交易流水编号
+//             store.LaveNum -= OpStoreNum;
+//             store.OutNum += OpStoreNum;
+//             db.SaveChanges();
             
-            StoreId = tostore.Id;
-            balance = db.StoreBalance.Add(new StoreBalance()
-            {
-                CreateDate = DateTime.Now,
-                StoreId = StoreId, //仓库
-                TransType = 0, //交易类型
-                BrandId = BrandId, //产品类型
-                OpStoreNum = OpStoreNum, //操作库存数
-                OpSymbol = "+", //操作符
-                BeforeTotalNum = store.TotalNum, //操作前总库存数
-                AfterTotalNum = store.TotalNum + OpStoreNum, //操作后总库存数
-                BeforeLaveNum = store.LaveNum, //操作前剩余库存数
-                AfterLaveNum = store.LaveNum + OpStoreNum, //操作后剩余库存数
-                BeforeOutNum = store.OutNum, //操作前出库数
-                AfterOutNum = store.OutNum, //操作后出库数
-            }).Entity;
-            db.SaveChanges();
-            string ChangeNo2 = "SC";
-            int StoreStockChangeId2 = balance.Id;
-            string StoreStockChangeId2String = StoreStockChangeId2.ToString();
-            for (int i = 0; i < 18 - StoreStockChangeId2.ToString().Length; i++)
-            {
-                StoreStockChangeId2String = "0" + StoreStockChangeId2String;
-            }
-            ChangeNo2 += StoreStockChangeId2String;
-            balance.TransRecordNo = ChangeNo2; //交易流水编号
-            store.TotalNum += OpStoreNum;
-            store.LaveNum += OpStoreNum;
-            db.SaveChanges();
-            if (data.Status == 1)
-            {
-                return "success";
-            }
-            else
-            {
-                return "false";
-            }
-
-        }
-        #endregion
-
-    }
-}
+//             StoreId = tostore.Id;
+//             balance = db.StoreBalance.Add(new StoreBalance()
+//             {
+//                 CreateDate = DateTime.Now,
+//                 StoreId = StoreId, //仓库
+//                 TransType = 0, //交易类型
+//                 BrandId = BrandId, //产品类型
+//                 OpStoreNum = OpStoreNum, //操作库存数
+//                 OpSymbol = "+", //操作符
+//                 BeforeTotalNum = store.TotalNum, //操作前总库存数
+//                 AfterTotalNum = store.TotalNum + OpStoreNum, //操作后总库存数
+//                 BeforeLaveNum = store.LaveNum, //操作前剩余库存数
+//                 AfterLaveNum = store.LaveNum + OpStoreNum, //操作后剩余库存数
+//                 BeforeOutNum = store.OutNum, //操作前出库数
+//                 AfterOutNum = store.OutNum, //操作后出库数
+//             }).Entity;
+//             db.SaveChanges();
+//             string ChangeNo2 = "SC";
+//             int StoreStockChangeId2 = balance.Id;
+//             string StoreStockChangeId2String = StoreStockChangeId2.ToString();
+//             for (int i = 0; i < 18 - StoreStockChangeId2.ToString().Length; i++)
+//             {
+//                 StoreStockChangeId2String = "0" + StoreStockChangeId2String;
+//             }
+//             ChangeNo2 += StoreStockChangeId2String;
+//             balance.TransRecordNo = ChangeNo2; //交易流水编号
+//             store.TotalNum += OpStoreNum;
+//             store.LaveNum += OpStoreNum;
+//             db.SaveChanges();
+//             if (data.Status == 1)
+//             {
+//                 return "success";
+//             }
+//             else
+//             {
+//                 return "false";
+//             }
+
+//         }
+//         #endregion
+
+//     }
+// }

+ 2 - 2
Areas/Admin/Views/MainServer/StoreMachineApply/Edit.cshtml

@@ -86,13 +86,13 @@
                                     </script>
                                 </div>
                             </div>
-                            <div class="layui-form-item layui-form-text">
+                            @* <div class="layui-form-item layui-form-text">
                                 <label class="layui-form-label">已发货机具SN</label>
                                 <div class="layui-input-block">
                                     <textarea class="layui-textarea" id="SwapSnExpand" name="SwapSnExpand"
                                         lay-verify="" placeholder="请输入已发货机具SN">@editData.SwapSnExpand</textarea>
                                 </div>
-                            </div>
+                            </div> *@
                             <div class="layui-form-item layui-form-text">
                                 <label class="layui-form-label">申请描述</label>
                                 <div class="layui-input-block">

+ 25 - 0
Models/StoreHouseAmountRecord.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.Models
+{
+    public partial class StoreHouseAmountRecord
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int OperateType { get; set; }
+        public int AmountType { get; set; }
+        public decimal AfterAmount { get; set; }
+        public decimal BeforeAmount { get; set; }
+        public decimal UseAmount { get; set; }
+        public int ApplyId { get; set; }
+        public int UserId { get; set; }
+    }
+}

+ 8 - 15
Models/Storemachineapply.cs

@@ -9,26 +9,19 @@ namespace MySystem.Models
         public int Sort { get; set; }
         public int QueryCount { get; set; }
         public int Status { get; set; }
-        public int Version { get; set; }
         public DateTime? CreateDate { get; set; }
         public DateTime? UpdateDate { get; set; }
-        public string CreateMan { get; set; }
-        public string UpdateMan { get; set; }
         public string SeoTitle { get; set; }
         public string SeoKeyword { get; set; }
         public string SeoDescription { get; set; }
-        public DateTime? ApplyTime { get; set; }
-        public int? BrandId { get; set; }
+        public int UserId { get; set; }
+        public string SendSn { get; set; }
+        public string ErpCode { get; set; }
+        public string SendMode { get; set; }
+        public decimal UseAmount { get; set; }
+        public int SendNum { get; set; }
+        public int ApplyNum { get; set; }
         public string ApplyNo { get; set; }
-        public int? ApplyNum { get; set; }
-        public int? SendNum { get; set; }
-        public int? BoxNum { get; set; }
-        public int? LastApply { get; set; }
-        public int? MaxApply { get; set; }
-        public int? ActualApply { get; set; }
-        public int? UserId { get; set; }
-        public int? StoreId { get; set; }
-        public int? OrderId { get; set; }
-        public string SwapSnExpand { get; set; }
+        public int BrandId { get; set; }
     }
 }

+ 2 - 0
Models/UserAccount.cs

@@ -32,5 +32,7 @@ namespace MySystem.Models
         public int UserProperty { get; set; }
         public int UserType { get; set; }
         public int UserId { get; set; }
+        public decimal TempAmount { get; set; }
+        public decimal FixedAmount { get; set; }
     }
 }

+ 65 - 54
Models/WebCMSEntities.cs

@@ -147,6 +147,7 @@ namespace MySystem.Models
         public virtual DbSet<StoreForCode> StoreForCode { get; set; }
         public virtual DbSet<StoreForName> StoreForName { get; set; }
         public virtual DbSet<StoreHouse> StoreHouse { get; set; }
+        public virtual DbSet<StoreHouseAmountRecord> StoreHouseAmountRecord { get; set; }
         public virtual DbSet<StoreMachineApply> StoreMachineApply { get; set; }
         public virtual DbSet<StoreMallOrderSummary> StoreMallOrderSummary { get; set; }
         public virtual DbSet<StoreSnActivateSummary> StoreSnActivateSummary { get; set; }
@@ -9960,60 +9961,83 @@ namespace MySystem.Models
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
-            modelBuilder.Entity<StoreMachineApply>(entity =>
+            modelBuilder.Entity<StoreHouseAmountRecord>(entity =>
             {
-                entity.HasComment("机具申请记录表");
-
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
-                entity.Property(e => e.ActualApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("实际申请台数");
+                entity.Property(e => e.AfterAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.ApplyNo)
-                    .HasColumnType("varchar(50)")
-                    .HasComment("申请单号")
-                    .HasCharSet("latin1")
-                    .HasCollation("latin1_swedish_ci");
+                entity.Property(e => e.AmountType).HasColumnType("int(11)");
 
-                entity.Property(e => e.ApplyNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("申请箱数");
+                entity.Property(e => e.ApplyId).HasColumnType("int(11)");
 
-                entity.Property(e => e.ApplyTime).HasColumnType("datetime");
+                entity.Property(e => e.BeforeAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.BoxNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("每箱台数");
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
 
-                entity.Property(e => e.BrandId)
-                    .HasColumnType("int(11)")
-                    .HasComment("产品Id");
+                entity.Property(e => e.OperateType).HasColumnType("int(11)");
 
-                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
-                entity.Property(e => e.CreateMan)
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.UseAmount).HasColumnType("decimal(18,2)");
+
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
+            });
+
+            modelBuilder.Entity<StoreMachineApply>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ApplyNo)
                     .HasColumnType("varchar(50)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
-                entity.Property(e => e.LastApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("上月申请台数");
+                entity.Property(e => e.ApplyNum).HasColumnType("int(11)");
 
-                entity.Property(e => e.MaxApply)
-                    .HasColumnType("int(11)")
-                    .HasComment("最多申请台数");
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
 
-                entity.Property(e => e.OrderId)
-                    .HasColumnType("int(11)")
-                    .HasComment("订单Id");
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.ErpCode)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.QueryCount).HasColumnType("int(11)");
 
-                entity.Property(e => e.SendNum)
-                    .HasColumnType("int(11)")
-                    .HasComment("发货箱数");
+                entity.Property(e => e.SendMode)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SendNum).HasColumnType("int(11)");
+
+                entity.Property(e => e.SendSn)
+                    .HasColumnType("mediumtext")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
 
                 entity.Property(e => e.SeoDescription)
                     .HasColumnType("varchar(500)")
@@ -10034,28 +10058,11 @@ namespace MySystem.Models
 
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
-                entity.Property(e => e.StoreId)
-                    .HasColumnType("int(11)")
-                    .HasComment("仓库Id");
-
-                entity.Property(e => e.SwapSnExpand)
-                    .HasColumnType("mediumtext")
-                    .HasComment("已发货机具SN号")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
-
                 entity.Property(e => e.UpdateDate).HasColumnType("datetime");
 
-                entity.Property(e => e.UpdateMan)
-                    .HasColumnType("varchar(50)")
-                    .HasCharSet("utf8")
-                    .HasCollation("utf8_general_ci");
-
-                entity.Property(e => e.UserId)
-                    .HasColumnType("int(11)")
-                    .HasComment("创客Id");
+                entity.Property(e => e.UseAmount).HasColumnType("decimal(18,2)");
 
-                entity.Property(e => e.Version).HasColumnType("int(11)");
+                entity.Property(e => e.UserId).HasColumnType("int(11)");
             });
 
             modelBuilder.Entity<StoreMallOrderSummary>(entity =>
@@ -11744,6 +11751,8 @@ namespace MySystem.Models
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
+                entity.Property(e => e.FixedAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.FreezeAmount).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.LockStatus).HasColumnType("int(11)");
@@ -11775,6 +11784,8 @@ namespace MySystem.Models
 
                 entity.Property(e => e.TeamTotalServiceProfit).HasColumnType("decimal(18,2)");
 
+                entity.Property(e => e.TempAmount).HasColumnType("decimal(18,2)");
+
                 entity.Property(e => e.TotalAmount).HasColumnType("decimal(18,2)");
 
                 entity.Property(e => e.TotalOverProfit).HasColumnType("decimal(18,2)");