|
@@ -301,6 +301,10 @@ func Byliinit() (err error) {
|
301
|
301
|
if err != nil && err.Error() != "record not found" {
|
302
|
302
|
return
|
303
|
303
|
}
|
|
304
|
+ err = initxt_storehouse(tx)
|
|
305
|
+ if err != nil && err.Error() != "record not found" {
|
|
306
|
+ return
|
|
307
|
+ }
|
304
|
308
|
err = initxt_stock_flow(tx)
|
305
|
309
|
if err != nil && err.Error() != "record not found" {
|
306
|
310
|
return
|
|
@@ -418,6 +422,17 @@ func StoreReduceConfig(tx *gorm.DB) (err error) {
|
418
|
422
|
return
|
419
|
423
|
}
|
420
|
424
|
|
|
425
|
+//初始化 xt_storehouse()把插入管理员的名字
|
|
426
|
+func initxt_storehouse(tx *gorm.DB) (err error) {
|
|
427
|
+ err = tx.Exec("UPDATE sgj_xt.xt_storehouse as t," +
|
|
428
|
+ "(SELECT o.id,o.creator,u.name from sgj_users.sgj_user_org as o,sgj_users.sgj_user_admin as u," +
|
|
429
|
+ "(SELECT DISTINCT org_id from sgj_xt.xt_gobal_template)as t " +
|
|
430
|
+ "WHERE o.creator = u.id AND t.org_id = o.id )tmp " +
|
|
431
|
+ "SET t.storehouse_admin_id = tmp.creator,t.storehouse_admin_name = tmp.name,t.mtime = UNIX_TIMESTAMP()" +
|
|
432
|
+ "WHERE t.status = 1 and t.user_org_id = tmp.id").Error
|
|
433
|
+ return
|
|
434
|
+}
|
|
435
|
+
|
421
|
436
|
//初始化 xt_stock_flow(完成)
|
422
|
437
|
func initxt_stock_flow(tx *gorm.DB) (err error) {
|
423
|
438
|
err = tx.Exec("UPDATE sgj_xt.xt_stock_flow as t," +
|
|
@@ -670,3 +685,9 @@ func initxt_supplier_warehousing_cancel_order(tx *gorm.DB) (err error) {
|
670
|
685
|
"WHERE (t.storehouse_id = 0 or t.storehouse_id is null) and t.user_org_id = tmp.orgid").Error
|
671
|
686
|
return
|
672
|
687
|
}
|
|
688
|
+
|
|
689
|
+//查询机构下的所有用户名
|
|
690
|
+func GetuserName(orgid int64) (username []models.App_Role_byli, err error) {
|
|
691
|
+ err = XTReadDB().Select("id,org_id,user_name").Where("org_id = ?", orgid).Find(&username).Error
|
|
692
|
+ return
|
|
693
|
+}
|