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 Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using Core.StlMes.Client.YdmBase; namespace Core.StlMes.Client.YdmPipeManage { public partial class frmBatchesPip : Form { OpeBase _ob; public frmBatchesPip(OpeBase ob) { _ob = ob; InitializeComponent(); } public frmBatchesPip(OpeBase ob,string type) { _ob = ob; Type = type; InitializeComponent(); } // 类型 1.正尺 2.非正尺 private string type = "1"; public string Type { get { return type; } set { type = value; } } //判定支数 private string allCount; public string AllCount { get { return allCount; } set { allCount = value; } } //判定重量 private string allWgt; public string AllWgt { get { return allWgt; } set { allWgt = value; } } //合同上限重量 private string sxWgt; public string SxWgt { get { return sxWgt; } set { sxWgt = value; } } //已缴库量 private string pipWgt; public string PipWgt { get { return pipWgt; } set { pipWgt = value; } } public string finishedProduct;//成品类别 public string buttonValue; public string count; public string outWgt; public string _allCount; public string _allWgt; public bool flag = false; private void frmBatchesPip_Load(object sender, EventArgs e) { txtPdCount.Text = AllCount; txtPdWgt.Text = AllWgt; txtSxWgt.Text = sxWgt; txtPipWgt.Text = pipWgt; int numBer = int.Parse(AllCount); double wgt = double.Parse(AllWgt); double nvlWgt = ((wgt * 1000) / numBer) / 1000; int m = 0; for (int i = 0; i < numBer+1; i++) { if (i * nvlWgt > double.Parse(sxWgt)) { m = i -1; break; } } txtHtCount.Text = m.ToString(); //txtHtWgt.Text = (m * nvlWgt).ToString(); if ("2".Equals(Type)) { textValue.Text = "缴库量大于合同行长短尺量差上限,是否缴库?"; ultraButton3.Text = "按长短尺上限缴库"; } initBase(); } /// /// 加载成品类别 /// private void initBase() { YdmBaseClass.InitComboEditor(cmbProduct, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getFinishedProduct", "BASECODE", this._ob, false); } private void ultraButton1_Click(object sender, EventArgs e) { this.buttonValue = "1"; flag = true; this.Close(); } private void ultraButton2_Click(object sender, EventArgs e) { buttonValue = "0"; flag = true; this.Close(); } private void ultraButton3_Click(object sender, EventArgs e) { buttonValue = "2"; count = this.txtHtCount.Text.ToString().Trim(); outWgt = this.txtHtWgt.Text.ToString().Trim(); finishedProduct = this.cmbProduct.Value.ToString2(); //if (finishedProduct == "") //{ // MessageBox.Show("请选择成品区分!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} if (count == "") { MessageBox.Show("分批缴库时请输入支数!","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning); return; } if (count != "") { this.Close(); } flag = true; } private void txtHtCount_TextChanged(object sender, EventArgs e) { int numBer = int.Parse(AllCount); double wgt = double.Parse(AllWgt); double nvlWgt = ((wgt * 1000) / numBer) / 1000; count = this.txtHtCount.Text.ToString().Trim(); //outWgt = this.txtHtWgt.Text.ToString().Trim(); if (!StringUtil.IsInt(count)) { MessageBox.Show("支数应输入整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (count != "") { this.txtHtWgt.Text = string.Format("{0:F}",(nvlWgt * int.Parse(count))); } } } }