Browse Source

修改出库记录删除功能

lwx_dev
erdanergou 3 years ago
parent
commit
b6c10a2cb9
  1. 27
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 7
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java
  3. 112
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  4. 6
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  5. 125
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  6. 48
      src/main/resources/templates/pages/depository/table-in.html
  7. 212
      src/main/resources/templates/pages/depository/table-out.html
  8. 8
      src/test/java/com/dreamchaser/depository_manage/TestOther.java

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

@ -849,13 +849,14 @@ public class DepositoryRecordController {
// 删除出库记录
@PostMapping("/deleteApplicationOutRecord")
public RestResponse deleteApplicationOutRecord(@RequestBody Map<String, Object> map) {
public RestResponse deleteApplicationOutRecord(@RequestBody Map<String, Object> map,HttpServletRequest request) {
UserByPort userByPort = (UserByPort) request.getAttribute("userToken");
if (map.containsKey("id")) {
Integer id = ObjectFormatUtil.toInteger(map.get("id"));
return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordById(id), 1);
return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordById(id,userByPort), 1);
} else if (map.containsKey("ids")) {
List<Integer> ids = (List<Integer>) map.get("ids");
return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordByIds(ids), ids.size());
return CrudUtil.deleteHandle(depositoryRecordService.deleteApplicationOutRecordByIds(ids,userByPort), ids.size());
} else {
throw new MyException("所需请求参数缺失!");
}
@ -866,11 +867,25 @@ public class DepositoryRecordController {
public RestResponse judgeApplicationOutRecordStatus(@RequestBody Map<String,Object> map){
if (map.containsKey("id")) {
Integer id = ObjectFormatUtil.toInteger(map.get("id"));
// 获取当前记录是否能删除
boolean b = depositoryRecordService.judgeApplicationOutRecordStatus(id);
return new RestResponse(b,0,1);
} else if (map.containsKey("ids")) {
List<Integer> ids = (List<Integer>) map.get("ids");
List<Integer> resultIds = new ArrayList<>();
for (Integer id:ids
) {
boolean b1 = depositoryRecordService.judgeApplicationOutRecordStatus(id);
if(!b1){
resultIds.add(id);
}
}
resultIds.add(2);
return new RestResponse(resultIds,0,2);
}
else {
throw new MyException("所需请求参数缺失!");
}
return null;
}
@ -1230,7 +1245,7 @@ public class DepositoryRecordController {
}
if (success == 0) {
depositoryRecordService.deleteApplicationOutRecordById(1);
depositoryRecordService.deleteApplicationOutRecordById(1,userToken);
return new RestResponse("", 666, new StatusInfo("申请失败", "超出最大存储容量"));
}
if (success < mids.size()) {

7
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java

@ -391,6 +391,13 @@ public interface DepositoryRecordMapper {
*/
List<ApplicationOutRecordMin> findApplicationOutRecordMinByParent(Integer parentId);
/**
* 根据主表获取所有子表
* @param list
* @return
*/
List<ApplicationOutRecordMin> findApplicationOutRecordMinByParents(List<Integer> list);
/**
* 修改子表记录
* @param map

112
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -321,19 +321,44 @@
from applicationInRecordInfo
where 1 = 1
<if test="depositoryIdList != null">
and did in
and ( did in
<foreach collection="depositoryIdList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="applicantId != null and applicantId != ''">
or applicant_id = #{applicantId}
or applicant_id = #{applicantId} )
</if>
</if>
<if test="depositoryIdList == null">
<if test="applicantId != null and applicantId != ''">
and applicant_id = #{applicantId}
</if>
</if>
<if test="depositoryId != null and depositoryId != ''">
and did = #{depositoryId}
</if>
<if test="mname != null and mname != ''">
and mname like CONCAT('%', #{mname}, '%')
</if>
<if test="version != null and version != ''">
and mversion like CONCAT('%', #{version}, '%')
</if>
<if test="mcode != null and mcode != ''">
and mcode like CONCAT('%', #{mcode}, '%')
</if>
<if test="code != null and code != ''">
and aircode like CONCAT('%', #{code}, '%')
</if>
<if test="startDate != null and startDate != ''">
and applicant_time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and applicant_time &lt;= #{endDate}
</if>
order by applicant_time desc
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
@ -348,12 +373,12 @@
from applicationInRecordInfo
where 1 = 1
<if test="depositoryIdList != null">
and did in
and ( did in
<foreach collection="depositoryIdList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="applicantId != null and applicantId != ''">
or applicant_id = #{applicantId}
or applicant_id = #{applicantId} )
</if>
</if>
<if test="depositoryIdList == null">
@ -361,6 +386,28 @@
and applicant_id = #{applicantId}
</if>
</if>
<if test="depositoryId != null and depositoryId != ''">
and did = #{depositoryId}
</if>
<if test="mname != null and mname != ''">
and mname like CONCAT('%', #{mname}, '%')
</if>
<if test="version != null and version != ''">
and mversion like CONCAT('%', #{version}, '%')
</if>
<if test="mcode != null and mcode != ''">
and mcode like CONCAT('%', #{mcode}, '%')
</if>
<if test="code != null and code != ''">
and aircode like CONCAT('%', #{code}, '%')
</if>
<if test="startDate != null and startDate != ''">
and applicant_time &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and applicant_time &lt;= #{endDate}
</if>
</select>
<!--根据条件查询入库记录-->
@ -489,13 +536,13 @@
from applicationOutRecordInfo
where 1 = 1
<if test="depositoryIdList != null">
and depositoryId
and ( depositoryId
in
<foreach collection="depositoryIdList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="applicantId != null and applicantId != ''">
or applicantId = #{applicantId}
or applicantId = #{applicantId} )
</if>
</if>
<if test="depositoryIdList == null">
@ -503,6 +550,25 @@
and applicantId = #{applicantId}
</if>
</if>
<if test="version != null and version != ''">
and mversion = #{version}
</if>
<if test="mcode != null and mcode != ''">
and mcode = #{mcode}
</if>
<if test="mname != null and mname != ''">
and mname = #{mname}
</if>
<if test="code != null and code != null">
and aorcode = #{code}
</if>
<if test="startDate != null and startDate != ''">
and applicantTime &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and applicantTime &lt;= #{endDate}
</if>
GROUP BY aorid
order by applicantTime desc
<if test="begin != null and size != null">
@ -516,12 +582,12 @@
from applicationOutRecordInfo
where 1 = 1
<if test="depositoryIdList != null">
and depositoryId in
and ( depositoryId in
<foreach collection="depositoryIdList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="applicantId != null and applicantId != ''">
or applicantId = #{applicantId}
or applicantId = #{applicantId} )
</if>
</if>
<if test="depositoryIdList == null">
@ -529,6 +595,24 @@
and applicantId = #{applicantId}
</if>
</if>
<if test="version != null and version != ''">
and mversion = #{version}
</if>
<if test="mcode != null and mcode != ''">
and mcode = #{mcode}
</if>
<if test="mname != null and mname != ''">
and mname = #{mname}
</if>
<if test="code != null and code != null">
and aorcode = #{code}
</if>
<if test="startDate != null and startDate != ''">
and applicantTime &gt;= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and applicantTime &lt;= #{endDate}
</if>
</select>
<!-- 查询所有入库记录-->
@ -902,6 +986,18 @@
and aorm.parentId = #{parentId}
</select>
<select id="findApplicationOutRecordMinByParents"
parameterType="list" resultMap="applicationOutRecordMin">
select
<include refid="ApplicationOutRecordMinInfo"/>
from application_out_record_min as aorm
where 1 = 1
and aorm.parentId in
<foreach collection="list" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="findApplicationOutMinForComplete" resultMap="applicationOutRecordMin" parameterType="map">
select
<include refid="ApplicationOutRecordMinInfo"/>

6
src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java

@ -331,14 +331,14 @@ public interface DepositoryRecordService {
* @return 受影响的行数
* @param id
*/
Integer deleteApplicationOutRecordById(Integer id);
Integer deleteApplicationOutRecordById(Integer id,UserByPort userToken);
/**
* 根据id集合删除多条出库记录
* @param list id集合
* @return 受影响的行数
*/
Integer deleteApplicationOutRecordByIds(List<Integer> list);
Integer deleteApplicationOutRecordByIds(List<Integer> list,UserByPort userByPort);
/**
@ -433,7 +433,7 @@ public interface DepositoryRecordService {
Integer reviewByQyWxApproval(String mainId, ApprovalInfo_Details approvalInfo_details, String userAgent,String spStatus,String spNo,boolean flagForFirst);
/**
* 判断当前出库记录运行状态
* 判断当前出库记录运行状态否可以直接删除
* @param id
* @return
*/

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

@ -237,9 +237,40 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Integer deleteApplicationOutRecordById(Integer id) {
public Integer deleteApplicationOutRecordById(Integer id,UserByPort userByPort) {
// 删除主单
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordById(id);
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id);
// 开启一个线程去删除redis中的数据
new Thread(new Runnable() {
@Override
public void run() {
// 获取该用户在redis中的订单记录
String key = "user:" + userByPort.getId().toString();
// 获取当前用户所有订单
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord");
for (ApplicationOutRecordMin recordMin :
applicationOutRecordMinByParent) {
String redisMinRecordKey = "minRecord:" + recordMin.getId();
minRecord = minRecord.replace(redisMinRecordKey + ",", "");
if (minRecord.length() == 2) {
// []
// 如果当前用户已经没有剩余订单,则删除
redisTemplate.delete("user:" + userByPort.getId());
} else {
redisTemplate.opsForHash().put(key, "minRecord", minRecord);
}
redisTemplate.delete(redisMinRecordKey);
}
String redisMainRecordKey = "record:" + id; // 设置redis中主订单键值
redisTemplate.delete(redisMainRecordKey);
}
}).start();
// 开启一个线程去删除子订单
new Thread(new Runnable() {
@Override
@ -247,19 +278,57 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
depositoryRecordMapper.deleteApplicationOutRecordMinById(id);
}
}).start();
return integer;
}
@Transactional(rollbackFor = Exception.class)
@Override
public Integer deleteApplicationOutRecordByIds(List<Integer> list) {
public Integer deleteApplicationOutRecordByIds(List<Integer> list,UserByPort userByPort) {
Integer integer = depositoryRecordMapper.deleteApplicationOutRecordByIds(list);
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParents(list);
// 开启一个线程去删除redis中的数据
new Thread(new Runnable() {
@Override
public void run() {
// 获取该用户在redis中的订单记录
String key = "user:" + userByPort.getId().toString();
// 获取当前用户所有订单
String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord");
for (ApplicationOutRecordMin recordMin :
applicationOutRecordMinByParent) {
String redisMinRecordKey = "minRecord:" + recordMin.getId();
minRecord = minRecord.replace(redisMinRecordKey + ",", "");
if (minRecord.length() == 2) {
// []
// 如果当前用户已经没有剩余订单,则删除
redisTemplate.delete("user:" + userByPort.getId());
} else {
redisTemplate.opsForHash().put(key, "minRecord", minRecord);
}
redisTemplate.delete(redisMinRecordKey);
}
for (Integer value : list) {
String redisMainRecordKey = "record:" + value; // 设置redis中主订单键值
redisTemplate.delete(redisMainRecordKey);
}
}
}).start();
// 开启一个线程用于删除
new Thread(new Runnable() {
@Override
public void run() {
depositoryRecordMapper.deleteApplicationOutRecordMinByIds(list);
}
}).start();
return integer;
}
@ -894,7 +963,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
}
} else {
}
else {
// 如果是拆单后的出库
// 用于获取对应的拆单记录
@ -1765,11 +1835,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (int j = 0; j < minIdList.size(); j++) {
sb.append(minIdList.get(j)).append(",");
}
QyWxApprovalMap.put("sp_no", sp_no);
QyWxApprovalMap.put("minIdList", sb.toString());
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap);
redisTemplate.opsForHash().putAll("wms_out_"+recordP.getId(), QyWxApprovalMap);
// 设置过期时间为7天
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS);
redisTemplate.expire("wms_out_"+recordP.getId(), 7, TimeUnit.DAYS);
} else {
continue;
}
@ -1837,13 +1908,33 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
/**
* 判断当前出库记录运行状态
* 判断当前出库记录运行状态是否可以直接删除
* @param id
* @return
* @return true:可以直接删除false流程暂未完成
*/
@Override
public boolean judgeApplicationOutRecordStatus(Integer id) {
return false;
// 获取当前出库记录
ApplicationOutRecordP recordPById = depositoryRecordMapper.findApplicationOutRecordPById(id);
Integer pass = recordPById.getPass();
if(Integer.compare(pass,2) == 0){
// 如果审核未通过
// 可以直接删除
return true;
}else{
// 获取所有子订单
List<ApplicationOutRecordMin> recordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id);
for (ApplicationOutRecordMin recordMin :
recordMinByParent) {
if(Integer.compare(recordMin.getTrueOut(),0) != 0){
// 如果已经出库数量不为0
return false; // 不允许删除
}
}
// 可以删除
return true;
}
}
/**
@ -2149,9 +2240,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
QyWxApprovalMap.put("sp_no", sp_no);
QyWxApprovalMap.put("minIdList", sb.toString());
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap);
redisTemplate.opsForHash().putAll("wms_out_"+record.getId(), QyWxApprovalMap);
// 设置过期时间为7天
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS);
redisTemplate.expire("wms_out_"+record.getId(), 7, TimeUnit.DAYS);
} else {
continue;
}
@ -2383,9 +2474,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
}
QyWxApprovalMap.put("sp_no", sp_no);
QyWxApprovalMap.put("minIdList", sb.toString());
redisTemplate.opsForHash().putAll(sp_no, QyWxApprovalMap);
redisTemplate.opsForHash().putAll("wms_out_"+recordP.getId(), QyWxApprovalMap);
// 设置过期时间为7天
redisTemplate.expire(sp_no, 7, TimeUnit.DAYS);
redisTemplate.expire("wms_out_"+recordP.getId(), 7, TimeUnit.DAYS);
} else {
continue;
}
@ -2937,9 +3028,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
page = ObjectFormatUtil.toInteger(map.get("page"));
map.put("begin", (page - 1) * size);
}
if (map.containsKey("applyTime")) {
String applyTime = (String) map.get("applyTime");
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime));
if (map.containsKey("startDate")) {
String applyTime = (String) map.get("startDate");
map.put("startDate", DateUtil.DateTimeByDayToTimeStamp(applyTime));
}
if (map.containsKey("endDate")) {
String applyTime = (String) map.get("endDate");
map.put("endDate", DateUtil.DateTimeByDayToTimeStamp(applyTime));
}
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());

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

@ -18,10 +18,13 @@
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">开始日期</label>
<div class="layui-input-block">
<input type="text" name="applyTime" id="date" placeholder="请选择开始日期"
autocomplete="off" class="layui-input">
<label class="layui-form-label">申请时间</label>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" id="startDate" name="startDate" autocomplete="off" placeholder="开始日期" class="layui-input">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" id="endDate" name="endDate" autocomplete="off" placeholder="结束日期" class="layui-input">
</div>
</div>
<div class="layui-inline">
@ -37,16 +40,14 @@
<div class="layui-inline">
<label class="layui-form-label">物料名称:</label>
<div class="layui-input-block">
<input id="openSonByMaterial" readonly type="text" placeholder="请填写物料名称"
class="layui-input" onclick="selectMaterialByName(this)"/>
<input id="mid" name="mid" readonly type="text" placeholder="请填写物料名称"
class="layui-input" style="display:none;"/>
<input id="mname" name="mname" type="text" placeholder="请填写物料名称"
class="layui-input" />
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">存货编码</label>
<label class="layui-form-label">物料编码</label>
<div class="layui-input-block">
<input type="text" name="code" autocomplete="off" class="layui-input">
<input type="text" name="mcode" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
@ -55,6 +56,12 @@
<input type="text" class="layui-input" id="version" name="version" autocomplete="off"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">记录编码</label>
<div class="layui-input-block">
<input type="text" class="layui-input" id="code" name="code" autocomplete="off"/>
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
@ -116,7 +123,10 @@
//日期
laydate.render({
elem: '#date'
elem: '#startDate'
}); //日期
laydate.render({
elem: '#endDate'
});
table.render({
elem: "#currentTableId",
@ -173,19 +183,25 @@
form.on('submit(data-search-btn)', function (data) {
var req = {};
data = data.field;
if (data.mid !== '') {
req.mid = data.mid;
if (data.mname !== '') {
req.mname = data.mname;
}
if (data.depositoryId !== '') {
req.depositoryId = data.depositoryId;
}
if (data.applyTime !== '') {
req.applyTime = data.applyTime;
if (data.startDate !== '') {
req.startDate = data.startDate;
}
if (data.endDate !== '') {
req.endDate = data.endDate;
}
if (data.code !== '') {
req.code = data.code;
}
if (data.code !== '') {
if (data.mcode !== '') {
req.mcode = data.mcode;
}
if (data.version !== '') {
req.version = data.version;
}

212
src/main/resources/templates/pages/depository/table-out.html

@ -18,47 +18,50 @@
<form class="layui-form layui-form-pane" action="">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">开始日期</label>
<div class="layui-input-block">
<input type="text" name="applyTime" id="date" placeholder="请选择开始日期"
autocomplete="off" class="layui-input">
<label class="layui-form-label">申请时间</label>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" id="startDate" name="startDate" autocomplete="off" placeholder="开始日期" class="layui-input">
</div>
<div class="layui-form-mid">-</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="text" id="endDate" name="endDate" autocomplete="off" placeholder="结束日期" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">仓库</label>
<div class="layui-input-inline">
<!--<select name="depositoryId" >
<option value="" selected>请选择仓库</option>
<option th:each="depository,iterStar:${depositories}" th:value="${depository?.getId()}" th:text="${depository?.getDname()}" >外芯仓库</option>
</select>-->
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository"
readonly/>
<input type="text" name="depositoryId" class="layui-input" id="depositoryId"
style="display: none"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">记录编码</label>
<div class="layui-input-block">
<input type="text" class="layui-input" id="code" name="code" autocomplete="off"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">物料名称:</label>
<div class="layui-input-inline">
<input id="openSonByMaterial" readonly type="text" placeholder="请填写物料名称"
class="layui-input" onclick="selectMaterialByName(this)"/>
<input id="mid" name="mid" readonly type="text" placeholder="请填写物料名称"
class="layui-input" style="display:none;"/>
<input id="mname" name="mname" type="text" placeholder="请填写物料名称"
class="layui-input" />
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">存货编码</label>
<div class="layui-input-block">
<input type="text" name="code" autocomplete="off" class="layui-input">
<input type="text" name="mcode" autocomplete="off" class="layui-input">
</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"/>
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索
@ -72,7 +75,9 @@
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加</button>
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete" th:style="'display:'+${display}"> 删除</button>
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"
th:style="'display:'+${display}"> 删除
</button>
</div>
</script>
@ -80,7 +85,8 @@
<script type="text/html" id="currentTableBar">
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="detail">详情</a>
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete" th:style="'display:'+${display}">删除</a>
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete"
th:style="'display:'+${display}">删除</a>
</script>
</div>
@ -110,12 +116,12 @@
move: '.layui-layer-title',
fixed: false,
content: '/selectDepository?type=2',
success: function(layero, index){
success: function (layero, index) {
var children = layero.children();
var content = $(children[1]);
var iframeChildren = $(content.children());
content.css('height','100%');
iframeChildren.css('height','100%');
content.css('height', '100%');
iframeChildren.css('height', '100%');
}
});
});
@ -135,12 +141,12 @@
content: '/getMaterialAll?type=1&mname=""',
move: '.layui-layer-title',
fixed: false,
success: function(layero, index){
success: function (layero, index) {
var children = layero.children();
var content = $(children[1]);
var iframeChildren = $(content.children());
content.css('height','100%');
iframeChildren.css('height','100%');
content.css('height', '100%');
iframeChildren.css('height', '100%');
}
});
@ -148,7 +154,10 @@
//日期
laydate.render({
elem: '#date'
elem: '#startDate'
}); //日期
laydate.render({
elem: '#endDate'
});
table.render({
elem: "#currentTableId",
@ -209,7 +218,7 @@
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
]
],
limits: [10, 15, 20, 25, 50,100],
limits: [10, 15, 20, 25, 50, 100],
limit: 10,
page: true,
skin: 'line',
@ -227,13 +236,22 @@
if (data.depositoryId !== '') {
req.depositoryId = data.depositoryId;
}
if (data.applyTime !== '') {
req.applyTime = data.applyTime;
if (data.startDate !== '') {
req.startDate = data.startDate;
}if (data.endDate !== '') {
req.endDate = data.endDate;
}
if (data.mcode !== '') {
req.mcode = data.mcode;
}
if (data.code !== '') {
req.code = data.code;
}
if (data.code !== '') {
if (data.mname !== '') {
req.mname = data.mname;
}
if (data.version !== '') {
req.version = data.version;
}
//执行搜索重载
@ -275,35 +293,72 @@
if (req.ids.length > 0) {
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) {
$.ajax({
url: '/depositoryRecord/deleteApplicationOutRecord',
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
url: 'depositoryRecord/judgeApplicationOutRecordStatus',
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
success: function (res) {
let status = res.status;
let res_data = res.data;
if(status === 2){
if(res_data.length === 0){
layer.confirm("该操作会造成不可逆的后果,确定删除?",{
icon:2,
title:"提示"
},function () {
$.ajax({
url: '/depositoryRecord/deleteApplicationOutRecord',
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("删除成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
});
//执行搜索重载
table.reload('currentTableId', {
url: '/depositoryRecord/applicationOutView',
page: {
curr: 1
} else {
layer.msg("删除成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
});
//执行搜索重载
table.reload('currentTableId', {
url: '/depositoryRecord/applicationOutView',
page: {
curr: 1
}
}, 'data');
return false;
}
}
})
})
}
else {
let msg = "申请编码为:";
$.each(res_data,function (index_num,item_num) {
$.each(data,function (index,item) {
if(item_num === item.id){
msg += item.code+",";
}
})
});
msg += "的出库记录正在出库中,不允许删除";
layer.msg(msg,{
icon:2,
time:1500
})
}
}, 'data');
return false;
}
}
}
})
)
});
} else {
layer.msg("未选中记录,请确认!");
@ -338,28 +393,53 @@
req.id = data.id;
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) {
$.ajax({
url: 'depositoryRecord/deleteApplicationOutRecord',
url: 'depositoryRecord/judgeApplicationOutRecordStatus',
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
success: function (res) {
let data = res.data;
let status = res.status;
if (status === 1) {
if (data) {
// 如果可以删除
layer.confirm('该操作将造成不可逆的后果,是否删除?', {icon: 2, title: '提示'}, function (index) {
$.ajax({
url: 'depositoryRecord/deleteApplicationOutRecord',
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
obj.del();
layer.msg("删除成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
});
} else {
obj.del();
layer.msg("删除成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
});
}
}
})
})
} else {
// 如果不可以删除
layer.msg("该出库正在进行中,不允许删除", {
icon: 0,
time: 1500
})
}
}
}
})
});
}
});

8
src/test/java/com/dreamchaser/depository_manage/TestOther.java

@ -3,6 +3,7 @@ package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.entity.ApplicationOutRecordMin;
import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.entity.qywxDepartment;
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper;
@ -29,13 +30,6 @@ public class TestOther {
@Test
public void Test(){
Map<String, Object> map = new HashMap<>();
List<Integer> depositoryRecordList = new ArrayList<>();
depositoryRecordList.add(48);
map.put("depositoryIdList",depositoryRecordList);
List<ApplicationInRecordP> applicationInRecordPByCondition = depositoryRecordMapper.findApplicationInRecordPByCondition(map);
System.out.println(applicationInRecordPByCondition);
}
}

Loading…
Cancel
Save