瀏覽代碼

耗材参数

XMLWAN 3 年之前
父節點
當前提交
5ef0a506f0

+ 1 - 0
controllers/drug_stock_api_contorller.go 查看文件

1998
 	}
1998
 	}
1999
 	adminUserInfo := this.GetAdminUserInfo()
1999
 	adminUserInfo := this.GetAdminUserInfo()
2000
 	userDetails, err, total := service.FindDrugStockUserDetailById(adminUserInfo.CurrentOrgId, order_id)
2000
 	userDetails, err, total := service.FindDrugStockUserDetailById(adminUserInfo.CurrentOrgId, order_id)
2001
+
2001
 	if err == nil {
2002
 	if err == nil {
2002
 		this.ServeSuccessJSON(map[string]interface{}{
2003
 		this.ServeSuccessJSON(map[string]interface{}{
2003
 			"list":  userDetails,
2004
 			"list":  userDetails,

+ 5 - 3
controllers/gobal_config_api_controller.go 查看文件

1787
 	drugConfig, _ := service.GetDrugStockConfig(orgId)
1787
 	drugConfig, _ := service.GetDrugStockConfig(orgId)
1788
 	list, err := service.GetDrugAutoMaticList(orgId, warehous_out_id, record_time, warehouse_out_order_number)
1788
 	list, err := service.GetDrugAutoMaticList(orgId, warehous_out_id, record_time, warehouse_out_order_number)
1789
 	drugList, err := service.GetAllBaseDrugList(orgId)
1789
 	drugList, err := service.GetAllBaseDrugList(orgId)
1790
+	manufacturerList, _ := service.GetAllManufacturerList(orgId)
1790
 	if err != nil {
1791
 	if err != nil {
1791
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1792
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeCreateConfig)
1792
 		return
1793
 		return
1793
 	}
1794
 	}
1794
 	c.ServeSuccessJSON(map[string]interface{}{
1795
 	c.ServeSuccessJSON(map[string]interface{}{
1795
-		"list":       list,
1796
-		"drugConfig": drugConfig,
1797
-		"drugList":   drugList,
1796
+		"list":             list,
1797
+		"drugConfig":       drugConfig,
1798
+		"drugList":         drugList,
1799
+		"manufacturerList": manufacturerList,
1798
 	})
1800
 	})
1799
 }
1801
 }
1800
 
1802
 

+ 24 - 29
controllers/stock_in_api_controller.go 查看文件

93
 func (c *StockManagerApiController) CreateWarehouse() {
93
 func (c *StockManagerApiController) CreateWarehouse() {
94
 
94
 
95
 	warehousing_time := c.GetString("warehousing_time")
95
 	warehousing_time := c.GetString("warehousing_time")
96
-	dealer_id, _ := c.GetInt64("dealer_id", 0)
97
-	manufacturer_id, _ := c.GetInt64("manufacturer_id", 0)
98
 
96
 
99
 	types, _ := c.GetInt64("type", 0)
97
 	types, _ := c.GetInt64("type", 0)
100
 
98
 
122
 		Ctime:            ctime,
120
 		Ctime:            ctime,
123
 		Status:           1,
121
 		Status:           1,
124
 		WarehousingTime:  warehousingDate.Unix(),
122
 		WarehousingTime:  warehousingDate.Unix(),
125
-		Dealer:           dealer_id,
126
-		Manufacturer:     manufacturer_id,
127
 		Type:             types,
123
 		Type:             types,
128
 	}
124
 	}
129
 	service.AddSigleWarehouse(&warehousing)
125
 	service.AddSigleWarehouse(&warehousing)
210
 
206
 
211
 				remark, _ := items["remark"].(string)
207
 				remark, _ := items["remark"].(string)
212
 
208
 
209
+				manufacturer := int64(items["manufacturer"].(float64))
210
+				dealer := int64(items["dealer"].(float64))
213
 				warehouseInfo := &models.WarehousingInfo{
211
 				warehouseInfo := &models.WarehousingInfo{
214
 					WarehousingOrder: warehousing.WarehousingOrder,
212
 					WarehousingOrder: warehousing.WarehousingOrder,
215
 					WarehousingId:    warehousing.ID,
213
 					WarehousingId:    warehousing.ID,
226
 					Remark:           remark,
224
 					Remark:           remark,
227
 					OrgId:            adminUserInfo.CurrentOrgId,
225
 					OrgId:            adminUserInfo.CurrentOrgId,
228
 					Type:             types,
226
 					Type:             types,
229
-					Manufacturer:     manufacturer_id,
230
-					Dealer:           dealer_id,
227
+					Manufacturer:     manufacturer,
231
 					StockCount:       warehousing_count,
228
 					StockCount:       warehousing_count,
229
+					Dealer:           dealer,
232
 				}
230
 				}
233
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
231
 				warehousingInfo = append(warehousingInfo, warehouseInfo)
234
 
232
 
464
 	warehousing_time := c.GetString("warehousing_time")
462
 	warehousing_time := c.GetString("warehousing_time")
465
 	id, _ := c.GetInt64("id", 0)
463
 	id, _ := c.GetInt64("id", 0)
466
 	types, _ := c.GetInt64("type", 0)
464
 	types, _ := c.GetInt64("type", 0)
467
-	manufacturer_id, _ := c.GetInt64("manufacturer_id", 0)
468
-	dealer_id, _ := c.GetInt64("dealer_id", 0)
469
 
465
 
470
 	if id == 0 {
466
 	if id == 0 {
471
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
467
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
493
 		Status:           1,
489
 		Status:           1,
494
 		WarehousingTime:  warehousingDate.Unix(),
490
 		WarehousingTime:  warehousingDate.Unix(),
495
 		Type:             warehouse.Type,
491
 		Type:             warehouse.Type,
496
-		Dealer:           dealer_id,
497
-		Manufacturer:     manufacturer_id,
498
 	}
492
 	}
499
 
493
 
500
 	service.EditWarehousing(warehousing)
494
 	service.EditWarehousing(warehousing)
583
 
577
 
584
 				remark, _ := items["remark"].(string)
578
 				remark, _ := items["remark"].(string)
585
 
579
 
580
+				manufacturer := int64(items["manufacturer"].(float64))
581
+				dealer := int64(items["dealer"].(float64))
582
+
586
 				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
583
 				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
587
 					utils.ErrorLog("id")
584
 					utils.ErrorLog("id")
588
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
585
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
607
 						Remark:           remark,
604
 						Remark:           remark,
608
 						OrgId:            adminUserInfo.CurrentOrgId,
605
 						OrgId:            adminUserInfo.CurrentOrgId,
609
 						Type:             types,
606
 						Type:             types,
610
-						Manufacturer:     manufacturer_id,
611
-						Dealer:           dealer_id,
607
+						Manufacturer:     manufacturer,
608
+						Dealer:           dealer,
609
+						StockCount:       warehousing_count,
612
 					}
610
 					}
613
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
611
 					warehousingInfo = append(warehousingInfo, warehouseInfo)
614
 
612
 
630
 						Remark:           remark,
628
 						Remark:           remark,
631
 						OrgId:            adminUserInfo.CurrentOrgId,
629
 						OrgId:            adminUserInfo.CurrentOrgId,
632
 						Type:             types,
630
 						Type:             types,
633
-						Manufacturer:     manufacturer_id,
634
-						Dealer:           dealer_id,
631
+						Manufacturer:     manufacturer,
632
+						Dealer:           dealer,
633
+						StockCount:       warehousing_count,
635
 					}
