From 28addaa46cb97c20ad37e13eb10535de7b75e71c Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 29 十一月 2023 19:29:43 +0800
Subject: [PATCH] 首次报工开始时间为工序开始时间

---
 model/production_progress.go |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/model/production_progress.go b/model/production_progress.go
index 293a660..58bc036 100644
--- a/model/production_progress.go
+++ b/model/production_progress.go
@@ -9,13 +9,15 @@
 type (
 	ProductionProgress struct {
 		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"`
+		ProceduresID       uint   `gorm:"index;type:varchar(191)" json:"proceduresId"` //procedures琛ㄧ殑id
+		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"`
+		ProductProcedureID string `gorm:"type:varchar(191);" json:"productProcedureID"` //浜у搧宸ュ簭id
+		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 {
@@ -64,8 +66,18 @@
 	return slf
 }
 
+func (slf *ProductionProgressSearch) SetProceduresId(proceduresId uint) *ProductionProgressSearch {
+	slf.ProceduresID = proceduresId
+	return slf
+}
+
 func (slf *ProductionProgressSearch) SetDeviceId(id string) *ProductionProgressSearch {
 	slf.DeviceID = id
+	return slf
+}
+
+func (slf *ProductionProgressSearch) SetProductProcedureId(productProcedureId string) *ProductionProgressSearch {
+	slf.ProductProcedureID = productProcedureId
 	return slf
 }
 
@@ -107,6 +119,10 @@
 		db = db.Where("procedure_id = ?", slf.ProcedureID)
 	}
 
+	if slf.ProceduresID != 0 {
+		db = db.Where("procedures_id = ?", slf.ProceduresID)
+	}
+
 	if slf.DeviceID != "" {
 		db = db.Where("device_id = ?", slf.DeviceID)
 	}
@@ -119,6 +135,10 @@
 		db = db.Where("finished_quantity <  total_quantity")
 	}
 
+	if slf.ProductProcedureID != "" {
+		db = db.Where("product_procedure_id = ?", slf.ProductProcedureID)
+	}
+
 	return db
 }
 

--
Gitblit v1.8.0