|
@@ -304,6 +304,112 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ #region 一键添加仓库
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 一件添加仓库
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <returns></returns>
|
|
|
|
|
+ public IActionResult Edits(string right, int Id = 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ ViewBag.RightInfo = RightInfo;
|
|
|
|
|
+ ViewBag.right = right;
|
|
|
|
|
+
|
|
|
|
|
+ StoreHouse editData = db.StoreHouse.FirstOrDefault(m => m.Id == Id) ?? new StoreHouse();
|
|
|
|
|
+ ViewBag.data = editData;
|
|
|
|
|
+
|
|
|
|
|
+ Users manage = db.Users.FirstOrDefault(m => m.Id == editData.ManageUserId) ?? new Users();
|
|
|
|
|
+ ViewBag.ManageMakerCode = manage.MakerCode;
|
|
|
|
|
+ ViewBag.ManageRealName = manage.RealName;
|
|
|
|
|
+
|
|
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == editData.ManageUserId) ?? new Users();
|
|
|
|
|
+ ViewBag.MakerCode = user.MakerCode;
|
|
|
|
|
+ return View();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region 一键添加仓库
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// 一键添加仓库
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <returns></returns>
|
|
|
|
|
+ [HttpPost]
|
|
|
|
|
+ public string Edits(StoreHouse data, string ManageMakerCode, string MakerCode)
|
|
|
|
|
+ {
|
|
|
|
|
+ Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
|
|
+ StoreHouse storeHouse = db.StoreHouse.FirstOrDefault(m => m.Id == data.Id);
|
|
|
|
|
+ if (!string.IsNullOrEmpty(storeHouse.BrandId))
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您已有该品牌类型的仓库,请重新选择";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!string.IsNullOrEmpty(storeHouse.StoreName))
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您的仓库名重复,请重新填写";
|
|
|
|
|
+ }
|
|
|
|
|
+ Fields.Add("StoreName", data.StoreName); //仓库名称
|
|
|
|
|
+ UserForMakerCode user = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
|
|
|
|
|
+ if (user == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的仓库归属创客编号不存在,请重新输入正确的仓库归属创客编号";
|
|
|
|
|
+ }
|
|
|
|
|
+ Fields.Add("UserId", user.UserId); //仓库归属人
|
|
|
|
|
+ Fields.Add("Areas", data.Areas); //所属地区
|
|
|
|
|
+ Fields.Add("Address", data.Address); //仓库地址
|
|
|
|
|
+ UserForMakerCode manage = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == ManageMakerCode);
|
|
|
|
|
+ if (manage == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "您输入的仓库负责人编号不存在,请重新输入正确的仓库负责人编号";
|
|
|
|
|
+ }
|
|
|
|
|
+ Fields.Add("ManageUserId", manage.UserId); //仓库管理员
|
|
|
|
|
+ Fields.Add("ManagerEmail", data.ManagerEmail); //管理者邮箱
|
|
|
|
|
+ Fields.Add("ManageMobile", data.ManageMobile);
|
|
|
|
|
+ Fields.Add("Remark", data.Remark); //备注
|
|
|
|
|
+ Fields.Add("LimitTopUserId", data.LimitTopUserId); //限制创客特殊仓库
|
|
|
|
|
+ Fields.Add("StoreKind", data.StoreKind); //仓库归属类型
|
|
|
|
|
+ int bid = int.Parse(storeHouse.BrandId);
|
|
|
|
|
+ KqProducts pro = db.KqProducts.FirstOrDefault(m => m.Id == bid) ?? new KqProducts();
|
|
|
|
|
+ Fields.Add("BrandId", storeHouse.BrandId);
|
|
|
|
|
+ Fields.Add("ProductName", pro.Name);
|
|
|
|
|
+ Fields.Add("StoreStatus", 1);
|
|
|
|
|
+ Fields.Add("Status", 1);
|
|
|
|
|
+
|
|
|
|
|
+ int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("StoreHouse", Fields, 0);
|
|
|
|
|
+ StoreHouse edit = db.StoreHouse.FirstOrDefault(m => m.Id == Id);
|
|
|
|
|
+ if (edit != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ string No = Id.ToString();
|
|
|
|
|
+ for (int i = 0; i < 7 - Id.ToString().Length; i++)
|
|
|
|
|
+ {
|
|
|
|
|
+ No = "0" + No;
|
|
|
|
|
+ }
|
|
|
|
|
+ No = "S" + No;
|
|
|
|
|
+ edit.StoreNo = No;
|
|
|
|
|
+ db.StoreForCode.Add(new StoreForCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ Code = No,
|
|
|
|
|
+ StoreId = Id,
|
|
|
|
|
+ });
|
|
|
|
|
+ RedisDbconn.Instance.Set("StoreForCode:" + No, Id);
|
|
|
|
|
+ }
|
|
|
|
|
+ db.StoreForName.Add(new StoreForName()
|
|
|
|
|
+ {
|
|
|
|
|
+ Name = data.StoreName,
|
|
|
|
|
+ StoreId = Id,
|
|
|
|
|
+ });
|
|
|
|
|
+ RedisDbconn.Instance.Set("StoreForName:" + data.StoreName, Id);
|
|
|
|
|
+ AddSysLog(data.Id.ToString(), "StoreHouse", "add");
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+
|
|
|
|
|
+ SetRedis(Id, user.UserId);
|
|
|
|
|
+ return "success";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#region 删除仓库信息
|
|
#region 删除仓库信息
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -459,7 +565,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
if (datalist[0] == "success")
|
|
if (datalist[0] == "success")
|
|
|
{
|
|
{
|
|
|
List<string> errList = RedisDbconn.Instance.GetList<string>("ErrList" + key);
|
|
List<string> errList = RedisDbconn.Instance.GetList<string>("ErrList" + key);
|
|
|
- if(errList.Count > 0)
|
|
|
|
|
|
|
+ if (errList.Count > 0)
|
|
|
{
|
|
{
|
|
|
Obj.Add("status", 2);
|
|
Obj.Add("status", 2);
|
|
|
Obj.Add("errList", errList);
|
|
Obj.Add("errList", errList);
|
|
@@ -594,7 +700,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
#region 仓库列表
|
|
#region 仓库列表
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -622,7 +728,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
|
|
OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
|
|
|
string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
|
string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
|
- if(!string.IsNullOrEmpty(CreateDateData))
|
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(CreateDateData))
|
|
|
{
|
|
{
|
|
|
string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
sCreateDate = datelist[0] + " 00:00:00";
|
|
sCreateDate = datelist[0] + " 00:00:00";
|
|
@@ -635,7 +741,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
nodata.Add("msg", "");
|
|
nodata.Add("msg", "");
|
|
|
nodata.Add("count", 0);
|
|
nodata.Add("count", 0);
|
|
|
nodata.Add("data", new List<Dictionary<string, object>>());
|
|
nodata.Add("data", new List<Dictionary<string, object>>());
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return Json(nodata);
|
|
return Json(nodata);
|
|
|
}
|
|
}
|
|
|
string minId = "0";
|
|
string minId = "0";
|
|
@@ -643,52 +749,52 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
string minPosId = "0";
|
|
string minPosId = "0";
|
|
|
string maxPosId = "0";
|
|
string maxPosId = "0";
|
|
|
DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
|
- if(startDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
|
- if(minId == "0")
|
|
|
|
|
|
|
+ if (minId == "0")
|
|
|
{
|
|
{
|
|
|
startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
|
- if(startDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
|
- if(endDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
|
- if(minId == "0")
|
|
|
|
|
|
|
+ if (minId == "0")
|
|
|
{
|
|
{
|
|
|
endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
|
- if(endDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
|
- if(startPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
|
- if(minPosId == "0")
|
|
|
|
|
|
|
+ if (minPosId == "0")
|
|
|
{
|
|
{
|
|
|
startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
|
- if(startPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
|
- if(endPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
|
- if(maxPosId == "0")
|
|
|
|
|
|
|
+ if (maxPosId == "0")
|
|
|
{
|
|
{
|
|
|
endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
|
- if(endPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
@@ -718,7 +824,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
obj.Add("msg", "");
|
|
obj.Add("msg", "");
|
|
|
obj.Add("count", recordcount);
|
|
obj.Add("count", recordcount);
|
|
|
obj.Add("data", diclist);
|
|
obj.Add("data", diclist);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return Json(obj);
|
|
return Json(obj);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -735,7 +841,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
|
|
OtherMySqlConn.connstr = ConfigurationManager.AppSettings["StatSqlConnStr"].ToString();
|
|
|
string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
string sCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
|
string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
string eCreateDate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
|
- if(!string.IsNullOrEmpty(CreateDateData))
|
|
|
|
|
|
|
+ if (!string.IsNullOrEmpty(CreateDateData))
|
|
|
{
|
|
{
|
|
|
string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
sCreateDate = datelist[0] + " 00:00:00";
|
|
sCreateDate = datelist[0] + " 00:00:00";
|
|
@@ -765,52 +871,52 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
string minPosId = "0";
|
|
string minPosId = "0";
|
|
|
string maxPosId = "0";
|
|
string maxPosId = "0";
|
|
|
DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
DataTable startDt = OtherMySqlConn.dtable("select min(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
|
- if(startDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
|
- if(minId == "0")
|
|
|
|
|
|
|
+ if (minId == "0")
|
|
|
{
|
|
{
|
|
|
startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
startDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
|
- if(startDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
minId = function.CheckInt(startDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
DataTable endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange where CreateDate>='" + sCreateDate + "'");
|
|
|
- if(endDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
|
- if(minId == "0")
|
|
|
|
|
|
|
+ if (minId == "0")
|
|
|
{
|
|
{
|
|
|
endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
endDt = OtherMySqlConn.dtable("select max(Id) from StoreStockChange");
|
|
|
- if(endDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
maxId = function.CheckInt(endDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
DataTable startPosDt = OtherMySqlConn.dtable("select min(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
|
- if(startPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
|
- if(minPosId == "0")
|
|
|
|
|
|
|
+ if (minPosId == "0")
|
|
|
{
|
|
{
|
|
|
startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
startPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
|
- if(startPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (startPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
minPosId = function.CheckInt(startPosDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
DataTable endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo where ActivationTime>='" + sCreateDate + "'");
|
|
|
- if(endPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
|
- if(maxPosId == "0")
|
|
|
|
|
|
|
+ if (maxPosId == "0")
|
|
|
{
|
|
{
|
|
|
endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
endPosDt = OtherMySqlConn.dtable("select max(Id) from PosMachinesTwo");
|
|
|
- if(endPosDt.Rows.Count > 0)
|
|
|
|
|
|
|
+ if (endPosDt.Rows.Count > 0)
|
|
|
{
|
|
{
|
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
maxPosId = function.CheckInt(endPosDt.Rows[0][0].ToString());
|
|
|
}
|
|
}
|