Example #1
0
        /// <summary>
        /// 打印记录查询
        /// </summary>
        /// <param name="model"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ReturnValue <List <packageInfo> > GetPrintInfo(PintInfoModel model, Page page)
        {
            var packageDao = SqlSugarDB.Instance <packageInfo>();
            List <packageInfo> packageList = packageDao.Query()
                                             .WhereIF(!string.IsNullOrEmpty(model.material), p => p.mNo.Equals(model.material))
                                             .WhereIF(!string.IsNullOrEmpty(model.status), p => p.STATE == model.status.ObjToInt())
                                             .WhereIF(!string.IsNullOrEmpty(model.seriesNo), p => p.seriesNo.Equals(model.seriesNo))
                                             .WhereIF(!string.IsNullOrEmpty(model.oldMatNo), p => p.newNo.Equals(model.oldMatNo))
                                             .WhereIF(!string.IsNullOrEmpty(model.isPackage), p => p.packageType == model.isPackage.ObjToInt())
                                             .WhereIF(!string.IsNullOrEmpty(model.spackageDate), p => p.packageDate >= Convert.ToDateTime(model.spackageDate))
                                             .WhereIF(!string.IsNullOrEmpty(model.epackageDate), p => p.packageDate <= Convert.ToDateTime(model.epackageDate))
                                             .WhereIF(!string.IsNullOrEmpty(model.printDate), p => SqlFunc.DateIsSame(p.timestamps, Convert.ToDateTime(model.printDate)))
                                             .WhereIF(!string.IsNullOrEmpty(UserBLL.userInfo.WorkLine), p => p.workShop == UserBLL.userInfo.WorkLine)
                                             .OrderBy(p => p.id, OrderByType.Desc).ToPageList(page.pageIndex, page.pageSize, ref page.totalCount)
                                             .ToList();

            return(new ReturnValue <List <packageInfo> >().Success(packageList));
        }
Example #2
0
        /// <summary>
        /// 打印记录搜索条件
        /// </summary>
        /// <returns></returns>
        public PintInfoModel QueryData()
        {
            PintInfoModel model = new PintInfoModel
            {
                material = matNum.Text.Trim(),
                //status = status.Text.Trim(),
                seriesNo = serialno.Text.Trim(),
                //oldMatNo = oldMatNum.Text.Trim(),
                //isPackage = isChangePack.Text.Trim(),
                spackageDate = txt_sPackageDate.Text ?? null,
                epackageDate = txt_ePackageDate.Text ?? null,
                printDate    = txt_printDate.Text ?? null
            };

            if ("已创建".Equals(status.Text.Trim()))
            {
                model.status = "0";
            }
            else if ("已删除".Equals(status.Text.Trim()))
            {
                model.status = "9";
            }
            else
            {
                model.status = status.Text.Trim();
            }
            if ("生产下线".Equals(isChangePack.Text.Trim()))
            {
                model.isPackage = "1";
            }
            else if ("改包装".Equals(isChangePack.Text.Trim()))
            {
                model.isPackage = "0";
            }
            else
            {
                model.isPackage = isChangePack.Text.Trim();
            }
            return(model);
        }
