正在显示
5 个修改的文件
包含
22 行增加
和
8 行删除
@@ -119,4 +119,8 @@ spec: | @@ -119,4 +119,8 @@ spec: | ||
119 | - name: MANUFACTURE_DEFAULT_ORGID | 119 | - name: MANUFACTURE_DEFAULT_ORGID |
120 | value: "487" | 120 | value: "487" |
121 | - name: MANUFACTURE_PRODUCT_TYPE | 121 | - name: MANUFACTURE_PRODUCT_TYPE |
122 | - value: "0502010004ST,0502010004ST" | ||
122 | + value: "0502010004ST,0502010004ST" | ||
123 | + - name: MQTT_HOST | ||
124 | + value: "47.97.5.102" | ||
125 | + - name: MQTT_PORT | ||
126 | + value: "6000" |
@@ -272,7 +272,12 @@ func (ptr *PGCommonStatisticsService) DeviceRunningStatistics(queryOptions map[s | @@ -272,7 +272,12 @@ func (ptr *PGCommonStatisticsService) DeviceRunningStatistics(queryOptions map[s | ||
272 | log.Logger.Error(err.Error()) | 272 | log.Logger.Error(err.Error()) |
273 | } | 273 | } |
274 | } | 274 | } |
275 | - _, devices, err := deviceRepository.Find(map[string]interface{}{"companyId": request.CompanyId, "orgId": request.OrgId, "workshopId": request.WorkshopId, "lineId": request.LineId}) | 275 | + _, devices, err := deviceRepository.Find(map[string]interface{}{ |
276 | + "companyId": request.CompanyId, | ||
277 | + "orgId": request.OrgId, | ||
278 | + "workshopId": request.WorkshopId, | ||
279 | + "lineId": request.LineId, | ||
280 | + "orderBy": "device_name asc"}) | ||
276 | if err != nil { | 281 | if err != nil { |
277 | return nil, err | 282 | return nil, err |
278 | } | 283 | } |
@@ -91,8 +91,8 @@ func (ptr *PGWorkshopDataConsumeService) Consume(companyId, orgId int, record *d | @@ -91,8 +91,8 @@ func (ptr *PGWorkshopDataConsumeService) Consume(companyId, orgId int, record *d | ||
91 | if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil { | 91 | if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil { |
92 | return nil, err | 92 | return nil, err |
93 | } | 93 | } |
94 | - // 2.保存设备生产记录 (统计车间、员工产能) | ||
95 | - if record.DeviceType == domain.DeviceTypeChuanChuanJi && plan != nil { | 94 | + // 2.保存设备生产记录 (统计车间、员工产能) 批次跟数量不为空 |
95 | + if record.DeviceType == domain.DeviceTypeChuanChuanJi && plan != nil && deviceRunningData.Count > 0 { | ||
96 | 96 | ||
97 | productRecord, _ := ptr.newProductRecord(companyId, orgId, workStation, device, deviceRunningData, plan) | 97 | productRecord, _ := ptr.newProductRecord(companyId, orgId, workStation, device, deviceRunningData, plan) |
98 | //if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil { | 98 | //if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil { |
@@ -247,8 +247,8 @@ func (ptr *PGWorkshopDataConsumeService) newProductRecord(companyId int, orgId i | @@ -247,8 +247,8 @@ func (ptr *PGWorkshopDataConsumeService) newProductRecord(companyId int, orgId i | ||
247 | ProductRecordInfo: &domain.ProductRecordInfo{ | 247 | ProductRecordInfo: &domain.ProductRecordInfo{ |
248 | ProductDate: data.CollectionTime.Local().Format("2006-01-02"), | 248 | ProductDate: data.CollectionTime.Local().Format("2006-01-02"), |
249 | Original: float64(data.Count), | 249 | Original: float64(data.Count), |
250 | - Weigh: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 1), | ||
251 | - WeighBefore: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 1), | 250 | + Weigh: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 2), |
251 | + WeighBefore: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 2), | ||
252 | ApproveStatus: domain.AttendanceNotApprove, | 252 | ApproveStatus: domain.AttendanceNotApprove, |
253 | ProductPlanId: plan.PlanDispatchRecordExt.ProductPlanId, | 253 | ProductPlanId: plan.PlanDispatchRecordExt.ProductPlanId, |
254 | PlanProductName: plan.PlanDispatchRecordExt.PlanProductName, | 254 | PlanProductName: plan.PlanDispatchRecordExt.PlanProductName, |
@@ -149,7 +149,7 @@ func (repository *DeviceDailyRunningRecordRepository) Find(queryOptions map[stri | @@ -149,7 +149,7 @@ func (repository *DeviceDailyRunningRecordRepository) Find(queryOptions map[stri | ||
149 | if v, ok := queryOptions["productDate"]; ok && !(v.(time.Time)).IsZero() { | 149 | if v, ok := queryOptions["productDate"]; ok && !(v.(time.Time)).IsZero() { |
150 | query.Where(`product_date = ?`, v) | 150 | query.Where(`product_date = ?`, v) |
151 | } | 151 | } |
152 | - query.SetOffsetAndLimit(20) | 152 | + query.SetOffsetAndLimit(domain.MaxQueryRow) |
153 | query.SetOrderDirect("device_daily_running_record_id", "DESC") | 153 | query.SetOrderDirect("device_daily_running_record_id", "DESC") |
154 | if count, err := query.SelectAndCount(); err != nil { | 154 | if count, err := query.SelectAndCount(); err != nil { |
155 | return 0, deviceDailyRunningRecords, err | 155 | return 0, deviceDailyRunningRecords, err |
@@ -165,7 +165,7 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i | @@ -165,7 +165,7 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i | ||
165 | devices := make([]*domain.Device, 0) | 165 | devices := make([]*domain.Device, 0) |
166 | query := sqlbuilder.BuildQuery(tx.Model(&deviceModels), queryOptions) | 166 | query := sqlbuilder.BuildQuery(tx.Model(&deviceModels), queryOptions) |
167 | query.SetOffsetAndLimit(domain.MaxQueryRow) | 167 | query.SetOffsetAndLimit(domain.MaxQueryRow) |
168 | - query.SetOrderDirect("device_id", "DESC") | 168 | + |
169 | query.SetWhereByQueryOption("company_id = ?", "companyId") | 169 | query.SetWhereByQueryOption("company_id = ?", "companyId") |
170 | query.SetWhereByQueryOption("org_id = ?", "orgId") | 170 | query.SetWhereByQueryOption("org_id = ?", "orgId") |
171 | if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { | 171 | if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 { |
@@ -185,6 +185,11 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i | @@ -185,6 +185,11 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i | ||
185 | if v, ok := queryOptions["deviceName"]; ok && len(v.(string)) > 0 { | 185 | if v, ok := queryOptions["deviceName"]; ok && len(v.(string)) > 0 { |
186 | query.Where(fmt.Sprintf(`device_name like '%%%v%%'`, v)) | 186 | query.Where(fmt.Sprintf(`device_name like '%%%v%%'`, v)) |
187 | } | 187 | } |
188 | + if v, ok := queryOptions["orderBy"]; ok && len(v.(string)) > 0 { | ||
189 | + query.Order(v.(string)) | ||
190 | + } else { | ||
191 | + query.SetOrderDirect("device_id", "DESC") | ||
192 | + } | ||
188 | if count, err := query.SelectAndCount(); err != nil { | 193 | if count, err := query.SelectAndCount(); err != nil { |
189 | return 0, devices, err | 194 | return 0, devices, err |
190 | } else { | 195 | } else { |
-
请 注册 或 登录 后发表评论