feat(材料管理):增加调拨出库
This commit is contained in:
@@ -171,6 +171,11 @@ namespace FineUIPro.Web.CLGL
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var model = BLL.TwInOutplanmasterService.GetById(rowID);
|
||||
if (!string.IsNullOrEmpty(model.TransferBatchId))
|
||||
{
|
||||
Alert.ShowInTop("已提交的调拨申请不允许单独删除!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (model.State == (int)TwConst.State.已审核 || model.State == (int)TwConst.State.已完成)
|
||||
{
|
||||
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
||||
@@ -200,6 +205,11 @@ namespace FineUIPro.Web.CLGL
|
||||
}
|
||||
string ID = Grid1.SelectedRowID;
|
||||
var model = BLL.TwInOutplanmasterService.GetById(ID);
|
||||
if (model != null && model.TypeInt == (int)TwConst.TypeInt.调拨入库)
|
||||
{
|
||||
Alert.ShowInTop("调拨入库申请由调拨出库申请配对生成,不允许单独编辑!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (model != null) ///已上报时不能删除
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("InPlanMasterApplyEdit.aspx?Id={0}", ID, "编辑 - ")));
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace FineUIPro.Web.CLGL
|
||||
|
||||
drpTypeInt.DataTextField = "Key";
|
||||
drpTypeInt.DataValueField = "Value";
|
||||
drpTypeInt.DataSource = TwConst.TypeIntMap.Where(x => x.Key.Contains("入库"));
|
||||
drpTypeInt.DataSource = TwConst.TypeIntMap.Where(x => x.Key.Contains("入库") && x.Value != (int)TwConst.TypeInt.调拨入库);
|
||||
drpTypeInt.DataBind();
|
||||
|
||||
drpCategory.DataTextField = "Key";
|
||||
@@ -160,6 +160,12 @@ namespace FineUIPro.Web.CLGL
|
||||
|
||||
private bool Save(string type, bool validateDetail)
|
||||
{
|
||||
var currentModel = string.IsNullOrEmpty(Id) ? null : TwInOutplanmasterService.GetById(Id);
|
||||
if (currentModel != null && currentModel.TypeInt == (int)TwConst.TypeInt.调拨入库)
|
||||
{
|
||||
Alert.ShowInTop("调拨入库申请不允许单独编辑!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
if (!ValidateMaster())
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -444,6 +444,11 @@ namespace FineUIPro.Web.CLGL
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var model = BLL.TwInOutplanmasterService.GetById(rowID);
|
||||
if (!string.IsNullOrEmpty(model.TransferBatchId) && model.State != (int)TwConst.State.待提交)
|
||||
{
|
||||
Alert.ShowInTop("已提交的调拨申请不允许单独删除!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (model.State == (int)TwConst.State.已审核 || model.State == (int)TwConst.State.已完成)
|
||||
{
|
||||
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
|
||||
@@ -530,7 +535,10 @@ namespace FineUIPro.Web.CLGL
|
||||
}
|
||||
string planId = Grid1.SelectedRowID;
|
||||
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
|
||||
if (planMaster.State == (int)TwConst.State.待提交 && (planMaster.TypeInt == (int)TwConst.TypeInt.散件出库 || planMaster.TypeInt == (int)TwConst.TypeInt.其他出库))
|
||||
if (planMaster.State == (int)TwConst.State.待提交 &&
|
||||
(planMaster.TypeInt == (int)TwConst.TypeInt.散件出库 ||
|
||||
planMaster.TypeInt == (int)TwConst.TypeInt.其他出库 ||
|
||||
planMaster.TypeInt == (int)TwConst.TypeInt.调拨出库))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterEdit.aspx?UnitWorkId={0}&Id={1} ", tvControlItem.SelectedNodeID, planId, "新增 - ")));
|
||||
|
||||
|
||||
@@ -134,10 +134,10 @@ namespace FineUIPro.Web.CLGL
|
||||
responeData.message = "请先保存出库单后再导入明细!";
|
||||
return responeData;
|
||||
}
|
||||
if (master.TypeInt != (int)TwConst.TypeInt.其他出库)
|
||||
if (master.TypeInt != (int)TwConst.TypeInt.其他出库 && master.TypeInt != (int)TwConst.TypeInt.调拨出库)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "只有选择其他出库时才允许导入出库明细!";
|
||||
responeData.message = "只有选择其他出库或调拨出库时才允许导入出库明细!";
|
||||
return responeData;
|
||||
}
|
||||
List<Tw_MaterialStockOutput> stockList = GetSelectableStockList(master);
|
||||
|
||||
@@ -40,15 +40,18 @@
|
||||
</f:TextBox>
|
||||
|
||||
<f:DropDownList ID="drpWarehouse" runat="server" Label="仓库" ColumnWidth="20%"
|
||||
LabelWidth="70px" LabelAlign="Right" Width="170px">
|
||||
LabelWidth="70px" LabelAlign="Right" Width="170px" Required="true" ShowRedStar="true">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpTransferWarehouse" runat="server" Label="调入仓库" ColumnWidth="20%" Hidden="true"
|
||||
LabelWidth="70px" LabelAlign="Right" Width="170px" Required="true" ShowRedStar="true">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpTypeInt" runat="server" Label="类型" ColumnWidth="20%" OnSelectedIndexChanged="drpTypeInt_SelectedIndexChanged" AutoPostBack="true"
|
||||
LabelWidth="70px" LabelAlign="Right" Width="170px">
|
||||
</f:DropDownList>
|
||||
<f:DropDownList ID="drpCategory" runat="server" Label="类别" ColumnWidth="30%" OnSelectedIndexChanged="drpTypeInt_SelectedIndexChanged" AutoPostBack="true"
|
||||
<f:DropDownList ID="drpCategory" runat="server" Label="类别" ColumnWidth="20%" OnSelectedIndexChanged="drpTypeInt_SelectedIndexChanged" AutoPostBack="true"
|
||||
LabelWidth="70px" LabelAlign="Right" Width="170px">
|
||||
</f:DropDownList>
|
||||
<f:TextBox ID="txtCusBillCode" Label="编号" ColumnWidth="30%" runat="server" ShowRedStar="true" Required="true">
|
||||
<f:TextBox ID="txtCusBillCode" Label="编号" ColumnWidth="20%" runat="server" ShowRedStar="true" Required="true">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:Panel>
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace FineUIPro.Web.CLGL
|
||||
drpReqUnit.SelectedValue = result.ReqUnitId;
|
||||
drpTypeInt.SelectedValue = result.TypeInt.ToString();
|
||||
drpWarehouse.SelectedValue = result.WarehouseId;
|
||||
drpTransferWarehouse.SelectedValue = result.TransferWarehouseId;
|
||||
drpCategory.SelectedValue = result.Category.ToString();
|
||||
txtRemark.Text = result.Remark;
|
||||
txtCusBillCode.Text = result.CusBillCode;
|
||||
@@ -75,7 +76,7 @@ namespace FineUIPro.Web.CLGL
|
||||
txtCreateMan.Text = this.CurrUser.PersonName;
|
||||
txtCreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
drpReqUnit.SelectedValue = this.CurrUser.UnitId;
|
||||
txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, UnitService.GetUnitByUnitId(drpReqUnit.SelectedValue)?.UnitCode, UnitWorkService.getUnitWorkByUnitWorkId(UnitWorkId)?.UnitWorkCode, drpTypeInt.SelectedText, drpCategory.SelectedText);
|
||||
txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, UnitService.GetUnitByUnitId(drpReqUnit.SelectedValue)?.UnitCode, drpTypeInt.SelectedText, UnitWorkService.getUnitWorkByUnitWorkId(UnitWorkId)?.UnitWorkCode, drpCategory.SelectedText);
|
||||
}
|
||||
|
||||
drpTypeInt_SelectedIndexChanged(null, null);
|
||||
@@ -90,7 +91,13 @@ namespace FineUIPro.Web.CLGL
|
||||
drpWarehouse.DataSource = BLL.TwInOutplanmasterService.GetWarehouseCode(this.CurrUser.LoginProjectId);
|
||||
drpWarehouse.DataBind();
|
||||
|
||||
string[] typeIntArr = { TwConst.TypeInt.散件出库.ToString(), TwConst.TypeInt.其他出库.ToString() };
|
||||
drpTransferWarehouse.DataTextField = "Key";
|
||||
drpTransferWarehouse.DataValueField = "Value";
|
||||
drpTransferWarehouse.DataSource = BLL.TwInOutplanmasterService.GetWarehouseCode(this.CurrUser.LoginProjectId);
|
||||
drpTransferWarehouse.DataBind();
|
||||
Funs.FineUIPleaseSelect(drpTransferWarehouse);
|
||||
|
||||
string[] typeIntArr = { TwConst.TypeInt.散件出库.ToString(), TwConst.TypeInt.其他出库.ToString(), TwConst.TypeInt.调拨出库.ToString() };
|
||||
drpTypeInt.DataTextField = "Key";
|
||||
drpTypeInt.DataValueField = "Value";
|
||||
drpTypeInt.DataSource = BLL.TwConst.TypeIntMap.Where(x => typeIntArr.Contains(x.Key));
|
||||
@@ -117,7 +124,7 @@ namespace FineUIPro.Web.CLGL
|
||||
{
|
||||
var queryRelationModel = new Tw_InOutDetailOutput();
|
||||
queryRelationModel.InOutPlanMasterId = Id;
|
||||
var tb = TwInOutplandetailService.GetListData(queryRelationModel, Grid1);
|
||||
var tb = TwInOutplandetailService.GetListData(queryRelationModel, Grid2);
|
||||
Grid2.DataSource = tb;
|
||||
Grid2.DataBind();
|
||||
}
|
||||
@@ -132,19 +139,19 @@ namespace FineUIPro.Web.CLGL
|
||||
/// <param name="e"></param>
|
||||
protected void btnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSave);
|
||||
if (!Save(Const.BtnSave)) return;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterSelect.aspx?UnitWorkId={0}&Id={1}", UnitWorkId, Id, "选择- ")));
|
||||
|
||||
}
|
||||
protected void btnSelectStock_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSave);
|
||||
if (!Save(Const.BtnSave)) return;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterSelectStock.aspx?UnitWorkId={0}&Id={1}", UnitWorkId, Id, "选择- ")));
|
||||
|
||||
}
|
||||
protected void btnImportStock_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSave);
|
||||
if (!Save(Const.BtnSave)) return;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterDetailImport.aspx?Id={0}", Id, "导入- ")));
|
||||
|
||||
}
|
||||
@@ -152,19 +159,50 @@ namespace FineUIPro.Web.CLGL
|
||||
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSave);
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
if (Save(Const.BtnSave))
|
||||
{
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save(Const.BtnSubmit);
|
||||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||||
if (IsTransferType())
|
||||
{
|
||||
Tw_InOutPlanMaster currentModel = string.IsNullOrEmpty(Id) ? null : TwInOutplanmasterService.GetById(Id);
|
||||
// 重复提交旧页面时直接查询配对结果,避免先保存而把已提交申请重置为待提交。
|
||||
if (currentModel == null || currentModel.State == (int)TwConst.State.待提交)
|
||||
{
|
||||
if (!Save(Const.BtnSave)) return;
|
||||
}
|
||||
ResponeData result = TwInOutplanmasterService.SubmitTransferPlan(Id, drpTransferWarehouse.SelectedValue, GetDetailPlanNums());
|
||||
if (result.code == 0)
|
||||
{
|
||||
Alert.ShowInTop(result.message, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
ShowNotify(result.message, MessageBoxIcon.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Save(Const.BtnSubmit)) return;
|
||||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
void Save(string type)
|
||||
private bool Save(string type)
|
||||
{
|
||||
if (!ValidateMaster()) return false;
|
||||
|
||||
Tw_InOutPlanMaster currentModel = string.IsNullOrEmpty(Id) ? null : TwInOutplanmasterService.GetById(Id);
|
||||
if (currentModel != null && !string.IsNullOrEmpty(currentModel.TransferBatchId) &&
|
||||
currentModel.State != (int)TwConst.State.待提交)
|
||||
{
|
||||
Alert.ShowInTop("已提交的调拨申请不允许修改!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
int state = (int)TwConst.State.待提交;
|
||||
switch (type)
|
||||
{
|
||||
@@ -197,11 +235,12 @@ namespace FineUIPro.Web.CLGL
|
||||
Category = int.Parse(drpCategory.SelectedValue),
|
||||
State = state
|
||||
};
|
||||
SetTransferFields(model);
|
||||
TwInOutplanmasterService.Add(model);
|
||||
}
|
||||
else
|
||||
{
|
||||
var model = TwInOutplanmasterService.GetById(Id);
|
||||
var model = currentModel;
|
||||
model.CusBillCode = txtCusBillCode.Text;
|
||||
model.WarehouseId = drpWarehouse.SelectedValue;
|
||||
model.WarehouseCode = drpWarehouse.SelectedText;
|
||||
@@ -215,6 +254,7 @@ namespace FineUIPro.Web.CLGL
|
||||
model.InOutType = (int)TwConst.InOutType.出库;
|
||||
model.Category = int.Parse(drpCategory.SelectedValue);
|
||||
model.State = state;
|
||||
SetTransferFields(model);
|
||||
TwInOutplanmasterService.Update(model);
|
||||
}
|
||||
if (drpTypeInt.SelectedValue == ((int)TwConst.TypeInt.散件出库).ToString())
|
||||
@@ -226,6 +266,66 @@ namespace FineUIPro.Web.CLGL
|
||||
{
|
||||
SaveDetail();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调拨草稿保存对方仓库和稳定批次,切换为普通出库时清空调拨字段。
|
||||
/// </summary>
|
||||
private void SetTransferFields(Tw_InOutPlanMaster model)
|
||||
{
|
||||
if (IsTransferType())
|
||||
{
|
||||
model.TransferWarehouseId = drpTransferWarehouse.SelectedValue;
|
||||
if (string.IsNullOrEmpty(model.TransferBatchId))
|
||||
{
|
||||
model.TransferBatchId = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model.TransferWarehouseId = null;
|
||||
model.TransferBatchId = null;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ValidateMaster()
|
||||
{
|
||||
if (string.IsNullOrEmpty(drpWarehouse.SelectedValue) || drpWarehouse.SelectedValue == Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择仓库!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
if (IsTransferType())
|
||||
{
|
||||
if (string.IsNullOrEmpty(drpTransferWarehouse.SelectedValue) || drpTransferWarehouse.SelectedValue == Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择调入仓库!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
if (drpTransferWarehouse.SelectedValue == drpWarehouse.SelectedValue)
|
||||
{
|
||||
Alert.ShowInTop("调出仓库和调入仓库不能相同!", MessageBoxIcon.Warning);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsTransferType()
|
||||
{
|
||||
return drpTypeInt.SelectedValue == ((int)TwConst.TypeInt.调拨出库).ToString();
|
||||
}
|
||||
|
||||
private IDictionary<string, decimal> GetDetailPlanNums()
|
||||
{
|
||||
Dictionary<string, decimal> result = new Dictionary<string, decimal>();
|
||||
foreach (JObject row in Grid2.GetMergedData())
|
||||
{
|
||||
JObject values = row.Value<JObject>("values");
|
||||
result[row.Value<string>("id")] = values.Value<decimal>("PlanNum");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -315,6 +415,14 @@ namespace FineUIPro.Web.CLGL
|
||||
Grid1.Hidden = true;
|
||||
Grid2.Hidden = false;
|
||||
}
|
||||
|
||||
bool isTransfer = IsTransferType();
|
||||
drpWarehouse.Label = isTransfer ? "调出仓库" : "仓库";
|
||||
drpTransferWarehouse.Hidden = !isTransfer;
|
||||
if (!isTransfer)
|
||||
{
|
||||
drpTransferWarehouse.SelectedValue = Const._Null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,15 @@ namespace FineUIPro.Web.CLGL
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpWarehouse;
|
||||
|
||||
/// <summary>
|
||||
/// drpTransferWarehouse 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.DropDownList drpTransferWarehouse;
|
||||
|
||||
/// <summary>
|
||||
/// drpTypeInt 控件。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user