Browse Source

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

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

+ 16 - 1
service/his_service.go View File

1726
 }
1726
 }
1727
 
1727
 
1728
 func SaveDF(df *models.DrugFlow) (err error) {
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
 	return
1745
 	return
1731
 }
1746
 }