Commit a9ab27ad authored by 鲁鑫's avatar 鲁鑫

工艺管理修改

parent 4f6a894a
...@@ -4,6 +4,7 @@ $(document).ready(function() { ...@@ -4,6 +4,7 @@ $(document).ready(function() {
initializateUI(); initializateUI();
loadResourceGrid(); loadResourceGrid();
loadProcessMaterialGrid(); loadProcessMaterialGrid();
bindEvent();
}); });
...@@ -17,7 +18,7 @@ function loadResourceGrid() { ...@@ -17,7 +18,7 @@ function loadResourceGrid() {
UICtrl.addGridRow(resourceGridManager); UICtrl.addGridRow(resourceGridManager);
}, },
deleteHandler: function (){ deleteHandler: function (){
var _grid = UICtrl.getGridManager('#rsourceGrid'); var _grid = UICtrl.getGridManager('#resourceGrid');
DataUtil.delSelectedRows({ DataUtil.delSelectedRows({
action: 'processResource/deleteProcessResource.ajax', action: 'processResource/deleteProcessResource.ajax',
param: {}, param: {},
...@@ -29,7 +30,7 @@ function loadResourceGrid() { ...@@ -29,7 +30,7 @@ function loadResourceGrid() {
}); });
}, },
}); });
resourceGridManager = UICtrl.grid("#rsourceGrid", { resourceGridManager = UICtrl.grid("#resourceGrid", {
columns: [ columns: [
{ display: "资源名称", name: "resourceName", width: 200, minWidth: 60, type: "string", align: "left", { display: "资源名称", name: "resourceName", width: 200, minWidth: 60, type: "string", align: "left",
editor: { editor: {
...@@ -54,7 +55,7 @@ function loadResourceGrid() { ...@@ -54,7 +55,7 @@ function loadResourceGrid() {
toolbar: toolbarOptions, toolbar: toolbarOptions,
enabledEdit: true, enabledEdit: true,
width: "100%", width: "100%",
height: "100%", height: "300",
heightDiff: -8, heightDiff: -8,
checkbox: true, checkbox: true,
fixedCellHeight: true, fixedCellHeight: true,
...@@ -122,7 +123,7 @@ function loadProcessMaterialGrid() { ...@@ -122,7 +123,7 @@ function loadProcessMaterialGrid() {
toolbar: toolbarOptions, toolbar: toolbarOptions,
enabledEdit: true, enabledEdit: true,
width: "100%", width: "100%",
height: "100%", height: "300",
heightDiff: -8, heightDiff: -8,
checkbox: true, checkbox: true,
fixedCellHeight: true, fixedCellHeight: true,
...@@ -137,4 +138,64 @@ function reloadProcessMaterialGrid() { ...@@ -137,4 +138,64 @@ function reloadProcessMaterialGrid() {
processMaterialGridManager.loadData(); processMaterialGridManager.loadData();
} }
function bindEvent() {
$("#save").click(function () {
saveData("save");
})
$("#submit").click(function () {
saveData("submit");
})
$("#close").click(function () {//关闭
closeDispatchTabItem();
})
}
function getProcessDetail(processAction) {
//采购订单保存时数据不进行必填验证,提交时数据才进行必填验证
var op = {};
var check = true;
var resourceList = [];
var processMaterialList = [];
if (processAction == "save") {
check = false;
}
op = {check: check};
var process = $('#submitForm').formToJSON(op);
if (!process) {
return false;
}
resourceList = DataUtil.getGridData({gridManager: resourceGridManager, isAllData: true, onCheck: check})
if (!resourceList) {
return false;
}
process.resourceList = $.toJSON(resourceList);
processMaterialList = DataUtil.getGridData({gridManager: processMaterialGridManager, isAllData: true, onCheck: check})
if (!processMaterialList) {
return false;
}
process.processMaterialList = $.toJSON(processMaterialList);
return process;
}
function saveData(action) {
var processDetail = getProcessDetail("submit");
if (!processDetail) {
return;
}
Public.ajax(web_app.name + '/process/saveProcess.ajax?code=' + action,processDetail,
function (data) {
setId(data.processId);
Public.successTip("数据保存成功");
processGridManager.setParm('processId', data.processId);
processGridManager.loadData();
}
);
}
function closeDispatchTabItem() {
UICtrl.closeCurrentTab();
}
<%@ page language="java" contentType="text/html; charset=utf-8"%> <%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x"%> <%@taglib uri="/WEB-INF/taglib.tld" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head> <head>
<x:base include="layout,dialog,grid,tree,combox,commonTree"/>
<x:script src='/biz/topsun/technology/processDetail.js'/>
</head> </head>
<form class="hg-form" method="post" action="" id="submitForm"> <body>
<x:hidden name="processId" /> <x:billTitle title="工序详情" needStatus="false" needPerson="true"/>
<div class="blank_div clearfix"></div>
<button class="btn btn-default" type="button" id="close" style="left: 200px;float:right;bottom: 10px;">关闭</button>
<button class="btn btn-warning" type="button" id="submit" style="left: 200px;float:right;bottom: 10px;">提交</button>
<button class="btn btn-success" type="button" id="save" style="left: 200px;float:right;bottom: 10px;">保存</button>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="processId"/>
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="processName" required="true" label="工序名称" labelCol="2" maxLength="64" fieldCol="4" /> <x:inputC name="processName" required="true" label="工序名称" labelCol="2" maxLength="64" fieldCol="4"/>
<x:selectC name="processType" required="true" label="工序类别" labelCol="2" dictionary="processType" fieldCol="4" /> <x:selectC name="processType" required="true" label="工序类别" labelCol="2" dictionary="processType" fieldCol="4"/>
<x:inputC name="processContent" required="true" label="工序内容" labelCol="2" maxLength="64" fieldCol="4" /> <x:inputC name="processContent" required="true" label="工序内容" labelCol="2" maxLength="64" fieldCol="4"/>
<x:inputC name="workHours" required="true" label="工时" labelCol="2" mask="nnnn.nn" dataOptions="min:0" maxLength="32" fieldCol="4" /> <x:inputC name="workHours" required="true" label="工时" labelCol="2" mask="nnnn.nn" dataOptions="min:0" maxLength="32" fieldCol="4"/>
<x:inputC name="processRemark" required="false" label="工序说明" labelCol="2" maxLength="32" fieldCol="10" /> <x:inputC name="processRemark" required="false" label="工序说明" labelCol="2" maxLength="32" fieldCol="10"/>
</div> </div>
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
</form> <x:title title="工序资源" name="group" hideTable="#info"/>
\ No newline at end of file <div id="resourceGrid" style="margin: 2px;"></div>
<div class="blank_div clearfix"></div>
<x:title title="工序物料" name="group" hideTable="#info"/>
<div id="processMaterialGrid" style="margin: 2px;"></div>
</form>
</body>
</html>
...@@ -60,7 +60,7 @@ function resetForm(obj) { ...@@ -60,7 +60,7 @@ function resetForm(obj) {
} }
function addHandler(){ function addHandler(){
UICtrl.showAjaxDialog({ /*UICtrl.showAjaxDialog({
url: web_app.name + '/process/addProcessDetail.load', url: web_app.name + '/process/addProcessDetail.load',
title: "新增工艺设置", title: "新增工艺设置",
width: 800, width: 800,
...@@ -73,7 +73,12 @@ function addHandler(){ ...@@ -73,7 +73,12 @@ function addHandler(){
} }
}); });
} }
}); });*/
UICtrl.addTabItem({
tabid: 'processDetail',
text: "新增工序",
url: web_app.name + '/process/addProcessDetail.do'
})
} }
function updateHandler(row){ function updateHandler(row){
...@@ -83,7 +88,7 @@ function updateHandler(row){ ...@@ -83,7 +88,7 @@ function updateHandler(row){
return; return;
} }
} }
UICtrl.showAjaxDialog({ /*UICtrl.showAjaxDialog({
url: web_app.name + '/process/showProcessDetail.load', url: web_app.name + '/process/showProcessDetail.load',
title: "修改工艺设置", title: "修改工艺设置",
width: 800, width: 800,
...@@ -97,7 +102,12 @@ function updateHandler(row){ ...@@ -97,7 +102,12 @@ function updateHandler(row){
} }
}); });
} }
}); });*/
UICtrl.addTabItem({
tabid: 'processDetail'+row.processId,
text: "修改工序",
url: web_app.name + '/process/addProcessDetail.do?processId='+row.processId
})
} }
//删除按钮 //删除按钮
......
...@@ -8,7 +8,7 @@ $(document).ready(function () { ...@@ -8,7 +8,7 @@ $(document).ready(function () {
function loadProcessListGrid() { function loadProcessListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({ var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function () { addHandler: function () {
UICtrl.addGridRow(processGridManager); UICtrl.addGridRow(processGridManager,{ sequence: processGridManager.getData().length + 1 });
}, },
deleteHandler: function () { deleteHandler: function () {
var _grid = UICtrl.getGridManager('#processListGrid'); var _grid = UICtrl.getGridManager('#processListGrid');
...@@ -25,6 +25,9 @@ function loadProcessListGrid() { ...@@ -25,6 +25,9 @@ function loadProcessListGrid() {
}); });
processGridManager = UICtrl.grid("#processListGrid", { processGridManager = UICtrl.grid("#processListGrid", {
columns: [ columns: [
{display: "序号", name: "sortNum", width: 80, minWidth: 60, type: "string", align: "left",
editor: { type: 'spinner', min: 1, max: 100, mask: 'nnn'}
},
{ {
display: "工序名称", name: "processName", width: 120, minWidth: 60, type: "string", align: "left", display: "工序名称", name: "processName", width: 120, minWidth: 60, type: "string", align: "left",
editor: { editor: {
...@@ -80,56 +83,6 @@ function loadProcessListGrid() { ...@@ -80,56 +83,6 @@ function loadProcessListGrid() {
type: 'text' type: 'text'
}*/ }*/
}, },
{
display: '资源', name: "resourceName", width: 180, align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "resourceNameGroup",
getParam: function (item) {
return {paramValue: item.processType}
},
back: {
gxmc: "resourceName",
id: "resourceId"
}
},
}
},
{display: "版本", name: "version", width: 200, minWidth: 60, type: "string", align: "left"},
{
display: "工序物料", name: "materialName", width: 180, minWidth: 60, type: "string", align: "left",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "sapMaterialSelect",
back: {
materialId: "materialId",
materialName: "materialName",
materialUnit: "materialUnit",
materialJson: "materialJson",
}
},
}
},
{display: "物料计量单位", name: "materialUnit", width: 100, minWidth: 60, type: "string", align: "left"},
{
display: "使用物料数量",
name: "materialNumber",
width: 100,
minWidth: 60,
type: "string",
align: "left",
editor: {
type: 'text',
mask: 'positiveMoney',
required: true
}
},
{display: "物料相关内容", name: "materialJson", width: 400, minWidth: 60, type: "string", align: "left"},
], ],
dataAction: "server", dataAction: "server",
url: web_app.name + '/technologyProcess/slicedTechnologyProcessList.ajax', url: web_app.name + '/technologyProcess/slicedTechnologyProcessList.ajax',
......
...@@ -122,7 +122,7 @@ public class ProofingTechnologyRelevancyController extends CommonController { ...@@ -122,7 +122,7 @@ public class ProofingTechnologyRelevancyController extends CommonController {
processMaterialItem.setMaterialId("测试id"+i); processMaterialItem.setMaterialId("测试id"+i);
processMaterialItem.setMaterialName("测试name"+i); processMaterialItem.setMaterialName("测试name"+i);
processMaterialItem.setMaterialNumber(Double.valueOf(i)); processMaterialItem.setMaterialNumber(Double.valueOf(i));
processMaterialItem.setTechnologyProcessId("process_id"+i); processMaterialItem.setProcessId("process_id"+i);
processMaterialItem.setMaterialJson("测试material"+i); processMaterialItem.setMaterialJson("测试material"+i);
processMaterialItem.setMaterialUnit("测试Unit"+i); processMaterialItem.setMaterialUnit("测试Unit"+i);
list.add(processMaterialItem); list.add(processMaterialItem);
......
package com.huigou.topsun.technology.application; package com.huigou.topsun.technology.application;
import com.huigou.topsun.technology.domain.model.ProcessMaterialItem;
import com.huigou.topsun.technology.domain.model.ProcessResource;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest; import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.topsun.technology.vo.ProcessVo; import com.huigou.topsun.technology.vo.ProcessVo;
...@@ -26,4 +28,5 @@ public interface ProcessApplication { ...@@ -26,4 +28,5 @@ public interface ProcessApplication {
void deleteProcessByProcessIds(List<String> ids); void deleteProcessByProcessIds(List<String> ids);
ProcessVo saveProcessAndResourceAndMaterial(ProcessVo processVo, List<ProcessResource> resourceList, List<ProcessMaterialItem> processMaterialList);
} }
...@@ -3,6 +3,8 @@ package com.huigou.topsun.technology.application; ...@@ -3,6 +3,8 @@ package com.huigou.topsun.technology.application;
import com.huigou.topsun.technology.domain.model.ProcessMaterialItem; import com.huigou.topsun.technology.domain.model.ProcessMaterialItem;
import java.util.List;
/** /**
* @author 16508 * @author 16508
* @description 针对表【process_material_item(工序物料关系表)】的数据库操作Service * @description 针对表【process_material_item(工序物料关系表)】的数据库操作Service
...@@ -14,4 +16,6 @@ public interface ProcessMaterialItemApplication { ...@@ -14,4 +16,6 @@ public interface ProcessMaterialItemApplication {
void deleteByTechnologyProcessId(String technologyProcessId); void deleteByTechnologyProcessId(String technologyProcessId);
void saveProcessMaterialItem(String processId, List<ProcessMaterialItem> processMaterialList);
} }
...@@ -16,4 +16,6 @@ public interface ProcessResourceApplication { ...@@ -16,4 +16,6 @@ public interface ProcessResourceApplication {
void deleteByTechnologyProcessId(String technologyProcessId); void deleteByTechnologyProcessId(String technologyProcessId);
void saveProcessResource(String processId, List<ProcessResource> resourceList);
} }
...@@ -24,4 +24,6 @@ public interface TechnologyProcessApplication { ...@@ -24,4 +24,6 @@ public interface TechnologyProcessApplication {
List<TechnologyProcess> findByTechnologyId(String technologyId); List<TechnologyProcess> findByTechnologyId(String technologyId);
void deleteByTechnologyProcessIds(List<String> technologyProcessIds); void deleteByTechnologyProcessIds(List<String> technologyProcessIds);
String saveTechnologyProcess(String processId);
} }
...@@ -4,7 +4,11 @@ import com.huigou.cache.DictUtil; ...@@ -4,7 +4,11 @@ import com.huigou.cache.DictUtil;
import com.huigou.data.query.model.QueryDescriptor; import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel; import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.technology.application.ProcessApplication; import com.huigou.topsun.technology.application.ProcessApplication;
import com.huigou.topsun.technology.application.ProcessMaterialItemApplication;
import com.huigou.topsun.technology.application.ProcessResourceApplication;
import com.huigou.topsun.technology.domain.model.Process; import com.huigou.topsun.technology.domain.model.Process;
import com.huigou.topsun.technology.domain.model.ProcessMaterialItem;
import com.huigou.topsun.technology.domain.model.ProcessResource;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest; import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.topsun.technology.repository.ProcessRepository; import com.huigou.topsun.technology.repository.ProcessRepository;
import com.huigou.topsun.technology.vo.ProcessVo; import com.huigou.topsun.technology.vo.ProcessVo;
...@@ -24,6 +28,10 @@ import java.util.Map; ...@@ -24,6 +28,10 @@ import java.util.Map;
public class ProcessApplicationImpl extends BaseApplication implements ProcessApplication { public class ProcessApplicationImpl extends BaseApplication implements ProcessApplication {
@Resource @Resource
private ProcessRepository processRepository; private ProcessRepository processRepository;
@Resource
private ProcessResourceApplication processResourceApplication;
@Resource
private ProcessMaterialItemApplication processMaterialItemApplication;
@Override @Override
public ProcessVo saveProcess(ProcessVo processVo) { public ProcessVo saveProcess(ProcessVo processVo) {
...@@ -57,6 +65,14 @@ public class ProcessApplicationImpl extends BaseApplication implements ProcessAp ...@@ -57,6 +65,14 @@ public class ProcessApplicationImpl extends BaseApplication implements ProcessAp
ids.forEach(this::deleteProcessByProcessId); ids.forEach(this::deleteProcessByProcessId);
} }
@Override
public ProcessVo saveProcessAndResourceAndMaterial(ProcessVo processVo, List<ProcessResource> resourceList, List<ProcessMaterialItem> processMaterialList) {
processVo = this.saveProcess(processVo);
processResourceApplication.saveProcessResource(processVo.getProcessId(),resourceList);
processMaterialItemApplication.saveProcessMaterialItem(processVo.getProcessId(),processMaterialList);
return processVo;
}
} }
......
...@@ -9,10 +9,10 @@ import javax.annotation.Resource; ...@@ -9,10 +9,10 @@ import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
* @author 16508 * @author 16508
* @description 针对表【process_material_item(工序物料关系表)】的数据库操作Service实现 * @description 针对表【process_material_item(工序物料关系表)】的数据库操作Service实现
* @createDate 2023-11-22 11:04:03 * @createDate 2023-11-22 11:04:03
*/ */
@Service @Service
public class ProcessMaterialItemApplicationImpl implements ProcessMaterialItemApplication { public class ProcessMaterialItemApplicationImpl implements ProcessMaterialItemApplication {
@Resource @Resource
...@@ -25,9 +25,18 @@ public class ProcessMaterialItemApplicationImpl implements ProcessMaterialItemAp ...@@ -25,9 +25,18 @@ public class ProcessMaterialItemApplicationImpl implements ProcessMaterialItemAp
@Override @Override
public void deleteByTechnologyProcessId(String technologyProcessId) { public void deleteByTechnologyProcessId(String technologyProcessId) {
List<ProcessMaterialItem> materialItemList = processMaterialItemRepository.findByTechnologyProcessId(technologyProcessId); List<ProcessMaterialItem> materialItemList = processMaterialItemRepository.findByProcessId(technologyProcessId);
processMaterialItemRepository.delete(materialItemList); processMaterialItemRepository.delete(materialItemList);
} }
@Override
public void saveProcessMaterialItem(String processId, List<ProcessMaterialItem> processMaterialList) {
processMaterialList
.forEach(processMaterialItem -> {
processMaterialItem.setProcessId(processId);
processMaterialItemRepository.save(processMaterialItem);
});
}
} }
......
...@@ -25,9 +25,18 @@ public class ProcessResourceApplicationImpl implements ProcessResourceApplicatio ...@@ -25,9 +25,18 @@ public class ProcessResourceApplicationImpl implements ProcessResourceApplicatio
@Override @Override
public void deleteByTechnologyProcessId(String technologyProcessId) { public void deleteByTechnologyProcessId(String technologyProcessId) {
List<ProcessResource> processResourceList = processResourceRepository.findByTechnologyProcessId(technologyProcessId); List<ProcessResource> processResourceList = processResourceRepository.findByProcessId(technologyProcessId);
processResourceRepository.delete(processResourceList); processResourceRepository.delete(processResourceList);
} }
@Override
public void saveProcessResource(String processId, List<ProcessResource> resourceList) {
resourceList
.forEach(processResource -> {
processResource.setProcessId(processId);
processResourceRepository.save(processResource);
});
}
} }
......
...@@ -24,10 +24,6 @@ import java.util.*; ...@@ -24,10 +24,6 @@ import java.util.*;
public class TechnologyProcessApplicationImpl extends BaseApplication implements TechnologyProcessApplication { public class TechnologyProcessApplicationImpl extends BaseApplication implements TechnologyProcessApplication {
@Resource @Resource
private TechnologyProcessRepository technologyProcessRepository; private TechnologyProcessRepository technologyProcessRepository;
@Resource
private ProcessResourceApplication processResourceApplication;
@Resource
private ProcessMaterialItemApplication processMaterialItemApplication;
@Override @Override
public List<Map<String, Object>> slicedTechnologyProcessList(String technologyId) { public List<Map<String, Object>> slicedTechnologyProcessList(String technologyId) {
...@@ -39,28 +35,12 @@ public class TechnologyProcessApplicationImpl extends BaseApplication implements ...@@ -39,28 +35,12 @@ public class TechnologyProcessApplicationImpl extends BaseApplication implements
@Override @Override
public void saveTechnologyProcessVoList(String technologyId, List<TechnologyProcessVo> technologyProcessList) { public void saveTechnologyProcessVoList(String technologyId, List<TechnologyProcessVo> technologyProcessList) {
technologyProcessList.forEach(technologyProcessVo -> { technologyProcessList.forEach(technologyProcessVo -> {
//保存工艺工序关系 //保存工艺工序关系
TechnologyProcess technologyProcess = new TechnologyProcess(); TechnologyProcess technologyProcess = new TechnologyProcess();
technologyProcess.setTechnologyId(technologyId); technologyProcess.setTechnologyId(technologyId);
technologyProcess.setProcessId(technologyProcessVo.getProcessId()); technologyProcess.setProcessId(technologyProcessVo.getProcessId());
technologyProcess.setSortNum(technologyProcessVo.getSortNum());
technologyProcessRepository.saveAndFlush(technologyProcess); technologyProcessRepository.saveAndFlush(technologyProcess);
//保存工序资源
ProcessResource processResource = new ProcessResource();
processResource.setTechnologyProcessId(technologyProcess.getTechnologyProcessId());
processResource.setResourceId(technologyProcessVo.getResourceId());
processResourceApplication.saveProcessResource(processResource);
//保存工序物料
ProcessMaterialItem processMaterialItem = new ProcessMaterialItem();
processMaterialItem.setTechnologyProcessId(technologyProcess.getTechnologyProcessId());
processMaterialItem.setMaterialId(technologyProcessVo.getMaterialId());
processMaterialItem.setMaterialName(technologyProcessVo.getMaterialName());
processMaterialItem.setMaterialNumber(technologyProcessVo.getMaterialNumber());
processMaterialItem.setMaterialUnit(technologyProcessVo.getMaterialUnit());
processMaterialItem.setMaterialJson(technologyProcessVo.getMaterialJson());
processMaterialItemApplication.saveProcessMaterialItem(processMaterialItem);
}); });
} }
...@@ -84,14 +64,15 @@ public class TechnologyProcessApplicationImpl extends BaseApplication implements ...@@ -84,14 +64,15 @@ public class TechnologyProcessApplicationImpl extends BaseApplication implements
this.deleteTechnologyProcessIds(technologyProcessList); this.deleteTechnologyProcessIds(technologyProcessList);
} }
public void deleteTechnologyProcessIds(List<TechnologyProcess> technologyProcessList){ @Override
technologyProcessList.forEach(technologyProcess -> { public String saveTechnologyProcess(String processId) {
//删除工序资源 TechnologyProcess technologyProcess = new TechnologyProcess();
processResourceApplication.deleteByTechnologyProcessId(technologyProcess.getTechnologyProcessId()); technologyProcess.setProcessId(processId);
technologyProcessRepository.save(technologyProcess);
return technologyProcess.getTechnologyProcessId();
}
//删除工序物料 public void deleteTechnologyProcessIds(List<TechnologyProcess> technologyProcessList){
processMaterialItemApplication.deleteByTechnologyProcessId(technologyProcess.getTechnologyProcessId());
});
//删除工艺工序关系表 //删除工艺工序关系表
technologyProcessRepository.delete(technologyProcessList); technologyProcessRepository.delete(technologyProcessList);
} }
......
...@@ -2,9 +2,10 @@ package com.huigou.topsun.technology.controller; ...@@ -2,9 +2,10 @@ package com.huigou.topsun.technology.controller;
import com.huigou.cache.DictUtil; import com.huigou.cache.DictUtil;
import com.huigou.topsun.technology.application.ProcessApplication; import com.huigou.topsun.technology.application.ProcessApplication;
import com.huigou.topsun.technology.domain.model.ProcessMaterialItem;
import com.huigou.topsun.technology.domain.model.ProcessResource;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest; import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.topsun.technology.vo.ProcessVo; import com.huigou.topsun.technology.vo.ProcessVo;
import com.huigou.topsun.technology.vo.TechnologyVo;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController; import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO; import com.huigou.util.SDO;
...@@ -56,7 +57,9 @@ public class ProcessController extends CommonController { ...@@ -56,7 +57,9 @@ public class ProcessController extends CommonController {
public String saveProcess(){ public String saveProcess(){
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
ProcessVo processVo = sdo.toObject(ProcessVo.class); ProcessVo processVo = sdo.toObject(ProcessVo.class);
processVo = processApplication.saveProcess(processVo); List<ProcessResource> resourceList = sdo.getList("resourceList", ProcessResource.class);
List<ProcessMaterialItem> processMaterialList = sdo.getList("processMaterialList", ProcessMaterialItem.class);
processVo = processApplication.saveProcessAndResourceAndMaterial(processVo,resourceList,processMaterialList);
return success(processVo); return success(processVo);
} }
......
package com.huigou.topsun.technology.controller; package com.huigou.topsun.technology.controller;
import com.huigou.cache.DictUtil; import com.huigou.cache.DictUtil;
import com.huigou.cache.SystemCache;
import com.huigou.topsun.sap.common.HttpClient;
import com.huigou.topsun.technology.application.TechnologyApplication; import com.huigou.topsun.technology.application.TechnologyApplication;
import com.huigou.topsun.technology.application.TechnologyProcessApplication; import com.huigou.topsun.technology.application.TechnologyProcessApplication;
import com.huigou.topsun.technology.domain.query.TechnologyQueryRequest; import com.huigou.topsun.technology.domain.query.TechnologyQueryRequest;
...@@ -14,7 +16,7 @@ import org.springframework.stereotype.Controller; ...@@ -14,7 +16,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -32,6 +34,8 @@ public class TechnologyController extends CommonController { ...@@ -32,6 +34,8 @@ public class TechnologyController extends CommonController {
private TechnologyApplication technologyApplication; private TechnologyApplication technologyApplication;
@Resource @Resource
private TechnologyProcessApplication technologyProcessApplication; private TechnologyProcessApplication technologyProcessApplication;
@Resource
private HttpClient httpClient;
protected String getPagePath() { protected String getPagePath() {
return "/biz/topsun/technology/"; return "/biz/topsun/technology/";
...@@ -136,4 +140,10 @@ public class TechnologyController extends CommonController { ...@@ -136,4 +140,10 @@ public class TechnologyController extends CommonController {
TechnologyVo technologyVo = technologyApplication.findTechnologyByTechnologyIdId(technologyId); TechnologyVo technologyVo = technologyApplication.findTechnologyByTechnologyIdId(technologyId);
return forward("technologyDetail",technologyVo); return forward("technologyDetail",technologyVo);
} }
public String testSap() throws IOException {
Map<String,Object> map = new HashMap<>();
String execute = httpClient.execute(map, SystemCache.getParameter("sap.service.material.url",String.class));
return success();
}
} }
...@@ -26,8 +26,8 @@ public class ProcessMaterialItem implements Serializable { ...@@ -26,8 +26,8 @@ public class ProcessMaterialItem implements Serializable {
/** /**
* 工艺ID * 工艺ID
*/ */
@Column(name = "technology_process_id") @Column(name = "process_id")
private String technologyProcessId; private String processId;
/** /**
* 物料ID * 物料ID
...@@ -74,7 +74,7 @@ public class ProcessMaterialItem implements Serializable { ...@@ -74,7 +74,7 @@ public class ProcessMaterialItem implements Serializable {
} }
ProcessMaterialItem other = (ProcessMaterialItem) that; ProcessMaterialItem other = (ProcessMaterialItem) that;
return (this.getProcessMaterialItemId() == null ? other.getProcessMaterialItemId() == null : this.getProcessMaterialItemId().equals(other.getProcessMaterialItemId())) return (this.getProcessMaterialItemId() == null ? other.getProcessMaterialItemId() == null : this.getProcessMaterialItemId().equals(other.getProcessMaterialItemId()))
&& (this.getTechnologyProcessId() == null ? other.getTechnologyProcessId() == null : this.getTechnologyProcessId().equals(other.getTechnologyProcessId())) && (this.getProcessId() == null ? other.getProcessId() == null : this.getProcessId().equals(other.getProcessId()))
&& (this.getMaterialId() == null ? other.getMaterialId() == null : this.getMaterialId().equals(other.getMaterialId())) && (this.getMaterialId() == null ? other.getMaterialId() == null : this.getMaterialId().equals(other.getMaterialId()))
&& (this.getMaterialNumber() == null ? other.getMaterialNumber() == null : this.getMaterialNumber().equals(other.getMaterialNumber())) && (this.getMaterialNumber() == null ? other.getMaterialNumber() == null : this.getMaterialNumber().equals(other.getMaterialNumber()))
&& (this.getMaterialUnit() == null ? other.getMaterialUnit() == null : this.getMaterialUnit().equals(other.getMaterialUnit())) && (this.getMaterialUnit() == null ? other.getMaterialUnit() == null : this.getMaterialUnit().equals(other.getMaterialUnit()))
...@@ -86,7 +86,7 @@ public class ProcessMaterialItem implements Serializable { ...@@ -86,7 +86,7 @@ public class ProcessMaterialItem implements Serializable {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((getProcessMaterialItemId() == null) ? 0 : getProcessMaterialItemId().hashCode()); result = prime * result + ((getProcessMaterialItemId() == null) ? 0 : getProcessMaterialItemId().hashCode());
result = prime * result + ((getTechnologyProcessId() == null) ? 0 : getTechnologyProcessId().hashCode()); result = prime * result + ((getProcessId() == null) ? 0 : getProcessId().hashCode());
result = prime * result + ((getMaterialId() == null) ? 0 : getMaterialId().hashCode()); result = prime * result + ((getMaterialId() == null) ? 0 : getMaterialId().hashCode());
result = prime * result + ((getMaterialNumber() == null) ? 0 : getMaterialNumber().hashCode()); result = prime * result + ((getMaterialNumber() == null) ? 0 : getMaterialNumber().hashCode());
result = prime * result + ((getMaterialUnit() == null) ? 0 : getMaterialUnit().hashCode()); result = prime * result + ((getMaterialUnit() == null) ? 0 : getMaterialUnit().hashCode());
...@@ -101,7 +101,7 @@ public class ProcessMaterialItem implements Serializable { ...@@ -101,7 +101,7 @@ public class ProcessMaterialItem implements Serializable {
sb.append(" ["); sb.append(" [");
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", processMaterialItemId=").append(processMaterialItemId); sb.append(", processMaterialItemId=").append(processMaterialItemId);
sb.append(", technologyProcessId=").append(technologyProcessId); sb.append(", technologyProcessId=").append(processId);
sb.append(", materialId=").append(materialId); sb.append(", materialId=").append(materialId);
sb.append(", materialNumber=").append(materialNumber); sb.append(", materialNumber=").append(materialNumber);
sb.append(", materialUnit=").append(materialUnit); sb.append(", materialUnit=").append(materialUnit);
......
...@@ -26,8 +26,8 @@ public class ProcessResource implements Serializable { ...@@ -26,8 +26,8 @@ public class ProcessResource implements Serializable {
/** /**
* 所属工序ID * 所属工序ID
*/ */
@Column(name = "technology_process_id") @Column(name = "process_id")
private String technologyProcessId; private String processId;
/** /**
* 使用的资源ID * 使用的资源ID
...@@ -55,7 +55,7 @@ public class ProcessResource implements Serializable { ...@@ -55,7 +55,7 @@ public class ProcessResource implements Serializable {
} }
ProcessResource other = (ProcessResource) that; ProcessResource other = (ProcessResource) that;
return (this.getProcessResourceId() == null ? other.getProcessResourceId() == null : this.getProcessResourceId().equals(other.getProcessResourceId())) return (this.getProcessResourceId() == null ? other.getProcessResourceId() == null : this.getProcessResourceId().equals(other.getProcessResourceId()))
&& (this.getTechnologyProcessId() == null ? other.getTechnologyProcessId() == null : this.getTechnologyProcessId().equals(other.getTechnologyProcessId())) && (this.getProcessId() == null ? other.getProcessId() == null : this.getProcessId().equals(other.getProcessId()))
&& (this.getResourceId() == null ? other.getResourceId() == null : this.getResourceId().equals(other.getResourceId())) && (this.getResourceId() == null ? other.getResourceId() == null : this.getResourceId().equals(other.getResourceId()))
&& (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion())); && (this.getVersion() == null ? other.getVersion() == null : this.getVersion().equals(other.getVersion()));
} }
...@@ -65,7 +65,7 @@ public class ProcessResource implements Serializable { ...@@ -65,7 +65,7 @@ public class ProcessResource implements Serializable {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((getProcessResourceId() == null) ? 0 : getProcessResourceId().hashCode()); result = prime * result + ((getProcessResourceId() == null) ? 0 : getProcessResourceId().hashCode());
result = prime * result + ((getTechnologyProcessId() == null) ? 0 : getTechnologyProcessId().hashCode()); result = prime * result + ((getProcessId() == null) ? 0 : getProcessId().hashCode());
result = prime * result + ((getResourceId() == null) ? 0 : getResourceId().hashCode()); result = prime * result + ((getResourceId() == null) ? 0 : getResourceId().hashCode());
result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode()); result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode());
return result; return result;
...@@ -78,7 +78,7 @@ public class ProcessResource implements Serializable { ...@@ -78,7 +78,7 @@ public class ProcessResource implements Serializable {
sb.append(" ["); sb.append(" [");
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", processResourceId=").append(processResourceId); sb.append(", processResourceId=").append(processResourceId);
sb.append(", technologyProcessId=").append(technologyProcessId); sb.append(", technologyProcessId=").append(processId);
sb.append(", resourceId=").append(resourceId); sb.append(", resourceId=").append(resourceId);
sb.append(", version=").append(version); sb.append(", version=").append(version);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
......
...@@ -11,5 +11,5 @@ import java.util.List; ...@@ -11,5 +11,5 @@ import java.util.List;
* @Description: * @Description:
*/ */
public interface ProcessMaterialItemRepository extends JpaRepository<ProcessMaterialItem,String> { public interface ProcessMaterialItemRepository extends JpaRepository<ProcessMaterialItem,String> {
List<ProcessMaterialItem> findByTechnologyProcessId(String technologyProcessId); List<ProcessMaterialItem> findByProcessId(String processId);
} }
...@@ -11,5 +11,5 @@ import java.util.List; ...@@ -11,5 +11,5 @@ import java.util.List;
* @Description: * @Description:
*/ */
public interface ProcessResourceRepository extends JpaRepository<ProcessResource,String> { public interface ProcessResourceRepository extends JpaRepository<ProcessResource,String> {
List<ProcessResource> findByTechnologyProcessId(String technologyProcessId); List<ProcessResource> findByProcessId(String processId);
} }
package com.huigou.topsun.util; package com.huigou.topsun.util;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
public class CommonUtil { public class CommonUtil {
...@@ -13,4 +17,29 @@ public class CommonUtil { ...@@ -13,4 +17,29 @@ public class CommonUtil {
return uuid; return uuid;
} }
/**
* 实体类转Map
* @param obj
* @return
*/
public static HashMap<String, String> entityToMap(Object obj) {
HashMap<String, String> map = new HashMap();
for (Field field : obj.getClass().getDeclaredFields()){
try {
boolean flag = field.isAccessible();
field.setAccessible(true);
Object o = field.get(obj);
if (o != null){
Field contField = obj.getClass().getDeclaredField(field.getName());
JsonProperty voField = contField.getAnnotation(JsonProperty.class);
String s = voField.value();
map.put(s, o.toString());
}
field.setAccessible(flag);
} catch (Exception e) {
e.printStackTrace();
}
}
return map;
}
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
technology t technology t
LEFT JOIN technology_process tp ON t.technology_id = tp.technology_id LEFT JOIN technology_process tp ON t.technology_id = tp.technology_id
LEFT JOIN process p ON tp.process_id = p.process_id LEFT JOIN process p ON tp.process_id = p.process_id
LEFT JOIN process_resource pr ON pr.technology_process_id = tp.technology_process_id LEFT JOIN process_resource pr ON pr.process_id = p.process_id
where 1=1 where 1=1
</sql-query> </sql-query>
<condition column="product_id" name="productId" symbol="in" alias="t"/> <condition column="product_id" name="productId" symbol="in" alias="t"/>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
p.process_content, p.process_content,
p.process_type, p.process_type,
p.process_remark, p.process_remark,
p.work_hours, p.work_hours<!--,
pr.resource_id, pr.resource_id,
CASE WHEN p.process_type = 'pakeage' THEN CASE WHEN p.process_type = 'pakeage' THEN
( SELECT gxmc FROM res_bz t WHERE t.id = pr.resource_id ) ( SELECT gxmc FROM res_bz t WHERE t.id = pr.resource_id )
...@@ -25,12 +25,10 @@ ...@@ -25,12 +25,10 @@
mi.material_unit, mi.material_unit,
mi.material_number, mi.material_number,
mi.material_json, mi.material_json,
mi.process_material_item_id mi.process_material_item_id-->
FROM FROM
technology_process tp technology_process tp
LEFT JOIN process p ON tp.process_id = p.process_id LEFT JOIN process p ON tp.process_id = p.process_id
LEFT JOIN process_resource pr ON pr.technology_process_id = tp.technology_process_id
LEFT JOIN process_material_item mi ON tp.technology_process_id = mi.technology_process_id
WHERE tp.technology_id = ? WHERE tp.technology_id = ?
</sql-query> </sql-query>
</query> </query>
......
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