Files
Gatedge.HuiWei.BOS.JJGZMJ/aoyuPlugIn/MaterialUnAuditController.cs
2025-06-20 09:17:36 +08:00

50 lines
2.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.ComponentModel;
namespace Kingdee.Joysing.Domustarzs
{
[HotUpdate]
[Description("物料反审核控制【已弃用】")]
public class MaterialUnAuditController: AbstractOperationServicePlugIn
{
public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
{
foreach (ExtendedDataEntity extendedDataEntity in e.SelectedRows)
{
int MaterialID = 0;
DynamicObject dynamicObjects = extendedDataEntity.DataEntity;
MaterialID = Convert.ToInt32(dynamicObjects["Id"]);
string sql = string.Format(@"/*dialect*/select
(SELECT case when count(1) > 0 then '在BOM单已使用此物料' else ''end
FROM T_ENG_BOM t0 LEFT OUTER JOIN T_ENG_BOMCHILD t1 ON t0.FID = t1.FID
where t0.FMATERIALID={0} or t1.FMATERIALID={1})+
(SELECT case when count(1) > 0 then '采购订单已使用此物料,' else ''end
FROM T_PUR_POORDERENTRY where FMATERIALID = {2}) as result
where (select top 1 FAntiCheckControl from PAEZ_t_AntiCheckControl order by fid)=1", MaterialID, MaterialID, MaterialID);
DynamicObjectCollection rows = DBUtils.ExecuteDynamicObject(this.Context, sql);
string result = "";
foreach (DynamicObject row in rows)
{
result = row["result"].ToString();
}
if (!"".Equals(result))
{
e.Cancel = true;
e.CancelMessage = Convert.ToString(dynamicObjects["Number"]) + result + "不能反审核的!本次反审核操作失败。";
break;
}
}
base.BeforeExecuteOperationTransaction(e);
}
}
}