添加项目文件。
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C672A706-DEAE-4541-AD5A-DCB8938FA4D1}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ProductionMaterialRequisition</RootNamespace>
|
||||
<AssemblyName>ProductionMaterialRequisition</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Kingdee.BOS">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.App">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.App.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.Core">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Kingdee.BOS.DataEntity">
|
||||
<HintPath>..\..\..\..\..\Program Files (x86)\Kingdee\K3Cloud\WebSite\bin\Kingdee.BOS.DataEntity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SaveVerification.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
36
ProductionMaterialRequisition/Properties/AssemblyInfo.cs
Normal file
36
ProductionMaterialRequisition/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("ProductionMaterialRequisition")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ProductionMaterialRequisition")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("c672a706-deae-4541-ad5a-dcb8938fa4d1")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
|
||||
//通过使用 "*",如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
100
ProductionMaterialRequisition/SaveVerification.cs
Normal file
100
ProductionMaterialRequisition/SaveVerification.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using Kingdee.BOS.Core.Bill.PlugIn;
|
||||
using Kingdee.BOS.Core.Bill.PlugIn.Args;
|
||||
using Kingdee.BOS.App.Data;
|
||||
using Kingdee.BOS.Orm.DataEntity;
|
||||
using Kingdee.BOS.Core.DynamicForm;
|
||||
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
||||
using Kingdee.BOS.Core.Permission;
|
||||
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.Core.DynamicForm.PlugIn.ControlModel;
|
||||
using Kingdee.BOS.Core.Metadata.Util;
|
||||
|
||||
namespace ProductionMaterialRequisition
|
||||
{
|
||||
[HotUpdate, Description("生产领料单保存库存数量验证")]
|
||||
public class SaveVerification : AbstractBillPlugIn
|
||||
{
|
||||
public override void BeforeSave(BeforeSaveEventArgs e)
|
||||
{
|
||||
|
||||
base.BeforeSave(e);
|
||||
|
||||
if (VerificationStock())
|
||||
{
|
||||
//this.View.ShowMessage("保存验证失败", MessageBoxType.Error);
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool VerificationStock()
|
||||
{
|
||||
var details = this.View.BusinessInfo.GetEntity("FEntity");
|
||||
|
||||
var entrys = this.View.Model.GetEntityDataObject(details);
|
||||
if (entrys == null || !entrys.Any())
|
||||
return false;
|
||||
|
||||
var id = this.View.Model.DataObject["Id"].Long2Int();
|
||||
var inDBWhere = $" AND tpp.FID !={id} ";
|
||||
if (id == 0)
|
||||
inDBWhere = string.Empty;
|
||||
|
||||
var selectActualQtySQL = $@"
|
||||
SELECT
|
||||
tbm.FMATERIALID,
|
||||
tbm.FUSEORGID,
|
||||
tbm.FMASTERID,
|
||||
SUM ( tsi.FBASEQTY ) - SUM ( tppd.FACTUALQTY ) AS 'Difference'
|
||||
FROM
|
||||
T_PRD_PICKMTRL tpp
|
||||
LEFT JOIN T_PRD_PICKMTRLDATA tppd ON tpp.FID= tppd.FID
|
||||
LEFT JOIN T_BD_MATERIAL tbm ON tbm.FMATERIALID = tppd.FMATERIALID
|
||||
LEFT JOIN T_STK_INVENTORY tsi ON tbm.FMASTERID = tsi.FMATERIALID
|
||||
AND tppd.FSTOCKID= tsi.FSTOCKID
|
||||
WHERE
|
||||
( tpp.FDOCUMENTSTATUS = 'A' OR tpp.FDOCUMENTSTATUS = 'Z' )
|
||||
AND tsi.FISEFFECTIVED= 1
|
||||
AND tsi.fstockstatusid = 10000
|
||||
AND FBASEQTY > 0 {inDBWhere}
|
||||
GROUP BY
|
||||
tbm.FUSEORGID,
|
||||
tbm.FMATERIALID,
|
||||
tbm.FMASTERID ";
|
||||
|
||||
DynamicObjectCollection actualQtylData = DBUtils.ExecuteDynamicObject(this.Context, $"/*dialect*/{selectActualQtySQL}");
|
||||
|
||||
StringBuilder msg = new StringBuilder();
|
||||
|
||||
var tempTockOrgId = this.View.Model.GetValue("FStockOrgId");
|
||||
|
||||
var stockOrgId = tempTockOrgId == null ? 0 : tempTockOrgId.Long2Int();
|
||||
|
||||
foreach (var entry in entrys)
|
||||
{
|
||||
var tempObject = entry["MaterialId"] as DynamicObject;
|
||||
|
||||
var tempEntity = actualQtylData.FirstOrDefault(w =>
|
||||
w["FMATERIALID"].Long2Int() == entry["MaterialId_Id"].Long2Int()
|
||||
&& w["FUSEORGID"].Long2Int() == stockOrgId);
|
||||
|
||||
if (tempEntity == null)
|
||||
msg.AppendLine($"物料编码:{tempObject["Number"]},物料名称:{tempObject["Name"]},可用库存:0;");
|
||||
else if (tempEntity != null && tempEntity["Difference"].Long2Int() > entry["MaterialId_Id"].Long2Int())
|
||||
msg.AppendLine($"物料编码:{tempObject["Number"]},物料名称:{tempObject["Name"]},可用库存:{tempEntity["Difference"]};");
|
||||
}
|
||||
|
||||
if (msg.Length > 0)
|
||||
this.View.ShowMessage(msg.ToString(), MessageBoxType.Error);
|
||||
|
||||
return msg.Length > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user