Browse Source

发邮件及导入报错后清空

master
qian 10 months ago
parent
commit
20f906ca4b
  1. 14
      北京北汽/Common/CK.SCP.Common.csproj
  2. 42
      北京北汽/Common/MailManager.cs
  3. 208
      北京北汽/Common/MyWebSmtpMail.cs
  4. 4
      北京北汽/Common/packages.config
  5. 16
      北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs
  6. 78
      北京北汽/Controller/SCP_PO_CONTROLLER.cs
  7. 21
      北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs
  8. 13
      北京北汽/SCP/SCP.csproj
  9. 11
      北京北汽/SCP/Views/BasicData/Price.aspx.cs
  10. 4
      北京北汽/SCP/Views/BasicData/PriceUpdate.aspx.cs
  11. 2
      北京北汽/SCP/Views/BasicData/SCP_PRICE_EDIT.aspx.cs
  12. 7
      北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs
  13. 2
      北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs
  14. 130
      北京北汽/SCP/Web.config
  15. 23
      北京北汽/SCP/default_hb.aspx.cs
  16. 4
      北京北汽/SCP/packages.config

14
北京北汽/Common/CK.SCP.Common.csproj

@ -30,6 +30,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar.Layout">
<HintPath>..\DLL\DevComponents.DotNetBar.Layout.dll</HintPath>
</Reference>
@ -39,6 +42,12 @@
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="MailKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b, processorArchitecture=MSIL">
<HintPath>..\packages\MailKit.3.1.1\lib\net452\MailKit.dll</HintPath>
</Reference>
<Reference Include="MimeKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\packages\MimeKit.3.1.1\lib\net452\MimeKit.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@ -55,10 +64,14 @@
<HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Drawing" />
<Reference Include="System.Security" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -80,6 +93,7 @@
<Compile Include="CktTextBox.Designer.cs">
<DependentUpon>CktTextBox.cs</DependentUpon>
</Compile>
<Compile Include="MailManager.cs" />
<Compile Include="SettingHelper.cs" />
<Compile Include="MyExcel.cs" />
<Compile Include="MyWebSmtpMail.cs" />

42
北京北汽/Common/MailManager.cs

@ -0,0 +1,42 @@
using System.Configuration;
using System;
using System.IO;
using CK.SCP.Utils;
using System.Text;
using NPOI.HSSF.UserModel;
using System.Collections.Generic;
using MailKit.Security;
namespace CK.SCP.Common
{
public class MailManager
{
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="mails"></param>
/// <param name="mailbody"></param>
/// <param name="p_MailTitle"></param>
public static void SendMail(string mails = "", string mailbody = "", string p_MailTitle ="" )
{
try
{
List<EmailAddress> toList = new List<EmailAddress>();
EmailAddress add = new EmailAddress(mails, mails);
toList.Add(add);
var smtpMailSender = new MailKitMailSender(SecureSocketOptions.StartTls);
smtpMailSender.BuildMessage(
toList,
p_MailTitle,
mailbody,
"BBC"
);
smtpMailSender.Send();
}
catch (Exception e)
{
LogHelper.Writlog(LogHelper.LogType.Error, typeof(MailManager), "MailManager", e.Message + e.InnerException?.Message);
}
}
}
}

208
北京北汽/Common/MyWebSmtpMail.cs

