| | |
| | | using System.Data; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Gs.DevApp.DevFrm |
| | | { |
| | | public partial class Frm_MesItemQtrk : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string _webServiceName = "MesItemQtrkManager/"; |
| | | List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | string _ucGys = "";//供应商 |
| | | string _ucBm = "";//领料部门 |
| | | string _ucCk = "";//发料仓库 |
| | | string _ucHzlx = "";//货主类型 |
| | | string _ucHz = "";//货主 |
| | | public Frm_MesItemQtrk() |
| | | { |
| | | InitializeComponent(); |
| | |
| | | this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1; |
| | | this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; |
| | | this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick; |
| | | toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; |
| | | toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "isSh", "", (value) => |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx( gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter( gridView1, picCheckBox, this, "isSh", "", (value) => |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | | }); |
| | |
| | | }); |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | txt_qt008.getSuppler(""); |
| | | txt_qt018.getSuppler(""); |
| | | //设置仓库选择 |
| | | this.txt_qt008.EditChanged += (s, e) => |
| | | |
| | | //选择库存组织(变明细中的物料和变货主) |
| | | this.txt_qt022.EditChanged += (s, e) => |
| | | { |
| | | |
| | | string _orgId = txt_qt022.GetId(); |
| | | if (string.IsNullOrEmpty(_orgId)) |
| | | return; |
| | | ucLookHuoZhu1.OrgId = _orgId; |
| | | ucLookHuoZhu1.HzId = _ucHz; |
| | | ucLookHuoZhu1.SetHzLx(_ucHzlx); |
| | | txt_qt009.getSuppler(_orgId,_ucBm); |
| | | txt_qt018.getSuppler(_orgId, _ucGys); |
| | | txt_qt008.getSuppler(_orgId, _ucCk); |
| | | System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(); |
| | | sbWhere.Append(" and a.FSubsidiary ='" + _orgId + "'"); |
| | | var _obj = new PageQueryModel(1, 999999, "item_no", "asc", "", sbWhere.ToString(), ""); |
| | | var json = JsonConvert.SerializeObject(_obj); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", |
| | | "MesItemsManager/GetListSelect", json); |
| | | var rtn = UtilityHelper.ReturnToTablePage(strReturn); |
| | | var dt = rtn.rtnData.list; |
| | | this.repositoryItemSearchLookUpEdit1.DataSource = dt; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | }; |
| | | //设置供应商选择 |
| | | this.txt_qt018.EditChanged += (s, e) => |
| | | { |
| | | |
| | | }; |
| | | var _obj = new |
| | | { |
| | | currentPage = 1, |
| | | everyPageSize = 999999, |
| | | sortName = "", |
| | | keyWhere = "", |
| | | }; |
| | | var json = JsonConvert.SerializeObject(_obj); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", |
| | | "MesItemsManager/GetListSelect", json); |
| | | var rtn = UtilityHelper.ReturnToTablePage(strReturn); |
| | | var dt = rtn.rtnData.list; |
| | | this.repositoryItemSearchLookUpEdit1.DataSource = dt; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | |
| | | gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged; |
| | | this.ucBtnPrint1.btnDesignClick += (s, e) => |
| | | { |
| | |
| | | Gs.DevApp.ToolBox.UtilityHelper.GetDilter(gridView1.Columns, gridView1); |
| | | Task.Delay(100); |
| | | getPageList(1); |
| | | } |
| | | /// <summary> |
| | | /// 日志 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnLogClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, |
| | | lbGuid, txt_qtck, gridView1); |
| | | toolBarMenu1.guidKey = rowGuid; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gvMx2); |
| | | UtilityHelper.ChangeEnableByControl(panel1.Controls, true, gvList); |
| | | ucLookHuoZhu1.Enabled = true; |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | UtilityHelper.CleanValueByControl(this.panel1.Controls, true, gridViews); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx2, gvMx2); |
| | | ucLookHuoZhu1.Enabled = true; |
| | | } |
| | | /// <summary> |
| | | /// 保存事件 |
| | |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | string inGys = txt_qt018.GetId(); |
| | | string inCjId = txt_qt008.GetId(); |
| | | if (string.IsNullOrEmpty(inGys)) |
| | | string kcZz = txt_qt022.GetId();//库存组织 |
| | | string kcBm = txt_qt009.GetId();//库存部门 |
| | | string kcGys = txt_qt018.GetId();//库存供应商 |
| | | string djLx = txt_qt003.Text.Trim();//单据类型 |
| | | string kcfx = txt_qt019.Text.Trim();//库存方向 |
| | | string inHzlx = ucLookHuoZhu1.GetHzLx();//货主类型 |
| | | string inHz = ucLookHuoZhu1.GetHzId();//货主 |
| | | string inRkyy = txt_qt010.Text.Trim();//入库原因 |
| | | string kcCk = txt_qt008.GetId();//仓库 |
| | | if (string.IsNullOrEmpty(kcZz)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择供应商!"); |
| | | txt_qt018.Focus(); |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择库存组织!"); |
| | | txt_qt022.Focus(); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(inCjId)) |
| | | if (string.IsNullOrEmpty(inHzlx)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择仓库!"); |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择货主类型!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(inHz)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择货主!"); |
| | | return; |
| | | } |
| | | if (txt_qt003.SelectedIndex < 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择单据类型!"); |
| | | txt_qt003.Focus(); |
| | | return; |
| | | } |
| | | if (txt_qt019.SelectedIndex <= 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择库存方向!"); |
| | | txt_qt019.Focus(); |
| | | return; |
| | | } |
| | | if (string.IsNullOrEmpty(kcCk)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.Warning("请选择发料仓库!"); |
| | | txt_qt008.Focus(); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | | kcZz = txt_qt022.GetId(),//库存组织 |
| | | kcBm = txt_qt009.GetId(),//库存部门 |
| | | kcGys = txt_qt018.GetId(),//库存供应商 |
| | | kcCk = txt_qt008.GetId(),//库存供应商 |
| | | inRkyy = txt_qt010.Text.Trim(),//入库原因 |
| | | djLx = txt_qt003.Text.Trim(),//单据类型 |
| | | kcfx = txt_qt019.Text.Trim(),//库存方向 |
| | | hzlx = txt_qt023.Text.Trim(),//货主类型 |
| | | hzzz = txt_qt024.GetId(),//货主组织 |
| | | hzkh = txt_qt025.GetId(),//货主客户 |
| | | hzbm = txt_qt026.GetId(),//货主部门 |
| | | kcZz = kcZz,//库存组织 |
| | | kcBm = kcBm,//库存部门 |
| | | kcGys = kcGys,//库存供应商 |
| | | kcCk = kcCk,//库存仓库 |
| | | inRkyy = inRkyy,//入库原因 |
| | | djLx = djLx,//单据类型 |
| | | kcfx = kcfx,//库存方向 |
| | | hzlx = inHzlx,//货主类型 |
| | | inHz = inHz,//货主 |
| | | list = new List<dynamic>(), |
| | | }; |
| | | gvMx1.CloseEditor(); |
| | |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gvMx2); |
| | | UtilityHelper.ChangeEnableByControl(this.panel1.Controls, false, gvList); |
| | | ucLookHuoZhu1.Enabled = false; |
| | | toolBarMenu1.currentAction = ""; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | dynamic dy = _rtn.rtnData; |
| | | _ucGys = dy.qt018; |
| | | _ucBm = dy.qt009; |
| | | _ucCk = dy.qt008; |
| | | _ucHzlx = dy.qt023; |
| | | _ucHz = dy.qt024; |
| | | lbGuid.Text = strGuid; |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | gvList.Add(gvMx2); |
| | | UtilityHelper.SetValueByObj(this.panel1.Controls, dy, isEdit, gvList); |
| | | _ucGys =""; |
| | | _ucBm = ""; |
| | | _ucCk = ""; |
| | | _ucHzlx = ""; |
| | | _ucHz = ""; |
| | | ucLookHuoZhu1.Enabled = isEdit; |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) |
| | |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | |
| | | JArray array2 = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list2"]) |
| | | { |
| | |
| | | gvMx1.SetFocusedRowCellValue("qd002", SelectedDataRow["itemNo"]); |
| | | gvMx1.SetFocusedRowCellValue("qd003", SelectedDataRow["itemName"]); |
| | | gvMx1.SetFocusedRowCellValue("qd004", SelectedDataRow["itemModel"]); |
| | | gvMx1.SetFocusedRowCellValue("qd009", SelectedDataRow["dwName"]); |
| | | gvMx1.SetFocusedRowCellValue("kcDw", SelectedDataRow["dwName"]); |
| | | gvMx1.SetFocusedRowCellValue("itemId", SelectedDataRow["id"]); |
| | | } |
| | | |
| | | private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | |
| | | txtWlid.Text = row["qd002"].ToString(); |
| | | txtWlgg.Text = row["qd004"].ToString(); |
| | | txtWlmc.Text = row["qd003"].ToString(); |
| | | //txtQuantity.Text = row["qd007"].ToString();//申请总量 |
| | | //txtYdy.Text = row["YDYNUM"].ToString();//已打印总量 |
| | | //kyPrtQty.Text = row["KDYNUM"].ToString();//可打印总量 |
| | | txtQuantity.Text = row["qd007"].ToString();//申请总量 |
| | | txtYdy.Text = row["ydy"].ToString();//已打印总量 |
| | | txtKdy.Text = row["kdy"].ToString();//可打印总量 |
| | | } |
| | | } |
| | | /// <summary> |