| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using CoreFS.SA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmBLCodeManage : FrmBase
- {
- private string _steels = "'1'";
- public string Steels
- {
- get { return _steels; }
- set { _steels = value; }
- }
- private string _stdCode = "";
- public string StdCode
- {
- get { return _stdCode; }
- set { _stdCode = value; }
- }
- private string keyJg = "";
- public string KeyJg
- {
- get { return keyJg; }
- set { keyJg = value; }
- }
- private string dimater = "";
- public string Dimater
- {
- get { return dimater; }
- set { dimater = value; }
- }
- private string height = "";
- public string Height1
- {
- get { return height; }
- set { height = value; }
- }
- private string specCode = "";
- public string SpecCode
- {
- get { return specCode; }
- set { specCode = value; }
- }
- private string textMsc = "";
- public string TextMsc
- {
- get { return textMsc; }
- set { textMsc = value; }
- }
- private string ordLnPk = "";
- public string OrdLnPk
- {
- get { return ordLnPk; }
- set { ordLnPk = value; }
- }
- //新增保存参数
- private ComMscBlEntity mscBlEntity;
- private PscEntity pscEntity;
- public FrmBLCodeManage()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Hidden = true;
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], "");
- ExceptionHelper.RegistException();
- }
- public void PopupLoad(string customInfo, OpeBase ob)
- {
- this.CustomInfo = customInfo;
- this.ob = ob;
- this.OnLoad(EventArgs.Empty);
- }
- private void FrmBLCodeManage_Load(object sender, EventArgs e)
- {//初始化界面上的下拉框
- InitCombo();
- }
- /// <summary>
- /// 初始化下拉框
- /// </summary>
- /// <param name="uce">下拉框控件名字</param>
- /// <param name="MethodId">请求的服务包名+类名+方法名</param>
- /// <param name="memberValue">下拉框的值成员</param>
- private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue)
- {
- //初始化编辑区域下拉框
- DataTable dt = ServerHelper.GetData(MethodId, null, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- if (uce == ultraComboEditor8)
- {
- Object[] obj = new Object[] { "", "" };
- dt.Rows.Add(obj);
- }
- uce.DataSource = dt;
- uce.ValueMember = memberValue;
- }
- }
- private void InitCombo()
- {
- ultraComboEditor5.DataSource = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.GetCPProduct", new object[] { }, ob);
- ultraComboEditor5.ValueMember = "PRODUCCODE";
- ultraComboEditor5.DisplayMember = "PRODUCNAME";
- ultraComboEditor9.DataSource = ServerHelper.GetData("com.steering.pss.qcm.JGCodeManage.GetJGModel", new object[] { }, ob);
- ultraComboEditor9.ValueMember = "MODEL_CODE";
- ultraComboEditor9.DisplayMember = "MODEL_DESC";
- //initJGDropDown(ultraComboEditor5, "com.steering.pss.qcm.JGCodeManage.GetCPProduct", "PRODUCCODE"); //品名
- initJGDropDown(ultraComboEditor7, "com.steering.pss.qcm.JGCodeManage.GetJGSteel", "STEELCODE"); //钢级牌号
- initJGDropDown(ultraComboEditor8, "com.steering.pss.qcm.BLCodeManage.GetBLSType", "STD_STYLE"); //标准类别
- //initJGDropDown(ultraComboEditor9, "com.steering.pss.qcm.JGCodeManage.GetJGModel", "MODEL_CODE"); //扣型描述
- //initJGDropDown(ultraComboEditor10, "com.steering.pss.qcm.BLCodeManage.GetBLStd_Alpha", "STD_CODE"); //标准
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor1, "1218", ob, false);
- ClsBaseInfo.FillComBaseInfo(ultraComboEditor2, "1219", ob, false);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor5);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor7);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor8);
- ClsBaseInfo.SetComboItemHeight(ultraComboEditor9);
- //设置品名默认为备料管
- DataTable dt3 = (DataTable)ultraComboEditor5.DataSource;
- dt3.DefaultView.RowFilter = "PRODUCCODE IN ('S000046', 'S000130','S000155')";
- //if (ultraComboEditor5.Items.Count > 0)
- //{
- // ultraComboEditor5.SelectedIndex = 0;
- //}
- //else
- //{
- // MessageUtil.ShowWarning("在品名基础数据中未找到[备料管],请维护[备料管]!");
- // return;
- //}
- //设置扣型默认为/
- DataTable dt = (DataTable)ultraComboEditor9.DataSource;
- dt.DefaultView.RowFilter = "MODEL_DESC = '/'";
- if (ultraComboEditor9.Items.Count > 0)
- {
- ultraComboEditor9.SelectedIndex = 0;
- }
- else
- {
- MessageUtil.ShowWarning("在扣型基础数据中未找到[/],请维护[/]!");
- return;
- }
- ValueList plnStatusList = new ValueList();
- plnStatusList.ValueListItems.Add("0", "计划");
- plnStatusList.ValueListItems.Add("1", "生产中");
- plnStatusList.ValueListItems.Add("2", "完成");
- plnStatusList.ValueListItems.Add("3", "关闭");
- plnStatusList.ValueListItems.Add("4", "关闭");
- ultraGrid1.DisplayLayout.Bands[0].Columns["PLN_STATUS"].ValueList = plnStatusList;
- }
- private bool _isPopup = false;
- /// <summary>
- /// 是否弹窗
- /// </summary>
- public bool IsPopup
- {
- get { return _isPopup; }
- set { _isPopup = value; }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.doQuery();
- break;
- case "Add":
- this.doAdd();
- break;
- case "Update":
- this.doUpdate();
- break;
- case "Delete":
- this.doDeleteOrResume(true);
- break;
- case "Resume":
- this.doDeleteOrResume(false);
- break;
- case "Refresh":
- this.doRefresh();
- break;
- case "TechnologyReview":
- TechnologyReview();
- break;
- case "ShowMsc":
- ShowMsc();
- break;
- case "Export":
- Export();
- break;
- case "ShowBlOrder":
- ShowBlOrder();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void ShowBlOrder()
- {
- if (ultraGrid1.ActiveRow == null) return;
- try
- {
- this.Cursor = Cursors.WaitCursor;
- FrmBlCodeManageOrder frm = new FrmBlCodeManageOrder(ob, ultraGrid1.ActiveRow.GetValue("PSC_BL"));
- frm.Load += (a, b) =>
- {
- this.Cursor = Cursors.Default;
- };
- frm.ShowDialog();
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void Export()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "备料基础信息");
- }
- private void ShowMsc()
- {
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowWarning("请选择一行记录!");
- return;
- }
- DataTable dtPsc = GetPscByBl(ultraGrid1.GetActiveRowValue("PSC_BL"));
- if (dtPsc.Rows.Count > 1)
- {
- MessageUtil.ShowWarning("通过备料码找到多条产品信息,请作废多余的产品信息!\r\n(查找方式:品名+钢级+标准类别+标准名称)");
- return;
- }
- string psc = dtPsc.Rows[0]["PSC"].ToString();
- string useCode = ultraGrid1.GetActiveRowValue("USE_CODE");
- FrmProPSCMSC2Popup popup = null;
- try
- {
- this.Cursor = Cursors.WaitCursor;
- popup = new FrmProPSCMSC2Popup(new string[] { psc, textMsc, dimater, height, specCode, ordLnPk }, "", "", useCode, ordLnPk, false,
- this.ValidDataPurviewIds, StdExceptionType.AllMsc, "", ob);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- popup.ShowDialog();
- }
- private DataTable GetPscByBl(String blCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.getPscByBl", new object[] { blCode }, ob);
- return dt;
- }
- private void TechnologyReview()
- {
- if (ultraGrid1.ActiveRow == null)
- {
- if (_isPopup == false)
- {
- MessageUtil.ShowWarning("请选择一条记录,然后再进行提交技术评审!");
- }
- }
- string blCode = ultraGrid1.ActiveRow.GetValue("PSC_BL");
- bool result = TechnologyReview2(blCode);
- if (result)
- {
- if (_isPopup == false)
- {
- MessageUtil.ShowTips("提交技术评审成功!");
- }
- }
- else
- {
- return;
- }
- doQuery();
- var queryableRows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("PSC_BL") == blCode);
- if (queryableRows.Count() > 0)
- {
- queryableRows.First().Activate();
- }
- }
- public bool TechnologyReview2(string blCode)
- {
- DataTable dtMscBl = QueryMscBlByPk(blCode);
- if (dtMscBl.Rows[0]["REVIEW_STATUS"].ToString() == "1")
- {
- if (_isPopup == false)
- {
- MessageUtil.ShowWarning("正在技术评审中,不允许再次提交技术评审!");
- return false;
- }
- return true;
- }
- if (_isPopup == false && MessageUtil.ShowYesNoAndQuestion("是否确认提交技术评审?") == DialogResult.No)
- {
- return false;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.MethodName = "qualityDesignBL";
- ccp.ServerName = "com.steering.pss.sale.order.qualityDesign.QualityDesignBL";
- ccp.ServerParams = new object[] { blCode, UserInfo.GetUserName() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnInfo != "")
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return false;
- }
- else
- {
- ServerHelper.SetData("com.steering.pss.qcm.BLCodeManage.updateReviewStateByPk",
- new object[] { "1", blCode }, ob);
- return true;
- }
- }
- private void doRefresh()
- {
- InitCombo();
- }
- //ArrayList parms = new ArrayList(); //参数
- private void doQuery()
- {
- try
- {
- ((Form)this.TopLevelControl).Cursor = Cursors.WaitCursor;
- bool validFlag = chkValid.Checked;
- ArrayList parm = new ArrayList();
- if (this.ultraCheckEditor1.Checked)
- {
- parm.Add(this.ultraTextEditor1.Text);
- }
- else
- {
- parm.Add("");
- }
- if (this.ultraCheckEditor2.Checked)
- {
- parm.Add(this.ultraTextEditor2.Text);
- }
- else
- {
- parm.Add("");
- }
- if (this.ultraCheckEditor3.Checked)
- {
- parm.Add(this.ultraTextEditor4.Text);
- }
- else
- {
- parm.Add("");
- }
- if (this.ultraCheckEditor4.Checked)
- {
- parm.Add(this.ultraTextEditor5.Text);
- }
- else
- {
- parm.Add("");
- }
- if (this.ultraCheckEditor5.Checked)
- {
- parm.Add(this.ultraTextEditor6.Text);
- }
- else
- {
- parm.Add("");
- }
- string steels = _steels.Substring(1, _steels.Length - 1);
- //steels = steels.Substring(0, steels.Length - 1);
- steels = "1";//取消钢级限制
- parm.Add(steels);
- parm.Add(ultraCheckEditor6.Checked ? ultraNumericEditor4.Value.ToString2() : "");
- parm.Add(ultraCheckEditor7.Checked ? ultraNumericEditor3.Value.ToString2() : "");
- parm.Add(_stdCode);
- parm.Add(keyJg);
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.doQuery", new Object[] { validFlag, parm }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- //不同颜色区分是否有效数据
- UltraGridColumn[] col = new UltraGridColumn[] { this.ultraGrid1.DisplayLayout.Bands[0].Columns["MEMO"] };
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid1, col);
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("有效"))
- {
- row.Appearance.ForeColor = Color.Red;
- }
- else
- {
- row.Appearance.ForeColor = Color.Black;
- }
- }
- if (dt != null && dt.Rows.Count > 0)
- {
- ultraGrid1.Rows[0].Activate();//默认激活首行
- }
- if (ultraGrid1.Rows.Count == 0)
- {
- numMinL.Value = 6;
- numMinL.Value = 9;
- }
- }
- finally
- {
- ((Form)this.TopLevelControl).Cursor = Cursors.Default;
- }
- }
- private void doAdd()
- {
- //parms = new ArrayList();
- if (ValidInput())
- {
- if (isExistBl("Add") == true)
- {
- MessageUtil.ShowWarning("系统已经存在相同的数据!");
- return;
- }
- string strJSONBl = JSONFormat.Format(mscBlEntity);
- string strJSONPsc = JSONFormat.Format(pscEntity);
- int count = ServerHelper.SetData("com.steering.pss.qcm.BLCodeManage.doAdd",
- new Object[] { strJSONBl, strJSONPsc }, this.ob);
- if (count > 0)
- {
- doQuery();
- //高亮显示新增的数据
- UltraGridRow[] rows = ultraGrid1.Rows.AsQueryable().Where("CREATE_NAME = '" + this.UserInfo.GetUserName() + "'")
- .OrderByDescending(a => a.GetValue("CREATE_TIME")).ToArray();
- if (rows.Length > 0)
- {
- rows[0].Activate();
- }
- }
- }
- }
- private void doUpdate()
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- {
- MessageBox.Show("请选择需要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (ugr.GetValue("CREATE_NAME") != UserInfo.GetUserName() && UserInfo.GetUserID() != "admin")
- {
- MessageUtil.ShowWarning("您不是该记录的创建人,没有修改权限!");
- return;
- }
- if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效")
- {
- MessageBox.Show("您所选的数据已经无效,无法修改", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (PkIsChange() && QueryIsRef(ugr.Cells["PSC_BL"].Value.ToString()))
- {
- MessageUtil.ShowWarning("该备料已被引用,不能修改!");
- return;
- }
- DataTable dtMscBl = QueryMscBlByPk(ugr.Cells["PSC_BL"].Value.ToString());
- if (dtMscBl.Rows[0]["REVIEW_STATUS"].ToString() == "1")
- {
- MessageUtil.ShowWarning("正在技术评审中,不允许修改!");
- return;
- }
- //parms = new ArrayList();
- if (ValidInput())
- {
- if (isExistBl("Update") == true)
- {
- MessageUtil.ShowWarning("系统已经存在相同的数据!");
- return;
- }
- if (MessageBox.Show("是否确认修改该行数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- //parms.Add(this.UserInfo.GetUserName()); //操作人
- //string blcode = ugr.Cells["PSC_BL"].Value.ToString();
- //parms.Add(blcode);
- string strJSONBl = JSONFormat.Format(mscBlEntity);
- string strJSONPsc = JSONFormat.Format(pscEntity);
- int count = ServerHelper.SetData("com.steering.pss.qcm.BLCodeManage.doUpdate", new Object[] { strJSONBl, strJSONPsc }, this.ob);
- if (count > 0)
- {
- doQuery();
- //高亮显示修改的数据
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (row.Cells["PSC_BL"].Value.ToString().Equals(mscBlEntity.PscBl.ToString()))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- }
- /// <summary>
- /// 删除与恢复
- /// </summary>
- /// <param name="flag">true删除,false恢复</param>
- private void doDeleteOrResume(bool flag)
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr == null)
- {
- MessageBox.Show("请选择需要操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string blcode = ugr.Cells["PSC_BL"].Value.ToString(); //备料码
- if (ugr.Cells["VALIDFLAG"].Value.ToString() == "无效" && flag == true)
- {
- MessageBox.Show("您所选的数据已经无效,无法作废", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- DataTable dtMscBl = QueryMscBlByPk(blcode);
- if (dtMscBl.Rows[0]["REVIEW_STATUS"].ToString() == "1")
- {
- if (_isPopup == false)
- {
- MessageUtil.ShowWarning("该备料正在技术评审中,不能作废!");
- }
- return;
- }
- //if (flag)
- //{
- // if (IsRef(blcode))
- // {
- // MessageUtil.ShowWarning("该备料码已被引用,不能作废!");
- // return;
- // }
- //}
- if (ugr.Cells["VALIDFLAG"].Value.ToString() == "有效" && flag == false)
- {
- MessageBox.Show("您所选的数据已经有效,无法恢复", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageBox.Show("是否确认" + (flag ? "作废" : "恢复") + "选中的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- string deletename = this.UserInfo.GetUserName().Trim(); //操作人
- int count = ServerHelper.SetData("com.steering.pss.qcm.BLCodeManage.doDeleteOrResume", new Object[] { blcode, deletename, flag }, this.ob);
- if (count > 0)
- {
- doQuery();
- if (flag == false)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- {
- row = ultraGrid1.Rows[i];
- if (row.Cells["PSC_BL"].Value.ToString().Equals(blcode))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- }
- private bool IsRef(string blCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.getIsRef",
- new object[] { blCode }, ob);
- if (dt.Rows[0][0].ToString() != "0")
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- private bool isExistBl(string strAction)
- {
- bool isSample = false;
- string stdStyle = ultraComboEditor8.Value == null ? "" : ultraComboEditor8.Value.ToString();
- if (ultraGrid1.ActiveRow != null)
- {
- if (ultraGrid1.ActiveRow.Cells["PRODUCCODE"].Value.ToString() == ultraComboEditor5.Value.ToString()
- && ultraGrid1.ActiveRow.Cells["STD_CODE"].Value.ToString() == ultraTextEditor7.Tag.ToString2()
- && ultraGrid1.ActiveRow.Cells["STEELCODE"].Value.ToString() == ultraComboEditor7.Value.ToString()
- && ultraGrid1.ActiveRow.Cells["STD_STYLE"].Value.ToString() == stdStyle
- && ultraGrid1.ActiveRow.Cells["MODEL_CODE"].Value.ToString() == ultraComboEditor9.Value.ToString()
- && ultraGrid1.ActiveRow.Cells["MIN_D"].Value.ToString() == ultraNumericEditor1.Value.ToString()
- && ultraGrid1.ActiveRow.Cells["MIN_H"].Value.ToString() == ultraNumericEditor2.Value.ToString()
- && ultraGrid1.ActiveRow.Cells["USE_CODE"].Value.ToString() == ultraTextEditor8.Tag.ToString2())
- {
- isSample = true;
- }
- }
- if (strAction == "Add")
- {
- if (isSample == true)
- {
- return true;
- }
- else
- {
- return isExistBl();
- }
- }
- if (strAction == "Update")
- {
- if (isSample == true)
- {
- return false;
- }
- else
- {
- return isExistBl();
- }
- }
- return true;
- }
- private bool isExistBl()
- {
- ArrayList list = new ArrayList();
- list.Add(ultraComboEditor5.Value.ToString());
- list.Add(ultraComboEditor5.Value.ToString());
- list.Add(ultraComboEditor5.Value.ToString());
- list.Add(ultraTextEditor7.Tag.ToString2());
- list.Add(ultraTextEditor7.Tag.ToString2());
- list.Add(ultraTextEditor7.Tag.ToString2());
- list.Add(ultraComboEditor7.Value.ToString());
- list.Add(ultraComboEditor7.Value.ToString());
- list.Add(ultraComboEditor7.Value.ToString());
- list.Add(ultraComboEditor8.Value == null ? "" : ultraComboEditor8.Value.ToString());
- list.Add(ultraComboEditor9.Value.ToString());
- list.Add(ultraComboEditor9.Value.ToString());
- list.Add(ultraComboEditor9.Value.ToString());
- list.Add(ultraNumericEditor1.Value.ToString());
- list.Add(ultraNumericEditor1.Value.ToString());
- list.Add(ultraNumericEditor1.Value.ToString());
- list.Add(ultraNumericEditor2.Value.ToString());
- list.Add(ultraNumericEditor2.Value.ToString());
- list.Add(ultraNumericEditor2.Value.ToString());
- list.Add(ultraTextEditor8.Tag.ToString2());
- list.Add(ultraTextEditor8.Tag.ToString2());
- list.Add(ultraTextEditor8.Tag.ToString2());
- try
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.isExistBl", new object[] { list }, ob);
- if (dt.Rows[0][0].ToString() == "0")
- {
- return false;
- }
- }
- catch { return true; }
- return true;
- }
- private bool PkIsChange()
- {
- var row = ultraGrid1.ActiveRow;
- string gridStr = row.GetValue("PRODUCCODE") + row.GetValue("STD_CODE") + row.GetValue("STEELCODE") + row.GetValue("STD_STYLE")
- + row.GetValue("MODEL_CODE") + row.GetValue("MIN_D") + row.GetValue("MIN_H") + row.GetValue("USE_CODE");
- string editStr = ultraComboEditor5.Value.ToString2() + ultraTextEditor7.Tag.ToString2() + ultraComboEditor7.Value.ToString2() +
- ultraComboEditor8.Value.ToString2() + ultraComboEditor9.Value.ToString2() + ultraNumericEditor1.Value.ToString2() +
- ultraNumericEditor2.Value.ToString2() + ultraTextEditor8.Tag.ToString2();
- if (gridStr == editStr)
- {
- return false;
- }
- else
- {
- return true;
- }
- }
- private bool QueryIsRef(string blCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.queryIsRef",
- new object[] { blCode }, ob);
- if (dt.Rows[0][0].ToString() != "0")
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- private DataTable QueryMscBlByPk(string blCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.queryMscBlByPk",
- new object[] { blCode }, ob);
- return dt;
- }
- private bool ValidInput()
- {
- if (ultraComboEditor5.Items.Count == 0)
- {
- MessageUtil.ShowWarning("在品名基础数据中未找到[备料管],请维护[备料管]!");
- return false;
- }
- if (ultraComboEditor9.Items.Count == 0)
- {
- MessageUtil.ShowWarning("在基础数据中未找到[/],请维护[/]!");
- return false;
- }
- if (ultraComboEditor5.SelectedItem == null)
- {
- MessageBox.Show("请选择品名描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (ultraTextEditor7.Text == "")
- {
- MessageBox.Show("请选择标准名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (ultraComboEditor7.SelectedItem == null)
- {
- MessageBox.Show("请选择钢级/牌号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (this.ultraNumericEditor1.Value == null)
- {
- MessageBox.Show("请输入外径数值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- //if (ultraComboEditor8.SelectedItem == null)
- //{
- // MessageBox.Show("请选择标准类别描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- // return false;
- //}
- if (ultraComboEditor9.SelectedItem == null)
- {
- MessageBox.Show("请选择扣型描述", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (ultraTextEditor8.Text.Trim() == "")
- {
- MessageUtil.ShowWarning("请选择用途码");
- return false;
- }
- if (numMinL.Value == null)
- {
- MessageBox.Show("请输入长度下限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- numMinL.Focus();
- return false;
- }
- if (numMaxL.Value == null)
- {
- MessageBox.Show("请输入长度上限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- numMinL.Focus();
- return false;
- }
- if (double.Parse(numMaxL.Value.ToString()) < double.Parse(numMinL.Value.ToString()))
- {
- MessageUtil.ShowWarning("长度上限不能小于长度下限!");
- numMaxL.Focus();
- return false;
- }
- string alphacode = " ";
- string alpha = " ";
- if (ultraTextEditor8.Text.Trim() != "")
- {
- alphacode = ultraTextEditor8.Tag.ToString2();
- alpha = ultraTextEditor8.Text.Trim();
- }
- if (this.ultraNumericEditor2.Value == null)
- {
- MessageBox.Show("请输入壁厚数值", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (Convert.ToDouble(ultraNumericEditor1.Value) < Convert.ToDouble(ultraNumericEditor2.Value))
- {
- MessageBox.Show("您输入的外径不能小于壁厚!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return false;
- }
- if (keyJg != "")//说明为接箍的备料弹窗。
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.JGRBLCode.getComMscJgByKeyJg",
- new object[] { keyJg }, ob);
- decimal minD = decimal.Parse(ultraNumericEditor1.Value.ToString2());
- decimal minH = decimal.Parse(ultraNumericEditor2.Value.ToString2());
- decimal minDCp = decimal.Parse(dt.Rows[0]["MIN_D_JG"].ToString());
- decimal maxDCp = decimal.Parse(dt.Rows[0]["MAX_D_JG"].ToString());
- if (minD < minDCp)
- {
- MessageUtil.ShowWarning("备料的外径不能小于接箍料的最小外径!");
- return false;
- }
- if ((minD - 2 * minH) > maxDCp)
- {
- MessageUtil.ShowWarning("备料的外径减去两倍壁厚不能大于接箍料的最大内径!");
- return false;
- }
- }
- if (ultraComboEditor1.Value.ToString2() == "")
- {
- MessageUtil.ShowWarning("请选择外购坯!");
- return false;
- }
- if (ultraComboEditor2.Value.ToString2() == "")
- {
- MessageUtil.ShowWarning("请选择外购管!");
- return false;
- }
- mscBlEntity = new ComMscBlEntity();
- mscBlEntity.CreateName = UserInfo.GetUserName();
- mscBlEntity.UpdateName = UserInfo.GetUserName();
- mscBlEntity.DeleteName = UserInfo.GetUserName();
- mscBlEntity.Producname = this.ultraComboEditor5.Text;
- mscBlEntity.Produccode = this.ultraComboEditor5.Value.ToString();
- mscBlEntity.StdCode = this.ultraTextEditor7.Tag.ToString2();
- mscBlEntity.StdName = this.ultraTextEditor7.Text;
- mscBlEntity.Steelcode = this.ultraComboEditor7.Value.ToString();
- mscBlEntity.Steelname = this.ultraComboEditor7.Text;
- mscBlEntity.StdStyle = this.ultraComboEditor8.Value == null ? "" : this.ultraComboEditor8.Value.ToString();
- mscBlEntity.StdStyleDesc = this.ultraComboEditor8.Text;
- mscBlEntity.ModelCode = this.ultraComboEditor9.Value.ToString();
- mscBlEntity.ModelDesc = this.ultraComboEditor9.Text;
- mscBlEntity.MinD = this.ultraNumericEditor1.Value.ToString();
- mscBlEntity.MinH = this.ultraNumericEditor2.Value.ToString();
- mscBlEntity.UseCode = alphacode;
- mscBlEntity.UseDesc = alpha;
- mscBlEntity.Memo = this.ultraTextEditor3.Text.ToString().Trim();
- mscBlEntity.MinL = this.numMinL.Value.ToString();
- mscBlEntity.MaxL = this.numMaxL.Value.ToString();
- mscBlEntity.PscBl = ultraGrid1.ActiveRow == null ? "" : ultraGrid1.GetActiveRowValue("PSC_BL");
- mscBlEntity.OutsBilletFl = ultraComboEditor1.Value.ToString2();
- mscBlEntity.OutsStlPipeFl = ultraComboEditor2.Value.ToString2();
- mscBlEntity.BlLevel = ultraNumericEditor5.Value.ToString2();
- pscEntity = new PscEntity();
- pscEntity.Autojudge = "0";
- pscEntity.NewProcCode = "0";
- pscEntity.Produccode = mscBlEntity.Produccode.ToString();
- pscEntity.Producname = mscBlEntity.Producname.ToString();
- pscEntity.PscDesc = "备料管";
- pscEntity.StdCode = mscBlEntity.StdCode.ToString();
- pscEntity.StdName = mscBlEntity.StdName.ToString();
- pscEntity.StdStyle = mscBlEntity.StdStyle.ToString();
- pscEntity.StdStyleDesc = mscBlEntity.StdStyleDesc.ToString();
- pscEntity.Steelcode = mscBlEntity.Steelcode.ToString();
- pscEntity.Steelname = mscBlEntity.Steelname.ToString();
- pscEntity.DepartmentCode = ClsBaseInfo.GetDepartIdBySectionId(CoreUserInfo.UserInfo.GetDeptid(), this.ob);
- pscEntity.DepartmentDesc = ClsBaseInfo.GetDepartBySectionId(CoreUserInfo.UserInfo.GetDeptid(), this.ob);
- pscEntity.UnitCode = CoreUserInfo.UserInfo.GetDeptid();
- pscEntity.UnitDesc = CoreUserInfo.UserInfo.GetDepartment();
- //parms.Add(this.ultraComboEditor5.Value.ToString()); //品名代码
- //parms.Add(this.ultraComboEditor5.Text.ToString()); //品名描述
- //parms.Add(this.ultraComboEditor6.Value.ToString()); //标准代码
- //parms.Add(this.ultraComboEditor6.Text.ToString()); //标准描述
- //parms.Add(this.ultraComboEditor7.Value.ToString()); //钢级代码
- //parms.Add(this.ultraComboEditor7.Text.ToString()); //钢级描述
- //parms.Add(this.ultraComboEditor8.Value == null ? "" : this.ultraComboEditor8.Value.ToString()); //标准类别代码
- //parms.Add(this.ultraComboEditor8.Text.ToString()); //标准类别描述
- //parms.Add(this.ultraComboEditor9.Value.ToString()); //扣型代码
- //parms.Add(this.ultraComboEditor9.Text.ToString()); //扣型描述
- //parms.Add(this.ultraNumericEditor1.Value.ToString().Trim()); //外径
- //parms.Add(this.ultraNumericEditor2.Value.ToString().Trim()); //壁厚
- //parms.Add(alphacode); //alpha代码
- //parms.Add(alpha); //alpha描述
- //parms.Add(this.ultraTextEditor3.Text.ToString().Trim()); //备注
- //parms.Add(this.numMinL.Value.ToString());
- //parms.Add(this.numMaxL.Value.ToString());
- //string departmentCode = ClsBaseInfo.GetDepartIdBySectionId(CoreUserInfo.UserInfo.GetDeptid(), this.ob);
- //string departmentDesc = ClsBaseInfo.GetDepartBySectionId(CoreUserInfo.UserInfo.GetDepartment(), this.ob);
- //string unitCode = CoreUserInfo.UserInfo.GetDeptid();
- //string unitDesc = CoreUserInfo.UserInfo.GetDepartment();
- //parms.Add(departmentCode);
- //parms.Add(departmentDesc);
- //parms.Add(unitCode);
- //parms.Add(unitDesc);
- return true;
- }
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor1.Checked)
- {
- this.ultraTextEditor1.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor1.ReadOnly = true;
- }
- }
- private void ultraCheckEditor2_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor2.Checked)
- {
- this.ultraTextEditor2.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor2.ReadOnly = true;
- }
- }
- private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor3.Checked)
- {
- this.ultraTextEditor4.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor4.ReadOnly = true;
- }
- }
- private void ultraCheckEditor4_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor4.Checked)
- {
- this.ultraTextEditor5.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor5.ReadOnly = true;
- }
- }
- private void ultraCheckEditor5_CheckedChanged(object sender, EventArgs e)
- {
- if (this.ultraCheckEditor5.Checked)
- {
- this.ultraTextEditor6.ReadOnly = false;
- }
- else
- {
- this.ultraTextEditor6.ReadOnly = true;
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- this.ultraComboEditor5.Text = ugr.Cells["PRODUCNAME"].Value.ToString();
- this.ultraComboEditor5.Value = ugr.Cells["PRODUCCODE"].Value.ToString();
- this.ultraTextEditor7.Tag = ugr.Cells["STD_CODE"].Value.ToString();
- this.ultraTextEditor7.Text = ugr.Cells["STD_NAME"].Value.ToString();
- this.ultraComboEditor7.Text = ugr.Cells["STEELNAME"].Value.ToString();
- this.ultraComboEditor7.Value = ugr.Cells["STEELCODE"].Value.ToString();
- this.ultraComboEditor8.Text = ugr.Cells["STD_STYLE_DESC"].Value.ToString();
- this.ultraComboEditor8.Value = ugr.Cells["STD_STYLE"].Value.ToString();
- this.ultraComboEditor9.Text = ugr.Cells["MODEL_DESC"].Value.ToString();
- this.ultraComboEditor9.Value = ugr.Cells["MODEL_CODE"].Value.ToString();
- ultraTextEditor8.Text = ugr.Cells["USE_DESC"].Value.ToString();
- ultraTextEditor8.Tag = ugr.Cells["USE_CODE"].Value.ToString();
- this.ultraNumericEditor1.Text = ugr.Cells["MIN_D"].Value.ToString();
- this.ultraNumericEditor2.Text = ugr.Cells["MIN_H"].Value.ToString();
- this.ultraTextEditor3.Text = ugr.Cells["MEMO"].Value.ToString();
- this.numMinL.Value = ugr.Cells["MIN_L"].Value.ToString();
- this.numMaxL.Value = ugr.Cells["MAX_L"].Value.ToString();
- this.ultraComboEditor1.Value = ugr.GetValue("OUTS_BILLET_FL");
- this.ultraComboEditor2.Value = ugr.GetValue("OUTS_STL_PIPE_FL");
- this.ultraNumericEditor5.Value = ugr.GetValue("BL_LEVEL") == "" ? null : ugr.GetValue("BL_LEVEL");
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- }
- private void ultraCheckEditor6_CheckedChanged(object sender, EventArgs e)
- {
- ultraNumericEditor4.ReadOnly = !ultraCheckEditor6.Checked;
- }
- private void ultraCheckEditor7_CheckedChanged(object sender, EventArgs e)
- {
- ultraNumericEditor3.ReadOnly = !ultraCheckEditor7.Checked;
- }
- private void ultraTextEditor7_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- //initJGDropDown(ultraComboEditor6, "com.steering.pss.qcm.BLCodeManage.GetBLStd", "STD_CODE"); //标准
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.GetBLStd",
- new object[] { }, ob);
- dt.Columns["STD_NAME"].Caption = "标准名称";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STD_NAME", "STD_CODE");
- baseInfo.Shown += new EventHandler((a, b) =>
- {
- var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- c => c.GetValue("STD_CODE") == ultraTextEditor7.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraTextEditor7.Tag = baseInfo.ChoicedRow.GetValue("STD_CODE");
- ultraTextEditor7.Text = baseInfo.ChoicedRow.GetValue("STD_NAME");
- }
- }
- private void ultraTextEditor7_ValueChanged(object sender, EventArgs e)
- {
- ultraTextEditor8.Text = "";
- }
- private void ultraTextEditor8_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- if (ultraTextEditor7.Tag.ToString2() == "")
- {
- MessageUtil.ShowWarning("请先选择产品标准");
- return;
- }
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.BLCodeManage.getComBaseStdAlpha",
- new object[] { ultraTextEditor7.Tag.ToString2() }, ob);
- dt.Columns["ALPHA_CODE"].Caption = "用途码";
- dt.Columns["ALPHA_NAME"].Caption = "用途描述";
- dt.Columns["DEPARTMENT_DESC"].Caption = "管理部门";
- dt.Columns["UNIT_DESC"].Caption = "管理科室";
- dt.Columns["MEMO"].Caption = "备注";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "ALPHA_NAME");
- GridHelper.RefreshAndAutoSize(baseInfo.UltraGrid1);
- baseInfo.Shown += new EventHandler((a, b) =>
- {
- var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- c => c.GetValue("ALPHA_CODE") == ultraTextEditor8.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraTextEditor8.Tag = baseInfo.ChoicedRow.GetValue("ALPHA_CODE");
- ultraTextEditor8.Text = baseInfo.ChoicedRow.GetValue("ALPHA_NAME");
- }
- }
- private void ultraTextEditor9_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- var row = ultraGrid1.ActiveRow;
- string path = row.GetValue("CRAFT_PATH");
- if (e.Button.Key == "Show")
- {
- FormFileDown down = new FormFileDown(ob, path);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- }
- private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- }
- private void ultraComboEditor5_ValueChanged(object sender, EventArgs e)
- {
- if (ultraComboEditor5.Value.ToString2() == "S000130")
- {
- DataTable dt = (DataTable)ultraComboEditor9.DataSource;
- dt.DefaultView.RowFilter = "";
- ultraComboEditor9.Enabled = true;
- }
- else
- {
- DataTable dt = (DataTable)ultraComboEditor9.DataSource;
- dt.DefaultView.RowFilter = "MODEL_DESC = '/'";
- ultraComboEditor9.Enabled = false;
- if (ultraComboEditor9.Items.Count > 0)
- {
- ultraComboEditor9.SelectedIndex = 0;
- }
- else
- {
- MessageUtil.ShowWarning("在扣型基础数据中未找到[/],请维护[/]!");
- return;
- }
- }
- }
- }
- }
|