From 20de9f0eb7ffb3159c347f4aba06f1ef6601752f Mon Sep 17 00:00:00 2001 From: qian Date: Wed, 27 Dec 2023 16:29:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E5=8F=8A?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=94=B6=E8=B4=A7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/SCP_EXCEL_CONTROLLER.cs | 100 ++++++++++++++++++ .../Controller/SCP_RECEIVE_CONTROLLER.cs | 10 +- .../SCP/Views/SupplierData/SCP_ARRIVE.aspx.cs | 8 +- 3 files changed, 112 insertions(+), 6 deletions(-) diff --git a/北京北汽/Controller/SCP_EXCEL_CONTROLLER.cs b/北京北汽/Controller/SCP_EXCEL_CONTROLLER.cs index 9ec769f..eae7724 100644 --- a/北京北汽/Controller/SCP_EXCEL_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_EXCEL_CONTROLLER.cs @@ -416,5 +416,105 @@ namespace CK.SCP.Controller } return _ds; } + + // 分地点导出 + public static DataSet GET_ARRIVE_EXECELBySite(List p_lst, string p_vendid = "",string site ="") + { + DataSet _ds = new DataSet(); + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + List _ls = new List(); + if (!string.IsNullOrEmpty(p_vendid)) + { + if (!string.IsNullOrWhiteSpace(site)) + { + _ls = db.V_TB_ARRIVE.Where(p => p_lst.Contains(p.ArrvBillNum) && (p.VendId == p_vendid) && (p.SubSite == site)).ToList(); + } + else + { + _ls = db.V_TB_ARRIVE.Where(p => (p_lst.Contains(p.ArrvBillNum)) && (p.VendId == p_vendid)).ToList(); + } + } + else + { + if (!string.IsNullOrWhiteSpace(site)) + { + _ls = db.V_TB_ARRIVE.Where(p => p_lst.Contains(p.ArrvBillNum) && (p.SubSite == site)).ToList(); + } + else + { + _ls = db.V_TB_ARRIVE.Where(p => p_lst.Contains(p.ArrvBillNum)).ToList(); + } + + } + + var str = JsonHelper.GetJson(_ls); + var _exportList = new List(); + _ls.ForEach(itm => + { + var _entity = new SCP_ARRIVE_EXPORT(); + _entity.状态 = itm.State_DESC; + _entity.单据类型 = itm.BillType_DESC; + _entity.到货单号 = itm.ArrvBillNum; + _entity.发货单号 = itm.AsnBillNum; + _entity.要货看板号 = itm.AskBillNum; + _entity.订单号 = itm.PoBillNum; + _entity.供应商 = itm.VendName; + _entity.供应商编码 = itm.VendId; + _entity.地点 = itm.SubSite; + _entity.地点名称 = itm.Site_Desc; + _entity.到货日期 = itm.ShipTime == null ? string.Empty : itm.ShipTime.ToString("yyyyMMdd"); + _exportList.Add(_entity); + }); + var _dt = ConvertHelper.ToDataTable(_exportList); + _ds.Tables.Add(_dt); + var _exportDetailList = new List(); + + List _detailList = new List(); + if (!string.IsNullOrEmpty(p_vendid)) + { + if (!string.IsNullOrWhiteSpace(site)) + { + _detailList = db.V_TB_ARRIVE_DETAIL.Where(p => p_lst.Contains(p.ArrvBillNum) && (p.VendId == p_vendid) && (p.SubSite == site)).ToList(); + } + else + { + _detailList = db.V_TB_ARRIVE_DETAIL.Where(p => p_lst.Contains(p.ArrvBillNum) && (p.VendId == p_vendid)).ToList(); + } + + } + else + { + if (!string.IsNullOrWhiteSpace(site)) + { + _detailList = db.V_TB_ARRIVE_DETAIL.Where(p => p_lst.Contains(p.ArrvBillNum)&& (p.SubSite == site)).ToList(); + } + else + { + _detailList = db.V_TB_ARRIVE_DETAIL.Where(p => p_lst.Contains(p.ArrvBillNum)).ToList(); + } + + } + + + _detailList.ForEach(itm => { + var _entity = new SCP_ARRIVE_DETAIL_EXPORT(); + _entity.单据号 = itm.ArrvBillNum; + _entity.发货单号 = itm.AsnBillNum; + _entity.订单号 = itm.PoBillNum; + _entity.订单行 = itm.PoLine.ToString(); + _entity.零件号 = itm.PartCode; + _entity.零件名称 = itm.PartDesc1; + _entity.单位 = itm.Unit; + _entity.数量 = itm.Qty.ToString(); + _entity.时间 = itm.ShipTime == null ? string.Empty : itm.ShipTime.Value.ToString("yyyyMMdd"); + _entity.备注 = itm.Remark; + _exportDetailList.Add(_entity); + }); + var _list_dt = ConvertHelper.ToDataTable(_exportDetailList); + _ds.Tables.Add(_list_dt); + } + return _ds; + } } } diff --git a/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs b/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs index 8c5f8a2..890e923 100644 --- a/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs +++ b/北京北汽/Controller/SCP_RECEIVE_CONTROLLER.cs @@ -1279,7 +1279,11 @@ namespace CK.SCP.Controller } if (!string.IsNullOrEmpty(p_entity.SubSite)) { - q = q.Where(p => p.SubSite==p_entity.SubSite); + q = q.Where(p => p.SubSite == p_entity.SubSite); + } + else if (p_entity.UserInSubSite != null && p_entity.UserInSubSite.Count > 0) + { + q = q.Where(p => p_entity.UserInSubSite.Contains(p.SubSite)); } if (!string.IsNullOrEmpty(p_entity.VendId)) { @@ -1313,10 +1317,6 @@ namespace CK.SCP.Controller { q = q.Where(p => p.Site_Desc.Contains(p_entity.Site_Desc)); } - if (p_entity.UserInSubSite != null && p_entity.UserInSubSite.Count > 0) - { - q = q.Where(p => p_entity.UserInSubSite.Contains(p.SubSite)); - } if (p_entity.UserInVendIds != null && p_entity.UserInVendIds.Count > 0) { q = q.Where(p => p_entity.UserInVendIds.Contains(p.VendId)); diff --git a/北京北汽/SCP/Views/SupplierData/SCP_ARRIVE.aspx.cs b/北京北汽/SCP/Views/SupplierData/SCP_ARRIVE.aspx.cs index 9456207..d56e9dd 100644 --- a/北京北汽/SCP/Views/SupplierData/SCP_ARRIVE.aspx.cs +++ b/北京北汽/SCP/Views/SupplierData/SCP_ARRIVE.aspx.cs @@ -169,13 +169,19 @@ namespace SCP.Views.SupplierData } protected void btnOutput_OnClick(object sender, EventArgs e) { + string SubSite = ""; List _ls = new List(); SearchV_TB_ARRIVEData(rs => { _ls = rs.Select(p => p.ArrvBillNum).ToList(); DataSet ds = null; if (CurrentUser.VenderList.Count > 0) { - ds = SCP_EXCEL_CONTROLLER.GET_ARRIVE_EXECEL(_ls, CurrentUser.VenderList.FirstOrDefault()); + if (!string.IsNullOrEmpty(factoryList.SelectedValue)) + { + SubSite = factoryList.SelectedValue; + } + ds = SCP_EXCEL_CONTROLLER.GET_ARRIVE_EXECELBySite(_ls, CurrentUser.VenderList.FirstOrDefault(), SubSite); + } else {