using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using BLL;
namespace FineUIPro.Web.WeldMat.UsingPlan
{
public partial class UsingPlanEdit : PageBase
{
#region 定义项
///
/// 主键
///
private string UsingPlanId
{
get
{
return (string)ViewState["UsingPlanId"];
}
set
{
ViewState["UsingPlanId"] = value;
}
}
#endregion
#region 加载
///
/// 加载页面
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.drpProjectId.DataValueField = "ProjectId";
this.drpProjectId.DataTextField = "ProjectCode";
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
this.drpProjectId.DataBind();
Funs.FineUIPleaseSelect(this.drpProjectId);
BLL.UnitStoreService.InitUnitStoreDropDownList2(drpUnitStore, null, true);
this.drpOrderTime.DataTextField = "Text";
this.drpOrderTime.DataValueField = "Value";
this.drpOrderTime.DataSource = BLL.DropListService.OrderTimeList();
this.drpOrderTime.DataBind();
Funs.FineUIPleaseSelect(this.drpOrderTime);
///材质
this.drpSheet.DataTextField = "STE_Code";
this.drpSheet.DataValueField = "STE_ID";
this.drpSheet.DataSource = BLL.HJGL_MaterialService.GetSteelList();
this.drpSheet.DataBind();
Funs.FineUIPleaseSelect(this.drpSheet);
this.drpTeamGroup.DataValueField = "TeamGroupName";
this.drpTeamGroup.DataTextField = "TeamGroupName";
this.drpTeamGroup.DataSource = BLL.Base_TeamGroupService.GetTeamGroupByUnit();
this.drpTeamGroup.DataBind();
Funs.FineUIPleaseSelect(this.drpTeamGroup);
this.drpUsePosition.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUsePosition);
this.txtOrderDate.MinDate = DateTime.Now;
var unit = BLL.Base_UnitService.GetAllUnitList();
this.drpUsingUnit.Items.Clear();
this.drpUsingUnit.DataValueField = "UnitId";
this.drpUsingUnit.DataTextField = "UnitName";
this.drpUsingUnit.DataSource = unit;
this.drpUsingUnit.DataBind();
Funs.FineUIPleaseSelect(this.drpUsingUnit);
this.drpUsingUnit.SelectedValue = this.CurrUser.UnitId;
this.UsingPlanId = Request.Params["UsingPlanId"];
if (!string.IsNullOrEmpty(this.UsingPlanId))
{
Model.Weld_UsingPlan usingPlan = BLL.UsingPlanService.GetUsingPlanById(this.UsingPlanId);
if (usingPlan != null)
{
if (!string.IsNullOrEmpty(usingPlan.WeldId))
{
this.hdWeldId.Text = usingPlan.WeldId;
if (!string.IsNullOrEmpty(usingPlan.UnitStoreId))
{
this.drpUnitStore.SelectedValue = usingPlan.UnitStoreId;
}
var weld = BLL.WeldInfoService.GetWeldInfoById(usingPlan.WeldId);
if (weld != null)
{
this.txtWeldName.Text = weld.WeldName;
this.txtWeldSpec.Text = weld.WeldSpec;
txtWeldCode.Text = weld.WeldCode;
if (!string.IsNullOrEmpty(weld.WeldTypeId))
{
var weldType = BLL.WeldTypeService.GetWeldTypeById(weld.WeldTypeId);
if (weldType != null)
{
if (weldType.WeldTypeName == "焊条" || weldType.WeldTypeName == "焊丝")
{
this.txtAmount.Label = "数量(根)";
}
else
{
this.txtAmount.Label = "数量(Kg)";
}
}
}
}
if (!string.IsNullOrEmpty(usingPlan.ProjectId))
{
this.drpProjectId.SelectedValue = usingPlan.ProjectId;
var position = from x in Funs.DB.View_UsePosition
where x.ProjectId == usingPlan.ProjectId
select x;
if (position.Count() > 0)
{
this.drpUsePosition.Items.Clear();
this.drpUsePosition.DataValueField = "UsePosition";
this.drpUsePosition.DataTextField = "UsePosition";
this.drpUsePosition.DataSource = position;
this.drpUsePosition.DataBind();
Funs.FineUIPleaseSelect(this.drpUsePosition);
if (!string.IsNullOrEmpty(usingPlan.UsePosition))
{
this.drpUsePosition.SelectedValue = usingPlan.UsePosition;
}
}
else
{
this.drpUsePosition.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUsePosition);
}
if (!string.IsNullOrEmpty(usingPlan.UsingUnit))
{
this.drpUsingUnit.SelectedValue = usingPlan.UsingUnit;
}
if (!string.IsNullOrEmpty(usingPlan.TeamGroupId))
{
this.drpTeamGroup.SelectedValue = usingPlan.TeamGroupId;
}
}
if (usingPlan.Amount.HasValue)
{
this.txtAmount.Text = usingPlan.Amount.ToString();
}
if (usingPlan.InPutDate.HasValue)
{
this.txtInPutDate.Text = string.Format("{0:yyyy-MM-dd}", usingPlan.InPutDate);
}
if (usingPlan.OrderDate.HasValue)
{
this.txtOrderDate.Text = string.Format("{0:yyyy-MM-dd}", usingPlan.OrderDate);
}
if (!string.IsNullOrEmpty(usingPlan.OrderTime))
{
this.drpOrderTime.SelectedValue = usingPlan.OrderTime;
}
if (usingPlan.CancelDate.HasValue)
{
this.txtCancelDate.Text = string.Format("{0:yyyy-MM-dd}", usingPlan.CancelDate);
}
if (usingPlan.IsSteelStru == true)
{
drpIsSteelStru.SelectedValue = "1";
}
else
{
drpIsSteelStru.SelectedValue = "0";
}
txtCancelResult.Text = usingPlan.CancelResult;
this.rblIsCancel.SelectedValue = (usingPlan.IsCancel == true ? "true" : "false");
if (!string.IsNullOrEmpty(usingPlan.UsingManOne))
{
this.hdUsingMan1.Text = usingPlan.UsingManOne;
var welder = BLL.HJGL_PersonManageService.GetWelderByWenId(usingPlan.UsingManOne);
if (welder != null)
{
this.txtUsingManOne.Text = welder.WED_Name;
}
}
if (!string.IsNullOrEmpty(usingPlan.STE_ID))
{
drpSheet.SelectedValueArray = usingPlan.STE_ID.Split(',');
}
}
}
}
else
{
this.txtInPutDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtOrderDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
}
}
}
#endregion
#region 保存
///
/// 保存按钮
///
///
///
protected void btnSave_Click(object sender, EventArgs e)
{
Model.SGGLDB db = Funs.DB;
var list = (from y in db.Weld_StockIn where y.UnitStoreId == this.drpUnitStore.SelectedValue && y.WeldId == this.hdWeldId.Text.Trim() select y).ToList();
var amount = list.Sum(x => x.Amount ?? 0);
var usingAmount = list.Sum(x => x.UsingAmount ?? 0);
var recycleAmount = list.Sum(x => x.RecycleAmount ?? 0);
decimal a = amount - usingAmount + recycleAmount;
if (Funs.GetNewDecimal(this.txtAmount.Text.Trim()) > a)
{
Alert.ShowInTop("焊材库存仅剩" + a.ToString("0.##") + "根,领用数量不能超过库存数量!", MessageBoxIcon.Warning);
return;
}
SaveData(false);
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Model.SGGLDB db = Funs.DB;
var list = (from y in db.Weld_StockIn where y.UnitStoreId == this.drpUnitStore.SelectedValue && y.WeldId == this.hdWeldId.Text.Trim() select y).ToList();
var amount = list.Sum(x => x.Amount ?? 0);
var usingAmount = list.Sum(x => x.UsingAmount ?? 0);
var recycleAmount = list.Sum(x => x.RecycleAmount ?? 0);
decimal a = amount - usingAmount + recycleAmount;
if (Funs.GetNewDecimal(this.txtAmount.Text.Trim()) > a)
{
Alert.ShowInTop("焊材库存仅剩" + a.ToString("0.##") + "根,领用数量不能超过库存数量!", MessageBoxIcon.Warning);
return;
}
SaveData(true);
}
///
/// 保存数据
///
private void SaveData(bool? isSubmit)
{
if (string.IsNullOrEmpty(this.hdWeldId.Text.Trim()))
{
Alert.ShowInTop("请选择焊材牌号!", MessageBoxIcon.Warning);
return;
}
if (this.drpProjectId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择施工号!", MessageBoxIcon.Warning);
return;
}
if (this.drpUnitStore.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择焊材库!", MessageBoxIcon.Warning);
return;
}
if (this.drpUsePosition.SelectedValue == BLL.Const._Null && drpUsePosition.Text == "")
{
Alert.ShowInTop("请选择使用位置!", MessageBoxIcon.Warning);
return;
}
if (this.drpUsingUnit.SelectedValue == BLL.Const._Null && this.CurrUser.UserId != BLL.Const.GlyId)
{
Alert.ShowInTop("请选择使用单位!", MessageBoxIcon.Warning);
return;
}
if (this.drpTeamGroup.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择焊工班组!", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.hdUsingMan1.Text.Trim()))
{
Alert.ShowInTop("请选择领料人!", MessageBoxIcon.Warning);
return;
}
if (this.drpSheet.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择焊件材质!", MessageBoxIcon.Warning);
return;
}
if (drpOrderTime.SelectedValue == Const._Null)
{
Alert.ShowInTop("请选择预约时间!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.UsingPlanId))
{
var plan = BLL.UsingPlanService.GetUsingPlanById(this.UsingPlanId);
if (plan.IsFinish == true)
{
Alert.ShowInTop("该计划已完成,不能修改!", MessageBoxIcon.Warning);
return;
}
}
var weld = BLL.WeldInfoService.GetWeldInfoById(this.hdWeldId.Text.Trim());
if (weld != null)
{
var weldtype = BLL.WeldTypeService.GetWeldTypeById(weld.WeldTypeId);
var welder = BLL.HJGL_PersonManageService.GetWelderByWenId(hdUsingMan1.Text.Trim());
if (welder.MaxHanTiao != null && welder.MaxHanTiao != null)
{
if (!string.IsNullOrEmpty(this.txtAmount.Text.Trim()))
{
if (weldtype.WeldTypeName.Contains("焊条"))
{
if (Funs.GetNewDecimal(this.txtAmount.Text.Trim()) > welder.MaxHanTiao)
{
Alert.ShowInTop("超过该焊工的最大领用数量,请重新录入计划领用数量!", MessageBoxIcon.Warning);
return;
}
}
if (weldtype.WeldTypeName.Contains("焊丝"))
{
if (Funs.GetNewDecimal(this.txtAmount.Text.Trim()) > welder.MaxWeldingWire)
{
Alert.ShowInTop("超过该焊工的最大领用数量,请重新录入计划领用数量!", MessageBoxIcon.Warning);
return;
}
}
}
}
else if (!string.IsNullOrEmpty(weld.WeldSpec))
{
var spec = from x in Funs.DB.Weld_Specifications where x.Specifications == weld.WeldSpec && x.WeldTypeId == weld.WeldTypeId select x;
if (spec.Count() > 0)
{
if (!string.IsNullOrEmpty(this.txtAmount.Text.Trim()))
{
if (Funs.GetNewDecimal(this.txtAmount.Text.Trim()) > spec.First().MaxUsingNum)
{
Alert.ShowInTop("超过最大领用数量,请重新录入计划领用数量!", MessageBoxIcon.Warning);
return;
}
}
}
}
if (!string.IsNullOrEmpty(weld.SteelType) && weld.SteelType == "FeⅢ无保护气体")
{
if (!string.IsNullOrEmpty(this.hdUsingMan1.Text.Trim()))
{
var qualifiedProject = BLL.HJGL_WelderQualifiedProjectService.GetWelderQualifiedProjectByWedId(this.hdUsingMan1.Text.Trim());
if (qualifiedProject.Count > 0)
{
//当材质类型为FeⅢ并且资质后面三个数中间的为11时可领用FeⅢ无保护气体焊丝
qualifiedProject = qualifiedProject.Where(e => e.MaterialType.Contains("FeⅢ") && e.QualifiedProjectCode.Contains("/11/")).ToList();
if (qualifiedProject.Count == 0)
{
Alert.ShowInTop("无FeⅢ无保护气体资质,不可领用!", MessageBoxIcon.Warning);
return;
}
}
}
}
}
Model.Weld_UsingPlan usingPlan = new Model.Weld_UsingPlan();
usingPlan.UnitStoreId = this.drpUnitStore.SelectedValue;
if (!string.IsNullOrEmpty(this.hdWeldId.Text.Trim()))
{
usingPlan.WeldId = this.hdWeldId.Text.Trim();
}
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
{
usingPlan.ProjectId = this.drpProjectId.SelectedValue;
}
if (drpUsePosition.SelectedValue != null && drpUsePosition.SelectedValue != BLL.Const._Null)
{
usingPlan.UsePosition = this.drpUsePosition.SelectedValue;
}
else
{
if (drpUsePosition.Text != "")
{
usingPlan.UsePosition = drpUsePosition.Text.Trim();
}
}
if (this.drpUsingUnit.SelectedValue != BLL.Const._Null)
{
usingPlan.UsingUnit = this.drpUsingUnit.SelectedValue;
}
if (this.drpSheet.SelectedValue != BLL.Const._Null && this.drpSheet.SelectedValue != null)
{
List texts = new List();
List values = new List();
foreach (ListItem item in drpSheet.SelectedItemArray)
{
texts.Add(item.Text);
values.Add(item.Value);
}
usingPlan.STE_ID = String.Join(",", values);
usingPlan.STE_Name = String.Join(",", texts);
}
usingPlan.Amount = Funs.GetNewDecimal(this.txtAmount.Text.Trim());
if (!string.IsNullOrEmpty(this.hdUsingMan1.Text.Trim()))
{
usingPlan.UsingManOne = this.hdUsingMan1.Text.Trim();
}
usingPlan.InPutDate = DateTime.Now;
usingPlan.OrderDate = Funs.GetNewDateTime(this.txtOrderDate.Text.Trim());
if (this.drpOrderTime.SelectedValue != BLL.Const._Null)
{
usingPlan.OrderTime = this.drpOrderTime.SelectedValue;
}
if (this.drpTeamGroup.SelectedValue != BLL.Const._Null)
{
usingPlan.TeamGroupId = this.drpTeamGroup.SelectedValue;
}
if (!string.IsNullOrEmpty(this.txtCancelDate.Text.Trim()))
{
usingPlan.CancelDate = DateTime.Now;
}
else
{
usingPlan.CancelDate = null;
}
usingPlan.IsCancel = Convert.ToBoolean(this.rblIsCancel.SelectedValue);
usingPlan.CancelResult = this.txtCancelResult.Text.Trim();
usingPlan.IsSubmit = isSubmit;
usingPlan.InPutMan = CurrUser.UserId;
usingPlan.Type = "1";
if (drpIsSteelStru.SelectedValue == "1")
{
usingPlan.IsSteelStru = true;
}
else
{
usingPlan.IsSteelStru = false;
}
var weldInfo = BLL.WeldInfoService.GetWeldInfoById(this.hdWeldId.Text.Trim());
if (WelderQueIsPass(this.hdUsingMan1.Text.Trim(), weldInfo.SteelType, usingPlan.IsSteelStru, weldInfo.WeldTypeId))
{
if (!string.IsNullOrEmpty(this.UsingPlanId))
{
var q = BLL.UsingPlanService.GetUsingPlanById(this.UsingPlanId);
usingPlan.UsingPlanId = this.UsingPlanId;
BLL.UsingPlanService.UpdateUsingPlan(usingPlan);
BLL.Sys_LogService.AddLog(Const.System_7, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改领料计划录入");
}
else
{
this.UsingPlanId = SQLHelper.GetNewID(typeof(Model.Weld_UsingPlan));
usingPlan.UsingPlanId = this.UsingPlanId;
BLL.UsingPlanService.AddUsingPlan(usingPlan);
BLL.Sys_LogService.AddLog(Const.System_7, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加领料计划录入");
this.UsingPlanId = string.Empty;
this.txtAmount.Text = string.Empty;
this.txtWeldName.Text = string.Empty;
this.txtWeldSpec.Text = string.Empty;
}
#region 在时间段内,焊丝和焊条各一条,超过2条,需加个确认 (暂不需要了)
// 在时间段内,焊丝和焊条各一条,超过2条,需加个确认
//List welderUsingPlan = BLL.UsingPlanService.GetWelderCurTimePlan(this.hdUsingMan1.Text.Trim(), usingPlan.OrderDate,this.drpOrderTime.SelectedValue);
//if (welderUsingPlan != null && welderUsingPlan.Count() > 2)
//{
// // 超过两条还未确认的记录
// var noConfirm = welderUsingPlan.Where(x => x.IsNeedConfirm == null);
// foreach (var q in noConfirm)
// {
// BLL.UsingPlanService.UpdateIsNeedConfirm(q.UsingPlanId, true);
// }
//}
//else
//{
// // 如修改时间段,则未超过两条,则不需要审核
// var noConfirm = welderUsingPlan.Where(x => x.IsNeedConfirm == true);
// foreach (var q in noConfirm)
// {
// BLL.UsingPlanService.UpdateIsNeedConfirm(q.UsingPlanId, null);
// }
//}
#endregion
if (isSubmit == true)
{
ShowNotify("提交成功!", MessageBoxIcon.Success);
}
else
{
ShowNotify("保存成功!", MessageBoxIcon.Success);
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("焊工资质不符合!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region DropDownList下拉选择事件
///
/// 是否作废选择事件
///
///
///
protected void rblIsCancel_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.rblIsCancel.SelectedValue == "true")
{
this.txtCancelDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
}
else
{
this.txtCancelDate.Text = string.Empty;
}
}
///
/// 项目下拉选择事件
///
///
///
protected void drpProjectId_OnSelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpProjectId.SelectedValue != BLL.Const._Null)
{
var position = from x in Funs.DB.View_UsePosition
where x.ProjectId == drpProjectId.SelectedValue
select x;
//var pipe = from x in Funs.DB.HJGL_PW_IsoInfo
// join y in Funs.DB.Base_Unit on x.BSU_ID equals y.UnitId
// where x.ProjectId == drpProjectId.SelectedValue orderby y.UnitName, x.ISO_IsoNo
// select new { x.ISO_ID,x.ISO_IsoNo,y.UnitName };
if (position.Count() > 0)
{
this.drpUsePosition.Items.Clear();
this.drpUsePosition.DataValueField = "UsePosition";
this.drpUsePosition.DataTextField = "UsePosition";
this.drpUsePosition.DataSource = position;
this.drpUsePosition.DataBind();
Funs.FineUIPleaseSelect(this.drpUsePosition);
}
else
{
this.drpUsePosition.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUsePosition);
}
}
else
{
this.drpUsePosition.Items.Clear();
Funs.FineUIPleaseSelect(this.drpUsePosition);
}
}
protected void drpUsingUnit_OnSelectedIndexChanged(object sender, EventArgs e)
{
//if (this.drpUsingUnit.SelectedValue != BLL.Const._Null)
//{
// this.drpTeamGroup.Items.Clear();
// this.drpTeamGroup.DataValueField = "TeamGroupId";
// this.drpTeamGroup.DataTextField = "TeamGroupName";
// this.drpTeamGroup.DataSource = BLL.Base_TeamGroupService.GetTeamGroupByUnit(drpProjectId.SelectedValue, drpUsingUnit.SelectedValue);
// this.drpTeamGroup.DataBind();
// Funs.FineUIPleaseSelect(this.drpTeamGroup);
//}
//else
//{
// this.drpTeamGroup.Items.Clear();
// Funs.FineUIPleaseSelect(this.drpTeamGroup);
//}
}
#endregion
#region 查找焊材信息
///
/// 查找焊材信息
///
///
///
protected void btnSelect_Click(object sender, EventArgs e)
{
if (this.drpUnitStore.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择焊材库!", MessageBoxIcon.Warning);
return;
}
string window = String.Format("ShowPlanWeld.aspx?projectId={0}&unitStoreId={1}", drpProjectId.SelectedValue, this.drpUnitStore.SelectedValue, "编辑 - ");
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.hdWeldId.ClientID) + Window1.GetShowReference(window));
}
#region 弹出编辑窗口关闭事件
///
/// 弹出编辑窗体关闭事件
///
///
///
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
if (!string.IsNullOrEmpty(this.hdWeldId.Text))
{
var weld = BLL.WeldInfoService.GetWeldInfoById(this.hdWeldId.Text);
if (weld != null)
{
this.txtWeldName.Text = weld.WeldName;
this.txtWeldSpec.Text = weld.WeldSpec;
txtWeldCode.Text = weld.WeldCode;
var weldType = BLL.WeldTypeService.GetWeldTypeById(weld.WeldTypeId);
if (weldType != null)
{
if (weldType.WeldTypeName == "焊条" || weldType.WeldTypeName == "焊丝")
{
this.txtAmount.Label = "数量(根)";
}
else
{
if (weldType.WeldTypeName == "焊丝(盘)")
{
this.txtAmount.Text = "15";
}
this.txtAmount.Label = "数量(Kg)";
}
}
}
else
{
this.txtWeldName.Text = string.Empty;
this.txtWeldSpec.Text = string.Empty;
txtWeldCode.Text = string.Empty;
}
}
else
{
this.txtWeldName.Text = string.Empty;
this.txtWeldSpec.Text = string.Empty;
txtWeldCode.Text = string.Empty;
}
}
#endregion
#endregion
#region 查找领料人
///
/// 查找领料人
///
///
///
protected void btnSelectUsingMan_Click(object sender, EventArgs e)
{
string window = String.Format("ShowUsingMan.aspx?projectId={0}", drpProjectId.SelectedValue, "编辑 - ");
PageContext.RegisterStartupScript(Window2.GetSaveStateReference(hdUsingMan1.ClientID) + Window2.GetShowReference(window));
}
///
/// 关闭领料人
///
///
///
protected void Window2_Close(object sender, WindowCloseEventArgs e)
{
if (!string.IsNullOrEmpty(hdUsingMan1.Text))//第一领料人
{
var welder = BLL.HJGL_PersonManageService.GetWelderByWenId(hdUsingMan1.Text.Trim());
if (welder != null)
{
this.txtUsingManOne.Text = welder.WED_Name;
}
else
{
this.txtUsingManOne.Text = string.Empty;
}
}
else
{
this.txtUsingManOne.Text = string.Empty;
}
}
///
/// 判断焊工资质是否合格
///
///
///
///
private bool WelderQueIsPass(string welderId, string steelType, bool? isSteelStru, string weldTypeId)
{
bool isPass = false;
List qualifys = new List();
if (isSteelStru == true)
{
qualifys = (from x in Funs.DB.HJGL_BS_WelderQualifiedProject
where x.WED_ID == welderId && x.LimitDate >= DateTime.Now && x.MaterialType != null
select x).ToList();
}
else
{
qualifys = (from x in Funs.DB.HJGL_BS_WelderQualifiedProject
where x.WED_ID == welderId && x.LimitDate >= DateTime.Now && x.MaterialType != null
&& (x.IsSteelStru == false || x.IsSteelStru == null)
select x).ToList();
}
foreach (var q in qualifys)
{
if (q.QualifiedProjectCode.Split('-').Length == 3) //该种合格项目只能领盘状焊丝
{
if (q.QualifiedProjectCode.Contains("SAW"))
{
if (weldTypeId == "9770311b-af69-4b6f-b8ad-161a4df88015" || weldTypeId == "23900d2f-f0e6-4d76-a44d-eb47eede3914") //SAW可以领用焊剂和盘装焊丝没有材质的限制
{
isPass = true;
break;
}
}
else
{
if (weldTypeId == "23900d2f-f0e6-4d76-a44d-eb47eede3914") //盘状焊丝
{
isPass = true;
break;
}
}
}
else
{
if (weldTypeId == "7f4261ef-70b4-4e5a-a5bb-623fc2eb190f" || weldTypeId == "56d933f6-8e6a-4761-80f4-c285662947cb") //焊条和焊丝
{
if (q.MaterialType.Contains(steelType) || (steelType == "FeⅣ无保护气体" && q.QualifiedProjectCode.Contains("03")))
{
isPass = true;
break;
}
}
else
{
//当系统识别为SAW焊接方法时,则所有的焊剂和盘状焊丝都可以领用
//当系统识别为GMAW、FCAW且钢种(FeⅠ、Ⅱ、Ⅲ、Ⅳ)和被领用的盘状焊丝钢种匹配时可以领用(焊剂不可领用)。SMAW、GTAW不可以领用焊剂及盘状焊丝
if (q.QualifiedProjectCode.Contains("SAW") || (steelType == "FeⅣ无保护气体" && q.QualifiedProjectCode.Contains("03")))
{
isPass = true;
break;
}
else if (q.QualifiedProjectCode.Contains("GMAW") || q.QualifiedProjectCode.Contains("FCAW"))
{
if (q.MaterialType.Contains(steelType) || (steelType == "FeⅣ无保护气体" && q.QualifiedProjectCode.Contains("03")))
{
isPass = true;
break;
}
}
}
}
}
return isPass;
}
#endregion
protected void drpSheet_OnSelectedIndexChanged(object sender, EventArgs e)
{
if (drpSheet.SelectedValueArray.Length > 1)
{
drpSheet.Items[0].Selected = false;
}
if (drpSheet.SelectedValueArray.Length == 0)
{
drpSheet.Items[0].Selected = true;
}
}
#region 附件上传 暂不用
///
/// 上传附件资源
///
///
///
//protected void btnAttachUrl_Click(object sender, EventArgs e)
//{
// string edit = "0"; // 表示能打开附件上传窗口,但不能上传附件
// if (this.drpProjectId.SelectedValue == Const._Null)
// {
// ShowNotify("请选择项目!");
// }
// else
// {
// PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/BaseInfo/Project&menuId={1}&edit={2}", this.drpProjectId.SelectedValue, Const.ProjectMenuId, edit)));
// }
//}
#endregion
}
}