feat:增加根据选择是否需要材料炉批号进行管控
This commit is contained in:
@@ -14,6 +14,13 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
bool usesMaterialBatch = BLL.Project_SysSetService.UsesMaterialBatchNumber(this.CurrUser.LoginProjectId);
|
||||
this.txtHeatNo.Hidden = !usesMaterialBatch;
|
||||
this.txtBatchNo.Hidden = !usesMaterialBatch;
|
||||
this.txtHeatNo.Required = usesMaterialBatch;
|
||||
this.txtBatchNo.Required = usesMaterialBatch;
|
||||
this.txtHeatNo.ShowRedStar = usesMaterialBatch;
|
||||
this.txtBatchNo.ShowRedStar = usesMaterialBatch;
|
||||
if (!IsPostBack)
|
||||
{
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
@@ -52,27 +59,29 @@ namespace FineUIPro.Web.HJGL.BaseInfo
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
string materialCode = Request.Params["MaterialCode"];
|
||||
if (string.IsNullOrEmpty(materialCode))
|
||||
bool usesMaterialBatch = BLL.Project_SysSetService.UsesMaterialBatchNumber(this.CurrUser.LoginProjectId);
|
||||
string code = this.txtCode.Text.Trim();
|
||||
string heatNo = usesMaterialBatch ? this.txtHeatNo.Text.Trim() : null;
|
||||
string batchNo = usesMaterialBatch ? this.txtBatchNo.Text.Trim() : null;
|
||||
string generatedMaterialCode = BLL.MaterialCodeLibService.BuildMaterialCode(code, heatNo, batchNo, usesMaterialBatch);
|
||||
var duplicate = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == generatedMaterialCode);
|
||||
if (duplicate != null && duplicate.MaterialCode != materialCode)
|
||||
{
|
||||
var q = Funs.DB.HJGL_MaterialCodeLib.FirstOrDefault(x => x.MaterialCode == materialCode);
|
||||
if (q != null)
|
||||
{
|
||||
Alert.ShowInTop("此材料编码、炉号、批号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Alert.ShowInTop("此材料编码、炉号、批号已存在!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
Model.HJGL_MaterialCodeLib newLib = new Model.HJGL_MaterialCodeLib
|
||||
{
|
||||
MaterialCode = this.txtCode.Text.Trim() + "-" + this.txtHeatNo.Text.Trim() + "-" + this.txtBatchNo.Text.Trim(),
|
||||
HeatNo = this.txtHeatNo.Text.Trim(),
|
||||
BatchNo = this.txtBatchNo.Text.Trim(),
|
||||
MaterialCode = generatedMaterialCode,
|
||||
HeatNo = heatNo,
|
||||
BatchNo = batchNo,
|
||||
MaterialName = this.txtMaterialName.Text.Trim(),
|
||||
MaterialSpec = this.txtMaterialSpec.Text.Trim(),
|
||||
MaterialMade = this.txtMaterialMade.Text.Trim(),
|
||||
MaterialDef = this.txtMaterialDef.Text.Trim(),
|
||||
MaterialUnit = txtMaterialUnit.Text.Trim(),
|
||||
Code = this.txtCode.Text.Trim(),
|
||||
Code = code,
|
||||
DesignInstitute = string.IsNullOrWhiteSpace(txtDesignInstitute.Text)
|
||||
? null
|
||||
: txtDesignInstitute.Text.Trim()
|
||||
|
||||
Reference in New Issue
Block a user