private void button1_Click(object sender, EventArgs e) { string newitemcode = txtItemCode.Text; string newvendorcode1 = txtVendorCode.Text; string newitemsn1 = txtBatchCode.Text; string barcode1 = newBarcode;// newitemcode + "^" + newvendorcode1 + "^" + newitemsn1; dataConn.ExeSql("insert into data_sn_bom_log select rmes_id,sn,t.company_code,t.plan_code,t.pline_code,t.location_code,t.process_code,t.process_seq,t.item_code,t.item_name,'" + newitemsn1 + "',t.item_qty,t.item_class,t.item_type,'" + newvendorcode1 + "',t.complete_qty,t.confirm_flag,sysdate,t.create_userid,t.replace_flag,t.station_code,t.station_name,'" + barcode1 + "','" + LoginInfo.UserInfo.USER_CODE + "'||'新增批次' from data_sn_bom_temp t where rmes_id='" + BomRmesID + "'"); dataConnVb dcVb = new dataConnVb(); if (Type2 == "B") { dataConn.ExeSql("insert into data_sn_bom_itembatch(rmes_id,bom_rmes_id,item_sn,barcode,item_vendor) values(seq_rmes_id.nextval,'" + BomRmesID + "','" + newitemsn1 + "','" + barcode1 + "','" + newvendorcode1 + "') "); try { dcVb.ExeSql("update sjsmljb set GYSDM='" + newvendorcode1 + "', LJLSH='" + newitemsn1 + "',GZRQ=TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD'),rqsj=sysdate, BCMC='" + LoginInfo.ShiftInfo.SHIFT_NAME + "', BZMC='" + LoginInfo.TeamInfo.TEAM_NAME + "', YGMC='" + LoginInfo.UserInfo.USER_NAME + "', BARCODE='" + barcode1 + "' where ghtm='" + ProductSn + "' and gzdd='" + PlineCode + "' and ljdm='" + newitemcode + "' and zdmc='" + LoginInfo.StationInfo.STATION_NAME + "' "); } catch { } } dcVb.CloseConn(); string gcXlh1 = dataConn.GetValue("select product_series from data_product where sn='" + ProductSn + "' and rownum=1"); string gcSaveData1 = ProductSn + ";" + "0" + ";" + "AB类零件防错" + ";" + newitemcode + "^" + newvendorcode1 + "^" + newitemsn1 + ";" + " " + ";" + LoginInfo.StationInfo.STATION_NAME + ";" + " " + ";" + PlineCode + ";" + gcXlh1 + ";" + "AB"; PublicClass.Output_DayData(LoginInfo.StationInfo.STATION_NAME, ProductSn, "sjclb", gcSaveData1); (Parent as frmBomItemEdit).Close(); }
private void btnOK_Click(object sender, EventArgs e) { if (lstSn.SelectedItems.Count != 1) { MessageBox.Show("请选择要替换的零件", "提示"); return; } string oldsn = ""; try { oldsn = lstSn.SelectedItem.ToString(); } catch { } if (oldsn == "") { MessageBox.Show("请选择要替换的零件", "提示"); return; } DialogResult drt = MessageBox.Show("确认替换?", "提示", MessageBoxButtons.YesNo); if (drt == DialogResult.No) { return; } //替换旧的数据 string[] msgbody = oldsn.Split('^'); string itemcode1 = msgbody[0]; string vendorcode1 = msgbody[1]; string itemsn1 = msgbody[2]; string newitemcode = txtItemCode.Text; string newvendorcode1 = txtVendorCode.Text; string newitemsn1 = txtBatchCode.Text; string barcode1 = newBarcode;// newitemcode + "^" + newvendorcode1 + "^" + newitemsn1; dataConn.ExeSql("insert into data_sn_bom_log select rmes_id,sn,t.company_code,t.plan_code,t.pline_code,t.location_code,t.process_code,t.process_seq,t.item_code,t.item_name,'" + itemsn1 + "',t.item_qty,t.item_class,t.item_type,'" + vendorcode1 + "',t.complete_qty,t.confirm_flag,sysdate,t.create_userid,t.replace_flag,t.station_code,t.station_name,'" + barcode1 + "','" + LoginInfo.UserInfo.USER_CODE + "'||'替换' from data_sn_bom_temp t where rmes_id='" + BomRmesID + "'"); dataConnVb dcVb = new dataConnVb(); if (Type2 == "A" || Type2 == "D") { dataConn.ExeSql("update data_sn_bom_itemsn set item_sn='" + newitemsn1 + "' , item_vendor='" + newvendorcode1 + "' ,barcode='" + barcode1 + "', work_time=sysdate where bom_rmes_id='" + BomRmesID + "' and item_sn='" + itemsn1 + "' and item_vendor='" + vendorcode1 + "' "); try { dcVb.ExeSql("update sjsmljb set GYSDM='" + newvendorcode1 + "', LJLSH='" + newitemsn1 + "',GZRQ=TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD'),rqsj=sysdate, BCMC='" + LoginInfo.ShiftInfo.SHIFT_NAME + "', BZMC='" + LoginInfo.TeamInfo.TEAM_NAME + "', YGMC='" + LoginInfo.UserInfo.USER_NAME + "', BARCODE='" + barcode1 + "' where ghtm='" + ProductSn + "' and gzdd='" + PlineCode + "' and ljdm='" + newitemcode + "' and zdmc='" + LoginInfo.StationInfo.STATION_NAME + "' "); } catch { } } else if (Type2 == "B") { dataConn.ExeSql("update DATA_SN_BOM_ITEMBATCH set item_sn='" + newitemsn1 + "' , item_vendor='" + newvendorcode1 + "' ,barcode='" + barcode1 + "', work_time=sysdate where bom_rmes_id='" + BomRmesID + "' and item_sn='" + itemsn1 + "' and item_vendor='" + vendorcode1 + "' "); try { dcVb.ExeSql("update sjsmljb set GYSDM='" + newvendorcode1 + "', LJLSH='" + newitemsn1 + "',GZRQ=TO_DATE(TO_CHAR(SYSDATE,'YYYY-MM-DD'),'YYYY-MM-DD'),rqsj=sysdate, BCMC='" + LoginInfo.ShiftInfo.SHIFT_NAME + "', BZMC='" + LoginInfo.TeamInfo.TEAM_NAME + "', YGMC='" + LoginInfo.UserInfo.USER_NAME + "', BARCODE='" + barcode1 + "' where ghtm='" + ProductSn + "' and gzdd='" + PlineCode + "' and ljdm='" + newitemcode + "' and zdmc='" + LoginInfo.StationInfo.STATION_NAME + "' "); } catch { } } dcVb.CloseConn(); string gcXlh1 = dataConn.GetValue("select product_series from data_product where sn='" + ProductSn + "' and rownum=1"); string gcSaveData1 = ProductSn + ";" + "0" + ";" + "AB类零件防错" + ";" + newitemcode + "^" + newvendorcode1 + "^" + newitemsn1 + ";" + " " + ";" + LoginInfo.StationInfo.STATION_NAME + ";" + " " + ";" + PlineCode + ";" + gcXlh1 + ";" + "AB"; PublicClass.Output_DayData(LoginInfo.StationInfo.STATION_NAME, ProductSn, "sjclb", gcSaveData1); //if (ConfirmBomItem()) //{ // RMESEventArgs thisEventArg = new RMESEventArgs(); // thisEventArg.MessageHead = "BOM"; // thisEventArg.MessageBody = ProductSn; // SendDataChangeMessage(thisEventArg); // (Parent as frmBomItemEdit).Close(); //} (Parent as frmBomItemEdit).Close(); }