Commit 82f03be2 authored by 赵汉亭's avatar 赵汉亭

BOM接口添加字段、保存封装完成

parent a22bbc52
...@@ -10,6 +10,7 @@ function initialize(){ ...@@ -10,6 +10,7 @@ function initialize(){
//若是作为流程页或详情页,则初始化bom //若是作为流程页或详情页,则初始化bom
if($("#productId").val()!=null&&$("#productId").val()!=""){ if($("#productId").val()!=null&&$("#productId").val()!=""){
showTechnologyTable({proofingApplyId:$("#proofingApplyId").val()},"proofingApplyTechnologyId",null); showTechnologyTable({proofingApplyId:$("#proofingApplyId").val()},"proofingApplyTechnologyId",null);
showBomTable({proofingApplyId:$("#proofingApplyId").val()},"proofingApplyId");
} }
let isDetailPage = ($("#isDetailPage").val() === "true"); let isDetailPage = ($("#isDetailPage").val() === "true");
if (isDetailPage) { if (isDetailPage) {
...@@ -25,6 +26,7 @@ function bindQueryEvent() { ...@@ -25,6 +26,7 @@ function bindQueryEvent() {
ajaxRenderDataGoForm({productId:data.productId}); ajaxRenderDataGoForm({productId:data.productId});
$('#productCategoryName').val(data.productCategoryName) $('#productCategoryName').val(data.productCategoryName)
showTechnologyTable({productId:data.productId},"technologyId",null); showTechnologyTable({productId:data.productId},"technologyId",null);
showBomTable();
} }
}); });
} }
......
...@@ -14,6 +14,7 @@ function initialize() { ...@@ -14,6 +14,7 @@ function initialize() {
let isDetailPage = ($("#isDetailPage").val() === "true"); let isDetailPage = ($("#isDetailPage").val() === "true");
if (isDetailPage) { if (isDetailPage) {
showTechnologyTable({proofingMakeId:$("#proofingMakeId").val()},"proofingMakeTechnologyId",null); showTechnologyTable({proofingMakeId:$("#proofingMakeId").val()},"proofingMakeTechnologyId",null);
showBomTable({proofingMakeId:$("#proofingMakeId").val()},"proofingMakeId");
$("#jobPageTop").hide(); $("#jobPageTop").hide();
if($("#jobPageTop").length>0){ if($("#jobPageTop").length>0){
$("#formButton").hide(); $("#formButton").hide();
...@@ -29,6 +30,7 @@ function bindQueryEvent() { ...@@ -29,6 +30,7 @@ function bindQueryEvent() {
$('#productCode').val(data.productCode); $('#productCode').val(data.productCode);
ajaxRenderDataGoForm(data.proofingApplyNo); ajaxRenderDataGoForm(data.proofingApplyNo);
showTechnologyTable({proofingApplyId:data.proofingApplyId},"proofingApplyTechnologyId",null); showTechnologyTable({proofingApplyId:data.proofingApplyId},"proofingApplyTechnologyId",null);
showBomTable({proofingApplyId:data.proofingApplyId},"proofingApplyId");
} }
}); });
} }
......
...@@ -2,199 +2,278 @@ ...@@ -2,199 +2,278 @@
// var isDetail=false; // var isDetail=false;
//定义生成表格的参数对象 //定义生成表格的参数对象
var bomObj={ var bomObj = {
parms:{}, parms: {
node:"", name: "primaryKey"
url:"", },
columns:[ node: "bomGrid",
{ display: "物料", name: "materialName", width: 140, minWidth: 60, type: "string", align: "left" }, url: "slicedBomList",
{ display: "物料数量", name: "materialNumber", width: 120, minWidth: 60, type: "string", align: "left" }, gridManager: null,
{ display: "产品", name: "productId", width: 120, minWidth: 60, type: "string", align: "left" } primaryKey: null,
] columns: [
{
display: "物料", name: "materialName", width: 140, 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: "materialNumber", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true}
},
{
display: "组件计量单位", name: "materialUnit", width: 120, minWidth: 60, type: "string", align: "left",
},
{
display: "组件报废百分比", name: "AUSCH", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true, mask: '99999.99'}
},
{
display: "BOM项目文本", name: "POTX1", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true}
},
{
display: "物料清单项目文本",
name: "materialJson",
width: 120,
minWidth: 60,
type: "string",
align: "left",
},
{
display: "替代组", name: "ALPGR", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true}
},
{
display: "替代优先级", name: "ALPRF", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true}
},
{
display: "策略", name: "ALPST", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true}
},
{
display: "使用概率", name: "EWAHR", width: 120, minWidth: 60, type: "string", align: "left",
editor: {type: 'text', required: true}
},
]
} }
var technologyObj={ var technologyObj = {
parms:{}, parms: {},
node:"technologyGrid", node: "technologyGrid",
url:"slicedTechnologyList", url: "slicedTechnologyList",
gridManager:null, gridManager: null,
primaryKey:null, primaryKey: null,
columns:[ columns: [
{display: "工艺路线名称", name: "technologyName", width: 140, minWidth: 60, type: "string", align: "left", {
editor: { display: "工艺路线名称", name: "technologyName", width: 140, minWidth: 60, type: "string", align: "left",
type: 'text', editor: {
required: true type: 'text',
} required: true
} }
], }
linkage:function (data){ ],
let key = this.primaryKey; linkage: function (data) {
let val = data.Rows.length>0?data.Rows[0][key]:-1; // 获取选中行 let key = this.primaryKey;
processObj.parms = { [key]: val }; let val = data.Rows.length > 0 ? data.Rows[0][key] : -1; // 获取选中行
processBomObj.parms = { [key]: val }; processObj.parms = {[key]: val};
if(processObj.gridManager==null){ processBomObj.parms = {[key]: val};
loadGrid(processObj); // bomObj.parms = {[key]: val}
loadGrid(processBomObj); // if (parms.proofingApplyId != null)
}else { // bomObj.primaryKey = parms.proofingApplyId;
reloadGrid(processObj); // else if (parms.proofingMakeId != null)
reloadGrid(processBomObj); // bomObj.primaryKey = parms.proofingMakeId;
} if (processObj.gridManager == null) {
loadGrid(processObj);
loadGrid(processBomObj);
// loadGrid(bomObj)
} else {
reloadGrid(processObj);
reloadGrid(processBomObj);
// reloadGrid(bomObj)
}
} }
} }
var processObj={ var processObj = {
parms:{}, parms: {},
node:"processGrid", node: "processGrid",
url:"slicedTechnologyProcessList", url: "slicedTechnologyProcessList",
gridManager:null, gridManager: null,
columns:[ columns: [
{ {
display: "工序名称", name: "processName", width: 120, minWidth: 60, type: "string", align: "left", display: "工序名称", name: "processName", width: 120, minWidth: 60, type: "string", align: "left",
editor: { editor: {
required: true, type: "select", required: true, type: "select",
data: { data: {
type: 'system', type: 'system',
name: "processNameGroup", name: "processNameGroup",
back: { back: {
processId: "processId", processId: "processId",
processName: "processName", processName: "processName",
processType: "processType", processType: "processType",
processTypeTextView: "processTypeTextView", processTypeTextView: "processTypeTextView",
workHours: "workHours", workHours: "workHours",
processContent: "processContent", processContent: "processContent",
processRemark: "processRemark", processRemark: "processRemark",
} }
}, },
} }
}, },
{ {
display: "工序类别", display: "工序类别",
name: "processTypeTextView", name: "processTypeTextView",
width: 120, width: 120,
minWidth: 60, minWidth: 60,
type: "string", type: "string",
align: "left", align: "left",
/*editor : { /*editor : {
type : 'combobox', type : 'combobox',
data : $("#processType").combox('getJSONData'), data : $("#processType").combox('getJSONData'),
required : true, required : true,
valueField : 'processType' valueField : 'processType'
}*/ }*/
}, },
{ {
display: "工时", name: "workHours", width: 120, minWidth: 60, type: "number", align: "left", display: "工时", name: "workHours", width: 120, minWidth: 60, type: "number", align: "left",
/*editor: { /*editor: {
required: true, required: true,
type: 'text', type: 'text',
mask: 'positiveMoney' mask: 'positiveMoney'
}*/ }*/
}, },
{ {
display: "工序内容", name: "processContent", width: 180, minWidth: 60, type: "string", align: "left", display: "工序内容", name: "processContent", width: 180, minWidth: 60, type: "string", align: "left",
/*editor: { /*editor: {
required: true, required: true,
type: 'text' type: 'text'
}*/ }*/
}, },
{ {
display: "工序说明", name: "processRemark", width: 180, minWidth: 60, type: "string", align: "left", display: "工序说明", name: "processRemark", width: 180, minWidth: 60, type: "string", align: "left",
/*editor: { /*editor: {
required: true, required: true,
type: 'text' type: 'text'
}*/ }*/
} }
] ]
} }
var processBomObj={ var processBomObj = {
parms:{}, parms: {},
node:"processBomGrid", node: "processBomGrid",
url:"slicedProcessMaterialList", url: "slicedProcessMaterialList",
primaryKey:null, primaryKey: null,
columns:[ columns: [
{ display: "物料", name: "materialName", width: 140, minWidth: 60, type: "string", align: "left", {
editor: { display: "物料", name: "materialName", width: 140, minWidth: 60, type: "string", align: "left",
required: true, type: "select", editor: {
data: { required: true, type: "select",
type: 'system', data: {
name: "sapMaterialSelect", type: 'system',
back: { name: "sapMaterialSelect",
materialId: "materialId", back: {
materialName:"materialName", materialId: "materialId",
materialUnit:"materialUnit", materialName: "materialName",
materialJson:"materialJson", materialUnit: "materialUnit",
} materialJson: "materialJson",
}, }
} },
}, }
{ display: "SAP物料详细信息", name: "materialJson", width: 140, minWidth: 60, type: "string", align: "left" }, },
{ display: "使用的物料数量", name: "materialNumber", width: 120, minWidth: 60, type: "string", align: "left" , {display: "SAP物料详细信息", name: "materialJson", width: 140, minWidth: 60, type: "string", align: "left"},
editor: { {
display: "使用的物料数量", name: "materialNumber", width: 120, minWidth: 60, type: "string", align: "left",
editor: {
required: true, required: true,
type: 'text', type: 'text',
mask: 'positiveMoney' mask: 'positiveMoney'
} }
}, },
{ display: "物料计量单位", name: "materialUnit", width: 120, minWidth: 60, type: "string", align: "left" } {display: "物料计量单位", name: "materialUnit", width: 120, minWidth: 60, type: "string", align: "left"}
] ]
} }
//创建表格(参数、列、插入的节点、请求地址) //创建表格(参数、列、插入的节点、请求地址)
function loadGrid(obj) { function loadGrid(obj) {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({ var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function () { addHandler: function () {
UICtrl.addGridRow(obj.gridManager); UICtrl.addGridRow(obj.gridManager);
}, },
deleteHandler: function () { deleteHandler: function () {
var _grid = UICtrl.getGridManager('#'+obj.node); var _grid = UICtrl.getGridManager('#' + obj.node);
_grid.deleteSelectedRow();//删除选定节点 _grid.deleteSelectedRow();//删除选定节点
} }
}); });
obj.gridManager = UICtrl.grid("#"+obj.node, { obj.gridManager = UICtrl.grid("#" + obj.node, {
columns: obj.columns, columns: obj.columns,
dataAction: "server", dataAction: "server",
url: web_app.name +'/proofingTechnologyRelevancy/'+obj.url+'.ajax', url: web_app.name + '/proofingTechnologyRelevancy/' + obj.url + '.ajax',
parms:obj.parms, parms: obj.parms,
pageSize: 10, pageSize: 10,
toolbar: toolbarOptions, toolbar: toolbarOptions,
usePager: true, usePager: true,
enabledEdit: true, enabledEdit: true,
width: "100%", width: "100%",
height: 400, height: 400,
heightDiff: -8, heightDiff: -8,
checkbox: true, checkbox: true,
fixedCellHeight: true, fixedCellHeight: true,
selectRowButtonOnly: true, selectRowButtonOnly: true,
onSuccess: function (data){ onSuccess: function (data) {
if(obj.linkage!=null){ if (obj.linkage != null) {
obj.linkage(data) obj.linkage(data)
} }
} }
}); });
UICtrl.setSearchAreaToggle(obj.gridManager); UICtrl.setSearchAreaToggle(obj.gridManager);
} }
//根据产品编号展示产品的艺表格 //根据产品编号展示产品的艺表格
function showTechnologyTable(parms,technologyKey,processKey){ function showTechnologyTable(parms, technologyKey, processKey) {
// isDetail=false; // isDetail=false;
technologyObj.primaryKey=technologyKey technologyObj.primaryKey = technologyKey
processObj.primaryKey=processKey processObj.primaryKey = processKey
technologyObj.parms = parms; technologyObj.parms = parms;
if(technologyObj.gridManager==null) { if (technologyObj.gridManager == null) {
loadGrid(technologyObj); loadGrid(technologyObj);
}{ }
reloadGrid(technologyObj); {
} reloadGrid(technologyObj);
}
}
function showBomTable(parms, primaryKey) {
bomObj.primaryKey = primaryKey
bomObj.parms = parms;
if (bomObj.gridManager == null) {
loadGrid(bomObj);
}
{
reloadGrid(bomObj);
}
} }
$(document).ready(function() { $(document).ready(function () {
// technologyClickRequestProcess(); // technologyClickRequestProcess();
UICtrl.layout("#layout",{ UICtrl.layout("#layout", {
leftWidth:2, leftWidth: 2,
rightWidth:4, rightWidth: 4,
}) })
}); });
...@@ -202,16 +281,14 @@ $(document).ready(function() { ...@@ -202,16 +281,14 @@ $(document).ready(function() {
* 刷新表格 * 刷新表格
*/ */
function reloadGrid(obj) { function reloadGrid(obj) {
if(obj === undefined){ if (obj === undefined) {
return; return;
} }
obj.gridManager.options.parms=obj.parms; obj.gridManager.options.parms = obj.parms;
obj.gridManager.loadData(); obj.gridManager.loadData();
} }
// /** // /**
// * 根据选定的technology列获取对应的process // * 根据选定的technology列获取对应的process
// * 冒泡机制永远都会先执行此点击事件,需要让平台内置事件先执行来获取行id // * 冒泡机制永远都会先执行此点击事件,需要让平台内置事件先执行来获取行id
...@@ -240,34 +317,40 @@ function reloadGrid(obj) { ...@@ -240,34 +317,40 @@ function reloadGrid(obj) {
* 获取编辑表格中的数据 * 获取编辑表格中的数据
* @returns {{}|boolean} * @returns {{}|boolean}
*/ */
function getTableResult(){ function getTableResult() {
let technologyResult = DataUtil.getUpdateRow(technologyObj.gridManager); // 获取选中行 let technologyResult = DataUtil.getUpdateRow(technologyObj.gridManager); // 获取选中行
let processResult = processObj.gridManager.getSelectedRows();
let processResult =processObj.gridManager.getSelectedRows(); let processMaterialResult = processBomObj.gridManager.getSelectedRows();
let processMaterialResult = processBomObj.gridManager.getSelectedRows(); let bomResult = bomObj.gridManager.getSelectedRows();
if(!technologyResult){ if (!technologyResult) {
Public.tip("请选择工艺!") Public.tip("请选择工艺!")
return false; return false;
}else if(processResult.length<1){ } else if (processResult.length < 1) {
Public.tip("请选择工序!") Public.tip("请选择工序!")
return false; return false;
}else if(processMaterialResult.length<1){ } else if (processMaterialResult.length < 1) {
Public.tip("请选择工序物料!") Public.tip("请选择工序物料!")
return false; return false;
} } else if (bomResult.length < 1) {
var extendedData = {}; Public.tip("请选择BOM设置")
extendedData.technology = Public.encodeJSONURI(technologyResult); return false;
extendedData.process = Public.encodeJSONURI(processResult); }
extendedData.processMaterial = Public.encodeJSONURI(processMaterialResult); var extendedData = {};
return extendedData; extendedData.technology = Public.encodeJSONURI(technologyResult);
extendedData.process = Public.encodeJSONURI(processResult);
extendedData.processMaterial = Public.encodeJSONURI(processMaterialResult);
extendedData.bom = Public.encodeJSONURI(bomResult);
return extendedData;
} }
function getTableDateAll(obj){ function getTableDateAll(obj) {
let result = DataUtil.getGridData({ let result = DataUtil.getGridData({
gridManager: obj.gridManager, gridManager: obj.gridManager,
isAllData: true isAllData: true
}); });
return result; return result;
} }
\ No newline at end of file
<x:script src='/biz/topsun/proofing/technologyAndBom/technologyAndBom.js'/> <x:script src='/biz/topsun/proofing/technologyAndBom/technologyAndBom.js'/>
<div><h3>BOM设置</h3></div> <div><h3>BOM设置</h3></div>
<div style="margin: 10px;"> <div style="margin: 10px;">
<div id="mobTableGrid" style="margin: 2px;"> <div id="bom">
<hr> <div id="bomGrid" style="margin: 2px;">
<hr>
</div>
</div> </div>
</div> </div>
<div><h3>工艺设置</h3></div> <div><h3>工艺设置</h3></div>
<div style="margin: 10px;"> <div style="margin: 10px;">
<div id="layout" style="height: 400px"> <div id="layout" style="height: 400px">
<div id="technology" position="left"> <div id="technology" position="left">
<x:title title="工艺" name="group"/> <x:title title="工艺" name="group"/>
<div id="technologyGrid" style="margin: 2px;"> <div id="technologyGrid" style="margin: 2px;">
<hr> <hr>
</div>
</div> </div>
</div>
<div id="process" position="center"> <div id="process" position="center">
<x:title title="工序" name="group"/> <x:title title="工序" name="group"/>
<div id="processGrid" style="margin: 2px;"> <div id="processGrid" style="margin: 2px;">
<hr> <hr>
</div>
</div> </div>
</div> <div id="processBom" position="right">
<div id="processBom" position="right"> <x:title title="工序物料" name="group"/>
<x:title title="工序物料" name="group"/> <div id="processBomGrid" style="margin: 2px;">
<div id="processBomGrid" style="margin: 2px;"> <hr>
<hr> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
\ No newline at end of file
package com.huigou.topsun.proofing.application;
import com.huigou.topsun.proofing.domain.proofingApply.model.ProofingApplyBom;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyBomQueryRequest;
import java.util.Map;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
public interface ProofingApplyBomApplication {
String QUERY_XML_FILE_PATH = "config/topsun/proofing/proofingApply.xml";
Map<String ,Object > slicedProofingApplyBom(ProofingApplyBomQueryRequest proofingApplyBomQueryRequest);
}
package com.huigou.topsun.proofing.application;
import com.huigou.topsun.proofing.domain.proofingMake.model.ProofingMakeBom;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeBomQueryRequest;
import java.util.Map;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
public interface ProofingMakeBomApplication {
String QUERY_XML_FILE_PATH = "config/topsun/proofing/proofingMake.xml";
Map<String ,Object > slicedProofingMakeBom(ProofingMakeBomQueryRequest proofingMakeBomQueryRequest);
}
...@@ -6,11 +6,9 @@ import com.huigou.data.query.model.QueryDescriptor; ...@@ -6,11 +6,9 @@ import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.product.domain.ProductPublishedConf; import com.huigou.topsun.product.domain.ProductPublishedConf;
import com.huigou.topsun.product.repository.ProductPublishedConfRepository; import com.huigou.topsun.product.repository.ProductPublishedConfRepository;
import com.huigou.topsun.proofing.application.ProofingApplyApplication; import com.huigou.topsun.proofing.application.ProofingApplyApplication;
import com.huigou.topsun.proofing.domain.proofingApply.model.*; import com.huigou.topsun.proofing.domain.proofingApply.model.*;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyQuery; import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyQuery;
import com.huigou.topsun.proofing.domain.vo.ProofingApplyAndLookedVo; import com.huigou.topsun.proofing.domain.vo.ProofingApplyAndLookedVo;
import com.huigou.topsun.proofing.repository.proofingApply.*; import com.huigou.topsun.proofing.repository.proofingApply.*;
import com.huigou.uasp.bmp.common.BizBillStatus; import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bpm.FlowBroker; import com.huigou.uasp.bpm.FlowBroker;
...@@ -22,16 +20,14 @@ import org.activiti.engine.delegate.DelegateExecution; ...@@ -22,16 +20,14 @@ import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask; import org.activiti.engine.delegate.DelegateTask;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID;
/** /**
* @author yonghuan * @author yonghuan
...@@ -52,6 +48,9 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing ...@@ -52,6 +48,9 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing
@Autowired @Autowired
private ProofingApplyProcessMaterialRepository proofingApplyProcessMaterialRepository; private ProofingApplyProcessMaterialRepository proofingApplyProcessMaterialRepository;
@Autowired
private ProofingApplyBomRepository proofingApplyBomRepository;
@Override @Override
public ProofingApplyBaseInfo loadProofingApplyById(String id) { public ProofingApplyBaseInfo loadProofingApplyById(String id) {
...@@ -61,7 +60,7 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing ...@@ -61,7 +60,7 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing
@Override @Override
public Map<String, Object> slicedQuery(ProofingApplyQuery query) { public Map<String, Object> slicedQuery(ProofingApplyQuery query) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedQuery"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedQuery");
return this.sqlExecutorDao.executeSlicedQuery(queryDescriptor,query); return this.sqlExecutorDao.executeSlicedQuery(queryDescriptor, query);
} }
@SneakyThrows @SneakyThrows
...@@ -78,7 +77,7 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing ...@@ -78,7 +77,7 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing
} }
//如果录入了ng重新打样原因,则更改状态为不通过 //如果录入了ng重新打样原因,则更改状态为不通过
if(!StringUtil.isBlank(proofingApply.getProofingApplyNgReReason())){ if (!StringUtil.isBlank(proofingApply.getProofingApplyNgReReason())) {
proofingApply.setProofingApplyApplicationStatus("2"); proofingApply.setProofingApplyApplicationStatus("2");
} }
proofingApply = proofingApplyRepository.save(proofingApply); proofingApply = proofingApplyRepository.save(proofingApply);
...@@ -91,8 +90,10 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing ...@@ -91,8 +90,10 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
ProofingApplyTechnology proofingTechnology = objectMapper.readValue(technologyJSON, ProofingApplyTechnology.class); ProofingApplyTechnology proofingTechnology = objectMapper.readValue(technologyJSON, ProofingApplyTechnology.class);
List<ProofingApplyProcess> processList = objectMapper.readValue(processJSON, new TypeReference<List<ProofingApplyProcess>>() {}); List<ProofingApplyProcess> processList = objectMapper.readValue(processJSON, new TypeReference<List<ProofingApplyProcess>>() {
List<ProofingApplyProcessMaterial> processMaterialList = objectMapper.readValue(processMaterialJSON, new TypeReference<List<ProofingApplyProcessMaterial>>() {}); });
List<ProofingApplyProcessMaterial> processMaterialList = objectMapper.readValue(processMaterialJSON, new TypeReference<List<ProofingApplyProcessMaterial>>() {
});
ProofingApplyLooked proofingApplyLooked = getBizEntity(ProofingApplyLooked.class); ProofingApplyLooked proofingApplyLooked = getBizEntity(ProofingApplyLooked.class);
...@@ -133,6 +134,30 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing ...@@ -133,6 +134,30 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing
proofingApplyProcessMaterial.setProofingApplyTechnologyId(proofingTechnology.getProofingApplyTechnologyId()); proofingApplyProcessMaterial.setProofingApplyTechnologyId(proofingTechnology.getProofingApplyTechnologyId());
proofingApplyProcessMaterialRepository.saveAndFlush(proofingApplyProcessMaterial); proofingApplyProcessMaterialRepository.saveAndFlush(proofingApplyProcessMaterial);
} }
// 保存BOM信息
String bomJson = sdo.getString("bom");
if (StringUtil.isNotBlank(bomJson)) {
// 获取前端传来的BOM列表
// 判断是否为新增还是修改
ProofingApplyBom proofingApplyBom1 = new ProofingApplyBom();
proofingApplyBom1.setProofingApplyId(proofingApply.getProofingApplyId());
List<ProofingApplyBom> applyBomList = proofingApplyBomRepository.findAll(Example.of(proofingApplyBom1));
if (!applyBomList.isEmpty()) {
// 修改 -- 删除
applyBomList.forEach(proofingApplyBom -> proofingApplyBomRepository.delete(proofingApplyBom.getProofingApplyBomId()));
}
List<ProofingApplyBom> proofingApplyBomList = objectMapper.readValue(bomJson, new TypeReference<List<ProofingApplyBom>>() {
});
// 新增
for (ProofingApplyBom proofingApplyBom : proofingApplyBomList) {
proofingApplyBom.setProofingApplyId(proofingApply.getProofingApplyId());
// 保存
proofingApplyBomRepository.save(proofingApplyBom);
}
}
// 封装保存
return proofingApply.getId(); return proofingApply.getId();
} }
...@@ -179,17 +204,16 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing ...@@ -179,17 +204,16 @@ public class ProofingApplyApplicationImpl extends FlowBroker implements Proofing
public ProofingApplyAndLookedVo getProofingApplyByProofingApplyNo(String proofingApplyNo) { public ProofingApplyAndLookedVo getProofingApplyByProofingApplyNo(String proofingApplyNo) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "queryProofingApplyAndProductQuery"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "queryProofingApplyAndProductQuery");
ProofingApplyAndLookedVo proofingApplyAndLookedVo = this.sqlExecutorDao.queryToObject(queryDescriptor.getSql(), ProofingApplyAndLookedVo.class, proofingApplyNo); ProofingApplyAndLookedVo proofingApplyAndLookedVo = this.sqlExecutorDao.queryToObject(queryDescriptor.getSql(), ProofingApplyAndLookedVo.class, proofingApplyNo);
ProductPublishedConf productPublishedConf = productPublishedConfRepository.findByProductId(new BigDecimal(proofingApplyAndLookedVo.getProductId())); ProductPublishedConf productPublishedConf = productPublishedConfRepository.findByProductId(new BigDecimal(proofingApplyAndLookedVo.getProductId()));
if(productPublishedConf!=null){ if (productPublishedConf != null) {
BeanUtils.copyProperties(productPublishedConf,proofingApplyAndLookedVo); BeanUtils.copyProperties(productPublishedConf, proofingApplyAndLookedVo);
} }
return proofingApplyAndLookedVo; return proofingApplyAndLookedVo;
} }
@Override @Override
public ProofingApplyBaseInfo selectProofingApplyByProofingApplyNo(String proofingApplyNo) { public ProofingApplyBaseInfo selectProofingApplyByProofingApplyNo(String proofingApplyNo) {
return proofingApplyRepository.findByProofingApplyNo(proofingApplyNo); return proofingApplyRepository.findByProofingApplyNo(proofingApplyNo);
......
package com.huigou.topsun.proofing.application.impl;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.proofing.application.ProofingApplyBomApplication;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyBomQueryRequest;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
@Service
public class ProofingApplyBomApplicationImpl extends BaseApplication implements ProofingApplyBomApplication {
@Override
public Map<String, Object> slicedProofingApplyBom(ProofingApplyBomQueryRequest proofingApplyBomQueryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedProofingApplyBom");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, proofingApplyBomQueryRequest);
Map<String, Object> map = this.sqlExecutorDao.executeSlicedQuery(queryModel);
// 转化为前端可以接受的数据
ArrayList<HashMap> rows = (ArrayList) map.get("Rows");
ArrayList<HashMap<String, Object>> proofingApplyBoms = new ArrayList<>();
for (HashMap row : rows) {
HashMap<String, Object> rowMap = new HashMap<>();
rowMap.put("ALPGR", row.get("proofingApplyBomAlpgr"));
rowMap.put("materialName", row.get("productMaterialName"));
rowMap.put("materialNumber", row.get("proofingApplyBomNum"));
rowMap.put("AUSCH", row.get("proofingApplyBomAusch"));
rowMap.put("POTX1", row.get("proofingApplyBomText"));
rowMap.put("materialJson", row.get("proofingApplyBomMaterialText"));
rowMap.put("ALPRF", row.get("proofingApplyBomAlprf"));
rowMap.put("ALPST", row.get("proofingApplyBomAlpst"));
rowMap.put("EWAHR", row.get("proofingApplyBomEwahr"));
rowMap.put("materialId", row.get("productMaterialId"));
rowMap.put("materialUnit", row.get("proofingApplyBomMeins"));
rowMap.put("bomId", row.get("proofingApplyBomId"));
rowMap.put("primaryKey",row.get("proofingApplyId"));
proofingApplyBoms.add(rowMap);
}
map.remove("Rows");
map.put("Rows", proofingApplyBoms);
return map;
}
}
package com.huigou.topsun.proofing.application.impl; package com.huigou.topsun.proofing.application.impl;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
...@@ -8,15 +9,9 @@ import com.huigou.topsun.product.domain.ProductPublishedConf; ...@@ -8,15 +9,9 @@ import com.huigou.topsun.product.domain.ProductPublishedConf;
import com.huigou.topsun.product.repository.ProductLookedRepository; import com.huigou.topsun.product.repository.ProductLookedRepository;
import com.huigou.topsun.product.repository.ProductPublishedConfRepository; import com.huigou.topsun.product.repository.ProductPublishedConfRepository;
import com.huigou.topsun.proofing.application.ProofingMakeApplication; import com.huigou.topsun.proofing.application.ProofingMakeApplication;
import com.huigou.topsun.proofing.domain.proofingApply.model.ProofingApplyProcess;
import com.huigou.topsun.proofing.domain.proofingApply.model.ProofingApplyProcessMaterial;
import com.huigou.topsun.proofing.domain.proofingApply.model.ProofingApplyTechnology;
import com.huigou.topsun.proofing.domain.proofingMake.model.*; import com.huigou.topsun.proofing.domain.proofingMake.model.*;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeQueryRequest; import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeQueryRequest;
import com.huigou.topsun.proofing.domain.vo.ProofingApplyAndLookedVo;
import com.huigou.topsun.proofing.domain.vo.ProofingMakeVo; import com.huigou.topsun.proofing.domain.vo.ProofingMakeVo;
import com.huigou.topsun.proofing.repository.proofingApply.ProofingApplyRepository; import com.huigou.topsun.proofing.repository.proofingApply.ProofingApplyRepository;
import com.huigou.topsun.proofing.repository.proofingMake.*; import com.huigou.topsun.proofing.repository.proofingMake.*;
import com.huigou.topsun.util.MyBaseUtil; import com.huigou.topsun.util.MyBaseUtil;
...@@ -25,21 +20,23 @@ import com.huigou.util.SDO; ...@@ -25,21 +20,23 @@ import com.huigou.util.SDO;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author 16508 * @author 16508
* @description 针对表【technology(工艺)】的数据库操作Service实现 * @description 针对表【technology(工艺)】的数据库操作Service实现
* @createDate 2023-11-22 11:04:03 * @createDate 2023-11-22 11:04:03
*/ */
@Service @Service
public class ProofingMakeApplicationImpl extends BaseApplication implements ProofingMakeApplication { public class ProofingMakeApplicationImpl extends BaseApplication implements ProofingMakeApplication {
...@@ -63,21 +60,25 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -63,21 +60,25 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
@Autowired @Autowired
ProofingMakeProcessMaterialRepository proofingMakeProcessMaterialRepository; ProofingMakeProcessMaterialRepository proofingMakeProcessMaterialRepository;
@Autowired
ProofingMakeBomRepository proofingMakeBomRepository;
@Override @Override
public Map<String, Object> slicedProofingMakeQuery(ProofingMakeQueryRequest query) { public Map<String, Object> slicedProofingMakeQuery(ProofingMakeQueryRequest query) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedProofingMakeList"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedProofingMakeList");
return this.sqlExecutorDao.executeSlicedQuery(queryDescriptor,query); return this.sqlExecutorDao.executeSlicedQuery(queryDescriptor, query);
} }
/** /**
* 编辑打样制造及相关信息 * 编辑打样制造及相关信息
*
* @param sdo 打样制造及相关信息 * @param sdo 打样制造及相关信息
*/ */
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
@SneakyThrows @SneakyThrows
@Override @Override
public Map<String,Object> saveProofingMake(SDO sdo) { public Map<String, Object> saveProofingMake(SDO sdo) {
HashMap<String, Object> idMap = new HashMap<>(); HashMap<String, Object> idMap = new HashMap<>();
ProofingMakeBaseInfo proofingMakeBaseInfo = sdo.toObject(ProofingMakeBaseInfo.class); ProofingMakeBaseInfo proofingMakeBaseInfo = sdo.toObject(ProofingMakeBaseInfo.class);
ProofingMakeLooked proofingMakeLooked = sdo.toObject(ProofingMakeLooked.class); ProofingMakeLooked proofingMakeLooked = sdo.toObject(ProofingMakeLooked.class);
...@@ -85,23 +86,25 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -85,23 +86,25 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
proofingMakeBaseInfo = proofingMakeRepository.save(proofingMakeBaseInfo); proofingMakeBaseInfo = proofingMakeRepository.save(proofingMakeBaseInfo);
idMap.put("proofingMakeId",proofingMakeBaseInfo.getProofingMakeId()); idMap.put("proofingMakeId", proofingMakeBaseInfo.getProofingMakeId());
proofingMakeLooked.setProofingMakeId(proofingMakeBaseInfo.getProofingMakeId()); proofingMakeLooked.setProofingMakeId(proofingMakeBaseInfo.getProofingMakeId());
proofingMakeLooked=proofingMakeLookedRepository.save(proofingMakeLooked); proofingMakeLooked = proofingMakeLookedRepository.save(proofingMakeLooked);
idMap.put("proofingMakeLookedId",proofingMakeLooked.getProofingMakeLookedId()); idMap.put("proofingMakeLookedId", proofingMakeLooked.getProofingMakeLookedId());
proofingMakePdPublishedConf.setProofingMakeId(proofingMakeBaseInfo.getProofingMakeId()); proofingMakePdPublishedConf.setProofingMakeId(proofingMakeBaseInfo.getProofingMakeId());
proofingMakePdPublishedConf=proofingMakePdPublishedConfRepository.save(proofingMakePdPublishedConf); proofingMakePdPublishedConf = proofingMakePdPublishedConfRepository.save(proofingMakePdPublishedConf);
idMap.put("proofingMakePdPublishedConfId",proofingMakePdPublishedConf.getProofingMakePdPublishedConfId()); idMap.put("proofingMakePdPublishedConfId", proofingMakePdPublishedConf.getProofingMakePdPublishedConfId());
String technologyJSON = sdo.getString("technology"); String technologyJSON = sdo.getString("technology");
String processJSON = sdo.getString("process"); String processJSON = sdo.getString("process");
String processMaterialJSON = sdo.getString("processMaterial"); String processMaterialJSON = sdo.getString("processMaterial");
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
ProofingMakeTechnology proofingMakeTechnology = objectMapper.readValue(technologyJSON, ProofingMakeTechnology.class); ProofingMakeTechnology proofingMakeTechnology = objectMapper.readValue(technologyJSON, ProofingMakeTechnology.class);
List<ProofingMakeProcess> ProcessList = objectMapper.readValue(processJSON, new TypeReference<List<ProofingMakeProcess>>() {}); List<ProofingMakeProcess> ProcessList = objectMapper.readValue(processJSON, new TypeReference<List<ProofingMakeProcess>>() {
List<ProofingMakeProcessMaterial> processMaterialList = objectMapper.readValue(processMaterialJSON, new TypeReference<List<ProofingMakeProcessMaterial>>() {}); });
List<ProofingMakeProcessMaterial> processMaterialList = objectMapper.readValue(processMaterialJSON, new TypeReference<List<ProofingMakeProcessMaterial>>() {
});
/* /*
* 将样品的相关工艺工序等删除 * 将样品的相关工艺工序等删除
...@@ -141,12 +144,38 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -141,12 +144,38 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
ProductPublishedConf productPublishedConf = sdo.toObject(ProductPublishedConf.class); ProductPublishedConf productPublishedConf = sdo.toObject(ProductPublishedConf.class);
productPublishedConf.setProductId(productId); productPublishedConf.setProductId(productId);
ProductLooked looked = productLookedRepository.findByProductId(productLooked.getProductId()); ProductLooked looked = productLookedRepository.findByProductId(productLooked.getProductId());
productLooked.setProductLookedId(looked==null?null:looked.getProductLookedId().toString()); productLooked.setProductLookedId(looked == null ? null : looked.getProductLookedId().toString());
productLookedRepository.save(productLooked); productLookedRepository.save(productLooked);
ProductPublishedConf publishedConf = productPublishedConfRepository.findByProductId(productPublishedConf.getProductId()); ProductPublishedConf publishedConf = productPublishedConfRepository.findByProductId(productPublishedConf.getProductId());
productPublishedConf.setProductPublishedConfId(publishedConf==null?null:publishedConf.getProductPublishedConfId().toString()); productPublishedConf.setProductPublishedConfId(publishedConf == null ? null : publishedConf.getProductPublishedConfId().toString());
productPublishedConfRepository.save(productPublishedConf); productPublishedConfRepository.save(productPublishedConf);
// 保存BOM信息
// 获取前端传来的BOM列表
String bomJson = sdo.getString("bom");
// 判断是否为新增还是修改
ProofingMakeBom proofingMakeBom1 = new ProofingMakeBom();
proofingMakeBom1.setProofingMakeId(idMap.get("proofingMakeId").toString());
List<ProofingMakeBom> makeBomList = proofingMakeBomRepository.findAll(Example.of(proofingMakeBom1));
if (!makeBomList.isEmpty()) {
// 修改 -- 删除
makeBomList.forEach(proofingApplyBom -> proofingMakeBomRepository.delete(proofingApplyBom.getProofingMakeBomId()));
}
List<ProofingMakeBom> proofingMakeBomList = objectMapper.readValue(bomJson, new TypeReference<List<ProofingMakeBom>>() {
});
// 封装保存
proofingMakeBomList.forEach(proofingMakeBom -> {
proofingMakeBom.setProofingMakeId(idMap.get("proofingMakeId").toString());
// 保存
proofingMakeBomRepository.save(proofingMakeBom);
// proofingMakeBom.setProductMaterialName(null);
});
// 给SAP返回BOM-JSON数据
String returnJson = getReturnJson(proofingMakeBomList);
return idMap; return idMap;
} }
...@@ -154,7 +183,7 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -154,7 +183,7 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
public ProofingMakeVo getProofingMakeVoById(String proofingMakeId) { public ProofingMakeVo getProofingMakeVoById(String proofingMakeId) {
ProofingMakeVo proofingMakeVo = new ProofingMakeVo(); ProofingMakeVo proofingMakeVo = new ProofingMakeVo();
ProofingMakeBaseInfo proofingMake = proofingMakeRepository.findOne(proofingMakeId); ProofingMakeBaseInfo proofingMake = proofingMakeRepository.findOne(proofingMakeId);
if (proofingMake==null) return null; if (proofingMake == null) return null;
ProofingMakeLooked proofingMakeLooked = proofingMakeLookedRepository.findByProofingMakeId(proofingMakeId); ProofingMakeLooked proofingMakeLooked = proofingMakeLookedRepository.findByProofingMakeId(proofingMakeId);
ProofingMakePdPublishedConf proofingMakePdPublishedConf = proofingMakePdPublishedConfRepository.findByProofingMakeId(proofingMakeId); ProofingMakePdPublishedConf proofingMakePdPublishedConf = proofingMakePdPublishedConfRepository.findByProofingMakeId(proofingMakeId);
MyBaseUtil.mergeObjects(proofingMakeVo, MyBaseUtil.mergeObjects(proofingMakeVo,
...@@ -166,6 +195,7 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -166,6 +195,7 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
/** /**
* 映射打样制造和打样申请 除前缀不一样的字段 * 映射打样制造和打样申请 除前缀不一样的字段
*
* @param vo * @param vo
* @throws IllegalAccessException * @throws IllegalAccessException
*/ */
...@@ -198,6 +228,35 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -198,6 +228,35 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
proofingMakeRepository.save(proofingMakeBaseInfo); proofingMakeRepository.save(proofingMakeBaseInfo);
} }
/**
* 返回JSON数据
*
* @return
*/
public String getReturnJson(List<ProofingMakeBom> bomJson) {
List<ProofingMakeBom> proofingMakeBoms = new ArrayList<>();
bomJson.forEach(bom -> {
ProofingMakeBom proofingMakeBom = new ProofingMakeBom();
BeanUtils.copyProperties(bom, proofingMakeBom);
proofingMakeBom.setProductMaterialName(null);
proofingMakeBoms.add(proofingMakeBom);
});
ObjectMapper objectMapper = new ObjectMapper();
String json = null;
try {
json = objectMapper.writeValueAsString(proofingMakeBoms);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
String returnJson = json.replaceAll("materialId", "IDNRK")
.replaceAll("materialNumber", "MENGE")
.replaceAll("materialUnit", "MEINS")
.replaceAll("materialJson", "POTX2")
.replaceAll("\"materialName\":null,", "");
return returnJson;
}
@Override @Override
@Transactional @Transactional
public void deleteProofingMakeByIds(List<String> ids) { public void deleteProofingMakeByIds(List<String> ids) {
...@@ -207,3 +266,4 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo ...@@ -207,3 +266,4 @@ public class ProofingMakeApplicationImpl extends BaseApplication implements Proo
package com.huigou.topsun.proofing.application.impl;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.proofing.application.ProofingMakeBomApplication;
import com.huigou.topsun.proofing.domain.proofingMake.model.ProofingMakeBom;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeBomQueryRequest;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
@Service
public class ProofingMakeBomApplicationImpl extends BaseApplication implements ProofingMakeBomApplication {
@Override
public Map<String, Object> slicedProofingMakeBom(ProofingMakeBomQueryRequest proofingMakeBomQueryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedProofingMakeBom");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, proofingMakeBomQueryRequest);
Map<String, Object> map = this.sqlExecutorDao.executeSlicedQuery(queryModel);
// 转换为前端可以接受的数据
ArrayList<HashMap> rows = (ArrayList) map.get("Rows");
ArrayList<HashMap<String, Object>> proofingMakeBoms = new ArrayList<>();
for (HashMap row : rows) {
HashMap<String, Object> rowMap = new HashMap<>();
rowMap.put("ALPGR", row.get("proofingMakeBomAlpgr"));
rowMap.put("materialName", row.get("productMaterialName"));
rowMap.put("materialNumber", row.get("proofingMakeBomNum"));
rowMap.put("AUSCH", row.get("proofingMakeBomAusch"));
rowMap.put("POTX1", row.get("proofingMakeBomText"));
rowMap.put("materialJson", row.get("proofingMakeBomMaterialText"));
rowMap.put("ALPRF", row.get("proofingMakeBomAlprf"));
rowMap.put("ALPST", row.get("proofingMakeBomAlpst"));
rowMap.put("EWAHR", row.get("proofingMakeBomEwahr"));
rowMap.put("materialId", row.get("productMaterialId"));
rowMap.put("materialUnit", row.get("proofingMakeBomMeins"));
rowMap.put("bomId", row.get("proofingMakeBomId"));
rowMap.put("primaryKey",row.get("proofingMakeId"));
proofingMakeBoms.add(rowMap);
}
map.remove("Rows");
map.put("Rows", proofingMakeBoms);
return map;
}
}
package com.huigou.topsun.proofing.controller; package com.huigou.topsun.proofing.controller;
import com.huigou.topsun.proofing.application.*; import com.huigou.topsun.proofing.application.*;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyBomQueryRequest;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyProcessMaterialQueryRequest; import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyProcessMaterialQueryRequest;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyProcessQueryRequest; import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyProcessQueryRequest;
import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyTechnologyQueryRequest; import com.huigou.topsun.proofing.domain.proofingApply.query.ProofingApplyTechnologyQueryRequest;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeBomQueryRequest;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeProcessMaterialQueryRequest; import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeProcessMaterialQueryRequest;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeProcessQueryRequest; import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeProcessQueryRequest;
import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeTechnologyQueryRequest; import com.huigou.topsun.proofing.domain.proofingMake.query.ProofingMakeTechnologyQueryRequest;
...@@ -49,6 +51,12 @@ public class ProofingTechnologyRelevancyController extends CommonController { ...@@ -49,6 +51,12 @@ public class ProofingTechnologyRelevancyController extends CommonController {
@Autowired @Autowired
ProofingMakeProcessMaterialApplication proofingMakeProcessMaterialApplication; ProofingMakeProcessMaterialApplication proofingMakeProcessMaterialApplication;
@Autowired
ProofingApplyBomApplication proofingApplyBomApplication;
@Autowired
ProofingMakeBomApplication proofingMakeBomApplication;
/** /**
* 展示工艺 * 展示工艺
...@@ -114,6 +122,22 @@ public class ProofingTechnologyRelevancyController extends CommonController { ...@@ -114,6 +122,22 @@ public class ProofingTechnologyRelevancyController extends CommonController {
return toResult(null); return toResult(null);
} }
/**
* 展示BOM
*/
public String slicedBomList(){
SDO sdo = this.getSDO();
ProofingApplyBomQueryRequest proofingApplyBomQueryRequest = sdo.toQueryRequest(ProofingApplyBomQueryRequest.class);
ProofingMakeBomQueryRequest proofingMakeBomQueryRequest = sdo.toQueryRequest(ProofingMakeBomQueryRequest.class);
//判断需要展示产品工序还是打样表中工序
if(!StringUtil.isBlank(proofingApplyBomQueryRequest.getProofingApplyId())){
return toResult(proofingApplyBomApplication.slicedProofingApplyBom(proofingApplyBomQueryRequest));
}else if(!StringUtil.isBlank(proofingMakeBomQueryRequest.getProofingMakeId())){
return toResult(proofingMakeBomApplication.slicedProofingMakeBom(proofingMakeBomQueryRequest));
}
return toResult(null);
}
public Map<String,Object> tempData(String id){ public Map<String,Object> tempData(String id){
if ("-1".equals(id))return null; if ("-1".equals(id))return null;
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
......
package com.huigou.topsun.proofing.domain.proofingApply.model; package com.huigou.topsun.proofing.domain.proofingApply.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
...@@ -13,6 +16,7 @@ import java.io.Serializable; ...@@ -13,6 +16,7 @@ import java.io.Serializable;
@Table(name="proofing_apply_bom") @Table(name="proofing_apply_bom")
@Entity @Entity
@Data @Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class ProofingApplyBom implements Serializable { public class ProofingApplyBom implements Serializable {
/** /**
* 打样申请单BOMid * 打样申请单BOMid
...@@ -26,12 +30,14 @@ public class ProofingApplyBom implements Serializable { ...@@ -26,12 +30,14 @@ public class ProofingApplyBom implements Serializable {
strategy = "guid" strategy = "guid"
) )
@Column(name = "proofing_apply_bom_id") @Column(name = "proofing_apply_bom_id")
@JsonProperty(value = "proofingApplyBomId",required = true)
private String proofingApplyBomId; private String proofingApplyBomId;
/** /**
* 产品物料组成id * 产品物料组成id
*/ */
@Column(name = "product_material_id") @Column(name = "product_material_id")
@JsonProperty("materialId")
private String productMaterialId; private String productMaterialId;
/** /**
...@@ -44,13 +50,71 @@ public class ProofingApplyBom implements Serializable { ...@@ -44,13 +50,71 @@ public class ProofingApplyBom implements Serializable {
* 数量 * 数量
*/ */
@Column(name = "proofing_apply_bom_num") @Column(name = "proofing_apply_bom_num")
@JsonProperty("materialNumber")
private String proofingApplyBomNum; private String proofingApplyBomNum;
/** /**
* 物料名称 * 物料名称
*/ */
@Column(name = "product_material_name") @Column(name = "product_material_name")
@JsonProperty("materialName")
private String productMaterialName; private String productMaterialName;
/**
* 组件计量单位
*/
@Column(name = "proofing_apply_bom_meins")
@JsonProperty("materialUnit")
private String proofingApplyBomMeins;
/**
* 组件报废百分比
*/
@Column(name = "proofing_apply_bom_ausch")
@JsonProperty(value = "AUSCH",required = true)
private Double proofingApplyBomAusch;
/**
* BOM项目文本(行1)
*/
@Column(name = "proofing_apply_bom_text")
@JsonProperty(value = "POTX1",required = true)
private String proofingApplyBomText;
/**
* 物料清单项目文本(行2)
*/
@Column(name = "proofing_apply_bom_material_text")
@JsonProperty(value = "materialJson",required = true)
private String proofingApplyBomMaterialText;
/**
* 替代组
*/
@Column(name = "proofing_apply_bom_alpgr")
@JsonProperty(value = "ALPGR",required = true)
private String proofingApplyBomAlpgr;
/**
* 替代优先级
*/
@Column(name = "proofing_apply_bom_alprf")
@JsonProperty(value = "ALPRF",required = true)
private Integer proofingApplyBomAlprf;
/**
* 策略
*/
@Column(name = "proofing_apply_bom_alpst")
@JsonProperty(value = "ALPST",required = true)
private String proofingApplyBomAlpst;
/**
* 使用概率
*/
@Column(name = "proofing_apply_bom_ewahr")
@JsonProperty(value = "EWAHR",required = true)
private Long proofingApplyBomEwahr;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }
\ No newline at end of file
package com.huigou.topsun.proofing.domain.proofingApply.query;
import com.huigou.data.domain.query.FlowBillSuperQueryRequest;
import lombok.Data;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
@Data
public class ProofingApplyBomQueryRequest extends FlowBillSuperQueryRequest {
/**
* 打样申请单BOMid
*/
private String proofingApplyBomId;
/**
* 产品物料组成id
*/
private String productMaterialId;
/**
* 打样申请单id
*/
private String proofingApplyId;
/**
* 数量
*/
private String proofingApplyBomNum;
/**
* 物料名称
*/
private String productMaterialName;
/**
* 组件计量单位
*/
private String proofingApplyBomMeins;
/**
* 组件报废百分比
*/
private Double proofingApplyBomAusch;
/**
* BOM项目文本(行1)
*/
private String proofingApplyBomText;
/**
* 物料清单项目文本(行2)
*/
private String proofingApplyBomMaterialText;
/**
* 替代组
*/
private String proofingApplyBomAlpgr;
/**
* 替代优先级
*/
private Integer proofingApplyBomAlprf;
/**
* 策略
*/
private String proofingApplyBomAlpst;
/**
* 使用概率
*/
private Long proofingApplyBomEwahr;
}
package com.huigou.topsun.proofing.domain.proofingMake.model; package com.huigou.topsun.proofing.domain.proofingMake.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
...@@ -12,7 +15,7 @@ import java.io.Serializable; ...@@ -12,7 +15,7 @@ import java.io.Serializable;
*/ */
@Table(name="proofing_make_bom") @Table(name="proofing_make_bom")
@Entity @Entity
@Data @JsonIgnoreProperties(ignoreUnknown = true)
public class ProofingMakeBom implements Serializable { public class ProofingMakeBom implements Serializable {
/** /**
* 打样制作单BOMid * 打样制作单BOMid
...@@ -26,31 +29,196 @@ public class ProofingMakeBom implements Serializable { ...@@ -26,31 +29,196 @@ public class ProofingMakeBom implements Serializable {
strategy = "guid" strategy = "guid"
) )
@Column(name = "proofing_make_bom_id") @Column(name = "proofing_make_bom_id")
@JsonIgnore
private String proofingMakeBomId; private String proofingMakeBomId;
/** /**
* 产品物料组成id * 产品物料组成id
*/ */
@Column(name = "product_material_id") @Column(name = "product_material_id")
@JsonProperty(value = "materialId",required = true)
private String productMaterialId; private String productMaterialId;
/** /**
* 打样制作单id * 打样制作单id
*/ */
@Column(name = "proofing_make_id") @Column(name = "proofing_make_id")
@JsonIgnore
private String proofingMakeId; private String proofingMakeId;
/** /**
* 数量 * 数量
*/ */
@Column(name = "proofing_make_bom_num") @Column(name = "proofing_make_bom_num")
@JsonProperty(value = "materialNumber",required = true)
private String proofingMakeBomNum; private String proofingMakeBomNum;
/** /**
* 物料名称 * 物料名称
*/ */
@Column(name = "product_material_name") @Column(name = "product_material_name")
@JsonProperty(value = "materialName",required = true)
private String productMaterialName; private String productMaterialName;
/**
* 组件计量单位
*/
@Column(name = "proofing_make_bom_meins")
@JsonProperty(value = "materialUnit",required = true)
private String proofingMakeBomMeins;
/**
* 组件报废百分比
*/
@Column(name = "proofing_make_bom_ausch")
@JsonProperty(value = "AUSCH",required = true)
private Double proofingMakeBomAusch;
/**
* BOM项目文本(行1)
*/
@Column(name = "proofing_make_bom_text")
@JsonProperty(value = "POTX1",required = true)
private String proofingMakeBomText;
/**
* 物料清单项目文本(行2)
*/
@Column(name = "proofing_make_bom_material_text")
@JsonProperty(value = "materialJson",required = true)
private String proofingMakeBomMaterialText;
/**
* 替代组
*/
@Column(name = "proofing_make_bom_alpgr")
@JsonProperty(value = "ALPGR",required = true)
private String proofingMakeBomAlpgr;
/**
* 替代优先级
*/
@Column(name = "proofing_make_bom_alprf")
@JsonProperty(value = "ALPRF",required = true)
private Integer proofingMakeBomAlprf;
/**
* 策略
*/
@Column(name = "proofing_make_bom_alpst")
@JsonProperty(value = "ALPST",required = true)
private String proofingMakeBomAlpst;
/**
* 使用概率
*/
@Column(name = "proofing_make_bom_ewahr")
@JsonProperty(value = "EWAHR",required = true)
private Long proofingMakeBomEwahr;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getProofingMakeBomId() {
return proofingMakeBomId;
}
public void setProofingMakeBomId(String proofingMakeBomId) {
this.proofingMakeBomId = proofingMakeBomId;
}
public String getProductMaterialId() {
return productMaterialId;
}
public void setProductMaterialId(String productMaterialId) {
this.productMaterialId = productMaterialId;
}
public String getProofingMakeId() {
return proofingMakeId;
}
public void setProofingMakeId(String proofingMakeId) {
this.proofingMakeId = proofingMakeId;
}
public String getProofingMakeBomNum() {
return proofingMakeBomNum;
}
public void setProofingMakeBomNum(String proofingMakeBomNum) {
this.proofingMakeBomNum = proofingMakeBomNum;
}
public String getProductMaterialName() {
return productMaterialName;
}
public void setProductMaterialName(String productMaterialName) {
this.productMaterialName = productMaterialName;
}
public String getProofingMakeBomMeins() {
return proofingMakeBomMeins;
}
public void setProofingMakeBomMeins(String proofingMakeBomMeins) {
this.proofingMakeBomMeins = proofingMakeBomMeins;
}
public Double getProofingMakeBomAusch() {
return proofingMakeBomAusch;
}
public void setProofingMakeBomAusch(Double proofingMakeBomAusch) {
this.proofingMakeBomAusch = proofingMakeBomAusch;
}
public String getProofingMakeBomText() {
return proofingMakeBomText;
}
public void setProofingMakeBomText(String proofingMakeBomText) {
this.proofingMakeBomText = proofingMakeBomText;
}
public String getProofingMakeBomMaterialText() {
return proofingMakeBomMaterialText;
}
public void setProofingMakeBomMaterialText(String proofingMakeBomMaterialText) {
this.proofingMakeBomMaterialText = proofingMakeBomMaterialText;
}
public String getProofingMakeBomAlpgr() {
return proofingMakeBomAlpgr;
}
public void setProofingMakeBomAlpgr(String proofingMakeBomAlpgr) {
this.proofingMakeBomAlpgr = proofingMakeBomAlpgr;
}
public Integer getProofingMakeBomAlprf() {
return proofingMakeBomAlprf;
}
public void setProofingMakeBomAlprf(Integer proofingMakeBomAlprf) {
this.proofingMakeBomAlprf = proofingMakeBomAlprf;
}
public String getProofingMakeBomAlpst() {
return proofingMakeBomAlpst;
}
public void setProofingMakeBomAlpst(String proofingMakeBomAlpst) {
this.proofingMakeBomAlpst = proofingMakeBomAlpst;
}
public Long getProofingMakeBomEwahr() {
return proofingMakeBomEwahr;
}
public void setProofingMakeBomEwahr(Long proofingMakeBomEwahr) {
this.proofingMakeBomEwahr = proofingMakeBomEwahr;
}
} }
\ No newline at end of file
[
{
"IDNRK": "1",
"MENGE": "1",
"MEINS": "张",
"AUSCH": 1.0,
"POTX1": "1",
"POTX2": "相关内容11",
"ALPGR": "1",
"ALPRF": 1,
"ALPST": "1",
"EWAHR": 1
},
{
"IDNRK": "2",
"MENGE": "2",
"MEINS": "张",
"AUSCH": 2.0,
"POTX1": "2",
"POTX2": "相关内容22",
"ALPGR": "2",
"ALPRF": 2,
"ALPST": "2",
"EWAHR": 2
}
]
\ No newline at end of file
package com.huigou.topsun.proofing.domain.proofingMake.query;
import com.huigou.data.domain.query.FlowBillSuperQueryRequest;
import com.huigou.data.domain.query.QueryAbstractRequest;
import lombok.Data;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
@Data
public class ProofingMakeBomQueryRequest extends QueryAbstractRequest {
/**
* 打样制作单BOMid
*/
private String proofingMakeBomId;
/**
* 产品物料组成id
*/
private String productMaterialId;
/**
* 打样制作单id
*/
private String proofingMakeId;
/**
* 数量
*/
private String proofingMakeBomNum;
/**
* 物料名称
*/
private String productMaterialName;
/**
* 组件计量单位
*/
private String proofingMakeBomMeins;
/**
* 组件报废百分比
*/
private Double proofingMakeBomAusch;
/**
* BOM项目文本(行1)
*/
private String proofingMakeBomText;
/**
* 物料清单项目文本(行2)
*/
private String proofingMakeBomMaterialText;
/**
* 替代组
*/
private String proofingMakeBomAlpgr;
/**
* 替代优先级
*/
private Integer proofingMakeBomAlprf;
/**
* 策略
*/
private String proofingMakeBomAlpst;
/**
* 使用概率
*/
private Long proofingMakeBomEwahr;
}
package com.huigou.topsun.proofing.repository.proofingApply;
import com.huigou.topsun.proofing.domain.proofingApply.model.ProofingApplyBom;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
public interface ProofingApplyBomRepository extends JpaRepository<ProofingApplyBom,String> {
}
package com.huigou.topsun.proofing.repository.proofingMake;
import com.huigou.topsun.proofing.domain.proofingMake.model.ProofingMakeBom;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* title:
* author:ZHT
* date:2024/1/3
* description:
*/
public interface ProofingMakeBomRepository extends JpaRepository<ProofingMakeBom, String> {
}
...@@ -66,4 +66,10 @@ ...@@ -66,4 +66,10 @@
<condition column="proofing_apply_technology_id" name="proofingApplyTechnologyId" type="java.lang.String" symbol="=" alias="t"/> <condition column="proofing_apply_technology_id" name="proofingApplyTechnologyId" type="java.lang.String" symbol="=" alias="t"/>
</query> </query>
<query name="slicedProofingApplyBom" table="proofing_apply_bom">
<sql-query>
select t.* from proofing_apply_bom t
</sql-query>
<condition column="proofing_apply_id" name="proofingApplyId" type="java.lang.String" symbol="=" alias="t"/>
</query>
</query-mappings> </query-mappings>
\ No newline at end of file
...@@ -39,4 +39,11 @@ ...@@ -39,4 +39,11 @@
<!-- work_instruction_apply wa--> <!-- work_instruction_apply wa-->
<!-- </sql-query>--> <!-- </sql-query>-->
<!-- </query>--> <!-- </query>-->
<query name="slicedProofingMakeBom" table="proofing_make_bom">
<sql-query>
select t.* from proofing_make_bom t
</sql-query>
<condition column="proofing_make_id" name="proofingMakeId" type="java.lang.String" symbol="=" alias="t"/>
</query>
</query-mappings> </query-mappings>
\ No newline at end of file
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