Browse Source

修改出库数量合法性判断

lwx_dev
erdanergou 3 years ago
parent
commit
8b61a6e558
  1. 26
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 2
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  3. 12
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 17
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.java
  5. 430
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  6. 5
      src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java
  7. 35
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  8. 8
      src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java
  9. 109
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  10. 17
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  11. 8
      src/main/resources/templates/pages/depository/table-in.html
  12. 41
      src/test/java/com/dreamchaser/depository_manage/TestOther.java

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

@ -46,6 +46,10 @@ public class DepositoryRecordController {
private SplitUnitService splitUnitService; private SplitUnitService splitUnitService;
@Autowired
private RoleService roleService;
@GetMapping("/myApply") @GetMapping("/myApply")
public RestResponse findDepositoryInAndOutRecordPByCondition(@RequestParam Map<String, Object> map, HttpServletRequest request) { public RestResponse findDepositoryInAndOutRecordPByCondition(@RequestParam Map<String, Object> map, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); UserByPort userToken = (UserByPort) request.getAttribute("userToken");
@ -356,7 +360,7 @@ public class DepositoryRecordController {
}).start();*/ }).start();*/
// 开启一个线程开启审批 // 开启一个线程开启审批
new Thread(new Runnable() { /*new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id)); JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id));
@ -368,7 +372,7 @@ public class DepositoryRecordController {
// 设置过期为7天 // 设置过期为7天
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS);
} }
}).start(); }).start();*/
} }
} else { } else {
@ -460,11 +464,12 @@ public class DepositoryRecordController {
// 查看入库申请 // 查看入库申请
@GetMapping("/applicationInView") @GetMapping("/applicationInView")
public RestResponse findApplicationInRecordByCondition(@RequestParam Map<String, Object> map, HttpServletRequest request) { public RestResponse findApplicationInRecordByCondition(@RequestParam Map<String, Object> map, HttpServletRequest request) {
List<ApplicationInRecordP> list = depositoryRecordService.findApplicationInRecordPByCondition(map, request); UserByPort userToken = (UserByPort) request.getAttribute("userToken");
List<ApplicationInRecordP> list = depositoryRecordService.findApplicationInRecordPByUser(userToken,map);
for (ApplicationInRecordP applicationInRecordP : list) { for (ApplicationInRecordP applicationInRecordP : list) {
applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100); applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100);
} }
return new RestResponse(list, depositoryRecordService.findApplicationInRecordPCountByCondition(map), 200); return new RestResponse(list, depositoryRecordService.findApplicationInRecordPCountByUser(userToken,map), 200);
} }
// 当前仓库中该用户的子订单详情 // 当前仓库中该用户的子订单详情
@ -596,8 +601,7 @@ public class DepositoryRecordController {
public RestResponse findApplicationOutRecordByCondition(@RequestParam Map<String, Object> map, HttpServletRequest request) { public RestResponse findApplicationOutRecordByCondition(@RequestParam Map<String, Object> map, HttpServletRequest request) {
// 获取对应主订单 // 获取对应主订单
List<ApplicationOutRecordP> list = depositoryRecordService.findApplicationOutRecordPByCondition(map, request); List<ApplicationOutRecordP> list = depositoryRecordService.findApplicationOutRecordPByCondition(map, request);
for (int i = 0; i < list.size(); i++) { for (ApplicationOutRecordP outRecordP : list) {
ApplicationOutRecordP outRecordP = list.get(i);
// 根据主订单获取所有子订单 // 根据主订单获取所有子订单
List<ApplicationOutRecordMin> applicationOutMinByParentId = depositoryRecordService.findApplicationOutMinByParentId(outRecordP.getId()); List<ApplicationOutRecordMin> applicationOutMinByParentId = depositoryRecordService.findApplicationOutMinByParentId(outRecordP.getId());
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
@ -618,11 +622,11 @@ public class DepositoryRecordController {
sumQuantity += applicationOutRecordMin.getQuantity(); sumQuantity += applicationOutRecordMin.getQuantity();
sumPrice += (inventory.getPrice() * applicationOutRecordMin.getQuantity()); sumPrice += (inventory.getPrice() * applicationOutRecordMin.getQuantity());
} }
list.get(i).setMcode(mcode.toString()); outRecordP.setMcode(mcode.toString());
list.get(i).setMname(mname.toString()); outRecordP.setMname(mname.toString());
list.get(i).setDepositoryName(depositoryName.toString()); outRecordP.setDepositoryName(depositoryName.toString());
list.get(i).setQuantity(sumQuantity); outRecordP.setQuantity(sumQuantity);
list.get(i).setPrice(sumPrice); outRecordP.setPrice(sumPrice);
} }
return new RestResponse(list, depositoryRecordService.findApplicationOutRecordPCountByCondition(map), 200); return new RestResponse(list, depositoryRecordService.findApplicationOutRecordPCountByCondition(map), 200);
} }

2
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -614,7 +614,7 @@ public class MaterialController {
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
// 如果是基础单位 // 如果是基础单位
for (InventoryP inventoryP : inventoryPList) { for (InventoryP inventoryP : inventoryPList) {
Integer integer = inventoryP.getShowQuantity().get(inventoryP.getBaseUnit()); Integer integer = inventoryP.getBaseUnitQuantity();
if (quantity <= (integer - inventoryP.getNumberOfTemporary())) { // 如果当前数量合适则跳出循环 if (quantity <= (integer - inventoryP.getNumberOfTemporary())) { // 如果当前数量合适则跳出循环
flag = true; flag = true;
break; break;

12
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -748,8 +748,18 @@ public class PageController {
} }
@GetMapping("/table_in") @GetMapping("/table_in")
public ModelAndView table_in() { public ModelAndView table_in(HttpServletRequest request) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
Integer isadmin = userToken.getIsadmin();
if (isadmin == null) {
isadmin = 1;
}
if (isadmin == 4) {
mv.addObject("display", "inline-block");
} else {
mv.addObject("display", "none");
}
mv.setViewName("pages/depository/table-in"); mv.setViewName("pages/depository/table-in");
return mv; return mv;
} }

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

@ -216,6 +216,20 @@ public interface DepositoryRecordMapper {
*/ */
List<ApplicationInRecordP> findApplicationInRecordPByCondition(Map<String,Object> map); List<ApplicationInRecordP> findApplicationInRecordPByCondition(Map<String,Object> map);
/**
* 查询当前用户入库记录及其管理仓库的入库记录
* @param map 查询条件
* @return
*/
List<ApplicationInRecordP> findApplicationInRecordPByUser(Map<String,Object> map);
/**
* 查询当前用户入库记录及其管理仓库的入库记录数目
* @param map 查询条件
* @return
*/
Integer findApplicationInRecordPCountByUser(Map<String,Object> map);
/** /**
* 查询当前仓库的入库记录 * 查询当前仓库的入库记录
* @param depositoryId 待查询仓库id * @param depositoryId 待查询仓库id
@ -237,6 +251,9 @@ public interface DepositoryRecordMapper {
* @return * @return
*/ */
List<ApplicationOutRecordP> findApplicationOutRecordPByCondition(Map<String,Object> map); List<ApplicationOutRecordP> findApplicationOutRecordPByCondition(Map<String,Object> map);
/** /**
* 根据条件查询入库记录数目 * 根据条件查询入库记录数目
* @param map * @param map

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

@ -6,112 +6,113 @@
<!-- This code was generated by TableGo tools, mark 1 begin. --> <!-- This code was generated by TableGo tools, mark 1 begin. -->
<!-- 字段映射 --> <!-- 字段映射 -->
<resultMap id="simpleDepositoryRecordMap" type="com.dreamchaser.depository_manage.entity.SimpleDepositoryRecord"> <resultMap id="simpleDepositoryRecordMap" type="com.dreamchaser.depository_manage.entity.SimpleDepositoryRecord">
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER"/>
<result column="type" property="type" jdbcType="INTEGER" /> <result column="type" property="type" jdbcType="INTEGER"/>
<result column="applicant_id" property="applicantId" jdbcType="INTEGER" /> <result column="applicant_id" property="applicantId" jdbcType="INTEGER"/>
<result column="apply_remark" property="applyRemark" jdbcType="VARCHAR" /> <result column="apply_remark" property="applyRemark" jdbcType="VARCHAR"/>
<result column="apply_time" property="applyTime" jdbcType="INTEGER" /> <result column="apply_time" property="applyTime" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<!-- 字段映射 --> <!-- 字段映射 -->
<resultMap id="simpleApplicationOutRecordMap" type="com.dreamchaser.depository_manage.entity.SimpleApplicationOutRecord"> <resultMap id="simpleApplicationOutRecordMap"
type="com.dreamchaser.depository_manage.entity.SimpleApplicationOutRecord">
<id property="id" column="aorid" jdbcType="INTEGER"/> <id property="id" column="aorid" jdbcType="INTEGER"/>
<result column="applicantId" property="applicantId" jdbcType="INTEGER" /> <result column="applicantId" property="applicantId" jdbcType="INTEGER"/>
<result column="applicantTime" property="applicantTime" jdbcType="INTEGER" /> <result column="applicantTime" property="applicantTime" jdbcType="INTEGER"/>
<result column="applyRemark" property="applyRemark" jdbcType="VARCHAR" /> <result column="applyRemark" property="applyRemark" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 字段映射 --> <!-- 字段映射 -->
<resultMap id="depositoryRecordMap" type="com.dreamchaser.depository_manage.entity.DepositoryRecord"> <resultMap id="depositoryRecordMap" type="com.dreamchaser.depository_manage.entity.DepositoryRecord">
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER"/>
<result column="application_id" property="applicationId" jdbcType="INTEGER" /> <result column="application_id" property="applicationId" jdbcType="INTEGER"/>
<result column="mname" property="mname" jdbcType="VARCHAR" /> <result column="mname" property="mname" jdbcType="VARCHAR"/>
<result column="depository_id" property="depositoryId" jdbcType="INTEGER" /> <result column="depository_id" property="depositoryId" jdbcType="INTEGER"/>
<result column="type" property="type" jdbcType="INTEGER" /> <result column="type" property="type" jdbcType="INTEGER"/>
<result column="quantity" property="quantity" jdbcType="INTEGER" /> <result column="quantity" property="quantity" jdbcType="INTEGER"/>
<result column="price" property="price" jdbcType="VARCHAR" /> <result column="price" property="price" jdbcType="VARCHAR"/>
<result column="state" property="state" jdbcType="VARCHAR" /> <result column="state" property="state" jdbcType="VARCHAR"/>
<result column="applicant_id" property="applicantId" jdbcType="INTEGER" /> <result column="applicant_id" property="applicantId" jdbcType="INTEGER"/>
<result column="apply_remark" property="applyRemark" jdbcType="VARCHAR" /> <result column="apply_remark" property="applyRemark" jdbcType="VARCHAR"/>
<result column="apply_time" property="applyTime" jdbcType="INTEGER" /> <result column="apply_time" property="applyTime" jdbcType="INTEGER"/>
<result column="reviewer_id" property="reviewerId" jdbcType="INTEGER" /> <result column="reviewer_id" property="reviewerId" jdbcType="INTEGER"/>
<result column="review_remark" property="reviewRemark" jdbcType="VARCHAR" /> <result column="review_remark" property="reviewRemark" jdbcType="VARCHAR"/>
<result column="review_time" property="reviewTime" jdbcType="INTEGER" /> <result column="review_time" property="reviewTime" jdbcType="INTEGER"/>
<result column="review_pass" property="reviewPass" jdbcType="INTEGER" /> <result column="review_pass" property="reviewPass" jdbcType="INTEGER"/>
<result column="checker_id" property="checkerId" jdbcType="INTEGER" /> <result column="checker_id" property="checkerId" jdbcType="INTEGER"/>
<result column="check_remark" property="checkRemark" jdbcType="VARCHAR" /> <result column="check_remark" property="checkRemark" jdbcType="VARCHAR"/>
<result column="check_time" property="checkTime" jdbcType="INTEGER" /> <result column="check_time" property="checkTime" jdbcType="INTEGER"/>
<result column="check_pass" property="checkPass" jdbcType="INTEGER" /> <result column="check_pass" property="checkPass" jdbcType="INTEGER"/>
<result column="oldId" property="oldId" jdbcType="VARCHAR" /> <result column="oldId" property="oldId" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 插入入库记录--> <!-- 插入入库记录-->
<resultMap id="applicationInRecord" type="com.dreamchaser.depository_manage.pojo.ApplicationInRecordP"> <resultMap id="applicationInRecord" type="com.dreamchaser.depository_manage.pojo.ApplicationInRecordP">
<id column="airid" property="id" jdbcType="INTEGER" /> <id column="airid" property="id" jdbcType="INTEGER"/>
<result column="mname" property="mname" jdbcType="VARCHAR" /> <result column="mname" property="mname" jdbcType="VARCHAR"/>
<result column="quantity" property="quantity" jdbcType="INTEGER" /> <result column="quantity" property="quantity" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER" /> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="flagForGroup" property="flagForGroup" jdbcType="INTEGER" /> <result column="flagForGroup" property="flagForGroup" jdbcType="INTEGER"/>
<result column="price" property="price" jdbcType="VARCHAR" /> <result column="price" property="price" jdbcType="VARCHAR"/>
<result column="tname" property="materialTypeName" jdbcType="VARCHAR" /> <result column="tname" property="materialTypeName" jdbcType="VARCHAR"/>
<result column="applicantTime" property="applicant_time" jdbcType="INTEGER" /> <result column="applicantTime" property="applicant_time" jdbcType="INTEGER"/>
<result column="airPlaceId" property="placeId" jdbcType="INTEGER" /> <result column="airPlaceId" property="placeId" jdbcType="INTEGER"/>
<result column="code" property="aircode" jdbcType="VARCHAR" /> <result column="code" property="aircode" jdbcType="VARCHAR"/>
<result column="dname" property="depositoryName" jdbcType="VARCHAR" /> <result column="dname" property="depositoryName" jdbcType="VARCHAR"/>
<result column="applicant_id" property="applicantId" jdbcType="INTEGER" /> <result column="applicant_id" property="applicantId" jdbcType="INTEGER"/>
<result column="applyRemark" property="applyRemark" jdbcType="INTEGER" /> <result column="applyRemark" property="applyRemark" jdbcType="INTEGER"/>
<result column="aircode" property="aircode" jdbcType="VARCHAR" /> <result column="aircode" property="aircode" jdbcType="VARCHAR"/>
<result column="mcode" property="mcode" jdbcType="VARCHAR" /> <result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="mversion" property="mversion" jdbcType="VARCHAR" /> <result column="mversion" property="mversion" jdbcType="VARCHAR"/>
<result column="munit" property="munit" jdbcType="VARCHAR" /> <result column="munit" property="munit" jdbcType="VARCHAR"/>
<result column="mtexture" property="mtexture" jdbcType="VARCHAR" /> <result column="mtexture" property="mtexture" jdbcType="VARCHAR"/>
<result column="mkingdeecode" property="mkingdeecode" jdbcType="VARCHAR" /> <result column="mkingdeecode" property="mkingdeecode" jdbcType="VARCHAR"/>
<result column="mdepositoryCode" property="mdepositoryCode" jdbcType="VARCHAR" /> <result column="mdepositoryCode" property="mdepositoryCode" jdbcType="VARCHAR"/>
<result column="airUnit" property="airUnit" jdbcType="VARCHAR" /> <result column="airUnit" property="airUnit" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 插入出库记录--> <!-- 插入出库记录-->
<resultMap id="applicationOutRecord" type="com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP"> <resultMap id="applicationOutRecord" type="com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP">
<id property="id" column="aorid" jdbcType="INTEGER"/> <id property="id" column="aorid" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER" /> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mname" property="mname" jdbcType="VARCHAR" /> <result column="mname" property="mname" jdbcType="VARCHAR"/>
<result column="depositoryId" property="depositoryId" jdbcType="INTEGER" /> <result column="depositoryId" property="depositoryId" jdbcType="INTEGER"/>
<result column="dname" property="depositoryName" jdbcType="VARCHAR" /> <result column="dname" property="depositoryName" jdbcType="VARCHAR"/>
<result column="applicantId" property="applicantId" jdbcType="INTEGER" /> <result column="applicantId" property="applicantId" jdbcType="INTEGER"/>
<result column="applicantTime" property="applicantTime" jdbcType="INTEGER" /> <result column="applicantTime" property="applicantTime" jdbcType="INTEGER"/>
<result column="applyRemark" property="applyRemark" jdbcType="VARCHAR" /> <result column="applyRemark" property="applyRemark" jdbcType="VARCHAR"/>
<result column="aorcode" property="code" jdbcType="VARCHAR" /> <result column="aorcode" property="code" jdbcType="VARCHAR"/>
<result column="aorpirce" property="price" jdbcType="INTEGER" /> <result column="aorpirce" property="price" jdbcType="INTEGER"/>
<result column="aorquantity" property="quantity" jdbcType="INTEGER" /> <result column="aorquantity" property="quantity" jdbcType="INTEGER"/>
<result column="departmenthead" property="departmenthead" jdbcType="VARCHAR" /> <result column="departmenthead" property="departmenthead" jdbcType="VARCHAR"/>
<result column="departmentheadPass" property="departmentheadPass" jdbcType="INTEGER" /> <result column="departmentheadPass" property="departmentheadPass" jdbcType="INTEGER"/>
<result column="departmentHeadTime" property="departmentheadTime" jdbcType="INTEGER" /> <result column="departmentHeadTime" property="departmentheadTime" jdbcType="INTEGER"/>
<result column="departmentheadMessage" property="departmentheadMessage" jdbcType="VARCHAR" /> <result column="departmentheadMessage" property="departmentheadMessage" jdbcType="VARCHAR"/>
<result column="depositoryManager" property="depositoryManager" jdbcType="VARCHAR" /> <result column="depositoryManager" property="depositoryManager" jdbcType="VARCHAR"/>
<result column="depositoryManagerPass" property="depositoryManagerPass" jdbcType="INTEGER" /> <result column="depositoryManagerPass" property="depositoryManagerPass" jdbcType="INTEGER"/>
<result column="depositoryManagerTime" property="depositoryManagerTime" jdbcType="INTEGER" /> <result column="depositoryManagerTime" property="depositoryManagerTime" jdbcType="INTEGER"/>
<result column="depositoryManagerMessage" property="depositoryManagerMessage" jdbcType="VARCHAR" /> <result column="depositoryManagerMessage" property="depositoryManagerMessage" jdbcType="VARCHAR"/>
<result column="aorstate" property="state" jdbcType="VARCHAR" /> <result column="aorstate" property="state" jdbcType="VARCHAR"/>
<result column="istransfer" property="istransfer" jdbcType="INTEGER" /> <result column="istransfer" property="istransfer" jdbcType="INTEGER"/>
<result column="mcode" property="mcode" jdbcType="VARCHAR" /> <result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="placeId" property="placeId" jdbcType="INTEGER" /> <result column="placeId" property="placeId" jdbcType="INTEGER"/>
<result column="pass" property="pass" jdbcType="INTEGER" /> <result column="pass" property="pass" jdbcType="INTEGER"/>
<result column="aormUnit" property="unit" jdbcType="VARCHAR"/> <result column="aormUnit" property="unit" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 出库子订单--> <!-- 出库子订单-->
<resultMap id="applicationOutRecordMin" type="com.dreamchaser.depository_manage.entity.ApplicationOutRecordMin"> <resultMap id="applicationOutRecordMin" type="com.dreamchaser.depository_manage.entity.ApplicationOutRecordMin">
<id property="id" column="id" jdbcType="INTEGER"/> <id property="id" column="id" jdbcType="INTEGER"/>
<result column="mid" property="mid" jdbcType="INTEGER" /> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="depositoryId" property="depositoryId" jdbcType="INTEGER" /> <result column="depositoryId" property="depositoryId" jdbcType="INTEGER"/>
<result column="placeId" property="placeId" jdbcType="INTEGER" /> <result column="placeId" property="placeId" jdbcType="INTEGER"/>
<result column="quantity" property="quantity" jdbcType="INTEGER" /> <result column="quantity" property="quantity" jdbcType="INTEGER"/>
<result column="checkId" property="checkId" jdbcType="INTEGER" /> <result column="checkId" property="checkId" jdbcType="INTEGER"/>
<result column="parentId" property="parentId" jdbcType="INTEGER" /> <result column="parentId" property="parentId" jdbcType="INTEGER"/>
<result column="code" property="code" jdbcType="VARCHAR" /> <result column="code" property="code" jdbcType="VARCHAR"/>
<result column="transferId" property="transferId" jdbcType="INTEGER" /> <result column="transferId" property="transferId" jdbcType="INTEGER"/>
<result column="unit" property="unit" jdbcType="VARCHAR" /> <result column="unit" property="unit" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<!-- 表查询字段 --> <!-- 表查询字段 -->
@ -177,8 +178,8 @@
count(*) count(*)
FROM applicationOutRecordInfo WHERE 1=1 FROM applicationOutRecordInfo WHERE 1=1
<if test='isDone == "0"'> <if test='isDone == "0"'>
and (departmentHeadTime = 0 and FIND_IN_SET(#{userId},departmenthead) != 0 and DepartmentheadPass != 2) and (departmentHeadTime = 0 and FIND_IN_SET(#{userId},departmenthead) != 0 and DepartmentheadPass != 2)
or (depositoryManagerTime = 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and DepartmentheadPass != 2) or (depositoryManagerTime = 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and DepartmentheadPass != 2)
</if> </if>
<if test='isDone == "1"'> <if test='isDone == "1"'>
and (departmentHeadTime != 0 and FIND_IN_SET(#{userId},departmenthead) != 0) and (departmentHeadTime != 0 and FIND_IN_SET(#{userId},departmenthead) != 0)
@ -249,13 +250,13 @@
<!-- 查询所有数据 --> <!-- 查询所有数据 -->
<select id="findDepositoryRecordAll" resultMap="depositoryRecordMap"> <select id="findDepositoryRecordAll" resultMap="depositoryRecordMap">
SELECT SELECT
<include refid="allColumns" /> <include refid="allColumns"/>
FROM depository_record dr FROM depository_record dr
</select> </select>
<!-- 根据id查询数据 --> <!-- 根据id查询数据 -->
<select id="findDepositoryRecordById" resultMap="depositoryRecordMap" parameterType="integer"> <select id="findDepositoryRecordById" resultMap="depositoryRecordMap" parameterType="integer">
SELECT SELECT
<include refid="allColumns" /> <include refid="allColumns"/>
FROM depository_record dr FROM depository_record dr
where dr.id=#{id} where dr.id=#{id}
</select> </select>
@ -263,7 +264,7 @@
<!-- 根据isDone来寻找完成任务或者未完成任务 --> <!-- 根据isDone来寻找完成任务或者未完成任务 -->
<select id="findMyTask" resultMap="simpleDepositoryRecordMap" parameterType="map"> <select id="findMyTask" resultMap="simpleDepositoryRecordMap" parameterType="map">
SELECT SELECT
<include refid="simpleColumns" /> <include refid="simpleColumns"/>
FROM depository_record dr WHERE 1=1 FROM depository_record dr WHERE 1=1
<if test='isDone == "0"'> <if test='isDone == "0"'>
and (dr.review_time = 0 and dr.reviewer_id =#{userId}) and (dr.review_time = 0 and dr.reviewer_id =#{userId})
@ -281,15 +282,17 @@
<!-- 根据isDone来寻找完成任务或者未完成任务 --> <!-- 根据isDone来寻找完成任务或者未完成任务 -->
<select id="findMyTaskOut" resultMap="simpleApplicationOutRecordMap" parameterType="map"> <select id="findMyTaskOut" resultMap="simpleApplicationOutRecordMap" parameterType="map">
SELECT SELECT
<include refid="simpleApplicationOut" /> <include refid="simpleApplicationOut"/>
FROM applicationOutRecordInfo WHERE 1=1 FROM applicationOutRecordInfo WHERE 1=1
<if test='isDone == "0"'> <if test='isDone == "0"'>
and (departmentHeadTime = 0 and FIND_IN_SET(#{userId},departmenthead) != 0 and DepartmentheadPass = 3) and (departmentHeadTime = 0 and FIND_IN_SET(#{userId},departmenthead) != 0 and DepartmentheadPass = 3)
or (depositoryManagerTime = 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass = 3) or (depositoryManagerTime = 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass =
3)
</if> </if>
<if test='isDone == "1"'> <if test='isDone == "1"'>
and (departmentHeadTime != 0 and FIND_IN_SET(#{userId},departmenthead) != 0 and DepartmentheadPass != 3) and (departmentHeadTime != 0 and FIND_IN_SET(#{userId},departmenthead) != 0 and DepartmentheadPass != 3)
or (depositoryManagerTime != 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass != 3) or (depositoryManagerTime != 0 and FIND_IN_SET(#{userId},depositoryManager) != 0 and depositoryManagerPass
!= 3)
</if> </if>
group by aorid group by aorid
ORDER BY applicantTime desc ORDER BY applicantTime desc
@ -310,23 +313,74 @@
</if> </if>
</select> </select>
<!--根据条件查询入库记录-->
<select id="findApplicationInRecordPByUser" parameterType="map"
resultMap="applicationInRecord">
select
<include refid="ApplicationInRecordInfo"/>
from applicationInRecordInfo
where 1 = 1
<if test="depositoryIdList != null">
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}
</if>
</if>
<if test="depositoryIdList == null">
<if test="applicantId != null and applicantId != ''">
and applicant_id = #{applicantId}
</if>
</if>
order by applicant_time desc
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
</select>
<select id="findApplicationInRecordPCountByUser" parameterType="map"
resultType="int">
select
count(*)
from applicationInRecordInfo
where 1 = 1
<if test="depositoryIdList != null">
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}
</if>
</if>
<if test="depositoryIdList == null">
<if test="applicantId != null and applicantId != ''">
and applicant_id = #{applicantId}
</if>
</if>
</select>
<!--根据条件查询入库记录-->
<select id="findApplicationInRecordPByCondition" parameterType="map" resultMap="applicationInRecord"> <select id="findApplicationInRecordPByCondition" parameterType="map" resultMap="applicationInRecord">
select select
<include refid="ApplicationInRecordInfo"/> <include refid="ApplicationInRecordInfo"/>
from applicationInRecordInfo from applicationInRecordInfo
where 1 = 1 where 1 = 1
<if test="id != '' and id != null"> <if test="id != '' and id != null">
and airid = #{id} and airid = #{id}
</if> </if>
<if test="applicantId != null and applicantId != ''"> <if test="applicantId != null and applicantId != ''">
and applicant_id = #{applicantId} and applicant_id = #{applicantId}
</if> </if>
<if test="depositoryId != null and depositoryId != ''"> <if test="depositoryId != null and depositoryId != ''">
and did = #{depositoryId} and did = #{depositoryId}
</if> </if>
<if test="mid != null and mid != ''"> <if test="mid != null and mid != ''">
and mid = #{mid} and mid = #{mid}
</if> </if>
<if test="applicantTime != null and applicantTime != ''"> <if test="applicantTime != null and applicantTime != ''">
and applicant_time >= #{applicantTime} and applicant_time >= #{applicantTime}
@ -350,7 +404,7 @@
from applicationOutRecordInfo from applicationOutRecordInfo
where 1 = 1 and depositoryId = #{depositoryId} where 1 = 1 and depositoryId = #{depositoryId}
</select> </select>
<!--根据条件查询出库记录--> <!--根据条件查询出库记录-->
<select id="findApplicationOutRecordPByCondition" parameterType="map" resultMap="applicationOutRecord"> <select id="findApplicationOutRecordPByCondition" parameterType="map" resultMap="applicationOutRecord">
select select
<include refid="ApplicationOutRecordInfo"/> <include refid="ApplicationOutRecordInfo"/>
@ -427,7 +481,7 @@
</if> </if>
</select> </select>
<!-- 查询所有入库记录--> <!-- 查询所有入库记录-->
<select id="findApplicationInRecordPAll" resultMap="applicationInRecord"> <select id="findApplicationInRecordPAll" resultMap="applicationInRecord">
select select
<include refid="ApplicationInRecordInfo"/> <include refid="ApplicationInRecordInfo"/>
@ -453,7 +507,7 @@
from applicationOutRecordInfo from applicationOutRecordInfo
where applicantTime between #{start} and #{end} where applicantTime between #{start} and #{end}
</select> </select>
<!--根据主键查询出库记录--> <!--根据主键查询出库记录-->
<select id="findApplicationOutRecordPById" parameterType="int" resultMap="applicationOutRecord"> <select id="findApplicationOutRecordPById" parameterType="int" resultMap="applicationOutRecord">
select select
<include refid="ApplicationOutRecordInfo"/> <include refid="ApplicationOutRecordInfo"/>
@ -469,7 +523,7 @@
where aorcode = #{code} where aorcode = #{code}
</select> </select>
<!--根据主键查询入库记录--> <!--根据主键查询入库记录-->
<select id="findApplicationInRecordPById" parameterType="int" resultMap="applicationInRecord"> <select id="findApplicationInRecordPById" parameterType="int" resultMap="applicationInRecord">
select select
<include refid="ApplicationInRecordInfo"/> <include refid="ApplicationInRecordInfo"/>
@ -484,7 +538,7 @@
where aircode = #{code} where aircode = #{code}
</select> </select>
<!-- 根据条件查询入库记录数--> <!-- 根据条件查询入库记录数-->
<select id="findApplicationInRecordPCountByCondition" parameterType="map" resultType="int"> <select id="findApplicationInRecordPCountByCondition" parameterType="map" resultType="int">
select select
count(*) count(*)
@ -507,7 +561,7 @@
</if> </if>
</select> </select>
<!-- 根据条件查询出库记录数--> <!-- 根据条件查询出库记录数-->
<select id="findApplicationOutRecordPCountByCondition" parameterType="map" resultType="int"> <select id="findApplicationOutRecordPCountByCondition" parameterType="map" resultType="int">
select select
count(DISTINCT aorid) count(DISTINCT aorid)
@ -573,7 +627,7 @@
<select id="findDepositoryRecordByCondition" resultMap="depositoryRecordMap" parameterType="map"> <select id="findDepositoryRecordByCondition" resultMap="depositoryRecordMap" parameterType="map">
SELECT SELECT
<include refid="allColumnsAndUserP" /> <include refid="allColumnsAndUserP"/>
FROM DepositoryRecordByCondition dr FROM DepositoryRecordByCondition dr
WHERE 1 = 1 WHERE 1 = 1
<if test="applicationId != null"> <if test="applicationId != null">
@ -638,14 +692,14 @@
<!-- 根据主键查询数据 --> <!-- 根据主键查询数据 -->
<select id="findDepositoryRecordByIds" resultMap="depositoryRecordMap" parameterType="list"> <select id="findDepositoryRecordByIds" resultMap="depositoryRecordMap" parameterType="list">
SELECT SELECT
<include refid="allColumns" /> <include refid="allColumns"/>
FROM depository_record dr WHERE dr.id IN FROM depository_record dr WHERE dr.id IN
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> <foreach collection="list" index="index" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<!-- 插入一条入库记录--> <!-- 插入一条入库记录-->
<insert id="insertApplicationInRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id"> <insert id="insertApplicationInRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id">
insert into application_in_record (id,mid,quantity,price,applicant_id,applicant_time,depository_id,code,applyRemark,unit,flagForGroup,placeId) insert into application_in_record (id,mid,quantity,price,applicant_id,applicant_time,depository_id,code,applyRemark,unit,flagForGroup,placeId)
values( values(
@ -664,7 +718,7 @@
) )
</insert> </insert>
<!-- 插入一条出库记录--> <!-- 插入一条出库记录-->
<insert id="insertApplicationOutRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id"> <insert id="insertApplicationOutRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id">
insert into application_out_record insert into application_out_record
(id,applicant_id,applicant_time,code,price,quantity,departmenthead,departmenthead_pass,departmenthead_time, (id,applicant_id,applicant_time,code,price,quantity,departmenthead,departmenthead_pass,departmenthead_time,
@ -713,7 +767,7 @@
) )
</insert> </insert>
<!-- 插入一条出库子订单--> <!-- 插入一条出库子订单-->
<insert id="insertApplicationOutRecordMin" parameterType="map" useGeneratedKeys="true" keyProperty="id"> <insert id="insertApplicationOutRecordMin" parameterType="map" useGeneratedKeys="true" keyProperty="id">
insert into application_out_record_min (id,mid,quantity,code,depositoryId,placeId,checkId,parentId,transferId,trueOut,unit) insert into application_out_record_min (id,mid,quantity,code,depositoryId,placeId,checkId,parentId,transferId,trueOut,unit)
values( values(
@ -731,13 +785,13 @@
) )
</insert> </insert>
<!-- 查找子订单--> <!-- 查找子订单-->
<select id="findApplicationOutMinById" parameterType="int" resultMap="applicationOutRecordMin"> <select id="findApplicationOutMinById" parameterType="int" resultMap="applicationOutRecordMin">
select select
<include refid="ApplicationOutRecordMinInfo" /> <include refid="ApplicationOutRecordMinInfo"/>
from application_out_record_min as aorm from application_out_record_min as aorm
where 1 = 1 where 1 = 1
and aorm.id = #{id} and aorm.id = #{id}
</select> </select>
@ -745,19 +799,19 @@
<!-- 查找子订单--> <!-- 查找子订单-->
<select id="findApplicationOutMinByIds" parameterType="list" resultMap="applicationOutRecordMin"> <select id="findApplicationOutMinByIds" parameterType="list" resultMap="applicationOutRecordMin">
select select
<include refid="ApplicationOutRecordMinInfo" /> <include refid="ApplicationOutRecordMinInfo"/>
from application_out_record_min as aorm from application_out_record_min as aorm
where 1 = 1 where 1 = 1
and aorm.id in and aorm.id in
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> <foreach collection="list" index="index" item="id" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</select> </select>
<select id="findApplicationOutMinByCondition" parameterType="int" resultMap="applicationOutRecordMin"> <select id="findApplicationOutMinByCondition" parameterType="int" resultMap="applicationOutRecordMin">
select select
<include refid="ApplicationOutRecordMinInfo" /> <include refid="ApplicationOutRecordMinInfo"/>
from application_out_record_min as aorm from application_out_record_min as aorm
where 1 = 1 where 1 = 1
<if test="id != null and id != ''"> <if test="id != null and id != ''">
@ -792,46 +846,46 @@
<select id="findApplicationOutRecordMinByParent" parameterType="int" resultMap="applicationOutRecordMin"> <select id="findApplicationOutRecordMinByParent" parameterType="int" resultMap="applicationOutRecordMin">
select select
<include refid="ApplicationOutRecordMinInfo" /> <include refid="ApplicationOutRecordMinInfo"/>
from application_out_record_min as aorm from application_out_record_min as aorm
where 1 = 1 where 1 = 1
and aorm.parentId = #{parentId} and aorm.parentId = #{parentId}
</select> </select>
<select id="findApplicationOutMinForComplete" resultMap="applicationOutRecordMin" parameterType="map"> <select id="findApplicationOutMinForComplete" resultMap="applicationOutRecordMin" parameterType="map">
select select
<include refid="ApplicationOutRecordMinInfo" /> <include refid="ApplicationOutRecordMinInfo"/>
from application_out_record_min aorm left join application_out_record aor on aorm.parentId = aor.id from application_out_record_min aorm left join application_out_record aor on aorm.parentId = aor.id
where 1 = 1 where 1 = 1
and aor.pass = 1 and aor.applicant_time between #{start} and #{end} and aor.pass = 1 and aor.applicant_time between #{start} and #{end}
</select> </select>
<!-- 插入数据 --> <!-- 插入数据 -->
<insert id="insertDepositoryRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id"> <insert id="insertDepositoryRecord" parameterType="map" useGeneratedKeys="true" keyProperty="id">
INSERT INTO depository_record ( INSERT INTO depository_record (
id, application_id, mname, depository_id, type, quantity, price, state, id, application_id, mname, depository_id, type, quantity, price, state,
applicant_id, apply_remark, apply_time, applicant_id, apply_remark, apply_time,
reviewer_id, review_remark, review_time,review_pass, checker_id, check_remark, reviewer_id, review_remark, review_time,review_pass, checker_id, check_remark,
check_time,check_pass,oldId check_time,check_pass,oldId
) VALUES ( ) VALUES (
#{id}, #{id},
#{applicationId}, #{applicationId},
#{mname}, #{mname},
#{depositoryId}, #{depositoryId},
#{type}, #{type},
#{quantity}, #{quantity},
#{price}, #{price},
#{state}, #{state},
#{applicantId}, #{applicantId},
#{applyRemark}, #{applyRemark},
<if test="applyTime == null"> <if test="applyTime == null">
0, 0,
</if> </if>
<if test="applyTime != null"> <if test="applyTime != null">
#{applyTime}, #{applyTime},
</if> </if>
#{reviewerId}, #{reviewerId},
#{reviewRemark}, #{reviewRemark},
<if test="reviewTime == null"> <if test="reviewTime == null">
@ -840,52 +894,53 @@
<if test="reviewTime != null"> <if test="reviewTime != null">
#{reviewTime}, #{reviewTime},
</if> </if>
#{reviewPass}, #{reviewPass},
#{checkerId}, #{checkerId},
#{checkRemark}, #{checkRemark},
<if test="checkTime == null"> <if test="checkTime == null">
0, 0,
</if> </if>
<if test="checkTime != null"> <if test="checkTime != null">
#{checkTime}, #{checkTime},
</if> </if>
#{checkPass}, #{checkPass},
#{oldId} #{oldId}
) )
</insert> </insert>
<!-- 批量插入数据 --> <!-- 批量插入数据 -->
<insert id="insertDepositoryRecords" parameterType="list"> <insert id="insertDepositoryRecords" parameterType="list">
INSERT INTO depository_record ( INSERT INTO depository_record (
id, application_id, mname, depository_id, type, quantity, price, state, id, application_id, mname, depository_id, type, quantity, price, state,
applicant_id, apply_remark, apply_time, reviewer_id, review_remark, review_time,review_pass, checker_id, check_remark, applicant_id, apply_remark, apply_time, reviewer_id, review_remark, review_time,review_pass, checker_id,
check_remark,
check_time,check_pass check_time,check_pass
) VALUES ) VALUES
<foreach collection="list" index="index" item="item" separator=","> <foreach collection="list" index="index" item="item" separator=",">
( (
#{id}, #{id},
#{applicationId}, #{applicationId},
#{mname}, #{mname},
#{depositoryId}, #{depositoryId},
#{type}, #{type},
#{quantity}, #{quantity},
#{price}, #{price},
#{state}, #{state},
#{applicantId}, #{applicantId},
#{applyRemark}, #{applyRemark},
#{applyTime}, #{applyTime},
#{reviewerId}, #{reviewerId},
#{reviewRemark}, #{reviewRemark},
#{reviewTime}, #{reviewTime},
#{reviewPass}, #{reviewPass},
#{checkerId}, #{checkerId},
#{checkRemark}, #{checkRemark},
#{checkTime}, #{checkTime},
#{checkPass} #{checkPass}
) )
</foreach> </foreach>
</insert> </insert>
<!-- 修改数据 --> <!-- 修改数据 -->
<update id="updateDepositoryRecord" parameterType="map"> <update id="updateDepositoryRecord" parameterType="map">
UPDATE depository_record UPDATE depository_record
@ -948,7 +1003,7 @@
WHERE id = #{id} WHERE id = #{id}
</update> </update>
<!-- 修改子单--> <!-- 修改子单-->
<update id="updateApplicationOutRecordMin"> <update id="updateApplicationOutRecordMin">
update application_out_record_min update application_out_record_min
<set> <set>
@ -982,7 +1037,7 @@
</set> </set>
</update> </update>
<!-- 修改数据--> <!-- 修改数据-->
<update id="updateApplicationOutRecord" parameterType="map"> <update id="updateApplicationOutRecord" parameterType="map">
UPDATE application_out_record UPDATE application_out_record
<set> <set>
@ -1014,10 +1069,10 @@
departmenthead_pass = #{departmentheadPass}, departmenthead_pass = #{departmentheadPass},
</if> </if>
<if test="departmentheadTime != null and departmentheadTime != ''"> <if test="departmentheadTime != null and departmentheadTime != ''">
departmenthead_time = #{departmentheadTime}, departmenthead_time = #{departmentheadTime},
</if> </if>
<if test="departmentheadMessage != null and departmentheadMessage != ''"> <if test="departmentheadMessage != null and departmentheadMessage != ''">
departmenthead_messgae = #{departmentheadMessage}, departmenthead_messgae = #{departmentheadMessage},
</if> </if>
<if test="depositoryManager != null and depositoryManager != ''"> <if test="depositoryManager != null and depositoryManager != ''">
depository_manager = #{depositoryManager}, depository_manager = #{depositoryManager},
@ -1106,12 +1161,12 @@
WHERE id = #{item.id} WHERE id = #{item.id}
</foreach> </foreach>
</update> </update>
<!-- 根据主键删除数据 --> <!-- 根据主键删除数据 -->
<delete id="deleteDepositoryRecordById" parameterType="integer"> <delete id="deleteDepositoryRecordById" parameterType="integer">
DELETE FROM depository_record WHERE id = #{id} DELETE FROM depository_record WHERE id = #{id}
</delete> </delete>
<!-- 根据主键批量删除数据 --> <!-- 根据主键批量删除数据 -->
<delete id="deleteDepositoryRecordByIds" parameterType="list"> <delete id="deleteDepositoryRecordByIds" parameterType="list">
DELETE FROM depository_record WHERE id IN DELETE FROM depository_record WHERE id IN
@ -1120,14 +1175,14 @@
</foreach> </foreach>
</delete> </delete>
<!--获取一段时间内的库存额度--> <!--获取一段时间内的库存额度-->
<select id="findDepositoryRecordByDate" parameterType="map" resultType="double"> <select id="findDepositoryRecordByDate" parameterType="map" resultType="double">
SELECT SELECT
ifnull(sum(quantity),0) ifnull(sum(quantity),0)
FROM DepositoryRecordByDate FROM DepositoryRecordByDate
where 1 = 1 where 1 = 1
<if test="type != null"> <if test="type != null">
and type = #{type} and type = #{type}
</if> </if>
<if test="depositoryId != null"> <if test="depositoryId != null">
and depository_id = #{depositoryId} and depository_id = #{depositoryId}
@ -1141,7 +1196,7 @@
and check_time between #{start} and #{end} and check_time between #{start} and #{end}
</select> </select>
<!--获取一段时间内的入库额度--> <!--获取一段时间内的入库额度-->
<select id="findApplicationInRecordByDate" parameterType="map" resultType="int"> <select id="findApplicationInRecordByDate" parameterType="map" resultType="int">
SELECT SELECT
ifnull(sum(quantity),0) ifnull(sum(quantity),0)
@ -1181,7 +1236,7 @@
from MaterialCountByMonth from MaterialCountByMonth
where 1 = 1 where 1 = 1
<if test="type != null"> <if test="type != null">
and type = #{type} and type = #{type}
</if> </if>
<if test="state != null and state != ''"> <if test="state != null and state != ''">
and state = #{state} and state = #{state}
@ -1189,9 +1244,9 @@
<if test="depository_id != null and depository_id != ''"> <if test="depository_id != null and depository_id != ''">
and depository_id = #{depository_id} and depository_id = #{depository_id}
</if> </if>
and check_time between #{start} and #{end} and check_time between #{start} and #{end}
<if test="tname != null and tname != ''"> <if test="tname != null and tname != ''">
and tname = #{tname} and tname = #{tname}
</if> </if>
</select> </select>
@ -1203,7 +1258,7 @@
<if test="depository_id != null and depository_id != ''"> <if test="depository_id != null and depository_id != ''">
and did = #{depository_id} and did = #{depository_id}
</if> </if>
and applicant_time between #{start} and #{end} and applicant_time between #{start} and #{end}
<if test="tname != null and tname != ''"> <if test="tname != null and tname != ''">
and tname = #{tname} and tname = #{tname}
</if> </if>
@ -1219,7 +1274,7 @@
<if test="depository_id != null and depository_id != ''"> <if test="depository_id != null and depository_id != ''">
and did = #{depository_id} and did = #{depository_id}
</if> </if>
and applicant_time between #{start} and #{end} and applicant_time between #{start} and #{end}
<if test="tname != null and tname != ''"> <if test="tname != null and tname != ''">
and tname = #{tname} and tname = #{tname}
</if> </if>
@ -1248,7 +1303,7 @@
<if test="depository_id != null and depository_id != ''"> <if test="depository_id != null and depository_id != ''">
and depositoryId = #{depository_id} and depositoryId = #{depository_id}
</if> </if>
and depositoryManagerTime between #{start} and #{end} and depositoryManagerTime between #{start} and #{end}
<if test="tname != null and tname != ''"> <if test="tname != null and tname != ''">
and tname = #{tname} and tname = #{tname}
</if> </if>
@ -1271,6 +1326,7 @@
and dr.check_time between #{start} and #{end} and dr.check_time between #{start} and #{end}
</select> </select>
<!-- 根据主键删除数据 --> <!-- 根据主键删除数据 -->
<delete id="deleteApplicationInRecordById" parameterType="integer"> <delete id="deleteApplicationInRecordById" parameterType="integer">
DELETE FROM application_in_record WHERE id = #{id} DELETE FROM application_in_record WHERE id = #{id}
@ -1298,8 +1354,4 @@
</delete> </delete>
</mapper> </mapper>

5
src/main/java/com/dreamchaser/depository_manage/pojo/InventoryP.java

@ -191,6 +191,11 @@ public class InventoryP {
*/ */
private String baseUnit; private String baseUnit;
/**
* 基础单位对应数目
*/
private Integer baseUnitQuantity;
/** /**
* 默认单位 * 默认单位
*/ */

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

@ -87,6 +87,41 @@ public interface DepositoryRecordService {
*/ */
List<ApplicationInRecordP> findApplicationInRecordPByCondition(Map<String,Object> map,HttpServletRequest request); List<ApplicationInRecordP> findApplicationInRecordPByCondition(Map<String,Object> map,HttpServletRequest request);
/**
* 查询当前用户入库记录及其管理仓库的入库记录
* @param userByPort 待查询用户
* @param map 查询条件
* @return
*/
List<ApplicationInRecordP> findApplicationInRecordPByUser(UserByPort userByPort,Map<String,Object> map);
/**
* 查询当前用户入库记录及其管理仓库的入库记录数目
* @param map 查询条件
* @return
*/
Integer findApplicationInRecordPCountByUser(UserByPort userByPort,Map<String,Object> map);
/**
* 查询当前用户出库记录及其管理仓库的出库记录
* @param userByPort 待查询用户
* @param map 查询条件
* @return
*/
List<ApplicationOutRecordP> findApplicationOutRecordPByUser(UserByPort userByPort,Map<String,Object> map);
/**
* 查询当前用户出库记录及其管理仓库的出库记录数目
* @param map 查询条件
* @return
*/
Integer findApplicationOutRecordPCountByUser(UserByPort userByPort,Map<String,Object> map);
/** /**
* 根据条件查询出库记录同时支持分页查询 * 根据条件查询出库记录同时支持分页查询
* @param map * @param map

8
src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java

@ -66,6 +66,14 @@ public interface MaterialService {
List<InventoryP> findInventory(Map<String,Object> map); List<InventoryP> findInventory(Map<String,Object> map);
/**
* 根据物料编码及所处仓库查询库存
* @param map 待查询条件
* @return
*/
List<Inventory> findInventoryByMcodeAndDepository(Map<String,Object> map);
/** /**
* 根据条件查询符合条件的库存 * 根据条件查询符合条件的库存
* @param map * @param map

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

@ -2887,6 +2887,115 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
return list; return list;
} }
/**
* 查询当前用户入库记录及其管理仓库的入库记录
* @param userByPort 待查询用户
* @param map 查询条件
* @return
*/
@Override
public List<ApplicationInRecordP> findApplicationInRecordPByUser(UserByPort userByPort, Map<String, Object> map) {
Integer size = 10, page = 1;
if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size"));
map.put("size", size);
}
if (map.containsKey("page")) {
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));
}
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());
List<Integer> depositoryIdList = new ArrayList<>();
for (RoleAndDepository depository: depositoryAndRole
) {
depositoryIdList.add(depository.getDepositoryId());
}
if(depositoryIdList.size() == 0){
depositoryIdList = null;
}
map.put("depositoryIdList",depositoryIdList);
map.put("applicantId",userByPort.getId());
List<ApplicationInRecordP> list = depositoryRecordMapper.findApplicationInRecordPByUser(map);
for (ApplicationInRecordP applicationInRecordP : list) {
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecordP.getApplicantId(),userByPort);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordP.getApplicantTime()));
applicationInRecordP.setApplicantName(userByPortById.getName());
applicationInRecordP.setApplicantTime(time);
applicationInRecordP.setApplyRemark(applicationInRecordP.getApplyRemark() == null ? "" : applicationInRecordP.getApplyRemark());
if (Integer.compare(applicationInRecordP.getFlagForGroup(), 2) == 0) {
// 如果入库的是组合
Group group = groupMapper.findGroupOnlyById(applicationInRecordP.getMid());
applicationInRecordP.setMname(group.getGname());
applicationInRecordP.setAirUnit("");
applicationInRecordP.setMcode(group.getCode());
applicationInRecordP.setMversion("组合");
}
}
return list;
}
@Override
public Integer findApplicationInRecordPCountByUser(UserByPort userByPort, Map<String, Object> map) {
if (map.containsKey("applyTime")) {
String applyTime = (String) map.get("applyTime");
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime));
}
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userByPort.getId());
List<Integer> depositoryIdList = new ArrayList<>();
for (RoleAndDepository depository: depositoryAndRole
) {
depositoryIdList.add(depository.getDepositoryId());
}
if(depositoryIdList.size() == 0){
depositoryIdList = null;
}
map.put("depositoryIdList",depositoryIdList);
map.put("applicantId",userByPort.getId());
return depositoryRecordMapper.findApplicationInRecordPCountByUser(map);
}
/**
* 查询当前用户出库记录及其管理仓库的出库记录
* @param userByPort 待查询用户
* @param map 查询条件
* @return
*/
@Override
public List<ApplicationOutRecordP> findApplicationOutRecordPByUser(UserByPort userByPort, Map<String, Object> map) {
if (map.containsKey("applyTime")) {
String applyTime = (String) map.get("applyTime");
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime));
}
List<ApplicationOutRecordP> list = depositoryRecordMapper.findApplicationOutRecordPByCondition(map);
for (ApplicationOutRecordP recordP : list) {
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userByPort);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime()));
recordP.setApplicantName(userByPortById.getName());
recordP.setApplicantTime(time);
recordP.setApplyRemark(recordP.getApplyRemark() == null ? "" : recordP.getApplyRemark());
}
return list;
}
/**
* 查询当前用户出库记录及其管理仓库的出库记录数目
* @param map 查询条件
* @return
*/
@Override
public Integer findApplicationOutRecordPCountByUser(UserByPort userByPort, Map<String, Object> map) {
return null;
}
/** /**
* 根据条件查询出库记录同时支持分页查询 * 根据条件查询出库记录同时支持分页查询
* *

17
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java

@ -299,6 +299,22 @@ public class MaterialServiceImpl implements MaterialService {
return pack(list); return pack(list);
} }
/**
* 根据物料编码及所处仓库查询库存
* @param map 待查询条件
* @return
*/
@Override
public List<Inventory> findInventoryByMcodeAndDepository(Map<String, Object> map) {
Object state = 1;
if (map.containsKey("state")) {
state = map.get("state");
}
map.put("state", state);
List<Inventory> list = materialMapper.findInventory(map);
return list;
}
/** /**
* 根据条件查询符合条件的库存 * 根据条件查询符合条件的库存
* *
@ -704,6 +720,7 @@ public class MaterialServiceImpl implements MaterialService {
Map<String, Integer> splitInventoryForUnit = new HashMap<>(); Map<String, Integer> splitInventoryForUnit = new HashMap<>();
splitInventoryForUnit.put(inventory.getUnit(), inventory.getQuantity()); splitInventoryForUnit.put(inventory.getUnit(), inventory.getQuantity());
m.setBaseUnitQuantity(inventory.getQuantity());
// 定义最后展示单位及数目 // 定义最后展示单位及数目
String unit = inventory.getUnit(); String unit = inventory.getUnit();

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

@ -68,7 +68,7 @@
<script type="text/html" id="toolbarDemo"> <script type="text/html" id="toolbarDemo">
<div class="layui-btn-container"> <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-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"> 删除</button> <button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete" th:style="'display:'+${display}"> 删除</button>
</div> </div>
</script> </script>
@ -76,7 +76,7 @@
<script type="text/html" id="currentTableBar"> <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-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">删除</a> <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete" th:style="'display:'+${display}">删除</a>
</script> </script>
</div> </div>
@ -102,7 +102,7 @@
var parentId = parent.id; var parentId = parent.id;
layer.open({ layer.open({
type: 2, type: 2,
title: '弹窗内容', title: '仓库列表',
skin: 'layui-layer-rim', skin: 'layui-layer-rim',
maxmin: true, maxmin: true,
shadeClose: true, //点击遮罩关闭层 shadeClose: true, //点击遮罩关闭层
@ -206,7 +206,7 @@
table.on('toolbar(currentTableFilter)', function (obj) { table.on('toolbar(currentTableFilter)', function (obj) {
if (obj.event === 'add') { // 监听添加操作 if (obj.event === 'add') { // 监听添加操作
var index = layer.open({ var index = layer.open({
title: '申请提交', title: '入库申请',
type: 2, type: 2,
shade: 0.2, shade: 0.2,
maxmin: true, maxmin: true,

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

@ -0,0 +1,41 @@
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.UserByPort;
import com.dreamchaser.depository_manage.entity.qywxDepartment;
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper;
import com.dreamchaser.depository_manage.pojo.ApplicationInRecordP;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TestOther {
@Autowired
DepositoryRecordMapper depositoryRecordMapper;
@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