|
@@ -27,6 +27,7 @@ func SupplyOrderApiRegistRouters() {
|
27
|
27
|
beego.Router("/api/supply/updatepurchaseorder", &SupplyOrderApiController{}, "Post:UpdatePurchaseOrder")
|
28
|
28
|
beego.Router("/api/supply/checkpurchaseorder", &SupplyOrderApiController{}, "get:UpdateSupplyWaresing")
|
29
|
29
|
beego.Router("/api/supply/getpurchaseorderdetail", &SupplyOrderApiController{}, "get:GetPurchaseOrderDetail")
|
|
30
|
+ beego.Router("/api/supply/addgoodorder", &SupplyOrderApiController{}, "post:AddGoodOrder")
|
30
|
31
|
}
|
31
|
32
|
|
32
|
33
|
func (this *SupplyOrderApiController) GetInitOrder() {
|
|
@@ -226,6 +227,14 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
226
|
227
|
|
227
|
228
|
name := items["name"].(string)
|
228
|
229
|
|
|
230
|
+ if items["supply_unit"] == nil || reflect.TypeOf(items["supply_unit"]).String() != "string" {
|
|
231
|
+ utils.ErrorLog("supply_unit")
|
|
232
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
233
|
+ return
|
|
234
|
+ }
|
|
235
|
+
|
|
236
|
+ supply_unit := items["supply_unit"].(string)
|
|
237
|
+
|
229
|
238
|
order := models.SupplierWarehousingInfoOrder{
|
230
|
239
|
OrderNumber: warehousing_order,
|
231
|
240
|
IsSource: is_source,
|
|
@@ -245,6 +254,7 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
245
|
254
|
SupplyTotal: supply_total,
|
246
|
255
|
SupplyManufacturer: supply_manufacturer,
|
247
|
256
|
Name: name,
|
|
257
|
+ SupplyUnit: supply_unit,
|
248
|
258
|
}
|
249
|
259
|
|
250
|
260
|
warehousingInfo = append(warehousingInfo, &order)
|
|
@@ -487,6 +497,13 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
487
|
497
|
|
488
|
498
|
name := items["name"].(string)
|
489
|
499
|
|
|
500
|
+ if items["supply_unit"] == nil || reflect.TypeOf(items["supply_unit"]).String() != "string" {
|
|
501
|
+ utils.ErrorLog("supply_unit")
|
|
502
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
503
|
+ return
|
|
504
|
+ }
|
|
505
|
+
|
|
506
|
+ supply_unit := items["supply_unit"].(string)
|
490
|
507
|
if id > 0 {
|
491
|
508
|
order := models.SupplierWarehousingInfoOrder{
|
492
|
509
|
ID: id,
|
|
@@ -505,6 +522,7 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
505
|
522
|
SupplyTotal: supply_total,
|
506
|
523
|
SupplyManufacturer: supply_manufacturer,
|
507
|
524
|
Name: name,
|
|
525
|
+ SupplyUnit: supply_unit,
|
508
|
526
|
}
|
509
|
527
|
|
510
|
528
|
updateWarehousingInfo = append(updateWarehousingInfo, &order)
|
|
@@ -524,13 +542,14 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
524
|
542
|
Status: 1,
|
525
|
543
|
Mtime: 0,
|
526
|
544
|
WarehousingId: warehousing_id,
|
527
|
|
- ProjectId: id,
|
|
545
|
+ ProjectId: project_id,
|
528
|
546
|
SupplyLicenseNumber: supply_license_number,
|
529
|
547
|
SupplyType: supply_type,
|
530
|
548
|
SupplySpecificationName: supply_specification_name,
|
531
|
549
|
SupplyTotal: supply_total,
|
532
|
550
|
SupplyManufacturer: supply_manufacturer,
|
533
|
551
|
Name: name,
|
|
552
|
+ SupplyUnit: supply_unit,
|
534
|
553
|
}
|
535
|
554
|
warehousingInfo = append(warehousingInfo, &order)
|
536
|
555
|
}
|
|
@@ -589,13 +608,44 @@ func (this *SupplyOrderApiController) GetPurchaseOrderDetail() {
|
589
|
608
|
orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
|
590
|
609
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
591
|
610
|
supplyList, _ := service.GetSupplierList(orgId)
|
|
611
|
+ //获取药品库数据
|
|
612
|
+ baseList, _ := service.GetSupplyDrugList(orgId)
|
|
613
|
+
|
|
614
|
+ goodList, _ := service.GetSupplyGoodList(orgId)
|
592
|
615
|
if err == nil {
|
593
|
616
|
this.ServeSuccessJSON(map[string]interface{}{
|
594
|
617
|
"info": info,
|
595
|
618
|
"orderInfo": orderInfo,
|
596
|
619
|
"supplyList": supplyList,
|
|
620
|
+ "baseList": baseList,
|
|
621
|
+ "goodList": goodList,
|
597
|
622
|
})
|
598
|
623
|
} else {
|
599
|
624
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
600
|
625
|
}
|
601
|
626
|
}
|
|
627
|
+
|
|
628
|
+func (this *SupplyOrderApiController) AddGoodOrder() {
|
|
629
|
+
|
|
630
|
+ supplier_id, _ := this.GetInt64("supplier_id")
|
|
631
|
+ start_time := this.GetString("start")
|
|
632
|
+ timeLayout := "2006-01-02"
|
|
633
|
+ loc, _ := time.LoadLocation("Local")
|
|
634
|
+ var startTime int64
|
|
635
|
+ if len(start_time) > 0 {
|
|
636
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
|
|
637
|
+ if err != nil {
|
|
638
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
639
|
+ return
|
|
640
|
+ }
|
|
641
|
+ startTime = theTime.Unix()
|
|
642
|
+ }
|
|
643
|
+ good_number := this.GetString("good_number")
|
|
644
|
+ arrerage, _ := this.GetInt64("arrerage")
|
|
645
|
+ payment, _ := this.GetInt64("payment")
|
|
646
|
+ warehousing_id, _ := this.GetInt64("warehousing_id")
|
|
647
|
+ number := this.GetString("number")
|
|
648
|
+ rate_of_concession, _ := this.GetInt64("rate_of_concession")
|
|
649
|
+ discount_amount, _ := this.GetInt64("discount_amount")
|
|
650
|
+ fmt.Println(supplier_id, startTime, good_number, arrerage, payment, warehousing_id, number, rate_of_concession, discount_amount)
|
|
651
|
+}
|