Browse Source

修改库存盘点处理功能

lwx_dev
erdanergou 3 years ago
parent
commit
eb96f1a7bf
  1. 80
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  2. 2
      src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java
  3. 5
      src/main/java/com/dreamchaser/depository_manage/entity/StockTaking.java
  4. 33
      src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml
  5. 6
      src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java
  6. 1
      src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingP.java
  7. 57
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  8. 126
      src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java
  9. 51
      src/main/resources/templates/pages/stockTaking/stockTaking.html
  10. 27
      src/main/resources/templates/pages/stockTaking/stockTakingComplete.html
  11. 33
      target/classes/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml
  12. 51
      target/classes/templates/pages/stockTaking/stockTaking.html
  13. 27
      target/classes/templates/pages/stockTaking/stockTakingComplete.html

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

@ -330,7 +330,7 @@ public class PageController {
Map<String, Object> paramForTask = new HashMap<>(); Map<String, Object> paramForTask = new HashMap<>();
paramForTask.put("isDone", 0); paramForTask.put("isDone", 0);
paramForTask.put("userId", userToken.getId()); paramForTask.put("departmentHead", userToken.getNumber());
// 定义任务列表 // 定义任务列表
List<SimpleTaskP> list = new ArrayList<>(); List<SimpleTaskP> list = new ArrayList<>();
@ -378,7 +378,7 @@ public class PageController {
if (role == null) { if (role == null) {
role = 1; role = 1;
} }
if (role == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (role == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -444,7 +444,7 @@ public class PageController {
if (role == null) { if (role == null) {
role = 1; role = 1;
} }
if (role == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (role == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -465,7 +465,7 @@ public class PageController {
if (isadmin == null) { if (isadmin == null) {
isadmin = 1; isadmin = 1;
} }
if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -667,7 +667,7 @@ public class PageController {
} }
List<MaterialType> materialTypeAll = materialTypeService.findMaterialTypeByCondition(map); List<MaterialType> materialTypeAll = materialTypeService.findMaterialTypeByCondition(map);
mv.addObject("materialTypes", materialTypeAll); mv.addObject("materialTypes", materialTypeAll);
if (role == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (role == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -781,7 +781,7 @@ public class PageController {
if (isadmin == null) { if (isadmin == null) {
isadmin = 1; isadmin = 1;
} }
if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -798,7 +798,7 @@ public class PageController {
if (isadmin == null) { if (isadmin == null) {
isadmin = 1; isadmin = 1;
} }
if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -903,7 +903,7 @@ public class PageController {
if (isadmin == null) { if (isadmin == null) {
isadmin = 1; isadmin = 1;
} }
if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -936,7 +936,7 @@ public class PageController {
} }
@GetMapping("/group_edit") @GetMapping("/group_edit")
public ModelAndView groupEdit(Integer id,HttpServletRequest request) { public ModelAndView groupEdit(Integer id, HttpServletRequest request) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/group/group_edit"); mv.setViewName("pages/group/group_edit");
Group group = groupService.findGroupOnlyById(id); Group group = groupService.findGroupOnlyById(id);
@ -945,7 +945,7 @@ public class PageController {
if (isadmin == null) { if (isadmin == null) {
isadmin = 1; isadmin = 1;
} }
if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(),361) == 0) { if (isadmin == 4 || Integer.compare(userToken.getMaindeparment(), 361) == 0) {
mv.addObject("display", "inline-block"); mv.addObject("display", "inline-block");
} else { } else {
mv.addObject("display", "none"); mv.addObject("display", "none");
@ -1075,7 +1075,7 @@ public class PageController {
@GetMapping("/user_add") @GetMapping("/user_add")
public ModelAndView user_add(Integer userId,Integer classes, HttpServletRequest request) { public ModelAndView user_add(Integer userId, Integer classes, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/user-add"); mv.setViewName("pages/user/user-add");
@ -1188,7 +1188,7 @@ public class PageController {
mv.addObject("id", id); mv.addObject("id", id);
Place placeById = placeService.findPlaceById(id); Place placeById = placeService.findPlaceById(id);
mv.addObject("place", placeById); mv.addObject("place", placeById);
if(Integer.compare(placeById.getFlagForType(),2)==0){ if (Integer.compare(placeById.getFlagForType(), 2) == 0) {
// 如果是托盘 // 如果是托盘
mv.setViewName("pages/place/place_editForTray"); mv.setViewName("pages/place/place_editForTray");
} }
@ -1268,6 +1268,7 @@ public class PageController {
/** /**
* 用于跳转到仓库管理员 * 用于跳转到仓库管理员
*
* @param id * @param id
* @return * @return
*/ */
@ -1281,6 +1282,7 @@ public class PageController {
/** /**
* 用于跳转到入库申请审核时的赋权 * 用于跳转到入库申请审核时的赋权
*
* @param id * @param id
* @return * @return
*/ */
@ -1293,7 +1295,7 @@ public class PageController {
} }
@GetMapping("/postRoleView") @GetMapping("/postRoleView")
public ModelAndView findPostRoleView(Integer id,Integer classes) { public ModelAndView findPostRoleView(Integer id, Integer classes) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.addObject("postId", id); mv.addObject("postId", id);
mv.addObject("classes", classes); mv.addObject("classes", classes);
@ -1476,9 +1478,9 @@ public class PageController {
ApplicationInRecordP applicationInRecordPById = depositoryRecordService.findApplicationInRecordPById(id); ApplicationInRecordP applicationInRecordPById = depositoryRecordService.findApplicationInRecordPById(id);
String airapproverTime = applicationInRecordPById.getAirapproverTime(); String airapproverTime = applicationInRecordPById.getAirapproverTime();
if(airapproverTime != null && !"".equals(airapproverTime)){ if (airapproverTime != null && !"".equals(airapproverTime)) {
airapproverTime = DateUtil.TimeStampToDateTime(Long.valueOf(airapproverTime)); airapproverTime = DateUtil.TimeStampToDateTime(Long.valueOf(airapproverTime));
applicationInRecordPById.setAirapproverTime(airapproverTime); applicationInRecordPById.setAirapproverTime(airapproverTime);
} }
// 获取入库库位id // 获取入库库位id
@ -1489,12 +1491,12 @@ public class PageController {
placeCode = placeById.getCode(); placeCode = placeById.getCode();
} }
Integer flagForGroup = applicationInRecordPById.getFlagForGroup(); Integer flagForGroup = applicationInRecordPById.getFlagForGroup();
if(Integer.compare(applicationInRecordPById.getAirapproverPass(),4) != 0){ if (Integer.compare(applicationInRecordPById.getAirapproverPass(), 4) != 0) {
String[] airapproverId = applicationInRecordPById.getAirapproverId().split(","); String[] airapproverId = applicationInRecordPById.getAirapproverId().split(",");
StringBuilder airapproverName = new StringBuilder(); StringBuilder airapproverName = new StringBuilder();
for (String approverId:airapproverId for (String approverId : airapproverId
) { ) {
if(!"".equals(approverId)){ if (!"".equals(approverId)) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(approverId), userToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(approverId), userToken);
airapproverName.append(userByPort.getName()).append(","); airapproverName.append(userByPort.getName()).append(",");
} }
@ -1541,7 +1543,7 @@ public class PageController {
ApplicationInRecordP applicationInRecordPById = depositoryRecordService.findApplicationInRecordPById(id); ApplicationInRecordP applicationInRecordPById = depositoryRecordService.findApplicationInRecordPById(id);
String airapproverTime = applicationInRecordPById.getAirapproverTime(); String airapproverTime = applicationInRecordPById.getAirapproverTime();
if(airapproverTime != null && !"".equals(airapproverTime)){ if (airapproverTime != null && !"".equals(airapproverTime)) {
airapproverTime = DateUtil.TimeStampToDateTime(Long.valueOf(airapproverTime)); airapproverTime = DateUtil.TimeStampToDateTime(Long.valueOf(airapproverTime));
applicationInRecordPById.setAirapproverTime(airapproverTime); applicationInRecordPById.setAirapproverTime(airapproverTime);
} }
@ -1554,12 +1556,12 @@ public class PageController {
placeCode = placeById.getCode(); placeCode = placeById.getCode();
} }
Integer flagForGroup = applicationInRecordPById.getFlagForGroup(); Integer flagForGroup = applicationInRecordPById.getFlagForGroup();
if(Integer.compare(applicationInRecordPById.getAirapproverPass(),4) != 0){ if (Integer.compare(applicationInRecordPById.getAirapproverPass(), 4) != 0) {
String[] airapproverId = applicationInRecordPById.getAirapproverId().split(","); String[] airapproverId = applicationInRecordPById.getAirapproverId().split(",");
StringBuilder airapproverName = new StringBuilder(); StringBuilder airapproverName = new StringBuilder();
for (String approverId:airapproverId for (String approverId : airapproverId
) { ) {
if(!"".equals(approverId)){ if (!"".equals(approverId)) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(approverId), userToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(approverId), userToken);
airapproverName.append(userByPort.getName()).append(","); airapproverName.append(userByPort.getName()).append(",");
} }
@ -1597,8 +1599,6 @@ public class PageController {
} }
@GetMapping("/form_step_lookByminRecordOut") @GetMapping("/form_step_lookByminRecordOut")
public ModelAndView form_step_lookByminRecordOut(Integer id, HttpServletRequest request) { public ModelAndView form_step_lookByminRecordOut(Integer id, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); UserByPort userToken = (UserByPort) request.getAttribute("userToken");
@ -1866,28 +1866,20 @@ public class PageController {
// 负责人姓名 // 负责人姓名
StringBuilder managerName = new StringBuilder(); StringBuilder managerName = new StringBuilder();
String[] split = stp.getDepartmentManager().split(","); String[] split = stp.getDepartmentManager().split(",");
for (int i = 0; i < split.length; i++) { for (String s : split) {
String s = split[i];
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort manager = PortConfig.findUserByPortByNumber(s); UserByPort manager = PortConfig.findUserByPortByNumber(s);
managerName.append(manager.getName() + ","); managerName.append(manager.getName()).append(",");
} }
stp.setDepartmentManagerName(managerName.toString()); stp.setDepartmentManagerName(managerName.toString());
// 获取盘点位置 // 获取盘点位置
Integer placeId = stockTaking.getPlaceId();
StringBuilder location = new StringBuilder();
Depository depository = depositoryService.findDepositoryById(stockTaking.getDepositoryId()); Depository depository = depositoryService.findDepositoryById(stockTaking.getDepositoryId());
location.append(depository.getDname()); String location = depository.getDname();
if (!(Integer.compare(placeId, 0) == 0)) {
// 如果不是默认库位
Place placeById = placeService.findPlaceById(placeId);
location.append("-" + placeById.getCode());
}
// 设置盘点位置 // 设置盘点位置
stp.setDepositoryName(location.toString()); stp.setDepositoryName(location);
mv.addObject("mainRecord", stp); mv.addObject("mainRecord", stp);
mv.addObject("recordChild", stockTakingChildPByMainId); mv.addObject("recordChild", stockTakingChildPByMainId);
Integer departmentManagerState = stp.getDepartmentManagerState(); Integer departmentManagerState = stp.getDepartmentManagerState();
@ -1956,15 +1948,8 @@ public class PageController {
stp.setDepartmentManagerName(managerName.toString()); stp.setDepartmentManagerName(managerName.toString());
// 获取盘点位置 // 获取盘点位置
Integer placeId = stockTaking.getPlaceId();
StringBuilder location = new StringBuilder();
Depository depository = depositoryService.findDepositoryById(stockTaking.getDepositoryId()); Depository depository = depositoryService.findDepositoryById(stockTaking.getDepositoryId());
location.append(depository.getDname()); String location = depository.getDname();
if (!(Integer.compare(placeId, 0) == 0)) {
// 如果不是默认库位
Place placeById = placeService.findPlaceById(placeId);
location.append("-").append(placeById.getCode());
}
// 设置盘点位置 // 设置盘点位置
stp.setDepositoryName(location.toString()); stp.setDepositoryName(location.toString());
mv.addObject("mainRecord", stp); mv.addObject("mainRecord", stp);
@ -1996,7 +1981,6 @@ public class PageController {
} }
public List<AdministrationP> findAllCompany(UserByPort userByPort) { public List<AdministrationP> findAllCompany(UserByPort userByPort) {
String url = PortConfig.external_url + "/org/govlist"; String url = PortConfig.external_url + "/org/govlist";
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
@ -2195,7 +2179,7 @@ public class PageController {
// 跳转到添加权限界面 // 跳转到添加权限界面
@GetMapping("/postRoleAdd") @GetMapping("/postRoleAdd")
public ModelAndView PostRoleAdd(Integer id,Integer classes, HttpServletRequest request) { public ModelAndView PostRoleAdd(Integer id, Integer classes, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/post/postRole_add"); mv.setViewName("pages/post/postRole_add");
@ -2508,7 +2492,7 @@ public class PageController {
// 获取主订单 // 获取主订单
stockTaking = stockTakingService.findStockTakingById(stcp.getMainId()); stockTaking = stockTakingService.findStockTakingById(stcp.getMainId());
Integer placeId = stockTaking.getPlaceId(); Integer placeId = stcp.getMid();
// 获取库位详情 // 获取库位详情
Place placeById = placeService.findPlaceById(placeId); Place placeById = placeService.findPlaceById(placeId);

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

@ -345,7 +345,7 @@ public class StockTakingController {
} }
param.put("newInventory", newInventory); param.put("newInventory", newInventory);
param.put("depositoryId",map.get("depositoryId")); param.put("depositoryId",map.get("depositoryId"));
param.put("placeId",map.get("placeId")); param.put("placeId",placeAndMaterial.getPid().toString());
param.put("departmentManager",map.get("departmentManager")); param.put("departmentManager",map.get("departmentManager"));
param.put("state",3); param.put("state",3);
param.put("departmentManagerState",3); param.put("departmentManagerState",3);

5
src/main/java/com/dreamchaser/depository_manage/entity/StockTaking.java

@ -26,11 +26,6 @@ public class StockTaking {
/** /**
* 盘点仓库 * 盘点仓库
*/ */
private Integer placeId;
/**
* 盘点库位
*/
private Integer depositoryId; private Integer depositoryId;
/** /**

33
src/main/java/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml

@ -9,10 +9,9 @@
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="VARCHAR" /> <result column="code" property="code" jdbcType="VARCHAR" />
<result column="depositoryId" property="depositoryId" jdbcType="INTEGER" /> <result column="depositoryId" property="depositoryId" jdbcType="INTEGER" />
<result column="placeId" property="placeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" /> <result column="state" property="state" jdbcType="INTEGER" />
<result column="departmentManagerState" property="departmentManagerState" jdbcType="INTEGER" /> <result column="departmentManagerState" property="departmentManagerState" jdbcType="INTEGER" />
<result column="crateTime" property="crateTime" jdbcType="INTEGER" /> <result column="createTime" property="createTime" jdbcType="INTEGER" />
<result column="completeTime" property="completeTime" jdbcType="INTEGER" /> <result column="completeTime" property="completeTime" jdbcType="INTEGER" />
<result column="reviewTime" property="reviewTime" jdbcType="INTEGER" /> <result column="reviewTime" property="reviewTime" jdbcType="INTEGER" />
<result column="originator" property="originator" jdbcType="INTEGER" /> <result column="originator" property="originator" jdbcType="INTEGER" />
@ -36,6 +35,7 @@
<result column="mcode" property="mcode" jdbcType="VARCHAR" /> <result column="mcode" property="mcode" jdbcType="VARCHAR" />
<result column="mname" property="mname" jdbcType="VARCHAR" /> <result column="mname" property="mname" jdbcType="VARCHAR" />
<result column="mtId" property="mtId" jdbcType="INTEGER" /> <result column="mtId" property="mtId" jdbcType="INTEGER" />
<result column="pid" property="pid" jdbcType="INTEGER" />
<result column="producedDate" property="producedDate" jdbcType="INTEGER" /> <result column="producedDate" property="producedDate" jdbcType="INTEGER" />
</resultMap> </resultMap>
@ -44,21 +44,20 @@
<!-- 表查询字段 --> <!-- 表查询字段 -->
<sql id="StockTakingAllColumns"> <sql id="StockTakingAllColumns">
st.id,st.code,st.depositoryId,st.placeId,st.departmentManager,st.state,st.createTime,st.originator,st.completeTime,st.reviewTime,st.auditOpinion,st.departmentManagerState st.id,st.code,st.depositoryId,st.departmentManager,st.state,st.createTime,st.originator,st.completeTime,st.reviewTime,st.auditOpinion,st.departmentManagerState
</sql> </sql>
<sql id="StockTakingChildPAllColumns"> <sql id="StockTakingChildPAllColumns">
id,mid,oldInventory,newInventory,inventory,mainId,takingResult,mname,mtId,tname,mcode,mversion,munit,mtexture,producedDate,stcUnit id,mid,oldInventory,newInventory,inventory,mainId,takingResult,mname,mtId,tname,mcode,mversion,munit,mtexture,producedDate,stcUnit,pid
</sql> </sql>
<!-- 插入主表--> <!-- 插入主表-->
<insert id="insertStockTaking" useGeneratedKeys="true" keyProperty="id"> <insert id="insertStockTaking" useGeneratedKeys="true" keyProperty="id">
INSERT INTO stocktaking (id,code,depositoryId,placeId,departmentManager,state,createTime,originator,departmentManagerState) INSERT INTO stocktaking (id,code,depositoryId,departmentManager,state,createTime,originator,departmentManagerState)
values ( values (
#{id}, #{id},
#{code}, #{code},
#{depositoryId}, #{depositoryId},
#{placeId},
#{departmentManager}, #{departmentManager},
#{state}, #{state},
#{createTime}, #{createTime},
@ -69,9 +68,9 @@
<!-- 插入子表--> <!-- 插入子表-->
<insert id="insertStockTakingChild" useGeneratedKeys="true" keyProperty="id"> <insert id="insertStockTakingChild" useGeneratedKeys="true" keyProperty="id">
INSERT INTO stocktakingchild (id,mid,oldInventory,newInventory,takingResult,inventory,mainId,producedDate,unit) INSERT INTO stocktakingchild (id,mid,oldInventory,newInventory,takingResult,inventory,mainId,producedDate,unit,pid)
values ( values (
#{id},#{mid},#{oldInventory},#{newInventory},#{takingResult},#{inventory},#{mainId},#{producedDate},#{unit} #{id},#{mid},#{oldInventory},#{newInventory},#{takingResult},#{inventory},#{mainId},#{producedDate},#{unit},#{placeId}
) )
</insert> </insert>
@ -109,9 +108,6 @@
<if test="depositoryId != null"> <if test="depositoryId != null">
depositoryId = #{depositoryId}, depositoryId = #{depositoryId},
</if> </if>
<if test="placeId != null">
placeId = #{placeId},
</if>
<if test="departmentManager != null and departmentManager != ''"> <if test="departmentManager != null and departmentManager != ''">
departmentManager = #{departmentManager}, departmentManager = #{departmentManager},
</if> </if>
@ -166,9 +162,13 @@
<if test="producedDate != null and producedDate != ''"> <if test="producedDate != null and producedDate != ''">
producedDate = #{producedDate}, producedDate = #{producedDate},
</if> </if>
<if test="placeId != null">
pid = #{placeId},
</if>
<if test="unit != null and unit != ''"> <if test="unit != null and unit != ''">
unit = #{unit} unit = #{unit}
</if> </if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
@ -202,9 +202,7 @@
<if test="depositoryId != null and depositoryId != ''"> <if test="depositoryId != null and depositoryId != ''">
and st.depositoryId = #{depositoryId} and st.depositoryId = #{depositoryId}
</if> </if>
<if test="placeId != null">
and st.placeId = #{placeId}
</if>
<if test="departmentManagerState != null and departmentManagerState != ''"> <if test="departmentManagerState != null and departmentManagerState != ''">
and st.departmentManagerState = #{departmentManagerState} and st.departmentManagerState = #{departmentManagerState}
</if> </if>
@ -232,6 +230,9 @@
<if test="newInventory != null"> <if test="newInventory != null">
and newInventory = #{newInventory} and newInventory = #{newInventory}
</if> </if>
<if test="placeId != null">
and pid = #{placeId}
</if>
<if test="takingResult != null and takingResult != ''"> <if test="takingResult != null and takingResult != ''">
and takingResult = #{takingResult} and takingResult = #{takingResult}
</if> </if>
@ -287,10 +288,10 @@
from stocktaking st from stocktaking st
where 1 = 1 where 1 = 1
<if test='isDone == 0'> <if test='isDone == 0'>
and (state = 3 and departmentManagerState = 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 ) and (state = 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 )
</if> </if>
<if test='isDone == 1'> <if test='isDone == 1'>
and (state != 3 and departmentManagerState != 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 ) and (state != 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 )
</if> </if>
ORDER BY st.createTime desc ORDER BY st.createTime desc
<if test="begin != null and size != null"> <if test="begin != null and size != null">

6
src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingChildP.java

@ -19,6 +19,12 @@ public class StockTakingChildP {
* 物料id * 物料id
*/ */
private Integer mid; private Integer mid;
/**
* 盘点库位id
*/
private Integer pid;
/** /**
* 库存容量 * 库存容量
*/ */

1
src/main/java/com/dreamchaser/depository_manage/pojo/StockTakingP.java

@ -95,7 +95,6 @@ public class StockTakingP {
this.code = st.getCode(); this.code = st.getCode();
this.departmentManager = st.getDepartmentManager(); this.departmentManager = st.getDepartmentManager();
this.depositoryId = st.getDepositoryId(); this.depositoryId = st.getDepositoryId();
this.placeId = st.getPlaceId();
this.state = st.getState(); this.state = st.getState();
this.departmentManagerState = st.getDepartmentManagerState(); this.departmentManagerState = st.getDepartmentManagerState();
this.createTime = DateUtil.TimeStampToDateTime(st.getCreateTime()); this.createTime = DateUtil.TimeStampToDateTime(st.getCreateTime());

57
src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java

@ -280,23 +280,12 @@ public class QyWxOperationService {
StringBuilder stockTakingResult = new StringBuilder(); StringBuilder stockTakingResult = new StringBuilder();
// 物料盘盈数量 // 物料盘盈数量
StringBuilder stockTakingInventory = new StringBuilder(); StringBuilder stockTakingInventory = new StringBuilder();
// 获取盘点的库位
Integer placeId = mainRecord.getPlaceId();
Place place = placeMapper.findPlaceById(placeId);
// 获取盘点的仓库 // 获取盘点的仓库
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
Depository depository = depositoryMapper.findDepositoryById(depositoryId); Depository depository = depositoryMapper.findDepositoryById(depositoryId);
Location.append(depository.getDname()); Location.append(depository.getDname());
if (Integer.compare(0, placeId) == 0) {
// 如果盘点库位为默认库位
Location.append(" - 默认库位");
} else {
Location.append(" - ").append(place.getCode());
}
for (StockTakingChildP childP : minRecordList) { for (StockTakingChildP childP : minRecordList) {
// 获取子订单信息 // 获取子订单信息
@ -528,23 +517,12 @@ public class QyWxOperationService {
StringBuilder stockTakingResult = new StringBuilder(); StringBuilder stockTakingResult = new StringBuilder();
// 物料盘盈数量 // 物料盘盈数量
StringBuilder stockTakingInventory = new StringBuilder(); StringBuilder stockTakingInventory = new StringBuilder();
// 获取盘点的库位
Integer placeId = mainRecord.getPlaceId();
Place place = placeMapper.findPlaceById(placeId);
// 获取盘点的仓库 // 获取盘点的仓库
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
Depository depository = depositoryMapper.findDepositoryById(depositoryId); Depository depository = depositoryMapper.findDepositoryById(depositoryId);
Location.append(depository.getDname()); Location.append(depository.getDname());
if (Integer.compare(0, placeId) == 0) {
// 如果盘点库位为默认库位
Location.append(" - 默认库位");
} else {
Location.append(" - ").append(place.getCode());
}
for (StockTakingChildP childP : minRecordList) { for (StockTakingChildP childP : minRecordList) {
// 获取子订单信息 // 获取子订单信息
@ -866,9 +844,8 @@ public class QyWxOperationService {
content.append("%n---%n"); content.append("%n---%n");
for (int i = 0; i < minIds.size(); i++) { for (Long minId : minIds) {
Long minId = minIds.get(i);
// 获取对应子订单 // 获取对应子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
@ -886,7 +863,7 @@ public class QyWxOperationService {
} }
// 获取转移前的库位 // 获取转移前的库位
Integer oldPlaceId = ObjectFormatUtil.toInteger(mainRecord.getPlaceId()); Integer oldPlaceId = ObjectFormatUtil.toInteger(minRecord.getPid());
Place oldPlace = placeMapper.findPlaceById(oldPlaceId); Place oldPlace = placeMapper.findPlaceById(oldPlaceId);
@ -976,9 +953,8 @@ public class QyWxOperationService {
content.append("%n---%n"); content.append("%n---%n");
for (int i = 0; i < errIds.size(); i++) { for (Long minId : errIds) {
Long minId = errIds.get(i);
// 获取错误的子订单 // 获取错误的子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
@ -987,7 +963,7 @@ public class QyWxOperationService {
// 获取转移前的库位 // 获取转移前的库位
Integer oldPlaceId = ObjectFormatUtil.toInteger(mainRecord.getPlaceId()); Integer oldPlaceId = ObjectFormatUtil.toInteger(minRecord.getPid());
Place oldPlace = placeMapper.findPlaceById(oldPlaceId); Place oldPlace = placeMapper.findPlaceById(oldPlaceId);
@ -1075,8 +1051,7 @@ public class QyWxOperationService {
content.append("%n---%n"); content.append("%n---%n");
for (int i = 0; i < minIds.size(); i++) { for (Long minId : minIds) {
Long minId = minIds.get(i);
// 获取对应子订单 // 获取对应子订单
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId);
@ -1087,7 +1062,7 @@ public class QyWxOperationService {
// 获取转移数量 // 获取转移数量
Integer inventory = ObjectFormatUtil.toInteger(map.get("invnetory" + minId)); Integer inventory = ObjectFormatUtil.toInteger(map.get("invnetory" + minId));
// 获取转移前的库位 // 获取转移前的库位
Integer oldPlaceId = ObjectFormatUtil.toInteger(mainRecord.getPlaceId()); Integer oldPlaceId = ObjectFormatUtil.toInteger(minRecord.getPid());
Place oldPlace = placeMapper.findPlaceById(oldPlaceId); Place oldPlace = placeMapper.findPlaceById(oldPlaceId);
@ -1796,10 +1771,10 @@ public class QyWxOperationService {
/** /**
* 用于发送入库审批 * 用于发送入库审批
* *
* @param userAgent 加密后的userAgent * @param userAgent 加密后的userAgent
* @param userToken 审批人 * @param userToken 审批人
* @param recordIdList 入库id列表 * @param recordIdList 入库id列表
* @param QyWxUid 接收人 * @param QyWxUid 接收人
* @return * @return
*/ */
public JSONObject sendApprovalTemplateIn(String userAgent, UserByPort userToken, List<Integer> recordIdList, String QyWxUid) { public JSONObject sendApprovalTemplateIn(String userAgent, UserByPort userToken, List<Integer> recordIdList, String QyWxUid) {
@ -1807,7 +1782,7 @@ public class QyWxOperationService {
// 获取当前出库明细 // 获取当前出库明细
List<ApplicationInRecordP> minRecordList = depositoryRecordMapper.findApplicationInRecordsByIds(recordIdList); List<ApplicationInRecordP> minRecordList = depositoryRecordMapper.findApplicationInRecordsByIds(recordIdList);
if(minRecordList.size() <= 0){ if (minRecordList.size() <= 0) {
throw new MyException("参数错误"); throw new MyException("参数错误");
} }
// 定义审批模板 // 定义审批模板
@ -1838,7 +1813,7 @@ public class QyWxOperationService {
List<String> userIdList = new ArrayList<>(); List<String> userIdList = new ArrayList<>();
String[] split = QyWxUid.split(","); String[] split = QyWxUid.split(",");
for (String value : split) { for (String value : split) {
if("".equals(value)){ if ("".equals(value)) {
continue; continue;
} }
userIdList.add(value); userIdList.add(value);
@ -2140,14 +2115,10 @@ public class QyWxOperationService {
// 获取当前盘点位置 // 获取当前盘点位置
Depository depository = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId()); Depository depository = depositoryMapper.findDepositoryById(mainRecord.getDepositoryId());
Place place = placeMapper.findPlaceById(mainRecord.getPlaceId());
// 声明盘点位置 // 声明盘点位置
String location = "";
if (Integer.compare(place.getId(), 0) == 0) { String location = depository.getDname();
location = depository.getDname();
} else {
location = depository.getDname() + "-" + place.getCode();
}
// 声明盘点审批模板 // 声明盘点审批模板
ApprovalTemplate approvalTemplate = new ApprovalTemplate(); ApprovalTemplate approvalTemplate = new ApprovalTemplate();

126
src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java

@ -162,10 +162,10 @@ public class StockTakingServiceImpl implements StockTakingService {
page = ObjectFormatUtil.toInteger(map.get("page")); page = ObjectFormatUtil.toInteger(map.get("page"));
map.put("begin", (page - 1) * size); map.put("begin", (page - 1) * size);
} }
List<StockTaking> myTask = stockTakingMapper.findMyTask(map); List<StockTaking> myTask = stockTakingMapper.findMyTask(map);
List<SimpleStockTakingP> stockTakingPS = new ArrayList<>(); List<SimpleStockTakingP> stockTakingPS = new ArrayList<>();
for (int i = 0; i < myTask.size(); i++) { for (StockTaking stockTaking : myTask) {
StockTaking stockTaking = myTask.get(i);
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking); SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking);
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId());
ssp.setDepositoryName(depositoryRecordById.getDname()); ssp.setDepositoryName(depositoryRecordById.getDname());
@ -358,9 +358,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 定义出错信息 // 定义出错信息
List<String> err = new ArrayList<>(); List<String> err = new ArrayList<>();
Integer placeId = mainRecord.getPlaceId();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
// 获取所有子单 // 获取所有子单
@ -369,6 +367,10 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取子单详情 // 获取子单详情
// 获取盘点的物料详情 // 获取盘点的物料详情
Integer placeId = minRecord.getPid();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
// 获取当前盘点结果 // 获取当前盘点结果
String takingResult = minRecord.getTakingResult(); String takingResult = minRecord.getTakingResult();
if ("Inventory_normal".equals(takingResult)) { if ("Inventory_normal".equals(takingResult)) {
@ -388,6 +390,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取物料与库位的对应关系 // 获取物料与库位的对应关系
MaterialAndPlace placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(paramForMaterialAndPlace); MaterialAndPlace placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(paramForMaterialAndPlace);
// 根据盘点结果重新计算物料的单价 // 根据盘点结果重新计算物料的单价
@ -403,7 +407,8 @@ public class StockTakingServiceImpl implements StockTakingService {
int newNumberForPlace = 0; int newNumberForPlace = 0;
// 用于计算新的库位与物料对应关系的数量 // 用于计算新的库位与物料对应关系的数量
int newNumberForMatrialAndPlace = 0; int newNumberForMatrialAndPlace = 0;
if ("Inventory_up".equals(takingResult)) { if ("Inventory_up".equals(takingResult))
{
// 如果盘盈 // 如果盘盈
// 更新当前库位数量 // 更新当前库位数量
@ -427,7 +432,8 @@ public class StockTakingServiceImpl implements StockTakingService {
// 更新物料与库位对应关系的数量 // 更新物料与库位对应关系的数量
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} else { }
else {
// 如果盘亏 // 如果盘亏
newNumberForPlace = placeById.getQuantity() - inventory; newNumberForPlace = placeById.getQuantity() - inventory;
@ -450,7 +456,6 @@ public class StockTakingServiceImpl implements StockTakingService {
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace);
} }
normalMinId.add(minRecord.getId()); normalMinId.add(minRecord.getId());
} }
@ -500,7 +505,7 @@ public class StockTakingServiceImpl implements StockTakingService {
map.put("departmentManager", userToken.getNumber()); map.put("departmentManager", userToken.getNumber());
stockTakingMapper.updateStockTaking(map); stockTakingMapper.updateStockTaking(map);
// 更新其他卡片 /*// 更新其他卡片
String finalStockTakingResult = stockTakingResult; String finalStockTakingResult = stockTakingResult;
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
@ -513,7 +518,7 @@ public class StockTakingServiceImpl implements StockTakingService {
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode"); String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode");
qyWxOperationService.updateTemplateCard(responseCode, userToken.getName(), finalStockTakingResult, userAgent); qyWxOperationService.updateTemplateCard(responseCode, userToken.getName(), finalStockTakingResult, userAgent);
} }
}).start(); }).start();*/
// 开启流程通知其他人忽略审批流程 // 开启流程通知其他人忽略审批流程
new Thread(new Runnable() { new Thread(new Runnable() {
@ -522,9 +527,8 @@ public class StockTakingServiceImpl implements StockTakingService {
String departmentManager1 = mainRecord.getDepartmentManager(); String departmentManager1 = mainRecord.getDepartmentManager();
String[] split = departmentManager1.split(","); String[] split = departmentManager1.split(",");
StringBuilder QyWxUid = new StringBuilder(); StringBuilder QyWxUid = new StringBuilder();
for (int i = 0; i < split.length; i++) { for (String s : split) {
String s = split[i]; if ("".equals(s.trim())) {
if("".equals(s.trim())){
continue; continue;
} }
UserByPort userByPort = PortConfig.findUserByPortByNumber(s); UserByPort userByPort = PortConfig.findUserByPortByNumber(s);
@ -586,16 +590,15 @@ public class StockTakingServiceImpl implements StockTakingService {
// 定义出错信息 // 定义出错信息
List<String> err = new ArrayList<>(); List<String> err = new ArrayList<>();
Integer placeId = mainRecord.getPlaceId();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
Integer depositoryId = mainRecord.getDepositoryId();
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId);
// 遍历当前拆单的子单详情
for (StockTakingChildP minRecord : minRecordList) { for (StockTakingChildP minRecord : minRecordList) {
// 获取子单详情 // 获取子单详情
Integer placeId = minRecord.getPid();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
// 获取当前盘点结果 // 获取当前盘点结果
String takingResult = minRecord.getTakingResult(); String takingResult = minRecord.getTakingResult();
@ -613,7 +616,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取盘点物料信息 // 获取盘点物料信息
Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid()); Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid());
// 定义用于获取物料与库位的对应关系的参数
Map<String, Object> paramForMaterialAndPlace = new HashMap<>(); Map<String, Object> paramForMaterialAndPlace = new HashMap<>();
paramForMaterialAndPlace.put("mid", inventoryById.getId()); paramForMaterialAndPlace.put("mid", inventoryById.getId());
paramForMaterialAndPlace.put("pid", placeById.getId()); paramForMaterialAndPlace.put("pid", placeById.getId());
@ -637,8 +640,8 @@ public class StockTakingServiceImpl implements StockTakingService {
mapForProducedDate.put("producedDate", producedDate); mapForProducedDate.put("producedDate", producedDate);
// 获取当前生产日期下的物料与生产日期的对应关系 // 获取当前生产日期下的物料与生产日期的对应关系
MaterialAndProducedDate materialAndProducedDate = materialMapper.findMaterialAndProducedDateByMidAndProducedDate(mapForProducedDate); MaterialAndProducedDate materialAndProducedDate = materialMapper.findMaterialAndProducedDateByMidAndProducedDate(mapForProducedDate);
Integer oldInventroy = materialAndProducedDate.getInventory(); Integer oldInventory = materialAndProducedDate.getInventory();
if (newInventory > oldInventroy) { if (newInventory > oldInventory) {
// 如果当前盘点数量大于库存数量 // 如果当前盘点数量大于库存数量
// 修改当前库存 // 修改当前库存
@ -647,7 +650,7 @@ public class StockTakingServiceImpl implements StockTakingService {
materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory);
// 修改物料对应数量 // 修改物料对应数量
inventoryById.setQuantity(inventoryById.getQuantity() + newInventory - oldInventroy); inventoryById.setQuantity(inventoryById.getQuantity() + newInventory - oldInventory);
} else { } else {
@ -659,14 +662,12 @@ public class StockTakingServiceImpl implements StockTakingService {
materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory); materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory);
// 修改物料对应数量 // 修改物料对应数量
inventoryById.setQuantity(inventoryById.getQuantity() - oldInventroy + newInventory); inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory + newInventory);
} }
// 获取当前物料数目
Integer quantity = inventoryById.getQuantity();
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); materialMapper.updateMaterialAndProducedDate(materialAndProducedDate);
} else { }
else {
// 如果没有生产日期 // 如果没有生产日期
// 获取当前库位以外的物料数量 // 获取当前库位以外的物料数量
@ -680,21 +681,20 @@ public class StockTakingServiceImpl implements StockTakingService {
} }
// 用于计算新的库位数量 // 用于计算新的库位数量
Integer newNumberForPlace = 0; int newNumberForPlace = 0;
// 用于计算新的库位与物料对应关系的数量 // 用于计算新的库位与物料对应关系的数量
Integer newNumberForMatrialAndPlace = 0; int newNumberForMatrialAndPlace = 0;
if ("Inventory_up".equals(takingResult)) { if ("Inventory_up".equals(takingResult)) {
// 如果盘盈 // 如果盘盈
// 如果是基础单位 // 如果是基础单位
if ("-1".equals(unit)) { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) {
// 更新当前库位数量 // 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory; newNumberForPlace = placeById.getQuantity() + inventory;
if (newNumberForPlace <= placeById.getMax()) { if (newNumberForPlace <= placeById.getMax()) {
// 如果更新后的库位数量没有上溢 // 如果更新后的库位数量没有上溢
// 更新当前库位的数量 // 更新当前库位的数量
@ -714,16 +714,8 @@ public class StockTakingServiceImpl implements StockTakingService {
} }
else { else {
// 如果是拆单单位 // 如果是拆单单位
// 更新当前库位数量
newNumberForPlace = placeById.getQuantity() + inventory;
if (newNumberForPlace > placeById.getMax()) {
// 添加错误信息
errIds.add(minRecord.getId());
err.add("当前库位数量溢出,需要转移");
continue;
}
// 用于查找对应的拆单记录 // 用于查找对应的拆单记录
Map<String, Object> paramForSplitInfo = new HashMap<>(); Map<String, Object> paramForSplitInfo = new HashMap<>();
paramForSplitInfo.put("newUnit", unit); paramForSplitInfo.put("newUnit", unit);
@ -733,8 +725,9 @@ public class StockTakingServiceImpl implements StockTakingService {
// 查找当前拆单记录对应的库存记录 // 查找当前拆单记录对应的库存记录
SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId()); SplitInventory splitInventory = splitUnitService.findSplitInventoryByIidAndSid(placeAndMaterialByMidAndPid.getId(), splitInfo.getId());
// 如果存在拆单库存记录
if(splitInventory != null){ if(splitInventory != null){
// 获取当前盘点后的库存数
int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity(); int realQuantity = Math.round(inventory) + splitInventory.getSaveQuantity();
// 定义当前进制 // 定义当前进制
int scale = splitInfo.getQuantity(); int scale = splitInfo.getQuantity();
@ -775,8 +768,21 @@ public class StockTakingServiceImpl implements StockTakingService {
// 修改拆单库存 // 修改拆单库存
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
} }
}else{ }
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); else{
// 如果不存在拆单库存记录
Map<String, Object> paramForUpdateSplitInventory = new HashMap<>();
paramForUpdateSplitInventory.put("placeId",minRecord.getPid());
paramForUpdateSplitInventory.put("depositoryId",mainRecord.getDepositoryId());
paramForUpdateSplitInventory.put("quantity",inventory);
paramForUpdateSplitInventory.put("mid",inventoryById.getMid());
paramForUpdateSplitInventory.put("unit",minRecord.getUnit());
splitUnitService.realInInventoryToDepository(Double.valueOf(inventory), null,paramForUpdateSplitInventory,splitInfo,placeAndMaterialByMidAndPid,false);
if (paramForUpdateSplitInventory.containsKey("applicationInId")) {
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForUpdateSplitInventory.get("applicationInId")));
}
} }
@ -785,7 +791,7 @@ public class StockTakingServiceImpl implements StockTakingService {
else { else {
// 如果盘亏 // 如果盘亏
if ("-1".equals(unit)) { if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) {
// 如果盘点的是基础单位 // 如果盘点的是基础单位
newNumberForPlace = placeById.getQuantity() - inventory; newNumberForPlace = placeById.getQuantity() - inventory;
@ -875,13 +881,12 @@ public class StockTakingServiceImpl implements StockTakingService {
map.put("minIds", minIds); map.put("minIds", minIds);
// 开启一个线程用于发送抄送信息给负责人 // 开启一个线程用于发送抄送信息给负责人
StockTaking finalMainRecord = mainRecord;
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
String s = QyWxUid.toString(); String s = QyWxUid.toString();
s = "PangFuZhen,"; s = "PangFuZhen,";
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingMessageToHead(s, map, userToken, finalMainRecord, userAgent); JSONObject jsonObject = qyWxOperationService.sendCcStockTakingMessageToHead(s, map, userToken, mainRecord, userAgent);
} }
}).start(); }).start();
@ -945,10 +950,7 @@ public class StockTakingServiceImpl implements StockTakingService {
List<Long> errIds = new ArrayList<>(); List<Long> errIds = new ArrayList<>();
// 定义出错信息 // 定义出错信息
List<String> err = new ArrayList<>(); List<String> err = new ArrayList<>();
// 获取盘点的库位id
Integer placeId = mainRecord.getPlaceId();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
// 获取盘点的仓库id // 获取盘点的仓库id
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
// 获取仓库详情 // 获取仓库详情
@ -961,6 +963,10 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取当前盘点的计量单位 // 获取当前盘点的计量单位
String unit = minRecord.getUnit(); String unit = minRecord.getUnit();
// 获取盘点的库位id
Integer placeId = minRecord.getPid();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
// 获取当前盘点结果 // 获取当前盘点结果
String takingResult = minRecord.getTakingResult(); String takingResult = minRecord.getTakingResult();
@ -1444,15 +1450,17 @@ public class StockTakingServiceImpl implements StockTakingService {
// 定义出错信息 // 定义出错信息
List<String> err = new ArrayList<>(); List<String> err = new ArrayList<>();
Integer placeId = mainRecord.getPlaceId();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
Integer depositoryId = mainRecord.getDepositoryId(); Integer depositoryId = mainRecord.getDepositoryId();
// 获取所有子单 // 获取所有子单
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId));
for (StockTakingChildP minRecord : minRecordList) { for (StockTakingChildP minRecord : minRecordList) {
// 获取子单详情 // 获取子单详情
Integer placeId = minRecord.getPid();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
// 获取盘点的物料详情 // 获取盘点的物料详情
@ -1646,7 +1654,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 如果转移前的库位为空 // 如果转移前的库位为空
if (oldPlace == null) { if (oldPlace == null) {
// 查询当前主订单对应的盘点库位 // 查询当前主订单对应的盘点库位
oldPlace = placeMapper.findPlaceById(mainRecord.getPlaceId()); oldPlace = placeMapper.findPlaceById(minRecord.getPid());
// 设置当前转移前库位的总数 // 设置当前转移前库位的总数
sumTransferAfter = oldPlace.getQuantity(); sumTransferAfter = oldPlace.getQuantity();
} }
@ -2519,12 +2527,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 定义出错信息 // 定义出错信息
List<String> err = new ArrayList<>(); List<String> err = new ArrayList<>();
Integer placeId = mainRecord.getPlaceId();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
Integer depositoryId = mainRecord.getDepositoryId();
// 获取仓库详情
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId);
// 获取所有子单 // 获取所有子单
@ -2532,7 +2535,10 @@ public class StockTakingServiceImpl implements StockTakingService {
for (int i = 0; i < minRecordList.size(); i++) { for (int i = 0; i < minRecordList.size(); i++) {
// 获取子单详情 // 获取子单详情
StockTakingChildP minRecord = minRecordList.get(i); StockTakingChildP minRecord = minRecordList.get(i);
// 获取盘点的物料详情
Integer placeId = minRecord.getPid();
// 获取库位详情
Place placeById = placeMapper.findPlaceById(placeId);
// 获取当前盘点结果 // 获取当前盘点结果
String takingResult = minRecord.getTakingResult(); String takingResult = minRecord.getTakingResult();

51
src/main/resources/templates/pages/stockTaking/stockTaking.html

@ -317,6 +317,7 @@
{field: 'mname', width: 150, title: '物料名称'}, {field: 'mname', width: 150, title: '物料名称'},
{field: 'typeName', width: 100, title: '物料种类'}, {field: 'typeName', width: 100, title: '物料种类'},
{field: 'version', width: 150, title: '规格型号',}, {field: 'version', width: 150, title: '规格型号',},
{field: 'pcode', width: 150, title: '所处库位',},
{title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'inventory', width: 100, title: '库存数'}, {field: 'inventory', width: 100, title: '库存数'},
{field: 'stockTakingQuantity', width: 100, title: '盘点数', edit: 'quantity'}, {field: 'stockTakingQuantity', width: 100, title: '盘点数', edit: 'quantity'},
@ -333,8 +334,8 @@
let takingUnit = j["takingUnit"]; let takingUnit = j["takingUnit"];
if (takingUnit !== null) { if (takingUnit !== null) {
let parentItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")"); let parentItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")");
let unitHandleItem = parentItem.children()[4]; let unitHandleItem = parentItem.children()[5];
let quantityHandleItem = parentItem.children()[5]; let quantityHandleItem = parentItem.children()[6];
unitHandleItem.childNodes[0].childNodes[1].childNodes[0].data = takingUnit; unitHandleItem.childNodes[0].childNodes[1].childNodes[0].data = takingUnit;
quantityHandleItem.childNodes[0].innerText = j["splitInventory"][takingUnit]; quantityHandleItem.childNodes[0].innerText = j["splitInventory"][takingUnit];
} }
@ -499,7 +500,7 @@
, data: dropDownDataList , data: dropDownDataList
, click: function (unit) { , click: function (unit) {
this.elem[0].childNodes[0].data = unit.title; this.elem[0].childNodes[0].data = unit.title;
obj.tr[0].childNodes[5].childNodes[0].innerText = obj.data.splitInventory[unit.title]; obj.tr[0].childNodes[6].childNodes[0].innerText = obj.data.splitInventory[unit.title];
} }
, align: 'right' //右对齐弹出(v2.6.8 新增) , align: 'right' //右对齐弹出(v2.6.8 新增)
, style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式 , style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
@ -512,7 +513,7 @@
// 用于计算盘点结果 // 用于计算盘点结果
calculate = function (obj) { calculate = function (obj) {
let oldInventory = Number(obj.tr[0].childNodes[5].childNodes[0].innerText); let oldInventory = Number(obj.tr[0].childNodes[6].childNodes[0].innerText);
let nowInventory = Number(obj.value); let nowInventory = Number(obj.value);
let number = 0; let number = 0;
let takingResult = ''; let takingResult = '';
@ -530,15 +531,15 @@
takingResult = "Inventory_normal"; takingResult = "Inventory_normal";
takingResultString = "正常"; takingResultString = "正常";
} }
obj.tr[0].childNodes[7].childNodes[0].innerText = takingResultString; obj.tr[0].childNodes[8].childNodes[0].innerText = takingResultString;
obj.tr[0].childNodes[8].childNodes[0].innerText = number; obj.tr[0].childNodes[9].childNodes[0].innerText = number;
obj.update({takingResult: takingResult}); obj.update({takingResult: takingResult});
obj.update({takingInventory: number}); obj.update({takingInventory: number});
req.number = number + ""; req.number = number + "";
req.takingResult = takingResult; req.takingResult = takingResult;
req.takingResultString = takingResultString; req.takingResultString = takingResultString;
req.id = obj.data.id + ""; req.id = obj.data.id + "";
req.unit = obj.tr[0].childNodes[4].childNodes[0].innerText; req.unit = obj.tr[0].childNodes[5].childNodes[0].innerText;
req.oldInventory = oldInventory+""; req.oldInventory = oldInventory+"";
$.ajax({ $.ajax({
url: "/stockTaking/temporaryStorageForTakingResult", url: "/stockTaking/temporaryStorageForTakingResult",
@ -548,42 +549,6 @@
contentType: "application/json;charset=utf-8" contentType: "application/json;charset=utf-8"
}); });
}; };
form.on('select()', function (data) {
var id = data.elem.id; //得到select原始DOM对象id
var req = {};
if (id.includes("producedDate")) {
var idNumber = id.split('producedDate')[1]; // 得到当前id对应数字
req.mid = $("#" + "mid" + idNumber).val();
req.producedDate = data.value;
$.ajax({
url: "/material/findQuantityByProducedDate",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (d) {
$("#" + "oldInventory" + idNumber).val(d.data)
}
});
} else if (id.includes("unit")) {
let idNumber = id.split("unit")[1]; // 得到当前id对应数字
req.mid = $("#" + "mid" + idNumber).val();
req.unit = data.value;
req.placeId = $("#placeId").val();
$.ajax({
url: "/material/findQuantityByUnit",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (d) {
$("#" + "oldInventory" + idNumber).val(d.data)
}
});
}
});
}); });
</script> </script>

27
src/main/resources/templates/pages/stockTaking/stockTakingComplete.html

@ -45,7 +45,7 @@
<div class="layui-fluid"> <div class="layui-fluid">
<div class="layui-card"> <div class="layui-card">
<form class="layui-form" <form class="layui-form"
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" style="margin: 0 auto;max-width: 700px;"
lay-filter="form1" id="form1"> lay-filter="form1" id="form1">
<div class="layui-card-body" id="takingHeader" style="padding-right: 0px"> <div class="layui-card-body" id="takingHeader" style="padding-right: 0px">
<div class="layui-form-item"> <div class="layui-form-item">
@ -219,21 +219,22 @@
</div> </div>
</fieldset> </fieldset>
<div id="review">
<div class="layui-form"
style="margin: 0 auto;max-width: 900px;padding-top: 40px;">
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" onclick="complete(1)">
&emsp;处理&emsp;
</button>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
</div> </div>
<div id="review">
<div class="layui-form"
style="margin: 0 auto;max-width: 900px;padding-top: 40px;">
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" onclick="complete(1)">
&emsp;处理&emsp;
</button>
</div>
</div>
</div>
</div>
</fieldset> </fieldset>
</div> </div>
</div> </div>

33
target/classes/com/dreamchaser/depository_manage/mapper/StockTakingMapper.xml

@ -9,10 +9,9 @@
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="VARCHAR" /> <result column="code" property="code" jdbcType="VARCHAR" />
<result column="depositoryId" property="depositoryId" jdbcType="INTEGER" /> <result column="depositoryId" property="depositoryId" jdbcType="INTEGER" />
<result column="placeId" property="placeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" /> <result column="state" property="state" jdbcType="INTEGER" />
<result column="departmentManagerState" property="departmentManagerState" jdbcType="INTEGER" /> <result column="departmentManagerState" property="departmentManagerState" jdbcType="INTEGER" />
<result column="crateTime" property="crateTime" jdbcType="INTEGER" /> <result column="createTime" property="createTime" jdbcType="INTEGER" />
<result column="completeTime" property="completeTime" jdbcType="INTEGER" /> <result column="completeTime" property="completeTime" jdbcType="INTEGER" />
<result column="reviewTime" property="reviewTime" jdbcType="INTEGER" /> <result column="reviewTime" property="reviewTime" jdbcType="INTEGER" />
<result column="originator" property="originator" jdbcType="INTEGER" /> <result column="originator" property="originator" jdbcType="INTEGER" />
@ -36,6 +35,7 @@
<result column="mcode" property="mcode" jdbcType="VARCHAR" /> <result column="mcode" property="mcode" jdbcType="VARCHAR" />
<result column="mname" property="mname" jdbcType="VARCHAR" /> <result column="mname" property="mname" jdbcType="VARCHAR" />
<result column="mtId" property="mtId" jdbcType="INTEGER" /> <result column="mtId" property="mtId" jdbcType="INTEGER" />
<result column="pid" property="pid" jdbcType="INTEGER" />
<result column="producedDate" property="producedDate" jdbcType="INTEGER" /> <result column="producedDate" property="producedDate" jdbcType="INTEGER" />
</resultMap> </resultMap>
@ -44,21 +44,20 @@
<!-- 表查询字段 --> <!-- 表查询字段 -->
<sql id="StockTakingAllColumns"> <sql id="StockTakingAllColumns">
st.id,st.code,st.depositoryId,st.placeId,st.departmentManager,st.state,st.createTime,st.originator,st.completeTime,st.reviewTime,st.auditOpinion,st.departmentManagerState st.id,st.code,st.depositoryId,st.departmentManager,st.state,st.createTime,st.originator,st.completeTime,st.reviewTime,st.auditOpinion,st.departmentManagerState
</sql> </sql>
<sql id="StockTakingChildPAllColumns"> <sql id="StockTakingChildPAllColumns">
id,mid,oldInventory,newInventory,inventory,mainId,takingResult,mname,mtId,tname,mcode,mversion,munit,mtexture,producedDate,stcUnit id,mid,oldInventory,newInventory,inventory,mainId,takingResult,mname,mtId,tname,mcode,mversion,munit,mtexture,producedDate,stcUnit,pid
</sql> </sql>
<!-- 插入主表--> <!-- 插入主表-->
<insert id="insertStockTaking" useGeneratedKeys="true" keyProperty="id"> <insert id="insertStockTaking" useGeneratedKeys="true" keyProperty="id">
INSERT INTO stocktaking (id,code,depositoryId,placeId,departmentManager,state,createTime,originator,departmentManagerState) INSERT INTO stocktaking (id,code,depositoryId,departmentManager,state,createTime,originator,departmentManagerState)
values ( values (
#{id}, #{id},
#{code}, #{code},
#{depositoryId}, #{depositoryId},
#{placeId},
#{departmentManager}, #{departmentManager},
#{state}, #{state},
#{createTime}, #{createTime},
@ -69,9 +68,9 @@
<!-- 插入子表--> <!-- 插入子表-->
<insert id="insertStockTakingChild" useGeneratedKeys="true" keyProperty="id"> <insert id="insertStockTakingChild" useGeneratedKeys="true" keyProperty="id">
INSERT INTO stocktakingchild (id,mid,oldInventory,newInventory,takingResult,inventory,mainId,producedDate,unit) INSERT INTO stocktakingchild (id,mid,oldInventory,newInventory,takingResult,inventory,mainId,producedDate,unit,pid)
values ( values (
#{id},#{mid},#{oldInventory},#{newInventory},#{takingResult},#{inventory},#{mainId},#{producedDate},#{unit} #{id},#{mid},#{oldInventory},#{newInventory},#{takingResult},#{inventory},#{mainId},#{producedDate},#{unit},#{placeId}
) )
</insert> </insert>
@ -109,9 +108,6 @@
<if test="depositoryId != null"> <if test="depositoryId != null">
depositoryId = #{depositoryId}, depositoryId = #{depositoryId},
</if> </if>
<if test="placeId != null">
placeId = #{placeId},
</if>
<if test="departmentManager != null and departmentManager != ''"> <if test="departmentManager != null and departmentManager != ''">
departmentManager = #{departmentManager}, departmentManager = #{departmentManager},
</if> </if>
@ -166,9 +162,13 @@
<if test="producedDate != null and producedDate != ''"> <if test="producedDate != null and producedDate != ''">
producedDate = #{producedDate}, producedDate = #{producedDate},
</if> </if>
<if test="placeId != null">
pid = #{placeId},
</if>
<if test="unit != null and unit != ''"> <if test="unit != null and unit != ''">
unit = #{unit} unit = #{unit}
</if> </if>
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
@ -202,9 +202,7 @@
<if test="depositoryId != null and depositoryId != ''"> <if test="depositoryId != null and depositoryId != ''">
and st.depositoryId = #{depositoryId} and st.depositoryId = #{depositoryId}
</if> </if>
<if test="placeId != null">
and st.placeId = #{placeId}
</if>
<if test="departmentManagerState != null and departmentManagerState != ''"> <if test="departmentManagerState != null and departmentManagerState != ''">
and st.departmentManagerState = #{departmentManagerState} and st.departmentManagerState = #{departmentManagerState}
</if> </if>
@ -232,6 +230,9 @@
<if test="newInventory != null"> <if test="newInventory != null">
and newInventory = #{newInventory} and newInventory = #{newInventory}
</if> </if>
<if test="placeId != null">
and pid = #{placeId}
</if>
<if test="takingResult != null and takingResult != ''"> <if test="takingResult != null and takingResult != ''">
and takingResult = #{takingResult} and takingResult = #{takingResult}
</if> </if>
@ -287,10 +288,10 @@
from stocktaking st from stocktaking st
where 1 = 1 where 1 = 1
<if test='isDone == 0'> <if test='isDone == 0'>
and (state = 3 and departmentManagerState = 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 ) and (state = 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 )
</if> </if>
<if test='isDone == 1'> <if test='isDone == 1'>
and (state != 3 and departmentManagerState != 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 ) and (state != 3 and FIND_IN_SET(#{departmentHead},st.departmentManager) != 0 )
</if> </if>
ORDER BY st.createTime desc ORDER BY st.createTime desc
<if test="begin != null and size != null"> <if test="begin != null and size != null">

51
target/classes/templates/pages/stockTaking/stockTaking.html

@ -317,6 +317,7 @@
{field: 'mname', width: 150, title: '物料名称'}, {field: 'mname', width: 150, title: '物料名称'},
{field: 'typeName', width: 100, title: '物料种类'}, {field: 'typeName', width: 100, title: '物料种类'},
{field: 'version', width: 150, title: '规格型号',}, {field: 'version', width: 150, title: '规格型号',},
{field: 'pcode', width: 150, title: '所处库位',},
{title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'inventory', width: 100, title: '库存数'}, {field: 'inventory', width: 100, title: '库存数'},
{field: 'stockTakingQuantity', width: 100, title: '盘点数', edit: 'quantity'}, {field: 'stockTakingQuantity', width: 100, title: '盘点数', edit: 'quantity'},
@ -333,8 +334,8 @@
let takingUnit = j["takingUnit"]; let takingUnit = j["takingUnit"];
if (takingUnit !== null) { if (takingUnit !== null) {
let parentItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")"); let parentItem = $("[lay-id='currentTableId'] tr:eq(" + (i + 1) + ")");
let unitHandleItem = parentItem.children()[4]; let unitHandleItem = parentItem.children()[5];
let quantityHandleItem = parentItem.children()[5]; let quantityHandleItem = parentItem.children()[6];
unitHandleItem.childNodes[0].childNodes[1].childNodes[0].data = takingUnit; unitHandleItem.childNodes[0].childNodes[1].childNodes[0].data = takingUnit;
quantityHandleItem.childNodes[0].innerText = j["splitInventory"][takingUnit]; quantityHandleItem.childNodes[0].innerText = j["splitInventory"][takingUnit];
} }
@ -499,7 +500,7 @@
, data: dropDownDataList , data: dropDownDataList
, click: function (unit) { , click: function (unit) {
this.elem[0].childNodes[0].data = unit.title; this.elem[0].childNodes[0].data = unit.title;
obj.tr[0].childNodes[5].childNodes[0].innerText = obj.data.splitInventory[unit.title]; obj.tr[0].childNodes[6].childNodes[0].innerText = obj.data.splitInventory[unit.title];
} }
, align: 'right' //右对齐弹出(v2.6.8 新增) , align: 'right' //右对齐弹出(v2.6.8 新增)
, style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式 , style: 'box-shadow: 1px 1px 10px rgb(0 0 0 / 12%);' //设置额外样式
@ -512,7 +513,7 @@
// 用于计算盘点结果 // 用于计算盘点结果
calculate = function (obj) { calculate = function (obj) {
let oldInventory = Number(obj.tr[0].childNodes[5].childNodes[0].innerText); let oldInventory = Number(obj.tr[0].childNodes[6].childNodes[0].innerText);
let nowInventory = Number(obj.value); let nowInventory = Number(obj.value);
let number = 0; let number = 0;
let takingResult = ''; let takingResult = '';
@ -530,15 +531,15 @@
takingResult = "Inventory_normal"; takingResult = "Inventory_normal";
takingResultString = "正常"; takingResultString = "正常";
} }
obj.tr[0].childNodes[7].childNodes[0].innerText = takingResultString; obj.tr[0].childNodes[8].childNodes[0].innerText = takingResultString;
obj.tr[0].childNodes[8].childNodes[0].innerText = number; obj.tr[0].childNodes[9].childNodes[0].innerText = number;
obj.update({takingResult: takingResult}); obj.update({takingResult: takingResult});
obj.update({takingInventory: number}); obj.update({takingInventory: number});
req.number = number + ""; req.number = number + "";
req.takingResult = takingResult; req.takingResult = takingResult;
req.takingResultString = takingResultString; req.takingResultString = takingResultString;
req.id = obj.data.id + ""; req.id = obj.data.id + "";
req.unit = obj.tr[0].childNodes[4].childNodes[0].innerText; req.unit = obj.tr[0].childNodes[5].childNodes[0].innerText;
req.oldInventory = oldInventory+""; req.oldInventory = oldInventory+"";
$.ajax({ $.ajax({
url: "/stockTaking/temporaryStorageForTakingResult", url: "/stockTaking/temporaryStorageForTakingResult",
@ -548,42 +549,6 @@
contentType: "application/json;charset=utf-8" contentType: "application/json;charset=utf-8"
}); });
}; };
form.on('select()', function (data) {
var id = data.elem.id; //得到select原始DOM对象id
var req = {};
if (id.includes("producedDate")) {
var idNumber = id.split('producedDate')[1]; // 得到当前id对应数字
req.mid = $("#" + "mid" + idNumber).val();
req.producedDate = data.value;
$.ajax({
url: "/material/findQuantityByProducedDate",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (d) {
$("#" + "oldInventory" + idNumber).val(d.data)
}
});
} else if (id.includes("unit")) {
let idNumber = id.split("unit")[1]; // 得到当前id对应数字
req.mid = $("#" + "mid" + idNumber).val();
req.unit = data.value;
req.placeId = $("#placeId").val();
$.ajax({
url: "/material/findQuantityByUnit",
type: "post",
dataType: 'json',
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (d) {
$("#" + "oldInventory" + idNumber).val(d.data)
}
});
}
});
}); });
</script> </script>

27
target/classes/templates/pages/stockTaking/stockTakingComplete.html

@ -45,7 +45,7 @@
<div class="layui-fluid"> <div class="layui-fluid">
<div class="layui-card"> <div class="layui-card">
<form class="layui-form" <form class="layui-form"
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" style="margin: 0 auto;max-width: 700px;"
lay-filter="form1" id="form1"> lay-filter="form1" id="form1">
<div class="layui-card-body" id="takingHeader" style="padding-right: 0px"> <div class="layui-card-body" id="takingHeader" style="padding-right: 0px">
<div class="layui-form-item"> <div class="layui-form-item">
@ -219,21 +219,22 @@
</div> </div>
</fieldset> </fieldset>
<div id="review">
<div class="layui-form"
style="margin: 0 auto;max-width: 900px;padding-top: 40px;">
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" onclick="complete(1)">
&emsp;处理&emsp;
</button>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
</div> </div>
<div id="review">
<div class="layui-form"
style="margin: 0 auto;max-width: 900px;padding-top: 40px;">
<div class="layui-form-item">
<div class="layui-input-block">
<button type="button" class="layui-btn" onclick="complete(1)">
&emsp;处理&emsp;
</button>
</div>
</div>
</div>
</div>
</fieldset> </fieldset>
</div> </div>
</div> </div>

Loading…
Cancel
Save