You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1116 lines
36 KiB
C#

using NetLibrary.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using TradeData;
using TradeModel;
using NetLibrary.OnlineTrade;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.IO;
using NetLibrary;
namespace TradeManage
{
/// <summary>
/// BaseData 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
[System.Web.Script.Services.ScriptService]
public class BaseData : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
#region 保存审批配置
[WebMethod(EnableSession = true)]
public int SaveCheckConfig(List<SP_CheckConfig> list, string CheckType)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
obj.DeleteCheckConfig(CheckType, CompanyId);
for(int i=0;i<list.Count;i++)
{
list[i].CompanyId = CompanyId;
list[i].CheckUserId = list[i].CheckUserId.Trim(',');
obj.SaveCheckConfig(list[i]);
}
return 0;
}
#endregion
#region 查询采购审批人,财务人
[WebMethod(EnableSession = true)]
public List<JC_UserInfo> GetCheckConfig(int StepNo, string CheckType)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
var obj = new BaseService();
var model = obj.GetCheckConfig(CompanyId, CheckType, StepNo);
if (model != null && model.CheckUserId != null)
{
var obj1 = new JC_UserInfoService();
RefParameterCollection Param = new RefParameterCollection();
Param.Add("UserId", "in", model.CheckUserId.Trim(','), DbType.String);
var list = obj1.GetUserInfoList(Param);
return list;
}
return null;
}
#endregion
#region 平台店铺主管
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetShopListMaster(int PlatType)
{
Pages.Login(this.Session);
int UserId = Convert.ToInt32(Session["UserId"]);
string UserType = Convert.ToString(Session["UserType"]);
BaseService obj = new BaseService();
var list = obj.GetShopListMaster(UserId, PlatType, UserType);
return list;
}
#endregion
#region 平台店铺主管
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetShopAllList(int PlatType)
{
Pages.Login(this.Session);
int UserId = Convert.ToInt32(Session["UserId"]);
BaseService obj = new BaseService();
var list = obj.GetShopListMaster(UserId, PlatType, "M");
return list;
}
#endregion
#region 平台店铺
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetShopListForTM(int PlatType)
{
Pages.Login(this.Session);
int UserId = Convert.ToInt32(Session["UserId"]);
string UserType = Convert.ToString(Session["UserType"]);
BaseService obj = new BaseService();
var list = obj.GetShopListUser(UserId, PlatType, UserType);
return list;
}
#endregion
#region 平台店铺
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetShopListForTM2(int DeptId,int PlatType)
{
Pages.Login(this.Session);
int UserId = Convert.ToInt32(Session["UserId"]);
string UserType = Convert.ToString(Session["UserType"]);
BaseService obj = new BaseService();
var list = obj.GetShopListUser2(DeptId,UserId, PlatType, UserType);
return list;
}
#endregion
#region 平台店铺
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetDeptShopListForTM(int PlatType)
{
Pages.Login(this.Session);
int UserId = Convert.ToInt32(Session["UserId"]);
string UserType = Convert.ToString(Session["UserType"]);
BaseService obj = new BaseService();
var list = obj.GetDeptShopListUser(UserId, PlatType, UserType);
return list;
}
#endregion
#region 平台店铺
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetShopList(int PlatType)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetShopList(CompanyId, PlatType);
return list;
}
#endregion
#region 平台部门店铺
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetDeptShopList(int PlatType,int DeptId)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetDeptShopList(CompanyId, PlatType, DeptId);
return list;
}
#endregion
#region 平台店铺
[WebMethod(EnableSession = true)]
public List<JC_Shop> GetAllShopList()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetAllShopList(CompanyId);
return list;
}
#endregion
#region 资源列表
[WebMethod(EnableSession = true)]
public List<JC_Resource> GetResourceList(string Ids)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetResourceList(Ids);
return list;
}
#endregion
#region 首页订单数
[WebMethod(EnableSession = true)]
public DT_DefaultData GetDefaultData(DateTime? st,Decimal MRate)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
// DateTime st=new DateTime();
// st =Convert.ToDateTime("2014-04-10");
var model = obj.GetDefaultData(CompanyId, st);
if (model != null)
{
model.AddPrice = model.TotalPrice * MRate;
}
return model;
}
#endregion
#region 首页订单数
[WebMethod(EnableSession = true)]
public DT_DefaultData GetDefaultDataForTM(DateTime? st, Decimal MRate)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
// DateTime st=new DateTime();
// st =Convert.ToDateTime("2014-04-10");
var model = obj.GetDefaultDataForTM(CompanyId, st, st.Value.AddDays(-1));
//if (model != null)
//{
// model.AddPrice = model.TotalPrice * MRate;
//}
return model;
}
#endregion
#region 首页订单数
[WebMethod(EnableSession = true)]
public DT_DefaultData GetDefaultDataForTM2(DateTime? st, Decimal MRate)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
// DateTime st=new DateTime();
// st =Convert.ToDateTime("2014-04-10");
DateTime sdate = Convert.ToDateTime(DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + " 08:00");
DateTime edate = Convert.ToDateTime(DateTime.Today.ToString("yyyy-MM-dd") + " 08:00");
var model = obj.GetDefaultDataForTM2(CompanyId, st, st.Value.AddDays(-1), sdate, edate);
//if (model != null)
//{
// model.AddPrice = model.TotalPrice * MRate;
//}
return model;
}
#endregion
#region 首页订单数
[WebMethod(EnableSession = true)]
public DT_DefaultData2 GetDefaultDataForTM3()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var model = obj.GetDefaultDataForTM3(CompanyId);
//if (model != null)
//{
// model.AddPrice = model.TotalPrice * MRate;
//}
return model;
}
#endregion
#region 仓库剩余立方
[WebMethod(EnableSession = true)]
public List<CK_StoreHouse> GetLeftSolid()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetLeftSolid(CompanyId);
return list;
}
#endregion
#region 读取未读数量
[WebMethod(EnableSession = true)]
public DefaultReadNum GetDefaultUnRead()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
int UserId = Convert.ToInt32(Session["UserId"]);
BaseService obj = new BaseService();
var model = obj.GetDefaultUnRead(CompanyId, UserId);
return model;
}
#endregion
#region 读取物流渠道
[WebMethod(EnableSession = true)]
public List<JC_ExpressDetail> GetExpressPostList(int LogisticsId)
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetExpressPostList(CompanyId, LogisticsId);
return list;
}
#endregion
#region 读取国家
[WebMethod(EnableSession = true)]
public List<JC_Country> GetCountryList()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
return obj.GetCountryList(CompanyId);
}
#endregion
#region 读取通知公告
[WebMethod(EnableSession = true)]
public List<TZ_Notice> GetNoticeList()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetNoticeList(CompanyId);
return list;
}
#endregion
#region 读取留言模板
[WebMethod(EnableSession = true)]
public List<LY_Templete> GetTempleteList()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
return obj.GetLY_TempleteList(CompanyId);
}
#endregion
#region 保存留言
[WebMethod(EnableSession = true)]
public void SaveLY_Content(List<LY_Content> list)
{
Pages.Login(this.Session);
BaseService obj1 = new BaseService();
int UserId = Convert.ToInt32(Session["UserId"]);
if (list == null)
return;
JC_Shop ShopModel = null;
int ShopId = 0;
foreach (var model in list)
{
model.InUserId = UserId;
model.InDate = DateTime.Now;
obj1.SaveLY_Content(model);
AlibabaApi obj = new AlibabaApi();
if (ShopId!=model.ShopId.Value)
ShopModel = JC_ShopService.GetModel(model.ShopId.Value);
ShopId = model.ShopId.Value;
obj.Appkey = ShopModel.Appkey;
obj.DeveKey = ShopModel.DeveKey;
obj.RefreshToken = ShopModel.RefreshToken;
obj.AccessToken = ShopModel.AccessToken;
obj.GroupName = ShopModel.ShopName;
obj.RefreshTokenSaveTime = ShopModel.RefreshTokenSaveTime;
obj.AccessTokenUpdateTime = ShopModel.AccessTokenUpdateTime;
//obj.Code = "66ef3e1d-ecc3-4008-adf5-5a57f11e66bb";
string mess = "";
if (model.OrderCode.StartsWith("H"))
model.OrderCode = model.OrderCode.Substring(1);
string detail = obj.GetOrderstr(model.OrderCode, out mess);
JObject sigle = (JObject)JsonConvert.DeserializeObject(detail);
string country = sigle["receiptAddress"]["country"].ToString();
string buyid = sigle["buyerloginid"].ToString();
obj.BackLeaveWord(model.OrderCode, buyid, model.BackContent, "order_msg", out mess);
//obj.GetMsgData(model.OrderCode, out mess);
Pages.SaveLog(UserId, "回复留言", model.OrderCode.ToString() + "留言", 0);
}
}
#endregion
#region 保存留言
[WebMethod(EnableSession = true)]
public void SaveLY_Content2(List<LY_Content> list)
{
Pages.Login(this.Session);
BaseService obj1 = new BaseService();
int UserId = Convert.ToInt32(Session["UserId"]);
if (list == null)
return;
var flist = obj1.GetAliFaceImgList();
foreach (var model in list)
{
model.InUserId = UserId;
model.InDate = DateTime.Now;
while(model.BackContent.Contains("<img"))
{
int s = model.BackContent.IndexOf("<img");
int e = model.BackContent.IndexOf("/>");
string imghtml = model.BackContent.Substring(s, e-s);
string imgcode="";
if (flist != null)
{
foreach (var facemd in flist)
{
if (imghtml.Contains(facemd.ImgUrl))
{
imgcode = facemd.Code;
break;
}
}
}
model.BackContent = model.BackContent.Substring(0, s) + imgcode + model.BackContent.Substring(e + 2);
}
obj1.SaveLY_Content(model);
AlibabaApi obj = new AlibabaApi();
JC_Shop ShopModel = JC_ShopService.GetModel(model.ShopId.Value);
obj.Appkey = ShopModel.Appkey;
obj.DeveKey = ShopModel.DeveKey;
obj.RefreshToken = ShopModel.RefreshToken;
obj.AccessToken = ShopModel.AccessToken;
obj.GroupName = ShopModel.ShopName;
obj.RefreshTokenSaveTime = ShopModel.RefreshTokenSaveTime;
obj.AccessTokenUpdateTime = ShopModel.AccessTokenUpdateTime;
//obj.Code = "66ef3e1d-ecc3-4008-adf5-5a57f11e66bb";
string mess = "";
if (model.OrderCode.StartsWith("H"))
model.OrderCode = model.OrderCode.Substring(1);
var obj2= new DD_OrderData();
obj2.UpdateLeavewordBackState(model.OrderCode);
obj.BackLeaveWord(model.OrderCode, model.CustomId, model.BackContent, "order_msg", out mess);
obj.GetMsgData(model.OrderCode, out mess);
Pages.SaveLog(UserId, "回复留言", model.OrderCode.ToString() + "留言", 0);
}
}
#endregion
#region 删除模板
[WebMethod(EnableSession = true)]
public void DeleteLY_Templete(int Id)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
obj.DeleteTemplete(Id);
}
#endregion
#region 保存模板
[WebMethod(EnableSession = true)]
public void SaveLY_Templete(LY_Templete model)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
model.CompanyId = CompanyId;
obj.SaveLY_Templete(model);
}
#endregion
#region 保存模板
[WebMethod(EnableSession = true)]
public LY_Templete GetLY_Templete(int Id)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
return obj.GetTempleteModel(Id);
}
#endregion
#region 读取平台使用情况
[WebMethod(EnableSession = true)]
public JC_CompanyUse GetCompanyUseModel(int CompanyId)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
return obj.GetCompanyUseModel(CompanyId);
}
#endregion
#region 保存线上发货模板
[WebMethod(EnableSession = true)]
public void SaveOnlineTemp(JC_OnlineTemp md)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
md.CompanyId = CompanyId;
obj.SaveOnlineTemp(md);
}
#endregion
#region 读取线上发货模板
[WebMethod(EnableSession = true)]
public List<JC_OnlineTemp> GetOnlineTempList()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
return obj.GetOnlineTempList(CompanyId);
}
#endregion
#region 读取线上发货模板
[WebMethod(EnableSession = true)]
public JC_OnlineTemp GetOnlineTempModel(int Id)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
return obj.GetOnlineTempModel(Id);
}
#endregion
#region 删除线上发货模板
[WebMethod(EnableSession = true)]
public void DeleteOnlineTemp(int Id)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
obj.DeleteOnlineTemp(Id);
}
#endregion
#region 读取国内物流
[WebMethod(EnableSession = true)]
public List<JC_InnerExpress> GetInnerPostList()
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
return obj.GetInnerPostList();
}
#endregion
#region 保存消息
[WebMethod(EnableSession = true)]
public void SaveOpenMess(int UserId,string Content,DateTime? InDate)
{
Pages.Login(this.Session);
JC_OpenMess mess = new JC_OpenMess();
string Name = Convert.ToString(Session["Name"]);
int InUserId = Convert.ToInt32(Session["UserId"]);
mess.InUserId = InUserId;
mess.UserId = UserId;
mess.UserType = "p";
mess.Content = Content + " From【" + Name + "】";
mess.IsRead = 0;
if (InDate == null)
mess.OpenDate = DateTime.Now;
else
mess.OpenDate = InDate;
BaseService.SaveOpenMess(mess);
}
#endregion
#region 保存选品
[WebMethod(EnableSession = true)]
public void SaveGoodsSelect(XP_GoodsSelectModel model)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
var obj1 = new HuoWuData();
int UserId = Convert.ToInt32(Session["UserId"]);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
string Name = Convert.ToString(Session["Name"]);
model.InUserId = UserId;
// model.InName = Name;
model.SortName = obj1.GetGoodsSortName(model.SortId.Value);
model.CompanyId = CompanyId;
model.InDate = DateTime.Now;
model.IsAdd = 0;
if (model.CheckState1 == 1)
model.CheckDate1 = DateTime.Now;
if (model.CheckState2 == 1)
model.CheckDate2 = DateTime.Now;
//model.CheckUId2 = 1;
obj.SaveGoodsSelect(model);
//JC_OpenMess mess = new JC_OpenMess();
//mess.UserId = model.CheckUId1;
//mess.UserType = "p";
//mess.Content =model.InName+"有个选品让你审核,尽快进选品系统审核";
//mess.IsRead = 0;
//mess.OpenDate = DateTime.Now;
//BaseService.SaveOpenMess(mess);
}
#endregion
#region 删除选品
[WebMethod(EnableSession = true)]
public void DeleteXP(int Id)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
obj.UpdateXP(Id);
}
#endregion
#region 保存选品部门审批
[WebMethod(EnableSession = true)]
public void SaveDeptCheck(XP_GoodsSelectModel model)
{
Pages.Login(this.Session);
string Name = Convert.ToString(Session["Name"]);
BaseService obj = new BaseService();
model.CheckDate1 = DateTime.Now;
obj.SaveDeptSelectCheck(model);
//JC_OpenMess mess = new JC_OpenMess();
//mess.UserId = model.CheckUId2;
//mess.UserType = "p";
//mess.Content = Name + "有个选品让你审核,尽快进选品系统审核";
//mess.IsRead = 0;
//mess.OpenDate = DateTime.Now;
//BaseService.SaveOpenMess(mess);
}
#endregion
#region 保存选品部门审批
[WebMethod(EnableSession = true)]
public void SaveDeptCheckList(List<XP_GoodsSelectModel> list)
{
Pages.Login(this.Session);
if (list == null || list.Count==0)
return;
string Name = Convert.ToString(Session["Name"]);
int UserId = Convert.ToInt32(Session["UserId"]);
BaseService obj = new BaseService();
var clist = obj.GetCompanyXPCheck(UserId);
foreach (var model in list)
{
model.CheckDate1 = DateTime.Now;
if (clist != null && clist.Count>0)
{
model.CheckUId2 = clist[0].UserId;
model.CheckName2 = clist[0].Name;
}
obj.SaveDeptSelectCheck(model);
//JC_OpenMess mess = new JC_OpenMess();
//mess.UserId = model.CheckUId2;
//mess.UserType = "p";
//mess.Content = Name + "有个选品让你审核,尽快进选品系统审核";
//mess.IsRead = 0;
//mess.OpenDate = DateTime.Now;
//BaseService.SaveOpenMess(mess);
}
}
#endregion
#region 保存选品领导审批
[WebMethod(EnableSession = true)]
public void SaveCompanyCheck(XP_GoodsSelectModel model)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
model.CheckDate2 = DateTime.Now;
obj.SaveCompanySelectCheck(model);
string Content=model.GoodsName;
// if (model.CheckState2 == 1)
// Content +="审核通过,可以加入系统";
// else if (model.CheckState2 == 2)
// Content += "审核未通过,详细请进入选品系统查询";
//JC_OpenMess mess = new JC_OpenMess();
// mess.UserId = model.InUserId;
// mess.UserType = "p";
// mess.Content=Content;
// mess.IsRead = 0;
// mess.OpenDate = DateTime.Now;
// BaseService.SaveOpenMess(mess);
}
#endregion
#region 保存选品领导审批
[WebMethod(EnableSession = true)]
public void SaveCompanyCheckList(List<XP_GoodsSelectModel> list)
{
Pages.Login(this.Session);
if (list == null || list.Count == 0)
return;
BaseService obj = new BaseService();
foreach (var model in list)
{
model.CheckDate2 = DateTime.Now;
obj.SaveCompanySelectCheck(model);
string Content = model.GoodsName;
if (model.CheckState2 == 1)
Content += "审核通过,可以加入系统";
else if (model.CheckState2 == 2)
Content += "审核未通过,详细请进入选品系统查询";
//JC_OpenMess mess = new JC_OpenMess();
//mess.UserId = model.InUserId;
//mess.UserType = "p";
//mess.Content = Content;
//mess.IsRead = 0;
//mess.OpenDate = DateTime.Now;
//BaseService.SaveOpenMess(mess);
}
}
#endregion
#region 删除选品
[WebMethod(EnableSession = true)]
public void DeleteGoodsSelect(int Id)
{
Pages.Login(this.Session);
BaseService obj = new BaseService();
obj.DeleteGoodsSelect(Id);
}
#endregion
#region 查选品人
[WebMethod(EnableSession = true)]
public List<XP_GoodsSelectModel> GetGoodsSelectName()
{
Pages.Login(this.Session);
var obj = new BaseService();
int UserId = Convert.ToInt32(Session["UserId"]);
string Name = Convert.ToString(Session["Name"]);
List<XP_GoodsSelectModel> list = new List<XP_GoodsSelectModel>();
list = obj.GetGoodsSelectName(UserId);
if (list == null || list.Count == 0)
{
list = new List<XP_GoodsSelectModel>();
var md = new XP_GoodsSelectModel();
md.InName = Name;
list.Add(md);
}
return list;
}
#endregion
#region 查选品审批负责人
[WebMethod(EnableSession = true)]
public List<OA_DeptCharge> GetXPCharge()
{
Pages.Login(this.Session);
var obj = new BaseService();
int UserId = Convert.ToInt32(Session["UserId"]);
var list = obj.GetXPCheck(UserId);
return list;
}
#endregion
#region 查选品审批负责人
[WebMethod(EnableSession = true)]
public List<OA_DeptCharge> GetCompanyXPCharge()
{
Pages.Login(this.Session);
var obj = new BaseService();
int UserId = Convert.ToInt32(Session["UserId"]);
var list = obj.GetCompanyXPCheck(UserId);
return list;
}
#endregion
#region 返回选品Model
[WebMethod(EnableSession = true)]
public XP_GoodsSelectModel GetXPModel(int Id)
{
Pages.Login(this.Session);
var obj = new BaseService();
var md = obj.GetXPModel(Id);
return md;
}
#endregion
#region 查询选品
[WebMethod(EnableSession = true)]
public JsonModel<List<XP_GoodsSelectModel>> GetGoodsSelectList(int XPR, int Type,string InName,int SortId,DateTime? SDate,DateTime? EDate,int CheckState1,int CheckState2,int IsAdd, int PageIndex, int PageSize, string Sort)
{
var obj = new BaseService();
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
int UserId = Convert.ToInt32(Session["UserId"]);
string Duty = Convert.ToString(Session["Duty"]);
RefParameterCollection Param = new RefParameterCollection();
//Param.Add("CompanyId", "=", CompanyId, DbType.Int32);
if (Duty !="总经理")
{
if (Type == 0)
{
Param.Add("(InUserId", "=", UserId, DbType.Int32);
Param.Add("CheckUId1", "=", UserId, "or", DbType.Int32);
Param.Add("CheckUId2", "=", UserId, "or", ")", DbType.Int32);
}
else
if (Type == 1)
Param.Add("InUserId", "=", UserId, DbType.Int32);
else
if (Type == 2)
{
Param.Add("(CheckUId1", "=", UserId, DbType.Int32);
Param.Add("CheckUId2", "=", UserId, "or", ")", DbType.Int32);
}
}
//else
//{
// if (XPR == 1)
// {
// Param.Add("(InUserId", "=", 39, DbType.Int32);
// Param.Add("CheckUId1", "=", 39, "or", DbType.Int32);
// Param.Add("CheckUId2", "=", 39, "or", ")", DbType.Int32);
// }
// else
// {
// Param.Add("(InUserId", "=", 26, DbType.Int32);
// Param.Add("CheckUId1", "=", 26, "or", DbType.Int32);
// Param.Add("CheckUId2", "=", 26, "or", ")", DbType.Int32);
// }
//}
if (InName.Trim() != "")
{
Param.Add("(InName", "like", InName.Trim(), DbType.String);
Param.Add("b.Name", "like", InName.Trim(), DbType.String);
Param.Add("ShopName", "=", InName.Trim(),"or",")", DbType.String);
}
if (IsAdd>-1)
Param.Add("IsAdd", "=", IsAdd, DbType.Int32);
if (SDate != null)
{
Param.Add("InDate", ">=", SDate, DbType.DateTime);
}
if (EDate != null)
{
Param.Add("InDate", "<", EDate.Value.AddDays(1), DbType.DateTime);
}
if (CheckState1> -1)
Param.Add("CheckState1", "=", CheckState1, DbType.Int32);
if(CheckState2>-1)
Param.Add("CheckState2", "=", CheckState2, DbType.Int32);
JsonModel<List<XP_GoodsSelectModel>> resultModel = new JsonModel<List<XP_GoodsSelectModel>>();
int RowCount = 0;
resultModel.DataSource = obj.GetListXP_GoodsSelect(Param, PageIndex, PageSize, Sort, out RowCount);
resultModel.RowCount = RowCount;
return resultModel;
}
#endregion
#region 查询选品
[WebMethod(EnableSession = true)]
public JsonModel<List<XP_GoodsSelectModel>> GetXPSelectList(int IsAdd,string Name,string InName,string DoName,int PageIndex, int PageSize, string Sort)
{
var obj = new BaseService();
//int CompanyId = Convert.ToInt32(Session["CompanyId"]);
RefParameterCollection Param = new RefParameterCollection();
// Param.Add("CompanyId", "=", CompanyId, DbType.Int32);
Param.Add("CheckState2", "=", 1, DbType.Int32);
Param.Add("isnull(IsUse,0)", "=", 0, DbType.Int32);
if (IsAdd==1)
Param.Add("IsAdd", "=", 1, DbType.Int32);
else
Param.Add("isnull(IsAdd,0)", "=", 0, DbType.Int32);
if (Name.Trim() != "")
{
Name = Name.Trim();
Param.Add("(GoodsName", "like", Name, DbType.String);
Param.Add("SortName", "like", Name, "or", DbType.String);
Param.Add("GoodsName", "like", Name, "or", DbType.String);
Param.Add("GoodsCode", "like", Name, "or", DbType.String);
Param.Add("ShopName", "like", Name, "or", DbType.String);
Param.Add("Remark", "like", Name, "or", ")", DbType.String);
}
if (InName.Trim()!="")
{
InName = InName.Trim();
Param.Add("a.InName", "like", InName, DbType.String);
}
if (DoName.Trim() != "")
{
DoName = DoName.Trim();
Param.Add("b.Name", "like", DoName, DbType.String);
}
JsonModel<List<XP_GoodsSelectModel>> resultModel = new JsonModel<List<XP_GoodsSelectModel>>();
int RowCount = 0;
resultModel.DataSource = obj.GetListXP_GoodsSelect(Param, PageIndex, PageSize, Sort, out RowCount);
resultModel.RowCount = RowCount;
return resultModel;
}
#endregion
#region 返回选品数量
[WebMethod(EnableSession = true)]
public DT_OrderBackNum GetOrderBackNum()
{
Pages.Login(this.Session);
int UserId = Convert.ToInt32(Session["UserId"]);
var obj = new DD_OrderData();
var md = obj.GetOrderBackNum(UserId);
return md;
}
#endregion
#region 读取通知公告
[WebMethod(EnableSession = true)]
public List<GG_Notice> GetGGNoticeList()
{
Pages.Login(this.Session);
int CompanyId = Convert.ToInt32(Session["CompanyId"]);
BaseService obj = new BaseService();
var list = obj.GetGGNoticeList(CompanyId);
return list;
}
#endregion
[WebMethod(EnableSession = true)]
public JC_Resource UploadImage(int Type, string BoxName, string DirectoryName, string size, string factname, string ImageBase64)
{
Pages.Login(base.Session);
int num = Convert.ToInt32(base.Session["UserId"]);
int num2 = Convert.ToInt32(base.Session["SchId"]);
int startIndex = factname.LastIndexOf(".") + 1;
string str = factname.Substring(startIndex).ToLower();
string str2 = DirectoryName;
if ((BoxName != null) && (BoxName != ""))
{
DirectoryName = AppDomain.CurrentDomain.BaseDirectory + BoxName + "/" + str2;
}
else
{
DirectoryName = AppDomain.CurrentDomain.BaseDirectory + "attached/" + str2;
}
if (!Directory.Exists(DirectoryName))
{
Directory.CreateDirectory(DirectoryName);
}
Random random = new Random();
string str3 = random.Next(100, 0x3e8).ToString();
string str4 = DateTime.Now.ToString("yyyyMMddHHmmss") + str3 + "." + str;
CustomIO.SetImage(DirectoryName + "/" + str4, ImageBase64);
JC_Resource resource = new JC_Resource();
string str6 = "";
if ((BoxName != null) && (BoxName != ""))
{
str6 = BoxName + "/" + str2 + "/" + str4;
}
else
{
str6 = "attached/" + str2 + "/" + str4;
}
resource.FileUrl = str6;
resource.FileName = factname;
Random rd = new Random();
resource.id =random.Next(10000, 99999);
return resource;
}
}
}