private void button12_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string aa = null; string d1 = SJ1.Value.ToString("yyyy-MM-dd 00:00:00"); string d2 = SJ2.Value.ToString("yyyy-MM-dd 23:59:59"); aa = "select c.pkunid as 跟踪表单号,c.sku_desc as 品名规格,c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,t.therm_id as 温度计编号,t.BACK_TIME as 温度计返回时间,t.FILE_PATH as 温度跟踪记录文件路径,t.PACK_MEMO as 温度计包装备注,t.TEMP_MEMO as 温度计温度备注,t.IF_BAD 温度计是否损坏 " + "from cc_cold_chain_c c left join cc_cold_chain_therm t on c.unid=t.pkunid " + "where c.pkunid like '%" + gzbdhrg.Text + "%' and c.create_date_time between (to_date('" + d1 + "','yyyy-mm-dd hh24:mi:ss')) " + "and (to_date('" + d2 + "','yyyy-mm-dd hh24:mi:ss')) order by c.size_desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(aa, cn); DataTable table = new DataTable(); adapater.Fill(table); if (table.Rows.Count == 0) { MessageBox.Show("查询不到记录"); return; } CommFunction.LYData2Excel(this.Handle, CommFunction.ConnectString, aa, ""); }
private void 修改ToolStripMenuItem_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } FrmEditItem.falg = "Edit"; FrmEditItem.pSku_id = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString(); FrmEditItem.pHz = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Value.ToString(); FrmEditItem.pSpdm = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString(); FrmEditItem.pPmgg = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value.ToString(); FrmEditItem.pSccj = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[5].Value.ToString(); FrmEditItem.pLlbs = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[4].Value.ToString(); FrmEditItem.pCctj = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[6].Value.ToString(); FrmEditItem.pJzs = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[11].Value.ToString(); FrmEditItem.pWdj = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[7].Value.ToString(); FrmEditItem.pBzlxZ = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[12].Value.ToString(); FrmEditItem.pBzlxL = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[13].Value.ToString(); FrmEditItem.pRpt = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[14].Value.ToString(); FrmEditItem.ShowUniqueForm(true); if (FrmEditItem.ifSave) { OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void 修改ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } if (dataGridView2.Rows.Count <= 0) { return; } FrmEditVendor.falg = "Edit"; FrmEditVendor.pUnid = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["unid"].Value.ToString(); FrmEditVendor.pCk = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["仓库"].Value.ToString(); FrmEditVendor.pHz = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["货主"].Value.ToString(); FrmEditVendor.pHzkhdm = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["货主客户代码"].Value.ToString(); FrmEditVendor.pFwdj = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["是否附温度计"].Value.ToString(); FrmEditVendor.pTh = dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells["温度计类型"].Value.ToString(); FrmEditVendor.ShowUniqueForm(true); if (FrmEditVendor.ifSave) { string sql = "select unid,misc_instr_code_2 货主客户代码,whse 仓库,season 货主,ifthermometer 是否附温度计,therm_type 温度计类型 " + "from cc_vendor_track where misc_instr_code_2='" + dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["货主客户代码"].Value.ToString() + "'"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView2.DataSource = ds.Tables["chk_con2"]; dataGridView2.AutoResizeColumns(); } }
private void 新增ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } if (dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[4].Value.ToString() != "冷链") { MessageBox.Show("非冷链品种,请核对!"); return; } FrmItemTrack.falg = "Add"; FrmItemTrack.pSpdm = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString(); FrmItemTrack.ShowUniqueForm(true); if (FrmItemTrack.ifSave) { string sql = "select unid,size_desc 商品代码,whse 仓库,season 货主,shipto 客户,ifthermometer 是否附温度计,create_date_time 时间,user_name 操作人 " + "from cc_item_track where 1=1 and size_desc in (" + FrmItemTrack.ResultSpdm + "')"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView2.DataSource = ds.Tables["chk_con2"]; dataGridView2.AutoResizeColumns(); } }
private void 除ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView2.Rows.Count <= 0) { return; } if (MessageBox.Show("确定要删除该条记录吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_item_track where unid='" + dataGridView2.Rows[dataGridView2.CurrentCell.RowIndex].Cells[0].Value.ToString() + "'", CommFunction.ConnectString); MessageBox.Show("删除成功!"); string sql = "select unid,size_desc 商品代码,whse 仓库,season 货主,shipto 客户,ifthermometer 是否附温度计,create_date_time 时间,user_name 操作人 " + "from cc_item_track where size_desc='" + dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString() + "'"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView2.DataSource = ds.Tables["chk_con2"]; dataGridView2.AutoResizeColumns(); }
private void toolStripButton1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } ResultSelect = ""; string sql = "select type as 类型,ysid as 代码,ysfs as 名称,pym as 拼音码,memo as 备注,reserve1 as 保留字段1,reserve2 as 保留字段2,reserve3 as 保留字段3," + "reserve4 as 保留字段4,reserve5 as 保留字段5,reserve6 as 保留字段6,reserve7 as 保留字段7,reserve8 as 保留字段8," + "reserve9 as 保留字段9,reserve10 as 保留字段10,create_date_time as 创建时间,user_name as 操作员,flag as 是否停用 " + "from ysfs order by type,ysid "; if (CommFunction.ShowQueryForm(this.Handle, CommFunction.ConnectString, sql, 3, ref ResultSelect) == false) { return; } OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); }
private void 修改ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } FrmEditIceMaster.falg = "Edit"; FrmEditIceMaster.pSpdm = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["商品代码"].Value.ToString(); FrmEditIceMaster.pPm = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["品名"].Value.ToString(); FrmEditIceMaster.pGg = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["规格"].Value.ToString(); FrmEditIceMaster.pLx = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["类型"].Value.ToString(); FrmEditIceMaster.pDw = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["单位"].Value.ToString(); FrmEditIceMaster.pSxsj = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["失效时间"].Value.ToString(); FrmEditIceMaster.pSexsj = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["生效时间"].Value.ToString(); FrmEditIceMaster.pCctj = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["存储条件"].Value.ToString(); FrmEditIceMaster.pSsgs = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["所属公司"].Value.ToString(); FrmEditIceMaster.ShowUniqueForm(true); if (FrmEditIceMaster.ifSave) { OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void 除ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } if (MessageBox.Show("确定要删除该条记录吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } LYFunctionCs.LYFunctionCsClass.cmd("delete from locn_master where LOCN_BRCD='" + dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["库位代码"].Value.ToString() + "'", CommFunction.ConnectString); MessageBox.Show("删除成功!"); OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); }
private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } if (MessageBox.Show("确定要删除该条记录吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_item_master where sku_id='" + dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString() + "'", CommFunction.ConnectString); string pNum = LYFunctionCs.LYFunctionCsClass.cmdScalar("select count(1) from cc_item_master c where c.size_desc='" + dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString() + "' and c.cc_flag='冷链' ", CommFunction.ConnectString); if (int.Parse(pNum) <= 0) { LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_item_track where size_desc='" + dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString() + "'", CommFunction.ConnectString); } MessageBox.Show("删除成功!"); OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); }
private void 综合查询ToolStripMenuItem_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } FrmColdQurey.ShowUniqueForm(true); }
private void toolStripButton3_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } CommFunction.LYData2Excel(this.Handle, CommFunction.ConnectString, ResultSelect, ""); }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } 修改ToolStripMenuItem_Click(null, null); }
private void toolStripButton2_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } button1_Click(null, null); }
private void 编辑ToolStripMenuItem_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } if (dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["是否需附温度计"].Value.ToString() == "附温度计") { FrmPack.Ifwdj = true; } else { FrmPack.Ifwdj = false; } FrmPack.pWdjgs = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["温度计所属公司"].Value.ToString(); FrmPack.pName = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["包装类型"].Value.ToString(); FrmPack.pLx = bzlx(FrmPack.pName); FrmPack.pBzts = cd[dataGridView1.CurrentCell.RowIndex].pBzts; FrmPack.pBzjs = cd[dataGridView1.CurrentCell.RowIndex].pBzjs; FrmPack.pWdj = cd[dataGridView1.CurrentCell.RowIndex].pWdj; if (cd[dataGridView1.CurrentCell.RowIndex].bd != null) { FrmPack.pBd = new FrmPack.Bp_dtl[cd[dataGridView1.CurrentCell.RowIndex].bd.Length];//恶心调用 木有办法 for (int ii = 0; ii < cd[dataGridView1.CurrentCell.RowIndex].bd.Length; ii++) { FrmPack.pBd[ii].pIce_Id = cd[dataGridView1.CurrentCell.RowIndex].bd[ii].pIce_Id; FrmPack.pBd[ii].pIce_Name = cd[dataGridView1.CurrentCell.RowIndex].bd[ii].pIce_Name; FrmPack.pBd[ii].pIce_Qty = cd[dataGridView1.CurrentCell.RowIndex].bd[ii].pIce_Qty; } } else if (cd[dataGridView1.CurrentCell.RowIndex].bd == null) { FrmPack.pBd = null; } //防止查询跟踪单赋值的时候 listview没有清除 FrmPack.ShowUniqueForm(true); if (FrmPack.Ifsave) { cd[dataGridView1.CurrentCell.RowIndex].pBzts = FrmPack.pBzts; cd[dataGridView1.CurrentCell.RowIndex].pBzjs = FrmPack.pBzjs; cd[dataGridView1.CurrentCell.RowIndex].pWdj = FrmPack.pWdj; if (FrmPack.pBd != null) { cd[dataGridView1.CurrentCell.RowIndex].bd = new Bp_dtl[FrmPack.pBd.Length]; for (int i = 0; i < FrmPack.pBd.Length; i++) { cd[dataGridView1.CurrentCell.RowIndex].bd[i].pIce_Id = FrmPack.pBd[i].pIce_Id; cd[dataGridView1.CurrentCell.RowIndex].bd[i].pIce_Name = FrmPack.pBd[i].pIce_Name; cd[dataGridView1.CurrentCell.RowIndex].bd[i].pIce_Qty = FrmPack.pBd[i].pIce_Qty; } } } }
private void button2_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if ((tbGzbd.Text == "") || (tbShsj.Text.Trim() == "") || (tbShsj2.Text.Trim() == ""))//不校验收货时间 { MessageBox.Show("请输完基本信息"); } else { OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string ff = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string gg = dtpShri.Value.ToString("yyyy-MM-dd"); gg = gg + " "; gg = gg + tbShsj.Text; gg = gg + ":"; gg = gg + tbShsj2.Text; gg = gg + ":00"; string SqlSeach = "update CC_COLD_CHAIN_Z set SIGN_TEMP_ENVI='" + tbHjwd.Text + "',SIGN_TEMP_DRUGS='" + tbYpwd.Text + "',SIGN_DATE_TIME=to_date('" + gg + "','yyyy-mm-dd hh24:mi:ss'),USER_SIGN='" + tbShr.Text + "',SIGN_MEMO='" + tbBz.Text + "' WHERE UNID='" + tbGzbd.Text + "'"; OleDbCommand command1 = new OleDbCommand(SqlSeach, cn); command1.ExecuteNonQuery(); tbGzbd.Text = null; tbHjwd.Text = null; tbYpwd.Text = null; dtpShri.Text = null; tbShsj.Text = null; tbShsj2.Text = null; tbShr.Text = null; tbBz.Text = null; //SqlSeach = "select z.unid as 跟踪表单号,c.assort_nbr as 发货单号,c.sku_desc as 品名规格," + // "c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,c.units as 单位,z.season as 货主," + // "z.shipto_name as 客户名称,z.create_date_time as 发货时间,z.user_name as 发货人,z.cur_temp_src as 发货天气温度 " + // "from CC_COLD_CHAIN_Z z " + // "left join CC_COLD_CHAIN_C c on z.unid=c.pkunid " + // "where z.unid like '%" + tbGzbd.Text + "%' and z.check_date_time is not null and z.sign_date_time is null " + // "order by z.create_date_time desc "; //要求不复核也可以确认收货 SqlSeach = "select z.unid as 跟踪表单号,c.assort_nbr as 发货单号,c.sku_desc as 品名规格," + "c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,c.units as 单位,z.season as 货主," + "z.shipto_name as 客户名称,z.create_date_time as 发货时间,z.user_name as 发货人,z.cur_temp_src as 发货天气温度 " + "from CC_COLD_CHAIN_Z z " + "left join CC_COLD_CHAIN_C c on z.unid=c.pkunid " + "where z.unid like '%" + tbGzbd.Text + "%' and z.sign_date_time is null " + "order by z.create_date_time desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(SqlSeach, cn); DataTable table = new DataTable(); adapater.Fill(table); dataGridView1.DataSource = table.DefaultView; dataGridView1.AutoResizeColumns(); } }
private void button3_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if ((tbGzbdh.Text.Trim() == "") || tbGzbdh.Text == null) { return; } LYFunctionCs.frmReportView frv = new LYFunctionCs.frmReportView(); ReportDocument Rpt = new ReportDocument(); string pRptNmae = ""; pRptNmae = LYFunctionCs.LYFunctionCsClass.cmdScalar("select cm.report_file from cc_cold_chain_c cc left join cc_cold_chain_z cz on cc.pkunid=cz.unid left join cc_item_master cm on cc.size_desc=cm.size_desc and cm.season=cz.season where pkunid='" + tbGzbdh.Text + "' and cm.report_file is not null and rownum=1 ", CommFunction.ConnectString); if ((pRptNmae.Trim() == "") || (pRptNmae == null)) { pRptNmae = "Rep_CC_ITEM_TRACK.rpt"; } Rpt.Load(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + pRptNmae); TableLogOnInfo logOnInfo = new TableLogOnInfo(); logOnInfo.ConnectionInfo.ServerName = CommFunction.cfServerName; logOnInfo.ConnectionInfo.UserID = CommFunction.cfUserID; logOnInfo.ConnectionInfo.Password = CommFunction.cfPassword; Rpt.Database.Tables[0].ApplyLogOnInfo(logOnInfo); //Rpt.Refresh(); frv.crystalReportViewer1.ReportSource = Rpt; CrystalDecisions.Shared.ParameterValues mypaVal = new CrystalDecisions.Shared.ParameterValues(); CrystalDecisions.Shared.ParameterDiscreteValue mypaDVal = new CrystalDecisions.Shared.ParameterDiscreteValue(); mypaDVal.Value = tbGzbdh.Text; mypaVal.Add(mypaDVal); Rpt.DataDefinition.ParameterFields["GZBDH"].ApplyCurrentValues(mypaVal); frv.ShowDialog(); }
private void toolStripButton6_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } string sql = "select type as 类型,ysid as 代码,ysfs as 名称,pym as 拼音码,memo as 备注,reserve1 as 保留字段1,reserve2 as 保留字段2,reserve3 as 保留字段3," + "reserve4 as 保留字段4,reserve5 as 保留字段5,reserve6 as 保留字段6,reserve7 as 保留字段7,reserve8 as 保留字段8," + "reserve9 as 保留字段9,reserve10 as 保留字段10,create_date_time as 创建时间,user_name as 操作员,flag as 是否停用 " + "from ysfs where 1=1 and type like '%" + toolStripComboBox1.Text + "%' order by type,ysid"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); }
private void 新增ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } FrmEditIceLocn.falg = "Add"; FrmEditIceLocn.ShowUniqueForm(true); if (FrmEditIceLocn.ifSave) { string sql = "select LOCN_BRCD 库位代码,STORE_CONDITION 存储条件 from locn_master where LOCN_BRCD in (" + FrmEditIceLocn.ResultKwdm + "') order by LOCN_BRCD"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void 新增ToolStripMenuItem1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } FrmEditIceMaster.falg = "Add"; FrmEditIceMaster.ShowUniqueForm(true); if (FrmEditIceMaster.ifSave) { string sql = "select size_desc 商品代码,sku_desc 品名,sku_format 规格,sku_type 类型, season 所属公司,invalid_time 失效时间,valid_time 生效时间,store_condition 存储条件,sku_unit 单位" + " from ice_master where size_desc in (" + FrmEditIceMaster.ResultSpdm + "') order by size_desc"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void button3_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (tbGzbd.Text == "") { MessageBox.Show("请输完基本信息"); } else { OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string ff = null; string SqlSeach = "update CC_COLD_CHAIN_Z set USER_CHECK='',USER_PACK='',CARR_NAME='',PACK_DATE_TIME=to_date('" + ff + "','yyyy-mm-dd hh24:mi:ss'),USER_CARR='',CARR_DATE_TIME=to_date('" + ff + "','yyyy-mm-dd hh24:mi:ss'), CHECK_DATE_TIME=to_date('" + ff + "','yyyy-mm-dd hh24:mi:ss') WHERE UNID='" + tbGzbd.Text + "'"; OleDbCommand command1 = new OleDbCommand(SqlSeach, cn); command1.ExecuteNonQuery(); tbGzbd.Text = null; SqlSeach = "select z.unid as 跟踪表单号,c.assort_nbr as 发货单号,c.sku_desc as 品名规格," + "c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,c.units as 单位,z.season as 货主," + "z.shipto_name as 客户名称,z.create_date_time as 发货时间,z.user_name as 发货人,z.cur_temp_src as 发货天气温度 " + "from CC_COLD_CHAIN_Z z " + "left join CC_COLD_CHAIN_C c on z.unid=c.pkunid " + "where z.unid like '%" + tbGzbd.Text + "%' and z.check_date_time is null " + "order by z.create_date_time desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(SqlSeach, cn); DataTable table = new DataTable(); adapater.Fill(table); dataGridView1.DataSource = table.DefaultView; dataGridView1.AutoResizeColumns(); } }
private void button2_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (cbWdj.Text == "") { MessageBox.Show("请输完基本信息"); } else { OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string gg = null; string SqlSeach = "update cc_cold_chain_therm ct set FILE_PATH=null, BACK_TIME=to_date('" + gg + "','yyyy-mm-dd hh24:mi:ss') ,PACK_MEMO=null,TEMP_MEMO=null,IF_BAD=null" + " where ct.pkunid in (select unid from cc_cold_chain_c where pkunid='" + tbGzbd.Text + "') and ct.THERM_ID='" + cbWdj.Text + "'"; OleDbCommand command1 = new OleDbCommand(SqlSeach, cn); command1.ExecuteNonQuery(); SqlSeach = "update ysfs set RESERVE1='已发',RESERVE2='正常',MEMO='' where type='温度计字典' and ysid='" + cbWdj.Text + "'"; command1.CommandText = SqlSeach; command1.ExecuteNonQuery(); command1.Dispose(); cn.Close(); cbWdj.Text = null; tbGzbd.Text = null; cbZt.SelectedIndex = 0; //tbFhsj.Text = DateTime.Now.Hour.ToString(); //tbFhsj2.Text = DateTime.Now.Minute.ToString(); dtpFhrq.Text = DateTime.Now.ToString(); } }
private void toolStripButton4_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (dataGridView1.Rows.Count <= 0) { return; } FrmEditCode.falg = "Edit"; FrmEditCode.pLx = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString(); FrmEditCode.pDm = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Value.ToString(); FrmEditCode.pMc = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[2].Value.ToString(); FrmEditCode.pPym = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[3].Value.ToString(); FrmEditCode.pBz = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[4].Value.ToString(); FrmEditCode.pBl1 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[5].Value.ToString(); FrmEditCode.pBl2 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[6].Value.ToString(); FrmEditCode.pBl3 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[7].Value.ToString(); FrmEditCode.pBl4 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[8].Value.ToString(); FrmEditCode.pBl5 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[9].Value.ToString(); FrmEditCode.pBl6 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[10].Value.ToString(); FrmEditCode.pBl7 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[11].Value.ToString(); FrmEditCode.pBl8 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[12].Value.ToString(); FrmEditCode.pBl9 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[13].Value.ToString(); FrmEditCode.pBl10 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[14].Value.ToString(); FrmEditCode.pTy = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[17].Value.ToString(); FrmEditCode.ShowUniqueForm(true); if (FrmEditCode.ifSave) { OleDbDataAdapter sda = new OleDbDataAdapter(ResultSelect, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void 新增ToolStripMenuItem_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } FrmEditItem.falg = "Add"; FrmEditItem.ShowUniqueForm(true); if (FrmEditItem.ifSave) { string sql = "select sku_id,season 货主,size_desc 商品代码,sku_desc 品名规格,cc_flag 冷链标示,manufacturer 生产厂家," + "storage_conditions 存储条件,therm_company 温度计所属单位,pym 拼音码,create_date_time 创建时间,user_name 操作人员," + "std_pack_qty 件装数,pack_type_z 整件包装类型,pack_type_l 零散包装类型,REPORT_FILE 跟踪报表名称 from cc_item_master where 1=1 and sku_id in (" + FrmEditItem.ResultSku_id + "')"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void 新增ToolStripMenuItem_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } FrmEditCode.falg = "Add"; FrmEditCode.ShowUniqueForm(true); if (FrmEditCode.ifSave) { string sql = "select type as 类型,ysid as 代码,ysfs as 名称,pym as 拼音码,memo as 备注,reserve1 as 保留字段1,reserve2 as 保留字段2,reserve3 as 保留字段3," + "reserve4 as 保留字段4,reserve5 as 保留字段5,reserve6 as 保留字段6,reserve7 as 保留字段7,reserve8 as 保留字段8," + "reserve9 as 保留字段9,reserve10 as 保留字段10,create_date_time as 创建时间,user_name as 操作员,flag as 是否停用 " + "from ysfs where 1=1 and type in (" + FrmEditCode.ResultCode_type + "') and ysid in (" + FrmEditCode.ResultCode_id + "') order by type,ysid"; OleDbDataAdapter sda = new OleDbDataAdapter(sql, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con2"); dataGridView1.DataSource = ds.Tables["chk_con2"]; dataGridView1.AutoResizeColumns(); } }
private void button11_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string d1 = SJ1.Value.ToString("yyyy-MM-dd 00:00:00"); string d2 = SJ2.Value.ToString("yyyy-MM-dd 23:59:59"); string SqlSeach = "select c.pkunid as 跟踪表单号,c.sku_desc as 品名规格,c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,t.therm_id as 温度计编号,t.BACK_TIME as 温度计返回时间,t.FILE_PATH as 温度跟踪记录文件路径,t.PACK_MEMO as 温度计包装备注,t.TEMP_MEMO as 温度计温度备注,t.IF_BAD 温度计是否损坏 " + "from cc_cold_chain_c c left join cc_cold_chain_therm t on c.unid=t.pkunid " + "where c.pkunid like '%" + gzbdhrg.Text + "%' and t.BACK_TIME between (to_date('" + d1 + "','yyyy-mm-dd hh24:mi:ss')) " + "and (to_date('" + d2 + "','yyyy-mm-dd hh24:mi:ss')) order by c.size_desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(SqlSeach, cn); DataTable table = new DataTable(); adapater.Fill(table); dataGridView6.DataSource = table.DefaultView; dataGridView6.AutoResizeColumns(); }
private void button4_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (MessageBox.Show("确实要删除跟踪单" + tbGzbdh.Text + "吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { return; } OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); //更新温度计状态表 string Sqlrg = "select ct.therm_id from cc_cold_chain_therm ct where ct.pkunid in " + "(select unid from cc_cold_chain_c where pkunid='" + tbGzbdh.Text + "')"; OleDbDataAdapter sda; sda = new OleDbDataAdapter(Sqlrg, cn); DataTable rgTable = new DataTable(); sda.Fill(rgTable); for (int rgsltemp = 0; rgsltemp < rgTable.Rows.Count; rgsltemp++) { LYFunctionCs.LYFunctionCsClass.cmd("update ysfs set RESERVE1='在库' where type='温度计字典' and ysid='" + rgTable.Rows[rgsltemp][0] + "' ", CommFunction.ConnectString); } LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_cold_chain_therm ct where ct.pkunid in (select unid from cc_cold_chain_c where pkunid='" + tbGzbdh.Text + "')", CommFunction.ConnectString); // 删除主表的记录 LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_cold_chain_ice ci where ci.pkunid in (select unid from cc_cold_chain_c where pkunid='" + tbGzbdh.Text + "' )", CommFunction.ConnectString); LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_cold_chain_c where pkunid='" + tbGzbdh.Text + "'", CommFunction.ConnectString); LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_cold_chain_Z where unid='" + tbGzbdh.Text + "'", CommFunction.ConnectString); //清空数据 dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = null; tbPKT.Text = null; tbCk.Text = null; tbHz.Text = null; tbHzqd.Text = null; tbXdsj.Text = null; tbDjzt.Text = null; tbBch.Text = null; tbKhmc.Text = null; tbShdz.Text = null; //nuCfmax.Value = 0; //nuMdmax.Value = 0; //nuFhwd.Value = 0; //nuCfmin.Value = 0; //nuMdmin.Value = 0; chbLcc.Checked = false; cbWdjpfr.Text = null; tbGzbdh.Text = null; }
private void button1_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if (cbWdj.Text == "" || cbZt.Text == "") { MessageBox.Show("请输完基本信息"); } else { //OleDbConnection isreturn_conn = new OleDbConnection(CommFunction.ConnectString); //isreturn_conn.Open(); string isreturn_sql = "select reserve1 from ysfs where type='温度计字典' and ysid='" + cbWdj.Text + "'"; //OleDbDataAdapter isreturn_ada = new OleDbDataAdapter(isreturn_sql,isreturn_conn); string isreturn_str = ""; isreturn_str = LYFunctionCs.LYFunctionCsClass.cmdScalar(isreturn_sql, CommFunction.ConnectString); if (isreturn_str == "") { MessageBox.Show("温度计未在基础数据中登记!"); return; } else { if (isreturn_str == "在库") { if (MessageBox.Show("温度计已在库,是否更新数据?", "更新数据", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } } if (localfilepath.Text != "" && serverfilepath.Text != "") { try { File.Copy(localfilepath.Text, serverfilepath.Text); } catch { MessageBox.Show("拷贝失败"); return; } } OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string gg = dtpFhrq.Value.ToString("yyyy-MM-dd"); //gg = gg + " "; //gg = gg + tbFhsj.Text; //gg = gg + ":"; //gg = gg + tbFhsj2.Text; //gg = gg + ":00"; gg = gg + " " + dtpFhsj.Text; string SqlSeach = "update cc_cold_chain_therm ct set FILE_PATH='" + serverfilepath.Text + "', BACK_TIME=to_date('" + gg + "','yyyy-mm-dd hh24:mi:ss') ,TEMP_MEMO='" + tbWdbz.Text + "',PACK_MEMO='" + tbZlbz.Text + "',IF_BAD='" + cbZt.Text + "' where ct.pkunid in (select unid from cc_cold_chain_c where pkunid='" + tbGzbd.Text + "') and ct.THERM_ID='" + cbWdj.Text + "'"; OleDbCommand command1 = new OleDbCommand(SqlSeach, cn); command1.ExecuteNonQuery(); SqlSeach = "update ysfs set RESERVE1='在库', RESERVE2='" + cbZt.Text + "',MEMO='" + tbZlbz.Text + "' where type='温度计字典' and ysid='" + cbWdj.Text + "'"; command1.CommandText = SqlSeach; command1.ExecuteNonQuery(); command1.Dispose(); cn.Close(); cbWdj.Text = null; dtpFhrq.Text = null; tbZlbz.Text = null; localfilepath.Text = null; serverfilepath.Text = null; tbWdbz.Text = null; cbZt.SelectedIndex = 0; //tbFhsj.Text = DateTime.Now.Hour.ToString(); //tbFhsj2.Text = DateTime.Now.Minute.ToString(); dtpFhrq.Text = DateTime.Now.ToString(); } } }
private void button2_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if ((cbWdjpfr.Enabled == true) && cbWdjpfr.Text.Trim() == "") { MessageBox.Show("请选择 温度计配附人 !"); return; } if (int.Parse(LYFunctionCs.LYFunctionCsClass.cmdScalar("select count(1) from cc_cold_chain_z where pkt_ctrl_nbr='" + tbPKT.Text + "'", CommFunction.ConnectString)) == 0) { if (MessageBox.Show("确实要新增一张跟踪单吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { OleDbConnection con = new OleDbConnection(CommFunction.ConnectString); con.Open(); OleDbCommand ocmd = new OleDbCommand("SP_INSERT_LLGZ", con); ocmd.CommandType = CommandType.StoredProcedure; //此处sourceColumn参数没什么用(不用该参数也可以).参数值必须按该存储过程中的参数顺序进行传递 ocmd.Parameters.Add("A", OleDbType.VarChar, 50, "pWHSE").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["仓库"].Value.ToString(); //Parameters.Add的第一个参数parameterName无实际意义,可随意输入 ocmd.Parameters.Add("B", OleDbType.VarChar, 100, "pSEASON").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["货主"].Value.ToString(); ocmd.Parameters.Add("C", OleDbType.VarChar, 100, "pSHIPTO").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["客户代码"].Value.ToString(); ocmd.Parameters.Add("D", OleDbType.VarChar, 100, "pSHIPTO_NAME").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["客户名称"].Value.ToString(); ocmd.Parameters.Add("E", OleDbType.VarChar, 100, "pSHIPTO_ADDR").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["送货地址"].Value.ToString(); ocmd.Parameters.Add("F", OleDbType.VarChar, 100, "pPKT_CTRL_NBR").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["物流PKT号"].Value.ToString(); ocmd.Parameters.Add("G", OleDbType.VarChar, 100, "pMAJOR_PKT_GRP_ATTR").Value = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells["货主清单号"].Value.ToString(); ocmd.Parameters.Add("H", OleDbType.VarChar, 100, "pUSER_NAME").Value = LoginCs.LoginClass.LogName; ocmd.Parameters.Add("I", OleDbType.VarChar, 100, "pUSER_THERM").Value = cbWdjpfr.Text.Trim(); ocmd.Parameters.Add("J", OleDbType.VarChar, 100, "pUSER_CHECK").Value = ""; ocmd.Parameters.Add("K", OleDbType.VarChar, 100, "pCHECK_DATE_TIME").Value = "";//未知 ocmd.Parameters.Add("L", OleDbType.VarChar, 100, "pMIN_TEMP_SRC").Value = nuCfmin.Value; ocmd.Parameters.Add("M", OleDbType.VarChar, 100, "pMAX_TEMP_SRC").Value = nuCfmax.Value; ocmd.Parameters.Add("N", OleDbType.VarChar, 100, "pMIN_TEMP_DEST").Value = nuMdmin.Value; ocmd.Parameters.Add("O", OleDbType.VarChar, 100, "pMAX_TEMP_DEST").Value = nuMdmax.Value; ocmd.Parameters.Add("P", OleDbType.VarChar, 100, "pCUR_TEMP_SRC").Value = nuFhwd.Value; ocmd.Parameters.Add("Q", OleDbType.VarChar, 100, "pFULL_COLD_CAR").Value = chbLcc.Checked ? "1" : "0"; ocmd.Parameters.Add("R", OleDbType.VarChar, 100, "pUSER_PACK").Value = ""; ocmd.Parameters.Add("S", OleDbType.VarChar, 100, "pPACK_DATE_TIME").Value = ""; //未知; ocmd.Parameters.Add("T", OleDbType.VarChar, 100, "pCARR_NAME").Value = ""; //未知; ocmd.Parameters.Add("U", OleDbType.VarChar, 100, "pUSER_CARR").Value = ""; //未知; ocmd.Parameters.Add("V", OleDbType.VarChar, 100, "pCARR_DATE_TIME").Value = ""; //未知; ocmd.Parameters.Add("W", OleDbType.VarChar, 100, "pUSER_SIGN").Value = ""; //未知; ocmd.Parameters.Add("X", OleDbType.VarChar, 100, "pSIGN_DATE_TIME").Value = ""; //未知; ocmd.Parameters.Add("Y", OleDbType.VarChar, 100, "pSIGN_TEMP_ENVI").Value = ""; //未知; ocmd.Parameters.Add("Z", OleDbType.VarChar, 100, "pSIGN_TEMP_DRUGS").Value = ""; //未知; ocmd.Parameters.Add("A", OleDbType.VarChar, 100, "pSIGN_MEMO").Value = ""; //未知; OleDbParameter pUNID = ocmd.Parameters.Add("GZDH", OleDbType.VarChar, 100, "pUNID"); //参数类型的变量,取名时也可随意 pUNID.Direction = ParameterDirection.Output; ocmd.ExecuteNonQuery(); string UNID = ocmd.Parameters["GZDH"].Value.ToString().Trim(Convert.ToChar(0x0));//此处需用到Parameters.Add的第一个参数parameterName con.Close(); con.Dispose(); for (int i = 0; i <= dataGridView1.RowCount - 1; i++) { OleDbConnection con2 = new OleDbConnection(CommFunction.ConnectString); con2.Open(); OleDbCommand ocmd2 = new OleDbCommand("SP_INSERT_LLGZ_C", con2); ocmd2.CommandType = CommandType.StoredProcedure; //此处sourceColumn参数没什么用(不用该参数也可以).参数值必须按该存储过程中的参数顺序进行传递 ocmd2.Parameters.Add("A", OleDbType.VarChar, 50, "pPKUNID").Value = int.Parse(UNID); //Parameters.Add的第一个参数parameterName无实际意义,可随意输入 ocmd2.Parameters.Add("B", OleDbType.VarChar, 100, "pPKT_SEQ_NBR").Value = dataGridView1.Rows[i].Cells["物流PKT序号"].Value; ocmd2.Parameters.Add("C", OleDbType.VarChar, 100, "pASSORT_NBR").Value = dataGridView1.Rows[i].Cells["货主业务编号"].Value.ToString(); ocmd2.Parameters.Add("D", OleDbType.VarChar, 100, "pSIZE_DESC").Value = dataGridView1.Rows[i].Cells["商品代码"].Value.ToString(); ocmd2.Parameters.Add("E", OleDbType.VarChar, 100, "pSKU_DESC").Value = dataGridView1.Rows[i].Cells["品名规格"].Value.ToString(); ocmd2.Parameters.Add("F", OleDbType.VarChar, 100, "pBATCH_NBR").Value = dataGridView1.Rows[i].Cells["批号"].Value.ToString(); ocmd2.Parameters.Add("G", OleDbType.VarChar, 100, "pORIG_PKT_QTY").Value = dataGridView1.Rows[i].Cells["数量"].Value; ocmd2.Parameters.Add("H", OleDbType.VarChar, 100, "pUNITS").Value = dataGridView1.Rows[i].Cells["单位"].Value.ToString();; ocmd2.Parameters.Add("I", OleDbType.VarChar, 100, "pUSER_NAME").Value = LoginCs.LoginClass.LogName; ocmd2.Parameters.Add("J", OleDbType.VarChar, 100, "pVENDOR_NAME").Value = dataGridView1.Rows[i].Cells["供应商"].Value.ToString(); ocmd2.Parameters.Add("K", OleDbType.VarChar, 100, "pPACK_TIPS").Value = cd[i].pBzts == null ? "" : cd[i].pBzts; ocmd2.Parameters.Add("L", OleDbType.VarChar, 100, "pPACK_NUM").Value = cd[i].pBzjs == null ? "0" : cd[i].pBzjs; OleDbParameter pUNID_C = ocmd2.Parameters.Add("GZDH_C", OleDbType.VarChar, 100, "pUNID_C");//参数类型的变量,取名时也可随意 pUNID_C.Direction = ParameterDirection.Output; ocmd2.ExecuteNonQuery(); string UNID_C = ocmd2.Parameters["GZDH_C"].Value.ToString().Trim(Convert.ToChar(0x0));//此处需用到Parameters.Add的第一个参数parameterName con2.Close(); con2.Dispose(); //冰排信息 if (cd[i].bd != null) { for (int iBd = 0; iBd < cd[i].bd.Length; iBd++) { string SqlIns = "insert into cc_cold_chain_ice (PKUNID,ICE_ID,ICE_NAME,ICE_QTY,USER_NAME,IF_PICK,PKT_SEQ_NBR) values('" + UNID_C + "','" + cd[i].bd[iBd].pIce_Id + "','" + cd[i].bd[iBd].pIce_Name + "','" + cd[i].bd[iBd].pIce_Qty + "','" + LoginCs.LoginClass.LogName + "','待拣','" + dataGridView1.Rows[i].Cells["物流PKT序号"].Value.ToString() + "')"; LYFunctionCs.LYFunctionCsClass.cmd(SqlIns, CommFunction.ConnectString); } } //温度计已发 更新处理。。。 string stra = cd[i].pWdj == null ? "" : cd[i].pWdj; char[] sep = { ';' }; string[] strb = new string[10]; strb = stra.Split(sep); int temprgsl = strb.Length - 1; for (int temp1 = 0; temp1 < temprgsl; temp1++) {//同一个明细的温度计循环 string SqlUpt = "update ysfs set RESERVE1='已发' where type='温度计字典' and ysid='" + strb[temp1].ToString() + "' "; LYFunctionCs.LYFunctionCsClass.cmd(SqlUpt, CommFunction.ConnectString); string strwdrggz = "select * from CC_COLD_CHAIN_THERM t where t.pkunid='" + UNID_C + "' and t.therm_id='" + strb[temp1].ToString() + "'"; OleDbDataAdapter sda; sda = new OleDbDataAdapter(strwdrggz, CommFunction.ConnectString); DataSet rgTable = new DataSet(); sda.Fill(rgTable); if (rgTable.Tables[0].Rows.Count == 0) { string SqlIns = "insert into CC_COLD_CHAIN_THERM (pkunid,therm_id,user_name,PKT_SEQ_NBR) values('" + UNID_C + "','" + strb[temp1].ToString() + "','" + LoginCs.LoginClass.LogName + "','" + dataGridView1.Rows[i].Cells["物流PKT序号"].Value.ToString() + "')"; LYFunctionCs.LYFunctionCsClass.cmd(SqlIns, CommFunction.ConnectString); } }//同一个明细的温度计循环 } //清空数据 dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = null; tbPKT.Text = null; tbCk.Text = null; tbHz.Text = null; tbHzqd.Text = null; tbXdsj.Text = null; tbDjzt.Text = null; tbBch.Text = null; tbKhmc.Text = null; tbShdz.Text = null; //nuCfmax.Value = 0; //nuMdmax.Value = 0; //nuFhwd.Value = 0; //nuCfmin.Value = 0; //nuMdmin.Value = 0; chbLcc.Checked = false; cbWdjpfr.Text = null; tbGzbdh.Text = UNID; } } else { if (MessageBox.Show("确实要修改该跟踪单吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { string SqlUpt = "update cc_cold_chain_z set USER_THERM='" + cbWdjpfr.Text.Trim() + "',MIN_TEMP_SRC='" + nuCfmin.Value + "',MAX_TEMP_SRC='" + nuCfmax.Value + "',MIN_TEMP_DEST='" + nuMdmin.Value + "',MAX_TEMP_DEST='" + nuMdmax.Value + "',CUR_TEMP_SRC='" + nuFhwd.Value + "',FULL_COLD_CAR='" + (chbLcc.Checked ? "1" : "0") + "' where unid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "'"; LYFunctionCs.LYFunctionCsClass.cmd(SqlUpt, CommFunction.ConnectString); for (int ii = 0; ii <= dataGridView1.RowCount - 1; ii++) { SqlUpt = "update cc_cold_chain_c set PACK_TIPS='" + (cd[ii].pBzts == null ? "" : cd[ii].pBzts) + "',PACK_NUM='" + (cd[ii].pBzjs == null ? "0" : cd[ii].pBzjs) + "' where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "' and PKT_SEQ_NBR='" + dataGridView1.Rows[ii].Cells["物流PKT序号"].Value + "'"; LYFunctionCs.LYFunctionCsClass.cmd(SqlUpt, CommFunction.ConnectString); string Sqlrg = "select ct.therm_id from cc_cold_chain_therm ct where ct.pkunid=" + "(select unid from cc_cold_chain_c where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "' and ct.pkt_seq_nbr=cc_cold_chain_c.pkt_seq_nbr )"; OleDbDataAdapter sda; sda = new OleDbDataAdapter(Sqlrg, CommFunction.ConnectString); DataTable rgTable = new DataTable(); sda.Fill(rgTable); for (int rgsltemp = 0; rgsltemp < rgTable.Rows.Count; rgsltemp++) { LYFunctionCs.LYFunctionCsClass.cmd("update ysfs set RESERVE1='在库' where type='温度计字典' and ysid='" + rgTable.Rows[rgsltemp][0] + "' ", CommFunction.ConnectString); } LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_cold_chain_therm ct where ct.pkunid in (select unid from cc_cold_chain_c where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "')", CommFunction.ConnectString); LYFunctionCs.LYFunctionCsClass.cmd("delete from cc_cold_chain_ice ci where ci.pkunid in (select unid from cc_cold_chain_c where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "')", CommFunction.ConnectString); //冰排信息 if (cd[ii].bd != null) { for (int iBd = 0; iBd < cd[ii].bd.Length; iBd++) { string SqlIns = "insert into cc_cold_chain_ice (PKUNID,ICE_ID,ICE_NAME,ICE_QTY,USER_NAME,IF_PICK,PKT_SEQ_NBR) values(" + "(select unid from cc_cold_chain_c where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "' and pkt_seq_nbr='" + dataGridView1.Rows[ii].Cells["物流PKT序号"].Value.ToString() + "'),'" + cd[ii].bd[iBd].pIce_Id + "','" + cd[ii].bd[iBd].pIce_Name + "','" + cd[ii].bd[iBd].pIce_Qty + "','" + LoginCs.LoginClass.LogName + "','待拣','" + dataGridView1.Rows[ii].Cells["物流PKT序号"].Value.ToString() + "')"; LYFunctionCs.LYFunctionCsClass.cmd(SqlIns, CommFunction.ConnectString); } } //温度计已发 更新处理。。。 string stra = cd[ii].pWdj == null ? "" : cd[ii].pWdj; char[] sep = { ';' }; string[] strb = new string[10]; strb = stra.Split(sep); int temprgsl = strb.Length - 1; for (int temp1 = 0; temp1 < temprgsl; temp1++) {//同一个明细的温度计循环 SqlUpt = "update ysfs set RESERVE1='已发' where type='温度计字典' and ysid='" + strb[temp1].ToString() + "' "; LYFunctionCs.LYFunctionCsClass.cmd(SqlUpt, CommFunction.ConnectString); string strwdrggz = "select * from CC_COLD_CHAIN_THERM t where t.pkunid in (select unid from cc_cold_chain_c where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "') and t.therm_id='" + strb[temp1].ToString() + "'"; OleDbDataAdapter sda1; sda1 = new OleDbDataAdapter(strwdrggz, CommFunction.ConnectString); DataSet rgTable1 = new DataSet(); sda1.Fill(rgTable1); if (rgTable1.Tables[0].Rows.Count == 0) { string SqlIns = "insert into CC_COLD_CHAIN_THERM (pkunid,therm_id,user_name,PKT_SEQ_NBR) values((select unid from cc_cold_chain_c where pkunid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value + "' and pkt_seq_nbr='" + dataGridView1.Rows[ii].Cells["物流PKT序号"].Value.ToString() + "'),'" + strb[temp1].ToString() + "','" + LoginCs.LoginClass.LogName + "','" + dataGridView1.Rows[ii].Cells["物流PKT序号"].Value.ToString() + "')"; LYFunctionCs.LYFunctionCsClass.cmd(SqlIns, CommFunction.ConnectString); } } } //清空数据 dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = null; tbPKT.Text = null; tbCk.Text = null; tbHz.Text = null; tbHzqd.Text = null; tbXdsj.Text = null; tbDjzt.Text = null; tbBch.Text = null; tbKhmc.Text = null; tbShdz.Text = null; //nuCfmax.Value = 0; //nuMdmax.Value = 0; //nuFhwd.Value = 0; //nuCfmin.Value = 0; //nuMdmin.Value = 0; chbLcc.Checked = false; cbWdjpfr.Text = null; tbGzbdh.Text = null; } } }
private void toolStripButton3_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } //string ResultSelect = ""; string SqlSeach = "select cz.unid as 跟踪单号, whse as 仓库,season as 货主,pkt_ctrl_nbr as 物流PKT号,major_pkt_grp_attr as 货主清单号,create_date_time as 下单时间," + "'' as 单据状态,'' as 波次号,shipto as 客户代码,shipto_name as 客户名称,shipto_addr as 送货地址,pkt_seq_nbr as 物流PKT序号," + "assort_nbr as 货主业务编号,size_desc as 商品代码,sku_desc as 品名规格,orig_pkt_qty as 数量,batch_nbr as 批号,units as 单位," + "vendor_name as 供应商,manufacturer as 生产厂家,case when cz.user_therm is not null then '附温度计' else '' end as 是否需附温度计,therm_company 温度计所属公司,pack_type 包装类型 " + "from cc_cold_chain_c cc " + "left join cc_cold_chain_z cz on cz.unid=cc.pkunid " + "left join cc_item_master cm on cm.size_desc=cc.size_desc and cm.season=cz.season where cz.unid='" + toolStripTextBox1.Text + "' order by pkt_ctrl_nbr,pkt_seq_nbr "; //if (CommFunction.ShowQueryForm(this.Handle, CommFunction.ConnectString, SqlSeach, 3, ref ResultSelect) == false) { return; } OleDbDataAdapter sda = new OleDbDataAdapter(SqlSeach, CommFunction.ConnectString); DataSet ds = new DataSet(); sda.Fill(ds, "chk_con"); dataGridView1.DataSource = ds.Tables["chk_con"]; dataGridView1.AutoResizeColumns(); tbPKT.Focus(); tbPKT.SelectAll(); if (dataGridView1.Rows.Count <= 0) { return; } string Sqlcha1 = "select MIN_TEMP_SRC,MAX_TEMP_SRC,MIN_TEMP_DEST,MAX_TEMP_DEST,CUR_TEMP_SRC,FULL_COLD_CAR,USER_THERM from cc_cold_chain_z where unid='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value.ToString() + "'"; OleDbDataAdapter sda1; sda1 = new OleDbDataAdapter(Sqlcha1, CommFunction.ConnectString); DataTable ATable = new DataTable(); sda1.Fill(ATable); nuCfmin.Value = int.Parse(ATable.Rows[0][0].ToString()); nuCfmax.Value = int.Parse(ATable.Rows[0][1].ToString()); nuMdmin.Value = int.Parse(ATable.Rows[0][2].ToString()); nuMdmax.Value = int.Parse(ATable.Rows[0][3].ToString()); nuFhwd.Value = int.Parse(ATable.Rows[0][4].ToString()); if (ATable.Rows[0][5].ToString() == "1") { chbLcc.Checked = true; } else { chbLcc.Checked = false; } cbWdjpfr.Text = ATable.Rows[0][6].ToString(); cd = new ColdChain_dtl[dataGridView1.Rows.Count];//查询跟踪单 和 待跟踪单 共享一个全局变量结构体数组 for (int i = 0; i < cd.Length; i++) { string Sqlcha2 = "select PACK_TIPS,PACK_NUM from cc_cold_chain_c where ASSORT_NBR='" + dataGridView1.Rows[i].Cells["货主业务编号"].Value.ToString() + "' and PKT_SEQ_NBR='" + dataGridView1.Rows[i].Cells["物流PKT序号"].Value.ToString() + "'"; OleDbDataAdapter sda2; sda2 = new OleDbDataAdapter(Sqlcha2, CommFunction.ConnectString); DataTable ETable = new DataTable(); sda2.Fill(ETable); cd[i].pBzts = ETable.Rows[0][0].ToString(); cd[i].pBzjs = ETable.Rows[0][1].ToString(); OleDbDataAdapter sda3; string strWDJ = "select THERM_ID from cc_cold_chain_therm WHERE PKT_SEQ_NBR='" + dataGridView1.Rows[i].Cells["物流PKT序号"].Value.ToString() + "' and PKUNID=(select unid from cc_cold_chain_c where PKUNID='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value.ToString() + "' and cc_cold_chain_therm.pkt_seq_nbr=cc_cold_chain_c.pkt_seq_nbr)"; sda3 = new OleDbDataAdapter(strWDJ, CommFunction.ConnectString); DataSet WDJTable = new DataSet(); sda3.Fill(WDJTable); string temp = ""; for (int wdjNum = 0; wdjNum < WDJTable.Tables[0].Rows.Count; wdjNum++) { temp = WDJTable.Tables[0].Rows[wdjNum][0] + ";" + temp; } cd[i].pWdj = temp; OleDbDataAdapter sda4; string strBP = "select ICE_ID,ICE_NAME,ICE_QTY from cc_cold_chain_ice WHERE PKT_SEQ_NBR='" + dataGridView1.Rows[i].Cells["物流PKT序号"].Value.ToString() + "' and PKUNID=(select unid from cc_cold_chain_c where PKUNID='" + dataGridView1.Rows[0].Cells["跟踪单号"].Value.ToString() + "' and cc_cold_chain_ice.pkt_seq_nbr=cc_cold_chain_c.pkt_seq_nbr)"; sda4 = new OleDbDataAdapter(strBP, CommFunction.ConnectString); DataSet BPTable = new DataSet(); sda4.Fill(BPTable); FrmPack.pBd = new FrmPack.Bp_dtl[BPTable.Tables[0].Rows.Count]; cd[i].bd = new Bp_dtl[BPTable.Tables[0].Rows.Count]; if (BPTable.Tables[0].Rows.Count == 0) { cd[i].bd = null; } else { for (int bpNum = 0; bpNum < cd[i].bd.Length; bpNum++) { cd[i].bd[bpNum].pIce_Id = BPTable.Tables[0].Rows[bpNum][0].ToString(); cd[i].bd[bpNum].pIce_Name = BPTable.Tables[0].Rows[bpNum][1].ToString(); cd[i].bd[bpNum].pIce_Qty = BPTable.Tables[0].Rows[bpNum][2].ToString(); } } } }
private void button2_Click(object sender, EventArgs e) { if (!PowerCheckCsClass.IfHasPower(LoginClass.LogID, CommFunction.GSYSNAME, sender, CommFunction.ConnectString)) { return; } if ((tbGzbd.Text == "") || (dtpFhsj.Text.Trim() == "") || //(tbFhsj2.Text.Trim() == "") || (dtpBzsj.Text.Trim() == "")) //|| (tbBzsj2.Text.Trim() == "")) { MessageBox.Show("请输完基本信息"); } else { OleDbConnection cn = new OleDbConnection(CommFunction.ConnectString); cn.Open(); string gg = dtpBzri.Value.ToString("yyyy-MM-dd"); //gg = gg + " "; //gg = gg + tbBzsj.Text; //gg = gg + ":"; //gg = gg + tbBzsj2.Text; //gg = gg + ":00"; gg = gg + " " + dtpBzsj.Text; string hh = dtpFhqi.Value.ToString("yyyy-MM-dd"); //hh = hh + " "; //hh = hh + tbFhsj.Text; //hh = hh + ":"; //hh = hh + tbFhsj2.Text; //hh = hh + ":00"; hh = hh + " " + dtpFhsj.Text; string II = dtpThri.Value.ToString("yyyy-MM-dd"); //II = II + " "; //II = II + tbThsj.Text; //II = II + ":"; //II = II + tbThsj2.Text; //II = II + ":00"; II = II + " " + dtpThsj.Text; string SqlSeach; OleDbCommand command1; SqlSeach = "update CC_COLD_CHAIN_Z set USER_CHECK='" + cbFhr.Text + "',USER_PACK='" + cbBzr.Text + "',CARR_NAME='" + cbCys.Text + "',PACK_DATE_TIME=to_date('" + gg + "','yyyy-mm-dd hh24:mi:ss'),USER_CARR='" + tbThr.Text + "',CARR_DATE_TIME=to_date('" + II + "','yyyy-mm-dd hh24:mi:ss'), CHECK_DATE_TIME=to_date('" + hh + "','yyyy-mm-dd hh24:mi:ss') WHERE UNID='" + tbGzbd.Text + "'"; command1 = new OleDbCommand(SqlSeach, cn); command1.ExecuteNonQuery(); tbGzbd.Text = null; cbFhr.Text = null; cbBzr.Text = null; cbCys.Text = null; //tbBzsj.Text = null; //tbBzsj2.Text = null; dtpBzsj.Text = DateTime.Now.ToString(); tbThr.Text = null; //tbThsj.Text = null; //tbThsj2.Text = null; dtpThsj.Text = DateTime.Now.ToString(); //tbFhsj.Text = null; //tbFhsj2.Text = null; dtpFhsj.Text = DateTime.Now.ToString(); SqlSeach = "select z.unid as 跟踪表单号,c.assort_nbr as 发货单号,c.sku_desc as 品名规格," + "c.batch_nbr as 商品批号,c.orig_pkt_qty as 商品数量,c.units as 单位,z.season as 货主," + "z.shipto_name as 客户名称,z.create_date_time as 发货时间,z.user_name as 发货人,z.cur_temp_src as 发货天气温度 " + "from CC_COLD_CHAIN_Z z " + "left join CC_COLD_CHAIN_C c on z.unid=c.pkunid " + "where z.unid like '%" + tbGzbd.Text + "%' and z.check_date_time is null " + "order by z.create_date_time desc "; OleDbDataAdapter adapater = new OleDbDataAdapter(SqlSeach, cn); DataTable table = new DataTable(); adapater.Fill(table); dataGridView1.DataSource = table.DefaultView; dataGridView1.AutoResizeColumns(); } }