2596 lines
92 KiB
C#
2596 lines
92 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.Windows.Forms;
|
||
using WMS.Frm.Base;
|
||
|
||
using WMS.Model.CK;
|
||
using WMS.Common;
|
||
|
||
using WMS.Model.Stock;
|
||
using WMS.Model.Base;
|
||
using DevExpress.XtraGrid.Columns;
|
||
using DevExpress.XtraEditors.Repository;
|
||
using System.Threading.Tasks;
|
||
using DevExpress.XtraReports.UI;
|
||
using WMS.FrmBaseData;
|
||
using WMS.Ctrl;
|
||
using System.Text.RegularExpressions;
|
||
using WMS.Model.SystemManage;
|
||
|
||
using System.Threading;
|
||
|
||
using System.Collections;
|
||
using WMS.Business;
|
||
using WMS.Business.Common;
|
||
using WMS.Business.CK;
|
||
using WMS.Business.Base;
|
||
|
||
namespace WMS.FrmCK
|
||
{
|
||
public partial class FrmOrders : FormBase
|
||
{
|
||
#region 变量声明
|
||
/// <summary>
|
||
/// 通知单实体
|
||
/// </summary>
|
||
public OrdersModel or_Model = new OrdersModel();
|
||
|
||
/// <summary>
|
||
/// 通知单实体集合
|
||
/// </summary>
|
||
public List<OrdersModel> or_List = new List<OrdersModel>();
|
||
|
||
/// <summary>
|
||
/// 通知单物料明细实体
|
||
/// </summary>
|
||
public OrderDetailModel or_det_Model = new OrderDetailModel();
|
||
|
||
/// <summary>
|
||
/// 通知单物料明细实体集合
|
||
/// </summary>
|
||
public List<OrderDetailModel> or_det_List = new List<OrderDetailModel>();
|
||
|
||
/// <summary>
|
||
/// 修改前的物料明细实体集合
|
||
/// </summary>
|
||
public List<OrderDetailModel> oldor_det_List = new List<OrderDetailModel>();
|
||
/// <summary>
|
||
/// 选择仓库编号
|
||
/// </summary>
|
||
public string storage_id;
|
||
|
||
/// <summary>
|
||
/// 所选库存物料
|
||
/// </summary>
|
||
public List<MIStockModel> mi_list = new List<MIStockModel>();
|
||
|
||
/// <summary>
|
||
/// 全选判断
|
||
/// </summary>
|
||
bool m_status = false;
|
||
|
||
/// <summary>
|
||
/// gridview 焦点行
|
||
/// </summary>
|
||
public int rowFocus = 0;
|
||
|
||
/// <summary>
|
||
/// 单位
|
||
/// </summary>
|
||
private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lueUnits = new RepositoryItemLookUpEdit();
|
||
/// <summary>
|
||
/// 操作标志 0 新增,1 编辑
|
||
/// </summary>
|
||
int flg = 0;
|
||
|
||
#endregion
|
||
|
||
public FrmOrders()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
private void FrmOrders_Load(object sender, EventArgs e)
|
||
{
|
||
|
||
|
||
//通用查询
|
||
|
||
FrmSelectModle = new OrdersModel();
|
||
|
||
|
||
//选择当前用户有权限的仓库
|
||
|
||
lue_CUSTOMERPROVINCE.LoadData();
|
||
lue_CUSTOMERCITY.LoadData();
|
||
lue_CUSTOMERADDRESS.LoadData();
|
||
lop_type.LoadData();
|
||
look_ck.LoadData();
|
||
loop_CkType.LoadData();
|
||
BindStatus();
|
||
|
||
BindDataSource();
|
||
|
||
BindData();
|
||
|
||
//BindDetailData();
|
||
|
||
if (frmButtonItem.ContainsKey("FillKD"))
|
||
{
|
||
frmButtonItem["FillKD"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = true;
|
||
}
|
||
DicCreateMan.TextBoxFlag = userData.USER_ID;
|
||
DicCreateMan.TextBoxValue = userData.NAME;
|
||
de_CREATE_DATE.EditValue = System.DateTime.Now.Date;
|
||
decheck.EditValue = System.DateTime.Now.Date;
|
||
|
||
//选择物料控件
|
||
ctr_Goods.IsSqlWhere = true;
|
||
ctr_Goods.SqlStr = " where 1=1 and goods_type_id not in (select goods_type_id from t_base_goods_type WHERE t_base_goods_type.goods_type_name = '包材')";
|
||
|
||
//创建人相同部门
|
||
DicCreateMan.IsSqlWhere = true;
|
||
DicCreateMan.SqlStr = " where COM_ID = '" + userData.COM_ID + "'";
|
||
|
||
//重量单位下拉框
|
||
lueweiunit.NullText = "";
|
||
lueweiunit.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("VC_DICTIONARY_NAME", "重量单位"));
|
||
lueweiunit.ValueMember = "VC_CHAR_VALUE";
|
||
lueweiunit.DisplayMember = "VC_DICTIONARY_NAME";
|
||
DataTable strResult = new DataTable();
|
||
try
|
||
{
|
||
strResult = IBussFactory<BussCommon>.Instance().GetCustomCtrlData("t_sys_dictionary_tab", "VC_CHAR_VALUE", "VC_DICTIONARY_NAME", " VC_DICTIONARY_TYPE = 'kg_unit' and c_flag = '1'", "");
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
if (strResult != null)
|
||
{
|
||
lueweiunit.DataSource = strResult;
|
||
}
|
||
|
||
//
|
||
lueUnits.NullText = "";
|
||
lueUnits.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UNIT_NAME", "单位"));
|
||
lueUnits.ValueMember = "UNIT";
|
||
lueUnits.DisplayMember = "UNIT_NAME";
|
||
de_CREATE_DATE.EditValue = System.DateTime.Now.ToString();
|
||
//单位下拉框
|
||
lueUnit.NullText = "";
|
||
lueUnit.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("VC_DICTIONARY_NAME", "单位"));
|
||
lueUnit.ValueMember = "VC_CHAR_VALUE";
|
||
lueUnit.DisplayMember = "VC_DICTIONARY_NAME";
|
||
|
||
try
|
||
{
|
||
strResult = IBussFactory<BussCommon>.Instance().GetCustomCtrlData("t_sys_dictionary_tab", "VC_CHAR_VALUE", "VC_DICTIONARY_NAME", " VC_DICTIONARY_TYPE = 'vc_uom' and c_flag = '1'", "");
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
if (strResult != null)
|
||
{
|
||
lueweiunit.DataSource = strResult;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
#region 通用查询
|
||
/// <summary>
|
||
/// 通用查询
|
||
/// </summary>
|
||
/// <param name="table"></param>
|
||
public override void LoadListData(DataTable table)
|
||
{
|
||
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
||
{
|
||
gridView1.FocusedRowHandle += 1;
|
||
or_List = ConvertHelper<OrdersModel>.ConvertToList(table);
|
||
bs_Orders.DataSource = or_List;
|
||
gr_Order.DataSource = or_List;
|
||
gridView1.RefreshData();
|
||
}
|
||
else
|
||
{
|
||
or_det_List = ConvertHelper<OrderDetailModel>.ConvertToList(table);
|
||
bs_OrderDetail.DataSource = or_det_List;
|
||
gr_OrderDetail.DataSource = or_det_List;
|
||
gridView2.RefreshData();
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 数据绑定
|
||
|
||
#region 绑定通知单
|
||
/// <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("数据加载中...");
|
||
|
||
try
|
||
|
||
{
|
||
if(frmVal!="0")
|
||
{
|
||
or_Model.Ck_type = frmVal;
|
||
}
|
||
or_Model.CREATE_DATE = System.DateTime.Now.AddDays(-15);
|
||
|
||
or_List = IBussFactory<BussOrders>.Instance().GetOrders(or_Model);
|
||
if (or_List != null)
|
||
{
|
||
if (or_List.Count > 0)
|
||
{
|
||
or_Model = or_List[0];
|
||
gridView1.FocusedRowHandle = 0;
|
||
BindDetailData();
|
||
}
|
||
bs_Orders.DataSource = or_List;
|
||
gr_Order.DataSource = or_List;
|
||
bs_OrdersEdit.DataSource = or_Model;
|
||
}
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
}
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定通知单明细
|
||
/// <summary>
|
||
/// 绑定通知单明细
|
||
/// </summary>
|
||
public void BindDetailData()
|
||
{
|
||
if (or_Model != null)
|
||
{
|
||
try
|
||
{
|
||
or_det_Model = new OrderDetailModel();
|
||
or_det_Model.BUSINESSID = or_Model.BUSINESSORDERID;
|
||
or_det_Model.ORDER_ID = or_Model.ORDER_ID;
|
||
|
||
or_det_List = IBussFactory<BussOrderDetail>.Instance().GetOrderDetail(or_det_Model);
|
||
if (or_det_List != null)
|
||
{
|
||
if (or_det_List.Count > 0)
|
||
{
|
||
or_det_Model = or_det_List[0];
|
||
}
|
||
bindingSource1.DataSource = or_det_List;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定状态
|
||
/// <summary>
|
||
/// 绑定状态 确认状态(0=未确认,1=已确认,-1=关闭,-2=退货)
|
||
/// </summary>
|
||
public void BindStatus()
|
||
{
|
||
DataTable dt_lep = new DataTable();
|
||
dt_lep.Columns.Add("编号", typeof(string));
|
||
dt_lep.Columns.Add("状态", typeof(string));
|
||
dt_lep.Rows.Add("0", "未确认");
|
||
dt_lep.Rows.Add("1", "已确认");
|
||
dt_lep.Rows.Add("2", "已生成");
|
||
dt_lep.Rows.Add("4", "已经完成");
|
||
dt_lep.Rows.Add("3", "已拣货");
|
||
dt_lep.Rows.Add("5", "已下发");
|
||
dt_lep.Rows.Add("-1", "关闭");
|
||
dt_lep.Rows.Add("-2", "退货");
|
||
dt_lep.AcceptChanges();
|
||
|
||
lue_STATUS.Properties.DataSource = dt_lep;
|
||
lue_STATUS.Properties.DisplayMember = "状态";
|
||
lue_STATUS.Properties.ValueMember = "编号";
|
||
lue_STATUS.ItemIndex = 4;
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定来源
|
||
/// <summary>
|
||
/// 绑定来源 数据来源(0 新增 ,1 线上,2 ERP ,3 导入)
|
||
/// </summary>
|
||
public void BindDataSource()
|
||
{
|
||
DataTable dt_lep = new DataTable();
|
||
dt_lep.Columns.Add("编号", typeof(string));
|
||
dt_lep.Columns.Add("状态", typeof(string));
|
||
dt_lep.Rows.Add("0", "新增");
|
||
dt_lep.Rows.Add("1", "线上");
|
||
dt_lep.Rows.Add("2", "ERP");
|
||
dt_lep.Rows.Add("3", "导入");
|
||
dt_lep.AcceptChanges();
|
||
|
||
lue_DATASOURCE.Properties.DataSource = dt_lep;
|
||
lue_DATASOURCE.Properties.DisplayMember = "状态";
|
||
lue_DATASOURCE.Properties.ValueMember = "编号";
|
||
lue_DATASOURCE.ItemIndex = 0;
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 事件
|
||
|
||
#region 按钮事件
|
||
|
||
#region 新增事件
|
||
/// <summary>
|
||
/// 新增
|
||
/// </summary>
|
||
public void Add()
|
||
{
|
||
|
||
flg = 0;
|
||
//label19.Visible = false;
|
||
//lup_KDCom.Visible = false;
|
||
label16.Visible = false;
|
||
ctrSearch.Visible = false;
|
||
xtraTabPage2.PageEnabled = true;
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
ctr_CUSTOMERNAME.Focus();
|
||
or_Model = new OrdersModel();
|
||
or_Model.EXPRESSNO = "";
|
||
or_Model.STATUS = "0";
|
||
or_Model.DATASOURCE = "0";
|
||
or_Model.CREATE_MAN = userData.USER_ID;
|
||
or_Model.Create_man_Name = userData.NAME;
|
||
or_Model.CREATE_DATE = System.DateTime.Now;
|
||
or_Model.CS_OPERATOR_DATE = System.DateTime.Now;
|
||
or_Model.Order_source = "手动新增";
|
||
or_Model.Storage_id = userData.STORAGE_ID;
|
||
bs_OrdersEdit.DataSource = or_Model;
|
||
look_ck.EditValue = userData.STORAGE_ID;
|
||
DicCreateMan.TextBoxValue = userData.NAME;
|
||
DicCreateMan.TextBoxFlag = userData.USER_ID;
|
||
DicCheckMan.TextBoxFlag = userData.USER_ID;
|
||
DicCheckMan.TextBoxValue = userData.NAME;
|
||
ctr_CUSTOMERNAME.TextBoxValue = "";
|
||
|
||
lue_STATUS.Enabled = false;
|
||
lue_DATASOURCE.Enabled = false;
|
||
decheck.Enabled = false;
|
||
de_CREATE_DATE.Enabled = false;
|
||
DicCheckMan.Enabled = false;
|
||
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = true;
|
||
//colSCALE_UNIT.OptionsColumn.AllowEdit = true;
|
||
colUNIT.OptionsColumn.AllowEdit = true;
|
||
or_Model.ORDER_ID = "";
|
||
txt_CKID.Enabled = false;
|
||
//清空已有明细
|
||
if (or_det_List != null)
|
||
{
|
||
or_det_List.Clear();
|
||
bs_OrderDetail.DataSource = or_det_List;
|
||
gridView2.RefreshData();
|
||
}
|
||
if (frmButtonItem.ContainsKey("Import"))
|
||
{
|
||
frmButtonItem["Import"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Cancel"))
|
||
{
|
||
frmButtonItem["Cancel"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Add"))
|
||
{
|
||
frmButtonItem["Add"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Search"))
|
||
{
|
||
frmButtonItem["Search"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
frmButtonItem["Edit"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Del"))
|
||
{
|
||
frmButtonItem["Del"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Select"))
|
||
{
|
||
frmButtonItem["Select"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
frmButtonItem["Save"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("FillKD"))
|
||
{
|
||
frmButtonItem["FillKD"].Enabled = false;
|
||
}
|
||
xtraTabPage2.Text = "出库物料明细-" + or_Model.ORDER_ID;
|
||
}
|
||
#endregion
|
||
|
||
#region 选择物料
|
||
/// <summary>
|
||
/// 选择物料
|
||
/// </summary>
|
||
public void Select()
|
||
{
|
||
ctr_Goods.t_dictonary_ButtonClick(null, null);
|
||
if(gridView2.RowCount>0)
|
||
{
|
||
gridView2.FocusedRowHandle = 0;
|
||
gridView2.Focus();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 拣货
|
||
/// <summary>
|
||
/// 拣货
|
||
/// </summary>
|
||
public void JianHuo()
|
||
{
|
||
gridView1.RefreshData();
|
||
gridView1.CloseEditor();
|
||
if (or_List.Count(s => s.IsCheck && (s.STATUS == "1"|| s.STATUS=="2"))> 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("出库单正在出库,不能再次出库!");
|
||
return;
|
||
}
|
||
if (or_List.Count(s => s.IsCheck && (s.STATUS == "-1" || s.STATUS == "-2")) > 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("单据已经关闭或者退货!");
|
||
return;
|
||
}
|
||
//if (or_List.Count(s => s.IsCheck && s.STATUS == "2") > 0)
|
||
//{
|
||
|
||
// if (SystemCommon.ShowMessageBoxResult("当前所选含有已生成过拣货单的通知单,是否再次生成") != DialogResult.OK)
|
||
// {
|
||
// return;
|
||
// }
|
||
//}
|
||
|
||
List<OrdersModel> listOrder = or_List.FindAll(r=>r.STATUS=="0" && r.IsCheck);
|
||
if(listOrder.Count>0)
|
||
{
|
||
IBussFactory<BussPickingWave>.Instance().PickTask(listOrder);
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("选择要拣选的单子!");
|
||
return;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 单据提交
|
||
/// <summary>
|
||
/// 单据提交
|
||
/// </summary>
|
||
public void Confirm()
|
||
{
|
||
gridView1.CloseEditor();
|
||
int count = or_List.Count(r => r.IsCheck);
|
||
if (count <= 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择出库单!");
|
||
return;
|
||
}
|
||
//查询选择的集合当中是否存在已确认的出库单
|
||
if (or_List.Count(s => s.IsCheck &&s.STATUS == "1") > 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("编号为 " + or_List.Find(s => s.IsCheck && s.STATUS == "1").ORDER_ID + " 的通知单已经确认!");
|
||
return;
|
||
}
|
||
if (SystemCommon.ShowMessageBoxResult("当前选择" + count.ToString() + "个通知单,确定此操作?") != DialogResult.OK)
|
||
{
|
||
return;
|
||
}
|
||
string errText = "";
|
||
foreach (OrdersModel model in or_List.FindAll(s => s.IsCheck))
|
||
{
|
||
model.STATUS = "1";
|
||
|
||
try
|
||
{
|
||
errText = IBussFactory<BussOrders>.Instance().InsOrUpdOrders(model, 1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
|
||
or_Model = new OrdersModel();
|
||
BindData();
|
||
//BindDetailData();
|
||
|
||
return;
|
||
}
|
||
}
|
||
if (errText == "")
|
||
{
|
||
if (errText == "")
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("操作成功!");
|
||
|
||
|
||
or_Model = new OrdersModel();
|
||
BindData();
|
||
//BindDetailData();
|
||
|
||
if (frmButtonItem.ContainsKey("Add"))
|
||
{
|
||
frmButtonItem["Add"].Enabled = true;
|
||
}
|
||
if (or_Model.STATUS == "0")
|
||
{
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
}
|
||
ChargeButton();
|
||
gridView1.FocusedRowHandle = rowFocus;
|
||
|
||
xtraTabPage2.Text = "出库物料明细-" + or_Model.ORDER_ID;
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("操作失败!");
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
List<JWGoodsInfoModel> _li = new List<JWGoodsInfoModel>();
|
||
|
||
#region 查询
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
public void Search()
|
||
{
|
||
|
||
if ( ctrSearch.SelectTable.Rows.Count != 0 )
|
||
{
|
||
|
||
List<OrdersModel> list_Or = new List<OrdersModel>();
|
||
|
||
try
|
||
{
|
||
|
||
|
||
list_Or = IBussFactory<BussOrders>.Instance().GetOrders(or_Model);
|
||
if (list_Or != null)
|
||
{ //}
|
||
if (list_Or.Count <= 0)
|
||
{
|
||
bs_Orders.DataSource = list_Or;
|
||
gr_Order.DataSource = list_Or;
|
||
gridView1.RefreshData();
|
||
return;
|
||
}
|
||
|
||
if (list_Or.Count <= 0)
|
||
{
|
||
bs_Orders.DataSource = null;
|
||
gridView1.RefreshData();
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接出现错误!");
|
||
return;
|
||
}
|
||
//if (lup_KDCom.EditValue != null)
|
||
//{
|
||
// //List<OrdersModel> list = list_Or.FindAll(r => r.LOG_COM_ID == lup_KDCom.EditValue.ToString());
|
||
// list_Or = list_Or.FindAll(r => r.LOG_COM_ID == lup_KDCom.EditValue.ToString());
|
||
|
||
|
||
if (_li.Count > 0)
|
||
{
|
||
//查询所有订单明细
|
||
OrderDetailModel od_Model = new OrderDetailModel();
|
||
List<OrderDetailModel> list_ODr = new List<OrderDetailModel>();
|
||
|
||
list_ODr = IBussFactory<BussOrderDetail>.Instance().GetOrderDetail(od_Model);
|
||
|
||
|
||
List<OrdersModel> list = new List<OrdersModel>();
|
||
foreach (JWGoodsInfoModel goods in _li)
|
||
{
|
||
//foreach (OrderDetailModel or in list_ODr.FindAll(r => r.GOOD_ID == goods.GOODS_ID))
|
||
//{
|
||
// foreach (OrdersModel o in list_Or.FindAll(r => r.ORDER_ID == or.ORDER_ID))
|
||
// {
|
||
// list.Add(o);
|
||
// }
|
||
//}
|
||
}
|
||
if (list.Count <= 0)
|
||
{
|
||
bs_Orders.DataSource = null;
|
||
gridView1.RefreshData();
|
||
return;
|
||
}
|
||
list_Or = list;
|
||
}
|
||
|
||
bs_Orders.DataSource = list_Or;
|
||
gr_Order.DataSource = list_Or;
|
||
|
||
BindDetailData();
|
||
gridView1.RefreshData();
|
||
bs_OrdersEdit.DataSource = list_Or[0];
|
||
return;
|
||
|
||
}
|
||
bs_OrdersEdit.EndEdit();
|
||
|
||
or_Model = bs_OrdersEdit.DataSource as OrdersModel;
|
||
if (lue_STATUS.EditValue == "4")
|
||
{
|
||
or_Model.STATUS = "";
|
||
}
|
||
|
||
string str_list = "";
|
||
try
|
||
{
|
||
or_List = IBussFactory<BussOrders>.Instance().GetOrders(or_Model);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
}
|
||
if (str_list == "")
|
||
{
|
||
or_List.Clear();
|
||
bs_Orders.DataSource = or_List;
|
||
return;
|
||
}
|
||
|
||
bs_Orders.DataSource = or_List;
|
||
gr_Order.DataSource = or_List;
|
||
gridView1.RefreshData();
|
||
gridView1.FocusedRowHandle = 0;
|
||
gridView1_RowClick(null, null);
|
||
}
|
||
#endregion
|
||
|
||
#region 取消
|
||
/// <summary>
|
||
/// 取消
|
||
/// </summary>
|
||
public void Cancel()
|
||
{
|
||
txt_CKID.Enabled = true;
|
||
if (frmButtonItem.ContainsKey("Add"))
|
||
{
|
||
frmButtonItem["Add"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Import"))
|
||
{
|
||
frmButtonItem["Import"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Search"))
|
||
{
|
||
frmButtonItem["Search"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Cancel"))
|
||
{
|
||
frmButtonItem["Cancel"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
frmButtonItem["Save"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Select"))
|
||
{
|
||
frmButtonItem["Select"].Enabled = false;
|
||
}
|
||
|
||
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
if (or_Model.STATUS == "0")
|
||
{
|
||
frmButtonItem["Edit"].Enabled = true;
|
||
}
|
||
else
|
||
frmButtonItem["Edit"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
if (or_Model.STATUS == "0")
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = true;
|
||
}
|
||
else
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Del"))
|
||
{
|
||
if (or_Model.STATUS == "0")
|
||
{
|
||
frmButtonItem["Del"].Enabled = true;
|
||
}
|
||
else
|
||
frmButtonItem["Del"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
if (or_Model.STATUS == "1")
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = true;
|
||
}
|
||
else
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = false;
|
||
}
|
||
}
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
xtraTabPage2.PageEnabled = false;
|
||
|
||
label16.Visible = true;
|
||
ctrSearch.Visible = true;
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 刷新
|
||
/// <summary>
|
||
/// 刷新
|
||
/// </summary>
|
||
public void Refresh()
|
||
{
|
||
_li.Clear();
|
||
Cancel();
|
||
or_Model = new OrdersModel();
|
||
BindData();
|
||
//gridView1_FocusedRowChanged(null, null);
|
||
BindDetailData();
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 编辑
|
||
/// <summary>
|
||
/// 编辑
|
||
/// </summary>
|
||
public void Edit()
|
||
{
|
||
flg = 1;
|
||
xtraTabPage2.PageEnabled = true;
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
rowFocus = gridView1.FocusedRowHandle;
|
||
//按钮可编辑状态改变
|
||
if (frmButtonItem.ContainsKey("Cancel"))
|
||
{
|
||
frmButtonItem["Cancel"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
frmButtonItem["Save"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Add"))
|
||
{
|
||
frmButtonItem["Add"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Del"))
|
||
{
|
||
frmButtonItem["Del"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Select"))
|
||
{
|
||
frmButtonItem["Select"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
frmButtonItem["Edit"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintJH"))
|
||
{
|
||
frmButtonItem["PrintJH"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintKD"))
|
||
{
|
||
frmButtonItem["PrintKD"].Enabled = false;
|
||
}
|
||
if (or_det_List.Count > 0)
|
||
{
|
||
if (frmButtonItem.ContainsKey("Clear"))
|
||
{
|
||
frmButtonItem["Clear"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Move"))
|
||
{
|
||
frmButtonItem["Move"].Enabled = true;
|
||
}
|
||
}
|
||
//控件可编辑状态
|
||
decheck.Enabled = false;
|
||
lue_STATUS.Enabled = false;
|
||
lue_DATASOURCE.Enabled = false;
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = true;
|
||
//colSCALE_UNIT.OptionsColumn.AllowEdit = true;
|
||
colUNIT.OptionsColumn.AllowEdit = true;
|
||
|
||
or_Model = bs_OrdersEdit.DataSource as OrdersModel;
|
||
txt_CKID.Enabled = false;
|
||
|
||
label16.Visible = false;
|
||
ctrSearch.Visible = false;
|
||
|
||
or_det_List = bindingSource1.DataSource as List<OrderDetailModel>;
|
||
if(or_det_List!=null)
|
||
bs_OrderDetail.DataSource = or_det_List;
|
||
}
|
||
|
||
|
||
#endregion
|
||
|
||
#region 移除物料
|
||
/// <summary>
|
||
/// 移除物料
|
||
/// </summary>
|
||
public void Move()
|
||
{
|
||
if (gridView2.SelectedRowsCount > 0)
|
||
{
|
||
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("确定删除所选物料"))
|
||
{
|
||
OrderDetailModel model = new OrderDetailModel();
|
||
model = gridView2.GetFocusedRow() as OrderDetailModel;
|
||
or_det_List.Remove(model);
|
||
gridView2.RefreshData();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择物料!");
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 清空物料
|
||
/// <summary>
|
||
/// 清空物料
|
||
/// </summary>
|
||
public void Clear()
|
||
{
|
||
or_det_List = bs_OrderDetail.DataSource as List<OrderDetailModel>;
|
||
if (or_det_List.Count > 0)
|
||
{
|
||
if (SystemCommon.ShowMessageBoxResult("确定删除") == DialogResult.OK)
|
||
{
|
||
or_det_List.Clear();
|
||
bs_OrderDetail.DataSource = or_det_List;
|
||
gridView2.RefreshData();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("您未选择物料!");
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 删除
|
||
/// <summary>
|
||
/// 删除
|
||
/// </summary>
|
||
public void Del()
|
||
{
|
||
gridView1.CloseEditor();
|
||
int count = or_List.Count(r => r.IsCheck);
|
||
if (count <= 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择出库单!");
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
if (or_List.FindAll(s => s.IsCheck).FindAll(r => r.STATUS != "0").Count > 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("编号为 " + or_List.FindAll(s => s.IsCheck).FindAll(r => r.STATUS != "0")[0].ORDER_ID + " 的通知单无法删除!");
|
||
return;
|
||
}
|
||
if (SystemCommon.ShowMessageBoxResult("当前选择" + count.ToString() + "个通知单,确定删除?") != DialogResult.OK)
|
||
{
|
||
return;
|
||
}
|
||
|
||
|
||
List<OrdersModel> orde_list = new List<OrdersModel>();
|
||
orde_list = or_List.FindAll(r => r.IsCheck);
|
||
string str_result = "";
|
||
foreach (OrdersModel model in orde_list)
|
||
{
|
||
try
|
||
{
|
||
str_result = IBussFactory<BussOrders>.Instance().DelOrders(model);
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
}
|
||
}
|
||
if (str_result == "")
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("删除成功!");
|
||
BindData();
|
||
or_det_List.Clear();
|
||
BindDetailData();
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("删除失败!");
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 导入
|
||
/// <summary>
|
||
/// 导入
|
||
/// </summary>
|
||
public void Import()
|
||
{
|
||
OpenFileDialog fileDialog = new OpenFileDialog();
|
||
fileDialog.Title = "导入出库明细资料";
|
||
fileDialog.Filter = "Excel文件(*.xls;*.xlsx)|*.xls;*.xlsx";
|
||
DialogResult dialogResult = fileDialog.ShowDialog(this);
|
||
if (dialogResult == DialogResult.OK)
|
||
{
|
||
|
||
Hashtable ht = new Hashtable();
|
||
ht.Add("GOOD_ID", "物料名称");
|
||
ht.Add("Good_name", "物料名称ISNAME");
|
||
ht.Add("GOODS_NUM", "物料数量");
|
||
//ht.Add("PY_NAME", "拼音简称");
|
||
//ht.Add("TELEPHONE", "手机");
|
||
//ht.Add("PHONE", "联系电话");
|
||
//ht.Add("FAX", "联系传真");
|
||
//ht.Add("ADDRESS", "联系地址");
|
||
//ht.Add("REMARK", "备注");
|
||
List<OrderDetailModel> list_temp = NPOIHelper<OrderDetailModel>.Import(fileDialog, ht);
|
||
if (list_temp == null || list_temp.Count <= 0)
|
||
{
|
||
if (frmButtonItem.ContainsKey("SaveImport"))
|
||
{
|
||
frmButtonItem["SaveImport"].Enabled = false;
|
||
}
|
||
return;
|
||
}
|
||
JWGoodsInfoModel mode = new JWGoodsInfoModel();
|
||
or_det_List.Clear();
|
||
list_temp.ForEach(r =>
|
||
{
|
||
try
|
||
{
|
||
List < JWGoodsInfoModel > str_model = IBussFactory<BussGoods>.Instance().GetGoodsList(r.GOOD_ID, "", "", "");
|
||
if (str_model != null)
|
||
{
|
||
if (str_model.Count > 0)
|
||
{
|
||
mode = str_model[0];
|
||
//r.UNIT = mode.UNIT;
|
||
//r.Cost_price = mode.COST_PRICE;
|
||
}
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
|
||
}
|
||
r.ORDER_ID = txt_CKID.Text;
|
||
or_det_List.Add(r);
|
||
});
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
bs_OrderDetail.DataSource = or_det_List;
|
||
gr_OrderDetail.DataSource = or_det_List;
|
||
gridView2.RefreshData();
|
||
gr_OrderDetail.RefreshDataSource();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 保存
|
||
/// <summary>
|
||
/// 保存
|
||
/// </summary>
|
||
public void Save()
|
||
{
|
||
|
||
if (flg == 0)//新增
|
||
{
|
||
#region 新增
|
||
//if (ctr_CUSTOMERNAME.TextBoxValue == "")
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("请选择客户!");
|
||
// ctr_CUSTOMERNAME.Focus();
|
||
// xtraTabControl1.SelectedTabPageIndex = 0;
|
||
// return;
|
||
//}
|
||
//if (lue_CUSTOMERADDRESS.Text == "")
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("请选择地区!");
|
||
// lue_CUSTOMERADDRESS.Focus();
|
||
// xtraTabControl1.SelectedTabPageIndex = 0;
|
||
// return;
|
||
//}
|
||
|
||
|
||
//int c = or_det_List.Count;
|
||
//List<OrderDetailModel> _li = new List<OrderDetailModel>();
|
||
|
||
or_det_List = bs_OrderDetail.DataSource as List<OrderDetailModel>;
|
||
if (or_det_List.Count(r => r.GOODS_NUM <= 0) > 0)
|
||
{
|
||
OrderDetailModel error= or_det_List.Find(r => r.GOODS_NUM <= 0);
|
||
SystemCommon.ShowInfoMessageBox("物料 " + error.Good_name + " 的数量不能为0!");
|
||
gridView2.FocusedRowHandle= or_det_List.IndexOf(error);
|
||
|
||
return;
|
||
}
|
||
if (or_det_List.Count == 0 || or_det_List.FindAll(r => r.ORDER_ID == txt_CKID.Text) == null)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择物料!");
|
||
return;
|
||
}
|
||
txt_CKID.Focus();
|
||
gridView2.CloseEditor();
|
||
bs_OrdersEdit.EndEdit();
|
||
or_Model = bs_OrdersEdit.DataSource as OrdersModel;
|
||
decimal packingweith = or_det_List.Sum(r => r.Weith);
|
||
decimal GOODS_NUM = or_det_List.Sum(r => r.GOODS_NUM);
|
||
decimal Price = or_det_List.Sum(r => r.Goods_money);
|
||
|
||
or_Model.CREATE_DATE = System.DateTime.Now.Date;
|
||
or_Model.CREATE_MAN = DicCreateMan.TextBoxFlag;
|
||
or_Model.Create_man_Name = DicCreateMan.TextBoxValue;
|
||
or_Model.Cs_operator_man_Name = DicCheckMan.TextBoxValue;
|
||
or_Model.CS_OPERATOR_MAN = DicCheckMan.TextBoxFlag;
|
||
or_Model.CUSTOMERNAME = ctr_CUSTOMERNAME.TextBoxValue;
|
||
or_Model.Storage_id = look_ck.EditValue.ToString();
|
||
or_Model.DATASOURCE = "0";
|
||
or_Model.Order_source = "手动新增";
|
||
or_Model.GOODS_NUM = GOODS_NUM;
|
||
or_Model.PACKINGWEITH = packingweith;
|
||
or_Model.GOODS_PRICE = Price;
|
||
or_Model.Ck_type = "1";
|
||
|
||
|
||
string errText = "";
|
||
try
|
||
{
|
||
errText= IBussFactory<BussOrders>.Instance().InsOrUpdate(or_Model, or_det_List, 0);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
return;
|
||
}
|
||
if (errText == "")
|
||
{
|
||
or_det_List.Clear();
|
||
gridView2.RefreshData();
|
||
|
||
|
||
SystemCommon.ShowInfoMessageBox("操作成功!");
|
||
|
||
label16.Visible = true;
|
||
ctrSearch.Visible = true;
|
||
|
||
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
de_CREATE_DATE.Enabled = true;
|
||
xtraTabPage2.PageEnabled = false;
|
||
txt_CKID.Enabled = true;
|
||
de_CREATE_DATE.Enabled = true;
|
||
decheck.Enabled = false;
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = false;
|
||
//colSCALE_UNIT.OptionsColumn.AllowEdit = false;
|
||
colUNIT.OptionsColumn.AllowEdit = false;
|
||
|
||
or_Model = new OrdersModel();
|
||
BindData();
|
||
|
||
//BindDetailData();
|
||
frmButtonItem["Del"].Enabled = true ;
|
||
if (frmButtonItem.ContainsKey("Import"))
|
||
{
|
||
frmButtonItem["Import"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Select"))
|
||
{
|
||
frmButtonItem["Select"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Cancel"))
|
||
{
|
||
frmButtonItem["Cancel"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Add"))
|
||
{
|
||
frmButtonItem["Add"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Search"))
|
||
{
|
||
frmButtonItem["Search"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Move"))
|
||
{
|
||
frmButtonItem["Move"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Clear"))
|
||
{
|
||
frmButtonItem["Clear"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintJH"))
|
||
{
|
||
frmButtonItem["PrintJH"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintKD"))
|
||
{
|
||
frmButtonItem["PrintKD"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("FillKD"))
|
||
{
|
||
frmButtonItem["FillKD"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
frmButtonItem["Save"].Enabled = false;
|
||
}
|
||
ChargeButton();
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("操作失败!");
|
||
}
|
||
#endregion
|
||
}
|
||
else if (flg == 1)//编辑
|
||
{
|
||
#region 编辑
|
||
|
||
or_det_List = bs_OrderDetail.DataSource as List<OrderDetailModel>;
|
||
if (or_det_List.Count <= 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("物料不能为空!");
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
return;
|
||
}
|
||
//查询仓库和快递公司
|
||
|
||
////通过地区查询仓库ID
|
||
//StorageInfoModel sto_model = new StorageInfoModel();
|
||
//try
|
||
//{
|
||
// sto_model.TOWN_ID = lue_CUSTOMERADDRESS.EditValue.ToString();
|
||
// string str_sto_model = Newtonsoft.Json.JsonConvert.SerializeObject(sto_model);
|
||
// string errtext = "";
|
||
// string str_sto_list = WebLockConfig.Instance.StorageInfo.GetStorageOrderDS(str_sto_model, ref errtext);
|
||
// sto_model = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StorageInfoModel>>(str_sto_list)[0];
|
||
// or_Model.Storage_id = sto_model.STORAGE_ID;
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("仓库查询出错!");
|
||
// return;
|
||
//}
|
||
//通过地区查询快递公司
|
||
// LogisticsComInfoModel kdcom = new LogisticsComInfoModel();
|
||
// LogisticsRangeModel kdrange = new LogisticsRangeModel();
|
||
|
||
try
|
||
{
|
||
string refText = "";
|
||
//kdrange.TOWN_ID = lue_CUSTOMERADDRESS.EditValue.ToString();
|
||
|
||
//string str_kdrange = Newtonsoft.Json.JsonConvert.SerializeObject(kdrange);
|
||
//string str_model = WebLockConfig.Instance.WebLogisticsRange.GetLogisticsRangeListStr(str_kdrange, ref refText);
|
||
//kdrange = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogisticsRangeModel>>(str_model)[0];
|
||
//kdcom.LOG_COM_ID = kdrange.LOG_COM_ID;
|
||
//or_Model.LOG_COM_ID = kdrange.LOG_COM_ID;
|
||
//or_Model.Log_com_name = kdrange.LOG_COM_NAME;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//SystemCommon.ShowInfoMessageBox("快递公司查询出错!");
|
||
//return;
|
||
}
|
||
|
||
txt_CKID.Focus();
|
||
gridView2.CloseEditor();
|
||
bs_OrdersEdit.EndEdit();
|
||
|
||
string str_result = "";
|
||
//修改通知单
|
||
or_Model = bs_OrdersEdit.DataSource as OrdersModel;
|
||
or_Model.GOODS_NUM = or_det_List.Sum(r => r.GOODS_NUM);
|
||
or_Model.PACKINGWEITH = or_det_List.Sum(r => r.Weith);
|
||
or_Model.GOODS_PRICE = or_det_List.Sum(r => r.PRICE * r.GOODS_NUM);
|
||
|
||
try
|
||
{
|
||
str_result = IBussFactory<BussOrders>.Instance().InsOrUpdate(or_Model, or_det_List, 1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
}
|
||
if (str_result == "")
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("修改成功!");
|
||
|
||
de_CREATE_DATE.Enabled = true;
|
||
decheck.Enabled = false;
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = false;
|
||
//colSCALE_UNIT.OptionsColumn.AllowEdit = false;
|
||
colUNIT.OptionsColumn.AllowEdit = false;
|
||
|
||
or_Model = new OrdersModel();
|
||
BindData();
|
||
xtraTabControl1.SelectedTabPageIndex = 0;
|
||
label16.Visible = true;
|
||
ctrSearch.Visible = true;
|
||
|
||
|
||
lue_STATUS.Enabled = true;
|
||
lue_DATASOURCE.Enabled = true;
|
||
if (frmButtonItem.ContainsKey("Add"))
|
||
{
|
||
frmButtonItem["Add"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Select"))
|
||
{
|
||
frmButtonItem["Select"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
frmButtonItem["Save"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Move"))
|
||
{
|
||
frmButtonItem["Move"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Clear"))
|
||
{
|
||
frmButtonItem["Clear"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("FillKD"))
|
||
{
|
||
frmButtonItem["FillKD"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
frmButtonItem["Save"].Enabled = false;
|
||
}
|
||
ChargeButton();
|
||
|
||
gridView1.FocusedRowHandle = rowFocus;
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("修改失败!");
|
||
}
|
||
#endregion
|
||
}
|
||
else
|
||
{
|
||
return;
|
||
}
|
||
|
||
//gridView1_FocusedRowChanged(null, null);
|
||
}
|
||
#endregion
|
||
|
||
#region &&打印拣货单&&
|
||
/// <summary>
|
||
/// 打印拣货单
|
||
/// </summary>
|
||
public void PrintJH()
|
||
{
|
||
#region
|
||
//打印方法
|
||
#endregion
|
||
or_Model.Printjh = "1";
|
||
string errText = "";
|
||
|
||
try
|
||
{
|
||
errText = IBussFactory<BussOrders>.Instance().InsOrUpdOrders(or_Model, 1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
return;
|
||
} if (errText == "")
|
||
{
|
||
//成功
|
||
SystemCommon.ShowInfoMessageBox("打印成功!");
|
||
gridView1.FocusedRowHandle = rowFocus;
|
||
}
|
||
else
|
||
{
|
||
//成功
|
||
SystemCommon.ShowInfoMessageBox("打印失败!");
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 打印快递单
|
||
/// <summary>
|
||
/// 打印快递单
|
||
/// </summary>
|
||
public void PrintKD()
|
||
{
|
||
#region
|
||
//打印方法
|
||
if (gridView1.FocusedRowHandle < 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择出库单!");
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(or_Model.EXPRESSNO))
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("快递单号不能为空!请先填充快递单号!");
|
||
// txt_EXPRESSNO.Focus();
|
||
return;
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(or_Model.Log_com_name))
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("快递公司为空!");
|
||
return;
|
||
}
|
||
if (SystemCommon.ShowMessageBoxResult("确定打印?") != DialogResult.OK)
|
||
{
|
||
return;
|
||
}
|
||
#region 仓库实体
|
||
|
||
StorageInfoModel stoModel = new StorageInfoModel();
|
||
if (!(string.IsNullOrEmpty(or_Model.Storage_id)))
|
||
{
|
||
stoModel.STORAGE_ID = or_Model.Storage_id;
|
||
string err = "";
|
||
|
||
try
|
||
{
|
||
List<StorageInfoModel> str_list = IBussFactory<BussStorageInfo>.Instance().GetStorageInfoDS(stoModel);
|
||
if (str_list != null)
|
||
{
|
||
if (str_list.Count > 0)
|
||
{
|
||
stoModel = str_list[0];
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowErrorMessageBox(ex.Message);
|
||
return;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
or_Model = gridView1.GetFocusedRow() as OrdersModel;
|
||
|
||
|
||
//打印状态
|
||
bool bol = false;
|
||
List<OrdersModel> list_Print = new List<OrdersModel>();
|
||
list_Print.Add(or_Model);
|
||
|
||
//UC uc = new UC(list_Print, userData, stoModel);
|
||
if (string.IsNullOrEmpty(or_Model.Log_com_name))
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("快递公司不能为空!");
|
||
return;
|
||
}
|
||
|
||
#endregion
|
||
|
||
or_Model.Printkd = "1";
|
||
string errText = "";
|
||
|
||
string str = "";
|
||
|
||
try
|
||
{
|
||
errText = IBussFactory<BussOrders>.Instance().InsOrUpdOrders(or_Model, 1);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
return;
|
||
} if (errText == "")
|
||
{
|
||
PrintInfoModel print = new PrintInfoModel();
|
||
print.PRINT_TYPE = "3";
|
||
print.PRINT_ID = or_Model.ORDER_ID;
|
||
print.Print_count = 1;
|
||
print.PRINT_DATE = System.DateTime.Now.Date;
|
||
print.PRINT_PER = userData.USER_ID;
|
||
|
||
string _errText = "";
|
||
try
|
||
{
|
||
_errText = IBussFactory<BussPrintInfo>.Instance().InsOrUpdPrint(print, 0);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox(ex.Message);
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//成功
|
||
SystemCommon.ShowInfoMessageBox("打印失败!");
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
bool isSKU = true;
|
||
#region 打印出库单
|
||
/// <summary>
|
||
/// 打印出库单
|
||
/// </summary>
|
||
public void PrintCK()
|
||
{
|
||
|
||
if (SystemCommon.ShowMessageBoxResult("确定打印?") != DialogResult.OK)
|
||
{
|
||
return;
|
||
}
|
||
|
||
or_Model.Printper = userData.NAME;
|
||
or_det_List.ForEach(r =>
|
||
{
|
||
List<JWGoodsInfoModel> lis = IBussFactory<BussGoods>.Instance().GetGoodsList(r.GOOD_ID, "", "", "");
|
||
|
||
if (lis != null)
|
||
{
|
||
if (lis.Count > 0)
|
||
{
|
||
//r.BarCode = lis[0].BARCODE;
|
||
}
|
||
}
|
||
});
|
||
|
||
//if (WebLockConfig.Instance.WebSysParams.GetParamValue("IsSKU") == "0")
|
||
//{
|
||
// #region 使用SKU
|
||
|
||
// #region 查询SKU明细
|
||
// if (listAll_SKUtab.Count <= 0)
|
||
// {
|
||
// SKUTabModel tabModel = new SKUTabModel();
|
||
// string str_tabModel = Newtonsoft.Json.JsonConvert.SerializeObject(tabModel);
|
||
// tabModel = new SKUTabModel();
|
||
// string _str_tabModel = Newtonsoft.Json.JsonConvert.SerializeObject(tabModel);
|
||
|
||
// string _str_l = "";
|
||
// try
|
||
// {
|
||
// _str_l = WebLockConfig.Instance.WebSKUTab.GetSKUTab(_str_tabModel);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
|
||
// }
|
||
// listAll_SKUtab = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUTabModel>>(_str_l);
|
||
// }
|
||
// #endregion
|
||
|
||
// isSKU = true;
|
||
// SKUCKOrder sku = new SKUCKOrder(or_Model, or_det_List, listAll_SKUtab.FindAll(r => r.DOCCTNUMBER == or_Model.ORDER_ID));
|
||
// sku.ShowPreviewDialog();
|
||
|
||
// if (DialogResult.OK != sku.PrintDialog())
|
||
// {
|
||
// return;
|
||
// }
|
||
|
||
// #endregion
|
||
//}
|
||
//else
|
||
//{
|
||
|
||
// CKOrder ck = new CKOrder(or_Model, or_det_List);
|
||
|
||
// ck.ShowPreviewDialog();
|
||
|
||
// if (DialogResult.OK != ck.PrintDialog())
|
||
// {
|
||
// return;
|
||
// }
|
||
//}
|
||
|
||
#region 添加打印记录
|
||
|
||
PrintInfoModel print_model = new PrintInfoModel();
|
||
print_model.PRINT_DATE = System.DateTime.Now;
|
||
print_model.PRINT_TYPE = "2";
|
||
print_model.PRINT_PER = userData.USER_ID;
|
||
print_model.Print_per_name = userData.NAME;
|
||
print_model.Order_id = or_Model.ORDER_ID;
|
||
print_model.Print_count = 1;
|
||
|
||
string errText = "";
|
||
try
|
||
{
|
||
string str_print_model = Newtonsoft.Json.JsonConvert.SerializeObject(print_model);
|
||
string str_or_Model = Newtonsoft.Json.JsonConvert.SerializeObject(or_Model);
|
||
//errText = WebLockConfig.Instance.WebOrders.Print(str_or_Model, str_print_model);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
return;
|
||
} if (errText != "")
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("操作失败!请重试!");
|
||
}
|
||
#endregion
|
||
}
|
||
#endregion
|
||
|
||
#region 自动填充快递单
|
||
/// <summary>
|
||
/// 自动填充快递单
|
||
/// </summary>
|
||
public void FillKD()
|
||
{
|
||
if(gridView1.RowCount==0)
|
||
{
|
||
return;
|
||
}
|
||
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 判断物料SKU是否已经存在 存在 1, 不存在 0, 查询出现错误 3
|
||
/// </summary>
|
||
int _flg = 0;
|
||
List<SKUTabModel> list_SKUtab = new List<SKUTabModel>();
|
||
List<SKUTabModel> listAll_SKUtab = new List<SKUTabModel>();
|
||
|
||
#region 判断数据库是否存在该单据号下的物料的SKU
|
||
/// <summary>
|
||
/// 判断SKU
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
//private int ChargeSKU(string djbh, string goods_ID)
|
||
//{
|
||
// SKUTabModel tabModel = new SKUTabModel();
|
||
// tabModel.GOODS_ID = goods_ID;
|
||
// tabModel.DOCCTNUMBER = djbh;
|
||
// string str_tabModel = Newtonsoft.Json.JsonConvert.SerializeObject(tabModel);
|
||
// tabModel = new SKUTabModel();
|
||
// string _str_tabModel = Newtonsoft.Json.JsonConvert.SerializeObject(tabModel);
|
||
// string str_l = "";
|
||
// string _str_l = "";
|
||
// try
|
||
// {
|
||
// str_l = WebLockConfig.Instance.WebSKUTab.GetSKUTab(str_tabModel);
|
||
// _str_l = WebLockConfig.Instance.WebSKUTab.GetSKUTab(_str_tabModel);
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
// return 3;
|
||
// }
|
||
// listAll_SKUtab = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUTabModel>>(_str_l);
|
||
// list_SKUtab = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUTabModel>>(str_l);
|
||
// if (list_SKUtab.Count <= 0)
|
||
// {
|
||
// return 0;
|
||
// }
|
||
// else
|
||
// {
|
||
// return 1;
|
||
// }
|
||
//}
|
||
#endregion
|
||
|
||
#region 选择SKU
|
||
/// <summary>
|
||
/// 选择SKU
|
||
/// </summary>
|
||
public void ChooseSKU()
|
||
{
|
||
//if (xtraTabControl1.SelectedTabPageIndex == 0)
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("请进入物料明细界面选择物料!");
|
||
// return;
|
||
//}
|
||
//if (bs_OrderDetail.DataSource == null)
|
||
//{
|
||
// return;
|
||
//}
|
||
|
||
//if (gridView2.FocusedRowHandle < 0)
|
||
//{
|
||
// return;
|
||
//}
|
||
//OrderDetailModel mo_detail = gridView2.GetFocusedRow() as OrderDetailModel;
|
||
//if (mo_detail == null)
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("请选择物料!");
|
||
// xtraTabControl1.SelectedTabPageIndex = 1;
|
||
// return;
|
||
//}
|
||
|
||
//_flg = ChargeSKU(mo_detail.CK_ID, mo_detail.GOOD_ID);
|
||
|
||
//FrmSKU sku = new FrmSKU(mo_detail.GOOD_ID, mo_detail.Good_name, mo_detail.CK_ID, mo_detail.GOODS_NUM, listAll_SKUtab.FindAll(r => r.GOODS_ID == mo_detail.GOOD_ID));
|
||
//if (sku.ShowDialog() == DialogResult.Ok)
|
||
//{
|
||
// sku.list_SKUTab.ForEach(r =>
|
||
// {
|
||
// if (listAll_SKUtab.Count(x => x.GOODS_ID == r.GOODS_ID) > 0)
|
||
// {
|
||
// listAll_SKUtab.RemoveAll(c => c.GOODS_ID == r.GOODS_ID);
|
||
// listAll_SKUtab.Add(r);
|
||
// }
|
||
// });
|
||
// //if (sku.list_SKUTab.FindAll(r=>r.SKU_NUM>0).Count > 0)
|
||
// //{
|
||
// // string str_listSKUTab = Newtonsoft.Json.JsonConvert.SerializeObject(sku.list_SKUTab);
|
||
|
||
// // string errText = "";
|
||
// // try
|
||
// // {
|
||
// // if (_flg != 3)
|
||
// // {
|
||
// // errText = WebLockConfig.Instance.WebSKUTab.ManageSKUTabList(str_listSKUTab, _flg);
|
||
// // }
|
||
// // else
|
||
// // {
|
||
// // SystemCommon.ShowInfoMessageBox("出现错误请重试!");
|
||
// // return;
|
||
// // }
|
||
// // }
|
||
// // catch (Exception ex)
|
||
// // {
|
||
// // SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
// // return;
|
||
// // }
|
||
// // SystemCommon.ShowInfoMessageBox("操作成功!");
|
||
// //}
|
||
//}
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
#region 控制按钮状态
|
||
/// <summary>
|
||
/// 通过当前实体状态判断按钮状态
|
||
/// </summary>
|
||
public void ChargeButton()
|
||
{
|
||
if (or_Model.STATUS == "0")
|
||
{
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
frmButtonItem["Edit"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Del"))
|
||
{
|
||
frmButtonItem["Del"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintJH"))
|
||
{
|
||
frmButtonItem["PrintJH"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintKD"))
|
||
{
|
||
frmButtonItem["PrintKD"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintCK"))
|
||
{
|
||
frmButtonItem["PrintCK"].Enabled = false;
|
||
}
|
||
|
||
}
|
||
else if (or_Model.STATUS == "1")
|
||
{
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
frmButtonItem["Edit"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Del"))
|
||
{
|
||
frmButtonItem["Del"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintJH"))
|
||
{
|
||
frmButtonItem["PrintJH"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintKD"))
|
||
{
|
||
frmButtonItem["PrintKD"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintCK"))
|
||
{
|
||
frmButtonItem["PrintCK"].Enabled = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (frmButtonItem.ContainsKey("Confirm"))
|
||
{
|
||
frmButtonItem["Confirm"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
frmButtonItem["Edit"].Enabled = false;
|
||
}
|
||
if (or_Model.Printjh == "1")
|
||
{
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = false;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (frmButtonItem.ContainsKey("JianHuo"))
|
||
{
|
||
frmButtonItem["JianHuo"].Enabled = true;
|
||
}
|
||
}
|
||
if (frmButtonItem.ContainsKey("Del"))
|
||
{
|
||
frmButtonItem["Del"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintJH"))
|
||
{
|
||
frmButtonItem["PrintJH"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintKD"))
|
||
{
|
||
frmButtonItem["PrintKD"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("PrintCK"))
|
||
{
|
||
frmButtonItem["PrintCK"].Enabled = true;
|
||
}
|
||
}
|
||
if (or_Model.Printjh == "1" || or_Model.Printck == "1" || or_Model.Printkd == "1")
|
||
{
|
||
if (frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
frmButtonItem["Edit"].Enabled = false;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 处理or_Model
|
||
/// <summary>
|
||
/// 把当前选中行转换实体赋给or_Model
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
|
||
{
|
||
}
|
||
#endregion
|
||
|
||
#region 标签选中改变
|
||
/// <summary>
|
||
/// table标签选中改变时
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
||
{
|
||
if (xtraTabControl1.SelectedTabPageIndex == 1)
|
||
{
|
||
if (frmButtonItem.ContainsKey("Save"))
|
||
{
|
||
if (frmButtonItem["Save"].Enabled == true)
|
||
{
|
||
if (frmButtonItem.ContainsKey("Move"))
|
||
{
|
||
frmButtonItem["Move"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Clear"))
|
||
{
|
||
frmButtonItem["Clear"].Enabled = true;
|
||
}
|
||
return;
|
||
}
|
||
}
|
||
if (frmButtonItem.ContainsKey("Move"))
|
||
{
|
||
frmButtonItem["Move"].Enabled = false;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Clear"))
|
||
{
|
||
frmButtonItem["Clear"].Enabled = false;
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
|
||
#region 计算明细重量
|
||
/// <summary>
|
||
/// 计算明细重量
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void gridView2_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
||
{
|
||
if (e.RowHandle < 0)
|
||
{
|
||
return;
|
||
}
|
||
|
||
OrderDetailModel model = new OrderDetailModel();
|
||
model = gridView2.GetFocusedRow() as OrderDetailModel;
|
||
if (e.Column.Name == "colGOODS_NUM1")
|
||
{
|
||
string goodsid = gridView2.GetFocusedRowCellValue("GOOD_ID").ToString();
|
||
string goods_num = gridView2.GetFocusedRowCellValue("GOODS_NUM").ToString();
|
||
if (Convert.ToDecimal(goods_num) == 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("所输入数量不能为 0 ");
|
||
gridView2.SetRowCellValue(gridView2.FocusedRowHandle, colGOODS_NUM1, 1);
|
||
return;
|
||
}
|
||
List<JWGoodsInfoModel> str_model = IBussFactory<BussGoods>.Instance().GetGoodsList(goodsid, "", "", "");
|
||
if (str_model != null)
|
||
{
|
||
JWGoodsInfoModel goods_model = new JWGoodsInfoModel();
|
||
goods_model = str_model[0];
|
||
|
||
//decimal volume = Convert.ToDecimal(goods_num) * goods_model.GVOLUME;
|
||
//decimal weigh = Convert.ToDecimal(goods_num) * goods_model.GROSS_WEIGHT;
|
||
decimal money = Convert.ToDecimal(goods_num) * model.PRICE;
|
||
model.Goods_money = money;
|
||
//gridView2.SetRowCellValue(gridView2.FocusedRowHandle, colWeith, weigh);
|
||
//gridView2.SetRowCellValue(gridView2.FocusedRowHandle, colTOTAL_VOLUME, volume);
|
||
gridView2.SetRowCellValue(gridView2.FocusedRowHandle, colGVOLUME, model.GVOLUME);
|
||
}
|
||
|
||
//gridView2.SetRowCellValue(gridView2.FocusedRowHandle, colPRICE, price);
|
||
|
||
}
|
||
|
||
if (e.Column.Name == "colUNIT")
|
||
{
|
||
|
||
DataTable dt = lueUnits.DataSource as DataTable;
|
||
decimal oldUnit = 0;
|
||
decimal newUnit = 0;
|
||
foreach (DataRow row in dt.Rows)
|
||
{
|
||
if (row[0].ToString() == unit)
|
||
{
|
||
oldUnit = decimal.Parse(row[2].ToString());
|
||
}
|
||
if (row[0].ToString() == gridView2.GetFocusedRowCellValue("UNIT").ToString())
|
||
{
|
||
newUnit = decimal.Parse(row[2].ToString());
|
||
}
|
||
}
|
||
|
||
if (model.GOODS_NUM != 0 && oldUnit != 0)
|
||
{
|
||
model.GOODS_NUM = model.GOODS_NUM / oldUnit * newUnit;
|
||
}
|
||
//if (model.GOODS_NUM != 0 && oldUnit != 0)
|
||
//{
|
||
// model.GOODS_NUM = model.GOODS_NUM / oldUnit * newUnit;
|
||
//}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region 省改变绑定市
|
||
/// <summary>
|
||
/// 省改变绑定市
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void lue_CUSTOMERPROVINCE_EditValueChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(lue_CUSTOMERPROVINCE.Properties.ValueMember) && lue_CUSTOMERPROVINCE.EditValue != null && !string.IsNullOrEmpty(lue_CUSTOMERPROVINCE.EditValue.ToString()))
|
||
{
|
||
//绑定城市数据
|
||
string errText = string.Empty;
|
||
|
||
AddressAreaModel addressAreaModel = new AddressAreaModel();
|
||
addressAreaModel.Add_pid = lue_CUSTOMERPROVINCE.EditValue.ToString();
|
||
|
||
|
||
|
||
DataTable strResult = new DataTable();
|
||
try
|
||
{
|
||
strResult = IBussFactory<BussAddressArea>.Instance().GetAddressArea(addressAreaModel);
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
|
||
//如果查询城市数据成功
|
||
if (errText == string.Empty)
|
||
{
|
||
if (strResult != null)
|
||
{
|
||
lue_CUSTOMERCITY.Properties.DataSource = strResult;
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox(errText);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 城市改变绑定县区
|
||
/// <summary>
|
||
/// 城市改变绑定县区
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void lue_CUSTOMERCITY_EditValueChanged(object sender, EventArgs e)
|
||
{
|
||
if (!string.IsNullOrEmpty(lue_CUSTOMERCITY.Properties.ValueMember) && lue_CUSTOMERCITY.EditValue != null && !string.IsNullOrEmpty(lue_CUSTOMERCITY.EditValue.ToString()))
|
||
{
|
||
//绑定区县数据
|
||
string errText = string.Empty;
|
||
|
||
AddressAreaModel addressAreaModel = new AddressAreaModel();
|
||
addressAreaModel.Add_pid = lue_CUSTOMERCITY.EditValue.ToString();
|
||
|
||
|
||
DataTable strResult = new DataTable();
|
||
try
|
||
{
|
||
strResult = IBussFactory<BussAddressArea>.Instance().GetAddressArea(addressAreaModel);
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
|
||
//如果查询区县数据成功
|
||
if (errText == string.Empty)
|
||
{
|
||
if(strResult!=null)
|
||
lue_CUSTOMERADDRESS.Properties.DataSource = strResult;
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox(errText);
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 处理状态和来源
|
||
/// <summary>
|
||
/// 处理状态和来源
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
||
{
|
||
//来源
|
||
if (e.Value == null)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (e.Column.Name == "colDATASOURCE")
|
||
{
|
||
if (!string.IsNullOrEmpty(e.Value.ToString()))
|
||
{
|
||
switch (e.Value.ToString())
|
||
{
|
||
case "0":
|
||
e.DisplayText = "新增";
|
||
break;
|
||
case "1":
|
||
e.DisplayText = "线上";
|
||
break;
|
||
case "2":
|
||
e.DisplayText = "ERP";
|
||
break;
|
||
case "3":
|
||
e.DisplayText = "POS ";
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (e.Column.Name == "colCk_type")
|
||
{
|
||
if (!string.IsNullOrEmpty(e.Value.ToString()))
|
||
{
|
||
switch (e.Value.ToString())
|
||
{
|
||
case "0":
|
||
e.DisplayText = "线上出库";
|
||
break;
|
||
case "1":
|
||
e.DisplayText = "线下出库";
|
||
break;
|
||
case "2":
|
||
e.DisplayText = "调拨出库";
|
||
break;
|
||
case "3":
|
||
e.DisplayText = "换货出库";
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
//出库单状态
|
||
if (e.Column.Name == "colSTATUS")
|
||
{
|
||
if (!string.IsNullOrEmpty(e.Value.ToString()))
|
||
{
|
||
switch (e.Value.ToString())
|
||
{
|
||
case "0":
|
||
e.DisplayText = "新增";
|
||
break;
|
||
case "1":
|
||
e.DisplayText = "已拣货";
|
||
break;
|
||
case "2":
|
||
e.DisplayText = "已完成";
|
||
break;
|
||
case "3":
|
||
e.DisplayText = "已拣货";
|
||
break;
|
||
case "4":
|
||
e.DisplayText = "已经完成";
|
||
break;
|
||
case "5":
|
||
e.DisplayText = "已下发";
|
||
break;
|
||
case "-1":
|
||
e.DisplayText = "关闭";
|
||
break;
|
||
case "-2 ":
|
||
e.DisplayText = "退货";
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region checkbox全选
|
||
// CustomDrawColumnHeader 事件
|
||
//DataSourceChanged 事件
|
||
private void gridView1_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e)
|
||
{
|
||
if (e.Column != null && e.Column.FieldName == "IsCheck")
|
||
{
|
||
e.Info.InnerElements.Clear();
|
||
e.Painter.DrawObject(e.Info);
|
||
DevControlHelper.DrawCheckBox(e, m_status);
|
||
e.Handled = true;
|
||
}
|
||
}
|
||
|
||
//DataSourceChanged 事件
|
||
private void gridView1_DataSourceChanged(object sender, EventArgs e)
|
||
{
|
||
GridColumn column = this.gridView1.Columns.ColumnByFieldName("IsCheck");
|
||
if (column != null)
|
||
{
|
||
column.Width = 20;
|
||
column.OptionsColumn.ShowCaption = m_status;
|
||
column.ColumnEdit = new RepositoryItemCheckEdit();
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 判断快递单号是否存在
|
||
/// <summary>
|
||
/// 判断快递单号是否存在
|
||
/// </summary>
|
||
/// <param name="str"></param>
|
||
/// <returns>不唯一 true,唯一 false</returns>
|
||
public bool Charge(string str)
|
||
{
|
||
bool bol = false;
|
||
OrdersModel or_mo = new OrdersModel();
|
||
or_mo.EXPRESSNO = str;
|
||
|
||
List<OrdersModel> _li =IBussFactory<BussOrders>.Instance().GetOrders(or_mo);
|
||
if (_li != null)
|
||
{
|
||
if (_li.Count > 0)
|
||
{
|
||
bol = true;
|
||
}
|
||
else
|
||
{
|
||
bol = false;
|
||
}
|
||
}
|
||
return bol;
|
||
}
|
||
#endregion
|
||
|
||
#region @选择物料@
|
||
/// <summary>
|
||
/// 选择物料
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void ctr_Goods_Button_Click(object sender, EventArgs e)
|
||
{
|
||
#region ¥¥
|
||
//try
|
||
//{
|
||
// //通过地区查询仓库ID
|
||
// StorageInfoModel sto_model = new StorageInfoModel();
|
||
// sto_model.TOWN_ID = lue_CUSTOMERADDRESS.EditValue.ToString();
|
||
// string str_sto_model = Newtonsoft.Json.JsonConvert.SerializeObject(sto_model);
|
||
// string errtext = "";
|
||
// string str_sto_list = WebLockConfig.Instance.StorageInfo.GetStorageOrderDS(str_sto_model, ref errtext);
|
||
// sto_model = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StorageInfoModel>>(str_sto_list)[0];
|
||
// or_Model.Storage_id = sto_model.STORAGE_ID;
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("仓库查询出错!");
|
||
// return;
|
||
//}
|
||
|
||
////通过地区查询快递公司
|
||
//LogisticsComInfoModel kdcom = new LogisticsComInfoModel();
|
||
//LogisticsRangeModel kdrange = new LogisticsRangeModel();
|
||
|
||
//try
|
||
//{
|
||
// string refText = "";
|
||
// kdrange.TOWN_ID = lue_CUSTOMERADDRESS.EditValue.ToString();
|
||
|
||
// string str_kdrange = Newtonsoft.Json.JsonConvert.SerializeObject(kdrange);
|
||
// string str_model = WebLockConfig.Instance.WebLogisticsRange.GetLogisticsRangeListStr(str_kdrange, ref refText);
|
||
// kdrange = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogisticsRangeModel>>(str_model)[0];
|
||
// kdcom.LOG_COM_ID = kdrange.LOG_COM_ID;
|
||
// or_Model.LOG_COM_ID = kdrange.LOG_COM_ID;
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
||
// return;
|
||
//}
|
||
|
||
// ctrlDicGoods.t_dictonary_ButtonClick(null, null);
|
||
//List<MIStockModel> mis_list = new List<MIStockModel>();
|
||
////list<MIStockModel> list =
|
||
//FrmGoodsSelect f_g_select = new FrmGoodsSelect(or_Model.Storage_id);
|
||
//f_g_select.ShowDialog();
|
||
//mis_list = f_g_select.miStockModelList;
|
||
|
||
//if (mis_list.Count <= 0)
|
||
//{
|
||
// SystemCommon.ShowInfoMessageBox("该仓库没有物料!");
|
||
// return;
|
||
//}
|
||
//foreach (MIStockModel mistock in mis_list)
|
||
//{
|
||
// if (or_det_List.FindAll(r => r.GOOD_ID == mistock.GOODS_ID).Count > 0)
|
||
// {
|
||
// continue;
|
||
// }
|
||
// or_det_Model = new OrderDetailModel();
|
||
// or_det_Model.GOOD_ID = mistock.GOODS_ID;
|
||
// or_det_Model.Good_name = mistock.GOODS_NAME;
|
||
// or_det_Model.GOODS_NUM = 1;
|
||
// or_det_Model.CK_ID = or_Model.ORDER_ID;
|
||
// or_det_Model.BUSINESSID = or_Model.BUSINESSORDERID;
|
||
|
||
// //查询出物料
|
||
// JWGoodsInfoModel goods = new JWGoodsInfoModel();
|
||
// string str_goods = WebLockConfig.Instance.Goods.GetGoodsList(mistock.GOODS_ID, "", "", "");
|
||
// goods = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JWGoodsInfoModel>>(str_goods)[0];
|
||
|
||
// or_det_Model.SPECIFICATION = goods.SPECIFICATION;
|
||
// or_det_Model.Good_name = goods.GOODS_NAME;
|
||
// or_det_Model.GVOLUME = goods.GVOLUME;
|
||
// or_det_Model.TOTAL_VOLUME = goods.GVOLUME;
|
||
// or_det_Model.GOODS_TYPE_ID = goods.GOODS_TYPE_ID;
|
||
// or_det_Model.Goods_type_name = goods.GOODS_TYPE_NAME;
|
||
// or_det_Model.SCALE_UNIT = goods.SCALE_UNIT_NAME;
|
||
// or_det_Model.Weith = goods.GROSS_WEIGHT;
|
||
// or_det_Model.PRICE = goods.PRICE;
|
||
// or_det_Model.UNIT = goods.UNIT;
|
||
// or_det_Model.Goods_money = goods.PRICE * or_det_Model.GOODS_NUM;
|
||
|
||
// or_det_List.Add(or_det_Model);
|
||
//}
|
||
#endregion
|
||
|
||
DataTable dt = ctr_Goods.SelectTable;
|
||
if (dt.Rows.Count <= 0 && or_det_List.Count <= 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择物料!");
|
||
return;
|
||
}
|
||
List<JWGoodsInfoModel> _li = new List<JWGoodsInfoModel>();
|
||
_li = ConvertHelper<JWGoodsInfoModel>.ConvertToList(dt);
|
||
|
||
foreach (JWGoodsInfoModel goods in _li)
|
||
{
|
||
//if (or_det_List.FindAll(r => r.GOOD_ID == goods.GOODS_ID).Count > 0)
|
||
//{
|
||
// continue;
|
||
//}
|
||
//or_det_Model = new OrderDetailModel();
|
||
//or_det_Model.GOOD_ID = goods.GOODS_ID;
|
||
//or_det_Model.GOODS_NUM = 0;
|
||
//or_det_Model.ORDER_ID = or_Model.ORDER_ID;
|
||
//or_det_Model.BUSINESSID = or_Model.BUSINESSORDERID;
|
||
//or_det_Model.SPECIFICATION = goods.SPECIFICATION;
|
||
//or_det_Model.Good_name = goods.GOODS_NAME;
|
||
//or_det_Model.GVOLUME = goods.GVOLUME;
|
||
//or_det_Model.TOTAL_VOLUME = goods.GVOLUME;
|
||
//or_det_Model.GOODS_TYPE_ID = goods.GOODS_TYPE_ID;
|
||
//or_det_Model.Goods_type_name = goods.GOODS_TYPE_NAME;
|
||
//or_det_Model.SCALE_UNIT = goods.SCALE_UNIT_NAME;
|
||
//or_det_Model.Weith = goods.GROSS_WEIGHT;
|
||
//or_det_Model.PRICE = goods.PRICE;
|
||
//or_det_Model.UNIT = goods.UNIT;
|
||
//or_det_Model.STORAGE_ID = look_ck.EditValue.ToString();
|
||
//or_det_Model.Goods_money = goods.PRICE * or_det_Model.GOODS_NUM;
|
||
//or_det_List.Add(or_det_Model);
|
||
}
|
||
if (or_det_List.Count > 0)
|
||
{
|
||
bs_OrderDetail.DataSource = or_det_List;
|
||
//gridView2.DataSource = or_det_List;
|
||
gr_OrderDetail.DataSource = or_det_List;
|
||
gr_OrderDetail.RefreshDataSource();
|
||
gridView2.RefreshData();
|
||
|
||
//colSCALE_UNIT.OptionsColumn.AllowEdit = true;
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = true;
|
||
colUNIT.OptionsColumn.AllowEdit = true;
|
||
|
||
xtraTabControl1.SelectedTabPageIndex = 1;
|
||
if (frmButtonItem.ContainsKey("Clear"))
|
||
{
|
||
frmButtonItem["Clear"].Enabled = true;
|
||
}
|
||
if (frmButtonItem.ContainsKey("Move"))
|
||
{
|
||
frmButtonItem["Move"].Enabled = true;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 选择收货人
|
||
/// <summary>
|
||
/// 选择收货人读取省市县手机和电话,查询仓库和快递公司
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void ctr_CUSTOMERNAME_Button_Click(object sender, EventArgs e)
|
||
{
|
||
DataTable dt = ctr_CUSTOMERNAME.SelectTable;
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
List<CustomerModel> list_cus = new List<CustomerModel>();
|
||
CustomerModel _model = new CustomerModel();
|
||
List<CustomerModel> listCustomerModel = ConvertHelper<CustomerModel>.ConvertToList(dt);
|
||
if (listCustomerModel.Count > 0)
|
||
{
|
||
_model = listCustomerModel[0];
|
||
|
||
}
|
||
list_cus = IBussFactory<WMS.Business.Base.BussCustomer>.Instance().GetCustomer(_model);
|
||
|
||
|
||
lue_CUSTOMERPROVINCE.EditValue = list_cus[0].Province_id;
|
||
lue_CUSTOMERCITY.EditValue = list_cus[0].City_id;
|
||
lue_CUSTOMERADDRESS.EditValue = list_cus[0].Town_id;
|
||
// txt_CUSTOMERPHONE.Text = list_cus[0].Telephone;
|
||
// txt_Mobile.Text = list_cus[0].Phone;
|
||
|
||
or_Model.CUSTOMERPROVINCE = list_cus[0].Province_id;
|
||
or_Model.Customerprovince_Name = list_cus[0].Province_name;
|
||
or_Model.CUSTOMERCITY = list_cus[0].City_id;
|
||
or_Model.Customercity_Name = list_cus[0].City_name;
|
||
or_Model.CUSTOMERDISTRICT = list_cus[0].Town_id;
|
||
or_Model.Customerdistrict_Name = list_cus[0].Town_name;
|
||
or_Model.Telephone = list_cus[0].Telephone;
|
||
or_Model.CUSTOMERPHONE = list_cus[0].Phone;
|
||
or_Model.CUSTOMERADDRESS = list_cus[0].Address;
|
||
|
||
bs_OrdersEdit.DataSource = or_Model;
|
||
// txt_CUSTOMERPHONE.Focus();
|
||
|
||
//查询仓库和快递公司
|
||
|
||
//通过地区查询仓库ID
|
||
StorageInfoModel sto_model = new StorageInfoModel();
|
||
try
|
||
{
|
||
if (lue_CUSTOMERADDRESS.EditValue != null)
|
||
{
|
||
sto_model.TOWN_ID = lue_CUSTOMERADDRESS.EditValue.ToString();
|
||
|
||
string errText = string.Empty;
|
||
// List<StorageInfoModel> Lissto_model = IBussFactory<BussStorageInfo>.Instance().GetStorageOrderDS(or_Model);
|
||
//if (Lissto_model != null)
|
||
//{
|
||
// sto_model = Lissto_model[0];
|
||
// if (string.IsNullOrEmpty(sto_model.STORAGE_ID))
|
||
// {
|
||
// //SystemCommon.ShowInfoMessageBox("仓库为空!");
|
||
// //lue_CUSTOMERADDRESS.Focus();
|
||
// //return;
|
||
// or_Model.Storage_id = userData.STORAGE_ID;
|
||
// }
|
||
// else
|
||
// {
|
||
// or_Model.Storage_id = sto_model.STORAGE_ID;
|
||
// }
|
||
//}
|
||
}
|
||
else
|
||
{
|
||
or_Model.Storage_id = userData.STORAGE_ID;
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
or_Model.Storage_id = userData.STORAGE_ID;
|
||
//SystemCommon.ShowInfoMessageBox("仓库查询出错!");
|
||
//return;
|
||
}
|
||
#region 快递
|
||
////通过地区查询快递公司
|
||
//LogisticsComInfoModel kdcom = new LogisticsComInfoModel();
|
||
//LogisticsRangeModel kdrange = new LogisticsRangeModel();
|
||
|
||
//try
|
||
//{
|
||
// string refText = "";
|
||
// if (lue_CUSTOMERADDRESS.EditValue != null)
|
||
// {
|
||
// kdrange.TOWN_ID = lue_CUSTOMERADDRESS.EditValue.ToString();
|
||
|
||
// string str_kdrange = Newtonsoft.Json.JsonConvert.SerializeObject(kdrange);
|
||
// string str_model = WebLockConfig.Instance.WebLogisticsRange.GetLogisticsRangeListStr(str_kdrange, ref refText);
|
||
// kdrange = Newtonsoft.Json.JsonConvert.DeserializeObject<List<LogisticsRangeModel>>(str_model)[0];
|
||
// kdcom.LOG_COM_ID = kdrange.LOG_COM_ID;
|
||
// if (string.IsNullOrEmpty(kdrange.LOG_COM_ID))
|
||
// {
|
||
// SystemCommon.ShowInfoMessageBox("快递公司为空!");
|
||
// lue_CUSTOMERADDRESS.Focus();
|
||
// return;
|
||
// }
|
||
// or_Model.LOG_COM_ID = kdrange.LOG_COM_ID;
|
||
// or_Model.Log_com_name = kdrange.LOG_COM_NAME;
|
||
// }
|
||
// else
|
||
// {
|
||
// return;
|
||
// }
|
||
//}
|
||
//catch (Exception ex)
|
||
//{
|
||
// //SystemCommon.ShowInfoMessageBox("快递公司查询出错!");
|
||
// return;
|
||
//}
|
||
#endregion
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
|
||
private string unit = string.Empty;//记录原单位
|
||
|
||
private void gridView2_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
||
{
|
||
if (gridView2.GetFocusedRowCellValue("UNIT") != null)
|
||
{
|
||
unit = gridView2.GetFocusedRowCellValue("UNIT").ToString();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//是否按下shift 按下 :true ,反之 false
|
||
private bool bol = false;
|
||
|
||
|
||
private void gridView2_KeyUp(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.ShiftKey)
|
||
{
|
||
bol = false;
|
||
}
|
||
else
|
||
{
|
||
bol = true;
|
||
}
|
||
}
|
||
|
||
private void gridView2_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
bol = false;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 选择物料查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void ctrSearch_Button_Click(object sender, EventArgs e)
|
||
{
|
||
DataTable dt = ctrSearch.SelectTable;
|
||
if (dt.Rows.Count <= 0 && or_det_List.Count <= 0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择物料!");
|
||
return;
|
||
}
|
||
|
||
_li = ConvertHelper<JWGoodsInfoModel>.ConvertToList(dt);
|
||
|
||
}
|
||
|
||
|
||
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
||
{
|
||
|
||
if (gridView1.FocusedRowHandle >= 0)
|
||
{
|
||
or_Model = gridView1.GetRow(gridView1.FocusedRowHandle) as OrdersModel;
|
||
|
||
//or_det_List = bs_OrderDetail.DataSource as List<OrderDetailModel>;
|
||
if (or_Model != null)
|
||
{
|
||
BindDetailData();
|
||
bindingSource2.DataSource = or_Model;
|
||
if(or_Model.Ck_type=="0" || or_Model.Ck_type == "1")
|
||
{
|
||
if (frmButtonItem.ContainsKey("FillKD"))
|
||
{
|
||
frmButtonItem["FillKD"].Enabled = true;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (frmButtonItem.ContainsKey("FillKD"))
|
||
{
|
||
frmButtonItem["FillKD"].Enabled = false;
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |