首页 > 其他分享 >氚云--生产报工3

氚云--生产报工3

时间:2023-06-08 11:00:27浏览次数:16  
标签:string BizObject -- Request Parse 报工 int 生产 Empty

报工部分:修改生产报工子表的工序记录情况,修改工序中心的数据情况,带当前报工数据、修改工序状态,及修改下一工序的上道工序报工数与下一工序开工状态。
主要是进行第一道工序的判断和最后一道工序的判断



protected override void OnSubmit(string actionName, H3.SmartForm.SmartFormPostValue postValue, H3.SmartForm.SubmitSmartFormResponse response) { if(actionName == "Remove") { H3.IEngine engine = this.Engine; string masterBoId = this.Request.BizObject["woId"] + string.Empty; //查找两个表的 string ziid = this.Request.BizObject["rtId"] + string.Empty; string sqlzib = "SELECT * FROM i_D000685F99add1cdbf3747eeade0bd6eb2ca7216 where ObjectId='" + ziid + "'"; System.Data.DataTable dtzib = this.Engine.Query.QueryTable(sqlzib, null); string sqlzib4 = "SELECT * FROM i_D00068566c3a33d6987424e9a0d142b1bef2bae where ObjectId='" + masterBoId + "'"; System.Data.DataTable dtzib4 = this.Engine.Query.QueryTable(sqlzib4, null); //当前工序的工序是否完成:报工是否等于派工,更改下道工序为进行中 //改变下一道工序报工数 string zinameshunxu = ""; if(dtzib.Rows.Count > 0) { zinameshunxu = dtzib.Rows[0]["Name"] + string.Empty;//这是工单的名称 } string masterSchemaCode = "D00068566c3a33d6987424e9a0d142b1bef2bae"; H3.DataModel.BulkCommit commit0 = new H3.DataModel.BulkCommit(); // H3.DataModel.BizObject objin2 = new H3.DataModel.BizObject(this.Engine, schemawe, H3.Organization.User.SystemUserId); H3.DataModel.BizObject objin2 = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, engine, masterSchemaCode, masterBoId, false); string childSchemaCode = "D000685F99add1cdbf3747eeade0bd6eb2ca7216"; H3.DataModel.BizObjectSchema childSchema = objin2.Schema.GetChildSchema(childSchemaCode); List < H3.DataModel.BizObject > newChildBoList = new List<H3.DataModel.BizObject>(); //获取子表内已有数据 H3.DataModel.BizObject[] childBoArray = (H3.DataModel.BizObject[]) objin2[childSchemaCode]; if(childBoArray != null && childBoArray.Length > 0) { string gdjs = "on"; int gxcd = childBoArray.Length; int zinameshunxuzi = int.Parse(zinameshunxu);//工单序号查询出的 int baogong = int.Parse(this.Request.BizObject["bcqty"] + string.Empty);//报工 // int blip = int.Parse(this.Request.BizObject["ngqty"] + string.Empty); // int bfei = int.Parse(this.Request.BizObject["bfqty"] + string.Empty); string sdgxzt = "";//上道工序状态 //获取第一道工序的报工数量,及状态 int onebg = 0; string onezt = ""; int one = 1;//是否为第一次 int cishu = 0; int cishut = 0; int zuihou = 0; foreach(H3.DataModel.BizObject itemBo in childBoArray) { //for(int i=0;i<childBoArray.Length;i++) { } int zinamejia = zinameshunxuzi + 1; int zinamej = int.Parse(itemBo["Name"].ToString());//工序名称默认为子表顺序1,2,3.... // string sdgxzt = "";//上道工序状态 if(zinameshunxuzi != 1) { int sdgx = zinameshunxuzi - 1;//上道工序 if(sdgx == zinamej) { sdgxzt = itemBo["gxstatus"] + string.Empty;//工序状态 } } // //获取第一道工序的报工数量,及状态 if(zinamej == one) { if(cishu < 1) { if(itemBo["ybgqty"] + string.Empty != "") { onebg = int.Parse(itemBo["ybgqty"].ToString());//第一道工序报工数 } onezt = itemBo["gxstatus"] + string.Empty;//第一道工序状态 cishu++; } } //当前工序第一道工序 if(zinameshunxuzi == one) { if(cishut < 1) {
                //第一道工序不是下料 if(this.Request.BizObject["seqence"] + string.Empty != "下料") { //itemBo["ybgqty"] = this.Request.BizObject["bcqty"] + string.Empty; //获取所有报工内容,判断是否等于派工。等于结束,不等于,继续进行 int zong = 0; int gonhda = 0;//工单数量 if(this.Request.BizObject["woqty"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["woqty"] + string.Empty); itemBo["F0000009"] = gonhda;//上道工序报工数==计划数 } int yiyou = 0;//已报工 if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); }
                    //已有的报工数-当前报工数,判断相减后的总数是否等于计划数,相等就结束工序状态 zong = /*gonhda +*/ yiyou - baogong; if(gonhda == zong) { itemBo["gxstatus"] = "已结束"; } else { itemBo["gxstatus"] = "进行中"; } cishut++; } else {
                  //第一道工序是下料 int zong = 0; int gonhda = 0;//工单数量0.9 if(this.Request.BizObject["F0000034"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["F0000034"] + string.Empty); //itemBo["F0000009"] = gonhda; } int gonhdabai = 0;//工单数量1.1 if(this.Request.BizObject["F0000035"] + string.Empty != "") { gonhdabai = int.Parse(this.Request.BizObject["F0000035"] + string.Empty); itemBo["F0000009"] = gonhdabai; } int yiyou = 0;//已报工 if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); }
                   //拿取下料的90%~110%的范围数目,获取已有报工数-当前报工数,进行范围判断是否在90%到110%之间,在结束工序状态 zong = /*gonhda +*/ yiyou - baogong; if(gonhda < zong && gonhdabai > zong) { itemBo["gxstatus"] = "已结束"; } else { itemBo["gxstatus"] = "进行中"; } cishut++; } } }//最后一道 gxcd=工序总数,判断当前数目是否等于工序总数 else if(zinameshunxuzi == gxcd) { if(zinamej == gxcd) { if(zuihou < 1) { int yiyou = 0;//已报工 if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); }
                    //判断现有的报工数是否等于第一道工序的报工数且第一道工序状态是否为结束 int souyou = yiyou - baogong; if(souyou == onebg && onezt == "已结束") { itemBo["gxstatus"] = "已结束"; gdjs = "off"; } else { itemBo["gxstatus"] = "进行中"; } zuihou++; }
                 //计算完工率与完工数目 if(dtzib4.Rows.Count > 0) { int wang = 0; int hg = 0; int huiy = 0; int cip = 0; int xlpw = 0; if(dtzib4.Rows[0]["F0000018"] + string.Empty != "") { wang = int.Parse(dtzib4.Rows[0]["F0000018"] + string.Empty); } if(this.Request.BizObject["F0000016"] + string.Empty != "") { hg = int.Parse(this.Request.BizObject["F0000016"] + string.Empty); } if(this.Request.BizObject["F0000013"] + string.Empty != "") { huiy = int.Parse(this.Request.BizObject["F0000013"] + string.Empty); } if(this.Request.BizObject["ngqty"] + string.Empty != "") { cip = int.Parse(this.Request.BizObject["ngqty"] + string.Empty); } if(this.Request.BizObject["F0000027"] + string.Empty != "") { xlpw = int.Parse(this.Request.BizObject["F0000027"] + string.Empty); } objin2["F0000018"] = wang - hg - huiy - cip - xlpw; double zonghe = wang - hg - huiy - cip - xlpw; int woqty = 0; if(this.Request.BizObject["woqty"] + string.Empty != "") { woqty = int.Parse(this.Request.BizObject["woqty"] + string.Empty); } double wgl = zonghe / woqty; objin2["F0000019"] = wgl; } } } //中间其他工序 else if(zinameshunxuzi == zinamej && zinameshunxuzi != 1 && zinameshunxuzi != gxcd) { int bao = 0;//上道工序数 if(itemBo["F0000009"] + string.Empty != "") { bao = int.Parse(itemBo["F0000009"] + string.Empty);//本来有的上道工序报工 } int yiyou = 0; if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); }
              //减去下道工序的上道工序报工数 int souyou = yiyou - baogong; if(souyou < bao)//小于进行中 { itemBo["gxstatus"] = "进行中"; } else { //获取上道工序的状态 string zt = sdgxzt; if(zt == "已结束") { itemBo["gxstatus"] = "已结束"; } } } else { } //第一道工序与派工进行对比,下面的工序与,上到工序的报工数进行对比 //中间工序改变状态, 下一道工序,改变下一道工序的上一道工序报工数,及状态 if(zinamej == zinamejia) { int bao = 0; if(itemBo["F0000009"] + string.Empty != "") { bao = int.Parse(itemBo["F0000009"] + string.Empty);//本来有的上道工序报工 } // int shangbao = 0; // if(this.Request.BizObject["shangyouliangpin"] + string.Empty != "" ) // { // shangbao = int.Parse(this.Request.BizObject["shangyouliangpin"] + string.Empty); // } itemBo["F0000009"] =bao - baogong;//上到工序报工数 itemBo["gxstatus"] = "进行中"; } //将子表内已有数据循环添加到新的子表数据集合里 newChildBoList.Add(itemBo); } if(gdjs == "off") { objin2["wostatus"] = "结束"; } } //创建 objin2[childSchemaCode] = newChildBoList.ToArray(); objin2.Update(commit0); // objin2.Status = H3.DataModel.BizObjectStatus.Effective; string errorMsg = null; commit0.Commit(this.Engine.BizObjectManager, out errorMsg); //上面都是更改工单派工的工艺路线 //更改工序中心的工艺及查询下一条工序的情况 //下道工序的上道工序数,在上面的工单派工中会一起变更 int baogongshu = int.Parse(this.Request.BizObject["F0000026"] + string.Empty);//总报工 int baogong2 = int.Parse(this.Request.BizObject["bcqty"] + string.Empty);//报工 int jianqubaogong = baogongshu - baogong2; //查询对应工序 string ziid2 = this.Request.BizObject["rtId"] + string.Empty;//工序 string gongdan = this.Request.BizObject["woId"] + string.Empty;//工单 string sqlzib2 = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where ObjectId='" + ziid2 + "'";//查询工序 System.Data.DataTable dtzib2 = this.Engine.Query.QueryTable(sqlzib2, null);//查询工序 //查询工单 string strgongdan = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where F0000020='" + gongdan + "'"; System.Data.DataTable dtgdgls = this.Engine.Query.QueryTable(strgongdan, null); int gongxuzongshu = 0; // string gdjsz = "";//状态 H3.DataModel.BulkCommit commitT = new H3.DataModel.BulkCommit(); if(dtgdgls.Rows.Count > 0) { gongxuzongshu = dtgdgls.Rows.Count;//工序总数 } if(dtzib2.Rows.Count > 0) { string gongxu = dtzib2.Rows[0]["F0000001"] + string.Empty;//工序 int gongxus = int.Parse(gongxu); H3.DataModel.BizObject objingx = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001728bf71c5566608411794824fd32f34a7a3", ziid2, false);//加载工序中心表 if(gongxu == "1") { if(this.Request.BizObject["seqence"] + string.Empty != "下料") { //获取所有报工内容,判断是否等于派工。等于结束,不等于,继续进行 int gonhda = 0;//派工 if(this.Request.BizObject["woqty"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["woqty"] + string.Empty); objingx["F0000008"] = gonhda; } if(jianqubaogong == gonhda) { objingx["F0000019"] = "已结束"; } else { objingx["F0000019"] = "进行中"; } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } else { int gonhda = 0;//工单数量0.9 if(this.Request.BizObject["F0000034"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["F0000034"] + string.Empty); //objingx["F0000009"] = gonhda; } int gonhdabai = 0;//工单数量1.1 if(this.Request.BizObject["F0000035"] + string.Empty != "") { gonhdabai = int.Parse(this.Request.BizObject["F0000035"] + string.Empty); objingx["F0000008"] = gonhdabai; } // int gonhdaw = 0;//派工 // if(this.Request.BizObject["woqty"] + string.Empty != "") // { // gonhdaw = int.Parse(this.Request.BizObject["woqty"] + string.Empty); // objingx["F0000008"] = gonhdaw; // } //比较大小 if(jianqubaogong > gonhda && jianqubaogong < gonhdabai) { objingx["F0000019"] = "已结束"; } else { objingx["F0000019"] = "进行中"; } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } } else if(gongxus == gongxuzongshu) { //查询第一道 string strdiyidao = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where F0000020='" + gongdan + "'" + "and F0000001=1"; System.Data.DataTable dtdiyidao = this.Engine.Query.QueryTable(strdiyidao, null);//查询工序 int onebg = 0; string onezt = ""; if(dtdiyidao.Rows.Count > 0) { if(dtdiyidao.Rows[0]["F0000009"] + string.Empty != "") { onebg = int.Parse(dtdiyidao.Rows[0]["F0000009"] + string.Empty); } onezt = dtdiyidao.Rows[0]["F0000019"] + string.Empty; } int souyou = jianqubaogong; if(souyou == onebg && onezt == "已结束") { objingx["F0000019"] = "已结束"; // gdjsz = "off"; } else { objingx["F0000019"] = "进行中"; } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } else { int shangdaoxu = gongxus - 1; string sxsdgxzt = ""; //获取上道工序状态 string sdgxzthq = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where F0000020='" + gongdan + "'" + "and F0000001=" + shangdaoxu; System.Data.DataTable shangdaogongxuzt = this.Engine.Query.QueryTable(sdgxzthq, null); if(shangdaogongxuzt.Rows.Count > 0) { sxsdgxzt = shangdaogongxuzt.Rows[0]["F0000019"] + string.Empty;//状态 } int bao = 0;//上道工序数 if(dtzib2.Rows[0]["F0000008"] + string.Empty != "") { bao = int.Parse(dtzib2.Rows[0]["F0000008"] + string.Empty);//本来有的上道工序报工 } int souyou = jianqubaogong; if(souyou < bao)//小于进行中 { objingx["F0000019"] = "进行中"; } else { //获取上道工序的状态 string zt = sxsdgxzt; if(zt == "已结束") { objingx["F0000019"] = "已结束"; } } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } } } base.OnSubmit(actionName, postValue, response); }
  //流程完成走,执行下面的代码,与上面的Remove,不同点只是修改工序报工数将减改为加 protected override void OnWorkflowInstanceStateChanged(H3.Workflow.Instance.WorkflowInstanceState oldState, H3.Workflow.Instance.WorkflowInstanceState newState) { if(oldState == H3.Workflow.Instance.WorkflowInstanceState.Running && newState == H3.Workflow.Instance.WorkflowInstanceState.Finished) { H3.IEngine engine = this.Engine; string masterBoId = this.Request.BizObject["woId"] + string.Empty; //查找两个表的 string ziid = this.Request.BizObject["rtId"] + string.Empty; string sqlzib = "SELECT * FROM i_D000685F99add1cdbf3747eeade0bd6eb2ca7216 where ObjectId='" + ziid + "'"; System.Data.DataTable dtzib = this.Engine.Query.QueryTable(sqlzib, null); string sqlzib4 = "SELECT * FROM i_D00068566c3a33d6987424e9a0d142b1bef2bae where ObjectId='" + masterBoId + "'"; System.Data.DataTable dtzib4 = this.Engine.Query.QueryTable(sqlzib4, null); //当前工序的工序是否完成:报工是否等于派工,更改下道工序为进行中 //改变下一道工序报工数 string zinameshunxu = ""; if(dtzib.Rows.Count > 0) { zinameshunxu = dtzib.Rows[0]["Name"] + string.Empty;//这是工单的名称 } string masterSchemaCode = "D00068566c3a33d6987424e9a0d142b1bef2bae"; H3.DataModel.BulkCommit commit0 = new H3.DataModel.BulkCommit(); // H3.DataModel.BizObject objin2 = new H3.DataModel.BizObject(this.Engine, schemawe, H3.Organization.User.SystemUserId); H3.DataModel.BizObject objin2 = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, engine, masterSchemaCode, masterBoId, false); string childSchemaCode = "D000685F99add1cdbf3747eeade0bd6eb2ca7216"; H3.DataModel.BizObjectSchema childSchema = objin2.Schema.GetChildSchema(childSchemaCode); List < H3.DataModel.BizObject > newChildBoList = new List<H3.DataModel.BizObject>(); //获取子表内已有数据 H3.DataModel.BizObject[] childBoArray = (H3.DataModel.BizObject[]) objin2[childSchemaCode]; if(childBoArray != null && childBoArray.Length > 0) { string gdjs = "on"; int gxcd = childBoArray.Length; int zinameshunxuzi = int.Parse(zinameshunxu);//工单序号查询出的 int baogong = int.Parse(this.Request.BizObject["bcqty"] + string.Empty);//报工 // int blip = int.Parse(this.Request.BizObject["ngqty"] + string.Empty); // int bfei = int.Parse(this.Request.BizObject["bfqty"] + string.Empty); string sdgxzt = "";//上道工序状态 //获取第一道工序的报工数量,及状态 int onebg = 0; string onezt = ""; int one = 1;//是否为第一次 int cishu = 0; int cishut = 0; int zuihou = 0; foreach(H3.DataModel.BizObject itemBo in childBoArray) { //for(int i=0;i<childBoArray.Length;i++) { } int zinamejia = zinameshunxuzi + 1; int zinamej = int.Parse(itemBo["Name"].ToString()); // string sdgxzt = "";//上道工序状态 if(zinameshunxuzi != 1) { int sdgx = zinameshunxuzi - 1;//上道工序 if(sdgx == zinamej) { sdgxzt = itemBo["gxstatus"] + string.Empty; } } // //获取第一道工序的报工数量,及状态 // int onebg = 0; // string onezt = ""; if(zinamej == one) { if(cishu < 1) { if(itemBo["ybgqty"] + string.Empty != "") { onebg = int.Parse(itemBo["ybgqty"].ToString()); } onezt = itemBo["gxstatus"] + string.Empty; cishu++; } } //当前工序第一道工序 if(zinameshunxuzi == one) { if(cishut < 1) { if(this.Request.BizObject["seqence"] + string.Empty != "下料") { //itemBo["ybgqty"] = this.Request.BizObject["bcqty"] + string.Empty; //获取所有报工内容,判断是否等于派工。等于结束,不等于,继续进行 int zong = 0; int gonhda = 0;//工单数量 if(this.Request.BizObject["woqty"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["woqty"] + string.Empty); itemBo["F0000009"] = gonhda; } int yiyou = 0;//已报工 if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); } zong = /*gonhda +*/ yiyou + baogong; if(gonhda == zong) { itemBo["gxstatus"] = "已结束"; } else { itemBo["gxstatus"] = "进行中"; } cishut++; } else { int zong = 0; int gonhda = 0;//工单数量0.9 if(this.Request.BizObject["F0000034"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["F0000034"] + string.Empty); //itemBo["F0000009"] = gonhda; } int gonhdabai = 0;//工单数量1.1 if(this.Request.BizObject["F0000035"] + string.Empty != "") { gonhdabai = int.Parse(this.Request.BizObject["F0000035"] + string.Empty); itemBo["F0000009"] = gonhdabai; } int yiyou = 0;//已报工 if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); } zong = /*gonhda +*/ yiyou + baogong; if(gonhda < zong && gonhdabai > zong) { itemBo["gxstatus"] = "已结束"; } else { itemBo["gxstatus"] = "进行中"; } cishut++; } } }//最后一道 else if(zinameshunxuzi == gxcd) { if(zinamej == gxcd) { if(zuihou < 1) { int yiyou = 0; if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); } int souyou = yiyou + baogong; if(souyou == onebg && onezt == "已结束") { itemBo["gxstatus"] = "已结束"; gdjs = "off"; } else { itemBo["gxstatus"] = "进行中"; } zuihou++; } if(dtzib4.Rows.Count > 0) { int wang = 0; int hg = 0; int huiy = 0; int cip = 0; int xlpw = 0; if(dtzib4.Rows[0]["F0000018"] + string.Empty != "") { wang = int.Parse(dtzib4.Rows[0]["F0000018"] + string.Empty); } if(this.Request.BizObject["F0000016"] + string.Empty != "") { hg = int.Parse(this.Request.BizObject["F0000016"] + string.Empty); } if(this.Request.BizObject["F0000013"] + string.Empty != "") { huiy = int.Parse(this.Request.BizObject["F0000013"] + string.Empty); } if(this.Request.BizObject["ngqty"] + string.Empty != "") { cip = int.Parse(this.Request.BizObject["ngqty"] + string.Empty); } if(this.Request.BizObject["F0000027"] + string.Empty != "") { xlpw = int.Parse(this.Request.BizObject["F0000027"] + string.Empty); } objin2["F0000018"] = wang + hg + huiy + cip + xlpw; double zonghe = wang + hg + huiy + cip + xlpw; int woqty = 0; if(this.Request.BizObject["woqty"] + string.Empty != "") { woqty = int.Parse(this.Request.BizObject["woqty"] + string.Empty); } double wgl = zonghe / woqty; objin2["F0000019"] = wgl; } } } //中间其他工序 else if(zinameshunxuzi == zinamej && zinameshunxuzi != 1 && zinameshunxuzi != gxcd) { int bao = 0;//上道工序数 if(itemBo["F0000009"] + string.Empty != "") { bao = int.Parse(itemBo["F0000009"] + string.Empty);//本来有的上道工序报工 } int yiyou = 0; if(this.Request.BizObject["F0000021"] + string.Empty != "") { yiyou = int.Parse(this.Request.BizObject["F0000021"] + string.Empty); } int souyou = yiyou + baogong; if(souyou < bao)//小于进行中 { itemBo["gxstatus"] = "进行中"; } else { //获取上道工序的状态 string zt = sdgxzt; if(zt == "已结束") { itemBo["gxstatus"] = "已结束"; } } } else { } //第一道工序与派工进行对比,下面的工序与,上到工序的报工数进行对比 //中间工序改变状态, 下一道工序,改变下一道工序的上一道工序报工数,及状态 if(zinamej == zinamejia) { int bao = 0; if(itemBo["F0000009"] + string.Empty != "") { bao = int.Parse(itemBo["F0000009"] + string.Empty);//本来有的上道工序报工 } // int shangbao = 0; // if(this.Request.BizObject["shangyouliangpin"] + string.Empty != "" ) // { // shangbao = int.Parse(this.Request.BizObject["shangyouliangpin"] + string.Empty); // } itemBo["F0000009"] = baogong + bao;//上到工序报工数 itemBo["gxstatus"] = "进行中"; } //将子表内已有数据循环添加到新的子表数据集合里 newChildBoList.Add(itemBo); } if(gdjs == "off") { objin2["wostatus"] = "结束"; } } //创建 objin2[childSchemaCode] = newChildBoList.ToArray(); objin2.Update(commit0); // objin2.Status = H3.DataModel.BizObjectStatus.Effective; string errorMsg = null; commit0.Commit(this.Engine.BizObjectManager, out errorMsg); //上面都是更改工单派工的工艺路线 //更改工序中心的工艺及查询下一条工序的情况 //下道工序的上道工序数,在上面的工单派工中会一起变更 int baogongshu = int.Parse(this.Request.BizObject["F0000026"] + string.Empty);//总报工 //查询对应工序 string ziid2 = this.Request.BizObject["rtId"] + string.Empty;//工序 string gongdan = this.Request.BizObject["woId"] + string.Empty;//工单 string sqlzib2 = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where ObjectId='" + ziid2 + "'";//查询工序 System.Data.DataTable dtzib2 = this.Engine.Query.QueryTable(sqlzib2, null);//查询工序 //查询工单 string strgongdan = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where F0000020='" + gongdan + "'"; System.Data.DataTable dtgdgls = this.Engine.Query.QueryTable(strgongdan, null); int gongxuzongshu = 0; // string gdjsz = "";//状态 H3.DataModel.BulkCommit commitT = new H3.DataModel.BulkCommit(); if(dtgdgls.Rows.Count > 0) { gongxuzongshu = dtgdgls.Rows.Count;//工序总数 } if(dtzib2.Rows.Count > 0) { string gongxu = dtzib2.Rows[0]["F0000001"] + string.Empty;//工序 int gongxus = int.Parse(gongxu); H3.DataModel.BizObject objingx = H3.DataModel.BizObject.Load(H3.Organization.User.SystemUserId, this.Engine, "D001728bf71c5566608411794824fd32f34a7a3", ziid2, false);//加载工序中心表 if(gongxu == "1") { if(this.Request.BizObject["seqence"] + string.Empty != "下料") { //获取所有报工内容,判断是否等于派工。等于结束,不等于,继续进行 int gonhda = 0;//派工 if(this.Request.BizObject["woqty"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["woqty"] + string.Empty); objingx["F0000008"] = gonhda; } if(baogongshu == gonhda) { objingx["F0000019"] = "已结束"; } else { objingx["F0000019"] = "进行中"; } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } else { int gonhda = 0;//工单数量0.9 if(this.Request.BizObject["F0000034"] + string.Empty != "") { gonhda = int.Parse(this.Request.BizObject["F0000034"] + string.Empty); //objingx["F0000009"] = gonhda; } int gonhdabai = 0;//工单数量1.1 if(this.Request.BizObject["F0000035"] + string.Empty != "") { gonhdabai = int.Parse(this.Request.BizObject["F0000035"] + string.Empty); objingx["F0000008"] = gonhdabai; } // int gonhdaw = 0;//派工 // if(this.Request.BizObject["woqty"] + string.Empty != "") // { // gonhdaw = int.Parse(this.Request.BizObject["woqty"] + string.Empty); // objingx["F0000008"] = gonhdaw; // } //比较大小 if(baogongshu > gonhda && baogongshu < gonhdabai) { objingx["F0000019"] = "已结束"; } else { objingx["F0000019"] = "进行中"; } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } } else if(gongxus == gongxuzongshu) { //查询第一道 string strdiyidao = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where F0000020='" + gongdan + "'" + "and F0000001=1"; System.Data.DataTable dtdiyidao = this.Engine.Query.QueryTable(strdiyidao, null);//查询工序 int onebg = 0; string onezt = ""; if(dtdiyidao.Rows.Count > 0) { if(dtdiyidao.Rows[0]["F0000009"] + string.Empty != "") { onebg = int.Parse(dtdiyidao.Rows[0]["F0000009"] + string.Empty); } onezt = dtdiyidao.Rows[0]["F0000019"] + string.Empty; } int souyou = baogongshu; if(souyou == onebg && onezt == "已结束") { objingx["F0000019"] = "已结束"; // gdjsz = "off"; } else { objingx["F0000019"] = "进行中"; } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } else { int shangdaoxu = gongxus - 1; string sxsdgxzt = ""; //获取上道工序状态 string sdgxzthq = "SELECT * FROM i_D001728bf71c5566608411794824fd32f34a7a3 where F0000020='" + gongdan + "'" + "and F0000001=" + shangdaoxu; System.Data.DataTable shangdaogongxuzt = this.Engine.Query.QueryTable(sdgxzthq, null); if(shangdaogongxuzt.Rows.Count > 0) { sxsdgxzt = shangdaogongxuzt.Rows[0]["F0000019"] + string.Empty;//状态 } int bao = 0;//上道工序数 if(dtzib2.Rows[0]["F0000008"] + string.Empty != "") { bao = int.Parse(dtzib2.Rows[0]["F0000008"] + string.Empty);//本来有的上道工序报工 } int souyou = baogongshu; if(souyou < bao)//小于进行中 { objingx["F0000019"] = "进行中"; } else { //获取上道工序的状态 string zt = sxsdgxzt; if(zt == "已结束") { objingx["F0000019"] = "已结束"; } } objingx.Update(commitT); string errorMsg2 = null; commitT.Commit(this.Engine.BizObjectManager, out errorMsg2); } } } }

 

标签:string,BizObject,--,Request,Parse,报工,int,生产,Empty
From: https://www.cnblogs.com/H-Yan/p/17465579.html

相关文章

  • 188. 买卖股票的最佳时机 IV
    188.买卖股票的最佳时机IV给定一个整数数组 prices,它的第i个元素 prices[i]是一支给定的股票在第i天的价格,和一个整型k。设计一个算法来计算你所能获取的最大利润。你最多可以完成k笔交易。也就是说,你最多可以买k次,卖k次。注意:你不能同时参与多笔交易(你必须......
  • springboot 返回流式数据
    @PostMapping("/stream")publicResponseEntity<StreamingResponseBody>stream(){StreamingResponseBodystream=out->{for(inti=0;i<3;i++){try{Thread.sleep(1000);}cat......
  • 利用异构语言学图增强汉语预训练语言模型
    中文预训练模型利用上下文字符信息学习表示,却忽略了语言学知识,如单词和句子信息。因此,我们提出了一个称为异构语言学图(HLG)的无任务增强模块,通过整合语言学知识来增强预先训练的汉语模型。具体而言,我们构建了一个层次异质图来建模汉语的特征语言学结构,并采用基于图的方法来总结和具......
  • 敏捷开发管理软件推荐
    Scrum中非常强调公开、透明、直接有效的沟通,这也是“可视化的管理工具”在敏捷开发中如此重要的原因之一。通过“可视化的管理工具”让所有人直观的看到需求,故事,任务之间的流转状态,可以使团队成员更加快速适应敏捷开发流程。所以,有敏捷工具的支撑是非常必要。Leangoo领歌Leango......
  • 1112.开发模式场景以及Git
    一、开发模式与场景1.客户端和服务端①什么是服务端理解服务端之前先搞清楚什么是服务器?服务器就是提供网络服务的机器设备!1.高效提供网络服务;2.多用户与用户组以及权限的管理;3.全年24小时不间断运行,无需关机重启。那服务端是什么了?就是运行在服务器上面提供具体网络......
  • linux配置虚拟ip实现主备双击高可用
    linux配置虚拟ip实现主备双击高可用背景:设置了虚拟ip指向两台服务器,但是没有配置虚拟网卡,虚拟ip10.249.134.227分别指向10.249.134.193,10.249.134.194,使用HaVip结合keepalived实现主备双机高可用转自HaVip结合keepalived实现主备双机高可用(aliyun.com)1.执行以下命令,主......
  • CentOS7 配置本地yum源软件仓库
    CentOS7配置本地yum源软件仓库前言配置本地yum源软件仓库可以离线状态下安装本地已有的软件先连接虚拟光驱,对应的光驱iso文件查看磁盘分区状态可以看到sr0未挂载[[email protected]]#lsblkNAMEMAJ:MINRMSIZEROTYPEMOUNTPOINTsda8:0......
  • 文件系统考古2:1984 - BSD Fast Filing System
    今天继续与大家分享系列文章《50yearsinfilesystems》,由KRISTIANKÖHNTOPP撰写。我们将进入文件系统的第二个十年,即1984年,计算机由微型计算机发展到了桌面和机柜工作站,BSDFastFilingSystem登场。回看第一篇:1974-UnixV7FileSystem早期的Unix文件系统已经表现得......
  • 使用Laf云平台,两步将ChatGPT接入微信公众号
    使用Laf云平台,两步将ChatGPT接入微信公众号最近很火的ChatGPT可以说已经满大街可见了,到处都有各种各样的体验地址,有收费的也有免费的,总之是五花八门、花里胡哨。所以呢,最近我就在研究怎么才能方便快捷的体验到ChatGPT的强大功能,其中一个就是:把ChatGPT接入公众号。如下图(成果图):......
  • 虚拟机上安装nginx、openssl、pcre、zlib步骤
    1、下载相关组件:wget http://nginx.org/download/nginx-1.10.2.tar.gzopenssl是一个开源的实现加解密和证书的专业系统。wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gzopenssl是一个开源的实现加解密和证书的专业系统。wgethttp://downloads.sourcefo......