634
 					}
636
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
635
 					upDateWarehousingInfo = append(upDateWarehousingInfo, warehouseInfo)
637
 				}
636
 				}
1042
 }
1041
 }
1043
 
1042
 
1044
 func (c *StockManagerApiController) CreateWarehouseOut() {
1043
 func (c *StockManagerApiController) CreateWarehouseOut() {
1045
-	dealer_id, _ := c.GetInt64("dealer_id", 0)
1046
-	manufacturer_id, _ := c.GetInt64("manufacturer_id", 0)
1044
+
1047
 	types, _ := c.GetInt64("type", 0)
1045
 	types, _ := c.GetInt64("type", 0)
1048
 
1046
 
1049
 	ctime := time.Now().Unix()
1047
 	ctime := time.Now().Unix()
1076
 		Ctime:                   ctime,
1074
 		Ctime:                   ctime,
1077
 		Status:                  1,
1075
 		Status:                  1,
1078
 		WarehouseOutTime:        warehousingOutDate.Unix(),
1076
 		WarehouseOutTime:        warehousingOutDate.Unix(),
1079
-		Dealer:                  dealer_id,
1080
-		Manufacturer:            manufacturer_id,
1081
 		Type:                    types,
1077
 		Type:                    types,
1082
 	}
1078
 	}
1083
 	service.AddSigleWarehouseOut(&warehouseOut)
1079
 	service.AddSigleWarehouseOut(&warehouseOut)
1105
 				}
1101
 				}
1106
 
1102
 
1107
 				good_id := int64(items["good_id"].(float64))
1103
 				good_id := int64(items["good_id"].(float64))
1108
-				fmt.Println("stockout223232324343445456465656565565665", good_id)
1104
+
1109
 				if items["good_type_id"] == nil || reflect.TypeOf(items["good_type_id"]).String() != "float64" {
1105
 				if items["good_type_id"] == nil || reflect.TypeOf(items["good_type_id"]).String() != "float64" {
1110
 					utils.ErrorLog("good_type_id")
1106
 					utils.ErrorLog("good_type_id")
1111
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1107
 					c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1131
 				total := float64(count) * price
1127
 				total := float64(count) * price
1132
 				remark := items["remark"].(string)
1128
 				remark := items["remark"].(string)
1133
 
1129
 
1130
+				manufacturer := int64(items["manufacturer"].(float64))
1131
+
1134
 				warehouseOutInfo := &models.WarehouseOutInfo{
1132
 				warehouseOutInfo := &models.WarehouseOutInfo{
1135
 					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1133
 					WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1136
 					WarehouseOutId:          warehouseOut.ID,
1134
 					WarehouseOutId:          warehouseOut.ID,
1144
 					Remark:                  remark,
1142
 					Remark:                  remark,
1145
 					OrgId:                   adminUserInfo.CurrentOrgId,
1143
 					OrgId:                   adminUserInfo.CurrentOrgId,
1146
 					Type:                    types,
1144
 					Type:                    types,
1147
-					Manufacturer:            manufacturer_id,
1148
-					Dealer:                  dealer_id,
1145
+					Manufacturer:            manufacturer,
1149
 				}
1146
 				}
1150
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1147
 				warehousingOutInfo = append(warehousingOutInfo, warehouseOutInfo)
1151
 
1148
 
1284
 	warehouse_out_time := c.GetString("warehouse_out_time")
1281
 	warehouse_out_time := c.GetString("warehouse_out_time")
1285
 	id, _ := c.GetInt64("id", 0)
1282
 	id, _ := c.GetInt64("id", 0)
1286
 	types, _ := c.GetInt64("type", 0)
1283
 	types, _ := c.GetInt64("type", 0)
1287
-	manufacturer_id, _ := c.GetInt64("manufacturer_id", 0)
1288
-	dealer_id, _ := c.GetInt64("dealer_id", 0)
1289
 
1284
 
1290
 	if id == 0 {
1285
 	if id == 0 {
1291
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1286
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1309
 		ID:               warehouseOut.ID,
1304
 		ID:               warehouseOut.ID,
1310
 		Mtime:            mtime,
1305
 		Mtime:            mtime,
1311
 		WarehouseOutTime: warehouseOutDate.Unix(),
1306
 		WarehouseOutTime: warehouseOutDate.Unix(),
1312
-		Manufacturer:     manufacturer_id,
1313
-		Dealer:           dealer_id,
1314
 	}
1307
 	}
1315
 
1308
 
1316
 	service.EditWarehouseOut(tempWarehouseOut)
1309
 	service.EditWarehouseOut(tempWarehouseOut)
1371
 				}
1364
 				}
1372
 				id := int64(items["id"].(float64))
1365
 				id := int64(items["id"].(float64))
1373
 
