Merge branch 'main' of http://39.98.69.61:22174/yem_rabbit_lhb/Cosmic_YEMStandard into yem_rabbit_lhb
# Conflicts: # settings.gradle # yem-cosmic-debug/build.gradle
This commit is contained in:
commit
e3c0bebe32
@ -24,6 +24,9 @@ include(
|
|||||||
':yem-wm-bd',
|
':yem-wm-bd',
|
||||||
|
|
||||||
':yem-wmzh-ii',
|
':yem-wmzh-ii',
|
||||||
|
':yem-wm-bd',
|
||||||
|
':yem-wm-sex',
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// -------------- 引入苍穹调试工程模块 --------------
|
// -------------- 引入苍穹调试工程模块 --------------
|
||||||
@ -49,10 +52,7 @@ project(':yem-wm-is').projectDir = new File('yem-wm/yem-wm-is')
|
|||||||
// -------------- 引入wm云-ct应用模块 --------------
|
// -------------- 引入wm云-ct应用模块 --------------
|
||||||
project(':yem-wm-ct').projectDir = new File('yem-wm/yem-wm-ct')
|
project(':yem-wm-ct').projectDir = new File('yem-wm/yem-wm-ct')
|
||||||
|
|
||||||
project(':yem-wmzh-csm').projectDir = new File('yem-wmzh/yem-wmzh-csm')
|
|
||||||
|
|
||||||
// -------------- 引入wm云-bd应用模块 --------------
|
// -------------- 引入wm云-bd应用模块 --------------
|
||||||
project(':yem-wm-bd').projectDir = new File('yem-wm/yem-wm-bd')
|
project(':yem-wm-bd').projectDir = new File('yem-wm/yem-wm-bd')
|
||||||
|
|
||||||
// -------------- 引入wmzh云-ii应用模块 --------------
|
|
||||||
project(':yem-wmzh-ii').projectDir = new File('yem-wmzh/yem-wmzh-ii')
|
|
||||||
|
@ -5,9 +5,12 @@ import kd.bos.context.RequestContext;
|
|||||||
import kd.bos.dataentity.OperateOption;
|
import kd.bos.dataentity.OperateOption;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.entity.report.FilterInfo;
|
import kd.bos.entity.report.FilterInfo;
|
||||||
import kd.bos.entity.report.ReportQueryParam;
|
import kd.bos.entity.report.ReportQueryParam;
|
||||||
import kd.bos.exception.KDException;
|
import kd.bos.exception.KDException;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.ORM;
|
import kd.bos.orm.ORM;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
@ -37,8 +40,7 @@ public class FieldKeyStoreUpdateTaskPlugin extends AbstractTask implements Plugi
|
|||||||
String appkeys = (String) map.get("appkeys");// 应用标识拼接
|
String appkeys = (String) map.get("appkeys");// 应用标识拼接
|
||||||
if (YEM.isEmpty(bizcloudkey) || YEM.isEmpty(appkeys))return;
|
if (YEM.isEmpty(bizcloudkey) || YEM.isEmpty(appkeys))return;
|
||||||
String[] appkeyArray = appkeys.split(",");
|
String[] appkeyArray = appkeys.split(",");
|
||||||
for (int i = 0; i < appkeyArray.length; i++) {
|
for (String appkey : appkeyArray) {
|
||||||
String appkey = appkeyArray[i];
|
|
||||||
// 更新数据
|
// 更新数据
|
||||||
try {
|
try {
|
||||||
updateFieldKeyStore(bizcloudkey, appkey);
|
updateFieldKeyStore(bizcloudkey, appkey);
|
||||||
@ -75,6 +77,7 @@ public class FieldKeyStoreUpdateTaskPlugin extends AbstractTask implements Plugi
|
|||||||
filters.addFilterItem("yem_fapp", appkey);
|
filters.addFilterItem("yem_fapp", appkey);
|
||||||
Param.setFilter(filters);
|
Param.setFilter(filters);
|
||||||
DataSet entityList = report.query(Param, null);
|
DataSet entityList = report.query(Param, null);
|
||||||
|
entityList = entityList.where(String.format("yem_appkey = '%s'", appkey));
|
||||||
DynamicObjectCollection entityCollection = ORM.create().toPlainDynamicObjectCollection(entityList);
|
DynamicObjectCollection entityCollection = ORM.create().toPlainDynamicObjectCollection(entityList);
|
||||||
for (DynamicObject entity : entityCollection){
|
for (DynamicObject entity : entityCollection){
|
||||||
String yemEntityid = entity.getString("yem_entityid");// 表单ID
|
String yemEntityid = entity.getString("yem_entityid");// 表单ID
|
||||||
@ -114,11 +117,26 @@ public class FieldKeyStoreUpdateTaskPlugin extends AbstractTask implements Plugi
|
|||||||
}
|
}
|
||||||
billIdList.add(yemEntityid);
|
billIdList.add(yemEntityid);
|
||||||
}
|
}
|
||||||
|
Log log = LogFactory.getLog(this.getClass());
|
||||||
// 删除 字段标识库 中的历史数据
|
// 删除 字段标识库 中的历史数据
|
||||||
|
if (!billIdList.isEmpty()){
|
||||||
DeleteServiceHelper.delete("yem_base_fieldkeystore",
|
DeleteServiceHelper.delete("yem_base_fieldkeystore",
|
||||||
new QFilter[]{new QFilter("yem_entityid", QCP.in, billIdList)});
|
new QFilter[]{new QFilter("yem_entityid", QCP.in, billIdList)});
|
||||||
|
log.info("字段标识库定时更新: 历史数据删除成功-"+billIdList.size()+"条");
|
||||||
|
}
|
||||||
// 保存最新的数据
|
// 保存最新的数据
|
||||||
SaveServiceHelper.saveOperate("save","yem_base_fieldkeystore",
|
if(!creatNewList.isEmpty()){
|
||||||
creatNewList.toArray(new DynamicObject[0]), OperateOption.create());
|
OperationResult operationResult = SaveServiceHelper.saveOperate("save",
|
||||||
|
"yem_base_fieldkeystore", creatNewList.toArray(new DynamicObject[0]),
|
||||||
|
OperateOption.create());
|
||||||
|
if (operationResult.isSuccess()){
|
||||||
|
log.info("字段标识库定时更新: 更新数据成功-云标识:"+bizcloudkey+"应用标识:"+appkey+
|
||||||
|
"数据:"+creatNewList.size()+"条");
|
||||||
|
} else {
|
||||||
|
log.error("字段标识库定时更新: 更新数据失败-云标识:"+bizcloudkey+"应用标识:"+appkey+
|
||||||
|
"数据:"+creatNewList.size()+"条; 失败原因:"+operationResult.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,6 +32,11 @@ dependencies {
|
|||||||
|
|
||||||
// 引入wm云 bd应用模块
|
// 引入wm云 bd应用模块
|
||||||
implementation project(':yem-wm-bd')
|
implementation project(':yem-wm-bd')
|
||||||
|
// 引入wm云 bd应用模块
|
||||||
|
implementation project(':yem-wm-bd')
|
||||||
|
// 引入wm云 sex应用模块
|
||||||
|
implementation project(':yem-wm-sex')
|
||||||
|
|
||||||
|
|
||||||
// 引入wmzh云 ii应用模块
|
// 引入wmzh云 ii应用模块
|
||||||
implementation project(':yem-wmzh-ii')
|
implementation project(':yem-wmzh-ii')
|
||||||
|
14
yem-wm/yem-wm-sex/build.gradle
Normal file
14
yem-wm/yem-wm-sex/build.gradle
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* This is a kingdee cosmic template project that is automatically generated by the Kingdee cosmic development assistant plugin.
|
||||||
|
* If there are any issues during the use process, you can provide feedback to the kingdee developer community website.
|
||||||
|
* Website: https://developer.kingdee.com/developer?productLineId=29
|
||||||
|
* Author: liebin.zheng
|
||||||
|
* Generate Date: 2025-02-18 11:00:22
|
||||||
|
*/
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api project(':yem-base-common')
|
||||||
|
// api project(':yem-base-helper')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,62 @@
|
|||||||
|
package yem.wm.sex.fagreement;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.entity.plugin.annotation.PluginEvent;
|
||||||
|
import kd.bos.form.IFormView;
|
||||||
|
import kd.bos.form.field.DateEdit;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import yem.base.common.utils.YEM;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 自营出口 - 框架协议 表单主插件
|
||||||
|
* @Author: bang
|
||||||
|
* @CreateTime: 2025-02-18 11:31
|
||||||
|
*/
|
||||||
|
public class SexFagreementFromPlugin extends AbstractBillPlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PluginEvent(enableOverride = true)
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
ChangeData[] changeSet = e.getChangeSet();
|
||||||
|
int rowIndex = changeSet[0].getRowIndex();
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
switch (name){
|
||||||
|
case "yem_startdate":// 开始日期
|
||||||
|
case "yem_expirationdate":// 结束日期
|
||||||
|
datePropertyChange(name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 结束日期 不可 早于 开始日期
|
||||||
|
* @function 功能 根据开始日期 设置结束日期最小范围
|
||||||
|
* 结束日期选择后判断开始日期是否有值
|
||||||
|
* @purposes 用途 :开始日期值改变
|
||||||
|
* 单据新增
|
||||||
|
*/
|
||||||
|
private void datePropertyChange(String propertyKey){
|
||||||
|
IFormView view = this.getView();
|
||||||
|
IDataModel model = view.getModel();
|
||||||
|
Date yemStartdate = (Date) model.getValue("yem_startdate");
|
||||||
|
Date yemExpirationdate = (Date) model.getValue("yem_expirationdate");
|
||||||
|
if ("yem_startdate".equals(propertyKey)){
|
||||||
|
if (YEM.isEmpty(yemStartdate)) return;
|
||||||
|
((DateEdit) this.getControl("yem_expirationdate")).setMinDate(yemStartdate);
|
||||||
|
if (!YEM.isEmpty(yemExpirationdate) && !yemExpirationdate.after(yemStartdate))
|
||||||
|
model.setValue("yem_expirationdate",null);
|
||||||
|
} else {
|
||||||
|
if (!YEM.isEmpty(yemExpirationdate) && YEM.isEmpty(yemStartdate))
|
||||||
|
this.getView().showErrorNotification("请先选择开始日期!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,507 @@
|
|||||||
|
package yem.wm.sex.tpl;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.bill.OperationStatus;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.entity.plugin.annotation.PluginEvent;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import yem.base.common.utils.DynamicObjectUtil;
|
||||||
|
import yem.base.common.utils.YEM;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description 自营出口(一般)模板(抬头+商品+财务) 表单插件
|
||||||
|
* @Author: bang
|
||||||
|
* @CreateTime: 2025-02-18 11:31
|
||||||
|
*/
|
||||||
|
public class SexTemplateFormPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PluginEvent(enableOverride = true)
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
((BasedataEdit) this.getControl("org")).addBeforeF7SelectListener(this);
|
||||||
|
((BasedataEdit) this.getControl("yem_department")).addBeforeF7SelectListener(this);
|
||||||
|
((BasedataEdit) this.getControl("yem_salegroup")).addBeforeF7SelectListener(this);
|
||||||
|
((BasedataEdit) this.getControl("yem_operator")).addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PluginEvent(enableOverride = true)
|
||||||
|
public void afterBindData(EventObject e) {
|
||||||
|
super.afterBindData(e);
|
||||||
|
OperationStatus status = this.getView().getFormShowParameter().getStatus();
|
||||||
|
if (status.equals(OperationStatus.ADDNEW))orgPropertyChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PluginEvent(enableOverride = true)
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent evt) {
|
||||||
|
String name = evt.getProperty().getName();
|
||||||
|
QFilter filter = null;
|
||||||
|
switch (name){
|
||||||
|
case "org":// 组织
|
||||||
|
filter = setOrgF7Filter();
|
||||||
|
break;
|
||||||
|
case "yem_department":// 部门
|
||||||
|
filter = setDeptF7Filter(evt);
|
||||||
|
break;
|
||||||
|
case "yem_salegroup": // 业务组
|
||||||
|
filter = setGroupF7Filter(evt);
|
||||||
|
break;
|
||||||
|
case "yem_operator": // 业务员
|
||||||
|
filter = setOperatorF7Filter(evt);
|
||||||
|
break;
|
||||||
|
case "yem_material": // 商品
|
||||||
|
filter = setMaterialF7Filter(evt);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// 设置过滤条件
|
||||||
|
if (filter == null) return;
|
||||||
|
ListShowParameter showParameter = (ListShowParameter) evt.getFormShowParameter();
|
||||||
|
List<QFilter> qFilters = showParameter.getListFilterParameter().getQFilters();
|
||||||
|
for (QFilter f : qFilters){
|
||||||
|
filter = filter != null ? filter.and(f) : f;
|
||||||
|
}
|
||||||
|
showParameter.getListFilterParameter().setFilter(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@PluginEvent(enableOverride = true)
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
ChangeData[] changeSet = e.getChangeSet();
|
||||||
|
int rowIndex = changeSet[0].getRowIndex();
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
switch (name){
|
||||||
|
case "org":// 组织
|
||||||
|
// 判断 部门、业务员 是否是当前组织下,如果不是则清空
|
||||||
|
orgPropertyChanged();
|
||||||
|
break;
|
||||||
|
case "yem_department":// 部门
|
||||||
|
deptPropertyChange();
|
||||||
|
break;
|
||||||
|
case "yem_salegroup": // 业务组
|
||||||
|
break;
|
||||||
|
case "yem_operator": // 业务员
|
||||||
|
operatorPropertyChange();
|
||||||
|
break;
|
||||||
|
case "yem_materialtype": // 商品分类
|
||||||
|
materialTypePropertyChange(rowIndex);
|
||||||
|
break;
|
||||||
|
case "yem_material": // 商品
|
||||||
|
materialPropertyChange(rowIndex);
|
||||||
|
updateBaseUnitQty(rowIndex);
|
||||||
|
break;
|
||||||
|
case "yem_qty": // 数量
|
||||||
|
case "yem_unit": // 计量单位
|
||||||
|
updateBaseUnitQty(rowIndex);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 单据组织人员相关字段合规
|
||||||
|
* @function 功能: 判断 部门、业务员 是否是当前组织下,如果不是则清空
|
||||||
|
* @purposes 用途:单据新增时、组织值改变时
|
||||||
|
*/
|
||||||
|
private void orgPropertyChanged(){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject org = (DynamicObject) model.getValue("org");
|
||||||
|
if (YEM.isEmpty(org)) return;
|
||||||
|
// 部门
|
||||||
|
DynamicObject yemDepartment = (DynamicObject) model.getValue("yem_department");
|
||||||
|
if (!YEM.isEmpty(yemDepartment)){
|
||||||
|
// 判断组织是否在 部门的上级组织中
|
||||||
|
boolean isOrgSubDept = isOrgSubDept(org, yemDepartment);
|
||||||
|
if (!isOrgSubDept) model.setValue("yem_department",null);
|
||||||
|
}
|
||||||
|
// 业务员
|
||||||
|
DynamicObject yemOperator = (DynamicObject) model.getValue("yem_operator");
|
||||||
|
if (!YEM.isEmpty(yemOperator)){
|
||||||
|
Map<Long, Boolean> orgSubUserDeptInfo = getOrgSubUserDeptInfo(org, yemOperator);
|
||||||
|
if (orgSubUserDeptInfo.isEmpty()) model.setValue("yem_operator",null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 部门值更新
|
||||||
|
* @function 功能:判断业务员是否合规,如果在对应部门没有职能,则清空
|
||||||
|
* @purposes 用途
|
||||||
|
*/
|
||||||
|
private void deptPropertyChange(){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject yemDepartment = (DynamicObject) model.getValue("yem_department");// 部门
|
||||||
|
DynamicObject yemOperator = (DynamicObject) model.getValue("yem_operator");// 业务员
|
||||||
|
if (!YEM.isEmpty(yemOperator) && !YEM.isEmpty(yemDepartment)){
|
||||||
|
// 判断业务员是否合规
|
||||||
|
DynamicObjectCollection entryentity = yemOperator.getDynamicObjectCollection("entryentity");
|
||||||
|
List<Long> deptIds = entryentity.stream().map(x ->
|
||||||
|
x.getDynamicObject("dpt").getLong("id")).collect(Collectors.toList());
|
||||||
|
if (deptIds.contains(yemDepartment.getLong("id"))){
|
||||||
|
model.setValue("yem_operator",null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 业务员值更新
|
||||||
|
* @function 功能: 1、更新部门:
|
||||||
|
* 如果部门不为空:判断部门是否合规:部门是否在 人员的部门范围内
|
||||||
|
* 如果为空:携带人员的部门,优先主职部门 次选 兼职部门
|
||||||
|
* 2、更新销售组:
|
||||||
|
* 如果销售组不为空:判断销售组是否合规:业务组的 业务员分录是否存在与当前分录匹配的
|
||||||
|
* 如果为空:根据人员、部门 查询 业务组 首个默认赋值,查不到 为空
|
||||||
|
* @purposes 用途:单据新增时、组织值改变时
|
||||||
|
*/
|
||||||
|
private void operatorPropertyChange(){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject org = (DynamicObject) model.getValue("org");
|
||||||
|
DynamicObject yemOperator = (DynamicObject) model.getValue("yem_operator");
|
||||||
|
if (YEM.isEmpty(yemOperator)) return;
|
||||||
|
|
||||||
|
// 部门
|
||||||
|
DynamicObject yemDepartment = (DynamicObject) model.getValue("yem_department");
|
||||||
|
Map<Long, Boolean> orgSubUserDeptInfo = getOrgSubUserDeptInfo(org, yemOperator);
|
||||||
|
if (!YEM.isEmpty(yemDepartment)){
|
||||||
|
// 判断是否合规
|
||||||
|
if (orgSubUserDeptInfo.containsKey(yemDepartment.getLong("id"))){
|
||||||
|
yemDepartment = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (YEM.isEmpty(yemDepartment)){
|
||||||
|
// 默认赋值
|
||||||
|
boolean aFalse = orgSubUserDeptInfo.containsValue(false);// 是否兼职
|
||||||
|
Set<Long> deptIds = orgSubUserDeptInfo.keySet();
|
||||||
|
for (Long id : deptIds){
|
||||||
|
if (aFalse){
|
||||||
|
if (!orgSubUserDeptInfo.get(id)){
|
||||||
|
model.setValue("yem_department",id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
model.setValue("yem_department",id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 销售组
|
||||||
|
DynamicObject yemSalegroup = (DynamicObject) model.getValue("yem_salegroup");
|
||||||
|
boolean isRational = false;
|
||||||
|
if (!YEM.isEmpty(yemSalegroup)){
|
||||||
|
// 判断是否合规 :业务组-业务员分录中是否存在数据与当前业务员匹配
|
||||||
|
DynamicObjectCollection entryentity = yemSalegroup.getDynamicObjectCollection("entryentity");
|
||||||
|
for (DynamicObject entry : entryentity){
|
||||||
|
DynamicObject operator = entry.getDynamicObject("operator");
|
||||||
|
if (YEM.isEmpty(operator)) continue;
|
||||||
|
long operatorId = operator.getLong("id");
|
||||||
|
long yemOperatorId = yemOperator.getLong("id");
|
||||||
|
if (operatorId == yemOperatorId) isRational = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (YEM.isEmpty(yemSalegroup) || !isRational){
|
||||||
|
List<DynamicObject> groups = queryGroup(yemDepartment, yemOperator);
|
||||||
|
if (groups != null && !groups.isEmpty()){
|
||||||
|
model.setValue("yem_salegroup",groups.get(0));
|
||||||
|
} else {
|
||||||
|
model.setValue("yem_salegroup",null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 商品分类值更新
|
||||||
|
* @function 功能: 商品分类更新时,如果商品分类为空 或者 商品的商品分类 与其不一致,则清空商品
|
||||||
|
* @param rowIndex 值更新触发行
|
||||||
|
*/
|
||||||
|
private void materialTypePropertyChange(int rowIndex){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject yemMaterialtype = (DynamicObject) model.getValue("yem_materialtype",rowIndex);// 商品分类
|
||||||
|
DynamicObject yemMaterial = (DynamicObject) model.getValue("yem_material",rowIndex); // 商品
|
||||||
|
if (YEM.isEmpty(yemMaterialtype)){
|
||||||
|
model.setValue("yem_material",null,rowIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!YEM.isEmpty(yemMaterial)){
|
||||||
|
// 判断是否合规
|
||||||
|
DynamicObject group = yemMaterial.getDynamicObject("group");
|
||||||
|
if (group.getLong("id") != yemMaterialtype.getLong("id"))
|
||||||
|
model.setValue("yem_material",null,rowIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 商品值更新
|
||||||
|
* @function 功能 商品更新时 给计量单位、基本计量单位赋值
|
||||||
|
* @param rowIndex 值更新触发行
|
||||||
|
*/
|
||||||
|
private void materialPropertyChange(int rowIndex){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject yemMaterial = (DynamicObject) model.getValue("yem_material",rowIndex); // 商品
|
||||||
|
if (!YEM.isEmpty(yemMaterial)){
|
||||||
|
DynamicObject baseunit = yemMaterial.getDynamicObject("baseunit");
|
||||||
|
model.setValue("yem_unit",baseunit,rowIndex); // 计量单位
|
||||||
|
model.setValue("yem_baseunit",baseunit,rowIndex); // 基本计量单位
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 计算基本单位数量
|
||||||
|
* @function 功能 :根基 计量单位、基本计量单位 换算率 和数量 计算基本单位数量
|
||||||
|
* @purposes 用途 物料 数量、 计量单位值更新
|
||||||
|
* @param rowIndex 值更新触发行
|
||||||
|
*/
|
||||||
|
private void updateBaseUnitQty(int rowIndex){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject yemMaterial = (DynamicObject) model.getValue("yem_material",rowIndex); // 商品
|
||||||
|
DynamicObject yemUnit = (DynamicObject) model.getValue("yem_unit",rowIndex); // 商品
|
||||||
|
DynamicObject yemBaseunit = (DynamicObject) model.getValue("yem_baseunit",rowIndex); // 商品
|
||||||
|
BigDecimal yemQty = (BigDecimal) model.getValue("yem_qty"); // 数量
|
||||||
|
if (!YEM.isEmpty(yemMaterial) && !YEM.isEmpty(yemUnit) && !YEM.isEmpty(yemBaseunit) && !YEM.isEmpty(yemQty)){
|
||||||
|
BigDecimal unitRate = YEM.getUnitRate(yemMaterial,yemUnit,yemBaseunit);
|
||||||
|
if (!YEM.isEmpty(unitRate)){
|
||||||
|
model.setValue("yem_baseqty", unitRate.multiply(yemQty),rowIndex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model.setValue("yem_baseqty",BigDecimal.ZERO,rowIndex);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @Description: 是否组织下级部门
|
||||||
|
* @function 功能 :判断组织是否在 部门的上级组织分录中
|
||||||
|
* @purposes 用途: 单据组织人员相关字段合规
|
||||||
|
* @param org 组织
|
||||||
|
* @param dept 部门
|
||||||
|
* @return boolean 是否下级
|
||||||
|
*/
|
||||||
|
private boolean isOrgSubDept(DynamicObject org,DynamicObject dept){
|
||||||
|
DynamicObjectCollection structure = dept.getDynamicObjectCollection("structure");
|
||||||
|
List<Long> parentOrgIds = structure.stream()
|
||||||
|
.map(x->x.getDynamicObject("viewparent").getLong("id"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return parentOrgIds.contains(org.getLong("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 组织下人员部门信息
|
||||||
|
* @function 功能 : 人员部门分录,判断部门是否组织下级
|
||||||
|
* @purposes 用途 : 判断人员在组织下是否有职能
|
||||||
|
* 部门选择时 根据组织人员过滤
|
||||||
|
* @param org 组织
|
||||||
|
* @param user 人员
|
||||||
|
* @return Map<Long,Boolean>: key 部门id,value : 是否兼职
|
||||||
|
*/
|
||||||
|
private Map<Long,Boolean> getOrgSubUserDeptInfo(DynamicObject org, DynamicObject user){
|
||||||
|
// 定义Map统计部门信息
|
||||||
|
Map<Long,Boolean> result = new HashMap<>();
|
||||||
|
// 人员部门分录
|
||||||
|
DynamicObjectCollection entryentity = user.getDynamicObjectCollection("entryentity");
|
||||||
|
for (DynamicObject entry : entryentity){
|
||||||
|
DynamicObject dpt = entry.getDynamicObject("dpt");
|
||||||
|
if ("0".equals(dpt.getString("enable"))) continue; // 使用状态为:可用
|
||||||
|
boolean orgSubDept = isOrgSubDept(org, dpt);// 是否组织下部门
|
||||||
|
boolean ispartjob = entry.getBoolean("ispartjob");// 是否兼职
|
||||||
|
if (orgSubDept)result.put(dpt.getLong("id"),ispartjob);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据当前登录人员的过滤可选组织
|
||||||
|
* @function 功能 :获取当前用户可切换的组织集合,设置过滤条件
|
||||||
|
* @purposes 用途 组织选择时
|
||||||
|
* @return QFilter 过滤条件
|
||||||
|
*/
|
||||||
|
private QFilter setOrgF7Filter() {
|
||||||
|
// 获取当前用户可切换的组织集合
|
||||||
|
List<Long> orgIds = YEM.getUserChangeAbleOrgIds();
|
||||||
|
// 设置过滤条件
|
||||||
|
if (orgIds != null){
|
||||||
|
return new QFilter("id", QCP.in, orgIds.toArray());
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据销售组织、销售业务员 过滤可选部门
|
||||||
|
* @function 功能 :根据情况设置过滤条件:销售组织下的所有行政组织
|
||||||
|
* 销售业务员不为空时:可选 业务员 在该组织下的所有职能部门
|
||||||
|
* @purposes 用途 部门选择时
|
||||||
|
* @param e 选择事件参数
|
||||||
|
* @return QFilter 过滤条件
|
||||||
|
*/
|
||||||
|
private QFilter setDeptF7Filter(BeforeF7SelectEvent e) {
|
||||||
|
DynamicObject org = (DynamicObject) this.getView().getModel().getValue("org");
|
||||||
|
if (YEM.isEmpty(org)){
|
||||||
|
e.setCancel(true);
|
||||||
|
this.getView().showErrorNotification("请先选择销售组织!");
|
||||||
|
}
|
||||||
|
DynamicObject yemOperator = (DynamicObject) this.getView().getModel().getValue("yem_operator");
|
||||||
|
QFilter filter = new QFilter("structure.viewparent.id", QCP.equals, org.getLong("id"))
|
||||||
|
.or(new QFilter("id",QCP.equals,org.getLong("id")));
|
||||||
|
if (!YEM.isEmpty(yemOperator)){
|
||||||
|
Map<Long, Boolean> orgSubUserDeptInfo = getOrgSubUserDeptInfo(org, yemOperator);
|
||||||
|
Long[] deptIds = orgSubUserDeptInfo.keySet().toArray(new Long[0]);
|
||||||
|
if (deptIds.length > 0)
|
||||||
|
filter = filter.and(new QFilter("id", QCP.in, deptIds));
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 业务组选择过滤
|
||||||
|
* @function 功能 :根据销售组织、销售部门和销售业务员过滤:
|
||||||
|
* 业务组类型为销售组、业务组-业务员分录 未失效、业务组-业务员分录存在当前业务员
|
||||||
|
* @purposes 用途:业务组选择
|
||||||
|
* @param e 选择事件参数
|
||||||
|
* @return QFilter 过滤条件
|
||||||
|
*/
|
||||||
|
private QFilter setGroupF7Filter(BeforeF7SelectEvent e){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject org = (DynamicObject) model.getValue("org"); // 组织
|
||||||
|
DynamicObject yemDepartment = (DynamicObject) model.getValue("yem_department"); // 部门
|
||||||
|
DynamicObject yemOperator = (DynamicObject) this.getView().getModel().getValue("yem_operator");// 业务员
|
||||||
|
QFilter filter = new QFilter("operatorgrouptype",QCP.equals,"XSZ");// 业务组类型为销售组
|
||||||
|
filter = filter.and(new QFilter("entryentity.invalid",QCP.equals,false));// 未失效
|
||||||
|
if (!YEM.isEmpty(org) && !YEM.isEmpty(yemDepartment)){
|
||||||
|
List<Long> deptId = queryOrgSub(org);
|
||||||
|
List<Long> deptIds = queryOrgSub(yemDepartment);
|
||||||
|
deptIds.addAll(deptId);
|
||||||
|
if (!deptIds.isEmpty())
|
||||||
|
filter = filter.and(new QFilter("entryentity.operator.dpt.id",QCP.in,
|
||||||
|
deptIds.toArray(new Long[0])));
|
||||||
|
} else {
|
||||||
|
e.setCancel(true);
|
||||||
|
this.getView().showErrorNotification(YEM.isEmpty(org) ? "请先选择销售组织!" : "请先选择销售部门!");
|
||||||
|
}
|
||||||
|
if (yemOperator != null){
|
||||||
|
filter = filter.and(new QFilter("entryentity.operator.id",QCP.equals,
|
||||||
|
yemOperator.getLong("id")));
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 业务员选择过滤
|
||||||
|
* @function 功能 :根据销售组织、销售部门和销售组过滤
|
||||||
|
* @purposes 用途 业务员选择
|
||||||
|
* @param e 选择事件参数
|
||||||
|
* @return QFilter 过滤条件
|
||||||
|
*/
|
||||||
|
private QFilter setOperatorF7Filter(BeforeF7SelectEvent e) {
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject org = (DynamicObject) model.getValue("org"); // 组织
|
||||||
|
DynamicObject yemDepartment = (DynamicObject) model.getValue("yem_department"); // 部门
|
||||||
|
DynamicObject yemSalegroup = (DynamicObject) model.getValue("yem_salegroup"); // 业务组
|
||||||
|
QFilter filter = null;
|
||||||
|
if (org != null){
|
||||||
|
List<Long> deptIds = queryOrgSub(org);
|
||||||
|
if (!deptIds.isEmpty())
|
||||||
|
filter = new QFilter("entryentity.dpt.id",QCP.in,deptIds.toArray(new Long[0]));
|
||||||
|
} else {
|
||||||
|
e.setCancel(true);
|
||||||
|
this.getView().showErrorNotification( "请先选择销售组织!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (yemDepartment != null){
|
||||||
|
List<Long> deptIds = queryOrgSub(yemDepartment);
|
||||||
|
if (!deptIds.isEmpty())
|
||||||
|
filter = new QFilter("entryentity.dpt.id",QCP.in,deptIds.toArray(new Long[0]));
|
||||||
|
} else {
|
||||||
|
e.setCancel(true);
|
||||||
|
this.getView().showErrorNotification( "请先选择销售部门!");
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
if (yemSalegroup != null){
|
||||||
|
// 业务组 的业务员分录
|
||||||
|
DynamicObjectCollection entryentity = yemSalegroup.getDynamicObjectCollection("entryentity");
|
||||||
|
List<Long> operatorIds = new ArrayList<>();
|
||||||
|
for (DynamicObject entry : entryentity){
|
||||||
|
DynamicObject operator = entry.getDynamicObject("operator");
|
||||||
|
if (!YEM.isEmpty(operator))operatorIds.add(operator.getLong("id"));
|
||||||
|
}
|
||||||
|
if (!operatorIds.isEmpty())filter = new QFilter("id",QCP.in,operatorIds.toArray(new Long[0]));
|
||||||
|
}
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private QFilter setMaterialF7Filter(BeforeF7SelectEvent e){
|
||||||
|
IDataModel model = this.getView().getModel();
|
||||||
|
DynamicObject yemMaterialtype = (DynamicObject) model.getValue("yem_materialtype", e.getRow());
|
||||||
|
if (yemMaterialtype == null){
|
||||||
|
e.setCancel(true);
|
||||||
|
this.getView().showErrorNotification( "请先选择商品分类!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new QFilter("group.id",QCP.equals, yemMaterialtype.getLong("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 根据业务员、部门 查询业务组
|
||||||
|
* @function 功能
|
||||||
|
* @purposes 用途 : 业务组选择过滤
|
||||||
|
* 默认赋值
|
||||||
|
* @param dept 部门
|
||||||
|
* @param operator 业务员
|
||||||
|
* @return List<DynamicObject> 符合条件的业务组数据
|
||||||
|
*/
|
||||||
|
private List<DynamicObject> queryGroup(DynamicObject dept,DynamicObject operator){
|
||||||
|
if (YEM.isEmpty(operator)) return null;
|
||||||
|
String selectfields = DynamicObjectUtil.getSelectfields("bd_operatorgroup", true);
|
||||||
|
DynamicObject[] load = BusinessDataServiceHelper.load("bd_operatorgroup", selectfields, new QFilter[]{
|
||||||
|
new QFilter("entryentity.operator.dpt.id", QCP.equals, dept.getLong("id")),
|
||||||
|
new QFilter("entryentity.operator.id", QCP.equals, operator.getLong("id"))});
|
||||||
|
return Arrays.asList(load);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 查询组织下级组织内码集合(包含当前组织)
|
||||||
|
* @function 功能:上级组织 = 组织
|
||||||
|
* @purposes 根据组织过滤字段
|
||||||
|
* @param org 组织
|
||||||
|
* @return List<Long>
|
||||||
|
*/
|
||||||
|
private List<Long> queryOrgSub(DynamicObject org){
|
||||||
|
List<Long> orgIds = new ArrayList<>();
|
||||||
|
if (org == null) return orgIds;
|
||||||
|
orgIds.add(org.getLong("id"));
|
||||||
|
DynamicObject[] load = BusinessDataServiceHelper.load("bos_adminorg", "id",
|
||||||
|
new QFilter[]{ new QFilter("enable", QCP.equals, "1"),// 可用
|
||||||
|
new QFilter("structure.viewparent.id", QCP.equals, org.getLong("id")) });
|
||||||
|
for (DynamicObject obj : load){
|
||||||
|
orgIds.add(obj.getLong("id"));
|
||||||
|
}
|
||||||
|
return orgIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user