28169 1 kuukausi sitten
vanhempi
commit
2077b285fb

+ 4 - 3
controllers/gobal_config_api_controller.go Näytä tiedosto

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

+ 0 - 1
controllers/stock_in_api_controller.go Näytä tiedosto

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

+ 13 - 7
service/stock_service.go Näytä tiedosto

@@ -4856,6 +4856,12 @@ func GetOutExprotList(orgid int64, ids []string, startime int64, endtime int64)
4856 4856
 	if orgid > 0 {
4857 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 4866
 	if len(ids) > 0 {
4861 4867
 		db = db.Where("x.warehouse_out_id in (?)", ids)
@@ -5309,13 +5315,13 @@ func GetDrugBatchNumber(drug_id int64, orgid int64) (info []*models.DrugWarehous
5309 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 5325
 	fmt.Println("table", table)
5320 5326
 	fmt.Println("tableOne", tableOne)
5321 5327
 	if len(warehouse_out_id) > 0 {
@@ -5337,9 +5343,9 @@ func GetExportOutOrderDrugList(warehouse_out_id []string) (out []*models.StDrugW
5337 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 5349
 	fmt.Println("table", table)
5344 5350
 	if len(warehouse_out_id) > 0 {
5345 5351
 		db = db.Where("x.warehouse_out_id in(?)", warehouse_out_id)