private void btnUpload_Click(object sender, EventArgs e) { //1.判断采购单数据 foreach (DataGridViewRow r in dgvPur.Rows) { if (r.Cells[7].Value == null) { MessageBox.Show("第" + (r.Index + 1).ToString() + "行数量为空"); return; } double num = 0; if (!double.TryParse(r.Cells[7].Value.ToString(), out num)) { MessageBox.Show("第" + (r.Index + 1).ToString() + "行数量错误"); return; } if (num <= 0) { MessageBox.Show("第" + (r.Index + 1).ToString() + "行数量必须>=0"); return; } } //2.上传到远程服务器 Thread thread = new Thread(new ParameterizedThreadStart(UploadPur)); thread.Start(dgvPur.Rows); formLoading = new FormLoading("正在上传..."); formLoading.ShowDialog(); }
private void tbtnVipLevel_Click(object sender, EventArgs e) { stripLabelInfo.Text = "正在统计会员级别,请稍后..."; Thread thread = new Thread(new ThreadStart(SelectVIPLevel)); thread.Start(); formLoading = new FormLoading("会员级别统计"); formLoading.ShowDialog(); }
private void tbtnUpdateBuyGive_Click(object sender, EventArgs e) { stripLabelInfo.Text = "正在更新品种,请稍后..."; Thread thread = new Thread(new ThreadStart(UpdateBuyGive)); thread.Start(); formLoading = new FormLoading("更新买赠"); formLoading.ShowDialog(); }
private void tbtnSelectVIP_Click(object sender, EventArgs e) { if (this.dm == "未设置") { MessageBox.Show("店码为空"); return; } stripLabelInfo.Text = "正在查询会员,请稍后..."; Thread thread = new Thread(new ThreadStart(SelectVIP)); thread.Start(); formLoading = new FormLoading("查询会员"); formLoading.ShowDialog(); }
private void tbtnUpdateScore_Click(object sender, EventArgs e) { if (this.dm == "未设置") { MessageBox.Show("店码为空"); return; } stripLabelInfo.Text = "正在更新不积分品种,请稍后..."; Thread thread = new Thread(new ThreadStart(UpdateScore)); thread.Start(); formLoading = new FormLoading("更新不积分品种"); formLoading.ShowDialog(); }
private void tbtnUpdatePercent_Click(object sender, EventArgs e) { if (this.dm == "未设置") { MessageBox.Show("店码为空"); return; } stripLabelInfo.Text = "正在更新参考提成..."; ParameterizedThreadStart parStart = new ParameterizedThreadStart(UpdatePercentage); Thread thread = new Thread(parStart); object o = this.dm; thread.Start(o); formLoading = new FormLoading("更新参考提成"); formLoading.ShowDialog(); }
private void tbtn_search_Click(object sender, EventArgs e) { if (this.txtUnsaleMonth.Text == "") { MessageBox.Show("输入数字"); return; } //begindate = dtpkBegindate.Value; //enddate = dtpkEnddate.Value.AddDays(1).AddSeconds(-1); //buydate = dtpkBuyDate.Value; /*if (!int.TryParse(txtUnsaleNum.Text, out unsaleNum)) * { * unsaleNum = 0; * MessageBox.Show("输入数字"); * return; * } * * if (unsaleNum < 1 || unsaleNum > 24) * { * MessageBox.Show("月数在1-24之间"); * return; * } */ dgv_yanzhong.Columns.Clear(); dgv_zhixiao.Columns.Clear(); dgv_zhongyao.Columns.Clear(); dgv_jianyi.Columns.Clear(); dgvDrug.Columns.Clear(); Thread thread = new Thread(new ThreadStart(SelectUnsalableItems)); thread.Start(); formLoading = new FormLoading("查询药品存销比"); formLoading.ShowDialog(); }
private void UpdateSelectRows() { string bigtype = cboxBigType.SelectedValue as string; //大类 string jftype = cbxJiFenType.SelectedValue as string; //积分类别 string lbmc = cbxJiFenType.Text; //类别名称 string zjm = txtzjm.Text.Trim(); string sqlstr; if (jftype == "-1") { //未在大类里所有品种 if (zjm == "") { sqlstr = "SELECT sz.bm, sz.mc,sz.sccj,sz.gg,sz.zjm,sz.dw,'-1' AS lbbm,'未分类' as lbmc,pfd.lsj FROM p_spjcxx_sz AS sz" + " LEFT JOIN (SELECT distinct lsj,bm FROM p_spjcxx_sz_fd WHERE dm =" + dm + ") AS pfd ON sz.bm=pfd.bm" + " WHERE sz.bm NOT in(SELECT DISTINCT spbm FROM p_splb_sp WHERE dm =" + dm + " AND lbbm LIKE '" + bigtype + "%')" + " ORDER BY pfd.lsj DESC"; } else { sqlstr = "SELECT sz.bm, sz.mc,sz.sccj,sz.gg,sz.zjm,sz.dw,'-1' AS lbbm,'未分类' as lbmc,pfd.lsj FROM p_spjcxx_sz AS sz" + " LEFT JOIN (SELECT distinct lsj,bm FROM p_spjcxx_sz_fd WHERE dm =" + dm + ") AS pfd ON sz.bm=pfd.bm" + " WHERE sz.bm NOT in(SELECT DISTINCT spbm FROM p_splb_sp WHERE dm =" + dm + " AND lbbm LIKE '" + bigtype + "%') AND sz.zjm LIKE '%" + zjm + "%'" + " ORDER BY pfd.lsj DESC"; } } else if (jftype == "0") { //所有品种(该大类下的所有品种) if (zjm == "") { sqlstr = "SELECT sz.bm, sz.mc,sz.sccj,sz.gg,sz.zjm,sz.dw,sp.lbbm,sp.lbbm+'('+ sp.mc+')' AS lbmc,pfd.lsj FROM p_spjcxx_sz AS sz" + " LEFT JOIN (SELECT distinct sp1.lbbm,sp1.spbm,spmc1.mc FROM p_splb_sp AS sp1,p_splb_mc AS spmc1 WHERE sp1.dm =" + dm + " AND sp1.lbbm LIKE '" + bigtype + "%' AND sp1.lbbm=spmc1.bm) AS sp ON sz.bm=sp.spbm " // + " LEFT JOIN p_splb_mc AS mc ON sp.lbbm=mc.bm" + " LEFT JOIN (SELECT distinct lsj,bm FROM p_spjcxx_sz_fd WHERE dm =" + dm + ") AS pfd ON sz.bm=pfd.bm" + " ORDER BY pfd.lsj DESC"; } else { sqlstr = "SELECT sz.bm, sz.mc,sz.sccj,sz.gg,sz.zjm,sz.dw,sp.lbbm,sp.lbbm+'('+ sp.mc+')' AS lbmc,pfd.lsj FROM p_spjcxx_sz AS sz" + " LEFT JOIN (SELECT distinct sp1.lbbm,sp1.spbm,spmc1.mc FROM p_splb_sp AS sp1,p_splb_mc AS spmc1 WHERE sp1.dm =" + dm + " AND sp1.lbbm LIKE '" + bigtype + "%' AND sp1.lbbm=spmc1.bm) AS sp ON sz.bm=sp.spbm " + " LEFT JOIN (SELECT distinct lsj,bm FROM p_spjcxx_sz_fd WHERE dm =" + dm + ") AS pfd ON sz.bm=pfd.bm" + " WHERE sz.zjm LIKE '%" + zjm + "%'" + " ORDER BY pfd.lsj DESC"; } } else { if (zjm == "") { sqlstr = "SELECT sz.bm, sz.mc,sz.sccj,sz.gg,sz.zjm,sz.dw,'" + jftype + "' AS lbbm,'" + lbmc + "' AS lbmc,pfd.lsj FROM p_splb_sp AS sp,p_spjcxx_sz AS sz" + " LEFT JOIN (SELECT distinct lsj,bm FROM p_spjcxx_sz_fd WHERE dm =" + dm + ") AS pfd ON sz.bm=pfd.bm" + " WHERE sp.spbm=sz.bm AND sp.dm =" + dm + " AND sp.lbbm='" + jftype + "'" + " ORDER BY pfd.lsj DESC"; } else { sqlstr = "SELECT sz.bm, sz.mc,sz.sccj,sz.gg,sz.zjm,sz.dw,'" + jftype + "' AS lbbm,'" + lbmc + "' AS lbmc,pfd.lsj FROM p_splb_sp AS sp,p_spjcxx_sz AS sz" + " LEFT JOIN (SELECT distinct lsj,bm FROM p_spjcxx_sz_fd WHERE dm =" + dm + ") AS pfd ON sz.bm=pfd.bm" + " WHERE sp.spbm=sz.bm AND sp.dm =" + dm + " AND sp.lbbm='" + jftype + "' AND sz.zjm LIKE '%" + zjm + "%'" + " ORDER BY pfd.lsj DESC"; } } //多线程更新dgv行 dgvDrug.Rows.Clear(); ParameterizedThreadStart parStart = new ParameterizedThreadStart(UpdateDgvRows); Thread thread = new Thread(parStart); object o = sqlstr; thread.Start(o); formLoading = new FormLoading("正在查询..."); formLoading.ShowDialog(); //UpdateDgvRows(sqlstr); }