| | |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn; |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; |
| | | using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; |
| | | using Kingdee.BOS.Core.List; |
| | | using Kingdee.BOS.Core.Metadata; |
| | | using Kingdee.BOS.Core.Metadata.EntityElement; |
| | | using Kingdee.BOS.JSON; |
| | |
| | | using System.Data; |
| | | using System.Diagnostics; |
| | | using System.Linq; |
| | | using System.Threading; |
| | | using System.Web; |
| | | using ZD.Cloud.Logger; |
| | | using ZD.Cloud.WebApi; |
| | |
| | | { |
| | | this.View.ShowMessage("操作成功!"); |
| | | } |
| | | } |
| | | //选单 |
| | | if (e.BarItemKey.ToUpper() == "TBSELECTMENU") |
| | | { |
| | | SelectMenu(); |
| | | } |
| | | //预留 |
| | | if (e.BarItemKey.ToUpper() == "TBRESERVE") |
| | |
| | | //if (result > 0) |
| | | //{ |
| | | //锁定后生成日计划用料清单 及 提料计划 |
| | | DayPlanPPBomBillBatch(); |
| | | DayPlanPPBomBill(); |
| | | //Extraction(); |
| | | SearchList(); |
| | | this.View.ShowMessage("操作成功"); |
| | |
| | | delete z_JIT_MOMaterReadysBill |
| | | ", item.FHMainICMOInterIDr, item.FHMainICMOEntryID, item.FHICMOInterID, item.FHICMOEntryID, item.FHMaterID, item.FHStockOrgID, item.FHStockQty, item.FHLeftQty, item.FHPRDORGID, item.FUnitDosage, item.FSumPlanCount, item.FPRDBillNo, item.FOwnerId == null ? "0" : item.FOwnerId, item.FPlanDate.ToString("yyyy-MM-dd"), item.FComPlete, item.FLackCount, item.FOccupyCount, item.FCompleteCount1, item.FErpClsID); |
| | | sqlList.Add(sql); |
| | | this.View.Session["ProcessRateValue"] = Convert.ToInt32((Convert.ToDecimal(98) / completeAnalysisTempModel.Count) * jdtmmm); |
| | | this.View.Session["ProcessRateValue"] = Convert.ToInt32((Convert.ToDecimal(80) / completeAnalysisTempModel.Count) * jdtmmm); |
| | | jdtmmm++; |
| | | } |
| | | DBServiceHelper.ExecuteBatch(Context, sqlList); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 日计划用料清单进度条 |
| | | /// </summary> |
| | | private void DayPlanPPBomBill() |
| | | { |
| | | // 显示一个进度显示界面:显示一个不停滚动的模拟进度 |
| | | // bUseTruePro参数:是否显示真实的进度。 |
| | | // bUseTruePro = false : |
| | | // 显示一个不停滚动的模拟进度,与实际处理进度没有关联。 |
| | | // 此方案优点:实际处理代码无需计算进度 |
| | | // 此方案缺点:进度不准确,且进度页面不会自动关闭。 |
| | | // bUseTruePro = true: 进度界面显示真实进度 |
| | | // 此方案优点:进度真实 |
| | | // 此方案缺点:需要在处理代码中,不断的更新真实进度,更新语句 |
| | | // this.View.Session["ProcessRateValue"] = 100; |
| | | // 特别说明,当进度更新到100时,进度界面会自动关闭 |
| | | // 本案例选用此方案 |
| | | var processForm = this.View.ShowProcessForm( |
| | | new Action<FormResult>(t => { }), |
| | | true, |
| | | "正在生成,请稍候..."); |
| | | |
| | | // 开启一个异步线程,处理引入功能 |
| | | // using Kingdee.BOS.KDThread; |
| | | MainWorker.QuequeTask(() => |
| | | { |
| | | try |
| | | { |
| | | // 需要捕获错误,以确保处理结束时,关闭进度滚动界面 |
| | | // 引入功能实际处理函数 |
| | | this.DayPlanPPBomBillBatch(); |
| | | } |
| | | finally |
| | | { |
| | | // 确保标记进度已经到达100% |
| | | this.View.Session["ProcessRateValue"] = 100; |
| | | // 引入完毕,关闭进度显示页面 |
| | | var processView = this.View.GetView(processForm.PageId); |
| | | if (processView != null) |
| | | { |
| | | processView.Close(); |
| | | this.View.SendDynamicFormAction(processView); |
| | | } |
| | | } |
| | | }, |
| | | (t) => { }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 日计划用料清单生成 |
| | | /// </summary> |
| | | public void DayPlanPPBomBillBatch() |
| | |
| | | DBServiceHelper.ExecuteBatch(Context, zxSqlList); |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start();//开始计时 |
| | | //Thread.Sleep(6000); |
| | | LogHelper.Info("生成日计划用料清单准备数据"); |
| | | //锁定的日计划不生成 |
| | | try |
| | |
| | | LogHelper.Info($"日计划用料清单,数据准备完成,保存到Model实体,总行数:{DayPlanMaterial.Count},耗时:" + sw.Elapsed); |
| | | var fidList = DayPlanMaterial.Select(x => x.FEntryID).Distinct().ToList(); |
| | | int i = 1; |
| | | int jdtmmm = 1; |
| | | JArray Fentity = new JArray(); |
| | | foreach (var item in fidList) |
| | | { |
| | |
| | | Fentity = new JArray(); |
| | | } |
| | | i++; |
| | | |
| | | this.View.Session["ProcessRateValue"] = Convert.ToInt32((Convert.ToDecimal(80) / fidList.Count) * jdtmmm); |
| | | jdtmmm++; |
| | | } |
| | | } |
| | | sw.Stop();//结束计时 |
| | |
| | | this.View.ShowErrMessage(ex.Message.ToString()); |
| | | } |
| | | } |
| | | |
| | | public void SelectMenu() { |
| | | //获取单据体信息 |
| | | Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity"); |
| | | //单据体信息转换为列表集合 |
| | | DynamicObjectCollection entityDataObjoct = this.View.Model.GetEntityDataObject(entity); |
| | | int Fseq = entityDataObjoct.Count(); |
| | | |
| | | string pageId = Guid.NewGuid().ToString(); |
| | | ListShowParameter showParameter = new ListShowParameter(); |
| | | showParameter.FormId = "PRD_MO"; |
| | | showParameter.PageId = pageId; |
| | | showParameter.UseOrgId = this.Context.CurrentOrganizationInfo.ID; |
| | | showParameter.IsLookUp = true; |
| | | this.View.ShowForm(showParameter); |
| | | |
| | | this.View.ShowForm(showParameter, delegate (FormResult result) |
| | | { |
| | | object returnData = result.ReturnData; |
| | | if (returnData is ListSelectedRowCollection) |
| | | { |
| | | ListSelectedRowCollection listSelectedRowCollection = returnData as ListSelectedRowCollection; |
| | | if (listSelectedRowCollection != null) |
| | | { |
| | | foreach (var listSelectedRow in listSelectedRowCollection) |
| | | { |
| | | this.Model.CreateNewEntryRow("FEntity"); |
| | | this.View.Model.SetValue("FORGID",100, Fseq); |
| | | this.View.Model.SetValue("FSCOrderNo", listSelectedRow.DataRow["FBillNo"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FSRCBILLENTRYSEQ", listSelectedRow.DataRow["t1_FSeq"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FMatrailId", listSelectedRow.DataRow["FMaterialId_Id"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FFUnit", listSelectedRow.DataRow["FUnitId_Id"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FOrderQuantity", listSelectedRow.DataRow["FQty"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FProductWorkShopId", listSelectedRow.DataRow["FWorkShopID_Id"].ToString(), Fseq); |
| | | this.View.Model.SetValue("FOrderLevel", "3", Fseq); |
| | | Fseq++; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |