protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(this.DataProvider); } Pickdetailmaterialsn[] pickdetailmaterialList = ((Pickdetailmaterialsn[])domainObjects.ToArray(typeof(Pickdetailmaterialsn))); try { this.DataProvider.BeginTransaction(); foreach (Pickdetailmaterialsn pickdetailm in pickdetailmaterialList) { #region delete //请先删除箱单信息 string sn = pickdetailm.Sn; object[] list = _WarehouseFacade.GetCartoninvdetailsnBySn(sn); if (list != null) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "请先删除箱单信息", this.languageComponent1); return; } #region delete 检查 //1、只有行明细是拣料中和拣料完成状态,且拣货任务令头状态是拣料状态或制作箱单状态时才可以删除。 PickDetail pickDetail = _InventoryFacade.GetPickDetail(pickdetailm.Pickno, pickdetailm.Pickline) as PickDetail; Pick pickHead = _InventoryFacade.GetPick(pickdetailm.Pickno) as Pick; if (pickDetail == null || pickHead == null) { this.DataProvider.RollbackTransaction(); return; } if (!(pickDetail.Status == PickDetail_STATUS.Status_Pick || pickDetail.Status == PickDetail_STATUS.Status_WaitPick || pickDetail.Status == PickDetail_STATUS.Status_ClosePick || pickDetail.Status == PickDetail_STATUS.Status_Cancel)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "行明细是拣料中和拣料完成,取消状态,才可以删除", this.languageComponent1); return; } if (!(pickHead.Status == PickHeadStatus.PickHeadStatus_Pick || pickDetail.Status == PickDetail_STATUS.Status_WaitPick || pickHead.Status == PickHeadStatus.PickHeadStatus_MakePackingList || pickHead.Status == PickHeadStatus.PickHeadStatus_Cancel)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "拣货任务令头状态是拣料状态或制作箱单,取消状态时,才可以删除", this.languageComponent1); return; } //delete pickdetailmsn _WarehouseFacade.DeletePickdetailmaterialsn(pickdetailm); // tblPickdetailmaterial object[] snlist = _WarehouseFacade.QueryPickdetailmaterialsnByCartonno(pickdetailm.Pickno, pickdetailm.Cartonno); Pickdetailmaterial pickdetailmaterial = _WarehouseFacade.GetPickdetailmaterial(pickdetailm.Pickno, pickdetailm.Cartonno) as Pickdetailmaterial; if (pickdetailmaterial != null) { pickdetailmaterial.Qty -= 1; _WarehouseFacade.UpdatePickdetailmaterial(pickdetailmaterial); if (snlist == null) { _WarehouseFacade.DeletePickdetailmaterial(pickdetailmaterial); } } //3、所有已拣行明细删除后,拣货任务令状态变更为待拣料。 #endregion StorageDetail storageDetail = _WarehouseFacade.GetStorageDetail(pickdetailm.Cartonno) as StorageDetail; if (storageDetail != null) { storageDetail.FreezeQty -= 1; storageDetail.AvailableQty += 1; _WarehouseFacade.UpdateStorageDetail(storageDetail); } StorageDetailSN storageDetailsn = _InventoryFacade.GetStorageDetailSN(pickdetailm.Sn) as StorageDetailSN; if (storageDetailsn != null) { storageDetailsn.PickBlock = "N"; _InventoryFacade.UpdateStorageDetailSN(storageDetailsn); } int count = _WarehouseFacade.GetPickdetailmaterialCount(pickdetailm.Pickno); pickDetail.SQTY -= 1; if (pickDetail.Status != "Cancel") { pickDetail.Status = PickDetail_STATUS.Status_Pick; } if (count == 0) { //pickHead.Status = PickHeadStatus.PickHeadStatus_WaitPick; _WarehouseFacade.UpdatePick(pickHead); //pickDetail.Status = PickDetail_STATUS.Status_WaitPick; } _WarehouseFacade.UpdatePickdetail(pickDetail); #endregion } this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "删除成功", this.languageComponent1); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1); } }