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); } }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(this.DataProvider); } Pickdetailmaterial[] pickdetailmaterialList = ((Pickdetailmaterial[])domainObjects.ToArray(typeof(Pickdetailmaterial))); try { this.DataProvider.BeginTransaction(); Pick pick = _InventoryFacade.GetPick(txtPickNoQuery.Text) as Pick; if (pick == null) { WebInfoPublish.Publish(this, pick.PickNo + "拣货任务令不存在!", this.languageComponent1); return; } foreach (Pickdetailmaterial pickdetailm in pickdetailmaterialList) { int packageCount = _WarehouseFacade.GetPackageMaterialCartonnos(pick.PickNo); if (packageCount > 0) { WebInfoPublish.Publish(this, pick.PickNo + "包装信息存在, 请先删除包装信息!", this.languageComponent1); return; } } foreach (Pickdetailmaterial pickdetailm in pickdetailmaterialList) { #region delete #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 || pickHead.Status == PickHeadStatus.PickHeadStatus_MakePackingList || pickHead.Status == PickHeadStatus.PickHeadStatus_WaitPick || pickHead.Status == PickHeadStatus.PickHeadStatus_Cancel)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "拣货任务令头状态是拣料状态或制作箱单,取消状态时,才可以删除", this.languageComponent1); return; } // 2、删除已拣行明细后,该行状态变更为待拣料。 _WarehouseFacade.DeletePickdetailmaterial(pickdetailm); //delete pickdetailmsn _WarehouseFacade.DeletePickDetailMaterialSNByCartonNo(pickdetailm.Pickno, pickdetailm.Cartonno); //3、所有已拣行明细删除后,拣货任务令状态变更为待拣料。 #endregion StorageDetail storageDetail = _WarehouseFacade.GetStorageDetail(pickdetailm.Cartonno) as StorageDetail; if (storageDetail != null) { storageDetail.FreezeQty -= Convert.ToInt32(pickdetailm.Qty); storageDetail.AvailableQty += Convert.ToInt32(pickdetailm.Qty); _WarehouseFacade.UpdateStorageDetail(storageDetail); _WarehouseFacade.UpdateStorageDetailSnbyCartonNo(pickdetailm.Cartonno, "N"); } if (pickDetail.Status != "Cancel") { pickDetail.Status = PickDetail_STATUS.Status_Pick; } pickDetail.SQTY -= pickdetailm.Qty; int count = _WarehouseFacade.GetPickdetailmaterialCount(pickdetailm.Pickno); 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); } }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(this.DataProvider); } Pickdetailmaterial[] pickdetailmaterialList = ((Pickdetailmaterial[])domainObjects.ToArray(typeof(Pickdetailmaterial))); try { this.DataProvider.BeginTransaction(); foreach (Pickdetailmaterial pickdetailm in pickdetailmaterialList) { #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_ClosePick)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "行明细是拣料中和拣料完成状态,才可以删除", this.languageComponent1); return; } if (!(pickHead.Status == PickHeadStatus.PickHeadStatus_Pick || pickHead.Status == PickHeadStatus.PickHeadStatus_MakePackingList)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "拣货任务令头状态是拣料状态或制作箱单状态时,才可以删除", this.languageComponent1); return; } // 2、删除已拣行明细后,该行状态变更为待拣料。 _WarehouseFacade.DeletePickdetailmaterial(pickdetailm); pickDetail.Status = PickDetail_STATUS.Status_Pick; //3、所有已拣行明细删除后,拣货任务令状态变更为待拣料。 int count = _WarehouseFacade.GetPickdetailmaterialCount(pickdetailm.Pickno); 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); } }