1366
 
1367
+				manufacturer := int64(items["manufacturer"].(float64))
1374
 				if id == 0 {
1368
 				if id == 0 {
1375
 					warehouseOutInfo := &models.WarehouseOutInfo{
1369
 					warehouseOutInfo := &models.WarehouseOutInfo{
1376
 						WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1370
 						WarehouseOutOrderNumber: warehouseOut.WarehouseOutOrderNumber,
1385
 						Remark:                  remark,
1379
 						Remark:                  remark,
1386
 						OrgId:                   adminUserInfo.CurrentOrgId,
1380
 						OrgId:                   adminUserInfo.CurrentOrgId,
1387
 						Type:                    types,
1381
 						Type:                    types,
1388
-						Manufacturer:            manufacturer_id,
1389
-						Dealer:                  dealer_id,
1390
 						IsSys:                   0,
1382
 						IsSys:                   0,
1391
 						SysRecordTime:           0,
1383
 						SysRecordTime:           0,
1392
 					}
1384
 					}
1422
 						OrgId:                   adminUserInfo.CurrentOrgId,
1414
 						OrgId:                   adminUserInfo.CurrentOrgId,
1423
 						Mtime:                   time.Now().Unix(),
1415
 						Mtime:                   time.Now().Unix(),
1424
 						Type:                    types,
1416
 						Type:                    types,
1425
-						Manufacturer:            manufacturer_id,
1426
-						Dealer:                  dealer_id,
1417
+						Manufacturer:            manufacturer,
1427
 						IsSys:                   is_sys,
1418
 						IsSys:                   is_sys,
1428
 						SysRecordTime:           sys_record_time,
1419
 						SysRecordTime:           sys_record_time,
1429
 					}
1420
 					}
3615
 	orgId := adminUserInfo.CurrentOrgId
3606
 	orgId := adminUserInfo.CurrentOrgId
3616
 	list, _ := service.GetSearchGoodList(keyword, orgId)
3607
 	list, _ := service.GetSearchGoodList(keyword, orgId)
3617
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3608
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3609
+	dealerList, _ := service.GetAllDealerList(orgId)
3618
 	this.ServeSuccessJSON(map[string]interface{}{
3610
 	this.ServeSuccessJSON(map[string]interface{}{
3619
 		"list":             list,
3611
 		"list":             list,
3620
 		"manufacturerList": manufacturerList,
3612
 		"manufacturerList": manufacturerList,
3613
+		"dealerList":       dealerList,
3621
 	})
3614
 	})
3622
 }
3615
 }
3623
 
3616
 
3695
 	}
3688
 	}
3696
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3689
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3697
 	list, total, _ := service.GetStockListById(id, orgId, limit, page, startTime, endTime)
3690
 	list, total, _ := service.GetStockListById(id, orgId, limit, page, startTime, endTime)
3691
+	outList, _, _ := service.GetStockOutList(id, orgId, limit, page, startTime, endTime)
3698
 	this.ServeSuccessJSON(map[string]interface{}{
3692
 	this.ServeSuccessJSON(map[string]interface{}{
3699
 		"list":             list,
3693
 		"list":             list,
3700
 		"total":            total,
3694
 		"total":            total,
3701
 		"manufacturerList": manufacturerList,
3695
 		"manufacturerList": manufacturerList,
3696
+		"outList":          outList,
3702
 	})
3697
 	})
3703
 }
3698
 }
3704
 
3699
 

+ 2 - 2
service/gobal_config_service.go 查看文件

548
 		db = db.Where("x.drug_id = ?", drugid)
548
 		db = db.Where("x.drug_id = ?", drugid)
549
 	}
549
 	}
550
 
550
 
