qian
1 month ago
29 changed files with 1949 additions and 911 deletions
File diff suppressed because it is too large
@ -0,0 +1,330 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using CK.SCP.Models.Enums; |
|||
using CK.SCP.Models.ScpEntity; |
|||
using CK.SCP.Utils; |
|||
using CK.SCP.Models; |
|||
using System.Data; |
|||
using System.Data.Entity.Core; |
|||
using System.Text; |
|||
using CK.SCP.Models.ScpEntity.ExcelExportEnttity; |
|||
using System.Collections.Generic; |
|||
using System.Data.Entity.Migrations; |
|||
|
|||
namespace CK.SCP.Controller |
|||
{ |
|||
public class SCP_ToleranceProportion_Controller |
|||
{ |
|||
/// <summary>
|
|||
/// 获取容差控制列表
|
|||
/// </summary>
|
|||
/// <param name="p_entity"></param>
|
|||
/// <param name="p_action"></param>
|
|||
public static void Get_TA_ToleranceProportion_List(TA_ToleranceProportion p_entity, Action<ResultObject<IQueryable<V_TA_ToleranceProportion>>> p_action) |
|||
{ |
|||
ResultObject<IQueryable<V_TA_ToleranceProportion>> _ret = new ResultObject<IQueryable<V_TA_ToleranceProportion>>(); |
|||
try |
|||
{ |
|||
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|||
{ |
|||
IQueryable<V_TA_ToleranceProportion> q = db.V_TA_ToleranceProportion; |
|||
if (!string.IsNullOrEmpty(p_entity.PartCode)) |
|||
{ |
|||
q = q.Where(p => p.PartCode == p_entity.PartCode); |
|||
} |
|||
_ret.State = ReturnStatus.Succeed; |
|||
_ret.Result = q; |
|||
p_action(_ret); |
|||
} |
|||
|
|||
} |
|||
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
|||
{ |
|||
var sb = new StringBuilder(); |
|||
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
|||
{ |
|||
error.ValidationErrors.ToList().ForEach(i => |
|||
{ |
|||
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
|||
}); |
|||
} |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.ErrorList.Add(dbEx); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "Get_TA_ToleranceProportion_List", sb.ToString()); |
|||
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); |
|||
} |
|||
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
|||
{ |
|||
|
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.ErrorList.Add(ex); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "Get_TA_ToleranceProportion_List", ex.ToString()); |
|||
throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); |
|||
} |
|||
catch (ScpException ex) |
|||
{ |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.ErrorList.Add(ex); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "Get_TA_ToleranceProportion_List", ex.ToString()); |
|||
|
|||
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) |
|||
{ |
|||
var inner = (UpdateException)ex.InnerException; |
|||
|
|||
|
|||
throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); |
|||
} |
|||
else |
|||
{ |
|||
if (ex.InnerException != null) throw ex.InnerException; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.ErrorList.Add(e); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "Get_TA_ToleranceProportion_List", e.Message); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 模具分摊导入
|
|||
/// </summary>
|
|||
/// <param name="p_order_list"></param>
|
|||
/// <param name="site"></param>
|
|||
/// <param name="p_creator"></param>
|
|||
/// <returns></returns>
|
|||
public static ResultObject<bool> EXCEL_MOLDSHARING_MOD(List<SCP_PART_ToleranceProportion> p_order_list, string site, string p_creator) |
|||
{ |
|||
ResultObject<bool> _ret = new ResultObject<bool>(); |
|||
List<TA_ToleranceProportion> list = new List<TA_ToleranceProportion>(); |
|||
_ret.State = ReturnStatus.Succeed; |
|||
_ret.Result = true; |
|||
try |
|||
{ |
|||
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|||
{ |
|||
List<string> ErrorList = new List<string>(); |
|||
var _lst = p_order_list; |
|||
_lst.ForEach(p => |
|||
{ |
|||
var _ls = CheckExcelMode_MoldSharing(db, p, site); |
|||
if (_ls.Count > 0) |
|||
{ |
|||
ErrorList.Add(string.Join("<br>", _ls.ToArray())); |
|||
} |
|||
}); |
|||
if (ErrorList.Count > 0) |
|||
{ |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.MessageList.AddRange(ErrorList); |
|||
_ret.Result = false; |
|||
} |
|||
else |
|||
{ |
|||
_lst.ForEach(p => |
|||
{ |
|||
var mold = db.TA_ToleranceProportion.FirstOrDefault(t => t.PartCode.ToUpper() == p.零件号.ToUpper() && t.Site == p.工厂编码.Trim()); |
|||
if (mold == null) |
|||
{ |
|||
mold = new TA_ToleranceProportion |
|||
{ |
|||
PartCode = p.零件号.ToUpper(), |
|||
CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
|||
CreateUser = p_creator, |
|||
Site = p.工厂编码.Trim(), |
|||
ToleranceProportion = decimal.Parse(p.容差), |
|||
}; |
|||
} |
|||
else |
|||
{ |
|||
mold.ToleranceProportion = decimal.Parse(p.容差); |
|||
mold.UpdateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); |
|||
mold.UpdateUser = p_creator; |
|||
} |
|||
list.Add(mold); |
|||
}); |
|||
|
|||
if (_ret.MessageList.Count == 0) |
|||
{ |
|||
|
|||
db.TA_ToleranceProportion.AddOrUpdate(q => q.UID, list.ToArray()); |
|||
int state = db.SaveChanges(); |
|||
if (state != -1) |
|||
{ |
|||
_ret.State = ReturnStatus.Succeed; |
|||
_ret.Result = true; |
|||
} |
|||
else |
|||
{ |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.Result = false; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.Result = false; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
|
|||
{ |
|||
var sb = new StringBuilder(); |
|||
|
|||
foreach (var error in dbEx.EntityValidationErrors.ToList()) |
|||
{ |
|||
|
|||
error.ValidationErrors.ToList().ForEach(i => |
|||
{ |
|||
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); |
|||
}); |
|||
} |
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.Result = false; |
|||
_ret.ErrorList.Add(dbEx); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "EXCEL_MOLDSHARING_MOD", sb.ToString()); |
|||
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); |
|||
} |
|||
catch (OptimisticConcurrencyException ex)//并发冲突异常
|
|||
{ |
|||
|
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.Result = false; |
|||
_ret.ErrorList.Add(ex); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "EXCEL_MOLDSHARING_MOD", ex.ToString()); |
|||
throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); |
|||
} |
|||
catch (ScpException ex) |
|||
{ |
|||
|
|||
|
|||
_ret.State = ReturnStatus.Failed; |
|||
_ret.Result = false; |
|||
_ret.ErrorList.Add(ex); |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "EXCEL_MOLDSHARING_MOD", ex.ToString()); |
|||
|
|||
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) |
|||
{ |
|||
var inner = (UpdateException)ex.InnerException; |
|||
|
|||
|
|||
throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); |
|||
} |
|||
else |
|||
{ |
|||
if (ex.InnerException != null) throw ex.InnerException; |
|||
} |
|||
} |
|||
catch (Exception e) |
|||
{ |
|||
_ret.State = ReturnStatus.Failed; |
|||
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ToleranceProportion_Controller), "EXCEL_MOLDSHARING_MOD", e.Message); |
|||
_ret.Result = false; |
|||
_ret.ErrorList.Add(e); |
|||
_ret.MessageList.Add("保存失败" + e.Message); |
|||
} |
|||
return _ret; |
|||
} |
|||
/// <summary>
|
|||
/// 数据检验
|
|||
/// </summary>
|
|||
/// <param name="db"></param>
|
|||
/// <param name="p_excel"></param>
|
|||
/// <param name="site"></param>
|
|||
/// <returns></returns>
|
|||
public static List<string> CheckExcelMode_MoldSharing(ScpEntities db, SCP_PART_ToleranceProportion p_excel, string site) |
|||
{ |
|||
List<string> ErrorList = new List<string>(); |
|||
|
|||
if (string.IsNullOrEmpty(p_excel.零件号) || string.IsNullOrEmpty(p_excel.工厂编码) || string.IsNullOrEmpty(p_excel.容差)) |
|||
{ |
|||
ErrorList.Add(string.Format("零件编号【{0}】有填写为空!", p_excel.零件号)); |
|||
} |
|||
else |
|||
{ |
|||
int count = db.TA_PART.Count(p => p.PartCode == p_excel.零件号 && p.Site == site); |
|||
if (count <= 0) |
|||
{ |
|||
ErrorList.Add(string.Format("零件编号{0}不存在!", p_excel.零件号)); |
|||
} |
|||
decimal ty = 0.00m; |
|||
if (!decimal.TryParse(p_excel.容差, out ty)) |
|||
{ |
|||
ErrorList.Add(string.Format("零件编号{0},容差填写不正确,不是数字类型!", p_excel.零件号)); |
|||
} |
|||
else |
|||
{ |
|||
if (ty > 1 || ty < 0) |
|||
{ |
|||
ErrorList.Add(string.Format("零件编号{0},容差填写不正确,只能填写0到1之间小数!", p_excel.零件号)); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
return ErrorList; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 检查是否超出容差数据
|
|||
/// </summary>
|
|||
/// <param name="entity"></param>
|
|||
/// <param name="QtyAll"></param>
|
|||
/// <returns></returns>
|
|||
public static List<string> CheckToleranceProportion(V_TB_ASK_DETAIL entity, decimal QtyAll) |
|||
{ |
|||
List<string> ErrorList = new List<string>(); |
|||
var canQty = entity.AskQty - entity.ShippedQty - entity.ReduceQty; |
|||
// WS 和 WG 类型物料 填写的 发货数 不能大于 (要货数量-已发数量)
|
|||
if (entity.DockCode == "WS" || entity.DockCode == "WG") |
|||
{ |
|||
if (canQty > 0) |
|||
{ |
|||
if (QtyAll > canQty) |
|||
{ |
|||
ErrorList.Add(entity.PartCode + "发货数量>可发数量"); |
|||
} |
|||
} |
|||
} |
|||
// YC 和 WT 填写的 发货数 能大于 (要货数 - 已发数量) 但是 不能 大于容差范围 并且 要货数 - 已发数量 不能小于等于0
|
|||
else if (entity.DockCode == "YC" || entity.DockCode == "WT") |
|||
{ |
|||
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|||
{ |
|||
var toleranceProportion = db.TA_ToleranceProportion.FirstOrDefault(q => q.PartCode == entity.PartCode); |
|||
if (toleranceProportion == null) |
|||
{ |
|||
ErrorList.Add(entity.PartCode + "没有容差控制,请联系管理员进行填写"); |
|||
} |
|||
else |
|||
{ |
|||
decimal maxqty = entity.AskQty * (1 + toleranceProportion.ToleranceProportion); |
|||
if (canQty <= 0) |
|||
{ |
|||
ErrorList.Add(entity.PartCode + "只能超发一次哦"); |
|||
} |
|||
// 最大要货数量(要货数* 1+容差) - 累计发货数量 <当前填写的 要货数量
|
|||
else if ((maxqty - entity.ShippedQty - entity.ReduceQty )< QtyAll) |
|||
{ |
|||
ErrorList.Add(entity.PartCode + "容差控制为"+ (toleranceProportion.ToleranceProportion * 100)+"% ,本次填写发货数量超出"+ Math.Abs((maxqty - entity.ShippedQty - QtyAll).Value)); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
else if ((canQty <= 0) && (QtyAll > 0)) |
|||
{ |
|||
ErrorList.Add(entity.PartCode + "只能超发一次哦"); |
|||
} |
|||
|
|||
|
|||
return ErrorList; |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity |
|||
{ |
|||
public class SCP_PART_ToleranceProportion |
|||
{ |
|||
public string 零件号 { get; set; } |
|||
public string 工厂编码 { get; set; } |
|||
public string 容差 { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
using System.ComponentModel; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
|
|||
namespace CK.SCP.Models.ScpEntity |
|||
{ |
|||
public class TA_ToleranceProportion |
|||
{ |
|||
[Key] |
|||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] |
|||
public long UID { get; set; } |
|||
|
|||
[StringLength(50)] |
|||
public string PartCode { get; set; } |
|||
[DisplayName("容差控制默认0.2 20%")] |
|||
public decimal ToleranceProportion { get; set; } |
|||
|
|||
[StringLength(20)] |
|||
public string CreateUser { get; set; } |
|||
public string CreateTime { get; set; } |
|||
public string UpdateUser { get; set; } |
|||
public string UpdateTime { get; set; } |
|||
[DisplayName("地点")] |
|||
public string Site { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
using System.ComponentModel; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.ComponentModel.DataAnnotations.Schema; |
|||
|
|||
namespace CK.SCP.Models.ScpEntity |
|||
{ |
|||
public class V_TA_ToleranceProportion |
|||
{ |
|||
[Key] |
|||
public long UID { get; set; } |
|||
|
|||
[StringLength(50)] |
|||
public string PartCode { get; set; } |
|||
[DisplayName("容差控制默认0.2 20%")] |
|||
public string VToleranceProportion { get; set; } |
|||
|
|||
[DisplayName("零件名称")] |
|||
public string PartName { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,61 @@ |
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_ToleranceProportion.aspx.cs" Inherits="SCP.Views.BasicData.SCP_ToleranceProportion" %> |
|||
|
|||
<!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 ID="PageManager1" runat="server" AutoSizePanelID="Panel1" /> |
|||
<f:Panel ID="Panel1" runat="server" Title="" Layout="VBox"> |
|||
<Items> |
|||
<f:Toolbar ID="Toolbar1" runat="server"> |
|||
<Items> |
|||
|
|||
<f:Button ID="Button3" runat="server" EnablePostBack="false" Text="刷新" Icon="Reload" OnClientClick="location.reload();" /> |
|||
<f:TextBox ID="txtPartCode" runat="server" Label="零件号" Text=""> |
|||
</f:TextBox> |
|||
<f:Button ID="btnSearch" runat="server" Text="快速查找" OnClick="btnSearch_Click" Icon="SystemSearch"> |
|||
</f:Button> |
|||
|
|||
<f:ToolbarSeparator runat="server" /> |
|||
<f:FileUpload runat="server" ID="FileUp" EmptyText="请选择导入模板" Required="true" Width="200" ButtonIcon="Add" ShowRedStar="true"></f:FileUpload> |
|||
<f:Button ID="btnInput" runat="server" Text="导入" Icon="PageExcel" OnClick="btnInput_Click"> |
|||
</f:Button> |
|||
</Items> |
|||
</f:Toolbar> |
|||
|
|||
<f:Grid ID="Grid1" runat="server" EnableCheckBoxSelect="false" BoxFlex="1" AutoScroll="True" |
|||
ShowHeader="False" |
|||
AllowPaging="True" PageSize="50" OnPageIndexChange="Grid1_OnPageIndexChange" |
|||
ShowBorder="False" |
|||
DataKeyNames="PartCode" AllowSorting="true" IsDatabasePaging="true" SortField="PartCode"> |
|||
<Columns> |
|||
|
|||
<f:BoundField SortField="PartCode" DataField="PartCode" HeaderText="零件号" Width="200px" /> |
|||
<f:BoundField SortField="PartName" DataField="PartName" HeaderText="零件名称" Width="200px" /> |
|||
<f:BoundField SortField="VToleranceProportion" DataField="VToleranceProportion" HeaderText="容差" Width="100px" /> |
|||
</Columns> |
|||
</f:Grid> |
|||
</Items> |
|||
</f:Panel> |
|||
|
|||
<script type="text/javascript"> |
|||
|
|||
function onReady() { |
|||
var grid1 = Ext.getCmp('<%=Grid1.ClientID%>'); |
|||
var bodySize = Ext.getBody().getSize(); |
|||
grid1.setHeight(bodySize.height - 27); |
|||
} |
|||
$(window).bind("load resize", function () { |
|||
onReady(); |
|||
}); |
|||
</script> |
|||
|
|||
</form> |
|||
</body> |
|||
</html> |
|||
|
@ -0,0 +1,143 @@ |
|||
using CK.SCP.Controller; |
|||
using CK.SCP.Models.ScpEntity; |
|||
using CK.SCP.Models.ScpEntity.ExcelExportEnttity; |
|||
using CK.SCP.Utils; |
|||
using FineUI; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data; |
|||
using System.IO; |
|||
using System.Linq; |
|||
using System.Web; |
|||
using System.Web.UI; |
|||
using System.Web.UI.WebControls; |
|||
using static System.Net.WebRequestMethods; |
|||
|
|||
namespace SCP.Views.BasicData |
|||
{ |
|||
public partial class SCP_ToleranceProportion : PageBase |
|||
{ |
|||
protected void Page_Load(object sender, EventArgs e) |
|||
{ |
|||
if (!IsPostBack) |
|||
{ |
|||
BindData(); |
|||
} |
|||
} |
|||
|
|||
public void BindData() |
|||
{ |
|||
SearchData((result) => { |
|||
Grid1.RecordCount = result.Count(); |
|||
var list = SortAndPage(result, Grid1); |
|||
Grid1.DataSource = list; |
|||
Grid1.DataBind(); |
|||
}); |
|||
} |
|||
|
|||
public void SearchData(Action<IQueryable<V_TA_ToleranceProportion>> p_action) |
|||
{ |
|||
TA_ToleranceProportion _entity = new TA_ToleranceProportion(); |
|||
|
|||
_entity.PartCode = txtPartCode.Text; |
|||
SCP_ToleranceProportion_Controller.Get_TA_ToleranceProportion_List(_entity, (_ret) => |
|||
{ |
|||
if (_ret.State == ReturnStatus.Succeed) |
|||
{ |
|||
p_action(_ret.Result); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
//导出
|
|||
public void BtnOutPut_OnClick(object sender, EventArgs e) |
|||
{ |
|||
//_list = SCP_TB_VENDER_CONTROLLER.Getlist();
|
|||
//var list = Sort<TA_VENDER>(_list.AsQueryable(), Grid1).ToList();
|
|||
//// 2.设置单元格抬头
|
|||
//// key:实体对象属性名称,可通过反射获取值
|
|||
//// value:Excel列的名称
|
|||
//Dictionary<string, string> cellheader = new Dictionary<string, string> {
|
|||
// { "VendId", "供应商编号" },
|
|||
// { "VendName", "供应商名称" },
|
|||
// { "VendAbbCode", "供应商缩写" },
|
|||
// { "VendType", "供应商类型" },
|
|||
// { "Country", "国家" },
|
|||
// { "City", "城市" },
|
|||
// { "Currency", "币种" },
|
|||
// { "Address", "地址" },
|
|||
// { "ZipCode", "邮编" },
|
|||
// { "Contacter", "联系人" },
|
|||
// { "Phone", "电话" },
|
|||
// { "Fax", "传真" },
|
|||
// { "Email", "电子邮件" },
|
|||
// { "State", "状态" },
|
|||
// { "Remark", "备注" },
|
|||
//};
|
|||
//string url = EntityListToExcel2003(cellheader, list, "供应商");
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
//查询
|
|||
protected void btnSearch_OnClick(object sender, EventArgs e) |
|||
{ |
|||
BindData(); |
|||
} |
|||
|
|||
|
|||
protected void Grid1_OnPageIndexChange(object sender, GridPageEventArgs e) |
|||
{ |
|||
BindData(); |
|||
} |
|||
|
|||
protected void btnSearch_Click(object sender, EventArgs e) |
|||
{ |
|||
BindData(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 上传文件
|
|||
/// </summary>
|
|||
/// <param name="sender"></param>
|
|||
/// <param name="e"></param>
|
|||
protected void btnInput_Click(object sender, EventArgs e) |
|||
{ |
|||
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); |
|||
} |
|||
var list = ConvertHelper.ToList<SCP_PART_ToleranceProportion>(ExcelHelper.RemoveEmpty(_dt)).ToList(); |
|||
var ret = SCP_ToleranceProportion_Controller.EXCEL_MOLDSHARING_MOD(list, CurrentUser.FactoryList[0], CurrentUser.Name); |
|||
if (ret.State == ReturnStatus.Succeed && ret.Result == true) |
|||
{ |
|||
Alert.Show("导入成功"); |
|||
BindData(); |
|||
FileUp.Reset(); |
|||
} |
|||
else |
|||
{ |
|||
Alert.Show(string.Join("<br>", ret.MessageList)); |
|||
FileUp.Reset(); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
} |
@ -0,0 +1,107 @@ |
|||
//------------------------------------------------------------------------------
|
|||
// <自动生成>
|
|||
// 此代码由工具生成。
|
|||
//
|
|||
// 对此文件的更改可能导致不正确的行为,如果
|
|||
// 重新生成代码,则所做更改将丢失。
|
|||
// </自动生成>
|
|||
//------------------------------------------------------------------------------
|
|||
|
|||
namespace SCP.Views.BasicData |
|||
{ |
|||
|
|||
|
|||
public partial class SCP_ToleranceProportion |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// form1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::System.Web.UI.HtmlControls.HtmlForm form1; |
|||
|
|||
/// <summary>
|
|||
/// PageManager1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.PageManager PageManager1; |
|||
|
|||
/// <summary>
|
|||
/// Panel1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Panel Panel1; |
|||
|
|||
/// <summary>
|
|||
/// Toolbar1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Toolbar Toolbar1; |
|||
|
|||
/// <summary>
|
|||
/// Button3 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Button Button3; |
|||
|
|||
/// <summary>
|
|||
/// txtPartCode 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.TextBox txtPartCode; |
|||
|
|||
/// <summary>
|
|||
/// btnSearch 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Button btnSearch; |
|||
|
|||
/// <summary>
|
|||
/// FileUp 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.FileUpload FileUp; |
|||
|
|||
/// <summary>
|
|||
/// btnInput 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Button btnInput; |
|||
|
|||
/// <summary>
|
|||
/// Grid1 控件。
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// 自动生成的字段。
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
|||
/// </remarks>
|
|||
protected global::FineUI.Grid Grid1; |
|||
} |
|||
} |
@ -1,87 +1,89 @@ |
|||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_PO_MAX_DETAIL.aspx.cs" Inherits="SCP.Views.富维冲压件.SCP_PO_MAX_DETAIL" %> |
|||
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="SCP_PO_MAX_DETAIL.aspx.cs" Inherits="SCP.Views.富维冲压件.SCP_PO_MAX_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"/> |
|||
<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" Layout="VBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start"> |
|||
<f:Panel ID="Panel1" runat="server" Title="" Layout="VBox" BoxConfigAlign="Stretch" BoxConfigPosition="Start"> |
|||
<Toolbars> |
|||
<f:Toolbar ID="Toolbar2" runat="server"> |
|||
<Items> |
|||
<f:Button ID="Btn_Save" runat="server" EnablePostBack="True" Text="保存" Icon="SystemSave" OnClick="BTN_SAVE_Click" Hidden="true"> |
|||
</f:Button> |
|||
<f:Button ID="Button1" runat="server" EnablePostBack="True" Text="作废大订单明细" Icon="CssDelete" OnClick="btnCancel_Click" OnClientClick="if(!confirm('是否要将选中明细'))return false;" Hidden="true"> |
|||
</f:Button> |
|||
<%-- <f:Button ID="Btn_Save" runat="server" EnablePostBack="True" Text="保存" Icon="SystemSave" OnClick="BTN_SAVE_Click" Hidden="True"> |
|||
</f:Button>--%> |
|||
<f:Button ID="Btn_SaveReductionQty" runat="server" EnablePostBack="True" Text="保存削减" Icon="SystemSave" OnClick="Btn_SaveReductionQty_Click" OnClientClick="if(!confirm('是否要将选中明细进行削减操作'))return false;" > |
|||
</f:Button> |
|||
<f:Button ID="Button1" runat="server" EnablePostBack="True" Text="作废大订单明细" Icon="CssDelete" OnClick="btnCancel_Click" OnClientClick="if(!confirm('是否要将选中明细作废'))return false;" Hidden="True"> |
|||
</f:Button> |
|||
</Items> |
|||
</f:Toolbar> |
|||
</Toolbars> |
|||
<Items> |
|||
<f:Grid ID = "Grid_V_TB_PO_SUBDETAIL" Title = "大订单明细" BoxFlex="1" EnableCollapse = "true" ShowBorder = "true" ShowHeader = "true" |
|||
runat ="server" EnableCheckBoxSelect = "true" PageSize="1000" |
|||
DataKeyNames = "UID,PoBillNum,PartCode,Qty,SubQty" |
|||
SortField="UID" IsDatabasePaging="True" AllowPaging="True" SortDirection="Desc" |
|||
AutoScroll="true" |
|||
> |
|||
<Columns> |
|||
<f:BoundField Width = "100px" DataField = "PartCode" DataFormatString = "{0}" HeaderText = "原料物料号" SortField="PartCode"/> |
|||
<f:BoundField Width = "100px" DataField = "PartNumber" DataFormatString = "{0}" HeaderText = "零件号" SortField="PartNumber"/> |
|||
<f:BoundField Width = "100px" DataField = "PoLine" DataFormatString = "{0}" HeaderText = "行号" SortField="PoLine"/> |
|||
<f:BoundField Width = "100px" DataField = "Texture" DataFormatString = "{0}" HeaderText = "材质" SortField="Texture"/> |
|||
<f:BoundField Width = "100px" DataField = "Model" DataFormatString = "{0}" HeaderText = "车型" SortField="Model"/> |
|||
<f:BoundField Width = "100px" DataField = "Finprspec" DataFormatString = "{0}" HeaderText = "成品规格" SortField="Finprspec"/> |
|||
<f:BoundField Width = "100px" DataField = "TechStandard" DataFormatString = "{0}" HeaderText = "技术标准" SortField="TechStandard"/> |
|||
<f:BoundField Width = "100px" DataField = "Matermanu" DataFormatString = "{0}" HeaderText = "材料厂家" SortField="Matermanu"/> |
|||
|
|||
<f:TemplateField HeaderText="订货量(吨)" Width="100px" ColumnID="OrderQtyd" MinWidth="100px"> |
|||
<ItemTemplate> |
|||
<asp:TextBox ID="NB_PublishNum" runat="server" Width="90px" Text='<%# Eval("OrderQtyd") %>' ></asp:TextBox> |
|||
</ItemTemplate> |
|||
</f:TemplateField> |
|||
<f:BoundField Width = "100px" DataField = "OrderQtykg" DataFormatString = "{0}" HeaderText = "订货量(千克)" SortField="OrderQtykg"/> |
|||
|
|||
<f:BoundField Width = "100px" DataField = "SurplusQty" DataFormatString = "{0}" HeaderText = "剩余订货量(千克)" SortField="SurplusQty"/> |
|||
<f:BoundField Width = "100px" DataField = "OrderNumber" DataFormatString = "{0}" HeaderText = "订货件数" SortField="OrderNumber"/> |
|||
<f:BoundField Width = "100px" DataField = "MinordQty" DataFormatString = "{0}" HeaderText = "起订量" SortField="MinordQty"/> |
|||
<f:BoundField Width = "100px" DataField = "Singlecon" DataFormatString = "{0}" HeaderText = "单件消耗(千克)" SortField="Singlecon"/> |
|||
<f:BoundField Width = "100px" DataField = "forecastone" DataFormatString = "{0}" HeaderText = "" SortField="forecastone" ColumnID="forecastone" /> |
|||
|
|||
<f:BoundField Width = "100px" DataField = "forecasttwo" DataFormatString = "{0}" HeaderText = "" SortField="forecasttwo" ColumnID="forecasttwo"/> |
|||
<f:BoundField Width = "100px" DataField = "forecastthree" DataFormatString = "{0}" HeaderText = "" SortField="forecastthree" ColumnID="forecastthree"/> |
|||
<f:BoundField Width = "100px" DataField = "forecastfour" DataFormatString = "{0}" HeaderText = "" SortField="forecastfour" ColumnID="forecastfour"/> |
|||
<f:BoundField Width = "100px" DataField = "forecastfive" DataFormatString = "{0}" HeaderText = "" SortField="forecastfive" ColumnID="forecastfive"/> |
|||
<f:BoundField Width = "100px" DataField = "forecastsix" DataFormatString = "{0}" HeaderText = "" SortField="forecastsix" ColumnID="forecastsix"/> |
|||
|
|||
</Columns> |
|||
<PageItems> |
|||
<f:Grid ID="Grid_V_TB_PO_SUBDETAIL" Title="大订单明细" BoxFlex="1" ShowBorder="True" ShowHeader="True" AllowCellEditing="True" ClicksToEdit="1" |
|||
runat="server" PageSize="1000" SortField="UID" IsDatabasePaging="True" AllowPaging="True" SortDirection="Desc" AutoScroll="True" |
|||
DataKeyNames="UID,PoBillNum,PartCode,Qty,SubQty,ReductionQty,ReductionQtyOne,ReductionQtyTwo,ReductionQtyThree,ReductionQtyFour,ReductionQtyFive" > |
|||
<Columns> |
|||
<f:BoundField Width="100px" DataField="PartCode" DataFormatString="{0}" HeaderText="原料物料号" SortField="PartCode" /> |
|||
<f:BoundField Width="100px" DataField="PartNumber" DataFormatString="{0}" HeaderText="零件号" SortField="PartNumber" /> |
|||
<f:BoundField Width="100px" DataField="PoLine" DataFormatString="{0}" HeaderText="行号" SortField="PoLine" /> |
|||
<f:BoundField Width="100px" DataField="Texture" DataFormatString="{0}" HeaderText="材质" SortField="Texture" /> |
|||
<f:BoundField Width="100px" DataField="Model" DataFormatString="{0}" HeaderText="车型" SortField="Model" /> |
|||
<f:BoundField Width="100px" DataField="Finprspec" DataFormatString="{0}" HeaderText="成品规格" SortField="Finprspec" /> |
|||
<f:BoundField Width="100px" DataField="TechStandard" DataFormatString="{0}" HeaderText="技术标准" SortField="TechStandard" /> |
|||
<f:BoundField Width="100px" DataField="Matermanu" DataFormatString="{0}" HeaderText="材料厂家" SortField="Matermanu" /> |
|||
|
|||
<f:BoundField Width="100px" DataField="OrderQtykg" DataFormatString="{0}" HeaderText="订货量(千克)" SortField="OrderQtykg" /> |
|||
|
|||
<f:BoundField Width="100px" DataField="SurplusQty" DataFormatString="{0}" HeaderText="剩余订货量(千克)" SortField="SurplusQty" /> |
|||
<f:BoundField Width="100px" DataField="OrderNumber" DataFormatString="{0}" HeaderText="订货件数" SortField="OrderNumber" /> |
|||
<f:BoundField Width="100px" DataField="MinordQty" DataFormatString="{0}" HeaderText="起订量" SortField="MinordQty" /> |
|||
<f:BoundField Width="100px" DataField="Singlecon" DataFormatString="{0}" HeaderText="单件消耗(千克)" SortField="Singlecon" /> |
|||
<f:BoundField Width="100px" DataField="OrderQtyd" DataFormatString="{0}" HeaderText="订货量吨(初始)" SortField="OrderQtyd" /> |
|||
<f:BoundField Width="120px" DataField="OrderQtydNow" DataFormatString="{0}" HeaderText="订货量吨(当前)"/> |
|||
|
|||
<f:RenderField Width="100px" ColumnID="ReductionQty" DataField="ReductionQty" FieldType="Float" HeaderText="单次削减量(吨)"> |
|||
<Editor> |
|||
<f:NumberBox ID="NumberBox2" runat="server" MinValue="-99999999" MaxValue="0" DecimalPrecision="5"> |
|||
</f:NumberBox> |
|||
</Editor> |
|||
</f:RenderField> |
|||
<f:BoundField Width="80px" DataField="ReductionQtyOne" HeaderText="第一次削减量" /> |
|||
<f:BoundField Width="80px" DataField="ReductionQtyTwo" HeaderText="第二次削减量" /> |
|||
<f:BoundField Width="80px" DataField="ReductionQtyThree" HeaderText="第三次削减量" /> |
|||
<f:BoundField Width="80px" DataField="ReductionQtyFour" HeaderText="第四次削减量" /> |
|||
<f:BoundField Width="80px" DataField="ReductionQtyFive" HeaderText="第五次削减量" /> |
|||
|
|||
<f:BoundField Width="100px" DataField="forecastone" DataFormatString="{0}" HeaderText="" SortField="forecastone" ColumnID="forecastone" /> |
|||
|
|||
<f:BoundField Width="100px" DataField="forecasttwo" DataFormatString="{0}" HeaderText="" SortField="forecasttwo" ColumnID="forecasttwo" /> |
|||
<f:BoundField Width="100px" DataField="forecastthree" DataFormatString="{0}" HeaderText="" SortField="forecastthree" ColumnID="forecastthree" /> |
|||
<f:BoundField Width="100px" DataField="forecastfour" DataFormatString="{0}" HeaderText="" SortField="forecastfour" ColumnID="forecastfour" /> |
|||
<f:BoundField Width="100px" DataField="forecastfive" DataFormatString="{0}" HeaderText="" SortField="forecastfive" ColumnID="forecastfive" /> |
|||
<f:BoundField Width="100px" DataField="forecastsix" DataFormatString="{0}" HeaderText="" SortField="forecastsix" ColumnID="forecastsix" /> |
|||
|
|||
</Columns> |
|||
<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" |
|||
<f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="True" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged" |
|||
runat="server"> |
|||
<f:ListItem Text="200" Value="200" /> |
|||
<f:ListItem Text="500" Value="500" /> |
|||
</f:DropDownList> |
|||
</PageItems> |
|||
</PageItems> |
|||
</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> |
|||
<f:HiddenField runat="server" ID="TXT_ModType"></f:HiddenField> |
|||
<f:HiddenField runat="server" ID="TXT_State"></f:HiddenField> |
|||
</form> |
|||
</body> |
|||
</html> |
|||
|
Loading…
Reference in new issue