| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- 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 CoreFS.CA06;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- using Core.StlMes.Client.YdmStuffManage.Entity;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Format;
- using Infragistics.Win;
- using Core.Mes.Client.Comm.Control;
- using System.Threading;
- namespace Core.StlMes.Client.YdmStuffManage
- {
- public partial class FrmGPRule : FrmBase
- {
- public FrmGPRule()
- {
- InitializeComponent();
- }
- private void Frm_Load(object sender, EventArgs e)
- {
- GridHelper.SetColumnsActivateAndColor(ultraGrid1.Rows.Band, "CHK");
- EntityHelper.ShowGridCaption<FrmGPRuleEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- arr = BaseMethod.WarehousePermissionsStore(this.ValidDataPurviewIds, ob);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doUpdate":
- doUpdate();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void doUpdate()
- {
- //List<UltraGridRow> rows = UltraGridGetChooseRows(this.ultraGrid1);
- //if (rows.Count==0)
- //{
- // MessageUtil.ShowTips("请选择需要返库的数据!");
- // return;
- //}
- //List<FrmGPRuleEntity> list = new List<FrmGPRuleEntity>();
- //foreach (UltraGridRow row in rows) {
- // FrmGPRuleEntity entity = row.ListObject as FrmGPRuleEntity;
- // list.Add(entity);
- //}
- //FrmGPLocationDlog frm = new FrmGPLocationDlog(list);
- //frm.ob = this.ob;
- //frm.ShowDialog();
- //if (frm.CloseEvent.Equals("update"))
- // this.doQuery();
- try
- {
- this.ultraGrid1.UpdateData();
- List<UltraGridRow> rows = UltraGridGetChooseRows(this.ultraGrid1);
- if (rows.Count == 0)
- {
- MessageUtil.ShowTips("请选择需要入库的数据!");
- return;
- }
- ArrayList strEntity = new ArrayList();
- foreach (UltraGridRow row in rows) {
- strEntity.Add(JSONFormat.Format(row.ListObject as FrmGPRuleEntity));
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmGPRule";
- ccp.MethodName = "insertYdmGpOutList";
- ccp.ServerParams = new object[] { strEntity,this.UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- if (ccp.ReturnInfo.Equals("返库成功!"))
- {
- MessageUtil.ShowWarning("返库成功!");
- doQuery();
- }
- }
- }
- catch (System.Exception ex)
- {
- MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- public static List<UltraGridRow> UltraGridGetChooseRows(UltraGrid grid, string columnName = "CHK")
- {
- grid.UpdateData();
- List<UltraGridRow> list = new List<UltraGridRow>();
- RowsCollection rows = grid.Rows;
- foreach (var item in rows)
- {
- try
- {
- if (Convert.ToBoolean(item.Cells[columnName].Value) == true && item.Hidden == false && item.IsFilteredOut == false)
- {
- list.Add(item);
- }
- }
- catch { }
- }
- return list;
- }
- private string[] arr = null;//仓库权限
- private void doQuery()
- {
- var dic = new Dictionary<string, object>();
- if (chkStoveNo.Checked)
- dic.Add("txtStoveNo", txtStoveNo.Text);
- if (chkFurnace.Checked)
- dic.Add("txtFurnace", txtFurnace.Text);
- ultraGrid1.DataSource = EntityHelper.GetData<FrmGPRuleEntity>("Core.LgMes.Server.Stuffmanage.FrmGPRule.query", new object[] { arr,dic },this.ob);
- }
- private void chkStoveNo_CheckedChanged(object sender, EventArgs e)
- {
- if (chkStoveNo.Checked)
- {
- this.txtStoveNo.Enabled = true;
- }
- else {
- this.txtStoveNo.Enabled = false;
- }
- }
- private void chkFurnace_CheckedChanged(object sender, EventArgs e)
- {
- if (chkFurnace.Checked)
- {
- this.txtFurnace.Enabled = true;
- }
- else
- {
- this.txtFurnace.Enabled = false;
- }
- }
- }
- }
|