public static void InsertOnLineCodes(string orderNO, NVBarcode.BarCode barcode, int current, int num) { string[] ss = { "", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000" }; for (int i = 1; i <= num - current; i++) { int crt = current + i; string sn = ss[barcode.snStr.Length - crt.ToString().Length] + crt.ToString(); //写入onLineCodes表 AddCode(orderNO, barcode.prefix + sn + barcode.suffix); } }
void BindOrder() { string dt = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetPrintInfo", orderNO); proc2 = JsonConvert.DeserializeObject <List <P_SSW_PrintList> >(dt); if (proc2.Count < 1) { MessageBox.Show("没有找到相应的工单"); } else { if (proc2[0].Template_id != null) { this.ktb_moduleName.Text = proc2[0].Template_id.ToString(); } else { MessageBox.Show("暂无打印模板,请添加模板", "提示"); return; } this.ktb_orderNO.Text = proc2[0].order_no.ToString(); //this.ktb_currentSN.Text = ((proc2[0].completed == null ? 0 : proc2[0].completed) + 1).ToString(); this.ktb_sy.Text = (proc2[0].qty - (proc2[0].completed == null ? 0 : proc2[0].completed)).ToString(); this.ktb_qty.Text = proc2[0].qty.ToString(); if (proc2[0].completed != null) { this.ktb_complete.Text = proc2[0].completed.ToString(); } else { this.ktb_complete.Text = "0"; } string MoudelId = this.ktb_moduleName.Text.ToString(); string mdl = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetTemplateInfo", MoudelId); proc1 = JsonConvert.DeserializeObject <List <P_SSW_TemplateList> >(mdl); this.ktb_currentSN.Text = proc1[0].currentSN.ToString(); this.pn = NVBarcode.PrintEngine6.GetPrintEngine(proc1[0].TemplatePath); string Mid = proc1[0].RuleStr.ToString(); NVBarcode.CodeRule coderule = Objs.SpecialRule.TransformRuleStr(Mid); //将特殊规则转成一般规则 barcode = coderule.GetCodeByRule(); //将规则转成条码 this.klb_barcode.Text += barcode.prefix + barcode.snStr + barcode.suffix; //if (mdl.CheckCode == 1) // this.klb_barcode.Text += "[C]"; //如果有校验码,则在最后加上[C]; //this.ktb_currentSN.Text = mdl.CurrentSN.ToString(); } }
//刷新 #region void BindOrderRu() { string dt = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetPrintInfo", orderNO); proc2 = JsonConvert.DeserializeObject <List <P_SSW_PrintList> >(dt); if (proc2.Count < 1) { MessageBox.Show("没有找到相应的工单"); } else { this.ktb_orderNO.Text = proc2[0].order_no.ToString(); this.kryptonTextBox1.Text = proc2[0].Template_id.ToString(); this.ktb_sy.Text = ((int)(proc2[0].qty - (proc2[0].completed == null ? 0 : proc2[0].completed))).ToString(); this.ktb_qty.Text = ((int)proc2[0].qty).ToString(); if (proc2[0].completed != null) { this.ktb_complete.Text = ((int)proc2[0].completed).ToString(); } else { this.ktb_complete.Text = "0"; } string MoudelId = this.kryptonTextBox1.Text.ToString(); string mdl = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetTemplateInfo", MoudelId); proc1 = JsonConvert.DeserializeObject <List <P_SSW_TemplateList> >(mdl); //this.ktb_currentSN.Text = proc1[0].currentSN.ToString(); NVBarcode.CodeRule coderule = Objs.SpecialRule.TransformRuleStr(Mid); //将特殊规则转成一般规则 barcode = coderule.GetCodeByRule(); //将规则转成条码 prefix = barcode.prefix; this.klb_barcode.Text += prefix + barcode.snStr + barcode.suffix; this.pn = NVBarcode.PrintEngine6.GetPrintEngine(proc1[0].TemplatePath); string PrintSn = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetPrint_currentSn", barcode.prefix + "," + barcode.suffix); PrintSnList = JsonConvert.DeserializeObject <List <P_Print_CurrentSN> >(PrintSn); this.ktb_currentSN.Text = PrintSnList[0].current_sn.ToString(); //if (mdl.CheckCode == 1) // this.klb_barcode.Text += "[C]"; //如果有校验码,则在最后加上[C]; } }
void BindOrder() { string dt = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetPrintInfo", orderNO); proc2 = JsonConvert.DeserializeObject <List <P_SSW_PrintList> >(dt); if (proc2.Count < 1) { MessageBox.Show("没有找到相应的工单"); } else { this.ktb_orderNO.Text = proc2[0].order_no.ToString(); this.kryptonTextBox1.Text = proc2[0].Template_id.ToString(); this.ktb_sy.Text = ((int)(proc2[0].qty - (proc2[0].completed == null ? 0 : proc2[0].completed))).ToString(); this.ktb_qty.Text = ((int)proc2[0].qty).ToString(); this.ktb_pNum.Text = Convert.ToDouble(ktb_sy.Text).ToString("#0"); if (proc2[0].completed != null) { this.ktb_complete.Text = ((int)proc2[0].completed).ToString(); } else { this.ktb_complete.Text = "0"; } string MoudelId = this.kryptonTextBox1.Text.ToString(); string mdl = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetTemplateInfo", MoudelId); proc1 = JsonConvert.DeserializeObject <List <P_SSW_TemplateList> >(mdl); Mid = proc1[0].RuleStr.ToString(); if (Mid.IndexOf("(") > -1) { string mainJson = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetMainOrderByOrderNo", orderNO); List <P_WorkOrder> workList = JsonConvert.DeserializeObject <List <P_WorkOrder> >(mainJson); string main_order = string.Empty; if (workList != null) { main_order = workList[0].main_order.ToString(); } PrintVari pv = new PrintVari(Mid, "", main_order); pv.ShowDialog(); Mid = pv.result; } NVBarcode.CodeRule coderule = Objs.SpecialRule.TransformRuleStr(Mid); //将特殊规则转成一般规则 barcode = coderule.GetCodeByRule(); //将规则转成条码 prefix = barcode.prefix; this.ktb_Pcopies.Text = "1"; this.klb_barcode.Text += prefix + barcode.snStr + barcode.suffix; this.pn = NVBarcode.PrintEngine6.GetPrintEngine(proc1[0].TemplatePath); string PrintSn = Toos.ServiceReferenceManager.GetClient().RunServerAPI("BLL.SSW", "GetPrint_currentSn", barcode.prefix + "," + barcode.suffix); PrintSnList = JsonConvert.DeserializeObject <List <P_Print_CurrentSN> >(PrintSn); if (PrintSnList != null) { this.ktb_currentSN.Text = PrintSnList[0].current_sn.ToString(); } else { this.ktb_currentSN.Text = "1"; } //if (mdl.CheckCode == 1) // this.klb_barcode.Text += "[C]"; //如果有校验码,则在最后加上[C]; } }