本道工序汇报并转移到下道工序后,下道工序如何设置自动开工
【应用场景】
本道工序汇报并转移到下道工序后,下道工序如何设置自动开工
【实现步骤】
<1>编写表单插件,需要继承工序转移单的审核插件,代码如下。
using System.Collections.Generic; using System.Linq; using Kingdee.BOS; using Kingdee.BOS.App.Data; using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Orm.DataEntity; using Kingdee.K3.Core.MFG.EnumConst; using Kingdee.K3.MFG.App; using Kingdee.K3.Core.MFG.EntityHelper; namespace Kingdee.K3.MFG.SFC.App.ServicePlugIn.OptTransfer { public class Class1:Audit { public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e) { base.AfterExecuteOperationTransaction(e); foreach (DynamicObject otBillInfo in e.DataEntitys) { long srcOPId = otBillInfo.GetDynamicObjectItemValue<long>(CONST_SFC_OperationTransfer.CONST_FBillHead.ORM_SrcOptPlanId); if (srcOPId == 0) continue; //转入工序计划分录未达到开工态(创建、计划、计划确认、下达)时,执行至开工 long inOperId = otBillInfo.GetDynamicObjectItemValue<long>("InOperId"); bool isStart = IsNeedStartByOplan(inOperId); if (isStart) { UpdateOperStatusSqlToThree(this.Context, new List<long>() { inOperId }); } } } /// <summary> /// 获取工序计划的行状态 /// </summary> /// <param name="oplanId"></param> /// <returns></returns> private bool IsNeedStartByOplan(long oplanId) { if (oplanId <= 0) return false; string strSql = @"select FOPERSTATUS from T_SFC_OPERPLANNINGDETAIL where fdetailid=@Id"; List<SqlParam> sqlParams = new List<SqlParam> { new SqlParam("@Id", KDDbType.Int64, oplanId) }; long status = AppServiceContext.DBService.ExecuteScalar(this.Context, strSql, 0, sqlParams.ToArray()); List<long> needUpdatestatuss = new List<long>() { 0, 1, 2, 3 }; return needUpdatestatuss.Contains(status); } private void UpdateOperStatusSqlToThree(Context ctx, List<long> lstOptPlanOptId) { string updateSqlToThree = string.Format(@" MERGE INTO T_SFC_OPERPLANNINGDETAIL P1 USING ( select --若已手动完工,则维持其完工状态 case when p.FOPERSTATUS = '3' then '4' end AS FOPERSTATUS , p.FDETAILID AS FDETAILID FROM T_SFC_OPERPLANNINGDETAIL p INNER JOIN (SELECT /*+ cardinality(b {0})*/ FID FROM table(fn_StrSplit(@FID,',',1)) b) T1 ON T1.FID=p.FDetailId WHERE p.FOPERSTATUS in ('3') ) P2 ON P1.FDETAILID=P2.FDETAILID WHEN MATCHED THEN UPDATE SET P1.FOPERSTATUS=P2.FOPERSTATUS ", lstOptPlanOptId.Distinct().Count()); List<SqlParam> paras1 = new List<SqlParam>(); paras1.Add(new SqlParam("@FID", KDDbType.udt_inttable, lstOptPlanOptId.Distinct().ToArray())); DBUtils.Execute(ctx, updateSqlToThree, paras1); } } }
<2>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<3>BOSIDE扩展工序转移单,注册插件,保存元数据,开发完毕。
【参考资料】
【二开案例.基础资料.联动查询(GetValue)】
https://vip.kingdee.com/article/127710528226504960
【金蝶云星空BOS二次开发案例演示】
https://vip.kingdee.com/article/94751030918525696
本道工序汇报并转移到下道工序后,下道工序如何设置自动开工
【应用场景】本道工序汇报并转移到下道工序后,下道工序如何设置自动开工【实现步骤】<1>编写表单插件,需要继承工序转移单的审核插件,代码...
点击下载文档
本文2024-09-23 03:29:13发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-159169.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章