Browse Source

信息发货添加发邮件功能,待开票功能优化

master
lvzb 4 years ago
parent
commit
9de8676f6c
  1. 2
      SCP/Admin/default.aspx.cs
  2. 35
      SCP/Common/MailHelper.cs
  3. 40
      SCP/Views/BasicData/SCP_INFO_EDIT.aspx.cs
  4. 4
      SCP/Views/SupplierData/SCP_RECEIVE_LIST.aspx
  5. 8
      SCP/Views/SupplierData/SCP_RECEIVE_LIST.aspx.cs
  6. 18
      SCP/Views/SupplierData/SCP_RECEIVE_LIST.aspx.designer.cs
  7. 6
      UniApiGroup/Controller/MailController.cs

2
SCP/Admin/default.aspx.cs

@ -30,7 +30,7 @@ namespace SCP.admin
public void BindData() public void BindData()
{ {
SearchData(ret => { SearchData(ret => {
if (CurrentUser.RoleList !=null && CurrentUser.RoleList.Contains("供应商")) if (CurrentUser.RoleList !=null && CurrentUser.RoleList.Contains("供应商")&& !CurrentUser.RoleList.Contains("管理员"))
{ {
ret = SetV_INFO(ret); ret = SetV_INFO(ret);
} }

35
SCP/Common/MailHelper.cs

@ -101,6 +101,41 @@ namespace SCP.Common
} }
} }
} }
public static void SendMails(string p_VendId, string p_Content, string p_title)
{
using (AppBoxContext db = EntitiesFactory.CreateAppBoxInstance())
{
StringBuilder _buffer = new StringBuilder();
_buffer.Append("SELECT b.Email ");
_buffer.Append(" FROM VenderUsers AS a INNER JOIN ");
_buffer.Append(" Users AS b ON a.UserId = b.ID INNER JOIN ");
_buffer.Append(" RoleUsers AS g ON a.UserId = g.UserID INNER JOIN ");
_buffer.Append(" Roles AS h ON g.RoleID = h.ID ");
_buffer.AppendFormat(" WHERE(h.Name = '供应商' and a.VenderId in ({0}) and b.enabled=1 ) ", p_VendId);
var _userList = db.Database.SqlQuery<string>(_buffer.ToString()).ToList();
//var _vender = ScpCache.VenderList.Where(itm => itm.VendId == p_VendId).FirstOrDefault();
if (_userList != null && _userList.Count > 0)
{
foreach (var itm in _userList)
{
string mails = "";
mails += itm + ",";
if (mails != "")
{
mails = mails.Substring(0, mails.Length - 1);
}
string mailbody = "";
mailbody += "尊敬的供应商<br>";
mailbody += "你好!<br><br>";
mailbody += "<b>" + p_Content + "</b> ,请到供应商SCP网站" + ConfigurationManager.AppSettings["ResetPassWord"] + "打开查看下载!<br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
MyWebSmtpMail webmail = new MyWebSmtpMail();
webmail.Send(mails, mailbody, p_title);
}
}
}
}
/// <summary> /// <summary>
/// 发邮件给采购 /// 发邮件给采购
/// </summary> /// </summary>

40
SCP/Views/BasicData/SCP_INFO_EDIT.aspx.cs

