1
This commit is contained in:
@@ -1,17 +1,37 @@
|
||||
using System;
|
||||
using BLL;
|
||||
using FineUIPro.Web.DataShow;
|
||||
using FineUIPro.Web.HJGL.WeldingManage;
|
||||
using FineUIPro.Web.ProjectData;
|
||||
using Microsoft.Office.Interop.Word;
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using BLL;
|
||||
using Model;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static BLL.TwConst;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace FineUIPro.Web.CLGL
|
||||
{
|
||||
public partial class OutPlanMasterEdit : PageBase
|
||||
public partial class OutPlanMasterEdit :PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位工程主键
|
||||
/// </summary>
|
||||
public string UnitWorkId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["UnitWorkId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["UnitWorkId"] = value;
|
||||
}
|
||||
}
|
||||
public string Id
|
||||
{
|
||||
get
|
||||
@@ -27,81 +47,172 @@ namespace FineUIPro.Web.CLGL
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InitDrpList();
|
||||
UnitWorkId = Request.QueryString["UnitWorkId"];
|
||||
Id = Request.QueryString["Id"];
|
||||
if (!string.IsNullOrEmpty(Id))
|
||||
{
|
||||
var model= TwInOutplanmasterService.GetById(Id);
|
||||
txtCusBillCode.Text = model.CusBillCode;
|
||||
txtWarehouseCode.Text = model.WarehouseCode;
|
||||
txtCreateDate.Text =string.Format("{0:yyyy-MM-dd}", model.CreateDate);
|
||||
txtCreateMan.Text = Person_PersonsService.GetPersonsNameById(model.CreateMan);
|
||||
txtReqUnitName.Text = UnitService.GetUnitNameByUnitId(model.ReqUnitId);
|
||||
|
||||
|
||||
var queryModel = new Model.Tw_InOutDetailOutput()
|
||||
{
|
||||
InOutPlanMasterId = Id
|
||||
|
||||
};
|
||||
var detailList= TwInOutplandetailService.GetByModle(queryModel).ToList();
|
||||
foreach (var item in detailList)
|
||||
{
|
||||
item.ActNum=item.PlanNum;
|
||||
|
||||
}
|
||||
Grid1.DataSource=detailList;
|
||||
Grid1.DataBind();
|
||||
var queryModel = new Model.Tw_InOutMasterOutput()
|
||||
{
|
||||
Id=Id,
|
||||
};
|
||||
var result = BLL.TwInOutplanmasterService.GetListData(queryModel).FirstOrDefault();
|
||||
txtCreateMan.Text = result.CreateManName;
|
||||
txtCreateDate.Text =result.CreateDate.Value.ToString("yyyy-MM-dd");
|
||||
drpReqUnit.SelectedValue = result.ReqUnitId;
|
||||
BindGrid(Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
txtCreateMan.Text = this.CurrUser.PersonName;
|
||||
txtCreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
drpReqUnit.SelectedValue = this.CurrUser.UnitId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private void InitDrpList()
|
||||
{
|
||||
drpWarehouse.DataTextField = "Text";
|
||||
drpWarehouse.DataValueField = "Value";
|
||||
drpWarehouse.DataSource = BLL.DropListService.HJGL_WarehouseCode();
|
||||
drpWarehouse.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpWarehouse);
|
||||
drpTypeInt.DataTextField = "Key";
|
||||
drpTypeInt.DataValueField = "Value";
|
||||
drpTypeInt.DataSource = BLL.TwConst.TypeIntMap.Where(x => x.Key.Contains("出库")); ;
|
||||
drpTypeInt.DataBind();
|
||||
Funs.FineUIPleaseSelect(this.drpTypeInt);
|
||||
UnitService.InitUnitDropDownList(drpReqUnit, this.CurrUser.LoginProjectId, true);
|
||||
|
||||
}
|
||||
private void BindGrid(string inOutPlanMasterId)
|
||||
{
|
||||
var queryRelationModel = new Tw_InOutPlanDetail_Relation();
|
||||
queryRelationModel.InOutPlanMasterId = Id;
|
||||
var tb = TwInoutplandetailRelationService.GetListData(queryRelationModel, Grid1);
|
||||
Grid1.DataSource = tb;
|
||||
Grid1.DataBind();
|
||||
|
||||
}
|
||||
#region 选择按钮
|
||||
/// <summary>
|
||||
/// 选择按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterSelect.aspx", "选择- ")));
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSave);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSubmit);
|
||||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
void Save(string type)
|
||||
{
|
||||
int state = (int)TwConst.State.待提交;
|
||||
switch (type)
|
||||
{
|
||||
case Const.BtnSave:
|
||||
state=(int)TwConst.State.待提交;
|
||||
break;
|
||||
case Const.BtnSubmit:
|
||||
state = (int)TwConst.State.待审核;
|
||||
break;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Id))
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
var model = new Tw_InOutPlanMaster()
|
||||
{
|
||||
Id = Id,
|
||||
ProjectId=this.CurrUser.LoginProjectId,
|
||||
CusBillCode=txtCusBillCode.Text,
|
||||
WarehouseCode = drpWarehouse.SelectedValue,
|
||||
WeldTaskId=UnitWorkId,
|
||||
Source=1,
|
||||
CreateDate = DateTime.Now,
|
||||
CreateMan = this.CurrUser.PersonId,
|
||||
ReqUnitId = drpReqUnit.SelectedValue,
|
||||
TypeInt = int.Parse( drpTypeInt.SelectedValue),
|
||||
Remark = txtRemark.Text,
|
||||
InOutType=(int)TwConst.InOutType.出库,
|
||||
Category= (int)TwConst.Category.全部,
|
||||
State=state
|
||||
};
|
||||
TwInOutplanmasterService.Add(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
var model = TwInOutplanmasterService.GetById(Id);
|
||||
model.ProjectId = this.CurrUser.LoginProjectId;
|
||||
model.CusBillCode = txtCusBillCode.Text;
|
||||
model.WarehouseCode = drpWarehouse.SelectedValue;
|
||||
model.WeldTaskId = UnitWorkId;
|
||||
model.Source = 1;
|
||||
model.CreateDate = DateTime.Now;
|
||||
model.CreateMan = this.CurrUser.PersonId;
|
||||
model.ReqUnitId = drpReqUnit.SelectedValue;
|
||||
model.TypeInt = int.Parse(drpTypeInt.SelectedValue);
|
||||
model.Remark = txtRemark.Text;
|
||||
model.InOutType = (int)TwConst.InOutType.出库;
|
||||
model.Category = (int)TwConst.Category.全部;
|
||||
model.State = state;
|
||||
TwInOutplanmasterService.Update(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存明细项
|
||||
/// </summary>
|
||||
private List<Model.Tw_OutputDetail> SaveDetail(string InOutPlanMasterId)
|
||||
private void SaveDetail()
|
||||
{
|
||||
|
||||
|
||||
//根据列表中的明细项添加
|
||||
List<Model.Tw_OutputDetail> detailLists = new List<Model.Tw_OutputDetail>();
|
||||
List<Model.Tw_InOutPlanDetail_Relation> detailLists = new List<Model.Tw_InOutPlanDetail_Relation>();
|
||||
JArray teamGroupData = Grid1.GetMergedData();
|
||||
foreach (JObject teamGroupRow in teamGroupData)
|
||||
{
|
||||
JObject values = teamGroupRow.Value<JObject>("values");
|
||||
int rowIndex = teamGroupRow.Value<int>("index");
|
||||
Model.Tw_OutputDetail newDetail = new Model.Tw_OutputDetail
|
||||
|
||||
var mdoel=TwInoutplandetailRelationService.GetById(values.Value<string>("Id"));
|
||||
if (mdoel != null)
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
OutputMasterId = InOutPlanMasterId,
|
||||
//ProNoticeCId= values.Value<string>("ProNoticeCId"),
|
||||
MaterialCode = values.Value<string>("MaterialCode"),
|
||||
PlanNum = values.Value<decimal>("PlanNum"),
|
||||
ActNum = values.Value<decimal>("ActNum"),
|
||||
};
|
||||
|
||||
detailLists.Add(newDetail);
|
||||
}
|
||||
return detailLists;
|
||||
}
|
||||
protected void btnEditProcess_Click(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
mdoel.Number= values.Value<decimal>("Number");
|
||||
}
|
||||
TwInoutplandetailRelationService.Update(mdoel);
|
||||
}
|
||||
TwInOutplandetailService.GenInOutPlanDetailByInoutPlanMasterId(Id);
|
||||
|
||||
}
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
TwOutputmasterService.GenOutMasterByPlanId(Id, SaveDetail(Id));
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
protected void btnAgree_Click(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected void btnDisgree_Click(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
if (e.CommandName == "delete" )
|
||||
{
|
||||
string id = e.RowID;
|
||||
TwInoutplandetailRelationService.DeleteById(id);
|
||||
TwInOutplandetailService.GenInOutPlanDetailByInoutPlanMasterId(Id);
|
||||
BindGrid(Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user