123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525 |
- using NPOI.SS.Util;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Windows.Forms;
- using UAS_LabelMachine.Entity;
- using UAS_LabelMachine.PublicMethod;
- namespace UAS_LabelMachine
- {
- public partial class 生成条码 : Form
- {
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataHelper dh;
- DataTable dt;
- StringBuilder sql = new StringBuilder();
- string pi_id;
- //用于提示超出数量的物料
- Dictionary<string, string> NotPass = new Dictionary<string, string>();
- //前缀条件
- string Prefix = "";
- string Suffix = "";
- //生成条码的流水号
- int serialnum = 0;
- //客户的流水号
- int custserialnum = 0;
- //是否生成过条码
- bool FirstCode = false;
- //客户编号
- string CustCode = "";
- //编码规则编号
- string NrCode = "";
- public 生成条码(string PI_INOUTNO)
- {
- InitializeComponent();
- pi_inoutno.Text = PI_INOUTNO;
- }
- private void 生成条码_Load(object sender, EventArgs e)
- {
- dh = SystemInf.dh;
- ChooseAll.ChooseAll(ProdIoInfDGV);
- //如果传进了出入库单号则默认执行一次取数据
- if (pi_inoutno.Text != "")
- {
- bi_inoutno_KeyDown(sender, new KeyEventArgs(Keys.Enter));
- }
- pr_kind.Text = "全部";
- asc.controllInitializeSize(this);
- Width = Width - 1;
- }
- private void bi_inoutno_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- LoadData();
- }
- }
- private void 生成条码_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- /// <summary>
- /// 筛选按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Screen_Click(object sender, EventArgs e)
- {
- bi_inoutno_KeyDown(sender, new KeyEventArgs(Keys.Enter));
- }
- /// <summary>
- /// 生成条码
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GenerateBarCode_Click(object sender, EventArgs e)
- {
- //获取编码规则
- DataTable Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_type,nrd_radix,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode='" + CustCode + "' order by nrd_detno", "select");
- //如果没有则取公共规则
- if (Nr.Rows.Count == 0)
- Nr = (DataTable)dh.ExecuteSql("select nrd_detno,nrd_name,nrd_radix,nrd_type,nrd_sql,nrd_length,nr_code,nvl(nrd_iscombine,-1)nrd_iscombine from NoRuleDetail left join norule on nrd_nrid=nr_id where nr_custcode is null and nr_isdefault <> 0 order by nrd_detno", "select");
- //用于过滤参数的正则表达式
- if (Nr.Rows.Count > 0)
- {
- NrCode = Nr.Rows[0]["nr_code"].ToString();
- }
- Regex match = new Regex("{\\w+}");
- //用于存放每一项的明细的数据
- string[] NrData = new string[Nr.Rows.Count];
- //流水号的索引
- int SerialNumIndex = 0;
- //流水长度
- int SerialNumLength = 0;
- //存放键值对
- int Radix = 10;
- string PrefixFixed = "";
- for (int m = 0; m < Nr.Rows.Count; m++)
- {
- switch (Nr.Rows[m]["nrd_type"].ToString())
- {
- //常量直接进行拼接
- case "常量":
- NrData[m] = Nr.Rows[m]["nrd_sql"].ToString();
- Prefix += NrData[m];
- Suffix += NrData[m];
- break;
- case "SQL":
- string SQL = Nr.Rows[m]["nrd_sql"].ToString();
- DataTable Temp;
- //如果不包含参数替换
- if (SQL.IndexOf("{") == 0)
- {
- Temp = (DataTable)dh.ExecuteSql(SQL, "select");
- }
- else
- {
- //替换参数后重新执行SQL
- foreach (Match mch in match.Matches(SQL))
- {
- SQL = SQL.Replace(mch.Value.Trim(), "'" + pi_inoutno.Text + "'");
- }
- Temp = (DataTable)dh.ExecuteSql(SQL, "select");
- }
- if (Temp.Rows.Count > 0)
- {
- NrData[m] = Temp.Rows[0][0].ToString();
- Prefix += NrData[m];
- Suffix += NrData[m];
- }
- else
- {
- NrData[m] = "";
- Prefix += NrData[m];
- Suffix += NrData[m];
- }
- break;
- //流水需要通过MaxNumber去取
- case "流水":
- NrData[m] = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "'").ToString();
- Suffix = "";
- PrefixFixed = Prefix;
- //设置当前流水
- custserialnum = int.Parse(NrData[m] == "" ? "0" : NrData[m]);
- SerialNumIndex = m;
- SerialNumLength = int.Parse(Nr.Rows[m]["nrd_length"].ToString());
- Radix = int.Parse(Nr.Rows[m]["nrd_radix"].ToString());
- break;
- default:
- break;
- }
- }
- //获取最大的流水号
- string maxnum = dh.getFieldDataByCondition("RuleMaxNum", "rmn_maxnumber", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'").ToString();
- //如果流水号为空则插入一条新记录,从1开始取
- if (maxnum == "")
- {
- dh.ExecuteSql("insert into RuleMaxNum(rmn_id,rmn_nrcode,rmn_prefix,rmn_maxnumber) values(RuleMaxNum_seq.nextval,'" + NrCode + "','" + Prefix + "','1')", "insert");
- custserialnum = 1;
- }
- //如果流水号不为空则取当前流水
- else
- {
- custserialnum = int.Parse(maxnum);
- }
- //有错误需要提醒的内容
- int CheckedRowCount = 0;
- string ErrRowIndex = "";
- //遍历整个Grid,勾选的项目全部进行条码生成
- for (int i = 0; i < ProdIoInfDGV.RowCount; i++)
- {
- if (ProdIoInfDGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True")
- {
- CheckedRowCount++;
- List<string> pib_inqty = new List<string>();
- string pd_id = ProdIoInfDGV.Rows[i].Cells["pd_id"].FormattedValue.ToString();
- string pd_prodcode = ProdIoInfDGV.Rows[i].Cells["pd_prodcode"].FormattedValue.ToString();
- string pr_id = ProdIoInfDGV.Rows[i].Cells["pr_id"].FormattedValue.ToString();
- string pd_ordercode = ProdIoInfDGV.Rows[i].Cells["pd_ordercode"].FormattedValue.ToString();
- string pd_pdno = ProdIoInfDGV.Rows[i].Cells["pd_pdno"].FormattedValue.ToString();
- string pd_orderdetno = ProdIoInfDGV.Rows[i].Cells["pd_orderdetno"].FormattedValue.ToString();
- string pr_brand = ProdIoInfDGV.Rows[i].Cells["pr_brand"].FormattedValue.ToString();
- //总数
- int pd_totalqty = int.Parse(ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].FormattedValue.ToString());
- //本次数量
- int pd_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["pd_qty"].FormattedValue.ToString());
- //最小包装数
- int pr_zxbzs = int.Parse(ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].FormattedValue.ToString());
- //中盒容量
- int mid_qty;
- try
- {
- mid_qty = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_qty"].FormattedValue.ToString());
- }
- catch (Exception)
- {
- MessageBox.Show("请检查中盒容量");
- return;
- }
- //如果中盘盒数量为1且有尾数则表示一箱未装满
- int mid_num = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_num"].FormattedValue.ToString());
- //中盒尾数
- int mid_remain = int.Parse(ProdIoInfDGV.Rows[i].Cells["mid_remain"].FormattedValue.ToString());
- string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
- //中盒数量*中盒容量=需要打印的单盘标签
- ArrayList<string> midcode = new ArrayList<string>();
- ArrayList<string> barcode = new ArrayList<string>();
- ArrayList<string> custbarcode = new ArrayList<string>();
- int restqty1 = 0;
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
- {
- string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
- for (int k = 0; k < restqty.Length; k++)
- {
- string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
- int.TryParse(restqty[k], out restqty1);
- barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
- midcode.Add(mid_code);
- pib_inqty.Add(restqty1.ToString());
- }
- }
- //循环中盒号的个数,取当前出入库单最大 的中盒号+1
- for (int j = 0; j < mid_num; j++)
- {
- //获取中盘的编号
- string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+" + (j + 1), "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
- //如果尾数不为0,并且已经遍历到了最后一箱(未装满的箱)
- int count = 0;
- int AddNum = pr_zxbzs;
- if (mid_remain != 0 && j + 1 == mid_num)
- {
- //剩下的尾数刚好够整数的最小包或者加上一个未装满的最小包
- count = mid_remain % pr_zxbzs == 0 ? mid_remain / pr_zxbzs : (mid_remain / pr_zxbzs) + 1;
- }
- else
- {
- //循环中盒的箱内容量
- count = mid_qty;
- }
- for (int k = 0; k < count; k++)
- {
- //将箱号添加进List
- barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
- midcode.Add(mid_code);
- if (mid_remain % pr_zxbzs != 0 && k + 1 == count && j + 1 == mid_num)
- AddNum = mid_remain % pr_zxbzs;
- pib_inqty.Add(AddNum.ToString());
- }
- }
- if (barcode.Count > 0)
- {
- //插入条码
- sql.Clear();
- sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_CUSTBARCODE,PIB_PDNO,");
- sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,PIB_PRODID,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,PIB_CUSTPO,pib_orderdetno)");
- sql.Append(" values (prodiobarcode_seq.nextval,'" + pd_prodcode + "',sysdate,'" + pi_inoutno.Text + "'," + pi_id + ",'" + pr_brand + "',:barcode,:custbarcode,'" + pd_pdno + "','" + pd_id + "',");
- sql.Append("'" + pi_class.Text + "',:pib_inqty,'" + pr_id + "',0,0,'" + pd_ordercode + "','','" + pd_orderdetno + "')");
- dh.BatchInsert(sql.ToString(), new string[] { "barcode", "custbarcode", "pib_inqty"}, barcode.ToArray(), custbarcode.ToArray(), pib_inqty.ToArray());
- //更新最大流水号
- dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
- }
- else
- {
- ErrRowIndex += (i + 1) + ",";
- }
- }
- }
- if (ErrRowIndex != "")
- {
- MessageBox.Show(ErrRowIndex + "行无可用条码,请检查本次数量");
- return;
- }
- if (CheckedRowCount > 0)
- {
- LoadData();
- MessageBox.Show("生成条码成功!");
- }
- else
- {
- MessageBox.Show("未勾选需要生成的明细!");
- }
- //如果含有内容不符合的选项,进行提示
- string str = "";
- foreach (string ss in NotPass.Values)
- {
- str += ss + "\n";
- }
- if (str != "")
- MessageBox.Show(str);
- }
- //生成唯一条码
- public string BarcodeMethod1(string pd_id, string pr_id, string pib_barcode)
- {
- if (pib_barcode != "")
- {
- if (FirstCode)
- {
- serialnum = serialnum + 1;
- }
- //第一次的时候去获取数据库查询出来的值
- else
- {
- serialnum = int.Parse(pib_barcode.Substring(pib_barcode.Length - 4)) + 1;
- FirstCode = true;
- }
- }
- else
- {
- serialnum = serialnum + 1;
- }
- string serialcode = serialnum.ToString();
- for (int i = serialnum.ToString().Length; i < 4; i++)
- {
- serialcode = "0" + serialcode;
- }
- return pd_id + "-" + pr_id + "-" + serialcode;
- }
- //生成客户条码
- public string BarcodeMethod1(string Prefix, string Suffix, int Index, int Length, int radix)
- {
- string str = Prefix;
- //如果是流水则需要在前面加0
- string serialcode = BaseUtil.DToAny(custserialnum, radix);
- for (int j = serialcode.ToString().Length; j < Length; j++)
- {
- serialcode = "0" + serialcode;
- }
- str += serialcode;
- str += Suffix;
- custserialnum = custserialnum + 1;
- return str;
- }
- private static string lpad(int length, string number)
- {
- while (number.Length < length)
- {
- number = "0" + number;
- }
- number = number.Substring(number.Length - length, length);
- return number;
- }
- /// <summary>
- /// 重绘指定列的背景色
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ProdIoInfDGV_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
- {
- bool mouseOver = e.CellBounds.Contains(this.PointToClient(Cursor.Position));
- if (e.ColumnIndex > 0)
- if (ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pr_zxbzs" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pd_qty" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "mid_qty" || ProdIoInfDGV.Columns[e.ColumnIndex].Name == "pib_restqty1")
- {
- SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
- e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
- Rectangle border = e.CellBounds;
- border.Width -= 1;
- e.Graphics.DrawRectangle(Pens.White, border);
- e.PaintContent(e.CellBounds);
- e.Handled = true;
- }
- }
- /// <summary>
- /// 计算中盘尾数的方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ProdIoInfDGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
- {
- object pr_zxbzs = ProdIoInfDGV.Rows[e.RowIndex].Cells["pr_zxbzs"].Value;
- object pd_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value;
- object mid_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_qty"].Value;
- object pd_totalqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_totalqty"].Value;
- int restqty1 = 0;
- if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString() != "")
- {
- string[] restqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString().Split(',');
- for (int k = 0; k < restqty.Length; k++)
- {
- int qty = 0;
- int.TryParse(restqty[k], out qty);
- restqty1 += qty;
- }
- }
- if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
- {
- int 最小包装量 = int.Parse(pr_zxbzs.ToString());
- int 中盘容量 = int.Parse(mid_qty.ToString());
- int 本次数量 = int.Parse(pd_qty.ToString());
- int 总数 = int.Parse(pd_totalqty.ToString());
- if (最小包装量 > 0)
- {
- if (本次数量 > 总数)
- {
- MessageBox.Show("本次数量不能大于总数");
- return;
- }
- if (中盘容量 <= 0 || 最小包装量 <= 0)
- {
- MessageBox.Show("中盘容量和单盘数量必须是正整数");
- return;
- }
- //计算中盘数量
- int mid_num = (本次数量 - restqty1) / (最小包装量 * 中盘容量);
- //计算中盘尾数
- if (((本次数量 - restqty1)) % (最小包装量 * 中盘容量) == 0)
- ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num;
- else
- ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_num"].Value = mid_num + 1;
- ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_remain"].Value = 本次数量 - restqty1 - mid_num * 最小包装量 * 中盘容量;
- }
- }
- }
- //设置全部中盒容量
- private void SetMidCapacity_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < ProdIoInfDGV.Rows.Count; i++)
- {
- int restqty1 = 0;
- if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
- {
- string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
- for (int k = 0; k < restqty.Length; k++)
- {
- int qty = 0;
- int.TryParse(restqty[k], out qty);
- restqty1 += qty;
- }
- }
- ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value = MidCapacity.Text;
- if (ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["pd_qty"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value.ToString() != "" && ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value.ToString() != "0")
- {
- object pr_zxbzs = ProdIoInfDGV.Rows[i].Cells["pr_zxbzs"].Value;
- object pd_qty = ProdIoInfDGV.Rows[i].Cells["pd_qty"].Value;
- object mid_qty = ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value;
- object pd_totalqty = ProdIoInfDGV.Rows[i].Cells["pd_totalqty"].Value;
- if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
- {
- int 最小包装量 = int.Parse(pr_zxbzs.ToString());
- int 中盘容量 = int.Parse(mid_qty.ToString());
- int 本次数量 = int.Parse(pd_qty.ToString());
- int 总数 = int.Parse(pd_totalqty.ToString());
- //计算中盘数量
- int mid_num = (本次数量 - restqty1) / (最小包装量 * 中盘容量);
- //计算中盘尾数
- if (((本次数量 - restqty1)) % (最小包装量 * 中盘容量) == 0)
- ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = mid_num;
- else
- ProdIoInfDGV.Rows[i].Cells["mid_num"].Value = mid_num + 1;
- ProdIoInfDGV.Rows[i].Cells["mid_remain"].Value = (本次数量 - restqty1) - mid_num * 最小包装量 * 中盘容量;
- }
- }
- }
- }
- private void LoadData()
- {
- //获取客户编号
- CustCode = dh.getFieldDataByCondition("ProdInOut", "pi_cardcode", "pi_inoutno='" + pi_inoutno.Text + "'").ToString();
- //用于存放每一项的明细的数据
- dt = (DataTable)dh.ExecuteSql("select pi_class,pi_id from prodinout where pi_inoutno='" + pi_inoutno.Text + "'", "select");
- if (dt.Rows.Count > 0)
- {
- pi_id = dt.Rows[0]["pi_id"].ToString();
- BaseUtil.SetFormValue(this.Controls, dt);
- //查询出入库的类型
- dt = (DataTable)dh.ExecuteSql("select ds_inorout from documentsetup where ds_name='" + pi_class.Text + "'", "select");
- sql.Clear();
- sql.Append("select '' pib_restqty1,pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty pd_totalqty,pd_ordercode,pd_orderdetno,pd_pdno, ");
- sql.Append("pd_prodcode,pd_piclass,pd_qty from (select pd_piid,pd_id,pr_id,pr_brand,pr_unit,pr_detail,pr_spec,pr_zxbzs,outqty,pd_ordercode,pd_orderdetno,pd_pdno,pd_prodcode,pd_piclass,");
- sql.Append("outqty-nvl((select sum(nvl(pib_qty,0)) from PRODIOBARCODE where PIB_PIID=pd_piid and pib_pdno=pd_pdno),0)pd_qty from (select pd_piid,min(pd_id) pd_id,sum(pd_outqty)outqty, ");
- sql.Append("pd_ordercode,pd_orderdetno,pd_pdno,max(pd_prodcode)pd_prodcode,max(pd_piclass)pd_piclass from prodiodetail where pd_piclass='出货单' group by pd_piid,pd_ordercode,pd_orderdetno,pd_pdno)T ");
- sql.Append("left join product on pr_code=pd_prodcode where nvl(pr_zxbzs,0)>0) where pd_piid='" + pi_id + "'");
- dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
- BaseUtil.FillDgvWithDataTable(ProdIoInfDGV, dt);
- }
- else
- {
- MessageBox.Show("当前单据不存在");
- pi_inoutno.Text = "";
- }
- }
- private void ResetSerialNum_Click(object sender, EventArgs e)
- {
- dt = (DataTable)dh.ExecuteSql("select pi_class,pi_id from prodinout where pi_inoutno='" + pi_inoutno.Text + "'", "select");
- if (dt.Rows.Count > 0)
- {
- if (NrCode != "")
- {
- dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber=1", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
- MessageBox.Show("流水重置成功");
- }
- else
- MessageBox.Show("当前客户无对应条码规则");
- }
- else
- {
- MessageBox.Show("当前单据不存在");
- pi_inoutno.Text = "";
- }
- }
- }
- }
|