| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- 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.StlMes.Client.SaleOrder;
- using System.Collections;
- using Core.Mes.Client.Comm.Control;
- using Core.StlMes.Client.SaleComm;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using Core.Mes.Client.Comm.Server;
- using Core.StlMes.Client.SaleOrder.ReviewForm;
- using Core.StlMes.Client.SaleOrder.Dialog;
- using Core.Mes.Client.Comm;
- using Infragistics.Win;
- using System.Text.RegularExpressions;
- namespace Core.StlMes.Client.SaleOrder
- {
- public partial class frmInsidePriceCarry : FrmBase
- {
- public frmInsidePriceCarry()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void frmInsidePriceCarry_Load(object sender, EventArgs e)
- {
- DateTime Today = DateTime.Now;
- this.date_starte.DateTime = Today.Date.AddMonths(-1);
- this.date_end.DateTime = DateTime.Today;
- GridHelper.SetColumnsActivateAndColor(efforder_seq.Rows.Band, "CARRY_USE");
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doSaveCarry":
- doSaveCarry();
- break;
- case "doClose":
- this.Close();
- break;
- }
- }
- private void doSaveCarry()
- {
- if (gffect_oder.ActiveRow == null)
- return;
- try
- {
- efforder_seq.UpdateData();
- }
- catch { }
- string ordPk = gffect_oder.ActiveRow.Cells["ORD_PK"].Value.ToString();
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow row in efforder_seq.Rows)
- {
- double wgt = 0;
- if (!double.TryParse(row.Cells["CARRY_USE"].Value.ToString(), out wgt))
- {
- MessageUtil.ShowTips("结转重量填写错误或未填写");
- return;
- }
- if (wgt == 0)
- {
- MessageUtil.ShowTips("结转重量不能为0");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(row.Cells["BALNCE_PRICE_ORG"].Value.ToString());
- list.Add(row.Cells["CARRY_USE"].Value.ToString());
- list.Add(row.Cells["CARRY_MONEY"].Value.ToString());
- list.Add(row.Cells["ORD_LN_PK"].Value.ToString());
- parm.Add(list);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.frmOrderEffect";
- ccp.MethodName = "saveCarryOrgInfo";
- ccp.ServerParams = new object[] { parm ,UserInfo.GetUserName()};
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("结转成功!");
- doQuery();
- foreach (UltraGridRow row in gffect_oder.Rows)
- {
- if (ordPk.Equals(row.Cells["ORD_PK"].Value.ToString()))
- {
- row.Activate();
- break;
- }
- }
- }
- }
- public void doQuery()
- {
- //签约时间
- string date = "";
- String orderStart = "";
- String orderEnd = "";
- if (che_date.Checked)
- {
- orderStart = Convert.ToDateTime(date_starte.Value).ToString("yyyy-MM-dd") + " 00:00:01";
- orderEnd = Convert.ToDateTime(date_end.Value).ToString("yyyy-MM-dd") + " 23:59:59";
- }
- else
- {
- orderStart = "1000-01-01 00:00:01";
- orderEnd = "9999-12-31 23:59:59";
- }
- //合同号
- string order = "";
- if (ord_no.Checked)
- order = orde_cho.Text.Trim();
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderCarryPriceQuery", new Object[] { order, orderStart, orderEnd }, this.ob);
- gffect_oder.DataSource = dt;
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptColumns(gffect_oder, new UltraGridColumn[] { });
- }
- private void che_date_CheckedChanged(object sender, EventArgs e)
- {
- date_starte.Enabled = che_date.Checked;
- date_end.Enabled = che_date.Checked;
- }
- private void ord_no_CheckedChanged(object sender, EventArgs e)
- {
- orde_cho.Enabled = ord_no.Checked;
- }
- private void gffect_oder_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = gffect_oder.ActiveRow;
- if (ugr == null)
- return;
- this.doQueryeffect(gffect_oder.ActiveRow.Cells["ORD_PK"].Text);
- this.doQueryeffect_mol(gffect_oder.ActiveRow.Cells["ORDER_MODEL_NO"].Value.ToString());
- this.queryPriceInfo(gffect_oder.ActiveRow.Cells["ORD_PK"].Text);
- }
- private void queryPriceInfo(string ordPk)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.sale.order.frmOrderEffect.queryPriceInfo", new object[] { ordPk }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- txtPrice.Text = dt.Rows[0][0].ToString();
- }
- }
- private void doQueryeffect_mol(string ordermodel)
- {
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderEffectinfo", new Object[] { ordermodel }, this.ob);
- efforder_mol.DataSource = dt;
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptColumns(efforder_mol, new UltraGridColumn[] {
-
- });
- }
- private void doQueryeffect(string order)
- {
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderCarrySqeQuery", new Object[] { order }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.orderLineDt, true);
- foreach (DataRow dr in orderLineDt.Rows)
- {
- double actWt = 0;
- double carryWt = 0;
- if (!double.TryParse(dr["ACT_WT"].ToString(), out actWt))
- return;
- if (!double.TryParse(dr["CARRY_WT"].ToString(), out carryWt))
- return;
- dr["CARRY_USE"] = Math.Round(actWt - carryWt, 4);
- }
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptColumns(efforder_seq, new UltraGridColumn[] { });
- }
- private void gffect_oder_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- string acustom = gffect_oder.ActiveCell.Value.ToString();
- dlgBuyerInfo spt = new dlgBuyerInfo();
- spt.oPbd = this.ob;
- spt.customer = acustom;
- spt.FilePath = "checker";
- spt.ShowDialog();
- }
- private void efforder_seq_AfterRowActivate(object sender, EventArgs e)
- {
- if (efforder_seq.ActiveRow != null)
- {
- DataTable dt = Globals.GetData("com.steering.pss.sale.order.frmOrderEffect.CoreOrderCarryOrgInfo", new Object[] { efforder_seq.ActiveRow.Cells["ORD_LN_PK"].Value.ToString() }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.carryOrg, true);
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptColumns(carry_price, new UltraGridColumn[] { });
- }
- }
- private void orde_cho_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- doQuery();
- }
- private void efforder_seq_CellDataError(object sender, CellDataErrorEventArgs e)
- {
- e.RaiseErrorEvent = false; // 阻止弹出错误提示窗口
- e.RestoreOriginalValue = true; // 恢复原始值
- e.StayInEditMode = true; // 继续保留在编辑模式
- }
- }
- }
|