@ -100,7 +100,7 @@ namespace SCP.BasicData
protected void Button3_OnClick(object sender, EventArgs e) protected void Button3_OnClick(object sender, EventArgs e)
{ {
Int32 id = GetQueryIntValue("id"); Int32 id = GetQueryIntValue("id");
string mailVendIds = "";
if (id != -1) if (id != -1)
{ {
User modelUsers = DB.Users.FirstOrDefault(p => p.Name == txtSupplierCode.SelectedValue); User modelUsers = DB.Users.FirstOrDefault(p => p.Name == txtSupplierCode.SelectedValue);
@ -179,6 +179,7 @@ namespace SCP.BasicData
{ {
model.SupplierCode = GetSupplierCodes("All"); model.SupplierCode = GetSupplierCodes("All");
model.SupplierName = GetSupplierNames("All"); model.SupplierName = GetSupplierNames("All");
mailVendIds = GetSupplierCodes_Mail("All");
} }
else else
{ {
@ -191,6 +192,7 @@ namespace SCP.BasicData
model.SupplierCode = GetSupplierCodes("Some"); model.SupplierCode = GetSupplierCodes("Some");
model.SupplierName = GetSupplierNames("Some"); model.SupplierName = GetSupplierNames("Some");
mailVendIds = GetSupplierCodes_Mail("Some");
} }
// model.FactoryCode=txt 用户登陆名字 // model.FactoryCode=txt 用户登陆名字
model.Content = txtContent.Text; model.Content = txtContent.Text;
@ -209,6 +211,7 @@ namespace SCP.BasicData
var ret = SCP_INFO_CONTROLLER.SaveInfo(model); var ret = SCP_INFO_CONTROLLER.SaveInfo(model);
if (ret.State == ReturnStatus.Succeed) if (ret.State == ReturnStatus.Succeed)
{ {
SCP.Common.MailManager.SendMails(mailVendIds, "信息发布:" + model.Content, CurrentUser.FactoryList.FirstOrDefault());
Alert.ShowInParent("保存成功!"); Alert.ShowInParent("保存成功!");
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
@ -259,6 +262,41 @@ namespace SCP.BasicData
} }
} }
private string GetSupplierCodes_Mail(string type)
{
string strResult = "";
if ("All".Equals(type))
{
foreach (FineUI.ListItem vender in txtSupplierCode.Items)
{
if (string.IsNullOrEmpty(strResult))
{
strResult ="'"+ vender.Value+"'";
}
else
{
strResult = strResult + "," + "'" + vender.Value + "'";
}
}
}
else if ("Some".Equals(type))
{
foreach (FineUI.ListItem item in txtSupplierCode.SelectedItemArray)
{
if (string.IsNullOrEmpty(strResult))
{
strResult = "'" + item.Value + "'";
}
else
{
strResult = strResult + "," + "'" + item.Value + "'";
}
}
}
return strResult;
}
private string GetSupplierCodes(string type) private string GetSupplierCodes(string type)
{ {

4
SCP/Views/SupplierData/SCP_RECEIVE_LIST.aspx

@ -43,7 +43,6 @@
<f:ToolbarFill runat="server" Hidden="true"/> <f:ToolbarFill runat="server" Hidden="true"/>
<f:TextBox ID="tb_RecvBillNum" runat="server" Label="单据号" Hidden="true"/> <f:TextBox ID="tb_RecvBillNum" runat="server" Label="单据号" Hidden="true"/>
<f:Button ID="btn_Search" runat="server" EnablePostBack="True" Text="快速查找" OnClick="btnSearch_Click" Hidden="true"></f:Button> <f:Button ID="btn_Search" runat="server" EnablePostBack="True" Text="快速查找" OnClick="btnSearch_Click" Hidden="true"></f:Button>
<f:Button ID="qq"></f:Button>
<f:DropDownList ID="DDL_VEND_LIST" DataValueField="VendId" DataTextField="VendName" runat="server" Label="供应商编码" EnableEdit="true" EnableMultiSelect="false" Hidden="true"/> <f:DropDownList ID="DDL_VEND_LIST" DataValueField="VendId" DataTextField="VendName" runat="server" Label="供应商编码" EnableEdit="true" EnableMultiSelect="false" Hidden="true"/>
<f:Button ID="BTN_INV" runat="server" EnablePostBack="True" Text="确认" OnClick="BTN_INV_Click" Hidden="true" Icon="Accept" ></f:Button> <f:Button ID="BTN_INV" runat="server" EnablePostBack="True" Text="确认" OnClick="BTN_INV_Click" Hidden="true" Icon="Accept" ></f:Button>
</Items> </Items>
@ -78,7 +77,8 @@
</f:FormRow> </f:FormRow>
<f:FormRow runat="server" ID="FormRow_3"> <f:FormRow runat="server" ID="FormRow_3">
<Items> <Items>
<f:TextBox runat = "server" Label = "收(退)货单号" EmptyText = "" ID = "TXT_RECEIVE" /> <f:TextBox runat = "server" Label = "ERP收(退)货单号" EmptyText = "" ID = "TXT_ERPBillNo" />
<f:TextBox runat = "server" Label = "WMS收(退)货单号" EmptyText = "" ID = "TXT_RECEIVE" />
<f:DropDownList runat="server" ID="DDL_State" Label="单据类型" Text="单据类型"> <f:DropDownList runat="server" ID="DDL_State" Label="单据类型" Text="单据类型">
<f:ListItem Text="-" Value=""/> <f:ListItem Text="-" Value=""/>
<f:ListItem Text="退货单" Value="退货单" /> <f:ListItem Text="退货单" Value="退货单" />

8
SCP/Views/SupplierData/SCP_RECEIVE_LIST.aspx.cs

@ -88,6 +88,8 @@ namespace SCP.SupplierData
_ls.PartCode = TXT_PartCode.Text; _ls.PartCode = TXT_PartCode.Text;
_ls.VendId = TXT_VendId.Text; _ls.VendId = TXT_VendId.Text;
_ls.ProjectId = TXT_ProjectId.Text; _ls.ProjectId = TXT_ProjectId.Text;
_ls.ErpRecvBillNum = TXT_ERPBillNo.Text;
_ls.RecvBillNum = TXT_RECEIVE.Text;
if (DP_StartDate.SelectedDate != null) if (DP_StartDate.SelectedDate != null)
{ {
_ls.BeginTime = DP_StartDate.SelectedDate; _ls.BeginTime = DP_StartDate.SelectedDate;
@ -402,6 +404,7 @@ namespace SCP.SupplierData
_ls.VendId = TXT_VendId.Text; _ls.VendId = TXT_VendId.Text;
_ls.ProjectId = TXT_ProjectId.Text; _ls.ProjectId = TXT_ProjectId.Text;
_ls.RecvBillNum = TXT_RECEIVE.Text; _ls.RecvBillNum = TXT_RECEIVE.Text;
_ls.ErpRecvBillNum = TXT_ERPBillNo.Text;
if (DP_StartDate.SelectedDate != null) if (DP_StartDate.SelectedDate != null)
{ {
_ls.BeginTime = DP_StartDate.SelectedDate; _ls.BeginTime = DP_StartDate.SelectedDate;
@ -446,7 +449,8 @@ namespace SCP.SupplierData
{ {
{ "ProjectId", "项目编号" }, { "ProjectId", "项目编号" },
{ "BillType_DESC", "单据类型" }, { "BillType_DESC", "单据类型" },
{ "RecvBillNum", "单据编号" }, { "ErpRecvBillNum", "ERP单据编号" },
{ "RecvBillNum", "WMS单据编号" },
{ "AsnBillNum", "发货单号" }, { "AsnBillNum", "发货单号" },
{ "VendName", "供应商" }, { "VendName", "供应商" },
{ "VendId", "供应商编码" }, { "VendId", "供应商编码" },
@ -458,7 +462,7 @@ namespace SCP.SupplierData
{ "Currency", "币种" }, { "Currency", "币种" },
{ "CanQty", "可开票数量" }, { "CanQty", "可开票数量" },
{ "Price", "单价" }, { "Price", "单价" },
{ "CreateTime", "创建时间" } { "CreateTime", "收货时间" }
}; };
string url = EntityListToExcel2003(cellheader,_lst , "审核明细"); string url = EntityListToExcel2003(cellheader,_lst , "审核明细");
} }

18
SCP/Views/SupplierData/SCP_RECEIVE_LIST.aspx.designer.cs

@ -122,15 +122,6 @@ namespace SCP.SupplierData
/// </remarks> /// </remarks>
protected global::FineUI.Button btn_Search; protected global::FineUI.Button btn_Search;
/// <summary>
/// qq 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.Button qq;
/// <summary> /// <summary>
/// DDL_VEND_LIST 控件。 /// DDL_VEND_LIST 控件。
/// </summary> /// </summary>
@ -257,6 +248,15 @@ namespace SCP.SupplierData
/// </remarks> /// </remarks>
protected global::FineUI.FormRow FormRow_3; protected global::FineUI.FormRow FormRow_3;
/// <summary>
/// TXT_ERPBillNo 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.TextBox TXT_ERPBillNo;
/// <summary> /// <summary>
/// TXT_RECEIVE 控件。 /// TXT_RECEIVE 控件。
/// </summary> /// </summary>

6
UniApiGroup/Controller/MailController.cs

@ -54,10 +54,10 @@ namespace CK.SCP.UniApi.Controller
{ {
continue; continue;
} }
var aaa = ToDataTable(stocklist); var dt_stocklist = ToDataTable(stocklist);
var bb = GetHtmlString(aaa); var html_stocklist = GetHtmlString(dt_stocklist);
MyWebSmtpMail webmail = new MyWebSmtpMail(); MyWebSmtpMail webmail = new MyWebSmtpMail();
webmail.Send(mails, bb, "库存"); webmail.Send(mails, html_stocklist, "库存");
Console.WriteLine($"发送邮件:供应商编码为{ itm.Key}"); Console.WriteLine($"发送邮件:供应商编码为{ itm.Key}");
} }
} }

Loading…
Cancel
Save