Commit 3380e6ce authored by 刘帅's avatar 刘帅

1.优化

parent c5024746
......@@ -57,6 +57,14 @@ public class ErpClientController extends BaseController {
return iErpClientService.queryPageList(bo, pageQuery);
}
/**
* 查询客户信息-客户列表
*/
@GetMapping("/listAll")
public R<List<ErpClientVo>> list(ErpClientBo bo) {
return R.ok(iErpClientService.queryList(bo));
}
/**
* 客户信息-客户导入模板下载
*/
......
......@@ -51,6 +51,14 @@ public class ErpMalfunctionProjectController extends BaseController {
return iErpMalfunctionProjectService.queryPageList(bo, pageQuery);
}
/**
* 查询故障项目列表
*/
@GetMapping("/listAll")
public R<List<ErpMalfunctionProjectVo>> listAll(ErpMalfunctionProjectBo bo) {
return R.ok(iErpMalfunctionProjectService.queryList(bo));
}
/**
* 故障项目导入模板下载
*/
......
......@@ -54,8 +54,6 @@ public class ErpMaterialBo extends BaseEntity {
/**
* 仓库ID
*/
@NotNull(message = "仓库不能为空", groups = { AddGroup.class, EditGroup.class })
private Long warehouseId;
/**
......
......@@ -29,9 +29,12 @@ import com.maintain.business.domain.vo.ErpMaterialCheckVo;
import com.maintain.business.service.IErpMaterialCheckService;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static net.sf.jsqlparser.parser.feature.Feature.update;
/**
* 物资盘点Service业务层处理
*
......@@ -146,17 +149,51 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
/**
* 修改物资盘点
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Boolean updateByBo(ErpMaterialCheckBo bo) {
ErpMaterialCheck update = BeanUtil.toBean(bo, ErpMaterialCheck.class);
validEntityBeforeSave(update);
SysDept sysDept = deptMapper.selectVoById(update.getDeptId());
update.setDeptName(sysDept.getDeptName());
ErpWarehouseVo warehouseVo = warehouseMapper.selectVoById(update.getWarehouseId());
update.setWarehouseName(warehouseVo.getName());
SysUser sysUser = userMapper.selectVoById(update.getTaskUserId());
update.setTaskUserName(sysUser.getNickName());
return baseMapper.updateById(update) > 0;
ErpMaterialCheck materialCheck = baseMapper.selectById(bo.getId());
materialCheck.setTaskName(bo.getTaskName());
materialCheck.setTaskStartTime(bo.getTaskStartTime());
materialCheck.setRemark(bo.getRemark());
if (!bo.getDeptId().equals(materialCheck.getDeptId())) {
/* 车间变更 */
SysDept sysDept = deptMapper.selectVoById(bo.getDeptId());
materialCheck.setDeptId(sysDept.getDeptId());
materialCheck.setDeptName(sysDept.getDeptName());
/* 仓库变更 */
ErpWarehouse warehouse = warehouseMapper.selectById(bo.getWarehouseId());
materialCheck.setWarehouseId(warehouse.getId());
materialCheck.setWarehouseName(warehouse.getName());
/* 仓库盘点状态变更 */
warehouse.setIsCheck(IsEnableStatus.YES.getCode());
warehouseMapper.updateById(warehouse);
/* 原仓库状态变更 */
ErpWarehouse erpWarehouse = new ErpWarehouse();
erpWarehouse.setId(materialCheck.getWarehouseId());
erpWarehouse.setIsCheck(IsEnableStatus.NO.getCode());
}
/* 盘点人存在变更 */
if (!bo.getTaskUserId().equals(materialCheck.getTaskUserId())) {
SysUser sysUser = userMapper.selectVoById(bo.getTaskUserId());
materialCheck.setTaskUserId(sysUser.getUserId());
materialCheck.setTaskUserName(sysUser.getNickName());
}
boolean flag = baseMapper.updateById(materialCheck) > 0;
if (flag) {
/* 删除旧绑定 */
LambdaQueryWrapper<ErpMaterialCheckInfo> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(ErpMaterialCheckInfo::getCheckId, bo.getId());
checkInfoMapper.delete(lambdaQuery);
/* 创建新绑定 */
checkInfoMapper.insertBatch(bo.getCheckInfoList().stream().map(item -> {
ErpMaterialCheckInfo checkInfo = BeanUtil.toBean(item, ErpMaterialCheckInfo.class);
checkInfo.setId(null);
checkInfo.setCheckId(bo.getId());
return checkInfo;
}).collect(Collectors.toList()));
}
return flag;
}
/**
......@@ -172,14 +209,9 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
materialCheck.setTaskEndTime(new Date());
materialCheck.setCheckState(CheckState.TWO.getCode());
// 将盘点的仓库状态改为 否
ErpWarehouse warehouse = warehouseMapper.selectById(bo.getWarehouseId());
ErpWarehouse warehouse = warehouseMapper.selectById(materialCheck.getWarehouseId());
warehouse.setIsCheck(IsEnableStatus.NO.getCode());
warehouseMapper.updateById(warehouse);
// 将盘点所在仓库下的物料是否盘点状态更改为 是
// LambdaUpdateWrapper<ErpMaterial> materialLambdaUpdateWrapper = Wrappers.lambdaUpdate();
// materialLambdaUpdateWrapper.eq(ErpMaterial::getWarehouseId, materialCheck.getWarehouseId());
// materialLambdaUpdateWrapper.set(ErpMaterial::getIsCheck, IsEnableStatus.NO.getCode());
// materialMapper.update(materialLambdaUpdateWrapper);
boolean flag = baseMapper.updateById(materialCheck) > 0;
if (flag) {
List<ErpMaterialPutawayInfo> putawayInfoList = new ArrayList<>();
......@@ -195,17 +227,22 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
ErpMaterial material = materialMapper.selectById(item.getMaterialId());
/* 查询物料库存 */
ErpMaterialInventoryRecordVo recordVo = materialInventoryRecordMapper.queryMaterialByWarehouseIdAndMaterialId(bo.getWarehouseId(), item.getMaterialId());
/* 如果recordVo为空,说明改物料没有过库存变动记录数据,默认给0 */
BigDecimal inventory = new BigDecimal("0");
if (null != recordVo) {
inventory = recordVo.getInventory();
}
// 判断盘盈或盘亏 盘盈则新增入库、盘亏新增出库
if (item.getResultState().equals(CheckInfoState.ONE.getCode())) {
ErpMaterialPutawayInfo putawayInfo = BeanUtil.toBean(material, ErpMaterialPutawayInfo.class);
putawayInfo.setPutawayNumber(item.getCheckNum().subtract(recordVo.getInventory()));
putawayInfo.setMaterialId(recordVo.getMaterialId());
putawayInfo.setPutawayNumber(item.getCheckNum().subtract(inventory));
putawayInfo.setMaterialId(item.getMaterialId());
putawayInfo.setId(null);
putawayInfoList.add(putawayInfo);
}else if (item.getResultState().equals(CheckInfoState.TWO.getCode())) {
ErpMaterialPickingInfo pickingInfo = BeanUtil.toBean(material, ErpMaterialPickingInfo.class);
pickingInfo.setCollectNumber(recordVo.getInventory().subtract(item.getCheckNum()));
pickingInfo.setMaterialId(recordVo.getMaterialId());
pickingInfo.setCollectNumber(inventory.subtract(item.getCheckNum()));
pickingInfo.setMaterialId(item.getMaterialId());
pickingInfo.setId(null);
pickingInfoList.add(pickingInfo);
}
......@@ -286,9 +323,19 @@ public class ErpMaterialCheckServiceImpl implements IErpMaterialCheckService {
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
/* 删除盘点明细 */
LambdaQueryWrapper<ErpMaterialCheckInfo> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.in(ErpMaterialCheckInfo::getCheckId, ids);
checkInfoMapper.delete(lambdaQueryWrapper);
/* 仓库盘点状态变更 */
List<ErpMaterialCheckVo> checkVoList = baseMapper.selectVoBatchIds(ids);
List<Long> collect = checkVoList.stream().map(ErpMaterialCheckVo::getWarehouseId).collect(Collectors.toList());
if (!collect.isEmpty()) {
LambdaUpdateWrapper<ErpWarehouse> updateWrapper = Wrappers.lambdaUpdate();
updateWrapper.in(ErpWarehouse::getId, collect).set(ErpWarehouse::getIsCheck, CheckInfoState.ONE.getCode());
warehouseMapper.update(updateWrapper);
}
/* 删除盘点单 */
return baseMapper.deleteBatchIds(ids) > 0;
}
}
......@@ -73,6 +73,7 @@ public class ErpWarehouseServiceImpl implements IErpWarehouseService {
lqw.eq(bo.getDeptId() != null, ErpWarehouse::getDeptId, bo.getDeptId());
lqw.like(StringUtils.isNotBlank(bo.getDeptName()), ErpWarehouse::getDeptName, bo.getDeptName());
lqw.in(!deptList.isEmpty(), ErpWarehouse::getCreateDeptId, deptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
lqw.orderByDesc(ErpWarehouse::getCreateTime);
return lqw;
}
......
package com.maintain.common.helper;
import com.maintain.common.core.domain.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
import org.springframework.stereotype.Component;
......@@ -21,6 +22,7 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
@Override
public String getUsername(String s) {
System.out.println("---------call---------getUsername-----------------------");
return "";
}
......@@ -31,8 +33,8 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
*/
@Override
public String getToken(HttpServletRequest request) {
//System.out.println("---------call---------getToken-----------------------");
return "token令牌";
System.out.println("---------call---------getToken-----------------------");
return request.getHeader("token");
}
/**
* Token校验
......@@ -41,7 +43,8 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
*/
@Override
public Boolean verifyToken(String token) {
//System.out.println("---------verify-----Token---------------");
System.out.println("---------verify-----Token---------------");
System.out.println(token);
return true;
}
......@@ -53,6 +56,7 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
*/
@Override
public String[] getRoles(String token) {
System.out.println("---------call---------getRoles-----------------------");
return new String[]{"admin","lowdeveloper","dbadeveloper"};
}
......@@ -64,6 +68,7 @@ public class JimuReportTokenService implements JmReportTokenServiceI {
*/
@Override
public String[] getPermissions(String token) {
System.out.println("---------call---------getPermissions-----------------------");
return new String[]{"drag:datasource:testConnection","onl:drag:clear:recovery","drag:analysis:sql","drag:design:getTotalData"};
}
}
......@@ -38,7 +38,7 @@
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where (find_in_set(#{deptId}, ancestors) or dept_id = #{deptId}) and status = 0
select * from sys_dept where (find_in_set(#{deptId}, ancestors) or dept_id = #{deptId}) and status = 0 and del_flag = 0
</select>
</mapper>
......@@ -9,6 +9,15 @@ export function listClient(query) {
})
}
// 查询客户信息-客户列表
export function listClientAll(query) {
return request({
url: '/business/client/listAll',
method: 'get',
params: query
})
}
// 查询客户信息-客户详细
export function getClient(id) {
return request({
......
......@@ -9,6 +9,15 @@ export function listMalfunctionProject(query) {
})
}
// 查询故障项目列表
export function listMalfunctionProjectAll(query) {
return request({
url: '/business/malfunctionProject/listAll',
method: 'get',
params: query
})
}
// 查询故障项目详细
export function getMalfunctionProject(id) {
return request({
......
......@@ -149,7 +149,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="手机号" prop="phone">
<el-select v-model="form.phone" filterable :filter-method="getPhone" @change="setPhone">
<el-select v-model="form.phone" filterable @change="setPhone">
<el-option v-for="(item,index) in phoneList" :key="index" :label="item.phone" :value="item.phone"></el-option>
</el-select>
</el-form-item>
......@@ -169,7 +169,7 @@
v-for="item in dict.type.client_type"
:key="item.value"
:label="item.label"
:value="parseInt(item.value)"
:value="item.value"
/>
</el-select>
</el-form-item>
......@@ -345,7 +345,7 @@
<script>
import { listCar, getCar, delCar, addCar, updateCar } from "@/api/business/car";
import { listClient } from "@/api/business/client";
import {listClient, listClientAll} from "@/api/business/client";
import { listVehicleModel, getVehicleModel } from "@/api/business/vehicleModel";
import { imageUpload } from "@/api/system/oss"
import { formatDate } from "@/utils/index"
......@@ -445,8 +445,6 @@ export default {
},
created() {
this.getList();
this.getPhone();
this.getCode()
},
methods: {
/** 查询客户信息-车辆列表 */
......@@ -502,6 +500,8 @@ export default {
this.reset();
this.open = true;
this.title = "添加车辆信息";
this.getCode()
this.getPhone();
},
/** 修改按钮操作 */
handleUpdate(row) {
......@@ -510,7 +510,8 @@ export default {
this.form.clientType = row.clientType
this.open = true;
this.title = "修改车辆信息";
console.log('this.form', this.form)
this.getCode()
this.getPhone();
if (row.carTypeId) {
getVehicleModel(row.carTypeId).then(res => {
this.form.carTypeId = res.data.id;
......@@ -582,17 +583,13 @@ export default {
},
getPhone(e){
console.log(e);
listClient({pageSize: 40, pageNum: 1, phone: e}).then(res=>{
listClientAll({phone: e}).then(res=>{
let arr=[]
res.rows.forEach(item=>{
res.data.forEach(item=>{
if(item.phone){
let a=item.phone.split(';');
let a = item.phone.split(';');
a.forEach(item1=>{
arr.push({
...item,
phone: item1,
type: typeof item.type == 'number'?''+item.type:item.type,
})
arr.push({...item, phone: item1, type: typeof item.type == 'number'?''+item.type:item.type,})
})
}
})
......
......@@ -195,20 +195,12 @@
<el-table-column label="车型编码" align="center" prop="carTypeCode" />
<el-table-column label="车辆品牌" align="center" prop="carBrand" />
<el-table-column label="型号" align="center" prop="carModel" />
<el-table-column label="配置" align="center" prop="carConfiguration" />
<el-table-column label="颜色" align="center" prop="carColour" />
<el-table-column label="类型" align="center" prop="type">
<template slot-scope="scope">
{{tableSelect(scope.row.type,dict.type.cheliangleixing)}}
</template>
</el-table-column>
<el-table-column label="能耗类型" align="center" prop="expendType">
<template slot-scope="scope">
{{tableSelect(scope.row.expendType,dict.type.nenghaoleixing)}}
</template>
</el-table-column>
<el-table-column label="底盘型号" align="center" prop="chassisNumber" />
<el-table-column label="发动机型号/电机型号" align="center" prop="motorNumber" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -263,20 +255,12 @@
<el-table-column label="车型编码" align="center" prop="carTypeCode" />
<el-table-column label="车辆品牌" align="center" prop="carBrand" />
<el-table-column label="型号" align="center" prop="carModel" />
<el-table-column label="配置" align="center" prop="carConfiguration" />
<el-table-column label="颜色" align="center" prop="carColour" />
<el-table-column label="类型" align="center" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.cheliangleixing" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="能耗类型" align="center" prop="expendType">
<template slot-scope="scope">
<dict-tag :options="dict.type.nenghaoleixing" :value="scope.row.expendType"/>
</template>
</el-table-column>
<el-table-column label="底盘型号" align="center" prop="chassisNumber" />
<el-table-column label="发动机型号/电机型号" align="center" prop="motorNumber" min-width="130px" />
</el-table>
<pagination
v-show="total1>0"
......
......@@ -48,24 +48,6 @@
v-hasPermi="['business:maintainProject:export']"
>导出</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleStencil"-->
<!-- v-hasPermi="['business:maintainProject:export']"-->
<!-- >导出上传模板</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <FileUploader-->
<!-- uploadUrl="/business/maintainProject/importData "-->
<!-- uploadButtonText="导入"-->
<!-- v-hasPermi="['business:maintainProject:import']"-->
<!-- @refreshTable="getList"-->
<!-- />-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="info"
......@@ -193,7 +175,7 @@
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="关联故障项目" prop="malfunctionProjectList">
<el-select v-model="form.malfunctionProjectList" placeholder="请选择关联故障项目(多选)" style="width: 100%;" multiple>
<el-select v-model="form.malfunctionProjectList" filterable placeholder="请选择关联故障项目(多选)" style="width: 100%;" multiple>
<el-option v-for="item in guanlianList" :key="item.id" :value="item.id" :label="item.malfunctionName"></el-option>
</el-select>
</el-form-item>
......@@ -254,7 +236,7 @@
<script>
import { listMaintainProject, getMaintainProject, delMaintainProject, addMaintainProject, updateMaintainProject } from "@/api/business/maintainProject";
import { listMalfunctionProject } from "@/api/business/malfunctionProject";
import {listMalfunctionProject, listMalfunctionProjectAll} from "@/api/business/malfunctionProject";
import { formatDate } from "@/utils/index"
import { getProjectType } from "@/api/business/projectType";
import Treeselect from "@riophae/vue-treeselect";
......@@ -376,8 +358,8 @@ export default {
},
methods: {
getGuanlian(){
listMalfunctionProject({ pageNum: 1, pageSize: 99, }).then(res=>{
this.guanlianList=res.rows;
listMalfunctionProjectAll().then(res=>{
this.guanlianList = res.data;
})
},
/** 查询维修项目列表 */
......@@ -411,7 +393,8 @@ export default {
createTime: formatDate(new Date().getTime()),
updateBy: undefined,
updateTime: undefined,
isDelete: undefined
isDelete: undefined,
malfunctionProjectList: []
};
this.resetForm("form");
},
......
......@@ -387,8 +387,8 @@ import {
updateMaterialPutaway
} from '@/api/business/materialPutaway'
import { typeTree } from '@/api/business/materialType'
import { listSiteWarehouse } from '@/api/business/siteWarehouse'
import { listMaterialVendor } from '@/api/business/materialVendor'
import {listSiteWarehouse, listWarehouseAll} from '@/api/business/siteWarehouse'
import {listMaterialVendor, listMaterialVendorAll} from '@/api/business/materialVendor'
import { listMaterial } from '@/api/business/material'
import { formatDate } from '@/utils'
......@@ -525,14 +525,14 @@ export default {
},
/** 查询仓库列表 */
getWarehouseList() {
listSiteWarehouse({ pageNum: 0, pageSize: 100 }).then(response => {
this.warehouseList = response.rows;
listWarehouseAll().then(response => {
this.warehouseList = response.data;
});
},
/** 查询物资供应商列表 */
getVendorList() {
listMaterialVendor({ pageNum: 0, pageSize: 100 }).then(response => {
this.materialVendorList = response.rows;
listMaterialVendorAll().then(response => {
this.materialVendorList = response.data;
});
},
/** 打开物料列表 */
......@@ -653,7 +653,7 @@ export default {
this.open = true;
this.title = "添加物料入库";
this.getWarehouseList()
this.getVendorList()
// this.getVendorList()
},
/** 详情按钮操作 */
handleDetail(row) {
......@@ -675,7 +675,7 @@ export default {
this.open = true;
this.title = "修改物料入库";
this.getWarehouseList()
this.getVendorList()
// this.getVendorList()
});
},
/** 提交按钮 */
......
......@@ -334,6 +334,7 @@ export default {
this.reset()
this.open = true;
this.title = "添加仓库";
this.getTree()
},
/** 修改按钮操作 */
handleUpdate(row) {
......@@ -344,6 +345,7 @@ export default {
this.form = response.data;
this.open = true;
this.title = "修改仓库";
this.getTree()
});
},
/** 提交按钮 */
......
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