|
@@ -3,6 +3,7 @@ package com.imcs.admin.business.service.impl;
|
|
|
|
|
|
import com.hankcs.hanlp.HanLP;
|
|
import com.hankcs.hanlp.HanLP;
|
|
import com.hankcs.hanlp.dictionary.py.Pinyin;
|
|
import com.hankcs.hanlp.dictionary.py.Pinyin;
|
|
|
|
+import com.imcs.admin.business.service.BusinessService;
|
|
import com.imcs.admin.business.service.DevicMaintainService;
|
|
import com.imcs.admin.business.service.DevicMaintainService;
|
|
import com.imcs.admin.common.config.SessionContext;
|
|
import com.imcs.admin.common.config.SessionContext;
|
|
import com.imcs.admin.common.data.SysFile;
|
|
import com.imcs.admin.common.data.SysFile;
|
|
@@ -49,6 +50,9 @@ public class DevicMaintainServiceImpl implements DevicMaintainService {
|
|
@Resource
|
|
@Resource
|
|
private SysFileService sysFileService;
|
|
private SysFileService sysFileService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private BusinessService businessService;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -179,7 +183,7 @@ public class DevicMaintainServiceImpl implements DevicMaintainService {
|
|
try {
|
|
try {
|
|
FileInputStream fis = new FileInputStream(filePath);
|
|
FileInputStream fis = new FileInputStream(filePath);
|
|
HWPFDocument document = new HWPFDocument(fis);
|
|
HWPFDocument document = new HWPFDocument(fis);
|
|
- fis.close();
|
|
|
|
|
|
+
|
|
|
|
|
|
// 遍历文档中的所有表格
|
|
// 遍历文档中的所有表格
|
|
Range range = document.getRange();
|
|
Range range = document.getRange();
|
|
@@ -276,15 +280,15 @@ public class DevicMaintainServiceImpl implements DevicMaintainService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- int wgSeq=0;
|
|
|
|
|
|
+ int y=0;
|
|
for(int i =0;i<procedureList.size();i++){
|
|
for(int i =0;i<procedureList.size();i++){
|
|
List<String> item=procedureList.get(i);
|
|
List<String> item=procedureList.get(i);
|
|
if (!item.isEmpty() && isNumeric(item.get(0))) {
|
|
if (!item.isEmpty() && isNumeric(item.get(0))) {
|
|
//int seq = Integer.parseInt(item.get(0));
|
|
//int seq = Integer.parseInt(item.get(0));
|
|
- int seq=i+1;
|
|
|
|
- wgSeq=seq;
|
|
|
|
|
|
+ //int seq=i+1;
|
|
|
|
+ y=++y;
|
|
String procedureName = item.get(1);
|
|
String procedureName = item.get(1);
|
|
- String procedureContent = item.get(2);
|
|
|
|
|
|
+ String procedureContent = item.get(3);
|
|
String procedureCode = convertToPinyin(procedureName);
|
|
String procedureCode = convertToPinyin(procedureName);
|
|
Map<String, Object> one = jdbcService.findOne("select * from a_procedure where procedure_code=? and procedure_name=? and procedure_content=?", procedureCode, procedureName, procedureContent);
|
|
Map<String, Object> one = jdbcService.findOne("select * from a_procedure where procedure_code=? and procedure_name=? and procedure_content=?", procedureCode, procedureName, procedureContent);
|
|
Long procedureId=null;
|
|
Long procedureId=null;
|
|
@@ -293,14 +297,17 @@ public class DevicMaintainServiceImpl implements DevicMaintainService {
|
|
}else{
|
|
}else{
|
|
procedureId = jdbcService.insert("insert", "INSERT INTO a_procedure (`procedure_code`, `procedure_name`, `procedure_content`) VALUES (?,?,?);", procedureCode, procedureName, procedureContent);
|
|
procedureId = jdbcService.insert("insert", "INSERT INTO a_procedure (`procedure_code`, `procedure_name`, `procedure_content`) VALUES (?,?,?);", procedureCode, procedureName, procedureContent);
|
|
}
|
|
}
|
|
- jdbcService.insert("insert",insertProcessProcedure,processVersionId,procedureId,0,null,null,seq);
|
|
|
|
- if(containsTargetString && i != item.size()-1){
|
|
|
|
- jdbcService.insert("insert",insertProcessProcedure,processVersionId,15,1,null,1,seq+1);
|
|
|
|
|
|
+ jdbcService.insert("insert",insertProcessProcedure,processVersionId,procedureId,0,null,null,y);
|
|
|
|
+ if(containsTargetString && i != procedureList.size()-1){
|
|
|
|
+ //过程检
|
|
|
|
+ y=++y;
|
|
|
|
+ jdbcService.insert("insert",insertProcessProcedure,processVersionId,15,1,null,1,y);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(wgSeq > 0 ){
|
|
|
|
- jdbcService.insert("insert",insertProcessProcedure,processVersionId,14,2,null,2,wgSeq+1);
|
|
|
|
|
|
+ if(y > 0 ){
|
|
|
|
+ //完工检检
|
|
|
|
+ jdbcService.insert("insert",insertProcessProcedure,processVersionId,14,2,null,2,++y);
|
|
}
|
|
}
|
|
|
|
|
|
Map<String, Object> one = jdbcService.findOne("select value from dic_item where parent_id = (select id from dic where dic_code='autoGeneration') and label = '销售订单'");
|
|
Map<String, Object> one = jdbcService.findOne("select value from dic_item where parent_id = (select id from dic where dic_code='autoGeneration') and label = '销售订单'");
|
|
@@ -309,12 +316,29 @@ public class DevicMaintainServiceImpl implements DevicMaintainService {
|
|
if(value){
|
|
if(value){
|
|
//销售订单
|
|
//销售订单
|
|
Long salesOrderId = jdbcService.insert("insert", "INSERT INTO b_sales_order (order_code, order_name, deliver_date, apply_status, is_issue, created_at, status) VALUES (?,?,?,?,?,?,?);"
|
|
Long salesOrderId = jdbcService.insert("insert", "INSERT INTO b_sales_order (order_code, order_name, deliver_date, apply_status, is_issue, created_at, status) VALUES (?,?,?,?,?,?,?);"
|
|
- , generateSerial.generateSerialNumber("bSalesOrder"), xsCode + "_" + result, new Date(), 0, 0, new Date(), 0);
|
|
|
|
|
|
+ , generateSerial.generateSerialNumber("bSalesOrder"), xsCode + "_" + result, new Date(), 1, 0, new Date(), 0);
|
|
jdbcService.insert("insert","INSERT INTO a_sales_product (parent_id, product_id, sales_amount, seq) VALUES (?,?,?,?);",salesOrderId,productId,num,1);
|
|
jdbcService.insert("insert","INSERT INTO a_sales_product (parent_id, product_id, sales_amount, seq) VALUES (?,?,?,?);",salesOrderId,productId,num,1);
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ businessService.salesProductionOrder(salesOrderId);
|
|
|
|
+ Map<String, Object> one1 = jdbcService.findOne("select id from a_production_order where sales_order_id=?", salesOrderId);
|
|
|
|
+ Long productionOrderId = Long.valueOf(one1.get("id").toString());
|
|
|
|
+ //设计分发id
|
|
|
|
+ Long productionPreparationTaskId = businessService.productionOrder(productionOrderId);
|
|
|
|
+ businessService.productionPreparationTask(productionPreparationTaskId);
|
|
|
|
+ //设计准备
|
|
|
|
+ jdbcService.update("update a_production_design_preparation_task set status=1 where production_preparation_task_id=?",productionPreparationTaskId);
|
|
|
|
+
|
|
|
|
+ //生产计划
|
|
|
|
+ jdbcService.update("update a_production_order set start_time=now(),end_time=now(),is_plan=1 where id=?",productionOrderId);
|
|
|
|
+ //生产排产
|
|
|
|
+ businessService.orderToProcedure(productionOrderId);
|
|
|
|
+ //生产任务下达
|
|
|
|
+ jdbcService.update("update a_production_work_order set apply_status=1 where production_order_id=?",productionOrderId);
|
|
|
|
+ }
|
|
|
|
+ fis.close();
|
|
document.close();
|
|
document.close();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
|
+ log.error("上传工艺规格报错:{}",e);
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|