Ejemplo n.º 1
0
        public void loadResources(string custId, string delMatno, string boundType, string workno, string cusPo)
        {
            capacity = capacityService.queryByRelation(custId, delMatno, boundType);
            if (capacity != null)
            {
                this.countBoxQty(capacity.Capacityqty, workno, cusPo);
                this.textBox12.Text = capacity.Capacitydesc;
                this.textBox14.Text = capacity.Capacityqty.ToString();
            }

            codeRule = codeRuleService.queryRuleByCond(custId, delMatno, boundType);  //1代表Carton碼編碼規則
            if (codeRule != null)
            {
                this.textBox2.Text = codeRule.RuleDesc;
            }
            mandUnionFieldTypeList = manRelFieldTypeService.queryFieldListByCond(custId, delMatno, boundType);
            fileRelDel             = fileRelDelService.queryFileRelDelCusNo(custId, delMatno, boundType);
            //下載模板並預覽   1.查询模板是否存在, 若存在不下载  2.若不存在下载模板
            if (fileRelDel != null)
            {
                filePath = modelInfoService.previewModelFile(fileRelDel.FileNo);
                //if (filePath != null)
                //{
                //    string pictureFile = barPrint.PreviewPrintBC(filePath);
                //    this.pictureBox1.Load(pictureFile);
                //}
            }
        }
Ejemplo n.º 2
0
        public void loadResources(string custId, string delMatno, string boundType, string workno, string cusPo)
        {
            capacity = capacityService.queryByRelation(custId, delMatno, boundType);
            if (capacity != null)
            {
                this.countBoxQty(capacity.Capacityqty, workno, cusPo);
                //this.numericUpDown1.Value = getPrintCeiling(int.Parse(ctCodeInfo.Orderqty), int.Parse(ctCodeInfo.Woquantity));
                this.textBox16.Text   = capacity.Capacitydesc;
                this.textBox19.Text   = capacity.Capacityqty.ToString();
                ctCodeInfo.CapacityNo = capacity.Capacityno;
            }
            else
            {
                this.countBoxQty(1, workno, cusPo);
            }

            codeRule = codeRuleService.queryRuleByCond(custId, delMatno, boundType);  //1代表Carton碼編碼規則
            if (codeRule != null)
            {
                this.textBox15.Text = codeRule.RuleDesc;
                ctCodeInfo.Ruleno   = codeRule.Ruleno;
            }
            mandUnionFieldTypeList = manRelFieldTypeService.queryFieldListByCond(custId, delMatno, boundType);
            fileRelDel             = fileRelDelService.queryFileRelDelCusNo(custId, delMatno, boundType);
            //下載模板並預覽   1.查询模板是否存在, 若存在不下载  2.若不存在下载模板
            if (fileRelDel != null)
            {
                ctCodeInfo.Modelno = fileRelDel.FileNo;
                filePath           = modelInfoService.previewModelFile(fileRelDel.FileNo);
                if (filePath != null)
                {
                    string pictureFile = barPrint.PreviewPrintBC(filePath);
                    this.pictureBox1.Load(pictureFile);
                }
            }
        }
