|
|
@@ -29,10 +29,7 @@ namespace UAS_LabelMachine
|
|
|
SqliteDBHelper sdh;
|
|
|
|
|
|
DataTable dt;
|
|
|
- /// <summary>
|
|
|
- /// 已经打印过的Vivo外箱号
|
|
|
- /// </summary>
|
|
|
- List<string> PrintedVivoOutboxCode = new List<string>();
|
|
|
+
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
/// <summary>
|
|
|
/// CodeSoft新建打印机引擎
|
|
|
@@ -96,6 +93,9 @@ namespace UAS_LabelMachine
|
|
|
/// BarTender引擎
|
|
|
/// </summary>
|
|
|
Engine engine;
|
|
|
+ LabelFormatDocument EmptySingleFormat;
|
|
|
+
|
|
|
+ LabelFormatDocument EmptyOutFormat;
|
|
|
/// <summary>
|
|
|
/// BarTender单盘
|
|
|
/// </summary>
|
|
|
@@ -156,6 +156,10 @@ namespace UAS_LabelMachine
|
|
|
public static DataTable Attach;
|
|
|
|
|
|
public string PrintMethod = "CodeSoft";
|
|
|
+ /// <summary>
|
|
|
+ /// 用于记录外箱号和当前的箱号进行比对,判断当前行和上一行是否是同一个箱号,从而判断是否要打印空白页
|
|
|
+ /// </summary>
|
|
|
+ public string Last_OutboxCode = "";
|
|
|
|
|
|
public UAS_出货标签打印(string Master)
|
|
|
{
|
|
|
@@ -246,6 +250,11 @@ namespace UAS_LabelMachine
|
|
|
asc.controlAutoSize(this);
|
|
|
string Code = dh.GetConfig("PrintMethod", "CodeOrBar").ToString();
|
|
|
SystemInf.CheckDcAndLotNo = dh.GetConfig("PrintCheck", "CheckDcAndLotNo").ToString() == "" ? false : true;
|
|
|
+ if (dh.GetConfig("isSpeac", "LabelSpace").ToString() == "" ? false : true)
|
|
|
+ {
|
|
|
+ LabelSpace.Visible = true;
|
|
|
+ LabelSpace.Checked = true;
|
|
|
+ }
|
|
|
if (Code == "")
|
|
|
{
|
|
|
try
|
|
|
@@ -525,6 +534,7 @@ namespace UAS_LabelMachine
|
|
|
if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value.ToString())
|
|
|
{
|
|
|
string pibid = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
+ string outboxcode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
dt.Rows[i]["pib_lotno"] = lotno;
|
|
|
dt.Rows[i]["pib_datecode"] = datecode;
|
|
|
dt.Rows[i]["pib_year"] = year;
|
|
|
@@ -538,7 +548,7 @@ namespace UAS_LabelMachine
|
|
|
CurrentRowIndex = i;
|
|
|
if (SingleLabelAutoPrint.Checked)
|
|
|
{
|
|
|
- AutoPrintSingleLabel(pibid);
|
|
|
+ AutoPrintSingleLabel(pibid, outboxcode);
|
|
|
}
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
AutoPrintMidLabel();
|
|
|
@@ -547,6 +557,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
pibid1.Append("1");
|
|
|
sdh.ExecuteSql("update prodiobarcode set pib_ifpick=-1,pib_lotno='" + lotno + "',pib_datecode='" + datecode + "',pib_year='" + year + "',pib_month='" + month + "',pib_day='" + day + "' where pib_id in (" + pibid1 + ")", "update");
|
|
|
+ Last_OutboxCode = "";
|
|
|
}
|
|
|
else if (CollectionUnit.Text == "全部")
|
|
|
{
|
|
|
@@ -583,7 +594,8 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (SingleLabelCombox.SelectedValue != null)
|
|
|
{
|
|
|
- AutoPrintSingleLabel(LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString());
|
|
|
+ AutoPrintSingleLabel(LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value.ToString());
|
|
|
+ Last_OutboxCode = "";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -656,12 +668,31 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void AutoPrintSingleLabel(string pib_id)
|
|
|
+ private void AutoPrintSingleLabel(string pib_id, string outboxcode)
|
|
|
{
|
|
|
+ bool PrintBlankLabel = false;
|
|
|
if (PrintMethod == "CodeSoft")
|
|
|
Print.CodeSoft.SinglePrint(SingleDoc, SingleLabelParam, pib_id);
|
|
|
else
|
|
|
+ {
|
|
|
+ //第一箱不打印空标签
|
|
|
+ if (outboxcode != "" && Last_OutboxCode == "")
|
|
|
+ {
|
|
|
+ PrintBlankLabel = false;
|
|
|
+ }
|
|
|
+ //如果外箱不相等
|
|
|
+ else if (outboxcode != "" && Last_OutboxCode != "" && outboxcode != Last_OutboxCode)
|
|
|
+ {
|
|
|
+ PrintBlankLabel = true;
|
|
|
+ }
|
|
|
+ Last_OutboxCode = outboxcode;
|
|
|
+ //打印一张空白标签
|
|
|
+ if (LabelSpace.Checked && PrintBlankLabel)
|
|
|
+ {
|
|
|
+ Print.BarTender.SinglePrint(EmptySingleFormat, SingleLabelParam, "-1");
|
|
|
+ }
|
|
|
Print.BarTender.SinglePrint(SingleFormat, SingleLabelParam, pib_id);
|
|
|
+ }
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
sdh.ExecuteSql("update prodiobarcode set pib_ifprint=-1 where pib_id='" + pib_id + "'", "update");
|
|
|
}
|
|
|
@@ -1008,6 +1039,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
SingleDoc = lbl.Documents.Open(ftpOperater.DownLoadTo + SingleLabelCombox.Text);
|
|
|
SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1097,6 +1129,24 @@ namespace UAS_LabelMachine
|
|
|
OutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
|
|
|
}
|
|
|
OutLabelParam = (DataTable)dh.ExecuteSql("select lp_name,lp_sql,lp_valuetype from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + OutBoxCombox.SelectedValue.ToString().Split('#')[0], "select");
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ //打开空标签文件
|
|
|
+ if (EmptySingleFormat == null)
|
|
|
+ {
|
|
|
+ EmptySingleFormat = engine.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\Empty.btw");
|
|
|
+ EmptySingleFormat.PrintSetup.PrinterName = SingleLabelPrinter.Text;
|
|
|
+ }
|
|
|
+ if (EmptyOutFormat == null)
|
|
|
+ {
|
|
|
+ EmptyOutFormat = engine.Documents.Open(System.Windows.Forms.Application.StartupPath + @"\Empty1.btw");
|
|
|
+ EmptyOutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+
|
|
|
}
|
|
|
//缓存外箱参数
|
|
|
ComBoxClickChangeLabelDoc = true;
|
|
|
@@ -1222,7 +1272,8 @@ namespace UAS_LabelMachine
|
|
|
try
|
|
|
{
|
|
|
string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
|
|
|
- AutoPrintSingleLabel(pib_id);
|
|
|
+ string outboxcode = LabelInf.Rows[i].Cells["pib_outboxcode2"].Value.ToString();
|
|
|
+ AutoPrintSingleLabel(pib_id, outboxcode);
|
|
|
if (MidLabelAutoPrint.Checked)
|
|
|
{
|
|
|
//判断当前行的盒号和下一行不相等或者已经是最后一行了
|
|
|
@@ -1244,6 +1295,7 @@ namespace UAS_LabelMachine
|
|
|
catch (Exception ex) { LogManager.DoLog(ex.Message); }
|
|
|
}
|
|
|
}
|
|
|
+ Last_OutboxCode = "";
|
|
|
dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
|
|
|
if (CheckedRowCount == 0)
|
|
|
MessageBox.Show("未勾选打印明细!");
|
|
|
@@ -1502,7 +1554,13 @@ namespace UAS_LabelMachine
|
|
|
if (PrintMethod == "CodeSoft")
|
|
|
Print.CodeSoft.OutPrint(OutBoxDoc, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2, cu_print_outprod.Checked, cu_print_outpo.Checked, cu_print_outdc.Checked, cu_print_outlotno.Checked, cu_print_ordercode.Checked);
|
|
|
else
|
|
|
+ {
|
|
|
Print.BarTender.OutPrint(OutFormat, OutLabelParam, pi_inoutno.Text, pib_id, pib_outboxcode2, cu_print_outprod.Checked, cu_print_outpo.Checked, cu_print_outdc.Checked, cu_print_outlotno.Checked, cu_print_ordercode.Checked);
|
|
|
+ if (LabelSpace.Checked)
|
|
|
+ {
|
|
|
+ Print.BarTender.OutPrint(EmptyOutFormat, OutLabelParam, pi_inoutno.Text, pib_id, "-1", cu_print_outprod.Checked, cu_print_outpo.Checked, cu_print_outdc.Checked, cu_print_outlotno.Checked, cu_print_ordercode.Checked);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void CleanDetail_Click(object sender, EventArgs e)
|
|
|
@@ -1965,6 +2023,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
SingleFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(SingleLabelCombox.SelectedValue.ToString().Split('#')[1], SingleLabelCombox.Text, time));
|
|
|
SingleFormat.PrintSetup.PrinterName = SingleLabelPrinter.Text;
|
|
|
+ EmptySingleFormat.PrintSetup.PrinterName = SingleLabelPrinter.Text;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2033,6 +2092,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
OutFormat = engine.Documents.Open(BaseUtil.GetLabelUrl(OutBoxCombox.SelectedValue.ToString().Split('#')[1], OutBoxCombox.Text, time));
|
|
|
OutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
|
|
|
+ EmptyOutFormat.PrintSetup.PrinterName = OutBoxPrinter.Text;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -2377,21 +2437,21 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
|
|
|
//前缀
|
|
|
- string Prefix = "";
|
|
|
+ public static string Prefix = "";
|
|
|
//后缀
|
|
|
- string Suffix = "";
|
|
|
+ public static string Suffix = "";
|
|
|
//编码规则编号
|
|
|
- string NrCode = "";
|
|
|
+ public static string NrCode = "";
|
|
|
|
|
|
- string PrefixFixed = "";
|
|
|
+ public static string PrefixFixed = "";
|
|
|
//流水号的索引
|
|
|
- int SerialNumIndex = 0;
|
|
|
+ public static int SerialNumIndex = 0;
|
|
|
//流水长度
|
|
|
- int SerialNumLength = 0;
|
|
|
+ public static int SerialNumLength = 0;
|
|
|
//存放键值对
|
|
|
- int Radix = 10;
|
|
|
+ public static int Radix = 10;
|
|
|
//客户的流水号
|
|
|
- int custserialnum = 0;
|
|
|
+ public static int custserialnum = 0;
|
|
|
|
|
|
public void GetCustRule()
|
|
|
{
|
|
|
@@ -2495,298 +2555,8 @@ namespace UAS_LabelMachine
|
|
|
try
|
|
|
{
|
|
|
GetCustRule();
|
|
|
- //获取最大的流水号
|
|
|
- DataTable dt = ExcelHandler.ExcelToDataTable(ImportExcel.FileName, true);
|
|
|
- if (dt == null)
|
|
|
- {
|
|
|
- MessageBox.Show("文件" + ImportExcel.FileName + "被占用或者格式不正确");
|
|
|
- return;
|
|
|
- }
|
|
|
- string outsql = "";
|
|
|
- LogicHandler.GenerateBarCode(PI_ID, cu_code.Text, out outsql);
|
|
|
- sql.Clear();
|
|
|
- sql.Append(outsql);
|
|
|
- DataTable dt1 = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
- //需要插入的参数
|
|
|
- ArrayList<string> barcode = new ArrayList<string>();
|
|
|
- ArrayList<string> custbarcode = new ArrayList<string>();
|
|
|
- ArrayList<string> datecode = new ArrayList<string>();
|
|
|
- ArrayList<string> lotno = new ArrayList<string>();
|
|
|
- ArrayList<string> pib_inqty = new ArrayList<string>();
|
|
|
- ArrayList<string> piboutboxcode2 = new ArrayList<string>();
|
|
|
- ArrayList<string> pdordercode = new ArrayList<string>();
|
|
|
- ArrayList<string> pdorderdetno = new ArrayList<string>();
|
|
|
- ArrayList<string> pdpdno = new ArrayList<string>();
|
|
|
- ArrayList<string> pdid = new ArrayList<string>();
|
|
|
- ArrayList<string> prbrand = new ArrayList<string>();
|
|
|
- ArrayList<string> pdprodcode = new ArrayList<string>();
|
|
|
- ArrayList<string> pib_custoutboxcode = new ArrayList<string>();
|
|
|
- ArrayList<string> brand = new ArrayList<string>();
|
|
|
- ArrayList<string> madein = new ArrayList<string>();
|
|
|
- ArrayList<string> prdetail = new ArrayList<string>();
|
|
|
- ArrayList<string> ordercode = new ArrayList<string>();
|
|
|
- ArrayList<string> size = new ArrayList<string>();
|
|
|
- ArrayList<string> weight = new ArrayList<string>();
|
|
|
- //用于数量的校验
|
|
|
- Dictionary<string, decimal> sumqty = new Dictionary<string, decimal>();
|
|
|
- Dictionary<string, Dictionary<string, decimal>> outsumqty = new Dictionary<string, Dictionary<string, decimal>>();
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
- {
|
|
|
- string pr_spec = dt.Rows[i]["规格型号"].ToString().Trim();
|
|
|
- if (pr_spec.Trim() == "")
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- string qty = Regex.Replace(dt.Rows[i]["数量"].ToString(), @"[^\d]*", ""); ;
|
|
|
- //累计Excel该型号的数量
|
|
|
- if (!sumqty.ContainsKey(pr_spec))
|
|
|
- {
|
|
|
- sumqty.Add(pr_spec, 0);
|
|
|
- }
|
|
|
- //累计Excel该型号的数量
|
|
|
- sumqty[pr_spec] += decimal.Parse(qty);
|
|
|
- }
|
|
|
- for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
- {
|
|
|
- //不包含型号则进行添加
|
|
|
- string pr_spec = dt1.Rows[i]["pr_spec"].ToString().Trim();
|
|
|
- string pd_pdno = dt1.Rows[i]["pd_pdno"].ToString();
|
|
|
- decimal pd_outqty = decimal.Parse(dt1.Rows[i]["pd_outqty"].ToString());
|
|
|
- if (!outsumqty.ContainsKey(pr_spec))
|
|
|
- {
|
|
|
- Dictionary<string, decimal> dic = new Dictionary<string, decimal>();
|
|
|
- dic.Add(pd_pdno, pd_outqty);
|
|
|
- outsumqty.Add(pr_spec, dic);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- outsumqty[pr_spec].Add(pd_pdno, pd_outqty);
|
|
|
- }
|
|
|
- }
|
|
|
- //上一个的最小外箱号,如果箱号没有发生变化则外箱条码也不变化
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
- {
|
|
|
- string pr_spec = dt.Rows[i]["规格型号"].ToString().Trim();
|
|
|
- string 品牌 = dt.Rows[i]["品牌"].ToString().Trim();
|
|
|
- string 产地 = dt.Rows[i]["产地"].ToString().Trim();
|
|
|
- string 尺寸 = dt.Rows[i]["尺寸"].ToString().Trim();
|
|
|
- string 重量 = dt.Rows[i]["重量"].ToString().Trim();
|
|
|
- string 产品名称 = dt.Rows[i]["产品名称"].ToString().Trim();
|
|
|
- string 订单编号 = dt.Rows[i]["订单编号"].ToString().Trim();
|
|
|
- if (pr_spec.Trim() == "")
|
|
|
- {
|
|
|
- break;
|
|
|
- }
|
|
|
- string qty = dt.Rows[i]["数量"].ToString();
|
|
|
- string DateCode = "";
|
|
|
- string LotNo = "";
|
|
|
- if (dt.Columns.Contains("DC/LOT NO"))
|
|
|
- {
|
|
|
- if (dt.Rows[i]["DC/LOT NO"].ToString().IndexOf("-") > 0)
|
|
|
- {
|
|
|
- DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[0];
|
|
|
- LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split('-')[1];
|
|
|
- }
|
|
|
- else if (dt.Rows[i]["DC/LOT NO"].ToString().IndexOf(" ") > 0)
|
|
|
- {
|
|
|
- DateCode = dt.Rows[i]["DC/LOT NO"].ToString().Split(' ')[0];
|
|
|
- LotNo = dt.Rows[i]["DC/LOT NO"].ToString().Split(' ')[1];
|
|
|
- }
|
|
|
- }
|
|
|
- if (dt.Columns.Contains("DC") && DateCode == "")
|
|
|
- {
|
|
|
- DateCode = dt.Rows[i]["DC"].ToString();
|
|
|
- }
|
|
|
- if (dt.Columns.Contains("LOT NO") && LotNo == "")
|
|
|
- {
|
|
|
- LotNo = dt.Rows[i]["LOT NO"].ToString();
|
|
|
- }
|
|
|
- string pib_outboxcode2 = dt.Rows[i]["箱号"].ToString();
|
|
|
- DataRow[] dr = dt1.Select("pr_spec='" + pr_spec + "'");
|
|
|
- if (dr.Length == 0)
|
|
|
- {
|
|
|
- LogicHandler.FilterData(cu_code.Text, "FUDAN", pr_spec, qty, DateCode, LotNo, out pr_spec, out qty, out DateCode, out LotNo);
|
|
|
- dr = dt1.Select("pr_spec='" + pr_spec + "'");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LogicHandler.FilterData(cu_code.Text, dr[0]["pr_brand"].ToString(), pr_spec, qty, DateCode, LotNo, out pr_spec, out qty, out DateCode, out LotNo);
|
|
|
- }
|
|
|
- if (dr.Length == 0)
|
|
|
- {
|
|
|
- MessageBox.Show("出货单" + pi_inoutno.Text + "不包含型号" + pr_spec);
|
|
|
- return;
|
|
|
- }
|
|
|
- decimal outqty = decimal.Parse(Regex.Replace(qty, @"[^\d]*", ""));
|
|
|
- for (int k = 0; k < dr.Length; k++)
|
|
|
- {
|
|
|
- string pd_orderdetno = dr[k]["pd_orderdetno"].ToString();
|
|
|
- string pd_prodcode = dr[k]["pd_prodcode"].ToString();
|
|
|
- string pd_ordercode = dr[k]["pd_ordercode"].ToString();
|
|
|
- string pd_piid = dr[k]["pd_piid"].ToString();
|
|
|
- string pr_brand = dr[k]["pr_brand"].ToString();
|
|
|
- string pd_pdno = dr[k]["pd_pdno"].ToString();
|
|
|
- string pd_id = dr[k]["pd_id"].ToString();
|
|
|
- string pd_piclass = dr[k]["pd_piclass"].ToString();
|
|
|
- string pr_id = dr[k]["pr_id"].ToString();
|
|
|
- string pr_madein = dr[k]["pr_madein"].ToString();
|
|
|
- //已导入数量
|
|
|
- decimal zxbzs = decimal.Parse(dr[k]["pr_zxbzs"].ToString());
|
|
|
- decimal pd_outqty = 0;
|
|
|
- decimal barcodenum = 0;
|
|
|
- if (outsumqty[pr_spec][pd_pdno] == 0)
|
|
|
- {
|
|
|
- continue;
|
|
|
- }
|
|
|
- //如果导入行的数量小于改明细的出货数量
|
|
|
- if (outsumqty[pr_spec][pd_pdno] >= outqty)
|
|
|
- {
|
|
|
- //使用导入明细行数量
|
|
|
- pd_outqty = outqty;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ////使用该出货单明细行数量,并且数量置为0
|
|
|
- pd_outqty = outsumqty[pr_spec][pd_pdno];
|
|
|
- }
|
|
|
- string pib_barcode = dh.getFieldDataByCondition("prodiobarcode", "max(pib_barcode)", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
|
|
|
- if (pd_outqty % zxbzs != 0)
|
|
|
- {
|
|
|
- barcodenum = Math.Floor(pd_outqty / zxbzs) + 1;
|
|
|
- //如果有余数先加上所有最小包最后加尾数
|
|
|
- for (int j = 0; j < barcodenum - 1; j++)
|
|
|
- {
|
|
|
- barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
- pib_custoutboxcode.Add(pib_outboxcode2);
|
|
|
- piboutboxcode2.Add(pib_outboxcode2);
|
|
|
- pib_inqty.Add(zxbzs);
|
|
|
- datecode.Add(DateCode);
|
|
|
- lotno.Add(LotNo);
|
|
|
- pdordercode.Add(订单编号 == "" ? pd_ordercode : 订单编号);
|
|
|
- pdorderdetno.Add(pd_orderdetno);
|
|
|
- pdpdno.Add(pd_pdno);
|
|
|
- pdid.Add(pd_id);
|
|
|
- prbrand.Add(品牌 == "" ? pr_brand : 品牌);
|
|
|
- madein.Add(产地 == "" ? pr_madein : 产地);
|
|
|
- size.Add(尺寸);
|
|
|
- weight.Add(重量);
|
|
|
- prdetail.Add(产品名称);
|
|
|
- ordercode.Add(订单编号);
|
|
|
- pdprodcode.Add(pd_prodcode);
|
|
|
- }
|
|
|
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
- pib_custoutboxcode.Add(pib_outboxcode2);
|
|
|
- barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- pib_inqty.Add(pd_outqty % zxbzs);
|
|
|
- piboutboxcode2.Add(pib_outboxcode2);
|
|
|
- datecode.Add(DateCode);
|
|
|
- lotno.Add(LotNo);
|
|
|
- pdordercode.Add(订单编号 == "" ? pd_ordercode : 订单编号);
|
|
|
- pdorderdetno.Add(pd_orderdetno);
|
|
|
- pdpdno.Add(pd_pdno);
|
|
|
- pdid.Add(pd_id);
|
|
|
- prbrand.Add(品牌 == "" ? pr_brand : 品牌);
|
|
|
- madein.Add(产地 == "" ? pr_madein : 产地);
|
|
|
- size.Add(尺寸);
|
|
|
- weight.Add(重量);
|
|
|
- prdetail.Add(产品名称);
|
|
|
- ordercode.Add(订单编号);
|
|
|
- pdprodcode.Add(pd_prodcode);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- barcodenum = pd_outqty / zxbzs;
|
|
|
- for (int j = 0; j < barcodenum; j++)
|
|
|
- {
|
|
|
- barcode.Add(BaseUtil.BarcodeMethod1(pd_id, pr_id, pib_barcode));
|
|
|
- custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
|
|
|
- pib_custoutboxcode.Add(pib_outboxcode2);
|
|
|
- pib_inqty.Add(zxbzs);
|
|
|
- piboutboxcode2.Add(pib_outboxcode2);
|
|
|
- datecode.Add(DateCode);
|
|
|
- lotno.Add(LotNo);
|
|
|
- pdordercode.Add(订单编号 == "" ? pd_ordercode : 订单编号);
|
|
|
- pdorderdetno.Add(pd_orderdetno);
|
|
|
- pdpdno.Add(pd_pdno);
|
|
|
- pdid.Add(pd_id);
|
|
|
- prbrand.Add(品牌 == "" ? pr_brand : 品牌);
|
|
|
- madein.Add(产地 == "" ? pr_madein : 产地);
|
|
|
- size.Add(尺寸);
|
|
|
- weight.Add(重量);
|
|
|
- prdetail.Add(产品名称);
|
|
|
- pdprodcode.Add(pd_prodcode);
|
|
|
- }
|
|
|
- }
|
|
|
- outqty -= outsumqty[pr_spec][pd_pdno];
|
|
|
- outsumqty[pr_spec][pd_pdno] -= pd_outqty;
|
|
|
- }
|
|
|
- }
|
|
|
- string Lastoutbox = "";
|
|
|
- string Lastoutboxcode = "";
|
|
|
- List<string> custoutboxcode = new List<string>();
|
|
|
- //根据记录的箱号,在料盘的流水之后拼接外箱的流水
|
|
|
- for (int i = 0; i < pib_custoutboxcode.Count; i++)
|
|
|
- {
|
|
|
- if (Lastoutbox != pib_custoutboxcode[i].ToString())
|
|
|
- {
|
|
|
- Lastoutboxcode = BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix);
|
|
|
- custoutboxcode.Add(Lastoutboxcode);
|
|
|
- Lastoutbox = pib_custoutboxcode[i].ToString();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- custoutboxcode.Add(Lastoutboxcode);
|
|
|
- }
|
|
|
- }
|
|
|
- //插叙所有的统计数量
|
|
|
- string ErrMsg = "";
|
|
|
- foreach (var item in sumqty)
|
|
|
- {
|
|
|
- dt = (DataTable)dh.ExecuteSql("select nvl(sum(pd_outqty),0)pd_outqty,pr_spec from prodiodetail left join product on pr_code=pd_prodcode where pd_piid='" + PI_ID + "' group by pr_spec", "select");
|
|
|
- dt1 = (DataTable)dh.ExecuteSql("select nvl(sum(pib_qty),0)pib_qty,pr_spec from prodiobarcode left join product on pib_prodcode=pr_code where pib_piid='" + PI_ID + "' group by pr_spec", "select");
|
|
|
- DataRow[] dr = dt.Select("pr_spec='" + item.Key + "'");
|
|
|
- DataRow[] dr1 = dt1.Select("pr_spec='" + item.Key + "'");
|
|
|
- if (dr.Length > 0)
|
|
|
- {
|
|
|
- decimal pd_outqty = decimal.Parse(dr[0]["pd_outqty"].ToString());
|
|
|
- decimal pib_qty = 0;
|
|
|
- //如果有已导入的数量
|
|
|
- if (dr1.Length > 0)
|
|
|
- {
|
|
|
- pib_qty = decimal.Parse(dr1[0]["pib_qty"].ToString());
|
|
|
- }
|
|
|
- //本次导入的数量和原有导入数量累加和出库数量做对比
|
|
|
- if (pd_outqty < item.Value + pib_qty)
|
|
|
- {
|
|
|
- ErrMsg += "型号" + dr[0]["pr_spec"].ToString() + "出货数量" + pd_outqty + ",已导入数量" + pib_qty + ",本次导入" + item.Value + ",超出数量" + (item.Value + pib_qty - pd_outqty) + "\n";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (ErrMsg == "")
|
|
|
- {
|
|
|
- if (pdprodcode.Count > 0)
|
|
|
- {
|
|
|
- sql.Clear();
|
|
|
- sql.Append("insert into prodiobarcode (PIB_ID,PIB_PRODCODE,pib_inman,PIB_INDATE,PIB_INOUTNO,PIB_PIID,pib_brand,PIB_BARCODE,PIB_PDNO,");
|
|
|
- sql.Append("PIB_PDID,PIB_PICLASS,PIB_QTY,pib_datecode,pib_lotno,PIB_IFPRINT,PIB_IFPICK,PIB_ORDERCODE,pib_orderdetno,");
|
|
|
- sql.Append("pib_outboxcode2,pib_custbarcode,pib_custoutboxcode,pib_madein,pib_size,pib_weight,pib_prdetail)values(prodiobarcode_seq.nextval,:pd_prodcode,'" + User.UserName + "',sysdate,");
|
|
|
- sql.Append("'" + pi_inoutno.Text + "'," + PI_ID + ",:pr_brand,:barcode,:pd_pdno,:pd_id,'" + pi_class.Text + "',:pib_inqty,");
|
|
|
- sql.Append(":pib_datecode,:pib_lotno,0,-1,:pd_ordercode,:pd_orderdetno,:outboxcode,:custbarcode,:pib_custoutboxcode,:pib_madein,:pib_size,:pib_weight,:pib_prdetail)");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "pd_prodcode", "pr_brand", "barcode", "pd_pdno", "pd_id", "pib_inqty", "pib_datecode", "pib_lotno", "pd_ordercode", "pd_orderdetno", "outboxcode", "custbarcode", "pib_custoutboxcode", "pib_madein", "pib_size", "pib_weight", "pib_prdetail" }, pdprodcode.ToArray(), prbrand.ToArray(), barcode.ToArray(), pdpdno.ToArray(), pdid.ToArray(), pib_inqty.ToArray(), datecode.ToArray(), lotno.ToArray(), pdordercode.ToArray(), pdorderdetno.ToArray(), piboutboxcode2.ToArray(), custbarcode.ToArray(), custoutboxcode.ToArray(), madein.ToArray(), size.ToArray(), weight.ToArray(), prdetail.ToArray());
|
|
|
- //更新流水
|
|
|
- dh.UpdateByCondition("RuleMaxNum", "rmn_maxnumber='" + custserialnum + "'", "rmn_nrcode='" + NrCode + "' and rmn_prefix='" + Prefix + "'");
|
|
|
- LoadGridData();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("解析数据不包含出货单数据,请重新导入", "提示");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show(ErrMsg, "超出数量提醒");
|
|
|
- }
|
|
|
+ LogicHandler.ImportExcel(SystemInf.Master, ImportExcel.FileName, PI_ID, pi_inoutno.Text, cu_code.Text);
|
|
|
+ LoadGridData();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|