using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Core.StlMes.Client.GlBusiness.OrderForm { public partial class FrmThOrderManageZc : FrmBase { public FrmThOrderManageZc() { InitializeComponent(); this.IsLoadUserView = true; } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "doQuery": doQuery(); break; case "Issue": doIssue(); break; case "CancelIssue": doCancelIssue(); break; case "doClose": this.Close(); break; case "Export": this.Export(); break; } } private void Export() { GridHelper.ulGridToExcel(ultraGrid1, "关联交易-成品"); } private void doCancelIssue() { UltraGridRow row = ultraGrid1.ActiveRow; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage"; ccp.MethodName = "doUpdateZcState"; ccp.ServerParams = new object[] { row.Cells["ORD_PK"].Value.ToString2(), "0" }; ccp.IfShowErrMsg = false; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp != null) { if (ccp.ReturnCode == -1) { MessageUtil.ShowWarning(ccp.ReturnInfo); return; } MessageUtil.ShowTips("撤销下发成功!"); doQuery(); } } private void doIssue() { UltraGridRow row = ultraGrid1.ActiveRow; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.glbusiness.FrmTHOrderManage"; ccp.MethodName = "doUpdateZcState"; ccp.ServerParams = new object[] { row.Cells["ORD_PK"].Value.ToString2(), "1" }; ccp.IfShowErrMsg = false; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp != null) { if (ccp.ReturnCode == -1) { MessageUtil.ShowWarning(ccp.ReturnInfo); return; } MessageUtil.ShowTips("下发成功!"); doQuery(); } } private void doQuery() { string orderNo = ""; //合同号 string orderStart = ""; string orderEnd = ""; if (uchkOrderNo.Checked) { orderNo = utxtOrderNo.Text.Trim(); } if (uchkDate.Checked) { orderStart = udtStart.DateTime.ToString("yyyy-MM-dd") + " 00:00:01"; orderEnd = udtEnd.DateTime.ToString("yyyy-MM-dd") + " 23:59:59"; } else { orderStart = "1000-01-01 00:00:01"; orderEnd = "9999-12-31 23:59:59"; } DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.FrmTHOrderManage.doQueryZc", new Object[] { orderNo, orderStart, orderEnd }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref this.orderHeadDt, true); foreach (UltraGridRow row in ultraGrid1.Rows) { if ("1".Equals(row.Cells["CUSTOMER_MODEL_FL"].Value)) { row.Cells["CUSTOMER_MODEL_FL"].Value = true; } else { row.Cells["CUSTOMER_MODEL_FL"].Value = false; } if ("1".Equals(row.Cells["VALIDFLAG"].Value)) { row.Cells["VALIDFLAG"].Value = true; row.Appearance.ForeColor = Color.Black; } else { row.Cells["VALIDFLAG"].Value = false; row.Appearance.ForeColor = Color.Red; row.Cells["MEMO"].Value = "合同已撤销"; } } ultraGrid1.UpdateData(); if (ultraGrid1.ActiveRow == null) { this.orderLineDt.Clear(); } } private void GetOrderLineDt(string ordpk) { DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.GetOrderLineDtZc", new Object[] { ordpk, "1", "1", false }, this.ob); GridHelper.CopyDataToDatatable(ref dt, ref this.orderLineDt, true); //不同颜色区分是否有效数据 Infragistics.Win.UltraWinGrid.UltraGridRow row = null; for (int i = 0; i < ultraGrid2.Rows.Count; i++) { row = ultraGrid2.Rows[i]; if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1")) { row.Cells["VALIDFLAG"].Value = false; row.Appearance.ForeColor = Color.Red; } else { row.Cells["VALIDFLAG"].Value = true; row.Appearance.ForeColor = Color.Black; } if ("1".Equals(row.Cells["MPS_FL"].Value)) { row.Cells["MPS_FL"].Value = true; } else { row.Cells["MPS_FL"].Value = false; } //监制 if ("1".Equals(row.Cells["PRODUCER_FL"].Value.ToString())) { row.Cells["PRODUCER_FL"].Value = true; } else { row.Cells["PRODUCER_FL"].Value = false; } //ASSEL if ("1".Equals(row.Cells["ASSEL_FL"].Value.ToString())) { row.Cells["ASSEL_FL"].Value = true; } else { row.Cells["ASSEL_FL"].Value = false; } if (row.Cells["ISLOCK"].Value.ToString() == "1") { row.RowSelectorAppearance.BackColor = Color.Red; } } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow row = ultraGrid1.ActiveRow; GetOrderLineDt(row.Cells["ORD_PK"].Value.ToString2()); } private void FrmThOrderManageZc_Load(object sender, EventArgs e) { //默认查询当前日期-1月——当前日期数据。 udtStart.DateTime = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToShortDateString()); udtEnd.DateTime = Convert.ToDateTime(DateTime.Now.ToShortDateString()); } dlgOrderAskDown askDown; private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { string filePath = ultraGrid2.ActiveRow.GetValue("CRAFT_NO"); if(filePath!=null&&filePath!=""){ DataTable dt = ServerHelper.GetData("com.steering.pss.glbusiness.GlOrderManage.getFilePath", new Object[] { filePath }, this.ob); string file = dt.Rows[0]["CRAFT_PATH"].ToString3(); dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, file); askDown.DeleteButton.Visible = false; askDown.Show(); } else { MessageUtil.ShowTips("工艺文件号为空"); return; } } } }