学 赵
4 years ago
16 changed files with 2 additions and 1981 deletions
@ -1,40 +0,0 @@ |
|||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MakeSupplierAccount.aspx.cs" Inherits="SCP.Views.PlanData.MakeSupplierAccount" %> |
|
||||
|
|
||||
<!DOCTYPE html> |
|
||||
|
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
||||
<head runat="server"> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
||||
<title></title> |
|
||||
</head> |
|
||||
<body> |
|
||||
<form id="form1" runat="server"> |
|
||||
<f:PageManager runat="server" AutoSizePanelID="Panel1" /> |
|
||||
<f:Panel ID="Panel1" runat="server" Title="" AutoScroll="True"> |
|
||||
<Items> |
|
||||
<f:Form BodyPadding="10px" Height="100px" ID="extForm1" |
|
||||
runat="server" Title="" ShowHeader="false" > |
|
||||
<Rows> |
|
||||
<f:FormRow > |
|
||||
<Items> |
|
||||
<f:DropDownList ID="ddl_Vender" runat="server" Label="供应商" Width="500" EnableEdit="true"></f:DropDownList> |
|
||||
<f:TextBox runat="server" Label="密码" ID="TXT_PASSWORD" Regex="\d{11}" Width="300" TextMode="Password" > |
|
||||
</f:TextBox> |
|
||||
<f:Label runat="server" Text="(空默认密码66666,不空时填写11位手机号)"></f:Label> |
|
||||
</Items> |
|
||||
</f:FormRow> |
|
||||
|
|
||||
<f:FormRow ColumnWidths="25% 25% 25% 25%"> |
|
||||
<Items> |
|
||||
<f:Button runat="server" ID="btnCreate" Text="创建供应商账号" OnClick="btnCreate_Click"></f:Button> |
|
||||
<f:Label ID="lbName" runat="server"></f:Label> |
|
||||
</Items> |
|
||||
</f:FormRow> |
|
||||
</Rows> |
|
||||
</f:Form> |
|
||||
</Items> |
|
||||
</f:Panel> |
|
||||
|
|
||||
</form> |
|
||||
</body> |
|
||||
</html> |
|
@ -1,153 +0,0 @@ |
|||||
using CK.SCP.Controller; |
|
||||
using CK.SCP.Models.AppBoxEntity; |
|
||||
using FineUI; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Web; |
|
||||
using System.Web.UI; |
|
||||
using System.Web.UI.WebControls; |
|
||||
|
|
||||
namespace SCP.Views.PlanData |
|
||||
{ |
|
||||
public partial class MakeSupplierAccount : PageBase |
|
||||
{ |
|
||||
protected void Page_Load(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (!Page.IsPostBack) |
|
||||
{ |
|
||||
BindVender(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
private void BindVender() |
|
||||
{ |
|
||||
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0) |
|
||||
{ |
|
||||
var ls = SCP_TB_VENDER_CONTROLLER.Getlist(CurrentUser.FactoryList.FirstOrDefault()); |
|
||||
|
|
||||
var lsVender=ls.Where(p => p.VendId.Substring(0, 1) == "R").ToList(); |
|
||||
lsVender.ForEach(p => { |
|
||||
p.VendName = string.Format("{0}({1})", p.VendName, p.VendId); |
|
||||
}); |
|
||||
ddl_Vender.DataSource = lsVender; |
|
||||
ddl_Vender.DataTextField = "VendName"; |
|
||||
ddl_Vender.DataValueField = "VendId"; |
|
||||
ddl_Vender.DataBind(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
protected void btnCreate_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
string _username = ddl_Vender.SelectedValue + "@" + CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
var userList = DB.Users.Where(p => p.Name == _username).ToList(); |
|
||||
if (userList.Count == 0) |
|
||||
{ |
|
||||
User item = new User(); |
|
||||
item.Name = _username; |
|
||||
if (string.IsNullOrEmpty(TXT_PASSWORD.Text)) |
|
||||
{ |
|
||||
item.Password = PasswordUtil.CreateDbPassword("666666"); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
item.Password = PasswordUtil.CreateDbPassword(TXT_PASSWORD.Text); |
|
||||
} |
|
||||
item.ChineseName = ddl_Vender.SelectedText; |
|
||||
item.Gender = "男"; |
|
||||
item.CompanyEmail = ddl_Vender.SelectedValue + "@" + CurrentUser.FactoryList.FirstOrDefault() + ".com"; |
|
||||
item.Email = ddl_Vender.SelectedValue + "@" + CurrentUser.FactoryList.FirstOrDefault() + ".com"; |
|
||||
item.Remark = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
item.Enabled = true; |
|
||||
item.CreateTime = DateTime.Now; |
|
||||
item.SupplierCode = ddl_Vender.SelectedValue; |
|
||||
if (!string.IsNullOrEmpty(ddl_Vender.SelectedValue)) |
|
||||
{ |
|
||||
var _role = DB.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); |
|
||||
if (_role != null) |
|
||||
{ |
|
||||
item.Roles = new List<Role>(); |
|
||||
int[] roleIDs = new int[] { _role.ID }; |
|
||||
AddEntities<Role>(item.Roles, roleIDs); |
|
||||
} |
|
||||
item.SupplierCode = ddl_Vender.SelectedValue; |
|
||||
} |
|
||||
DB.Users.Add(item); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
Alert.Show("用户已经存在,不能创建!"); |
|
||||
return; |
|
||||
} |
|
||||
if (DB.SaveChanges() != -1) |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
var user = DB.Users.Where(p => p.Name == _username).FirstOrDefault(); |
|
||||
if (user != null) |
|
||||
{ |
|
||||
if (!string.IsNullOrEmpty(CurrentUser.FactoryList.FirstOrDefault())) |
|
||||
{ |
|
||||
var _VenderUsers = DB.VenderUsers.Where(p => p.UserId == user.ID).ToList(); |
|
||||
if (_VenderUsers != null && _VenderUsers.Count > 0) |
|
||||
{ |
|
||||
DB.VenderUsers.RemoveRange(_VenderUsers); |
|
||||
} |
|
||||
List<VenderUsers> _vList = new List<VenderUsers>(); |
|
||||
VenderUsers _vus = new VenderUsers(); |
|
||||
_vus.UserId = user.ID; |
|
||||
_vus.VenderId = ddl_Vender.SelectedValue; |
|
||||
_vList.Add(_vus); |
|
||||
if (_vList.Count > 0) |
|
||||
{ |
|
||||
var ls = _vList.Where(p => p.UserId > 0 && !string.IsNullOrEmpty(p.VenderId)); |
|
||||
DB.VenderUsers.AddRange(ls.ToArray()); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
if (DB.SaveChanges() != -1) |
|
||||
{ |
|
||||
try |
|
||||
{ |
|
||||
var user1 = DB.Users.Where(p => p.Name == _username).FirstOrDefault(); |
|
||||
var _factory = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
var _f = DB.TA_FACTORY.Where(p => p.FactoryId == _factory).FirstOrDefault(); |
|
||||
int[] titleIDs = new int[] { _f.ID }; |
|
||||
user1.TA_FACTORY = new List<TA_FACTORY>(); |
|
||||
AddEntities<TA_FACTORY>(user1.TA_FACTORY, titleIDs); |
|
||||
if(DB.SaveChanges()!=-1) |
|
||||
{ |
|
||||
Alert.Show("供应商账号初始化成功"); |
|
||||
lbName.Text = "生成账号:" +ddl_Vender.SelectedValue + "@" + CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
return; |
|
||||
} |
|
||||
} |
|
||||
catch (Exception ex) |
|
||||
{ |
|
||||
Alert.Show(ex.Message); |
|
||||
return; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
catch (Exception ex) |
|
||||
{ |
|
||||
Alert.Show(ex.Message); |
|
||||
return; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
catch (Exception ex) |
|
||||
{ |
|
||||
Alert.Show(ex.Message); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,78 +0,0 @@ |
|||||
//------------------------------------------------------------------------------
|
|
||||
// <自动生成>
|
|
||||
// 此代码由工具生成。
|
|
||||
//
|
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
|
||||
// 重新生成代码,则所做更改将丢失。
|
|
||||
// </自动生成>
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
|
|
||||
namespace SCP.Views.PlanData { |
|
||||
|
|
||||
|
|
||||
public partial class MakeSupplierAccount { |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// form1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Panel1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Panel Panel1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// extForm1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Form extForm1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// ddl_Vender 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.DropDownList ddl_Vender; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// TXT_PASSWORD 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.TextBox TXT_PASSWORD; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// btnCreate 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Button btnCreate; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// lbName 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Label lbName; |
|
||||
} |
|
||||
} |
|
@ -1,51 +0,0 @@ |
|||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_PLAN_DETAIL.aspx.cs" Inherits="SCP.Views.SupplierData.SCP_PLAN_DETAIL" %> |
|
||||
|
|
||||
|
|
||||
<!DOCTYPE html> |
|
||||
|
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
||||
<head runat="server"> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
||||
<title></title> |
|
||||
</head> |
|
||||
<body> |
|
||||
<form id="form2" runat="server"> |
|
||||
<f:PageManager runat="server" /> |
|
||||
<f:Panel ID="Panel1" runat="server" Title="" Layout="VBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start" > |
|
||||
<Toolbars> |
|
||||
<f:Toolbar ID="Toolbar2" runat="server"> |
|
||||
<Items> |
|
||||
<f:DropDownList Label="选择计划时间" runat="server" ID="DDL_PLAN" ></f:DropDownList> |
|
||||
<f:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="添加发货单"></f:Button> |
|
||||
</Items> |
|
||||
</f:Toolbar> |
|
||||
</Toolbars> |
|
||||
<Items> |
|
||||
<f:Form runat="server" Title=""> |
|
||||
<Items> |
|
||||
<f:Grid ID="Grid1" runat="server" Width="1000" Height="400px" BoxFlex="1" AutoScroll="true" ClicksToEdit="2" AllowCellEditing="true" AllowSorting="true" OnSort="Grid1_Sort" ></f:Grid> |
|
||||
</Items> |
|
||||
</f:Form> |
|
||||
</Items> |
|
||||
|
|
||||
<Items> |
|
||||
<f:Form runat="server" Title=""> |
|
||||
<Items> |
|
||||
<f:Grid ID="Grid2" runat="server" BoxFlex="1" AutoScroll="true" ClicksToEdit="2" AllowCellEditing="true" > |
|
||||
|
|
||||
</f:Grid> |
|
||||
</Items> |
|
||||
</f:Form> |
|
||||
</Items> |
|
||||
</f:Panel> |
|
||||
<f:Window runat="server" ID="Window1" Hidden="True" |
|
||||
WindowPosition="Center" IsModal="true" Title="Popup Window 1" Target="Parent" EnableIFrame="true" |
|
||||
IFrameUrl="about:blank" Height="840px" Width="700px" /> |
|
||||
<f:Window ID="WindowUpload" runat="server" Hidden="True" |
|
||||
WindowPosition="Center" IsModal="true" Title="Popup Window 1" Target="Parent" EnableIFrame="true" |
|
||||
IFrameUrl="about:blank" Height="200px" Width="400px"> |
|
||||
</f:Window> |
|
||||
</form> |
|
||||
</body> |
|
||||
</html> |
|
||||
|
|
@ -1,181 +0,0 @@ |
|||||
using CK.SCP.Controller; |
|
||||
using CK.SCP.Models.Enums; |
|
||||
using CK.SCP.Models.ScpEntity; |
|
||||
using CK.SCP.Utils; |
|
||||
using FineUI; |
|
||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Data; |
|
||||
using System.IO; |
|
||||
using System.Linq; |
|
||||
using System.Text; |
|
||||
using System.Text.RegularExpressions; |
|
||||
using System.Web; |
|
||||
using System.Web.UI; |
|
||||
using System.Web.UI.WebControls; |
|
||||
|
|
||||
namespace SCP.Views.SupplierData |
|
||||
{ |
|
||||
public partial class SCP_PLAN_DETAIL : PageBase |
|
||||
{ |
|
||||
protected void Page_Load(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (!IsPostBack) |
|
||||
{ |
|
||||
Bind(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void Bind() |
|
||||
{ |
|
||||
LoadData((rs) => { |
|
||||
|
|
||||
DataTable _dt = ExcelHelper.GetDataTableExtend(rs); |
|
||||
foreach (DataColumn column in _dt.Columns) |
|
||||
{ |
|
||||
if (!column.ColumnName.Contains("计划类型") && |
|
||||
!column.ColumnName.Contains("零件编码") && |
|
||||
!column.ColumnName.Contains("零件名称") && |
|
||||
!column.ColumnName.Contains("供应商编码") && |
|
||||
!column.ColumnName.Contains("供应商名称") && |
|
||||
!column.ColumnName.Contains("运输周期") && |
|
||||
!column.ColumnName.Contains("域") && |
|
||||
!column.ColumnName.Contains("地点") && |
|
||||
!column.ColumnName.Contains("行号") && |
|
||||
!column.ColumnName.Contains("版本号") |
|
||||
) |
|
||||
{ |
|
||||
FineUI.RenderField bf; |
|
||||
bf = new FineUI.RenderField(); |
|
||||
bf.Width = 180; |
|
||||
bf.Editor.Add(new NumberBox() { MinValue = 0, MaxValue = 99999999 }); |
|
||||
bf.DataField = column.ColumnName; |
|
||||
bf.SortField = column.ColumnName; |
|
||||
bf.HeaderText = column.ColumnName; |
|
||||
Grid1.Columns.Add(bf); |
|
||||
DDL_PLAN.Items.Add(column.ColumnName, column.ColumnName); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
FineUI.BoundField bf; |
|
||||
bf = new FineUI.BoundField(); |
|
||||
bf.DataField = column.ColumnName; |
|
||||
bf.DataFormatString = "{0}"; |
|
||||
bf.SortField = column.ColumnName; |
|
||||
bf.HeaderText = column.ColumnName; |
|
||||
Grid1.Columns.Add(bf); |
|
||||
} |
|
||||
} |
|
||||
Grid1.DataSource = _dt; |
|
||||
Grid1.DataBind(); |
|
||||
|
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
private void LoadData(Action<string> p_action) |
|
||||
{ |
|
||||
TB_PLAN_CUSTOM _plan = new TB_PLAN_CUSTOM(); |
|
||||
_plan.UID = long.Parse(Request["UID"]); |
|
||||
SCP_PLAN_CONTROLLER.Get_TB_PLAN_CUSTOM_List(_plan, (rs) => { |
|
||||
if (rs.State == ReturnStatus.Succeed) |
|
||||
{ |
|
||||
var _entity = rs.Result.ToList().FirstOrDefault(); |
|
||||
switch (_entity.PlanType.Trim()) |
|
||||
{ |
|
||||
case "DAY": |
|
||||
string urlPath = "/DayPlan/" + _entity.PlanData; // 文件下载的URL地址,供给前台下载
|
|
||||
string filePath = HttpContext.Current.Server.MapPath("\\" + urlPath); // 文件路径
|
|
||||
// RenderTable(filePath);
|
|
||||
p_action(filePath); |
|
||||
break; |
|
||||
case "WEEK": |
|
||||
string urlPath1 = "/WeekPlan/" + _entity.PlanData; // 文件下载的URL地址,供给前台下载
|
|
||||
string filePath1 = HttpContext.Current.Server.MapPath("\\" + urlPath1); // 文件路径
|
|
||||
p_action(filePath1); |
|
||||
break; |
|
||||
case "MONTH": |
|
||||
string urlPath2 = "/MonthPlan/" + _entity.PlanData; // 文件下载的URL地址,供给前台下载
|
|
||||
string filePath2 = HttpContext.Current.Server.MapPath("\\" + urlPath2); // 文件路径
|
|
||||
p_action(filePath2); |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
}); |
|
||||
} |
|
||||
private void ImportExcel() |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
protected void Grid1_Sort(object sender, GridSortEventArgs e) |
|
||||
{ |
|
||||
// Dictionary<string, string> _dic = new Dictionary<string, string>();
|
|
||||
string str = e.SortDirection; |
|
||||
|
|
||||
if (e.SortField.Contains("/")) |
|
||||
{ |
|
||||
//_dic.Add(e.SortDirection,)
|
|
||||
// Session["Bill"] = _dic;
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
protected void btnAdd_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
LoadData((p_filePath) => { |
|
||||
DataTable _dt = ExcelHelper.GetDataTableExtend(p_filePath); |
|
||||
TB_ASK _ask = new TB_ASK(); |
|
||||
_ask.VendId=_dt.Rows[0]["供应商编码"].ToString(); |
|
||||
_ask.Site=_dt.Rows[0]["域"].ToString(); |
|
||||
_ask.PoBillNum = _ask.VendId; |
|
||||
_ask.State = (int)AskState.New; |
|
||||
_ask.IsDeleted = false; |
|
||||
_ask.ModType = (int)BillModType.Contract; |
|
||||
_ask.CreateUser =CurrentUser.Name; |
|
||||
_ask.CreateTime =DateTime.Now; |
|
||||
_ask.ErpBillNum = _ask.PoBillNum; |
|
||||
_ask.GUID = Guid.NewGuid(); |
|
||||
var _first=SCPDB.TA_VENDER.Where(p => p.VendId == _ask.VendId).FirstOrDefault(); |
|
||||
foreach (DataRow _row in _dt.Rows) |
|
||||
{ |
|
||||
TB_ASK_DETAIL _askDetail = new TB_ASK_DETAIL(); |
|
||||
_askDetail.PoBillNum = _ask.PoBillNum; |
|
||||
_askDetail.TempQty = 0; |
|
||||
_askDetail.Currency = _first.Currency; |
|
||||
_askDetail.CreateTime = _ask.CreateTime; |
|
||||
_askDetail.CreateUser = _askDetail.CreateUser; |
|
||||
foreach (DataColumn column in _dt.Columns) |
|
||||
{ |
|
||||
//row[column.ColumnName]
|
|
||||
switch (column.ColumnName) |
|
||||
{ |
|
||||
case "零件编码": |
|
||||
_askDetail.PartCode = _row[column.ColumnName].ToString(); |
|
||||
break; |
|
||||
//case "运输周期":
|
|
||||
// _askDetail.PartCode = _row[column.ColumnName].ToString();
|
|
||||
// break;
|
|
||||
case "行号": |
|
||||
_askDetail.PoLine = int.Parse(_row[column.ColumnName].ToString()); |
|
||||
break; |
|
||||
} |
|
||||
if (column.ColumnName == DDL_PLAN.SelectedValue) |
|
||||
{ |
|
||||
_askDetail.AskQty = decimal.Parse(_row[column.ColumnName].ToString()); |
|
||||
column.ColumnName.Split(new char[] {','}); |
|
||||
|
|
||||
|
|
||||
//_askDetail.BeginTime
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
|
@ -1,96 +0,0 @@ |
|||||
//------------------------------------------------------------------------------
|
|
||||
// <自动生成>
|
|
||||
// 此代码由工具生成。
|
|
||||
//
|
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
|
||||
// 重新生成代码,则所做更改将丢失。
|
|
||||
// </自动生成>
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
|
|
||||
namespace SCP.Views.SupplierData { |
|
||||
|
|
||||
|
|
||||
public partial class SCP_PLAN_DETAIL { |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// form2 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form2; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Panel1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Panel Panel1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Toolbar2 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Toolbar Toolbar2; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// DDL_PLAN 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.DropDownList DDL_PLAN; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// btnAdd 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Button btnAdd; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Grid1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Grid Grid1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Grid2 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Grid Grid2; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Window1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Window Window1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// WindowUpload 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Window WindowUpload; |
|
||||
} |
|
||||
} |
|
@ -1,71 +0,0 @@ |
|||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_PLAN_LIST.aspx.cs" Inherits="SCP.Views.PlanData.SCP_PLAN_LIST" %> |
|
||||
|
|
||||
<!DOCTYPE html> |
|
||||
|
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
||||
<head runat="server"> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
||||
<title></title> |
|
||||
</head> |
|
||||
<body> |
|
||||
<form id="form1" runat="server"> |
|
||||
<f:PageManager runat="server" AutoSizePanelID="Panel1" /> |
|
||||
<f:Panel ID="Panel1" runat="server" Title="" AutoScroll="True"> |
|
||||
<Toolbars> |
|
||||
<f:Toolbar ID="Toolbar2" runat="server"> |
|
||||
<Items> |
|
||||
<f:Button ID="btnOutput" runat="server" EnablePostBack="True" OnClick="btnOutput_Click" Text="导出" Icon="CssAdd" > |
|
||||
</f:Button> |
|
||||
|
|
||||
|
|
||||
</Items> |
|
||||
</f:Toolbar> |
|
||||
</Toolbars> |
|
||||
<Items> |
|
||||
<f:Grid runat="server" ID="Grid_V_TB_ASK_DETAIL" |
|
||||
DataKeyNames ="UID,PoBillNum,PoLine,PartCode,PartDesc1,PartDesc2,AskBillNum,AskQty,ReduceQty,ShippedQty,CanQty" |
|
||||
IsDatabasePaging="True" AllowPaging="True" PageSize="100" OnPageIndexChange="Grid_V_TB_ASK_DETAIL_PageIndexChange" EnableCheckBoxSelect="true" |
|
||||
AutoScroll="True" SortField="PoBillNum;PoLine;PartCode;EndTime" SortDirection="DESC" > |
|
||||
<PageItems> |
|
||||
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server"> |
|
||||
</f:ToolbarSeparator> |
|
||||
<f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:"> |
|
||||
</f:ToolbarText> |
|
||||
<f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged" |
|
||||
runat="server"> |
|
||||
<%-- <f:ListItem Text="10" Value="10" />--%> |
|
||||
<f:ListItem Text="40" Value="40" /> |
|
||||
<f:ListItem Text="80" Value="80" /> |
|
||||
<f:ListItem Text="100" Value="100" /> |
|
||||
<f:ListItem Text="200" Value="200" /> |
|
||||
</f:DropDownList> |
|
||||
</PageItems> |
|
||||
<Columns> |
|
||||
<f:BoundField SortField="State" DataField="State" HeaderText="状态" ColumnID="State" Width="50px" Hidden="true" /> |
|
||||
<f:BoundField SortField="PoBillNum" DataField="PoBillNum" HeaderText="订单编号" ColumnID="PoBillNum" Width="80px" /> |
|
||||
<f:BoundField SortField="VendName" DataField="VendName" HeaderText="供应商名称" ColumnID="VendName" /> |
|
||||
<f:BoundField SortField="EndTime" DataField="EndTime" HeaderText="需求日期" ColumnID="EndTime" /> |
|
||||
<f:BoundField SortField="PoLine" DataField="PoLine" HeaderText="行号" ColumnID="PoLine" Width="40px" /> |
|
||||
<f:BoundField SortField="PartDesc1" DataField="PartDesc1" HeaderText="零件名称" ColumnID="PartDesc1" Width="200px" /> |
|
||||
<f:BoundField SortField="PartCode" DataField="PartCode" HeaderText="零件号" ColumnID="ProductCode" Width="80px" /> |
|
||||
<f:BoundField SortField="PoUnit" DataField="PoUnit" HeaderText="单位" ColumnID="PoUnit" Width="40px" /> |
|
||||
<f:BoundField SortField="PackQty" DataField="PackQty" HeaderText="标包数量" ColumnID="PackQty" Width="80px" DataFormatString = "{0:F}" /> |
|
||||
<f:BoundField SortField="AskQty" DataField="AskQty" HeaderText="要货数量" ColumnID="AskQty" Width="80px" /> |
|
||||
<f:BoundField SortField="BeginTime" DataField="BeginTime" HeaderText="发布日期" ColumnID="BeginTime" /> |
|
||||
</Columns> |
|
||||
</f:Grid> |
|
||||
</Items> |
|
||||
</f:Panel> |
|
||||
<f:Window runat="server" ID="Window1" Hidden="True" |
|
||||
WindowPosition="Center" IsModal="true" Title="Popup Window 1" Target="Parent" EnableIFrame="true" |
|
||||
IFrameUrl="about:blank" Height="840px" Width="700px" /> |
|
||||
<f:Window ID="WindowUpload" runat="server" Hidden="True" |
|
||||
WindowPosition="Center" IsModal="true" Title="Popup Window 1" Target="Parent" EnableIFrame="true" |
|
||||
IFrameUrl="about:blank" Height="200px" Width="400px"> |
|
||||
</f:Window> |
|
||||
<f:HiddenField runat="server" ID="TXT_ModType"></f:HiddenField> |
|
||||
<f:HiddenField runat="server" ID="TXT_State"></f:HiddenField> |
|
||||
</form> |
|
||||
|
|
||||
</body> |
|
||||
</html> |
|
@ -1,494 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Web; |
|
||||
using System.Web.UI; |
|
||||
using System.Web.UI.WebControls; |
|
||||
using CK.SCP.Models.Enums; |
|
||||
using CK.SCP.Models.ScpEntity; |
|
||||
using CK.SCP.Utils; |
|
||||
using CK.SCP.Controller; |
|
||||
using FineUI; |
|
||||
using SCP.Code; |
|
||||
using CK.SCP.Models; |
|
||||
using System.Text; |
|
||||
using System.Data.Entity.SqlServer; |
|
||||
using System.Data; |
|
||||
using System.IO; |
|
||||
using NPOI.XSSF.UserModel; |
|
||||
using NPOI.SS.UserModel; |
|
||||
|
|
||||
namespace SCP.Views.PlanData |
|
||||
{ |
|
||||
public partial class SCP_PLAN_LIST :PageBase |
|
||||
{ |
|
||||
protected void Page_Load(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (!IsPostBack) |
|
||||
{ |
|
||||
BindDetail(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public void SearchV_TB_ASK_DETAILData(Action<IQueryable<V_TB_ASK_DETAIL>> p_action) |
|
||||
{ |
|
||||
V_TB_ASK_DETAIL _entity = new V_TB_ASK_DETAIL(); |
|
||||
if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0) |
|
||||
{ |
|
||||
_entity.VendId = CurrentUser.VenderList[0]; |
|
||||
} |
|
||||
_entity.IsDeleted = false; |
|
||||
_entity.EndTime = DateTime.Now; |
|
||||
SCP_ASK_CONTROLLER.Get_V_TB_ASK_DETAIL_List(_entity, (_ret) => |
|
||||
{ |
|
||||
if (_ret.State == ReturnStatus.Succeed) |
|
||||
{ |
|
||||
p_action(_ret.Result); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
public void BindDetail() |
|
||||
{ |
|
||||
SearchV_TB_ASK_DETAILData((ret) => |
|
||||
{ |
|
||||
ret = ret.Where(p => SqlFunctions.IsNumeric(p.Remark) >0); |
|
||||
var _verList =ret.Select(p => p.Remark).ToList(); |
|
||||
var _vlist=_verList.Distinct().ToList(); |
|
||||
if (_vlist.Count > 0) |
|
||||
{ |
|
||||
List<long> _ls1 = new List<long>(); |
|
||||
_vlist.ForEach(p => |
|
||||
{ |
|
||||
_ls1.Add(long.Parse(p)); |
|
||||
}); |
|
||||
ret = ret.Where(p => p.Remark ==_ls1.Max().ToString() && p.AskBillNum.Contains("K_")); |
|
||||
} |
|
||||
Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count(); |
|
||||
var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL,"ASC"); |
|
||||
var _ls = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(list.ToList()); |
|
||||
Grid_V_TB_ASK_DETAIL.DataSource = SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(_ls); |
|
||||
Grid_V_TB_ASK_DETAIL.DataBind(); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
protected void btnOutput_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
V_TB_ASK_DETAIL _entity = new V_TB_ASK_DETAIL(); |
|
||||
if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0) |
|
||||
{ |
|
||||
_entity.VendId = CurrentUser.VenderList[0]; |
|
||||
} |
|
||||
SearchV_TB_ASK_DETAILData((ret) => { |
|
||||
Dictionary<string, string> cellheader = new Dictionary<string, string>(){ |
|
||||
{"PoBillNum" , "发货单号" }, |
|
||||
{ "VendName" , "供应商" }, |
|
||||
{ "EndTime" , "到货日期" }, |
|
||||
{ "PoLine" , "行号" }, |
|
||||
{ "PartCode" , "零件编号" }, |
|
||||
{ "PartDesc1" , "零件名称" }, |
|
||||
{ "AskQty" , "需求数量" }, |
|
||||
{ "PoUnit" , "单位" }, |
|
||||
{ "BeginTime" , "发布日期" }, |
|
||||
}; |
|
||||
string url = EntityListToExcel2003(cellheader, ret.ToList(), "发货单明细"); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
protected void Grid_V_TB_ASK_DETAIL_PageIndexChange(object sender, GridPageEventArgs e) |
|
||||
{ |
|
||||
BindDetail(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) |
|
||||
{ |
|
||||
Grid_V_TB_ASK_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); |
|
||||
BindDetail(); |
|
||||
} |
|
||||
public static string Upload(FineUI.FileUpload fUpload, string ext, TB_CLAIM_APPEND model) |
|
||||
{ |
|
||||
string[] allowedExtensions = { ".xls", ".xlsx" };//允许上传的文件类型
|
|
||||
string filename = ""; //MyWebString.GetOrderNumber();
|
|
||||
bool fileOK = false; |
|
||||
//fUpload.PostedFile.ContentLength
|
|
||||
string fileExtension = System.IO.Path.GetExtension(fUpload.FileName).ToLower(); |
|
||||
for (int i = 0; i < allowedExtensions.Length; i++) |
|
||||
{ |
|
||||
if (fileExtension == allowedExtensions[i]) |
|
||||
{ |
|
||||
fileOK = true; |
|
||||
} |
|
||||
} |
|
||||
if (ext != "") |
|
||||
{ |
|
||||
if (fileExtension != ext.ToLower()) |
|
||||
{ |
|
||||
throw new Exception("只能上传 " + ext + " 类型的文件!"); |
|
||||
} |
|
||||
} |
|
||||
if (fileOK) |
|
||||
{ |
|
||||
if (fUpload.HasFile) |
|
||||
{ |
|
||||
//上传新附件前把旧的删除
|
|
||||
if (!string.IsNullOrEmpty(model.FileNameMD5)) |
|
||||
{ |
|
||||
if (File.Exists(System.Web.HttpContext.Current.Server.MapPath("~//") + model.FileNameMD5)) |
|
||||
{ |
|
||||
File.Delete(System.Web.HttpContext.Current.Server.MapPath("~/ClaimFiles/") + model.FileNameMD5); |
|
||||
} |
|
||||
} |
|
||||
filename = Path.GetFileName(fUpload.FileName); |
|
||||
model.FileName = filename; |
|
||||
//filename = GetMD5HashFromFile(filename); //TODO 将文件名改为MD5
|
|
||||
filename = System.Guid.NewGuid().ToString("N"); |
|
||||
filename = filename + fileExtension; |
|
||||
//filename = Path.GetFileName(fUpload.FileName);
|
|
||||
model.FileNameMD5 = filename; |
|
||||
|
|
||||
if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath("~/ClaimFiles/") + filename)) |
|
||||
{ |
|
||||
fUpload.SaveAs(System.Web.HttpContext.Current.Server.MapPath("~/ClaimFiles/") + filename); |
|
||||
} |
|
||||
//else
|
|
||||
//{
|
|
||||
// File.Delete(System.Web.HttpContext.Current.Server.MapPath("~/uploadfiles/") + filename);
|
|
||||
//}
|
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
throw new Exception("文件上传失败!"); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
throw new Exception("上传文件格式不正确!"); |
|
||||
} |
|
||||
return filename; |
|
||||
} |
|
||||
|
|
||||
//private void ImportExcel()
|
|
||||
//{
|
|
||||
// string _fileName = FileUp.FileName;
|
|
||||
// if (string.IsNullOrEmpty(_fileName))
|
|
||||
// {
|
|
||||
// Alert.Show("选择文件为空!");
|
|
||||
// return;
|
|
||||
// }
|
|
||||
// string _lx = _fileName.Split('.')[1];
|
|
||||
// Stream _stream = FileUp.PostedFile.InputStream;
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
// DataTable _dt = new DataTable();
|
|
||||
// if (_lx == "xls")
|
|
||||
// {
|
|
||||
// _dt = ExcelHelper.GetDataTable(_stream);
|
|
||||
// }
|
|
||||
// else
|
|
||||
// {
|
|
||||
// _dt = ExcelHelper.GetDataTableOfXlsx(_stream);
|
|
||||
// }
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
// //foreach (DataRow row in _dt.Rows)
|
|
||||
// //{
|
|
||||
// // foreach (DataColumn column in _dt.Columns)
|
|
||||
// // {
|
|
||||
// // switch (column.ColumnName)
|
|
||||
// // {
|
|
||||
// // case "供应商编码":
|
|
||||
// // //_row[column.ColumnName] = itm.VendId;
|
|
||||
// // break;
|
|
||||
// // case "零件编码":
|
|
||||
// // //_row[column.ColumnName] = itm.PartCode;
|
|
||||
// // break;
|
|
||||
// // case "供应商名称":
|
|
||||
// // //_row[column.ColumnName] = itm.VendName;
|
|
||||
// // break;
|
|
||||
// // case "零件名称":
|
|
||||
// // //_row[column.ColumnName] = (string.IsNullOrEmpty(itm.PartDesc1) ? string.Empty : itm.PartDesc1) + (string.IsNullOrEmpty(itm.PartDesc2) ? string.Empty : itm.PartDesc2);
|
|
||||
// // break;
|
|
||||
// // case "运输周期":
|
|
||||
// // //_row[column.ColumnName] = txtPlanDay.Text;
|
|
||||
// // break;
|
|
||||
// // case "域":
|
|
||||
// // //_row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault();
|
|
||||
// // break;
|
|
||||
// // case "地点":
|
|
||||
// // //_row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault();
|
|
||||
// // break;
|
|
||||
// // default:
|
|
||||
|
|
||||
|
|
||||
|
|
||||
// // column.ColumnName
|
|
||||
|
|
||||
|
|
||||
// // //_row[column.ColumnName] = "0";
|
|
||||
// // break;
|
|
||||
// // }
|
|
||||
// // }
|
|
||||
// //}
|
|
||||
//}
|
|
||||
|
|
||||
//private void ExportExcel()
|
|
||||
//{
|
|
||||
// string _pobillnum = "RCSCAIP";
|
|
||||
// string _domain = "CNS";
|
|
||||
// string _site = "CNS";
|
|
||||
// int _day = int.Parse(txtPlanDay.Text);
|
|
||||
// DataTable _table = new DataTable();
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "零件编码" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "零件名称" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "供应商编码" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "供应商名称" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "运输周期" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "域" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "地点" });
|
|
||||
|
|
||||
// SCP_PO_CONTROLLER.Get_V_TB_PO_DETAIL_List(new V_TB_PO_DETAIL() { PoBillNum = _pobillnum, Site = _domain }, (rs) =>
|
|
||||
// {
|
|
||||
// if (rs.State == ReturnStatus.Succeed)
|
|
||||
// {
|
|
||||
// switch (DDL_PLAN.SelectedValue)
|
|
||||
// {
|
|
||||
// case "0":
|
|
||||
// DateTime _dt = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now;
|
|
||||
// for (int i = 0; i < 15; i++)
|
|
||||
// {
|
|
||||
// _dt.AddDays(0 - _day);
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = _dt.AddDays(0 - _day).ToShortDateString() + "/" + _dt.ToShortDateString() });
|
|
||||
// _dt = _dt.AddDays(1);
|
|
||||
// }
|
|
||||
// break;
|
|
||||
// case "1":
|
|
||||
// DateTime _dt1 = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now;
|
|
||||
// for (int i = 0; i < 15; i++)
|
|
||||
// {
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = _dt1.AddDays(0 - _day).ToShortDateString() + "/" + _dt1.ToShortDateString() });
|
|
||||
// _dt1 = _dt1.AddDays(7);
|
|
||||
// }
|
|
||||
// break;
|
|
||||
// case "2":
|
|
||||
// DateTime _dt2 = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now;
|
|
||||
// for (int i = 0; i < 15; i++)
|
|
||||
// {
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = _dt2.AddDays(0 - _day).ToShortDateString() + "/" + _dt2.ToShortDateString() });
|
|
||||
// _dt2 = _dt2.AddMonths(1);
|
|
||||
// }
|
|
||||
// break;
|
|
||||
// }
|
|
||||
// var _result = rs.Result.ToList();
|
|
||||
// foreach (var itm in _result)
|
|
||||
// {
|
|
||||
// var _row = _table.NewRow();
|
|
||||
// foreach (DataColumn column in _table.Columns)
|
|
||||
// {
|
|
||||
// switch (column.ColumnName)
|
|
||||
// {
|
|
||||
// case "供应商编码":
|
|
||||
// _row[column.ColumnName] = itm.VendId;
|
|
||||
// break;
|
|
||||
// case "零件编码":
|
|
||||
// _row[column.ColumnName] = itm.PartCode;
|
|
||||
// break;
|
|
||||
// case "供应商名称":
|
|
||||
// _row[column.ColumnName] = itm.VendName;
|
|
||||
// break;
|
|
||||
// case "零件名称":
|
|
||||
// _row[column.ColumnName] = (string.IsNullOrEmpty(itm.PartDesc1) ? string.Empty : itm.PartDesc1) + (string.IsNullOrEmpty(itm.PartDesc2) ? string.Empty : itm.PartDesc2);
|
|
||||
// break;
|
|
||||
// case "运输周期":
|
|
||||
// _row[column.ColumnName] = txtPlanDay.Text;
|
|
||||
// break;
|
|
||||
// case "域":
|
|
||||
// _row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault();
|
|
||||
// break;
|
|
||||
// case "地点":
|
|
||||
// _row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault();
|
|
||||
// break;
|
|
||||
// default:
|
|
||||
// _row[column.ColumnName] = "0";
|
|
||||
// break;
|
|
||||
// }
|
|
||||
// }
|
|
||||
// _table.Rows.Add(_row);
|
|
||||
// }
|
|
||||
// }
|
|
||||
// });
|
|
||||
|
|
||||
// string str = JsonHelper.GetJson(_table);
|
|
||||
// DataSet _ds = new DataSet();
|
|
||||
// _ds.Tables.Add(_table);
|
|
||||
// DataSetToExcel(_ds, "导出计划");
|
|
||||
//}
|
|
||||
|
|
||||
//protected void btnMake_Click(object sender, EventArgs e)
|
|
||||
//{
|
|
||||
// string _pobillnum = "RCSCAIP";
|
|
||||
// string _domain = "CNS";
|
|
||||
// string _site = "CNS";
|
|
||||
// int _day = int.Parse(txtPlanDay.Text);
|
|
||||
// DataTable _table = new DataTable();
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "零件编码" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "零件名称" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "供应商编码" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "供应商名称" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "运输周期" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "域" });
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = "地点" });
|
|
||||
|
|
||||
// SCP_PO_CONTROLLER.Get_V_TB_PO_DETAIL_List(new V_TB_PO_DETAIL() { PoBillNum = _pobillnum, Site = _domain }, (rs) =>
|
|
||||
// {
|
|
||||
// if (rs.State == ReturnStatus.Succeed)
|
|
||||
// {
|
|
||||
// switch (DDL_PLAN.SelectedValue)
|
|
||||
// {
|
|
||||
// case "0":
|
|
||||
// DateTime _dt = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now;
|
|
||||
// for (int i = 0; i < 15; i++)
|
|
||||
// {
|
|
||||
// _dt.AddDays(0 - _day);
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName= _dt.AddDays(0 - _day).ToShortDateString() + "/" + _dt.ToShortDateString() });
|
|
||||
// _dt = _dt.AddDays(1);
|
|
||||
// }
|
|
||||
// break;
|
|
||||
// case "1":
|
|
||||
// DateTime _dt1 = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now;
|
|
||||
// for (int i = 0; i < 15; i++)
|
|
||||
// {
|
|
||||
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = _dt1.AddDays(0 - _day).ToShortDateString() + "/" + _dt1.ToShortDateString() });
|
|
||||
// _dt1 = _dt1.AddDays(7);
|
|
||||
// }
|
|
||||
// break;
|
|
||||
// case "2":
|
|
||||
// DateTime _dt2 = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now;
|
|
||||
// for (int i = 0; i < 15; i++)
|
|
||||
// {
|
|
||||
// _table.Columns.Add(new DataColumn() { ColumnName = _dt2.AddDays(0 - _day).ToShortDateString() + "/" + _dt2.ToShortDateString() });
|
|
||||
// _dt2 = _dt2.AddMonths(1);
|
|
||||
// }
|
|
||||
// break;
|
|
||||
// }
|
|
||||
// var _result = rs.Result.ToList();
|
|
||||
// foreach (var itm in _result)
|
|
||||
// {
|
|
||||
// var _row = _table.NewRow();
|
|
||||
// foreach (DataColumn column in _table.Columns)
|
|
||||
// {
|
|
||||
// switch (column.ColumnName)
|
|
||||
// {
|
|
||||
// case "供应商编码":
|
|
||||
// _row[column.ColumnName] = itm.VendId;
|
|
||||
// break;
|
|
||||
// case "零件编码":
|
|
||||
// _row[column.ColumnName] = itm.PartCode;
|
|
||||
// break;
|
|
||||
// case "供应商名称":
|
|
||||
// _row[column.ColumnName] = itm.VendName;
|
|
||||
// break;
|
|
||||
// case "零件名称":
|
|
||||
// _row[column.ColumnName] = (string.IsNullOrEmpty(itm.PartDesc1) ? string.Empty : itm.PartDesc1) + (string.IsNullOrEmpty(itm.PartDesc2) ? string.Empty : itm.PartDesc2);
|
|
||||
// break;
|
|
||||
// case "运输周期":
|
|
||||
// _row[column.ColumnName] = txtPlanDay.Text;
|
|
||||
// break;
|
|
||||
// case "域":
|
|
||||
// _row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault();
|
|
||||
// break;
|
|
||||
// case "地点":
|
|
||||
// _row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault();
|
|
||||
// break;
|
|
||||
// default:
|
|
||||
// _row[column.ColumnName] = "0";
|
|
||||
// break;
|
|
||||
// }
|
|
||||
// }
|
|
||||
// _table.Rows.Add(_row);
|
|
||||
// }
|
|
||||
// }
|
|
||||
// });
|
|
||||
|
|
||||
// string str= JsonHelper.GetJson(_table);
|
|
||||
// DataSet _ds =new DataSet();
|
|
||||
// _ds.Tables.Add(_table);
|
|
||||
// DataSetToExcel(_ds, "导出计划");
|
|
||||
//}
|
|
||||
|
|
||||
protected void btnImport_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
//private MemoryStream RenderDataTableToExcel(DataTable SourceTable)
|
|
||||
//{
|
|
||||
// XSSFWorkbook workbook = null;
|
|
||||
// MemoryStream ms = null;
|
|
||||
// ISheet sheet = null;
|
|
||||
// XSSFRow headerRow = null;
|
|
||||
// try
|
|
||||
// {
|
|
||||
// workbook = new XSSFWorkbook();
|
|
||||
// ms = new MemoryStream();
|
|
||||
// sheet = workbook.CreateSheet();
|
|
||||
// headerRow = (XSSFRow)sheet.CreateRow(0);
|
|
||||
// foreach (DataColumn column in SourceTable.Columns)
|
|
||||
// headerRow.CreateCell(column.Ordinal).SetCellValue(column.ColumnName);
|
|
||||
// int rowIndex = 1;
|
|
||||
// foreach (DataRow row in SourceTable.Rows)
|
|
||||
// {
|
|
||||
// XSSFRow dataRow = (XSSFRow)sheet.CreateRow(rowIndex);
|
|
||||
// foreach (DataColumn column in SourceTable.Columns)
|
|
||||
// dataRow.CreateCell(column.Ordinal).SetCellValue(row[column].ToString());
|
|
||||
// ++rowIndex;
|
|
||||
// }
|
|
||||
// //列宽自适应,只对英文和数字有效
|
|
||||
// for (int i = 0; i <= SourceTable.Columns.Count; ++i)
|
|
||||
// sheet.AutoSizeColumn(i);
|
|
||||
// workbook.Write(ms);
|
|
||||
// ms.Flush();
|
|
||||
// }
|
|
||||
// catch (Exception ex)
|
|
||||
// {
|
|
||||
// return null;
|
|
||||
// }
|
|
||||
// finally
|
|
||||
// {
|
|
||||
// ms.Close();
|
|
||||
// sheet = null;
|
|
||||
// headerRow = null;
|
|
||||
// workbook = null;
|
|
||||
// }
|
|
||||
// return ms;
|
|
||||
//}
|
|
||||
//private void DownloadExcel(DataTable dt, string reportName)
|
|
||||
//{
|
|
||||
// MemoryStream ms = RenderDataTableToExcel(dt);
|
|
||||
// if (ms != null)
|
|
||||
// {
|
|
||||
|
|
||||
// Response.AddHeader("Content-Disposition", string.Format("attachment;filename=" + HttpUtility.UrlEncode(reportName) + DateTime.Now.ToString("yyyyMMdd") + ".xlsx"));
|
|
||||
// Response.AddHeader("Content-Length", ms.ToArray().Length.ToString());
|
|
||||
// Response.BinaryWrite(ms.ToArray());
|
|
||||
// Response.Flush();
|
|
||||
// ms.Close();
|
|
||||
// ms.Dispose();
|
|
||||
// }
|
|
||||
// else
|
|
||||
// Response.Write("出错,无法下载!");
|
|
||||
//}
|
|
||||
|
|
||||
} |
|
||||
} |
|
@ -1,123 +0,0 @@ |
|||||
//------------------------------------------------------------------------------
|
|
||||
// <自动生成>
|
|
||||
// 此代码由工具生成。
|
|
||||
//
|
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
|
||||
// 重新生成代码,则所做更改将丢失。
|
|
||||
// </自动生成>
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
|
|
||||
namespace SCP.Views.PlanData { |
|
||||
|
|
||||
|
|
||||
public partial class SCP_PLAN_LIST { |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// form1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Panel1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Panel Panel1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Toolbar2 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Toolbar Toolbar2; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// btnOutput 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Button btnOutput; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Grid_V_TB_ASK_DETAIL 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Grid Grid_V_TB_ASK_DETAIL; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// ToolbarSeparator1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.ToolbarSeparator ToolbarSeparator1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// ToolbarText1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.ToolbarText ToolbarText1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// ddlGridPageSize 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.DropDownList ddlGridPageSize; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Window1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Window Window1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// WindowUpload 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Window WindowUpload; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// TXT_ModType 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.HiddenField TXT_ModType; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// TXT_State 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.HiddenField TXT_State; |
|
||||
} |
|
||||
} |
|
@ -1,74 +0,0 @@ |
|||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_PLAN_VENDER.aspx.cs" Inherits="SCP.Views.PlanData.SCP_PLAN_VENDER" %> |
|
||||
|
|
||||
<!DOCTYPE html> |
|
||||
|
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
||||
<head runat="server"> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
||||
<title></title> |
|
||||
</head> |
|
||||
<body> |
|
||||
<form id="form1" runat="server"> |
|
||||
<f:PageManager runat="server" AutoSizePanelID="Panel1" /> |
|
||||
<f:Panel ID="Panel1" runat="server" Title="" AutoScroll="True"> |
|
||||
<Toolbars> |
|
||||
<f:Toolbar ID="Toolbar2" runat="server"> |
|
||||
<Items> |
|
||||
<f:Button ID="btnOutput" runat="server" EnablePostBack="True" OnClick="btnOutput_Click" Text="导出" Icon="CssAdd" > |
|
||||
</f:Button> |
|
||||
<f:DropDownList ID="ddl_Vender" runat="server" Label="供应商" EnableEdit="true" ></f:DropDownList> |
|
||||
|
|
||||
<f:DropDownList runat="server" ID="DDL_PLAN" Label="状态"> |
|
||||
<f:ListItem Text="日" Value="0" /> |
|
||||
<f:ListItem Text="周" Value="1" /> |
|
||||
<f:ListItem Text="月" Value="2"/> |
|
||||
</f:DropDownList> |
|
||||
<f:NumberBox ID="txtPlanDay" runat="server" Label="运输周期" Text="7"></f:NumberBox> |
|
||||
<f:DatePicker ID="dp_ArriveDate" runat="server" Label="需求日期"></f:DatePicker> |
|
||||
<f:Button ID="btnMake" runat="server" EnablePostBack="True" OnClick="btnMake_Click" Text="导出计划模板" Icon="PageExcel" > |
|
||||
</f:Button> |
|
||||
</Items> |
|
||||
</f:Toolbar> |
|
||||
|
|
||||
</Toolbars> |
|
||||
<Items> |
|
||||
<f:SimpleForm runat="server"> |
|
||||
<Items> |
|
||||
<f:FileUpload runat="server" ID="FileUp" EmptyText="请选择导入计划模板" ButtonIcon="PageExcel" Label="上传计划" > </f:FileUpload> |
|
||||
<f:Button ID="btnImport" runat="server" EnablePostBack="True" OnClick="btnImport_Click" Text="导入预测" Icon="PageExcel" > |
|
||||
</f:Button> |
|
||||
</Items> |
|
||||
</f:SimpleForm> |
|
||||
<f:Grid ID = "Grid1" EnableCollapse = "true" ShowBorder = "true" ShowHeader = "true" runat ="server" EnableCheckBoxSelect="true" |
|
||||
DataKeyNames= "UID,VendID,PlanData,Version" |
|
||||
AllowSorting="true" PageSize="1000" |
|
||||
CssClass="maingrid" EnableRowDoubleClickEvent="True" OnRowDoubleClick="Grid1_RowDoubleClick" |
|
||||
IsDatabasePaging="True" AllowPaging="True" |
|
||||
AutoScroll="True" SortDirection="ASC" |
|
||||
BoxFlex="1" > |
|
||||
|
|
||||
<Columns> |
|
||||
<f:BoundField Width = "100px" DataField = "UID" HeaderText = "UID" Hidden="true" /> |
|
||||
<f:BoundField Width = "100px" DataField = "PlanType" HeaderText = "订单类型" /> |
|
||||
<f:BoundField Width = "100px" DataField = "VendID" HeaderText = "供应商编码" /> |
|
||||
<f:BoundField Width = "300px" DataField = "PlanData" HeaderText = "数据编码" /> |
|
||||
<f:BoundField Width = "200px" DataField = "Version" HeaderText = "版本号" /> |
|
||||
<f:BoundField Width = "100px" DataField = "CreateUser" HeaderText = "创建人" /> |
|
||||
<f:BoundField Width = "100px" DataField = "CreateTime" HeaderText = "创建时间" /> |
|
||||
</Columns> |
|
||||
</f:Grid> |
|
||||
|
|
||||
</Items> |
|
||||
</f:Panel> |
|
||||
<f:Window runat="server" ID="Window1" Hidden="True" |
|
||||
WindowPosition="Center" IsModal="true" Title="Popup Window 1" Target="Parent" EnableIFrame="true" |
|
||||
IFrameUrl="about:blank" Height="600px" Width="1024px" /> |
|
||||
<f:Window ID="WindowUpload" runat="server" Hidden="True" |
|
||||
WindowPosition="Center" IsModal="true" Title="Popup Window 1" Target="Parent" EnableIFrame="true" |
|
||||
IFrameUrl="about:blank" Height="200px" Width="400px"> |
|
||||
</f:Window> |
|
||||
<f:HiddenField runat="server" ID="TXT_ModType"></f:HiddenField> |
|
||||
<f:HiddenField runat="server" ID="TXT_State"></f:HiddenField> |
|
||||
</form> |
|
||||
</body> |
|
||||
</html> |
|
@ -1,361 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Web; |
|
||||
using System.Web.UI; |
|
||||
using System.Web.UI.WebControls; |
|
||||
using CK.SCP.Models.Enums; |
|
||||
using CK.SCP.Models.ScpEntity; |
|
||||
using CK.SCP.Utils; |
|
||||
using CK.SCP.Controller; |
|
||||
using FineUI; |
|
||||
using SCP.Code; |
|
||||
using CK.SCP.Models; |
|
||||
using System.Text; |
|
||||
using System.Data.Entity.SqlServer; |
|
||||
using System.Data; |
|
||||
using System.IO; |
|
||||
using NPOI.XSSF.UserModel; |
|
||||
using NPOI.SS.UserModel; |
|
||||
|
|
||||
namespace SCP.Views.PlanData |
|
||||
{ |
|
||||
public partial class SCP_PLAN_VENDER : PageBase |
|
||||
{ |
|
||||
protected void Page_Load(object sender, EventArgs e) |
|
||||
{ |
|
||||
if (!IsPostBack) |
|
||||
{ |
|
||||
BindVender(ddl_Vender); |
|
||||
BindDetail(); |
|
||||
} |
|
||||
} |
|
||||
public void BindDetail() |
|
||||
{ |
|
||||
TB_PLAN_CUSTOM _plan = new TB_PLAN_CUSTOM(); |
|
||||
SCP_PLAN_CONTROLLER.Get_TB_PLAN_CUSTOM_List(_plan, (rs) => { |
|
||||
if(rs.State==ReturnStatus.Succeed) |
|
||||
{ |
|
||||
Grid1.DataSource= rs.Result.ToList(); |
|
||||
Grid1.DataBind(); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
protected void btnOutput_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
protected void Grid_V_TB_ASK_DETAIL_PageIndexChange(object sender, GridPageEventArgs e) |
|
||||
{ |
|
||||
BindDetail(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
|
|
||||
public string Upload(FineUI.FileUpload p_file, string ext, PlanType p_type) |
|
||||
{ |
|
||||
string[] allowedExtensions = { ".xls", ".xlsx" };//允许上传的文件类型
|
|
||||
string filename = ""; //MyWebString.GetOrderNumber();
|
|
||||
bool fileOK = false; |
|
||||
//fUpload.PostedFile.ContentLength
|
|
||||
string fileExtension = System.IO.Path.GetExtension(p_file.FileName).ToLower(); |
|
||||
for (int i = 0; i < allowedExtensions.Length; i++) |
|
||||
{ |
|
||||
if (fileExtension == allowedExtensions[i]) |
|
||||
{ |
|
||||
fileOK = true; |
|
||||
} |
|
||||
} |
|
||||
if (ext != "") |
|
||||
{ |
|
||||
if (fileExtension != ext.ToLower()) |
|
||||
{ |
|
||||
throw new Exception("只能上传 " + ext + " 类型的文件!"); |
|
||||
} |
|
||||
} |
|
||||
if (fileOK) |
|
||||
{ |
|
||||
if (p_file.HasFile) |
|
||||
{ |
|
||||
//上传新附件前把旧的删除
|
|
||||
filename = Path.GetFileName(p_file.FileName); |
|
||||
//model.FileName = filename;
|
|
||||
//filename = GetMD5HashFromFile(filename); //TODO 将文件名改为MD5
|
|
||||
filename = System.Guid.NewGuid().ToString("N"); |
|
||||
filename = filename + fileExtension; |
|
||||
//filename = Path.GetFileName(fUpload.FileName);
|
|
||||
//model.FileNameMD5 = filename;
|
|
||||
filename = filename + fileExtension; |
|
||||
switch (p_type) |
|
||||
{ |
|
||||
case PlanType.DAY: |
|
||||
if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath("~/DayPlan/") + filename)) |
|
||||
{ |
|
||||
p_file.SaveAs(System.Web.HttpContext.Current.Server.MapPath("~/DayPlan/") + filename); |
|
||||
} |
|
||||
break; |
|
||||
case PlanType.WEEK: |
|
||||
if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath("~/WeekPlan/") + filename)) |
|
||||
{ |
|
||||
p_file.SaveAs(System.Web.HttpContext.Current.Server.MapPath("~/WeekPlan/") + filename); |
|
||||
} |
|
||||
break; |
|
||||
case PlanType.MONTH: |
|
||||
if (!File.Exists(System.Web.HttpContext.Current.Server.MapPath("~/MonthPlan/") + filename)) |
|
||||
{ |
|
||||
p_file.SaveAs(System.Web.HttpContext.Current.Server.MapPath("~/MonthPlan/") + filename); |
|
||||
} |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
throw new Exception("文件上传失败!"); |
|
||||
} |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
throw new Exception("上传文件格式不正确!"); |
|
||||
} |
|
||||
return filename; |
|
||||
} |
|
||||
|
|
||||
private void ImportExcel() |
|
||||
{ |
|
||||
string _fileName = FileUp.FileName; |
|
||||
if (string.IsNullOrEmpty(_fileName)) |
|
||||
{ |
|
||||
Alert.Show("选择文件为空!"); |
|
||||
return; |
|
||||
} |
|
||||
string _lx = _fileName.Split('.')[1]; |
|
||||
Stream _stream = FileUp.PostedFile.InputStream; |
|
||||
|
|
||||
DataTable _dt = new DataTable(); |
|
||||
if (_lx == "xls") |
|
||||
{ |
|
||||
_dt = ExcelHelper.GetDataTable(_stream); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
_dt = ExcelHelper.GetDataTableOfXlsx(_stream); |
|
||||
} |
|
||||
|
|
||||
TB_PLAN_CUSTOM _plan = new TB_PLAN_CUSTOM(); |
|
||||
|
|
||||
if (_dt.Rows.Count > 0 && _dt.Rows[0]["计划类型"] != null) |
|
||||
{ |
|
||||
_plan.VendID = _dt.Rows[0]["供应商编码"].ToString(); |
|
||||
_plan.Version = DateTime.Now.ToString("yyyyMMddHHmmssfff"); |
|
||||
_plan.Domain = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
_plan.Site = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
|
|
||||
if (_dt.Rows[0]["计划类型"].ToString() == "日") |
|
||||
{ |
|
||||
var ep = new EpPlusHelper(); |
|
||||
DataSet _ds = new DataSet(); |
|
||||
_dt.Columns.Add(new DataColumn() { ColumnName = "版本号" }); |
|
||||
foreach(DataRow row in _dt.Rows) |
|
||||
{ |
|
||||
row["版本号"] = _plan.Version; |
|
||||
} |
|
||||
_ds.Tables.Add(_dt); |
|
||||
string fileName = Guid.NewGuid().ToString("N") + ".xls"; // 文件名称
|
|
||||
string urlPath = "/DayPlan/" + fileName; // 文件下载的URL地址,供给前台下载
|
|
||||
string filePath = HttpContext.Current.Server.MapPath("\\" + urlPath); // 文件路径 // 1.检测是否存在文件夹,若不存在就建立个文件夹
|
|
||||
string directoryName = Path.GetDirectoryName(filePath); |
|
||||
if (!Directory.Exists(directoryName)) |
|
||||
{ |
|
||||
Directory.CreateDirectory(directoryName); |
|
||||
} |
|
||||
ep.WriteDataSetToExcel(_ds, filePath, "", null); |
|
||||
|
|
||||
_plan.PlanData = fileName; |
|
||||
_plan.PlanType = PlanType.DAY.ToString(); |
|
||||
} |
|
||||
if (_dt.Rows[0]["计划类型"].ToString() == "周") |
|
||||
{ |
|
||||
var ep = new EpPlusHelper(); |
|
||||
DataSet _ds = new DataSet(); |
|
||||
|
|
||||
_dt.Columns.Add(new DataColumn() { ColumnName = "版本号" }); |
|
||||
foreach (DataRow row in _dt.Rows) |
|
||||
{ |
|
||||
row["版本号"] = _plan.Version; |
|
||||
} |
|
||||
|
|
||||
_ds.Tables.Add(_dt); |
|
||||
string fileName = Guid.NewGuid().ToString("N") + ".xls"; // 文件名称
|
|
||||
string urlPath = "/WeekPlan/" + fileName; // 文件下载的URL地址,供给前台下载
|
|
||||
string filePath = HttpContext.Current.Server.MapPath("\\" + urlPath); // 文件路径
|
|
||||
// 1.检测是否存在文件夹,若不存在就建立个文件夹
|
|
||||
string directoryName = Path.GetDirectoryName(filePath); |
|
||||
if (!Directory.Exists(directoryName)) |
|
||||
{ |
|
||||
Directory.CreateDirectory(directoryName); |
|
||||
} |
|
||||
ep.WriteDataSetToExcel(_ds, filePath, "", null); |
|
||||
_plan.PlanData = fileName; |
|
||||
_plan.PlanType = PlanType.WEEK.ToString(); |
|
||||
} |
|
||||
if (_dt.Rows[0]["计划类型"].ToString() == "月") |
|
||||
{ |
|
||||
var ep = new EpPlusHelper(); |
|
||||
DataSet _ds = new DataSet(); |
|
||||
_dt.Columns.Add(new DataColumn() { ColumnName = "版本号" }); |
|
||||
foreach (DataRow row in _dt.Rows) |
|
||||
{ |
|
||||
row["版本号"] = _plan.Version; |
|
||||
} |
|
||||
_ds.Tables.Add(_dt); |
|
||||
string fileName = Guid.NewGuid().ToString("N") + ".xls"; // 文件名称
|
|
||||
string urlPath = "/MonthPlan/" + fileName; // 文件下载的URL地址,供给前台下载
|
|
||||
string filePath = HttpContext.Current.Server.MapPath("\\" + urlPath); // 文件路径
|
|
||||
// 1.检测是否存在文件夹,若不存在就建立个文件夹
|
|
||||
string directoryName = Path.GetDirectoryName(filePath); |
|
||||
if (!Directory.Exists(directoryName)) |
|
||||
{ |
|
||||
Directory.CreateDirectory(directoryName); |
|
||||
} |
|
||||
ep.WriteDataSetToExcel(_ds, filePath, "", null); |
|
||||
_plan.PlanData = fileName; |
|
||||
_plan.PlanType = PlanType.MONTH.ToString(); |
|
||||
|
|
||||
} |
|
||||
_plan.CreateUser = CurrentUser.Name; |
|
||||
_plan.CreateTime = DateTime.Now; |
|
||||
|
|
||||
var _ret=SCP_PLAN_CONTROLLER.Save_TB_PLAN_CUSTOM(new List<TB_PLAN_CUSTOM>() { _plan }); |
|
||||
if (_ret.State == ReturnStatus.Succeed) |
|
||||
{ |
|
||||
Alert.Show("计划上传成功"); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
private void ExportExcel() |
|
||||
{ |
|
||||
string _pobillnum = ddl_Vender.SelectedValue ; |
|
||||
string _domain = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
string _site = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
int _day = int.Parse(txtPlanDay.Text); |
|
||||
DataTable _table = new DataTable(); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "计划类型" }); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "零件编码" }); |
|
||||
|
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "供应商编码" }); |
|
||||
|
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "行号" }); |
|
||||
SCP_PO_CONTROLLER.Get_V_TB_PO_DETAIL_List(new V_TB_PO_DETAIL() { PoBillNum = _pobillnum, Site = _domain }, (rs) => |
|
||||
{ |
|
||||
if (rs.State == ReturnStatus.Succeed) |
|
||||
{ |
|
||||
switch (DDL_PLAN.SelectedValue) |
|
||||
{ |
|
||||
case "0": |
|
||||
DateTime _dt = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now; |
|
||||
for (int i = 0; i < 15; i++) |
|
||||
{ |
|
||||
_dt.AddDays(0 - _day); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = _dt.AddDays(0 - _day).ToShortDateString() + "/" + _dt.ToShortDateString() }); |
|
||||
_dt = _dt.AddDays(1); |
|
||||
} |
|
||||
break; |
|
||||
case "1": |
|
||||
DateTime _dt1 = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now; |
|
||||
for (int i = 0; i < 15; i++) |
|
||||
{ |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = _dt1.AddDays(0 - _day).ToShortDateString() + "/" + _dt1.ToShortDateString() }); |
|
||||
_dt1 = _dt1.AddDays(7); |
|
||||
} |
|
||||
break; |
|
||||
case "2": |
|
||||
DateTime _dt2 = (dp_ArriveDate.SelectedDate != null) ? dp_ArriveDate.SelectedDate.Value : DateTime.Now; |
|
||||
for (int i = 0; i < 15; i++) |
|
||||
{ |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = _dt2.AddDays(0 - _day).ToShortDateString() + "/" + _dt2.ToShortDateString() }); |
|
||||
_dt2 = _dt2.AddMonths(1); |
|
||||
} |
|
||||
break; |
|
||||
} |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "供应商名称" }); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "零件名称" }); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "运输周期" }); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "域" }); |
|
||||
_table.Columns.Add(new DataColumn() { ColumnName = "地点" }); |
|
||||
|
|
||||
var _result = rs.Result.ToList(); |
|
||||
foreach (var itm in _result) |
|
||||
{ |
|
||||
var _row = _table.NewRow(); |
|
||||
foreach (DataColumn column in _table.Columns) |
|
||||
{ |
|
||||
switch (column.ColumnName) |
|
||||
{ |
|
||||
case "供应商编码": |
|
||||
_row[column.ColumnName] = itm.VendId; |
|
||||
break; |
|
||||
case "零件编码": |
|
||||
_row[column.ColumnName] = itm.PartCode; |
|
||||
break; |
|
||||
case "供应商名称": |
|
||||
_row[column.ColumnName] = itm.VendName; |
|
||||
break; |
|
||||
case "零件名称": |
|
||||
_row[column.ColumnName] = (string.IsNullOrEmpty(itm.PartDesc1) ? string.Empty : itm.PartDesc1) + (string.IsNullOrEmpty(itm.PartDesc2) ? string.Empty : itm.PartDesc2); |
|
||||
break; |
|
||||
case "运输周期": |
|
||||
_row[column.ColumnName] = txtPlanDay.Text; |
|
||||
break; |
|
||||
case "域": |
|
||||
_row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
break; |
|
||||
case "地点": |
|
||||
_row[column.ColumnName] = CurrentUser.FactoryList.FirstOrDefault(); |
|
||||
break; |
|
||||
case "计划类型": |
|
||||
_row[column.ColumnName] =DDL_PLAN.SelectedText; |
|
||||
break; |
|
||||
case "行号": |
|
||||
_row[column.ColumnName] =itm.PoLine; |
|
||||
break; |
|
||||
default: |
|
||||
_row[column.ColumnName] = "0"; |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
_table.Rows.Add(_row); |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
string str = JsonHelper.GetJson(_table); |
|
||||
DataSet _ds = new DataSet(); |
|
||||
_ds.Tables.Add(_table); |
|
||||
DataSetToExcel(_ds, "导出计划"); |
|
||||
} |
|
||||
|
|
||||
protected void btnMake_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
ExportExcel(); |
|
||||
} |
|
||||
|
|
||||
protected void btnImport_Click(object sender, EventArgs e) |
|
||||
{ |
|
||||
ImportExcel(); |
|
||||
} |
|
||||
|
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) |
|
||||
{ |
|
||||
object[] rowDataKeys = Grid1.DataKeys[e.RowIndex]; |
|
||||
string uid= rowDataKeys[0].ToString(); |
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../PlanData/SCP_PLAN_DETAIL.aspx?UID={0}", uid))); |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,159 +0,0 @@ |
|||||
//------------------------------------------------------------------------------
|
|
||||
// <自动生成>
|
|
||||
// 此代码由工具生成。
|
|
||||
//
|
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
|
||||
// 重新生成代码,则所做更改将丢失。
|
|
||||
// </自动生成>
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
|
|
||||
namespace SCP.Views.PlanData { |
|
||||
|
|
||||
|
|
||||
public partial class SCP_PLAN_VENDER { |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// form1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Panel1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Panel Panel1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Toolbar2 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Toolbar Toolbar2; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// btnOutput 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Button btnOutput; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// ddl_Vender 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.DropDownList ddl_Vender; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// DDL_PLAN 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.DropDownList DDL_PLAN; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// txtPlanDay 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.NumberBox txtPlanDay; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// dp_ArriveDate 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.DatePicker dp_ArriveDate; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// btnMake 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Button btnMake; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// FileUp 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.FileUpload FileUp; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// btnImport 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Button btnImport; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Grid1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Grid Grid1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// Window1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Window Window1; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// WindowUpload 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.Window WindowUpload; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// TXT_ModType 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.HiddenField TXT_ModType; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// TXT_State 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::FineUI.HiddenField TXT_State; |
|
||||
} |
|
||||
} |
|
@ -1,17 +0,0 @@ |
|||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_RECEIVE_PLAN.aspx.cs" Inherits="SCP.Views.PlanData.SCP_RECEIVE_PLAN" %> |
|
||||
|
|
||||
<!DOCTYPE html> |
|
||||
|
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
||||
<head runat="server"> |
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
|
||||
<title></title> |
|
||||
</head> |
|
||||
<body> |
|
||||
<form id="form1" runat="server"> |
|
||||
<div> |
|
||||
|
|
||||
</div> |
|
||||
</form> |
|
||||
</body> |
|
||||
</html> |
|
@ -1,17 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.Linq; |
|
||||
using System.Web; |
|
||||
using System.Web.UI; |
|
||||
using System.Web.UI.WebControls; |
|
||||
|
|
||||
namespace SCP.Views.PlanData |
|
||||
{ |
|
||||
public partial class SCP_RECEIVE_PLAN : System.Web.UI.Page |
|
||||
{ |
|
||||
protected void Page_Load(object sender, EventArgs e) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,26 +0,0 @@ |
|||||
//------------------------------------------------------------------------------
|
|
||||
// <auto-generated>
|
|
||||
// 此代码由工具生成。
|
|
||||
//
|
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
|
||||
// 重新生成代码,这些更改将会丢失。
|
|
||||
// </auto-generated>
|
|
||||
//------------------------------------------------------------------------------
|
|
||||
|
|
||||
namespace SCP.Views.PlanData |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
public partial class SCP_RECEIVE_PLAN |
|
||||
{ |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// form1 控件。
|
|
||||
/// </summary>
|
|
||||
/// <remarks>
|
|
||||
/// 自动生成的字段。
|
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|
||||
/// </remarks>
|
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|
||||
} |
|
||||
} |
|
Loading…
Reference in new issue