This commit is contained in:
2024-07-01 09:29:35 +08:00
parent 3990f747ce
commit 26d1774fb1
35 changed files with 1432 additions and 488 deletions
@@ -110,20 +110,18 @@
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpCoode1" Label="Coode1" runat="server"
EnableEdit="true" LabelWidth="130px" AutoPostBack="true" OnSelectedIndexChanged="drpCoode1_SelectedIndexChanged">
</f:DropDownList>
<f:TextBox ID="txtCoode1" Label="Coode1" runat="server"
LabelWidth="130px" AutoPostBack="true" OnTextChanged="txtCoode1_TextChanged">
</f:TextBox>
<f:TextBox ID="txtCoode2" Label="Coode2" runat="server" AutoPostBack="true" OnTextChanged="txtCoode2_TextChanged"
LabelWidth="130px">
</f:TextBox>
<f:DropDownList ID="drpHeartNo1" Label="<%$ Resources:Lan,BatchNumber1 %>" runat="server"
LabelWidth="130px" EnableEdit="true">
</f:DropDownList>
<f:DropDownList ID="drpCoode2" Label="Coode2" runat="server"
EnableEdit="true" LabelWidth="130px" AutoPostBack="true" OnSelectedIndexChanged="drpCoode2_SelectedIndexChanged">
</f:DropDownList>
<f:DropDownList ID="drpHeartNo2" Label="<%$ Resources:Lan,BatchNumber2 %>" runat="server"
LabelWidth="130px" EnableEdit="true">
</f:DropDownList>
</Items>
</f:FormRow>
<f:FormRow>
@@ -127,9 +127,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
this.drpJointAttribute.DataBind();
Funs.FineUIPleaseSelect(this.drpJointAttribute,Resources.Lan.PleaseSelect);
// 物料码
BLL.MaterialCoodeService.InitCoodeDropDownList(this.drpCoode1, this.CurrUser.LoginProjectId, true, Resources.Lan.PleaseSelect);//Coode1
BLL.MaterialCoodeService.InitCoodeDropDownList(this.drpCoode2, this.CurrUser.LoginProjectId, true, Resources.Lan.PleaseSelect);//Coode2
///组件1号
Base_ComponentsService.InitComponentsDropDownList(this.drpPipeAssembly1, true,Resources.Lan.PleaseSelect);
///组件2号
@@ -355,14 +353,14 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
txtPageNum.Text = jointInfo.PageNum;
if (!string.IsNullOrEmpty(jointInfo.Coode1))
{
drpCoode1.SelectedValue = jointInfo.Coode1;
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo1, drpCoode1.SelectedValue, true, Resources.Lan.PleaseSelect);
txtCoode1.Text = jointInfo.Coode1;
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo1, txtCoode1.Text, true, Resources.Lan.PleaseSelect);
drpHeartNo1.SelectedValue = jointInfo.Coode1;
}
if (!string.IsNullOrEmpty(jointInfo.Coode2))
{
drpCoode2.SelectedValue = jointInfo.Coode2;
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo2, drpCoode2.SelectedValue, true, Resources.Lan.PleaseSelect);
txtCoode2.Text = jointInfo.Coode2;
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo2, txtCoode2.Text, true, Resources.Lan.PleaseSelect);
drpHeartNo2.SelectedValue = jointInfo.Coode2;
}
@@ -517,19 +515,13 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
newJointInfo.TestPackageNo = this.txtTestPackageNo.Text.Trim();
newJointInfo.PrepareTemp = this.txtPrepareTemp.Text.Trim();
newJointInfo.PageNum = txtPageNum.Text.Trim();
if (drpCoode1.SelectedValue != Const._Null)
{
newJointInfo.Coode1 = drpCoode1.SelectedValue;
}
newJointInfo.Coode1 = txtCoode1.Text.Trim();
if (drpHeartNo1.SelectedValue != Const._Null)
{
newJointInfo.HeartNo1 = drpHeartNo1.SelectedValue;
}
if (drpCoode2.SelectedValue != Const._Null)
{
newJointInfo.Coode2=drpCoode2.SelectedValue;
}
newJointInfo.Coode2 = txtCoode2.Text.Trim();
if (drpHeartNo2.SelectedValue != Const._Null)
{
newJointInfo.HeartNo2 = drpHeartNo2.SelectedValue;
@@ -658,21 +650,21 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
protected void drpCoode1_SelectedIndexChanged(object sender, EventArgs e)
protected void txtCoode1_TextChanged(object sender, EventArgs e)
{
if (drpCoode1.SelectedValue != Const._Null)
if (!string.IsNullOrEmpty(txtCoode1.Text))
{
drpHeartNo1.Items.Clear();
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo1, drpCoode1.SelectedValue, true, Resources.Lan.PleaseSelect);//HeartNo1
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo1, txtCoode1.Text, true, Resources.Lan.PleaseSelect);//HeartNo1
}
}
protected void drpCoode2_SelectedIndexChanged(object sender, EventArgs e)
protected void txtCoode2_TextChanged(object sender, EventArgs e)
{
if (drpCoode2.SelectedValue != Const._Null)
if (!string.IsNullOrEmpty(txtCoode2.Text))
{
drpHeartNo2.Items.Clear();
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo2, drpCoode2.SelectedValue, true, Resources.Lan.PleaseSelect);//HeartNo2
BLL.MaterialCoodeService.InitHeartNoDropDownList(this.drpHeartNo2, txtCoode2.Text, true, Resources.Lan.PleaseSelect);//HeartNo2
}
}
@@ -249,13 +249,22 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
protected global::FineUIPro.TextBox txtSystemNumber;
/// <summary>
/// drpCoode1 控件。
/// txtCoode1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpCoode1;
protected global::FineUIPro.TextBox txtCoode1;
/// <summary>
/// txtCoode2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCoode2;
/// <summary>
/// drpHeartNo1 控件。
@@ -266,15 +275,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </remarks>
protected global::FineUIPro.DropDownList drpHeartNo1;
/// <summary>
/// drpCoode2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpCoode2;
/// <summary>
/// drpHeartNo2 控件。
/// </summary>
@@ -30,9 +30,18 @@
</f:Button>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnNew" ToolTip="<%$ Resources:Lan,Add %>" Icon="Add" EnablePostBack="true"
runat="server" OnClick="btnNew_Click">
<f:FileUpload runat="server" ID="CoodeUrl" EmptyText="请选择要导入的Excel日报文件"
LabelWidth="50px" LabelAlign="Right" Width="300px">
</f:FileUpload>
<f:Button ID="btnImport" Icon="ApplicationEdit" runat="server" Text="导入" ToolTip="日报导入"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="模板下载" ToolTip="模板下载" OnClick="btnDownLoad_Click">
</f:Button>
<f:Button ID="btnNew" ToolTip="<%$ Resources:Lan,Add %>" Icon="Add" EnablePostBack="true"
Text="新增" runat="server" OnClick="btnNew_Click">
</f:Button>
<f:HiddenField ID="hidFileName" runat="server"></f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
@@ -49,6 +58,8 @@
FieldType="String" HeaderText="数量" HeaderTextAlign="Center"
TextAlign="Left" SortField="MediumAbbreviation">
</f:RenderField>
<f:RenderCheckField Width="80px" ColumnID="IsUse" DataField="IsUse" HeaderText="是否启用" EnableColumnEdit="false" >
</f:RenderCheckField>
</Columns>
<Listeners>
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
@@ -4,11 +4,25 @@ using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using Model;
using System.IO;
using System.Drawing;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
public partial class MaterialCoode : PageBase
{
//定义变量
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 错误集合
/// </summary>
public static string errorInfos = string.Empty;
#region
/// <summary>
/// 加载页面
@@ -179,18 +193,18 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var getMedium = BLL.Base_MediumService.GetMediumByMediumId(rowID);
if (getMedium != null)
var getCoode = BLL.MaterialCoodeService.GetMaterialCoode(rowID,this.CurrUser.LoginProjectId);
if (getCoode != null)
{
string cont = judgementDelete(rowID);
if (string.IsNullOrEmpty(cont))
{
BLL.Base_MediumService.DeleteMediumByMediumId(rowID);
BLL.MaterialCoodeService.DeleteMaterialCoode(rowID);
BLL.Sys_LogService.AddLog(Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.MediumMenuId, Const.BtnDelete, rowID);
}
else
{
strShowNotify += Resources.Lan.MediumDefinition + "" + getMedium.MediumCode + cont;
strShowNotify += Resources.Lan.MediumDefinition + "" + getCoode.Coode + cont;
}
}
}
@@ -255,6 +269,181 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
#endregion
protected void btnImport_Click(object sender, EventArgs e)
{
if (this.CoodeUrl.HasFile == false)
{
ShowNotify("请选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string IsXls = Path.GetExtension(this.CoodeUrl.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls" && IsXls != ".xlsx")
{
ShowNotify("只能选择Excel文件!", MessageBoxIcon.Warning);
return;
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
{
Directory.CreateDirectory(initFullPath);
}
//指定上传文件名称
this.hidFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
//上传文件路径
string filePath = initFullPath + this.hidFileName.Text;
//文件上传服务器
this.CoodeUrl.PostedFile.SaveAs(filePath);
//文件上传服务器后的名称
string fileName = rootPath + initPath + this.hidFileName.Text;
//读取Excel
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out errorInfos, true);
errorInfos = string.Empty;
//验证Excel读取是否有误
if (!string.IsNullOrEmpty(errorInfos))
{
ShowNotify(errorInfos, MessageBoxIcon.Warning);
return;
}
string message = string.Empty;
List<Model.Base_MaterialCoode> coodeList = new List<Model.Base_MaterialCoode>();
var coodes = from x in Funs.DB.Base_MaterialCoode where x.ProjectId == this.CurrUser.LoginProjectId select x;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
Model.Base_MaterialCoode d = new Model.Base_MaterialCoode();
d.ProjectId = this.CurrUser.LoginProjectId;
d.MaterialCoodeId = SQLHelper.GetNewID(typeof(Model.Base_MaterialCoode));
d.Coode = ds.Tables[0].Rows[i]["Coode"].ToString();
d.HeartNo = ds.Tables[0].Rows[i]["炉批号"].ToString();
if (!string.IsNullOrEmpty(d.Coode) && !string.IsNullOrEmpty(d.HeartNo))
{
var c = from x in coodes where x.Coode == d.Coode && x.HeartNo == d.HeartNo select x;
if (c.Count() > 0)
{
errorInfos += (i + 2) + "行,Coode对应的炉批号已存在!</br>";
}
}
if (ds.Tables[0].Rows[i]["数量"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["数量"].ToString()))
{
int? dd = Funs.GetNewInt(ds.Tables[0].Rows[i]["数量"].ToString());
if (dd != null)
{
d.Amount = Funs.GetNewInt(ds.Tables[0].Rows[i]["数量"].ToString());
}
else
{
errorInfos += (i + 2) + "行,数量格式不正确!</br>";
}
}
if (ds.Tables[0].Rows[i]["是否启用"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["是否启用"].ToString()))
{
string isUser = ds.Tables[0].Rows[i]["是否启用"].ToString();
if (isUser != "是" && isUser != "否")
{
errorInfos += (i + 2) + "行,是否启用只能录入是或否!</br>";
}
else
{
if (isUser == "是")
{
d.IsUse = true;
}
else
{
d.IsUse = false;
}
}
}
else
{
d.IsUse = false;
}
coodeList.Add(d);
}
var coodeGroup = coodeList.GroupBy(x => new { x.Coode, x.HeartNo }).Select(g => new { Coode = g.Key.Coode, HeartNo = g.Key.HeartNo });
if (coodeList.Count() != coodeGroup.Count())
{
errorInfos += "Coode对应的炉批号有重复!";
}
// 数据验证错误,返回
if (!string.IsNullOrEmpty(errorInfos))
{
ShowNotify(errorInfos, MessageBoxIcon.Warning, 10000);
return;
}
else
{
foreach (var item in coodeList)
{
BLL.MaterialCoodeService.AddMaterialCoode(item);
}
ShowNotify("Coode导入成功!", MessageBoxIcon.Success);
this.BindGrid();
}
}
#region
/// <summary>
/// 模板下载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDownLoad_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.CoodeInTemplateUrl;
string filePath = Const.CoodeInTemplateUrl;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
//PageContext.RegisterStartupScript(Confirm.GetShowReference("确定要下载焊工资质导入模板?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
}
/// <summary>
/// 下载导入模板
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.WelderQueTemplateUrl;
string filePath = Const.WelderQueTemplateUrl;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
Response.ClearContent();
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.ContentType = "excel/plain";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
Response.TransmitFile(uploadfilepath, 0, fileSize);
Response.End();
}
}
#endregion
#region
/// <summary>
/// 获取按钮权限
@@ -86,6 +86,33 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// CoodeUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload CoodeUrl;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnDownLoad 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnDownLoad;
/// <summary>
/// btnNew 控件。
/// </summary>
@@ -95,6 +122,15 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// hidFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hidFileName;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@@ -35,6 +35,11 @@
<f:NumberBox ID="txtAmount" runat="server" Label="数量" LabelWidth="200px"></f:NumberBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:CheckBox ID="cbIsUse" Checked="true" Label="是否启用" runat="server" LabelWidth="200px"/>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
@@ -1,4 +1,5 @@
using BLL;
using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;
using System;
using System.Linq;
@@ -52,6 +53,14 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
txtAmount.Text = Material.Amount.Value.ToString();
}
if (Material.IsUse.HasValue)
{
this.cbIsUse.Checked = Material.IsUse.Value;
}
else
{
this.cbIsUse.Checked=false;
}
}
}
}
@@ -78,6 +87,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
ProjectId = this.CurrUser.LoginProjectId,
Coode = this.txtCoode.Text.Trim(),
HeartNo = this.txtHeartNo.Text.Trim(),
IsUse = this.cbIsUse.Checked,
};
if (this.txtAmount.Text != "")
{
@@ -68,6 +68,15 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </remarks>
protected global::FineUIPro.NumberBox txtAmount;
/// <summary>
/// cbIsUse 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.CheckBox cbIsUse;
/// <summary>
/// Toolbar1 控件。
/// </summary>
@@ -1020,40 +1020,26 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
if (ds.Tables[0].Rows[i]["Coode1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["Coode1"].ToString()))
{
var cood = coodeList.FirstOrDefault(x => x.Coode == ds.Tables[0].Rows[i]["Coode1"].ToString());
if (cood == null)
{
errorInfos += "Coode1:[" + ds.Tables[0].Rows[i]["Coode1"].ToString() + "]不存在;";
}
else
{
d.Coode1 = cood.Coode;
}
}
else
{
errorInfos += (i + 2) + "行,Coode1不能为空!</br>";
d.Coode1 = ds.Tables[0].Rows[i]["Coode1"].ToString();
}
//else
//{
// errorInfos += (i + 2) + "行,Coode1不能为空!</br>";
//}
if (ds.Tables[0].Rows[i]["Coode2"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["Coode2"].ToString()))
{
var cood = coodeList.FirstOrDefault(x => x.Coode == ds.Tables[0].Rows[i]["Coode2"].ToString());
if (cood == null)
{
errorInfos += "Coode2:[" + ds.Tables[0].Rows[i]["Coode2"].ToString() + "]不存在;";
}
else
{
d.Coode1 = cood.Coode;
}
}
else
{
errorInfos += (i + 2) + "行,Coode2不能为空!</br>";
d.Coode1 = ds.Tables[0].Rows[i]["Coode2"].ToString();
}
//else
//{
// errorInfos += (i + 2) + "行,Coode2不能为空!</br>";
//}
if (ds.Tables[0].Rows[i]["炉批号1"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["炉批号1"].ToString()))
{
var cood = coodeList.FirstOrDefault(x => x.Coode == d.Coode1 && x.HeartNo == ds.Tables[0].Rows[i]["炉批号1"].ToString());
var cood = coodeList.FirstOrDefault(x =>x.IsUse==true && x.Coode == d.Coode1 && x.HeartNo == ds.Tables[0].Rows[i]["炉批号1"].ToString());
if (cood == null)
{
errorInfos += "炉批号1:[" + ds.Tables[0].Rows[i]["炉批号1"].ToString() + "]或对应的Coode1不存在;";
@@ -1063,14 +1049,14 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
d.HeartNo1 = ds.Tables[0].Rows[i]["炉批号1"].ToString();
}
}
else
{
errorInfos += (i + 2) + "行,炉批号1不能为空!</br>";
}
//else
//{
// errorInfos += (i + 2) + "行,炉批号1不能为空!</br>";
//}
if (ds.Tables[0].Rows[i]["炉批号2"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["炉批号2"].ToString()))
{
var cood = coodeList.FirstOrDefault(x => x.Coode == d.Coode2 && x.HeartNo == ds.Tables[0].Rows[i]["炉批号2"].ToString());
var cood = coodeList.FirstOrDefault(x => x.IsUse == true && x.Coode == d.Coode2 && x.HeartNo == ds.Tables[0].Rows[i]["炉批号2"].ToString());
if (cood == null)
{
errorInfos += "炉批号2:[" + ds.Tables[0].Rows[i]["炉批号2"].ToString() + "]或对应的Coode2不存在;";
@@ -1080,10 +1066,10 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
d.HeartNo2 = ds.Tables[0].Rows[i]["炉批号2"].ToString();
}
}
else
{
errorInfos += (i + 2) + "行,炉批号2不能为空!</br>";
}
//else
//{
// errorInfos += (i + 2) + "行,炉批号2不能为空!</br>";
//}
//if (ds.Tables[0].Rows[i]["焊丝"] != null && !string.IsNullOrEmpty(ds.Tables[0].Rows[i]["焊丝"].ToString()))
//{
@@ -1166,6 +1152,39 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
dayList.Add(d);
#region WPS资质
//if (!string.IsNullOrEmpty(errorInfos))
//{
// ShowNotify(errorInfos, MessageBoxIcon.Warning, 10000);
// return;
//}
//else
//{
// // 判断WPS资质 暂不用
// if (welderQueIsUse == true)
// {
// if (isExistFloor && isExistCell)
// {
// //bool canSave = false;
// var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(jotId);
// var wps = BLL.WPQListServiceService.GetWPQById(jot.WPQId);
// if (wps != null)
// {
// if (wps.WelderIds.Contains(cellWelderId) && wps.WelderIds.Contains(floorWelderId))
// {
// }
// else
// {
// eventArg = eventArg + jot.WeldJointCode + ",";
// }
// }
// }
// }
//}
#endregion
#region
if (!string.IsNullOrEmpty(errorInfos))
{
ShowNotify(errorInfos, MessageBoxIcon.Warning, 10000);
@@ -1176,125 +1195,98 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
// 判断资质
if (welderQueIsUse == true)
{
if (isExistFloor && isExistCell)
if (!string.IsNullOrEmpty(jotId) && isExistFloor && isExistCell)
{
//bool canSave = false;
bool canSave = false;
var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(jotId);
var wps = BLL.WPQListServiceService.GetWPQById(jot.WPQId);
if (wps.WelderIds.Contains(cellWelderId) && wps.WelderIds.Contains(floorWelderId))
{
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
string weldTypeGroup = joty.Flag;
string weldTypeCode = joty.WeldTypeCode;
string floorWelder = floorWelderId;
string cellWelder = cellWelderId;
//decimal? dia = jot.Dia;
//decimal? sch = jot.Thickness;
string weldingMethodCode = string.Empty;
var wm = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(d.WeldingMethodId);
if (wm != null)
{
weldingMethodCode = wm.WeldingMethodCode;
}
string[] wmeCodes = weldingMethodCode.Split('+');
string location = string.Empty;
var loc = BLL.Base_WeldingLocationServie.GetWeldingLocationById(d.WeldingLocationId);
if (loc != null)
{
location = loc.WeldingLocationCode;
}
string ste = jot.Material1Id;
List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
where x.WelderId == floorWelder && x.WeldingMethodId != null
&& x.WeldingLocationId != null && x.MaterialType != null
&& x.WeldType != null
&& x.ThicknessMax != null && x.SizesMin != null
select x).ToList();
List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
where x.WelderId == cellWelder && x.WeldingMethodId != null
&& x.WeldingLocationId != null && x.MaterialType != null
&& x.WeldType != null
&& x.ThicknessMax != null && x.SizesMin != null
select x).ToList();
// 打底和盖面同一焊工
if (floorWelder == cellWelder)
{
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
{
if (wmeCodes.Count() <= 1) // 一种焊接方法
{
canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
else // 大于一种焊接方法,如氩电联焊
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
}
// 打底和盖面焊工不同
else
{
bool isok1 = false;
bool isok2 = false;
if (wmeCodes.Count() <= 1) // 一种焊接方法
{
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
{
isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
{
isok2 = IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (isok1 && isok2)
{
canSave = true;
}
}
else
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
if (canSave == false)
{
eventArg = eventArg + jot.WeldJointCode + ",";
}
}
}
}
#region ,WPS的焊工判断
//if (!string.IsNullOrEmpty(errorInfos))
//{
// ShowNotify(errorInfos, MessageBoxIcon.Warning, 10000);
// return;
//}
//else
//{
// // 判断资质
// if (welderQueIsUse == true)
// {
// if (isExistFloor && isExistCell)
// {
// bool canSave = false;
// var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(jotId);
// var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
// string weldTypeGroup = joty.Flag;
// string weldTypeCode = joty.WeldTypeCode;
// string floorWelder = floorWelderId;
// string cellWelder = cellWelderId;
// //decimal? dia = jot.Dia;
// //decimal? sch = jot.Thickness;
// string weldingMethodCode = string.Empty;
// var wm = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(jot.WeldingMethodId);
// if (wm != null)
// {
// weldingMethodCode = wm.WeldingMethodCode;
// }
// string[] wmeCodes = weldingMethodCode.Split('+');
// string location = string.Empty;
// var loc = BLL.Base_WeldingLocationServie.GetWeldingLocationById(jot.WeldingLocationId);
// if (loc != null)
// {
// location = loc.WeldingLocationCode;
// }
// string ste = jot.Material1Id;
// List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == floorWelder && x.WeldingMethodId != null
// && x.WeldingLocationId != null && x.MaterialType != null
// && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == cellWelder && x.WeldingMethodId != null
// && x.WeldingLocationId != null && x.MaterialType != null
// && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// // 打底和盖面同一焊工
// if (floorWelder == cellWelder)
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
// }
// else // 大于一种焊接方法,如氩电联焊
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
// }
// }
// }
// // 打底和盖面焊工不同
// else
// {
// bool isok1 = false;
// bool isok2 = false;
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
// }
// if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
// {
// isok2 = IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
// }
// if (isok1 && isok2)
// {
// canSave = true;
// }
// }
// else
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
// }
// }
// if (canSave == false)
// {
// eventArg = eventArg + jot.WeldJointCode + ",";
// }
// }
// }
//}
#endregion
}
@@ -208,6 +208,7 @@
</f:DropDownList>
</Editor>
</f:RenderField>
<f:RenderField HeaderText="Coode1-炉批号1" ColumnID="CoodeHeartNo1"
DataField="CoodeHeartNo1" FieldType="String"
HeaderTextAlign="Center" TextAlign="Left" Width="200px">
@@ -374,99 +374,98 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
coodeNumError = coodeNumError + "请检查后再导入";
}
#region
//// 焊工资质
//foreach (var item in GetWeldingDailyItem)
//{
// bool canSave = false;
// var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
// var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
// string weldTypeGroup = joty.Flag;
// string weldTypeCode = joty.WeldTypeCode;
// string floorWelder = item.BackingWelderId;
// string cellWelder = item.CoverWelderId;
// decimal? dia = item.Dia;
// decimal? sch = item.Thickness;
// //string wme = item.WeldingMethodCode;
// //string wmeCode = string.Empty;
// //var wm = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(item.WME_ID);
// //if (wm != null)
// //{
// // wmeCode = wm.WME_Code;
// //}
#region
foreach (var item in GetWeldingDailyItem)
{
bool canSave = false;
var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
string weldTypeGroup = joty.Flag;
string weldTypeCode = joty.WeldTypeCode;
string floorWelder = item.BackingWelderId;
string cellWelder = item.CoverWelderId;
decimal? dia = item.Dia;
decimal? sch = item.Thickness;
//string wme = item.WeldingMethodCode;
//string wmeCode = string.Empty;
//var wm = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(item.WME_ID);
//if (wm != null)
//{
// wmeCode = wm.WME_Code;
//}
// string[] wmeCodes = item.WeldingMethodCode.Split('+');
// string location = item.WeldingLocationCode;
// string ste = jot.Material1Id;
// var projectWelder = BLL.Welder_ProjectWelderService.GetProjectWelderByProjectIdAndWelderId(this.ProjectId,item.BackingWelderId);
// var projectUnit = BLL.Project_UnitService.GetProject_UnitByProjectIdUnitId(this.ProjectId,projectWelder.UnitId);
// if (projectUnit != null && projectUnit.WelderQueIsUse == true)
// {
// List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == floorWelder && x.WeldingMethodId != null
// && x.WeldingLocationId != null && x.MaterialType != null
// && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
string[] wmeCodes = item.WeldingMethodCode.Split('+');
string location = item.WeldingLocationCode;
string ste = jot.Material1Id;
var projectWelder = BLL.Welder_ProjectWelderService.GetProjectWelderByProjectIdAndWelderId(this.ProjectId, item.BackingWelderId);
var projectUnit = BLL.Project_UnitService.GetProject_UnitByProjectIdUnitId(this.ProjectId, projectWelder.UnitId);
if (projectUnit != null && projectUnit.WelderQueIsUse == true)
{
List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
where x.WelderId == floorWelder && x.WeldingMethodId != null
&& x.WeldingLocationId != null && x.MaterialType != null
&& x.WeldType != null
&& x.ThicknessMax != null && x.SizesMin != null
select x).ToList();
// List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
// where x.WelderId == cellWelder && x.WeldingMethodId != null
// && x.WeldingLocationId != null && x.MaterialType != null
// && x.WeldType != null
// && x.ThicknessMax != null && x.SizesMin != null
// select x).ToList();
// // 打底和盖面同一焊工
// if (floorWelder == cellWelder)
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
// }
// else // 大于一种焊接方法,如氩电联焊
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
// }
// }
// }
// // 打底和盖面焊工不同
// else
// {
// bool isok1 = false;
// bool isok2 = false;
List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
where x.WelderId == cellWelder && x.WeldingMethodId != null
&& x.WeldingLocationId != null && x.MaterialType != null
&& x.WeldType != null
&& x.ThicknessMax != null && x.SizesMin != null
select x).ToList();
// 打底和盖面同一焊工
if (floorWelder == cellWelder)
{
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
{
if (wmeCodes.Count() <= 1) // 一种焊接方法
{
canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
else // 大于一种焊接方法,如氩电联焊
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
}
// 打底和盖面焊工不同
else
{
bool isok1 = false;
bool isok2 = false;
// if (wmeCodes.Count() <= 1) // 一种焊接方法
// {
// if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
// {
// isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
// }
// if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
// {
// isok2 = IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
// }
// if (isok1 && isok2)
// {
// canSave = true;
// }
// }
// else
// {
// canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
// }
// }
// }
// else
// {
// canSave = true;
// }
if (wmeCodes.Count() <= 1) // 一种焊接方法
{
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
{
isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
{
isok2 = IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (isok1 && isok2)
{
canSave = true;
}
}
else
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
}
else
{
canSave = true;
}
// if (canSave == false)
// {
// eventArg = eventArg + jot.WeldJointCode + ",";
// }
//}
if (canSave == false)
{
eventArg = eventArg + jot.WeldJointCode + ",";
}
}
#endregion
#region 线