Ejemplo n.º 1
0
        private string[] FormatExportRecord(object obj)
        {
            ArmorPlate armorPlate = obj as ArmorPlate;

            return(new string[] { armorPlate.ArmorPlateID.ToString(),
                                  armorPlate.BasePlateCode.ToString(),
                                  armorPlate.Version.ToString(),
                                  armorPlate.WithItems,
                                  armorPlate.Thickness.ToString(),
                                  armorPlate.UsedTimes.ToString("##.##"),
                                  this.languageComponent1.GetString(armorPlate.Status.ToString()),
                                  armorPlate.ManufacturerSN.ToString(),
                                  armorPlate.LBRate.ToString("##.##"),
                                  armorPlate.TensionA.ToString(),
                                  armorPlate.TensionB.ToString(),
                                  armorPlate.TensionC.ToString(),
                                  armorPlate.TensionD.ToString(),
                                  armorPlate.TensionE.ToString(),
                                  armorPlate.Memo.ToString(),
                                  //Laws Lu,2006/08/13 添加 进厂时间
                                  FormatHelper.ToDateString(armorPlate.InFactoryDate),
                                  FormatHelper.ToTimeString(armorPlate.InFactoryTime),

                                  armorPlate.MaintainUser.ToString(),
                                  FormatHelper.ToDateString(armorPlate.MaintainDate),
                                  FormatHelper.ToTimeString(armorPlate.MaintainTime) });
        }
Ejemplo n.º 2
0
        public void UpdateArmorPlate(ArmorPlate armorPlate)
        {
            if (armorPlate.Items != null)
            {
                object[]  oldItems = this.GetArmorPlate2Items(armorPlate.ArmorPlateID);
                ArrayList array    = new ArrayList(oldItems);
                this._helper.DeleteDomainObject((ArmorPlate2Item[])array.ToArray(typeof(ArmorPlate2Item)));
            }

            this.DataProvider.BeginTransaction();
            try
            {
                this._helper.UpdateDomainObject(armorPlate);
                if (armorPlate.Items != null && armorPlate.Items.Length > 0)
                {
                    for (int i = 0; i < armorPlate.Items.Length; i++)
                    {
                        this._helper.AddDomainObject(armorPlate.Items[i], false);
                    }
                }

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();

                ExceptionManager.Raise(armorPlate.GetType(), "$Error_Update_Domain_Object", ex);
            }
        }
Ejemplo n.º 3
0
        public void DeleteArmorPlate(ArmorPlate armorPlate)
        {
            this.DataProvider.BeginTransaction();
            try
            {
                object[] oldItems = this.GetArmorPlate2Items(armorPlate.ArmorPlateID);

                if (oldItems != null && oldItems.Length > 0)
                {
                    for (int i = 0; i < oldItems.Length; i++)
                    {
                        this._helper.DeleteDomainObject(oldItems[i] as ArmorPlate2Item);
                    }
                }

                this._helper.DeleteDomainObject(armorPlate,
                                                new ICheck[] { new DeleteAssociateCheck(armorPlate,
                                                                                        this.DataProvider,
                                                                                        new Type[] {
                        typeof(ArmorPlateVersionChangeList),
                        typeof(ArmorPlateStatusChangeList),
                        typeof(ArmorPlateContol)
                    }) });

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();

                ExceptionManager.Raise(armorPlate.GetType(), "$Error_Delete_Domain_Object", ex);
            }
        }
