| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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 FrmGPInRule : FrmBase
- {
- public FrmGPInRule()
- {
- InitializeComponent();
- }
- private void Frm_Load(object sender, EventArgs e)
- {
- GridHelper.SetColumnsActivateAndColor(ultraGrid1.Rows.Band, "CHK","InActCount");
- 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;
- }
- }
- 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.queryInList", new object[] { arr,dic },this.ob);
- }
- private void doUpdate()
- {
- 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)
- {
- if (row.Cells["inActCount"].Value.ToString().Equals(""))
- {
- MessageUtil.ShowTips("请输入红冲支数!");
- return;
- }
- if (Int32.Parse(row.Cells["ActCount"].Value.ToString()) < Int32.Parse(row.Cells["inActCount"].Value.ToString())) {
- MessageUtil.ShowTips("红冲支数不能大于总支数!");
- return;
- }
- strEntity.Add(JSONFormat.Format(row.ListObject as FrmGPRuleEntity));
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "Core.LgMes.Server.Stuffmanage.FrmGPRule";
- ccp.MethodName = "insertYdmGpInList";
- ccp.ServerParams = new object[] { strEntity,UserInfo.GetUserName() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("入库成功!");
- }
- }
- catch (System.Exception ex)
- {
- MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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;
- }
- }
- }
- }
|