|
|
@@ -5,11 +5,7 @@ import android.graphics.BitmapFactory
|
|
|
import android.widget.ImageView
|
|
|
import com.grkj.iscs.R
|
|
|
import com.grkj.iscs.databinding.FragmentWorkshopBinding
|
|
|
-import com.grkj.iscs.model.Constants.TICKET_TYPE_CHANGE_SHIFTS
|
|
|
-import com.grkj.iscs.model.Constants.TICKET_TYPE_CLEAN
|
|
|
-import com.grkj.iscs.model.Constants.TICKET_TYPE_PRE_MAINTENANCE
|
|
|
-import com.grkj.iscs.model.Constants.TICKET_TYPE_REPAIR
|
|
|
-import com.grkj.iscs.model.Constants.TICKET_TYPE_SWITCH_PRODUCT
|
|
|
+import com.grkj.iscs.model.Constants
|
|
|
import com.grkj.iscs.util.ToastUtils
|
|
|
import com.grkj.iscs.view.base.BaseMvpFragment
|
|
|
import com.grkj.iscs.view.iview.IWorkshopView
|
|
|
@@ -32,17 +28,20 @@ class WorkshopFragment :
|
|
|
|
|
|
override fun initView() {
|
|
|
jobStatisticList = mutableListOf(
|
|
|
- JobStatistics(R.mipmap.repair, TICKET_TYPE_REPAIR, getString(R.string.repair), 0),
|
|
|
- JobStatistics(R.mipmap.pre_maintenance, TICKET_TYPE_PRE_MAINTENANCE, getString(R.string.pre_maintenance), 0),
|
|
|
- JobStatistics(R.mipmap.change_shifts, TICKET_TYPE_CHANGE_SHIFTS, getString(R.string.change_shifts), 0),
|
|
|
- JobStatistics(R.mipmap.clean, TICKET_TYPE_CLEAN, getString(R.string.clean), 0),
|
|
|
- JobStatistics(R.mipmap.switch_product, TICKET_TYPE_SWITCH_PRODUCT, getString(R.string.switch_product), 0),
|
|
|
+ JobStatistics(Constants.SOP_REPAIR, 0),
|
|
|
+ JobStatistics(Constants.SOP_PRE_MAINTENANCE, 0),
|
|
|
+ JobStatistics(Constants.SOP_CHANGE_SHIFTS, 0),
|
|
|
+ JobStatistics(Constants.SOP_CLEAN, 0),
|
|
|
+ JobStatistics(Constants.SOP_SWITCH_PRODUCT, 0)
|
|
|
)
|
|
|
|
|
|
mBinding?.rvStatistics?.adapter = object : CommonAdapter<JobStatistics>(requireActivity(), R.layout.item_rv_job_management, jobStatisticList) {
|
|
|
override fun convert(holder: ViewHolder, statistic: JobStatistics, position: Int) {
|
|
|
- holder.getView<ImageView>(R.id.iv).setImageResource(statistic.icon)
|
|
|
- holder.setText(R.id.tv_name, if (statistic.count == 0) statistic.title else "${statistic.title}(${statistic.count})")
|
|
|
+ holder.getView<ImageView>(R.id.iv).setImageResource(statistic.sopType.icon)
|
|
|
+ holder.setText(R.id.tv_name,
|
|
|
+ if (statistic.count == 0) statistic.sopType.title
|
|
|
+ else "${statistic.sopType.title}(${statistic.count})"
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -57,7 +56,7 @@ class WorkshopFragment :
|
|
|
return@getWorkstationTicketList
|
|
|
}
|
|
|
jobStatisticList.forEach { itJob ->
|
|
|
- itJob.count = it.count { it.ticketType == itJob.type.toString() }
|
|
|
+ itJob.count = it.count { it.ticketType == itJob.sopType.type.toString() }
|
|
|
}
|
|
|
mBinding?.rvStatistics?.adapter?.notifyDataSetChanged()
|
|
|
}
|
|
|
@@ -103,5 +102,5 @@ class WorkshopFragment :
|
|
|
return WorkshopPresenter()
|
|
|
}
|
|
|
|
|
|
- data class JobStatistics(val icon: Int, val type: Int, val title: String, var count: Int)
|
|
|
+ data class JobStatistics(var sopType: Constants.SopType, var count: Int)
|
|
|
}
|