package constvar type BaseOperationType int const ( BaseOperationTypeIncoming BaseOperationType = iota + 1 //收货 BaseOperationTypeOutgoing //交货 BaseOperationTypeInternal //内部调拨 ) func (slf BaseOperationType) IsValid() bool { return slf == BaseOperationTypeIncoming || slf == BaseOperationTypeOutgoing || slf == BaseOperationTypeInternal } type ReservationMethod int const ( ReservationMethodAtConfirm ReservationMethod = iota + 1 //在确认时 ReservationMethodManual //手动 ReservationMethodByDate //在预定日期之前 ) func (slf ReservationMethod) IsValid() bool { return slf == ReservationMethodAtConfirm || slf == ReservationMethodManual || slf == ReservationMethodByDate } type WhetherType int const ( WhetherTypeAsk WhetherType = iota + 1 //询问 WhetherTypeAlways //总是 ReservationNever //从不 ) func (slf WhetherType) IsValid() bool { return slf == WhetherTypeAsk || 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 }