Exemplo n.º 1
0
        //插入一条数据到packageDetail表中,并且显示
        private void ShowPackageDetailTable(PickException _temp)
        {
            // dgExceptionTable.Rows.Add();


            var row = pickExceptionTable.NewRow();

            row["发生时间"] = _temp.Time.ToString();
            row["日期"]   = _temp.PickDate;
            row["线路名称"] = _temp.LineID.ToString();
            row["客户编码"] = _temp.CustomerID;
            row["客户名称"] = _temp.CustomerName;

            row["包号"]   = _temp.PackID.ToString();
            row["商品名称"] = _temp.ProductName;
            row["异常原因"] = _temp.Detail;



            this.PerformSafely(() => pickExceptionTable.Rows.Add(row));
        }
Exemplo n.º 2
0
        //分析一个包中条烟数量情况
        private void ResultAnalysis(int _result, int _abnormalCount, int _allCount, PickPackageDetail _pd)
        {
            var           pdresult  = orderHandle.localDatabase.dataBase.PackageDetails.FirstOrDefault(c => c.PickPackageDetailID == _pd.PickPackageDetailID);
            var           _ps       = orderHandle.localDatabase.dataBase.Packages.FirstOrDefault(c => c.PickPackageID == _pd.PickPackageID);
            PickException exception = null;
            string        message   = "";

            if (_result == 0)
            {
                pdresult.Details = "正常";
                pdresult.Readed  = _pd.Readed;
                pdresult.Result  = (int)ReadResult.OK;
            }

            else if (_result > 0)
            {
                message = "缺少 " + _pd.Product.ProductName.Trim() + " , " + _pd.ProductID.Trim() + "," + _result.ToString() + "条";

                pdresult.Details = "缺少 " + _result.ToString() + "条";
                pdresult.Readed  = _pd.Readed;
                pdresult.Result  = (int)ReadResult.LESS;
                exception        = new PickException();

                exception.CustomerID   = _ps.CustomerID;
                exception.CustomerName = _ps.CustomerName;
                exception.Detail       = "少烟";
                exception.PackID       = _ps.PackID;
                exception.PickDate     = _ps.PickDate;
                exception.ProductName  = _pd.Product.ProductName;
                exception.LineID       = _ps.LineID;
                exception.Time         = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
            }
            else
            {
                message = ("多 " + _pd.Product.ProductName.Trim() + " , " + _pd.ProductID.Trim() + "," + (-_result).ToString() + "条");

                pdresult.Details = "多 " + (-_result).ToString() + "条";
                pdresult.Readed  = _pd.Readed;
                pdresult.Result  = (int)ReadResult.MORE;

                exception = new PickException();

                exception.CustomerID   = _ps.CustomerID;
                exception.CustomerName = _ps.CustomerName;
                exception.Detail       = "多烟";
                exception.PackID       = _ps.PackID;
                exception.PickDate     = _ps.PickDate;
                exception.ProductName  = _pd.Product.ProductName;
                exception.LineID       = _ps.LineID;
                exception.Time         = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
            }
            try
            {
                orderHandle.localDatabase.dataBase.Entry(pdresult).State = System.Data.Entity.EntityState.Modified;
                if (exception != null)
                {
                    orderHandle.localDatabase.dataBase.PickExceptions.Add(exception);
                }

                orderHandle.localDatabase.dataBase.SaveChanges();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.InnerException.Message);
            }


            this.PerformSafely(() => {
                listBoxMessageShow.Items.Add(new CCWin.SkinControl.SkinListBoxItem {
                    Text = message
                });
            });
        }