Beispiel #1
0
 /// <summary>
 /// 物料号验证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void materialTB_Validating(object sender, CancelEventArgs e)
 {
     if (string.IsNullOrEmpty(materialTB.Text))
     {
         materialValidateBox.Visible   = true;
         materialValidateBox.Text      = "物料号不能为空!";
         materialValidateBox.ForeColor = Color.Red;
         materialTB.Focus();
         BatSaveBtn.Enabled = false;
     }
     else
     {
         var matDao   = SqlSugarDB.Instance <tblMaterial>();
         var matModel = matDao.Query().First(p => p.MAT_ID == materialTB.Text.Trim());
         if (matModel == null)
         {
             string msg = string.Format("物料号:{0} 未维护,请先在物料主数据维护该物料后再操作!", materialTB.Text.Trim());
             materialTB.Focus();
             BatSaveBtn.Enabled = false;
             MessageBox.Show(msg, "错误");
             return;
         }
         materialValidateBox.Visible = false;
         materialValidateBox.Text    = "";
         BatSaveBtn.Enabled          = true;
     }
 }
Beispiel #2
0
        /// <summary>
        /// 标签补打实现
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void revPrintExecute(object sender, PrintPageEventArgs e)
        {
            var matMapingDao   = SqlSugarDB.Instance <MatMaping>();
            var matMapingModel = matMapingDao.Query().First(p => p.Mat_ID == packageData.mNo);

            PrintHelper.PrintImplementation(packageData, matMapingModel.CustomMat, e);
            packageDate = null;
        }
