public Page<Record> getUserPage(int pageNumber, int pageSize) { return Db.paginate( pageNumber, pageSize, SqlXmlKit.sql("user.findUserPageBySelect") + blank, SqlXmlKit.sql("user.findUserPageByFrom")); }
/** * @描述 查询Operates 分页 * * @param pageNumber * @param pageSize * @param where * @param orderby * @param paras * @return */ public Page<Record> findOperatesByUserId( int pageNumber, int pageSize, String where, String orderby, Object... paras) { return Db.paginate( pageNumber, pageSize, getSql("order.findOfferQueryBySelect"), getSql("order.findOfferQueryByFrom") + getWhere(where) + orderby, paras); }
/** * 根据条件获取Order。 * * @param where * @param paras * @return */ public Page<Record> findExceptionOrders( int pageNumber, int pageSize, String where, Object... paras) { return Db.paginate( pageNumber, pageSize, getSql("order.findOrderInfoBySelect"), getSql("order.findOrderInfoByFrom") + getWhere(where), paras); }
private void select() { StringBuffer whee = new StringBuffer(); List<Object> param = new ArrayList<Object>(); String startTime = getPara("startTime"); if (startTime != null && !"".equals(startTime.trim())) { whee.append(" and UNIX_TIMESTAMP(p.OrderDate) >= UNIX_TIMESTAMP(?)"); param.add(startTime); } setAttr("startTime", startTime); String endTime = getPara("endTime"); if (endTime != null && !"".equals(endTime.trim())) { whee.append(" and UNIX_TIMESTAMP(p.OrderDate) <= UNIX_TIMESTAMP(?)"); param.add(endTime); } setAttr("endTime", endTime); String supplierCode = getPara("supplier.supplierCode"); if (supplierCodePara != null) supplierCode = supplierCodePara; if (supplierCode != null && !"".equals(supplierCode.trim())) { whee.append(" and p.SupplierCode = ?"); param.add(Long.parseLong(supplierCode)); } setAttr("supplierCode", supplierCode); setAttr("supplierName", getPara("supplier.supplierName")); String storeCd = getPara("store.StoreCode"); if (storeCd != null && !"".equals(storeCd.trim())) { whee.append(" and p.StoreCode = ?"); param.add(Long.parseLong(storeCd)); } setAttr("StoreCode", storeCd); setAttr("StoreName", getPara("store.StoreName")); String sql = " from ckjhcheck p left join jbsupplier b on p.SupplierCode = b.supplierCode "; sql += " left join jbstore c on p.StoreCode = c.StoreCode "; sql += " left join employee d on d.usr_no = p.EmpCode "; sql += " left join partment e on e.deptCode = p.deptCode "; sql += " left join types t on t.id=p.inoutTypeNo and t.function='入库类型'"; sql += " where 1=1 "; setAttr( "page", Db.paginate( getParaToInt("pageNum", 1), getParaToInt("numPerPage", 10), "select p.id,p.OrderCode 订单号, p.OrderDate 进货日期,p.remark 备注, t.name 入库类型,p.BillOrderNo 采购单号,p.CKAmount 入库金额, p.payAmount 已付金额,p.checkflag 审核, b.supplierName 供应商,c.StoreName 订货仓库,d.usr_name 业务员, e.`name` 部门 ", sql + whee.toString(), param.toArray())); setAttr( "collist", new String[] { "订单号", "进货日期", "供应商", "业务员", "部门", "收货日期", "订货仓库", "入库类型", "采购单号", "入库金额", "已付金额", "审核", "备注" }); }
public void add() { Ckjhcheck ckjhcheck = new Ckjhcheck(); Jbsupplier jbsupplier = new Jbsupplier(); Jbstore jbstore = new Jbstore(); // 采购入库单号 String ordCdNw = null; // 不是采购订单导入 Long id = getParaToLong(0, 0L); List<Object> param = new ArrayList<Object>(); StringBuffer whee = new StringBuffer(); whee.append(" and a.OrderCode = ?"); if (id != 0) { // 修改 ckjhcheck = Ckjhcheck.dao.findById(id); jbsupplier = Jbsupplier.dao.findFirst( "select * from jbsupplier where supplierCode = ?", ckjhcheck.getStr("SupplierCode")); jbstore = Jbstore.dao.findFirst( "select * from jbstore where StoreCode = ?", ckjhcheck.getStr("StoreCode")); param.add(ckjhcheck.get("orderCode")); } else { synchronized (lock) { ordCdNw = BsUtil.getMaxOrdNo("OrderCode", "PK", "ckjhcheck"); } ckjhcheck.set("OrderCode", ordCdNw); param.add(ordCdNw); // 赋值当前时间 Date dt = new Date(); SimpleDateFormat ckDate = new SimpleDateFormat("yyyy-MM-dd"); ckjhcheck.set("orderdate", ckDate.format(dt)); // 赋值制单人 Record m = getCurrentUser(); ckjhcheck.set("operator", m.getStr("usr_name")); } String sql = "select a.id,b.GoodsCode 商品编号,b.GoodsName 商品名称,b.Model 商品规格,b.BaseUnit 基本单位,b.BRefPrice 原价,a.Discount 折扣, a.Quantity 数量,"; sql += " a.TaxRate 税率,a.TaxAmount 税额,a.Amount 金额"; String sqlSelect = " from ckjhcheckdetail a"; sqlSelect += " left join jbgoods b on a.GoodsCode = b.GoodsCode where 1=1 "; Page<Record> redLst = Db.paginate( getParaToInt("pageNum", 1), getParaToInt("numPerPage", 20), sql, sqlSelect + whee.toString(), param.toArray()); int size = redLst.getList().size(); // 不足10条,补足10条显示 if (size < 10) { for (int i = 0; i < 10 - size; i++) { redLst.getList().add(new Record()); } } setAttr("page", redLst); setAttr( "collist", new String[] {"商品编号", "商品名称", "商品规格", "单位", "原价", "折扣%", "数量", "订单金额", "税率%", "税额", "金额"}); setAttr("ckjhcheck", ckjhcheck); setAttr("store", jbstore); setAttr("supplier", jbsupplier); setAttr(InOutTypeNoSelectTarget.targetName, new InOutTypeNoSelectTarget()); setAttr(PartmentSelectTarget.targetName, new PartmentSelectTarget()); setAttr(EmployeeSelectTarget.targetName, new EmployeeSelectTarget()); render("add.html"); }
// 采购入库 public void cgInStore() { Ckjhcheck ckjhcheck = new Ckjhcheck(); Jbsupplier jbsupplier = new Jbsupplier(); Jbstore jbstore = new Jbstore(); List<Object> param = new ArrayList<Object>(); // 采购入库单号 String ordCdNw = null; synchronized (lock) { ordCdNw = BsUtil.getMaxOrdNo("OrderCode", "PK", "ckjhcheck"); } ckjhcheck.set("OrderCode", ordCdNw); String obj = getPara(); Cgorder cgOrd = new Cgorder(); cgOrd = Cgorder.dao.findFirst("select * from cgorder where orderCode = ?", new Object[] {obj}); jbsupplier = Jbsupplier.dao.findFirst( "select * from jbsupplier where supplierCode = ?", cgOrd.getStr("supplierCode")); jbstore = Jbstore.dao.findFirst( "select * from jbstore where StoreCode = ?", cgOrd.getStr("StoreCode")); // ckjhcheck.set("OrderCode", ordCdNw); ckjhcheck.set("OrderDate", cgOrd.getDate("DeliveryDate")); ckjhcheck.set("supplierCode", cgOrd.getStr("supplierCode")); ckjhcheck.set("StoreCode", cgOrd.getStr("StoreCode")); // ckjhcheck.set("InOutTypeNo", "52"); ckjhcheck.set("BillOrderNo", cgOrd.getStr("orderCode")); ckjhcheck.set("deptCode", cgOrd.getStr("deptcode")); ckjhcheck.set("Empcode", cgOrd.getStr("Empcode")); ckjhcheck.set("Operator", cgOrd.getStr("Operator")); ckjhcheck.set("CheckFlag", 0); ckjhcheck.set("SettleTypeFlag", 0); StringBuffer whee = new StringBuffer(); whee.append(" and a.orderCode = ?"); param.add(obj); String sql = "select a.id,b.GoodsCode 商品编号,b.GoodsName 商品名称,b.Model 商品规格,b.BaseUnit 基本单位,b.BRefPrice 原价,a.Discount 折扣, a.Quantity 数量,"; sql += " a.TaxRate 税率,a.TaxAmount 税额,a.Amount 税后金额"; String sqlSelect = " from cgorderdetail a"; sqlSelect += " left join jbgoods b on a.GoodsCode = b.GoodsCode where 1=1 "; Page<Record> redLst = Db.paginate( getParaToInt("pageNum", 1), getParaToInt("numPerPage", 20), sql, sqlSelect + whee.toString(), param.toArray()); int size = redLst.getList().size(); // 不足10条,补足10条显示 if (size < 10) { for (int i = 0; i < 10 - size; i++) { redLst.getList().add(new Record()); } } setAttr("page", redLst); setAttr( "collist", new String[] { "商品编号", "商品名称", "商品规格", "基本单位", "原价", "折扣%", "单价", "数量", "税率%", "折后金额", "税后金额" }); setAttr("ckjhcheck", ckjhcheck); setAttr("store", jbstore); setAttr("supplier", jbsupplier); setAttr(InOutTypeNoSelectTarget.targetName, new InOutTypeNoSelectTarget()); setAttr(PartmentSelectTarget.targetName, new PartmentSelectTarget()); setAttr(EmployeeSelectTarget.targetName, new EmployeeSelectTarget()); render("add.html"); }