包装管理修改
This commit is contained in:
@@ -1,31 +1,33 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
public partial class PackagingManageSelectStock : PageBase
|
||||
{
|
||||
public string Id
|
||||
public string PackagingManageId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["Id"];
|
||||
return (string)ViewState["PackagingManageId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Id"] = value;
|
||||
ViewState["PackagingManageId"] = value;
|
||||
}
|
||||
}
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Id = Request.QueryString["Id"];
|
||||
PackagingManageId = Request.QueryString["PackagingManageId"];
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
}
|
||||
@@ -36,33 +38,25 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
|
||||
var inoutplanmaster = TwInOutplanmasterService.GetById(Id);
|
||||
if (inoutplanmaster == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Model.Tw_MaterialStockOutput table = new Model.Tw_MaterialStockOutput();
|
||||
table.PipeLineMatCode = txtMatCode.Text.Trim();
|
||||
table.WarehouseCode = inoutplanmaster.WarehouseCode;
|
||||
table.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (inoutplanmaster.Category == (int)TwConst.Category.管段)
|
||||
{
|
||||
table.MaterialUnit = "米";
|
||||
table.WarehouseCode = "工厂预制";
|
||||
table.ProjectId = this.CurrUser.LoginProjectId;
|
||||
var tb = BLL.TwMaterialstockService.GetTw_MaterialStockByModle(table);
|
||||
|
||||
}
|
||||
else if (inoutplanmaster.Category == (int)TwConst.Category.管件)
|
||||
{
|
||||
table.MaterialUnit = "个";
|
||||
|
||||
}
|
||||
|
||||
var tb = BLL.TwMaterialstockService.GetListData(table, Grid1);
|
||||
Grid1.RecordCount = TwMaterialstockService.Count;
|
||||
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
Grid1.DataSource = tb;
|
||||
var inoutplandetail = (from x in Funs.DB.HJGL_PackagingManageDetail
|
||||
where x.PackagingManageId == PackagingManageId
|
||||
select x).ToList();
|
||||
var queryList = tb;
|
||||
// 优化 Linq 过滤条件,过滤已经进入包装的预制散件
|
||||
var result = (from x in queryList
|
||||
join y in inoutplandetail on x.PipeLineMatCode equals y.MaterialCode into yy
|
||||
from y in yy.DefaultIfEmpty()
|
||||
where y == null
|
||||
select x).ToList();
|
||||
Grid1.RecordCount = result.Count;
|
||||
Grid1.DataSource = result;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
#endregion
|
||||
@@ -90,28 +84,21 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
foreach (var id in List_Id)
|
||||
{
|
||||
var StockModel = TwMaterialstockService.GetTw_MaterialStockById(id);
|
||||
var querydetail = new Model.Tw_InOutDetailOutput()
|
||||
var StockModel = TwMaterialstockService.GetTw_MaterialStockById(id);
|
||||
var model = new Model.HJGL_PackagingManageDetail()
|
||||
{
|
||||
InOutPlanMasterId = Id,
|
||||
Id = SQLHelper.GetNewID(),
|
||||
PackagingManageId = this.PackagingManageId,
|
||||
MaterialCode = StockModel.PipeLineMatCode,
|
||||
Number = 0,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateUser = this.CurrUser.PersonId,
|
||||
};
|
||||
var detail = TwInOutplandetailService.GetByModle(querydetail).FirstOrDefault();
|
||||
if (detail == null)
|
||||
{
|
||||
var tw_InOutPlanDetail = new Model.Tw_InOutPlanDetail
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InOutPlanMasterId = Id,
|
||||
MaterialCode = StockModel.PipeLineMatCode,
|
||||
PlanNum = 0,
|
||||
};
|
||||
TwInOutplandetailService.Add(tw_InOutPlanDetail);
|
||||
}
|
||||
HJGLPackagingmanagedetailService.Add(model);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GV 数据操作
|
||||
|
||||
Reference in New Issue
Block a user