Beispiel #3
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PrintBtn_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            #region 组装验证数据
            packageData               = new packageInfo();
            packageData.spec          = jhspeci.Text.Trim();//商品名
            packageData.description   = mat_desc.Text.Trim();
            packageData.mNo           = MaterialNo.Text.Trim();
            packageData.standard      = "FZ/T 51004-2011";
            packageData.bNo           = batch_no.Text.Trim();
            packageData.workLine      = txt_workLine.Text.Trim();
            packageData.grade         = txt_grade.Text.Trim();
            packageData.hiddenProduct = oldMat.Text.Trim();
            packageData.packType      = packType.Text.Trim();
            if (string.IsNullOrEmpty(txt_nbtWeight.Text.Trim()))
            {
                packageData.nbtWeight = 0;
            }
            else
            {
                packageData.nbtWeight = Convert.ToDecimal(txt_nbtWeight.Text.Trim());
            }
            packageData.SILONUM = siloNum.Text.Trim();//料仓号
            #endregion
            if (!PrintValidating.Verification(packageData, ref msg, txt_page.Text))
            {
                MessageBox.Show(msg);
                return;
            }
            int page = Convert.ToInt32(txt_page.Text);
            for (int i = 0; i < page; i++)
            {
                var packageDao  = SqlSugarDB.Instance <packageInfo>();
                var packageInfo = packageDao.Query().First(p => p.seriesNo.Equals(sn.Text.Trim()));
                if (packageInfo != null)
                {
                    sn.Text = packagebll.GetSNInfo(UserBLL.userInfo.WorkLine, dic[siloNum.Text], PROCESSNUM.Text.Trim()).Value;
                    MessageBox.Show("已经自动重置最大箱号!请继续点击打印!");
                    return;
                }
                else
                {
                    PrintDocument pdt = new PrintDocument();
                    pdt.PrinterSettings     = new PrinterSettings();
                    pdt.DefaultPageSettings = new PageSettings();
                    pdt.PrintController     = new StandardPrintController();
                    PageSettings ps = pdt.DefaultPageSettings;
                    pdt.PrintPage += GetPrintPageEventHandler();
                    pdt.Print();
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 获取标签打印数据
        /// </summary>
        /// <returns></returns>
        private packageInfo GetPrintPackageInfo()
        {
            var printModel = new packageInfo();

            DateTime now = DateTime.Now;

            #region 标签打印数据组装
            //printModel.ORD_NO = txt_ORD_NO.Text;
            printModel.spec        = jhspeci.Text.Trim();
            printModel.description = mat_desc.Text.Trim();
            printModel.newNo       = oldMat.Text.Trim();
            printModel.productDesc = englishDesc.Text.Trim();
            var matDao         = SqlSugarDB.Instance <MatMaping>();
            var matMapingModel = matDao.Query().First(p => p.CustomMat == MaterialNo.Text.Trim());
            printModel.mNo            = matMapingModel.Mat_ID;
            printModel.standard       = "FZ/T 51004-2011";
            printModel.bNo            = batch_no.Text.Trim();
            printModel.workLine       = txt_workLine.Text.Trim();
            printModel.SILONUM        = dic[siloNum.Text.Trim()];
            printModel.grade          = txt_grade.Text.Trim();
            printModel.characteristic = chracteristicsTB.Text.Trim();
            printModel.PROCESSNUM     = PROCESSNUM.Text.Trim();
            printModel.nbtWeight      = Convert.ToDecimal(txt_nbtWeight.Text.Trim());
            printModel.productDate    = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
            printModel.packageDate    = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
            printModel.timestamps     = now;
            printModel.packType       = packType.Text.Trim();
            if (com_packageType.Text.Trim().Equals("生产下线"))
            {
                printModel.packageType = 1;
            }
            else
            {
                printModel.packageType = 0;
            }
            printModel.productDate   = Convert.ToDateTime(txt_productDate.Text.Trim());
            printModel.comments      = remark.Text.Trim();
            printModel.ISExport      = false; //是否出口
            printModel.ISViceProduct = false; //是否副产品
            printModel.BOX_TYPE      = 0;     //纸箱类型
            printModel.workShop      = UserBLL.userInfo.WorkLine;
            printModel.wksplit       = UserBLL.userInfo.WorkLine;
            printModel.warehouseNo   = UserBLL.userInfo.CenterWareHouse;
            printModel.CREATEUSER    = printModel.MODIFYUSER = UserBLL.userInfo.UserName;
            printModel.CREATEDATE    = printModel.MODIFYDATE = now;
            //string fg = siloNum.Text.Split('-')[0].Substring(1, siloNum.Text.Split('-')[0].Length - 1) + (!string.IsNullOrEmpty(printModel.PROCESSNUM.Trim()) ? printModel.PROCESSNUM : "00");
            printModel.seriesNo = sn.Text;
            printModel.pack_Ex1 = string.IsNullOrEmpty(customSn.Text) ? printModel.seriesNo : customSn.Text;//客户箱号
            #endregion

            return(printModel);
        }
Beispiel #5
0
        /// <summary>
        /// 保存时验证
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        private bool SaveValidate(ref string msg)
        {
            if (string.IsNullOrEmpty(materialTB.Text.Trim()))
            {
                msg = "物料号不能为空";
                return(false);
            }
            if (string.IsNullOrEmpty(hscMat_ID.Text.Trim()))
            {
                msg = "新物料号不能为空";
                return(false);
            }
            var matDao      = SqlSugarDB.Instance <MatMaping>();
            var matMapModel = matDao.Query().First(p => p.CustomMat == materialTB.Text.Trim());

            if (matMapModel != null)
            {
                msg = "物料号" + materialTB.Text.Trim() + "已经被维护了对应关系,请检查!";
                return(false);
            }
            return(true);
        }
Beispiel #6
0
 /// <summary>
 /// 新物料号验证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void hscMat_ID_Validating(object sender, CancelEventArgs e)
 {
     if (string.IsNullOrEmpty(hscMat_ID.Text))
     {
         hscMatValidateBox.Visible   = true;
         hscMatValidateBox.Text      = "新物料号不能为空!";
         hscMatValidateBox.ForeColor = Color.Red;
         hscMat_ID.Focus();
     }
     else
     {
         var matDao   = SqlSugarDB.Instance <MatMaping>();
         var matModel = matDao.Query().First(p => p.Mat_ID == hscMat_ID.Text.Trim());
         if (matModel != null)
         {
             string msg = string.Format("新物料号:{0} 已经和物料号:{1}建立对应关系,请检查!", hscMat_ID.Text.Trim(), materialTB.Text.Trim());
             hscMat_ID.Focus();
             //BatSaveBtn.Enabled = false;
             MessageBox.Show(msg, "错误");
             return;
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// 新物料号回车事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MaterialNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            string material = MaterialNo.Text.Trim();

            if (e.KeyChar == 13)
            {
                if (string.IsNullOrEmpty(material))
                {
                    MessageBox.Show("物料号为空,请检查!");
                    return;
                }
                //获取物料号的映射物料
                var matMapingDao = SqlSugarDB.Instance <MatMaping>();
                var matMapModel  = matMapingDao.Query().First(p => p.CustomMat == material);
                if (matMapModel == null)
                {
                    MessageBox.Show("物料号" + material + "未维护有对应关系的新物料,请检查!");
                    return;
                }
                var packageInfo = packagebll.GetPackageInfo(matMapModel.Mat_ID);
                if (packageInfo.Value != null && packageInfo.IsSuccess)
                {
                    if (string.IsNullOrEmpty(packageInfo.Value.spec) || string.IsNullOrEmpty(packageInfo.Value.description) ||
                        string.IsNullOrEmpty(packageInfo.Value.hiddenProduct))
                    {
                        QueryMat(material);
                    }
                    else
                    {
                        //商品名
                        jhspeci.Text = packageInfo.Value.spec;
                        //物料描述
                        mat_desc.Text = packageInfo.Value.description;
                        //英文描述
                        if (string.IsNullOrEmpty(packageInfo.Value.productDesc))
                        {
                            englishDesc.Text = packageInfo.Value.newNo;
                        }
                        else
                        {
                            englishDesc.Text = packageInfo.Value.productDesc;
                        }
                        //批号
                        oldMat.Text = packageInfo.Value.hiddenProduct;
                        //执行标准
                        //standard.Text = standard.Items[0].ToString();
                    }
                    batch_no.Text         = packageInfo.Value.bNo;
                    siloNum.Text          = dic.FirstOrDefault(o => o.Value == packageInfo.Value.SILONUM).Key;
                    txt_grade.Text        = packageInfo.Value.grade;
                    PROCESSNUM.Text       = packageInfo.Value.PROCESSNUM;
                    chracteristicsTB.Text = packageInfo.Value.characteristic;
                    txt_workLine.Text     = packageInfo.Value.workLine;
                    txt_nbtWeight.Text    = packageInfo.Value.nbtWeight.ToString("0.00");
                    txt_productDate.Text  = packageInfo.Value.productDate.ToString("yyyy-MM-dd");
                    remark.Text           = packageInfo.Value.comments;
                    packType.Text         = packageInfo.Value.packType;
                }
                else
                {
                    QueryMat(material);
                }
            }
        }