protected override DataRow GetGridRow(object obj) { DataRow row = this.DtSource.NewRow(); BenQGuru.eMES.Domain.MOModel.Material merterail = obj as BenQGuru.eMES.Domain.MOModel.Material; row["MaterialNo"] = merterail.MCode; row["DQMaterialNo"] = merterail.DqmCode; row["ENSDesc"] = merterail.MenshortDesc; row["ENLDesc"] = merterail.MenlongDesc; row["CHSDesc"] = merterail.MchshortDesc; row["CHLDesc"] = merterail.MchlongDesc; row["SpecialDesc"] = merterail.MspecialDesc; row["MaterialItem"] = merterail.ModelCode; row["MUOM"] = merterail.Muom; row["MaterialType"] = merterail.MaterialType; row["ROHS1"] = merterail.Rohs; row["MStatus"] = merterail.Mstate; row["MControlType"] = merterail.MCONTROLTYPE; row["MValidity"] = merterail.Validity; row["Msource"] = merterail.Sourceflag; row["MaintainUser"] = merterail.MaintainUser; row["MaintainDate"] = FormatHelper.ToDateString(merterail.MaintainDate); row["MaintainTime"] = FormatHelper.ToTimeString(merterail.MaintainTime); return(row); }
protected override object GetEditObject() { if (_facade == null) { _facade = new MOModel.ItemFacade(base.DataProvider); } BenQGuru.eMES.Domain.MOModel.Material merterial = this._facade.CreateNewMaterial(); merterial = _facade.GetMaterial(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMaterialNO.Text, 40))) as BenQGuru.eMES.Domain.MOModel.Material; merterial.MCONTROLTYPE = FormatHelper.CleanString(this.drpMaterialType.SelectedValue, 40); merterial.Validity = Int32.Parse(FormatHelper.CleanString(this.txtMaterialValidity.Text, 100)); merterial.MaintainUser = this.GetUserCode(); return(merterial); }
protected override void SetEditObject(object obj) { if (obj == null) { this.txtMaterialNO.Text = ""; this.txtMaterialENDesc.Text = ""; this.txtMaterialCHDesc.Text = ""; this.txtDQMaterialNO.Text = ""; this.drpMaterialType.SelectedIndex = 0; this.txtMaterialValidity.Text = ""; return; } BenQGuru.eMES.Domain.MOModel.Material merterial = obj as BenQGuru.eMES.Domain.MOModel.Material; this.txtMaterialNO.Text = merterial.MCode; this.txtMaterialENDesc.Text = merterial.MenshortDesc; this.txtMaterialCHDesc.Text = merterial.MchshortDesc; this.txtDQMaterialNO.Text = merterial.DqmCode; this.drpMaterialType.SelectedIndex = this.drpMaterialType.Items.IndexOf(this.drpMaterialType.Items.FindByValue(merterial.MCONTROLTYPE));; this.txtMaterialValidity.Text = merterial.Validity.ToString(); }
private void GetAllItem() { try { string fileName = string.Empty; #region new #region File if (_facade == null) { _facade = new MOModel.ItemFacade(base.DataProvider); } if (inventoryFacade == null) { inventoryFacade = new BenQGuru.eMES.Material.InventoryFacade(base.DataProvider); } string upfileName = ""; BenQGuru.eMES.Domain.Warehouse.InvDoc doc = new BenQGuru.eMES.Domain.Warehouse.InvDoc(); if (this.DownLoadPathBom.PostedFile != null) { string stno = "MaterialImport";// FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtASNSTNOQuery.Text)); HttpPostedFile postedFile = this.DownLoadPathBom.PostedFile; string path = Server.MapPath(this.VirtualHostRoot + "InvDoc/" + "物料维护/"); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider); //string CARINVNO = row.Items.FindItemByKey("CARINVNO").Text; doc.InvDocNo = stno; doc.InvDocType = "MaterialImport";//FMaterialMP string[] part = postedFile.FileName.Split(new char[] { '/', '\\' }); doc.DocType = Path.GetExtension(postedFile.FileName); doc.DocName = Path.GetFileNameWithoutExtension(postedFile.FileName); doc.DocSize = postedFile.ContentLength / 1024; doc.UpUser = GetUserCode(); doc.UpfileDate = FormatHelper.TODateInt(DateTime.Now); doc.Dirname = "物料维护"; doc.MaintainUser = this.GetUserCode(); doc.MaintainDate = dbDateTime.DBDate; doc.MaintainTime = dbDateTime.DBTime; doc.ServerFileName = doc.DocName + "_" + stno + DateTime.Now.ToString("yyyyMMddhhmmss") + doc.DocType; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } fileName = doc.ServerFileName; upfileName = path + fileName; this.DownLoadPathBom.PostedFile.SaveAs(upfileName); } else { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, "导入文件不能为空", this.languageComponent1); return; } #endregion this.UploadedFileName = upfileName; #endregion DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider); if (this.ViewState["UploadedFileName"] == null) { WebInfoPublish.Publish(this, "$Error_UploadFileIsEmpty", this.languageComponent1); //BenQGuru.eMES.Common.ExceptionManager.Raise(this.GetType().BaseType, "$Error_UploadFileIsEmpty"); } fileName = this.ViewState["UploadedFileName"].ToString(); //读取EXCEL格式文件 System.Data.DataTable dt = GetExcelData(fileName); if ((dt != null) && (dt.Rows.Count > 0)) { for (int t = 0; t < dt.Rows.Count; t++) { string dqmcode = dt.Rows[t][0].ToString().Trim(); //物料号 string validity = dt.Rows[t][1].ToString().Trim(); //有效期 if (validity.Length > 10) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "$Error_VALID_DAY_NOT_MORE_THREE", this.languageComponent1); return; } if (!IsInt(validity)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "鼎桥物料号" + dqmcode + "有效期必须是数值型", this.languageComponent1); return; } BenQGuru.eMES.Domain.MOModel.Material material = _facade.GetMaterialByDQMCode(dqmcode) as BenQGuru.eMES.Domain.MOModel.Material; if (material != null) { material.Validity = Convert.ToInt32(FormatHelper.CleanString(validity, 100)); material.MaintainDate = dbTime.DBDate; material.MaintainTime = dbTime.DBTime; material.MaintainUser = this.GetUserCode(); this._facade.UpdateMaterial(material); } else { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, dqmcode + "EXCEL表中鼎桥物料号不存在", this.languageComponent1); return; } } this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "导入成功!", this.languageComponent1); } else { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "导入内容不能为空", this.languageComponent1);//add by sam } } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1); } }