HMI端联动报工
【应用场景】
两工序绑定一起,当A(需要汇报工序)工序手工下推工序汇报单时,B工序(无需汇报工序)自动生成工序汇报单
【实现步骤】
<1>需要(SFC_MobileComplexReportBillEdit)二开插件,继承于ComplexOperReportEdit,重写方法BeforeInvokeBillOperation
<2>相关的代码如下:
1、需要通过当前序找到下序是不用汇报的工序。2、进行循环下推生成工序汇报单
/// <summary> /// 调用操作前 /// </summary> /// <param name="e"></param> public override void BeforeInvokeBillOperation(BeforeInvokeBillOperationEventArgs e) { base.BeforeInvokeBillOperation(e); switch (e.OperationNumber) { case "Save": //通过当前序找下道序 DynamicObjectCollection rptEntrys = this.View.BillModel.DataObject["OptRptEntry"] as DynamicObjectCollection; long optId = Convert.ToInt64(rptEntrys[0]["OptPlanOptId"]); long optPlanId = Convert.ToInt64(rptEntrys[0]["OptPlanId"]); List<long> lst=new List<long>(); //查找当前序往下不用汇报的序 string sql = @"select IL.fseq,FDETAILID,de.FReportMode from T_SFC_OPERPLANNINGDETAIL IL inner join (SELECT tso.FENTRYID ,IL.fseq from T_SFC_OPERPLANNINGDETAIL IL inner join T_SFC_OPERPLANNINGSEQ tso on IL.FENTRYID =tso.FENTRYID where FDETAILID =@Id) a on IL.FENTRYID =a.FENTRYID and IL.FSEQ >a.FSEQ inner join T_ENG_OPTCTRLCODE de on IL.FOptCtrlCodeId=de.FID order by IL.fseq "; List<SqlParam> para = new List<SqlParam>(); para.Add(new SqlParam("@Id", KDDbType.Int64, optId)); using (IDataReader rd = DBServiceHelper.ExecuteReader(this.Context, sql,para)) { while (rd.Read()) { if (!rd["FReportMode"].Equals("10"))//10 代表必须汇报 { lst.Add(Convert.ToInt64(rd["FDETAILID"])); } else { break; } } } //循环进行报工 foreach (long item in lst) { bool IsSuccess = ReportOper(this.Context, item, optPlanId, rptEntrys[0]); if (!IsSuccess) { break; } } break; } }
3、在下推工序汇报的时候,需要根据客户的需求把数量赋值到新的工序汇报上去。
public bool ReportOper(Context ctx, long dy, long optPlanId, DynamicObject srcopt) { ListSelectedRow row = new ListSelectedRow(Convert.ToString(optPlanId), Convert.ToString(dy), 1, MFGFormIdConst.SubSys_SFC.OperationPlanning) { EntryEntityKey = "FSubEntity" }; Dictionary<string, string> fieldValues = new Dictionary<string, string>(); fieldValues["FSubEntity"] = Convert.ToString(dy); row.FieldValues = fieldValues; ConvertRuleElement rule = ConvertServiceHelper.GetConvertRules(ctx, MFGFormIdConst.SubSys_SFC.OperationPlanning, MFGFormIdConst.SubSys_SFC.OperationReport).Find(f => f.IsDefault); PushArgs arg = new PushArgs(rule, new[] { row }); OperateOption option = OperateOption.Create(); option.SetVariableValue("IsMobileInvoke", true); try { ConvertOperationResult result = MobileCommonServiceHelper.Push(ctx, arg, option); if (result.IsSuccess) { DynamicObject data = result.TargetDataEntities.FirstOrDefault().DataEntity; //将当前的工序汇报单的数量赋值到新的汇报单上来 FormMetadata metadata = MetaDataServiceHelper.Load(ctx, MFGFormIdConst.SubSys_SFC.OperationReport) as FormMetadata; List<DynamicObject> lstObj = new List<DynamicObject>(); lstObj.Add(data); // 工序汇报单提交和审核 IOperationResult resul1t = BillOperationUtil.SaveBillDatasByService(ctx, metadata.BusinessInfo, lstObj.ToArray(), null); return resul1t.IsSuccess; } } catch (KDBusinessException ex) { } return false; }
<3>BOSIDE扩展,注册表单插件,保存元数据,开发完毕。
【参考资料】
【二开案例.基础资料.联动查询(GetValue)】
https://vip.kingdee.com/article/127710528226504960
【金蝶云星空BOS二次开发案例演示】
https://vip.kingdee.com/article/94751030918525696
HMI端联动报工
【应用场景】两工序绑定一起,当A(需要汇报工序)工序手工下推工序汇报单时,B工序(无需汇报工序)自动生成工序汇报单【实现步骤】<1>需要(SFC...
点击下载文档
本文2024-09-23 03:29:30发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-159197.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章