|
@@ -9,10 +9,10 @@ import (
|
9
|
9
|
"time"
|
10
|
10
|
)
|
11
|
11
|
|
12
|
|
-//生成编号,规则为:"sh-"+4位随机数
|
|
12
|
+//生成编号,规则为:"SH-"+4位随机数
|
13
|
13
|
func CreateCode() string {
|
14
|
14
|
s := fmt.Sprintf("%04v", rand.New(rand.NewSource(time.Now().UnixNano())).Int63n(10000))
|
15
|
|
- code := "sh-" + s
|
|
15
|
+ code := "SH-" + s
|
16
|
16
|
return code
|
17
|
17
|
}
|
18
|
18
|
|
|
@@ -397,7 +397,7 @@ func Byliinit() (err error) {
|
397
|
397
|
//根据xt_gobal_template 获取的机构id减去仓库表存在的机构id,把结果插入到仓库表
|
398
|
398
|
func StoreReduceOrg(tx *gorm.DB) (err error) {
|
399
|
399
|
err = tx.Exec("INSERT INTO sgj_xt.xt_storehouse(storehouse_code,storehouse_name,user_org_id,ctime)" +
|
400
|
|
- "SELECT CONCAT(\"sh-\",FLOOR(RAND()*9000+1000)),\"默认仓库\",tmp.id,UNIX_TIMESTAMP()" +
|
|
400
|
+ "SELECT CONCAT(\"SH-\",FLOOR(RAND()*9000+1000)),\"默认仓库\",tmp.id,UNIX_TIMESTAMP()" +
|
401
|
401
|
"FROM" +
|
402
|
402
|
"(select t1.org_id as id FROM sgj_xt.xt_gobal_template as t1 LEFT JOIN " +
|
403
|
403
|
"(SELECT distinct user_org_id as i FROM sgj_xt.xt_storehouse) as t2 on t1.org_id = t2.i WHERE t2.i is null and t1.status = 1)tmp").Error
|