Пример #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);
                //}
            }
        }
Пример #2
0
        public FileRelDel queryFileRelDelById(string uuid)
        {
            FileRelDel    fileRelDel = null;
            StringBuilder strSql     = new StringBuilder();

            strSql.Append("SELECT uuid,file_no,cus_no,del_matno,op_user,create_time FROM t_file_reldel where uuid=@uuid and del_flag is null");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@uuid", MySqlDbType.VarChar, 900),
            };
            parameters[0].Value = uuid;
            DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                fileRelDel            = new FileRelDel();
                fileRelDel.Uuid       = ds.Tables[0].Rows[0]["uuid"].ToString();
                fileRelDel.FileNo     = ds.Tables[0].Rows[0]["file_no"].ToString();
                fileRelDel.CusNo      = ds.Tables[0].Rows[0]["cus_no"].ToString();
                fileRelDel.DelMatno   = ds.Tables[0].Rows[0]["del_matno"].ToString();
                fileRelDel.OpUser     = ds.Tables[0].Rows[0]["op_user"].ToString();
                fileRelDel.CreateTime = ds.Tables[0].Rows[0]["create_time"].ToString();
            }
            return(fileRelDel);
        }
Пример #3
0
        public FileRelDel saveFileRelDel(FileRelDel fileRelDel)
        {
            FileRelDel reFileRelDel = null;

            fileRelDel.Uuid       = Auxiliary.Get_UUID();
            fileRelDel.OpUser     = Auxiliary.loginName;
            fileRelDel.CreateTime = Auxiliary.Get_CurrentTime();
            if (fileRelDelDao.saveFileRelDel(fileRelDel))
            {
                reFileRelDel = fileRelDelDao.queryFileRelDelById(fileRelDel.Uuid);
            }
            return(reFileRelDel);
        }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (saveMark)
            {
                MessageBox.Show("該模板關係已經保存,請勿重複保存!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.textBox1.Text == null || this.textBox1.Text.Trim() == "")
            {
                MessageBox.Show("维护客户料号信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.textBox1.Focus();
                return;
            }
            string     boundType  = this.comboBox3.SelectedValue == null ? "0" : this.comboBox3.SelectedValue.ToString();
            FileRelDel fileRelDel = new FileRelDel();

            fileRelDel.FileNo    = this.comboBox1.SelectedValue.ToString();
            fileRelDel.CusNo     = this.comboBox2.SelectedValue.ToString().Trim();
            fileRelDel.DelMatno  = this.textBox1.Text.Trim().ToString().Trim();
            fileRelDel.BoundType = boundType;

            if (fileRelDelService.checkAdd(fileRelDel))
            {
                MessageBox.Show("該客戶和出貨料號的打印模板已經綁定,請勿重複綁定!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.textBox1.Focus();
                return;
            }
            FileRelDel reFileRelDel = fileRelDelService.saveFileRelDel(fileRelDel);

            if (reFileRelDel != null)
            {
                this.textBox2.Text = reFileRelDel.CreateTime;
                saveMark           = true;
                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #5
0
        public bool exists(FileRelDel fileRelDel)
        {
            bool          repeatJudge = false;
            StringBuilder strSql      = new StringBuilder();

            strSql.Append("select count(1) from t_file_reldel where cus_no=@CusNo and del_matno=@delMatno and bound_type=@boundType and del_flag is null");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@CusNo",     MySqlDbType.VarChar, 900),
                new MySqlParameter("@delMatno",  MySqlDbType.VarChar, 900),
                new MySqlParameter("@boundType", MySqlDbType.VarChar, 900),
            };
            parameters[0].Value = fileRelDel.CusNo;
            parameters[1].Value = fileRelDel.DelMatno;
            parameters[2].Value = fileRelDel.BoundType;
            int rows = int.Parse(SQLHelper.ExecuteScalar(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters).ToString().Trim());

            if (rows > 0)
            {
                repeatJudge = true;
            }
            return(repeatJudge);
        }
Пример #6
0
        public bool saveFileRelDel(FileRelDel fileRelDel)
        {
            bool          saveMark = true;
            StringBuilder strSql   = new StringBuilder();

            strSql.Append("insert into t_file_reldel (uuid,file_no,cus_no,del_matno,op_user,create_time,bound_type)");
            strSql.Append("values(@uuid,@fileNo,@cusNo,@delMatno,@opUser,@createTime,@boundType)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@uuid",       MySqlDbType.VarChar, 900),
                new MySqlParameter("@fileNo",     MySqlDbType.VarChar, 900),
                new MySqlParameter("@cusNo",      MySqlDbType.VarChar, 900),
                new MySqlParameter("@delMatno",   MySqlDbType.VarChar, 900),
                new MySqlParameter("@opUser",     MySqlDbType.VarChar, 900),
                new MySqlParameter("@createTime", MySqlDbType.VarChar, 900),
                new MySqlParameter("@boundType",  MySqlDbType.VarChar, 900)
            };
            parameters[0].Value = fileRelDel.Uuid;
            parameters[1].Value = fileRelDel.FileNo;
            parameters[2].Value = fileRelDel.CusNo;
            parameters[3].Value = fileRelDel.DelMatno;
            parameters[4].Value = fileRelDel.OpUser;
            parameters[5].Value = fileRelDel.CreateTime;
            parameters[6].Value = fileRelDel.BoundType;
            int rows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                saveMark = true;
            }
            else
            {
                saveMark = false;
            }
            return(saveMark);
        }
Пример #7
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);
                }
            }
        }
Пример #8
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();
             }
         }
     }
 }
Пример #9
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 = "";
                }
            }
        }
Пример #10
0
 /// <summary>
 /// 檢查是否存在
 /// </summary>
 /// <param name="fileRelDel"></param>
 /// <returns></returns>
 public bool checkAdd(FileRelDel fileRelDel)
 {
     return(fileRelDelDao.exists(fileRelDel));
 }