Commit f0d47c7d authored by 鲁鑫's avatar 鲁鑫

工艺管理优化;新增工序管理

parent c50a77d6
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<head>
</head>
<form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="processId" />
<div class="hg-form-row">
<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:inputC name="processContent" required="true" label="工序内容" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="workHours" required="true" label="工时" labelCol="2" mask="nnnn" dataOptions="min:0" maxLength="32" fieldCol="4" />
<x:inputC name="processRemark" required="false" label="工序说明" labelCol="2" maxLength="32" fieldCol="10" />
</div>
<div class="blank_div clearfix"></div>
</form>
\ No newline at end of file
var gridManager = null;
$(document).ready(function() {
initializateUI();
loadProcessListGrid();
});
function initializateUI() {
UICtrl.layout("#layout", {leftWidth: 3});
}
function loadProcessListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(){
addHandler();
},
updateHandler: function(){
updateHandler();
},
deleteHandler: deleteHandler,
});
gridManager = UICtrl.grid("#processListGrid", {
columns: [
{ display: "工序名称", name: "processName", width: 200, minWidth: 60, type: "string", align: "left" },
{ display: "工序类别", name: "processTypeTextView", width: 200, minWidth: 60, type: "string", align: "left" },
{ display: "工时", name: "workHours", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "工序内容", name: "processContent", width: 300, minWidth: 60, type: "string", align: "left" },
{ display: "工序说明", name: "processRemark", width: 300, minWidth: 60, type: "string", align: "left" },
],
dataAction: "server",
url: web_app.name + '/process/slicedProcessList.ajax',
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
width: "100%",
height: "100%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow : function(data, rowindex, rowobj) {
updateHandler(data.id);
}
});
UICtrl.setSearchAreaToggle(gridManager);
}
function query(obj) {
var param = $(obj).formToJSON();
UICtrl.gridSearch(gridManager, param);
}
function reloadGrid() {
gridManager.loadData();
}
function resetForm(obj) {
$(obj).formClean();
}
function addHandler(){
UICtrl.showAjaxDialog({
url: web_app.name + '/process/addProcessDetail.load',
title: "新增工艺设置",
width: 800,
ok: function(div){
var _self=this;
$('#submitForm',div).ajaxSubmit({url: web_app.name + '/process/saveProcess.ajax',
success : function() {
_self.close();
reloadGrid();
}
});
}
});
}
function updateHandler(){
var process = DataUtil.getUpdateRow(gridManager);
if (!process){ return; }
UICtrl.showAjaxDialog({
url: web_app.name + '/process/showProcessDetail.load',
title: "修改工艺设置",
width: 800,
param:{processId:process.processId},
ok: function(div){
var _self=this;
$('#submitForm',div).ajaxSubmit({url: web_app.name + '/process/saveProcess.ajax',
success : function() {
_self.close();
reloadGrid();
}
});
}
});
}
//删除按钮
function deleteHandler() {
DataUtil.del({
action: 'technology/deleteProcessByProcessId.ajax',
gridManager: gridManager, idFieldName: 'processId',
onSuccess: function () {
reloadGrid();
}
});
}
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<x:base include="layout,dialog,grid,tree,combox,commonTree" />
<x:script src='/biz/topsun/technology/processList.js'/>
</head>
<body>
<div class="container-fluid">
<div class="ui-hide">
<x:select name="processType" dictionary="processType" />
<x:select name="yesorno" dictionary="yesorno" />
</div>
<div id="layout">
<div position="center" title="工序管理">
<x:title title="common.button.search" hideTable="queryMainForm" isHide="true" />
<form class="hg-form ui-hide" method="post" action="" id="queryMainForm">
<x:inputC name="processName" required="false" label="工序名称" labelCol="1"/>
<x:searchButtons />
</form>
<div class="blank_div clearfix"></div>
<div id="processListGrid" style="margin: 2px;"></div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -25,33 +25,48 @@ function loadProcessListGrid(){
columns: [
{ display: "工序名称", name: "processName", width: 120, minWidth: 60, type: "string", align: "left",
editor: {
required: true,
type: 'text'
required: true, type: "select",
data: {
type: 'system',
name: "processNameGroup",
back: {
processId: "processId",
processName:"processName",
processType:"processType",
processTypeTextView:"processTypeTextView",
workHours:"workHours",
processContent:"processContent",
processRemark:"processRemark",
}
},
}
},
{ display: "工序类别", name: "processTypeTextView", width: 120, minWidth: 60, type: "string", align: "left",
editor : {
/*editor : {
type : 'combobox',
data : $("#processType").combox('getJSONData'),
required : true,
valueField : 'processType'
}},
}*/
},
{ display: "工时", name: "workHours", width: 120, minWidth: 60, type: "number", align: "left",
editor: {
/*editor: {
required: true,
type: 'text',
mask: 'positiveMoney'
}},
}*/
},
{ display: "工序内容", name: "processContent", width: 180, minWidth: 60, type: "string", align: "left",
editor: {
/*editor: {
required: true,
type: 'text'
}},
}*/
},
{ display: "工序说明", name: "processRemark", width: 180, minWidth: 60, type: "string", align: "left",
editor: {
/*editor: {
required: true,
type: 'text'
}
}*/
},
{display: '资源', name: "resourceName", width: 180, align: "left", type: "string",
editor: {
......@@ -69,6 +84,12 @@ function loadProcessListGrid(){
},
}
},
{ display: "工序物料", name: "materialName", width: 180, minWidth: 60, type: "string", align: "left",
editor: {
required: false,
type: 'text'
}
},
],
dataAction: "server",
url: web_app.name + '/technologyProcess/slicedTechnologyProcessList.ajax',
......
......@@ -11,7 +11,7 @@
<x:inputC name="technologyName" required="true" label="工艺路线名称" labelCol="2" maxLength="64" fieldCol="4" />
<x:selectC name="technologyType" required="true" label="工艺类型" labelCol="2" dictionary="technologyType" fieldCol="4" />
<x:inputC name="productName" required="true" label="产品" wrapper="select" labelCol="2" maxLength="64" fieldCol="4" />
<x:inputC name="technologyVersion" required="false" readonly="true" label="工艺版本" labelCol="2" maxLength="32" fieldCol="4" />
<x:inputC name="technologyVersion" required="false" label="工艺版本" labelCol="2" maxLength="32" fieldCol="4" />
</div>
<div class="blank_div clearfix"></div>
<x:title title="工序设置" name="group" hideTable="#info" />
......
......@@ -105,7 +105,7 @@ function updateHandler(){
function deleteHandler() {
DataUtil.del({
action: 'technology/deleteTechnologyByTechnologyId.ajax',
gridManager: gridManager, idFieldName: 'technologyProcessId',
gridManager: gridManager, idFieldName: 'technologyId',
onSuccess: function () {
reloadGrid();
}
......
package com.huigou.topsun.easySearch.controller;
import com.huigou.topsun.resource.service.ResourceFiledService;
import com.huigou.topsun.technology.application.ProcessApplication;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.easysearch.EasySearch;
import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse;
......@@ -27,7 +29,8 @@ import java.util.Map;
public class ResourceSearchController {
@Resource
private ResourceFiledService resourceFiledService;
@Resource
private ProcessApplication processApplication;
@EasySearch(queryName = "resourceNameGroup")
public Map<String, Object> queryResourceNameGroup(SDO sdo){
Integer intPage = sdo.getInteger("intPage", 1);
......@@ -49,4 +52,31 @@ public class ResourceSearchController {
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
@EasySearch(queryName = "processNameGroup")
public Map<String, Object> queryProcessNameGroup(SDO sdo){
Integer intPage = sdo.getInteger("intPage", 1);
Integer pageSize = sdo.getInteger("pageSize",10);
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
List<QuerySchemeField> fields =
Arrays.asList(new QuerySchemeField("processId", "processId", "hidden"),
new QuerySchemeField("工序名称", "processName", "string", 200L),
new QuerySchemeField("工序类型", "processType", "hidden", 100L),
new QuerySchemeField("工序类型", "processTypeTextView", "string", 100L),
new QuerySchemeField("工时", "workHours", "string", 100L),
new QuerySchemeField("工序内容", "processContent", "hidden", 100L),
new QuerySchemeField("工序说明", "processRemark", "hidden", 100L)
);
EasySearchParse easySearchParse = new EasySearchParse();
easySearchParse.setFields(fields);
easySearchParse.setWidth(450L);
String processName = sdo.getString("paramValue");
ProcessQueryRequest queryRequest = sdo.toQueryRequest(ProcessQueryRequest.class);
queryRequest.setProcessName(processName);
Map<String, Object> map = processApplication.slicedProcessList(queryRequest);
List<Map<String, Object>> mapList = (List<Map<String, Object>>)map.get("Rows");
MemEasySearcher<Map<String, Object>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
}
package com.huigou.topsun.technology.application;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.topsun.technology.vo.ProcessVo;
import java.util.List;
import java.util.Map;
/**
* @author 16508
......@@ -17,4 +19,11 @@ public interface ProcessApplication {
ProcessVo saveProcess(ProcessVo processVo);
void deleteProcessByProcessId(String processId);
Map<String,Object> slicedProcessList(ProcessQueryRequest queryRequest);
ProcessVo findProcessByProcessId(String processId);
void deleteProcessByProcessIds(List<String> ids);
}
......@@ -5,6 +5,7 @@ import com.huigou.topsun.technology.domain.model.Technology;
import com.huigou.topsun.technology.domain.query.TechnologyQueryRequest;
import com.huigou.topsun.technology.vo.TechnologyVo;
import java.util.List;
import java.util.Map;
/**
......@@ -22,7 +23,7 @@ public interface TechnologyApplication {
TechnologyVo updateTechnologyVo(TechnologyVo technologyVo);
void deleteTechnologyVo(String id);
void deleteTechnology(List<String> ids);
TechnologyVo findTechnologyByTechnologyIdId(String technologyId);
}
package com.huigou.topsun.technology.application.impl;
import com.huigou.cache.DictUtil;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.technology.application.ProcessApplication;
import com.huigou.topsun.technology.domain.model.Process;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.topsun.technology.repository.ProcessRepository;
import com.huigou.topsun.technology.vo.ProcessVo;
import com.huigou.uasp.bmp.common.application.BaseApplication;
......@@ -34,6 +38,25 @@ public class ProcessApplicationImpl extends BaseApplication implements ProcessAp
processRepository.delete(processId);
}
@Override
public Map<String, Object> slicedProcessList(ProcessQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "processList");
QueryModel model = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
model.putDictionary("processType", DictUtil.getDictionary("processType"));
return this.sqlExecutorDao.executeSlicedQuery(model);
}
@Override
public ProcessVo findProcessByProcessId(String processId) {
Process process = processRepository.findOne(processId);
return ProcessVo.getProcessVo(process);
}
@Override
public void deleteProcessByProcessIds(List<String> ids) {
ids.forEach(this::deleteProcessByProcessId);
}
}
......
......@@ -41,7 +41,7 @@ public class TechnologyApplicationImpl extends BaseApplication implements Techno
@Override
public TechnologyVo saveTechnology(TechnologyVo technologyVo) {
Technology technology = TechnologyVo.getTechnology(technologyVo);
technologyRepository.saveAndFlush(technology);
technology = technologyRepository.saveAndFlush(technology);
technologyVo.setTechnologyId(technology.getTechnologyId());
return technologyVo;
}
......@@ -52,16 +52,18 @@ public class TechnologyApplicationImpl extends BaseApplication implements Techno
}
@Override
public void deleteTechnologyVo(String id) {
List<TechnologyProcess> technologyProcessList = technologyProcessApplication.findByTechnologyId(id);
List<String> technologyProcessIds = technologyProcessList
.stream()
.map(TechnologyProcess::getTechnologyProcessId)
.collect(Collectors.toList());
//删除工艺工序关系表
technologyProcessApplication.deleteByTechnologyProcessIds(technologyProcessIds);
//删除工艺表
technologyRepository.delete(id);
public void deleteTechnology(List<String> ids) {
ids.forEach(technologyId->{
List<TechnologyProcess> technologyProcessList = technologyProcessApplication.findByTechnologyId(technologyId);
List<String> technologyProcessIds = technologyProcessList
.stream()
.map(TechnologyProcess::getTechnologyProcessId)
.collect(Collectors.toList());
//删除工艺工序关系表
technologyProcessApplication.deleteByTechnologyProcessIds(technologyProcessIds);
//删除工艺表
technologyRepository.delete(technologyId);
});
}
@Override
......
......@@ -40,15 +40,11 @@ public class TechnologyProcessApplicationImpl extends BaseApplication implements
@Override
public void saveTechnologyProcessVoList(String technologyId, List<TechnologyProcessVo> technologyProcessList) {
technologyProcessList.forEach(technologyProcessVo -> {
//保存工序
ProcessVo processVo = new ProcessVo();
BeanUtil.copyProperties(technologyProcessVo,processVo);
processVo = processApplication.saveProcess(processVo);
//保存工艺工序关系
TechnologyProcess technologyProcess = new TechnologyProcess();
technologyProcess.setTechnologyId(technologyId);
technologyProcess.setProcessId(processVo.getProcessId());
technologyProcess.setProcessId(technologyProcessVo.getProcessId());
technologyProcessRepository.saveAndFlush(technologyProcess);
//保存工序资源
......@@ -83,9 +79,6 @@ public class TechnologyProcessApplicationImpl extends BaseApplication implements
technologyProcessList.forEach(technologyProcess -> {
//删除工序资源
processResourceApplication.deleteByTechnologyProcessId(technologyProcess.getTechnologyProcessId());
//删除工序
processApplication.deleteProcessByProcessId(technologyProcess.getProcessId());
});
//删除工艺工序关系表
technologyProcessRepository.delete(technologyProcessList);
......
package com.huigou.topsun.technology.controller;
import com.huigou.cache.DictUtil;
import com.huigou.topsun.technology.application.ProcessApplication;
import com.huigou.topsun.technology.domain.query.ProcessQueryRequest;
import com.huigou.topsun.technology.vo.ProcessVo;
import com.huigou.topsun.technology.vo.TechnologyVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
......@@ -16,5 +22,60 @@ import javax.annotation.Resource;
@Controller
@ControllerMapping("/process")
public class ProcessController extends CommonController {
protected String getPagePath() {
return "/biz/topsun/technology/";
}
@Resource
private ProcessApplication processApplication;
public String forwardProcessList(){
Map<String, String> processType = DictUtil.getDictionary("processType");
this.putAttribute("processType",processType);
return forward("processList");
}
public String slicedProcessList(){
SDO sdo = this.getSDO();
ProcessQueryRequest queryRequest = sdo.toQueryRequest(ProcessQueryRequest.class);
return toResult(processApplication.slicedProcessList(queryRequest));
}
/**
* 工序新增明细
* @return
*/
public String addProcessDetail(){
return forward("processDetail");
}
/**
* 保存工序
* @return
*/
public String saveProcess(){
SDO sdo = this.getSDO();
ProcessVo processVo = sdo.toObject(ProcessVo.class);
processVo = processApplication.saveProcess(processVo);
return success(processVo);
}
/**
* 查看工序明细
* @return
*/
public String showProcessDetail(){
SDO sdo = this.getSDO();
String processId = sdo.getString("processId");
ProcessVo processVo = processApplication.findProcessByProcessId(processId);
return forward("processDetail",processVo);
}
public String deleteProcess(){
SDO sdo = this.getSDO();
List<String> ids = sdo.getIds();
processApplication.deleteProcessByProcessIds(ids);
return success();
}
}
......@@ -86,8 +86,8 @@ public class TechnologyController extends CommonController {
*/
public String deleteTechnologyByTechnologyId(){
SDO sdo = this.getSDO();
String technologyId = sdo.getString("technologyId");
technologyApplication.deleteTechnologyVo(technologyId);
List<String> ids = sdo.getIds();
technologyApplication.deleteTechnology(ids);
return success();
}
......
package com.huigou.topsun.technology.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
import lombok.Data;
/**
* 工序
* @TableName process
*/
@Data
public class ProcessQueryRequest extends QueryAbstractRequest {
/**
* 工序ID
*/
private String processId;
/**
* 工序名称
*/
private String processName;
/**
* 工序说明
*/
private String processRemark;
/**
* 工时
*/
private Double workHours;
/**
* 工序类别(process_type)
*/
private String processType;
/**
* 工序内容
*/
private String processContent;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<query-mappings>
<query name="processByTechnologyId" label="工序表" table="process">
<query name="processList" label="工序表" table="process">
<sql-query>
SELECT
p.process_id,
......@@ -12,10 +12,9 @@
p.work_hours
FROM
process p
LEFT JOIN technology_process tp ON tp.process_id = p.process_id
WHERE 1 =1
</sql-query>
<condition column="technology_id" name="technologyId" type="java.lang.String" symbol="=" alias="tp"/>
<condition column="process_name" name="processName" type="java.lang.String" symbol="like" alias="p"/>
</query>
</query-mappings>
\ No newline at end of file
......@@ -14,7 +14,11 @@
p.process_remark,
p.work_hours,
pr.resource_id,
CASE WHEN p.process_type = 'cropping' THEN
CASE WHEN p.process_type = 'pakeage' THEN
( SELECT gxmc FROM res_bz t WHERE t.id = pr.resource_id )
WHEN p.process_type = 'printing' THEN
( SELECT gxmc FROM res_ys t WHERE t.id = pr.resource_id )
WHEN p.process_type = 'cropping' THEN
( SELECT gxmc FROM res_cj t WHERE t.id = pr.resource_id ) ELSE '' end AS resource_name
FROM
technology_process tp
......
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