|
@@ -242,73 +242,94 @@ public class DevicMaintainServiceImpl implements DevicMaintainService {
|
|
|
//第8行 获取 工序
|
|
|
List<String> seven = list.get(7);
|
|
|
|
|
|
- //物料
|
|
|
- Long materialId = jdbcService.insert("insert", "INSERT INTO a_material ( `material_code`, `material_name`,`material_size`) VALUES (?,?,?)", materialName, materialName, three.get(2));
|
|
|
+ Map<String, Object> findMaterial = jdbcService.findOne("select * from a_material where material_code=? limit 1", materialName);
|
|
|
+ Long materialId = null;
|
|
|
+ if(findMaterial == null){
|
|
|
+ //物料
|
|
|
+ materialId = jdbcService.insert("insert", "INSERT INTO a_material ( `material_code`, `material_name`,`material_size`) VALUES (?,?,?)", materialName, materialName, three.get(2));
|
|
|
+ }else{
|
|
|
+ materialId = Long.valueOf(findMaterial.get("id").toString());
|
|
|
+ }
|
|
|
+ Map<String, Object> findMaterialStore = jdbcService.findOne("select * from a_material_store where parent_id=? limit 1", materialId);
|
|
|
|
|
|
+ if(findMaterialStore == null){
|
|
|
+ //原材料库存
|
|
|
+ jdbcService.insert("insert", "INSERT INTO a_material_store(`parent_id`, `store_amount`) VALUES (?,?);", materialId,materialStore);
|
|
|
+ }else{
|
|
|
+ jdbcService.update("update a_material_store set store_amount=store_amount + ? where parent_id=?",materialStore,materialId);
|
|
|
+ }
|
|
|
|
|
|
- //原材料库存
|
|
|
- Long materialStoreId = jdbcService.insert("insert", "INSERT INTO a_material_store(`parent_id`, `store_amount`) VALUES (?,?);", materialId,materialStore);
|
|
|
+ Map<String, Object> findProduct = jdbcService.findOne("select * from a_product where product_code=? limit 1", "xs_"+xsCode);
|
|
|
+ Long productId = null;
|
|
|
+ if(findProduct == null){
|
|
|
+ //产品管理
|
|
|
+ productId = jdbcService.insert("insert", "INSERT INTO a_product (`product_code`, `product_name`, `product_model`, `flat`) VALUES (?,?,?,?);", "xs_"+xsCode, result, productSize, "个");
|
|
|
+ //产品物料
|
|
|
+ jdbcService.insert("insert","INSERT INTO a_product_material (`parent_id`, `material_id`, `material_amount`, `seq`) VALUES (?,?,1,1);",productId,materialId);
|
|
|
+ }else{
|
|
|
+ productId=Long.valueOf(findProduct.get("id").toString());
|
|
|
+ }
|
|
|
|
|
|
- //产品管理
|
|
|
- Long productId = jdbcService.insert("insert", "INSERT INTO a_product (`product_code`, `product_name`, `product_model`, `flat`) VALUES (?,?,?,?);", "xs_"+xsCode, result, productSize, "个");
|
|
|
- //产品物料
|
|
|
- jdbcService.insert("insert","INSERT INTO a_product_material (`parent_id`, `material_id`, `material_amount`, `seq`) VALUES (?,?,1,1);",productId,materialId);
|
|
|
|
|
|
//工艺路径
|
|
|
SysFile sysFile = sysFileService.upload(convertToMultipartFile(file));
|
|
|
String path="/admin/download/"+sysFile.getId()+"/"+sysFile.getFileName();
|
|
|
|
|
|
+ Map<String, Object> findProcessVersionId = jdbcService.findOne("select * from a_process_version where parent_id=? limit 1", productId);
|
|
|
|
|
|
+ if(findProcessVersionId == null){
|
|
|
+ Long processVersionId = jdbcService.insert("insert", "INSERT INTO a_process_version(`process_version`,`create_time`, `create_by`, `parent_id`, `status`, `device_id`,contract_file,business_type) VALUES (?,?,?,?,?,'2,6,7,9,10,11,12,15,16,20,3,4,5,8,13,14,17,18,19',?,?);\n", processVersion, new Date(), getUserId(), productId, 1,path,4);
|
|
|
|
|
|
- Long processVersionId = jdbcService.insert("insert", "INSERT INTO a_process_version(`process_version`,`create_time`, `create_by`, `parent_id`, `status`, `device_id`,contract_file,business_type) VALUES (?,?,?,?,?,'2,6,7,9,10,11,12,15,16,20,3,4,5,8,13,14,17,18,19',?,?);\n", processVersion, new Date(), getUserId(), productId, 1,path,4);
|
|
|
+ String insertProcessProcedure="INSERT INTO a_process_procedure (`parent_id`, `procedure_id`, `is_outsourcing`, `work_hour`, `inspect_type`, `seq`) VALUES (?,?,?,?,?,?);";
|
|
|
|
|
|
- String insertProcessProcedure="INSERT INTO a_process_procedure (`parent_id`, `procedure_id`, `is_outsourcing`, `work_hour`, `inspect_type`, `seq`) VALUES (?,?,?,?,?,?);";
|
|
|
+ String targetString = "注意:每道工序加工后实施检验,检验合格后方可转下序";
|
|
|
|
|
|
- String targetString = "注意:每道工序加工后实施检验,检验合格后方可转下序";
|
|
|
+ // 判断列表中是否包含目标字符串
|
|
|
+ boolean containsTargetString = list.stream()
|
|
|
+ .flatMap(List::stream) // 将所有子列表合并成一个流
|
|
|
+ .anyMatch(s -> s.equals(targetString)); // 判断是否存在目标字符串
|
|
|
|
|
|
- // 判断列表中是否包含目标字符串
|
|
|
- boolean containsTargetString = list.stream()
|
|
|
- .flatMap(List::stream) // 将所有子列表合并成一个流
|
|
|
- .anyMatch(s -> s.equals(targetString)); // 判断是否存在目标字符串
|
|
|
|
|
|
-
|
|
|
- //工序 工艺路径工序
|
|
|
- List<List<String>> procedureList=new ArrayList<>();
|
|
|
- for(List<String> item:list){
|
|
|
- if (!item.isEmpty() && isNumeric(item.get(0))) {
|
|
|
- procedureList.add(item);
|
|
|
+ //工序 工艺路径工序
|
|
|
+ List<List<String>> procedureList=new ArrayList<>();
|
|
|
+ for(List<String> item:list){
|
|
|
+ if (!item.isEmpty() && isNumeric(item.get(0))) {
|
|
|
+ procedureList.add(item);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- int y=0;
|
|
|
- for(int i =0;i<procedureList.size();i++){
|
|
|
- List<String> item=procedureList.get(i);
|
|
|
- if (!item.isEmpty() && isNumeric(item.get(0))) {
|
|
|
- //int seq = Integer.parseInt(item.get(0));
|
|
|
- //int seq=i+1;
|
|
|
- y=++y;
|
|
|
- String procedureName = item.get(1);
|
|
|
- String procedureContent = item.get(3);
|
|
|
- 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);
|
|
|
- Long procedureId=null;
|
|
|
- if(one !=null){
|
|
|
- procedureId=Long.valueOf(one.get("id").toString());
|
|
|
- }else{
|
|
|
- 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,y);
|
|
|
- if(containsTargetString && i != procedureList.size()-1){
|
|
|
- //过程检
|
|
|
+ int y=0;
|
|
|
+ for(int i =0;i<procedureList.size();i++){
|
|
|
+ List<String> item=procedureList.get(i);
|
|
|
+ if (!item.isEmpty() && isNumeric(item.get(0))) {
|
|
|
+ //int seq = Integer.parseInt(item.get(0));
|
|
|
+ //int seq=i+1;
|
|
|
y=++y;
|
|
|
- jdbcService.insert("insert",insertProcessProcedure,processVersionId,15,1,null,1,y);
|
|
|
+ String procedureName = item.get(1);
|
|
|
+ String procedureContent = item.get(3);
|
|
|
+ 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);
|
|
|
+ Long procedureId=null;
|
|
|
+ if(one !=null){
|
|
|
+ procedureId=Long.valueOf(one.get("id").toString());
|
|
|
+ }else{
|
|
|
+ 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,y);
|
|
|
+ if(containsTargetString && i != procedureList.size()-1){
|
|
|
+ //过程检
|
|
|
+ y=++y;
|
|
|
+ jdbcService.insert("insert",insertProcessProcedure,processVersionId,15,1,null,1,y);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ if(y > 0 ){
|
|
|
+ //完工检检
|
|
|
+ jdbcService.insert("insert",insertProcessProcedure,processVersionId,14,2,null,2,++y);
|
|
|
+ }
|
|
|
}
|
|
|
- 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 = '销售订单'");
|
|
|
|