|
|
@@ -147,16 +147,20 @@ class StationTaskCommodityService
|
|
|
$stationTaskCommodities_grouped->each(function(&$groupByBatch){
|
|
|
($标记本波次内是处理中或处理队列=function()use(&$groupByBatch){
|
|
|
$taskBatchId=$groupByBatch[0]['station_task_batch_id'];
|
|
|
- $processing=$this->getProcessing_byTaskBatch($taskBatchId);
|
|
|
- if(!$processing
|
|
|
- || $processing['material_box_id'] == $taskBatchId['material_box_id']){
|
|
|
- $status='处理中';
|
|
|
- }else{
|
|
|
- $status='处理队列';
|
|
|
- }
|
|
|
- $groupByBatch->each(function(&$stationTaskCommodity)use($status){
|
|
|
- $stationTaskCommodity['status']=$status;
|
|
|
+ $processingIds=data_get($this->getProcessings_byTaskBatch($taskBatchId),'*.id')??[];
|
|
|
+ $groupByBatch->each(function(&$stationTaskCommodity)use($processingIds){
|
|
|
+ if(in_array($stationTaskCommodity['id'],$processingIds))
|
|
|
+ $stationTaskCommodity['status']='处理中';
|
|
|
+ else
|
|
|
+ $stationTaskCommodity['status']='处理队列';
|
|
|
});
|
|
|
+ if(count($processingIds)==0){
|
|
|
+ foreach($groupByBatch as &$stationTaskCommodity){
|
|
|
+ if($stationTaskCommodity['material_box_id']==$groupByBatch[0]['material_box_id']){
|
|
|
+ $stationTaskCommodity['status']='处理中';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
})();
|
|
|
});
|
|
|
($持久化处理队列的记录=function()use(&$stationTaskCommodities_grouped){
|
|
|
@@ -173,13 +177,13 @@ class StationTaskCommodityService
|
|
|
|
|
|
}
|
|
|
|
|
|
- function getProcessing_byTaskBatch($stationTaskBatch_id)
|
|
|
+ function getProcessings_byTaskBatch($stationTaskBatch_id)
|
|
|
{
|
|
|
- //这里不能用缓存,因为更新会非常快
|
|
|
+ //这里不好用缓存,因为更新会非常快
|
|
|
return StationTaskCommodity::query()
|
|
|
->where('station_task_batch_id',$stationTaskBatch_id)
|
|
|
->where('status','处理中')
|
|
|
- ->first();
|
|
|
+ ->get();
|
|
|
}
|
|
|
|
|
|
|