551
-	err = db.Joins("left join xt_base_drug as t on t.id = x.drug_id and t.status = 1 and t.org_id = ?", orgid).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.total_price,x.dealer,x.remark,x.org_id,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.batch_number,t.drug_name,t.drug_type,t.max_unit,t.min_unit,t.min_number,t.dose,t.dose_unit,t.last_price,t.manufacturer").Offset(offset).Count(&total).Order("x.ctime desc").Scan(&list).Error
551
+	err = db.Joins("left join xt_base_drug as t on t.id = x.drug_id and t.status = 1 and t.org_id = ?", orgid).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.total_price,x.dealer,x.remark,x.org_id,x.is_return,x.warehousing_order,x.type,x.retail_price,x.retail_total_price,x.batch_number,x.ctime,t.drug_name,t.drug_type,t.max_unit,t.min_unit,t.min_number,t.dose,t.dose_unit,t.last_price,t.manufacturer").Offset(offset).Count(&total).Order("x.ctime desc").Scan(&list).Error
552
 	return list, total, err
552
 	return list, total, err
553
 }
553
 }
554
 
554
 
576
 	if stocktype == 2 {
576
 	if stocktype == 2 {
577
 		db = db.Where("x,is_sys = 1")
577
 		db = db.Where("x,is_sys = 1")
578
 	}
578
 	}
579
-	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,x.warehouse_info_id").Offset(offset).Count(&total).Order("x.ctime desc").Scan(&list).Error
579
+	err = db.Select("x.id,x.warehouse_out_id,x.drug_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.org_id,x.remark,x.is_cancel,x.warehouse_out_order_number,x.type,x.dealer,x.manufacturer,x.is_sys,x.sys_record_time,x.retail_price,x.retail_total_price,x.warehouse_info_id,x.ctime").Offset(offset).Count(&total).Order("x.ctime desc").Scan(&list).Error
580
 	return list, total, err
580
 	return list, total, err
581
 }
581
 }
582
 
582
 

+ 13 - 3
service/stock_service.go 查看文件

2782
 	if good_id > 0 {
2782
 	if good_id > 0 {
2783
 		db = db.Where("x.good_id = ?", good_id)
2783
 		db = db.Where("x.good_id = ?", good_id)
2784
 	}
2784
 	}
2785
-	err = db.Select("x.id,x.warehousing_id,x.good_id,x.good_type_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.warehousing_unit,x.stock_count,x.price,x.total_price,x.dealer,x.manufacturer,x.remark,x.ctime,x.is_return,x.warehousing_order,x.type,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.min_unit").Joins("left join xt_good_information as t on t.id = x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&info).Error
2785
+	err = db.Select("x.id,x.warehousing_id,x.good_id,x.good_type_id,x.number,x.product_date,x.expiry_date,x.warehousing_count,x.warehousing_unit,x.stock_count,x.price,x.total_price,x.dealer,t.manufacturer,x.remark,x.ctime,x.is_return,x.warehousing_order,x.type,t.good_name,t.good_type_id,t.specification_name,t.min_number,t.min_unit").Joins("left join xt_good_information as t on t.id = x.good_id").Count(&total).Offset(offset).Limit(limit).Scan(&info).Error
2786
 	return info, total, err
2786
 	return info, total, err
2787
 
2787
 
2788
 }
2788
 }
2804
 	if good_id > 0 {
2804
 	if good_id > 0 {
2805
 		db = db.Where("x.good_id = ?", good_id)
2805
 		db = db.Where("x.good_id = ?", good_id)
2806
 	}
2806
 	}
2807
-	err = db.Select("x.id,x.warehouse_out_id,x.warehouse_info_id,x.good_id,x.good_type_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id").Offset(offset).Count(&total).Scan(&info).Error
2807
+	err = db.Select("x.id,x.warehouse_out_id,x.warehouse_info_id,x.good_id,x.good_type_id,x.warehousing_out_target,x.count,x.price,x.total_price,x.product_date,x.expiry_date,x.ctime,x.org_id,x.warehouse_out_order_number").Offset(offset).Count(&total).Scan(&info).Error
2808
 	return info, total, err
2808
 	return info, total, err
2809
 }
2809
 }
2810
 
2810
 
2843
 
2843
 
