Commit a5d0e06e authored by 刘学辉's avatar 刘学辉

Merge remote-tracking branch 'origin/dev' into dev

parents 33acc4de 9d7fe8f8
...@@ -27,14 +27,37 @@ function bindEvent(){ ...@@ -27,14 +27,37 @@ function bindEvent(){
$('#pd').searchbox({ $('#pd').searchbox({
type: "system", name: "queryPd", type: "system", name: "queryPd",
checkbox:true,
checkboxIndex:"productCode",
textIndex:"productName",
valueIndex:"productCode",
getParam: function (item) { getParam: function (item) {
return { return {
filterValue:$("#brandCode").val() filterValue:$("#brandCode").val()
} }
}, },
onChange: function (value, data) { onChange: function (value, data) {
$('#pd').val(data.productCode); $('#pd').val(value.value);
$('#productName').val(data.productName); $('#productName').val(value.text);
}
});
$('#process').searchbox({
type: "system", name: "queryProductAndBom",
// checkbox:true,
// checkboxIndex:"process",
// textIndex:"material,",
// valueIndex:"process",
// idIndex:"productionSolutionId",
getParam: function (item) {
return {
filterValue:$('#pd').val()
}
},
onChange: function (value, data) {
$('#process').val(data.process);
$('#material').val(value.material);
$('#productionSolutionId').val(value.productionSolutionId);
} }
}); });
...@@ -60,17 +83,32 @@ function loadGrid() { ...@@ -60,17 +83,32 @@ function loadGrid() {
}); });
gridManager = UICtrl.grid("#maingrid", { gridManager = UICtrl.grid("#maingrid", {
columns: [ columns: [
{display : "部门",name : "deptName",width : 200,minWidth : 100,type : "string",align : "left",
editor: { required : true, type: "dynamic",
getEditor:function (row) {
var org = "return { type:'tree',data:{name:'org',filter:'ogn',getParam:function(){return {orgRoot:'orgRoot',orgKindId:'ogn'};}},textField:'deptName',valueField:'deptId' }";
org = (new Function(org))();
return org;
}
}
},
{ {
display: "部门", name: "deptName", width: 200, minWidth: 60, type: "string", align: "left", display: "部门", name: "deptId", width: 200, minWidth: 60, type: "string", align: "left",
editor: { editor: {
type: 'tree', type: 'tree',
required: true, required: true,
data: { data: {
name: 'org', name: 'org',
filter: 'dpt', filter: 'ogn,dpt',
minWidth: 250 minWidth: 250,
}, getParam:function(){
textField: 'deptName' return {
orgRoot: "orgRoot",
orgKindId: "ogn,dpt"
}
},
},
textField: 'deptId'
} }
}, },
{ {
...@@ -78,13 +116,14 @@ function loadGrid() { ...@@ -78,13 +116,14 @@ function loadGrid() {
editor: { editor: {
type: 'tree', type: 'tree',
required: true, required: true,
checkbox: true,
data: { data: {
name: 'org', name: 'org',
filter: 'psm', filter: 'psm',
minWidth: 250 minWidth: 250
}, },
textField: 'executor', textField: 'executor',
//valueField: 'userCode' valueField: 'executorId'
} }
}, },
{ {
......
...@@ -42,13 +42,14 @@ ...@@ -42,13 +42,14 @@
<x:inputC name="pd" required="true" label="产品代号" labelCol="2" maxLength="64" fieldCol="10" wrapper="select"/> <x:inputC name="pd" required="true" label="产品代号" labelCol="2" maxLength="64" fieldCol="10" wrapper="select"/>
</div> </div>
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="productName" required="true" label="产品名称" labelCol="2" fieldCol="10"/> <x:inputC name="productName" required="true" label="产品名称" labelCol="2" fieldCol="10" readonly="true"/>
</div> </div>
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="process" required="true" label="制程工艺" labelCol="2" fieldCol="10"/> <x:inputC name="process" required="true" label="制程工艺" labelCol="2" fieldCol="10" wrapper="select"/>
<x:hidden name="productionSolutionId"/>
</div> </div>
<div class="hg-form-row"> <div class="hg-form-row">
<x:textareaC name="material" required="true" label="原材料" labelCol="2" fieldCol="10" rows="3"/> <x:textareaC name="material" required="true" label="原材料" labelCol="2" fieldCol="10" rows="3" readonly="true"/>
</div> </div>
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="others" required="true" label="其他" labelCol="2" fieldCol="10"/> <x:inputC name="others" required="true" label="其他" labelCol="2" fieldCol="10"/>
......
...@@ -387,10 +387,10 @@ var tableArray = [ ...@@ -387,10 +387,10 @@ var tableArray = [
minwidth: 120, minwidth: 120,
type: "money", type: "money",
align: "left", align: "left",
editor: { // editor: {
mask: 'nnnnnnnnn.nn', // mask: 'nnnnnnnnn.nn',
type: 'text' // type: 'text'
} // }
}, },
{ {
display: "税额(审批-本位币)", display: "税额(审批-本位币)",
...@@ -399,10 +399,10 @@ var tableArray = [ ...@@ -399,10 +399,10 @@ var tableArray = [
minwidth: 120, minwidth: 120,
type: "money", type: "money",
align: "left", align: "left",
editor: { // editor: {
mask: 'nnnnnnnnn.nn', // mask: 'nnnnnnnnn.nn',
type: 'text' // type: 'text'
} // }
}, },
{ {
display: "含税金额(审批-本位币)", display: "含税金额(审批-本位币)",
...@@ -411,10 +411,10 @@ var tableArray = [ ...@@ -411,10 +411,10 @@ var tableArray = [
minwidth: 120, minwidth: 120,
type: "money", type: "money",
align: "left", align: "left",
editor: { // editor: {
mask: 'nnnnnnnnn.nn', // mask: 'nnnnnnnnn.nn',
type: 'text' // type: 'text'
} // }
}, },
{ {
display: "是否付款", name: "zepPay", width: 120, minwidth: 120, type: "string", align: "left", display: "是否付款", name: "zepPay", width: 120, minwidth: 120, type: "string", align: "left",
......
...@@ -44,6 +44,7 @@ function bindEvent(){ ...@@ -44,6 +44,7 @@ function bindEvent(){
$("#applyPersonName").orgTree({ $("#applyPersonName").orgTree({
checkbox : false, checkbox : false,
tree:{autoCheckboxEven:true}, tree:{autoCheckboxEven:true},
filter: 'psm',
getParam : function() { getParam : function() {
return { return {
orgRoot:'orgRoot', orgRoot:'orgRoot',
......
...@@ -527,9 +527,9 @@ function getExtendedData(processAction) { ...@@ -527,9 +527,9 @@ function getExtendedData(processAction) {
} }
extendedData.suppliersPayList = Public.encodeJSONURI(datas); extendedData.suppliersPayList = Public.encodeJSONURI(datas);
} }
var _grid = UICtrl.getGridManager('#sapSuppliersBuyerGrid'); var buy_grid = UICtrl.getGridManager('#sapSuppliersBuyerGrid');
if (_grid) { if (buy_grid) {
var rows = _grid.getData(); var rows = buy_grid.getData();
for (var i = 0; i < rows.length; i++) { for (var i = 0; i < rows.length; i++) {
var row = rows[i]; var row = rows[i];
if (row.Inco1 != ""&&row.Inco2L=="") { if (row.Inco1 != ""&&row.Inco2L=="") {
...@@ -538,7 +538,7 @@ function getExtendedData(processAction) { ...@@ -538,7 +538,7 @@ function getExtendedData(processAction) {
} }
} }
var datas = DataUtil.getGridData({ var datas = DataUtil.getGridData({
gridManager: _grid, gridManager: buy_grid,
isAllData: isAllData isAllData: isAllData
}); });
if (!datas) { if (!datas) {
...@@ -546,10 +546,10 @@ function getExtendedData(processAction) { ...@@ -546,10 +546,10 @@ function getExtendedData(processAction) {
} }
extendedData.suppliersBuyerList = Public.encodeJSONURI(datas); extendedData.suppliersBuyerList = Public.encodeJSONURI(datas);
} }
var _grid = UICtrl.getGridManager('#sapSuppliersBankGrid'); var bank_grid = UICtrl.getGridManager('#sapSuppliersBankGrid');
if (_grid) { if (bank_grid) {
var datas = DataUtil.getGridData({ var datas = DataUtil.getGridData({
gridManager: _grid, gridManager: bank_grid,
isAllData: isAllData isAllData: isAllData
}); });
if (!datas) { if (!datas) {
...@@ -577,12 +577,27 @@ function checkConstraints(){ ...@@ -577,12 +577,27 @@ function checkConstraints(){
return false; return false;
} }
} }
//银行信息
var bank_grid = UICtrl.getGridManager('#sapSuppliersBankGrid');
if (bank_grid) {
var datas = DataUtil.getGridData({
gridManager: bank_grid,
isAllData: true
});
if (!datas) {
return false;
}
if (isApproveProcUnit() && datas.length == 0 && "2" != getHandleResult()){
Public.tip("供应商银行银行信息必填");
return false;
}
}
if ("cashier" == getSubProcUnitId() || "finance" == getSubProcUnitId()){ if ("cashier" == getSubProcUnitId() || "finance" == getSubProcUnitId()){
//付款信息 //付款信息
var _grid = UICtrl.getGridManager('#sapSuppliersPayGrid'); var pay_grid = UICtrl.getGridManager('#sapSuppliersPayGrid');
if (_grid) { if (pay_grid) {
var datas = DataUtil.getGridData({ var datas = DataUtil.getGridData({
gridManager: _grid, gridManager: pay_grid,
isAllData: true isAllData: true
}); });
if (!datas) { if (!datas) {
...@@ -593,21 +608,6 @@ function checkConstraints(){ ...@@ -593,21 +608,6 @@ function checkConstraints(){
return false; return false;
} }
} }
//银行信息
var _grid = UICtrl.getGridManager('#sapSuppliersBankGrid');
if (_grid) {
var datas = DataUtil.getGridData({
gridManager: _grid,
isAllData: true
});
if (!datas) {
return false;
}
if (isApproveProcUnit() && datas.length == 0 && "2" != getHandleResult()){
Public.tip("供应商银行银行信息必填");
return false;
}
}
} }
return true; return true;
} }
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<x:inputC name="strSuppl3" label="街道4" labelCol="1" fieldCol="2"/>--%> <x:inputC name="strSuppl3" label="街道4" labelCol="1" fieldCol="2"/>--%>
<x:inputC name="land1Name" label="国家" labelCol="1" fieldCol="2" required="true" wrapper="select"/> <x:inputC name="land1Name" label="国家" labelCol="1" fieldCol="2" required="true" wrapper="select"/>
<x:hidden name="land1"/> <x:hidden name="land1"/>
<x:inputC name="regionName" label="地区" labelCol="1" fieldCol="2" required="true" wrapper="select"/> <x:inputC name="regionName" label="地区" labelCol="1" fieldCol="2" required="false" wrapper="select"/>
<x:hidden name="region"/> <x:hidden name="region"/>
<x:inputC name="city1" label="城市" labelCol="1" fieldCol="2" required="true" /> <x:inputC name="city1" label="城市" labelCol="1" fieldCol="2" required="true" />
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<div id="sapSuppliersBuyerGrid" style="margin: 2px;"></div> <div id="sapSuppliersBuyerGrid" style="margin: 2px;"></div>
<div id="cashierGrid"> <div id="cashierGrid">
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
<x:title title="供应商付款信息" name="group"/> <x:title title="供应商公司信息" name="group"/>
<div id="sapSuppliersPayGrid" style="margin: 2px;"></div> <div id="sapSuppliersPayGrid" style="margin: 2px;"></div>
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
<x:title title="供应商银行银行信息" name="group"/> <x:title title="供应商银行银行信息" name="group"/>
......
...@@ -108,6 +108,12 @@ public class EpChangeForm extends FlowBillAbstractEntity { ...@@ -108,6 +108,12 @@ public class EpChangeForm extends FlowBillAbstractEntity {
@Column(name = "changed_others") @Column(name = "changed_others")
private String changedOthers; private String changedOthers;
/**
* 版本id
*/
@Column(name = "production_solution_id")
private String productionSolutionId;
@Override @Override
protected String getCodeRuleId() { protected String getCodeRuleId() {
return "epChangeForm"; return "epChangeForm";
......
...@@ -42,4 +42,13 @@ public class EpResourceSearchController { ...@@ -42,4 +42,13 @@ public class EpResourceSearchController {
mapList = epApplication.queryEpPd(filterValue); mapList = epApplication.queryEpPd(filterValue);
return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "queryProductAndBom")
public Map<String, Object> queryProductAndBom(SDO sdo) throws IOException {
String param = sdo.getString("paramValue");
String filterValue = sdo.getString("filterValue");
List<Map<String, String>> mapList = new ArrayList<>();
mapList = epApplication.queryProductAndBom(filterValue);
return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
}
} }
...@@ -12,4 +12,6 @@ public interface EpApplication { ...@@ -12,4 +12,6 @@ public interface EpApplication {
List<Map<String, String>> queryEpBrand(String brandName); List<Map<String, String>> queryEpBrand(String brandName);
List<Map<String, String>> queryEpPd(String brandCode); List<Map<String, String>> queryEpPd(String brandCode);
List<Map<String, String>> queryProductAndBom(String itemCode);
} }
package com.huigou.topsun.ep.epApplication.impl; package com.huigou.topsun.ep.epApplication.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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;
import com.huigou.topsun.ep.epApplication.EpApplication; import com.huigou.topsun.ep.epApplication.EpApplication;
import com.huigou.topsun.sap.common.HttpClient; import com.huigou.topsun.sap.common.HttpClient;
import com.huigou.topsun.sap.common.domain.SapResult;
import com.huigou.topsun.util.SAPUtils; import com.huigou.topsun.util.SAPUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @Auther: xin.lu * @Auther: xin.lu
...@@ -34,12 +29,12 @@ public class EpApplicationImpl implements EpApplication { ...@@ -34,12 +29,12 @@ public class EpApplicationImpl implements EpApplication {
String message = ""; String message = "";
try { try {
String executeForEp = httpClient.executeForEp(map, "md/brand/queryAllEnableBrand"); String executeForEp = httpClient.executeForEp(map, "md/brand/queryAllEnableBrand");
Map<String, String> resultMap = JSONObject.parseObject(executeForEp, Map.class); Map<String, Object> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code"))) { if ("200".equals(resultMap.get("code").toString())) {
ObjectMapper objectMapper = SAPUtils.objectMapper(); ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {}); mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else { }else {
message = resultMap.get("msg"); message = (String) resultMap.get("msg");
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("查询品牌出错:" + message); throw new RuntimeException("查询品牌出错:" + message);
...@@ -50,21 +45,42 @@ public class EpApplicationImpl implements EpApplication { ...@@ -50,21 +45,42 @@ public class EpApplicationImpl implements EpApplication {
@Override @Override
public List<Map<String, String>> queryEpPd(String brandCode) { public List<Map<String, String>> queryEpPd(String brandCode) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("brandCode",brandCode); //map.put("brandCode",brandCode);
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
String message = ""; String message = "";
try { try {
String executeForEp = httpClient.executeForEp(map, "md/mditem/queryProductByBrandCode"); String executeForEp = httpClient.executeForEp(map, "md/mdItem/queryProductByBrandCode?brandCode="+brandCode);
Map<String, String> resultMap = JSONObject.parseObject(executeForEp, Map.class); Map<String, Object> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code"))) { if ("200".equals(resultMap.get("code").toString())) {
ObjectMapper objectMapper = SAPUtils.objectMapper(); ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {}); mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else { }else {
message = resultMap.get("msg"); message =(String) resultMap.get("msg");
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("查询产品出错:" + message); throw new RuntimeException("查询产品出错:" + message);
} }
return mapList; return mapList;
} }
@Override
public List<Map<String, String>> queryProductAndBom(String itemCode) {
Map<String,Object> map = new HashMap<>();
//map.put("brandCode",brandCode);
List<Map<String, String>> mapList = new ArrayList<>();
String message = "";
try {
String executeForEp = httpClient.executeForEp(map, "md/mdItem/queryProductAndBomByItemCode?itemCode="+itemCode);
Map<String, Object> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code").toString())) {
ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else {
message =(String) resultMap.get("msg");
}
} catch (IOException e) {
throw new RuntimeException("查询制程工艺、原材料出错:" + message);
}
return mapList;
}
} }
...@@ -25,6 +25,7 @@ import com.huigou.topsun.sap.common.domain.SapResult; ...@@ -25,6 +25,7 @@ import com.huigou.topsun.sap.common.domain.SapResult;
import com.huigou.topsun.sap.costReimbursement.domain.SapCostReimbursement; import com.huigou.topsun.sap.costReimbursement.domain.SapCostReimbursement;
import com.huigou.uasp.bmp.common.BizBillStatus; import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bmp.operator.OperatorApplication; import com.huigou.uasp.bmp.operator.OperatorApplication;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.bpm.FlowBroker; import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.uasp.bpm.ProcessAction; import com.huigou.uasp.bpm.ProcessAction;
import com.huigou.uasp.bpm.ProcessStartModel; import com.huigou.uasp.bpm.ProcessStartModel;
...@@ -205,8 +206,10 @@ public class EpSaleOrderApplicationImpl extends FlowBroker implements EpSaleOrde ...@@ -205,8 +206,10 @@ public class EpSaleOrderApplicationImpl extends FlowBroker implements EpSaleOrde
BeanUtil.copyProperties(epSaleOrderVo,epSaleOrder); BeanUtil.copyProperties(epSaleOrderVo,epSaleOrder);
//初始化用户信息 //初始化用户信息
String createdById = SystemCache.getParameter("adminPersonId", String.class); String personCode = epSaleOrderVos.get(0).getPersonCode();
Operator operator = operatorApplication.createOperatorByPersonMemberId(createdById); Org org = orgApplication.loadMainOrgByLoginName(personCode);
//String createdById = SystemCache.getParameter("adminPersonId", String.class);
Operator operator = operatorApplication.createOperatorByPersonMemberId(org.getId());
epSaleOrder.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName())); epSaleOrder.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
Map<String, Object> formData = BeanUtil.beanToMap(epSaleOrder); Map<String, Object> formData = BeanUtil.beanToMap(epSaleOrder);
......
...@@ -24,6 +24,7 @@ import com.huigou.topsun.sap.common.domain.EpResult; ...@@ -24,6 +24,7 @@ import com.huigou.topsun.sap.common.domain.EpResult;
import com.huigou.topsun.sap.costReimbursement.domain.SapCostReimbursement; import com.huigou.topsun.sap.costReimbursement.domain.SapCostReimbursement;
import com.huigou.uasp.bmp.common.BizBillStatus; import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bmp.operator.OperatorApplication; import com.huigou.uasp.bmp.operator.OperatorApplication;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.bpm.FlowBroker; import com.huigou.uasp.bpm.FlowBroker;
import com.huigou.uasp.bpm.ProcessAction; import com.huigou.uasp.bpm.ProcessAction;
import com.huigou.uasp.bpm.ProcessStartModel; import com.huigou.uasp.bpm.ProcessStartModel;
...@@ -204,8 +205,10 @@ public class EpSaleOrderCancelApplicationImpl extends FlowBroker implements EpSa ...@@ -204,8 +205,10 @@ public class EpSaleOrderCancelApplicationImpl extends FlowBroker implements EpSa
BeanUtil.copyProperties(epSaleOrderCancelVo,epSaleOrderCancel); BeanUtil.copyProperties(epSaleOrderCancelVo,epSaleOrderCancel);
//初始化用户信息 //初始化用户信息
String createdById = SystemCache.getParameter("adminPersonId", String.class); String personCode = epSaleOrderCancelVos.get(0).getPersonCode();
Operator operator = operatorApplication.createOperatorByPersonMemberId(createdById); Org org = orgApplication.loadMainOrgByLoginName(personCode);
//String createdById = SystemCache.getParameter("adminPersonId", String.class);
Operator operator = operatorApplication.createOperatorByPersonMemberId(org.getId());
epSaleOrderCancel.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName())); epSaleOrderCancel.setDefaultValues(new OrgUnit(operator.getFullId(), operator.getFullName()));
Map<String, Object> formData = BeanUtil.beanToMap(epSaleOrderCancel); Map<String, Object> formData = BeanUtil.beanToMap(epSaleOrderCancel);
......
...@@ -14,6 +14,11 @@ import java.util.List; ...@@ -14,6 +14,11 @@ import java.util.List;
*/ */
@Data @Data
public class EpSaleOrderCancelVo implements Serializable { public class EpSaleOrderCancelVo implements Serializable {
/**
* 创建人
*/
@JsonProperty("personCode")
private String personCode;
/** /**
* 订单类型 * 订单类型
*/ */
......
...@@ -13,6 +13,11 @@ import java.util.List; ...@@ -13,6 +13,11 @@ import java.util.List;
*/ */
@Data @Data
public class EpSaleOrderVo implements Serializable { public class EpSaleOrderVo implements Serializable {
/**
* 创建人
*/
@JsonProperty("personCode")
private String personCode;
/** /**
* 订单类型 * 订单类型
*/ */
......
...@@ -15,6 +15,7 @@ import com.huigou.topsun.sap.nonProducePick.domain.query.NonProducePickQueryRequ ...@@ -15,6 +15,7 @@ import com.huigou.topsun.sap.nonProducePick.domain.query.NonProducePickQueryRequ
import com.huigou.topsun.sap.nonProducePick.repository.NonProducePickRepository; import com.huigou.topsun.sap.nonProducePick.repository.NonProducePickRepository;
import com.huigou.topsun.sap.nonProducePick.vo.NonProducePickItemVo; import com.huigou.topsun.sap.nonProducePick.vo.NonProducePickItemVo;
import com.huigou.topsun.sap.nonProducePick.vo.NonProducePickVo; import com.huigou.topsun.sap.nonProducePick.vo.NonProducePickVo;
import com.huigou.topsun.sap.purchase.domain.SapPurchase;
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;
import com.huigou.util.ClassHelper; import com.huigou.util.ClassHelper;
...@@ -209,4 +210,27 @@ public class NonProducePickApplicationImpl extends FlowBroker implements NonProd ...@@ -209,4 +210,27 @@ public class NonProducePickApplicationImpl extends FlowBroker implements NonProd
nonProducePickRepository.save(nonProducePick); nonProducePickRepository.save(nonProducePick);
} }
} }
/**
* 设置任务名称
*/
@Override
protected void setTaskDescription(DelegateTask delegateTask) {
String bizId = delegateTask.getExecution().getProcessBusinessKey();
delegateTask.setDescription(this.getApprovalSubjectName(bizId));
}
/**
* 获取任务标题
*
* @param bizId
* @return
*/
private String getApprovalSubjectName(String bizId) {
NonProducePick producePick = this.nonProducePickRepository.findOne(bizId);
//查询 单据日期
String fillinDateStr = DateUtil.getDateFormat("yyyy-MM-dd HH:mm:ss", producePick.getFillinDate());
//设置标题
return String.format("%s-%s(%s)", "其他物品领发料", producePick.getBillCode(), fillinDateStr);
}
} }
package com.huigou.uasp.bmp.opm.domain.model.org;
import com.huigou.annotation.JsonIgnore;
import com.huigou.context.OrgNode;
import com.huigou.data.domain.listener.VersionListener;
import com.huigou.domain.IdentifiedEntity;
import com.huigou.domain.ValidStatus;
import com.huigou.exception.ApplicationException;
import com.huigou.uasp.bmp.opm.OpmUtil;
import com.huigou.uasp.bmp.opm.domain.model.access.Role;
import com.huigou.util.CommonUtil;
import com.huigou.util.StringUtil;
import com.huigou.util.Util;
import org.apache.commons.beanutils.BeanUtils;
import javax.persistence.*;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 组织
*
* @author gongmm
*/
@Entity
@Table(name = "SA_OPOrg")
@EntityListeners({ VersionListener.class })
public class Org implements IdentifiedEntity, Serializable {
private static final long serialVersionUID = -4359439039376343018L;
public static final String ORG_ROOT_ID = "orgRoot";
@Id
private String id;
/**
* 实体版本号
*/
private Long version;
/**
* 父节点ID
*/
@Column(name = "parent_id")
private String parentId;
/**
* ID全路径
*/
@Column(name = "full_id", length = 1024)
private String fullId;
/**
* 名称全路径
*/
@Column(name = "full_name", length = 1024)
private String fullName;
private Integer sequence;
/**
* 编码
*/
private String code;
/**
* 名称
*/
private String name;
/**
* 状态
*/
private Integer status;
/**
* 组织机构类型
*/
@ManyToOne()
@JoinColumn(name = "type_id")
private OrgType orgType;
/**
* 全面名称
*/
@Column(name = "long_name")
private String longName;
/**
* 组织节点类型
*/
@Column(name = "org_kind_id", nullable = false)
private String orgKindId;
/**
* 部门级别
*/
@Column(name = "dept_level")
private String deptLevel;
/**
* 人员
*/
@ManyToOne()
@JoinColumn(name = "person_id")
private Person person;
/**
* 描述
*/
private String description;
/**
* 编码全路径
*/
@Column(name = "full_code", nullable = false)
private String fullCode;
/**
* 排序号全路径
*/
@Column(name = "full_sequence", nullable = false)
private String fullSequence;
/**
* 组件机构类别全路径
*/
@Column(name = "full_org_kind_id", nullable = false)
private String fullOrgKindId;
/**
* 是否虚拟组织
*/
@Column(name = "is_virtual")
private Integer isVirtual;
/**
* 公司ID
*/
@Column(name = "org_id")
private String orgId;
/**
* 公司编码
*/
@Column(name = "org_code")
private String orgCode;
/**
* 公司名称
*/
@Column(name = "org_name")
private String orgName;
/**
* 部门ID
*/
@Column(name = "dept_id")
private String deptId;
/**
* 部门编码
*/
@Column(name = "dept_code")
private String deptCode;
/**
* 部门名称
*/
@Column(name = "dept_name")
private String deptName;
/**
* 岗位ID
*/
@Column(name = "position_id")
private String positionId;
/**
* 岗位编码
*/
@Column(name = "position_code")
private String positionCode;
/**
* 岗位名称
*/
@Column(name = "position_name")
private String positionName;
@Column(name = "tenant_id")
private String tenantId;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "SA_OPAuthorize", joinColumns = { @JoinColumn(name = "org_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "role_id", referencedColumnName = "id") })
private List<Role> roles;
@OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = "org_id")
private List<OrgProperty> orgProperties;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Long getVersion() {
return this.version;
}
public void setVersion(Long version) {
this.version = version;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getFullId() {
return fullId;
}
public void setFullId(String fullId) {
this.fullId = fullId;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
@JsonIgnore
public OrgType getOrgType() {
return orgType;
}
@JsonIgnore
public void setOrgType(OrgType orgType) {
this.orgType = orgType;
}
public String getDeptLevel() {
return deptLevel;
}
public void setDeptLevel(String deptLevel) {
this.deptLevel = deptLevel;
}
public String getLongName() {
return longName;
}
public void setLongName(String longName) {
this.longName = longName;
}
public String getOrgKindId() {
return orgKindId;
}
public void setOrgKindId(String orgKindId) {
this.orgKindId = orgKindId;
}
@JsonIgnore
public Person getPerson() {
return person;
}
@JsonIgnore
public void setPerson(Person person) {
this.person = person;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFullCode() {
return fullCode;
}
public void setFullCode(String fullCode) {
this.fullCode = fullCode;
}
public String getFullSequence() {
return fullSequence;
}
public void setFullSequence(String fullSequence) {
this.fullSequence = fullSequence;
}
public String getFullOrgKindId() {
return fullOrgKindId;
}
public void setFullOrgKindId(String fullOrgKindId) {
this.fullOrgKindId = fullOrgKindId;
}
public Integer getIsVirtual() {
return isVirtual;
}
public void setIsVirtual(Integer isVirtual) {
this.isVirtual = isVirtual;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getDeptId() {
return deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getPositionId() {
return positionId;
}
public void setPositionId(String positionId) {
this.positionId = positionId;
}
public String getPositionCode() {
return positionCode;
}
public void setPositionCode(String positionCode) {
this.positionCode = positionCode;
}
public String getPositionName() {
return positionName;
}
public void setPositionName(String positionName) {
this.positionName = positionName;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
@JsonIgnore
public String getTenantField_() {
return "tenantId";
}
@JsonIgnore
public String getTenantId_() {
return tenantId;
}
@JsonIgnore
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roles) {
this.roles = roles;
}
@JsonIgnore
public List<OrgProperty> getOrgProperties() {
return orgProperties;
}
@JsonIgnore
public void setOrgProperties(List<OrgProperty> orgProperties) {
this.orgProperties = orgProperties;
}
/**
* 构建冗余数据
*/
public void buildRedundantData(Org parent) {
buildFullInfo(parent);
buildOrgNodeData();
}
@JsonIgnore
public OrgNodeKind getOrgKind() {
return OrgNodeKind.fromValue(orgKindId);
}
@JsonIgnore
public ValidStatus getValidStatus() {
return ValidStatus.fromId(this.getStatus());
}
private void buildOrgNodeData() {
String[] orgIds = this.getFullId().substring(1).split("/");
String[] orgCodes = this.getFullCode().substring(1).split("/");
String[] orgNames = this.getFullName().substring(1).split("/");
String[] orgKindIds = this.getFullOrgKindId().substring(1).split("/");
Util.check(orgIds.length == orgCodes.length && orgIds.length == orgNames.length && orgIds.length == orgKindIds.length,
"调用“buildOrgIdNameExtInfo”出错,参数长度不等。");
int deptLevel = 0;
int orgLevel = 0;
for (int i = orgIds.length - 1; i >= 0; i--) {
if (orgIds[i].endsWith(OrgNode.ORGAN)) {
orgLevel++;
if (orgLevel == 1) {
this.setOrgId(orgIds[i].replace("." + OrgNode.ORGAN, ""));
this.setOrgCode(orgCodes[i]);
this.setOrgName(orgNames[i]);
}
} else if (orgKindIds[i].equalsIgnoreCase(OrgNode.DEPT)) {
deptLevel++;
if (deptLevel == 1) {
this.setDeptId(orgIds[i].replace("." + OrgNode.DEPT, ""));
this.setDeptCode(orgCodes[i]);
this.setDeptName(orgNames[i]);
}
} else if (orgIds[i].endsWith(OrgNode.POSITION)) {
this.setPositionId(orgIds[i].replace("." + OrgNode.POSITION, ""));
this.setPositionCode(orgCodes[i]);
this.setPositionName(orgNames[i]);
}
}
}
private void buildFullInfo(Org parent) {
String sequence = CommonUtil.lpad(3, this.getSequence());
String fullId = OpmUtil.createFileFullName(parent == null ? "" : parent.getFullId(), this.getId(), getOrgKindId());
String fullCode = OpmUtil.createFileFullName(parent == null ? "" : parent.getFullCode(), getCode(), "");
String fullName = OpmUtil.createFileFullName(parent == null ? "" : parent.getFullName(), getName(), "");
String fullSequence = OpmUtil.createFileFullName(parent == null ? "" : parent.getFullSequence(), sequence, "");
String fullOrgKindId = OpmUtil.createFileFullName(parent == null ? "" : parent.getFullOrgKindId(), getOrgKindId(), "");
setFullId(fullId);
setFullCode(fullCode);
setFullName(fullName);
setFullSequence(fullSequence);
setFullOrgKindId(fullOrgKindId);
}
private void checkOrgKindRule(Org parent, String operateKind) {
// 公司+ -->部门+ --岗位 -->人员
// 公司+-->项目组织分类+ -->项目组织--> 分组 -->人员-->职能角色
// 公司+-->项目组织分类+ -->销售团队--> 部门+ -->人员
if (parent == null) {
Util.check(OrgNodeKind.OGN.equals(this.getOrgKind()), "%s失败,组织根下只能创机构节点。", new Object[] { operateKind });
} else {
// 组织层级判断
Util.check(this.getOrgKind().getLevel() >= parent.getOrgKind().getLevel(), "%s失败,“%s”的上级组织不能是“%s”!", new Object[] {
operateKind,
getOrgKind().getDisplayName(),
parent.getOrgKind()
.getDisplayName() });
// 公司下面只能建机构、部门、项目分类(文件夹)
if (OrgNodeKind.OGN.equals(parent.getOrgKind())) {
Util.check(OrgNodeKind.OGN.equals(this.getOrgKind()) || OrgNodeKind.DPT.equals(this.getOrgKind()) || OrgNodeKind.FLD.equals(this.getOrgKind()),
"%s失败,机构下不能建“%s”。", new Object[] { operateKind, this.getOrgKind().getDisplayName() });
}
// 部门下面只能建部门和岗位
else if (OrgNodeKind.DPT.equals(parent.getOrgKind())) {
Util.check(OrgNodeKind.DPT.equals(this.getOrgKind()) || OrgNodeKind.POS.equals(this.getOrgKind()), "%s失败,部门下不能建“%s”。",
new Object[] { operateKind, this.getOrgKind().getDisplayName() });
}
// 岗位只能建人员
else if (OrgNodeKind.POS.equals(parent.getOrgKind())) {
Util.check(OrgNodeKind.PSM.equals(this.getOrgKind()), "%s失败,岗位下不能建“%s”。", new Object[] { operateKind, this.getOrgKind().getDisplayName() });
}
// 项目组织分类下项目组织分类或项目组织
else if (OrgNodeKind.FLD.equals(parent.getOrgKind())) {
Util.check(OrgNodeKind.FLD.equals(this.getOrgKind()) || OrgNodeKind.PRJ.equals(this.getOrgKind()), "%s失败,项目组织分类下不能建“%s”。",
new Object[] { operateKind, this.getOrgKind().getDisplayName() });
}
// 项目组织下只能建分组
else if (OrgNodeKind.PRJ.equals(parent.getOrgKind())) {
// Util.check(OrgNodeKind.GRP.equals(this.getOrgKind()) || OrgNodeKind.STM.equals(this.getOrgKind()), "%s失败,项目组织下不能建“%s”。",
// new Object[] { operateKind, this.getOrgKind().getDisplayName() });
}
// 销售团队下只能建部门
// else if (OrgNodeKind.stm.equals(parent.getOrgKind())) {
// Util.check(OrgNodeKind.dpt.equals(this.getOrgKind()), "%s失败,项目组织下不能建“%s”。", new Object[] { operateKind, this.getOrgKind().getDisplayName() });
// }
// 分组下只能建人员
// else if (OrgNodeKind.grp.equals(parent.getOrgKind())) {
// Util.check(OrgNodeKind.psm.equals(this.getOrgKind()), "%s失败,分组下不能建“%s”。", new Object[] { operateKind, this.getOrgKind().getDisplayName() });
// }
// 人员下只能建职能角色
// else if (OrgKind.psm.equals(parent.getOrgKind())) {
// Util.check(OrgKind.fun.equals(this.getOrgKind()), "%s失败,人员下不能建“%s”。", new Object[] { operateKind, this.getOrgKind().getDisplayName() });
// }
}
}
/**
* 验证状态规则
*
* @param parent
* @param operateKind
*/
public void checkStatusRule(Org parent, String operateKind) {
if (parent != null) {
Util.check(this.getValidStatus().getId() <= parent.getValidStatus().getId(), "%s失败,上级组织:“%s”的状态是“%s”,下级组织:“%s”的状态不能是“%s”。",
new Object[] { operateKind, parent.getName(), parent.getValidStatus().getDisplayName(), this.getName(),
this.getValidStatus().getDisplayName() });
}
}
/**
* 验证组织ID合法性
*/
private void checkOrgId() {
Util.check(Util.isNotEmptyString(this.getId()), "标识不能为空。", new Object[0]);
Util.check((this.getId().indexOf('/') < 0) && (this.getId().indexOf('@') < 0) && (this.getId().indexOf('.') < 0) && (this.getId().indexOf('%') < 0),
"无效的标识“%s”,不能包含字符“/”、“@”、“.”、“%%”。", new Object[] { this.getId() });
}
/**
* 验证组织编码的合法性
*
* @param code
* 组织编码
*/
private void checkOrgCode() {
Util.check(Util.isNotEmptyString(this.getCode()), "编码“%s”不能为空。", new Object[] { this.getCode() });
Util.check((this.getCode().indexOf('/') < 0) && (this.getCode().indexOf('%') < 0) && (this.getCode().indexOf(',') < 0),
"无效的编码“%s”,不能包含字符“/”、“%%”、“,”。", new Object[] { this.getCode() });
}
/**
* 验证组织名称合法性
*
* @param name
* 组织名称
*/
private void checkOrgName() {
Util.check(Util.isNotEmptyString(this.getName()), "名称“%s”不能为空。", new Object[] { this.getName() });
Util.check((this.getName().indexOf('/') < 0) && (this.getName().indexOf('%') < 0) && (this.getName().indexOf(',') < 0),
"无效的名称“%s”,不能包含字符“/”、“%%”、“,”。", new Object[] { this.getName() });
}
private void checkNamedValidity() {
if (!OrgNodeKind.PSM.equals(this.getOrgKind())) {
this.checkOrgId();
}
this.checkOrgCode();
this.checkOrgName();
}
public void checkConstraints(Org parent, Org other, String operateKind) {
checkNamedValidity();
checkOrgKindRule(parent, operateKind);
checkStatusRule(parent, operateKind);
if (other != null) {
if (this.getCode().equalsIgnoreCase(other.getCode())) {
throw new ApplicationException("编码不能重复。");
}
if (this.getName().equalsIgnoreCase(other.getName())) {
//throw new ApplicationException("名称不能重复。");
}
}
}
/**
* 删除角色
*
* @param ids
* 角色ID列表
*/
public void removeRoles(List<String> roleIds) {
for (Iterator<Role> iter = this.getRoles().iterator(); iter.hasNext();) {
if (roleIds.contains(iter.next().getId())) {
iter.remove();
}
}
}
/**
* 构建角色实体列表
*
* @param inputRoles
* @retu
*/
public void buildRoles(List<Role> inputRoles) {
List<Role> roles = this.getRoles();
if (roles == null) {
this.setRoles(inputRoles);
return;
}
boolean found;
for (Role input : inputRoles) {
found = false;
for (Role role : roles) {
if (input.equals(role)) {
found = true;
break;
}
}
if (!found) {
roles.add(input);
}
}
}
public void fromMap(Map<String, Object> params) {
try {
BeanUtils.populate(this, params);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
@Override
@JsonIgnore
public boolean isNew() {
return StringUtil.isBlank(this.id);
}
@JsonIgnore
public boolean isRootChild() {
return ORG_ROOT_ID.equals(this.parentId);
}
@Override
public void setUpdateFields_(Collection<String> names) {
// TODO Auto-generated method stub
}
// @Override
// public void setUpdateFields_(String... updateFields) {
// // TODO Auto-generated method stub
// }
public void reviseProperties() {
if (isVirtual == null) {
isVirtual = 0;
}
}
}
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