Exemplo n.º 1
0
func (p *InventoryStat) Setup() {
	// TODO load TimeFrom
	// if gxl.CN == p.TimeFrom

	// page values
	if p.GroupId != nil {
		var err error
		ig, err := service.InventoryGroup.GetInventoryGroup((int64)(p.GroupId.Int),
			service.WITH_INVENTORIES|service.WITH_PRODUCT|service.WITH_STOCKS)
		if err != nil {
			panic(err)
		}
		p.InventoryGroup = ig

		// parser := db.NewQueryParser().Where(inventory.FGroupId, p.GroupId.Int)
		// list, err := service.Inventory.List(parser,
		// 	service.WITH_PERSON|service.WITH_PRODUCT|service.WITH_USERS)
		// if err != nil {
		// 	panic(err)
		// }

		// construct group;
		// p.InventoryGroup = model.NewInventoryGroup(list)
	} else {
		p.InventoryGroup = model.NewInventoryGroup(nil)
	}
}
Exemplo n.º 2
0
func (p *InventoryEdit) Setup() {

	switch p.CreateType {
	case "produce": // placeorder mode
		p.CurrentPage = "/placeorder"
		p.PageTitle = "创建生产订单"
		p.SubTitle = "下单管理"

	case "client": // client order mode
		p.CurrentPage = "/client/orderindex"
		p.PageTitle = "客户下单"
		p.SubTitle = "客户订单"

	default: // normal
		p.CurrentPage = "/inventory"
		p.PageTitle = "新增入库"
		p.SubTitle = "库存管理"

	}

	// page values
	p.Title = "create input post"
	if p.GroupId != nil {
		var err error
		ig, err := service.InventoryGroup.GetInventoryGroup((int64)(p.GroupId.Int),
			service.WITH_INVENTORIES|service.WITH_PRODUCT|service.WITH_STOCKS)
		if err != nil {
			panic(err)
		}
		p.InventoryGroup = ig

		// parser := db.NewQueryParser().Where(inventory.FGroupId, p.GroupId.Int)
		// list, err := service.Inventory.List(parser,
		// 	service.WITH_PERSON|service.WITH_PRODUCT|service.WITH_USERS)
		// if err != nil {
		// 	panic(err)
		// }

		// construct group;
		// p.InventoryGroup = model.NewInventoryGroup(list)
		p.SubTitle = p.SubTitle + ":编辑"
	} else {
		p.InventoryGroup = model.NewInventoryGroup(nil)
		p.SubTitle = p.SubTitle + ":新建"
	}
}