Browse Source

冲压件供应商菜单添加查询条件

SCP_CYJ
qian 6 months ago
parent
commit
4dfac2ff31
  1. 9
      SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx
  2. 13
      SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx.cs
  3. 18
      SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx.designer.cs
  4. 87
      UniApiGroup/Controller/OdbcApiQadController.cs
  5. 3
      UniApiGroup/Controller/PoBillNumcontroller.cs

9
SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx

@ -46,11 +46,18 @@
<f:Form runat="server">
<Rows>
<f:FormRow runat="server" ColumnWidths="25% 25% 25% 25%">
<f:FormRow runat="server" ColumnWidths="20% 20% 20% 20% 20%">
<Items>
<f:TextBox runat="server" Label="订单号" EmptyText="" ID="TXT_PurdocNO" />
<f:DatePicker runat="server" Required="true" DateFormatString="yyyy-MM-dd" Label="订货日期" EmptyText="请选择日期" ID="DP_StartDate" />
<f:DatePicker runat="server" Required="true" DateFormatString="yyyy-MM-dd" Label="至" EmptyText="请选择日期" ID="DP_EndDate" />
<f:TextBox runat="server" Label="创建人" EmptyText="" ID="TXT_CreatedByDesc" />
<f:DropDownList runat="server" ID="DDL_State" Label="状态">
<f:ListItem Text="请选择状态" Value="" />
<f:ListItem Text="待确认" Value="0" />
<f:ListItem Text="供应商已确认" Value="1" />
<f:ListItem Text="作废" Value="-1" />
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow runat="server">

13
SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx.cs

