Commit 779bbc8d authored by 温志超's avatar 温志超

更新生产排产BUG

parent f5e76a8f
......@@ -159,4 +159,12 @@ public class ProTaskWorkunitController extends BaseController {
return AjaxResult.success("获取成功",printData);
}
@ApiOperation("获取工序打印日记")
@Log(title = "获取工序打印日记", businessType = BusinessType.UPDATE)
@PostMapping(value= "/printDataBySpil")
public AjaxResult printDataBySpil(@RequestBody Long taskWorkunitId) {
Map<String,Object> printData = proTaskWorkunitService.printDataBySpil(taskWorkunitId);
return AjaxResult.success("获取成功",printData);
}
}
......@@ -196,6 +196,7 @@ public interface ProTaskMapper extends BaseMapper<ProTask> {
List<ProTask> selectByTaskIds(@Param("taskIds")List<Long> taskIds);
List<ProTask> selectByTaskBatch(@Param("taskBatch")String taskBatch);
List<ProTask> selectByTaskWorkunitId(@Param("taskWorkunitId")Long taskWorkunitId);
void deleteByTaskBatch(@Param("taskBatch")String taskBatch);
......
......@@ -153,7 +153,7 @@ public interface ProTaskWorkunitMapper extends BaseMapper<ProTaskWorkunit> {
"\t, t.duration, ptw.schedule_end_date, t.color_code, t.request_date\n" +
"\t, t.attr1, t.attr2, t.attr3, t.attr4\n" +
"\t, t.create_time, t.update_by, t.update_time, ptw.STATUS, ptw.quantity_qualify, ptw.remark\n" +
"\t, ptw.quantity_unqualify, ptw.outsource_unit_price,ptw.outsourced, ptw.vendor_id,ptw.vendor_name, mw.workunit_id, mw.workunit_code, mw.workunit_name, ptw.std_working_time,ptw.std_working_time_uom, wo.workorder_code\n" +
"\t,ptw.source_task_workunit_id, ptw.quantity_unqualify, ptw.outsource_unit_price,ptw.outsourced, ptw.vendor_id,ptw.vendor_name, mw.workunit_id, mw.workunit_code, mw.workunit_name, ptw.std_working_time,ptw.std_working_time_uom, wo.workorder_code\n" +
"\t, (case ptw.STATUS when 'BEGINNING' then 1 when 'PREPARE' then 2 when 'PAUSE' then 3 when 'ERROR_STOP' then 4 end) statusIndex\n" +
"from pro_task_workunit ptw\n" +
"\tleft join pro_task t on ptw.task_id = t.task_id\n" +
......
......@@ -637,4 +637,59 @@ public class ProTaskWorkunitServiceImpl implements IProTaskWorkunitService {
return null;
}
}
@Override
public Map<String, Object> printDataBySpil(Long taskWorkunitId) {
Map<String, Object> printData = new HashMap<>();
ArrayList valueList = new ArrayList();
printData.put("reportName","process.xml");
List<MdFactory> mdFactorys = mdFactoryMapper.selectLikeByName("上海希迈机电");
if(mdFactorys.size() > 0){
printData.put("reportName","process-cn.xml");
}
printData.put("valueList",valueList);
int i = 1;
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
//for (String taskBatch : taskBatchs){
List<ProTask> taskBatchTasks = proTaskMapper.selectByTaskWorkunitId(taskWorkunitId);
String[] sp = taskBatchTasks.get(0).getTaskBatch().split("-");
if(taskBatchTasks.size() > 0){
List<TaskProPrintData> taskProPrintDatas = new ArrayList<>();
Map<String,Object> value = new HashMap<>();
valueList.add(value);
ProWorkorder proWorkorder = proWorkorderMapper.selectProWorkorderWorderCode(taskBatchTasks.get(0).getArrangeCode());
TaskProWorkorderPrintData taskProWorkorderPrintData = new TaskProWorkorderPrintData();
BeanUtil.copyProperties(proWorkorder,taskProWorkorderPrintData);
taskProWorkorderPrintData.setWorkorderType(dictDataService.getDictLabel("mes_workorder_type", taskProWorkorderPrintData.getWorkorderType()));
taskProWorkorderPrintData.setTaskBatch(sp[sp.length-1]);
value.put("header",taskProWorkorderPrintData);
value.put("detail",taskProPrintDatas);
Date over = null;
if(taskProWorkorderPrintData.getExpectStartDate() != null || taskProWorkorderPrintData.getRequestDate() != null){
for (ProTask proTask : taskBatchTasks){
TaskProPrintData taskProPrintData = new TaskProPrintData();
BeanUtil.copyProperties(proTask,taskProPrintData);
String begin = taskProWorkorderPrintData.getExpectStartDate() != null ? simpleDateFormat1.format(taskProWorkorderPrintData.getExpectStartDate()) : "空";
String end = taskProWorkorderPrintData.getRequestDate() != null ? simpleDateFormat1.format(taskProWorkorderPrintData.getRequestDate()) : "空";
taskProPrintData.setExpectStartDateString(begin);
taskProPrintData.setRequestDateString(end);
taskProPrintDatas.add(taskProPrintData);
if(proTask.getScheduleEndDate() != null){
if(over == null || over.getTime() < proTask.getScheduleEndDate().getTime()) {
over = proTask.getScheduleEndDate();
}
}
}
}
if(over != null){
taskProWorkorderPrintData.setRequestDate(over);
}
taskProWorkorderPrintData.setSize(i++);
taskProWorkorderPrintData.setDate(simpleDateFormat1.format(new Date()));
taskProWorkorderPrintData.setQuantity(taskBatchTasks.get(0).getQuantity());
//}
}
return printData;
}
}
......@@ -181,4 +181,6 @@ public interface IProTaskWorkunitService {
void outsourceConfirm(ProTaskWorkunit taskWorkunit);
Map<String, Object> printData(List<Long> taskIds);
Map<String, Object> printDataBySpil(Long taskWorkunitId);
}
......@@ -345,6 +345,68 @@
</foreach>
</where>
</select>
<select id="selectByTaskWorkunitId" resultType="com.ximai.mes.pro.domain.task.ProTask">
SELECT ptw.task_workunit_id,
t.task_id,
t.task_code,
t.task_name,
t.workstation_id,
ws.workstation_code,
ws.workstation_name,
t.process_id,
t.arrange_code,
p.process_code,
p.process_name,
p.remark as processRemark,
t.item_id,
i.item_code,
i.item_name,
t.specification,
t.client_id,
t.client_code,
t.client_name,
t.client_nick,
t.start_time,
t.duration,
t.end_time,
t.color_code,
t.request_date,
t.remark,
t.attr1,
t.attr2,
t.attr3,
t.attr4,
t.create_by,
t.create_time,
t.update_by,
t.update_time,
t.idx,
t.task_batch,
ptw.task_workunit_id,
ptw.quantity,
ptw.quantity_produced,
ptw.quantity_changed,
ptw.quantity_qualify,
ptw.unit_of_measure,
ptw.STATUS,
mw.workunit_name workunit_name,
mw.workunit_id workunit_id,
mw.workunit_code workunit_code,
ptw.quantity_unqualify,
ptw.schedule_end_date,
ptw.schedule_start_date
FROM pro_task_workunit ptw
LEFT JOIN pro_task t ON t.task_id = ptw.task_id
LEFT JOIN pro_process p ON t.process_id = p.process_id
LEFT JOIN md_item i ON t.item_id = i.item_id
LEFT JOIN md_workunit mw ON ptw.workunit_id = mw.workunit_id
LEFT JOIN md_workstation ws ON t.workstation_id = ws.workstation_id
<where>
ptw.task_workunit_id = #{taskWorkunitId}
</where>
order by t.idx
</select>
<select id="selectByTaskBatch" resultType="com.ximai.mes.pro.domain.task.ProTask">
SELECT ptw.task_workunit_id,
t.task_id,
......@@ -403,8 +465,9 @@
<where>
t.task_batch = #{taskBatch}
</where>
order by t.idx
order by t.idx
</select>
<select id="getProcessList"
resultType="com.ximai.mes.report.response.WorkOrderProgressProcessListResponse">
select * from pro_task where arrange_code = #{workorderCode} order by task_id
......
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