Browse Source

Merge branch 'master' of http://git.shengws.com/csx/gdyb

test_user 5 months ago
parent
commit
e0ade730eb
2 changed files with 24 additions and 9 deletions
  1. 8 8
      controllers/sg/his_api_controller.go
  2. 16 1
      service/his_service.go

+ 8 - 8
controllers/sg/his_api_controller.go View File

@@ -643,7 +643,7 @@ func (c *HisApiController) ChangeDrug() {
643 643
 						if res3.Infcode != -1{
644 644
 							item.IsChange = 1
645 645
 							item.Bchno = item.NewDrugWarehouseInfo.Bchno
646
-							service.SaveDF(item)
646
+							service.SaveDF2(item)
647 647
 						}else{
648 648
 							err = append(err,item.HisDoctorAdviceInfo.AdviceName +",销售变更失败:"+res3.ErrMsg)
649 649
 						}
@@ -690,7 +690,7 @@ func (c *HisApiController) ChangeDrug() {
690 690
 								if res3.Infcode != -1 {
691 691
 									item.IsChange = 1
692 692
 									item.Bchno = item.NewDrugWarehouseInfo.Bchno
693
-									service.SaveDF(item)
693
+									service.SaveDF2(item)
694 694
 								} else {
695 695
 									err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
696 696
 								}
@@ -720,7 +720,7 @@ func (c *HisApiController) ChangeDrug() {
720 720
 					if res3.Infcode != -1{
721 721
 						item.IsChange = 1
722 722
 						item.Bchno = item.NewDrugWarehouseInfo.Bchno
723
-						service.SaveDF(item)
723
+						service.SaveDF2(item)
724 724
 					}else{
725 725
 						err = append(err,item.HisDoctorAdviceInfo.AdviceName +",销售变更失败:"+res3.ErrMsg)
726 726
 					}
@@ -735,7 +735,7 @@ func (c *HisApiController) ChangeDrug() {
735 735
 				if item.IsSale == 1 { //是否已经销售,1是   0否
736 736
 					//是否已经变更 1是  0否
737 737
 					if item.IsChange == 0 { //没变更,进行变更操作
738
-						result, result2  :=ChangeStock(item.Count, item, miConfig, "107", roles)
738
+						result, result2  := ChangeStock(item.Count, item, miConfig, "107", roles)
739 739
 						saveLog(result, result2, "3502", "自动出库,未销售,未变更3502")
740 740
 
741 741
 						var respJSON3 map[string]interface{}
@@ -753,7 +753,7 @@ func (c *HisApiController) ChangeDrug() {
753 753
 						if res3.Infcode != -1{
754 754
 							item.IsChange = 1
755 755
 							item.Bchno = item.NewDrugWarehouseInfo.Bchno
756
-							service.SaveDF(item)
756
+							service.SaveDF2(item)
757 757
 						}else{
758 758
 							err = append(err,item.HisDoctorAdviceInfo.AdviceName +",销售变更失败:"+res3.ErrMsg)
759 759
 						}
@@ -781,7 +781,7 @@ func (c *HisApiController) ChangeDrug() {
781 781
 						if res3.Infcode != -1{
782 782
 							item.IsChange = 1
783 783
 							item.Bchno = item.NewDrugWarehouseInfo.Bchno
784
-							service.SaveDF(item)
784
+							service.SaveDF2(item)
785 785
 						}else{
786 786
 							err = append(err,item.HisDoctorAdviceInfo.AdviceName +",销售变更失败:"+res3.ErrMsg)
787 787
 						}
@@ -807,7 +807,7 @@ func (c *HisApiController) ChangeDrug() {
807 807
 					if res3.Infcode != -1{
808 808
 						item.IsChange = 1
809 809
 						item.Bchno = item.NewDrugWarehouseInfo.Bchno
810
-						service.SaveDF(item)
810
+						service.SaveDF2(item)
811 811
 					}else{
812 812
 						err = append(err,item.HisDoctorAdviceInfo.AdviceName +",销售变更失败:"+res3.ErrMsg)
813 813
 					}
@@ -835,7 +835,7 @@ func (c *HisApiController) ChangeDrug() {
835 835
 				if res3.Infcode != -1{
836 836
 					item.IsChange = 1
837 837
 					item.Bchno = item.NewDrugWarehouseInfo.Bchno
838
-					service.SaveDF(item)
838
+					service.SaveDF2(item)
839 839
 				}else{
840 840
 					err = append(err,item.HisDoctorAdviceInfo.AdviceName +",销售变更失败:"+res3.ErrMsg)
841 841
 				}

+ 16 - 1
service/his_service.go View File

@@ -1726,6 +1726,21 @@ func GetHisOrderByNumber(number string) (order models.HisOrder) {
1726 1726
 }
1727 1727
 
1728 1728
 func SaveDF(df *models.DrugFlow) (err error) {
1729
-	err = writeDb.Save(&df).Error
1729
+	//err = writeDb.(&df).Error
1730
+	err = XTWriteDB().Model(&models.DrugFlow{}).Where("id = ? ", df.ID).Updates(map[string]interface{}{
1731
+		"is_sale":   df.IsSale,
1732
+		"sale_date": df.SaleDate,
1733
+		//"is_change"
1734
+	}).Error
1735
+	return
1736
+}
1737
+
1738
+func SaveDF2(df *models.DrugFlow) (err error) {
1739
+	//err = writeDb.(&df).Error
1740
+	err = XTWriteDB().Model(&models.DrugFlow{}).Where("id = ? ", df.ID).Updates(map[string]interface{}{
1741
+		"is_change": df.IsChange,
1742
+		"bchno":     df.Bchno,
1743
+		//"is_change"
1744
+	}).Error
1730 1745
 	return
1731 1746
 }