| | |
| | | |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | |
| | | |
| | | //选存组织(变明细中的物料和车间) |
| | | txt_erpSczz.EditChanged += (s, e) => |
| | | { |
| | |
| | | if (string.IsNullOrEmpty(_orgId)) |
| | | return; |
| | | txt_pba013.getSuppler(_orgId, _cjBm); |
| | | _getListDepot(_orgId); |
| | | }; |
| | | // 选择车间(变明细中产线) |
| | | txt_pba013.EditChanged += (s, e) => |
| | |
| | | { |
| | | _oldTable.ImportRow(sourceRows[i]); |
| | | } |
| | | // 确保自动调拨相关列存在,便于下拉赋值 |
| | | if (!_oldTable.Columns.Contains("dbDepotId")) _oldTable.Columns.Add("dbDepotId", typeof(string)); |
| | | if (!_oldTable.Columns.Contains("depotName")) _oldTable.Columns.Add("depotName", typeof(string)); |
| | | if (!_oldTable.Columns.Contains("dbDepotSections")) _oldTable.Columns.Add("dbDepotSections", typeof(string)); |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = _oldTable; |
| | | gvMx1.CloseEditor(); |
| | |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | gvMx1.ShowingEditor += (s, e) => |
| | | { |
| | | if (gvMx1.FocusedColumn == gvMx1DepotSections) |
| | | { |
| | | string depotId = gvMx1.GetRowCellValue(gvMx1.FocusedRowHandle, "dbDepotId")?.ToString(); |
| | | _getListDepotSections(depotId); |
| | | } |
| | | }; |
| | | |
| | | gvMx1.CellValueChanged += (s, e) => |
| | | { |
| | | if (e.RowHandle < 0) return; |
| | | if (e.Column == gvMx1DepotName) |
| | | { |
| | | var depotId = gvMx1.GetRowCellValue(e.RowHandle, "dbDepotId")?.ToString(); |
| | | // 清空库位并根据仓库ID加载库位下拉 |
| | | gvMx1.SetRowCellValue(e.RowHandle, "dbDepotSections", null); |
| | | _getListDepotSections(depotId); |
| | | } |
| | | }; |
| | | |
| | | |
| | | } |
| | | private void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | | { |
| | |
| | | MsgHelper.ShowError("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | toolBarMenu1.currentAction = "edit"; |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3); |
| | | if (xtraTabControl1.SelectedTabPageIndex == 1) |
| | | { |
| | |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, true, gvList); |
| | | gvMx1DepotName.OptionsColumn.ReadOnly = false; |
| | | gvMx1DepotName.OptionsColumn.AllowEdit = true; |
| | | gvMx1DepotSections.OptionsColumn.ReadOnly = false; |
| | | gvMx1DepotSections.OptionsColumn.AllowEdit = true; |
| | | if (btnBatchSetDepotSections != null) |
| | | btnBatchSetDepotSections.Enabled = true; |
| | | } |
| | | //2025/07/12加上修改状态下不能修改 |
| | | txt_erpSczz.IsReadly = true; |
| | |
| | | MsgHelper.ShowError("预计完工时间不能为空!"); |
| | | return; |
| | | } |
| | | var _isCheckObj = row["isCheck"]; |
| | | bool _isAuto = false; |
| | | if (_isCheckObj is bool _b) _isAuto = _b; |
| | | else |
| | | { |
| | | var _s = _isCheckObj == null ? "" : _isCheckObj.ToString(); |
| | | _isAuto = _s == "1" || string.Equals(_s, "true", System.StringComparison.OrdinalIgnoreCase); |
| | | } |
| | | if (_isAuto) |
| | | { |
| | | var _depotId = row["dbDepotId"] == null ? "" : row["dbDepotId"].ToString(); |
| | | var _depotSections = row["dbDepotSections"] == null ? "" : row["dbDepotSections"].ToString(); |
| | | if (string.IsNullOrWhiteSpace(_depotId)) |
| | | { |
| | | MsgHelper.ShowError("自动调拨仓库不能为空!"); |
| | | return; |
| | | } |
| | | if (string.IsNullOrWhiteSpace(_depotSections)) |
| | | { |
| | | MsgHelper.ShowError("自动调拨库位不能为空!"); |
| | | return; |
| | | } |
| | | } |
| | | _obj.list.Add(new |
| | | { |
| | | Guid = _guid, |
| | |
| | | Yjwgsj = row["mesEndProd"].ToString(),//预计完工时间 |
| | | Pcsl = row["daa008"].ToString(),//排产数量 |
| | | Bz = row["daa009"].ToString(),//备注 |
| | | IsZddb = row["isCheck"].ToString(),//是否自动调拨 |
| | | DepotId = row["dbDepotId"].ToString(),//仓库ID |
| | | DepotSections = row["dbDepotSections"].ToString()//仓库库位 |
| | | |
| | | }); |
| | | } |
| | | } |
| | |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList); |
| | | toolBarMenu1.currentAction = ""; |
| | | if (btnBatchSetDepotSections != null) |
| | | btnBatchSetDepotSections.Enabled = false; |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); |
| | | } |
| | | else |
| | |
| | | { |
| | | ToolBox.MsgHelper.ShowError("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | private void btnBatchSetDepotSections_Click(object sender, EventArgs e) |
| | | { |
| | | var selected = gvMx1.GetSelectedRows(); |
| | | if (selected == null || selected.Length == 0) |
| | | { |
| | | MsgHelper.ShowError("请先在最左侧选择需要批量赋值的行!"); |
| | | return; |
| | | } |
| | | // 预加载仓库列表 |
| | | string orgId = txt_erpSczz.GetId(); |
| | | _getListDepot(orgId); |
| | | // 构建弹框 |
| | | var dlg = new DevExpress.XtraEditors.XtraForm(); |
| | | dlg.Text = "批量赋值自动调拨库位"; |
| | | dlg.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
| | | dlg.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
| | | dlg.MaximizeBox = false; |
| | | dlg.MinimizeBox = false; |
| | | dlg.Width = 420; |
| | | dlg.Height = 220; |
| | | |
| | | var lblDepot = new DevExpress.XtraEditors.LabelControl() { Text = "仓库名称:", Left = 15, Top = 20, Width = 80 }; |
| | | var cboDepot = new DevExpress.XtraEditors.ComboBoxEdit() { Left = 100, Top = 16, Width = 280 }; |
| | | cboDepot.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; |
| | | foreach (var item in this.rptDepotName.Items) |
| | | { |
| | | cboDepot.Properties.Items.Add(item); |
| | | } |
| | | |
| | | var lblSection = new DevExpress.XtraEditors.LabelControl() { Text = "库位:", Left = 15, Top = 60, Width = 80 }; |
| | | var cboSection = new DevExpress.XtraEditors.ComboBoxEdit() { Left = 100, Top = 56, Width = 280 }; |
| | | cboSection.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; |
| | | |
| | | var chkAuto = new DevExpress.XtraEditors.CheckEdit() { Left = 15, Top = 96, Width = 200, Text = "同时勾选自动调拨标识", Checked = true }; |
| | | |
| | | var btnOk = new DevExpress.XtraEditors.SimpleButton() { Left = 200, Top = 130, Width = 80, Text = "确定" }; |
| | | var btnCancel = new DevExpress.XtraEditors.SimpleButton() { Left = 300, Top = 130, Width = 80, Text = "取消" }; |
| | | |
| | | cboDepot.SelectedIndexChanged += (s, ev) => |
| | | { |
| | | var itm = cboDepot.EditValue as CboItemEntity; |
| | | var depotId = itm == null ? null : itm.Value?.ToString(); |
| | | _getListDepotSections(depotId); |
| | | cboSection.Properties.Items.Clear(); |
| | | foreach (var sec in this.rptDepotSections.Items) |
| | | { |
| | | cboSection.Properties.Items.Add(sec); |
| | | } |
| | | cboSection.EditValue = null; |
| | | }; |
| | | |
| | | btnCancel.Click += (s, ev) => { dlg.DialogResult = System.Windows.Forms.DialogResult.Cancel; dlg.Close(); }; |
| | | btnOk.Click += (s, ev) => |
| | | { |
| | | var depotItem = cboDepot.EditValue as CboItemEntity; |
| | | var sectionItem = cboSection.EditValue as CboItemEntity; |
| | | if (depotItem == null) |
| | | { |
| | | MsgHelper.ShowError("请选择仓库名称!"); |
| | | return; |
| | | } |
| | | if (sectionItem == null) |
| | | { |
| | | MsgHelper.ShowError("请选择库位!"); |
| | | return; |
| | | } |
| | | var depotId = depotItem.Value?.ToString(); |
| | | var depotName = depotItem.Text?.ToString(); |
| | | var sectionCode = sectionItem.Text?.ToString(); |
| | | |
| | | gvMx1.BeginUpdate(); |
| | | foreach (var handle in selected) |
| | | { |
| | | if (handle < 0) continue; |
| | | gvMx1.SetRowCellValue(handle, "dbDepotId", depotId); |
| | | gvMx1.SetRowCellValue(handle, "depotName", depotName); |
| | | gvMx1.SetRowCellValue(handle, "dbDepotSections", sectionCode); |
| | | gvMx1.SetRowCellValue(handle, "isCheck", true); |
| | | } |
| | | gvMx1.EndUpdate(); |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | |
| | | dlg.DialogResult = System.Windows.Forms.DialogResult.OK; |
| | | dlg.Close(); |
| | | }; |
| | | |
| | | dlg.Controls.Add(lblDepot); |
| | | dlg.Controls.Add(cboDepot); |
| | | dlg.Controls.Add(lblSection); |
| | | dlg.Controls.Add(cboSection); |
| | | dlg.Controls.Add(chkAuto); |
| | | dlg.Controls.Add(btnOk); |
| | | dlg.Controls.Add(btnCancel); |
| | | |
| | | dlg.ShowDialog(this); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | if (!dt.Columns.Contains("DbDepotId")) dt.Columns.Add("DbDepotId", typeof(string)); |
| | | if (!dt.Columns.Contains("DepotName")) dt.Columns.Add("DepotName", typeof(string)); |
| | | if (!dt.Columns.Contains("DbDepotSections")) dt.Columns.Add("DbDepotSections", typeof(string)); |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridLayout(gvMx1); |
| | | if (btnBatchSetDepotSections != null) |
| | | btnBatchSetDepotSections.Enabled = isEdit; |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void rptDepotName_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | ComboBoxEdit comboBox = sender as ComboBoxEdit; |
| | | if (comboBox != null) |
| | | { |
| | | GridView myView = (gcMx1.MainView as GridView); |
| | | int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle); |
| | | CboItemEntity _itm = comboBox.EditValue as CboItemEntity; |
| | | if (_itm == null) return; |
| | | string depotId = _itm.Value.ToString(); |
| | | string depotName = _itm.Text.ToString(); |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | gvMx1.SetRowCellValue(dataIndex, "dbDepotId", depotId); |
| | | gvMx1.SetRowCellValue(dataIndex, "depotName", depotName); |
| | | // 清空库位并根据仓库ID加载库位列表 |
| | | gvMx1.SetRowCellValue(dataIndex, "dbDepotSections", null); |
| | | _getListDepotSections(depotId); |
| | | } |
| | | } |
| | | |
| | | private void rptDepotSections_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | ComboBoxEdit comboBox = sender as ComboBoxEdit; |
| | | if (comboBox != null) |
| | | { |
| | | GridView myView = (gcMx1.MainView as GridView); |
| | | int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle); |
| | | CboItemEntity _itm = comboBox.EditValue as CboItemEntity; |
| | | if (_itm == null) return; |
| | | string sectionCode = _itm.Text.ToString(); |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | gvMx1.SetRowCellValue(dataIndex, "dbDepotSections", sectionCode); |
| | | } |
| | | } |
| | | |
| | | private void _getListDepot(string orgId) |
| | | { |
| | | try |
| | | { |
| | | var pgq = new PageQueryModel(1, 999999, "org.FNumber asc ,a.depot_code", "asc", "", " and is_ng='A'" + (string.IsNullOrEmpty(orgId) ? "" : (" and a.FSubsidiary='" + orgId + "'"))); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | var strReturn = UtilityHelper.HttpPost("", "MesDepotsManager/GetListPage", json); |
| | | var rtn = UtilityHelper.ReturnToTablePage(strReturn); |
| | | var dt = rtn.rtnData.list; |
| | | this.rptDepotName.Items.Clear(); |
| | | foreach (System.Data.DataRow dr in dt.Rows) |
| | | { |
| | | this.rptDepotName.Items.Add(new CboItemEntity(dr["depotId"].ToString(), dr["depotName"].ToString())); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | private void _getListDepotSections(string depotId) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(depotId)) |
| | | { |
| | | this.rptDepotSections.Items.Clear(); |
| | | return; |
| | | } |
| | | var pgq = new PageQueryModel(1, 999999, "b.xh", "asc", "", " and is_ng='A' and a.depot_id='" + depotId + "'" ); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | var strReturn = UtilityHelper.HttpPost("", "MesDepotSectionsManager/GetListPage", json); |
| | | var rtn = UtilityHelper.ReturnToTablePage(strReturn); |
| | | var dt = rtn.rtnData.list; |
| | | this.rptDepotSections.Items.Clear(); |
| | | foreach (System.Data.DataRow dr in dt.Rows) |
| | | { |
| | | this.rptDepotSections.Items.Add(new CboItemEntity(dr["depotSectionCode"].ToString(), dr["depotSectionCode"].ToString())); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新增方法:列表显示 |
| | | /// </summary> |