| | |
| | | if err != nil { |
| | | return err |
| | | } |
| | | return service.NewProgressService().Upsert(db, procedure, order) |
| | | return service.NewProgressService().Add(db, procedure, order) |
| | | }) |
| | | if err != nil { |
| | | logx.Errorf("SendProcessParams update order and procedure status error:%v", err.Error()) |
| | |
| | | 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:"uniqueIndex:idx_product_procedure;type:varchar(191);comment:工序ID" json:"procedureId"` |
| | | 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"` |
| | | Position int `gorm:"type:int;comment:工作位置" json:"position"` //每个设备可能有多个机位同时生产,用position表示位置 |
| | |
| | | return &ProgressService{} |
| | | } |
| | | |
| | | func (slf ProgressService) Upsert(db *gorm.DB, procedure *model.Procedures, order *model.Order) error { |
| | | func (slf ProgressService) Add(db *gorm.DB, procedure *model.Procedures, order *model.Order) error { |
| | | _, err := model.NewProductionProgressSearch(db).SetProcedureId(procedure.ProcedureID).SetWorkOrderId(procedure.WorkOrderID).First() |
| | | if err == gorm.ErrRecordNotFound { |
| | | progress := &model.ProductionProgress{ |