Ejemplo n.º 4
0
        protected DataRow GetGridRow(object obj)
        {
            ArmorPlate armorPlate = obj as ArmorPlate;
            //return new Infragistics.WebUI.UltraWebGrid.UltraGridRow(
            //    new object[]{   "false",
            //                    armorPlate.ArmorPlateID.ToString(),
            //                    armorPlate.BasePlateCode.ToString(),
            //                    armorPlate.Version.ToString(),
            //                    armorPlate.WithItems,
            //                    armorPlate.Thickness.ToString(),
            //                    armorPlate.UsedTimes.ToString("##.##"),
            //                    this.languageComponent1.GetString(armorPlate.Status.ToString()),
            //                    armorPlate.ManufacturerSN.ToString(),
            //                    armorPlate.LBRate.ToString("##.##"),
            //                    armorPlate.TensionA.ToString(),
            //                    armorPlate.TensionB.ToString(),
            //                    armorPlate.TensionC.ToString(),
            //                    armorPlate.TensionD.ToString(),
            //                    armorPlate.TensionE.ToString(),
            //                    armorPlate.Memo.ToString(),
            //                    //Laws Lu,2006/08/13 添加 进厂时间
            //                    FormatHelper.ToDateString(armorPlate.InFactoryDate),
            //                    FormatHelper.ToTimeString(armorPlate.InFactoryTime),

            //                    armorPlate.MaintainUser.ToString(),
            //                    FormatHelper.ToDateString(armorPlate.MaintainDate),
            //                    FormatHelper.ToTimeString(armorPlate.MaintainTime),
            //                    ""});
            DataRow row = this.DtSource.NewRow();

            row["ArmorPlateID"]   = armorPlate.ArmorPlateID.ToString();
            row["BasePlateCode"]  = armorPlate.BasePlateCode.ToString();
            row["CurrentVersion"] = armorPlate.Version.ToString();
            row["WithItem"]       = armorPlate.WithItems;
            row["Thickness"]      = armorPlate.Thickness.ToString();
            row["TotalUsedTimes"] = armorPlate.UsedTimes.ToString("##.##");
            row["Status"]         = this.languageComponent1.GetString(armorPlate.Status.ToString());
            row["ManufacturerSN"] = armorPlate.ManufacturerSN.ToString();
            row["LBRate"]         = armorPlate.LBRate.ToString("##.##");
            row["TensionA"]       = armorPlate.TensionA.ToString();
            row["TensionB"]       = armorPlate.TensionB.ToString();
            row["TensionC"]       = armorPlate.TensionC.ToString();
            row["TensionD"]       = armorPlate.TensionD.ToString();
            row["TensionE"]       = armorPlate.TensionE.ToString();
            row["Memo"]           = armorPlate.Memo.ToString();
            row["InFactoryDate"]  = FormatHelper.ToDateString(armorPlate.InFactoryDate);
            row["InFactoryTime"]  = FormatHelper.ToTimeString(armorPlate.InFactoryTime);
            row["MUSER"]          = armorPlate.MaintainUser.ToString();
            row["MDATE"]          = FormatHelper.ToDateString(armorPlate.MaintainDate);
            row["MTIME"]          = FormatHelper.ToTimeString(armorPlate.MaintainTime);
            return(row);
        }
Ejemplo n.º 5
0
        private void SetEditObject(object obj)
        {
            if (_apFacade == null)
            {
                _apFacade = new SMTFacadeFactory(base.DataProvider).CreateArmorPlateFacade();
            }
            if (obj == null)
            {
                this.txtAPIDEdit.Text      = string.Empty;
                this.txtBPCodeEdit.Text    = string.Empty;
                this.txtVersionEdit.Text   = string.Empty;
                this.txtItemEdit.Text      = string.Empty;
                this.txtThicknessEdit.Text = string.Empty;
                this.txtManSNEdit.Text     = string.Empty;
                this.txtLBRateEdit.Text    = string.Empty;
                this.txtTenAEdit.Text      = string.Empty;
                this.txtTenBEdit.Text      = string.Empty;
                this.txtTenCEdit.Text      = string.Empty;
                this.txtTenDEdit.Text      = string.Empty;
                this.txtTenEEdit.Text      = string.Empty;
                this.txtMemoEdit.Text      = string.Empty;



                return;
            }

            ArmorPlate armorPlate = obj as ArmorPlate;

            this.txtAPIDEdit.Text      = armorPlate.ArmorPlateID.ToString();
            this.txtBPCodeEdit.Text    = armorPlate.BasePlateCode.ToString();
            this.txtVersionEdit.Text   = armorPlate.Version.ToString();
            this.txtItemEdit.Text      = armorPlate.WithItems.ToString();
            this.txtThicknessEdit.Text = armorPlate.Thickness.ToString();
            this.txtManSNEdit.Text     = armorPlate.ManufacturerSN.ToString();
            this.txtLBRateEdit.Text    = armorPlate.LBRate.ToString("##.##");

            this.txtInFacDate.Text = FormatHelper.ToDateString(armorPlate.InFactoryDate);
            this.txtInFacTime.Text = FormatHelper.ToTimeString(armorPlate.InFactoryTime);

            this.txtTenAEdit.Text = armorPlate.TensionA.ToString();
            this.txtTenBEdit.Text = armorPlate.TensionB.ToString();
            this.txtTenCEdit.Text = armorPlate.TensionC.ToString();
            this.txtTenDEdit.Text = armorPlate.TensionD.ToString();
            this.txtTenEEdit.Text = armorPlate.TensionE.ToString();
            this.txtMemoEdit.Text = armorPlate.Memo.ToString();
        }
