diff --git a/src/gongyinglian/brand.go b/src/gongyinglian/brand.go new file mode 100644 index 0000000..e73a5c0 --- /dev/null +++ b/src/gongyinglian/brand.go @@ -0,0 +1,10 @@ +package gongyinglian + +import "shylinux.com/x/ice" + +type brand struct{ Tables } + +func (s brand) List(m *ice.Message, arg ...string) { +} + +func init() { ice.TeamCtxCmd(brand{}) } \ No newline at end of file diff --git a/src/gongyinglian/common.go b/src/gongyinglian/common.go index 2c45deb..e76282f 100644 --- a/src/gongyinglian/common.go +++ b/src/gongyinglian/common.go @@ -64,6 +64,15 @@ func (s Table) checkRole(m *ice.Message, arg ...UserStoreRole) bool { } return !m.WarnNotRight(true) } +func (s Table) userStoreRole(m *ice.Message, arg ...string) UserStoreRole { + msg := m.Cmd(userStore{}, s.Select, model.STORE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID)) + if msg.Length() > 0 { + return UserStoreRole(kit.Int(msg.Append(model.ROLE))) + } else { + return -1 + } +} + func (s Table) recordEvent(m *ice.Message, info string, arg ...string) *ice.Message { s.Table.RecordEvent(m, m.Option(model.STORE_UID), info, kit.Select(m.Option(model.UID), arg, 0)) return m diff --git a/src/gongyinglian/model/model.go b/src/gongyinglian/model/model.go index aad8b74..1b06896 100644 --- a/src/gongyinglian/model/model.go +++ b/src/gongyinglian/model/model.go @@ -17,14 +17,14 @@ const ( STORE_UID = "store_uid" STORE_NAME = "store_name" STORE_TYPE = "store_type" - FROM_STORE_UID = "from_store_uid" - FROM_USER_UID = "from_user_uid" - TO_STORE_UID = "to_store_uid" - TO_USER_UID = "to_user_uid" ORDER_UID = "order_uid" ORDER_TYPE = "order_type" ORDER_STATUS = "order_status" ORDER_DETAIL_UID = "order_detail_uid" + FROM_STORE_UID = "from_store_uid" + FROM_USER_UID = "from_user_uid" + TO_STORE_UID = "to_store_uid" + TO_USER_UID = "to_user_uid" PAYMENT_STATUS = "payment_status" EXPRESS_STATUS = "express_status" RETURN_STATUS = "return_status" @@ -37,6 +37,7 @@ const ( COMPANY_UID = "company_uid" CITY_UID = "city_uid" PRICE = "price" + STOCK = "stock" COUNT = "count" UNIT = "unit" ) diff --git a/src/gongyinglian/portal.go b/src/gongyinglian/portal.go index ca6cd6e..13a2b33 100644 --- a/src/gongyinglian/portal.go +++ b/src/gongyinglian/portal.go @@ -7,7 +7,7 @@ import ( type Portal struct { gonganxitong.Portal - placeCreate string `name:"placeCreate city_name* company_name* store_name*" role:"void"` + placeCreate string `name:"placeCreate city_name* company_name* store_type*:select store_name*" role:"void"` } func init() { diff --git a/src/gongyinglian/portal.json b/src/gongyinglian/portal.json index c1073f9..a6d8aa4 100644 --- a/src/gongyinglian/portal.json +++ b/src/gongyinglian/portal.json @@ -1,36 +1,32 @@ { "portal": "供应链", "placeCreate": "创建生意", "placeRemove": "删除生意", - "product": "产品列表", "order": "订单列表", "member": "生意伙伴", - + "goods": "商品", "expense": "开支", + "material": "材料", "process": "加工", + "quality": "质检", "brand": "贴牌", + "shop": "店铺", "garage": "仓库", "express": "物流", "payment": "账本", + "product": "货物列表", "order": "订单列表", "member": "生意伙伴", "loan": "借贷外债", "sell": "出货", "confirmSell": "确认出货", "purchase": "进货", "confirmPurchase": "确认进货", "payment": "付款", "confirmPayment": "确认收款", "express": "寄件", "confirmExpress": "确认收件", "return": "发起退货", "confirmReturn": "确认收到退货", "refund": "发起退款", "confirmRefund": "确认收到退款", - "material": "材料", "process": "加工", "goods": "商品", - "garage": "仓库", - "loan": "借贷", "expense": "开支", - "express": "物流", - "payment": "账本", - "shop": "店铺", - "style": { - "purchase": "danger" - }, "icons": { - "loan": "https://img.icons8.com/officel/80/bank-building.png", - "expense": "https://img.icons8.com/officel/80/cash-in-hand.png", + "goods": "https://img.icons8.com/officel/80/product.png", + "sell": "https://img.icons8.com/officel/80/handle-with-care.png", "purchase": "https://img.icons8.com/officel/80/paid.png", + "expense": "https://img.icons8.com/officel/80/cash-in-hand.png", "material": "https://img.icons8.com/officel/80/wood.png", "process": "https://img.icons8.com/officel/80/cnc-machine.png", - "goods": "https://img.icons8.com/officel/80/product.png", + "quality": "https://img.icons8.com/officel/80/test-partial-passed.png", + "brand": "https://img.icons8.com/officel/80/add-tag.png", "shop": "https://img.icons8.com/officel/80/shop.png", - "sell": "https://img.icons8.com/officel/80/handle-with-care.png", + "garage": "https://img.icons8.com/officel/80/garage-closed.png", "express": "https://img.icons8.com/officel/80/in-transit.png", "payment": "https://img.icons8.com/officel/80/spiral-bound-booklet.png", "product": "https://img.icons8.com/officel/80/warehouse.png", - "garage": "https://img.icons8.com/officel/80/garage-closed.png", - "order": "https://img.icons8.com/officel/80/receipt.png" + "order": "https://img.icons8.com/officel/80/receipt.png", + "loan": "https://img.icons8.com/officel/80/bank-building.png" }, "input": { "My Store": "我的生意", @@ -58,7 +54,12 @@ } }, "store_type": { - "normal": "普通" + "shop": "商铺", + "factory": "工厂", + "icons": { + "shop": "https://img.icons8.com/officel/80/shop.png", + "factory": "https://img.icons8.com/officel/80/cnc-machine.png" + } }, "order_type": { "sell": "出货单", diff --git a/src/gongyinglian/portal.shy b/src/gongyinglian/portal.shy new file mode 100644 index 0000000..7e40247 --- /dev/null +++ b/src/gongyinglian/portal.shy @@ -0,0 +1,32 @@ +order ` +userStore.go +store.go +product.go +product.js +order.go +order.js +orderDetail.go +orderDetail.js +payment.go +express.go +return.go +refund.go + +sell.go +purchase.go +process.go +quality.go +expense.go +material.go +goods.go +warehouse.go +garage.go +shop.go +loan.go + +model +common.go +portal.go +portal.json +portal.shy +` diff --git a/src/gongyinglian/product.go b/src/gongyinglian/product.go index 83d0d61..95f53d8 100644 --- a/src/gongyinglian/product.go +++ b/src/gongyinglian/product.go @@ -17,14 +17,14 @@ type product struct { func (s product) Create(m *ice.Message, arg ...string) { s.Table.Create(m, kit.Simple(arg, model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100), m.OptionSimple(model.STORE_UID))...) - s.recordEvent(m, m.Trans("create product ", "创建商品 ")+m.Option(model.NAME), m.Result()) + s.recordEvent(m, m.Trans("create product ", "创建商品 ")+kit.Cut(m.Result(), 6)+" "+m.Option(model.NAME), m.Result()) } func (s product) Modify(m *ice.Message, arg ...string) { - s.Table.Update(m, kit.Dict(arg, model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100)), m.OptionSimple(model.STORE_UID, model.UID)...) + s.Table.Update(m, kit.Dict(arg, model.PRICE, kit.Int(kit.Float(m.Option(model.PRICE))*100)), m.OptionSimple(model.UID, model.STORE_UID)...) } func (s product) Delete(m *ice.Message, arg ...string) { s.Table.Delete(m, m.OptionSimple(model.STORE_UID, model.UID)...) - s.recordEvent(m, m.Trans("delete product ", "删除商品 ")+m.Option(model.NAME), m.Option(model.UID)) + s.recordEvent(m, m.Trans("delete product ", "删除商品 ")+kit.Cut(m.Option(model.UID), 6)+" "+m.Option(model.NAME), m.Option(model.UID)) } func (s product) List(m *ice.Message, arg ...string) { if len(arg) == 0 { @@ -39,10 +39,10 @@ func (s product) List(m *ice.Message, arg ...string) { } else { return } - msg := m.Cmd(s.userStore, s.Select, model.STORE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID)) - role := UserStoreRole(kit.Int(msg.Append(model.ROLE))) - if msg.Length() > 0 && (role == UserStoreCreator || role == UserStoreBoss) { - m.PushAction(s.Modify, s.Delete) + if role := s.userStoreRole(m, arg[0]); role == UserStoreCreator || role == UserStoreBoss { + m.PushAction(s.Modify, s.Delete).Action(s.Create) + } else { + m.Action() } } diff --git a/src/gongyinglian/quality.go b/src/gongyinglian/quality.go new file mode 100644 index 0000000..35373a4 --- /dev/null +++ b/src/gongyinglian/quality.go @@ -0,0 +1,10 @@ +package gongyinglian + +import "shylinux.com/x/ice" + +type quality struct{ Tables } + +func (s quality) List(m *ice.Message, arg ...string) { +} + +func init() { ice.TeamCtxCmd(quality{}) } \ No newline at end of file diff --git a/src/gongyinglian/store.go b/src/gongyinglian/store.go index 0339426..8fa8521 100644 --- a/src/gongyinglian/store.go +++ b/src/gongyinglian/store.go @@ -9,11 +9,13 @@ func init() { ice.TeamCtxCmd(store{}) } type StoreType int const ( - StoreNormal StoreType = iota + StoreShop StoreType = iota + StoreFactory ) var StoreTypeList = map[StoreType]string{ - StoreNormal: "normal", + StoreShop: "shop", + StoreFactory: "factory", } func (s StoreType) String() string { return StoreTypeList[s] }