| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- using com.steering.pss.sale.order.model;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.SaleOrder;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class frmComBaseAskRStation : FrmBase
- {
- private string askItemNo = "";
- public frmComBaseAskRStation()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<ComBaseStationEntity>(ultraGridStation.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<SlmBaseAddAskEntity>(ultraGrid1AddAsk.DisplayLayout.Bands[0]);
- setColumnNoEdit();
- }
- /// <summary>
- /// 重写基类toolBar方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- Query();
- break;
- case "Save":
- Save();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void Query()
- {
- List<SlmBaseAddAskEntity> listSource = EntityHelper.GetData<SlmBaseAddAskEntity>(
- "com.steering.pss.qcm.CoreComBaseAskRStation.getAddAsk", new object[] { }, this.ob);
- slmBaseAddAskEntityBindingSource.DataSource = listSource;
- foreach (UltraGridRow ugrAdd in ultraGrid1AddAsk.Rows)
- {
- if (ugrAdd.Cells["AskItemNo"].Value.ToString().Equals(askItemNo))
- {
- ugrAdd.Activate();
- }
- }
- askItemNo = "";
- }
- private void Save()
- {
- ultraGrid1AddAsk.UpdateData();
- ultraGridStation.UpdateData();
- UltraGridRow ugr = ultraGrid1AddAsk.ActiveRow;
- SlmBaseAddAskEntity addAskEntity = (SlmBaseAddAskEntity)ugr.ListObject;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择附加要求分项!");
- return;
- }
- IQueryable<UltraGridRow> checkedRows = ultraGridStation.Rows.AsQueryable().Where(" CHC = 'True'");
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugrCheck in checkedRows)
- {
- ComBaseStationEntity baseStationEntity = (ComBaseStationEntity)ugrCheck.ListObject;
- ComBaseAskRStationEntity askRelationEntity = new ComBaseAskRStationEntity();
- askRelationEntity.AskItemNo = addAskEntity.AskItemNo;
- askRelationEntity.AskItemDesc = addAskEntity.AskItemDesc;
- askRelationEntity.ProcessCdoe = baseStationEntity.ProcessCode;
- askRelationEntity.ProcessDesc = baseStationEntity.ProcessDesc;
- askRelationEntity.ProcessDescC = baseStationEntity.ProcessDescC;
- askRelationEntity.ProcessCdoeC = baseStationEntity.ProcessCodeC;
- askRelationEntity.StationCode = baseStationEntity.StationCode;
- askRelationEntity.StationDesc = baseStationEntity.StationDesc;
- askRelationEntity.CreateName = UserInfo.GetUserName();
- list.Add(askRelationEntity);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否保存?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.qcm.CoreComBaseAskRStation";
- ccp.MethodName = "saveAddAskRelation";
- ccp.ServerParams = new object[] { list, addAskEntity.AskItemNo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips("保存成功!");
- Query();
- }
- askItemNo = addAskEntity.AskItemNo.ToString();
- }
- private void ultraGrid1AddAsk_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGrid1AddAsk.ActiveRow;
- if (ugr != null)
- {
- String itemNo = ugr.Cells["AskItemNo"].Value.ToString();
- List<ComBaseStationEntity> listSource = EntityHelper.GetData<ComBaseStationEntity>(
- "com.steering.pss.qcm.CoreComBaseAskRStation.getAddAskRelation", new object[] { itemNo }, this.ob);
- comBaseStationEntityBindingSource.DataSource = listSource;
- if (ultraGridStation.Rows.Count > 0)
- {
- ultraGridStation.Rows[0].Activate();
- }
- }
- }
- private void setColumnNoEdit()
- {
- foreach (UltraGridColumn ugc in ultraGridStation.DisplayLayout.Bands[0].Columns)
- {
- if (!ugc.Key.Equals("Chc"))
- {
- ugc.CellActivation = Activation.ActivateOnly;
- }
- }
- }
- private void frmComBaseAskRStation_Load(object sender, EventArgs e)
- {
- Query();
- }
- }
- }
|