Ejemplo n.º 6
0
        public object GetArmorPlate(string armorPlateID)
        {
            object obj = this.DataProvider.CustomSearch(typeof(ArmorPlate), new object[] { armorPlateID });

            if (obj != null)
            {
                ArmorPlate ap    = obj as ArmorPlate;
                object[]   items = this.GetArmorPlate2Items(ap.ArmorPlateID);
                if (items != null && items.Length > 0)
                {
                    foreach (ArmorPlate2Item item in items)
                    {
                        ap.WithItems += item.ItemCode + ",";
                    }
                    ap.WithItems = ap.WithItems.TrimEnd(',');
                }
            }
            return(obj);
        }
Ejemplo n.º 7
0
        public object[] QueryArmorPlate(string armorPlateID, string basePlateCode, string itemcode, int inclusive, int exclusive)
        {
            string condition = string.Empty;

            if (armorPlateID != null && armorPlateID.Length > 0)
            {
                condition += string.Format(" and APID like '{0}%' ", armorPlateID);
            }

            if (basePlateCode != null && basePlateCode.Length > 0)
            {
                condition += string.Format(" and BPCODE like '{0}%' ", basePlateCode);
            }

            if (itemcode != null && itemcode.Length > 0)
            {
                condition += string.Format(" and APID in ( select APID from TBLAP2ITEM where ITEMCODE like '{0}%' ) ", itemcode);
            }

            object[] objs = this.DataProvider.CustomQuery(typeof(ArmorPlate), new PagerCondition(string.Format("select {0} from TBlARMORPLATE where 1=1 {1}", DomainObjectUtility.GetDomainObjectFieldsString(typeof(ArmorPlate)), condition), "APID", inclusive, exclusive));

            if (objs != null && objs.Length > 0)
            {
                for (int i = 0; i < objs.Length; i++)
                {
                    ArmorPlate ap = objs[i] as ArmorPlate;

                    object[] items = this.GetArmorPlate2Items(ap.ArmorPlateID);
                    if (items != null && items.Length > 0)
                    {
                        foreach (ArmorPlate2Item item in items)
                        {
                            ap.WithItems += item.ItemCode + ",";
                        }
                        ap.WithItems = ap.WithItems.TrimEnd(',');
                    }
                }
            }

            return(objs);
        }
Ejemplo n.º 8
0
        public void AddArmorPlate(ArmorPlate armorPlate)
        {
            this.DataProvider.BeginTransaction();
            try
            {
                this._helper.AddDomainObject(armorPlate);
                if (armorPlate.Items != null && armorPlate.Items.Length > 0)
                {
                    for (int i = 0; i < armorPlate.Items.Length; i++)
                    {
                        this._helper.AddDomainObject(armorPlate.Items[i]);
                    }
                }

                this.DataProvider.CommitTransaction();
            }
            catch (Exception ex)
            {
                this.DataProvider.RollbackTransaction();

                ExceptionManager.Raise(armorPlate.GetType(), "$Error_Add_Domain_Object", ex);
            }
        }
Ejemplo n.º 9
0
        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);
            }
        }
Ejemplo n.º 10
0
 public void plateDestroyed(ArmorPlate plate)
 {
     if (plates.Remove(plate))
         calculateSpeedMultiplier();
 }