private bool CheckData(out string msg) { msg = "OK"; if (lbLogInfo.Items.Count >= 1000) { //数据项太多了--清除 lbLogInfo.Items.Clear(); lbLogInfo.Items.Add("日志大于1000条,清空!"); } //if (txtHourseName.Text != "原料仓(主仓)") //{ // msg = "仅原料仓(主仓)的料盘可以进行分盘"; // return false; //} if (txt_BarCode.Text == string.Empty) { msg = "料卷信息为空!"; return(false); } if (txtSigleCount.Text == string.Empty) { msg = "单盘物料数量为空!"; return(false); } if (txtDiskNum.Text == string.Empty) { msg = "分盘数量为空!"; return(false); } DataTable dt = NMS.QueryDataTable(PubUtils.uContext, string.Format("select * from T_Bllb_StockInfo_tbsi where SerialNumber='{0}'", txt_Reelid.Text.Trim())); if (dt.Rows.Count > 0) { string ShelfID = StringChange.ChangeNullToString(dt.Rows[0]["Location_SN"]); if (ShelfID != "") { msg = "料盘上架中!"; return(false); } } else { msg = "料盘编号错误!"; return(false); } return(true); }
static void Main(string[] args) { StringChange prov = new StringChange(); prov.InputStr(); prov.NewStr(); prov.Print(); /* TextChack prov = new TextChack(); * prov.Chack(); * prov.Print();*/ /*TextWork prov = new TextWork(); * prov.InputText(); * if (prov.IsPolindrom()) * Console.WriteLine("It is polindrom"); * else * Console.WriteLine("It is not polindrom"); * * prov.Print();*/ }
public FrmMetaBindingEdit(string newpn) { InitializeComponent(); int SH = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2; int SW = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2; this.Location = new Point(SW, SH); DataTable dt = NMS.QueryDataTable(CIT.MES.PubUtils.uContext, "select * from sysDatMPNcustomer"); for (int i = 0; i < dt.Rows.Count; i++) { cbx_customerID.Items.Add(dt.Rows[i][0].ToString()); } txt_old.Enabled = false; txt_new.Enabled = false; txt_new.Text = newpn; cbx_customerID.Enabled = false; dt = NMS.QueryDataTable(CIT.MES.PubUtils.uContext, "select * from mdcdatmpn where newpn='" + newpn + "'"); if (dt.Rows.Count > 0) { cbx_customerID.Text = dt.Rows[0]["CustomerType"].ToString(); txt_old.Text = dt.Rows[0]["oldpn"].ToString(); txt_Qty.Text = dt.Rows[0]["MaterialMinCount"].ToString(); txt_SupplierName.Text = dt.Rows[0]["SupplierName"].ToString(); txt_ManufacturerLocation.Text = dt.Rows[0]["ManufacturerLocation"].ToString(); txt_MaterialType.Text = dt.Rows[0]["MaterialType"].ToString(); txt_Purchase.Text = dt.Rows[0]["Purchase"].ToString(); txt_partcode1.Text = dt.Rows[0]["partcode1"].ToString(); txt_PartCode2.Text = dt.Rows[0]["partcode2"].ToString(); txt_PartCode3.Text = dt.Rows[0]["partcode3"].ToString(); txt_PartCode4.Text = dt.Rows[0]["partcode4"].ToString(); txt_PartCode5.Text = dt.Rows[0]["partcode5"].ToString(); txt_PartCode6.Text = dt.Rows[0]["partcode6"].ToString(); txt_PartCode7.Text = dt.Rows[0]["partcode7"].ToString(); txt_PartCode8.Text = dt.Rows[0]["partcode8"].ToString(); txt_PartCode9.Text = dt.Rows[0]["partcode9"].ToString(); txt_PartCode10.Text = dt.Rows[0]["partcode10"].ToString(); txt_PartCode11.Text = dt.Rows[0]["partcode11"].ToString(); txt_PartCode12.Text = dt.Rows[0]["partcode12"].ToString(); txt_PartCode13.Text = dt.Rows[0]["partcode13"].ToString(); txt_PartCode14.Text = dt.Rows[0]["partcode14"].ToString(); txt_sPartCod15.Text = dt.Rows[0]["partcode15"].ToString(); cboMSDLevel.SelectedItem = dt.Rows[0]["MSDLevel"].ToString(); cboShelfType.SelectedItem = dt.Rows[0]["ShelfType"].ToString(); try { chkIsBing.Checked = dt.Rows[0]["IsBing"] == null ? false : (bool)dt.Rows[0]["IsBing"]; } catch { } try { chkIsEnable.Checked = (bool)dt.Rows[0]["IsEnable"]; } catch { } txtWarehouseLocation.Text = dt.Rows[0]["WarehouseLocation"].ToString(); txtPasteMinCount.Text = dt.Rows[0]["PasteMinCount"].ToString(); txtShelfLife.Text = dt.Rows[0]["ShelfLife"].ToString(); if (dt.Rows[0]["MorePack"].ToString().ToLower() == "y") { chx_morepage.Checked = true; } else { chx_morepage.Checked = false; } //2018.02.27 Zach 是否送检 string sql_isSendCheck = string.Format("select IsSendCheck from dbo.MdcdatMaterial where MaterialCode='{0}'", newpn); DataTable dt_isSendCheck = NMS.QueryDataTable(CIT.MES.PubUtils.uContext, sql_isSendCheck); if (dt_isSendCheck.Rows.Count > 0) { if (StringChange.ChangeNullToString(dt_isSendCheck.Rows[0]["IsSendCheck"]) == "是") { chk_isSendCheck.Checked = true; } else { chk_isSendCheck.Checked = false; } } } FrmType = true; this.txt_partcode1.TextChanged += new System.EventHandler(this.txt_partcode1_TextChanged); this.txt_PartCode2.TextChanged += new System.EventHandler(this.txt_PartCode2_TextChanged); this.txt_PartCode3.TextChanged += new System.EventHandler(this.txt_PartCode3_TextChanged); this.txt_PartCode4.TextChanged += new System.EventHandler(this.txt_PartCode4_TextChanged); this.txt_PartCode5.TextChanged += new System.EventHandler(this.txt_PartCode5_TextChanged); this.txt_PartCode6.TextChanged += new System.EventHandler(this.txt_PartCode6_TextChanged); this.txt_sPartCod15.TextChanged += new System.EventHandler(this.txt_PartCode15_TextChanged); this.txt_PartCode7.TextChanged += new System.EventHandler(this.txt_PartCode7_TextChanged); this.txt_PartCode8.TextChanged += new System.EventHandler(this.txt_PartCode8_TextChanged); this.txt_PartCode9.TextChanged += new System.EventHandler(this.txt_PartCode9_TextChanged); this.txt_PartCode10.TextChanged += new System.EventHandler(this.txt_PartCode10_TextChanged); this.txt_PartCode11.TextChanged += new System.EventHandler(this.txt_PartCode11_TextChanged); this.txt_PartCode12.TextChanged += new System.EventHandler(this.txt_PartCode12_TextChanged); this.txt_PartCode13.TextChanged += new System.EventHandler(this.txt_PartCode13_TextChanged); this.txt_PartCode14.TextChanged += new System.EventHandler(this.txt_PartCode14_TextChanged); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ok_Click(object sender, EventArgs e) { MdcdatMaterial M = new MdcdatMaterial(); bool isSucess = false; if (txt_materialCode.Text == string.Empty) { new PubUtils().ShowNoteNGMsg("料号不能为空", 1, grade.OrdinaryError); return; } if (cbo_houseCode.SelectedValue.ToString() == string.Empty) { if (cbo_houseCode1.SelectedValue.ToString() != string.Empty || cbo_houseCode2.SelectedValue.ToString() != string.Empty) { MsgBox.Waring("请先选择默认仓库!"); return; } } if (cbo_houseCode.SelectedValue.ToString() == cbo_houseCode1.SelectedValue.ToString() || cbo_houseCode.SelectedValue.ToString() == cbo_houseCode2.SelectedValue.ToString()) { new PubUtils().ShowNoteNGMsg("备用仓库不能跟默认仓库相同", 2, grade.RepeatedError); return; } if (cbo_houseCode1.SelectedValue.ToString() != string.Empty && cbo_houseCode2.SelectedValue.ToString() != string.Empty) { if (cbo_houseCode1.SelectedValue.ToString() == cbo_houseCode2.SelectedValue.ToString()) { new PubUtils().ShowNoteNGMsg("备用仓库1不能跟备用仓库2相同", 2, grade.RepeatedError); return; } } M.MaterialCode = txt_materialCode.Text.Trim(); M.MaterialName = txt_materialName.Text.Trim(); if (cbo_Type.SelectedValue.ToString() != "-1")//类型 { M.Type = cbo_Type.Text.ToString(); } if (cbo_houseCode.SelectedValue.ToString() != "-1")//默认苍库 { M.HouseCode = cbo_houseCode.SelectedValue.ToString(); } M.HouseCode1 = cbo_houseCode1.SelectedValue.ToString(); M.HouseCode2 = cbo_houseCode2.SelectedValue.ToString(); if (cbo_isMSD.SelectedValue.ToString() != "-1")//是否MSD { M.IsMSD = cbo_isMSD.SelectedValue.ToString(); } if (cbo_isSendCheck.SelectedValue.ToString() != "-1")//是否送检 { M.IsSendCheck = cbo_isSendCheck.Text.Trim(); } if (cbo_inComingType.SelectedValue.ToString() != "-1")//供料模式 { M.INCOMINGTYPE = cbo_inComingType.SelectedValue.ToString(); } if (cbo_secMateiralClass.Text != "")//辅材等级 { M.SecondMaterialClass = cbo_secMateiralClass.Text.Trim(); } M.PackageType = txt_packType.Text.Trim(); M.PackagingMax = txt_packMax.Text.Trim(); M.PackagingMin = txt_packMin.Text.Trim(); M.ShelfLifeTime = StringChange.ChangeNullToInt(txt_shelfLifeTime.Text.Trim(), 0); M.SafeQty = StringChange.ChangeNullToInt(txt_safeQty.Text.Trim(), 0); if (_isAddOrEdit == false) { string strSql = string.Format(@"select * from MdcdatMaterial where MaterialCode='{0}'", txt_materialCode.Text.Trim()); DataTable dt = NMS.QueryDataTable(PubUtils.uContext, strSql); if (dt.Rows.Count > 0) { new PubUtils().ShowNoteNGMsg("料号已存在", 2, grade.RepeatedError); return; } isSucess = MdcdatMaterial_DAL.Insert(M); } else { M.MaterialCode = obj.MaterialCode; isSucess = MdcdatMaterial_DAL.Update(M); } if (isSucess) { new PubUtils().ShowNoteOKMsg("保存成功!"); this.result = DialogResult.OK; this.Close(); } }