2844
 func GetOutStockTotalCountFour(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
2844
 func GetOutStockTotalCountFour(startime int64, endtime int64, orgid int64) (autoMatic []*models.NewXtAutomaticReduceDetail, err error) {
2845
 
2845
 
2846
-	err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >=? and x.record_time<=? and `status` = 1)  as b GROUP BY good_id", orgid, startime, endtime).Scan(&autoMatic).Error
2846
+	if startime > 0 {
2847
+		err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time >=?  and `status` = 1)  as b GROUP BY good_id", orgid, startime).Scan(&autoMatic).Error
2848
+	} else {
2849
+		err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and `status` = 1)  as b GROUP BY good_id", orgid).Scan(&autoMatic).Error
2850
+	}
2851
+
2852
+	if endtime > 0 {
2853
+		err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and x.record_time <=?  and `status` = 1)  as b GROUP BY good_id", orgid, endtime).Scan(&autoMatic).Error
2854
+	} else {
2855
+		err = XTReadDB().Raw("SELECT good_id,SUM(b.count) as count FROM (SELECT DISTINCT x.patient_id,x.good_id,x.count FROM xt_automatic_reduce_detail as x WHERE x.org_id = ? and `status` = 1)  as b GROUP BY good_id", orgid).Scan(&autoMatic).Error
2856
+	}
2847
 
2857
 
2848
 	return autoMatic, err
2858
 	return autoMatic, err
2849
 
2859
 

+ 5 - 6
service/warhouse_service.go 查看文件

879
 			}
879
 			}
880
 		}
880
 		}
881
 		fmt.Println("newcount9999999999999999999999999999999", goods.NewCount)
881
 		fmt.Println("newcount9999999999999999999999999999999", goods.NewCount)
882
-		
882
+
883
 		maxNumber = goods.Count
883
 		maxNumber = goods.Count
884
-		
885
 
884
 
886
 		if warehouse.StockCount < maxNumber {
885
 		if warehouse.StockCount < maxNumber {
887
 			return errors.New("库存数量不足")
886
 			return errors.New("库存数量不足")
1019
 		goods.Count = deliver_number - stock_number
1018
 		goods.Count = deliver_number - stock_number
1020
 
1019
 
1021
 		ConsumablesDelivery(orgID, patient_id, record_time, goods, warehouseOut, count)
1020
 		ConsumablesDelivery(orgID, patient_id, record_time, goods, warehouseOut, count)
1022
-		
1021
+
1023
 	}
1022
 	}
1024
 	return nil
1023
 	return nil
1025
 }
1024
 }
1280
 			Type:                    1,
1279
 			Type:                    1,
1281
 			Manufacturer:            0,
1280
 			Manufacturer:            0,
1282
 			Dealer:                  0,
1281
 			Dealer:                  0,
1283
-			IsSys:                   2,
1282
+			IsSys:                   1,
1284
 			SysRecordTime:           record_time,
1283
 			SysRecordTime:           record_time,
1285
 			GoodTypeId:              goods.GoodTypeId,
1284
 			GoodTypeId:              goods.GoodTypeId,
1286
 			GoodId:                  goods.GoodId,
1285
 			GoodId:                  goods.GoodId,
1308
 				Type:                    1,
1307
 				Type:                    1,
1309
 				Manufacturer:            0,
1308
 				Manufacturer:            0,
1310
 				Dealer:                  0,
1309
 				Dealer:                  0,
1311
-				IsSys:                   2,
1310
+				IsSys:                   1,
1312
 				SysRecordTime:           record_time,
1311
 				SysRecordTime:           record_time,
1313
 				GoodTypeId:              goods.GoodTypeId,
1312
 				GoodTypeId:              goods.GoodTypeId,
1314
 				GoodId:                  goods.GoodId,
1313
 				GoodId:                  goods.GoodId,
1431
 			Type:          1,
1430
 			Type:          1,
1432
 			Manufacturer:  0,
1431
 			Manufacturer:  0,
1433
 			Dealer:        0,
1432
 			Dealer:        0,
1434
-			IsSys:         2,
1433
+			IsSys:         1,
1435
 			SysRecordTime: record_time,
1434
 			SysRecordTime: record_time,
1436
 			GoodTypeId:    good_yc.GoodTypeId,
1435
 			GoodTypeId:    good_yc.GoodTypeId,
1437
 			GoodId:        good_yc.GoodId,
1436
 			GoodId:        good_yc.GoodId,