Commit 391cb15e by 宋祥

1.生产组订单增加派工人员历史记录,人员组织架构变动后认可查看历史任务

parent 8374a3d3
......@@ -58,4 +58,21 @@ public class HgScSqlConstant {
//app 查询生产任务数量
public static final String COUNT_APP = "HGSC007.countApp";
}
/**
* HGSC007B 定义
*
* @author:songx
* @date:2024/9/14,14:43
*/
public static class HgSc007B {
// 去重查询
public static final String QUERY_DISTINCT = "HGSC007B.queryDistinct";
// 批量新增
public static final String BATCH_INSERT = "HGSC007B.batchInsert";
// 根据订单清除
public static final String DELETE_BY_ORDER = "HGSC007B.deleteByOrder";
}
}
package com.baosight.hggp.hg.sc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* Project: <br>
* Title:Hgsc007b.java <br>
* Description: <br>
*
* Copyrigth:Baosight Software LTD.co Copyright (c) 2019. <br>
*
* @version 1.0
* @history 2024-09-14 14:26:37 create
*/
public class HGSC007B extends DaoEPBase {
private static final long serialVersionUID = 1L;
public static final String FIELD_id = "id";
public static final String FIELD_account_code = "accountCode"; /* 帐套*/
public static final String FIELD_dep_code = "depCode"; /* 部门编码*/
public static final String FIELD_dep_name = "depName"; /* 部门名称*/
public static final String FIELD_created_by = "createdBy"; /* 创建人*/
public static final String FIELD_created_name = "createdName"; /* 创建人名称*/
public static final String FIELD_created_time = "createdTime"; /* 创建时间*/
public static final String FIELD_updated_by = "updatedBy"; /* 更新人*/
public static final String FIELD_updated_name = "updatedName"; /* 修改人名称*/
public static final String FIELD_updated_time = "updatedTime"; /* 更新时间*/
public static final String FIELD_delete_flag = "deleteFlag"; /* 0=未删除,1=已删除*/
public static final String FIELD_order_id = "orderId"; /* 生产订单ID*/
public static final String FIELD_order_detail_id = "orderDetailId"; /* 生产订单明细ID*/
public static final String FIELD_task_code = "taskCode"; /* 任务编码*/
public static final String FIELD_factory_code = "factoryCode"; /* 工厂编号*/
public static final String FIELD_factory_name = "factoryName"; /* 工厂名称*/
public static final String FIELD_group_code = "groupCode"; /* 工作组编号*/
public static final String FIELD_group_name = "groupName"; /* 工作组名称*/
public static final String FIELD_user_id = "userId"; /* 用户ID*/
public static final String FIELD_user_name = "userName"; /* 用户姓名*/
public static final String COL_id = "id";
public static final String COL_account_code = "account_code"; /* 帐套*/
public static final String COL_dep_code = "dep_code"; /* 部门编码*/
public static final String COL_dep_name = "dep_name"; /* 部门名称*/
public static final String COL_created_by = "created_by"; /* 创建人*/
public static final String COL_created_name = "created_name"; /* 创建人名称*/
public static final String COL_created_time = "created_time"; /* 创建时间*/
public static final String COL_updated_by = "updated_by"; /* 更新人*/
public static final String COL_updated_name = "updated_name"; /* 修改人名称*/
public static final String COL_updated_time = "updated_time"; /* 更新时间*/
public static final String COL_delete_flag = "delete_flag"; /* 0=未删除,1=已删除*/
public static final String COL_order_id = "order_id"; /* 生产订单ID*/
public static final String COL_order_detail_id = "order_detail_id"; /* 生产订单明细ID*/
public static final String COL_task_code = "task_code"; /* 任务编码*/
public static final String COL_factory_code = "factory_code"; /* 工厂编号*/
public static final String COL_factory_name = "factory_name"; /* 工厂名称*/
public static final String COL_group_code = "group_code"; /* 工作组编号*/
public static final String COL_group_name = "group_name"; /* 工作组名称*/
public static final String COL_user_id = "user_id"; /* 用户ID*/
public static final String COL_user_name = "user_name"; /* 用户姓名*/
public static final String QUERY = "HGSC007B.query";
public static final String COUNT = "HGSC007B.count";
public static final String INSERT = "HGSC007B.insert";
public static final String UPDATE = "HGSC007B.update";
public static final String DELETE = "HGSC007B.delete";
private Long id = new Long(0);
private String accountCode = " "; /* 帐套*/
private String depCode = " "; /* 部门编码*/
private String depName = " "; /* 部门名称*/
private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/
private String updatedBy = " "; /* 更新人*/
private String updatedName = " "; /* 修改人名称*/
private String updatedTime = " "; /* 更新时间*/
private Integer deleteFlag; /* 0=未删除,1=已删除*/
private Long orderId = new Long(0); /* 生产订单ID*/
private Long orderDetailId = new Long(0); /* 生产订单明细ID*/
private String taskCode = " "; /* 任务编码*/
private String factoryCode = " "; /* 工厂编号*/
private String factoryName = " "; /* 工厂名称*/
private String groupCode = " "; /* 工作组编号*/
private String groupName = " "; /* 工作组名称*/
private String userId = " "; /* 用户ID*/
private String userName = " "; /* 用户姓名*/
/**
* initialize the metadata.
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn(FIELD_id);
eiColumn.setPrimaryKey(true);
eiColumn.setDescName(" ");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_account_code);
eiColumn.setDescName("帐套");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_dep_code);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_dep_name);
eiColumn.setDescName("部门名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_created_by);
eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_created_name);
eiColumn.setDescName("创建人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_created_time);
eiColumn.setDescName("创建时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_updated_by);
eiColumn.setDescName("更新人");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_updated_name);
eiColumn.setDescName("修改人名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_updated_time);
eiColumn.setDescName("更新时间");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_delete_flag);
eiColumn.setDescName("0=未删除,1=已删除");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_order_id);
eiColumn.setDescName("生产订单ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_order_detail_id);
eiColumn.setDescName("生产订单明细ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_task_code);
eiColumn.setDescName("任务编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_factory_code);
eiColumn.setDescName("工厂编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_factory_name);
eiColumn.setDescName("工厂名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_group_code);
eiColumn.setDescName("工作组编号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_group_name);
eiColumn.setDescName("工作组名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_user_id);
eiColumn.setDescName("用户ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_user_name);
eiColumn.setDescName("用户姓名");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor.
*/
public HGSC007B() {
initMetaData();
}
/**
* get the id .
* @return the id
*/
public Long getId() {
return this.id;
}
/**
* set the id .
*
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* get the accountCode - 帐套.
* @return the accountCode
*/
public String getAccountCode() {
return this.accountCode;
}
/**
* set the accountCode - 帐套.
*
* @param accountCode - 帐套
*/
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
/**
* get the depCode - 部门编码.
* @return the depCode
*/
public String getDepCode() {
return this.depCode;
}
/**
* set the depCode - 部门编码.
*
* @param depCode - 部门编码
*/
public void setDepCode(String depCode) {
this.depCode = depCode;
}
/**
* get the depName - 部门名称.
* @return the depName
*/
public String getDepName() {
return this.depName;
}
/**
* set the depName - 部门名称.
*
* @param depName - 部门名称
*/
public void setDepName(String depName) {
this.depName = depName;
}
/**
* get the createdBy - 创建人.
* @return the createdBy
*/
public String getCreatedBy() {
return this.createdBy;
}
/**
* set the createdBy - 创建人.
*
* @param createdBy - 创建人
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/**
* get the createdName - 创建人名称.
* @return the createdName
*/
public String getCreatedName() {
return this.createdName;
}
/**
* set the createdName - 创建人名称.
*
* @param createdName - 创建人名称
*/
public void setCreatedName(String createdName) {
this.createdName = createdName;
}
/**
* get the createdTime - 创建时间.
* @return the createdTime
*/
public String getCreatedTime() {
return this.createdTime;
}
/**
* set the createdTime - 创建时间.
*
* @param createdTime - 创建时间
*/
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
/**
* get the updatedBy - 更新人.
* @return the updatedBy
*/
public String getUpdatedBy() {
return this.updatedBy;
}
/**
* set the updatedBy - 更新人.
*
* @param updatedBy - 更新人
*/
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
/**
* get the updatedName - 修改人名称.
* @return the updatedName
*/
public String getUpdatedName() {
return this.updatedName;
}
/**
* set the updatedName - 修改人名称.
*
* @param updatedName - 修改人名称
*/
public void setUpdatedName(String updatedName) {
this.updatedName = updatedName;
}
/**
* get the updatedTime - 更新时间.
* @return the updatedTime
*/
public String getUpdatedTime() {
return this.updatedTime;
}
/**
* set the updatedTime - 更新时间.
*
* @param updatedTime - 更新时间
*/
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
/**
* get the deleteFlag - 0=未删除,1=已删除.
* @return the deleteFlag
*/
public Integer getDeleteFlag() {
return this.deleteFlag;
}
/**
* set the deleteFlag - 0=未删除,1=已删除.
*
* @param deleteFlag - 0=未删除,1=已删除
*/
public void setDeleteFlag(Integer deleteFlag) {
this.deleteFlag = deleteFlag;
}
/**
* get the orderId - 生产订单ID.
* @return the orderId
*/
public Long getOrderId() {
return this.orderId;
}
/**
* set the orderId - 生产订单ID.
*
* @param orderId - 生产订单ID
*/
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
/**
* get the orderDetailId - 生产订单明细ID.
* @return the orderDetailId
*/
public Long getOrderDetailId() {
return this.orderDetailId;
}
/**
* set the orderDetailId - 生产订单明细ID.
*
* @param orderDetailId - 生产订单明细ID
*/
public void setOrderDetailId(Long orderDetailId) {
this.orderDetailId = orderDetailId;
}
/**
* get the taskCode - 任务编码.
* @return the taskCode
*/
public String getTaskCode() {
return this.taskCode;
}
/**
* set the taskCode - 任务编码.
*
* @param taskCode - 任务编码
*/
public void setTaskCode(String taskCode) {
this.taskCode = taskCode;
}
/**
* get the factoryCode - 工厂编号.
* @return the factoryCode
*/
public String getFactoryCode() {
return this.factoryCode;
}
/**
* set the factoryCode - 工厂编号.
*
* @param factoryCode - 工厂编号
*/
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
/**
* get the factoryName - 工厂名称.
* @return the factoryName
*/
public String getFactoryName() {
return this.factoryName;
}
/**
* set the factoryName - 工厂名称.
*
* @param factoryName - 工厂名称
*/
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
/**
* get the groupCode - 工作组编号.
* @return the groupCode
*/
public String getGroupCode() {
return this.groupCode;
}
/**
* set the groupCode - 工作组编号.
*
* @param groupCode - 工作组编号
*/
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
/**
* get the groupName - 工作组名称.
* @return the groupName
*/
public String getGroupName() {
return this.groupName;
}
/**
* set the groupName - 工作组名称.
*
* @param groupName - 工作组名称
*/
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* get the userId - 用户ID.
* @return the userId
*/
public String getUserId() {
return this.userId;
}
/**
* set the userId - 用户ID.
*
* @param userId - 用户ID
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* get the userName - 用户姓名.
* @return the userName
*/
public String getUserName() {
return this.userName;
}
/**
* set the userName - 用户姓名.
*
* @param userName - 用户姓名
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* get the value from Map.
*
* @param map - source data map
*/
@Override
public void fromMap(Map map) {
setId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_id)), id));
setAccountCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_account_code)), accountCode));
setDepCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_dep_code)), depCode));
setDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_dep_name)), depName));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_created_by)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_created_name)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_created_time)), createdTime));
setUpdatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_by)), updatedBy));
setUpdatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_name)), updatedName));
setUpdatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_updated_time)), updatedTime));
setDeleteFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_delete_flag)), deleteFlag));
setOrderId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_order_id)), orderId));
setOrderDetailId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_order_detail_id)), orderDetailId));
setTaskCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_task_code)), taskCode));
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_factory_code)), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_factory_name)), factoryName));
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_code)), groupCode));
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_group_name)), groupName));
setUserId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_user_id)), userId));
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_user_name)), userName));
}
/**
* set the value to Map.
*/
@Override
public Map toMap() {
Map map = new HashMap();
map.put(FIELD_id, StringUtils.toString(id, eiMetadata.getMeta(FIELD_id)));
map.put(FIELD_account_code, StringUtils.toString(accountCode, eiMetadata.getMeta(FIELD_account_code)));
map.put(FIELD_dep_code, StringUtils.toString(depCode, eiMetadata.getMeta(FIELD_dep_code)));
map.put(FIELD_dep_name, StringUtils.toString(depName, eiMetadata.getMeta(FIELD_dep_name)));
map.put(FIELD_created_by, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_created_by)));
map.put(FIELD_created_name, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_created_name)));
map.put(FIELD_created_time, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_created_time)));
map.put(FIELD_updated_by, StringUtils.toString(updatedBy, eiMetadata.getMeta(FIELD_updated_by)));
map.put(FIELD_updated_name, StringUtils.toString(updatedName, eiMetadata.getMeta(FIELD_updated_name)));
map.put(FIELD_updated_time, StringUtils.toString(updatedTime, eiMetadata.getMeta(FIELD_updated_time)));
map.put(FIELD_delete_flag, StringUtils.toString(deleteFlag, eiMetadata.getMeta(FIELD_delete_flag)));
map.put(FIELD_order_id, StringUtils.toString(orderId, eiMetadata.getMeta(FIELD_order_id)));
map.put(FIELD_order_detail_id, StringUtils.toString(orderDetailId, eiMetadata.getMeta(FIELD_order_detail_id)));
map.put(FIELD_task_code, StringUtils.toString(taskCode, eiMetadata.getMeta(FIELD_task_code)));
map.put(FIELD_factory_code, StringUtils.toString(factoryCode, eiMetadata.getMeta(FIELD_factory_code)));
map.put(FIELD_factory_name, StringUtils.toString(factoryName, eiMetadata.getMeta(FIELD_factory_name)));
map.put(FIELD_group_code, StringUtils.toString(groupCode, eiMetadata.getMeta(FIELD_group_code)));
map.put(FIELD_group_name, StringUtils.toString(groupName, eiMetadata.getMeta(FIELD_group_name)));
map.put(FIELD_user_id, StringUtils.toString(userId, eiMetadata.getMeta(FIELD_user_id)));
map.put(FIELD_user_name, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_user_name)));
return map;
}
}
......@@ -7,8 +7,11 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
......@@ -23,7 +26,6 @@ import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -113,6 +115,8 @@ public class ServiceHGSC006A extends ServiceBase {
hgsc007.setFactoryCode(factoryCode);
hgsc007.setFactoryName(factoryName);
DaoUtils.insert(HGSC007.INSERT, hgsc007);
// 写入派工人员明细
HgScUtils.HgSc007B.addGroupUser(hgsc007);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + orderDetailIds.length + "]条数据分派成功!");
......
......@@ -3,17 +3,25 @@ package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC098;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -23,7 +31,11 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
......@@ -205,6 +217,8 @@ public class ServiceHGSC006B extends ServiceBase {
add007.setLength(hgpz005.getLength());
}
DaoUtils.insert(HGSC007.INSERT, add007);
// 写入派工人员明细
HgScUtils.HgSc007B.addGroupUser(add007);
}
private void cleanBaseInfo(HGSC007 hgsc007){
......@@ -229,7 +243,7 @@ public class ServiceHGSC006B extends ServiceBase {
private void modify(HGSC006A hgsc006A, HGSC007 hgsc007, List<HGSC007> hgsc007List) {
Long orderDetailId = hgsc006A.getId();
// 数据校验
HGSC007 dbSc007 = hgsc007List.stream().filter(o -> o.getId().compareTo(hgsc007.getId())==0).findAny().get();
HGSC007 dbSc007 = hgsc007List.stream().filter(o -> o.getId().compareTo(hgsc007.getId()) == 0).findAny().get();
AssertUtils.isGt(new BigDecimal(dbSc007.getFinishQuantity()), new BigDecimal(hgsc007.getQuantity()),
String.format("任务[%s]修改后的数量不能小于已完工的数量", hgsc007.getTaskCode()));
// 计算差异数量
......@@ -239,9 +253,10 @@ public class ServiceHGSC006B extends ServiceBase {
// 更新子单
hgsc007.setTotalWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc007.getQuantity())));
DaoUtils.update(HGSC007.UPDATE, hgsc007);
// 更新派工人员
HgScUtils.HgSc007B.modifyGroupUser(hgsc007);
}
/**
* 删除操作.
*
......@@ -264,6 +279,8 @@ public class ServiceHGSC006B extends ServiceBase {
HGSCTools.checkAssignedNum(orderDetailId, -hgsc007.getQuantity());
// 删除子单
DaoUtils.update(HGSC007.DELETE, hgsc007);
// 清除已经分配的人员信息
DaoUtils.update(HgScSqlConstant.HgSc007B.DELETE_BY_ORDER, hgsc007);
}
inInfo = this.query(inInfo);
// 刷新主订单信息
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* 派工人员信息
*
* @author:songx
* @date:2024/9/14,14:30
*/
public class ServiceHGSC007B extends ServiceEPBase {
/**
* 初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC007B().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007B.QUERY_DISTINCT, new HGSC007B());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 去重查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产报工", operType = "报工", operDesc = "初始化页面")
public EiInfo queryDistinct(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HgScSqlConstant.HgSc007B.QUERY_DISTINCT, new HGSC007B());
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC007B">
<sql id="column">
id as "id",
account_code as "accountCode", <!-- 帐套 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime", <!-- 更新时间 -->
delete_flag as "deleteFlag", <!-- 0=未删除,1=已删除 -->
order_id as "orderId", <!-- 生产订单ID -->
order_detail_id as "orderDetailId", <!-- 生产订单明细ID -->
task_code as "taskCode", <!-- 任务编码 -->
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
user_id as "userId", <!-- 用户ID -->
user_name as "userName" <!-- 用户姓名 -->
</sql>
<sql id="condition">
AND DELETE_FLAG = 0
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderId">
order_id = #orderId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderDetailId">
order_detail_id = #orderDetailId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="taskCode">
task_code = #taskCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
factory_code = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
factory_name like concat('%', #factoryName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
group_code = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
group_name like concat('%', #groupName#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userId">
user_id = #userId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="userName">
user_name like concat('%', #userName#, '%')
</isNotEmpty>
</sql>
<sql id="orderBy">
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
id asc
</isEmpty>
</dynamic>
</sql>
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007B">
SELECT
<include refid="column"/>
FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
<include refid="orderBy"/>
</select>
<select id="count" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
</select>
<!-- 去重查询 -->
<select id="queryDistinct" resultClass="com.baosight.hggp.hg.sc.domain.HGSC007B">
SELECT DISTINCT
factory_code as "factoryCode", <!-- 工厂编号 -->
factory_name as "factoryName", <!-- 工厂名称 -->
group_code as "groupCode", <!-- 工作组编号 -->
group_name as "groupName", <!-- 工作组名称 -->
user_id as "userId", <!-- 用户ID -->
user_name as "userName" <!-- 用户姓名 -->
FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
ORDER BY FACTORY_CODE DESC, GROUP_CODE DESC, USER_ID DESC
</select>
<select id="countDistinct" resultClass="int">
SELECT COUNT(*) FROM ${hggpSchema}.HGSC007B WHERE 1=1
<include refid="condition"/>
</select>
<insert id="insert">
INSERT INTO ${hggpSchema}.HGSC007B (
account_code, <!-- 帐套 -->
dep_code, <!-- 部门编码 -->
dep_name, <!-- 部门名称 -->
created_by, <!-- 创建人 -->
created_name, <!-- 创建人名称 -->
created_time, <!-- 创建时间 -->
delete_flag, <!-- 0=未删除,1=已删除 -->
order_id, <!-- 生产订单ID -->
order_detail_id, <!-- 生产订单明细ID -->
task_code, <!-- 任务编码 -->
factory_code, <!-- 工厂编号 -->
factory_name, <!-- 工厂名称 -->
group_code, <!-- 工作组编号 -->
group_name, <!-- 工作组名称 -->
user_id, <!-- 用户ID -->
user_name <!-- 用户姓名 -->
) VALUES (
#accountCode#, #depCode#, #depName#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #orderId#, #orderDetailId#, #taskCode#, #factoryCode#,
#factoryName#, #groupCode#, #groupName#, #userId#, #userName#)
</insert>
<!-- 批量新增 -->
<insert id="batchInsert">
INSERT INTO ${hggpSchema}.HGSC007B (
account_code, dep_code, dep_name, created_by, created_name,
created_time, delete_flag, order_id, order_detail_id, task_code,
factory_code, factory_name, group_code, group_name, user_id, user_name
) VALUES
<iterate open="(" conjunction="),(" close=")" property="rows">
#rows[].accountCode#, #rows[].depCode#, #rows[].depName#, #rows[].createdBy#,
#rows[].createdName#, #rows[].createdTime#, #rows[].deleteFlag#, #rows[].orderId#,
#rows[].orderDetailId#, #rows[].taskCode#, #rows[].factoryCode#,
#rows[].factoryName#, #rows[].groupCode#, #rows[].groupName#,
#rows[].userId#, #rows[].userName#
</iterate>
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGSC007B WHERE id = #id#
</delete>
<update id="update">
UPDATE ${hggpSchema}.HGSC007B
SET
created_by = #createdBy#, <!-- 创建人 -->
created_name = #createdName#, <!-- 创建人名称 -->
created_time = #createdTime#, <!-- 创建时间 -->
order_id = #orderId#, <!-- 生产订单ID -->
order_detail_id = #orderDetailId#, <!-- 生产订单明细ID -->
task_code = #taskCode#, <!-- 任务编码 -->
factory_code = #factoryCode#, <!-- 工厂编号 -->
factory_name = #factoryName#, <!-- 工厂名称 -->
group_code = #groupCode#, <!-- 工作组编号 -->
group_name = #groupName#, <!-- 工作组名称 -->
user_id = #userId#, <!-- 用户ID -->
user_name = #userName# <!-- 用户姓名 -->
WHERE id = #id#
</update>
<!-- 根据订单清除 -->
<update id="deleteByOrder">
UPDATE FROM ${hggpSchema}.HGSC007B
SET DELETE_FLAG = 1
<include refid="SqlBase.updateRevise"/>
WHERE ORDER_DETAIL_ID = #orderDetailId#
</update>
</sqlMap>
......@@ -28,6 +28,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC005A;
import com.baosight.hggp.hg.sc.domain.HGSC006;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.domain.HGSC009;
import com.baosight.hggp.hg.sc.domain.HGSC009A;
......@@ -1543,6 +1544,29 @@ public class HGSCTools {
}
/**
* HGSC007B SQL 定义
*
* @author:songx
* @date:2024/9/14,14:34
*/
public static class HgSc007B {
/**
* 根据用户查询
*
* @param userId
* @return
*/
public static List<HGSC007B> listByUser(String userId) {
AssertUtils.isEmpty(userId, "用户ID不能为空!");
Map queryMap = new HashMap();
queryMap.put(HGSC007B.FIELD_user_id, userId);
return DaoBase.getInstance().query(HGSC007B.QUERY, queryMap);
}
}
/**
* @author:songx
* @date:2024/9/10,9:27
*/
......
package com.baosight.hggp.hg.sc.util;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC007B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -31,17 +38,84 @@ public class HgScUtils {
* @param queryMap
*/
public static void setOrgCondition(Map queryMap) {
String userId = UserSessionUtils.getLoginName();
// 超级管理员看所有数据
if (LoginUserDetails.isUserAdmin(UserSessionUtils.getLoginName())) {
if (LoginUserDetails.isUserAdmin(userId)) {
return;
}
// 查询自己所在组的任务 added by songx at 20240820
List<String> allGroupNames = UserSessionUtils.getAllGroupName();
if (CollectionUtils.isNotEmpty(allGroupNames)) {
queryMap.put("groupNames", allGroupNames);
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
// 查询历史分配的组任务
List<HGSC007B> dbSc007Bs = HGSCTools.HgSc007B.listByUser(userId);
if (CollectionUtils.isEmpty(allGroupNames) && CollectionUtils.isEmpty(dbSc007Bs)) {
return;
}
if (allGroupNames == null) {
allGroupNames = new ArrayList<>();
}
if (dbSc007Bs != null) {
List<String> historyGroupNames = dbSc007Bs.stream().map(HGSC007B::getGroupName)
.collect(Collectors.toList());
// 合并班组信息
allGroupNames.addAll(historyGroupNames);
}
queryMap.put("groupNames", allGroupNames.stream().distinct().collect(Collectors.toList()));
queryMap.put("enableRoleAuth", CommonConstant.YesNo.NO_0);
}
}
/**
* HGSC007B 定义
*
* @author:songx
* @date:2024/9/14,14:35
*/
public static class HgSc007B {
/**
* 新增组人员
*
* @param sc007
*/
public static void addGroupUser(HGSC007 sc007) {
// 查询组下的所有人员
List<User> users = HGXSTools.XsUser.queryByOrg(sc007.getGroupCode());
if (CollectionUtils.isEmpty(users)) {
return;
}
List<HGSC007B> newSc007Bs = users.stream().map(user -> {
HGSC007B newSc007B = BeanUtils.copy(sc007, HGSC007B.class);
newSc007B.setUserId(user.getLoginName());
newSc007B.setUserName(user.getUserName());
newSc007B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
return newSc007B;
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
/**
* 更新组人员
*
* @param sc007
*/
public static void modifyGroupUser(HGSC007 sc007) {
// 清除已经分配的人员信息
DaoUtils.update(HgScSqlConstant.HgSc007B.DELETE_BY_ORDER, sc007);
// 查询组下的所有人员
List<User> users = HGXSTools.XsUser.queryByOrg(sc007.getGroupCode());
if (CollectionUtils.isEmpty(users)) {
return;
}
List<HGSC007B> newSc007Bs = users.stream().map(user -> {
HGSC007B newSc007B = BeanUtils.copy(sc007, HGSC007B.class);
newSc007B.setUserId(user.getLoginName());
newSc007B.setUserName(user.getUserName());
newSc007B.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
return newSc007B;
}).collect(Collectors.toList());
DaoUtils.batchInsert(HgScSqlConstant.HgSc007B.BATCH_INSERT, newSc007Bs);
}
}
}
......@@ -214,6 +214,19 @@ public class HGXSTools {
/**
* 查询用户
*
* @param orgId
* @return
*/
public static List<User> queryByOrg(String orgId) {
AssertUtils.isEmpty(orgId, "组织ID不能为空");
Map paramMap = new HashMap();
paramMap.put("orgId", orgId);
return DaoBase.getInstance().query(HGSqlConstant.HgXsUser.QUERY_BY_ORG, paramMap);
}
/**
* 查询用户
*
* @param orgIds
* @return
*/
......
......@@ -73,6 +73,7 @@
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC006A.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC007B.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC008.xml"/>
<sqlMap resource="com/baosight/hggp/hg/sc/sql/HGSC009.xml"/>
......
......@@ -10,18 +10,18 @@ $(function () {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="showInfo(\'' + item.orderCode + '\')" >订单详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>';
return template;
}
}
],
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showInfo(\'' + item.orderCode + '\')" >订单详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showGroupUser(' + item.id + ')" >人员明细</a>';
return template;
}
}],
loadComplete: function(grid) {
},
onSuccess: function (e) {
......@@ -68,3 +68,16 @@ function showUploadFile(id) {
});
}
/**
* 显示班组人员明细
*
* @param orderCode
*/
function showGroupUser(id) {
JSColorbox.open({
href: "HGSC007B?inqu_status-0-orderId=" + id,
title: "<div style='text-align: center;'>班组人员明细</div>",
width: "85%",
height: "80%",
});
}
......@@ -27,7 +27,7 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="160" align="center" />
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="200" align="center" />
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="true" align="center" readOnly="true"/>
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [20, 50, 70, 100],
},
columns: []
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 初始化
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
function query() {
resultGrid.dataSource.page(1);
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="派工人员明细">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="orderId" cname="生产订单ID" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput ename="orderDetailId" cname="生产订单明细ID" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFInput ename="factoryName" cname="厂区名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="groupName" cname="班组名称" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput ename="userName" cname="人员姓名" blockId="inqu_status" row="0" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="数据集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" autoBind="false">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="factoryName" cname="厂区名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="groupCode" cname="班组编码" enable="false" width="120" align="center"/>
<EF:EFColumn ename="groupName" cname="班组名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userId" cname="人员ID" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="人员名称" enable="false" width="120" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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