Browse Source

[feat][feat] 修改该开发修改添加页面,新增查询生产单物料方法,新增查询生产物料bom信息查询方法,新增开发修改单子表信息,新增bom查询父级及相关部门根据materialNo查询bom信息。开发修改单调整页面样式。

dev
zhangsiqi 6 months ago
parent
commit
8734a3c492
  1. 2
      ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/IProcessService.java
  2. 68
      ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/impl/ProcessServiceImpl.java
  3. 3
      ruoyi-activiti/src/main/java/com/ruoyi/process/todoitem/service/IBizTodoItemService.java
  4. 69
      ruoyi-activiti/src/main/java/com/ruoyi/process/todoitem/service/impl/BizTodoItemServiceImpl.java
  5. 25
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java
  6. 5
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java
  7. 11
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  8. 97
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  9. 122
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
  10. 2
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  11. 33
      ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
  12. 1
      ruoyi-admin/src/main/resources/templates/erp/bom/edit.html
  13. 368
      ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/add.html
  14. 12
      ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

2
ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/IProcessService.java

@ -37,6 +37,8 @@ public interface IProcessService {
boolean complete(String taskId, String instanceId, String itemName, String itemContent, String module, Map<String, Object> variables, HttpServletRequest request);
boolean complete2(String taskId, String instanceId, String itemName, String itemContent, String module, Map<String, Object> variables, HttpServletRequest request);
/**
* 判断流程是否结束
* @return

68
ruoyi-activiti/src/main/java/com/ruoyi/process/general/service/impl/ProcessServiceImpl.java

@ -187,7 +187,75 @@ public class ProcessServiceImpl implements IProcessService {
}
return agree;
}
@Override
public boolean complete2(String taskId, String instanceId, String itemName, String itemContent, String module, Map<String, Object> variables, HttpServletRequest request) {
Enumeration<String> parameterNames = request.getParameterNames();
String comment = null; // 批注
boolean agree = true;
try {
while (parameterNames.hasMoreElements()) {
String parameterName = parameterNames.nextElement();
if (parameterName.startsWith("p_")) {
// 参数结构:p_B_name,p为参数的前缀,B为类型,name为属性名称
String[] parameter = parameterName.split("_");
if (parameter.length == 3) {
String paramValue = request.getParameter(parameterName);
Object value = paramValue;
if (parameter[1].equals("B")) {
value = BooleanUtils.toBoolean(paramValue);
agree = (boolean) value;
} else if (parameter[1].equals("DT")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
value = sdf.parse(paramValue);
} else if (parameter[1].equals("COM")) {
comment = paramValue;
}
variables.put(parameter[2], value);
} else {
throw new RuntimeException("invalid parameter for activiti variable: " + parameterName);
}
}
}
if (StringUtils.isNotEmpty(comment)) {
identityService.setAuthenticatedUserId(ShiroUtils.getLoginName());
comment = agree ? "【同意】" + comment : "【拒绝】" + comment;
taskService.addComment(taskId, instanceId, comment);
}
// 被委派人处理完成任务
// p.s. 被委托的流程需要先 resolved 这个任务再提交。
// 所以在 complete 之前需要先 resolved
// resolveTask() 要在 claim() 之前,不然 act_hi_taskinst 表的 assignee 字段会为 null
taskService.resolveTask(taskId, variables);
// 只有签收任务,act_hi_taskinst 表的 assignee 字段才不为 null
taskService.claim(taskId, ShiroUtils.getLoginName());
taskService.complete(taskId, variables);
// 更新待办事项状态
BizTodoItem query = new BizTodoItem();
query.setTaskId(taskId);
// 考虑到候选用户组(或签,多个待办只要一人审批通过就行),会有多个 todoitem 办理同个 task
List<BizTodoItem> updateList = CollectionUtils.isEmpty(bizTodoItemService.selectBizTodoItemList(query)) ? null : bizTodoItemService.selectBizTodoItemList(query);
for (BizTodoItem update: updateList) {
// 找到当前登录用户的 todoitem,置为已办
if (update.getTodoUserId().equals(ShiroUtils.getLoginName())) {
update.setIsView("1");
update.setIsHandle("1");
update.setHandleUserId(ShiroUtils.getLoginName());
update.setHandleUserName(ShiroUtils.getSysUser().getUserName());
update.setHandleTime(DateUtils.getNowDate());
bizTodoItemService.updateBizTodoItem(update);
} else {
bizTodoItemService.deleteBizTodoItemById(update.getId()); // 删除候选用户组其他 todoitem
}
}
// 下一节点处理人待办事项
bizTodoItemService.insertTodoItem(instanceId, itemName, itemContent, module);
} catch (Exception e) {
logger.error("error on complete task {}, variables={}", new Object[]{taskId, variables, e});
}
return agree;
}
@Override
public boolean judgeProcessIsFinish(String instanceId) {
boolean result = false;

3
ruoyi-activiti/src/main/java/com/ruoyi/process/todoitem/service/IBizTodoItemService.java

@ -61,6 +61,9 @@ public interface IBizTodoItemService {
* @return 结果
*/
public int deleteBizTodoItemById(Long id);
int insertTodoItem2(String instanceId, String itemName, String itemContent, String module);
int insertTodoItem(String instanceId, BizLeaveVo leave, String module);
public List<BizTodoItem> getTodoItemList(Map<String, Object> paraMap);

69
ruoyi-activiti/src/main/java/com/ruoyi/process/todoitem/service/impl/BizTodoItemServiceImpl.java

@ -204,7 +204,76 @@ public class BizTodoItemServiceImpl implements IBizTodoItemService {
}
return counter;
}
@Override
public int insertTodoItem2(String instanceId, String itemName, String itemContent, String module) {
BizTodoItem todoItem = new BizTodoItem();
todoItem.setItemName(itemName);
todoItem.setItemContent(itemContent);
todoItem.setIsView("0");
todoItem.setIsHandle("0");
todoItem.setModule(module);
todoItem.setTodoTime(DateUtils.getNowDate());
List<Task> taskList = taskService.createTaskQuery().processInstanceId(instanceId).active().list();
int counter = 0;
for (Task task: taskList) {
// todoitem 去重
List<BizTodoItem> bizTodoItem = bizTodoItemMapper.selectTodoItemByTaskId(task.getId(),null);
if (!CollectionUtils.isEmpty(bizTodoItem)) continue;
BizTodoItem newItem = new BizTodoItem();
BeanUtils.copyProperties(todoItem, newItem);
newItem.setInstanceId(instanceId);
newItem.setTaskId(task.getId());
newItem.setTaskName("task" + task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1));
newItem.setNodeName(task.getName());
String assignee = task.getAssignee();
//todo 如果是本部门经理审核节点,查询当前提交的用户是部门角色,提取申请人对应部门经理
if (task.getTaskDefinitionKey().equals("deptManagerAudit")) {
//查询当前提交的用户是部门角色,提取申请人对应部门经理
String todoUserId = bizTodoItemMapper.selectTodoUserByTaskId(task.getId());
SysUser todoUser = userMapper.selectUserByLoginName(todoUserId);
newItem.setTodoUserId(todoUser.getLoginName());
newItem.setTodoUserName(todoUser.getUserName());
}
//todo 如果是本部门主管审核节点,查询当前提交的是提交人部门,提取申请人对应部门主管角色
if (task.getTaskDefinitionKey().equals("deptLeaderAudit")) {
//查询当前提交的用户是部门角色,提取申请人对应部门经理
String todoUserId = bizTodoItemMapper.selectTodoUserByTaskId(task.getId());
SysUser todoUser = userMapper.selectUserByLoginName(todoUserId);
newItem.setTodoUserId(todoUser.getLoginName());
newItem.setTodoUserName(todoUser.getUserName());
}
// 代理人
if (StringUtils.isNotBlank(assignee)) {
newItem.setTodoUserId(assignee);
SysUser user = userMapper.selectUserByLoginName(assignee);
newItem.setTodoUserName(user.getUserName());
bizTodoItemMapper.insertBizTodoItem(newItem);
counter++;
} else {
// 查询候选用户组,系统用户角色视图,group是角色
List<String> todoUserIdList = bizTodoItemMapper.selectTodoUserListByTaskId(task.getId());
if (!CollectionUtils.isEmpty(todoUserIdList)) {
for (String todoUserId: todoUserIdList) {
SysUser todoUser = userMapper.selectUserByLoginName(todoUserId);
newItem.setTodoUserId(todoUser.getLoginName());
newItem.setTodoUserName(todoUser.getUserName());
bizTodoItemMapper.insertBizTodoItem(newItem);
counter++;
}
} else {
// 查询候选用户,用户id匹配的上
String todoUserId = bizTodoItemMapper.selectTodoUserByTaskId(task.getId());
SysUser todoUser = userMapper.selectUserByLoginName(todoUserId);
newItem.setTodoUserId(todoUser.getLoginName());
newItem.setTodoUserName(todoUser.getUserName());
bizTodoItemMapper.insertBizTodoItem(newItem);
counter++;
}
}
}
return counter;
}
@Override
public int insertTodoItem(String instanceId, BizLeaveVo leave, String module) {
BizTodoItem todoItem = new BizTodoItem();

25
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java

@ -31,10 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* 物料bom信息Controller
@ -87,8 +84,24 @@ public class ErpBomController extends BaseController
startPage();
List<ErpBomVo> list = erpBomService.selectErpBomList(erpBomVo);
return getDataTable(list);
}
@RequiresPermissions("erp:bom:list")
@PostMapping("/reverseList")
@ResponseBody
public TableDataInfo selectErpBomVoReverse(ErpBomVo erpBomVo,HttpServletRequest request) {
Map<String, Object> map = new HashMap<>();
map.put("materialNo", erpBomVo.getMaterialNo());
map.put("materialName", erpBomVo.getMaterialName());
List<ErpBomVo> materialList = erpBomService.selectErpBomByMaterialNos(erpBomVo.getMaterialNo());
//将返回结果根据父节点进行排序
List<Long> parentIds = erpBomService.getAllParentIds(materialList);
Map<String, Object> map2 = new HashMap<>();
map2.put("parentIds", parentIds);
ErpBomVo erpBomVo1 = new ErpBomVo();
List<ErpBomVo> list1 = erpBomService.selectErpBomList(erpBomVo1);
startPage();
List<ErpBomVo> list = erpBomService.selectErpBomListReverse(list1);
return getDataTable(list);
}
/**

5
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java

@ -5,6 +5,7 @@ import com.ruoyi.erp.domain.ErpBomVo;
import com.ruoyi.erp.domain.ErpMaterialVo;
import java.util.List;
import java.util.Map;
/**
* bomMapper接口
@ -134,4 +135,8 @@ public interface ErpBomMapper
ErpBomVo selectErpBomByMaterialNo(String materialNo);
List<ErpBomVo> selectErpBomByMaterialNos(String materialNo);
List<ErpBomVo> selectSubBomsByParentMaterialNo(Map<String, Object> params, List<String> materialTypes);
List<ErpBomVo> selectErpBomByParentIds(Map<String, Object> params);
}

11
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -7,6 +7,7 @@ import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
* bomService接口
@ -36,6 +37,16 @@ public interface IErpBomService
List<ErpBom> selectErpBomAllLevelList(ErpBom erpBom);
void recursionSubBom(List<ErpBom> resultList, String materialNo, Long level);
List<Long> getAllParentIds(List<ErpBomVo> startIds);
void collectParentIdsRecursively(List<Long> parents, Long currentId);
List<ErpBomVo> selectErpBomListReverse(List<ErpBomVo> erpBomVoList);
List<ErpBomVo> selectErpBomByMaterialNos(String materialNo);
/**
* 新增bom
*

97
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

@ -15,6 +15,7 @@ import com.ruoyi.erp.mapper.ErpBomMapper;
import com.ruoyi.erp.mapper.ErpMaterialMapper;
import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.erp.service.IErpMaterialService;
import com.ruoyi.framework.web.service.CategoryService;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.system.mapper.SysUserMapper;
@ -31,10 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Pattern;
/**
* bomService业务层处理
@ -80,6 +78,8 @@ private ISysAttachService attachService;
@Autowired
private ErpMaterialMapper materialMapper;
@Autowired
private CategoryService categoryService;
/**
* 查询bom
*
@ -181,8 +181,8 @@ private ISysAttachService attachService;
return resultList;
}
private void recursionSubBom(List<ErpBom> resultList, String materialNo, Long level) {
@Override
public void recursionSubBom(List<ErpBom> resultList, String materialNo, Long level) {
ErpBom subBom = erpBomMapper.selectErpBomByOneMaterialNo(materialNo);
if(subBom!=null){
Long subId = subBom.getId();
@ -204,6 +204,93 @@ private ISysAttachService attachService;
}
}
// 获取所有父节点id
@Override
public List<Long> getAllParentIds(List<ErpBomVo> startList) {
List<Long> allParentIds = new ArrayList<>();
List<Long> startIds = new ArrayList<>();
for (ErpBomVo erpBomVo : startList) {
Long id = erpBomVo.getId();
startIds.add(id);
}
for (Long startId : startIds) {
collectParentIdsRecursively(allParentIds, startId);
}
return allParentIds;
}
// 递归获取所有父节点id
@Override
public void collectParentIdsRecursively(List<Long> parents, Long currentId) {
// 新增条件:遇到parentId为0时停止递归
if (currentId.equals(0)) {
return;
}
Map<String, Object> param = new HashMap<>();
param.put("parentId", currentId);
List<ErpBomVo> children = erpBomMapper.selectErpBomByParentIds(param);
for (ErpBomVo child : children) {
// 避免循环引用,这里假设id和parentId不会相等
if (!parents.contains(child.getId())) {
parents.add(child.getId());
// 继续递归,直到遇到parentId为0的节点
collectParentIdsRecursively(parents, child.getId());
}
}
}
@Override
public List<ErpBomVo> selectErpBomListReverse(List<ErpBomVo> erpBomVoList)
{
List<ErpBomVo> returnList = new ArrayList<>();
for (ErpBomVo bomVo: erpBomVoList) {
SysUser sysUser = userMapper.selectUserByLoginName(bomVo.getCreateBy());
if (sysUser != null) {
bomVo.setCreateUserName(sysUser.getUserName());
}
SysUser sysUser2 = userMapper.selectUserByLoginName(bomVo.getApplyUser());
if (sysUser2 != null) {
bomVo.setApplyUserName(sysUser2.getUserName());
}
String instanceId = bomVo.getInstanceId();
// 当前环节
if (StringUtils.isNotBlank(instanceId)) {
List<Task> taskList = taskService.createTaskQuery()
.processInstanceId(instanceId)
// .singleResult();
.list(); // 例如请假会签,会同时拥有多个任务
if (!org.springframework.util.CollectionUtils.isEmpty(taskList)) {
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0);
String taskId = task.getId();
bomVo.setTaskId(taskId);
// 设置待办用户
List<String> todoUserList = todoItemMapper.selectUndealTodoUserList(taskId);
if(!org.springframework.util.CollectionUtils.isEmpty(taskList)){
bomVo.setTodoUserId(String.join(",",todoUserList));
}
if (task.getSuspensionState() == 2) {
bomVo.setTaskName("已挂起");
bomVo.setSuspendState("2");
} else {
bomVo.setTaskName(task.getName());
bomVo.setSuspendState("1");
}
} else {
// 已办结或者已撤销
bomVo.setTaskName("已结束");
}
} else {
bomVo.setTaskName("未启动");
}
returnList.add(bomVo);
}
Integer total = erpBomVoList.size();
return returnList;
}
@Override
public List<ErpBomVo> selectErpBomByMaterialNos(String materialNo) {
return erpBomMapper.selectErpBomByMaterialNos(materialNo);
}
/**
* 新增bom
*

122
ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

@ -137,6 +137,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="applyUser != null and applyUser != ''"> and erp.apply_user = #{applyUser}</if>
<if test="applyTime != null "> and erp.apply_time = #{applyTime}</if>
<if test="keyword != null and keyword != ''"> and (erp.material_no like concat('%',#{keyword},'%') or erp.material_name like concat('%',#{keyword},'%'))</if>
<if test="params.parentIds != null and params.parentIds != ''">
and erp.id in
<foreach collection="parendIds" item="parendId" index="index"
open="(" separator="," close=")">
#{parendId}
</foreach>
and erp.level = 0
</if>
and erp.bom_no != ''
</where>
order by erp.create_time desc
@ -397,4 +405,118 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on erp_material.id = file.rel_id
where erp.material_no = #{materialNo}
</select>
<select id="selectSubBomsByParentMaterialNo" parameterType="map" resultMap="ErpBomResult">
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time,
erp.remark,erp.bom_no,erp.material_no,erp.material_name, erp.audit_status, erp.use_status,
erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.engineer,
erp.use_num,erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id,
erp.instance_type, processDict.dict_label as instance_type_name, erp.submit_instance_id,
erp.cancel_instance_id, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time,
file.url as photo_url,cate.name as material_type_name from erp_bom as erp
left join (
select id,material_no,material_name from erp_material
) erp_material
on erp.material_no = erp_material.material_no
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) processDict
on erp.instance_type = processDict.dict_value
left join (
select code,name from sys_category
where parent_id in(
select id from sys_category
where parent_id = (select id from sys_category where code = 'materialType') )
) cate
on erp.material_type = cate.code
left join (
select att.rel_id,file.url,min(file.create_time) as create_time from sys_attach as att
left join sys_attach_file as file
on att.id = file.attach_id
where att.source_type = 'erpMaterial' and att.source_sub_type = 'photo'
group by att.rel_id
) file
on erp_material.id = file.rel_id
WHERE
erp.material_no in #{params.materialNo}
<if test="params.materialName != null and params.materialName != ''">
and erp.material_name in #{params.materialName}
</if>
<if test="params.bomNO != null and params.bomNo != ''">
and erp.bom_no in #{params.bomNo}
</if>
AND erp.material_type IN
<foreach item="type" index="index" collection="materialTypes" separator=",">
#{type}
</foreach>
</select>
<select id="selectErpBomByMaterialNos" parameterType="String" resultMap="ErpBomResult">
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time,
erp.remark,erp.bom_no,erp.material_no,erp.material_name, erp.audit_status, erp.use_status,
erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.engineer,
erp.use_num,erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id,
erp.instance_type, processDict.dict_label as instance_type_name, erp.submit_instance_id,
erp.cancel_instance_id, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time,
file.url as photo_url,cate.name as material_type_name from erp_bom as erp
left join (
select id,material_no,material_name from erp_material
) erp_material
on erp.material_no = erp_material.material_no
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) processDict
on erp.instance_type = processDict.dict_value
left join (
select code,name from sys_category
where parent_id in(
select id from sys_category
where parent_id = (select id from sys_category where code = 'materialType') )
) cate
on erp.material_type = cate.code
left join (
select att.rel_id,file.url,min(file.create_time) as create_time from sys_attach as att
left join sys_attach_file as file
on att.id = file.attach_id
where att.source_type = 'erpMaterial' and att.source_sub_type = 'photo'
group by att.rel_id
) file
on erp_material.id = file.rel_id
where erp.material_no = #{materialNo}
</select>
<select id="selectErpBomByParentIds" parameterType="Map" resultMap="ErpBomResult">
select erp.id, erp.del_flag, erp.create_by, erp.create_time, erp.update_by, erp.update_time,
erp.remark,erp.bom_no,erp.material_no,erp.material_name, erp.audit_status, erp.use_status,
erp.material_type, erp.process_method,erp.unit, erp.brand, erp.`describe`,erp.engineer,
erp.use_num,erp.loss_rate, erp.parent_id, erp.`level`, erp.sort_no, erp.instance_id,
erp.instance_type, processDict.dict_label as instance_type_name, erp.submit_instance_id,
erp.cancel_instance_id, erp.restore_instance_id,erp.apply_title,erp.apply_user,erp.apply_time,
file.url as photo_url,cate.name as material_type_name from erp_bom as erp
left join (
select id,material_no,material_name from erp_material
) erp_material
on erp.material_no = erp_material.material_no
left join(
select dict_value,dict_label from sys_dict_data
where dict_type = 'processType'
) processDict
on erp.instance_type = processDict.dict_value
left join (
select code,name from sys_category
where parent_id in(
select id from sys_category
where parent_id = (select id from sys_category where code = 'materialType') )
) cate
on erp.material_type = cate.code
left join (
select att.rel_id,file.url,min(file.create_time) as create_time from sys_attach as att
left join sys_attach_file as file
on att.id = file.attach_id
where att.source_type = 'erpMaterial' and att.source_sub_type = 'photo'
group by att.rel_id
) file
on erp_material.id = file.rel_id
where erp.parent_id = #{parentId}
</select>
</mapper>

2
ruoyi-admin/src/main/resources/templates/erp/bom/add.html

@ -102,7 +102,7 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "erp/bom"
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]];

33
ruoyi-admin/src/main/resources/templates/erp/bom/bom.html

@ -12,15 +12,15 @@
<ul>
<li>
<label>料号:</label>
<input type="text" name="materialNo"/>
<input type="text" id="selectMaterialNo" name="materialNo"/>
</li>
<li>
<label>bom号:</label>
<input type="text" name="bomNo"/>
<input type="text" id="selectBomNo" name="bomNo"/>
</li>
<li>
<label>物料名称:</label>
<input type="text" name="materialName"/>
<input type="text" id="selectMaterialName" name="materialName"/>
</li>
<li>
<label>物料类型:</label>
@ -65,7 +65,7 @@
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
<a class="btn btn-primary btn-rounded btn-sm" onclick="searchbom()"><i class="fa fa-search"></i>反向BOM</a>
<a class="btn btn-primary btn-rounded btn-sm" onclick="seachReverseBom()"><i class="fa fa-search"></i>反向BOM</a>
</li>
</ul>
</div>
@ -762,13 +762,24 @@
};
$.modal.openOptions(options);
}
function seachBom(){
var url = ctx + "erp/bom/searchBom";
var options = {
title: '反向BOM',
url: url
};
$.modal.openOptions(options);
function seachReverseBom(){
var url = ctx + "erp/bom/reverseList";
//将获取的page类型数据放入bootstarpTable中
$.ajax({
type: "POST",
url: url,
data: {
"bomNo":$("#selectBomNo").val(),
"materialNo":$("#selectMaterialNo").val(),
"materialName":$("#selectmMaterialName").val(),
},
success: function (result) {
if (result.code == 0) {
$("#bootstrap-table").bootstrapTable('destroy');
$("#bootstrap-table").bootstrapTable( 'load',result.rows);
}
}
});
}
</script>
</body>

1
ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

@ -91,6 +91,7 @@
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: select2-js" />
<script th:src="@{/js/activiti.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "erp/bom";
var erpBom = [[${erpBom}]];

368
ruoyi-admin/src/main/resources/templates/erp/developModifyOrder/add.html

@ -2,25 +2,27 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增开发修改单')" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-editable-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-developModifyOrder-add">
<div class="form-group">
<div class="form-group" hidden="hidden">
<label class="col-sm-3 control-label">开发修改单号:</label>
<div class="col-sm-8">
<input name="developOderCode" class="form-control" type="text">
</div>
</div>
<div class="container">
<div class="form-row">
<div class="header">
<div class="btn-group-sm" role="group">
<header>修改开发修改单:</header>
</div>
</div>
<div class="row">
<div class="form-group is-required">
<label class="col-sm-3 control-label">生产单号:</label>
<div class="form-group">
<label class="col-sm-3 control-label is-required">生产单号:</label>
<div class="col-sm-8">
<select id="add_developOderCode" name="developOderCode" class="form-control" type="text" required>
<option value="">请选择</option>
@ -52,32 +54,60 @@
</div>
</div>
</div>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar1" role="group">
<span>选择采购物料</span>
<a class="btn btn-success" onclick="insertRow2()">
<i class="fa fa-plus"></i> 添加修改物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-material"></table>
</div>
</div>
</div>
<div class="container">
<div class="form-row">
<div class="btn-group-sm" id="toolbar2" role="group">
<span>选择通知人</span>
<a class="btn btn-success" onclick="insertRow3()">
<i class="fa fa-plus"></i> 添加修改物料
</a>
</div>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-sub-table-biztoitem"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "erp/developModifyOrder"
var userName = [[${@permission.getPrincipalProperty('userName')}]];
$("#form-developModifyOrder-add").validate({ focusCleanup: true});
$(function () {
$.ajax({
url: ctx + 'erp/developModifyOrder/getEngineerList',
type: 'post',
data: { roleKey: 'gcwyRole' },
success: function (res) {
if (res.data.length > 0) {
var userData = res.data;
for (let i in userData) {
$("#userId_add").append(
"<option value='" + userData[i].userId + "'>" + userData[i].userName + "</option>" // 显示用户姓名
);
}
$("#userId_add").val(userData[i].userId).trigger("change");
} else {
$.modal.msgError(res.msg);
$("#add_developOderCode").select2({
ajax: {
url: ctx + "system/makeorder" + "/selectAllMakeNos",
dataType: 'json',
type: "POST",
delay: 250,
processResults: function (data, params) {
params.page = params.page || 1;
return {
results: data.data,
}
}
});
}
});
$(function () {
var options = {
id: "bootstrap-sub-table-developModify",
url: prefix + "/getDevelopModifyOrderList",
@ -145,21 +175,295 @@
return form; // 返回生成的表单HTML
}},
]
}
$("bootstrap-sub-table-developModify").init(options);
})
};
$.table.init(options);
var option1 = {
url: prefix + "/list",
modalName: "bom",
detailView: true,
height: $(window).height() - 100,
//指定父id列
onExpandRow : function(index, row, $detail) {
$detail.html('<table class="table-container" id="all_level_table_'+row.id+'"></table>').find('table');
// 多阶
initAllLevelTable(index,row,$detail);
// $.table.bootstrapTable('resetView');
},
columns: [
{checkbox: false},
{title: 'bom号',field: 'bomNo', },
{title: '关联料号',field: 'materialNo', },
{field: 'photoUrl',title: '图片',formatter: function(value, row, index) {return $.table.imageView(value);}},
{title: '物料名称',field: 'materialName', },
{field: 'materialType',title: '物料类型',formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value);}},
{field: 'processMethod', title: '半成品类型',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}},
{field: 'unit',title: '单位',},
{ title: '品牌',field: 'brand', },
{title: '描述',field: 'describe'},
{field: 'num',title: '订单数量',},
{field: 'parentId',title: '父级id',visible:false},
{title: '操作',align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="remove(\'' + row.id + '\')"><i class="fa fa-eye"></i> 删除</a> ');
return actions.join('');
}
}]
};
$.table.init(option1);
});
initAllLevelTable = function(index, row, $detail) {
$("#"+"all_level_table_"+row.id).bootstrapTable({
url: prefix + "/allLevelList",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
parentId: row.id
},
columns: [{
field: 'id',
title: '主键id'
},
{
field: 'level',
title: '层级',
formatter: function(value, row, index) {
return $.table.selectDictLabel(levelDatas, value);
}
},
{
field: 'bomNo',
title: 'bom号',
formatter:function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'photoUrl',
title: '图片',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
field: 'materialNo',
title: '料号',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'materialName',
title: '物料名称',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'materialType',
title: '物料类型',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
field: 'describe',
title: '描述',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'brand',
title: '品牌',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'unit',
title: '单位',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'useNum',
title: '用量',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'lossRate',
title: '损耗率',
formatter: function (value,row,index){
if (value == null || value == ''){
return "/";
}
return value + "%";
}
},
{
field: 'processMethod',
title: '半成品类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
field: 'parentId',
title: '父级id',
visible: false,
},
{
field: 'sortNo',
title: '排序',
visible: false
}]
});
};
initChildSonTable = function(index, row, $detail) {
var childSonTable = $detail.html('<table style="table-layout:fixed"></table>').find('table');
$(childSonTable).bootstrapTable({
url: prefix + "/subList",
method: 'post',
detailView: true,
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {parentId: row.id},
onExpandRow : function(index, row, $detail) {initChildSonTable(index, row, $detail);},
columns: [
{field: 'id',title: '主键id'},
{field: 'level',title: '层级',formatter: function(value, row, index) {return $.table.selectDictLabel(levelDatas, value);}},
{field: 'bomNo',title: 'bom号',formatter:function (value,row,index){if (value == null || value == ''){return '/'; }else{ return value;}}},
{field: 'photoUrl',title: '图片',formatter:function (value,row,index){if (value == null || value == ''){ return '/';}else{return $.table.imageView(value);}}},
{field: 'materialNo',title: '料号',},
{field: 'materialName',title: '物料名称',},
{field: 'materialType',title: '物料类型',formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}},
{field: 'describe',title: '描述',},
{field: 'brand',title: '品牌',},
{field: 'unit',title: '单位',},
{field: 'lossRate',title: '损耗率(%)',formatter:function (value,row,index){return value + '%';}},
{field: 'processMethod',title: '半成品类型',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}},
{field: 'useNum',title: '订单用量',},
{field: 'parentId',title: '父级id',visible: false,},
]
});
}
function insertRow() {
var table = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData');
var row = table.length + 1;
$("#bootstrap-sub-table-developModify").bootstrapTable('insertRow', {
index: row,
var url = ctx + "system/makeorder/selectMakeorder";
var options = {
title: '选择生产物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function insertRow2() {
var url = ctx + "erp/material/select";
var options = {
title: '选择料号',
url: url,
callBack: doSubmit2
};
$.modal.openOptions(options);
}
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
var totalNum = $("#bootstrap-sub-table-developModify").bootstrapTable('getData').length;
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-developModify").bootstrapTable('insertRow',{
index: 1,
row: {
id: row,
developOderCode: $("#add_developOderCode").val(),
id:rowData.id,
bomNo:rowData.bomNo,
materialNo: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
processMethod: rowData.processMethod,
unit: rowData.unit,
brand: rowData.brand,
level: "1",
lossRate:'',
useNum:''
}
});
})
layer.close(index);
}
function doSubmit2(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
var totalNum = $("#bootstrap-sub-table-material").bootstrapTable('getData').length;
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-material").bootstrapTable('insertRow',{
index: 1,
row: {
id:rowData.id,
bomNo:rowData.bomNo,
materialNo: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
processMethod: rowData.processMethod,
unit: rowData.unit,
brand: rowData.brand,
level: "1",
lossRate:'',
useNum:''
}
})
layer.close(index);
}
function remove(id){
$("#bootstrap-sub-table-developModify").bootstrapTable('remove', {
field: 'id',
values: id
})
}
function removeRow(id){
$("#bootstrap-sub-table-material").bootstrapTable('remove', {
field: 'id',
values: id
})
}
function submitHandler() {
if ($.validate.form()) {

12
ruoyi-admin/src/main/resources/templates/system/salesOrder/salesOrder.html

@ -229,12 +229,16 @@
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/detail/{id}",
pageSize: 5,
pageList: [5, 10, 25, 50],
pageSize: 10,
sortable: true, // 是否启用排序
sortStable: true, // 设置为 true 将获得稳定的排序
detailView: true,
fixedColumns: true, // 启用冻结列
rightFixedColumns:1,
fixedRightNumber: 1, // 冻结右列个数
modalName: "销售订单",
fixedColumns:true,
fixedRightNumber:1,
height: $(window).height() - 200,
height: $(window).height() - 100,
columns: [
{checkbox: true},
{title: '订单id',field: 'salesOrderId',visible: false},

Loading…
Cancel
Save