|
|
@@ -995,11 +995,31 @@ class WorkOrderProcess extends Api
|
|
|
->where($where)
|
|
|
->field('id,part_code as 部件编号,part_name as 部件名称,process_code as 工序编号,process_name as 工序名称,
|
|
|
big_process as 大工序,standard_hour as 秒,standard_minutes as 分,standard_score as 定额分,money as 金额,
|
|
|
- coefficient as 难度系数,remark as 备注,status as 状态')
|
|
|
+ coefficient as 难度系数,remark as 备注,status as 状态,pid')
|
|
|
->select();
|
|
|
if (empty($workOrderProcess)) {
|
|
|
$this->error('工单工艺不存在');
|
|
|
}
|
|
|
+
|
|
|
+ $pidList = [];
|
|
|
+ foreach ($workOrderProcess as $row) {
|
|
|
+ if (!empty($row['pid'])) {
|
|
|
+ $pidList[(int)$row['pid']] = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $parentCodeMap = [];
|
|
|
+ if (!empty($pidList)) {
|
|
|
+ $parentCodeMap = Db::table('工单_基础工艺资料')
|
|
|
+ ->whereIn('id', array_keys($pidList))
|
|
|
+ ->column('process_code', 'id');
|
|
|
+ }
|
|
|
+ foreach ($workOrderProcess as &$row) {
|
|
|
+ $row['母工序编号'] = !empty($row['pid']) && isset($parentCodeMap[(int)$row['pid']])
|
|
|
+ ? $parentCodeMap[(int)$row['pid']]
|
|
|
+ : '';
|
|
|
+ }
|
|
|
+ unset($row);
|
|
|
+
|
|
|
$this->success('成功', $workOrderProcess);
|
|
|
}
|
|
|
|