王 垚
2021-03-14 8d5747ca9b72c69655c9fcd8814d3e427d6b3da1
代码上传
9个文件已修改
433 ■■■■ 已修改文件
src/BLL/Demo.BillView/Demo.BillView.csproj 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/ProCompleteAnalysisMateriel.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/Pro_MaterialRequisitionAudit.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/Pro_MaterialRequisitionAuditDayPlan.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/Pro_TlPush.cs 353 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatImport.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/app.config 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BLL/Demo.BillView/Demo.BillView.csproj
@@ -12,6 +12,7 @@
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <Deterministic>true</Deterministic>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
@@ -42,16 +43,16 @@
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\K3Cloud.Extend.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.App, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.App.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.BOS.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.App.Core, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.App.Core.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.BOS.App.Core.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.Business.PlugIn, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.Business.PlugIn.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.BOS.Business.PlugIn.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.BusinessEntity, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.BusinessEntity.dll</HintPath>
@@ -60,10 +61,12 @@
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.Contracts.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.Core, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.Core.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.BOS.Core.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.DataEntity, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.DataEntity.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.BOS.DataEntity.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.FileConvert.Core, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.FileConvert.Core.dll</HintPath>
@@ -93,7 +96,8 @@
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.ServiceFacade.KDServiceFx.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.ServiceHelper, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.ServiceHelper.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.BOS.ServiceHelper.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.BOS.Web, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.BOS.Web.dll</HintPath>
@@ -138,7 +142,8 @@
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.K3.SCM.App.Stock.ServicePlugIn.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.K3.SCM.Business.DynamicForm, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.K3.SCM.Business.DynamicForm.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <HintPath>C:\Users\14027\Desktop\最新版bin文件\Kingdee.K3.SCM.Business.DynamicForm.dll</HintPath>
    </Reference>
    <Reference Include="Kingdee.K3.SCM.Common.BusinessEntity, Version=7.2.904.6, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\..\..\packages\ZD.Cloud.Common.7.2.3\lib\net452\Kingdee.K3.SCM.Common.BusinessEntity.dll</HintPath>
src/BLL/Demo.BillView/PRD/ProCompleteAnalysisMateriel.cs
@@ -1,5 +1,4 @@
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
src/BLL/Demo.BillView/PRD/Pro_MaterialRequisitionAudit.cs
@@ -11,6 +11,7 @@
using Kingdee.BOS.Core.Metadata.FieldElement;
using System.ComponentModel;
using Kingdee.BOS.ServiceHelper;
using Kingdee.K3.SCM.App;
namespace Demo.DynamicForm.PRD
{
src/BLL/Demo.BillView/PRD/Pro_MaterialRequisitionAuditDayPlan.cs
@@ -11,6 +11,7 @@
using Kingdee.BOS.Core.Metadata.FieldElement;
using System.ComponentModel;
using Kingdee.BOS.ServiceHelper;
using Kingdee.K3.SCM.App;
namespace Demo.DynamicForm.PRD
{
src/BLL/Demo.BillView/PRD/Pro_ScDayImport.cs
@@ -5,18 +5,14 @@
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper.Excel;
using Kingdee.BOS.Util;
using Kingdee.BOS.ServiceHelper;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using Newtonsoft.Json.Linq;
using Kingdee.BOS.WebApi.Client;
using ZD.Cloud.WebApi;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.KDThread;
using Kingdee.BOS.ServiceHelper;
using Demo.TimedTaskPlugIn.PRD;
using ZD.Cloud.Logger;
using Demo.Model.Model;
using ZD.Share.Common;
@@ -29,6 +25,7 @@
    [HotUpdate]
    public class Pro_ScDayImport : AbstractDynamicFormPlugIn
    {
        CloudClient cloudClient = new CloudClient("http://localhost/K3Cloud/");
        private string fileFullPath = string.Empty;
        //public override void BarItemClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
@@ -52,17 +49,29 @@
        //    }
        //}
        public override void AfterBarItemClick(AfterBarItemClickEventArgs e)
        public override void OnLoad(EventArgs e)
        {
            base.AfterBarItemClick(e);
            base.OnLoad(e);
            throw new Exception("1");
        }
        public override void BarItemClick(BarItemClickEventArgs e)
        {
            base.BarItemClick(e);
            throw new Exception("1");
            LogHelper.Info("导入功能点击按钮:");
            if (e.BarItemKey.ToUpper().Equals("TBIMPORT"))
            {
                LogService.WriteAsync("导入功能:");
                this.View.ShowErrMessage("测试导入功能点击按钮");
                LogHelper.Info("导入功能点击按钮:");
                ImportData();
            }
            if (e.BarItemKey.ToUpper().Equals("TBWJSC"))
            {
                this.View.ShowErrMessage("测试文件上传功能点击按钮");
                //Control updateControl = this.View.GetControl("fileFullPath");
                //// 上传地址
                //string uploadUrl = "FileUpLoadServices/FileService.svc/upload2attachment/";
@@ -70,7 +79,7 @@
                //// 下载地址
                //string downloadUrl = "FileUpLoadServices/download.aspx";
                //updateControl.SetCustomPropertyValue("ExDownLoadUrl", downloadUrl);
                LogService.WriteAsync("上传功能:");
                LogHelper.Info("文件上传功能点击按钮:");
                ImportDataSC(fileFullPath);
            }
        }
@@ -108,7 +117,7 @@
                {
                    DataSet ds = helper.ReadFromFile(fileFullPath, 1);
                    DataTable dt = ds.Tables[0];
                    LogService.WriteAsync("导入功能:dt行数:" + dt.Rows.Count);
                    LogHelper.Info("导入功能:dt行数:" + dt.Rows.Count);
                    DateTime date = Convert.ToDateTime(this.Model.GetValue("F_Paez_Date"));
                    if (dt.Rows.Count > 0)
                    {
@@ -251,13 +260,13 @@
        {
            try
            {
                LogService.WriteAsync("测试");
                string sql;
                DateTime date = Convert.ToDateTime(this.Model.GetValue("F_Paez_Date"));
                //获取单据体信息
                Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity");
                //单据体信息转换为列表集合
                DynamicObjectCollection entityDataObjoct = this.View.Model.GetEntityDataObject(entity);
                LogHelper.Info("导入功能列表行数:" + entityDataObjoct.Count);
                List<string> sqlList = new List<string>();
                foreach (DynamicObject current in entityDataObjoct)
                {
@@ -442,7 +451,7 @@
                        var result = cloudClient.Save("Paez_Sc_WorkBillAutoSortBill", jsonRoot.ToString());
                        JObject saveObj = JObject.Parse(result);
                        string saveIsSuc = saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper();
                        LogService.WriteAsync(jsonRoot);
                        //LogService.WriteAsync(jsonRoot);
                        if (saveIsSuc == "TRUE")
                        {
                            string FDayPlanBillNo = saveObj["Result"]["Number"].ToString();
src/BLL/Demo.BillView/PRD/Pro_TlPush.cs
@@ -21,6 +21,7 @@
using Kingdee.BOS.Core.Metadata.BarElement;
using Kingdee.BOS.Core.Metadata.ConvertElement;
using Kingdee.BOS.Core.Metadata.ConvertElement.ServiceArgs;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.Metadata.FormElement;
using Kingdee.BOS.Core.Metadata.QueryElement;
using Kingdee.BOS.Core.Msg;
@@ -36,6 +37,7 @@
using Kingdee.K3.SCM.Business;
using Kingdee.K3.SCM.Core.SCP;
using Kingdee.K3.SCM.ServiceHelper;
using Newtonsoft.Json.Linq;
namespace Demo.BillView.PRD
{
@@ -44,9 +46,6 @@
    [Kingdee.BOS.Util.HotUpdate]
    public class Pro_TlPush : AbstractBillPlugIn
    {
        private string InstockEntryTableNameAs;
        private string ReturnEntryTableNameAs;
        private string PoChangeEntryTableNameAs;
        public override void BarItemClick(BarItemClickEventArgs e)
        {
            string a;
@@ -54,327 +53,47 @@
            {
                if (a == "TBPUSH")
                {
                    try
                    {
                        PermissionAuthResult permissionAuthResult = PermissionServiceHelper.FuncPermissionAuth(base.Context, new BusinessObject
                        {
                            Id = "SCP_ReceiveBill"
                        }, "fce8b1aca2144beeb3c6655eaf78bc34");
                        if (!permissionAuthResult.Passed)
                        {
                            string msg = ResManager.LoadKDString("没有送货通知单的新增权限", "00444293030010485", SubSystemType.SCM, new object[0]);
                            base.View.ShowErrMessage(msg, "", MessageBoxType.Notice);
                            return;
                        }
                        DynamicObjectCollection source = this.Model.DataObject["FEntity"] as DynamicObjectCollection;
                        string[] selEntryIds = (from p in source
                                                select Convert.ToString(p["id"])).ToArray<string>();
                        InvokePushToRec(base.View, selEntryIds);
                        return;
                    }
                    catch (Exception ex)
                    {
                        if (ex.InnerException != null)
                        {
                            base.View.ShowErrMessage(ex.InnerException.Message, "", MessageBoxType.Notice);
                        }
                        else
                        {
                            base.View.ShowErrMessage(ex.Message, "", MessageBoxType.Notice);
                        }
                        return;
                    }
                }
                long num = Convert.ToInt64(this.Model.DataObject["id"]);
                string arg = Convert.ToString(this.Model.GetValue("fbillno"));
                ScpBillTrackInfo scpBillTrackInfo = new ScpBillTrackInfo();
                scpBillTrackInfo.IsUpTrack = false;
                scpBillTrackInfo.BillName = ResManager.LoadKDString("供应商协同采购订单", "00444293030009441", SubSystemType.SCM, new object[0]);
                TrackItem trackItem = new TrackItem();
                trackItem.FormId = "SCP_ReceiveBill";
                trackItem.FormName = ResManager.LoadKDString("送货通知单", "00444293030009436", SubSystemType.SCM, new object[0]);
                trackItem.Filter = string.Format("  FSRCFORMID='PUR_PurchaseOrder'  AND FSRCID={0} ", num);
                scpBillTrackInfo.TrackItems.Add(trackItem);
                TrackItem trackItem2 = new TrackItem();
                trackItem2.FormId = "SCP_MRAPP";
                trackItem2.FormName = ResManager.LoadKDString("退料通知单", "00444293030010278", SubSystemType.SCM, new object[0]);
                trackItem2.Filter = string.Format(" FSRCBILLTYPEID='PUR_PurchaseOrder' and FSRCBILLNO = '{0}' ", arg);
                if (string.IsNullOrWhiteSpace(this.InstockEntryTableNameAs))
                {
                    FormMetadata formMetadata = (FormMetadata)MetaDataServiceHelper.Load(base.Context, "SCP_InStock", true);
                    SelectField selectField = formMetadata.BusinessInfo.GetQueryInfo().GetSelectField("FMATERIALID");
                    this.InstockEntryTableNameAs = selectField.FullFieldName.Substring(0, selectField.FullFieldName.IndexOf('.'));
                }
                if (string.IsNullOrWhiteSpace(this.ReturnEntryTableNameAs))
                {
                    FormMetadata formMetadata2 = (FormMetadata)MetaDataServiceHelper.Load(base.Context, "SCP_MRB", true);
                    SelectField selectField2 = formMetadata2.BusinessInfo.GetQueryInfo().GetSelectField("FMATERIALID");
                    this.ReturnEntryTableNameAs = selectField2.FullFieldName.Substring(0, selectField2.FullFieldName.IndexOf('.'));
                }
                if (string.IsNullOrWhiteSpace(this.PoChangeEntryTableNameAs))
                {
                    FormMetadata formMetadata3 = (FormMetadata)MetaDataServiceHelper.Load(base.Context, "SCP_POChange", true);
                    SelectField selectField3 = formMetadata3.BusinessInfo.GetQueryInfo().GetSelectField("FMATERIALID");
                    this.PoChangeEntryTableNameAs = selectField3.FullFieldName.Substring(0, selectField3.FullFieldName.IndexOf('.'));
                }
                TrackItem trackItem3 = new TrackItem();
                trackItem3.FormId = "SCP_InStock";
                trackItem3.FormName = ResManager.LoadKDString("采购入库单", "00444293030010276", SubSystemType.SCM, new object[0]);
                TrackItem trackItem4 = new TrackItem();
                trackItem4.FormId = "SCP_MRB";
                trackItem4.FormName = ResManager.LoadKDString("采购退料单", "00444293030010277", SubSystemType.SCM, new object[0]);
                TrackItem trackItem5 = new TrackItem();
                trackItem5.FormId = "SCP_POChange";
                trackItem5.FormName = ResManager.LoadKDString("采购订单变更单", "00444293030010132", SubSystemType.SCM, new object[0]);
                List<long> list = new List<long>();
                list.Add(-1L);
                List<long> list2 = new List<long>();
                list2.Add(-1L);
                List<long> list3 = new List<long>();
                list3.Add(-1L);
                string item = Convert.ToString(base.View.Model.DataObject["id"]);
                List<string> list4 = new List<string>
                {
                    item
                };
                string[] trackIds = list4.ToArray();
                List<long> linkBillEntryIds = PurchaseNewServiceHelper.GetLinkBillEntryIds(base.Context, "T_STK_INSTOCKENTRY_lk", "t_PUR_POOrderEntry", trackIds, null, true);
                List<long> linkBillEntryIds2 = PurchaseNewServiceHelper.GetLinkBillEntryIds(base.Context, "T_PUR_MRBENTRY_lk", "t_PUR_POOrderEntry", trackIds, null, true);
                List<long> linkBillEntryIds3 = PurchaseNewServiceHelper.GetLinkBillEntryIds(base.Context, "T_PUR_POChangeEntry_LK", "t_PUR_POOrderEntry", trackIds, null, true);
                trackItem3.Filter = string.Format(" {1}.fentryid in ({0}) ", string.Join<long>(",", linkBillEntryIds), this.InstockEntryTableNameAs);
                trackItem4.Filter = string.Format(" {1}.fentryid in ({0}) ", string.Join<long>(",", linkBillEntryIds2), this.ReturnEntryTableNameAs);
                trackItem5.Filter = string.Format(" {1}.fentryid in ({0}) ", string.Join<long>(",", linkBillEntryIds3), this.PoChangeEntryTableNameAs);
                scpBillTrackInfo.TrackItems.Add(trackItem2);
                scpBillTrackInfo.TrackItems.Add(trackItem3);
                scpBillTrackInfo.TrackItems.Add(trackItem4);
                scpBillTrackInfo.TrackItems.Add(trackItem5);
                //base.View.ShowForm(scpBillTrackInfo);
                    // 获取父单据体
                    Entity entity = this.View.BillBusinessInfo.GetEntity("FEntity");//标识
                    //DynamicObjectCollection entityRows = entity.DynamicProperty.GetValue(this.Model.DataObject) as DynamicObjectCollection;//获取父单据体行集合
                    DynamicObjectCollection entityRows = this.Model.GetEntityDataObject(entity);//获取父单据体行集合
                    // 1和2均可
                    // 取当前页面子单据体
                    //Entity subEntity = this.View.BillBusinessInfo.GetEntity("FEntity");//标识
                    //DynamicObjectCollection rows = this.Model.GetEntityDataObject(subEntity);//获得子单据体行集合
                View.ShowForm(new DynamicFormShowParameter
                {
                    Height = 500,
                    Width = 1000,
                    FormId = "SCP_ScpBillTracker",
                    SyncCallBackAction = true,
                    ParentPageId = View.PageId,
                    PageId = SequentialGuid.NewGuid().ToString(),
                    CustomComplexParams =
                {
                    string sql = $"select * from ";
                    JObject model = new JObject();
                    model.Add("FHDate", "");
                    model.Add("FSettleCurrId", new JObject() { ["Fnumber"] = "PRE001" });
                    model.Add("FSupplierID", new JObject() { ["Fnumber"] = "" });
                    JArray Fentity = new JArray();
                    for (int i = 0; i < 10; i++)
                    {
                        "ScpBillTrackInfo",
                        scpBillTrackInfo
                        JObject FentityModel = new JObject();
                        FentityModel.Add("FUnitID", new JObject() { ["Fnumber"] = "Pcs" }); //发料方式
                        Fentity.Add(FentityModel);
                    }
                    model.Add("FEntity", Fentity);
                    JObject jsonRoot = new JObject()
                    {
                        ["Creator"] = "",
                        ["NeedUpDateFields"] = new JArray(),
                        ["NeedReturnFields"] = new JArray(),
                        ["IsDeleteEntry"] = "false",
                        ["SubSystemId"] = "",
                        ["IsVerifyBaseDataField"] = "false",
                        ["Model"] = model
                    };
                }
                });
                return;
            }
        }
        public static void InvokePushToRec(IDynamicFormView formView, string[] selEntryIds)
        {
            if (CheckPoHasPushRec(formView.Context, selEntryIds))
            {
                formView.ShowWarnningMessage(ResManager.LoadKDString("采购订单有暂存的关联送货单据,再次生成会造成单据重复下推,是否继续生成送货通知单?", "00444293030037168", SubSystemType.SCM, new object[0]), "", MessageBoxOptions.YesNoCancel, delegate (MessageBoxResult selRst)
                {
                    if (MessageBoxResult.Yes == selRst)
                    {
                        InnerInvokePushToRec(formView, selEntryIds);
                    }
                }, MessageBoxType.Advise);
                return;
            }
            InnerInvokePushToRec(formView, selEntryIds);
        }
        public static bool CheckPoHasPushRec(Context ctx, string[] billEntryIds)
        {
            string strSql = string.Format("select 1 from T_PUR_RECEIVE TH\r\nINNER JOIN T_PUR_RECEIVEENTRY TE ON TE.FID=TH.FID\r\nINNER JOIN T_PUR_RECEIVEENTRY_LK TELK ON TE.FENTRYID=TELK.FENTRYID\r\ninner join (select /*+ cardinality(b1 {0})*/FID from TABLE(fn_StrSplit(@FID,',',1)) b1) b on TELK.FSID=b.fid  \r\nwhere TH.FDOCUMENTSTATUS='Z' ", billEntryIds.Length);
            int num = DBServiceHelper.ExecuteScalar<int>(ctx, strSql, 0, new List<SqlParam>
            {
                new SqlParam("@FID", KDDbType.udt_inttable, billEntryIds)
            }.ToArray());
            return num == 1;
        }
        public static void InnerInvokePushToRec(IDynamicFormView formView, string[] selEntryIds)
        {
            DynamicFormShowParameter dynamicFormShowParameter = new DynamicFormShowParameter();
            dynamicFormShowParameter.FormId = "SCP_PushParamFrom";
            dynamicFormShowParameter.ParentPageId = formView.PageId;
            dynamicFormShowParameter.OpenStyle.ShowType = ShowType.Modal;
            //dynamicFormShowParameter.CustomComplexParams.Add("SrcFormId", "paez_PODemandPlan");
            //dynamicFormShowParameter.CustomComplexParams.Add("TargetFormId", "SCP_ReceiveBill");
            dynamicFormShowParameter.CustomComplexParams.Add("SrcFormId", "PUR_PurchaseOrder");
            dynamicFormShowParameter.CustomComplexParams.Add("TargetFormId", "PUR_ReceiveBill");
            formView.ShowForm(dynamicFormShowParameter, delegate (FormResult results)
            {
                if (results != null && results.ReturnData != null)
                {
                    DynamicObject dynamicObject = results.ReturnData as DynamicObject;
                    string CbConvertRule = Convert.ToString(dynamicObject["CbConvertRule"]);
                    List<ConvertRuleElement> convertRules = ConvertServiceHelper.GetConvertRules(formView.Context, "PUR_PurchaseOrder", "PUR_ReceiveBill");
                    //List<ConvertRuleElement> convertRules = ConvertServiceHelper.GetConvertRules(formView.Context, "paez_PODemandPlan", "SCP_ReceiveBill");
                    ConvertRuleElement rule = convertRules.FirstOrDefault((ConvertRuleElement t) => t.Id == CbConvertRule);
                    PushPurOrderToRec(formView, selEntryIds, rule);
                }
            });
        }
        public static void PushPurOrderToRec(IDynamicFormView formView, string[] billEntryIds, ConvertRuleElement rule)
        {
            ConvertPolicyElement convertPolicyElement = rule.Policies[6];
            Collection<BillTypeMapElement> billTypeMaps = ((BillTypeMapPolicyElement)convertPolicyElement).BillTypeMaps;
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            foreach (BillTypeMapElement billTypeMapElement in billTypeMaps)
            {
                if (!dictionary.ContainsKey(billTypeMapElement.SourceBillTypeId))
                {
                    dictionary.Add(billTypeMapElement.SourceBillTypeId, billTypeMapElement.TargetBillTypeId);
                }
            }
            List<ScpOrderPushInfo> list = new List<ScpOrderPushInfo>();
            string strSQL = string.Format(" select tr.FentryID, t.fbilltypeid,ts.FMASTERID as fsupmasterid,t.fbillNO,TR.FID AS FBILLID  \r\n                        from Cg_PODemandPlanBillMain t\r\n                        inner join T_BD_SUPPLIER ts on ts.FSUPPLIERID=t.FSUPPLIERID\r\n                        inner join Cg_PODemandPlanBillSub TR ON TR.FID=T.FID \r\n                        inner join  (select /*+ cardinality(b {0})*/ fid from table(fn_StrSplit(@FID, ',',1)) b) tb on TR.fentryid=tb.fid \r\n                      ", billEntryIds.Length);
            List<SqlParam> list2 = new List<SqlParam>
            {
                new SqlParam("@FID", KDDbType.udt_inttable, billEntryIds)
            };
            DynamicObjectCollection dynamicObjectCollection = DBServiceHelper.ExecuteDynamicObject(formView.Context, strSQL, null, null, CommandType.Text, list2.ToArray());
            if (dynamicObjectCollection == null || dynamicObjectCollection.Count == 0)
            {
                throw new KDException("", ResManager.LoadKDString("受源单所选单据类型限制,不允许下推目标单!", "00444293030009439", SubSystemType.SCM, new object[0]));
            }
            long supplierMasterIdByUserId = SupplierServiceHelper.GetSupplierMasterIdByUserId(formView.Context, formView.Context.UserId);
            string format = ResManager.LoadKDString("您没有权限操作单据{0}", "00444293030009639", SubSystemType.SCM, new object[0]);
            foreach (DynamicObject dynamicObject in dynamicObjectCollection)
            {
                if (supplierMasterIdByUserId != Convert.ToInt64(dynamicObject["fsupmasterid"]))
                {
                    throw new KDException("", string.Format(format, Convert.ToString(dynamicObject["fbillNO"])));
                }
                list.Add(new ScpOrderPushInfo
                {
                    EntryId = Convert.ToString(dynamicObject["FentryID"]),
                    BillId = Convert.ToString(dynamicObject["FBILLID"]),
                    BilltypeId = Convert.ToString(dynamicObject["fbilltypeid"])
                });
            }
            IEnumerable<IGrouping<string, ScpOrderPushInfo>> enumerable = from g in list
                                                                          group g by g.BilltypeId;
            List<DynamicObject> list3 = new List<DynamicObject>();
            StringBuilder stringBuilder = new StringBuilder();
            foreach (IGrouping<string, ScpOrderPushInfo> grouping in enumerable)
            {
                string key = grouping.Key;
                List<ListSelectedRow> list4 = new List<ListSelectedRow>();
                int num = 0;
                foreach (ScpOrderPushInfo scpOrderPushInfo in grouping)
                {
                    list4.Add(new ListSelectedRow(scpOrderPushInfo.BillId, scpOrderPushInfo.EntryId, num++, "paez_PODemandPlan")
                    {
                        EntryEntityKey = "FEntity"
                    });
                }
                ListSelectedRow[] selectedRows = list4.ToArray();
                PushArgs pushArgs = new PushArgs(rule, selectedRows);
                if (dictionary.ContainsKey(key))
                {
                    pushArgs.TargetBillTypeId = dictionary[key];
                }
                try
                {
                    ConvertOperationResult convertOperationResult = ConvertServiceHelper.Push(formView.Context, pushArgs, false);
                    list3.AddRange(from p in convertOperationResult.TargetDataEntities
                                   select p.DataEntity);
                }
                catch (Exception ex)
                {
                    stringBuilder.AppendLine(ex.Message);
                }
            }
            if (list3.Count == 0)
            {
                if (stringBuilder.Length > 0)
                {
                    formView.ShowErrMessage(stringBuilder.ToString(), "", MessageBoxType.Notice);
                    return;
                }
                formView.ShowErrMessage(ResManager.LoadKDString("没有可下推数据!", "00444293030009360", SubSystemType.SCM, new object[0]), "", MessageBoxType.Notice);
                return;
            }
            else
            {
                DynamicObject[] array = list3.ToArray();
                Dictionary<string, object> dictionary2 = new Dictionary<string, object>();
                dictionary2["CodeTime"] = 0;
                dictionary2["UpdateMaxNum"] = 1;
                FormMetadata formMetadata = (FormMetadata)MetaDataServiceHelper.Load(formView.Context, "PUR_ReceiveBill", true);
                List<BillNoInfo> billNo = BusinessDataServiceHelper.GetBillNo(formView.Context, formMetadata.BusinessInfo, array, dictionary2, "");
                for (int i = 0; i < array.Count<DynamicObject>(); i++)
                {
                    array[i]["BillNo"] = billNo[i].BillNo;
                    array[i]["IsInsideBill"] = true;
                }
                OperateOption option = OperateOption.Create();
                IOperationResult operationResult = BusinessDataServiceHelper.Draft(formView.Context, formMetadata.BusinessInfo, array, option, "");
                if (!operationResult.IsSuccess)
                {
                    formView.ShowMessage(ResManager.LoadKDString("下推失败!", "00444293030009440", SubSystemType.SCM, new object[0]), MessageBoxType.Notice);
                    return;
                }
                if (operationResult.SuccessDataEnity.Count<DynamicObject>() == 1)
                {
                    DynamicObject dynamicObject2 = operationResult.SuccessDataEnity.FirstOrDefault<DynamicObject>();
                    formView.ShowForm(new BillShowParameter
                    {
                        FormId = "SCP_ReceiveBill",
                        PKey = Convert.ToString(dynamicObject2["id"]),
                        Status = OperationStatus.EDIT,
                        OpenStyle =
                        {
                            ShowType = ShowType.MainNewTabPage
                        },
                        CustomComplexParams =
                        {
                            {
                                "FromScpOrderPushRecs",
                                true
                            }
                        }
                    });
                    return;
                }
                DynamicObjectType dynamicObjectType = new DynamicObjectType("ScpRecBillDatas", null, null, DataEntityTypeFlag.Class, new object[0]);
                dynamicObjectType.RegisterSimpleProperty("BillNo", typeof(string), null, false, new object[0]);
                dynamicObjectType.RegisterSimpleProperty("DocumentStatus", typeof(string), null, false, new object[0]);
                dynamicObjectType.RegisterSimpleProperty("BillId", typeof(long), null, false, new object[0]);
                DynamicObjectCollection dynamicObjectCollection2 = new DynamicObjectCollection(dynamicObjectType, null);
                foreach (DynamicObject dynamicObject3 in operationResult.SuccessDataEnity)
                {
                    DynamicObject dynamicObject4 = new DynamicObject(dynamicObjectType);
                    dynamicObject4["BillNo"] = dynamicObject3["BillNo"];
                    dynamicObject4["DocumentStatus"] = dynamicObject3["DocumentStatus"];
                    dynamicObject4["BillId"] = dynamicObject3["id"];
                    dynamicObjectCollection2.Add(dynamicObject4);
                }
                formView.ShowForm(new DynamicFormShowParameter
                {
                    FormId = "SCP_GENRECRSTFORM",
                    PageId = SequentialGuid.NewGuid().ToString(),
                    OpenStyle =
                    {
                        ShowType = ShowType.MainNewTabPage
                    },
                    CustomComplexParams =
                    {
                        {
                            "ScpRecBillDatas",
                            dynamicObjectCollection2
                        }
                    }
                });
                return;
            }
        }
    }
}
src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatImport.cs
@@ -9,6 +9,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZD.Cloud.Logger;
namespace Demo.BillView.PRD
{
@@ -21,6 +22,7 @@
            base.BarItemClick(e);
            if (e.BarItemKey.Equals("btImport"))
            {
                LogHelper.Info("导入功能点击按钮:");
                DynamicFormShowParameter formPa = new DynamicFormShowParameter();
                formPa.FormId = "Paez_ScDayImport";
                this.View.ShowForm(formPa);
src/BLL/Demo.BillView/PRD/Pro_WorkBillPlatform.cs
@@ -1,7 +1,6 @@
using Demo.Model.Model;
using Demo.Model.Model.PODemandPlan;
using K3Cloud.Extend.Utils;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.Const;
src/BLL/Demo.BillView/app.config
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.8.6.0" newVersion="1.8.6.0" />
        <assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-1.8.6.0" newVersion="1.8.6.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.2.0.246" newVersion="1.2.0.246" />
        <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-1.2.0.246" newVersion="1.2.0.246"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>