作者 yangfu

fix: 配置修改

... ... @@ -119,4 +119,8 @@ spec:
- name: MANUFACTURE_DEFAULT_ORGID
value: "487"
- name: MANUFACTURE_PRODUCT_TYPE
value: "0502010004ST,0502010004ST"
\ No newline at end of file
value: "0502010004ST,0502010004ST"
- name: MQTT_HOST
value: "47.97.5.102"
- name: MQTT_PORT
value: "6000"
\ No newline at end of file
... ...
... ... @@ -272,7 +272,12 @@ func (ptr *PGCommonStatisticsService) DeviceRunningStatistics(queryOptions map[s
log.Logger.Error(err.Error())
}
}
_, devices, err := deviceRepository.Find(map[string]interface{}{"companyId": request.CompanyId, "orgId": request.OrgId, "workshopId": request.WorkshopId, "lineId": request.LineId})
_, devices, err := deviceRepository.Find(map[string]interface{}{
"companyId": request.CompanyId,
"orgId": request.OrgId,
"workshopId": request.WorkshopId,
"lineId": request.LineId,
"orderBy": "device_name asc"})
if err != nil {
return nil, err
}
... ...
... ... @@ -91,8 +91,8 @@ func (ptr *PGWorkshopDataConsumeService) Consume(companyId, orgId int, record *d
if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil {
return nil, err
}
// 2.保存设备生产记录 (统计车间、员工产能)
if record.DeviceType == domain.DeviceTypeChuanChuanJi && plan != nil {
// 2.保存设备生产记录 (统计车间、员工产能) 批次跟数量不为空
if record.DeviceType == domain.DeviceTypeChuanChuanJi && plan != nil && deviceRunningData.Count > 0 {
productRecord, _ := ptr.newProductRecord(companyId, orgId, workStation, device, deviceRunningData, plan)
//if _, err = deviceRunningRecordRepository.Save(deviceRunningRecord); err != nil {
... ... @@ -247,8 +247,8 @@ func (ptr *PGWorkshopDataConsumeService) newProductRecord(companyId int, orgId i
ProductRecordInfo: &domain.ProductRecordInfo{
ProductDate: data.CollectionTime.Local().Format("2006-01-02"),
Original: float64(data.Count),
Weigh: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 1),
WeighBefore: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 1),
Weigh: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 2),
WeighBefore: utils.Round(float64(data.Count)*DefaultCCJUnitQuantity, 2),
ApproveStatus: domain.AttendanceNotApprove,
ProductPlanId: plan.PlanDispatchRecordExt.ProductPlanId,
PlanProductName: plan.PlanDispatchRecordExt.PlanProductName,
... ...
... ... @@ -149,7 +149,7 @@ func (repository *DeviceDailyRunningRecordRepository) Find(queryOptions map[stri
if v, ok := queryOptions["productDate"]; ok && !(v.(time.Time)).IsZero() {
query.Where(`product_date = ?`, v)
}
query.SetOffsetAndLimit(20)
query.SetOffsetAndLimit(domain.MaxQueryRow)
query.SetOrderDirect("device_daily_running_record_id", "DESC")
if count, err := query.SelectAndCount(); err != nil {
return 0, deviceDailyRunningRecords, err
... ...
... ... @@ -165,7 +165,7 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i
devices := make([]*domain.Device, 0)
query := sqlbuilder.BuildQuery(tx.Model(&deviceModels), queryOptions)
query.SetOffsetAndLimit(domain.MaxQueryRow)
query.SetOrderDirect("device_id", "DESC")
query.SetWhereByQueryOption("company_id = ?", "companyId")
query.SetWhereByQueryOption("org_id = ?", "orgId")
if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int)) > 0 {
... ... @@ -185,6 +185,11 @@ func (repository *DeviceRepository) Find(queryOptions map[string]interface{}) (i
if v, ok := queryOptions["deviceName"]; ok && len(v.(string)) > 0 {
query.Where(fmt.Sprintf(`device_name like '%%%v%%'`, v))
}
if v, ok := queryOptions["orderBy"]; ok && len(v.(string)) > 0 {
query.Order(v.(string))
} else {
query.SetOrderDirect("device_id", "DESC")
}
if count, err := query.SelectAndCount(); err != nil {
return 0, devices, err
} else {
... ...