private object GetEditObject() { if (this.ValidateInput()) { if (_apFacade == null) { _apFacade = new SMTFacadeFactory(base.DataProvider).CreateArmorPlateFacade(); } ArmorPlate obj = this._apFacade.CreateNewArmorPlate(); obj.ArmorPlateID = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtAPIDEdit.Text, 40)); obj.BasePlateCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtBPCodeEdit.Text, 40)); obj.Version = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtVersionEdit.Text, 40)); obj.Thickness = Convert.ToDecimal(FormatHelper.CleanString(this.txtThicknessEdit.Text)); obj.ManufacturerSN = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtManSNEdit.Text, 40)); obj.LBRate = Convert.ToInt32(FormatHelper.CleanString(this.txtLBRateEdit.Text)); obj.TensionA = Convert.ToDecimal(FormatHelper.CleanString(this.txtTenAEdit.Text)); obj.TensionB = Convert.ToDecimal(FormatHelper.CleanString(this.txtTenBEdit.Text)); obj.TensionC = Convert.ToDecimal(FormatHelper.CleanString(this.txtTenCEdit.Text)); obj.TensionD = Convert.ToDecimal(FormatHelper.CleanString(this.txtTenDEdit.Text)); obj.TensionE = Convert.ToDecimal(FormatHelper.CleanString(this.txtTenEEdit.Text)); obj.InFactoryDate = FormatHelper.TODateInt(this.txtInFacDate.Text); obj.InFactoryTime = FormatHelper.TOTimeInt(this.txtInFacTime.Text); obj.Memo = FormatHelper.CleanString(this.txtMemoEdit.Text, 100); obj.UsedTimes = 0; obj.Status = ArmorPlateStatus.StartUsing; obj.MaintainUser = this.GetUserCode(); string[] items = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemEdit.Text)).Split(','); if (items != null && items.Length > 0) { //-------Modify by DS22 / Crane.Liu 2014-02-27 Start-------------- /// Description: /// 新增钢板,选择多个产品;维护后保存,再查看该钢板,发现对应产品只有选择多个产品的第一个和最后一个; /// 保存时有一段过滤重复产品的逻辑,不正确,导致只能得到头尾两个产品 /// List <string> itemList = new List <string>(items); ItemFacade itemFacade = new SMTFacadeFactory(base.DataProvider).CreateItemFacade(); ArmorPlate2Item[] ap2Items = new ArmorPlate2Item[itemList.Count]; int i = 0; foreach (string itemstr in itemList) { ArmorPlate2Item ap2Item = this._apFacade.CreateNewArmorPlate2Item(); ap2Item.ArmorPlateID = obj.ArmorPlateID; ap2Item.ItemCode = itemstr.ToString(); ap2Item.MaintainUser = this.GetUserCode(); object item = itemFacade.GetItem(ap2Item.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); ap2Items[i++] = ap2Item; } //-------Modify by DS22 / Crane.Liu 2014-02-27 End---------------- obj.Items = ap2Items; } return(obj); } else { return(null); } }
private object[] GetEditObject() { if (this.ValidateInput()) { if (_solderPasteFacade == null) { _solderPasteFacade = new SMTFacadeFactory(base.DataProvider).CreateSolderPasteFacade(); } string[] items = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemEdit.Text, int.MaxValue)).Split(','); if (items != null && items.Length > 0) { ItemFacade itemFacade = new SMTFacadeFactory(base.DataProvider).CreateItemFacade(); object[] spis = new object[items.Length]; for (int i = 0; i < items.Length; i++) { SolderPaste2Item obj = this._solderPasteFacade.CreateNewSolderPaste2Item(); obj.ItemCode = items[i]; object item = itemFacade.GetItem(obj.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (item == null) { ExceptionManager.Raise(this.GetType(), string.Format("$Domain_ItemCode=[{0}], $Error_Not_Maintain", obj.ItemCode)); return(null); } object sp2Item = _solderPasteFacade.GetSolderPaste2Item(obj.ItemCode); if (sp2Item != null) { ExceptionManager.Raise(this.GetType(), string.Format("$Domain_ItemCode=[{0}], $Error_SPType_Maintain${1}", obj.ItemCode, (sp2Item as SolderPaste2Item).SolderPasteType)); return(null); } ///* 3.1 无铅锡膏可以用于产品代码编码中第二码是字母的所有产品 */ //if( string.Compare( drpSPTypeEdit.SelectedValue, SolderPasteType.Pb_Free, true )==0 // && (!char.IsLetter( obj.ItemCode, 1 )) // && char.IsDigit( obj.ItemCode, 1 ) ) //{ // ExceptionManager.Raise( this.GetType(), string.Format("$Domain_ItemCode=[{0}], $Error_SPType_Should_Maintain${1}", // obj.ItemCode, SolderPasteType.Pb ) ); // return null; //} ///* 3.2 有铅锡膏可以用于产品代码编码中第二码是数字的所有产品 */ //else if( string.Compare( drpSPTypeEdit.SelectedValue, SolderPasteType.Pb, true )==0 // && (!char.IsDigit( obj.ItemCode, 1 )) // && char.IsLetter( obj.ItemCode, 1 )) //{ // ExceptionManager.Raise( this.GetType(), string.Format("$Domain_ItemCode=[{0}], $Error_SPType_Should_Maintain${1}", // obj.ItemCode, SolderPasteType.Pb_Free ) ); // return null; //} obj.SolderPasteType = drpSPTypeEdit.SelectedValue; obj.MaintainUser = this.GetUserCode(); spis[i] = obj; } return(spis); } return(null); } else { return(null); } }