Browse Source

冲压件要货看板发布优化

master
qian 9 months ago
parent
commit
03cad02474
  1. 13
      Common/CK.SCP.Common.csproj
  2. 110
      Common/MyWebSmtpMail.cs
  3. 8
      Common/app.config
  4. 4
      Common/packages.config
  5. 602
      Controller/SCP_ASK_CONTROLLER.cs
  6. 83
      SCP/Common/MailHelper.cs
  7. 95
      SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs
  8. 158
      SCP/Web.config
  9. 4
      SCP/packages.config
  10. 28
      UniApiGroup/App.config

13
Common/CK.SCP.Common.csproj

@ -31,6 +31,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>
@ -40,6 +43,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.0\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.0\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>
@ -56,10 +65,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" />

110
Common/MyWebSmtpMail.cs

@ -1,4 +1,7 @@
using System;
using MailKit.Security;
using MimeKit;
using MimeKit.Text;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
@ -85,4 +88,109 @@ namespace CK.SCP.Common
}
}
}
public class EmailAddress
{
public EmailAddress(string address, string name)
{
Address = address;
Name = name;
}
public string Name { get; set; }
public string Address { get; set; }
}
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();
}
}
}
}

8
Common/app.config

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration>

4
Common/packages.config

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MailKit" version="3.1.0" targetFramework="net452" />
<package id="MimeKit" version="3.1.0" 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>

602
Controller/SCP_ASK_CONTROLLER.cs