Example #3
0
 /// <summary>
 /// 打印汇总查询
 /// </summary>
 /// <param name="model"></param>
 /// <param name="page"></param>
 /// <returns></returns>
 public ReturnValue <List <PackageInfoSum> > GetPrintInfoSum(PintInfoModel model, Page page)
 {
     #region 弃用
     //var packageDao = SqlSugarDB.Instance<PackageInfoSum>();
     //StringBuilder sql = new StringBuilder();
     //sql.Append("select top 1000 productDesc as 规格,(case when inner_key=1 or inner_key=0 and (innerMatNo='' or innerMatNo is null)  then  newNo else    innerMatNo end )as 旧物料号,mNo as 物料号,bNo as 批次,grade as 等级,workLine as 线别,convert(char(10),packageDate,120) as 包装日期,count(*) as 袋数,CONVERT(decimal(18, 2), sum(nbtWeight)) as 净重小计 from packageInfo");
     //sql.Append(" where  state<>9 and workShop = '申远聚合'");
     //if (!string.IsNullOrEmpty(model.spackageDate))
     //{
     //    sql.Append(" and packageDate >= '" + model.spackageDate + "'");
     //}
     //if (!string.IsNullOrEmpty(model.epackageDate))
     //{
     //    sql.Append(" and packageDate <= '" + model.epackageDate + "'");
     //}
     //if (!string.IsNullOrEmpty(model.isPackage))
     //{
     //    sql.Append(" and packagetype = " + Convert.ToInt32(model.isPackage));
     //}
     //if (!string.IsNullOrEmpty(model.grade))
     //{
     //    sql.Append(" and grade = '" + model.grade + "'");
     //}
     //sql.Append(" group by productDesc, newNo ,grade,workline,packageDate,mNo,bNo,case when inner_key=1 or inner_key=0 and (innerMatNo='' or innerMatNo is null)  then newNo else innerMatNo end");
     //sql.Append(" order by packageDate desc");
     //var sumPackageInfo = packageDao.Query(sql.ToString()).ToPageList(page.pageIndex, page.pageSize, ref page.totalCount).ToList();
     #endregion
     DBHelper <packageInfo> pdao = SqlSugarDB.Instance <packageInfo>();
     List <PackageInfoSum>  sum  = pdao.Query().WhereIF(!string.IsNullOrEmpty(model.spackageDate), p => p.packageDate >= Convert.ToDateTime(model.spackageDate))
                                   .WhereIF(!string.IsNullOrEmpty(model.epackageDate), p => p.packageDate <= Convert.ToDateTime(model.epackageDate))
                                   .WhereIF(!string.IsNullOrEmpty(model.isPackage), p => p.packageType == Convert.ToInt32(model.isPackage))
                                   .WhereIF(!string.IsNullOrEmpty(model.grade), p => p.grade == model.grade)
                                   .Where(p => p.STATE != 9 && p.workShop == UserBLL.userInfo.WorkLine)
                                   .Select <PackageInfoSum>(@"productDesc as 规格,(case when inner_key=1 or inner_key=0 and (innerMatNo='' or innerMatNo is null)  then  newNo else    innerMatNo end )as 旧物料号,mNo as 物料号,bNo as 批次,grade as 等级,workLine as 线别,convert(char(10),packageDate,120) as 包装日期,count(*) as 袋数,CONVERT(decimal(18, 2), sum(nbtWeight)) as 净重小计")
                                   .GroupBy(@"productDesc, newNo ,grade,workline,packageDate,mNo,bNo,case when inner_key=1 or inner_key=0 and (innerMatNo='' or innerMatNo is null)  then newNo else innerMatNo end")
                                   .OrderBy(@"packageDate desc")
                                   .ToPageList(page.pageIndex, page.pageSize, ref page.totalCount).ToList();
     return(new ReturnValue <List <PackageInfoSum> >().Success(sum));
 }
Example #4
0
        /// <summary>
        /// 打印汇总搜索条件
        /// </summary>
        /// <returns></returns>
        private PintInfoModel SumQueryData()
        {
            var model = new PintInfoModel()
            {
                spackageDate = txt_startPackageDate.Text ?? "",
                epackageDate = txt_endPackageDate.Text ?? "",
                grade        = gradeCB.Text.Trim()
            };

            if ("是".Equals(isChangePackageCB.Text.Trim()))
            {
                model.isPackage = "0";
            }
            else if ("否".Equals(isChangePackageCB.Text.Trim()))
            {
                model.isPackage = "1";
            }
            else
            {
                model.isPackage = isChangePackageCB.Text.Trim();
            }
            return(model);
        }