| | |
| | | using Gs.DevApp.Entity; |
| | | |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Gs.DevApp.UserControl; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | |
| | | namespace Gs.DevApp.DevFrm.Work |
| | | { |
| | | public partial class Frm_WorkTechnique : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | private List<FilterEntity> _filterList = new List<FilterEntity>(); |
| | | private readonly string _webServiceName = "MesItemsManager/"; |
| | | private readonly string _webServiceName = "WorkTechnique/"; |
| | | public Frm_WorkTechnique() |
| | | { |
| | | InitializeComponent(); |
| | | gridView1.FocusedRowHandle = -1; |
| | | gridView1.FocusedRowChanged += (s, e) => |
| | | { |
| | | if (e.FocusedRowHandle >= 0) |
| | | { |
| | | DataRow row = gridView1.GetDataRow(e.FocusedRowHandle); |
| | | string _guid = row["guid"].ToString(); |
| | | getModel(_guid); |
| | | } |
| | | }; |
| | | this.pageBar1.setBar(false); |
| | | this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; |
| | | toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; |
| | | toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick; |
| | | this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick; |
| | | this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick; |
| | | toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick; |
| | | toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick; |
| | | this.toolBarMenu1.getXmlConfig(); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, null, null, "", "", (value) => |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0); |
| | | }); |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) => |
| | | { |
| | | getModel(value); |
| | | }, (value) => |
| | | { |
| | | getPageList(this.pageBar1.CurrentPage); |
| | | |
| | | }); |
| | | getPageList(1); |
| | | pageBar1.PagerEvent += PageBar1_PagerEvent; |
| | | //选择需要入库的明细 |
| | | btnSelect.Click += (s, e) => |
| | | { |
| | | var frm = new SelectProcess(); |
| | | frm.UpdateParent += (ss, ee) => |
| | | { |
| | | try |
| | | { |
| | | var lst = ee.DynamicList; |
| | | DataTable _Table = (DataTable)gcMx1.DataSource; |
| | | foreach (dynamic dym in lst) |
| | | { |
| | | DataRow _row = _Table.NewRow(); |
| | | _row["fSeq"] = dym.fSeq; |
| | | _row["statStatus"] = "Y-是"; |
| | | _row["collectionName"] = "空"; |
| | | _row["processNo"] = dym.processNo; |
| | | _row["processName"] = dym.processName; |
| | | _Table.Rows.Add(_row); |
| | | } |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = _Table; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | gvMx1.BestFitColumns(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | | }; |
| | | frm.ShowDialog(); |
| | | }; |
| | | _getListJyxm(); |
| | | } |
| | | |
| | | private void GridView1_ColumnFilterChanged(object sender, EventArgs e) |
| | |
| | | /// <param name="pageSize">每页几条</param> |
| | | private void getPageList(int curPage) |
| | | { |
| | | gcMain1.DataSource = null; |
| | | var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList); |
| | | var pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "org.FNumber asc ,a.item_no asc", "", |
| | | "", _sbSqlWhere.ToString()); |
| | |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", |
| | | _webServiceName + "GetListPage", json); |
| | | "MesItemsManager/GetListPage", json); |
| | | var dd = UtilityHelper.ReturnToTablePage(strReturn); |
| | | if (dd.rtnCode > 0) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 审核事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnChkClick(object sender, EventArgs e) |
| | | { |
| | | _toolCk(1); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 反审核 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e) |
| | | { |
| | | _toolCk(0); |
| | | } |
| | | /// <summary> |
| | | /// 取消事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnEscClick(object sender, EventArgs e) |
| | | { |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList); |
| | | } |
| | | /// <summary> |
| | | /// 保存事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e) |
| | | { |
| | | toolBarMenu1.isSetBtn = false; |
| | | if (txt_fType.SelectedIndex <= 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("生产类型不能为空!"); |
| | | txt_fType.Focus(); |
| | | return; |
| | | } |
| | | if (txt_fJingDu.SelectedIndex < 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("管理精度不能为空!"); |
| | | txt_fJingDu.Focus(); return; |
| | | } |
| | | if (txt_fBegDate.Text.Length <= 0) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("生效日期不能为空!"); |
| | | txt_fBegDate.Focus(); return; |
| | | } |
| | | if (txt_fEndDate.Text.Length > 0 && txt_fBegDate.DateTime > txt_fEndDate.DateTime) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("生效日期不能大于失效日期!"); |
| | | txt_fEndDate.Focus(); return; |
| | | } |
| | | decimal num = 0; |
| | | int num2 = 0; |
| | | if (!int.TryParse(txt_fSumPeople.Text.Trim(), out num2)) { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的定员!"); |
| | | txt_fSumPeople.Focus(); return; |
| | | } |
| | | if (!decimal.TryParse(txt_fCapacity.Text.Trim(), out num)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的产能!"); |
| | | txt_fCapacity.Focus(); return; |
| | | } |
| | | if (!decimal.TryParse(txt_fMaxWeight.Text.Trim(), out num)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的重量上限!"); |
| | | txt_fMaxWeight.Focus(); return; |
| | | } |
| | | if (!decimal.TryParse(txt_fMinWeight.Text.Trim(), out num)) |
| | | { |
| | | Gs.DevApp.ToolBox.MsgHelper.ShowInformation("请输入正确的重量下限!"); |
| | | txt_fMinWeight.Focus(); return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建 |
| | | fType = txt_fType.Text.Trim(), |
| | | fBegDate = txt_fBegDate.Text.Trim(), |
| | | fEndDate = txt_fEndDate.Text.Trim(), |
| | | fJingDu = txt_fJingDu.Text.Trim(), |
| | | fCapacity = txt_fCapacity.Text.Trim(), |
| | | fMaxWeight = txt_fMaxWeight.Text.Trim(), |
| | | fMinWeight = txt_fMinWeight.Text.Trim(), |
| | | fSumPeople = txt_fSumPeople.Text.Trim(), |
| | | remark = txt_remark.Text.Trim(), |
| | | list = new List<dynamic>(), |
| | | }; |
| | | gvMx1.CloseEditor(); |
| | | gvMx1.PostEditor(); |
| | | gvMx1.UpdateCurrentRow(); |
| | | for (var i = 0; i < gvMx1.DataRowCount; i++) |
| | | { |
| | | var row = gvMx1.GetDataRow(i); |
| | | if (row != null) |
| | | { |
| | | _obj.list.Add(new |
| | | { |
| | | fSeq = row["fSeq"].ToString(),//序号 |
| | | processNo = row["processNo"].ToString(),//工序编号 |
| | | statStatus = (row["statStatus"].ToString()),//生产进度统计点 |
| | | collectionName = row["collectionName"].ToString(),//采集点 |
| | | remark = row["remark"].ToString(),//备注 |
| | | frontProcessNo = row["frontProcessNo"].ToString(),//上工序号 |
| | | }); |
| | | } |
| | | } |
| | | try |
| | | { |
| | | string strJson = UtilityHelper.HttpPost("", _webServiceName + "EditModel", JsonConvert.SerializeObject(_obj)); |
| | | ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson); |
| | | ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | toolBarMenu1.isSetBtn = true; |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.ChangeEnableByControl(this.layoutMx1.Controls, false, gvList); |
| | | toolBarMenu1.currentAction = ""; |
| | | Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 6); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ToolBox.MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改事件 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e) |
| | | { |
| | | string rowGuid = "", rowName = ""; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | ToolBox.MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | getModel(rowGuid); |
| | | |
| | | } |
| | | private void getModel(string strGuid) |
| | | { |
| | | bool isEdit = false; |
| | |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | var dy = _rtn.rtnData; |
| | | dynamic dy = _rtn.rtnData; |
| | | lbGuid.Text = strGuid; |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit); |
| | | List<DevExpress.XtraGrid.Views.Grid.GridView> gvList = new List<DevExpress.XtraGrid.Views.Grid.GridView>(); |
| | | gvList.Add(gvMx1); |
| | | UtilityHelper.SetValueByObj(this.layoutMx1.Controls, dy, isEdit, gvList); |
| | | JObject _job = JObject.Parse(strJson); |
| | | JArray array = new JArray(); |
| | | foreach (var a in _job["rtnData"]["list"]) |
| | | { |
| | | array.Add(a); |
| | | } |
| | | DataTable dt = JsonConvert.DeserializeObject<DataTable>(array.ToString()); |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | gcMx1.BindingContext = new BindingContext(); |
| | | gcMx1.DataSource = dt; |
| | | gcMx1.ForceInitialize(); |
| | | gvMx1.BestFitColumns(); |
| | | } |
| | | else |
| | | { |
| | | Gs.DevApp.ToolBox.UtilityHelper.SetDefaultTable(gcMx1, gvMx1); |
| | | } |
| | | UtilityHelper.SetCheckIco(null, "", "", "", picCheckBox, this, (txt_isCheck.Checked == true ? 1 : 0).ToString()); |
| | | } |
| | | else |
| | | { |
| | |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 工具条事件 |
| | | /// </summary> |
| | | /// <param name="inFieldValue"></param> |
| | | private void _toolCk(int _inFieldValue) |
| | | { |
| | | string strMsg = ""; |
| | | switch (_inFieldValue) |
| | | { |
| | | case 1: |
| | | strMsg = "审核"; |
| | | break; |
| | | case 0: |
| | | strMsg = "反审核"; |
| | | break; |
| | | }; |
| | | toolBarMenu1.guidKey = ""; |
| | | string rowGuid, rowName; |
| | | (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_itemNo, gridView1, "itemNo"); |
| | | if (string.IsNullOrEmpty(rowGuid)) |
| | | { |
| | | MsgHelper.Warning("请先选择你要操作的行!"); |
| | | return; |
| | | } |
| | | if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定" + strMsg + "吗?")) |
| | | return; |
| | | var _obj = new |
| | | { |
| | | guid = rowGuid, |
| | | inFieldValue = _inFieldValue, |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "EditModelSubmit", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | MsgHelper.Warning(_rtn.rtnData.outMsg.ToString()); |
| | | if (_rtn.rtnCode > 0 && _rtn.rtnData.outSum * 1 > 0) |
| | | { |
| | | getModel(lbGuid.Text.Trim()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 移出工序 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) |
| | | { |
| | | var rowhandle = gvMx1.FocusedRowHandle; |
| | | if (rowhandle < 0) |
| | | return; |
| | | if (e.Button.Index == 0) |
| | | { |
| | | var dr = gvMx1.GetDataRow(rowhandle); |
| | | var mxGuid = dr["guid"].ToString(); |
| | | if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?")) |
| | | return; |
| | | if (string.IsNullOrEmpty(mxGuid)) |
| | | { |
| | | gvMx1.DeleteRow(rowhandle); |
| | | return; |
| | | } |
| | | var _obj = new |
| | | { |
| | | guid = lbGuid.Text.Trim(),//这是产品的guid |
| | | mxGuid = mxGuid, |
| | | }; |
| | | try |
| | | { |
| | | var strJson = UtilityHelper.HttpPost("", |
| | | _webServiceName + "DeleteModelOrMx", |
| | | JsonConvert.SerializeObject(_obj)); |
| | | var _rtn = UtilityHelper.ReturnToDynamic(strJson); |
| | | if (_rtn.rtnCode > 0) |
| | | { |
| | | if (_rtn.rtnCode > 0) getModel(lbGuid.Text); |
| | | } |
| | | MsgHelper.Warning("提示:" + _rtn.rtnMsg); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读取工序下拉 |
| | | /// </summary> |
| | | private void _getListJyxm() |
| | | { |
| | | var pgq = new PageQueryModel(1, 999999, "a.processNo", "asc", "", ""); |
| | | var json = JsonConvert.SerializeObject(pgq); |
| | | try |
| | | { |
| | | var strReturn = UtilityHelper.HttpPost("", "WorkPro/GetListPage", json); |
| | | var dd = UtilityHelper.ReturnToTablePage(strReturn); |
| | | DataTable dt = dd.rtnData.list; |
| | | rptGx.Items.Add("空"); |
| | | foreach (DataRow dr in dt.Rows) |
| | | { |
| | | rptGx.Items.Add(dr["processNo"].ToString()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MsgHelper.Warning("提示:" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |