| | |
| | | WorkType WorkTypeManage `json:"workType" gorm:"foreignKey:WorkTypeID;references:ID"` |
| | | WorkerID string `json:"workerId" gorm:"size:200;not null;comment:员工ID"` //员工ID |
| | | Worker Worker `json:"worker" gorm:"foreignKey:WorkerID;references:ID"` |
| | | WorkshopId uint `json:"workshopId" gorm:"type:int(11);comment:车间Id"` |
| | | WorkshopNumber string `json:"workshopNumber" gorm:"size:255;not null;comment:车间编号"` // 车间编号 |
| | | GroupNumber int `json:"groupNumber" gorm:"size:11;not null;comment:组别"` // 组别 |
| | | CarNumbers string `json:"carNumbers" gorm:"size:255;not null;comment:车台号"` // 车台号 |
| | |
| | | ) |
| | | |
| | | func (slf PayrollProductionWeavers) TableName() string { |
| | | return "silk_payroll_production_employee" |
| | | return "silk_payroll_production_weavers" |
| | | } |
| | | |
| | | // NewPayrollProductionWeaversSearch 员工每天的产量统计 |
| | |
| | | |
| | | return records, nil |
| | | } |
| | | |
| | | type WeaversAmount struct { |
| | | WorkerID string `json:"workerID"` |
| | | SilkQuantity decimal.Decimal `json:"silkQuantity"` // 丝量 |
| | | SilkTotalAmount decimal.Decimal `json:"silkTotalAmount"` // 丝量总价 |
| | | BadSilkQuantity decimal.Decimal `json:"badSilkQuantity"` // 野纤数量 |
| | | BadSilkTotalAmount decimal.Decimal `json:"badSilkTotalAmount"` // 野纤总价 |
| | | FinishTotalAmount decimal.Decimal `json:"finishTotalAmount"` // 成品金额 |
| | | } |
| | | |
| | | // FindWeaversAmount 挡车工月工资 |
| | | func (slf *PayrollProductionWeaversSearch) FindWeaversAmount(monthly string) ([]*WeaversAmount, error) { |
| | | var ( |
| | | records = make([]*WeaversAmount, 0) |
| | | db = slf.Orm.Table(slf.TableName()) |
| | | ) |
| | | db.Select("worker_id, sum(silk_quantity) as silk_quantity, sum(silk_total_amount) as silk_total_amount, sum(bad_silk_quantity) as bad_silk_quantity, sum(bad_silk_total_amount) as bad_silk_total_amount, sum(finish_total_amount) as finish_total_amount"). |
| | | Where("cycle like ?", monthly+"%"). |
| | | Group("worker_id") |
| | | |
| | | return records, db.Find(&records).Error |
| | | } |