|
@@ -2033,6 +2033,24 @@ func GetAddGoodWarehouseInfoList(good_id int64, orgid int64, startime int64, end
|
2033
|
2033
|
return info, err
|
2034
|
2034
|
}
|
2035
|
2035
|
|
|
2036
|
+func GetAddGoodWarehouseInfoListTwenty(good_id int64, orgid int64, startime int64, endtime int64) (info []*models.StartWarehousingInfo, err error) {
|
|
2037
|
+ db := XTReadDB().Model(&info).Where("status = 1 and is_check =1")
|
|
2038
|
+ if good_id > 0 {
|
|
2039
|
+ db = db.Where("good_id = ?", good_id)
|
|
2040
|
+ }
|
|
2041
|
+ if orgid > 0 {
|
|
2042
|
+ db = db.Where("org_id = ?", orgid)
|
|
2043
|
+ }
|
|
2044
|
+ if startime > 0 {
|
|
2045
|
+ db = db.Where("ctime >=?", startime)
|
|
2046
|
+ }
|
|
2047
|
+ if endtime > 0 {
|
|
2048
|
+ db = db.Where("ctime <=?", endtime)
|
|
2049
|
+ }
|
|
2050
|
+ err = db.Find(&info).Error
|
|
2051
|
+ return info, err
|
|
2052
|
+}
|
|
2053
|
+
|
2036
|
2054
|
func GetAddStartFlow(good_id int64, orgid int64, startime int64, endtime int64, storehouse_id int64) (info []*models.VmStockFlowTwenty, err error) {
|
2037
|
2055
|
db := XTReadDB().Model(&info).Where("status = 1 and (consumable_type =1 or consumable_type = 13)")
|
2038
|
2056
|
if good_id > 0 {
|
|
@@ -2054,6 +2072,25 @@ func GetAddStartFlow(good_id int64, orgid int64, startime int64, endtime int64,
|
2054
|
2072
|
return info, err
|
2055
|
2073
|
}
|
2056
|
2074
|
|
|
2075
|
+func GetAddStartFlowTwenty(good_id int64, orgid int64, startime int64, endtime int64) (info []*models.VmStockFlowTwenty, err error) {
|
|
2076
|
+ db := XTReadDB().Model(&info).Where("status = 1 and (consumable_type =1)")
|
|
2077
|
+ if good_id > 0 {
|
|
2078
|
+ db = db.Where("good_id = ?", good_id)
|
|
2079
|
+ }
|
|
2080
|
+ if orgid > 0 {
|
|
2081
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
2082
|
+ }
|
|
2083
|
+ if startime > 0 {
|
|
2084
|
+ db = db.Where("ctime >=?", startime)
|
|
2085
|
+ }
|
|
2086
|
+ if endtime > 0 {
|
|
2087
|
+ db = db.Where("ctime <=?", endtime)
|
|
2088
|
+ }
|
|
2089
|
+
|
|
2090
|
+ err = db.Find(&info).Error
|
|
2091
|
+ return info, err
|
|
2092
|
+}
|
|
2093
|
+
|
2057
|
2094
|
func GetReduceWarehouseInfoList(good_id int64, orgid int64, startime int64, endtime int64, storehouse_id int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
2058
|
2095
|
db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 2 or consumable_type = 3 or consumable_type= 15)")
|
2059
|
2096
|
if good_id > 0 {
|
|
@@ -2075,6 +2112,24 @@ func GetReduceWarehouseInfoList(good_id int64, orgid int64, startime int64, endt
|
2075
|
2112
|
return outinfo, err
|
2076
|
2113
|
}
|
2077
|
2114
|
|
|
2115
|
+func GetReduceWarehouseInfoListTwenty(good_id int64, orgid int64, startime int64, endtime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
|
2116
|
+ db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 2 or consumable_type = 3 or consumable_type= 15)")
|
|
2117
|
+ if good_id > 0 {
|
|
2118
|
+ db = db.Where("good_id = ?", good_id)
|
|
2119
|
+ }
|
|
2120
|
+ if orgid > 0 {
|
|
2121
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
2122
|
+ }
|
|
2123
|
+ if startime > 0 {
|
|
2124
|
+ db = db.Where("ctime >=?", startime)
|
|
2125
|
+ }
|
|
2126
|
+ if endtime > 0 {
|
|
2127
|
+ db = db.Where("ctime <=?", endtime)
|
|
2128
|
+ }
|
|
2129
|
+ err = db.Preload("WarehousingInfo", "org_id = ? and status = 1", orgid).Find(&outinfo).Error
|
|
2130
|
+ return outinfo, err
|
|
2131
|
+}
|
|
2132
|
+
|
2078
|
2133
|
func GetStartEndCancelFLowInfo(good_id int64, orgid int64, startime int64, endtime int64, storehouse_id int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
2079
|
2134
|
db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 7)")
|
2080
|
2135
|
if good_id > 0 {
|
|
@@ -2096,6 +2151,24 @@ func GetStartEndCancelFLowInfo(good_id int64, orgid int64, startime int64, endti
|
2096
|
2151
|
return outinfo, err
|
2097
|
2152
|
}
|
2098
|
2153
|
|
|
2154
|
+func GetStartEndCancelFLowInfoTwenty(good_id int64, orgid int64, startime int64, endtime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
|
2155
|
+ db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 7)")
|
|
2156
|
+ if good_id > 0 {
|
|
2157
|
+ db = db.Where("good_id = ?", good_id)
|
|
2158
|
+ }
|
|
2159
|
+ if orgid > 0 {
|
|
2160
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
2161
|
+ }
|
|
2162
|
+ if startime > 0 {
|
|
2163
|
+ db = db.Where("ctime >=?", startime)
|
|
2164
|
+ }
|
|
2165
|
+ if endtime > 0 {
|
|
2166
|
+ db = db.Where("ctime <=?", endtime)
|
|
2167
|
+ }
|
|
2168
|
+ err = db.Preload("WarehousingInfo", "org_id = ? and status = 1", orgid).Find(&outinfo).Error
|
|
2169
|
+ return outinfo, err
|
|
2170
|
+}
|
|
2171
|
+
|
2099
|
2172
|
func FindeStartFlowInfo(good_id int64, orgid int64, startime int64) (info []*models.VmStockFlowTwenty, err error) {
|
2100
|
2173
|
|
2101
|
2174
|
db := XTReadDB().Model(&info).Where("status = 1 and consumable_type = 1")
|
|
@@ -2210,6 +2283,23 @@ func FindeWarehouseOutInfo(good_id int64, orgid int64, startime int64, storehous
|
2210
|
2283
|
return outinfo, err
|
2211
|
2284
|
}
|
2212
|
2285
|
|
|
2286
|
+func FindeWarehouseOutInfoTwenty(good_id int64, orgid int64, startime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
|
2287
|
+
|
|
2288
|
+ db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 2 or consumable_type = 3 or consumable_type = 15)")
|
|
2289
|
+ if good_id > 0 {
|
|
2290
|
+ db = db.Where("good_id = ?", good_id)
|
|
2291
|
+ }
|
|
2292
|
+ if orgid > 0 {
|
|
2293
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
2294
|
+ }
|
|
2295
|
+ if startime > 0 {
|
|
2296
|
+ db = db.Where("ctime <?", startime)
|
|
2297
|
+ }
|
|
2298
|
+
|
|
2299
|
+ err = db.Preload("WarehousingInfo", "org_id = ? and status = 1", orgid).Find(&outinfo).Error
|
|
2300
|
+ return outinfo, err
|
|
2301
|
+}
|
|
2302
|
+
|
2213
|
2303
|
func FindeStartStockInventoryProfit(good_id int64, orgid int64, startime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
2214
|
2304
|
|
2215
|
2305
|
db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 10)")
|
|
@@ -2248,6 +2338,26 @@ func FindeEndStokInventoryProfit(good_id int64, orgid int64, startime int64, end
|
2248
|
2338
|
return outinfo, err
|
2249
|
2339
|
}
|
2250
|
2340
|
|
|
2341
|
+func FindeEndStokInventoryProfitTwenty(good_id int64, orgid int64, startime int64, endtime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
|
2342
|
+
|
|
2343
|
+ db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 10)")
|
|
2344
|
+ if good_id > 0 {
|
|
2345
|
+ db = db.Where("good_id = ?", good_id)
|
|
2346
|
+ }
|
|
2347
|
+ if orgid > 0 {
|
|
2348
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
2349
|
+ }
|
|
2350
|
+ if startime > 0 {
|
|
2351
|
+ db = db.Where("ctime >=?", startime)
|
|
2352
|
+ }
|
|
2353
|
+ if endtime < 0 {
|
|
2354
|
+ db = db.Where("ctime <=?", endtime)
|
|
2355
|
+ }
|
|
2356
|
+
|
|
2357
|
+ err = db.Preload("WarehousingInfo", "org_id = ? and status = 1", orgid).Find(&outinfo).Error
|
|
2358
|
+ return outinfo, err
|
|
2359
|
+}
|
|
2360
|
+
|
2251
|
2361
|
func FindeEndStockInventoryLosses(good_id int64, orgid int64, startime int64, endtime int64, storehouse_id int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
2252
|
2362
|
db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 11)")
|
2253
|
2363
|
if good_id > 0 {
|
|
@@ -2269,6 +2379,25 @@ func FindeEndStockInventoryLosses(good_id int64, orgid int64, startime int64, en
|
2269
|
2379
|
return outinfo, err
|
2270
|
2380
|
}
|
2271
|
2381
|
|
|
2382
|
+func FindeEndStockInventoryLossesTwenty(good_id int64, orgid int64, startime int64, endtime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
|
2383
|
+ db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 11)")
|
|
2384
|
+ if good_id > 0 {
|
|
2385
|
+ db = db.Where("good_id = ?", good_id)
|
|
2386
|
+ }
|
|
2387
|
+ if orgid > 0 {
|
|
2388
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
2389
|
+ }
|
|
2390
|
+ if startime > 0 {
|
|
2391
|
+ db = db.Where("ctime >=?", startime)
|
|
2392
|
+ }
|
|
2393
|
+ if endtime < 0 {
|
|
2394
|
+ db = db.Where("ctime <=?", endtime)
|
|
2395
|
+ }
|
|
2396
|
+
|
|
2397
|
+ err = db.Preload("WarehousingInfo", "org_id = ? and status = 1", orgid).Find(&outinfo).Error
|
|
2398
|
+ return outinfo, err
|
|
2399
|
+}
|
|
2400
|
+
|
2272
|
2401
|
func FindStartStockInventoryLosses(good_id int64, orgid int64, startime int64) (outinfo []*models.VmStockFlowTwenty, err error) {
|
2273
|
2402
|
|
2274
|
2403
|
db := XTReadDB().Model(&outinfo).Where("status = 1 and (consumable_type = 11)")
|
|
@@ -2673,12 +2802,25 @@ func GetStartLastFLow(goodid int64, orgid int64, startime int64, storehouse_id i
|
2673
|
2802
|
return flwo, err
|
2674
|
2803
|
}
|
2675
|
2804
|
|
|
2805
|
+func GetStartLastFLowTwenty(goodid int64, orgid int64, startime int64) (models.VmStockFlowTwenty, error) {
|
|
2806
|
+
|
|
2807
|
+ flwo := models.VmStockFlowTwenty{}
|
|
2808
|
+ err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime < ?", goodid, orgid, startime).Last(&flwo).Error
|
|
2809
|
+ return flwo, err
|
|
2810
|
+}
|
|
2811
|
+
|
2676
|
2812
|
func GetEndLastFlow(goodid int64, orgid int64, endtime int64, storehouse_id int64) (models.VmStockFlowTwenty, error) {
|
2677
|
2813
|
flwo := models.VmStockFlowTwenty{}
|
2678
|
2814
|
err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime <= ? and storehouse_id= ?", goodid, orgid, endtime, storehouse_id).Last(&flwo).Error
|
2679
|
2815
|
return flwo, err
|
2680
|
2816
|
}
|
2681
|
2817
|
|
|
2818
|
+func GetEndLastFlowTwenty(goodid int64, orgid int64, endtime int64) (models.VmStockFlowTwenty, error) {
|
|
2819
|
+ flwo := models.VmStockFlowTwenty{}
|
|
2820
|
+ err := XTReadDB().Where("good_id = ? and user_org_id = ? and status = 1 and ctime <= ?", goodid, orgid, endtime).Last(&flwo).Error
|
|
2821
|
+ return flwo, err
|
|
2822
|
+}
|
|
2823
|
+
|
2682
|
2824
|
func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
|
2683
|
2825
|
|
2684
|
2826
|
db := XTReadDB().Model(&druginfo).Where("status = 1")
|