|
|
@@ -25,6 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
public StoreMachineApplyController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
{
|
|
|
+ OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
}
|
|
|
|
|
|
#region 分仓机具申请记录列表
|
|
|
@@ -37,8 +38,8 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
@@ -52,45 +53,45 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// <returns></returns>
|
|
|
public JsonResult IndexData(StoreMachineApply data, string BrandIdSelect, string UserIdRealName, string UserIdMakerCode, int page = 1, int limit = 30)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
-
|
|
|
+
|
|
|
Fields.Add("CreateDate", "3"); //时间
|
|
|
-Fields.Add("ApplyNo", "1"); //申请单号
|
|
|
-Fields.Add("SendMode", "1"); //发货方式
|
|
|
+ Fields.Add("ApplyNo", "1"); //申请单号
|
|
|
+ Fields.Add("SendMode", "1"); //发货方式
|
|
|
|
|
|
|
|
|
string condition = " and Status>-1";
|
|
|
//品牌
|
|
|
-if (!string.IsNullOrEmpty(BrandIdSelect))
|
|
|
-{
|
|
|
-condition += " and BrandId=" + BrandIdSelect;
|
|
|
-}
|
|
|
-//创客真实姓名
|
|
|
-if (!string.IsNullOrEmpty(UserIdRealName))
|
|
|
-{
|
|
|
-condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
|
|
|
-}
|
|
|
-//创客创客编号
|
|
|
-if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
|
-{
|
|
|
-condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
|
|
|
-}
|
|
|
+ if (!string.IsNullOrEmpty(BrandIdSelect))
|
|
|
+ {
|
|
|
+ condition += " and BrandId=" + BrandIdSelect;
|
|
|
+ }
|
|
|
+ //创客真实姓名
|
|
|
+ if (!string.IsNullOrEmpty(UserIdRealName))
|
|
|
+ {
|
|
|
+ condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
|
|
|
+ }
|
|
|
+ //创客创客编号
|
|
|
+ if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
|
+ {
|
|
|
+ condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).IndexData("StoreMachineApply", Fields, "Id desc", "0", page, limit, condition);
|
|
|
+ Dictionary<string, object> obj = new AdminContent(_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.GetKqProductsInfo(int.Parse(dic["BrandId"].ToString()));
|
|
|
-dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
|
|
|
-//创客
|
|
|
-int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
|
|
|
-Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
-dic["UserIdRealName"] = userid_Users.RealName;
|
|
|
-dic["UserIdMakerCode"] = userid_Users.MakerCode;
|
|
|
-dic.Remove("UserId");
|
|
|
+ dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
|
|
|
+ dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
|
|
|
+ //创客
|
|
|
+ int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
|
|
|
+ Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
+ dic["UserIdRealName"] = userid_Users.RealName;
|
|
|
+ dic["UserIdMakerCode"] = userid_Users.MakerCode;
|
|
|
+ dic.Remove("UserId");
|
|
|
|
|
|
}
|
|
|
return Json(obj);
|
|
|
@@ -108,7 +109,7 @@ dic.Remove("UserId");
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
return View();
|
|
|
}
|
|
|
@@ -125,24 +126,24 @@ dic.Remove("UserId");
|
|
|
public string Add(StoreMachineApply data)
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
-
|
|
|
+
|
|
|
Fields.Add("BrandId", data.BrandId); //品牌
|
|
|
-Fields.Add("ApplyNo", data.ApplyNo); //申请单号
|
|
|
-Fields.Add("ApplyNum", data.ApplyNum); //申请台数
|
|
|
-Fields.Add("SendNum", data.SendNum); //发货台数
|
|
|
-Fields.Add("UseAmount", data.UseAmount); //使用额度
|
|
|
-Fields.Add("SendMode", data.SendMode); //发货方式
|
|
|
-Fields.Add("ErpCode", data.ErpCode); //快递单号
|
|
|
-Fields.Add("SendSn", data.SendSn); //发货SN数据
|
|
|
-Fields.Add("UserId", data.UserId); //创客
|
|
|
+ Fields.Add("ApplyNo", data.ApplyNo); //申请单号
|
|
|
+ Fields.Add("ApplyNum", data.ApplyNum); //申请台数
|
|
|
+ Fields.Add("SendNum", data.SendNum); //发货台数
|
|
|
+ Fields.Add("UseAmount", data.UseAmount); //使用额度
|
|
|
+ Fields.Add("SendMode", data.SendMode); //发货方式
|
|
|
+ Fields.Add("ErpCode", data.ErpCode); //快递单号
|
|
|
+ Fields.Add("SendSn", data.SendSn); //发货SN数据
|
|
|
+ Fields.Add("UserId", data.UserId); //创客
|
|
|
|
|
|
Fields.Add("SeoTitle", data.SeoTitle);
|
|
|
Fields.Add("SeoKeyword", data.SeoKeyword);
|
|
|
Fields.Add("SeoDescription", data.SeoDescription);
|
|
|
- int Id = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Add("StoreMachineApply", Fields, 0);
|
|
|
+ int Id = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreMachineApply", Fields, 0);
|
|
|
AddSysLog(data.Id.ToString(), "StoreMachineApply", "add");
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -158,7 +159,7 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
StoreMachineApply editData = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new StoreMachineApply();
|
|
|
ViewBag.data = editData;
|
|
|
@@ -177,24 +178,24 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
public string Edit(StoreMachineApply data)
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
-
|
|
|
+
|
|
|
Fields.Add("BrandId", data.BrandId); //品牌
|
|
|
-Fields.Add("ApplyNo", data.ApplyNo); //申请单号
|
|
|
-Fields.Add("ApplyNum", data.ApplyNum); //申请台数
|
|
|
-Fields.Add("SendNum", data.SendNum); //发货台数
|
|
|
-Fields.Add("UseAmount", data.UseAmount); //使用额度
|
|
|
-Fields.Add("SendMode", data.SendMode); //发货方式
|
|
|
-Fields.Add("ErpCode", data.ErpCode); //快递单号
|
|
|
-Fields.Add("SendSn", data.SendSn); //发货SN数据
|
|
|
-Fields.Add("UserId", data.UserId); //创客
|
|
|
+ Fields.Add("ApplyNo", data.ApplyNo); //申请单号
|
|
|
+ Fields.Add("ApplyNum", data.ApplyNum); //申请台数
|
|
|
+ Fields.Add("SendNum", data.SendNum); //发货台数
|
|
|
+ Fields.Add("UseAmount", data.UseAmount); //使用额度
|
|
|
+ Fields.Add("SendMode", data.SendMode); //发货方式
|
|
|
+ Fields.Add("ErpCode", data.ErpCode); //快递单号
|
|
|
+ Fields.Add("SendSn", data.SendSn); //发货SN数据
|
|
|
+ Fields.Add("UserId", data.UserId); //创客
|
|
|
|
|
|
Fields.Add("SeoTitle", data.SeoTitle);
|
|
|
Fields.Add("SeoKeyword", data.SeoKeyword);
|
|
|
Fields.Add("SeoDescription", data.SeoDescription);
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("StoreMachineApply", Fields, data.Id);
|
|
|
- AddSysLog(data.Id.ToString(),"StoreMachineApply","update");
|
|
|
+ new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, data.Id);
|
|
|
+ AddSysLog(data.Id.ToString(), "StoreMachineApply", "update");
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -209,16 +210,16 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
public string Delete(string Id)
|
|
|
{
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
- AddSysLog(Id,"StoreMachineApply","del");
|
|
|
+ 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 AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("StoreMachineApply", Fields, id);
|
|
|
+ new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -233,13 +234,13 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
public string Open(string Id)
|
|
|
{
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
- AddSysLog(Id,"StoreMachineApply","open");
|
|
|
+ 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 AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("StoreMachineApply", Fields, id);
|
|
|
+ new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
return "success";
|
|
|
@@ -256,13 +257,13 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
public string Close(string Id)
|
|
|
{
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
- AddSysLog(Id,"StoreMachineApply","close");
|
|
|
+ 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 AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("StoreMachineApply", Fields, id);
|
|
|
+ new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Edit("StoreMachineApply", Fields, id);
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
return "success";
|
|
|
@@ -277,8 +278,8 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
/// <param name="Id"></param>
|
|
|
public string Sort(int Id, int Sort)
|
|
|
{
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Sort("StoreMachineApply", Sort, Id);
|
|
|
-
|
|
|
+ new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).Sort("StoreMachineApply", Sort, Id);
|
|
|
+
|
|
|
AddSysLog(Id.ToString(), "StoreMachineApply", "sort");
|
|
|
return "success";
|
|
|
}
|
|
|
@@ -293,15 +294,15 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
{
|
|
|
ExcelData = HttpUtility.UrlDecode(ExcelData);
|
|
|
JsonData list = JsonMapper.ToObject(ExcelData);
|
|
|
- for (int i = 1; i < list.Count;i++ )
|
|
|
+ for (int i = 1; i < list.Count; i++)
|
|
|
{
|
|
|
JsonData dr = list[i];
|
|
|
-
|
|
|
+
|
|
|
db.StoreMachineApply.Add(new StoreMachineApply()
|
|
|
{
|
|
|
CreateDate = DateTime.Now,
|
|
|
UpdateDate = DateTime.Now,
|
|
|
-
|
|
|
+
|
|
|
});
|
|
|
db.SaveChanges();
|
|
|
}
|
|
|
@@ -320,41 +321,41 @@ Fields.Add("UserId", data.UserId); //创客
|
|
|
{
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
Fields.Add("CreateDate", "3"); //时间
|
|
|
-Fields.Add("ApplyNo", "1"); //申请单号
|
|
|
-Fields.Add("SendMode", "1"); //发货方式
|
|
|
+ Fields.Add("ApplyNo", "1"); //申请单号
|
|
|
+ Fields.Add("SendMode", "1"); //发货方式
|
|
|
|
|
|
|
|
|
string condition = " and Status>-1";
|
|
|
//品牌
|
|
|
-if (!string.IsNullOrEmpty(BrandIdSelect))
|
|
|
-{
|
|
|
-condition += " and BrandId=" + BrandIdSelect;
|
|
|
-}
|
|
|
-//创客真实姓名
|
|
|
-if (!string.IsNullOrEmpty(UserIdRealName))
|
|
|
-{
|
|
|
-condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
|
|
|
-}
|
|
|
-//创客创客编号
|
|
|
-if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
|
-{
|
|
|
-condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
|
|
|
-}
|
|
|
+ if (!string.IsNullOrEmpty(BrandIdSelect))
|
|
|
+ {
|
|
|
+ condition += " and BrandId=" + BrandIdSelect;
|
|
|
+ }
|
|
|
+ //创客真实姓名
|
|
|
+ if (!string.IsNullOrEmpty(UserIdRealName))
|
|
|
+ {
|
|
|
+ condition += " and UserId in (select UserId from UsersForRealName where RealName='" + UserIdRealName + "')";
|
|
|
+ }
|
|
|
+ //创客创客编号
|
|
|
+ if (!string.IsNullOrEmpty(UserIdMakerCode))
|
|
|
+ {
|
|
|
+ condition += " and UserId in (select UserId from UsersForMakerCode where MakerCode='" + UserIdMakerCode + "')";
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).IndexData("StoreMachineApply", Fields, "Id desc", "0", 1, 20000, condition, "BrandId,ApplyNo,ApplyNum,SendNum,UseAmount,SendMode,ErpCode,UserId", false);
|
|
|
+ Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, PublicFunction.MainTables).IndexData("StoreMachineApply", Fields, "Id desc", "0", 1, 20000, condition, "BrandId,ApplyNo,ApplyNum,SendNum,UseAmount,SendMode,ErpCode,UserId", false);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|
|
|
//品牌
|
|
|
-dic["BrandId"] = RelationClass.GetKqProductsInfo(int.Parse(dic["BrandId"].ToString()));
|
|
|
-dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
|
|
|
-//创客
|
|
|
-int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
|
|
|
-Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
-dic["UserIdRealName"] = userid_Users.RealName;
|
|
|
-dic["UserIdMakerCode"] = userid_Users.MakerCode;
|
|
|
-dic.Remove("UserId");
|
|
|
+ dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
|
|
|
+ dic["StatusName"] = dic["Status"].ToString() == "1" ? "正常" : "关闭";
|
|
|
+ //创客
|
|
|
+ int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
|
|
|
+ Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
+ dic["UserIdRealName"] = userid_Users.RealName;
|
|
|
+ dic["UserIdMakerCode"] = userid_Users.MakerCode;
|
|
|
+ dic.Remove("UserId");
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -364,14 +365,14 @@ dic.Remove("UserId");
|
|
|
result.Add("Obj", diclist);
|
|
|
Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
|
|
|
ReturnFields.Add("BrandId", "品牌");
|
|
|
-ReturnFields.Add("ApplyNo", "申请单号");
|
|
|
-ReturnFields.Add("ApplyNum", "申请台数");
|
|
|
-ReturnFields.Add("SendNum", "发货台数");
|
|
|
-ReturnFields.Add("UseAmount", "使用额度");
|
|
|
-ReturnFields.Add("SendMode", "发货方式");
|
|
|
-ReturnFields.Add("ErpCode", "快递单号");
|
|
|
-ReturnFields.Add("UserIdRealName", "创客真实姓名");
|
|
|
-ReturnFields.Add("UserIdMakerCode", "创客创客编号");
|
|
|
+ ReturnFields.Add("ApplyNo", "申请单号");
|
|
|
+ ReturnFields.Add("ApplyNum", "申请台数");
|
|
|
+ ReturnFields.Add("SendNum", "发货台数");
|
|
|
+ ReturnFields.Add("UseAmount", "使用额度");
|
|
|
+ ReturnFields.Add("SendMode", "发货方式");
|
|
|
+ ReturnFields.Add("ErpCode", "快递单号");
|
|
|
+ ReturnFields.Add("UserIdRealName", "创客真实姓名");
|
|
|
+ ReturnFields.Add("UserIdMakerCode", "创客创客编号");
|
|
|
|
|
|
result.Add("Fields", ReturnFields);
|
|
|
AddSysLog("0", "StoreMachineApply", "ExportExcel");
|