/// <summary> /// 取消分配 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnCancelAllocation84_Click_Extend(object sender, EventArgs e) { if (this.Model.BillNoItemHead.FocusedRecord == null) { throw new Exception("没有发票号组"); } if (this.Model.BillNoItemHead.FocusedRecord != null && this.Model.BillNoItemHead.FocusedRecord.BillNoItemStates == 0) { throw new Exception("发票号组未分配,无需取消分配"); } if (this.Model.BilAlllcationShipPlanView.SelectRecords.Count <= 0) { throw new Exception("没有选择出运明细单"); } UFIDA.U9.Cust.GS.FT.OperateShipPlanBP.Proxy.AllocationBillNoProxy proxy = new OperateShipPlanBP.Proxy.AllocationBillNoProxy(); //proxy.BillNoItemHead = this.Model.BillNoItemHead.FocusedRecord.Key; List <long> listShipPlan = new List <long>(); foreach (BilAlllcationShipPlanViewRecord recourd in this.Model.BilAlllcationShipPlanView.SelectRecords) { if (!listShipPlan.Contains(recourd.ShipPlanDetailHead ?? 0)) { listShipPlan.Add(recourd.ShipPlanDetailHead ?? 0); } } proxy.ShipPlanList = listShipPlan; proxy.Type = 4; int result = proxy.Do(); if (result > 0) { if (this.BtnOk.Visible) { this.CloseDialog(true); } else { foreach (BilAlllcationShipPlanViewRecord recourd in this.Model.BilAlllcationShipPlanView.SelectRecords) { recourd.Remove(); } } } OnCancelAllocation84_Click_DefaultImpl(sender, e); }
//OnComSpace0_Click... private void OnComSpace0_Click_Extend(object sender, EventArgs e) { //调用模版提供的默认实现.--默认实现可能会调用相应的Action. this.Model.ClearErrorMessage(); IList <IUIRecord> recordList = this.Model.ShipPlanDetailHead.Cache.GetSelectRecord(); //选择所有数据 UFIDA.U9.Cust.GS.FT.OperateShipPlanBP.Proxy.AllocationBillNoProxy proxy = new OperateShipPlanBP.Proxy.AllocationBillNoProxy(); List <long> listShipPlan = new List <long>(); foreach (ShipPlanDetailHeadRecord record in recordList) { if (record.ID > 0L && record.IsSelected) { if (!listShipPlan.Contains(record.ID)) { listShipPlan.Add(record.ID); } } } if (listShipPlan.Count > 0) { proxy.ShipPlanList = listShipPlan; proxy.Type = 2; int result = proxy.Do(); if (result > 0) { ShowAlertMessage(this, "订舱成功"); } this.Action.NavigateAction.Refresh(null, true); } else { throw new Exception("请选择要确认订舱的出运明细单"); } OnComSpace0_Click_DefaultImpl(sender, e); }
//OnAllocation0_Click... private void OnAllocation0_Click_Extend(object sender, EventArgs e) { //调用模版提供的默认实现.--默认实现可能会调用相应的Action. //出运明细单保存 //if(this.Code70.Text.Trim() == "") // throw new Exception("没有发票号组编码"); //if (this.Model.BillNoItemHead.FocusedRecord == null) // throw new Exception("没有发票号组信息"); if (this.Model.BillNoItemHead_BillNoItemLine.Records.Count <= 0) { //throw new Exception("没有发票号信息"); this.Model.ErrorMessage.Message = "没有发票号信息"; return; } //else if (this.Model.BillNoItemHead_BillNoItemLine.Records.Count == 1) //{ // if (this.Model.BillNoItemHead_BillNoItemLine.FocusedRecord.ID <= 0) // { // this.Model.ErrorMessage.Message = "请录入发票号"; // return; // } //} //勾选的出运明细单必须是同一种装柜方式 if (this.Model.BilAlllcationShipPlanView.SelectRecords.Count <= 0) { //this.Model.ErrorMessage.Message = "没有选择出运明细单"; //return; throw new Exception("没有选择出运明细单"); } UFIDA.U9.Cust.GS.FT.OperateShipPlanBP.Proxy.AllocationBillNoProxy proxy = new OperateShipPlanBP.Proxy.AllocationBillNoProxy(); List <long> listShipPlan = new List <long>(); //不同币种、接单组织、外销员、出运日期的出运明细单不允许分配同一个发票号组 string parkType = "", currenty = "", saleMan = ""; int count = 0; long org = 0; DateTime shipPlanDate = DateTime.Now; foreach (BilAlllcationShipPlanViewRecord recourd in this.Model.BilAlllcationShipPlanView.SelectRecords) { ////放在BP校验 //if (count > 0) //{ // if (parkType != "" && parkType != recourd.ParkingType) //出运明细单必须是同一种装柜方式; // { // throw new Exception("出运明细单" + recourd.ShipPlanDetailHead_DocNo + "与其他不为同一种装柜方式"); // } // //不同币种、接单组织、外销员、出运日期的出运明细单不允许分配同一个发票号组; // if (currenty != recourd.Currency) // { // throw new Exception("出运明细单" + recourd.ShipPlanDetailHead_DocNo + "与其他明细单不为同一种币种"); // } // if (org != recourd.Org) // { // throw new Exception("出运明细单" + recourd.ShipPlanDetailHead_DocNo + "与其他明细单不为相同接单组织"); // } // if (saleMan != recourd.SaleMan) // { // throw new Exception("出运明细单" + recourd.ShipPlanDetailHead_DocNo + "与其他明细单不为同一个业务员"); // } // if (shipPlanDate.ToString("yyyy-MM-dd") != (recourd.Date??DateTime.Now).ToString("yyyy-MM-dd")) // { // throw new Exception("出运明细单" + recourd.ShipPlanDetailHead_DocNo + "与其他明细单出运日期不同"); // } //} if (!listShipPlan.Contains(recourd.ShipPlanDetailHead ?? 0)) { listShipPlan.Add(recourd.ShipPlanDetailHead ?? 0); } parkType = recourd.ParkingType; currenty = recourd.Currency; saleMan = recourd.SaleMan; org = recourd.Org ?? 0; count++; } BtnSave_Click_DefaultImpl(sender, e); proxy.ShipPlanList = listShipPlan; proxy.Type = 0; proxy.BillNoItemHead = this.Model.BillNoItemHead.FocusedRecord.ID; //if (BtnOk.Visible) //{ // BtnOk_Click(sender, e); //} int result = proxy.Do(); if (result > 0) { if (NavigateManager.IsTitleLink(this) || NavigateManager.IsModelPopup(this)) { //BtnOk_Click(sender, e); this.CloseDialog(true); } else { //分配的发票号组更新到明细单界面 } } OnAllocation0_Click_DefaultImpl(sender, e); }