Ejemplo n.º 3
0
 private void textBox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "")
         {
             this.textBox1.Focus();
             return;
         }
         CTCode ctcode = ctCodeService.queryCTCodeByCtcode(this.textBox1.Text.Trim());
         if (ctcode == null)
         {
             this.textBox1.Text = "";
             this.textBox1.Focus();
             CommonAuxiliary.playFail();
             return;
         }
         if (cartonService.exists(ctcode.Ctcode))
         {
             MessageBox.Show("該CT碼已綁定,請檢查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.textBox1.Text = "";
             this.textBox1.Focus();
             CommonAuxiliary.playFail();
             return;
         }
         if (this.dataGridView1.Rows.Count == 0)
         {
             if (firstScan == null || !(firstScan.Workno.Equals(ctcode.Workno) && firstScan.Delmatno.Equals(ctcode.Delmatno) && firstScan.Cusno.Equals(ctcode.Cusno)))
             {
                 codeRule = codeRuleService.queryRuleByCond(ctcode.Cusno, ctcode.Delmatno, "1");  //1代表Carton碼編碼規則
                 if (codeRule == null)
                 {
                     MessageBox.Show("请联系管理员,绑定装箱单编码规则!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.textBox1.Text = "";
                     this.textBox1.Focus();
                     CommonAuxiliary.playFail();
                     return;
                 }
                 //查询标签模板
                 fileRelDel = fileRelDelService.queryFileRelDelCusNo(ctcode.Cusno, ctcode.Delmatno, "1");
                 if (fileRelDel == null)
                 {
                     MessageBox.Show("请联系管理员,绑定标签模板!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.textBox1.Text = "";
                     this.textBox1.Focus();
                     CommonAuxiliary.playFail();
                     return;
                 }
                 //查询标签参数信息
                 mandUnionFieldTypeList = manRelFieldTypeService.queryFieldListByCond(ctcode.Cusno, ctcode.Delmatno, "1");
                 if (mandUnionFieldTypeList == null)
                 {
                     MessageBox.Show("未找到該客戶出貨料號對應的打印字段規則信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.textBox1.Text = "";
                     this.textBox1.Focus();
                     CommonAuxiliary.playFail();
                     return;
                 }
                 //裝箱容量查詢
                 capacity = capacityService.queryByRelation(ctcode.Cusno, ctcode.Delmatno, "1");
                 if (capacity != null)
                 {
                     this.textBox11.Text = capacity.Capacityqty.ToString();
                     this.textBox12.Text = capacity.Capacitydesc;
                 }
                 firstScan = ctcode;
                 //下載模板並預覽   1.查询模板是否存在, 若存在不下载  2.若不存在下载模板
                 filePath = modelInfoService.previewModelFile(fileRelDel.FileNo);
             }
             firstScan = ctcode;
             initRow(ctcode);
             //初始化信息
             this.textBox2.Text = ctcode.Workno;
             this.textBox4.Text = ctcode.Woquantity;
             //根據工單號查詢已裝箱數量;
             this.textBox6.Text  = ctcode.Cusname;
             this.textBox7.Text  = ctcode.Cusno;
             this.textBox8.Text  = ctcode.Delmatno;
             this.textBox9.Text  = ctcode.Cusmatno;
             this.textBox13.Text = codeRule.RuleDesc;
             this.textBox5.Text  = cartonService.getCartonQtyByWO(ctcode.Workno);
             this.textBox14.Text = ctcode.Quantity.ToString();
             this.textBox3.Text  = this.dataGridView1.Rows.Count.ToString();
             this.label18.Text   = this.dataGridView1.Rows.Count.ToString();
             CommonAuxiliary.playSuccess();
             //if (filePath != null)
             //{
             //    string pictureFile = barPrint.PreviewPrintBC(filePath);
             //    this.pictureBox1.Load(pictureFile);
             //}
         }
         else
         {
             // 判断当前条码出货料号和工单以及客户编号是否一致
             if (ctcode.Workno.Trim().Equals(firstScan.Workno.Trim()) && ctcode.Delmatno.Equals(firstScan.Delmatno) && ctcode.Cusno.Equals(firstScan.Cusno))
             {
                 if (!checkRepeat(ctcode.Ctcode))
                 {
                     initRow(ctcode);
                     this.textBox3.Text  = this.dataGridView1.Rows.Count.ToString();
                     this.label18.Text   = this.dataGridView1.Rows.Count.ToString();
                     this.textBox14.Text = countQty(ctCodeList).ToString();
                     CommonAuxiliary.playSuccess();
                 }
                 else
                 {
                     this.textBox1.Text = "";
                     this.textBox1.Focus();
                     CommonAuxiliary.playFail();
                 }
             }
             else
             {
                 MessageBox.Show("底座条码工单/客户编号不一致,请检查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.textBox1.Text = "";
                 this.textBox1.Focus();
                 CommonAuxiliary.playFail();
                 return;
             }
         }
         if (capacity != null)
         {
             //扫码包装数量等于容量时打印标签
             if (countQty(ctCodeList) == capacity.Capacityqty)
             {
                 printCarton();
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "")
                {
                    this.textBox1.Focus();
                    return;
                }
                Carton carton = cartonService.queryCartonByCartonNo(this.textBox1.Text.Trim());
                if (carton != null)
                {
                    if (!carton.CartonStatus.Equals("0"))
                    {
                        MessageBox.Show("該裝箱單碼已綁定,請檢查!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.textBox1.Text = "";
                        this.textBox1.Focus();
                        return;
                    }
                    if (this.dataGridView1.Rows.Count == 0)
                    {
                        // 1.檢查是否綁定棧板模板
                        fileRelDel = fileRelDelService.queryFileRelDelCusNo(carton.Cusno, carton.Delmatno, "2");
                        if (fileRelDel == null)
                        {
                            MessageBox.Show("請聯繫管理員綁定標籤模板!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.textBox1.Text = "";
                            this.textBox1.Focus();
                            CommonAuxiliary.playFail();
                            return;
                        }
                        //2. 檢查是否綁定編碼規則
                        codeRule = codeRuleService.queryRuleByCond(carton.Cusno, carton.Delmatno, "2");                 //2代表Pallet碼編碼規則
                        if (codeRule == null)
                        {
                            MessageBox.Show("請聯繫管理員綁定編碼規則!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.textBox1.Text = "";
                            this.textBox1.Focus();
                            CommonAuxiliary.playFail();
                            return;
                        }
                        //3.查询标签参数信息
                        mandUnionFieldTypeList = manRelFieldTypeService.queryFieldListByCond(carton.Cusno, carton.Delmatno, "2");
                        if (mandUnionFieldTypeList == null)
                        {
                            MessageBox.Show("未找到該客戶出貨料號對應的打印字段規則信息,請維護相關信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            this.textBox1.Text = "";
                            this.textBox1.Focus();
                            CommonAuxiliary.playFail();
                            return;
                        }
                        //4.查询标准栈板容量
                        capacity = capacityService.queryByRelation(carton.Cusno, carton.Delmatno, "2");
                        pallet   = new Pallet();
                        if (capacity != null)
                        {
                            pallet.CapacityNo   = capacity.Capacityno;
                            this.textBox12.Text = capacity.Capacitydesc;
                            this.textBox14.Text = capacity.Capacityqty.ToString();
                        }
                        firstCarton        = carton;
                        this.textBox2.Text = carton.Workno;
                        initRow(carton);
                        //初始化信息
                        this.textBox3.Text = this.dataGridView1.Rows.Count.ToString();
                        this.textBox4.Text = firstCarton.Woquantity;
                        //根據工單號查詢已裝箱數量;
                        this.textBox6.Text  = firstCarton.Cusname;
                        this.textBox7.Text  = firstCarton.Cusno;
                        this.textBox8.Text  = firstCarton.Delmatno;
                        this.textBox9.Text  = firstCarton.Cusmatno;
                        this.textBox15.Text = firstCarton.Cuspo;
                        this.textBox5.Text  = carton.CartonQty.ToString();
                        this.textBox13.Text = codeRule.RuleDesc;

                        //下载打印模板 並初始化Carton 基本信息

                        pallet.Workno   = firstCarton.Workno;
                        pallet.Delmatno = firstCarton.Delmatno;                             //浪潮默認規則 編號R007         棧板規則使用默認編碼規則
                        pallet.Cusmatno = firstCarton.Cusmatno;
                        pallet.Cuspo    = firstCarton.Cuspo;
                        pallet.Cusname  = firstCarton.Cusname;
                        pallet.SoOrder  = firstCarton.SoOrder;
                        pallet.Cusno    = firstCarton.Cusno;
                        pallet.Modelno  = fileRelDel.FileNo;
                        pallet.Ruleno   = codeRule.Ruleno;

                        //pallet = GeneratePallet.generatePalletNo(pallet);
                        ////顯示棧板號:
                        //this.textBox10.Text = pallet.PalletNo;
                        //this.textBox11.Text = pallet.BatchNo;
                        //下載模板並預覽   1.查询模板是否存在, 若存在不下载  2.若不存在下载模板
                        filePath = modelInfoService.previewModelFile(pallet.Modelno);
                        //if (filePath != null)
                        //{
                        //    string pictureFile = barPrint.PreviewPrintBC(filePath);
                        //    this.pictureBox1.Load(pictureFile);
                        //}
                        CommonAuxiliary.playSuccess();
                    }
                    else
                    {
                        //第二箱掃描  檢查是否混棧板,同工單,檢查箱號是否同工單號
                        if (("1").Equals(this.comboBox1.SelectedValue.ToString()))
                        {
                            if (carton.Workno.Trim().Equals(this.firstCarton.Workno.Trim()))
                            {
                                if (!checkRepeat(carton.CartonNo))
                                {
                                    initRow(carton);
                                    this.textBox3.Text = this.dataGridView1.Rows.Count.ToString();
                                    this.textBox5.Text = countQty(cartonList).ToString();
                                    CommonAuxiliary.playSuccess();
                                }
                                else
                                {
                                    this.textBox1.Text = "";
                                    this.textBox1.Focus();
                                    CommonAuxiliary.playFail();
                                    return;
                                }
                            }
                            else
                            {
                                MessageBox.Show("装箱单的工单号不同,请检查是否需要混栈板包装!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                this.textBox1.Text = "";
                                this.textBox1.Focus();
                                CommonAuxiliary.playFail();
                                return;
                            }
                        }
                        else
                        {
                            //混棧板  只檢查箱號是否重複
                            if (!checkRepeat(carton.CartonNo))
                            {
                                initRow(carton);
                                this.textBox3.Text = this.dataGridView1.Rows.Count.ToString();
                                this.textBox5.Text = countQty(cartonList).ToString();
                                CommonAuxiliary.playSuccess();
                            }
                            else
                            {
                                this.textBox1.Text = "";
                                this.textBox1.Focus();
                                CommonAuxiliary.playFail();
                                return;
                            }
                        }
                    }
                    //判斷是否混棧板.
                    if (("1").Equals(this.comboBox1.SelectedValue.ToString()))
                    {
                        if (capacity != null)
                        {
                            //扫码数量等于容量时打印标签
                            if (this.dataGridView1.Rows.Count == capacity.Capacityqty)
                            {
                                printCarton();
                            }
                        }
                        else
                        {
                            if (this.dataGridView1.Rows.Count == 100)
                            {
                                printCarton();
                            }
                        }
                    }
                }
                else
                {
                    this.textBox1.Text = "";
                }
            }
        }