@ -54,7 +54,18 @@ namespace SCP.Views.SupplierData
{
_entity.DocDateEnd = Convert.ToDateTime(DP_EndDate.SelectedDate);
}
_entity.PurdocNO = TXT_PurdocNO.Text;
if (!string.IsNullOrWhiteSpace(TXT_CreatedByDesc.Text))
{
_entity.CreatedBy = TXT_CreatedByDesc.Text.Trim();
}
if (!string.IsNullOrEmpty(DDL_State.SelectedValue))
{
_entity.AcceptStatusSelect = DDL_State.SelectedValue;
}
if (!string.IsNullOrWhiteSpace(TXT_PurdocNO.Text))
{
_entity.PurdocNO = TXT_PurdocNO.Text.Trim();
}
_entity.UserInVendIds = CurrentUser.VenderList;
SCP_MPO_CONTROLLER.Get_V_TB_MPO_List(_entity, (_ret) =>
{

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

@ -122,6 +122,24 @@ namespace SCP.Views.SupplierData
/// </remarks>
protected global::FineUI.DatePicker DP_EndDate;
/// <summary>
/// TXT_CreatedByDesc 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.TextBox TXT_CreatedByDesc;
/// <summary>
/// DDL_State 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUI.DropDownList DDL_State;
/// <summary>
/// BtnClose 控件。
/// </summary>

87
UniApiGroup/Controller/OdbcApiQadController.cs

@ -801,6 +801,11 @@ namespace CK.SCP.GrupUniApi.Controller
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault();
DataTable b = PoBillNumcontroller.GetInvBatchStock(a, FATCTORY.FactoryId);
List<PURStockBill> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURStockBill>(b);
if (list.Count() == 0)
{
Console.WriteLine("更新 ERP采购订单 数据:" + "无数据");
return;
}
var wmsPoList = new List<TB_PO>();
var wmsPoDetailList = new List<TB_PO_DETAIL>();
var wmsAskList = new List<TB_ASK>();
@ -1637,7 +1642,7 @@ namespace CK.SCP.GrupUniApi.Controller
{
try
{
DateTime time = DateTime.Now.AddYears(-1);
DateTime time = DateTime.Now.AddMonths(-12);
var hisList = idb.xxDiMaxes_Order.Where(q => q.CREATEDDATE > time).ToList();
// 读取一年内 所有审批完的一般材料订单
DataTable b = GetGeneralMaterialOrder();
@ -1650,33 +1655,34 @@ namespace CK.SCP.GrupUniApi.Controller
return;
}
List<GeneralMaterialOrder> list = new List<GeneralMaterialOrder>();
//取差集
foreach (var exitem in expectedList)
{
var selectList = orderlist.Where(q => q.PURDOCNO == exitem.PURDOCNO && q.DI_BATCHNO == exitem.DI_BATCHNO && q.PURDOCITEMNO == exitem.PURDOCITEMNO).ToList();
list.AddRange(selectList);
}
var PoList = new List<TB_MATERIALORDERS>();
var PoDetailList = new List<TB_MATERIALORDERS_DETAIL>();
var InPoList = new List<TB_MATERIALORDERS>();
var InPoDetailList = new List<TB_MATERIALORDERS_DETAIL>();
var xxMaxbath = new List<xxDiMaxes_Order>();
var emails = new List<TS_Email>();
var Dlist = list.Where(p => p.CTYPE == "D");
var Ilist = list.Where(p => p.CTYPE == "I").GroupBy(p => p.PURDOCNO).Distinct();
var _Dlist = Dlist.GroupBy(p => p.PURDOCNO).Distinct();
var Dlist = list.Where(p => p.DI_OPERTYPE == "D").GroupBy(p => p.PURDOCNO).Distinct();// 按照订单号分组去重
var Ilist = list.Where(p => p.DI_OPERTYPE == "I").GroupBy(p => p.PURDOCNO).Distinct();// 按照订单号分组去重
string wwadres= sdb.TA_CONFIG.FirstOrDefault(q => q.ParamName == "接口邮件网址").ParamValue;
foreach (var DeleteItem in _Dlist)
// 作废
foreach (var DeleteItem in Dlist)
{
var _list = DeleteItem.ToList();
var _entity = _list.First();
var MATERIALORDERDETAILList = sdb.TB_MATERIALORDERS_DETAIL.Where(q => q.PurdocNO == _entity.PURDOCNO).ToList();
foreach (var Ditem in _list)
{
var MATERIALORDERDETAILList = sdb.TB_MATERIALORDERS_DETAIL.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList();
if (MATERIALORDERDETAILList.Count() == 0)
{
continue;
}
// 根据行号 将子表数据变为作废状态
MATERIALORDERDETAILList.ForEach(p =>
{
if (p.PURDOCITEMNO == Ditem.PURDOCITEMNO)
@ -1684,7 +1690,34 @@ namespace CK.SCP.GrupUniApi.Controller
p.Ctype = Ditem.CTYPE;
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel;
PoDetailList.Add(p);
#region
// 添加发邮件数据
TS_Email email = new TS_Email();
email.EmailToUser = Ditem.VENDORDESC;
string mailbody = "";
mailbody += "尊敬的 供应商<br>";
mailbody += "你好!<br><br>";
mailbody += "一般材料订单 <b>" + Ditem.PURDOCNO +"</b>"+"<b> 行号"+p.PURDOCITEMNO+ "</b> 进行了物料行作废的操作,请登录供应商协同网站进行订单查看。<br>";
mailbody += "登录账号:<b>" + Ditem.VENDORNO + "@W21" + "</b><br>";
mailbody += "登录地址:" + wwadres + "<br><br>";
mailbody += "<br><br><br><br>日期:" + DateTime.Now;
email.EmailString = mailbody;
var user = authdb.Users.FirstOrDefault(q => q.Name.Contains(Ditem.VENDORNO));
if (user == null)
{
email.EmailSendState = 2;
email.EmailSendFailReason = "该供应商邮箱未维护";
}
else
{
email.EmailAddress = user.Email;
email.EmailSendState = 0;
}
emails.Add(email);
#endregion
}
});
var valueType = MATERIALORDERDETAILList.Select(q => q.Ctype).Distinct().ToList();
var type = valueType.FirstOrDefault();
@ -1744,10 +1777,19 @@ namespace CK.SCP.GrupUniApi.Controller
};
xxMaxbath.Add(maxlist1);
}
var itemnolist = _list.Select(q => q.PURDOCITEMNO).ToList();
foreach (var Mitem in MATERIALORDERDETAILList)
{
//子表不包含的变成新建状态
if (!itemnolist.Contains(Mitem.PURDOCITEMNO))
{
Mitem.Ctype = "N";
Mitem.AcceptStatus = (int)GeneralMaterialOrderState.New;
PoDetailList.Add(Mitem);
}
}
}
// 新增
foreach (var InsertItem in Ilist)
{
var inlist = InsertItem.ToList();
@ -1832,22 +1874,25 @@ namespace CK.SCP.GrupUniApi.Controller
sdb.BulkInsert(emails);// 添加一般材料订单的邮件
sdb.BulkInsert(InPoList);// 添加插入的数据
sdb.BulkInsert(InPoDetailList);// 添加明细
item.Remark = ((int)UniApiState.).ToString();
item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
idb.xxDiMaxes_Order.AddOrUpdate(xxMaxbath.ToArray());
// 更新
sdb.TB_MATERIALORDERS.BulkUpdate(PoList);
sdb.TB_MATERIALORDERS_DETAIL.BulkUpdate(PoDetailList);
Console.WriteLine($"更新 一般材料订单 数据:{list.Count}");
idb.BulkInsert(xxMaxbath);
if (PoList.Count()>0)
{
sdb.TB_MATERIALORDERS.AddOrUpdate(q => q.UID, PoList.ToArray());
}
if (PoDetailList.Count()>0)
{
sdb.TB_MATERIALORDERS_DETAIL.AddOrUpdate(q => q.UID, PoDetailList.ToArray());
}
Console.WriteLine($"更新 一般材料订单 数据:{Dlist.Count()+Ilist.Count()}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
if (ex.InnerException != null)
{
Console.WriteLine(ex.InnerException.Message);
}
}
}
}
}

3
UniApiGroup/Controller/PoBillNumcontroller.cs

@ -76,6 +76,9 @@ namespace CK.SCP.UniApi.Controller
{
string Sql = $"select * from PURStockBill";
Sql += $" Where ((ordType='CY02'AND APPROVALSTATUS = '4') OR (ordType='CY04' AND APPROVALSTATUS = '4') OR (ordType='CY05' AND APPROVALSTATUS = '4') OR ( ordType='CY08'AND APPROVALSTATUS = '4' ) OR (ordType='CY09' AND APPROVALSTATUS = '4') ) and plant='W21' and docDate > add_months(trunc(SYSDATE), -12)";
//sql server
//Sql += $" Where ((ordType='CY02'AND APPROVALSTATUS = '4') OR (ordType='CY04' AND APPROVALSTATUS = '4') OR (ordType='CY05' AND APPROVALSTATUS = '4') OR ( ordType='CY08'AND APPROVALSTATUS = '4' ) OR (ordType='CY09' AND APPROVALSTATUS = '4') ) and plant='W21' and docDate > DATEADD(YEAR,-1,GETDATE())";
var dt_Part = DBControllerByOracle.GetDataTable(Sql);
return dt_Part;
}

Loading…
Cancel
Save