From eba4eb850f0ecfb5839395aa125955ceaa2a454f Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 19 十月 2023 16:39:07 +0800
Subject: [PATCH] Merge branch 'feat-serf'

---
 model/production_progress.go |   39 ++++++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/model/production_progress.go b/model/production_progress.go
index 4a159af..d928936 100644
--- a/model/production_progress.go
+++ b/model/production_progress.go
@@ -3,28 +3,28 @@
 import (
 	"apsClient/pkg/sqlitex"
 	"fmt"
-	"gorm.io/gorm"
+	"github.com/jinzhu/gorm"
 )
 
 type (
 	ProductionProgress struct {
-		gorm.Model       `json:"-"`
-		ID               int    `gorm:"primarykey"`
-		WorkOrderID      string `gorm:"index;type:varchar(191);not null;comment:宸ュ崟ID" json:"workOrderID"`
-		OrderID          string `gorm:"index;type:varchar(191);not null;comment:璁㈠崟ID" json:"orderID"`
-		ProcedureID      string `gorm:"type:varchar(191);comment:宸ュ簭ID" json:"procedureId"`
-		DeviceID         string `gorm:"type:varchar(191);not null;comment:璁惧ID" json:"deviceId"`
-		FinishedQuantity int64  `gorm:"type:int;not null;comment:瀹屾垚鏁伴噺" json:"finishedQuantity"`
-		Channel          int32  `gorm:"type:int;comment:宸ヤ綔閫氶亾" json:"channel"` //閫氶亾
-		TotalQuantity    int64  `gorm:"type:int;not null;comment:鎬婚噺" json:"totalQuantity"`
+		gorm.Model
+		WorkOrderID      string `gorm:"index;type:varchar(191);not null" json:"workOrderID"`
+		OrderID          string `gorm:"index;type:varchar(191);not null" json:"orderID"`
+		ProcedureID      string `gorm:"type:varchar(191)" json:"procedureId"`
+		DeviceID         string `gorm:"type:varchar(191);not null" json:"deviceId"`
+		FinishedQuantity int64  `gorm:"type:int;not null" json:"finishedQuantity"`
+		Channel          int32  `gorm:"type:int" json:"channel"` //閫氶亾
+		TotalQuantity    int64  `gorm:"type:int;not null" json:"totalQuantity"`
 	}
 
 	ProductionProgressSearch struct {
 		ProductionProgress
-		Order    string
-		PageNum  int
-		PageSize int
-		Orm      *gorm.DB
+		Order      string
+		PageNum    int
+		PageSize   int
+		Orm        *gorm.DB
+		UnFinished bool
 	}
 )
 
@@ -69,13 +69,18 @@
 	return slf
 }
 
-func (slf *ProductionProgressSearch) SetId(id int) *ProductionProgressSearch {
+func (slf *ProductionProgressSearch) SetId(id uint) *ProductionProgressSearch {
 	slf.ID = id
 	return slf
 }
 
 func (slf *ProductionProgressSearch) SetChannel(channel int32) *ProductionProgressSearch {
 	slf.Channel = channel
+	return slf
+}
+
+func (slf *ProductionProgressSearch) SetUnFinished() *ProductionProgressSearch {
+	slf.UnFinished = true
 	return slf
 }
 
@@ -110,6 +115,10 @@
 		db = db.Where("channel = ?", slf.Channel)
 	}
 
+	if slf.UnFinished {
+		db = db.Where("finished_quantity <  total_quantity")
+	}
+
 	return db
 }
 

--
Gitblit v1.8.0