Exemplo n.º 1
0
        protected void cmdDelete_ServerClick(object sender, EventArgs e)
        {
            if (_WarehouseFacade == null)
            {
                _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);
            }
            if (inventoryFacade == null)
            {
                inventoryFacade = new BenQGuru.eMES.Material.InventoryFacade(base.DataProvider);
            }
            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array == null)
            {
                return;
            }
            List <BenQGuru.eMES.Domain.Warehouse.PickDetail> ll = new List <BenQGuru.eMES.Domain.Warehouse.PickDetail>();

            foreach (GridRecord row in array)
            {
                BenQGuru.eMES.Domain.Warehouse.PickDetail obj = (BenQGuru.eMES.Domain.Warehouse.PickDetail)_WarehouseFacade.GetPickdetail(txtPickNoQuery.Text, row.Items.FindItemByKey("PICKLINE").Text);

                if (obj.Status != "Release")
                {
                    WebInfoPublish.Publish(this, obj.PickNo + "状态不为初始化!", this.languageComponent1); return;
                }


                if (inventoryFacade.GetPickDetailMaterialsCount(obj.PickNo, obj.PickLine) > 0)
                {
                    WebInfoPublish.Publish(this, obj.PickNo + ":" + obj.PickLine + "正在拣料中,不能删除!", this.languageComponent1);
                    return;
                }

                ll.Add(obj);
            }

            try
            {
                this.DataProvider.BeginTransaction();

                foreach (BenQGuru.eMES.Domain.Warehouse.PickDetail p in ll)
                {
                    _WarehouseFacade.DeletePickToPo(p.PickNo, p.PickLine);  //add by sam
                    _WarehouseFacade.DeletePickdetail(p);
                }

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