private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "") { this.textBox1.Focus(); return; } string workno = this.textBox1.Text.Trim(); woInfo = queryB.queryWoInfoByWo(workno.ToUpper()); if (woInfo != null) { this.textBox4.Text = woInfo.WoQty; this.textBox8.Text = woInfo.DelMatno; this.textBox5.Text = woInfo.DeptId; this.textBox7.Text = woInfo.DeptCode; this.textBox2.Text = woInfo.ModelNo; this.textBox6.Text = woInfo.ClassCode; this.textBox11.Text = woInfo.CompletionSub; this.textBox12.Text = woInfo.DelMatnoDesc; filePath = modelInfoService.previewModelFile("F042"); if (filePath == null) { MessageBox.Show("未找到對應的打印模板信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } }
private void button1_Click(object sender, EventArgs e) { if (this.dataGridView1.CurrentRow == null) { MessageBox.Show("請選中需要质检的单号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Focus(); return; } int index = this.dataGridView1.CurrentRow.Index; string qualityNo = this.dataGridView1.Rows[index].Cells["QualiatyNo"].Value.ToString(); QualityInfo qualityInfo = qualityInfos[index]; qualityInfo.Status = "2"; if (qualityInfoService.updateEndQualityInfo(qualityInfo)) { WoInfo woInfo = woInfoService.queryWoInfoByNo(qualityInfo.WoNo); woInfo.Status = "2"; woInfo.CheckTimes = woInfo.CheckTimes + 1; if (woInfoService.updateWoInfoStatusAndTimes(woInfo)) { this.qualityInfos.RemoveAt(this.dataGridView1.SelectedRows[0].Index); this.dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index); } } else { MessageBox.Show("质检结果更新失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 根據质检编号查詢质检信息 /// </summary> /// <param name="cartonNo"></param> /// <returns></returns> public WoInfo queryWoInfoByNo(string woNo) { WoInfo woInfo = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT uuid,woNo,delMatno,woQty,deptId,deptCode,classCode,completionSub,modelNo,delMatnoDesc,status,checkTimes,op_user,create_time FROM t_woInfo where woNo=@woNo and del_flag is null"); MySqlParameter[] parameters = { new MySqlParameter("@woNo", MySqlDbType.VarChar, 900) }; parameters[0].Value = woNo; DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { woInfo = new WoInfo(); woInfo.Uuid = ds.Tables[0].Rows[0]["uuid"].ToString(); woInfo.WoNo = ds.Tables[0].Rows[0]["woNo"].ToString(); woInfo.DelMatno = ds.Tables[0].Rows[0]["delMatno"].ToString(); woInfo.WoQty = ds.Tables[0].Rows[0]["woQty"].ToString(); woInfo.DeptId = ds.Tables[0].Rows[0]["deptId"].ToString(); woInfo.DeptCode = ds.Tables[0].Rows[0]["deptCode"].ToString(); woInfo.ClassCode = ds.Tables[0].Rows[0]["classCode"].ToString(); woInfo.CompletionSub = ds.Tables[0].Rows[0]["completionSub"].ToString(); woInfo.ModelNo = ds.Tables[0].Rows[0]["modelNo"].ToString(); woInfo.DelMatnoDesc = ds.Tables[0].Rows[0]["delMatnoDesc"].ToString(); woInfo.Status = ds.Tables[0].Rows[0]["status"].ToString(); woInfo.CheckTimes = (int)ds.Tables[0].Rows[0]["checkTimes"]; woInfo.Opuser = ds.Tables[0].Rows[0]["op_user"].ToString(); woInfo.Createtime = ds.Tables[0].Rows[0]["create_time"].ToString(); } return(woInfo); }
/// <summary> /// 更新工单状态及检验次数 /// </summary> /// <param name="qualityInfo"></param> /// <returns></returns> public bool updateWoInfoStatusAndTimes(WoInfo woInfo) { bool saveMark = true; StringBuilder strSql = new StringBuilder(); strSql.Append("update t_woInfo set status=@status,checkTimes=@checkTimes,update_user=@updateUser,update_time=@updateTime where woNo=@woNo"); MySqlParameter[] parameters = { new MySqlParameter("@status", MySqlDbType.VarChar, 900), new MySqlParameter("@updateUser", MySqlDbType.VarChar, 900), new MySqlParameter("@updateTime", MySqlDbType.VarChar, 900), new MySqlParameter("@woNo", MySqlDbType.VarChar, 900), new MySqlParameter("@checkTimes", MySqlDbType.Int16, 900), }; parameters[0].Value = woInfo.Status; parameters[1].Value = woInfo.Updateser; parameters[2].Value = woInfo.Updatetime; parameters[3].Value = woInfo.WoNo; parameters[4].Value = woInfo.CheckTimes; int rows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters); if (rows > 0) { saveMark = true; } else { saveMark = false; } return(saveMark); }
/// <summary> /// 查詢ERP 已核發訂單 /// </summary> /// <param name="woNo"></param> /// <returns></returns> public WoInfo queryWoInfoByWo(string woNo) { WoInfo woInfo = null; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT a.WIP_ENTITY_NAME,d.SEGMENT1,B.START_QUANTITY,wo.DEPARTMENT_ID,wo.DEPARTMENT_CODE,b.CLASS_CODE,b.COMPLETION_SUBINVENTORY,d.ATTRIBUTE7,d.DESCRIPTION NDESCRIPTION FROM wip.wip_entities a,WIP_OPERATIONS_V wo,wip.wip_discrete_jobs b,inv.mtl_system_items_b d WHERE a.WIP_ENTITY_ID = b.WIP_ENTITY_ID AND a.WIP_ENTITY_ID = wo.WIP_ENTITY_ID AND a.ORGANIZATION_ID = wo.ORGANIZATION_ID AND a.PRIMARY_ITEM_ID = d.INVENTORY_ITEM_ID AND a.ORGANIZATION_ID = d.ORGANIZATION_ID AND trim(a.Wip_Entity_Name) =:woNo"); // AND B.STATUS_TYPE IN (3, 4) OracleParameter[] parameters = { new OracleParameter(":woNo", OracleDbType.Varchar2, 900) }; parameters[0].Value = woNo; DataSet ds = OracleSQLHelper.ExecuteDataset(OracleSQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { woInfo = new WoInfo(); woInfo.WoNo = ds.Tables[0].Rows[0]["WIP_ENTITY_NAME"].ToString(); woInfo.DelMatno = ds.Tables[0].Rows[0]["SEGMENT1"].ToString(); woInfo.WoQty = ds.Tables[0].Rows[0]["START_QUANTITY"].ToString(); woInfo.DeptId = ds.Tables[0].Rows[0]["DEPARTMENT_ID"].ToString(); woInfo.DeptCode = ds.Tables[0].Rows[0]["DEPARTMENT_CODE"].ToString(); woInfo.ClassCode = ds.Tables[0].Rows[0]["CLASS_CODE"].ToString(); woInfo.CompletionSub = ds.Tables[0].Rows[0]["COMPLETION_SUBINVENTORY"].ToString(); woInfo.ModelNo = ds.Tables[0].Rows[0]["ATTRIBUTE7"].ToString(); woInfo.DelMatnoDesc = ds.Tables[0].Rows[0]["NDESCRIPTION"].ToString(); } return(woInfo); }
/// <summary> /// 保存工单信息 /// </summary> /// <param name="woInfo"></param> /// <returns></returns> public bool saveWoInfo(WoInfo woInfo) { woInfo.Uuid = Auxiliary.Get_UUID(); woInfo.Createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); woInfo.Opuser = Auxiliary.loginName; woInfo.Status = "0"; woInfo.CheckTimes = 0; return(woInfoDao.saveWoInfo(woInfo)); }
private void clearAll() { this.textBox1.Text = ""; this.textBox4.Text = ""; this.textBox8.Text = ""; this.textBox5.Text = ""; this.textBox7.Text = ""; this.textBox2.Text = ""; this.textBox6.Text = ""; this.textBox11.Text = ""; this.textBox12.Text = ""; this.textBox3.Text = ""; woInfo = null; }
/// <summary> /// TODO 保存质检工单信息 /// </summary> /// <param name="carton"></param> /// <returns></returns> public bool saveWoInfo(WoInfo woInfo) { bool saveMark = true; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into t_woInfo (uuid,woNo,delMatno,woQty,deptId,deptCode,classCode,completionSub,modelNo,delMatnoDesc,status,op_user,create_time,checkTimes)"); strSql.Append("values(@uuid,@woNo,@delMatno,@woQty,@deptId,@deptCode,@classCode,@completionSub,@modelNo,@delMatnoDesc,@status,@opuser,@createtime,@checkTimes)"); MySqlParameter[] parameters = { new MySqlParameter("@uuid", MySqlDbType.VarChar, 900), new MySqlParameter("@woNo", MySqlDbType.VarChar, 900), new MySqlParameter("@delMatno", MySqlDbType.VarChar, 900), new MySqlParameter("@woQty", MySqlDbType.VarChar, 900), new MySqlParameter("@deptId", MySqlDbType.VarChar, 900), new MySqlParameter("@deptCode", MySqlDbType.VarChar, 900), new MySqlParameter("@classCode", MySqlDbType.VarChar, 900), new MySqlParameter("@completionSub", MySqlDbType.VarChar, 900), new MySqlParameter("@modelNo", MySqlDbType.VarChar, 900), new MySqlParameter("@delMatnoDesc", MySqlDbType.VarChar, 900), new MySqlParameter("@status", MySqlDbType.VarChar, 900), new MySqlParameter("@opuser", MySqlDbType.VarChar, 900), new MySqlParameter("@createtime", MySqlDbType.VarChar, 900), new MySqlParameter("@checkTimes", MySqlDbType.Int16, 900) }; parameters[0].Value = woInfo.Uuid; parameters[1].Value = woInfo.WoNo; parameters[2].Value = woInfo.DelMatno; parameters[3].Value = woInfo.WoQty; parameters[4].Value = woInfo.DeptId; parameters[5].Value = woInfo.DeptCode; parameters[6].Value = woInfo.ClassCode; parameters[7].Value = woInfo.CompletionSub; parameters[8].Value = woInfo.ModelNo; parameters[9].Value = woInfo.DelMatnoDesc; parameters[10].Value = woInfo.Status; parameters[11].Value = woInfo.Opuser; parameters[12].Value = woInfo.Createtime; parameters[13].Value = woInfo.CheckTimes; int rows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters); if (rows > 0) { saveMark = true; } else { saveMark = false; } return(saveMark); }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "") { this.textBox1.Focus(); return; } QualityInfo qualityInfo = qualityInfoService.queryQualityInfoByNo(this.textBox1.Text.Trim()); if (qualityInfo != null) { switch (qualityInfo.Status) { case "0": QualityInfo updateQualInfo = new QualityInfo(); updateQualInfo.StartTime = DateTime.Now; updateQualInfo.QualiatyNo = qualityInfo.QualiatyNo; updateQualInfo.Status = "1"; QualityInfo reQualityInfo = qualityInfoService.updateStartQualityInfo(updateQualInfo); //更新工单状态 WoInfo updatedWoInfo = new WoInfo(); updatedWoInfo.Status = "1"; updatedWoInfo.WoNo = reQualityInfo.WoNo; woInfoService.updateWoInfoStatus(updatedWoInfo); //更新工单状态. if (!checkRepeat(reQualityInfo.QualiatyNo)) { int index = this.dataGridView1.Rows.Add(); initRow(index, reQualityInfo); } break; case "1": //质检中 if (!checkRepeat(qualityInfo.QualiatyNo)) { int index = this.dataGridView1.Rows.Add(); initRow(index, qualityInfo); } break; case "2": //质检Ok MessageBox.Show("该工单首件质检标签已完成,不能再进行质检操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Text = ""; this.textBox1.Focus(); break; case "3": //质检NG MessageBox.Show("该工单首件质检标签已完成,不能再进行质检操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.textBox1.Text = ""; this.textBox1.Focus(); break; } } else { this.textBox1.Text = ""; this.textBox1.Focus(); return; } } }
public bool updateWoInfoStatus(WoInfo woInfo) { woInfo.Updatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); woInfo.Updateser = Auxiliary.loginName; return(woInfoDao.updateWoInfoStatus(woInfo)); }