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

提交22222

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