private void btn_SyncNC_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, slbwhCode + "开坯同步NC", "开坯同步NC", "开坯同步NC");//添加操作日志 int result = 0; DataTable dt = bll_TRC_COGDOWN_MAIN.GetCogDownFact(2, staID, 1).Tables[0]; if (dt == null || dt.Rows.Count == 0) { MessageBox.Show("开坯完工实绩数据为空"); return; } WaitingFrom.ShowWait(""); for (int i = 0; i < dt.Rows.Count; i++) { string re = bll_TRC_COGDOWN_MAIN.KpSyncNc(dt.Rows[i]["C_COGDOWN_ID"].ToString(), slbwhCode, staID, Application.StartupPath, dt.Rows[i]["C_COGDOWN_SHIFT"].ToString(), dt.Rows[i]["C_COGDOWN_GROUP"].ToString()); if (re == "0") { result++; } } WaitingFrom.CloseWait(); MessageBox.Show("同步成功" + result + "条"); BindToSlabList(); }
private void btn_Sucess_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "完成计划", "完成计划", "完成计划");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认完成计划吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_KPZPJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查计划记录!"); return; } string planID = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString();//获取焦点主键 string result = bll_TRC_COGDOWN_MAIN.SuccessPlan(planID); if (result == "1") { MessageBox.Show("操作成功"); Query1(); } else { MessageBox.Show("操作失败"); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Seave_Click(object sender, EventArgs e) { try { Mod_TQB_CHECKTYPE mod = bll.GetModel(id); DataTable dt = bll.GetList_Not_Name(txt_TypeName.Text.Trim(), mod.C_TYPE_NAME).Tables[0]; if (dt.Rows.Count > 0) { MessageBox.Show("项目名称已存在!"); return; } mod.C_TYPE_NAME = txt_TypeName.Text.Trim(); mod.C_REMARK = txt_Remark1.Text.Trim(); mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.D_MOD_DT = RV.UI.ServerTime.timeNow(); bll.Update(mod); MessageBox.Show("修改成功!"); UserLog.AddLog(strMenuName, this.Name, this.Text, "修改检验类别");//添加操作日志 this.DialogResult = DialogResult.Cancel; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Elim_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "抛丸剔除", "抛丸剔除", "抛丸剔除");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认剔除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_XMJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查修磨计划,记录为空!"); return; } string id = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string num = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "N_QUA").ToString(); //获取焦点支数 string factNum = txt_Elim.Text; //支数 string remark = txt_ElimRemark.Text; int errorNum = 0;//TryParse 输出参数 if (!Int32.TryParse(factNum, out errorNum)) { MessageBox.Show("剔除支数只能是整数!"); return; } if (Convert.ToInt32(factNum) == 0) { MessageBox.Show("剔除支数不能为0!"); return; } if (Convert.ToInt32(factNum) > Convert.ToInt32(num)) { MessageBox.Show("剔除支数不能大于库存支数!"); return; } string result = bll_TRC_PLAN_REGROUND.Elim(id, factNum, "抛丸探伤", remark, slbwhCodeArr[0]); if (result == "1") { BindXMPlanData(); MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } RefreshControls(); }
/// <summary> /// 撤回出炉 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OutBack_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "出炉撤回", "出炉撤回", "出炉撤回");//添加操作日志 try { if (txt_OutRemark.Text.Trim() == "") { MessageBox.Show("备注为空不能撤回!"); return; } if (DialogResult.No == MessageBox.Show("是否确认撤回?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int errorNum = 0;//TryParse 输出参数 //支数 string outNum = this.txt_outCancelNum.Text.Trim(); if (!Int32.TryParse(outNum, out errorNum)) { MessageBox.Show("撤回支数只能是整数!"); return; } if (int.Parse(outNum) <= 0) { MessageBox.Show("撤回支数不能小于0"); return; } //撤回支数不能大于入炉支数 int furnaceNum = bll_TRC_ROLL_MAIN.GetFurnaceNum(staID, int.Parse(outNum), 2); if (furnaceNum < int.Parse(outNum)) { MessageBox.Show("撤回支数不能大于出炉支数!"); return; } if (bll_TRC_ROLL_MAIN.OutBackHandler(staID, this.txt_OutRemark.Text, int.Parse(outNum), this.cbo_OutShift.EditValue.ToString(), this.cbo_OutGroup.EditValue.ToString()) == "1") { MessageBox.Show("撤回成功!"); } else { MessageBox.Show("撤回失败!"); } RefreshPut(Query1()); RefreshOut(Query2()); Refresh(Query3()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 出炉剔除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OutElim_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "出炉剔除", "出炉剔除", "出炉剔除");//添加操作日志 try { if (DialogResult.No == MessageBox.Show("是否确认剔除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int errorNum = 0;//TryParse 输出参数 //支数 string outNum = this.txt_outCancelNum.Text.Trim(); if (!Int32.TryParse(outNum, out errorNum)) { MessageBox.Show("剔除支数只能是整数!"); return; } if (int.Parse(outNum) <= 0) { MessageBox.Show("剔除支数不能为0"); return; } //剔除支数不能大于入炉支数 int furnaceNum = bll_TRC_COGDOWN_MAIN.GetFurnaceNum(staID, int.Parse(outNum), 2); if (furnaceNum < int.Parse(outNum)) { MessageBox.Show("剔除支数不能大于出炉支数!"); return; } string shift = this.cbo_OutShift.EditValue.ToString(); string group = this.cbo_OutGroup.EditValue.ToString(); string userID = RV.UI.UserInfo.UserID; if (bll_TRC_COGDOWN_MAIN.OutElimHandler(staID, this.txt_OutRemark.Text, int.Parse(outNum), slabwhCode, shift, group, userID) == "1") { MessageBox.Show("剔除成功!"); } else { MessageBox.Show("剔除失败!"); } RefreshPut(Query1()); RefreshOut(Query2()); Refresh(Query3()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_Close_Click(object sender, EventArgs e) { if (DialogResult.No == MessageBox.Show("确认关闭计划吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "确认关闭计划" + this.txt_BranchNo.Text, "确认关闭计划", "确认关闭计划");//添加操作日志 string planRemark = txt_planRemark.Text.Trim(); if (planRemark == "") { MessageBox.Show("关闭计划请填写备注"); return; } int selectedPlanHandle = this.gv_ZGZPJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查计划记录!"); return; } string planID = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string orderNo = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_ORDER_NO").ToString(); //获取焦点订单号 string groupWgt = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_GROUP_WGT").ToString(); //获取焦点组批量 string wgt = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_WGT").ToString(); //获取焦点组批量 var m = bll_TRP_PLAN_ROLL_ITEM.GetModel(planID); if (m.N_GROUP_WGT >= m.N_WGT) { MessageBox.Show("组批量大于等于计划量,无法关闭"); return; } string result = bll_TRC_ROLL_MAIN.ClosePlans(planID, orderNo, planRemark, RV.UI.UserInfo.UserID, RV.UI.UserInfo.UserName); if (result == "1") { MessageBox.Show("操作成功"); Query1(); } else { MessageBox.Show("操作失败"); } }
/// <summary> /// 撤回 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_BackOut_Click(object sender, EventArgs e) { try { if (DialogResult.No == MessageBox.Show("是否确认撤回?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } string sql = " AND TRM.C_STA_ID='" + staID + "' "; DataTable dt = bll_TRC_ROLL_MAIN.GetListMain(sql, false).Tables[0]; if (dt == null || dt.Rows.Count == 0) { MessageBox.Show("无组批记录,无法撤回!"); return; } DataRow dr = dt.Rows[0]; string planID = dr["C_PLAN_ID"].ToString(); string asseID = dr["C_ID"].ToString(); decimal assemNum = decimal.Parse(dr["N_WGT_TOTAL_VIRTUAL"].ToString()); string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "轧钢组坯撤销" + dr["C_BATCH_NO"].ToString(), "轧钢组坯撤销", "轧钢组坯撤销");//添加操作日志 string result = bll_TRC_ROLL_MAIN.BackOutHandler(asseID, assemNum, planID); if (result == "1") { MessageBox.Show("操作成功!"); Query1(); Query2(); Query3(); //生成批号 this.txt_BranchNo.Text = bll_TRC_ROLL_MAIN.CreateBranchNo(staID); } else { MessageBox.Show("操作失败!"); Query1(); Query2(); Query3(); //生成批号 this.txt_BranchNo.Text = bll_TRC_ROLL_MAIN.CreateBranchNo(staID); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_Success_Click(object sender, EventArgs e) { if (DialogResult.No == MessageBox.Show("确认完成计划吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "确认完成计划吗" + this.txt_BranchNo.Text, "确认完成计划", "确认完成计划"); //添加操作日志 int selectedPlanHandle = this.gv_ZGZPJH.FocusedRowHandle; //获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查计划记录!"); return; } string planID = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString();//获取焦点主键 decimal wgt = 0; decimal groupWgt = decimal.Parse(this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_GROUP_WGT").ToString()); decimal planWgt = decimal.Parse(this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_WGT").ToString()); var m = bll_TRP_PLAN_ROLL_ITEM.GetModel(planID); if (m.N_GROUP_WGT < m.N_WGT) { MessageBox.Show("组批量小于计划量,无法完成"); return; } string result = bll_TRC_ROLL_MAIN.SuccessPlan(planID); if (result == "1") { MessageBox.Show("操作成功"); Query1(); } else { MessageBox.Show("操作失败"); } }
private void btn_SyncRF_Click(object sender, EventArgs e) { if (dtRF != null && dtRF.Rows.Count > 0) { WaitingFrom.ShowWait(""); for (int i = 0; i < dtRF.Rows.Count; i++) { dal_Interface_FR.TbKCList("", "", "", dtRF.Rows[i]["WGDH"].ToString(), "", "", ""); bll_TRC_ROLL_WGD.UpdateUpLoadStatus(2, dtRF.Rows[i]["WGDH"].ToString()); UserLog.AddLog(RV.UI.UserInfo.menuName, this.Name, this.Text, dtRF.Rows[i]["WGDH"].ToString() + "同步条码数据,时间:" + DateTime.Now.ToLongDateString()); } WaitingFrom.CloseWait(); MessageBox.Show("同步成功"); } else { MessageBox.Show("同步失败"); } BindWgdFinished(); }
private void simpleButton2_Click(object sender, EventArgs e) { int selectedPlanHandle = 0;//获取计划焦点行索引 if (gv_ZGZPJH.RowCount == 0) { MessageBox.Show("记录为空!"); return; } if (DialogResult.No == MessageBox.Show("确认修改时间吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "确认关闭计划" + this.txt_BranchNo.Text, "确认关闭计划", "确认关闭计划"); //添加操作日志 string planID = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 decimal mach = decimal.Parse(this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_MACH_WGT").ToString()); //获取焦点机时产能 decimal wgt = decimal.Parse(this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_WGT").ToString()); //获取焦点行排产量 DateTime start = dt_PlanStart.DateTime; decimal re = wgt / mach; DateTime end = start.AddHours((double)re); if (bll_TRC_ROLL_MAIN.UpdatePlanTime(planID, start, end)) { #region 重新计算所有订单生产时间 OverAgainTime(); #endregion MessageBox.Show("操作成功"); Query1(); } else { MessageBox.Show("操作失败"); } }
protected void btnAdd_Click(object sender, EventArgs e) { this.doing.Attributes.Add("display", "none"); int userid = int.Parse(this.ddlUser.SelectedValue); string Idlist = ""; int num = this.AllRoleList.Items.Count; for (int i = 0; i < num; i++) { if (this.AllRoleList.Items[i].Selected) { int roleid = int.Parse(this.AllRoleList.Items[i].Value); string description = this.AllRoleList.Items[i].Text; bll.Add(userid, roleid); Idlist += roleid + ","; } } #region 添加日志 //获取当前用户及权限 AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //获取当前用户 User currentUser = new LTP.Accounts.Bus.User(user); try { UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "管理员端 | 系统管理 | 用户角色权函数限设置 | 要关联的用户ID: " + userid + " , 被设置的角色ID: " + Idlist); } catch { UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "管理员端 | 系统管理 | 用户角色权函数限设置 | 要关联的用户ID: " + userid + " , 被设置的角色ID " + Idlist + ", 添加日志失败"); } #endregion ddlUser_SelectedIndexChanged(sender, e); }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "密码输入的不一致!请重试!"; } else { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; //日志 UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败"); } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; //日志 UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功"); } } } }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Add_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txt_Type.Text.Trim())) { MessageBox.Show("原因类型不能为空!", "提示"); return; } #region 检测是否重复添加 System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("C_REASON_TYPE_NAME", txt_Type.Text); ht.Add("N_STATUS", "1"); if (Common.CheckRepeat.CheckTable("TQB_FAULT_REASON_TYPE", ht) > 0) { MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #endregion Mod_TQB_FAULT_REASON_TYPE mod = new Mod_TQB_FAULT_REASON_TYPE(); mod.C_REASON_TYPE_NAME = txt_Type.Text.Trim(); mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.D_MOD_DT = RV.UI.ServerTime.timeNow(); bll_type.Add(mod); NewMethod(); MessageBox.Show("添加成功!", "提示"); UserLog.AddLog(strMenuName, this.Name, this.Text, "添加不合格原因类型");//添加操作日志 ClearContent.ClearFlowLayoutPanel(flowLayoutPanel1.Controls); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 撤回 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Back_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "撤回", "撤回", "撤回");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认撤回吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedHandle = this.gv_WGDV.FocusedRowHandle;//获取焦点行索引 if (selectedHandle < 0) { this.gc_WGDV.DataSource = null; this.gv_WGDV.BestFitColumns(); MessageBox.Show("无记录!"); return; } //获取焦点行ID string id = this.gv_WGDV.GetRowCellValue(selectedHandle, "C_ID").ToString(); string result = bll_TRC_ROLL_WGD.WgdBackHandler(id, 3); if (result == "1") { BindWgdData(); BindWgdVData(); MessageBox.Show("操作成功!"); } else { BindWgdData(); BindWgdVData(); MessageBox.Show("操作失败!"); } }
/// <summary> /// 删除修磨记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Del_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "确认删除", "确认删除", "确认删除");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_Handler.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查修磨记录,数据为空!"); return; } string id = this.gv_Handler.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string regroundid = this.gv_Handler.GetRowCellValue(selectedPlanHandle, "C_REGROUND_ID").ToString(); //获取焦点修磨计划id string xmbz = this.gv_Handler.GetRowCellValue(selectedPlanHandle, "C_XMBZ").ToString(); //获取焦点修磨标准 string qua = this.gv_Handler.GetRowCellValue(selectedPlanHandle, "N_QUA").ToString(); //获取焦点修磨支数 string result = bll_TRC_PLAN_REGROUND.DelRegroundHandler(id, regroundid, xmbz, qua); if (result == "1") { MessageBox.Show("操作成功"); BindXMPlanData(); BindHandlerData(regroundid); } else { MessageBox.Show("操作失败"); } }
private void btn_Back_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "撤回完工单", "撤回完工单", "撤回完工单");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认撤回吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gridView1.FocusedRowHandle; //获取计划焦点行索引 string batchNo = this.gridView1.GetRowCellValue(selectedPlanHandle, "C_BATCH_NO").ToString(); //获取焦点主键 if (bll_TRC_ROLL_WGD.BackWgd(batchNo)) { BindWgdVData(); MessageBox.Show("操作成功"); } else { MessageBox.Show("操作成功"); } }
private void btn_BackOut_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "撤回修磨计划", "撤回修磨计划", "撤回修磨计划");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认撤回吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_XMJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查修磨计划,记录为空!"); return; } string id = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string num = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "N_QUA").ToString(); //获取焦点支数 string result = bll_TRC_PLAN_REGROUND.BackRegroundPlan(id, num, slbwhCodeArr[0]); if (result == "1") { BindXMData(); BindXMPlanData(); MessageBox.Show("操作成功!"); } else { BindXMData(); BindXMPlanData(); MessageBox.Show("操作失败!"); } }
private void btn_Update_Click(object sender, EventArgs e) { if (DialogResult.No == MessageBox.Show("确认修改吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "修改实绩", "修改实绩", "完工记录"); //添加操作日志 int selectedAllowGrd = this.gv_WGD.FocusedRowHandle; //获取可轧钢种焦点行索引 if (selectedAllowGrd < 0) { MessageBox.Show("请选择一条完工单修改!"); return; } string id = this.gv_WGD.GetRowCellValue(selectedAllowGrd, "C_MAIN_ID").ToString(); //ID decimal produceQua = decimal.Parse(this.gv_WGD.GetRowCellValue(selectedAllowGrd, "N_QUA_PRODUCE").ToString()); //支数 decimal success = this.txt_UpSuccess.Text == "" ? 0 : decimal.Parse(this.txt_UpSuccess.Text); decimal castOff = this.txt_UpCastOff.Text == "" ? 0 : decimal.Parse(this.txt_UpCastOff.Text); decimal cutting = this.txt_UpCutting.Text == "" ? 0 : decimal.Parse(this.txt_UpCutting.Text); DateTime start = this.dt_UpdateStart.DateTime; DateTime end = this.dt_UpdateEnd.DateTime; if (bll_TRC_ROLL_WGD.UpdateWgdQua(id, success, castOff, cutting, RV.UI.UserInfo.userID, start, end)) { BindAssePutStoreData(); BindWGDData(); MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } }
/// <summary> /// 改判 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Update_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "确认改判", "确认改判", "确认改判");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认改判吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedHandle = this.gv_WGD.FocusedRowHandle;//获取焦点行索引 if (selectedHandle < 0) { this.gc_WGD.DataSource = null; this.gv_WGD.BestFitColumns(); MessageBox.Show("无记录!"); return; } int selectedHandleItem = this.gv_WGDITEM.FocusedRowHandle;//获取焦点行索引 if (selectedHandleItem < 0) { this.gc_WGDITEM.DataSource = null; this.gv_WGDITEM.BestFitColumns(); MessageBox.Show("无记录!"); return; } //获取焦点行ID string id = this.gv_WGD.GetRowCellValue(selectedHandle, "C_ID").ToString(); //获取焦点行工位 string staID = this.gv_WGD.GetRowCellValue(selectedHandle, "C_STA_ID").ToString(); //获取焦点行炉号 string stove = this.gv_WGD.GetRowCellValue(selectedHandle, "C_STOVE").ToString(); //获取焦点行批次 string batchNo = this.gv_WGD.GetRowCellValue(selectedHandle, "C_BATCH_NO").ToString(); //获取焦点行计划号 string planID = this.gv_WGD.GetRowCellValue(selectedHandle, "C_PLAN_ID").ToString(); //获取焦点行钢种 string grd = this.gv_WGD.GetRowCellValue(selectedHandle, "C_STL_GRD").ToString(); //获取焦点行执行标准 string std = this.gv_WGD.GetRowCellValue(selectedHandle, "C_STD_CODE").ToString(); //获取焦点行规格 string spec = this.gv_WGD.GetRowCellValue(selectedHandle, "C_SPEC").ToString(); //获取焦点行包装要求 string pack = this.gv_WGD.GetRowCellValue(selectedHandle, "C_PACK").ToString(); //获取焦点行自由项 string zyx = this.gv_WGD.GetRowCellValue(selectedHandle, "C_FREE_TERM").ToString(); //获取焦点行自由项2 string zyx2 = this.gv_WGD.GetRowCellValue(selectedHandle, "C_FREE_TERM2").ToString(); //获取焦点行物料编码 string matCode = this.gv_WGD.GetRowCellValue(selectedHandle, "C_MAT_CODE").ToString(); //获取焦点行物料名称 string matDesc = this.gv_WGD.GetRowCellValue(selectedHandle, "C_MAT_DESC").ToString(); //获取焦点批次属性 string mrsx = this.gv_WGD.GetRowCellValue(selectedHandle, "C_MRSX").ToString(); //获取焦点批次类型 string pclx = this.gv_WGD.GetRowCellValue(selectedHandle, "C_PCLX").ToString(); //获取批次属性 string newMrsx = cbo_BatchAttr.Text; //批次类型 string newPclx = this.image_Type.EditValue.ToString(); //完工执行标准 string itemID = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_ID").ToString(); //完工执行标准 string newStd = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_STD_CODE").ToString(); //完工钢种 string newGrd = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_STL_GRD").ToString(); //完工规格 string newSpec = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_SPEC").ToString(); //完工物料编码 string newMatCode = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_MAT_CODE").ToString(); //完工物料名称 string newMatDesc = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_MAT_DESC").ToString(); //完工自由项 string newZyx = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_ZYX1").ToString(); //完工自由项2 string newZyx2 = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_ZYX2").ToString(); //完工包装标准 string newPack = this.gv_WGDITEM.GetRowCellValue(selectedHandleItem, "C_BZYQ").ToString(); //属性 string sx = cbo_Sx.Text; string result = bll_TRC_ROLL_WGD.WgdHandler(id, staID, stove, batchNo, planID, grd, std, spec, pack, zyx, zyx2, mrsx, matCode , matDesc, pclx, newMrsx, newPclx, newStd, newGrd, newSpec, newMatCode, newMatDesc, newZyx, newZyx2, newPack, dt_ExecStart.DateTime, 2, sx, itemID); if (result == "1") { BindWgdData(); BindWgdVData(); MessageBox.Show("操作成功!"); } else { BindWgdData(); BindWgdVData(); MessageBox.Show("操作失败!"); } }
private void btn_SyncNC_Click(object sender, EventArgs e) { NcRollA1 ncA1 = new NcRollA1(); NcRollA2 ncA2 = new NcRollA2(); NcRollA3 ncA3 = new NcRollA3(); NcRollA4 ncA4 = new NcRollA4(); int result = 0; int errorStatus = 1; string errorId = ""; string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, slbwhCode + "同步NC", "同步NC", "同步NC");//添加操作日志 try { WaitingFrom.ShowWait(""); if (dtNC != null && dtNC.Rows.Count > 0) { for (int i = 0; i < dtNC.Rows.Count; i++) { string id = dtNC.Rows[i]["C_MAIN_ID"].ToString(); errorId = id; var wgd = bll_TRC_ROLL_WGD.GetModel(id, 1); var plan = bllPlanRollItem.GetModel_Item(wgd.C_PLAN_ID); if (plan.N_IS_MERGE == 1) { continue; } var a1Sta = bll_TB_STA.GetModel(plan.C_STA_ID); ncA1.bmid = "1001NC10000000000345"; ncA1.jhrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.jhxxsl = plan.N_WGT.ToString(); var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); ncA1.jhyid = matrl.C_PLANEMP; ncA1.jldwid = matrl.C_PK_MEASDOC; ncA1.pk_produce = matrl.C_PK_PRODUCE; ncA1.scbmid = a1Sta.C_SSBMID; ncA1.shrid = "1006AA100000000ERS2A";//plan.C_EMP_ID; ncA1.shrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.slrq = DateTime.Parse(plan.D_NEED_DT == null ? DateTime.Now.ToString() : plan.D_NEED_DT.ToString()); ncA1.wlbmid = matrl.C_PK_INVBASDOC; ncA1.xdrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.xqrq = DateTime.Parse(plan.D_DELIVERY_DT == null ? DateTime.Now.ToString() : plan.D_DELIVERY_DT.ToString()); ncA1.xqsl = plan.N_WGT.ToString(); ncA1.zdrq = DateTime.Now; ncA1.zyx1 = plan.C_FREE_TERM; ncA1.zyx2 = plan.C_FREE_TERM2; ncA1.zyx3 = plan.C_PACK; ncA1.zyx5 = plan.C_ID; ncA1.memo = plan.C_AREA; ncA1.jhfaid = matrl.C_PK_PSID; string a1Name = plan.C_ID + "_A1.xml"; var resultA1 = bll_Interface_NC_Roll_A1.SendXml_ROLL_A1("", a1Name, ncA1, Application.StartupPath); if (resultA1[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA1[1]); //continue; } DataTable factDt2 = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; bool bol = false; for (int j = 0; j < factDt2.Rows.Count; j++) { string slabWh = bll_TPB_LINEWH.GetList_id(factDt2.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); if (string.IsNullOrEmpty(slabWh)) { bol = true; break; } } if (bol) { continue; } errorStatus = 2; var main = bll_TRC_ROLL_MAIN.GetModel(id); var a2Sta = bll_TB_STA.GetModel(main.C_STA_ID); var matrl2 = bll_TB_MATRL_MAIN.GetModel(main.C_MAT_SLAB_CODE); ncA2.wlbmid = matrl.C_PK_INVBASDOC; ncA2.pk_produce = matrl.C_PK_PRODUCE; ncA2.invcode = matrl.C_ID; ncA2.pch = main.C_BATCH_NO; ncA2.scbmid = a2Sta.C_SSBMID; ncA2.gzzxid = a2Sta.C_ERP_PK; ncA2.bcid = wgd.C_PRODUCE_SHIFT; ncA2.bzid = wgd.C_PRODUCE_GROUP; ncA2.jhkgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.jhwgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.jhkssj = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.jhjssj = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.sjkgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.sjwgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.sjkssj = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.sjjssj = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.jhwgsl = main.N_WGT_EXIT == 0 ? main.N_WGT_ELIM.ToString() : main.N_WGT_EXIT.ToString(); ncA2.fjhsl = main.N_QUA_EXIT == 0 ? main.N_QUA_ELIM.ToString() : main.N_QUA_EXIT.ToString(); ncA2.jldwid = matrl.C_PK_MEASDOC; ncA2.fjlid = matrl.C_FJLDW; ncA2.sjwgsl = (main.N_WGT_TOTAL_VIRTUAL - main.N_WGT_TOTAL).ToString(); ncA2.freeitemvalue1 = plan.C_FREE_TERM; ncA2.freeitemvalue2 = plan.C_FREE_TERM2; ncA2.freeitemvalue3 = plan.C_PACK; ncA2.zdrid = RV.UI.UserInfo.userAccount; ncA2.freeitemvalue5 = plan.C_ID; string a2Name = Guid.NewGuid() + "_A2.xml"; if (bll_TRC_ROLL_WGD.IsA2Repeat(main.C_BATCH_NO, "") > 0) { } var resultA2 = bll_Interface_NC_Roll_A2.SendXml_ROLL_A2("", a2Name, ncA2, Application.StartupPath); if (resultA2[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(2, id, resultA2[1]); } if (main.N_WGT_EXIT == 0) { if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) { MessageBox.Show("同步成功"); } } errorStatus = 3; ncA3.hpch = main.C_BATCH_NO; ncA3.hzdrid = RV.UI.UserInfo.userAccount; ncA3.hwlbmid = matrl.C_PK_INVBASDOC; ncA3.hjldwid = matrl.C_PK_MEASDOC; ncA3.hzdrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); ncA3.hfreeitemvalue1 = plan.C_FREE_TERM; ncA3.hfreeitemvalue2 = plan.C_FREE_TERM2; ncA3.hfreeitemvalue3 = plan.C_PACK; DataTable consumeDt = new DataTable(); DataTable a3Dt = bll_TRC_WARM_FURNACE.GetSlabMainInfo(wgd.C_MAIN_ID, out consumeDt); DataTable a3DtZyx = bll_TB_STD_CONFIG.GetZYX(a3Dt.Rows[0]["C_STL_GRD"].ToString(), a3Dt.Rows[0]["C_STD_CODE"].ToString()).Tables[0]; var m = bll_TB_MATRL_MAIN.GetModel(a3Dt.Rows[0]["C_MAT_CODE"].ToString()); ncA3.kgyid = RV.UI.UserInfo.userAccount; ncA3.ckckid = bll_TPB_SLABWH.GetList_id(slbwhCode); ncA3.wlbmid = matrl2.C_PK_INVBASDOC; ncA3.jldwid = matrl2.C_PK_MEASDOC; ncA3.fjldwid = matrl2.C_FJLDW; ncA3.ljcksl = a3Dt.Rows[0]["N_WGT"].ToString(); ncA3.fljcksl = a3Dt.Rows[0]["N_QUA"].ToString(); ncA3.pch = a3Dt.Rows[0]["C_BATCH_NO"].ToString() == "" ? a3Dt.Rows[0]["C_STOVE"].ToString() : a3Dt.Rows[0]["C_BATCH_NO"].ToString(); ncA3.gzzxid = a2Sta.C_ERP_PK; ncA3.freeitemvalue1 = a3Dt.Rows[0]["C_ZYX1"].ToString(); ncA3.freeitemvalue2 = a3Dt.Rows[0]["C_ZYX2"].ToString(); object objOutTime = bll_TRC_WARM_FURNACE.GetOutTime(main.C_ID); ncA3.flrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()).ToString("yyyy-MM-dd"); string a3Name = Guid.NewGuid() + "_A3.xml"; if (bll_TRC_ROLL_WGD.IsA3Repeat(main.C_BATCH_NO, "") > 0) { } var resultA3 = bll_Interface_NC_Roll_A3.SendXml_ROLL_A3("", a3Name, ncA3, Application.StartupPath); if (resultA3[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(3, id, resultA3[1]); } bll_TRC_WARM_FURNACE.ConsumeSlab(consumeDt); errorStatus = 4; DataTable a4FactDt = bll_TRC_ROLL_WGD.GetWgdFact(wgd.C_BATCH_NO, 1).Tables[0]; var a4M = bll_TB_MATRL_MAIN.GetModel(wgd.C_MAT_CODE); var a4Sta = bll_TB_STA.GetModel(wgd.C_STA_ID); ncA4.zdrid = RV.UI.UserInfo.userAccount; ncA4.rq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA4.gzzxbmid = a4Sta.C_STA_ERPCODE; ncA4.scbmid = a4Sta.C_SSBMID; ncA4.pch = wgd.C_BATCH_NO; ncA4.wlbmid = a4M.C_PK_INVBASDOC; ncA4.jldwid = a4M.C_PK_MEASDOC; ncA4.gzzxid = a4Sta.C_ERP_PK; ncA4.ccxh = wgd.C_BATCH_NO; ncA4.pk_produce = a4M.C_PK_PRODUCE; ncA4.ksrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA4.jsrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA4.hgsl = a4FactDt.Rows[0]["WGT"].ToString(); ncA4.fhgsl = a4FactDt.Rows[0]["QUA"].ToString(); object wgdHandlerStatus = bll_TRC_ROLL_WGD_HANDLER.GetWgdHandlerStatus(wgd.C_ID); if (wgdHandlerStatus != null) { string status = wgdHandlerStatus.ToString(); ncA4.sflfcp = int.Parse(status) == 2 ? "Y" : "N"; ncA4.sffsgp = int.Parse(status) == 2 ? "Y" : "N"; } else { ncA4.sflfcp = "N"; ncA4.sffsgp = "N"; } ncA4.freeitemvalue1 = wgd.C_FREE_TERM; ncA4.freeitemvalue2 = wgd.C_FREE_TERM2; ncA4.freeitemvalue3 = wgd.C_PACK; string a4Name = Guid.NewGuid() + "_A4.xml"; if (bll_TRC_ROLL_WGD.IsA4Repeat(main.C_BATCH_NO, "") > 0) { } var resultA4 = bll_Interface_NC_Roll_A4.SendXml_ROLL_A4("", a4Name, ncA4, Application.StartupPath); if (resultA4[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(4, id, resultA4[1]); } errorStatus = 5; decimal wgdWgt = 0; DataTable factDt = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; List <NcRoll46> nc46s = new List <NcRoll46>(); for (int j = 0; j < factDt.Rows.Count; j++) { NcRoll46 nc46 = new NcRoll46(); var a46M = bll_TB_MATRL_MAIN.GetModel(factDt.Rows[j]["C_MAT_CODE"].ToString()); nc46.cwarehouseid = bll_TPB_LINEWH.GetList_id(factDt.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); nc46.taccounttime = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); nc46.coperatorid = RV.UI.UserInfo.userAccount; //if (wgd.C_MRSX == "DP") //{ } nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName("DP", "1001").C_ID; //else // nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName(factDt.Rows[j]["C_JUDGE_LEV_BP"].ToString(), "1001").C_ID; nc46.cworkcenterid = bll_TB_STA.Get_NC_ID(wgd.C_STA_ID); nc46.dbizdate = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); nc46.vbatchcode = wgd.C_BATCH_NO; nc46.cinvbasid = a46M.C_PK_INVBASDOC; nc46.pk_produce = a46M.C_PK_PRODUCE; nc46.ninnum = factDt.Rows[j]["WGT"].ToString(); nc46.ninassistnum = factDt.Rows[j]["QUA"].ToString(); nc46.castunitid = a46M.C_FJLDW; nc46.vfree1 = factDt.Rows[j]["C_ZYX1"].ToString(); nc46.vfree2 = factDt.Rows[j]["C_ZYX2"].ToString(); nc46.vfree3 = factDt.Rows[j]["C_BZYQ"].ToString(); nc46s.Add(nc46); wgdWgt += decimal.Parse(factDt.Rows[j]["WGT"].ToString()); } string a46Name = Guid.NewGuid() + "_A46.xml"; var resultA46 = bll_Interface_NC_Roll_46.SendXml_ROLL_46("", a46Name, nc46s, Application.StartupPath); if (resultA46[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(5, id, resultA46[1]); } if (bll_TRC_ROLL_WGD.Is46Repeat(main.C_BATCH_NO, "") > 0) { bll_TRC_ROLL_WGD.UpdateRollPlanItemWgt(plan.C_ID, wgdWgt); if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) { result++; } } } } WaitingFrom.CloseWait(); MessageBox.Show("同步成功" + result); } catch (Exception ex) { bll_TRC_ROLL_WGD.UpdateIfStatus(errorStatus, errorId, ex.Message); MessageBox.Show("同步错误"); } BindWgd(); }
/// <summary> /// 入炉 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Put_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "入炉", "入炉", "入炉");//添加操作日志 try { if (DialogResult.No == MessageBox.Show("是否确认入炉?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } DataTable dtLength = Query1(); if (dtLength == null || dtLength.Rows.Count == 0) { MessageBox.Show("无待入炉钢坯!"); return; } int errorNum = 0;//TryParse 输出参数 //入炉总支数 string putNum = this.txt_PutNum.Text.Trim(); if (!Int32.TryParse(putNum, out errorNum)) { MessageBox.Show("入炉支数只能是整数!"); return; } if (int.Parse(putNum) == 0) { MessageBox.Show("入炉支数不能为0!"); return; } int result = 0; //单次入炉支数 int num = 0; //控制循环开关 bool bol = false; do { DataTable dt = Query1(); if (dt == null || dt.Rows.Count == 0) { bol = false; break; } //总入炉支数-组坯支数 如果记过>0还需要下一下循环 <=0不需要下次循环 int calculate = int.Parse(putNum) - Convert.ToInt32(dt.Rows[0]["N_QUA_TOTAL"]); if (calculate > 0) { bol = true; num = Convert.ToInt32(dt.Rows[0]["N_QUA_TOTAL"]); putNum = calculate.ToString(); } else { bol = false; num = int.Parse(putNum); } this.txt_PutRemark.Text += "|" + dt.Rows[0]["C_REMARK"] == null ? "" : dt.Rows[0]["C_REMARK"].ToString(); string id = dt.Rows[0]["C_ID"].ToString(); string batchNo = dt.Rows[0]["C_BATCH_NO"].ToString(); string staID = dt.Rows[0]["C_STA_ID"].ToString(); string planID = dt.Rows[0]["C_PLAN_ID"].ToString(); if (bll_TRC_ROLL_MAIN.PutFurnaceHandler(id, num, batchNo, staID, this.cbo_PutShift.EditValue.ToString(), this.cbo_PutGroup.EditValue.ToString(), this.txt_PutRemark.Text, planID, RV.UI.ServerTime.timeNow()) == "1") { result++; } }while (bol); if (result > 0) { MessageBox.Show("操作成功"); } else { MessageBox.Show("操作失败"); } RefreshPut(Query1()); RefreshOut(Query2()); Refresh(Query3()); this.txt_PutRemark.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_SL_Click(object sender, EventArgs e) { WaitingFrom.ShowWait(""); string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "生产实绩", "生产实绩", "完工记录");//添加操作日志 int compareDt = DateTime.Compare(this.dt_ExecStart.DateTime, this.dt_ExecEnd.DateTime); if (this.dt_ExecStart.DateTime == DateTime.MinValue || this.dt_ExecEnd.DateTime == DateTime.MinValue) { MessageBox.Show("日期错误!"); BindAssePutStoreData(); } if (compareDt > 0) { MessageBox.Show("日期错误!"); return; } int errorNum = 0; //TryParse 输出参数 //撤回支数 //string num = this.txt_HGZS.Text.Trim(); //if (!Int32.TryParse(num, out errorNum)) //{ // MessageBox.Show("完工支数只能是整数!"); // return; //} //if (int.Parse(num) <= 0) //{ // MessageBox.Show("完工支数不能小于0"); // return; //} string whereSql = " AND TRM.C_STA_ID = '" + staID + "' "; DataTable dt = bll_TRC_ROLL_WGD.GetAssePutStoreData(whereSql, true).Tables[0]; if (DialogResult.No == MessageBox.Show("确认完工吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } if (dt != null && dt.Rows.Count > 0) { string stove = dt.Rows[0]["C_STOVE"].ToString(); string batchNo = dt.Rows[0]["C_BATCH_NO"].ToString(); string planID = dt.Rows[0]["C_PLAN_ID"].ToString(); decimal wgt = 2; string grd = dt.Rows[0]["C_STL_GRD"].ToString(); string spec = dt.Rows[0]["C_SPEC"].ToString(); string std = dt.Rows[0]["C_STD_CODE"].ToString(); string ids = dt.Rows[0]["C_ID"].ToString(); string qua = dt.Rows[0]["N_QUA_EXIT"].ToString(); DateTime start = dt_ExecStart.DateTime; DateTime end = dt_ExecEnd.DateTime; string shift = cbo_BC.EditValue.ToString(); string group = cbo_BZ.EditValue.ToString(); string shiftName = cbo_BC.Text; string groupName = cbo_BZ.Text; string castOffQua = txt_CastOff.Text; string cuttingQua = txt_Cutting.Text; string result = bll_TRC_ROLL_WGD.WgdHandler(stove, batchNo, planID, int.Parse(qua), wgt, grd, spec, std, ids, staID, start, end, shift, group, shiftName, groupName , castOffQua, cuttingQua); if (result == "1") { BindAssePutStoreData(); BindWGDData(); MessageBox.Show("操作成功!"); //#region 同步完工单 //string sqlWhere = @" N_SCRF=2 // AND C_STA_ID='" + staID + "' "; //var dtNC = bll_TRC_ROLL_WGD.GetList(sqlWhere).Tables[0]; //NcRollA1 ncA1 = new NcRollA1(); //NcRollA2 ncA2 = new NcRollA2(); //NcRollA3 ncA3 = new NcRollA3(); //NcRollA4 ncA4 = new NcRollA4(); //int errorStatus = 1; //string errorId = ""; //if (dtNC != null && dtNC.Rows.Count > 0) //{ // for (int i = 0; i < dtNC.Rows.Count; i++) // { // string id = dtNC.Rows[i]["C_MAIN_ID"].ToString(); // errorId = id; // var wgd = bll_TRC_ROLL_WGD.GetModel(id, 1); // var plan = bllPlanRollItem.GetModel_Item(wgd.C_PLAN_ID); // var a1Sta = bll_TB_STA.GetModel(plan.C_STA_ID); // ncA1.bmid = "1001NC10000000000345"; // ncA1.jhrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); // ncA1.jhxxsl = plan.N_WGT.ToString(); // var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); // ncA1.jhyid = matrl.C_PLANEMP; // ncA1.jldwid = matrl.C_PK_MEASDOC; // ncA1.pk_produce = matrl.C_PK_PRODUCE; // ncA1.scbmid = a1Sta.C_SSBMID; // ncA1.shrid = "1006AA100000000ERS2A";//plan.C_EMP_ID; // ncA1.shrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); // ncA1.slrq = DateTime.Parse(plan.D_NEED_DT == null ? DateTime.Now.ToString() : plan.D_NEED_DT.ToString()); // ncA1.wlbmid = matrl.C_PK_INVBASDOC; // ncA1.xdrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); // ncA1.xqrq = DateTime.Parse(plan.D_DELIVERY_DT == null ? DateTime.Now.ToString() : plan.D_DELIVERY_DT.ToString()); // ncA1.xqsl = plan.N_WGT.ToString(); // ncA1.zdrq = DateTime.Now; // ncA1.zyx1 = plan.C_FREE_TERM; // ncA1.zyx2 = plan.C_FREE_TERM2; // ncA1.zyx3 = plan.C_PACK; // ncA1.zyx5 = plan.C_ID; // ncA1.jhfaid = matrl.C_PK_PSID; // string a1Name = plan.C_ID + "_A1.xml"; // var resultA1 = bll_Interface_NC_Roll_A1.SendXml_ROLL_A1("", a1Name, ncA1, Application.StartupPath); // if (resultA1[0] != "1") // { // bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA1[1]); // //continue; // } // DataTable factDt2 = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; // bool bol = false; // for (int j = 0; j < factDt2.Rows.Count; j++) // { // string slabWh = bll_TPB_LINEWH.GetList_id(factDt2.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); // if (string.IsNullOrEmpty(slabWh)) // { // bol = true; // break; // } // } // if (bol) // continue; // errorStatus = 2; // var main = bll_TRC_ROLL_MAIN.GetModel(id); // var a2Sta = bll_TB_STA.GetModel(main.C_STA_ID); // var matrl2 = bll_TB_MATRL_MAIN.GetModel(main.C_MAT_SLAB_CODE); // ncA2.wlbmid = matrl.C_PK_INVBASDOC; // ncA2.pk_produce = matrl.C_PK_PRODUCE; // ncA2.invcode = matrl.C_ID; // ncA2.pch = main.C_BATCH_NO; // ncA2.scbmid = a2Sta.C_SSBMID; // ncA2.gzzxid = a2Sta.C_ERP_PK; // ncA2.bcid = wgd.C_PRODUCE_SHIFT; // ncA2.bzid = wgd.C_PRODUCE_GROUP; // ncA2.jhkgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); // ncA2.jhwgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); // ncA2.jhkssj = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); // ncA2.jhjssj = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); // ncA2.sjkgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); // ncA2.sjwgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); // ncA2.sjkssj = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); // ncA2.sjjssj = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); // ncA2.jhwgsl = main.N_WGT_EXIT == 0 ? main.N_WGT_ELIM.ToString() : main.N_WGT_EXIT.ToString(); // ncA2.fjhsl = main.N_QUA_EXIT == 0 ? main.N_QUA_ELIM.ToString() : main.N_QUA_EXIT.ToString(); // ncA2.jldwid = matrl.C_PK_MEASDOC; // ncA2.fjlid = matrl.C_FJLDW; // ncA2.sjwgsl = (main.N_WGT_TOTAL_VIRTUAL - main.N_WGT_TOTAL).ToString(); // ncA2.freeitemvalue1 = plan.C_FREE_TERM; // ncA2.freeitemvalue2 = plan.C_FREE_TERM2; // ncA2.freeitemvalue3 = plan.C_PACK; // ncA2.zdrid = RV.UI.UserInfo.userAccount; // ncA2.freeitemvalue5 = plan.C_ID; // string a2Name = Guid.NewGuid() + "_A2.xml"; // if (bll_TRC_ROLL_WGD.IsA2Repeat(wgd.C_BATCH_NO, "") > 0) // { // } // var resultA2 = bll_Interface_NC_Roll_A2.SendXml_ROLL_A2("", a2Name, ncA2, Application.StartupPath); // if (resultA2[0] != "1") // { // bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA2[1]); // } // if (main.N_WGT_EXIT == 0) // { // if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) // MessageBox.Show("同步成功"); // return; // } // errorStatus = 3; // ncA3.hpch = main.C_BATCH_NO; // ncA3.hzdrid = RV.UI.UserInfo.userAccount; // ncA3.hwlbmid = matrl.C_PK_INVBASDOC; // ncA3.hjldwid = matrl.C_PK_MEASDOC; // ncA3.hzdrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); // ncA3.hfreeitemvalue1 = plan.C_FREE_TERM; // ncA3.hfreeitemvalue2 = plan.C_FREE_TERM2; // ncA3.hfreeitemvalue3 = plan.C_PACK; // DataTable consumeDt = new DataTable(); // DataTable a3Dt = bll_TRC_WARM_FURNACE.GetSlabMainInfo(wgd.C_MAIN_ID, out consumeDt); // DataTable a3DtZyx = bll_TB_STD_CONFIG.GetZYX(a3Dt.Rows[0]["C_STL_GRD"].ToString(), a3Dt.Rows[0]["C_STD_CODE"].ToString()).Tables[0]; // var m = bll_TB_MATRL_MAIN.GetModel(a3Dt.Rows[0]["C_MAT_CODE"].ToString()); // ncA3.kgyid = RV.UI.UserInfo.userAccount; // ncA3.ckckid = bll_TPB_SLABWH.GetList_id(a3Dt.Rows[0]["c_slabwh_code"].ToString()); // ncA3.wlbmid = matrl2.C_PK_INVBASDOC; // ncA3.jldwid = matrl2.C_PK_MEASDOC; // ncA3.fjldwid = matrl2.C_FJLDW; // ncA3.ljcksl = a3Dt.Rows[0]["N_WGT"].ToString(); // ncA3.fljcksl = a3Dt.Rows[0]["N_QUA"].ToString(); // ncA3.pch = a3Dt.Rows[0]["C_BATCH_NO"].ToString() == "" ? a3Dt.Rows[0]["C_STOVE"].ToString() : a3Dt.Rows[0]["C_BATCH_NO"].ToString(); // ncA3.gzzxid = a2Sta.C_ERP_PK; // ncA3.freeitemvalue1 = a3Dt.Rows[0]["C_ZYX1"].ToString(); // ncA3.freeitemvalue2 = a3Dt.Rows[0]["C_ZYX2"].ToString(); // object objOutTime = bll_TRC_WARM_FURNACE.GetOutTime(main.C_ID); // ncA3.flrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()).ToString("yyyy-MM-dd"); // string a3Name = Guid.NewGuid() + "_A3.xml"; // if (bll_TRC_ROLL_WGD.IsA3Repeat(wgd.C_BATCH_NO, "") > 0) // { // } // var resultA3 = bll_Interface_NC_Roll_A3.SendXml_ROLL_A3("", a3Name, ncA3, Application.StartupPath); // if (resultA3[0] != "1") // { // bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA3[1]); // } // bll_TRC_WARM_FURNACE.ConsumeSlab(consumeDt); // errorStatus = 4; // DataTable a4FactDt = bll_TRC_ROLL_WGD.GetWgdFact(wgd.C_BATCH_NO, 1).Tables[0]; // var a4M = bll_TB_MATRL_MAIN.GetModel(wgd.C_MAT_CODE); // var a4Sta = bll_TB_STA.GetModel(wgd.C_STA_ID); // ncA4.zdrid = RV.UI.UserInfo.userAccount; // ncA4.rq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); // ncA4.gzzxbmid = a4Sta.C_STA_ERPCODE; // ncA4.scbmid = a4Sta.C_SSBMID; // ncA4.pch = wgd.C_BATCH_NO; // ncA4.wlbmid = a4M.C_PK_INVBASDOC; // ncA4.jldwid = a4M.C_PK_MEASDOC; // ncA4.gzzxid = a4Sta.C_ERP_PK; // ncA4.ccxh = wgd.C_BATCH_NO; // ncA4.pk_produce = a4M.C_PK_PRODUCE; // ncA4.ksrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); // ncA4.jsrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); // ncA4.hgsl = a4FactDt.Rows[0]["WGT"].ToString(); // ncA4.fhgsl = a4FactDt.Rows[0]["QUA"].ToString(); // object wgdHandlerStatus = bll_TRC_ROLL_WGD_HANDLER.GetWgdHandlerStatus(wgd.C_ID); // if (wgdHandlerStatus != null) // { // string status = wgdHandlerStatus.ToString(); // ncA4.sflfcp = int.Parse(status) == 2 ? "Y" : "N"; // ncA4.sffsgp = int.Parse(status) == 2 ? "Y" : "N"; // } // else // { // ncA4.sflfcp = "N"; // ncA4.sffsgp = "N"; // } // ncA4.freeitemvalue1 = wgd.C_FREE_TERM; // ncA4.freeitemvalue2 = wgd.C_FREE_TERM2; // ncA4.freeitemvalue3 = wgd.C_PACK; // string a4Name = Guid.NewGuid() + "_A4.xml"; // if (bll_TRC_ROLL_WGD.IsA4Repeat(wgd.C_BATCH_NO, "") > 0) // { // } // var resultA4 = bll_Interface_NC_Roll_A4.SendXml_ROLL_A4("", a4Name, ncA4, Application.StartupPath); // if (resultA4[0] != "1") // { // bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA4[1]); // } // errorStatus = 5; // decimal wgdWgt = 0; // DataTable factDt = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; // List<NcRoll46> nc46s = new List<NcRoll46>(); // for (int j = 0; j < factDt.Rows.Count; j++) // { // NcRoll46 nc46 = new NcRoll46(); // var a46M = bll_TB_MATRL_MAIN.GetModel(factDt.Rows[j]["C_MAT_CODE"].ToString()); // nc46.cwarehouseid = bll_TPB_LINEWH.GetList_id(factDt.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); // nc46.taccounttime = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); // nc46.coperatorid = RV.UI.UserInfo.userAccount; // //if (wgd.C_MRSX == "DP") // //{ } // nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName("DP", "1001").C_ID; // //else // // nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName(factDt.Rows[j]["C_JUDGE_LEV_BP"].ToString(), "1001").C_ID; // nc46.cworkcenterid = bll_TB_STA.Get_NC_ID(wgd.C_STA_ID); // nc46.dbizdate = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); // nc46.vbatchcode = wgd.C_BATCH_NO; // nc46.cinvbasid = a46M.C_PK_INVBASDOC; // nc46.pk_produce = a46M.C_PK_PRODUCE; // nc46.ninnum = factDt.Rows[j]["WGT"].ToString(); // nc46.ninassistnum = factDt.Rows[j]["QUA"].ToString(); // nc46.castunitid = a46M.C_FJLDW; // nc46.vfree1 = factDt.Rows[j]["C_ZYX1"].ToString(); // nc46.vfree2 = factDt.Rows[j]["C_ZYX2"].ToString(); // nc46.vfree3 = factDt.Rows[j]["C_BZYQ"].ToString(); // nc46s.Add(nc46); // wgdWgt += decimal.Parse(factDt.Rows[j]["WGT"].ToString()); // } // string a46Name = Guid.NewGuid() + "_A46.xml"; // var resultA46 = bll_Interface_NC_Roll_46.SendXml_ROLL_46("", a46Name, nc46s, Application.StartupPath); // if (resultA46[0] != "1") // { // bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA46[1]); // } // if (bll_TRC_ROLL_WGD.Is46Repeat(wgd.C_BATCH_NO, "") > 0) // { // bll_TRC_ROLL_WGD.UpdateRollPlanItemWgt(plan.C_ID, wgdWgt); // bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id); // } // } //} //#endregion } else { BindAssePutStoreData(); BindWGDData(); MessageBox.Show("操作失败!"); } } WaitingFrom.CloseWait(); }
/// <summary> /// 出炉 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OutFurnace_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "出炉", "出炉", "出炉");//添加操作日志 if (DialogResult.No == MessageBox.Show("是否确认出炉?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } DataTable dtLength = Query2(); if (dtLength == null || dtLength.Rows.Count == 0) { MessageBox.Show("无入炉钢坯!"); return; } int errorNum = 0;//TryParse 输出参数 //出炉总支数 string outNum = this.txt_OutNum.Text.Trim(); if (!Int32.TryParse(outNum, out errorNum)) { MessageBox.Show("出炉支数只能是整数!"); return; } if (int.Parse(outNum) == 0) { MessageBox.Show("出炉支数不能为0!"); return; } int result = 0; //单次入炉支数 int num = 0; //控制循环开关 bool bol = false; do { DataTable dt = Query2(); if (dt == null || dt.Rows.Count == 0) { bol = false; break; } //总入炉支数-组坯支数 如果记过>0还需要下一下循环 <=0不需要下次循环 int calculate = int.Parse(outNum) - Convert.ToInt32(dt.Rows[0]["N_QUA_JOIN"]); if (int.Parse(dt.Rows[0]["N_QUA_JOIN"].ToString()) == 0) { break; } else if (calculate > 0) { bol = true; num = Convert.ToInt32(dt.Rows[0]["N_QUA_JOIN"]); outNum = calculate.ToString(); } else { bol = false; num = int.Parse(outNum); } string remark = dt.Rows[0]["C_REMARK"] == null ? "" : dt.Rows[0]["C_REMARK"].ToString(); if (!string.IsNullOrWhiteSpace(remark)) { this.txt_OutRemark.Text += "|" + remark; } string id = dt.Rows[0]["C_ID"].ToString(); string batchNo = dt.Rows[0]["C_BATCH_NO"].ToString(); string staID = dt.Rows[0]["C_STA_ID"].ToString(); string planID = dt.Rows[0]["C_PLAN_ID"].ToString(); var plan = bll_TRP_PLAN_COGDOWN.GetModel(planID); decimal pw = plan.N_SLAB_PW.Value; if (bll_TRC_COGDOWN_MAIN.OutFurnaceHandler(id, num, batchNo, staID, this.cbo_OutShift.EditValue.ToString(), this.cbo_OutGroup.EditValue.ToString(), this.txt_OutRemark.Text, planID, pw, RV.UI.ServerTime.timeNow()) == "1") { result++; } }while (bol); if (result > 0) { MessageBox.Show("操作成功"); } else { MessageBox.Show("操作失败"); } RefreshPut(Query1()); RefreshOut(Query2()); Refresh(Query3()); this.txt_OutRemark.Text = ""; }
/// <summary> /// 入炉剔除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_PutElim_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "入炉剔除", "入炉剔除", "入炉剔除");//添加操作日志 try { if (DialogResult.No == MessageBox.Show("是否确认剔除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int errorNum = 0;//TryParse 输出参数 //支数 string putNum = this.txt_putCancelNum.Text.Trim(); if (!Int32.TryParse(putNum, out errorNum)) { MessageBox.Show("剔除支数只能是整数!"); return; } if (int.Parse(putNum) <= 0) { MessageBox.Show("剔除支数不能为0"); return; } DataTable dt = Query1(); //剔除支数不能大于入炉支数 if (dt == null || dt.Rows.Count == 0) { MessageBox.Show("无待入炉数据!"); return; } int num = Convert.ToInt32(dt.Rows[0]["N_QUA_TOTAL"]); if (int.Parse(putNum) >= num) { MessageBox.Show("剔除后组坯支数为0,请撤回组坯计划重新组坯!"); return; } string shift = this.cbo_PutShift.EditValue.ToString(); string group = this.cbo_PutGroup.EditValue.ToString(); string userID = RV.UI.UserInfo.UserID; string id = dt.Rows[0]["C_ID"].ToString(); if (bll_TRC_COGDOWN_MAIN.PutElimHandler(staID, this.txt_PutRemark.Text, int.Parse(putNum), slabwhCode, shift, group, userID, id) == "1") { MessageBox.Show("剔除成功!"); } else { MessageBox.Show("剔除失败!"); } RefreshPut(Query1()); RefreshOut(Query2()); Refresh(Query3()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// 组批 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Asse_Click(object sender, EventArgs e) { try { if (this.gv_ZGZPJH.RowCount == 0) { MessageBox.Show("计划记录为空!"); return; } int selectedPlanHandle = this.gv_ZGZPJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle != 0 && string.IsNullOrWhiteSpace(txt_Remark.Text)) { MessageBox.Show("配批必须输入备注!"); return; } int selectedAllowGrd = this.gv_KDZGZ.FocusedRowHandle;//获取可轧钢种焦点行索引 if (selectedPlanHandle < 0 || selectedAllowGrd < 0) { MessageBox.Show("请检查计划和可轧钢种,记录为空!"); return; } if (DialogResult.No == MessageBox.Show("确认组批吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } string planID = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string planGrd = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_STL_GRD").ToString(); //获取焦点行钢种 string planStd = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_STD_CODE").ToString(); //获取焦点行执行标准 string planSpec = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_SPEC").ToString(); //获取焦点规格 string status = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_STATUS").ToString(); //获取焦点状态 string planMatCode = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_MAT_CODE").ToString(); //获取焦点物料编码 string planMatName = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "C_MAT_NAME").ToString(); //获取焦点物料名称 string planIsMerge = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "N_IS_MERGE").ToString(); //获取焦点合并标记 string maxWgt = this.gv_ZGZPJH.GetRowCellValue(selectedPlanHandle, "MaxWgt").ToString(); //获取焦点合并标记 int allowGrdNum = Convert.ToInt32(this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "N_QUA")); //可轧钢种支数 string grd = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STL_GRD").ToString(); //钢种 string std = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STD_CODE").ToString(); //执行标准 string spec = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_SPEC").ToString(); //钢坯断面 string matCode = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_MAT_CODE").ToString(); //获取焦点物料编码 string matName = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_MAT_NAME").ToString(); //获取焦点物料名称 string remark = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_REMARK").ToString(); //获取焦点物料名称 decimal planPw = decimal.Parse(this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "N_WGT").ToString()); //获取焦点单重 string kpBatchNo = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_BATCH_NO").ToString(); //获取焦点开批号 string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "轧钢组坯" + this.txt_BranchNo.Text, "轧钢组坯", "轧钢组坯");//添加操作日志 if (status != "1" && status != "2") { MessageBox.Show("请选择已下发、已组坯状态计划组坯!"); return; } int errorNum = 0;//TryParse 输出参数 string asseNum = txt_AsseNum.Text.Trim(); if (!Int32.TryParse(asseNum, out errorNum) || int.Parse(asseNum) == 0) { MessageBox.Show("组批支数只能是整数!"); return; } if (int.Parse(asseNum) > allowGrdNum) { MessageBox.Show("组批支数不能大于钢坯库存支数!"); return; } Mod_TRC_ROLL_MAIN model = new Mod_TRC_ROLL_MAIN(); model.C_ID = bll_TRC_ROLL_MAIN.CreateID(); model.C_STOVE = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STOVE").ToString(); model.C_BATCH_NO = this.txt_BranchNo.Text; model.C_PLAN_ID = planID; model.C_STL_GRD_SLAB = grd; model.C_STD_CODE_SLAB = std; model.C_SPEC_SLAB = spec; model.N_QUA_TOTAL = decimal.Parse(asseNum); model.N_WGT_TOTAL = planPw * decimal.Parse(asseNum); model.C_EMP_ID = UserInfo.UserID; model.C_STL_GRD = planGrd; model.C_SPEC = planSpec; model.C_STD_CODE = planStd; model.C_MAT_SLAB_CODE = matCode; model.C_MAT_SLAB_NAME = matName; model.C_REMARK = this.txt_Remark.Text; if (!string.IsNullOrWhiteSpace(remark)) { model.C_REMARK += "|" + remark; } model.C_GROUP = this.cbo_Group.EditValue.ToString(); model.C_SHIFT = this.cbo_Shift.EditValue.ToString(); model.N_QUA_TOTAL_VRITUAL = model.N_QUA_TOTAL; model.N_WGT_TOTAL_VRITUAL = model.N_WGT_TOTAL; model.C_PLANT = kpBatchNo; model.C_STA_ID = staID; model.N_IS_MERGE = decimal.Parse(planIsMerge); string result = bll_TRC_ROLL_MAIN.AssemblyHandler(model, grd, std, slbwhCode, kpBatchNo, planMatCode, staID, maxWgt); if (result == "1") { btn_AssePlanQuery_Click(null, null); Query3(); MessageBox.Show("操作成功!"); //生成批号 this.txt_BranchNo.Text = bll_TRC_ROLL_MAIN.CreateBranchNo(staID); } else if (result == "8") { btn_AssePlanQuery_Click(null, null); Query3(); MessageBox.Show("组批量超出计划量,不能组坯"); //生成批号 this.txt_BranchNo.Text = bll_TRC_ROLL_MAIN.CreateBranchNo(staID); } else if (result == "9") { btn_AssePlanQuery_Click(null, null); Query3(); MessageBox.Show("组批量超出订单总量,不能组坯"); //生成批号 this.txt_BranchNo.Text = bll_TRC_ROLL_MAIN.CreateBranchNo(staID); } else { btn_AssePlanQuery_Click(null, null); Query3(); MessageBox.Show("操作失败!"); //生成批号 this.txt_BranchNo.Text = bll_TRC_ROLL_MAIN.CreateBranchNo(staID); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_Accomplish_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "抛丸完成", "抛丸完成", "抛丸完成");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认完成吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_XMJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查探伤计划,记录为空!"); return; } string id = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string num = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "N").ToString(); //获取焦点支数 string factNum = txt_Num.Text; //支数 string notNum = this.txt_NotNum.Text; //未探支数 string cause = image_Sta.Text; //this.txt_Cause.Text;/抛丸说明 string batchNo = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "C_BATCH_NO").ToString(); //获取焦点批次号 string xmbz = cbo_Cause.Text; //修磨表标准 string sta = image_Sta.EditValue == null ? "" : image_Sta.EditValue.ToString().Substring(0, 2); //工位 string remark = txt_Remark.Text; //备注 string emp = txt_EMP.Text; //探伤人 string notBz = cbo_Cause.Text + cbo_Level.Text; //不合格标准 string group = this.cbo_Group.EditValue.ToString(); //班组 string shift = this.cbo_Shift.EditValue.ToString(); //班次 DateTime operation = this.dt_operation.DateTime; int errorNum = 0;//TryParse 输出参数 if (!Int32.TryParse(factNum, out errorNum)) { MessageBox.Show("探伤支数只能是整数!"); return; } if (!Int32.TryParse(notNum, out errorNum)) { MessageBox.Show("未探支数只能是整数!"); return; } if (Convert.ToInt32(factNum) > Convert.ToInt32(num)) { MessageBox.Show("探伤支数不能大于库存支数!"); return; } bll_TRC_PLAN_REGROUND.ShotBlastingConfirm(id, num, factNum, notNum, notBz, sta, remark, emp, batchNo, "地上", cause, group, shift, operation); string result = bll_TRC_PLAN_REGROUND.Accomplish(id, factNum, "抛丸探伤"); if (result == "1") { BindXMPlanData(); MessageBox.Show("操作成功!"); } else { BindXMPlanData(); MessageBox.Show("操作失败!"); } RefreshControls(); }
/// <summary> /// 组批 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Asse_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "组批", "组批", "组批");//添加操作日志 try { if (DialogResult.No == MessageBox.Show("确认组批吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_KPZPJH.FocusedRowHandle; //获取计划焦点行索引 int selectedAllowGrd = this.gv_KDZGZ.FocusedRowHandle; //获取可轧钢种焦点行索引 if (selectedPlanHandle < 0 || selectedAllowGrd < 0) { MessageBox.Show("请检查计划和可轧钢种,记录为空!"); return; } string planID = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string planGrd = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "C_STL_GRD").ToString(); //获取焦点行钢种 string planStd = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "C_STD_CODE").ToString(); //获取焦点行执行标准 string planSpec = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "C_SPEC").ToString(); //获取焦点规格 string status = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "N_STATUS").ToString(); //获取焦点状态 string castNo = this.gv_KPZPJH.GetRowCellValue(selectedPlanHandle, "C_CAST_NO").ToString(); //获取焦点炉号 int allowGrdNum = Convert.ToInt32(this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "N_QUA")); //可轧钢种支数 decimal wgt = decimal.Parse(this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "N_WGT").ToString()); //重量 string grd = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STL_GRD").ToString(); //钢种 string std = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STD_CODE").ToString(); //执行标准 string spec = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_SPEC").ToString(); //钢坯断面 string matCode = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_MAT_CODE").ToString(); //获取焦点物料编码 string matName = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_MAT_NAME").ToString(); //获取焦点物料名称 string remark = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_REMARK").ToString(); //备注 string stove = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STOVE").ToString(); //获取焦点炉号 if (castNo != stove) { MessageBox.Show("炉号不匹配,请选择与计划匹配炉号进行组坯!"); return; } if (status != "1") { MessageBox.Show("请选择已下发状态计划组坯!"); return; } int errorNum = 0;//TryParse 输出参数 string asseNum = txt_AsseNum.Text.Trim(); if (!Int32.TryParse(asseNum, out errorNum) || int.Parse(asseNum) == 0) { MessageBox.Show("组批支数只能是整数!"); return; } if (int.Parse(asseNum) > allowGrdNum) { MessageBox.Show("组批支数不能大于钢坯库存支数!"); return; } Mod_TRC_COGDOWN_MAIN model = new Mod_TRC_COGDOWN_MAIN(); model.C_ID = bll_TRC_COGDOWN_MAIN.CreateID(); model.C_STOVE = this.gv_KDZGZ.GetRowCellValue(selectedAllowGrd, "C_STOVE").ToString(); model.C_BATCH_NO = this.txt_BranchNo.Text; model.C_PLAN_ID = planID; model.C_STL_GRD_SLAB = grd; model.C_SPEC_SLAB = spec; model.N_QUA_TOTAL = decimal.Parse(asseNum); model.N_WGT_TOTAL = wgt * model.N_QUA_TOTAL; model.C_EMP_ID = UserInfo.UserID; model.C_STL_GRD = planGrd; model.C_SPEC = planSpec; model.C_STD_CODE = planStd; model.C_MAT_SLAB_CODE = matCode; model.C_MAT_SLAB_NAME = matName; if (!string.IsNullOrWhiteSpace(remark)) { model.C_REMARK = this.txt_Remark.Text += "|" + remark; } model.C_GROUP = this.cbo_Group.EditValue.ToString(); model.C_SHIFT = this.cbo_Shift.EditValue.ToString(); model.C_STA_ID = staID; model.N_QUA_TOTAL_VIRTUAL = model.N_QUA_TOTAL; model.N_WGT_TOTAL_VIRTUAL = model.N_WGT_TOTAL; string result = bll_TRC_COGDOWN_MAIN.AssemblyHandler(model, grd, std, slbwhCode, Application.StartupPath); if (result == "1") { btn_AssePlanQuery_Click(null, null); Query3(); MessageBox.Show("操作成功!"); //生成批号 this.txt_BranchNo.Text = bll_TRC_COGDOWN_MAIN.CreateBranchNo(staID); } else { MessageBox.Show("操作失败!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_Fk_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, slbwhCode + "入库", "入库", "入库");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认入库吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } DataRow dr = gv_Fk.GetDataRow(gv_Fk.FocusedRowHandle); if (dr == null) { MessageBox.Show("请选择需要入库的数据!"); return; } if (string.IsNullOrEmpty(this.image_Store.Text)) { MessageBox.Show("请选择仓库!"); return; } if (string.IsNullOrEmpty(icbo_Shift.Text)) { MessageBox.Show("请选择班次!"); return; } if (string.IsNullOrEmpty(icbo_Group.Text)) { MessageBox.Show("请选择班组!"); return; } string store = this.image_Store.EditValue.ToString(); //仓库 string area = this.image_Area.EditValue == null ? "" : this.image_Area.EditValue.ToString(); //区域 string kw = this.image_Loc.EditValue == null ? "" : this.image_Loc.EditValue.ToString(); //库位 string floor = strStoveNum; //层 string shift = this.icbo_Shift.EditValue.ToString(); //班次 string group = this.icbo_Group.EditValue.ToString(); //班组 string remark = this.txt_Remark.Text; DateTime start = this.dt_Fk_Start.DateTime; DateTime end = this.dt_Fk_End.DateTime; string empID = RV.UI.UserInfo.userID; DateTime ccmData = DateTime.Now; int errorNum = 0;//TryParse 输出参数 string allotNum = dr["N_QUA"].ToString(); if (!Int32.TryParse(allotNum, out errorNum)) { MessageBox.Show("调拨支数只能是整数!"); return; } if (Convert.ToInt32(allotNum) > Convert.ToInt32(dr["N_QUA"].ToString())) { MessageBox.Show("调拨支数不能超过可调拨钢坯总数!"); return; } string result = bll_TRC_COGDOWN_MAIN.CogDownFkHandler(dr, int.Parse(allotNum), store, shift, group, staID, start, end, empID, ccmData, area, kw, floor, remark); if (result == "1") { BindSlabList(); BindToSlabList(); MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } }
private void btn_Confirm_Click(object sender, EventArgs e) { string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, this.Name + "确认修磨", "确认修磨", "确认修磨");//添加操作日志 if (DialogResult.No == MessageBox.Show("确认修磨吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int selectedPlanHandle = this.gv_XMJH.FocusedRowHandle;//获取计划焦点行索引 if (selectedPlanHandle < 0) { MessageBox.Show("请检查修磨计划,记录为空!"); return; } string id = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "C_ID").ToString(); //获取焦点主键 string num = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "N_QUA").ToString(); //获取焦点支数 string batchNo = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, "C_BATCH_NO").ToString(); //获取焦点批次号 string xmbz = img_RegroundStandard.Text; //修磨表标准 string factNum = txt_Num.Text; //支数 string sta = image_Sta.EditValue == null ? "" : image_Sta.EditValue.ToString(); //工位 string remark = txt_Remark.Text; //备注 string emp = txt_EMP.Text; //修磨人 string hg = ""; //txt_HG.Text;//货管 string grinWheel = cbo_GrinWheel.Text; //砂轮 string group = this.cbo_Group.EditValue.ToString(); //班组 string shift = this.cbo_Shift.EditValue.ToString(); //班次 DateTime operation = this.dt_operation.DateTime; int errorNum = 0;//TryParse 输出参数 if (!Int32.TryParse(factNum, out errorNum)) { MessageBox.Show("修磨支数只能是整数!"); return; } if (Convert.ToInt32(factNum) > Convert.ToInt32(num)) { MessageBox.Show("修磨支数不能大于库存支数!"); return; } if (string.IsNullOrWhiteSpace(grinWheel)) { MessageBox.Show("请选砂轮!"); return; } if (string.IsNullOrWhiteSpace(xmbz)) { MessageBox.Show("请选择修磨标准!"); return; } string columnName = ""; if (area == "1") { columnName = General.NameType[xmbz]; } else { columnName = General.NameTypes[xmbz]; } string xmbzNum = this.gv_XMJH.GetRowCellValue(selectedPlanHandle, columnName).ToString();//获取焦点修磨标准支数 int reaultNum = int.Parse(xmbzNum) + int.Parse(factNum); if (reaultNum > int.Parse(num)) { MessageBox.Show("修磨支数大于工序最大支数!"); return; } string result = bll_TRC_PLAN_REGROUND.RegroundConfirm(id, num, factNum, xmbz, sta, remark, emp, hg, batchNo, "合格", "临时", slbwhCode, grinWheel , group, shift, operation, area); if (result == "1") { BindXMPlanData(); BindHandlerData(id); MessageBox.Show("操作成功!"); } else { MessageBox.Show("操作失败!"); } RefreshControls(); }