正在显示
4 个修改的文件
包含
17 行增加
和
20 行删除
@@ -2,7 +2,6 @@ package dto | @@ -2,7 +2,6 @@ package dto | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" |
5 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" | ||
6 | ) | 5 | ) |
7 | 6 | ||
8 | type EmployeeProductRecordDto struct { | 7 | type EmployeeProductRecordDto struct { |
@@ -32,7 +31,7 @@ type EmployeeProductRecordDto struct { | @@ -32,7 +31,7 @@ type EmployeeProductRecordDto struct { | ||
32 | // 权限标识 (当前登录组织匹配为true,否则false) | 31 | // 权限标识 (当前登录组织匹配为true,否则false) |
33 | AuthFlag bool `json:"authFlag"` | 32 | AuthFlag bool `json:"authFlag"` |
34 | // 合格率 百分比 | 33 | // 合格率 百分比 |
35 | - QualificationRate int `json:"qualificationRate"` | 34 | + QualificationRate float64 `json:"qualificationRate"` |
36 | // 考勤类型 1.正常 2.支援 | 35 | // 考勤类型 1.正常 2.支援 |
37 | ParticipateTypeDescription string `json:"participateTypeDescription"` | 36 | ParticipateTypeDescription string `json:"participateTypeDescription"` |
38 | // 员工类型描述 1:固定 2:派遣 3.临时 | 37 | // 员工类型描述 1:固定 2:派遣 3.临时 |
@@ -50,9 +49,9 @@ func (d *EmployeeProductRecordDto) LoadDto(m *domain.EmployeeProductRecord, orgI | @@ -50,9 +49,9 @@ func (d *EmployeeProductRecordDto) LoadDto(m *domain.EmployeeProductRecord, orgI | ||
50 | d.PlanProductName = m.ProductRecordInfo.PlanProductName | 49 | d.PlanProductName = m.ProductRecordInfo.PlanProductName |
51 | d.BatchNumber = m.ProductRecordInfo.BatchNumber | 50 | d.BatchNumber = m.ProductRecordInfo.BatchNumber |
52 | d.ParticipateType = m.ParticipateType | 51 | d.ParticipateType = m.ParticipateType |
53 | - d.ProductWeigh = utils.Round(m.RealProductWeigh(), 1) | ||
54 | - d.SecondLevelWeigh = utils.Round(m.SecondLevelWeigh, 1) | ||
55 | - d.QualificationRate = m.QualificationRate() | 52 | + d.ProductWeigh = m.ProductRecordInfo.OutputWeight // utils.Round(m.RealProductWeigh(), 1) |
53 | + d.SecondLevelWeigh = m.ProductRecordInfo.SecondLevelWeight // utils.Round(m.SecondLevelWeigh, 1) | ||
54 | + d.QualificationRate = m.ProductRecordInfo.QualificationRate //m.QualificationRate() | ||
56 | d.CreatedAt = m.CreatedAt.Local().Format("2006-01-02") | 55 | d.CreatedAt = m.CreatedAt.Local().Format("2006-01-02") |
57 | d.ParticipateTypeDescription = domain.ParticipateTypeDescription(m.ParticipateType) | 56 | d.ParticipateTypeDescription = domain.ParticipateTypeDescription(m.ParticipateType) |
58 | d.EmployeeTypeDescription = domain.EmployeeTypeDescription(m.ProductWorker.EmployeeType) | 57 | d.EmployeeTypeDescription = domain.EmployeeTypeDescription(m.ProductWorker.EmployeeType) |
@@ -2,7 +2,6 @@ package dto | @@ -2,7 +2,6 @@ package dto | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" | 4 | "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/domain" |
5 | - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils" | ||
6 | ) | 5 | ) |
7 | 6 | ||
8 | type WorkshopProductRecordDto struct { | 7 | type WorkshopProductRecordDto struct { |
@@ -32,7 +31,7 @@ type WorkshopProductRecordDto struct { | @@ -32,7 +31,7 @@ type WorkshopProductRecordDto struct { | ||
32 | // 权限标识 (当前登录组织匹配为true,否则false) | 31 | // 权限标识 (当前登录组织匹配为true,否则false) |
33 | AuthFlag bool `json:"authFlag"` | 32 | AuthFlag bool `json:"authFlag"` |
34 | // 合格率 百分比 | 33 | // 合格率 百分比 |
35 | - QualificationRate int `json:"qualificationRate"` | 34 | + QualificationRate float64 `json:"qualificationRate"` |
36 | } | 35 | } |
37 | 36 | ||
38 | func (d *WorkshopProductRecordDto) LoadDto(m *domain.WorkshopProductRecord, orgId int) *WorkshopProductRecordDto { | 37 | func (d *WorkshopProductRecordDto) LoadDto(m *domain.WorkshopProductRecord, orgId int) *WorkshopProductRecordDto { |
@@ -42,10 +41,10 @@ func (d *WorkshopProductRecordDto) LoadDto(m *domain.WorkshopProductRecord, orgI | @@ -42,10 +41,10 @@ func (d *WorkshopProductRecordDto) LoadDto(m *domain.WorkshopProductRecord, orgI | ||
42 | d.PlanProductName = m.ProductRecordInfo.PlanProductName | 41 | d.PlanProductName = m.ProductRecordInfo.PlanProductName |
43 | d.BatchNumber = m.ProductRecordInfo.BatchNumber | 42 | d.BatchNumber = m.ProductRecordInfo.BatchNumber |
44 | //d.ParticipateType = m.ParticipateType | 43 | //d.ParticipateType = m.ParticipateType |
45 | - d.DevotedProductWeigh = utils.Round(m.DevotedProductWeigh(), 1) | ||
46 | - d.ProductWeigh = utils.Round(m.RealProductWeigh(), 1) | ||
47 | - d.SecondLevelWeigh = utils.Round(m.SecondLevelWeigh, 1) | ||
48 | - d.QualificationRate = m.QualificationRate() | 44 | + d.DevotedProductWeigh = m.ProductRecordInfo.InputWeight //utils.Round(m.DevotedProductWeigh(), 1) |
45 | + d.ProductWeigh = m.ProductRecordInfo.OutputWeight //utils.Round(m.RealProductWeigh(), 1) | ||
46 | + d.SecondLevelWeigh = m.ProductRecordInfo.SecondLevelWeight //utils.Round(m.SecondLevelWeigh, 1) | ||
47 | + d.QualificationRate = m.ProductRecordInfo.QualificationRate //m.QualificationRate() | ||
49 | d.CreatedAt = m.ProductDate | 48 | d.CreatedAt = m.ProductDate |
50 | d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) | 49 | d.AuthFlag = domain.CheckOrgAuth(orgId, m.OrgId) |
51 | if m.Ext != nil { | 50 | if m.Ext != nil { |
@@ -25,7 +25,7 @@ type ProductRecordStaticInfo struct { | @@ -25,7 +25,7 @@ type ProductRecordStaticInfo struct { | ||
25 | // 历史最好产出量 | 25 | // 历史最好产出量 |
26 | BestOutputWeight float64 `json:"bestOutputWeight"` | 26 | BestOutputWeight float64 `json:"bestOutputWeight"` |
27 | // 合格率 | 27 | // 合格率 |
28 | - QualificationRate int `json:"qualificationRate"` | 28 | + QualificationRate float64 `json:"qualificationRate"` |
29 | 29 | ||
30 | // 其他工段二级品的重量合计 | 30 | // 其他工段二级品的重量合计 |
31 | TotalOtherSecondLevelWeigh float64 `json:"totalOtherSecondLevelWeigh"` | 31 | TotalOtherSecondLevelWeigh float64 `json:"totalOtherSecondLevelWeigh"` |
@@ -38,7 +38,7 @@ func (info *ProductRecordStaticInfo) OtherSecondLevelWeigh() float64 { | @@ -38,7 +38,7 @@ func (info *ProductRecordStaticInfo) OtherSecondLevelWeigh() float64 { | ||
38 | for _, v := range info.OtherSectionSecondLevelWeigh { | 38 | for _, v := range info.OtherSectionSecondLevelWeigh { |
39 | result += v | 39 | result += v |
40 | } | 40 | } |
41 | - return result | 41 | + return utils.Round(result, 1) |
42 | } | 42 | } |
43 | 43 | ||
44 | // AddSectionWeight 添加工段的二级品 | 44 | // AddSectionWeight 添加工段的二级品 |
@@ -57,9 +57,9 @@ func (info *ProductRecordStaticInfo) AddSectionWeight(section string, weight flo | @@ -57,9 +57,9 @@ func (info *ProductRecordStaticInfo) AddSectionWeight(section string, weight flo | ||
57 | // bestWeight 最佳产能 | 57 | // bestWeight 最佳产能 |
58 | func (info *ProductRecordStaticInfo) PreStatistics(productWeight float64, secondWeight float64, yesterdayWeight float64, bestWeight float64) { | 58 | func (info *ProductRecordStaticInfo) PreStatistics(productWeight float64, secondWeight float64, yesterdayWeight float64, bestWeight float64) { |
59 | totalOtherSecondLevelWeigh := info.OtherSecondLevelWeigh() | 59 | totalOtherSecondLevelWeigh := info.OtherSecondLevelWeigh() |
60 | - info.InputWeight = productWeight - totalOtherSecondLevelWeigh | ||
61 | - info.OutputWeight = info.InputWeight - secondWeight | ||
62 | - info.SecondLevelWeight = secondWeight | 60 | + info.InputWeight = utils.Round(productWeight-totalOtherSecondLevelWeigh, 1) |
61 | + info.OutputWeight = utils.Round(info.InputWeight-secondWeight, 1) | ||
62 | + info.SecondLevelWeight = utils.Round(secondWeight, 1) | ||
63 | if info.YesterdayOutputWeight == 0 && info.BestOutputWeight == 0 { | 63 | if info.YesterdayOutputWeight == 0 && info.BestOutputWeight == 0 { |
64 | info.YesterdayOutputWeight = yesterdayWeight | 64 | info.YesterdayOutputWeight = yesterdayWeight |
65 | info.BestOutputWeight = bestWeight | 65 | info.BestOutputWeight = bestWeight |
@@ -68,5 +68,5 @@ func (info *ProductRecordStaticInfo) PreStatistics(productWeight float64, second | @@ -68,5 +68,5 @@ func (info *ProductRecordStaticInfo) PreStatistics(productWeight float64, second | ||
68 | info.BestOutputWeight = info.OutputWeight | 68 | info.BestOutputWeight = info.OutputWeight |
69 | } | 69 | } |
70 | info.TotalOtherSecondLevelWeigh = totalOtherSecondLevelWeigh | 70 | info.TotalOtherSecondLevelWeigh = totalOtherSecondLevelWeigh |
71 | - info.QualificationRate = int(utils.Round(info.OutputWeight/info.InputWeight*100, 2)) | 71 | + info.QualificationRate = utils.Round(info.OutputWeight*100.0/info.InputWeight, 0) |
72 | } | 72 | } |
@@ -87,7 +87,7 @@ func (employeeProductRecord *WorkshopProductRecord) RealProductWeigh() float64 { | @@ -87,7 +87,7 @@ func (employeeProductRecord *WorkshopProductRecord) RealProductWeigh() float64 { | ||
87 | } | 87 | } |
88 | 88 | ||
89 | // 合格率 | 89 | // 合格率 |
90 | -func (employeeProductRecord *WorkshopProductRecord) QualificationRate() int { | 90 | +func (employeeProductRecord *WorkshopProductRecord) QualificationRate() float64 { |
91 | realProductWeigh := employeeProductRecord.RealProductWeigh() | 91 | realProductWeigh := employeeProductRecord.RealProductWeigh() |
92 | if realProductWeigh == 0 { | 92 | if realProductWeigh == 0 { |
93 | return 0 | 93 | return 0 |
@@ -97,8 +97,7 @@ func (employeeProductRecord *WorkshopProductRecord) QualificationRate() int { | @@ -97,8 +97,7 @@ func (employeeProductRecord *WorkshopProductRecord) QualificationRate() int { | ||
97 | return 0 | 97 | return 0 |
98 | } | 98 | } |
99 | // 合格率 = 产能重量 / (总投入重量 - 上级损耗重量) | 99 | // 合格率 = 产能重量 / (总投入重量 - 上级损耗重量) |
100 | - result := int(utils.Round(realProductWeigh*100/devoteWeigh, 0)) | ||
101 | - return result | 100 | + return utils.Round(realProductWeigh*100/devoteWeigh, 0) |
102 | } | 101 | } |
103 | func (employeeProductRecord *WorkshopProductRecord) DevotedProductWeigh() float64 { | 102 | func (employeeProductRecord *WorkshopProductRecord) DevotedProductWeigh() float64 { |
104 | result := employeeProductRecord.ProductWeigh - employeeProductRecord.ProductRecordInfo.OtherSecondLevelWeigh() | 103 | result := employeeProductRecord.ProductWeigh - employeeProductRecord.ProductRecordInfo.OtherSecondLevelWeigh() |
-
请 注册 或 登录 后发表评论