protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response) { var code = this.Request.ActivityCode; if (code == ActivityRK) { dp.FillWorkShop(me, ProcessName); } Init(response);//初始化 base.OnLoad(response); }
protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response) { var code = this.Request.ActivityCode; if (code == ActivityRK) { dp.FillWorkShop(me, ProcessName); } Init(response); //初始化 UserId(response); base.OnLoad(response); me.GetNew(); var t1 = me.CurrentRow; var t2 = me.And(Schema.RID, "=", this.Request.BizObjectId).GetFirst(false); var t3 = this.Request.BizObject; }
protected override void OnLoad(H3.SmartForm.LoadSmartFormResponse response) { var code = this.Request.ActivityCode; //var t=this.JavaScriptSerializer; //.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; //var r = this.Serialize(this.Request.BizObject); //var t=Newtonsoft.Json.JsonConvert; if (code == ActivityRK) { dp.FillWorkShop(me, ProcessName); } Init(response); //初始赋值 base.OnLoad(response); }
protected void Init(H3.SmartForm.LoadSmartFormResponse response) { if (!this.Request.IsCreateMode) { H3.DataModel.BizObject thisObj = this.Request.BizObject; string tsFormId = thisObj["F0000167"] + string.Empty; //探伤表 H3.DataModel.BizObjectSchema schema = this.Request.Engine.BizObjectManager.GetPublishedSchema(this.Request.SchemaCode); H3.DataModel.BizObject[] lstArray = thisObj["D001419F790f3a6b004e4988abe9511380792293"] as H3.DataModel.BizObject[]; //获取子表数据 thisObj["F0000166"] = thisObj["F0000166"] + string.Empty != string.Empty ? thisObj["F0000166"] + string.Empty : "1"; //初始化计数器 if (lstArray == null) { //初始化子表 CreatSublist(thisObj, schema, lstArray); } string bizid = thisObj.ObjectId; //查询钻孔加工中所有耗时 string command = string.Format("Select b.bizobjectid,b.activitycode, sum(b.usedtime) as utime From i_D001419Sugyf7m5q744eyhe45o26haop4 " + "a left join H_WorkItem b on a.objectid = b.BizObjectId where b.ActivityCode = 'Activity35' and b.BizObjectId = '{0}' group by b.bizobjectid", bizid); DataTable data = this.Engine.Query.QueryTable(command, null); if (data != null && data.Rows != null && data.Rows.Count > 0) { if (data.Rows[0]["utime"] != null) { string utimestr = data.Rows[0]["utime"] + string.Empty; //转换时间单位为秒 double utime = double.Parse(utimestr) / 10000000 / 60; //实际加工耗时 thisObj["CountTime"] = utime; } } //当前工序 if (thisObj["F0000056"] + string.Empty == string.Empty) { //当前工序 thisObj["F0000056"] = "钻孔"; } //产品类别更新 if (thisObj["F0000090"] + string.Empty == string.Empty) { string orderSpec = thisObj["F0000016"] + string.Empty; //订单规格号 string mysql = string.Format("Select ObjectId,F0000004,F0000006 From i_D0014196b62f7decd924e1e8713025dc6a39aa5 Where F0000073 = '{0}'", orderSpec); DataTable typeData = this.Engine.Query.QueryTable(mysql, null); if (typeData != null && typeData.Rows != null && typeData.Rows.Count > 0) { thisObj["F0000090"] = typeData.Rows[0]["ObjectId"] + string.Empty; //产品参数表 thisObj["F0000107"] = typeData.Rows[0]["F0000004"] + string.Empty; //产品类型 thisObj["F0000103"] = typeData.Rows[0]["F0000006"] + string.Empty; //产品小型 } } if (this.Request.WorkflowInstance.IsUnfinished) { //获取父流程实例对象 H3.Workflow.Instance.WorkflowInstance instance = this.Request.Engine.WorkflowInstanceManager.GetWorkflowInstance(this.Request.WorkflowInstance.ParentInstanceId); var parentId = instance != null ? instance.BizObjectId : ""; //获取父流程业务对象 H3.DataModel.BizObject parentObj = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D001419Sq0biizim9l50i2rl6kgbpo3u4", parentId, false); string planId = parentObj != null ? parentObj["F0000126"] + string.Empty : string.Empty; //获取工序计划业务对象 H3.DataModel.BizObject planObj = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D001419Szlywopbivyrv1d64301ta5xv4", planId, false); //获取产品的数据Id string acObjId = planObj != null && planObj["F0000145"] != null ? planObj["F0000145"] + string.Empty : string.Empty; //加载产品数据 H3.DataModel.BizObject acObj = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001419Skniz33124ryujrhb4hry7md21", acObjId, false); //查询质量配置 string mySql = string.Format("Select * from i_D0014198feb957936e040648d486b034af96597"); DataTable qcForm = this.Engine.Query.QueryTable(mySql, null); //转换工艺配置为布尔值 Dictionary <string, bool> qcConfig = new Dictionary <string, bool>(); qcConfig.Add("是", true); qcConfig.Add("否", false); //获取质量配置上机前互检优先级顺序 string hjOrder = qcForm.Rows[0]["F0000007"] + string.Empty; if (hjOrder == "配置表") { //获取《质量配置表》中“全局上机前互检”并赋值 string hjConfig = qcForm.Rows[0]["F0000002"] + string.Empty; thisObj["F0000108"] = qcConfig[hjConfig] + string.Empty; } if (planObj != null) { if (hjOrder == "计划表") { //获取《工序计划表》中“单件上机前互检”并赋值 string hjConfig = planObj != null ? planObj["F0000175"] + string.Empty : string.Empty; if (hjConfig != "") { thisObj["F0000108"] = qcConfig[hjConfig] + string.Empty; } else { //获取《订单规格表》中“产品上机前互检”并赋值 hjConfig = acObj != null ? acObj["F0000135"] + string.Empty : string.Empty; if (hjConfig != "") { thisObj["F0000108"] = qcConfig[hjConfig] + string.Empty; } else { //获取《质量配置表》中“全局上机前互检”并赋值 hjConfig = qcForm.Rows[0]["F0000002"] + string.Empty; thisObj["F0000108"] = qcConfig[hjConfig] + string.Empty; } } } //加载划线绞扣配置 string jqConfig = acObj != null ? acObj["F0000133"] + string.Empty : string.Empty; if (jqConfig.Length > 0) { //赋值划线绞扣 thisObj["F0000022"] = jqConfig; } } } if (tsFormId == string.Empty) //探伤表为空时,查询探伤表中ID相同的数据放入本表单中 { string thisId = thisObj["F0000029"] + string.Empty; //ID string mySql = string.Format("Select ObjectId From i_D001419fdcaecf556264750ae2d5684b2a3706e Where F0000001 = '{0}'", thisId); DataTable tsData = this.Engine.Query.QueryTable(mySql, null); if (tsData != null && tsData.Rows != null && tsData.Rows.Count > 0) { thisObj["F0000167"] = thisId = tsData.Rows[0]["ObjectId"] + string.Empty; } } //更新本表单 thisObj.Update(); try { //DataSync.instance.ZKSyncData(this.Engine); } catch (Exception ex) { response.Errors.Add(System.Convert.ToString(ex)); } } }
protected void Init(H3.SmartForm.LoadSmartFormResponse response) { if (!this.Request.IsCreateMode) { H3.DataModel.BizObject thisObj = this.Request.BizObject; string activityName = this.Request.WorkItem.ActivityDisplayName; //活动节点 string tsFormId = thisObj["F0000167"] + string.Empty; //探伤表 H3.DataModel.BizObjectSchema schema = this.Request.Engine.BizObjectManager.GetPublishedSchema(this.Request.SchemaCode); //本表单Schema H3.DataModel.BizObject[] thisLstArray = thisObj["D001419Fd25eb8064b424ed9855ced1923841f1c"] as H3.DataModel.BizObject[]; //获取子表数据 thisObj["F0000118"] = thisObj["F0000118"] + string.Empty != string.Empty ? thisObj["F0000118"] + string.Empty : "1"; //初始化计数器 if (thisLstArray == null) { //初始化子表 CreatSublist(thisObj, schema, thisLstArray); } string bizid = thisObj.ObjectId; string command = string.Format("Select b.bizobjectid,b.activitycode, sum(b.usedtime) as utime From i_D001419Swcbscvwcv9vk70tgvnqs4fy10 a left join H_WorkItem b on a.objectid = b.BizObjectId where b.ActivityCode = 'Activity24' and b.BizObjectId = '{0}' group by b.bizobjectid", bizid); DataTable data = this.Engine.Query.QueryTable(command, null); //机加工耗时计算 if (data != null && data.Rows != null && data.Rows.Count > 0) { if (data.Rows[0]["utime"] != null) { string utimestr = data.Rows[0]["utime"] + string.Empty; double utime = double.Parse(utimestr) / 10000000 / 60; thisObj["CountTime"] = utime; } } //当前工序 if (thisObj["F0000069"] + string.Empty == string.Empty) { //当前工序 thisObj["F0000069"] = "精车"; } //产品类别更新 if (thisObj["F0000111"] + string.Empty == string.Empty) { string orderSpec = thisObj["F0000016"] + string.Empty; //订单规格号 string mysql = string.Format("Select ObjectId,F0000004 From i_D0014196b62f7decd924e1e8713025dc6a39aa5 Where F0000073 = '{0}'", orderSpec); DataTable typeData = this.Engine.Query.QueryTable(mysql, null); if (typeData != null && typeData.Rows != null && typeData.Rows.Count > 0) { thisObj["F0000104"] = typeData.Rows[0]["ObjectId"] + string.Empty; //产品参数表 thisObj["F0000111"] = typeData.Rows[0]["F0000004"] + string.Empty; //产品类型 } } if (tsFormId == string.Empty) //探伤表为空时,查询探伤表中ID相同的数据放入本表单中 { string thisId = thisObj["F0000053"] + string.Empty; //ID string mySql = string.Format("Select ObjectId From i_D001419fdcaecf556264750ae2d5684b2a3706e Where F0000001 = '{0}'", thisId); DataTable tsData = this.Engine.Query.QueryTable(mySql, null); if (tsData != null && tsData.Rows != null && tsData.Rows.Count > 0) { thisObj["F0000167"] = thisId = tsData.Rows[0]["ObjectId"] + string.Empty; } } if (tsFormId != string.Empty) //探伤表不为空时,写入工序信息 { H3.DataModel.BizObject tsForm = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001419fdcaecf556264750ae2d5684b2a3706e", tsFormId, false); H3.DataModel.BizObject[] lstArray = tsForm["D001419F89050d4fc56d4bf7b41f343f2e3bd5a1"] as H3.DataModel.BizObject[]; //获取子表数据 tsForm["F0000023"] = "精车"; tsForm["F0000022"] = thisObj.ObjectId; if (lstArray[lstArray.Length - 1]["F0000002"] + string.Empty == string.Empty) //探伤结果 { lstArray[lstArray.Length - 1]["F0000017"] = "精车"; //工序 lstArray[lstArray.Length - 1]["F0000018"] = activityName != "待探伤" ? activityName : lstArray[lstArray.Length - 1]["F0000018"] + string.Empty; //工步 lstArray[lstArray.Length - 1].Update(); } tsForm.Update(); } //上机前互检字段 if (this.Request.WorkflowInstance.IsUnfinished) { //获取父流程实例对象 H3.Workflow.Instance.WorkflowInstance instance = this.Request.Engine.WorkflowInstanceManager.GetWorkflowInstance(this.Request.WorkflowInstance.ParentInstanceId); var parentId = instance != null ? instance.BizObjectId : ""; //获取父流程业务对象 H3.DataModel.BizObject parentObj = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D001419Sq0biizim9l50i2rl6kgbpo3u4", parentId, false); string planId = parentObj != null ? parentObj["F0000126"] + string.Empty : string.Empty; //获取工序计划业务对象 H3.DataModel.BizObject planObj = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D001419Szlywopbivyrv1d64301ta5xv4", planId, false); //获取产品的数据Id string acObjId = planObj != null && planObj["F0000145"] != null ? planObj["F0000145"] + string.Empty : string.Empty; //加载产品数据 H3.DataModel.BizObject acObj = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001419Skniz33124ryujrhb4hry7md21", acObjId, false); //查询质量配置 string mySql = string.Format("Select * from i_D0014198feb957936e040648d486b034af96597"); DataTable qcForm = this.Engine.Query.QueryTable(mySql, null); //转换工艺配置为布尔值 Dictionary <string, bool> qcConfig = new Dictionary <string, bool>(); qcConfig.Add("是", true); qcConfig.Add("否", false); //获取质量配置上机前互检优先级顺序 string hjOrder = qcForm.Rows[0]["F0000009"] + string.Empty; if (hjOrder == "配置表") { //获取《质量配置表》中“全局上机前互检”并赋值 string hjConfig = qcForm.Rows[0]["F0000010"] + string.Empty; thisObj["F0000172"] = qcConfig[hjConfig] + string.Empty; } if (planObj != null) { if (hjOrder == "计划表") { //获取《工序计划表》中“单件上机前互检”并赋值 string hjConfig = planObj != null ? planObj["F0000175"] + string.Empty : string.Empty; if (hjConfig != "") { thisObj["F0000172"] = qcConfig[hjConfig] + string.Empty; } else { //获取《订单规格表》中“产品上机前互检”并赋值 hjConfig = acObj != null ? acObj["F0000135"] + string.Empty : string.Empty; if (hjConfig != "") { thisObj["F0000172"] = qcConfig[hjConfig] + string.Empty; } else { //获取《质量配置表》中“全局上机前互检”并赋值 hjConfig = qcForm.Rows[0]["F0000010"] + string.Empty; thisObj["F0000172"] = qcConfig[hjConfig] + string.Empty; } } } } } //更新本表单 thisObj.Update(); } try { // DataSync.instance.JCSyncData(this.Engine); } catch (Exception ex) { response.Errors.Add(System.Convert.ToString(ex)); } }
private void UserId(H3.SmartForm.LoadSmartFormResponse response) { //H3.SmartForm.SmartFormResponseDataItem sd = new H3.SmartForm.SmartFormResponseDataItem(); //sd.Value = this.Request.UserContext.UserId; //response.ReturnData.Add("UserId", sd); }
protected void Init(H3.SmartForm.LoadSmartFormResponse response) { if (!this.Request.IsCreateMode) { H3.DataModel.BizObject thisObj = this.Request.BizObject; string userId = this.Request.UserContext.UserId; //当前用户ID string activityName = this.Request.ActivityCode; //活动节点 string tsFormId = thisObj["F0000167"] + string.Empty; //探伤表 H3.DataModel.BizObjectSchema schema = this.Request.Engine.BizObjectManager.GetPublishedSchema(this.Request.SchemaCode); //子表schema H3.DataModel.BizObject[] thisLstArray = thisObj["D001419F8cbba24c57a74ad99bd809ab8e262996"] as H3.DataModel.BizObject[]; //获取子表数据 thisObj["F0000133"] = thisObj["F0000133"] + string.Empty != string.Empty ? thisObj["F0000133"] + string.Empty : "1"; //初始化计数器 if (thisLstArray == null) { //初始化子表 CreatSublist(thisObj, schema, thisLstArray); } string bizid = thisObj.ObjectId; string command = string.Format("Select b.bizobjectid,b.activitycode, sum(b.usedtime) as utime From i_D001419Szzswrfsp91x3heen4dykgwus0 a left join H_WorkItem b on a.objectid = b.BizObjectId where b.ActivityCode = 'cuchexiaji' and b.BizObjectId = '{0}' group by b.bizobjectid", bizid); DataTable data = this.Engine.Query.QueryTable(command, null); //机加工耗时计算 if (data != null && data.Rows != null && data.Rows.Count > 0) { if (data.Rows[0]["utime"] != null) { string utimestr = data.Rows[0]["utime"] + string.Empty; double utime = double.Parse(utimestr) / 10000000 / 60; thisObj["CountTime"] = utime; } } //当前工序 if (thisObj["F0000083"] + string.Empty == string.Empty) { //当前工序 thisObj["F0000083"] = "粗车"; } //产品类别更新 if (thisObj["F0000121"] + string.Empty == string.Empty) { string orderSpec = thisObj["F0000016"] + string.Empty; //订单规格号 string mySql = string.Format("Select ObjectId,F0000004 From i_D0014196b62f7decd924e1e8713025dc6a39aa5 Where F0000073 = '{0}'", orderSpec); DataTable typeData = this.Engine.Query.QueryTable(mySql, null); if (typeData != null && typeData.Rows != null && typeData.Rows.Count > 0) { thisObj["F0000116"] = typeData.Rows[0]["ObjectId"] + string.Empty; //产品参数表 thisObj["F0000121"] = typeData.Rows[0]["F0000004"] + string.Empty; //产品类型 } } if (tsFormId == string.Empty) //探伤表为空时,查询探伤表中ID相同的数据放入本表单中 { string thisId = thisObj["F0000067"] + string.Empty; //ID string mySql = string.Format("Select ObjectId From i_D001419fdcaecf556264750ae2d5684b2a3706e Where F0000001 = '{0}'", thisId); DataTable tsData = this.Engine.Query.QueryTable(mySql, null); if (tsData != null && tsData.Rows != null && tsData.Rows.Count > 0) { thisObj["F0000167"] = thisId = tsData.Rows[0]["ObjectId"] + string.Empty; } else { H3.DataModel.BizObjectSchema aSchema = this.Engine.BizObjectManager.GetPublishedSchema("D001419fdcaecf556264750ae2d5684b2a3706e"); H3.DataModel.BizObject tsForm = new H3.DataModel.BizObject(this.Engine, aSchema, userId); tsForm.Status = H3.DataModel.BizObjectStatus.Effective; //生效 tsForm["F0000001"] = thisObj["F0000067"] + string.Empty; //ID tsForm["F0000023"] = "粗车"; tsForm["F0000021"] = thisObj.ObjectId; List <H3.DataModel.BizObject> lstObject = new List <H3.DataModel.BizObject>(); //new子表数据集合 //new一个子表业务对象 H3.DataModel.BizObject lstArray = new H3.DataModel.BizObject(this.Engine, aSchema.GetChildSchema("D001419F89050d4fc56d4bf7b41f343f2e3bd5a1"), H3.Organization.User.SystemUserId); //子表对象 lstArray["F0000017"] = "粗车"; //工序 lstArray["F0000018"] = ""; //工步 lstObject.Add(lstArray); //将这个子表业务对象添加至子表数据集合中 tsForm["D001419F89050d4fc56d4bf7b41f343f2e3bd5a1"] = lstObject.ToArray(); //子表数据赋值 tsForm.Create(); thisObj["F0000167"] = tsFormId = tsForm.ObjectId; //探伤表 thisObj.Update(); } } if (tsFormId != string.Empty) //探伤表不为空时,写入工序信息 { H3.DataModel.BizObject tsForm = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001419fdcaecf556264750ae2d5684b2a3706e", tsFormId, false); H3.DataModel.BizObject[] lstArray = tsForm["D001419F89050d4fc56d4bf7b41f343f2e3bd5a1"] as H3.DataModel.BizObject[]; //获取子表数据 tsForm["F0000023"] = "粗车"; tsForm["F0000022"] = thisObj.ObjectId; if (lstArray[lstArray.Length - 1]["F0000002"] + string.Empty == string.Empty) //探伤结果 { lstArray[lstArray.Length - 1]["F0000017"] = "粗车"; //工序 lstArray[lstArray.Length - 1]["F0000018"] = activityName != "Activity85" ? thisObj["F0000082"] + string.Empty : lstArray[lstArray.Length - 1]["F0000018"] + string.Empty; //工步 lstArray[lstArray.Length - 1].Update(); } tsForm.Update(); } //上机前互检字段 if (this.Request.WorkflowInstance.IsUnfinished) { //获取父流程实例对象 H3.Workflow.Instance.WorkflowInstance instance = this.Request.Engine.WorkflowInstanceManager.GetWorkflowInstance(this.Request.WorkflowInstance.ParentInstanceId); var parentId = instance != null ? instance.BizObjectId : ""; //获取父流程业务对象 H3.DataModel.BizObject parentObj = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D001419Sq0biizim9l50i2rl6kgbpo3u4", parentId, false); string planId = parentObj != null ? parentObj["F0000126"] + string.Empty : string.Empty; //获取工序计划业务对象 H3.DataModel.BizObject planObj = H3.DataModel.BizObject.Load(this.Request.UserContext.UserId, this.Engine, "D001419Szlywopbivyrv1d64301ta5xv4", planId, false); //获取产品的数据Id string acObjId = planObj != null && planObj["F0000145"] != null ? planObj["F0000145"] + string.Empty : string.Empty; //加载产品数据 H3.DataModel.BizObject acObj = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001419Skniz33124ryujrhb4hry7md21", acObjId, false); //查询质量配置 string mySql = string.Format("Select * from i_D0014198feb957936e040648d486b034af96597"); DataTable qcForm = this.Engine.Query.QueryTable(mySql, null); //查询订单规格号相同的AC表配置 string mySqlAC = string.Format("Select F0000136 from i_D001419Skniz33124ryujrhb4hry7md21 where F0000076 = '{0}'", thisObj["F0000016"] + string.Empty); DataTable gyFormAC = this.Engine.Query.QueryTable(mySqlAC, null); //转换工艺配置为布尔值 Dictionary <string, bool> qcConfig = new Dictionary <string, bool>(); qcConfig.Add("是", true); qcConfig.Add("否", false); //获取ac表是否四面光的值 string smgConfig = gyFormAC != null && gyFormAC.Rows != null && gyFormAC.Rows.Count > 0 ? gyFormAC.Rows[0]["F0000136"] + string.Empty : string.Empty; //获取质量配置上机前互检优先级顺序 string hjOrder = qcForm.Rows[0]["F0000011"] + string.Empty; //是否四面光 thisObj["F0000186"] = smgConfig != string.Empty ? qcConfig[smgConfig] + string.Empty : string.Empty; if (hjOrder == "配置表") { //获取《质量配置表》中“全局上机前互检”并赋值 string hjConfig = qcForm.Rows[0]["F0000012"] + string.Empty; thisObj["F0000184"] = qcConfig[hjConfig] + string.Empty; } if (planObj != null) { if (hjOrder == "计划表") { //获取《工序计划表》中“单件上机前互检”并赋值 string hjConfig = planObj != null ? planObj["F0000175"] + string.Empty : string.Empty; if (hjConfig != "") { thisObj["F0000184"] = qcConfig[hjConfig] + string.Empty; } else { //获取《订单规格表》中“产品上机前互检”并赋值 hjConfig = acObj != null ? acObj["F0000135"] + string.Empty : string.Empty; if (hjConfig != "") { thisObj["F0000184"] = qcConfig[hjConfig] + string.Empty; } else { //获取《质量配置表》中“全局上机前互检”并赋值 hjConfig = qcForm.Rows[0]["F0000012"] + string.Empty; thisObj["F0000184"] = qcConfig[hjConfig] + string.Empty; } } } } } //更新本表单 thisObj.Update(); try { //同步实时制造情况 // DataSync.instance.CCSyncData(this.Engine); } catch (Exception ex) { response.Errors.Add(System.Convert.ToString(ex)); } } }