@ -5,6 +5,9 @@ using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using MailKit.Security;
using MimeKit;
using MimeKit.Text;
namespace CK.SCP.Common
{
@ -38,12 +41,13 @@ namespace CK.SCP.Common
this.credentials = false;
}
public void Send(string To, string Body, string Title)
{
mailMessage = new MailMessage();
mailMessage.To.Add(To);
mailMessage.From = new System.Net.Mail.MailAddress(this.from);
mailMessage.Subject = Title;
mailMessage.Subject = "新的邮件通知";
mailMessage.Body = Body;
mailMessage.IsBodyHtml = true;
mailMessage.BodyEncoding = System.Text.Encoding.UTF8;
@ -52,6 +56,7 @@ namespace CK.SCP.Common
if (mailMessage != null)
{
smtpClient = new SmtpClient();
if (!credentials)
{
smtpClient.Credentials = new System.Net.NetworkCredential(username, password);
@ -60,16 +65,11 @@ namespace CK.SCP.Common
smtpClient.Host = server;
smtpClient.Port = port;
smtpClient.EnableSsl = enablessl;
//smtpClient.Send(mailMessage);
//smtpClient.SendAsync(mailMessage, null);
//如果服务器支持安全连接,则将安全连接设为true
//smtpClient.EnableSsl = true;
try
{
//是否使用默认凭据,若为false,则使用自定义的证书,就是下面的networkCredential实例对象
smtpClient.UseDefaultCredentials = false;
smtpClient.UseDefaultCredentials = true;
//指定邮箱账号和密码,需要注意的是,这个密码是你在QQ邮箱设置里开启服务的时候给你的那个授权码
System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential(username, password);
smtpClient.Credentials = networkCredential;
@ -80,9 +80,201 @@ namespace CK.SCP.Common
}
catch (System.Net.Mail.SmtpException ex)
{
//Console.WriteLine(ex.Message, "发送邮件出错");
throw new Exception(ex.Message + ex.InnerException?.Message);
// Console.WriteLine(ex.Message, "发送邮件出错");
}
}
}
}
public class SmtpMailSender
{
private readonly SmtpClient _client = new SmtpClient();
private MailMessage _message = new MailMessage();
private readonly string _targetName;
public SmtpMailSender(string targetName)
{
_targetName = targetName;
}
public void BuildClient(string host, int port, bool enableSsl, string username, string password)
{
_client.Host = host;
//587 or 25
_client.Port = port;
// This require to be before setting Credentials property
_client.UseDefaultCredentials = false;
_client.DeliveryMethod = SmtpDeliveryMethod.Network;
// you must give a full email address for authentication
_client.Credentials = new System.Net.NetworkCredential(username, password);
// Set to avoid MustIssueStartTlsFirst exception
_client.TargetName = _targetName;
// Set to avoid secure connection exception
_client.EnableSsl = enableSsl;
}
public void BuildMessage(EmailAddress fromAddress, List<EmailAddress> toAddressList, string subject, string body)
{
_message = new MailMessage()
{
// sender must be a full email address
From = new MailAddress(fromAddress.Address, fromAddress.Name),
Subject = subject,
IsBodyHtml = true,
Body = body,
BodyEncoding = Encoding.UTF8,
SubjectEncoding = Encoding.UTF8,
};
foreach (var emailAddress in toAddressList)
{
_message.To.Add(new MailAddress(emailAddress.Address, emailAddress.Name));
}
}
public void Send()
{
try
{
_client.Send(_message);
Console.WriteLine("Smtp Send Success:" + _message.To[0].Address);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
public async Task SendAsync()
{
try
{
await _client.SendMailAsync(_message);
Console.WriteLine("Smtp Send Success:" + _message.To[0].Address);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
}
public class MailKitMailSender
{
private readonly MailKit.Net.Smtp.SmtpClient _client = new MailKit.Net.Smtp.SmtpClient();
private MimeMessage _message = new MimeMessage();
private string host;//邮箱服务器
private int port;//端口
private string from;//发送的邮箱
private string password;//密码
private bool enablessl;//是否ssl
private string username;//发送名称
private readonly SecureSocketOptions _secureSocketOptions;
private MailKitMailSender()
{
_client.ServerCertificateValidationCallback = (s, c, h, e) => true;
}
public MailKitMailSender(SecureSocketOptions secureSocketOptions) : this()
{
_secureSocketOptions = secureSocketOptions;
host = ConfigurationManager.AppSettings["MailServer"];
port = Convert.ToInt32(ConfigurationManager.AppSettings["MailPort"]);
from = ConfigurationManager.AppSettings["MailSender"];
username = ConfigurationManager.AppSettings["MailUserName"];
password = ConfigurationManager.AppSettings["MailPassword"];
enablessl = false;
}
public void BuildMessage(List<EmailAddress> toAddressList, string subject, string body, string model)
{
_message = new MimeMessage();
_message.Sender = new MailboxAddress(username, from);
_message.From.Add(new MailboxAddress(username, from));
_message.Subject = subject;
_message.Body = new TextPart(TextFormat.Html) { Text = body };
foreach (var emailAddress in toAddressList)
{
if (model == "BCC")//抄送模式(抄送模式只发送一个邮件,避免大量发重复邮件)
{
_message.Bcc.Add(new MailboxAddress(emailAddress.Name, emailAddress.Address));
}
else
{
_message.To.Add(new MailboxAddress(emailAddress.Name, emailAddress.Address));
}
}
}
public void Send()
{
try
{
_client.Connect(host, port, _secureSocketOptions);
_client.Authenticate(from, password);
_client.Send(_message);
_client.Disconnect(true);
Console.WriteLine("MailKit Send Success:" + _message.To.Mailboxes.First());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
public async Task SendAsync()
{
try
{
await _client.ConnectAsync(host, port, _secureSocketOptions);
await _client.AuthenticateAsync(from, password);
await _client.SendAsync(_message);
await _client.DisconnectAsync(true);
Console.WriteLine("MailKit Send Success:" + _message.To.Mailboxes.First());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine();
}
}
}
public class EmailAddress
{
public EmailAddress(string address, string name)
{
Address = address;
Name = name;
}
public string Name { get; set; }
public string Address { get; set; }
}
}

4
北京北汽/Common/packages.config

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MailKit" version="3.1.1" targetFramework="net452" />
<package id="MimeKit" version="3.1.1" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
<package id="NPOI" version="2.3.0" targetFramework="net452" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net452" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
<package id="System.Buffers" version="4.5.1" targetFramework="net452" />
</packages>

16
北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs

@ -2614,7 +2614,7 @@ namespace CK.SCP.Controller
_PO_Detail.Currency = "CNY";
_PO_Detail.PoBillNum = _po.PoBillNum;
_PO_Detail.PartCode = itm..Trim();
var part = scpdb.TA_PART.FirstOrDefault(t => t.PartCode == itm. && t.Site == _po.Site);
var part = scpdb.TA_PART.FirstOrDefault(t => t.PartCode == itm..Trim() && t.Site == _po.Site);
_PO_Detail.PoLine =int.Parse(itm.);
_PO_Detail.PoUnit = part.Unit;
_PO_Detail.CreateTime = DateTime.Now;
@ -2636,7 +2636,7 @@ namespace CK.SCP.Controller
_PO_Detail.Scheduledays = string.IsNullOrEmpty(itm.) ? 7 : int.Parse(itm.);
_PO_Detail.Scheduleweeks = string.IsNullOrEmpty(itm.) ? 2 : int.Parse(itm.);
_PO_Detail.Schedulemonth = string.IsNullOrEmpty(itm.) ? 1 : int.Parse(itm.);
_PO_Detail.Supplieritem = itm.;
_PO_Detail.Supplieritem = itm..Trim();
_PO_Detail.Dliverypatterncode = itm.;
_PO_Detail.Deliverytimecode = itm.;
_PO_Detail.Transportdays = string.IsNullOrEmpty(itm.) ? 0 : int.Parse(itm.);
@ -2734,7 +2734,7 @@ namespace CK.SCP.Controller
TB_PO_DETAIL _PO_Detail = new TB_PO_DETAIL();
_PO_Detail.GUID = Guid.NewGuid();
_PO_Detail.PartCode = itm..Trim().ToUpper();
var part = scpdb.TA_PART.FirstOrDefault(t => t.PartCode == itm. && t.Site == _po.Site);
var part = scpdb.TA_PART.FirstOrDefault(t => t.PartCode == itm..Trim() && t.Site == _po.Site);
_PO_Detail.PoLine = _number;
_PO_Detail.PoBillNum = _po.PoBillNum;
_PO_Detail.State = (int)PoState.Open;
@ -2760,7 +2760,7 @@ namespace CK.SCP.Controller
_PO_Detail.Scheduledays = string.IsNullOrEmpty(itm.) ? 7 : int.Parse(itm.);
_PO_Detail.Scheduleweeks = string.IsNullOrEmpty(itm.) ? 2 : int.Parse(itm.);
_PO_Detail.Schedulemonth = string.IsNullOrEmpty(itm.) ? 1 : int.Parse(itm.);
_PO_Detail.Supplieritem = itm.;
_PO_Detail.Supplieritem = itm..Trim();
_PO_Detail.Dliverypatterncode = itm.;
_PO_Detail.Deliverytimecode = itm.;
_PO_Detail.Transportdays = string.IsNullOrEmpty(itm.) ? 0 : int.Parse(itm.);
@ -2924,8 +2924,8 @@ namespace CK.SCP.Controller
TB_PO_DETAIL _PO_Detail = new TB_PO_DETAIL();
_PO_Detail.Currency = "CNY";
_PO_Detail.PoBillNum = _po.PoBillNum;
_PO_Detail.PartCode = itm.;
var part = scpdb.TA_PART.FirstOrDefault(t=>t.PartCode== itm.&&t.Site==_po.Site);
_PO_Detail.PartCode = itm..Trim();
var part = scpdb.TA_PART.FirstOrDefault(t=>t.PartCode== itm..Trim()&&t.Site==_po.Site);
_PO_Detail.PoLine = int.Parse(itm.);
_PO_Detail.PoUnit = part.Unit;
_PO_Detail.CreateTime = DateTime.Now;
@ -3021,7 +3021,7 @@ namespace CK.SCP.Controller
TB_PO_DETAIL _PO_Detail = new TB_PO_DETAIL();
_PO_Detail.GUID = Guid.NewGuid();
_PO_Detail.PartCode = itm..Trim().ToUpper();
var part = scpdb.TA_PART.FirstOrDefault(t => t.PartCode == itm. && t.Site == _po.Site);
var part = scpdb.TA_PART.FirstOrDefault(t => t.PartCode == itm..Trim() && t.Site == _po.Site);
_PO_Detail.PoLine = _number;
_PO_Detail.PoBillNum = _po.PoBillNum.Trim();
_PO_Detail.State = (int)PoState.Open;
@ -3179,7 +3179,7 @@ namespace CK.SCP.Controller
TB_PO_DETAIL _PO_Detail = new TB_PO_DETAIL();
_PO_Detail.Currency = "CNY";
_PO_Detail.PoBillNum = _po.PoBillNum;
_PO_Detail.PartCode = itm.;
_PO_Detail.PartCode = itm..Trim();
_PO_Detail.PoLine = int.Parse(itm.);
_PO_Detail.PoUnit = itm.;
_PO_Detail.CreateTime = DateTime.Now;

78
北京北汽/Controller/SCP_PO_CONTROLLER.cs

@ -1178,7 +1178,7 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("供应商编号为【{0}】的零件编号【{1}】币种填写错误,只能是CNY或者EUR或者USD!", p_excel., p_excel.));
}
var Site = db.TB_FACTORY.Where(p=>p.ErpSite== p_excel.).FirstOrDefault();
var _first = db.TA_PART.Where(p => p.PartCode == p_excel. &&p.Site== p_excel.).FirstOrDefault();
var _first = db.TA_PART.Where(p => p.PartCode == p_excel..Trim() &&p.Site== p_excel.).FirstOrDefault();
if (_first == null)
{
ErrorList.Add(string.Format("供应商编号为【{0}】的零件编号【{1}】零件表里无数据,无法导入!", p_excel., p_excel.));
@ -1208,7 +1208,7 @@ namespace CK.SCP.Controller
var _Site = new SqlParameter("@Site", p_excel.);
var _SubSite = new SqlParameter("@SubSite", p_excel.);
var _VendId = new SqlParameter("@VendId", p_excel.);
var _PartCode = new SqlParameter("@PartCode", p_excel.);
var _PartCode = new SqlParameter("@PartCode", p_excel..Trim());
if (st > et)
{
ErrorList.Add(string.Format("供应商{0}零件编号{1}的结束时间需要大于开始时间!", p_excel., p_excel.));
@ -1307,7 +1307,7 @@ namespace CK.SCP.Controller
// ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表里无数据,无法导入!", p_excel.订单编号,p_excel.零件号 ));
//}
var _checkpart = db.TA_PART.FirstOrDefault(p => p.PartCode == p_excel.&&p.Site== site);
var _checkpart = db.TA_PART.FirstOrDefault(p => p.PartCode == p_excel..Trim()&&p.Site== site);
if (_checkpart != null)
{
if (_checkpart.State.ToUpper() != "SP")
@ -1319,7 +1319,7 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表零件停用,无法导入!", p_excel., p_excel.));
}
}
var _checkpart1= db.TA_PART.Count(p => p.PartCode == p_excel. && p.Site == site);
var _checkpart1= db.TA_PART.Count(p => p.PartCode == p_excel..Trim() && p.Site == site);
if (_checkpart1 == 0)
{
ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表里无数据,无法导入!", p_excel., p_excel.));
@ -1369,17 +1369,17 @@ namespace CK.SCP.Controller
}
int _polinr = Int32.Parse(p_excel.);
var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel. && p.PoLine != _polinr).ToList();
var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel..Trim() && p.PoLine != _polinr).ToList();
if (_partlist.Count > 0)
{
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel., p_excel., _partlist[0].PoLine));
}
int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel.);
int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel..Trim());
if (linecount > 0)
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】已经存在,请更换行号!", p_excel., p_excel.));
}
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel. && p.Site == site && p.SubSite == subsite && p.State != (int)PriceState.Reject && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel..Trim() && p.Site == site && p.SubSite == subsite && p.State != (int)PriceState.Reject && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
if (checkcount.Count == 0)
{
ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel., p_excel.));
@ -1535,7 +1535,7 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel., p_excel., p_excel.));
}
}
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel. && p.Site == site && p.SubSite == subsite && p.State == (int)PriceState.FConfirm && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel..Trim() && p.Site == site && p.SubSite == subsite && p.State == (int)PriceState.FConfirm && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
if (checkcount.Count == 0)
{
ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel., p_excel.));
@ -1622,7 +1622,7 @@ namespace CK.SCP.Controller
// ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表里无数据,无法导入!", p_excel.订单编号,p_excel.零件号 ));
//}
var _checkpart = db.TA_PART.FirstOrDefault(p => p.PartCode == p_excel.&&p.Site== site);
var _checkpart = db.TA_PART.FirstOrDefault(p => p.PartCode == p_excel..Trim()&&p.Site== site);
if (_checkpart != null)
{
if (_checkpart.State.ToUpper() != "SP")
@ -1634,7 +1634,7 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("订单编号为【{0}】的零件编号【{1}】零件表零件停用,无法导入!", p_excel., p_excel.));
}
}
var _checkpart1 = db.TA_PART.Count(p => p.PartCode == p_excel. && p.Site == site);
var _checkpart1 = db.TA_PART.Count(p => p.PartCode == p_excel..Trim() && p.Site == site);
if (_checkpart1 == 0)
{
@ -1678,7 +1678,7 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel., p_excel., p_excel.));
}
}
var pode = db.TB_PO_DETAIL.Count(p=>p.PoBillNum== p_excel.&&p.PartCode==p_excel.);
var pode = db.TB_PO_DETAIL.Count(p=>p.PoBillNum== p_excel.&&p.PartCode==p_excel..Trim());
if (pode > 0)
{
ErrorList.Add(string.Format("订单号【{1}】零件号【{0}】已存在!", p_excel., p_excel.));
@ -1690,20 +1690,20 @@ namespace CK.SCP.Controller
//}
int _polinr = Int32.Parse(p_excel.);
var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel. && p.PoLine != _polinr).ToList();
var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel..Trim() && p.PoLine != _polinr).ToList();
if (_partlist.Count > 0)
{
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel., p_excel., _partlist[0].PoLine));
}
int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel.);
int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel..Trim());
if (linecount > 0)
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】已经存在,请更换行号!", p_excel., p_excel.));
}
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel. && p.Site == site && p.SubSite == subsite && p.State != (int)PriceState.Reject && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel..Trim() && p.Site == site && p.SubSite == subsite && p.State != (int)PriceState.Reject && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
if (checkcount.Count == 0)
{
ErrorList.Add(string.Format("零件编号【{0}】供应编码【{1}】价格表没有维护信息!", p_excel., p_excel.));
ErrorList.Add(string.Format("零件编号【{0}】供应编码【{1}】价格表没有维护信息!", p_excel..Trim(), p_excel.));
}
else
{
@ -1853,7 +1853,7 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel., p_excel., p_excel.));
}
}
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel. && p.Site == site && p.SubSite == subsite && p.State == (int)PriceState.FConfirm && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel..Trim() && p.Site == site && p.SubSite == subsite && p.State == (int)PriceState.FConfirm && p.VendId == p_excel. && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList();
if (checkcount.Count == 0)
{
ErrorList.Add(string.Format("零件编号【{0}】供应编码【{1}】价格表没有维护信息!", p_excel., p_excel.));
@ -2399,7 +2399,7 @@ namespace CK.SCP.Controller
var _lst = p_order_list;
_lst.ForEach(p =>
{
var _count = _lst.Count(itm => itm. == p. && itm. == p. && itm. == p.);
var _count = _lst.Count(itm => itm. == p. && itm..Trim() == p. && itm. == p.);
if (_count > 1)
{
lineError.Add(string.Format("导入的域{2}供应商{0}零件编号{1}有重复", p., p., p.));
@ -2677,7 +2677,7 @@ namespace CK.SCP.Controller
{
List<string> ErrorList = new List<string>();
int count = db.TA_MoldSharing.Count(p => p.VendId == p_excel..ToUpper() && p.Site == p_excel. && p.PartCode == p_excel..ToUpper() && p.Count != 0);
int count = db.TA_MoldSharing.Count(p => p.VendId == p_excel..ToUpper() && p.Site == p_excel. && p.PartCode == p_excel..Trim().ToUpper() && p.Count != 0);
if (count > 0)
{
ErrorList.Add(string.Format("供应商{0}零件编码{1}已存在分摊数据,不可修改分摊价格和数量!", p_excel., p_excel.));
@ -2706,10 +2706,10 @@ namespace CK.SCP.Controller
_lst.ForEach
(p =>
{
var _count = _lst.Count(itm => itm. == p. && itm. == p. && itm. == p. && itm. == p.);
var _count = _lst.Count(itm => itm. == p. && itm. == p. && itm. == p. && itm..Trim() == p..Trim());
if (_count > 1)
{
lineError.Add(string.Format("导入的模板供应商编号{0}零件编号{3}有重复,请修改时间!", p., p., p., p.));
lineError.Add(string.Format("导入的模板供应商编号{0}零件编号{3}有重复,请修改时间!", p., p., p., p..Trim()));
ErrorList = lineError;
}
@ -2721,7 +2721,7 @@ namespace CK.SCP.Controller
}
number++;
});
var _sharinglist = _lst.Where(t => !string.IsNullOrEmpty(t.) && !string.IsNullOrEmpty(t.) && t. != "0" && t. != "0" && !string.IsNullOrEmpty(t.) && !string.IsNullOrEmpty(t.)).ToList().DistinctBy(x => new { x., x., x., x., x. }).ToList();
var _sharinglist = _lst.Where(t => !string.IsNullOrEmpty(t.) && !string.IsNullOrEmpty(t..Trim()) && t. != "0" && t. != "0" && !string.IsNullOrEmpty(t.) && !string.IsNullOrEmpty(t.)).ToList().DistinctBy(x => new { x., x., x., x., x. }).ToList();
if (_sharinglist.Count > 0)
{
_sharinglist.ForEach(p =>
@ -2755,7 +2755,7 @@ namespace CK.SCP.Controller
var _Site = new SqlParameter("@Site", p.);
var _SubSite = new SqlParameter("@SubSite", p.);
var _VendId = new SqlParameter("@VendId", p.);
var _PartCode = new SqlParameter("@PartCode", p.);
var _PartCode = new SqlParameter("@PartCode", p..Trim());
string sqlString = "select * from tb_price where uid in\n" +
"(\n" +
" select max(uid) uid\n" +
@ -2794,7 +2794,7 @@ namespace CK.SCP.Controller
});
_sharinglist.ForEach(p =>
{
var _moldsharing = db.TA_MoldSharing.SingleOrDefault(t => t.VendId == p..ToUpper() && t.PartCode == p..ToUpper() && t.Site == p.) ??
var _moldsharing = db.TA_MoldSharing.SingleOrDefault(t => t.VendId == p..ToUpper() && t.PartCode == p..Trim().ToUpper() && t.Site == p.) ??
new TA_MOLDSHARING
{
VendId = p..ToUpper().Trim(),
@ -3038,7 +3038,7 @@ namespace CK.SCP.Controller
_lst.ForEach
(p =>
{
var _count = _lst.Count(itm => itm. == p. && itm. == p.);
var _count = _lst.Count(itm => itm. == p. && itm..Trim() == p..Trim());
if (_count > 1)
{
lineError.Add(string.Format("导入的模板供应商编号{0}零件编号{3}有重复,请修改时间!", p., p., p., p.));
@ -3072,10 +3072,10 @@ namespace CK.SCP.Controller
{
string starttime = Convert.ToDateTime(p.).ToShortDateString();
string endtime = Convert.ToDateTime(p.).ToShortDateString();
var _vender = db.TB_PRICE.SingleOrDefault(t => t.VendId == p..ToUpper() && t.PartCode == p. && t.UID.ToString() == p. && t.SubSite == p. && t.Site == p.);
var _vender = db.TB_PRICE.SingleOrDefault(t => t.VendId == p..ToUpper() && t.PartCode == p..Trim() && t.UID.ToString() == p. && t.SubSite == p. && t.Site == p.);
if (_vender == null)
{
lineError.Add(string.Format("供应商编号{0}零件编号{3}数据不存在", p., p., p., p.));
lineError.Add(string.Format("供应商编号{0}零件编号{3}数据不存在", p., p., p., p..Trim()));
ErrorList = lineError;
}
if (DateTime.Parse(p.)< DateTime.Parse(p.) && DateTime.Parse(p.) >DateTime.Parse(p.))
@ -3083,7 +3083,7 @@ namespace CK.SCP.Controller
_vender.EndTime = Convert.ToDateTime(DateTime.Parse(starttime).AddDays(-1));
_vender.Extend3 = "价格表修改";
var _PR = db.V_TB_PRICE.FirstOrDefault(t => t.VendId == p..ToUpper() && t.PartCode == p. && t.UID.ToString() == p. && t.SubSite == p. && t.Site == p.);
var _PR = db.V_TB_PRICE.FirstOrDefault(t => t.VendId == p..ToUpper() && t.PartCode == p..Trim() && t.UID.ToString() == p. && t.SubSite == p. && t.Site == p.);
if (_PR != null)
{
TS_UNI_API TS = new TS_UNI_API();
@ -3110,7 +3110,7 @@ namespace CK.SCP.Controller
TS.PutTime = Convert.ToDateTime(DateTime.Parse(starttime).AddDays(-1));//结束时间
TS.CreateOper = _PR.Creator;
TS.Currency = _PR.Curr;//货币
var _first = db.TA_PART.Where(itm => itm.PartCode == p.).FirstOrDefault();
var _first = db.TA_PART.Where(itm => itm.PartCode == p..Trim()).FirstOrDefault();
if (_first != null)
{
TS.PoUnit = _first.Unit;
@ -3128,7 +3128,7 @@ namespace CK.SCP.Controller
tb.State = 0;
tb.Extend3 = "价格表修改增加";
tb.VendId = p.;
tb.PartCode = p.;
tb.PartCode = p..Trim();
tb.Curr = p.;
tb.Unit = p.;
tb.Remarks = p.;
@ -3254,7 +3254,7 @@ namespace CK.SCP.Controller
});
_lst.ForEach(p =>
{
var _count = _lst.Count(itm => itm. == p. && itm. == p. && itm. == p.);
var _count = _lst.Count(itm => itm. == p. && itm..Trim() == p..Trim() && itm. == p.);
if (_count > 1)
{
lineError.Add(string.Format("导入订单编号{0}行号{1}零件编码{2}有重复", p., p., p.));
@ -3316,7 +3316,7 @@ namespace CK.SCP.Controller
_PO_Detail.PoUnit = itm.;
_PO_Detail.CreateTime = DateTime.Parse(itm.);
_PO_Detail.CreateUser = p_creator;
_PO_Detail.PartCode = itm.;
_PO_Detail.PartCode = itm..Trim();
_PO_Detail.BeginTime = DateTime.Parse(itm.);
_PO_Detail.EndTime = DateTime.Parse(itm.);
_PO_Detail.PlanQty = decimal.Parse(itm.);
@ -3725,7 +3725,7 @@ namespace CK.SCP.Controller
p_order_list.ForEach(p =>
{
var _count1 = _lst.Count(itm => itm. == p. && itm. == p.);
var _count2 = _lst.Count(itm => itm. == p. && itm. == p.);
var _count2 = _lst.Count(itm => itm. == p. && itm..Trim() == p..Trim());
if (_count1 > 1 && p_modtype == BillModType.Contract)
{
lineError.Add(string.Format("导入订单编号【{0}】行号【{1}】有重复", p., p.));
@ -3853,7 +3853,7 @@ namespace CK.SCP.Controller
p_order_list.ForEach(p =>
{
var _count1 = _lst.Count(itm => itm. == p. && itm. == p.);
var _count2 = _lst.Count(itm => itm. == p. && itm. == p.);
var _count2 = _lst.Count(itm => itm. == p. && itm..Trim() == p..Trim());
if (_count1 > 1 && p_modtype == BillModType.Contract)
@ -3863,7 +3863,7 @@ namespace CK.SCP.Controller
}
if (_count2 > 1)
{
lineError.Add(string.Format("导入订单编号【{0}】零件编码【{1}】有重复", p., p.));
lineError.Add(string.Format("导入订单编号【{0}】零件编码【{1}】有重复", p., p..Trim()));
ErrorList = lineError;
}
@ -3992,8 +3992,8 @@ namespace CK.SCP.Controller
list.ForEach((itm) =>
{
int _poline = Int32.Parse(itm.);
var _PO_Detail = db.TB_PO_DETAIL.FirstOrDefault(t => t.PartCode == itm. && t.PoLine == _poline && t.PoBillNum == itm. /*&& t.State == state*/ && t.Site == site && t.SubSite == subsite) ??
new TB_PO_DETAIL { GUID = Guid.NewGuid(), PartCode = itm..ToUpper(), PoLine = _poline, PoBillNum = itm..ToUpper(), State = (int)PoState.Open, Site = site, SubSite = subsite };
var _PO_Detail = db.TB_PO_DETAIL.FirstOrDefault(t => t.PartCode == itm..Trim() && t.PoLine == _poline && t.PoBillNum == itm. /*&& t.State == state*/ && t.Site == site && t.SubSite == subsite) ??
new TB_PO_DETAIL { GUID = Guid.NewGuid(), PartCode = itm..Trim().ToUpper(), PoLine = _poline, PoBillNum = itm..ToUpper(), State = (int)PoState.Open, Site = site, SubSite = subsite };
_PO_Detail.Currency = "CNY";
_PO_Detail.PoUnit = itm.;
_PO_Detail.CreateTime = DateTime.Parse(itm.);
@ -4014,7 +4014,7 @@ namespace CK.SCP.Controller
_PO_Detail.Scheduledays = string.IsNullOrEmpty(itm.) ? 7 : int.Parse(itm.);
_PO_Detail.Scheduleweeks = string.IsNullOrEmpty(itm.) ? 2 : int.Parse(itm.);
_PO_Detail.Schedulemonth = string.IsNullOrEmpty(itm.) ? 1 : int.Parse(itm.);
_PO_Detail.Supplieritem = itm..ToUpper();
_PO_Detail.Supplieritem = itm..Trim().ToUpper();
_PO_Detail.Dliverypatterncode = itm.;
_PO_Detail.Deliverytimecode = itm.;
_PO_Detail.Transportdays = string.IsNullOrEmpty(itm.) ? 0 : int.Parse(itm.);
@ -4100,7 +4100,7 @@ namespace CK.SCP.Controller
_PO_Detail.Scheduledays = string.IsNullOrEmpty(itm.) ? 7 : int.Parse(itm.);
_PO_Detail.Scheduleweeks = string.IsNullOrEmpty(itm.) ? 2 : int.Parse(itm.);
_PO_Detail.Schedulemonth = string.IsNullOrEmpty(itm.) ? 1 : int.Parse(itm.);
_PO_Detail.Supplieritem = itm.;
_PO_Detail.Supplieritem = itm..Trim();
_PO_Detail.Dliverypatterncode = itm.;
_PO_Detail.Deliverytimecode = itm.;
_PO_Detail.Transportdays = string.IsNullOrEmpty(itm.) ? 0 : int.Parse(itm.);
@ -4344,7 +4344,7 @@ namespace CK.SCP.Controller
_t_ASK_Detail.PoUnit = itm.;
_t_ASK_Detail.CreateTime = DateTime.Now;
_t_ASK_Detail.CreateUser = _ask.CreateUser;
_t_ASK_Detail.PartCode = itm..ToUpper();
_t_ASK_Detail.PartCode = itm..Trim().ToUpper();
_t_ASK_Detail.BeginTime = DateTime.Parse(itm.);
_t_ASK_Detail.EndTime = DateTime.Parse(itm.);
_t_ASK_Detail.TempQty = decimal.Parse(itm.);

21
北京北汽/Controller/SCP_TB_PRICE_CONTROLLER.cs

@ -509,6 +509,7 @@ namespace CK.SCP.Controller
public static ResultObject<bool> Save_TB_PRICE(List<TB_PRICE> p_entitys,PriceState p_state)
{
ResultObject<bool> _ret = new ResultObject<bool>();
List<string> errorlist = new List<string>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
@ -522,18 +523,30 @@ namespace CK.SCP.Controller
_entity.TemporaryPrice = itm.TemporaryPrice;
_entity.Creator = itm.Creator;
_entity.EndTime = itm.EndTime;
if (_entity.EndTime<_entity.StartTime)
{
errorlist.Add("修改后的结束日期不允许小于开始日期!");
break;
}
//_entity.UpdateTime = itm.UpdateTime;
//_entity.UpdateUser = itm.UpdateUser;
//_entity.UpdateInfo = itm.UpdateInfo;
db.TB_PRICE.AddOrUpdate(p => p.UID, _entity);
}
if (p_state == PriceState.FConfirm)
{
//if (p_state == PriceState.FConfirm)
//{
//}
// 如果错误存在 就抛
if (errorlist.Count>0)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = errorlist.FirstOrDefault();
return _ret;
}
if (db.SaveChanges() != -1)
else if (db.SaveChanges() != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;

13
北京北汽/SCP/SCP.csproj

@ -48,6 +48,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="ChangKeTec.Utils">
<HintPath>C:\Users\asus\Desktop\ChangKeTec.Utils.dll</HintPath>
<Private>True</Private>
@ -75,10 +78,16 @@
<HintPath>..\..\..\..\Interop.grsvr6Lib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="MailKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b, processorArchitecture=MSIL">
<HintPath>..\packages\MailKit.3.1.1\lib\net452\MailKit.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="MimeKit, Version=3.1.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\packages\MimeKit.3.1.1\lib\net452\MimeKit.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net20\Newtonsoft.Json.dll</HintPath>
@ -96,10 +105,14 @@
<HintPath>..\packages\NPOI.2.3.0\lib\net40\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\netstandard1.1\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />

11
北京北汽/SCP/Views/BasicData/Price.aspx.cs

@ -267,10 +267,11 @@ namespace SCP.BasicData
}
var list = ConvertHelper.ToList<SCP_PRICE_EXPORT>(ExcelHelper.RemoveEmpty(_dt)).ToList();
List<string> partCodeList = list.Select(a => a.).ToList();
List<string> partCodeList = list.Select(a => a..Trim()).ToList();
if (partCodeList.Count == 0)
{
Alert.Show(GetResourceKey("未填写零件编码!"));
FileUp.Reset();
return;
}
List<string> list1 = new List<string>();
@ -278,6 +279,7 @@ namespace SCP.BasicData
if (list1.Count()>0 )
{
Alert.Show(GetResourceKey(string.Format( "导入文件中有不存在的零件,如{0}", list1.FirstOrDefault())));
FileUp.Reset();
return;
}
var ret = SCP_PO_CONTROLLER.EXCEL_PRICE_MOD(list, CurrentUser.Name,CurrentUser.RoleList);
@ -340,6 +342,11 @@ namespace SCP.BasicData
Alert.Show(GetResourceKey("结束时间不能为空!"));
return;
}
if (DateTime.Parse( modifyValue["EndTime"].ToString())< _entity.StartTime)
{
Alert.Show(GetResourceKey("结束时间不能小于开始时间!"));
return;
}
_entity.EndTime = ConvertHelper.To<DateTime>(modifyValue["EndTime"]);
//SCPDB.V_TB_ARRIVE_DETAIL.Count(p => p.ShipTime > _entity.EndTime && p.PartCode == _entity.PartCode && p.SubSite==_entity.SubSite && p.Site==p.Site);
//SCPDB.V_TB_ASK_DETAIL.Count(p => p.BeginTime > _entity.EndTime && p.PartCode == _entity.PartCode && p.SubSite == _entity.SubSite && p.Site == p.Site);
@ -748,7 +755,7 @@ namespace SCP.BasicData
protected void BtnEdit_Click(object sender, EventArgs e)
{
if (this.Grid1.SelectedRowIndexArray.Length == 0 && this.Grid1.SelectedRowIndexArray.Length>1)
if (this.Grid1.SelectedRowIndexArray.Length == 0 || this.Grid1.SelectedRowIndexArray.Length>1)
{
Alert.Show(GetResourceKey("请选择一行要操作的记录,不能选多条记录!"));
return;

4
北京北汽/SCP/Views/BasicData/PriceUpdate.aspx.cs

@ -15,6 +15,7 @@ using System.Linq.Expressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using static System.Net.WebRequestMethods;
namespace SCP.BasicData
{
@ -192,7 +193,7 @@ namespace SCP.BasicData
}
var list = ConvertHelper.ToList<SCP_PRICE_EXPORT>(ExcelHelper.RemoveEmpty(_dt)).ToList();
List<string> partCodeList = list.Select(a => a.).ToList();
List<string> partCodeList = list.Select(a => a..Trim()).ToList();
if (partCodeList.Count == 0)
{
Alert.Show("未填写零件编码!");
@ -216,6 +217,7 @@ namespace SCP.BasicData
else
{
Alert.Show(string.Join("<br>", ret.MessageList));
FileUpload1.Reset();
return;
}
}

2
北京北汽/SCP/Views/BasicData/SCP_PRICE_EDIT.aspx.cs

@ -92,7 +92,7 @@ namespace SCP.Views.BasicData
}
else
{
Alert.Show("更新价格失败!");
Alert.Show("更新价格失败!原因:"+rs.Message);
}
}
}

7
北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs

@ -196,6 +196,7 @@ namespace SCP.PlanData
if (string.IsNullOrEmpty(_fileName))
{
Alert.Show("选择文件为空!");
FileUp.Reset();
return;
}
string _lx = _fileName.Split('.')[1];
@ -211,10 +212,11 @@ namespace SCP.PlanData
}
var list = ConvertHelper.ToList<SCP_PO_EXPORT_IMPORT_MODEL>(ExcelHelper.RemoveEmpty(_dt)).ToList();
List<string> partCodeList = list.Select(a => a.).ToList();
List<string> partCodeList = list.Select(a => a..Trim()).ToList();
if (partCodeList.Count == 0)
{
Alert.Show("未填写零件编码!");
FileUp.Reset();
return;
}
List<string> list1 = new List<string>();
@ -222,12 +224,14 @@ namespace SCP.PlanData
if (list1.Count()>0)
{
Alert.Show(string.Format("导入文件中有不存在的零件,如{0}", list1.FirstOrDefault()));
FileUp.Reset();
return;
}
var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]);
if (checkret.State == ReturnStatus.Failed && checkret.Result == false)
{
Alert.Show(string.Join("<br>", checkret.MessageList));
FileUp.Reset();
return;
}
if (CurrentUser.ConfigList.ContainsKey("数据中心接口"))
@ -258,6 +262,7 @@ namespace SCP.PlanData
{
//Alert.Show(string.Join("<br>", saveret.MessageList));
Alert.Show(saveret.Message);
FileUp.Reset();
return;
}
}

2
北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs

@ -210,7 +210,7 @@ namespace SCP.Views.PlanData
}
var list = ConvertHelper.ToList<SCP_PO_EXPORT_IMPORT_MODEL>(ExcelHelper.RemoveEmpty(_dt)).ToList();
List<string> partCodeList = list.Select(a => a.).ToList();
List<string> partCodeList = list.Select(a => a..Trim()).ToList();
if (partCodeList.Count == 0)
{
Alert.Show("未填写零件编码!");

130
北京北汽/SCP/Web.config

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=169433
@ -7,39 +7,39 @@
<configSections>
<section name="FineUI" type="FineUI.ConfigSection, FineUI" requirePermission="false"/>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="FineUI" type="FineUI.ConfigSection, FineUI" requirePermission="false" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<appSettings>
<!-- 发邮件配置开始 -->
<add key="MailSender" value="gysxtxt@bbmpt.com.cn"/>
<add key="MailServer" value="smtp.bbmpt.com.cn"/>
<add key="MailUserName" value="gysxtxt@bbmpt.com.cn"/>
<add key="MailPassword" value="QAZ135qaz!"/>
<add key="MailPort" value="25"/>
<add key="ResetPassWord" value="https://scp.bbmpt.com.cn"/>
<add key="MailSender" value="gysxtxt@bbmpt.com.cn" />
<add key="MailServer" value="smtp.bbmpt.com.cn" />
<add key="MailUserName" value="gysxtxt@bbmpt.com.cn" />
<add key="MailPassword" value="QAZ135qaz!" />
<add key="MailPort" value="25" />
<add key="ResetPassWord" value="https://scp.bbmpt.com.cn" />
<!-- 发邮件配置结束 -->
<add key="AppBoxDbUser" value="sa"/>
<add key="AppBoxDbPassword" value="5E0AFEB85CA001A3371A9F19E7EC4DFF"/>
<add key="AppBoxDbUser" value="sa" />
<add key="AppBoxDbPassword" value="5E0AFEB85CA001A3371A9F19E7EC4DFF" />
<!--测试服务器数据库-->
<!-- <add key="AppBoxDbServer" value="10.1.1.13" />-->
<!--本机数据库-->
<add key="AppBoxDbServer" value="."/>
<add key="AppBoxDbPort" value="1433"/>
<add key="AppBoxDbName" value="SCPAppBox"/>
<add key="SCPDbUser" value="sa"/>
<add key="SCPDbPassword" value="5E0AFEB85CA001A3371A9F19E7EC4DFF"/>
<add key="AppBoxDbServer" value="." />
<add key="AppBoxDbPort" value="1433" />
<add key="AppBoxDbName" value="SCPAppBox" />
<add key="SCPDbUser" value="sa" />
<add key="SCPDbPassword" value="5E0AFEB85CA001A3371A9F19E7EC4DFF" />
<!--测试服务器数据库-->
<!-- <add key="MesDbServer" value="10.1.6.74" />-->
<!--本机数据库-->
<add key="SCPDbServer" value="."/>
<add key="SCPDbPort" value="1433"/>
<add key="SCPDbName" value="ChangKeTecSCP"/>
<add key="SCPDbServer" value="." />
<add key="SCPDbPort" value="1433" />
<add key="SCPDbName" value="ChangKeTecSCP" />
<add key="SCP_TIME_OUT" value="60" />
</appSettings>
<FineUI DebugMode="false" Theme="Gray"/>
<FineUI DebugMode="false" Theme="Gray" />
<!--
@ -51,30 +51,30 @@
</system.Web>
-->
<system.web>
<sessionState mode="InProc" timeout="60"/>
<sessionState mode="InProc" timeout="60" />
<httpModules>
<add name="FineUIScriptModule" type="FineUI.ScriptModule, FineUI"/>
<add name="FineUIScriptModule" type="FineUI.ScriptModule, FineUI" />
</httpModules>
<httpHandlers>
<add verb="GET" path="res.axd" type="FineUI.ResourceHandler, FineUI" validate="false"/>
<add verb="GET" path="res.axd" type="FineUI.ResourceHandler, FineUI" validate="false" />
</httpHandlers>
<!-- <httpRuntime maxRequestLength="102400 " />-->
<customErrors mode="Off"/>
<customErrors mode="Off" />
<authentication mode="Forms">
<forms name=".APPBOX_FORMS_AUTH" loginUrl="~/Default_hb.aspx" timeout="120" defaultUrl="~/main.aspx" protection="All" path="/"/>
<forms name=".APPBOX_FORMS_AUTH" loginUrl="~/Default_hb.aspx" timeout="120" defaultUrl="~/main.aspx" protection="All" path="/" />
</authentication>
<authorization>
<deny users="?"/>
<deny users="?" />
</authorization>
<compilation targetFramework="4.5.2" debug="true"/>
<compilation targetFramework="4.5.2" debug="true" />
<httpRuntime />
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt"/>
<add assembly="FineUI" namespace="FineUI" tagPrefix="f"/>
<add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
<add assembly="FineUI" namespace="FineUI" tagPrefix="f" />
</controls>
</pages>
<!-- <httpModules>-->
@ -84,28 +84,28 @@
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
<assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="FineUI" publicKeyToken="0ff1835d01c384a9" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0"/>
<assemblyIdentity name="FineUI" publicKeyToken="0ff1835d01c384a9" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.1.0" newVersion="6.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0"/>
<assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.1.0" newVersion="2.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1"/>
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
@ -119,14 +119,14 @@
<location path="res">
<system.web>
<authorization>
<allow users="*"/>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="extjs">
<system.web>
<authorization>
<allow users="*"/>
<allow users="*" />
</authorization>
</system.web>
</location>
@ -134,37 +134,37 @@
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Headers" value="*"/>
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE"/>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE" />
</customHeaders>
</httpProtocol>
<security>
<!--<requestFiltering allowDoubleEscaping="true"/>-->
<requestFiltering >
<requestLimits maxAllowedContentLength="2147483647" maxQueryString="2147483647"/>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647" maxQueryString="2147483647" />
</requestFiltering>
</security>
<validation validateIntegratedModeConfiguration="false"/>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="FineUIScriptModule"/>
<add name="FineUIScriptModule" preCondition="managedHandler" type="FineUI.ScriptModule, FineUI"/>
<remove name="FineUIScriptModule" />
<add name="FineUIScriptModule" preCondition="managedHandler" type="FineUI.ScriptModule, FineUI" />
</modules>
<handlers>
<add name="FineUIResourceHandler" verb="GET" path="res.axd" type="FineUI.ResourceHandler, FineUI"/>
<add name="FineUIResourceHandler" verb="GET" path="res.axd" type="FineUI.ResourceHandler, FineUI" />
</handlers>
<staticContent>
<mimeMap fileExtension=".grf" mimeType="grf/gridreport"/>
<mimeMap fileExtension=".grf" mimeType="grf/gridreport" />
</staticContent>
<defaultDocument>
<files>
<clear/>
<add value="default.aspx"/>
<add value="Default.htm"/>
<add value="Default.asp"/>
<add value="index.htm"/>
<add value="index.html"/>
<add value="iisstart.htm"/>
<clear />
<add value="default.aspx" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
</files>
</defaultDocument>
</system.webServer>
@ -175,18 +175,18 @@
</parameters>
</defaultConnectionFactory>-->
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
</configuration>

23
北京北汽/SCP/default_hb.aspx.cs

@ -17,6 +17,8 @@ using System.Configuration;
using SCP.Code;
using CK.SCP.Models.Enums;
using System.Drawing;
using static CK.SCP.Common.MyWebSmtpMail;
using MailKit.Security;
namespace SCP
{
@ -366,6 +368,7 @@ namespace SCP
if (!user.Enabled)
{
Alert.Show(GetResourceKey("用户未启用,请联系管理员!"));
img.ImageUrl = DrawToBase64(4);
}
else
{
@ -384,22 +387,34 @@ namespace SCP
string mailbody = "";
mailbody += "尊敬的供应商<br>";
mailbody += "你好!密码已经重置为" + b + "@"+ a + "请点击链接进行登录并修改密码 < br><br>";
mailbody += "你好!密码已经重置为" + b + "@"+ a + "请点击链接进行登录并修改密码 <br><br>";
string str = ConfigurationManager.AppSettings["ResetPassWord"].ToString();
//mailbody += string.Format("<a href='http://{0}/default.aspx?</a><br/><br/>", ConfigurationManager.AppSettings["ResetPassWord"].ToString());
mailbody += str + "<br><br>";
mailbody += str + "<br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
MyWebSmtpMail webmail = new MyWebSmtpMail();
//MyWebSmtpMail webmail = new MyWebSmtpMail();
try
{
MailManager.SendMail(mails, mailbody, "供应商密码找回");
}
catch (Exception ex)
{
Alert.Show(ex.Message + ex.InnerException?.Message);
img.ImageUrl = DrawToBase64(4);
return;
}
webmail.Send(mails, mailbody, "供应商密码找回");
//webmail.Send(mails, mailbody, "供应商密码找回");
user.Password = PasswordUtil.CreateDbPassword(b + "@" + a);
DB.SaveChanges();
Alert.Show(GetResourceKey("新密码登录链接已发送到邮箱,请查收!"));
img.ImageUrl = DrawToBase64(4);
}
}
else
{
Alert.Show(GetResourceKey("邮箱错误,请输入注册邮箱!"));
img.ImageUrl = DrawToBase64(4);
return;
}
}

4
北京北汽/SCP/packages.config

@ -12,6 +12,7 @@
<package id="FineUI" version="6.0.1" targetFramework="net452" />
<package id="jQuery" version="1.10.2" targetFramework="net452" />
<package id="knockoutjs" version="3.4.2" targetFramework="net452" />
<package id="MailKit" version="3.1.1" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" />
@ -30,9 +31,12 @@
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="MimeKit" version="3.1.1" targetFramework="net452" />
<package id="Modernizr" version="2.6.2" targetFramework="net452" />
<package id="NPOI" version="2.3.0" targetFramework="net452" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net452" />
<package id="Respond" version="1.2.0" targetFramework="net452" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net452" />
<package id="System.Buffers" version="4.5.1" targetFramework="net452" />
<package id="WebGrease" version="1.5.2" targetFramework="net452" />
</packages>
Loading…
Cancel
Save