Commit 2922bea9 authored by 覃振观's avatar 覃振观 👶

提交22222

parent a22bbc52
...@@ -23,6 +23,7 @@ function buildMapping(dataMapping, rawData) { ...@@ -23,6 +23,7 @@ function buildMapping(dataMapping, rawData) {
}else { }else {
window.dataSet.isInsert = false; window.dataSet.isInsert = false;
} }
inputEventListener();
return mapping(rawData); return mapping(rawData);
} }
...@@ -233,7 +234,7 @@ function checkArrayMapper(str) { ...@@ -233,7 +234,7 @@ function checkArrayMapper(str) {
* @private * @private
*/ */
function onBeforeEdit_(options) { function onBeforeEdit_(options) {
const originalOnBeforeEdit = options.onBeforeEdit; const originalOnBeforeEdit = !options.onBeforeEdit ? ()=>{} : options.onBeforeEdit ;
options.onBeforeEdit = function(editParm, gg){ options.onBeforeEdit = function(editParm, gg){
let domIds = editParm.column.__domid.split('|'), colName = editParm.column.name; let domIds = editParm.column.__domid.split('|'), colName = editParm.column.name;
let mapper = window.dataMapping.mapper; let mapper = window.dataMapping.mapper;
...@@ -298,7 +299,7 @@ function settingEditDomStyle(eleId, inputVal, width) { ...@@ -298,7 +299,7 @@ function settingEditDomStyle(eleId, inputVal, width) {
* @param options * @param options
*/ */
function listeningSearchbox(elId, options, gridId) { function listeningSearchbox(elId, options, gridId) {
const originalOnChange = options.onChange; const originalOnChange = !options.onChange ? ()=>{} : options.onChange;
options.onChange = function(value, data, gridManager) { options.onChange = function(value, data, gridManager) {
let eleName = this.element[0].name, beanName = ''; let eleName = this.element[0].name, beanName = '';
let currentMapper = window.dataMapping.mapper[eleName]; let currentMapper = window.dataMapping.mapper[eleName];
...@@ -306,12 +307,14 @@ function listeningSearchbox(elId, options, gridId) { ...@@ -306,12 +307,14 @@ function listeningSearchbox(elId, options, gridId) {
console.error("找不到该映射,请检查映射配置是否存在该配置: "+ eleName); console.error("找不到该映射,请检查映射配置是否存在该配置: "+ eleName);
} }
Object.entries(currentMapper).forEach(mapper => { Object.entries(currentMapper).forEach(mapper => {
debugger;
let property = ""; let property = "";
if(eleName.split('_').length > 1) { if(eleName.split('_').length > 1) {
property = eleName.split('_')[1]; property = eleName.split('_')[1];
} else { } else {
beanName = mapper[0];
property = mapper[1]; property = mapper[1];
}
beanName = mapper[0];
if(typeof property== 'string') { if(typeof property== 'string') {
// ------------------ Form 下拉框执行此逻辑 ------------------ // ------------------ Form 下拉框执行此逻辑 ------------------
window.dataSet.newData[beanName][property] = data[property]; window.dataSet.newData[beanName][property] = data[property];
...@@ -342,8 +345,6 @@ function listeningSearchbox(elId, options, gridId) { ...@@ -342,8 +345,6 @@ function listeningSearchbox(elId, options, gridId) {
} }
} }
}
}) })
originalOnChange.call(this, value, data, gridManager); originalOnChange.call(this, value, data, gridManager);
} }
...@@ -391,10 +392,9 @@ function listeningGrid(elId, options) { ...@@ -391,10 +392,9 @@ function listeningGrid(elId, options) {
return; return;
} }
options.columns.unshift({ name: 'rowIndex', hide: true }); options.columns.unshift({ name: 'rowIndex', hide: true });
debugger;
let data = {}; let data = {};
if(!options.data){ if(!options.data){
console.error('listeningGrid 必须传入 Data !请检查'); console.error('listeningGrid 必须传入 Data !请检查 : ' + elId);
data.Rows = ''; data.Rows = '';
} else { data.Rows = options.data.raw; } } else { data.Rows = options.data.raw; }
options.data = data; options.data = data;
...@@ -408,7 +408,7 @@ function listeningGrid(elId, options) { ...@@ -408,7 +408,7 @@ function listeningGrid(elId, options) {
// ------------------ Grid 新增行时,设置 mapper、 newData ----------------- // ------------------ Grid 新增行时,设置 mapper、 newData -----------------
if(but.id === "menuAdd") { if(but.id === "menuAdd") {
// 使用 gridManager 对象 可以省略 页面监听操作。需要修改。 // 使用 gridManager 对象 可以省略 页面监听操作。需要修改。
const originalOnClick = but.click; const originalOnClick = !but.click ? ()=>{} : but.click;
but.click = function() { but.click = function() {
let currentMapper = checkArrayMapper(elId); let currentMapper = checkArrayMapper(elId);
let beanName = currentMapper.beanName; let beanName = currentMapper.beanName;
...@@ -443,7 +443,7 @@ function listeningGrid(elId, options) { ...@@ -443,7 +443,7 @@ function listeningGrid(elId, options) {
} }
} }
if(but.id === "menuDelete") { if(but.id === "menuDelete") {
const originalOnClick = but.click; const originalOnClick = !but.click ? ()=>{} : but.click;
but.click = function() { but.click = function() {
let selectRows = gridManager.getSelectedRows(); let selectRows = gridManager.getSelectedRows();
selectRows.forEach(row => { selectRows.forEach(row => {
...@@ -527,6 +527,7 @@ function listenerContent(event) { ...@@ -527,6 +527,7 @@ function listenerContent(event) {
} }
// Form 时执行此逻辑 // Form 时执行此逻辑
if(control === 'form') { if(control === 'form') {
debugger;
let mappings = Object.entries(beanMapping); let mappings = Object.entries(beanMapping);
tryForEach(mappings, (entry) => { tryForEach(mappings, (entry) => {
let beanName = entry[0]; let beanName = entry[0];
......
...@@ -48,8 +48,8 @@ function initializateSelectC() { ...@@ -48,8 +48,8 @@ function initializateSelectC() {
},function (data) { },function (data) {
let showData = refreshMapping(dataMapping, 'processed', data); let showData = refreshMapping(dataMapping, 'processed', data);
$('#submitForm').formClean(); // $('#submitForm').formClean();
$('#submitForm').formSet(showData); // $('#submitForm').formSet(showData);
processedGrid('#processedGrid', window.dataSet.rawData.processed); processedGrid('#processedGrid', window.dataSet.rawData.processed);
}); });
// $('#selectedTechnology').val(data.productTechnologyName) // $('#selectedTechnology').val(data.productTechnologyName)
...@@ -58,6 +58,7 @@ function initializateSelectC() { ...@@ -58,6 +58,7 @@ function initializateSelectC() {
} }
function initGridSearchbox() { function initGridSearchbox() {
listeningGridSearchbox('fronColorsGrid_colorName', { listeningGridSearchbox('fronColorsGrid_colorName', {
type: "product", type: "product",
name: "color", name: "color",
...@@ -135,18 +136,11 @@ function loadData() { ...@@ -135,18 +136,11 @@ function loadData() {
let showData = buildMapping(dataMapping, data.rawData); let showData = buildMapping(dataMapping, data.rawData);
$('#submitForm').formSet(showData); $('#submitForm').formSet(showData);
if(window.dataSet.isInsert) {
// Grid 使用 Local 模式,data 不能为 undefined
data.rawData = {};
data.rawData.fronColors = {};
data.rawData.backColors = {};
data.rawData.processed = {};
}
faceGrid("#fronColorsGrid", data.rawData.fronColors); faceGrid("#fronColorsGrid", data.rawData.fronColors);
faceGrid("#backColorsGrid", data.rawData.backColors); faceGrid("#backColorsGrid", data.rawData.backColors);
processedGrid('#processedGrid', data.rawData.processed); processedGrid('#processedGrid', data.rawData.processed);
productLossGrid('#productLossGrid', data.rawData.productLoss); productLossGrid('#productLossGrid', data.rawData.productLoss);
inputEventListener();
}); });
} }
...@@ -157,7 +151,7 @@ function loadData() { ...@@ -157,7 +151,7 @@ function loadData() {
// Grid: 需要监听 Grid Data 时,必须设置 唯一 id 列。 // Grid: 需要监听 Grid Data 时,必须设置 唯一 id 列。
var dataMapping = { var dataMapping = {
Product: [ Product: [
"productId", "brandName","productCategoryId", "productUnit", "productSizeGroupId" "productId", "brandName","productCategoryId", "productUnit", "productSizeGroupId", "productName"
, "isOnlyCode", "isBodyColor", "isDisable", "isBuildBom" , "isOnlyCode", "isBodyColor", "isDisable", "isBuildBom"
, "confirmDate", "comfirmPerson" , "confirmDate", "comfirmPerson"
, "isFreeInspection", "isNoQualityLoss", "sampleOrderNo", "stockNo", "fileNo", "brandName" , "isFreeInspection", "isNoQualityLoss", "sampleOrderNo", "stockNo", "fileNo", "brandName"
...@@ -204,6 +198,7 @@ var dataMapping = { ...@@ -204,6 +198,7 @@ var dataMapping = {
} }
function faceGrid(elId, data) { function faceGrid(elId, data) {
if(data === undefined) { data = {}; }
var toolbarOptions = UICtrl.getDefaultToolbarOptions({ var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(rawData, gridManager){ addHandler: function(rawData, gridManager){
let isBack = true; let isBack = true;
...@@ -222,30 +217,26 @@ function faceGrid(elId, data) { ...@@ -222,30 +217,26 @@ function faceGrid(elId, data) {
console.log(rowData.rowIndex); console.log(rowData.rowIndex);
}, },
}); });
var gridManager = listeningGrid(elId, { listeningGrid(elId, {
columns: [ columns: [
{ display: "颜色名称", name: "colorName", width: 140, minWidth: 60, type: "string", align: "left", { display: "颜色名称", name: "colorName", width: 140, minWidth: 60, type: "string", align: "left",
editor: { type: 'select', fillProperty: 'colorId'} }, editor: { type: 'select', fillProperty: 'colorId'} },
{ display: "油墨覆盖率(%)", name: "coverageRate", width: 120, minWidth: 60, type: "string", align: "left", editor: { type: 'text'} } { display: "油墨覆盖率(%)", name: "coverageRate", width: 120, minWidth: 60, type: "string", align: "left",
editor: { type: 'text'} }
], ],
toolbar: toolbarOptions, toolbar: toolbarOptions,
dataType: "local", dataType: "local",
data: data, // data 数据结构 data: ("Rows": [ {}, {} ]) data: data,
enabledEdit: true, enabledEdit: true,
checkbox: true, checkbox: true,
usePager: false, usePager: false,
width: "98%", width: "98%",
height: "90%", height: "90%",
onBeforeEdit : function(editParm, gg) {
console.log('original run onBeforeEdit()');
},
onBeforeSubmitEdit: function(editParm, gg){
// debugger;
},
}); });
} }
function processedGrid(elId, data) { function processedGrid(elId, data) {
if(data === undefined) { data = {}; }
// var toolbarOptions = UICtrl.getDefaultToolbarOptions({ // var toolbarOptions = UICtrl.getDefaultToolbarOptions({
// addHandler: function(){ // addHandler: function(){
// }, // },
...@@ -287,6 +278,7 @@ function processedGrid(elId, data) { ...@@ -287,6 +278,7 @@ function processedGrid(elId, data) {
} }
function productLossGrid(elId, data) { function productLossGrid(elId, data) {
if(data === undefined) { data = {}; }
var toolbarOptions = UICtrl.getDefaultToolbarOptions({ var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(rawData){ addHandler: function(rawData){
}, },
......
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
<x:inputC name="netPlateNo" label="网版编号" labelCol="1" fieldCol="3" maxLength="64" /> <x:inputC name="netPlateNo" label="网版编号" labelCol="1" fieldCol="3" maxLength="64" />
</div> </div>
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="technology_productId" title="productId" id = "selectedTechnology" label="制程工艺" labelCol="1" <x:inputC name="technology_productId" id = "selectedTechnology" label="制程工艺" labelCol="1"
fieldCol="3" wrapper="select" maxLength="64" /> fieldCol="3" wrapper="select" maxLength="64" />
<x:inputC name="productProperty" label="产品性质" labelCol="1" fieldCol="3" maxLength="64" /> <x:inputC name="productProperty" label="产品性质" labelCol="1" fieldCol="3" maxLength="64" />
<x:inputC name="productTechnologyRequire" label="工艺要求" labelCol="1" fieldCol="3" <x:inputC name="productTechnologyRequire" label="工艺要求" labelCol="1" fieldCol="3"
......
...@@ -74,6 +74,14 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp ...@@ -74,6 +74,14 @@ public class ProductApplicationImpl extends BaseApplication implements ProductAp
*/ */
@Override @Override
public Map<String, Object> queryDetailAll(Product product) { public Map<String, Object> queryDetailAll(Product product) {
// EntityGraph<Product> entityGraph = entityManager.createEntityGraph(Product.class);
// entityGraph.addAttributeNodes("productDetail");
//
// Map<String, Object> properties = new HashMap<>();
// properties.put("javax.persistence.fetchgraph", entityGraph);
//
// Product product3 = entityManager.find(Product.class, product.getProductId(), properties);
Map<String, Object> resultMap = new HashMap<>(200); Map<String, Object> resultMap = new HashMap<>(200);
BigDecimal productId = product.getProductId(); BigDecimal productId = product.getProductId();
ProductDetail productDetail = detailRepository.findByProductId(productId); ProductDetail productDetail = detailRepository.findByProductId(productId);
......
...@@ -8,10 +8,7 @@ import com.huigou.topsun.common.NumberToStringSerializer; ...@@ -8,10 +8,7 @@ import com.huigou.topsun.common.NumberToStringSerializer;
import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.HashCodeBuilder;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -25,6 +22,9 @@ import java.math.BigDecimal; ...@@ -25,6 +22,9 @@ import java.math.BigDecimal;
@Table(name = "product") @Table(name = "product")
public class Product implements Serializable { public class Product implements Serializable {
@OneToOne(mappedBy = "product")
private ProductDetail productDetail;
/** /**
* 产品ID * 产品ID
*/ */
...@@ -161,6 +161,14 @@ public class Product implements Serializable { ...@@ -161,6 +161,14 @@ public class Product implements Serializable {
@Column(name = "file_no", nullable = true, length = 255) @Column(name = "file_no", nullable = true, length = 255)
private String fileNo; private String fileNo;
public ProductDetail getProductDetail() {
return productDetail;
}
public void setProductDetail(ProductDetail productDetail) {
this.productDetail = productDetail;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
......
...@@ -7,10 +7,7 @@ import com.huigou.topsun.common.NumberToStringSerializer; ...@@ -7,10 +7,7 @@ import com.huigou.topsun.common.NumberToStringSerializer;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
import javax.persistence.Column; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -24,6 +21,10 @@ import java.math.BigDecimal; ...@@ -24,6 +21,10 @@ import java.math.BigDecimal;
@Table(name = "product_detail") @Table(name = "product_detail")
public class ProductDetail implements Serializable { public class ProductDetail implements Serializable {
@OneToOne
@JoinColumn(name = "product_id", nullable = false)
private Product product;
/** /**
* 产品详细信息ID * 产品详细信息ID
*/ */
......
...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; ...@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.huigou.topsun.common.NumberToStringSerializer; import com.huigou.topsun.common.NumberToStringSerializer;
import org.hibernate.annotations.Formula;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
...@@ -51,7 +52,7 @@ public class ProductFaceColor implements Serializable { ...@@ -51,7 +52,7 @@ public class ProductFaceColor implements Serializable {
@Column(name = "sort_order", nullable = true) @Column(name = "sort_order", nullable = true)
private Integer sortOrder; private Integer sortOrder;
@Transient @Formula("(select c.color_name from color c where c.color_id = color_id)")
private String colorName; private String colorName;
public BigDecimal getProductFaceColorId() { public BigDecimal getProductFaceColorId() {
......
...@@ -2,6 +2,8 @@ package com.huigou.topsun.product.repository; ...@@ -2,6 +2,8 @@ package com.huigou.topsun.product.repository;
import com.huigou.topsun.product.domain.ProductPublishedConf; import com.huigou.topsun.product.domain.ProductPublishedConf;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.math.BigDecimal; import java.math.BigDecimal;
......
...@@ -3,7 +3,6 @@ package com.huigou.topsun.quotation.application.impl; ...@@ -3,7 +3,6 @@ package com.huigou.topsun.quotation.application.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.huigou.cache.SystemCache; import com.huigou.cache.SystemCache;
import com.huigou.data.query.model.QueryDescriptor; import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.product.domain.Product;
import com.huigou.topsun.product.repository.ProductRepository; import com.huigou.topsun.product.repository.ProductRepository;
import com.huigou.topsun.quotation.application.QuotationItemApplication; import com.huigou.topsun.quotation.application.QuotationItemApplication;
import com.huigou.topsun.quotation.domain.model.Quotation; import com.huigou.topsun.quotation.domain.model.Quotation;
...@@ -21,18 +20,11 @@ import org.activiti.engine.delegate.DelegateTask; ...@@ -21,18 +20,11 @@ import org.activiti.engine.delegate.DelegateTask;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.Instant;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.activiti.engine.impl.util.CollectionUtil.map;
/** /**
* @author 16508 * @author 16508
* @description 针对表【quotation(报价单)】的数据库操作Service实现 * @description 针对表【quotation(报价单)】的数据库操作Service实现
......
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