|
@@ -25,6 +25,9 @@ func SupplyOrderApiRegistRouters() {
|
25
|
25
|
beego.Router("/api/supply/getallsupply", &SupplyOrderApiController{}, "get:GetAllSupply")
|
26
|
26
|
beego.Router("/api/supply/getallpurchaseorderlist", &SupplyOrderApiController{}, "get:GetAllPurchaseOrderList")
|
27
|
27
|
beego.Router("/api/supply/updatepurchaseorder", &SupplyOrderApiController{}, "Post:UpdatePurchaseOrder")
|
|
28
|
+ beego.Router("/api/supply/checkpurchaseorder", &SupplyOrderApiController{}, "get:UpdateSupplyWaresing")
|
|
29
|
+ beego.Router("/api/supply/getpurchaseorderdetail", &SupplyOrderApiController{}, "get:GetPurchaseOrderDetail")
|
|
30
|
+ beego.Router("/api/supply/addgoodorder", &SupplyOrderApiController{}, "post:AddGoodOrder")
|
28
|
31
|
}
|
29
|
32
|
|
30
|
33
|
func (this *SupplyOrderApiController) GetInitOrder() {
|
|
@@ -130,12 +133,12 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
130
|
133
|
for _, item := range thisStockIn {
|
131
|
134
|
items := item.(map[string]interface{})
|
132
|
135
|
|
133
|
|
- if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
134
|
|
- utils.ErrorLog("id")
|
|
136
|
+ if items["project_id"] == nil || reflect.TypeOf(items["project_id"]).String() != "float64" {
|
|
137
|
+ utils.ErrorLog("project_id")
|
135
|
138
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
136
|
139
|
return
|
137
|
140
|
}
|
138
|
|
- id := int64(items["id"].(float64))
|
|
141
|
+ project_id := int64(items["project_id"].(float64))
|
139
|
142
|
|
140
|
143
|
if items["supply_count"] == nil || reflect.TypeOf(items["supply_count"]).String() != "float64" {
|
141
|
144
|
utils.ErrorLog("supply_count")
|
|
@@ -224,6 +227,14 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
224
|
227
|
|
225
|
228
|
name := items["name"].(string)
|
226
|
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
|
+
|
227
|
238
|
order := models.SupplierWarehousingInfoOrder{
|
228
|
239
|
OrderNumber: warehousing_order,
|
229
|
240
|
IsSource: is_source,
|
|
@@ -236,13 +247,14 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
236
|
247
|
Status: 1,
|
237
|
248
|
Mtime: 0,
|
238
|
249
|
WarehousingId: warehouseInfo.ID,
|
239
|
|
- ProjectId: id,
|
|
250
|
+ ProjectId: project_id,
|
240
|
251
|
SupplyLicenseNumber: supply_license_number,
|
241
|
252
|
SupplyType: supply_type,
|
242
|
253
|
SupplySpecificationName: supply_specification_name,
|
243
|
254
|
SupplyTotal: supply_total,
|
244
|
255
|
SupplyManufacturer: supply_manufacturer,
|
245
|
256
|
Name: name,
|
|
257
|
+ SupplyUnit: supply_unit,
|
246
|
258
|
}
|
247
|
259
|
|
248
|
260
|
warehousingInfo = append(warehousingInfo, &order)
|
|
@@ -358,7 +370,7 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
358
|
370
|
discount_amount_float, _ := strconv.ParseFloat(discount_amount, 64)
|
359
|
371
|
warehousing_id, _ := this.GetInt64("id")
|
360
|
372
|
number := this.GetString("number")
|
361
|
|
- fmt.Println("supplier_id23323232323232", supplier_id, startTime, endTime, rate_of_concession, rate_of_concession_float, discount_amount, discount_amount_float)
|
|
373
|
+ //fmt.Println("supplier_id23323232323232", supplier_id, startTime, endTime, rate_of_concession, rate_of_concession_float, discount_amount, discount_amount_float)
|
362
|
374
|
orgId := this.GetAdminUserInfo().CurrentOrgId
|
363
|
375
|
info := models.SupplierWarehouseInfo{
|
364
|
376
|
RateOfConcession: rate_of_concession_float,
|
|
@@ -438,12 +450,12 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
438
|
450
|
supply_total_price := items["supply_total_price"].(string)
|
439
|
451
|
|
440
|
452
|
supply_total_price_float, _ := strconv.ParseFloat(supply_total_price, 64)
|
441
|
|
- if items["is_source"] == nil || reflect.TypeOf(items["is_source"]).String() != "float64" {
|
442
|
|
- utils.ErrorLog("is_source")
|
|
453
|
+ if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
|
454
|
+ utils.ErrorLog("type")
|
443
|
455
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
444
|
456
|
return
|
445
|
457
|
}
|
446
|
|
- is_source := int64(items["is_source"].(float64))
|
|
458
|
+ is_source := int64(items["type"].(float64))
|
447
|
459
|
|
448
|
460
|
if items["supply_type"] == nil || reflect.TypeOf(items["supply_type"]).String() != "string" {
|
449
|
461
|
utils.ErrorLog("supply_type")
|
|
@@ -485,6 +497,13 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
485
|
497
|
|
486
|
498
|
name := items["name"].(string)
|
487
|
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)
|
488
|
507
|
if id > 0 {
|
489
|
508
|
order := models.SupplierWarehousingInfoOrder{
|
490
|
509
|
ID: id,
|
|
@@ -503,6 +522,7 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
503
|
522
|
SupplyTotal: supply_total,
|
504
|
523
|
SupplyManufacturer: supply_manufacturer,
|
505
|
524
|
Name: name,
|
|
525
|
+ SupplyUnit: supply_unit,
|
506
|
526
|
}
|
507
|
527
|
|
508
|
528
|
updateWarehousingInfo = append(updateWarehousingInfo, &order)
|
|
@@ -522,13 +542,14 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
522
|
542
|
Status: 1,
|
523
|
543
|
Mtime: 0,
|
524
|
544
|
WarehousingId: warehousing_id,
|
525
|
|
- ProjectId: id,
|
|
545
|
+ ProjectId: project_id,
|
526
|
546
|
SupplyLicenseNumber: supply_license_number,
|
527
|
547
|
SupplyType: supply_type,
|
528
|
548
|
SupplySpecificationName: supply_specification_name,
|
529
|
549
|
SupplyTotal: supply_total,
|
530
|
550
|
SupplyManufacturer: supply_manufacturer,
|
531
|
551
|
Name: name,
|
|
552
|
+ SupplyUnit: supply_unit,
|
532
|
553
|
}
|
533
|
554
|
warehousingInfo = append(warehousingInfo, &order)
|
534
|
555
|
}
|
|
@@ -553,3 +574,78 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
553
|
574
|
|
554
|
575
|
}
|
555
|
576
|
}
|
|
577
|
+
|
|
578
|
+func (this *SupplyOrderApiController) UpdateSupplyWaresing() {
|
|
579
|
+
|
|
580
|
+ id, _ := this.GetInt64("id")
|
|
581
|
+ recordDateStr := time.Now().Format("2006-01-02")
|
|
582
|
+ recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
583
|
+
|
|
584
|
+ record_date := recordDate.Unix()
|
|
585
|
+ checker := this.GetAdminUserInfo().AdminUser.Id
|
|
586
|
+ info := models.SupplierWarehouseInfo{
|
|
587
|
+ Mtime: time.Now().Unix(),
|
|
588
|
+ Status: 1,
|
|
589
|
+ IsCheck: 1,
|
|
590
|
+ Checker: checker,
|
|
591
|
+ CheckTime: record_date,
|
|
592
|
+ }
|
|
593
|
+ parseDateErr := service.UpdateSupplyWaresing(id, info)
|
|
594
|
+ if parseDateErr == nil {
|
|
595
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
596
|
+ "info": info,
|
|
597
|
+ })
|
|
598
|
+ } else {
|
|
599
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
600
|
+ }
|
|
601
|
+}
|
|
602
|
+
|
|
603
|
+func (this *SupplyOrderApiController) GetPurchaseOrderDetail() {
|
|
604
|
+
|
|
605
|
+ id, _ := this.GetInt64("id")
|
|
606
|
+ info, _ := service.GetPurchaseOrderDetail(id)
|
|
607
|
+ //查询
|
|
608
|
+ orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
|
|
609
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
610
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
|
611
|
+ //获取药品库数据
|
|
612
|
+ baseList, _ := service.GetSupplyDrugList(orgId)
|
|
613
|
+
|
|
614
|
+ goodList, _ := service.GetSupplyGoodList(orgId)
|
|
615
|
+ if err == nil {
|
|
616
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
617
|
+ "info": info,
|
|
618
|
+ "orderInfo": orderInfo,
|
|
619
|
+ "supplyList": supplyList,
|
|
620
|
+ "baseList": baseList,
|
|
621
|
+ "goodList": goodList,
|
|
622
|
+ })
|
|
623
|
+ } else {
|
|
624
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
625
|
+ }
|
|
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
|
+}
|