1
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
alter table [dbo].[HJGL_MaterialCodeLib] add Code nvarchar(50) null
|
||||
GO
|
||||
@@ -42,7 +42,7 @@ namespace BLL
|
||||
Id = x.Id,
|
||||
InOutPlanMasterId = x.InOutPlanMasterId,
|
||||
PipelineComponentId = x.PipelineComponentId,
|
||||
MaterialCode = x.MaterialCode,
|
||||
MaterialCode = mat.Code,
|
||||
HeatNo = x.HeatNo,
|
||||
BatchNo = x.BatchNo,
|
||||
PlanNum = x.PlanNum,
|
||||
@@ -119,7 +119,7 @@ namespace BLL
|
||||
Id = SQLHelper.GetNewID(),
|
||||
InOutPlanMasterId = inoutPlanMasterId,
|
||||
PipelineComponentId = item.PipelineComponentId,
|
||||
MaterialCode = item.MaterialCode,
|
||||
MaterialCode = item.MaterialCode + "-" + item.HeatNo + "-" + item.BatchNo,
|
||||
PlanNum = item.PlanNum,
|
||||
ActNum = item.ActNum,
|
||||
SortIndex = sortIndex,
|
||||
|
||||
@@ -37,7 +37,8 @@
|
||||
MaterialDef = codeLib.MaterialDef,
|
||||
PipeGrade = codeLib.PipeGrade,
|
||||
MaterialUnit = codeLib.MaterialUnit,
|
||||
ProjectId = codeLib.ProjectId
|
||||
ProjectId = codeLib.ProjectId,
|
||||
Code = codeLib.Code
|
||||
};
|
||||
db.HJGL_MaterialCodeLib.InsertOnSubmit(newCodeLib);
|
||||
db.SubmitChanges();
|
||||
@@ -66,6 +67,7 @@
|
||||
newCodeLib.MaterialDef = codeLib.MaterialDef;
|
||||
newCodeLib.PipeGrade = codeLib.PipeGrade;
|
||||
newCodeLib.MaterialUnit = codeLib.MaterialUnit;
|
||||
newCodeLib.Code = codeLib.Code;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
@@ -94,24 +96,30 @@
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var materialCodes = (from x in db.HJGL_MaterialCodeLib select x.MaterialCode + "_" + x.HeatNo + "_" + x.BatchNo).Distinct().ToList();
|
||||
var materialCodes = from x in db.HJGL_MaterialCodeLib select x.MaterialCode;
|
||||
var ls = from x in list
|
||||
where !materialCodes.Contains(x.MaterialCode + "_" + x.HeatNo + "_" + x.BatchNo)
|
||||
where !materialCodes.Contains(x.MaterialCode + "-" + x.HeatNo + "-" + x.BatchNo)
|
||||
select x;
|
||||
List<string> codes = new List<string>();
|
||||
List<Model.HJGL_MaterialCodeLib> details = new List<Model.HJGL_MaterialCodeLib>();
|
||||
foreach (var item in ls)
|
||||
{
|
||||
Model.HJGL_MaterialCodeLib table = new Model.HJGL_MaterialCodeLib
|
||||
if (!codes.Contains(item.MaterialCode + "-" + item.HeatNo + "-" + item.BatchNo))
|
||||
{
|
||||
MaterialCode = item.MaterialCode,
|
||||
HeatNo = item.HeatNo,
|
||||
BatchNo = item.BatchNo,
|
||||
MaterialName = item.MaterialName,
|
||||
MaterialSpec = item.MaterialSpec,
|
||||
MaterialUnit = item.MaterialUnit,
|
||||
MaterialDef = item.MaterialDef,
|
||||
};
|
||||
details.Add(table);
|
||||
Model.HJGL_MaterialCodeLib table = new Model.HJGL_MaterialCodeLib
|
||||
{
|
||||
MaterialCode = item.MaterialCode + "-" + item.HeatNo + "-" + item.BatchNo,
|
||||
HeatNo = item.HeatNo,
|
||||
BatchNo = item.BatchNo,
|
||||
MaterialName = item.MaterialName,
|
||||
MaterialSpec = item.MaterialSpec,
|
||||
MaterialUnit = item.MaterialUnit,
|
||||
MaterialDef = item.MaterialDef,
|
||||
Code = item.MaterialCode
|
||||
};
|
||||
details.Add(table);
|
||||
codes.Add(table.MaterialCode);
|
||||
}
|
||||
}
|
||||
|
||||
db.HJGL_MaterialCodeLib.InsertAllOnSubmit(details);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
<f:TextBox ID="txtMaterialCode" runat="server" Label="材料编码"
|
||||
<f:TextBox ID="txtCode" runat="server" Label="材料编码"
|
||||
EmptyText="输入查询条件" Width="300px" LabelWidth="120px"
|
||||
LabelAlign="Right">
|
||||
</f:TextBox>
|
||||
@@ -44,9 +44,9 @@
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RenderField Width="200px" ColumnID="MaterialCode" DataField="MaterialCode"
|
||||
<f:RenderField Width="200px" ColumnID="Code" DataField="Code"
|
||||
FieldType="String" HeaderText="材料编码" HeaderTextAlign="Center"
|
||||
TextAlign="Left" SortField="MaterialCode">
|
||||
TextAlign="Left" SortField="Code">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="200px" ColumnID="HeatNo" DataField="HeatNo"
|
||||
FieldType="String" HeaderText="炉号" HeaderTextAlign="Center"
|
||||
|
||||
@@ -36,10 +36,10 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
WHERE 1=1";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtMaterialCode.Text.Trim()))
|
||||
if (!string.IsNullOrEmpty(this.txtCode.Text.Trim()))
|
||||
{
|
||||
strSql += " AND MaterialCode LIKE @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + this.txtMaterialCode.Text.Trim() + "%"));
|
||||
strSql += " AND Code LIKE @Code";
|
||||
listStr.Add(new SqlParameter("@Code", "%" + this.txtCode.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtMaterialName.Text.Trim()))
|
||||
{
|
||||
|
||||
@@ -58,13 +58,13 @@ namespace FineUIPro.Web.HJGL.BaseInfo {
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialCode 控件。
|
||||
/// txtCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtMaterialCode;
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialName 控件。
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtMaterialCode" runat="server" Label="材料编码"
|
||||
<f:TextBox ID="txtCode" runat="server" Label="材料编码"
|
||||
Required="true" MaxLength="50" ShowRedStar="true" FocusOnPageLoad="true" LabelWidth="100px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
Model.HJGL_MaterialCodeLib lib = BLL.MaterialCodeLibService.GetMaterialCodeLib(materialCode);
|
||||
if (lib != null)
|
||||
{
|
||||
this.txtMaterialCode.Text = materialCode;
|
||||
this.txtCode.Text = lib.Code;
|
||||
this.txtMaterialMade.Text = lib.MaterialMade;
|
||||
this.txtHeatNo.Text = lib.HeatNo;
|
||||
this.txtBatchNo.Text = lib.BatchNo;
|
||||
@@ -31,11 +31,11 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
txtMaterialSpec.Text = lib.MaterialSpec;
|
||||
txtMaterialDef.Text = lib.MaterialDef;
|
||||
txtMaterialUnit.Text = lib.MaterialUnit;
|
||||
txtMaterialCode.Enabled = false;
|
||||
//txtMaterialCode.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
txtMaterialCode.Enabled = true;
|
||||
//txtMaterialCode.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,24 +53,25 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
string materialCode = Request.Params["MaterialCode"];
|
||||
if (string.IsNullOrEmpty(materialCode))
|
||||
{
|
||||
var q = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == this.txtMaterialCode.Text.Trim());
|
||||
var q = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == materialCode);
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此材料编码已存在!", MessageBoxIcon.Warning);
|
||||
Alert.ShowInTop("此材料编码、炉号、批号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Model.HJGL_MaterialCodeLib newLib = new Model.HJGL_MaterialCodeLib
|
||||
{
|
||||
MaterialCode = this.txtMaterialCode.Text.Trim(),
|
||||
MaterialCode = this.txtCode.Text.Trim() + "-" + this.txtHeatNo.Text.Trim() + "-" + this.txtBatchNo.Text.Trim(),
|
||||
HeatNo = this.txtHeatNo.Text.Trim(),
|
||||
BatchNo = this.txtBatchNo.Text.Trim(),
|
||||
MaterialName = this.txtMaterialName.Text.Trim(),
|
||||
MaterialSpec = this.txtMaterialSpec.Text.Trim(),
|
||||
MaterialMade = this.txtMaterialMade.Text.Trim(),
|
||||
MaterialDef = this.txtMaterialDef.Text.Trim(),
|
||||
MaterialUnit = txtMaterialUnit.Text.Trim()
|
||||
MaterialUnit = txtMaterialUnit.Text.Trim(),
|
||||
Code = this.txtCode.Text.Trim()
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(materialCode))
|
||||
|
||||
@@ -40,13 +40,13 @@ namespace FineUIPro.Web.HJGL.BaseInfo {
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// txtMaterialCode 控件。
|
||||
/// txtCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtMaterialCode;
|
||||
protected global::FineUIPro.TextBox txtCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtHeatNo 控件。
|
||||
|
||||
@@ -100588,6 +100588,8 @@ namespace Model
|
||||
|
||||
private string _BatchNo;
|
||||
|
||||
private string _Code;
|
||||
|
||||
private EntityRef<Base_Project> _Base_Project;
|
||||
|
||||
private EntitySet<HJGL_PipeLineMat> _HJGL_PipeLineMat;
|
||||
@@ -100616,6 +100618,8 @@ namespace Model
|
||||
partial void OnHeatNoChanged();
|
||||
partial void OnBatchNoChanging(string value);
|
||||
partial void OnBatchNoChanged();
|
||||
partial void OnCodeChanging(string value);
|
||||
partial void OnCodeChanged();
|
||||
#endregion
|
||||
|
||||
public HJGL_MaterialCodeLib()
|
||||
@@ -100829,6 +100833,26 @@ namespace Model
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Code", DbType="NVarChar(50)")]
|
||||
public string Code
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._Code;
|
||||
}
|
||||
set
|
||||
{
|
||||
if ((this._Code != value))
|
||||
{
|
||||
this.OnCodeChanging(value);
|
||||
this.SendPropertyChanging();
|
||||
this._Code = value;
|
||||
this.SendPropertyChanged("Code");
|
||||
this.OnCodeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HJGL_MaterialCodeLib_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
|
||||
public Base_Project Base_Project
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user