using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Web.UI.WebControls;
using System.Windows.Forms;
namespace Gs.DevApp.UserControl
{
public partial class SelectMesCgthSqLink : DevExpress.XtraEditors.XtraForm
{
public readonly string _webServiceName = "MesItemsManager/";
public string orgId = "";
///
///
///
/// 供应商
/// 收料组织
/// 是否委外
public SelectMesCgthSqLink(string _orgId)
{
InitializeComponent();
this.orgId = _orgId;
Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, null, "", null, null, false);
getPageList(1);
}
///
/// 选择后的回调事件
///
public event EventHandler UpdateParent;
///
///
/// 第几页
/// 每页几条
private void getPageList(int curPage)
{
var _sbSqlWhere = " and a.FSubsidiary=" + orgId;
var pgq = new PageQueryModel(curPage, 999999, "org.FNumber asc", "asc", "", _sbSqlWhere.ToString());
var json = JsonConvert.SerializeObject(pgq);
try
{
var strReturn = UtilityHelper.HttpPost("",
_webServiceName + "GetListSelect", json);
var dd = UtilityHelper.ReturnToTablePage(strReturn);
if (dd.rtnCode > 0)
{
DataTable dt = dd.rtnData.list;
gcMain.BindingContext = new BindingContext();
if (dt.Rows.Count > 0)
{
gcMain.DataSource = dt;
gcMain.ForceInitialize();
gridView1.BestFitColumns(); Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gridView1);
}
else
UtilityHelper.SetDefaultTable(gcMain, gridView1);
}
else
{
ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg);
}
}
catch (Exception ex)
{
MsgHelper.ShowError("提示:" + ex.Message);
}
}
///
/// 选择物料
///
///
///
private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
var rowhandle = gridView1.FocusedRowHandle;
if (rowhandle < 0)
return;
if (e.Button.Index == 0)
{
var dr = gridView1.GetDataRow(rowhandle);
var itemId = dr["id"].ToString();
if (string.IsNullOrEmpty(itemId))
{
return;
}
var list = new List();
list.Add(new
{
id = "",
mid = "",
rkmxGuid = "",//入库明细表guid
cgdh = "",//采购单号
invWorkLine = "",//行号,
wlbm = dr["itemNo"].ToString(), //物料编号,
wlmc = dr["itemName"].ToString(), //物料名称,
wlgg = dr["itemModel"].ToString(),//规格型号,
rksl = "", //入库数量,
dwName = dr["dwName"].ToString(),
eid = "",
erpid = "",
itemId = dr["id"].ToString(), //物料id,
ysNum = "0",//已扫数量
remark = "",
orderNo = "0", //序号
kcQty = dr["kcQty"].ToString()//库存数量
});
UpdateParent?.Invoke(this, new UpdateParentEventArgs { DynamicList = list });
Close();
}
}
}
}