2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
2025-06-04 22:46:21 +08:00
|
|
|
|
using Model;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HJGL.PreDesign
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PackagingManageEdit : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public string PackagingManageId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["PackagingManageId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["PackagingManageId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
|
|
|
|
|
PackagingManageId = Request.Params["PackagingManageId"];
|
2025-05-08 18:38:55 +08:00
|
|
|
|
TrainNumberManageService.InitDownListOfTrainNumber(drpTrainNumber, this.CurrUser.LoginProjectId, false);
|
|
|
|
|
|
|
|
|
|
|
|
drpTypeInt.DataTextField = "Key";
|
|
|
|
|
|
drpTypeInt.DataValueField = "Value";
|
|
|
|
|
|
drpTypeInt.DataSource = HJGL_PackagingmanageService.TypeIntMap;
|
|
|
|
|
|
drpTypeInt.DataBind();
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-18 23:22:47 +08:00
|
|
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(PackagingManageId))
|
|
|
|
|
|
{
|
|
|
|
|
|
var model = HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
|
2025-05-12 19:05:13 +08:00
|
|
|
|
drpTypeInt.Enabled = false;
|
2023-11-30 11:03:07 +08:00
|
|
|
|
txtPackagingCode.Text = model.PackagingCode;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
dropPipelineComponentCode.Values = model.PipelineComponentId?.Split(',');
|
|
|
|
|
|
txtStackingPosition.Text = model.StackingPosition;
|
|
|
|
|
|
drpTrainNumber.SelectedValue = model.TrainNumberId;
|
|
|
|
|
|
drpTypeInt.SelectedValue = model.TypeInt.ToString();
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (model.State== HJGL_PackagingmanageService.state_0)
|
|
|
|
|
|
{
|
|
|
|
|
|
btnSave.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2025-05-12 19:05:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
drpTypeInt.Enabled = true;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
btnSave.Hidden = false;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
txtPackagingCode.Text = HJGL_PackagingmanageService.GetNewPackagingCode(this.CurrUser.LoginProjectId);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2025-05-08 18:38:55 +08:00
|
|
|
|
drpTypeInt_SelectedIndexChanged(null, null);
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2023-09-11 11:40:38 +08:00
|
|
|
|
|
|
|
|
|
|
private void BindGrid()
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-09-11 11:40:38 +08:00
|
|
|
|
Grid1.DataSource = HJGL_PipelineComponentService.GetAcceptedPipelineComponent(CurrUser.LoginProjectId,
|
|
|
|
|
|
txtpipelineCode.Text.Trim(), txtpipelineComponentCode.Text.Trim(), txtflowingSection.Text.Trim());
|
|
|
|
|
|
Grid1 .DataBind();
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
2025-05-08 18:38:55 +08:00
|
|
|
|
private void BindGrid2(string PackagingManageId)
|
|
|
|
|
|
{
|
2025-05-12 19:05:13 +08:00
|
|
|
|
Grid2.DataSource = HJGLPackagingmanagedetailService.GetPackagingData(PackagingManageId);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
Grid2.DataBind();
|
2025-05-12 19:05:13 +08:00
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
Save();
|
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Save()
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(PackagingManageId))
|
|
|
|
|
|
{
|
2025-05-08 18:38:55 +08:00
|
|
|
|
Model.HJGL_PackagingManage table = new Model.HJGL_PackagingManage();
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
table.PackagingManageId = SQLHelper.GetNewID();
|
|
|
|
|
|
table.PackagingCode = txtPackagingCode.Text;
|
|
|
|
|
|
table.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
|
table.StackingPosition = txtStackingPosition.Text;
|
|
|
|
|
|
table.State = 0;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
//table.ContactName = txtContactName.Text;
|
|
|
|
|
|
//table.ContactPhone = txtContactPhone.Text;
|
|
|
|
|
|
table.TrainNumberId = drpTrainNumber.SelectedValue;
|
|
|
|
|
|
table.TypeInt = int.Parse(drpTypeInt.SelectedValue);
|
2025-07-31 11:59:31 +08:00
|
|
|
|
table.CompileMan = this.CurrUser.PersonId;
|
|
|
|
|
|
table.CompileDate = DateTime.Now;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
if (drpTypeInt.SelectedValue == ((int)HJGL_PackagingmanageService.TypeInt.预制组件).ToString())
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values);
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
BLL.HJGL_PackagingmanageService.AddHJGL_PackagingManage(table);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
|
|
|
|
|
|
PackagingManageId= table.PackagingManageId;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.HJGL_PackagingManage table = BLL.HJGL_PackagingmanageService.GetHJGL_PackagingManageById(PackagingManageId);
|
|
|
|
|
|
if (table != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
table.PackagingCode = txtPackagingCode.Text;
|
|
|
|
|
|
table.ProjectId = this.CurrUser.LoginProjectId;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
table.StackingPosition = txtStackingPosition.Text;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
table.State = 0;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
//table.ContactName = txtContactName.Text;
|
|
|
|
|
|
//table.ContactPhone =txtContactPhone.Text;
|
|
|
|
|
|
table.TrainNumberId = drpTrainNumber.SelectedValue;
|
|
|
|
|
|
table.TypeInt = int.Parse(drpTypeInt.SelectedValue);
|
2025-05-12 19:05:13 +08:00
|
|
|
|
if (drpTypeInt.SelectedValue ==((int)HJGL_PackagingmanageService.TypeInt.预制组件).ToString())
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
table.PipelineComponentId = string.Join(",", dropPipelineComponentCode.Values);
|
|
|
|
|
|
|
2025-06-04 22:46:21 +08:00
|
|
|
|
var newDetailList= new List<Model.HJGL_PackagingManageDetail>();
|
|
|
|
|
|
foreach (var item in dropPipelineComponentCode.Values)
|
|
|
|
|
|
{
|
|
|
|
|
|
var ComponentModel = BLL.HJGL_PipelineComponentService.GetPipelineComponentById(item);
|
|
|
|
|
|
if (ComponentModel != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var model = new Model.HJGL_PackagingManageDetail()
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = SQLHelper.GetNewID(),
|
|
|
|
|
|
PackagingManageId = this.PackagingManageId,
|
|
|
|
|
|
PipelineId = ComponentModel.PipelineId,
|
|
|
|
|
|
PipelineComponentId = item,
|
|
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
|
CreateUser = this.CurrUser.PersonId,
|
|
|
|
|
|
};
|
|
|
|
|
|
newDetailList.Add(model);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
HJGLPackagingmanagedetailService.DeleteByPackagingManageId(this.PackagingManageId);
|
|
|
|
|
|
HJGLPackagingmanagedetailService.AddBulk(newDetailList);
|
|
|
|
|
|
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
BLL.HJGL_PackagingmanageService.UpdateHJGL_PackagingManage(table);
|
|
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
SaveDetail();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SaveDetail()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
//根据列表中的明细项添加
|
|
|
|
|
|
List<Model.PipelinePrefabricatedComponentsItem> detailLists = new List<Model.PipelinePrefabricatedComponentsItem>();
|
|
|
|
|
|
JArray teamGroupData = Grid2.GetMergedData();
|
|
|
|
|
|
foreach (JObject teamGroupRow in teamGroupData)
|
|
|
|
|
|
{
|
|
|
|
|
|
JObject values = teamGroupRow.Value<JObject>("values");
|
|
|
|
|
|
int rowIndex = teamGroupRow.Value<int>("index");
|
|
|
|
|
|
string id = teamGroupRow.Value<string>("id");
|
|
|
|
|
|
|
|
|
|
|
|
var mdoel = HJGLPackagingmanagedetailService.GetModelById(id);
|
|
|
|
|
|
if (mdoel != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
mdoel.Number = values.Value<decimal>("Number");
|
|
|
|
|
|
}
|
|
|
|
|
|
HJGLPackagingmanagedetailService.Update(mdoel);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
2023-09-11 11:40:38 +08:00
|
|
|
|
|
|
|
|
|
|
protected void btnFind_Click1(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
2025-05-08 18:38:55 +08:00
|
|
|
|
|
|
|
|
|
|
#region 选择按钮
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 选择按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnSelect_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Save();
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PackagingManageSelect.aspx?PackagingManageId={0}", PackagingManageId, "选择- ")));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void btnSelectStock_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Save();
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PackagingManageSelectStock.aspx?PackagingManageId={0}", PackagingManageId, "选择- ")));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
protected void drpTypeInt_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (drpTypeInt.SelectedValue == ((int)HJGL_PackagingmanageService.TypeInt.预制组件).ToString())
|
|
|
|
|
|
{
|
|
|
|
|
|
dropPipelineComponentCode.Hidden=false;
|
|
|
|
|
|
Grid2.Hidden=true;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
BindGrid();
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (drpTypeInt.SelectedValue == ((int)HJGL_PackagingmanageService.TypeInt.预制散件).ToString())
|
|
|
|
|
|
{
|
|
|
|
|
|
dropPipelineComponentCode.Hidden = true;
|
|
|
|
|
|
Grid2.Hidden = false;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
btnSelect.Hidden = false;
|
|
|
|
|
|
btnSelectStock.Hidden = true;
|
|
|
|
|
|
BindGrid2(this.PackagingManageId);
|
|
|
|
|
|
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (drpTypeInt.SelectedValue == ((int)HJGL_PackagingmanageService.TypeInt.其他材料).ToString())
|
|
|
|
|
|
{
|
|
|
|
|
|
dropPipelineComponentCode.Hidden = true;
|
|
|
|
|
|
Grid2.Hidden = false;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
btnSelect.Hidden = true;
|
|
|
|
|
|
btnSelectStock.Hidden = false;
|
|
|
|
|
|
BindGrid2(this.PackagingManageId);
|
|
|
|
|
|
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
2025-05-12 19:05:13 +08:00
|
|
|
|
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
protected void Grid2_RowCommand(object sender, GridCommandEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.CommandName == "delete")
|
|
|
|
|
|
{
|
|
|
|
|
|
string id = e.RowID;
|
2025-05-12 19:05:13 +08:00
|
|
|
|
HJGLPackagingmanagedetailService.DeleteById(id);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
BindGrid2(this.PackagingManageId);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
BindGrid2(this.PackagingManageId);
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|