|
@@ -124,7 +124,7 @@ func GetSupplyDrugList(orgid int64) (drug []*models.SpBaseDrug, err error) {
|
124
|
124
|
db = db.Where("x.org_id = ?", orgid)
|
125
|
125
|
}
|
126
|
126
|
|
127
|
|
- err = db.Preload("DrugWarehouseInfo", "status = 1 and org_id = ?", orgid).Find(&drug).Error
|
|
127
|
+ err = db.Preload("DrugWarehouseInfo", "status = 1 and org_id = ? and (stock_max_number >0 or stock_min_number>0)", orgid).Find(&drug).Error
|
128
|
128
|
return drug, err
|
129
|
129
|
}
|
130
|
130
|
|
|
@@ -148,7 +148,7 @@ func GetSupplierList(orgid int64) (suppler []*models.SpSupplierName, err error)
|
148
|
148
|
|
149
|
149
|
func FindAllSupplyOrder(orgid int64) (total int64, err error) {
|
150
|
150
|
|
151
|
|
- err = XTReadDB().Model(&models.SupplierWarehouseInfo{}).Where("user_org_id = ? and status = 1", orgid).Count(&total).Error
|
|
151
|
+ err = XTReadDB().Model(&models.SupplierWarehouseInfo{}).Where("user_org_id = ?", orgid).Count(&total).Error
|
152
|
152
|
return total, err
|
153
|
153
|
}
|
154
|
154
|
|
|
@@ -210,7 +210,7 @@ func GetSupplyWarehousingOrderInfoTwo(id int64, ids []string) (order []*models.S
|
210
|
210
|
|
211
|
211
|
func ModefySupplyWarehouseInfo(id int64, info models.SupplierWarehouseInfo) error {
|
212
|
212
|
|
213
|
|
- 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
|
|
213
|
+ 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
|
214
|
214
|
return err
|
215
|
215
|
}
|
216
|
216
|
|
|
@@ -234,7 +234,7 @@ func GetPurchaseOrderDetail(id int64) (models.SupplierWarehouseInfo, error) {
|
234
|
234
|
}
|
235
|
235
|
|
236
|
236
|
func FindAllSupplyWarehouseOutOrder(orgid int64) (total int64, err error) {
|
237
|
|
- err = XTReadDB().Model(&models.SpSupplierWarehouseOut{}).Where("user_org_id = ? and status = 1", orgid).Count(&total).Error
|
|
237
|
+ err = XTReadDB().Model(&models.SpSupplierWarehouseOut{}).Where("user_org_id = ?", orgid).Count(&total).Error
|
238
|
238
|
return total, err
|
239
|
239
|
}
|
240
|
240
|
|
|
@@ -263,27 +263,27 @@ func GetSupplyWarehouseOutById(id int64, user_org_id int64) (order []*models.SpS
|
263
|
263
|
}
|
264
|
264
|
|
265
|
265
|
func GetAllGoodOderList(check_id int64, keyword string, page int64, limit int64, startime int64, endtime int64, orgid int64) (out []*models.VmSupplierWarehouseOut, total int64, err error) {
|
266
|
|
- db := XTReadDB().Model(&out).Where("status = 1")
|
|
266
|
+ db := XTReadDB().Model(&out).Where("sgj_xt.xt_supplier_warehouse_out.status = 1")
|
267
|
267
|
likeKey := "%" + keyword + "%"
|
268
|
268
|
offset := (page - 1) * limit
|
269
|
269
|
if check_id > 0 {
|
270
|
|
- db = db.Where("xt_supplier_warehouse_out.is_check = ?", check_id)
|
|
270
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.is_check = ?", check_id)
|
271
|
271
|
}
|
272
|
272
|
if startime > 0 {
|
273
|
|
- db = db.Where("xt_supplier_warehouse_out.record_date >= ?", startime)
|
|
273
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.record_date >= ?", startime)
|
274
|
274
|
}
|
275
|
275
|
if endtime > 0 {
|
276
|
|
- db = db.Where("xt_supplier_warehouse_out.record_date<=?", endtime)
|
|
276
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.record_date<=?", endtime)
|
277
|
277
|
}
|
278
|
278
|
|
279
|
279
|
if len(keyword) > 0 {
|
280
|
|
- db.Joins("join xt_supplier_name on xt_supplier_name.id = xt_supplier_warehouse_out.supplier_id")
|
281
|
|
- db = db.Where("xt_supplier_warehouse_out.number like ? or xt_supplier_name.supplier_name like ? ", likeKey, likeKey).Group("xt_supplier_warehouse_out.id")
|
|
280
|
+ db = db.Joins("join sgj_xt.xt_supplier_name on sgj_xt.xt_supplier_name.id = sgj_xt.xt_supplier_warehouse_out.supplier_id")
|
|
281
|
+ 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")
|
282
|
282
|
}
|
283
|
283
|
if orgid > 0 {
|
284
|
|
- db = db.Where("xt_supplier_warehouse_out.user_org_id = ?", orgid)
|
|
284
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_out.user_org_id = ?", orgid)
|
285
|
285
|
}
|
286
|
|
- err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingOutOrder", "status= 1 and user_org_id = ?", orgid).Find(&out).Error
|
|
286
|
+ 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
|
287
|
287
|
return out, total, err
|
288
|
288
|
}
|
289
|
289
|
|
|
@@ -295,13 +295,13 @@ func GetGoodOrderDetail(id int64, orgid int64) (models.SpSupplierWarehouseOut, e
|
295
|
295
|
|
296
|
296
|
func UpdateGoodWarehouseOut(id int64, out models.SpSupplierWarehouseOut) error {
|
297
|
297
|
|
298
|
|
- 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
|
|
298
|
+ 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
|
299
|
299
|
return err
|
300
|
300
|
}
|
301
|
301
|
|
302
|
302
|
func UpdateGoodWarehouseOutOrder(order *models.SpSupplierWarehousingOutOrder) error {
|
303
|
303
|
|
304
|
|
- 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
|
|
304
|
+ 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
|
305
|
305
|
return err
|
306
|
306
|
}
|
307
|
307
|
|
|
@@ -353,3 +353,245 @@ func CheckGoodOrder(id int64, orgid int64, out models.SpSupplierWarehouseOut) er
|
353
|
353
|
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
|
354
|
354
|
return err
|
355
|
355
|
}
|
|
356
|
+
|
|
357
|
+func ModefySupplyWarehousing(is_warehose int64, warehousing_id int64, orgid int64) error {
|
|
358
|
+
|
|
359
|
+ 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
|
|
360
|
+ return err
|
|
361
|
+}
|
|
362
|
+
|
|
363
|
+func GetAllDoctorSix(orgid int64, appid int64) (appRole []*models.App_Role, err error) {
|
|
364
|
+
|
|
365
|
+ err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = 1", orgid, appid).Find(&appRole).Error
|
|
366
|
+ return appRole, err
|
|
367
|
+}
|
|
368
|
+
|
|
369
|
+func GetSingleDrugWarehouseOrder(record_date int64, orgid int64) (*models.DrugWarehouse, error) {
|
|
370
|
+ warehouse := models.DrugWarehouse{}
|
|
371
|
+ var err error
|
|
372
|
+ err = XTReadDB().Model(&warehouse).Where("warehousing_time = ? and org_id = ? and status = 1", record_date, orgid).Find(&warehouse).Error
|
|
373
|
+ if err == gorm.ErrRecordNotFound {
|
|
374
|
+ return nil, err
|
|
375
|
+ }
|
|
376
|
+ if err != nil {
|
|
377
|
+ return nil, err
|
|
378
|
+ }
|
|
379
|
+ return &warehouse, nil
|
|
380
|
+}
|
|
381
|
+
|
|
382
|
+func GetSindleWarehouse(record_date int64, orgid int64) (*models.Warehousing, error) {
|
|
383
|
+ warehousing := models.Warehousing{}
|
|
384
|
+ var err error
|
|
385
|
+ err = XTReadDB().Model(&warehousing).Where("warehousing_time = ? and org_id = ? and status = 1", record_date, orgid).Find(&warehousing).Error
|
|
386
|
+ if err == gorm.ErrRecordNotFound {
|
|
387
|
+ return nil, err
|
|
388
|
+ }
|
|
389
|
+ if err != nil {
|
|
390
|
+ return nil, err
|
|
391
|
+ }
|
|
392
|
+ return &warehousing, nil
|
|
393
|
+}
|
|
394
|
+
|
|
395
|
+func GetLastWarehouseInfoByInfo(orgid int64) (models.Warehousing, error) {
|
|
396
|
+ warehousing := models.Warehousing{}
|
|
397
|
+ err := XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&warehousing).Error
|
|
398
|
+ return warehousing, err
|
|
399
|
+}
|
|
400
|
+
|
|
401
|
+func GetSupplyCancelOrder(orgid int64) (total int64, err error) {
|
|
402
|
+ err = XTReadDB().Model(&models.SpSupplierWarehouseCancel{}).Where("user_org_id = ?", orgid).Count(&total).Error
|
|
403
|
+ return total, err
|
|
404
|
+}
|
|
405
|
+
|
|
406
|
+func CreateReturnCacelOrder(cancel models.SpSupplierWarehouseCancel) error {
|
|
407
|
+
|
|
408
|
+ err := XTWriteDB().Create(&cancel).Error
|
|
409
|
+ return err
|
|
410
|
+}
|
|
411
|
+
|
|
412
|
+func GetLastReturnCancelOrder(orgid int64) (models.SpSupplierWarehouseCancel, error) {
|
|
413
|
+
|
|
414
|
+ cancel := models.SpSupplierWarehouseCancel{}
|
|
415
|
+ err := XTReadDB().Where("user_org_id =? and status = 1", orgid).Find(&cancel).Error
|
|
416
|
+ return cancel, err
|
|
417
|
+}
|
|
418
|
+
|
|
419
|
+func CreateCancelReturnOrder(order *models.SpSupplierWarehousingCancelOrder) error {
|
|
420
|
+
|
|
421
|
+ err := XTWriteDB().Create(&order).Error
|
|
422
|
+ return err
|
|
423
|
+}
|
|
424
|
+
|
|
425
|
+func GetReturnCancelOrder(id int64, orgid int64) (models.SpSupplierWarehouseCancel, error) {
|
|
426
|
+
|
|
427
|
+ cancel := models.SpSupplierWarehouseCancel{}
|
|
428
|
+ err := XTReadDB().Where("id = ? and status= 1 and user_org_id =?", id, orgid).Find(&cancel).Error
|
|
429
|
+ return cancel, err
|
|
430
|
+}
|
|
431
|
+
|
|
432
|
+func GetReturnCancelOrderList(id int64, orgid int64) (order models.SpSupplierWarehousingCancelOrder, err error) {
|
|
433
|
+
|
|
434
|
+ err = XTReadDB().Where("warehouse_cancel_id = ? and user_org_id =? and status = 1", id, orgid).Find(&order).Error
|
|
435
|
+ return order, err
|
|
436
|
+}
|
|
437
|
+
|
|
438
|
+func GetAllGoodReturnOrderList(checkid int64, keyword string, page int64, limit int64, startime int64, endtime int64, orgid int64) (order []*models.VmSpSupplierWarehouseCancel, total int64, err error) {
|
|
439
|
+
|
|
440
|
+ db := XTReadDB().Table("sgj_xt.xt_supplier_warehouse_cancel").Where("sgj_xt.xt_supplier_warehouse_cancel.status = 1")
|
|
441
|
+ likeKey := "%" + keyword + "%"
|
|
442
|
+ offset := (page - 1) * limit
|
|
443
|
+ if checkid > 0 {
|
|
444
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.is_check = ?", checkid)
|
|
445
|
+ }
|
|
446
|
+ if len(keyword) > 0 {
|
|
447
|
+ db = db.Joins("join sgj_xt.xt_supplier_name on sgj_xt.xt_supplier_name.id = sgj_xt.xt_supplier_warehouse_out.supplier_id")
|
|
448
|
+ 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")
|
|
449
|
+ }
|
|
450
|
+ if startime > 0 {
|
|
451
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.record_date >= ?", startime)
|
|
452
|
+ }
|
|
453
|
+
|
|
454
|
+ if endtime > 0 {
|
|
455
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.record_date <= ?", endtime)
|
|
456
|
+ }
|
|
457
|
+ if orgid > 0 {
|
|
458
|
+ db = db.Where("sgj_xt.xt_supplier_warehouse_cancel.user_org_id = ?", orgid)
|
|
459
|
+ }
|
|
460
|
+ err = db.Count(&total).Offset(offset).Limit(limit).Preload("SpSupplierWarehousingCancelOrder", "status= 1 and user_org_id = ?", orgid).Find(&order).Error
|
|
461
|
+ return order, total, err
|
|
462
|
+}
|
|
463
|
+
|
|
464
|
+func GetGoodReturnDetail(id int64, orgid int64) (models.VmSpSupplierWarehouseCancel, error) {
|
|
465
|
+ cancel := models.VmSpSupplierWarehouseCancel{}
|
|
466
|
+ db := XTReadDB().Model(&cancel).Where("status = 1")
|
|
467
|
+ if id > 0 {
|
|
468
|
+ db = db.Where("id = ?", id)
|
|
469
|
+ }
|
|
470
|
+ if orgid > 0 {
|
|
471
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
472
|
+ }
|
|
473
|
+ err := db.Find(&cancel).Error
|
|
474
|
+ return cancel, err
|
|
475
|
+}
|
|
476
|
+
|
|
477
|
+func GetGoodReturnOrderDetail(id int64, orgid int64) (order []*models.SpSupplierWarehousingCancelOrder, err error) {
|
|
478
|
+
|
|
479
|
+ db := XTReadDB().Model(&order).Where("status =1")
|
|
480
|
+ if id > 0 {
|
|
481
|
+ db = db.Where("warehouse_cancel_id = ?", id)
|
|
482
|
+ }
|
|
483
|
+ if orgid > 0 {
|
|
484
|
+ db = db.Where("user_org_id = ?", orgid)
|
|
485
|
+ }
|
|
486
|
+ err = db.Find(&order).Error
|
|
487
|
+ return order, err
|
|
488
|
+}
|
|
489
|
+
|
|
490
|
+func UpdateWarehouseCancelOrder(order *models.SpSupplierWarehousingCancelOrder) error {
|
|
491
|
+
|
|
492
|
+ 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
|
|
493
|
+ return err
|
|
494
|
+}
|
|
495
|
+
|
|
496
|
+func UpdateWarehouseCancel(id int64, cancel models.SpSupplierWarehouseCancel) error {
|
|
497
|
+
|
|
498
|
+ 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
|
|
499
|
+ return err
|
|
500
|
+}
|
|
501
|
+
|
|
502
|
+func GetSupplyCancelOrderById(warehouse_out_id int64, orgid int64) (*models.SpSupplierWarehouseCancel, error) {
|
|
503
|
+ cancel := models.SpSupplierWarehouseCancel{}
|
|
504
|
+ var err error
|
|
505
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", warehouse_out_id, orgid).Find(&cancel).Error
|
|
506
|
+ if err == gorm.ErrRecordNotFound {
|
|
507
|
+ return nil, err
|
|
508
|
+ }
|
|
509
|
+ if err != nil {
|
|
510
|
+ return nil, err
|
|
511
|
+ }
|
|
512
|
+ return &cancel, nil
|
|
513
|
+}
|
|
514
|
+
|
|
515
|
+func UpdateSupplyGoodOrder(id int64, out models.SpSupplierWarehouseOut) error {
|
|
516
|
+
|
|
517
|
+ 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
|
|
518
|
+ return err
|
|
519
|
+}
|
|
520
|
+
|
|
521
|
+func UpdateDrugSupplyWarehousingInfo(id int64, orgid int64) error {
|
|
522
|
+
|
|
523
|
+ err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
524
|
+ return err
|
|
525
|
+}
|
|
526
|
+
|
|
527
|
+func UpdateDrugSupplyFlow(id int64, orgid int64) error {
|
|
528
|
+
|
|
529
|
+ 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
|
|
530
|
+ return err
|
|
531
|
+}
|
|
532
|
+
|
|
533
|
+func UpdateGoodSupplyWarehousingInfo(id int64, orgid int64) error {
|
|
534
|
+
|
|
535
|
+ err := XTWriteDB().Model(&models.WarehousingInfo{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
536
|
+ return err
|
|
537
|
+}
|
|
538
|
+
|
|
539
|
+func UpdateGoodSupplyFlow(id int64, orgid int64) error {
|
|
540
|
+
|
|
541
|
+ 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
|
|
542
|
+ return err
|
|
543
|
+}
|
|
544
|
+
|
|
545
|
+func GetDrugSupplyWarehousingById(id int64, orgid int64) (info []*models.DrugWarehouseInfo, err error) {
|
|
546
|
+
|
|
547
|
+ err = XTReadDB().Where("supply_warehouse_id <> ? and org_id = ? and status = 1", id, orgid).Find(&info).Error
|
|
548
|
+ return info, err
|
|
549
|
+}
|
|
550
|
+
|
|
551
|
+func UpdateSupplyWarehousing(id int64, orgid int64) error {
|
|
552
|
+
|
|
553
|
+ err := XTWriteDB().Model(&models.DrugWarehouse{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
554
|
+ return err
|
|
555
|
+}
|
|
556
|
+
|
|
557
|
+func GetGoodSupplyWarehousingById(id int64, orgid int64) (info []*models.WarehousingInfo, err error) {
|
|
558
|
+
|
|
559
|
+ err = XTReadDB().Where("supply_warehouse_id <> ? and org_id = ? and status = 1", id, orgid).Find(&info).Error
|
|
560
|
+ return info, err
|
|
561
|
+}
|
|
562
|
+
|
|
563
|
+func UpdateGoodWarehousing(id int64, orgid int64) error {
|
|
564
|
+ err := XTWriteDB().Model(&models.Warehousing{}).Where("supply_warehouse_id = ? and org_id = ? and status = 1", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
565
|
+ return err
|
|
566
|
+}
|
|
567
|
+
|
|
568
|
+func UpdateSupplyWarehousingById(id int64, orgid int64) error {
|
|
569
|
+
|
|
570
|
+ err := XTWriteDB().Model(&models.SupplierWarehouseInfo{}).Where("id = ? and user_org_id =? and status = 1", id, orgid).Updates(map[string]interface{}{"is_warehouse": 1}).Error
|
|
571
|
+ return err
|
|
572
|
+}
|
|
573
|
+
|
|
574
|
+func DeleteGoodOrder(id int64, orgid int64) error {
|
|
575
|
+
|
|
576
|
+ err := XTWriteDB().Model(&models.SpSupplierWarehouseOut{}).Where("id = ? and status = 1 and user_org_id = ?", id, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
|
577
|
+
|
|
578
|
+ 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
|
|
579
|
+ return err
|
|
580
|
+}
|
|
581
|
+func GetSupplyCancelWarehouse(id int64, orgid int64) (cancel []*models.SpSupplierWarehouseCancel, err error) {
|
|
582
|
+
|
|
583
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&cancel).Error
|
|
584
|
+ return cancel, err
|
|
585
|
+}
|
|
586
|
+
|
|
587
|
+func GetGoodOrderListById(id int64, orgid int64) (out []*models.VmSpSupplierWarehousingOutOrder, err error) {
|
|
588
|
+
|
|
589
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&out).Error
|
|
590
|
+ return out, err
|
|
591
|
+}
|
|
592
|
+
|
|
593
|
+func GetGoodCanceListById(id int64, orgid int64) (cancel []*models.VmSpSupplierWarehousingCancelOrder, err error) {
|
|
594
|
+
|
|
595
|
+ err = XTReadDB().Where("warehouse_out_id = ? and user_org_id = ? and status = 1", id, orgid).Find(&cancel).Error
|
|
596
|
+ return cancel, err
|
|
597
|
+}
|