Browse Source

完成入库查询按申请人搜索

lwx_dev
erdanergou 2 years ago
parent
commit
2f62f8cb08
  1. 35
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 6
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.java
  3. 35
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml
  4. 3
      src/main/java/com/dreamchaser/depository_manage/service/UserService.java
  5. 5
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  6. 51
      src/main/resources/templates/pages/depository/table-in.html

35
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -243,7 +243,7 @@ public class DepositoryRecordController {
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
List<Integer> params = (List<Integer>) map.get("params"); List<Integer> params = ObjectFormatUtil.objToList(map.get("params"), Integer.class);
Integer integer = 0; Integer integer = 0;
map.put("applicantId", userToken.getId()); map.put("applicantId", userToken.getId());
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
@ -468,7 +468,7 @@ public class DepositoryRecordController {
// 如果是个人 // 如果是个人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = PublicConfig.FindUserById(uid,finalUserKey,finalToken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserKey, finalToken);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -485,7 +485,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", uid); paramForGetUserByPost.put("position", uid);
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost,finalUserKey,finalToken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -529,7 +529,7 @@ public class DepositoryRecordController {
// 如果是个人 // 如果是个人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = PublicConfig.FindUserById(uid,finalUserKey,finalToken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserKey, finalToken);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -546,7 +546,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", uid); paramForGetUserByPost.put("position", uid);
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost,finalUserKey,finalToken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -889,6 +889,17 @@ public class DepositoryRecordController {
map.remove("depositoryId"); map.remove("depositoryId");
} }
} }
if (map.containsKey("applicantName")) {
List<Long> applicantIdList = new ArrayList<>();
List<UserByPort> applicantName = userService.findUserByName(map.get("applicantName").toString());
for (UserByPort byPort : applicantName) {
applicantIdList.add(byPort.getId());
}
if (applicantIdList.size() > 0) {
map.put("applicantIdList", applicantIdList);
}
}
if (PublicConfig.roleAdminorgList.contains(maindeparment)) { if (PublicConfig.roleAdminorgList.contains(maindeparment)) {
list = depositoryRecordService.findApplicationInRecordPByCondition(map, userToken, userKey, token); list = depositoryRecordService.findApplicationInRecordPByCondition(map, userToken, userKey, token);
recordPCount = depositoryRecordService.findApplicationInRecordPCountByCondition(map); recordPCount = depositoryRecordService.findApplicationInRecordPCountByCondition(map);
@ -1067,7 +1078,10 @@ public class DepositoryRecordController {
for (UserByPort byPort : applicantName) { for (UserByPort byPort : applicantName) {
applicantIdList.add(byPort.getId()); applicantIdList.add(byPort.getId());
} }
map.put("applicantIdList",applicantIdList); if (applicantIdList.size() > 0) {
map.put("applicantIdList", applicantIdList);
}
} }
if (PublicConfig.roleAdminorgList.contains(maindeparment)) { if (PublicConfig.roleAdminorgList.contains(maindeparment)) {
@ -1115,7 +1129,7 @@ public class DepositoryRecordController {
// List<Long> depositoryIds = ObjectFormatUtil.objToList(map.get("depositoryIds"),Long.class); // List<Long> depositoryIds = ObjectFormatUtil.objToList(map.get("depositoryIds"),Long.class);
// List<String> placeCodes = ObjectFormatUtil.objToList(map.get("placeCodes"),String.class); // List<String> placeCodes = ObjectFormatUtil.objToList(map.get("placeCodes"),String.class);
List<String> nowmids = redisPool.getRedisTemplateByDb(15).opsForList().range("mids" + userToken.getId(), 0, -1); List<String> nowmids = redisPool.getRedisTemplateByDb(15).opsForList().range("mids" + userToken.getId(), 0, -1);
if(nowmids == null){ if (nowmids == null) {
nowmids = new ArrayList<>(); nowmids = new ArrayList<>();
} }
for (int i = 0; i < mids.size(); i++) { for (int i = 0; i < mids.size(); i++) {
@ -1794,8 +1808,7 @@ public class DepositoryRecordController {
} }
}); });
} } else if ("out".equals(type)) {
else if ("out".equals(type)) {
// 获取部门负责人 // 获取部门负责人
List<UserByPort> departmentHeadByUsers = userService.getDepartmentHeaderByIdForNoPack(userToken.getMaindeparment()); List<UserByPort> departmentHeadByUsers = userService.getDepartmentHeaderByIdForNoPack(userToken.getMaindeparment());
StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departmentHeadId = new StringBuilder();
@ -1870,7 +1883,7 @@ public class DepositoryRecordController {
// 获取要处理的类型 // 获取要处理的类型
String type = jsonParam.getString("type"); String type = jsonParam.getString("type");
Integer success = 0; Integer success = 0;
JSONArray mids =jsonParam.getJSONArray("mids"); JSONArray mids = jsonParam.getJSONArray("mids");
JSONArray iids = jsonParam.getJSONArray("iids"); JSONArray iids = jsonParam.getJSONArray("iids");
JSONArray depositoryIds = jsonParam.getJSONArray("depositoryIds"); JSONArray depositoryIds = jsonParam.getJSONArray("depositoryIds");
JSONArray quantitys = jsonParam.getJSONArray("quantitys"); JSONArray quantitys = jsonParam.getJSONArray("quantitys");
@ -2164,7 +2177,7 @@ public class DepositoryRecordController {
} }
} }
if (flag) { if (flag) {
String applyRemark = (String)applyRemarks.get(i); String applyRemark = (String) applyRemarks.get(i);
Map<String, Object> outRecord = new HashMap<>(); Map<String, Object> outRecord = new HashMap<>();
outRecord.put("quantity", quantity); outRecord.put("quantity", quantity);
outRecord.put("mid", mid); outRecord.put("mid", mid);

6
src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.java

@ -275,12 +275,6 @@ public interface DepositoryRecordMapper {
*/ */
Integer findApplicationOutByMonth(Map<String, Object> map); Integer findApplicationOutByMonth(Map<String, Object> map);
/**
* 查询仓库当天流水
*
* @return
*/
Integer findWarehouseRecord(Map<String, Object> map);
/** /**

35
src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml

@ -431,6 +431,13 @@
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and applicant_time <![CDATA[ <= ]]> #{endDate} and applicant_time <![CDATA[ <= ]]> #{endDate}
</if> </if>
<if test="applicantIdList != null">
and applicant_id in
<foreach collection="applicantIdList" index="index" item="applicantId" open="(" separator="," close=")">
#{applicantId}
</foreach>
</if>
and airtoGroupId is null and airtoGroupId is null
@ -483,6 +490,13 @@
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and applicant_time <![CDATA[ <= ]]> #{endDate} and applicant_time <![CDATA[ <= ]]> #{endDate}
</if> </if>
<if test="applicantIdList != null">
and applicant_id in
<foreach collection="applicantIdList" index="index" item="applicantId" open="(" separator="," close=")">
#{applicantId}
</foreach>
</if>
and airtoGroupId is null and airtoGroupId is null
</select> </select>
@ -530,6 +544,13 @@
<if test="code != null and code != ''"> <if test="code != null and code != ''">
and mcode = #{code} and mcode = #{code}
</if> </if>
<if test="applicantIdList != null">
and applicant_id in
<foreach collection="applicantIdList" index="index" item="applicantId" open="(" separator="," close=")">
#{applicantId}
</foreach>
</if>
and airtoGroupId is null and airtoGroupId is null
order by applicant_time desc order by applicant_time desc
<if test="begin != null and size != null"> <if test="begin != null and size != null">
@ -954,6 +975,13 @@
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and applicant_time <![CDATA[ <= ]]> #{endDate} and applicant_time <![CDATA[ <= ]]> #{endDate}
</if> </if>
<if test="applicantIdList != null">
and applicant_id in
<foreach collection="applicantIdList" index="index" item="applicantId" open="(" separator="," close=")">
#{applicantId}
</foreach>
</if>
and airtoGroupId is null and airtoGroupId is null
</select> </select>
@ -1920,13 +1948,6 @@
</select> </select>
<select id="findWarehouseRecord" parameterType="map" resultType="Long">
select count(*)
from depository_record dr
where dr.state like '%已%'
and dr.check_time between #{start} and #{end}
</select>
<!-- 根据主键删除数据 --> <!-- 根据主键删除数据 -->
<delete id="deleteApplicationInRecordById" parameterType="Long"> <delete id="deleteApplicationInRecordById" parameterType="Long">

3
src/main/java/com/dreamchaser/depository_manage/service/UserService.java

@ -90,6 +90,7 @@ public interface UserService {
UserByPort findUserByWorkWechat(String workWechat); UserByPort findUserByWorkWechat(String workWechat);
/** /**
* 根据用户名称查询用户信息 * 根据用户名称查询用户信息
* @param name 待查询名称 * @param name 待查询名称
@ -97,4 +98,6 @@ public interface UserService {
*/ */
List<UserByPort> findUserByName(String name); List<UserByPort> findUserByName(String name);
} }

5
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -776,7 +776,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
flagForApproval = isApprovalPass; flagForApproval = isApprovalPass;
} }
map.put("flagForApproval", flagForApproval); map.put("flagForApproval", flagForApproval);
} else { }
else {
// 设置审批权限 // 设置审批权限
map.put("inType", "mt"); map.put("inType", "mt");
// 获取当前类别物料是否需要审批 // 获取当前类别物料是否需要审批
@ -5834,7 +5835,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
/** /**
* 生成单号 * 生成单号
* *
* @param depositoryName * @param depositoryName 入库的仓库
* @return * @return
*/ */
public String createCode(String depositoryName, String key, String type, String mainDeparmentName) { public String createCode(String depositoryName, String key, String type, String mainDeparmentName) {

51
src/main/resources/templates/pages/depository/table-in.html

@ -24,16 +24,13 @@
<input style="display: none" th:value="${type}" id="selectDepositoryType"> <input style="display: none" th:value="${type}" id="selectDepositoryType">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">申请时间</label> <label class="layui-form-label">记录编码</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" style="display:inline;width: 130px;" id="startDate" <input type="text" class="layui-input" id="code" name="code" autocomplete="off"
name="startDate" autocomplete="off" placeholder="开始日期" placeholder="请填写申请记录编码"/>
class="layui-input">
-
<input type="text" style="display:inline;width: 130px;" id="endDate"
name="endDate" autocomplete="off" placeholder="结束日期" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">仓库:</label> <label class="layui-form-label">仓库:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -51,6 +48,13 @@
class="layui-input"/> class="layui-input"/>
</div> </div>
</div> </div>
<div class="layui-inline">
<label class="layui-form-label">型号</label>
<div class="layui-input-block">
<input type="text" class="layui-input" id="version" name="version"
autocomplete="off" placeholder="请填写物料型号"/>
</div>
</div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">物料编码</label> <label class="layui-form-label">物料编码</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -58,20 +62,26 @@
placeholder="请填写物料编码"> placeholder="请填写物料编码">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">型号</label> <label class="layui-form-label">申请时间</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" class="layui-input" id="version" name="version" <input type="text" style="display:inline;width: 130px;" id="startDate"
autocomplete="off" placeholder="请填写物料型号"/> name="startDate" autocomplete="off" placeholder="开始日期"
class="layui-input">
-
<input type="text" style="display:inline;width: 130px;" id="endDate"
name="endDate" autocomplete="off" placeholder="结束日期" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">记录编码</label> <label class="layui-form-label">申请人</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" class="layui-input" id="code" name="code" autocomplete="off" <input type="text" name="applicantName" autocomplete="off" class="layui-input"
placeholder="请填写申请记录编码"/> placeholder="请填写申请人名称">
</div> </div>
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit <button type="submit" class="layui-btn layui-btn-primary" lay-submit
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
@ -95,9 +105,6 @@
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
<script id="applicationInCode" type="text/html">
<a id="{{d.id}}" onclick="showDetail(this)">{{d.aircode}}</a>
</script>
<script type="text/html" id="currentTableBar"> <script type="text/html" id="currentTableBar">
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete" <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete"
@ -189,7 +196,7 @@
cols: [ cols: [
[ [
{type: "checkbox", width: 50}, {type: "checkbox", width: 50},
{field: 'aircode', title: '存货编码', width: 150, templet: '#applicationInCode'}, {field: "aircode", title: '申请编码', width: 250,},
{field: 'mname', width: 150, title: '物料名称'}, {field: 'mname', width: 150, title: '物料名称'},
{field: 'mversion', width: 150, title: '规格型号'}, {field: 'mversion', width: 150, title: '规格型号'},
{field: 'airUnit', width: 100, title: '计量单位'}, {field: 'airUnit', width: 100, title: '计量单位'},
@ -238,6 +245,9 @@
if (data.version !== '') { if (data.version !== '') {
req.version = data.version.trim(); req.version = data.version.trim();
} }
if (data.applicantName !== '') {
req.applicantName = data.applicantName.trim();
}
//执行搜索重载 //执行搜索重载
table.reloadData('currentTableId', { table.reloadData('currentTableId', {
@ -427,6 +437,13 @@
}); });
}; };
table.on('rowDouble(currentTableFilter)', function (obj) {
var data = obj.data; // 获取当前行数据
let id = data.id;
let req = {};
req.id = id;
showDetail(req);
});
showDetail = function (obj) { showDetail = function (obj) {
layer.open({ layer.open({

Loading…
Cancel
Save