zhangqian
2023-09-13 5bc036d71ff6094e550c99168eae2e2b4d495f51
constvar/const.go
@@ -41,3 +41,89 @@
      slf == WhetherTypeAlways ||
      slf == ReservationNever
}
// ProductType 产品类型
type ProductType int
const (
   ProductTypeRaw      = iota + 1 // 原材料
   ProductTypeSemi                // 半成品
   ProductTypeFinished            // 成品
)
type ProductStatus int
const (
   ProductStatusCreate   ProductStatus = iota // 新建
   ProductStatusActive                        // 启用
   ProductStatusInactive = -1                 // 停用
)
// PurchaseType 采购类型
type PurchaseType int
const (
   PurchaseTypeOutSource PurchaseType = iota + 1 // 采购
   PurchaseTypeSelf                              // 自制
   PurchaseTypeEntrust                           // 委外
)
func (t PurchaseType) Valid() bool {
   if t < PurchaseTypeOutSource ||
      t > PurchaseTypeEntrust {
      return false
   }
   return true
}
// LocationType 位置类型
type LocationType int
const (
   LocationTypeVendor        LocationType = iota + 1 // 供应商位置
   LocationTypeView                                  // 视图
   LocationTypeInternal                              // 内部位置
   LocationTypeCustomer                              // 客户位置
   LocationTypeInventoryLoss                         // 库存损失
   LocationTypeProduction                            // 生产
   LocationTypeTransit                               // 中转位置
)
func (t LocationType) Valid() bool {
   return t >= LocationTypeVendor && t <= LocationTypeTransit
}
type ForceRemovalStrategy int
const (
   ForceRemovalStrategyFIFO ForceRemovalStrategy = iota + 1
   ForceRemovalStrategyLIFO
   ForceRemovalStrategyClosestLocation
)
func (t ForceRemovalStrategy) Valid() bool {
   return t >= ForceRemovalStrategyFIFO && t <= ForceRemovalStrategyClosestLocation
}
type CostingMethod int
const (
   CostingMethodStandardPrice CostingMethod = iota + 1 //标准价格
   CostingMethodFIFO                                   //先进先出
   CostingMethodAverageCost                            //
)
func (t CostingMethod) Valid() bool {
   return t >= CostingMethodStandardPrice && t <= CostingMethodAverageCost
}
type InventoryValuation int
const (
   InventoryValuationManual InventoryValuation = iota + 1 //手动
   InventoryValuationAuto                                 //自动
)
func (t InventoryValuation) Valid() bool {
   return t >= InventoryValuationManual && t <= InventoryValuationAuto
}