From 3ee1243be7aa6a7bdbfc23a96da82dc72b4de3b4 Mon Sep 17 00:00:00 2001 From: 王 垚 <1402714037@qq.com> Date: 星期四, 31 十二月 2020 11:25:06 +0800 Subject: [PATCH] 代码上传 --- src/BLL/Demo.BillView/PRD/ProCompleteAnalysisDetails.cs | 110 ++++++++++++++++++++++++++---------------------------- 1 files changed, 53 insertions(+), 57 deletions(-) diff --git a/src/BLL/Demo.BillView/PRD/ProCompleteAnalysisDetails.cs b/src/BLL/Demo.BillView/PRD/ProCompleteAnalysisDetails.cs index b2a07cb..06bd552 100644 --- a/src/BLL/Demo.BillView/PRD/ProCompleteAnalysisDetails.cs +++ b/src/BLL/Demo.BillView/PRD/ProCompleteAnalysisDetails.cs @@ -1,18 +1,14 @@ -锘縰sing Kingdee.BOS.App.Data; -using Kingdee.BOS.Core.DynamicForm; +锘縰sing Kingdee.BOS.Core.DynamicForm; using Kingdee.BOS.Core.DynamicForm.PlugIn; -using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; -using Kingdee.BOS.Core.Metadata.EntityElement; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using System; -using System.Collections.Generic; using System.ComponentModel; using System.Data; -using System.Linq; -using System.Text; using Kingdee.BOS.ServiceHelper; -using System.Threading.Tasks; +using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; +using Kingdee.BOS.Core.Metadata.EntityElement; +using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; namespace Demo.BillView { @@ -24,7 +20,6 @@ public override void OnLoad(EventArgs e) { base.OnLoad(e); - if (this.View.OpenParameter.GetCustomParameter("FHMainICMOInterID") == null) { SearchList(); @@ -33,46 +28,55 @@ { if (did) return; - string FHMainICMOInterIDr = this.View.OpenParameter.GetCustomParameter("FHMainICMOInterID").ToString();//涓荤敓浜ц鍗曚富鍐呯爜 string FHMainICMOEntryID = this.View.OpenParameter.GetCustomParameter("FHMainICMOEntryID").ToString();// 涓荤敓浜ц鍗曞瓙鍐呯爜 string FHICMOInterID = this.View.OpenParameter.GetCustomParameter("FHICMOInterID").ToString();//鏃ヨ鍒掕鍗曚富鍐呯爜 - //string FMatrailId_Id = this.View.OpenParameter.GetCustomParameter("FMatrailId_Id").ToString(); - - //string FBillNo = this.View.OpenParameter.GetCustomParameter("FBillNo").ToString(); - string sql = string.Format(@"/*dialect*/select * from JIT_MOMaterReadysBill where FHMainICMOInterIDr ='{0}' and FHMainICMOEntryID ='{1}' and FHICMOInterID='{2}' ", FHMainICMOInterIDr, FHMainICMOEntryID, FHICMOInterID); + string sql = string.Format(@"/*dialect*/select * from JIT_MOMaterReadysBill where FHMainICMOInterIDr ='{0}' and FHMainICMOEntryID ='{1}' and FHICMOInterID='{2}' order by FPlanDate, FHStockQty desc ,FHMaterID ", FHMainICMOInterIDr, FHMainICMOEntryID, FHICMOInterID); DataTable dt = DBServiceHelper.ExecuteDataSet(this.Context, sql).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { - /* - 璁″垝鍙戞枡鏁伴噺 = 璁″垝鎬绘暟閲� * 鍗曚綅鐢ㄦ枡 - 榻愬鏁伴噺 = 榻愬鏁� * 鍗曚綅鐢ㄦ枡锛堣�冭檻鍒嗗眰绾�* 鐖剁骇锛� - 缂烘枡鏁伴噺 = 1 - 2 - 鏄惁榻愬 = 缂烘枡 < 0 ? - */ - decimal FPlanIssueCount = Convert.ToDecimal(dt.Rows[i]["FSumPlanCount"]) * Convert.ToDecimal(dt.Rows[i]["FUNITDOSAGE"]);//璁″垝鍙戞枡鏁伴噺 - decimal FCompleteCount = Convert.ToDecimal(dt.Rows[i]["FCompleteCount"]) * Convert.ToDecimal(dt.Rows[i]["FUNITDOSAGE"]);//榻愬鏁伴噺 - decimal FLackCount = FPlanIssueCount - FCompleteCount;//缂烘枡鏁伴噺 this.Model.CreateNewEntryRow("FEntity"); this.Model.SetValue("FSEQ", i + 1, i);//搴忓彿 this.Model.SetValue("FMateralDetailId", dt.Rows[i]["FHMATERID"], i); - this.Model.SetValue("FPlanIssueCount", FPlanIssueCount, i);//璁″垝鍙戞枡鏁伴噺 - this.Model.SetValue("FCompleteCount", FCompleteCount, i);//榻愬鏁伴噺 - this.Model.SetValue("FLackCount", FLackCount, i);//缂烘枡鏁伴噺 + this.Model.SetValue("FPlanIssueCount", dt.Rows[i]["FSumPlanCount"], i);//璁″垝鍙戞枡鏁伴噺 + this.Model.SetValue("FCompleteCount", dt.Rows[i]["FCompleteCount"], i);//榻愬鏁伴噺 + this.Model.SetValue("FLackCount", dt.Rows[i]["FLackCount"], i);//缂烘枡鏁伴噺 this.Model.SetValue("FPassableCount", dt.Rows[i]["FHLeftQty"].ToString(), i);//鍙敤鏁伴噺 - this.Model.SetValue("FMateralCount", dt.Rows[i]["FHLeftQty"].ToString(), i);//鐗╂枡鏁伴噺 - this.Model.SetValue("FCompleteDetailStatus", FLackCount > 0 ? "鏈綈濂�" : "榻愬", i);//鏄惁榻愬 + this.Model.SetValue("FMateralCount", dt.Rows[i]["FHStockQty"].ToString(), i);//鐗╂枡鏁伴噺 + this.Model.SetValue("FOccupyCount", dt.Rows[i]["FOccupyCount"].ToString(), i);//鍗犵敤鏁伴噺 + this.Model.SetValue("FCompleteDetailStatus", dt.Rows[i]["FComPlete"].ToString(), i);//鏄惁榻愬 this.Model.SetValue("FHMainICMOInterIDr", dt.Rows[i]["FHMainICMOInterIDr"].ToString(), i);//鐢熶骇璁㈠崟鍐呯爜 this.Model.SetValue("FPRDBillNo", dt.Rows[i]["FPRDBillNo"].ToString(), i);//鐢熶骇璁㈠崟鍐呯爜 + this.Model.SetValue("FPlanDate", dt.Rows[i]["FPlanDate"].ToString(), i);//鏃ヨ鍒掓棩鏈� + this.Model.SetValue("FOrgId", dt.Rows[i]["FHStockOrgID"], i);//搴撳瓨缁勭粐 + this.Model.SetValue("FOwnerTypeId", dt.Rows[i]["FOwnerTypeId"], i);//璐т富绫诲瀷 + this.Model.SetValue("FOwnerId", dt.Rows[i]["FOwnerId"], i);//璐т富 } } - did = true; } } - + public override void AfterBindData(EventArgs e) + { + base.AfterBindData(e); + //鑾峰彇鍗曟嵁浣撲俊鎭� + //Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity"); + ////鍗曟嵁浣撲俊鎭浆鎹负鍒楄〃闆嗗悎 + //DynamicObjectCollection entityDataObjoct = this.View.Model.GetEntityDataObject(entity); + //EntryGrid grid = this.View.GetControl<EntryGrid>("FEntity"); + //int i = 0; + //foreach (DynamicObject current in entityDataObjoct) + //{ + // if (Convert.ToString(current["FCompleteDetailStatus"]) == "鏈綈濂�") + // { + // grid.SetBackcolor("FEntity", "#FF0000", i); + // } + // i++; + //} + //this.View.UpdateView(); + } public override void BarItemClick(BarItemClickEventArgs e) { @@ -93,34 +97,22 @@ base.EntityRowClick(e); DynamicFormShowParameter formPa = new DynamicFormShowParameter(); formPa.FormId = "paez_CompleteAnalysisMateriel"; - /* jsonModel.Add("FHMainICMOInterID", FMainInterID);//涓荤敓浜ц鍗曚富鍐呯爜 jsonModel.Add("FHMainICMOEntryID", FMainEntryID);//涓荤敓浜ц鍗曞瓙鍐呯爜 jsonModel.Add("FHICMOInterID", FDayPlanWorkID);//鏃ヨ鍒掕鍗曚富鍐呯爜 current["FMatrailId_Id"].ToString(), current["FHMainSourceInterID"].ToString(), current["FHMainSourceEntryID"].ToString(), current["FDayPlanWorkID"].ToString()) - */ - formPa.CustomParams.Add("FHMainICMOInterIDr", Convert.ToString(this.View.Model.GetValue("FHMainICMOInterIDr", e.Row).ToString())); + formPa.CustomParams.Add("FMatrailId", Convert.ToString((this.View.Model.GetValue("FMateralDetailId", e.Row) as DynamicObject)["Id"].ToString())); this.View.ShowForm(formPa); } - /// <summary> /// 鏌ヨ浜嬩欢 /// </summary> public void SearchList() { string sqlwhere = " where 1=1"; - string sql = @" -/*dialect*/ -select * from ( -select FSumPlanCount*FUNITDOSAGE as FPlanIssueCountS,FCompleteCount*FUNITDOSAGE FCompleteCountS,(FSumPlanCount-FCompleteCount)*FUNITDOSAGE FLackCountS,case when FSumPlanCount>FCompleteCount then '鏈綈濂�' else '榻愬' end CompleteStatus, -t2.FBillNo PRDBillNo, -t1.* from JIT_MOMaterReadysBill T1 -JOIN T_PRD_MO t2 on t1.FHMainICMOInterIDr=t2.FID -)AS T -"; - + string sql = string.Format(@"/*dialect*/select * from JIT_MOMaterReadysBill "); //鐗╂枡 if ((this.Model.GetValue("FMateralId") as DynamicObject) != null) { @@ -128,42 +120,46 @@ if (!string.IsNullOrEmpty(FMateralId)) sqlwhere += $" and FHMATERID='{FMateralId}'"; } - //榻愬 string FCompleteStatus = Convert.ToString(this.Model.GetValue("FCompleteStatus")); if (!string.IsNullOrEmpty(FCompleteStatus)) - sqlwhere += $" and CompleteStatus='{FCompleteStatus}'"; + sqlwhere += $" and FComPlete='{FCompleteStatus}'"; + + //鏃ヨ鍒掓棩鏈� + string FPlanDate = Convert.ToString(this.Model.GetValue("FPlanDate2")); + if (!string.IsNullOrEmpty(FPlanDate)) + sqlwhere += $" and FPlanDate='{FPlanDate}'"; //鐢熶骇璁㈠崟鍙� string PRDBillNo = Convert.ToString(this.Model.GetValue("FScOrderNo")); if (!string.IsNullOrEmpty(PRDBillNo)) - sqlwhere += $" and PRDBillNo='{PRDBillNo}'"; - + sqlwhere += $" and FPRDBillNo='{PRDBillNo}'"; sql += sqlwhere; + sql += "order by FPlanDate, FHStockQty desc ,FHMaterID"; DataTable dt = DBServiceHelper.ExecuteDataSet(this.Context, sql).Tables[0]; this.Model.DeleteEntryData("FEntity"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { - decimal FPlanIssueCount = Convert.ToDecimal(dt.Rows[i]["FSumPlanCount"]) * Convert.ToDecimal(dt.Rows[i]["FUNITDOSAGE"]);//璁″垝鍙戞枡鏁伴噺 - decimal FCompleteCount = Convert.ToDecimal(dt.Rows[i]["FCompleteCount"]) * Convert.ToDecimal(dt.Rows[i]["FUNITDOSAGE"]);//榻愬鏁伴噺 - decimal FLackCount = FPlanIssueCount - FCompleteCount;//缂烘枡鏁伴噺 this.Model.CreateNewEntryRow("FEntity"); this.Model.SetValue("FSEQ", i + 1, i);//搴忓彿 this.Model.SetValue("FMateralDetailId", dt.Rows[i]["FHMATERID"], i); - this.Model.SetValue("FPlanIssueCount", dt.Rows[i]["FPlanIssueCountS"], i);//璁″垝鍙戞枡鏁伴噺 - this.Model.SetValue("FCompleteCount", dt.Rows[i]["FCompleteCountS"], i);//榻愬鏁伴噺 - this.Model.SetValue("FLackCount", dt.Rows[i]["FLackCountS"], i);//缂烘枡鏁伴噺 + this.Model.SetValue("FPlanIssueCount", dt.Rows[i]["FSumPlanCount"], i);//璁″垝鍙戞枡鏁伴噺 + this.Model.SetValue("FCompleteCount", dt.Rows[i]["FCompleteCount"], i);//榻愬鏁伴噺 + this.Model.SetValue("FLackCount", dt.Rows[i]["FLackCount"], i);//缂烘枡鏁伴噺 this.Model.SetValue("FPassableCount", dt.Rows[i]["FHLeftQty"].ToString(), i);//鍙敤鏁伴噺 - this.Model.SetValue("FMateralCount", dt.Rows[i]["FHLeftQty"].ToString(), i);//鐗╂枡鏁伴噺 - this.Model.SetValue("FCompleteDetailStatus", dt.Rows[i]["CompleteStatus"].ToString(), i);//鏄惁榻愬 + this.Model.SetValue("FMateralCount", dt.Rows[i]["FHStockQty"].ToString(), i);//鐗╂枡鏁伴噺 + this.Model.SetValue("FCompleteDetailStatus", dt.Rows[i]["FComPlete"].ToString(), i);//鏄惁榻愬 this.Model.SetValue("FHMainICMOInterIDr", dt.Rows[i]["FHMainICMOInterIDr"].ToString(), i);//鐢熶骇璁㈠崟鍐呯爜 this.Model.SetValue("FPRDBillNo", dt.Rows[i]["FPRDBillNo"].ToString(), i);//鐢熶骇璁㈠崟鍐呯爜 + this.Model.SetValue("FPlanDate", dt.Rows[i]["FPlanDate"].ToString(), i);//鏃ヨ鍒掓棩鏈� + this.Model.SetValue("FOrgId", dt.Rows[i]["FHStockOrgID"], i);//搴撳瓨缁勭粐 + this.Model.SetValue("FOwnerTypeId", dt.Rows[i]["FOwnerTypeId"], i);//璐т富绫诲瀷 + this.Model.SetValue("FOwnerId", dt.Rows[i]["FOwnerId"], i);//璐т富 } } this.View.UpdateView(); - did = true; } } -- Gitblit v1.9.1