|
@@ -666,7 +666,11 @@ func FindAllDrugWarehousingList(orgId int64, page int64, limit int64, startTime
|
666
|
666
|
func FindWarehousingInfoById(id int64) (list []*models.WarehousingInfo, err error) {
|
667
|
667
|
err = readDb.Model(&models.WarehousingInfo{}).Where("warehousing_id = ? AND status = 1", id).Preload("GoodInfo").Find(&list).Error
|
668
|
668
|
return list, err
|
|
669
|
+}
|
669
|
670
|
|
|
671
|
+func FindWarehousingInfoByIdOne(id []int64) (list []*models.WarehousingInfo, err error) {
|
|
672
|
+ err = readDb.Model(&models.WarehousingInfo{}).Where("warehousing_id in(?) AND status = 1", id).Preload("GoodInfo").Find(&list).Error
|
|
673
|
+ return list, err
|
670
|
674
|
}
|
671
|
675
|
|
672
|
676
|
func FindDrugWarehousingInfoById(id int64, org_id int64) (list []*VMDrugWarehouseInfo, err error) {
|
|
@@ -674,18 +678,54 @@ func FindDrugWarehousingInfoById(id int64, org_id int64) (list []*VMDrugWarehous
|
674
|
678
|
return list, err
|
675
|
679
|
}
|
676
|
680
|
|
|
681
|
+func FindDrugWarehousingInfoByIdOne(id []string, org_id int64) (list []*models.StDrugWarehouseInfo, err error) {
|
|
682
|
+
|
|
683
|
+ db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1")
|
|
684
|
+ table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
|
|
685
|
+ fmt.Println(table)
|
|
686
|
+ if len(id) > 0 {
|
|
687
|
+ db = db.Where("x.warehousing_id in(?)", id)
|
|
688
|
+ }
|
|
689
|
+ if org_id > 0 {
|
|
690
|
+ db = db.Where("x.org_id = ?", org_id)
|
|
691
|
+ }
|
|
692
|
+ err = db.Select("x.id,x.warehousing_id,x.drug_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.warehouseing_unit,x.max_unit,x.min_unit,x.stock_max_number,x.stock_min_number,x.price,x.remark,x.batch_number,t.manufacturer,t.dealer,t.drug_name,t.last_price,t.dose_unit,t.dose,t.min_number,t.min_unit,t.max_unit,t.drug_type").Joins("left join xt_base_drug as t on t.id = x.drug_id").Scan(&list).Error
|
|
693
|
+ return list, err
|
|
694
|
+}
|
|
695
|
+
|
677
|
696
|
func FindWarehousingById(id int64) (warehousing models.Warehousing, err error) {
|
678
|
697
|
err = readDb.Model(&models.Warehousing{}).Where("id = ? AND status = 1 ", id).First(&warehousing).Error
|
679
|
698
|
return warehousing, err
|
680
|
699
|
|
681
|
700
|
}
|
682
|
701
|
|
|
702
|
+func FindWarehousingByIdOne(id []string) (warehousing []*models.Warehousing, err error) {
|
|
703
|
+ err = readDb.Model(&models.Warehousing{}).Where("id in(?) and status = 1", id).Find(&warehousing).Error
|
|
704
|
+ //err = readDb.Model(&models.Warehousing{}).Where("id = ? AND status = 1 ", id).First(&warehousing).Error
|
|
705
|
+ return warehousing, err
|
|
706
|
+
|
|
707
|
+}
|
|
708
|
+
|
683
|
709
|
func FindDrugWarehousingById(id int64, org_id int64) (warehousing VMDrugWarehouse, err error) {
|
684
|
710
|
err = readDb.Model(&VMDrugWarehouse{}).Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Where("id = ? AND status = 1 ", id).First(&warehousing).Error
|
685
|
711
|
return warehousing, err
|
686
|
712
|
|
687
|
713
|
}
|
688
|
714
|
|
|
715
|
+func FindDrugWarehousingByIdOne(id []string, org_id int64) (warehousing []*models.DrugWarehouse, err error) {
|
|
716
|
+
|
|
717
|
+ db := XTReadDB().Table("xt_drug_warehouse as x").Where("x.status = 1")
|
|
718
|
+ if len(id) > 0 {
|
|
719
|
+ db = db.Where("x.id in(?)", id)
|
|
720
|
+ }
|
|
721
|
+ if org_id > 0 {
|
|
722
|
+ db = db.Where("x.org_id = ?", org_id)
|
|
723
|
+ }
|
|
724
|
+
|
|
725
|
+ err = db.Select("x.id,x.warehousing_order,x.operation_time,x.org_id,x.creater,x.ctime,x.modifier,x.warehousing_time").Find(&warehousing).Error
|
|
726
|
+ return warehousing, err
|
|
727
|
+}
|
|
728
|
+
|
689
|
729
|
//func FindDrugWarehousingById(id int64) (warehousing models.DrugWarehouse, err error) {
|
690
|
730
|
// err = readDb.Model(&models.DrugWarehouse{}).Where("id = ? AND status = 1 ", id).First(&warehousing).Error
|
691
|
731
|
// return warehousing, err
|
|
@@ -2934,6 +2974,34 @@ func GetOrderDetialByOrderId(id int64, orgid int64) (out []*models.WarehouseOutI
|
2934
|
2974
|
return out, err
|
2935
|
2975
|
}
|
2936
|
2976
|
|
|
2977
|
+func GetWarehouseOutOrder(id []string, orgid int64) (out []*models.WarehouseOut, err error) {
|
|
2978
|
+
|
|
2979
|
+ db := XTReadDB().Table("xt_warehouse_out as x").Where("x.status = 1")
|
|
2980
|
+ if len(id) > 0 {
|
|
2981
|
+ db = db.Where("x.id in(?)", id)
|
|
2982
|
+ }
|
|
2983
|
+ if orgid > 0 {
|
|
2984
|
+ db = db.Where("x.org_id= ?", orgid)
|
|
2985
|
+ }
|
|
2986
|
+ err = db.Select("x.id,x.warehouse_out_order_number,x.operation_time,x.creater,x.org_id,x.modifier,x.remark,x.warehouse_out_time,x.dealer,x.manufacturer,x.type").Find(&out).Error
|
|
2987
|
+ return out, err
|
|
2988
|
+}
|
|
2989
|
+
|
|
2990
|
+func GetOrderDetialByOrderIdOne(id []string, orgid int64) (out []*models.WarehouseOutInfoOne, err error) {
|
|
2991
|
+
|
|
2992
|
+ db := XTReadDB().Table("xt_warehouse_out_info as x").Where("x.status = 1")
|
|
2993
|
+ table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
|
|
2994
|
+ fmt.Println(table)
|
|
2995
|
+ if len(id) > 0 {
|
|
2996
|
+ db = db.Where("x.warehouse_out_id in (?)", id)
|
|
2997
|
+ }
|
|
2998
|
+ if orgid > 0 {
|
|
2999
|
+ db = db.Where("x.org_id = ?", orgid)
|
|
3000
|
+ }
|
|
3001
|
+ err = db.Select("x.id,x.warehouse_out_id,x.good_id,sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number,x.type,x.dealer,t.manufacturer,x.is_sys,x.sys_record_time,x.number,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.packing_unit,t.min_unit").Joins("left join xt_good_information as t on t.id=x.good_id").Group("x.good_id").Order("x.ctime desc").Scan(&out).Error
|
|
3002
|
+ return out, err
|
|
3003
|
+}
|
|
3004
|
+
|
2937
|
3005
|
func FindUserDetailByIdOne(good_id int64, record_time int64, org_id int64) (user []*models.AutomaticReduceDetail, err error, total int64) {
|
2938
|
3006
|
db := readDb.Model(&models.AutomaticReduceDetail{})
|
2939
|
3007
|
db = db.Preload("GoodInfo", "org_id = ? AND status = 1", org_id)
|
|
@@ -2952,7 +3020,7 @@ func GetGoodInformationByGoodId(good_id int64) (models.GoodInfo, error) {
|
2952
|
3020
|
return info, err
|
2953
|
3021
|
}
|
2954
|
3022
|
|
2955
|
|
-func GetExprotStockList(orgid int64, orderid int64, startime int64, endtime int64) (info []*models.StWarehousingInfo, err error) {
|
|
3023
|
+func GetExprotStockList(orgid int64, orderid []string, startime int64, endtime int64) (info []*models.StWarehousingInfo, err error) {
|
2956
|
3024
|
|
2957
|
3025
|
db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1")
|
2958
|
3026
|
|
|
@@ -2962,8 +3030,8 @@ func GetExprotStockList(orgid int64, orderid int64, startime int64, endtime int6
|
2962
|
3030
|
if orgid > 0 {
|
2963
|
3031
|
db = db.Where("x.org_id = ?", orgid)
|
2964
|
3032
|
}
|
2965
|
|
- if orderid > 0 {
|
2966
|
|
- db = db.Where("x.warehousing_id = ?", orgid)
|
|
3033
|
+ if len(orderid) > 0 {
|
|
3034
|
+ db = db.Where("x.warehousing_id in(?)", orderid)
|
2967
|
3035
|
}
|
2968
|
3036
|
if startime > 0 {
|
2969
|
3037
|
db = db.Where("x.ctime>=?", startime)
|
|
@@ -2994,3 +3062,57 @@ func GetDrugWarehouOrderInfo(startime int64, endtime int64, orgid int64) (info [
|
2994
|
3062
|
err = db.Select("x.drug_id,x.count,x.count_unit,t.max_unit,t.min_unit,t.min_number").Joins("left join xt_base_drug as t on t.id = x.drug_id").Scan(&info).Error
|
2995
|
3063
|
return info, err
|
2996
|
3064
|
}
|
|
3065
|
+
|
|
3066
|
+func GetOutExprotList(orgid int64, ids []string, startime int64, endtime int64) (out []*models.WarehouseOutInfoOne, err error) {
|
|
3067
|
+
|
|
3068
|
+ db := XTReadDB().Table("xt_warehouse_out_info as x").Where("x.status =1 ")
|
|
3069
|
+ table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
|
|
3070
|
+ fmt.Println(table)
|
|
3071
|
+ if orgid > 0 {
|
|
3072
|
+ db = db.Where("x.org_id = ?", orgid)
|
|
3073
|
+ }
|
|
3074
|
+
|
|
3075
|
+ if len(ids) > 0 {
|
|
3076
|
+ db = db.Where("x.warehouse_out_id in (?)", ids)
|
|
3077
|
+ }
|
|
3078
|
+ if startime > 0 {
|
|
3079
|
+ db = db.Where("x.ctime>=?", startime)
|
|
3080
|
+ }
|
|
3081
|
+ if endtime > 0 {
|
|
3082
|
+ db = db.Where("x.ctime<=?", endtime)
|
|
3083
|
+ }
|
|
3084
|
+
|
|
3085
|
+ err = db.Select("x.id,x.warehouse_out_id,x.good_id,x.good_type_id,x.warehousing_out_target,Sum(x.count) as count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.remark,x.number,t.good_name,t.specification_name,t.min_number,t.packing_price,t.min_unit,t.packing_unit,t.manufacturer,t.dealer").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id").Scan(&out).Error
|
|
3086
|
+ return out, err
|
|
3087
|
+
|
|
3088
|
+}
|
|
3089
|
+
|
|
3090
|
+func FindeDrugWarehouseOutOrder(ids []string, orgid int64) (info []*models.DrugWarehouseOut, err error) {
|
|
3091
|
+
|
|
3092
|
+ db := XTReadDB().Table("xt_drug_warehouse_out as x").Where("x.status = 1")
|
|
3093
|
+ if len(ids) > 0 {
|
|
3094
|
+ db = db.Where("x.id in(?)", ids)
|
|
3095
|
+ }
|
|
3096
|
+ if orgid > 0 {
|
|
3097
|
+ db = db.Where("x.org_id = ?", orgid)
|
|
3098
|
+ }
|
|
3099
|
+
|
|
3100
|
+ err = db.Select("x.id,x.warehouse_out_order_number,x.operation_time,x.creater,x.org_id,x.modifier,x.remark,x.warehouse_out_time,x.is_sys").Scan(&info).Error
|
|
3101
|
+ return info, err
|
|
3102
|
+
|
|
3103
|
+}
|
|
3104
|
+
|
|
3105
|
+func FindeDrugWarehouseOutDetail(ids []string, orgid int64) (info []*models.VmDrugWarehouseOutInfo, err error) {
|
|
3106
|
+
|
|
3107
|
+ db := XTReadDB().Table("xt_drug_warehouse_out_info as x").Where("x.status =1 ")
|
|
3108
|
+ table := XTReadDB().Table("x.base_drug as t").Where("t.status = 1")
|
|
3109
|
+ fmt.Println(table)
|
|
3110
|
+ if len(ids) > 0 {
|
|
3111
|
+ db = db.Where("x.warehouse_out_id in(?)", ids)
|
|
3112
|
+ }
|
|
3113
|
+ if orgid > 0 {
|
|
3114
|
+ db = db.Where("x.org_id = ?", orgid)
|
|
3115
|
+ }
|
|
3116
|
+ err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.count_unit,x.price,x.product_date,x.expiry_date,x.number,x.batch_number,t.drug_type,t.max_unit,t.min_unit,t.min_number,t.dose,t.dose_unit,t.last_price,t.drug_name").Joins("left join xt_base_drug as t on t.id =x.drug_id").Scan(&info).Error
|
|
3117
|
+ return info, err
|
|
3118
|
+}
|