|
@@ -289,7 +289,7 @@ func GetSupplyDrugList(orgid int64) (drug []*models.SpBaseDrug, err error) {
|
289
|
289
|
db = db.Where("x.org_id = ?", orgid)
|
290
|
290
|
}
|
291
|
291
|
|
292
|
|
- err = db.Preload("DrugWarehouseInfo", "status = 1 and org_id = ?", orgid).Find(&drug).Error
|
|
292
|
+ err = db.Preload("DrugWarehouseInfo", "status = 1 and org_id = ? and (stock_max_number >0 or stock_min_number>0)", orgid).Find(&drug).Error
|
293
|
293
|
return drug, err
|
294
|
294
|
}
|
295
|
295
|
|
|
@@ -313,7 +313,7 @@ func GetSupplierList(orgid int64) (suppler []*models.SpSupplierName, err error)
|
313
|
313
|
|
314
|
314
|
func FindAllSupplyOrder(orgid int64) (total int64, err error) {
|
315
|
315
|
|
316
|
|
- err = XTReadDB().Model(&models.SupplierWarehouseInfo{}).Where("user_org_id = ? and status = 1", orgid).Count(&total).Error
|
|
316
|
+ err = XTReadDB().Model(&models.SupplierWarehouseInfo{}).Where("user_org_id = ?", orgid).Count(&total).Error
|
317
|
317
|
return total, err
|
318
|
318
|
}
|
319
|
319
|
|
|
@@ -375,7 +375,7 @@ func GetSupplyWarehousingOrderInfoTwo(id int64, ids []string) (order []*models.S
|
375
|
375
|
|
376
|
376
|
func ModefySupplyWarehouseInfo(id int64, info models.SupplierWarehouseInfo) error {
|
377
|
377
|
|
378
|
|
- err := XTWriteDB().Model(&models.SupplierWarehouseInfo{}).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"rate_of_concession": info.RateOfConcession, "discount_amount": info.DiscountAmount, "document_date": info.DocumentDate, "delivery_date": info.DeliveryDate, "supplier_id": info.SupplierId}).Error
|
|
378
|
+ err := XTWriteDB().Model(&models.SupplierWarehouseInfo{}).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"rate_of_concession": info.RateOfConcession, "discount_amount": info.DiscountAmount, "document_date": info.DocumentDate, "delivery_date": info.DeliveryDate, "supplier_id": info.SupplierId, "return_remake": info.ReturnRemake}).Error
|
379
|
379
|
return err
|
380
|
380
|
}
|
381
|
381
|
|
|
@@ -399,7 +399,7 @@ func GetPurchaseOrderDetail(id int64) (models.SupplierWarehouseInfo, error) {
|
399
|
399
|
}
|
400
|
400
|
|
401
|
401
|
func FindAllSupplyWarehouseOutOrder(orgid int64) (total int64, err error) {
|
402
|
|
- err = XTReadDB().Model(&models.SpSupplierWarehouseOut{}).Where("user_org_id = ? and status = 1", orgid).Count(&total).Error
|
|
402
|
+ err = XTReadDB().Model(&models.SpSupplierWarehouseOut{}).Where("user_org_id = ?", orgid).Count(&total).Error
|
403
|
403
|
return total, err
|
404
|
404
|
}
|
405
|
405
|
|
|
@@ -427,28 +427,34 @@ func GetSupplyWarehouseOutById(id int64, user_org_id int64) (order []*models.SpS
|
427
|
427
|
return order, err
|
428
|
428
|
}
|
429
|
429
|
|
|
430
|
+func GetSupplyWarehouseOutByIdOne(id int64, user_org_id int64, ids []string) (order []*models.SpSupplierWarehousingOutOrder, err error) {
|
|
431
|
+
|
|
432
|
+ err = XTReadDB().Where("warehouse_out_id = ? and status = 1 and user_org_id = ? and project_id in(?)", id, user_org_id, ids).Find(&order).Error
|
|
433
|
+ return order, err
|
|
434
|
+}
|
|
435
|
+
|
430
|
436
|
func GetAllGoodOderList(check_id int64, keyword string, page int64, limit int64, startime int64, endtime int64, orgid int64) (out []*models.VmSupplierWarehouseOut, total int64, err error) {
|
431
|
|
- db := XTReadDB().Model(&out).Where("status = 1")
|
|
437
|
+ db := XTReadDB().Model(&out).Where("sgj_xt.xt_supplier_warehouse_out.status = 1")
|
432
|
438
|
likeKey := "%" + keyword + "%"
|
433
|
439
|
offset := (page - 1) * limit
|
434
|
440
|
if check_id > 0 {
|
435
|
|
- db = db.Where("xt_supplier_warehouse_out.is_check = ?", check_id)
|
|
441
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.is_check = ?", check_id)
|
436
|
442
|
}
|
437
|
443
|
if startime > 0 {
|
438
|
|
- db = db.Where("xt_supplier_warehouse_out.record_date >= ?", startime)
|
|
444
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.record_date >= ?", startime)
|
439
|
445
|
}
|
440
|
446
|
if endtime > 0 {
|
441
|
|
- db = db.Where("xt_supplier_warehouse_out.record_date<=?", endtime)
|
|
447
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.record_date<=?", endtime)
|
442
|
448
|
}
|
443
|
449
|
|
444
|
450
|
if len(keyword) > 0 {
|
445
|
|
- db.Joins("join xt_supplier_name on xt_supplier_name.id = xt_supplier_warehouse_out.supplier_id")
|
446
|
|
- db = db.Where("xt_supplier_warehouse_out.number like ? or xt_supplier_name.supplier_name like ? ", likeKey, likeKey).Group("xt_supplier_warehouse_out.id")
|
|
451
|
+ db = db.Joins("join sgj_xt.xt_supplier_name on sgj_xt.xt_supplier_name.id = sgj_xt.xt_supplier_warehouse_out.supplier_id")
|
|
452
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.good_number like ? or sgj_xt.xt_supplier_name.supplier_name like ? ", likeKey, likeKey).Group("xt_supplier_warehouse_out.id")
|
447
|
453
|
}
|
448
|
454
|
if orgid > 0 {
|
449
|
|
- db = db.Where("xt_supplier_warehouse_out.user_org_id = ?", orgid)
|
|
455
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.user_org_id = ?", orgid)
|
450
|
456
|
}
|
451
|
|
- err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingOutOrder", "status= 1 and user_org_id = ?", orgid).Find(&out).Error
|
|
457
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingOutOrder", "status= 1 and user_org_id = ?", orgid).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Find(&out).Error
|
452
|
458
|
return out, total, err
|
453
|
459
|
}
|
454
|
460
|
|
|
@@ -460,13 +466,13 @@ func GetGoodOrderDetail(id int64, orgid int64) (models.SpSupplierWarehouseOut, e
|
460
|
466
|
|
461
|
467
|
func UpdateGoodWarehouseOut(id int64, out models.SpSupplierWarehouseOut) error {
|
462
|
468
|
|
463
|
|
- err := XTWriteDB().Model(&out).Where("id=? and status = 1", id).Updates(map[string]interface{}{"arrearage": out.Arrearage, "payment": out.Payment, "rate_of_concession": out.RateOfConcession, "discount_amount": out.DiscountAmount, "document_date": out.DocumentDate}).Error
|
|
469
|
+ err := XTWriteDB().Model(&out).Where("id=? and status = 1", id).Updates(map[string]interface{}{"arrearage": out.Arrearage, "payment": out.Payment, "rate_of_concession": out.RateOfConcession, "discount_amount": out.DiscountAmount, "document_date": out.DocumentDate, "return_remake": out.ReturnRemake}).Error
|
464
|
470
|
return err
|
465
|
471
|
}
|
466
|
472
|
|
467
|
473
|
func UpdateGoodWarehouseOutOrder(order *models.SpSupplierWarehousingOutOrder) error {
|
468
|
474
|
|
469
|
|
- err := XTWriteDB().Model(&order).Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{"project_id": order.ProjectId, "is_source": order.IsSource, "count": order.Count, "price": order.Count, "amount": order.Amount, "remark": order.Amount, "supply_batch_number": order.SupplyBatchNumber, "supply_product_date": order.SupplyProductDate, "supply_expiry_date": order.SupplyExpiryDate, "supply_type": order.SupplyType, "supply_specification_name": order.SupplySpecificationName, "supply_total": order.SupplySpecificationName, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name, "supply_unit": order.SupplyUnit, "manufacturer_id": order.ManufacturerId, "supply_license_number": order.SupplyLicenseNumber}).Error
|
|
475
|
+ err := XTWriteDB().Model(&order).Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{"project_id": order.ProjectId, "is_source": order.IsSource, "count": order.Count, "price": order.Count, "remark": order.Remark, "supply_batch_number": order.SupplyBatchNumber, "supply_product_date": order.SupplyProductDate, "supply_expiry_date": order.SupplyExpiryDate, "supply_type": order.SupplyType, "supply_specification_name": order.SupplySpecificationName, "supply_total": order.SupplySpecificationName, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name, "supply_unit": order.SupplyUnit, "manufacturer_id": order.ManufacturerId, "supply_license_number": order.SupplyLicenseNumber, "warehousing_id": order.WarehousingId, "warehouse_info_id": order.WarehouseInfoId}).Error
|
470
|
476
|
return err
|
471
|
477
|
}
|
472
|
478
|
|
|
@@ -518,3 +524,245 @@ func CheckGoodOrder(id int64, orgid int64, out models.SpSupplierWarehouseOut) er
|
518
|
524
|
err := XTWriteDB().Model(&models.SpSupplierWarehouseOut{}).Where("id = ? and user_org_id =? and status = 1", id, orgid).Updates(map[string]interface{}{"is_check": out.IsCheck, "checker": out.Checker, "check_time": out.CheckTime, "mtime": time.Now().Unix()}).Error
|
519
|
525
|
return err
|
520
|
526
|
}
|
|
527
|
+
|
|
528
|
+func ModefySupplyWarehousing(is_warehose int64, warehousing_id int64, orgid int64) error {
|
|
529
|
+
|
|
530
|
+ err := XTWriteDB().Model(&models.SupplierWarehouseInfo{}).Where("id = ? and status = 1 and user_org_id =?", warehousing_id, orgid).Updates(map[string]interface{}{"is_warehouse": is_warehose, "mtime": time.Now().Unix()}).Error
|
|
531
|
+ return err
|
|
532
|
+}
|
|
533
|
+
|
|
534
|
+func GetAllDoctorSix(orgid int64, appid int64) (appRole []*models.App_Role, err error) {
|
|
535
|
+
|
|
536
|
+ err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = 1", orgid, appid).Find(&appRole).Error
|
|
537
|
+ return appRole, err
|
|
538
|
+}
|
|
539
|
+
|
|
540
|
+func GetSingleDrugWarehouseOrder(record_date int64, orgid int64) (*models.DrugWarehouse, error) {
|
|
541
|
+ warehouse := models.DrugWarehouse{}
|
|
542
|
+ var err error
|
|
543
|
+ err = XTReadDB().Model(&warehouse).Where("warehousing_time = ? and org_id = ? and status = 1", record_date, orgid).Find(&warehouse).Error
|
|
544
|
+ if err == gorm.ErrRecordNotFound {
|
|
545
|
+ return nil, err
|
|
546
|
+ }
|
|
547
|
+ if err != nil {
|
|
548
|
+ return nil, err
|
|
549
|
+ }
|
|
550
|
+ return &warehouse, nil
|
|
551
|
+}
|
|
552
|
+
|
|
553
|
+func GetSindleWarehouse(record_date int64, orgid int64) (*models.Warehousing, error) {
|
|
554
|
+ warehousing := models.Warehousing{}
|
|
555
|
+ var err error
|
|
556
|
+ err = XTReadDB().Model(&warehousing).Where("warehousing_time = ? and org_id = ? and status = 1", record_date, orgid).Find(&warehousing).Error
|
|
557
|
+ if err == gorm.ErrRecordNotFound {
|
|
558
|
+ return nil, err
|
|
559
|
+ }
|
|
560
|
+ if err != nil {
|
|
561
|
+ return nil, err
|
|
562
|
+ }
|
|
563
|
+ return &warehousing, nil
|
|
564
|
+}
|
|
565
|
+
|
|
566
|
+func GetLastWarehouseInfoByInfo(orgid int64) (models.Warehousing, error) {
|
|
567
|
+ warehousing := models.Warehousing{}
|
|
568
|
+ err := XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&warehousing).Error
|
|
569
|
+ return warehousing, err
|
|
570
|
+}
|
|
571
|
+
|
|
572
|
+func GetSupplyCancelOrder(orgid int64) (total int64, err error) {
|
|
573
|
+ err = XTReadDB().Model(&models.SpSupplierWarehouseCancel{}).Where("user_org_id = ?", orgid).Count(&total).Error
|
|
574
|
+ return total, err
|
|
575
|
+}
|
|
576
|
+
|
|
577
|
+func CreateReturnCacelOrder(cancel models.SpSupplierWarehouseCancel) error {
|
|
578
|
+
|
|
579
|
+ err := XTWriteDB().Create(&cancel).Error
|
|
580
|
+ return err
|
|
581
|
+}
|
|
582
|
+
|
|
583
|
+func GetLastReturnCancelOrder(orgid int64) (models.SpSupplierWarehouseCancel, error) {
|
|
584
|
+
|
|
585
|
+ cancel := models.SpSupplierWarehouseCancel{}
|
|
586
|
+ err := XTReadDB().Where("user_org_id =? and status = 1", orgid).Find(&cancel).Error
|
|
587
|
+ return cancel, err
|
|
588
|
+}
|
|
589
|
+
|
|
590
|
+func CreateCancelReturnOrder(order *models.SpSupplierWarehousingCancelOrder) error {
|
|
591
|
+
|
|
592
|
+ err := XTWriteDB().Create(&order).Error
|
|
593
|
+ return err
|
|
594
|
+}
|
|
595
|
+
|
|
596
|
+func GetReturnCancelOrder(id int64, orgid int64) (models.SpSupplierWarehouseCancel, error) {
|
|
597
|
+
|
|
598
|
+ cancel := models.SpSupplierWarehouseCancel{}
|
|
599
|
+ err := XTReadDB().Where("id = ? and status= 1 and user_org_id =?", id, orgid).Find(&cancel).Error
|
|
600
|
+ return cancel, err
|
|
601
|
+}
|
|
602
|
+
|
|
603
|
+func GetReturnCancelOrderList(id int64, orgid int64) (order models.SpSupplierWarehousingCancelOrder, err error) {
|
|
604
|
+
|
|
605
|
+ err = XTReadDB().Where("warehouse_cancel_id = ? and user_org_id =? and status = 1", id, orgid).Find(&order).Error
|
|
606
|
+ return order, err
|
|
607
|
+}
|
|
608
|
+
|
|
609
|
+func GetAllGoodReturnOrderList(checkid int64, keyword string, page int64, limit int64, startime int64, endtime int64, orgid int64) (order []*models.VmSpSupplierWarehouseCancel, total int64, err error) {
|
|
610
|
+
|
|
611
|
+ db := XTReadDB().Table("sgj_xt.xt_supplier_warehouse_cancel").Where("sgj_xt.xt_supplier_warehouse_cancel.status = 1")
|
|
612
|
+ likeKey := "%" + keyword + "%"
|
|
613
|
+ offset := (page - 1) * limit
|
|
614
|
+ if checkid > 0 {
|
|
615
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.is_check = ?", checkid)
|
|
616
|
+ }
|
|
617
|
+ if len(keyword) > 0 {
|
|
618
|
+ db = db.Joins("join sgj_xt.xt_supplier_name on sgj_xt.xt_supplier_name.id = sgj_xt.xt_supplier_warehouse_out.supplier_id")
|
|
619
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.number like ? or sgj_xt.xt_supplier_name.supplier_name like ? ", likeKey, likeKey).Group("xt_supplier_warehouse_cancel.id")
|
|
620
|
+ }
|
|
621
|
+ if startime > 0 {
|
|
622
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.record_date >= ?", startime)
|
|
623
|
+ }
|
|
624
|
+
|
|
625
|
+ if endtime > 0 {
|
|
626
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.record_date <= ?", endtime)
|
|
627
|
+ }
|
|
628
|
+ if orgid > 0 {
|
|
629
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.user_org_id = ?", orgid)
|
|
630
|
+ }
|
|
631
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Find(&order).Error
|
|
632
|
+ return order, total, err
|
|
633
|
+}
|
|
634
|
+
|
|
635
|
+func GetGoodReturnDetail(id int64, orgid int64) (models.VmSpSupplierWarehouseCancel, error) {
|
|
636
|
+ cancel := models.VmSpSupplierWarehouseCancel{}
|
|
637
|
+ db := XTReadDB().Model(&cancel).Where("status = 1")
|
|
638
|
+ if id > 0 {
|
|
639
|
+ db = db.Where("id = ?", id)
|
|
640
|
+ }
|
|
641
|
+ if orgid > 0 {
|
|
642
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
643
|
+ }
|
|
644
|
+ err := db.Find(&cancel).Error
|
|
645
|
+ return cancel, err
|
|
646
|
+}
|
|
647
|
+
|
|
648
|
+func GetGoodReturnOrderDetail(id int64, orgid int64) (order []*models.SpSupplierWarehousingCancelOrder, err error) {
|
|
649
|
+
|
|
650
|
+ db := XTReadDB().Model(&order).Where("status =1")
|
|
651
|
+ if id > 0 {
|
|
652
|
+ db = db.Where("warehouse_cancel_id = ?", id)
|
|
653
|
+ }
|
|
654
|
+ if orgid > 0 {
|
|
655
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
656
|
+ }
|
|
657
|
+ err = db.Find(&order).Error
|
|
658
|
+ return order, err
|
|
659
|
+}
|
|
660
|
+
|
|
661
|
+func UpdateWarehouseCancelOrder(order *models.SpSupplierWarehousingCancelOrder) error {
|
|
662
|
+
|
|
663
|
+ err = XTWriteDB().Where("id = ? and status = 1", order.ID).Updates(map[string]interface{}{"manufacturer_id": order.ManufacturerId, "order_number": order.OrderNumber, "project_id": order.ProjectId, "is_source": order.IsSource, "count": order.Count, "price": order.Price, "remark": order.Remark, "rate_of_concession": order.RateOfConcession, "discount_amount": order.DiscountAmount, "type": order.Type, "supply_specification_name": order.SupplySpecificationName, "supply_type": order.SupplyType, "supply_total": order.SupplyTotal, "supply_manufacturer": order.SupplyManufacturer, "name": order.Name, "supply_unit": order.SupplyUnit, "supply_license_number": order.SupplyLicenseNumber}).Error
|
|
664
|
+ return err
|
|
665
|
+}
|
|
666
|
+
|
|
667
|
+func UpdateWarehouseCancel(id int64, cancel models.SpSupplierWarehouseCancel) error {
|
|
668
|
+
|
|
669
|
+ err := XTWriteDB().Model(&cancel).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"rate_of_concession": cancel.RateOfConcession, "discount_amount": cancel.DiscountAmount, "document_date": cancel.DocumentDate, "supplier_id": cancel.SupplierId, "arrearage": cancel.Arrearage, "payment": cancel.Payment, "return_remark": cancel.ReturnRemark}).Error
|
|
670
|
+ return err
|
|
671
|
+}
|
|
672
|
+
|
|
673
|
+func GetSupplyCancelOrderById(warehouse_out_id int64, orgid int64) (*models.SpSupplierWarehouseCancel, error) {
|
|
674
|
+ cancel := models.SpSupplierWarehouseCancel{}
|
|
675
|
+ var err error
|
|
676
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", warehouse_out_id, orgid).Find(&cancel).Error
|
|
677
|
+ if err == gorm.ErrRecordNotFound {
|
|
678
|
+ return nil, err
|
|
679
|
+ }
|
|
680
|
+ if err != nil {
|
|
681
|
+ return nil, err
|
|
682
|
+ }
|
|
683
|
+ return &cancel, nil
|
|
684
|
+}
|
|
685
|
+
|
|
686
|
+func UpdateSupplyGoodOrder(id int64, out models.SpSupplierWarehouseOut) error {
|
|
687
|
+
|
|
688
|
+ err := XTWriteDB().Model(&models.SpSupplierWarehouseOut{}).Where("id = ? and status = 1", id).Updates(map[string]interface{}{"is_check": out.IsCheck, "checker": out.Checker, "check_time": out.CheckTime}).Error
|
|
689
|
+ return err
|
|
690
|
+}
|
|
691
|
+
|
|
692
|
+func UpdateDrugSupplyWarehousingInfo(id int64, orgid int64) error {
|
|
693
|
+
|
|
694
|
+ err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
695
|
+ return err
|
|
696
|
+}
|
|
697
|
+
|
|
698
|
+func UpdateDrugSupplyFlow(id int64, orgid int64) error {
|
|
699
|
+
|
|
700
|
+ err := XTWriteDB().Model(&models.DrugFlow{}).Where("supply_warehouse_id = ? and user_org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
701
|
+ return err
|
|
702
|
+}
|
|
703
|
+
|
|
704
|
+func UpdateGoodSupplyWarehousingInfo(id int64, orgid int64) error {
|
|
705
|
+
|
|
706
|
+ err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
707
|
+ return err
|
|
708
|
+}
|
|
709
|
+
|
|
710
|
+func UpdateGoodSupplyFlow(id int64, orgid int64) error {
|
|
711
|
+
|
|
712
|
+ err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("supply_warehouse_id = ? and user_org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
713
|
+ return err
|
|
714
|
+}
|
|
715
|
+
|
|
716
|
+func GetDrugSupplyWarehousingById(id int64, orgid int64) (info []*models.DrugWarehouseInfo, err error) {
|
|
717
|
+
|
|
718
|
+ err = XTReadDB().Where("supply_warehouse_id <> ? and org_id = ? and status = 1", id, orgid).Find(&info).Error
|
|
719
|
+ return info, err
|
|
720
|
+}
|
|
721
|
+
|
|
722
|
+func UpdateSupplyWarehousing(id int64, orgid int64) error {
|
|
723
|
+
|
|
724
|
+ err := XTWriteDB().Model(&models.DrugWarehouse{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
725
|
+ return err
|
|
726
|
+}
|
|
727
|
+
|
|
728
|
+func GetGoodSupplyWarehousingById(id int64, orgid int64) (info []*models.WarehousingInfo, err error) {
|
|
729
|
+
|
|
730
|
+ err = XTReadDB().Where("supply_warehouse_id <> ? and org_id = ? and status = 1", id, orgid).Find(&info).Error
|
|
731
|
+ return info, err
|
|
732
|
+}
|
|
733
|
+
|
|
734
|
+func UpdateGoodWarehousing(id int64, orgid int64) error {
|
|
735
|
+ err := XTWriteDB().Model(&models.Warehousing{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
736
|
+ return err
|
|
737
|
+}
|
|
738
|
+
|
|
739
|
+func UpdateSupplyWarehousingById(id int64, orgid int64) error {
|
|
740
|
+
|
|
741
|
+ err := XTWriteDB().Model(&models.SupplierWarehouseInfo{}).Where("id = ? and user_org_id =? and status = 1", id, orgid).Updates(map[string]interface{}{"is_warehouse": 1}).Error
|
|
742
|
+ return err
|
|
743
|
+}
|
|
744
|
+
|
|
745
|
+func DeleteGoodOrder(id int64, orgid int64) error {
|
|
746
|
+
|
|
747
|
+ err := XTWriteDB().Model(&models.SpSupplierWarehouseOut{}).Where("id = ? and status = 1 and user_org_id = ?", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
748
|
+
|
|
749
|
+ err = XTWriteDB().Model(&models.SpSupplierWarehousingOutOrder{}).Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
750
|
+ return err
|
|
751
|
+}
|
|
752
|
+func GetSupplyCancelWarehouse(id int64, orgid int64) (cancel []*models.SpSupplierWarehouseCancel, err error) {
|
|
753
|
+
|
|
754
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&cancel).Error
|
|
755
|
+ return cancel, err
|
|
756
|
+}
|
|
757
|
+
|
|
758
|
+func GetGoodOrderListById(id int64, orgid int64) (out []*models.VmSpSupplierWarehousingOutOrder, err error) {
|
|
759
|
+
|
|
760
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&out).Error
|
|
761
|
+ return out, err
|
|
762
|
+}
|
|
763
|
+
|
|
764
|
+func GetGoodCanceListById(id int64, orgid int64) (cancel []*models.VmSpSupplierWarehousingCancelOrder, err error) {
|
|
765
|
+
|
|
766
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&cancel).Error
|
|
767
|
+ return cancel, err
|
|
768
|
+}
|