|
@@ -25,6 +25,8 @@ 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")
|
28
|
30
|
}
|
29
|
31
|
|
30
|
32
|
func (this *SupplyOrderApiController) GetInitOrder() {
|
|
@@ -130,12 +132,12 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
130
|
132
|
for _, item := range thisStockIn {
|
131
|
133
|
items := item.(map[string]interface{})
|
132
|
134
|
|
133
|
|
- if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
134
|
|
- utils.ErrorLog("id")
|
|
135
|
+ if items["project_id"] == nil || reflect.TypeOf(items["project_id"]).String() != "float64" {
|
|
136
|
+ utils.ErrorLog("project_id")
|
135
|
137
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
136
|
138
|
return
|
137
|
139
|
}
|
138
|
|
- id := int64(items["id"].(float64))
|
|
140
|
+ project_id := int64(items["project_id"].(float64))
|
139
|
141
|
|
140
|
142
|
if items["supply_count"] == nil || reflect.TypeOf(items["supply_count"]).String() != "float64" {
|
141
|
143
|
utils.ErrorLog("supply_count")
|
|
@@ -236,7 +238,7 @@ func (this *SupplyOrderApiController) SavePurchaseOrder() {
|
236
|
238
|
Status: 1,
|
237
|
239
|
Mtime: 0,
|
238
|
240
|
WarehousingId: warehouseInfo.ID,
|
239
|
|
- ProjectId: id,
|
|
241
|
+ ProjectId: project_id,
|
240
|
242
|
SupplyLicenseNumber: supply_license_number,
|
241
|
243
|
SupplyType: supply_type,
|
242
|
244
|
SupplySpecificationName: supply_specification_name,
|
|
@@ -438,12 +440,12 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
438
|
440
|
supply_total_price := items["supply_total_price"].(string)
|
439
|
441
|
|
440
|
442
|
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")
|
|
443
|
+ if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
|
|
444
|
+ utils.ErrorLog("type")
|
443
|
445
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
444
|
446
|
return
|
445
|
447
|
}
|
446
|
|
- is_source := int64(items["is_source"].(float64))
|
|
448
|
+ is_source := int64(items["type"].(float64))
|
447
|
449
|
|
448
|
450
|
if items["supply_type"] == nil || reflect.TypeOf(items["supply_type"]).String() != "string" {
|
449
|
451
|
utils.ErrorLog("supply_type")
|
|
@@ -553,3 +555,47 @@ func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
|
553
|
555
|
|
554
|
556
|
}
|
555
|
557
|
}
|
|
558
|
+
|
|
559
|
+func (this *SupplyOrderApiController) UpdateSupplyWaresing() {
|
|
560
|
+
|
|
561
|
+ id, _ := this.GetInt64("id")
|
|
562
|
+ recordDateStr := time.Now().Format("2006-01-02")
|
|
563
|
+ recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
|
|
564
|
+
|
|
565
|
+ record_date := recordDate.Unix()
|
|
566
|
+ checker := this.GetAdminUserInfo().AdminUser.Id
|
|
567
|
+ info := models.SupplierWarehouseInfo{
|
|
568
|
+ Mtime: time.Now().Unix(),
|
|
569
|
+ Status: 1,
|
|
570
|
+ IsCheck: 1,
|
|
571
|
+ Checker: checker,
|
|
572
|
+ CheckTime: record_date,
|
|
573
|
+ }
|
|
574
|
+ parseDateErr := service.UpdateSupplyWaresing(id, info)
|
|
575
|
+ if parseDateErr == nil {
|
|
576
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
577
|
+ "info": info,
|
|
578
|
+ })
|
|
579
|
+ } else {
|
|
580
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
581
|
+ }
|
|
582
|
+}
|
|
583
|
+
|
|
584
|
+func (this *SupplyOrderApiController) GetPurchaseOrderDetail() {
|
|
585
|
+
|
|
586
|
+ id, _ := this.GetInt64("id")
|
|
587
|
+ info, _ := service.GetPurchaseOrderDetail(id)
|
|
588
|
+ //查询
|
|
589
|
+ orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
|
|
590
|
+ orgId := this.GetAdminUserInfo().CurrentOrgId
|
|
591
|
+ supplyList, _ := service.GetSupplierList(orgId)
|
|
592
|
+ if err == nil {
|
|
593
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
594
|
+ "info": info,
|
|
595
|
+ "orderInfo": orderInfo,
|
|
596
|
+ "supplyList": supplyList,
|
|
597
|
+ })
|
|
598
|
+ } else {
|
|
599
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
600
|
+ }
|
|
601
|
+}
|