Browse Source

2024/6/17

28169 1 month ago
parent
commit
2077b285fb

+ 4 - 3
controllers/gobal_config_api_controller.go View File

2413
 
2413
 
2414
 	manufacturerList, _ := service.GetAllManufacturerList(admin.CurrentOrgId)
2414
 	manufacturerList, _ := service.GetAllManufacturerList(admin.CurrentOrgId)
2415
 
2415
 
2416
-	warehousing, _ := service.GetExportOutOrderDrugListOne(ids)
2416
+	warehousing, _ := service.GetExportOutOrderDrugListOne(ids, admin.CurrentOrgId)
2417
 
2417
 
2418
 	drug_warhouse_out, _ := service.GetDrugWarehouseOutTenty(ids, admin.CurrentOrgId)
2418
 	drug_warhouse_out, _ := service.GetDrugWarehouseOutTenty(ids, admin.CurrentOrgId)
2419
 
2419
 
2439
 
2439
 
2440
 	orderId := c.GetString("order_id")
2440
 	orderId := c.GetString("order_id")
2441
 	ids := strings.Split(orderId, ",")
2441
 	ids := strings.Split(orderId, ",")
2442
-	list, _ := service.ExportDrugList(ids)
2443
 	orgId := c.GetAdminUserInfo().CurrentOrgId
2442
 	orgId := c.GetAdminUserInfo().CurrentOrgId
2443
+	list, _ := service.ExportDrugList(ids, orgId)
2444
+
2444
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2445
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2445
 	dealerList, _ := service.GetAllDealerList(orgId)
2446
 	dealerList, _ := service.GetAllDealerList(orgId)
2446
 	c.ServeSuccessJSON(map[string]interface{}{
2447
 	c.ServeSuccessJSON(map[string]interface{}{
2456
 	ids := strings.Split(orderId, ",")
2457
 	ids := strings.Split(orderId, ",")
2457
 	orgId := c.GetAdminUserInfo().CurrentOrgId
2458
 	orgId := c.GetAdminUserInfo().CurrentOrgId
2458
 
2459
 
2459
-	list, _ := service.GetExportOutOrderDrugListOne(ids)
2460
+	list, _ := service.GetExportOutOrderDrugListOne(ids, orgId)
2460
 	outInfoList, _ := service.GetDrugOutListFlow(ids, orgId)
2461
 	outInfoList, _ := service.GetDrugOutListFlow(ids, orgId)
2461
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2462
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2462
 	dealerList, _ := service.GetAllDealerList(orgId)
2463
 	dealerList, _ := service.GetAllDealerList(orgId)

+ 0 - 1
controllers/stock_in_api_controller.go View File

5008
 	end_time := this.GetString("end_time")
5008
 	end_time := this.GetString("end_time")
5009
 	idArray := this.GetString("id")
5009
 	idArray := this.GetString("id")
5010
 	ids := strings.Split(idArray, ",")
5010
 	ids := strings.Split(idArray, ",")
5011
-	fmt.Println("ids2222222222", ids)
5012
 	var startTime int64
5011
 	var startTime int64
5013
 	if len(start_time) > 0 {
5012
 	if len(start_time) > 0 {
5014
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
5013
 		theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)

+ 13 - 7
service/stock_service.go View File

4856
 	if orgid > 0 {
4856
 	if orgid > 0 {
4857
 		db = db.Where("x.org_id = ?", orgid)
4857
 		db = db.Where("x.org_id = ?", orgid)
4858
 	}
4858
 	}
4859
+	if orgid > 0 {
4860
+		db = db.Where("t.org_id = ?", orgid)
4861
+	}
4862
+	if orgid > 0 {
4863
+		db = db.Where("p.org_id = ?", orgid)
4864
+	}
4859
 
4865
 
4860
 	if len(ids) > 0 {
4866
 	if len(ids) > 0 {
4861
 		db = db.Where("x.warehouse_out_id in (?)", ids)
4867
 		db = db.Where("x.warehouse_out_id in (?)", ids)
5309
 	return info, err
5315
 	return info, err
5310
 }
5316
 }
5311
 
5317
 
5312
-func ExportDrugList(warehouse_out_id []string) (out []*models.StDrugWarehouseInfo, err error) {
5318
+func ExportDrugList(warehouse_out_id []string, org_id int64) (out []*models.StDrugWarehouseInfo, err error) {
5313
 
5319
 
5314
-	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status =1")
5320
+	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status =1 AND x.org_id=?", org_id)
5315
 
5321
 
5316
-	table := XTReadDB().Table("xt_base_drug as b").Where("b.status = 1")
5322
+	table := XTReadDB().Table("xt_base_drug as b").Where("b.status = 1 and b.org_id = ?", org_id)
5317
 
5323
 
5318
-	tableOne := XTReadDB().Table("xt_drug_warehouse as p")
5324
+	tableOne := XTReadDB().Table("xt_drug_warehouse as p").Where("p.status=1 and p.org_id=?", org_id)
5319
 	fmt.Println("table", table)
5325
 	fmt.Println("table", table)
5320
 	fmt.Println("tableOne", tableOne)
5326
 	fmt.Println("tableOne", tableOne)
5321
 	if len(warehouse_out_id) > 0 {
5327
 	if len(warehouse_out_id) > 0 {
5337
 	return out, err
5343
 	return out, err
5338
 }
5344
 }
5339
 
5345
 
5340
-func GetExportOutOrderDrugListOne(warehouse_out_id []string) (out []*models.StDrugWarehouseOutInfo, err error) {
5341
-	db := XTReadDB().Table("xt_drug_flow as x").Where("x.status = 1")
5342
-	table := XTReadDB().Table("xt_base_drug as b").Where("b.status = 1")
5346
+func GetExportOutOrderDrugListOne(warehouse_out_id []string, org_id int64) (out []*models.StDrugWarehouseOutInfo, err error) {
5347
+	db := XTReadDB().Table("xt_drug_flow as x").Where("x.status = 1 and x.user_org_id =?", org_id)
5348
+	table := XTReadDB().Table("xt_base_drug as b").Where("b.status = 1 and b.org_id = ?", org_id)
5343
 	fmt.Println("table", table)
5349
 	fmt.Println("table", table)
5344
 	if len(warehouse_out_id) > 0 {
5350
 	if len(warehouse_out_id) > 0 {
5345
 		db = db.Where("x.warehouse_out_id in(?)", warehouse_out_id)
5351
 		db = db.Where("x.warehouse_out_id in(?)", warehouse_out_id)