487 lines
15 KiB
C#
487 lines
15 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.CK;
|
|||
|
|
using WMS.Business.SC;
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.Ctrl;
|
|||
|
|
using WMS.Frm.Base;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using WMS.Model.CK;
|
|||
|
|
using WMS.Model.SC;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmSC
|
|||
|
|
{
|
|||
|
|
public partial class FrmScPlan : FormBase
|
|||
|
|
{
|
|||
|
|
public FrmScPlan()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridControlCustom4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单物料明细实体集合
|
|||
|
|
/// </summary>
|
|||
|
|
public List<OrderDetailModel> or_det_List = new List<OrderDetailModel>();
|
|||
|
|
string orderId = "";
|
|||
|
|
private void gridView4_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gridView4.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
orderId = gridView4.GetFocusedRowCellValue("ORDER_ID").ToString();
|
|||
|
|
BindDetailData(orderId);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 审核
|
|||
|
|
/// </summary>
|
|||
|
|
public void Audit()
|
|||
|
|
{
|
|||
|
|
string orderId = "";
|
|||
|
|
string sts = "";
|
|||
|
|
IBussFactory<BussProcessPlan>.Instance().UpdateStsScPlan(orderId, sts);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void gridView5_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
OrdersModel or_Model = new OrdersModel();
|
|||
|
|
List<OrdersModel> or_List = new List<OrdersModel>();
|
|||
|
|
#region 绑定通知单
|
|||
|
|
void BindPlanData()
|
|||
|
|
{
|
|||
|
|
ProcessPlanModel planModel = new ProcessPlanModel();
|
|||
|
|
|
|||
|
|
List<ProcessPlanModel> planList = IBussFactory<BussProcessPlan>.Instance().GetScPlanList(planModel);
|
|||
|
|
if (planList != null)
|
|||
|
|
{
|
|||
|
|
bs_jh.DataSource = planList;
|
|||
|
|
if (planList.Count > 0)
|
|||
|
|
{
|
|||
|
|
string planId = planList[0].PLAN_ID;
|
|||
|
|
BindPlanGoods(planId);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定通知单
|
|||
|
|
/// </summary>
|
|||
|
|
public void BindData()
|
|||
|
|
{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 70);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("数据加载中...");
|
|||
|
|
BindPlanData();
|
|||
|
|
new Thread(delegate ()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
or_Model.CREATE_DATE = System.DateTime.Now.AddDays(-15);
|
|||
|
|
or_Model.STATUS = "0";
|
|||
|
|
if(CkorderId.Trim().Length>0)
|
|||
|
|
{
|
|||
|
|
or_Model.ORDER_ID = CkorderId;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
or_List = IBussFactory<BussOrders>.Instance().GetOrders(or_Model);
|
|||
|
|
if (or_List != null)
|
|||
|
|
{
|
|||
|
|
bs_Orders.DataSource = or_List;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
}
|
|||
|
|
this.Invoke(new MethodInvoker(delegate ()
|
|||
|
|
{
|
|||
|
|
if (or_List != null)
|
|||
|
|
{
|
|||
|
|
if (or_List.Count > 0)
|
|||
|
|
{
|
|||
|
|
string orderId = or_List[0].ORDER_ID;
|
|||
|
|
gdvScPlan.FocusedRowHandle = 0;
|
|||
|
|
|
|||
|
|
BindDetailData(orderId);
|
|||
|
|
}
|
|||
|
|
//
|
|||
|
|
}
|
|||
|
|
if (DevExpress.XtraSplashScreen.SplashScreenManager.ActivateParentOnSplashFormClosing)
|
|||
|
|
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
}));
|
|||
|
|
}).Start();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
#region 绑定通知单明细
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定通知单明细
|
|||
|
|
/// </summary>
|
|||
|
|
public void BindDetailData(string orderID)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
OrderDetailModel or_det_Model = new OrderDetailModel();
|
|||
|
|
or_det_Model.ORDER_ID = orderID;
|
|||
|
|
or_det_List = IBussFactory<BussOrderDetail>.Instance().GetOrderDetail(or_det_Model);
|
|||
|
|
if (or_det_List != null)
|
|||
|
|
{
|
|||
|
|
bindingSource1.DataSource = or_det_List;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
catch (Exception ex)
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
public string CkorderId = "";
|
|||
|
|
private void FrmScPlan_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
BindData();
|
|||
|
|
bs_Select.DataSource = listDetailModel;
|
|||
|
|
dateBeg.DateTime = System.DateTime.Now;
|
|||
|
|
dateEnd.DateTime = System.DateTime.Now.AddDays(2);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gridView5_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
string sBool = gridView5.GetFocusedRowCellValue("IsCheck").ToString();
|
|||
|
|
}
|
|||
|
|
List<PlanGoodsModel> listPlan = new List<PlanGoodsModel>();
|
|||
|
|
/// <summary>
|
|||
|
|
///选择单据
|
|||
|
|
/// </summary>
|
|||
|
|
List<OrderDetailModel> listDetailModel = new List<OrderDetailModel>();
|
|||
|
|
OrderDetailModel deTail = new OrderDetailModel();
|
|||
|
|
private void gridView5_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName == "IsCheck")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
OrderDetailModel googdsID = gridView5.GetFocusedRow() as OrderDetailModel;
|
|||
|
|
string goodsId = googdsID.GOOD_ID;
|
|||
|
|
string orderID = googdsID.ORDER_ID;
|
|||
|
|
if (e.Value.ToString() == "True")
|
|||
|
|
{
|
|||
|
|
if (listDetailModel.Count(r => r.GOOD_ID == goodsId && r.ORDER_ID == orderID) == 0)
|
|||
|
|
{
|
|||
|
|
listDetailModel.Add(googdsID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
listDetailModel.Remove(googdsID);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (listDetailModel != null)
|
|||
|
|
{
|
|||
|
|
bs_Select.DataSource = listDetailModel;
|
|||
|
|
gdv_Goods.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void bindingSource2_CurrentChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除选择明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons5_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (listDetailModel == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (listDetailModel.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
listDetailModel.Remove(deTail);
|
|||
|
|
gdv_Goods.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void gdv_Goods_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (listDetailModel == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (listDetailModel.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
deTail = gdv_Goods.GetFocusedRow() as OrderDetailModel;
|
|||
|
|
// t_num.Text = deTail.GOODS_NUM.ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
List<GoodsMaterialModel> listProess = new List<GoodsMaterialModel>();
|
|||
|
|
private void ctrlButtons4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (listDetailModel == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (listDetailModel.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
gdv_Goods.CloseEditor();
|
|||
|
|
gdv_Goods.UpdateCurrentRow();
|
|||
|
|
|
|||
|
|
for (int i = 0; i < listDetailModel.Count; i++)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (listDetailModel[i].NOWNUM == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("数量不能为0");
|
|||
|
|
gdv_Goods.FocusedRowHandle = i;
|
|||
|
|
this.gdv_Goods.FocusedColumn = this.gdmNum;//某一列
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
listProess.Clear();
|
|||
|
|
listProess = IBussFactory<BussPlanGoods>.Instance().GetScPlanData(listDetailModel);
|
|||
|
|
if (listProess != null)
|
|||
|
|
{
|
|||
|
|
bs_jhInfo.DataSource = listProess;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctr_goods_Button_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
DataTable tb = ctr_goods.SelectTable;
|
|||
|
|
|
|||
|
|
if (tb != null)
|
|||
|
|
{
|
|||
|
|
if (tb.Rows.Count > 0)
|
|||
|
|
{
|
|||
|
|
List<GoodsInfoModel> listGoodsInfoModel = ConvertHelper<GoodsInfoModel>.ConvertToList(ctr_goods.SelectTable);
|
|||
|
|
if (listGoodsInfoModel != null)
|
|||
|
|
{
|
|||
|
|
foreach (GoodsInfoModel infoModel in listGoodsInfoModel)
|
|||
|
|
{
|
|||
|
|
OrderDetailModel prderModel = new OrderDetailModel();
|
|||
|
|
prderModel.GOOD_ID = infoModel.GOODS_ID;
|
|||
|
|
prderModel.Good_name = infoModel.GOODS_NAME;
|
|||
|
|
prderModel.GOODS_NUM = 0;
|
|||
|
|
prderModel.ORDER_ID = "";
|
|||
|
|
listDetailModel.Add(prderModel);
|
|||
|
|
}
|
|||
|
|
bs_Select.DataSource = listDetailModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
List<PlanGoodsModel> goodsProessList = new List<PlanGoodsModel>();
|
|||
|
|
|
|||
|
|
if (listProess == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (listProess.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
foreach (GoodsMaterialModel goodsMode in listProess)
|
|||
|
|
{
|
|||
|
|
PlanGoodsModel planModel = new PlanGoodsModel();
|
|||
|
|
planModel.GOODS_ID = goodsMode.GOODS_ID;
|
|||
|
|
if (planModel.GOODS_ID.Trim().Length == 0)
|
|||
|
|
{
|
|||
|
|
planModel.GOODS_ID = goodsMode.MATERIAL_ID;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
planModel.NEED_NUM = goodsMode.NEED_NUM;
|
|||
|
|
planModel.GOODS_NUM = goodsMode.SC_NUM;
|
|||
|
|
planModel.MATERIAL_ID = goodsMode.MATERIAL_ID;
|
|||
|
|
planModel.OUT_NUM = goodsMode.OUT_NUM;
|
|||
|
|
planModel.NEED_NUM = goodsMode.NEED_NUM;
|
|||
|
|
planModel.LLSTS = goodsMode.REMARK;
|
|||
|
|
goodsProessList.Add(planModel);
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
string begDate = dateBeg.EditValue.ToString();
|
|||
|
|
string endDate = dateEnd.EditValue.ToString();
|
|||
|
|
string errtext = IBussFactory<BussPlanGoods>.Instance().AddPlanDataList(begDate, endDate, goodsProessList, userData.STORAGE_ID, userData.USER_ID, orderId);
|
|||
|
|
if(errtext.Trim().Length==0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("任务生成成功");
|
|||
|
|
orderId = "";
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 0;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
public override void Refresh()
|
|||
|
|
{
|
|||
|
|
BindPlanData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void ctrlButtons3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdvScPlan.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (gdvScPlan.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择要生产的订单!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string sts = gdvScPlan.GetFocusedRowCellValue("STATUS").ToString();
|
|||
|
|
if (sts!="0")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("已经领料,不能重复生成任务");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string planId = gdvScPlan.GetFocusedRowCellValue("PLAN_ID").ToString();
|
|||
|
|
string err =IBussFactory<BussProcessPlan>.Instance().ExceOrderPlan(planId, userData.USER_ID);
|
|||
|
|
if(err.Trim().Length==0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("领料任务成功");
|
|||
|
|
BindData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
void BindPlanGoods(string planId)
|
|||
|
|
{
|
|||
|
|
PlanGoodsModel planGoods = new PlanGoodsModel();
|
|||
|
|
planGoods.PLAN_ID = planId;
|
|||
|
|
List<PlanGoodsModel> goodsPLan = IBussFactory<BussPlanGoods>.Instance().GetPlanGoodsList(planGoods);
|
|||
|
|
if (goodsPLan != null)
|
|||
|
|
{
|
|||
|
|
bindingSource2.DataSource = goodsPLan;
|
|||
|
|
|
|||
|
|
// bindingSource2
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
void BindPlanInfoData(string orderID)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void gdvScPlan_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdvScPlan.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string planId = gdvScPlan.GetFocusedRowCellValue("PLAN_ID").ToString();
|
|||
|
|
BindPlanGoods(planId);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons6_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gridView4.RowCount == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (or_det_List.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
foreach (OrderDetailModel orderInfo in or_det_List)
|
|||
|
|
{
|
|||
|
|
orderInfo.NOWNUM = orderInfo.GOODS_NUM;
|
|||
|
|
}
|
|||
|
|
orderId = or_det_List[0].ORDER_ID;
|
|||
|
|
listDetailModel.AddRange(or_det_List);
|
|||
|
|
gdv_Goods.RefreshData();
|
|||
|
|
xtraTabControl2.SelectedTabPageIndex = 1;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void gdvScPlan_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName == "STATUS")
|
|||
|
|
{
|
|||
|
|
if (e.Value != null)
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "新增";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "领料成功";
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
e.DisplayText = "打印成功";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ctrlButtons7_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|