|
@@ -14,11 +14,7 @@ import (
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
)
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
// 成品采购单据管理
|
|
|
-=======
|
|
|
-// 单据管理
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
func BillProduct(r *GinRouter) {
|
|
|
|
|
|
// 创建单据
|
|
@@ -62,15 +58,9 @@ func ProductReview(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
return nil, errors.New("该用户没有权限")
|
|
|
}
|
|
|
// 查询单据获取已有的签字
|
|
|
-<<<<<<< HEAD
|
|
|
- bill := model.ProduceBill{}
|
|
|
- repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
- CollectName: repo.CollectionBillProduce,
|
|
|
-=======
|
|
|
bill := model.ProductBill{}
|
|
|
repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
CollectName: repo.CollectionBillProduct,
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
Query: repo.Map{"_id": id, "reviewed": 1},
|
|
|
}, &bill)
|
|
|
signs := make([]primitive.ObjectID, 0)
|
|
@@ -86,28 +76,16 @@ func ProductReview(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
|
|
|
// 更改状态为已审核 并签字
|
|
|
signs = append(signs, userId)
|
|
|
-<<<<<<< HEAD
|
|
|
- produce := model.ProduceBill{
|
|
|
-=======
|
|
|
product := model.ProductBill{
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
Reviewed: 1,
|
|
|
UpdateTime: time.Now(),
|
|
|
SignUsers: signs,
|
|
|
}
|
|
|
-<<<<<<< HEAD
|
|
|
- return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduce, _id, &produce)
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-// 创建成品采购单据
|
|
|
-=======
|
|
|
return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, _id, &product)
|
|
|
|
|
|
}
|
|
|
|
|
|
// 创建生产加工单据
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
func CreateProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
|
|
|
bill := &model.ProductBill{}
|
|
@@ -163,11 +141,7 @@ func GetProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
}
|
|
|
var bill model.ProductBill
|
|
|
option := &repo.DocSearchOptions{
|
|
|
-<<<<<<< HEAD
|
|
|
- CollectName: repo.CollectionBillProduce,
|
|
|
-=======
|
|
|
CollectName: repo.CollectionBillProduct,
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
Query: repo.Map{"_id": id},
|
|
|
}
|
|
|
found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), option, &bill)
|
|
@@ -205,11 +179,7 @@ func GetProductBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
}
|
|
|
|
|
|
option := &repo.PageSearchOptions{
|
|
|
-<<<<<<< HEAD
|
|
|
- CollectName: repo.CollectionBillProduce,
|
|
|
-=======
|
|
|
CollectName: repo.CollectionBillProduct,
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
Query: query,
|
|
|
Page: page,
|
|
|
Size: size,
|
|
@@ -220,11 +190,7 @@ func GetProductBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
|
|
|
// 更新单据
|
|
|
func UpdateProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
-<<<<<<< HEAD
|
|
|
- var bill model.ProduceBill
|
|
|
-=======
|
|
|
var bill model.ProductBill
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
err := c.ShouldBindJSON(&bill)
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
@@ -293,11 +259,7 @@ func DownProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
f.SetActiveSheet(index)
|
|
|
f.SetDefaultFont("宋体")
|
|
|
|
|
|
-<<<<<<< HEAD
|
|
|
- billExcel := NewProduceBill(f)
|
|
|
-=======
|
|
|
billExcel := NewProductBill(f)
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
// 获取已审核的签名数据
|
|
|
if bill.Reviewed == 1 {
|
|
|
if len(bill.SignUsers) > 0 {
|
|
@@ -311,15 +273,9 @@ func DownProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-<<<<<<< HEAD
|
|
|
- // billExcel.Content = &bill
|
|
|
- companyName := getCompanyName(apictx)
|
|
|
- billExcel.Title = fmt.Sprintf("%s加工单", companyName)
|
|
|
-=======
|
|
|
billExcel.Content = &bill
|
|
|
companyName := getCompanyName(apictx)
|
|
|
billExcel.Title = fmt.Sprintf("%s成品采购单", companyName)
|
|
|
->>>>>>> bb4e90e71ab5ef881ab438960e3aa9d606f4899c
|
|
|
//设置对应的数据
|
|
|
billExcel.Draws()
|
|
|
|