@ -169,21 +169,21 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TA_ASK_SUBPART.Where(p=>p.AskBillNum==ASK&&string.IsNullOrEmpty(p.VendBatch)).ToList();
return db.TA_ASK_SUBPART.Where(p => p.AskBillNum == ASK && string.IsNullOrEmpty(p.VendBatch)).ToList();
}
}
public static ResultObject<bool> Update_User_ErrorCount(string p_userName,int count )
public static ResultObject<bool> Update_User_ErrorCount(string p_userName, int count)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
var user = _appdb.Users.FirstOrDefault(p => p.Name == p_userName);
var user = _appdb.Users.FirstOrDefault(p => p.Name == p_userName);
if (user != null)
{
user.ErrorCount = user.ErrorCount + 1;
if(user.ErrorCount== count)
if (user.ErrorCount == count)
{
user.Enabled = false;
_ret.Message = $"密码错误超过【{count}】次,账号已锁定请联系管理员";
@ -377,7 +377,7 @@ namespace CK.SCP.Controller
var sub = db.TA_SubPartCode.Where(p => p.PartCode == ak.PartCode).ToList();
if (sub.Count() > 0)
{
foreach(var su in sub)
foreach (var su in sub)
{
TA_ASK_SUBPART subpart = new TA_ASK_SUBPART();
subpart.PartCode = su.PartCode;
@ -1359,7 +1359,7 @@ namespace CK.SCP.Controller
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var ret= db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault();
var ret = db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault();
ret.Extend1 = p_entitys.Extend1;
db.TB_ASK.AddOrUpdate(ret);
@ -1426,12 +1426,12 @@ namespace CK.SCP.Controller
return _ret;
}
/// <summary>
///
/// </summary>
/// <param name="p_entitys"></param>
/// <returns></returns>
public static ResultObject<bool> Save_TB_PO(List<TB_PO> p_entitys)
/// <summary>
///
/// </summary>
/// <param name="p_entitys"></param>
/// <returns></returns>
public static ResultObject<bool> Save_TB_PO(List<TB_PO> p_entitys)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
@ -1685,12 +1685,12 @@ namespace CK.SCP.Controller
{
_tDetail.VendBatch = itm.VendBatch;
}
var subpart = db.TA_ASK_SUBPART.Where(p=>p.PartCode== itm.PartCode&&p.AskBillNum==itm.AskBillNum).ToList();
var subpart = db.TA_ASK_SUBPART.Where(p => p.PartCode == itm.PartCode && p.AskBillNum == itm.AskBillNum).ToList();
string str1 = "";
string str2 = "";
foreach(var sub in subpart)
foreach (var sub in subpart)
{
string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#";
string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#";
str2 = str2 + sub.VendBatch;
str1 = str1 + str;
}
@ -1736,17 +1736,17 @@ namespace CK.SCP.Controller
uni.Batch = _tDetail.Batch;
uni.Qty = _tDetail.Qty;
uni.State = 2;
uni.CreateOper=_t.CreateUser;
uni.CreateOper = _t.CreateUser;
uni.CreateTime = DateTime.Now;
uni.PutTime= DateTime.Now;
uni.PutTime = DateTime.Now;
uni.VendId = _t.VendId;
uni.PoUnit = _tDetail.PoUnit;
uni.LocUnit = _tDetail.PoUnit;
uni.ValidDate= DateTime.Now;
uni.ValidDate = DateTime.Now;
uni.ErpBillNum = _tDetail.PoBillNum;
uni.ErpLineNum = _tDetail.PoLine;
uni.VendBatch = sub.VendBatch;
uni.PackQty= _tDetail.Qty;
uni.PackQty = _tDetail.Qty;
uni.Price = _tDetail.Price;
uni.UmConv = 1;
uni.Buyer = _t.ShipUser;
@ -1852,7 +1852,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var po = db.TB_PO.FirstOrDefault(p=>p.PoBillNum==p_ask.PoBillNum);
var po = db.TB_PO.FirstOrDefault(p => p.PoBillNum == p_ask.PoBillNum);
TB_ASN _t = new TB_ASN();
_t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode();
_t.AskBillNum = p_ask.AskBillNum;
@ -1883,7 +1883,7 @@ namespace CK.SCP.Controller
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
_t.Extend3 = partgroup.PartGroup;
}
db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
List<TB_ASN_DETAIL> _list = new List<TB_ASN_DETAIL>();
foreach (var itm in p_order_list)
{
@ -1893,7 +1893,7 @@ namespace CK.SCP.Controller
_tDetail.PoLine = itm.PoLine;
_tDetail.PoUnit = itm.PoUnit;
_tDetail.Batch = itm.Batch;
if (itm.VendBatch=="55")
if (itm.VendBatch == "55")
{
_tDetail.VendBatch = "";
}
@ -1902,12 +1902,12 @@ namespace CK.SCP.Controller
_tDetail.VendBatch = itm.VendBatch;
}
if (_t.PoBillNum.Substring(0, 5) == "CYD03"&&_t.Site=="W21")
if (_t.PoBillNum.Substring(0, 5) == "CYD03" && _t.Site == "W21")
{
var podetail = db.TB_PO_DETAIL.FirstOrDefault(t=>t.PoBillNum==_t.PoBillNum&&t.PartCode==itm.PartCode&&t.PoLine==itm.PoLine);
var podetail = db.TB_PO_DETAIL.FirstOrDefault(t => t.PoBillNum == _t.PoBillNum && t.PartCode == itm.PartCode && t.PoLine == itm.PoLine);
_tDetail.VendBatch = podetail.SubSite + "," + podetail.Extend3 + "," + itm.VendBatch + "#";
}
_tDetail.UpdateUser= itm.VendBatch;
_tDetail.UpdateUser = itm.VendBatch;
_tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty;
_tDetail.PartCode = itm.PartCode;
_tDetail.State = (int)AsnState.New;
@ -1928,18 +1928,18 @@ namespace CK.SCP.Controller
_tDetail.SubSite = itm.SubSite;
_tDetail.Site = itm.Site;
_tDetail.Extend2 = itm.ReceivedQty.ToString();
_tDetail.Remark= itm.ReceivedQty.ToString();
_tDetail.Remark = itm.ReceivedQty.ToString();
_tDetail.UpdateInfo = itm.UpdateInfo;
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
var askdetail=db.TB_ASK_DETAIL.Where(p => p.PartCode == itm.PartCode&&p.AskBillNum==itm.AskBillNum).FirstOrDefault();
var askdetail = db.TB_ASK_DETAIL.Where(p => p.PartCode == itm.PartCode && p.AskBillNum == itm.AskBillNum).FirstOrDefault();
_tDetail.Extend3 = partgroup.PartGroup;
_tDetail.Extend1 =po.VendId;
_tDetail.Extend1 = po.VendId;
if (itm.Site == "U32")
{
var _applin = db.TA_Appliance.FirstOrDefault(p=>p.PartNumber==itm.SubSite&&p.VendID==p_ask.VendId);
var _applin = db.TA_Appliance.FirstOrDefault(p => p.PartNumber == itm.SubSite && p.VendID == p_ask.VendId);
if (_applin != null)
{
var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p=>p.BoxType==_applin.BoxType&&p.Enabled==true);
var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p => p.BoxType == _applin.BoxType && p.Enabled == true);
if (_boxtype != null)
{
TB_ASN_PARTBOX PARTBOX = new TB_ASN_PARTBOX();
@ -1947,14 +1947,14 @@ namespace CK.SCP.Controller
PARTBOX.PartCode = itm.PartCode;
PARTBOX.BoxType = _boxtype.BoxType;
PARTBOX.Box = Convert.ToInt32(_tDetail.Qty) / Convert.ToInt32(_tDetail.PackQty);
if(Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0)
if (Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0)
{
PARTBOX.Box = PARTBOX.Box + 1;
}
PARTBOX.SumBox = PARTBOX.Box;
PARTBOX.PoBillNum = _t.PoBillNum;
PARTBOX.VendId = _t.VendId;
PARTBOX.ShipTime =DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString();
PARTBOX.ShipTime = DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString();
PARTBOX.Batch = _tDetail.Batch;
PARTBOX.PoLine = _tDetail.PoLine;
PARTBOX.PackQty = _tDetail.PackQty;
@ -1966,15 +1966,15 @@ namespace CK.SCP.Controller
var ModelList = db.TA_CarModel.ToList();
foreach (var model in ModelList)
{
if(model.Model.Length<=askdetail.Extend2.Length)
if (model.Model.Length <= askdetail.Extend2.Length)
{
if (askdetail.Extend2.Contains(model.Model))
{
_tDetail.Extend1 = "FT";
break;
_tDetail.Extend1 = "FT";
break;
}
}
}
_tDetail.Extend1 = "PT";
}
@ -2086,7 +2086,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var _ls = p_list.Select(p => p.AskBillNum);
var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
_buffer.Append(" select distinct (C.AskBillNum)from V_TB_ASK_DETAIL C");
_buffer.Append(" left JOIN ");
@ -2111,18 +2111,18 @@ namespace CK.SCP.Controller
return p_list;
}
public static List<V_TB_ASK> GET_IS_COMPLETED_SEND1(List<V_TB_ASK> p_list,string lz)
public static List<V_TB_ASK> GET_IS_COMPLETED_SEND1(List<V_TB_ASK> p_list, string lz)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<V_TB_ASK> lt = new List<V_TB_ASK>();
var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
_buffer.Append(" select AskBillNum from V_TB_ASK_DETAIL ");
_buffer.Append(" select AskBillNum from V_TB_ASK_DETAIL ");
_buffer.Append($" WHERE Currency like '%{lz}%'");
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray()));
var _list = db.Database.SqlQuery<string>(_str).ToList();
var ll= p_list.Where(p => _list.Contains(p.AskBillNum)).ToList();
var ll = p_list.Where(p => _list.Contains(p.AskBillNum)).ToList();
return ll;
}
@ -2211,7 +2211,7 @@ namespace CK.SCP.Controller
p_list.ForEach(itm =>
{
var maxtime = db.TB_ASN_DETAIL.Where(p=>p.PartCode==itm.PartCode&&p.State>-1).Select(t=>t.ProduceDate).Max();
var maxtime = db.TB_ASN_DETAIL.Where(p => p.PartCode == itm.PartCode && p.State > -1).Select(t => t.ProduceDate).Max();
itm.MaxTime = maxtime.ToString();
groupList.ForEach(p =>
@ -2650,327 +2650,317 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
if (p_state == AskState.Close)
switch (p_state)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
if (_ls.Count > 0)
{
_ls.ForEach(p =>
case AskState.Close:
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
if (_ls.Count > 0)
{
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
if (_asnlist.Count > 0)
_ls.ForEach(p =>
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
if (_asnlist.Count > 0)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
}
else
{
p.State = (int)AskState.Close;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.Close);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
else
{
p.State = (int)AskState.Close;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.Close);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
}
);
if (_ret.MessageList.Count == 0)
{
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
}
);
if (_ret.MessageList.Count == 0)
else
{
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,不能关闭!";
}
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,不能关闭!";
}
}
if (p_state == AskState.Complete)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count = _ls.Count(p => p.State == (int)AskState.Ship);
if (count == _ls.Count && _ls.Count > 0)
{
_ls.ForEach(p =>
break;
case AskState.Complete:
var _ls1 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count1 = _ls1.Count(p => p.State == (int)AskState.Ship);
if (count1 == _ls1.Count && _ls1.Count > 0)
{
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
if (_asnlist.Count > 0)
_ls1.ForEach(p =>
{
_ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
}
else
{
p.State = (int)AskState.Complete;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.Complete);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList();
if (_asnlist.Count > 0)
{
_ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
}
else
{
p.State = (int)AskState.Complete;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.Complete);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls1.ToArray());
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录非已发货状态,不能关闭!";
}
}
if (p_state == AskState.Confirm)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count = _ls.Count(p => p.State == (int)AskState.Release);
if (count == _ls.Count && _ls.Count > 0)
{
_ls.ForEach(p =>
else
{
p.State = (int)AskState.Confirm;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录非已发货状态,不能关闭!";
}
break;
case AskState.Confirm:
var _ls2 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count2 = _ls2.Count(p => p.State == (int)AskState.Release);
if (count2 == _ls2.Count && _ls2.Count > 0)
{
_ls2.ForEach(p =>
{
p.State = (int)AskState.Confirm;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
{
itm.State = (int)AskState.Confirm;
itm.State = (int)AskState.Confirm;
itm.UpdateTime = DateTime.Now;
}
itm.UpdateTime = DateTime.Now;
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
#region 供应商确认要货状态完成
//var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
//_pendingList.ForEach(itm => {
// itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED;
// itm.ITEM_CONTENT = "要货看板已完成!";
//}
//);
//db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray());
#endregion
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
#region 供应商确认要货状态完成
//var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
//_pendingList.ForEach(itm => {
// itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED;
// itm.ITEM_CONTENT = "要货看板已完成!";
//}
//);
//db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray());
#endregion
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls2.ToArray());
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是发布状态记录!";
}
}
if (p_state == AskState.New)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count = _ls.Count(p => p.State == (int)AskState.Release);
if (count == _ls.Count && _ls.Count > 0)
{
_ls.ForEach(p =>
else
{
p.State = (int)AskState.New;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.New);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是发布状态记录!";
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是发布状态记录!";
}
}
if (p_state == AskState.Release)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
foreach (var mail in _ls)
{
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL();
mall.State = 0;
mall.SupplicerCode = mail.VendId;
mall.MailBody = "有新的要货订单" + mail.AskBillNum;
mall.Email = mail.PoBillNum;
db.TB_SUPPLIER_MAIL.Add(mall);
}
int count = _ls.Count(p => p.State == (int)AskState.New);
if (count > 0)
{
_ls.ForEach(p =>
break;
case AskState.New:
var _ls3 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count3 = _ls3.Count(p => p.State == (int)AskState.Release);
if (count3 == _ls3.Count && _ls3.Count > 0)
{
p.State = (int)AskState.Release;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
_ls3.ForEach(p =>
{
itm.State = (int)AskState.Release;
p.State = (int)AskState.New;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.New);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls3.ToArray());
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是新建状态记录!";
}
}
if (p_state == AskState.Reject)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
if (count == _ls.Count && _ls.Count > 0)
{
_ls.ForEach(p =>
else
{
p.State = (int)AskState.Reject;
p.IsDeleted = true;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是发布状态记录!";
}
break;
case AskState.Release:
var _ls4 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
foreach (var mail in _ls4)
{
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL();
mall.State = 0;
mall.SupplicerCode = mail.VendId;
mall.MailBody = "有新的要货订单" + mail.AskBillNum;
mall.Email = mail.PoBillNum;
db.TB_SUPPLIER_MAIL.Add(mall);
}
int count4 = _ls4.Count(p => p.State == (int)AskState.New);
if (count4 > 0)
{
_ls4.ForEach(p =>
{
itm.State = (int)AskState.Reject;
itm.IsDeleted = true;
p.State = (int)AskState.Release;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
{
itm.State = (int)AskState.Release;
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
//#region 供应商要货代办作废
//var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
//db.TB_PENING_ITEMS.RemoveRange(_pendingList);
//#endregion
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是新建或发布状态记录!";
}
}
if (p_state == AskState.CompleteForce)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
int count = _ls.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship);
if (count == _ls.Count && _ls.Count > 0)
{
_ls.ForEach(p =>
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls4.ToArray());
}
else
{
if (p.State == (int)AskState.Complete)
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是新建状态记录!";
}
break;
case AskState.Reject:
var _ls5 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count5 = _ls5.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
if (count5 == _ls5.Count && _ls5.Count > 0)
{
_ls5.ForEach(p =>
{
p.State = (int)AskState.Reject;
p.IsDeleted = true;
}
// p.State = (int)AskState.CompleteForce;
#region 修改发货单
var _asnList = db.TB_ASN.Where(itm => itm.IsDeleted == false && itm.AskBillNum == p.AskBillNum && itm.State == 0).ToList();
_asnList.ForEach(itm =>
{
itm.State = (int)AsnState.Reject;
itm.IsDeleted = true;
var _asnDetailList = db.TB_ASN_DETAIL.Where(asn => asn.IsDeleted == false && asn.AsnBillNum == itm.AsnBillNum).ToList();
_asnDetailList.ForEach(ad =>
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
{
itm.State = (int)AsnState.Reject;
ad.IsDeleted = true;
itm.State = (int)AskState.Reject;
itm.IsDeleted = true;
}
);
db.TB_ASN_DETAIL.AddOrUpdate(asndetail => asndetail.UID, _asnDetailList.ToArray());
});
db.TB_ASN.AddOrUpdate(_asnList.ToArray());
#endregion
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum && itm.IsDeleted == false).ToList();
_list.ForEach(itm =>
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
//#region 供应商要货代办作废
//var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList();
//db.TB_PENING_ITEMS.RemoveRange(_pendingList);
//#endregion
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls5.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是新建或发布状态记录!";
}
break;
case AskState.CompleteForce:
var _ls6 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
int count6 = _ls6.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship);
if (count6 == _ls6.Count && _ls6.Count > 0)
{
_ls6.ForEach(p =>
{
itm.AskQty = 0;
var asn = db.V_TB_ASN_DETAIL.Where(ask => ask.AskBillNum == itm.AskBillNum && ask.IsDeleted == false && (ask.State == (int)AsnState.Ship || ask.State == (int)AsnState.Receive))
.GroupBy(ask => new { ask.AskBillNum, ask.PoLine, ask.PartCode })
.Select(ask => new { AsSum = ask.Sum(itm1 => itm1.Qty), PoLine = ask.Key.PoLine, AskBillNum = ask.Key.AskBillNum, PartCode = ask.Key.PartCode }).ToList();
asn.ForEach(itm1 =>
if (p.State == (int)AskState.Complete)
{
if (itm1.AskBillNum == itm.AskBillNum && itm1.PoLine == itm.PoLine && itm1.PartCode == itm.PartCode)
p.State = (int)AskState.Reject;
p.IsDeleted = true;
}
// p.State = (int)AskState.CompleteForce;
#region 修改发货单
var _asnList = db.TB_ASN.Where(itm => itm.IsDeleted == false && itm.AskBillNum == p.AskBillNum && itm.State == 0).ToList();
_asnList.ForEach(itm =>
{
itm.State = (int)AsnState.Reject;
itm.IsDeleted = true;
var _asnDetailList = db.TB_ASN_DETAIL.Where(asn => asn.IsDeleted == false && asn.AsnBillNum == itm.AsnBillNum).ToList();
_asnDetailList.ForEach(ad =>
{
itm.AskQty = itm1.AsSum;
itm.State = (int)AsnState.Reject;
ad.IsDeleted = true;
}
);
db.TB_ASN_DETAIL.AddOrUpdate(asndetail => asndetail.UID, _asnDetailList.ToArray());
});
//itm.State = (int)AskState.CompleteForce;
db.TB_ASN.AddOrUpdate(_asnList.ToArray());
#endregion
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum && itm.IsDeleted == false).ToList();
_list.ForEach(itm =>
{
itm.AskQty = 0;
var asn = db.V_TB_ASN_DETAIL.Where(ask => ask.AskBillNum == itm.AskBillNum && ask.IsDeleted == false && (ask.State == (int)AsnState.Ship || ask.State == (int)AsnState.Receive))
.GroupBy(ask => new { ask.AskBillNum, ask.PoLine, ask.PartCode })
.Select(ask => new { AsSum = ask.Sum(itm1 => itm1.Qty), PoLine = ask.Key.PoLine, AskBillNum = ask.Key.AskBillNum, PartCode = ask.Key.PartCode }).ToList();
asn.ForEach(itm1 =>
{
if (itm1.AskBillNum == itm.AskBillNum && itm1.PoLine == itm.PoLine && itm1.PartCode == itm.PartCode)
{
itm.AskQty = itm1.AsSum;
}
});
//itm.State = (int)AskState.CompleteForce;
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls6.ToArray());
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!";
}
}
if (p_state == AskState.Receive)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
if (count > 0)
{
_ls.ForEach(p =>
else
{
p.State = (int)AskState.Receive;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!";
}
break;
case AskState.Receive:
var _ls7 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
int count7 = _ls7.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release);
if (count7 > 0)
{
_ls7.ForEach(p =>
{
itm.State = (int)AskState.Receive;
p.State = (int)AskState.Receive;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
{
itm.State = (int)AskState.Receive;
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls7.ToArray());
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是新建或发布状态记录!";
}
}
if (p_state == AskState.NoConfirm)
{
var _ls = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
if (_ls.Count == 0)
{
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
_askList.ForEach(p =>
else
{
p.State = (int)AskState.Release;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录,有不是新建或发布状态记录!";
}
break;
case AskState.NoConfirm:
var _ls8 = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
if (_ls8.Count == 0)
{
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList();
_askList.ForEach(p =>
{
itm.State = (int)AskState.Release;
p.State = (int)AskState.Release;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm =>
{
itm.State = (int)AskState.Release;
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _askList.ToArray());
}
);
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _askList.ToArray());
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录已经有发货单据不能取消!";
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = "选择的记录已经有发货单据不能取消!";
}
break;
}
if (string.IsNullOrEmpty(_ret.Message))
{

83
SCP/Common/MailHelper.cs

@ -10,6 +10,7 @@ using System.Text;
using CK.SCP.Utils;
using System.Configuration;
using static CK.SCP.UniApi.Controller.MailController;
using MailKit.Security;
namespace SCP.Common
{
@ -59,6 +60,7 @@ namespace SCP.Common
{
mails = mails.Substring(0, mails.Length - 1);
}
string mailbody = "";
mailbody += "尊敬的供应商<br>";
mailbody += "你好!<br><br>";
@ -295,5 +297,86 @@ namespace SCP.Common
}
}
public static void ASKSendMail(string p_VendId, string p_Content, string p_title, string p_site)
{
try
{
List<String> result = new List<String>();
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(" FactoryUsers AS c ON a.UserId = c.UserID INNER JOIN ");
_buffer.Append(" TA_FACTORY AS d ON c.FACTORY_ID = d.ID INNER JOIN ");
_buffer.Append(" Users AS f ON c.UserID = f.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='{0}' and d.FactoryId='{1}' ) ", p_VendId, p_site);
var _userList = db.Database.SqlQuery<string>(_buffer.ToString()).ToList();
if (_userList != null && _userList.Count > 0)
{
foreach (var itm in _userList)
{
if (itm.Contains('@'))
{
using (ScpEntities dbb = EntitiesFactory.CreateScpInstance())
{
string[] arr = itm.Split('@');
string vendid = arr[0];
var vend = dbb.TA_VENDER.FirstOrDefault(p => p.VendId == vendid);
if (vend != null)
{
break;
}
}
}
string mails = "";
mails += itm + ",";
if (mails != "")
{
mails = mails.Substring(0, mails.Length - 1);
result.Add(mails);
}
}
}
}
var toMail = result;
string mailbody = "";
mailbody += "尊敬的供应商<br>";
mailbody += "你好!<br><br>";
mailbody += "<b>" + p_Content + "</b> ," + ConfigurationManager.AppSettings["ResetPassWord"] + "<br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
List<EmailAddress> toList = new List<EmailAddress>();
foreach (var em1 in toMail)
{
EmailAddress add = new EmailAddress(em1, em1);
toList.Add(add);
}
var smtpMailSender = new MailKitMailSender(SecureSocketOptions.StartTls);
smtpMailSender.BuildMessage(
toList,
p_title,
mailbody,
"BCC"
);
smtpMailSender.Send();
LogHelper.Writlog(LogHelper.LogType.Debug, typeof(MailManager), "ASKSendMail", "发送成功");
}
catch (Exception e)
{
LogHelper.Writlog(LogHelper.LogType.Error, typeof(MailManager), "ASKSendMail", e.Message);
throw e;
}
}
}
}

95
SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs

@ -253,61 +253,70 @@ namespace SCP.PlanData
{
var _ask = Session["Ask"] as V_TB_ASK;
var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(new List<string>() { _ask.AskBillNum }, p_state);
if (ret.State == ReturnStatus.Succeed)
try
{
switch (p_state)
if (ret.State == ReturnStatus.Succeed)
{
case AskState.Release:
if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
{
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
switch (p_state)
{
case AskState.Release:
if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
{
SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
//SCP.Common.MailManager.GetPoMailList();
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
{
SCP.Common.MailManager.ASKSendMail(_ask.VendId, string.Format("发布了新的要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
//SCP.Common.MailManager.GetPoMailList();
}
}
}
Alert.Show(p_msg);
GetV_TB_POData();
BindDetail();
break;
case AskState.Receive:
//SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
break;
case AskState.New:
break;
case AskState.Ship:
// SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
break;
case AskState.Confirm:
break;
case AskState.CompleteForce:
if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
{
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
Alert.Show(p_msg);
GetV_TB_POData();
BindDetail();
break;
case AskState.Receive:
//SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
break;
case AskState.New:
break;
case AskState.Ship:
// SCP.Common.MailManager.SendMail(_ask.VendId, "", "");
break;
case AskState.Confirm:
break;
case AskState.CompleteForce:
if (CurrentUser.ConfigList.ContainsKey("供应商邮件"))
{
SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("强制归档了的要货看板,要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
{
SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("强制归档了的要货看板,要货看板编号{0}", _ask.AskBillNum), string.Format("新的要货单信息{0}", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
}
}
}
Alert.Show(p_msg);
GetV_TB_POData();
BindDetail();
break;
case AskState.Reject:
Alert.Show(p_msg);
GetV_TB_POData();
BindDetail();
break;
case AskState.Reject:
break;
default:
break;
default:
break;
}
break;
}
}
else
{
Alert.Show(ret.Message);
}
}
else
catch(Exception ex)
{
Alert.Show(ret.Message);
Alert.Show(ex.Message);
}
}
}

158
SCP/Web.config

@ -1,73 +1,67 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
https://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<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="wuliu@faway.com"/>
<add key="MailServer" value="smtp.partner.outlook.cn"/>
<add key="MailUserName" value="wuliu@faway.com"/>
<add key="MailPassword" value="BTL1234@12aa"/>
<!--<add key="MailSender" value="3264161989@qq.com"/>
<add key="MailServer" value="smtp.qq.com"/>
<add key="MailUserName" value="3264161989@qq.com"/>
<add key="MailPassword" value="bsvdsyyhsonjchgh"/>
<add key="MailPort" value="587"/>
<add key="ResetPassWord" value="http://123.150.38.30:8091"/>
<!--<add key="MailSender" value="scp@fs-cockpit.com"/>
<add key="MailServer" value="smtp.partner.outlook.cn"/>
<add key="MailUserName" value="scp@fs-cockpit.com"/>
<add key="MailPassword" value="Law73743"/>
<add key="MailPort" value="587"/>
<add key="ResetPassWord" value="http://192.168.0.101:8081" />-->
<!--发邮件配置开始-->
<!--<add key="MailSender" value="qcjscp@fawayqcj.com"/>
<add key="MailServer" value="smtp.exmail.qq.com"/>
<add key="MailUserName" value="qcjscp@fawayqcj.com"/>
<add key="MailPassword" value="ZdmcwmoUP66MKkQ2"/>
<add key="MailPort" value="25"/>
<add key="ResetPassWord" value="localhost:5678" />-->
<!--<add key="MailSender" value="scp@jinhengairbag.com" />
<add key="ResetPassWord" value="localhost:5678" />-->
<!--发邮件配置开始-->
<add key="MailSender" value="qcjscp@fawayqcj.com" />
<add key="MailServer" value="smtp.exmail.qq.com" />
<add key="MailUserName" value="qcjscp@fawayqcj.com" />
<add key="MailPassword" value="ZdmcwmoUP66MKkQ2" />
<add key="MailPort" value="25" />
<add key="ResetPassWord" value="localhost:5678" />
<!--<add key="MailSender" value="scp@jinhengairbag.com" />
<add key="MailServer" value="smtp.qiye.aliyun.com" />
<add key="MailUserName" value="scp@jinhengairbag.com" />
<add key="MailPassword" value="8iCUyrPnfo7WAuPH" />
<add key="MailPort" value="25" />
<add key="ResetPassWord" value="60.21.207.234:55563" />-->
<!--<add key="MailSender" value="scp@syjbjh.com"/>
<add key="MailServer" value="smtp.qiye.aliyun.com"/>
<add key="MailUserName" value="scp@syjbjh.com"/>
<add key="MailPassword" value="abc@SYJBJH.com"/>
<add key="MailPort" value="25"/>
<add key="ResetPassWord" value="localhost:5678
<!--<add key="MailSender" value="scp@syjbjh.com"/>
<add key="MailServer" value="smtp.qiye.aliyun.com"/>
<add key="MailUserName" value="scp@syjbjh.com"/>
<add key="MailPassword" value="abc@SYJBJH.com"/>
<add key="MailPort" value="25"/>
<add key="ResetPassWord" value="localhost:5678
" />-->
<!--<add key="MailSender" value="huangyanling@fzc.com.cn"/>
<!--<add key="MailSender" value="huangyanling@fzc.com.cn"/>
<add key="MailServer" value="smtp.qiye.163.com"/>
<add key="MailUserName" value="huangyanling@fzc.com.cn"/>
<add key="MailPassword" value="Hyl1357"/>
<add key="MailPort" value="25"/>
<add key="ResetPassWord" value="localhost:5678" />-->
<add key="ResetPassWord" value="localhost:5678" />-->
<!--发邮件配置结束-->
<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="SCP_TIME_OUT" value="120"/>
<add key="SCPDbServer" value="." />
<add key="SCPDbPort" value="1433" />
<add key="SCPDbName" value="ChangKeTecSCP" />
<add key="SCP_TIME_OUT" value="120" />
</appSettings>
<FineUI DebugMode="true" Theme="Gray"/>
<FineUI DebugMode="true" Theme="Gray" />
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
@ -77,35 +71,35 @@
</system.Web>
-->
<system.web>
<sessionState mode="InProc" timeout="120"/>
<sessionState mode="InProc" timeout="120" />
<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 " />-->
<httpRuntime executionTimeout="120" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="false"/>
<customErrors mode="Off"/>
<httpRuntime executionTimeout="120" maxRequestLength="204800" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="false" />
<customErrors mode="Off" />
<authentication mode="Forms">
<forms name=".APPBOX_FORMS_AUTH" loginUrl="~/default.aspx" timeout="3" defaultUrl="~/main.aspx" protection="All" path="/"/>
<forms name=".APPBOX_FORMS_AUTH" loginUrl="~/default_CYJ.aspx" timeout="3" defaultUrl="~/main.aspx" protection="All" path="/" />
</authentication>
<authorization>
<deny users="?"/>
<deny users="?" />
</authorization>
<compilation debug="true" targetFramework="4.5.2">
<assemblies>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<!--<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>-->
@ -115,28 +109,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>
@ -150,14 +144,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>
@ -165,26 +159,26 @@
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-Content-Type-Options" value="nosniff"/>
<add name="X-XSS-Protection" value="1"/>
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-XSS-Protection" value="1" />
</customHeaders>
</httpProtocol>
<security>
<!--<requestFiltering allowDoubleEscaping="true"/>-->
<requestFiltering allowDoubleEscaping="true">
<requestLimits maxAllowedContentLength="2147483647"/>
<requestLimits maxAllowedContentLength="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>
</system.webServer>
<entityFramework>
@ -194,29 +188,29 @@
</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>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="JsonServiceSoap"/>
<binding name="JsonServiceSoap" />
</basicHttpBinding>
<customBinding>
<binding name="JsonServiceSoap12">
<textMessageEncoding messageVersion="Soap12"/>
<httpTransport/>
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>

4
SCP/packages.config

@ -13,6 +13,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.0" 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" />
@ -32,9 +33,12 @@
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" version="1.10.9" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="MimeKit" version="3.1.0" 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>

28
UniApiGroup/App.config

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 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="scp@jinhengairbag.com"/>
<add key="MailServer" value="smtp.qiye.aliyun.com"/>
<add key="MailUserName" value="scp@jinhengairbag.com"/>
<add key="MailPassword" value="SCPscp2020"/>
<add key="MailPort" value="25"/>
<add key="MailSender" value="scp@jinhengairbag.com" />
<add key="MailServer" value="smtp.qiye.aliyun.com" />
<add key="MailUserName" value="scp@jinhengairbag.com" />
<add key="MailPassword" value="SCPscp2020" />
<add key="MailPort" value="25" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb"/>
<parameter value="mssqllocaldb" />
</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>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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="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>

Loading…
Cancel
Save