作者 yangfu

fix: 车间产能统计修改

package domain
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
type ProductRecordStaticInfo struct {
// 生产日期
ProductDate string `json:"productDate"`
... ... @@ -66,5 +68,5 @@ func (info *ProductRecordStaticInfo) PreStatistics(productWeight float64, second
info.BestOutputWeight = info.OutputWeight
}
info.TotalOtherSecondLevelWeigh = totalOtherSecondLevelWeigh
info.QualificationRate = int(info.OutputWeight / info.InputWeight * 100)
info.QualificationRate = int(utils.Round(info.OutputWeight/info.InputWeight*100, 2))
}
... ...
package domain
import "time"
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/utils"
"time"
)
// 员工生产记录
type WorkshopProductRecord struct {
... ... @@ -89,8 +92,12 @@ func (employeeProductRecord *WorkshopProductRecord) QualificationRate() int {
if realProductWeigh == 0 {
return 0
}
devoteWeigh := employeeProductRecord.DevotedProductWeigh()
if devoteWeigh == 0 {
return 0
}
// 合格率 = 产能重量 / (总投入重量 - 上级损耗重量)
result := int(realProductWeigh * 100 / (employeeProductRecord.ProductWeigh - employeeProductRecord.ProductRecordInfo.OtherSecondLevelWeigh()))
result := int(utils.Round(realProductWeigh*100/devoteWeigh, 0))
return result
}
func (employeeProductRecord *WorkshopProductRecord) DevotedProductWeigh() float64 {
... ...
... ... @@ -57,6 +57,7 @@ func TestComputeTimeDuration(t *testing.T) {
const TIME_LAYOUT = "2006-01-02 03:04:05"
func TestTimeParse(t *testing.T) {
fmt.Println(int(-1))
timeParse()
}
... ...