排程任务下发增加productProcedureID,报工表和工序表增加productProcedureID
| | |
| | | "procedureName": { |
| | | "type": "string" |
| | | }, |
| | | "productProcedureID": { |
| | | "type": "string" |
| | | }, |
| | | "startTime": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | "description": "工艺模型编号", |
| | | "type": "string" |
| | | }, |
| | | "productProcedureID": { |
| | | "description": "产品工序id", |
| | | "type": "string" |
| | | }, |
| | | "realEndTime": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | "properties": { |
| | | "barCode": { |
| | | "description": "条形码", |
| | | "type": "integer" |
| | | "type": "string" |
| | | }, |
| | | "channel": { |
| | | "description": "通道", |
| | |
| | | "description": "procedures表的id", |
| | | "type": "integer" |
| | | }, |
| | | "productProcedureID": { |
| | | "description": "产品工序id", |
| | | "type": "string" |
| | | }, |
| | | "reportAmount": { |
| | | "description": "报工数量", |
| | | "type": "integer" |
| | |
| | | "procedureName": { |
| | | "type": "string" |
| | | }, |
| | | "productProcedureID": { |
| | | "type": "string" |
| | | }, |
| | | "startTime": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | "description": "工艺模型编号", |
| | | "type": "string" |
| | | }, |
| | | "productProcedureID": { |
| | | "description": "产品工序id", |
| | | "type": "string" |
| | | }, |
| | | "realEndTime": { |
| | | "type": "integer" |
| | | }, |
| | |
| | | "properties": { |
| | | "barCode": { |
| | | "description": "条形码", |
| | | "type": "integer" |
| | | "type": "string" |
| | | }, |
| | | "channel": { |
| | | "description": "通道", |
| | |
| | | "description": "procedures表的id", |
| | | "type": "integer" |
| | | }, |
| | | "productProcedureID": { |
| | | "description": "产品工序id", |
| | | "type": "string" |
| | | }, |
| | | "reportAmount": { |
| | | "description": "报工数量", |
| | | "type": "integer" |
| | |
| | | type: string |
| | | procedureName: |
| | | type: string |
| | | productProcedureID: |
| | | type: string |
| | | startTime: |
| | | type: integer |
| | | workHours: |
| | |
| | | processModelNumber: |
| | | description: 工艺模型编号 |
| | | type: string |
| | | productProcedureID: |
| | | description: 产品工序id |
| | | type: string |
| | | realEndTime: |
| | | type: integer |
| | | realStartTime: |
| | |
| | | properties: |
| | | barCode: |
| | | description: 条形码 |
| | | type: integer |
| | | type: string |
| | | channel: |
| | | description: 通道 |
| | | type: integer |
| | |
| | | proceduresId: |
| | | description: procedures表的id |
| | | type: integer |
| | | productProcedureID: |
| | | description: 产品工序id |
| | | type: string |
| | | reportAmount: |
| | | description: 报工数量 |
| | | type: integer |
| | |
| | | } |
| | | |
| | | ProductProcedure struct { |
| | | ProcedureID string `gorm:"uniqueIndex:idx_product_procedure;type:varchar(191);comment:工序ID" json:"procedureId"` |
| | | ProcedureName string `gorm:"type:varchar(191);comment:工序名称,仅查询用" json:"procedureName"` |
| | | NextProcedureID string `json:"nextProcedureId"` |
| | | NextProcedureName string `json:"nextProcedureName"` |
| | | DeviceID string `gorm:"type:varchar(191);not null;comment:设备ID" json:"deviceId"` |
| | | DeviceName string `json:"deviceName"` |
| | | StartTime int64 `gorm:"comment:计划开始时间" json:"startTime"` |
| | | EndTime int64 `gorm:"comment:计划结束时间" json:"endTime"` |
| | | WorkHours decimal.Decimal `gorm:"type:decimal(35,18);comment:工时" json:"workHours"` |
| | | InputMaterials []*ProcedureMaterial `json:"inputMaterials"` // 输入物料列表 |
| | | OutputMaterials []*ProcedureMaterial `json:"outputMaterials"` // 输出物料列表 |
| | | Workers []*ProcedureWorker `json:"workers"` // 人员列表 |
| | | AllProcedureNames []string `json:"allProcedureNames"` // 所属工单工序列表 |
| | | Channel int32 `json:"channel"` //通道序号 |
| | | ProductProcedureID string `gorm:"index;type:varchar(191);not null;comment:产品工序ID" json:"productProcedureID"` |
| | | ProcedureID string `gorm:"uniqueIndex:idx_product_procedure;type:varchar(191);comment:工序ID" json:"procedureId"` |
| | | ProcedureName string `gorm:"type:varchar(191);comment:工序名称,仅查询用" json:"procedureName"` |
| | | NextProcedureID string `json:"nextProcedureId"` |
| | | NextProcedureName string `json:"nextProcedureName"` |
| | | DeviceID string `gorm:"type:varchar(191);not null;comment:设备ID" json:"deviceId"` |
| | | DeviceName string `json:"deviceName"` |
| | | StartTime int64 `gorm:"comment:计划开始时间" json:"startTime"` |
| | | EndTime int64 `gorm:"comment:计划结束时间" json:"endTime"` |
| | | WorkHours decimal.Decimal `gorm:"type:decimal(35,18);comment:工时" json:"workHours"` |
| | | InputMaterials []*ProcedureMaterial `json:"inputMaterials"` // 输入物料列表 |
| | | OutputMaterials []*ProcedureMaterial `json:"outputMaterials"` // 输出物料列表 |
| | | Workers []*ProcedureWorker `json:"workers"` // 人员列表 |
| | | AllProcedureNames []string `json:"allProcedureNames"` // 所属工单工序列表 |
| | | Channel int32 `json:"channel"` //通道序号 |
| | | } |
| | | |
| | | DeliverScheduleTask struct { |
| | |
| | | type ( |
| | | Procedures struct { |
| | | gorm.Model |
| | | ProductProcedureID string `gorm:"index;type:varchar(191);not null" json:"productProcedureID"` //产品工序id |
| | | WorkOrderID string `gorm:"index;type:varchar(191);not null" json:"-"` |
| | | OrderID string `gorm:"index;type:varchar(191);not null" json:"-"` |
| | | DeviceID string `gorm:"index;type:varchar(191)" json:"deviceId"` |
| | |
| | | type ( |
| | | ReportWork struct { |
| | | gorm.Model |
| | | ProceduresID uint `gorm:"index;type:varchar(191)" json:"proceduresId"` //procedures表的id |
| | | WorkOrderID string `gorm:"index;type:varchar(191);not null" json:"workOrderId"` |
| | | DeviceID string `gorm:"index;type:varchar(191)" json:"deviceId"` |
| | | DeviceName string `gorm:"index;type:varchar(191)" json:"deviceName"` |
| | | ProcedureID string `gorm:"index;type:varchar(191)" json:"procedureId"` |
| | | Channel int32 `gorm:"index;" json:"channel"` //通道 |
| | | StartTime int64 `json:"startTime"` |
| | | EndTime int64 `json:"endTime"` |
| | | ReportAmount int `json:"reportAmount"` //报工数量 |
| | | FinishAmount int `json:"finishAmount"` //本次报工 - 上次报工 |
| | | WorkerID string `json:"workerID"` //报工人id |
| | | WorkerName string `json:"workerName"` //报工人姓名 |
| | | WorkerTime int64 `json:"workerTime"` //工时,单位秒 |
| | | BarCode string `json:"barCode"` //条形码 |
| | | ProceduresID uint `gorm:"index;type:varchar(191)" json:"proceduresId"` //procedures表的id |
| | | ProductProcedureID string `gorm:"index;type:varchar(191);not null" json:"productProcedureID"` //产品工序id |
| | | WorkOrderID string `gorm:"index;type:varchar(191);not null" json:"workOrderId"` |
| | | DeviceID string `gorm:"index;type:varchar(191)" json:"deviceId"` |
| | | DeviceName string `gorm:"index;type:varchar(191)" json:"deviceName"` |
| | | ProcedureID string `gorm:"index;type:varchar(191)" json:"procedureId"` |
| | | Channel int32 `gorm:"index;" json:"channel"` //通道 |
| | | StartTime int64 `json:"startTime"` |
| | | EndTime int64 `json:"endTime"` |
| | | ReportAmount int `json:"reportAmount"` //报工数量 |
| | | FinishAmount int `json:"finishAmount"` //本次报工 - 上次报工 |
| | | WorkerID string `json:"workerID"` //报工人id |
| | | WorkerName string `json:"workerName"` //报工人姓名 |
| | | WorkerTime int64 `json:"workerTime"` //工时,单位秒 |
| | | BarCode string `json:"barCode"` //条形码 |
| | | } |
| | | |
| | | ReportWorkSearch struct { |
| | |
| | | procedureRecords := make([]*model.Procedures, 0, len(task.Procedures)) |
| | | for _, procedure := range task.Procedures { |
| | | procedureRecord := model.Procedures{ |
| | | WorkOrderID: task.WorkOrder.WorkOrderID, |
| | | OrderID: task.WorkOrder.OrderID, |
| | | DeviceID: procedure.DeviceID, |
| | | ProcedureID: procedure.ProcedureID, |
| | | StartTime: procedure.StartTime, |
| | | EndTime: procedure.EndTime, |
| | | Status: model.ProcedureStatusWaitProcess, |
| | | Channel: procedure.Channel, |
| | | ProceduresInfo: common.ProductProcedure{}, |
| | | ProductProcedureID: procedure.ProductProcedureID, |
| | | WorkOrderID: task.WorkOrder.WorkOrderID, |
| | | OrderID: task.WorkOrder.OrderID, |
| | | DeviceID: procedure.DeviceID, |
| | | ProcedureID: procedure.ProcedureID, |
| | | StartTime: procedure.StartTime, |
| | | EndTime: procedure.EndTime, |
| | | Status: model.ProcedureStatusWaitProcess, |
| | | Channel: procedure.Channel, |
| | | ProceduresInfo: common.ProductProcedure{}, |
| | | } |
| | | procedureData, err := json.Marshal(procedure) |
| | | if err != nil { |
| | |
| | | } |
| | | |
| | | record := &model.ReportWork{ |
| | | ProceduresID: params.ProcedureId, |
| | | WorkOrderID: procedure.WorkOrderID, |
| | | DeviceID: procedure.DeviceID, |
| | | DeviceName: procedure.ProceduresInfo.DeviceName, |
| | | ProcedureID: procedure.ProcedureID, |
| | | Channel: procedure.Channel, |
| | | StartTime: startTs, |
| | | EndTime: nowTs, |
| | | ReportAmount: params.ReportAmount, |
| | | FinishAmount: finishAmount, |
| | | WorkerID: params.WorkerID, |
| | | WorkerName: workerName, |
| | | WorkerTime: nowTs - startTs, |
| | | BarCode: snowflake.GenerateIdStr(), |
| | | ProceduresID: params.ProcedureId, |
| | | ProductProcedureID: procedure.ProductProcedureID, |
| | | WorkOrderID: procedure.WorkOrderID, |
| | | DeviceID: procedure.DeviceID, |
| | | DeviceName: procedure.ProceduresInfo.DeviceName, |
| | | ProcedureID: procedure.ProcedureID, |
| | | Channel: procedure.Channel, |
| | | StartTime: startTs, |
| | | EndTime: nowTs, |
| | | ReportAmount: params.ReportAmount, |
| | | FinishAmount: finishAmount, |
| | | WorkerID: params.WorkerID, |
| | | WorkerName: workerName, |
| | | WorkerTime: nowTs - startTs, |
| | | BarCode: snowflake.GenerateIdStr(), |
| | | } |
| | | |
| | | err = model.NewReportWorkSearch(nil).Create(record) |