Commit a3fa4c47 authored by 温志超's avatar 温志超

更新打印

parent 997adb32
......@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
/**
......@@ -149,4 +150,13 @@ public class ProTaskWorkunitController extends BaseController {
}
@ApiOperation("获取工序打印日记")
@Log(title = "获取工序打印日记", businessType = BusinessType.UPDATE)
@PostMapping(value= "/printData")
public AjaxResult printData(@RequestBody List<Long> taskIds) {
Map<String,Object> printData = proTaskWorkunitService.printData(taskIds);
return AjaxResult.success("获取成功",printData);
}
}
......@@ -201,4 +201,6 @@ public class ProTaskWorkunit extends BaseEntity {
private String orderCode;
@ApiModelProperty("项目号")
private String customerProjectNo;
@ApiModelProperty("任务批号")
private String taskBatch;
}
......@@ -191,4 +191,8 @@ public interface ProTaskMapper extends BaseMapper<ProTask> {
@Select("select p.task_id,pw.task_workunit_id,pw.task_workunit_id,pw.status from pro_task p LEFT JOIN pro_task_workunit pw on p.task_id=pw.task_id ${ew.customSqlSegment}")
List<ProTask> selectTaskWuListByQw(@Param("ew") QueryWrapper<ProTask> query);
List<ProTask> selectByTaskIds(@Param("taskIds")List<Long> taskIds);
List<ProTask> selectByTaskBatch(@Param("taskBatch")String taskBatch);
}
......@@ -138,7 +138,7 @@ public interface ProTaskWorkunitMapper {
@Select(value = "select * from pro_task_workunit where task_id =#{taskId} and and actual_end_date is not null order by task_workunit_id limit 1")
ProTaskWorkunit selectTaskScheduledForearliestExec(@Param("taskId") Long taskId);
@Select(value = "select t.task_id, t.task_code, t.task_name\n" +
@Select(value = "select t.task_id, t.task_code, t.task_name, t.task_batch\n" +
"\t, t.workstation_id, t.workstation_code, ws.workstation_name\n" +
"\t, t.process_id, t.process_code, t.process_name\n" +
"\t, t.item_id, wo.product_code as item_code, wo.product_name as item_name,wo.customer_project_no,wo.order_code, t.specification, t.unit_of_measure\n" +
......
......@@ -25,6 +25,7 @@ import com.ximai.mes.pro.dto.task.ProTaskWorkunitConvertRecordCreate;
import com.ximai.mes.pro.mapper.ProArrangeMapper;
import com.ximai.mes.pro.mapper.ProFeedbackMapper;
import com.ximai.mes.pro.mapper.proWorkOrder.ProWorkorderMapper;
import com.ximai.mes.pro.mapper.task.ProTaskMapper;
import com.ximai.mes.pro.mapper.task.ProTaskWorkunitMapper;
import com.ximai.mes.pro.service.IProAllocationMaterialService;
import com.ximai.mes.pro.service.IProMaterialRequestService;
......@@ -65,6 +66,8 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
@Autowired
private IProTaskService proTaskService;
@Autowired
private ProTaskMapper proTaskMapper;
@Autowired
private IProTaskWorkunitService proTaskWorkunitService;
@Resource
private ProWorkorderMapper proWorkorderMapper;
......@@ -554,4 +557,29 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
this.updateProTaskWorkunit(taskWorkunit);
this.updateProTaskWorkunitState(taskWorkunit, TaskStatusEnum.BEGINNING);
}
@Override
public Map<String, Object> printData(List<Long> taskIds) {
if(taskIds.size() > 0){
Map<String, Object> printData = new HashMap<>();
ArrayList valueList = new ArrayList();
printData.put("reportName","mysql:qrcode-50*50-2");
printData.put("valueList",valueList);
List<ProTask> tasks = proTaskMapper.selectByTaskIds(taskIds);
List<String> taskBatchs = tasks.stream().map(proTask -> proTask.getTaskBatch()).distinct().collect(Collectors.toList());
for (String taskBatch : taskBatchs){
List<ProTask> taskBatchTasks = proTaskMapper.selectByTaskBatch(taskBatch);
if(taskBatchTasks.size() > 0){
Map<String,Object> value = new HashMap<>();
valueList.add( value);
ProWorkorder proWorkorder = proWorkorderMapper.selectProWorkorderWorderCode(taskBatchTasks.get(0).getArrangeCode());
value.put("header",proWorkorder);
value.put("detail",taskBatchTasks);
}
}
return printData;
}else{
return null;
}
}
}
......@@ -14,6 +14,8 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* 任务工作单元Service接口
......@@ -169,4 +171,5 @@ public interface IProTaskWorkunitService {
*/
void outsourceConfirm(ProTaskWorkunit taskWorkunit);
Map<String, Object> printData(List<Long> taskIds);
}
......@@ -329,6 +329,21 @@
<include refid="selectProTaskVo"/>
where task_code = #{taskCode}
</select>
<select id="selectByTaskIds" resultType="com.ximai.mes.pro.domain.task.ProTask">
<include refid="selectProTaskVo"/>
<where>
t.task_id in
<foreach item="item" collection="taskIds" open="(" separator="," close=")">
#{item}
</foreach>
</where>
</select>
<select id="selectByTaskBatch" resultType="com.ximai.mes.pro.domain.task.ProTask">
<include refid="selectProTaskDetailVo"/>
<where>
t.task_batch = #{taskBatch}
</where>
</select>
<insert id="insertProTask" parameterType="ProTask" useGeneratedKeys="true" keyProperty="taskId">
insert into pro_task
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment