Browse Source

更新

lwx_dev
erdanergou 3 years ago
parent
commit
e68abf4eeb
  1. 13
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 41
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java
  3. 10
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 2
      src/main/java/com/dreamchaser/depository_manage/converter/ExcelMaterialCodeConverter.java
  5. 6
      src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfo.java
  6. 4
      src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java
  7. 4
      src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByMT.java
  8. 4
      src/main/java/com/dreamchaser/depository_manage/entity/Material.java
  9. 4
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndBarCode.java
  10. 91
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialType.java
  11. 3
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java
  12. 17
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml
  13. 17
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.java
  14. 34
      src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml
  15. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationModel.java
  16. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java
  17. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/MaterialP.java
  18. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java
  19. 2
      src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java
  20. 6
      src/main/java/com/dreamchaser/depository_manage/service/MaterialTypeService.java
  21. 11
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  22. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java
  23. 32
      src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java
  24. 51
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  25. 30
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialTypeServiceImpl.java
  26. 1
      src/main/resources/templates/pages/application/application-in.html
  27. 3
      src/main/resources/templates/pages/application/application-in_scanQrCode.html
  28. 32
      src/main/resources/templates/pages/application/application-out.html
  29. 10
      src/main/resources/templates/pages/material/material-add.html
  30. 5
      src/main/resources/templates/pages/material/material-out.html
  31. 4
      src/main/resources/templates/pages/material/selectType.html
  32. 22
      src/main/resources/templates/pages/materialtype/materialType_edit.html
  33. 18
      src/main/resources/templates/pages/materialtype/materialType_view.html
  34. 17
      src/test/java/com/dreamchaser/depository_manage/Test.java
  35. 17
      target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml
  36. 34
      target/classes/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml
  37. 1
      target/classes/templates/pages/application/application-in.html
  38. 3
      target/classes/templates/pages/application/application-in_scanQrCode.html
  39. 32
      target/classes/templates/pages/application/application-out.html
  40. 34
      target/classes/templates/pages/chart/chart-in_back.html
  41. 10
      target/classes/templates/pages/material/material-add.html
  42. 5
      target/classes/templates/pages/material/material-out.html
  43. 4
      target/classes/templates/pages/material/selectType.html
  44. 22
      target/classes/templates/pages/materialtype/materialType_edit.html
  45. 18
      target/classes/templates/pages/materialtype/materialType_view.html

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

@ -763,6 +763,19 @@ public class DepositoryRecordController {
map.put("quantity",quantity.toString());
map.put("price",map.get("price").toString());
map.put("applicantId",userToken.getId());
Map<String,Object> param = new HashMap<>();
String placeCode = (String) map.get("placeCode");
placeCode = placeCode.trim();
param.put("code",placeCode);
if(!("0000".equals(placeCode))) {
param.put("depositoryId",map.get("depositoryId"));
}
List<Place> placeByCondition = placeService.findPlaceByCondition(param);
if(placeByCondition.size() > 0){
map.put("placeId",placeByCondition.get(0).getId());
}
String type = (String) map.get("type");
Integer success = 0;
if("in".equals(type)){

41
src/main/java/com/dreamchaser/depository_manage/controller/MaterialTypeController.java

@ -74,21 +74,23 @@ public class MaterialTypeController {
public RestResponse realDeleteMaterialType(@RequestBody Map<String,Object> map){
if (map.containsKey("id")){
Integer id= ObjectFormatUtil.toInteger(map.get("id"));
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(id);
new Thread(new Runnable() {
@Override
public void run() {
RealDeleteSonDepository(id.toString());
RealDeleteSonDepository(materialTypeById.getOldId().toString());
}
}).start();
return CrudUtil.deleteHandle(materialTypeService.deleteMaterialTypeById(id),1);
}else if (map.containsKey("ids")){
List<Integer> ids=(List<Integer>) map.get("ids");
for (int i = 0; i < ids.size(); i++) {
String id = ids.get(i).toString();
Integer id = ids.get(i);
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(id);
new Thread(new Runnable() {
@Override
public void run() {
RealDeleteSonDepository(id);
RealDeleteSonDepository(materialTypeById.getOldId().toString());
}
}).start();
}
@ -108,9 +110,10 @@ public class MaterialTypeController {
// 获取当前仓库所有子仓库
List<MaterialType> materialTypeByCondition = materialTypeService.findMaterialTypeByCondition(param);
for (int i = 0; i < materialTypeByCondition.size(); i++) {
Integer id = materialTypeByCondition.get(i).getId(); // 获取当前物料id
RealDeleteSonDepository(id.toString()); // 递归查询物料类型
materialTypeService.deleteMaterialTypeById(id); // 删除物料类型
MaterialType materialType = materialTypeByCondition.get(i);
Long oldId = materialType.getOldId();// 获取当前物料id
RealDeleteSonDepository(oldId.toString()); // 递归查询物料类型
materialTypeService.deleteMaterialTypeById(materialType.getId()); // 删除物料类型
}
}
@ -123,21 +126,23 @@ public class MaterialTypeController {
public RestResponse deleteMaterialType(@RequestBody Map<String,Object> map){
if (map.containsKey("id")){
Integer id= ObjectFormatUtil.toInteger(map.get("id"));
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(id);
new Thread(new Runnable() {
@Override
public void run() {
UpdateSonState(id.toString(),3);
UpdateSonState(materialTypeById.getOldId().toString(),3);
}
}).start();
return CrudUtil.deleteHandle(materialTypeService.changeStateToDeletedById(id),1);
}else if (map.containsKey("ids")){
List<Integer> ids=(List<Integer>) map.get("ids");
for (int i = 0; i < ids.size(); i++) {
String id = ids.get(i).toString();
Integer id = ids.get(i);
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(id);
new Thread(new Runnable() {
@Override
public void run() {
UpdateSonState(id,3);
UpdateSonState(materialTypeById.getOldId().toString(),3);
}
}).start();
}
@ -172,11 +177,13 @@ public class MaterialTypeController {
Boolean allSonDepository = false;
if(map.containsKey("id")){
Integer materialTypeId = ObjectFormatUtil.toInteger(map.get("id"));
allSonDepository = findAllSonMaterialType(materialTypeId.toString());
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(materialTypeId);
allSonDepository = findAllSonMaterialType(materialTypeById.getOldId().toString());
}else if(map.containsKey("ids")){
List<Integer> ids = (List<Integer>) map.get("ids");
for (int i = 0; i < ids.size(); i++) {
allSonDepository |= findAllSonMaterialType(ids.get(i).toString());
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(ids.get(i));
allSonDepository |= findAllSonMaterialType(materialTypeById.getOldId().toString());
if(allSonDepository){
break;
}
@ -210,8 +217,8 @@ public class MaterialTypeController {
}
List<MaterialType> materialTypeByCondition = materialTypeService.findMaterialTypeByCondition(param);
for (int i = 0; i < materialTypeByCondition.size(); i++) {
if(!findMaterialByMaterialType(materialTypeByCondition.get(i).getId().toString())){
findAllSonMaterialType(materialTypeByCondition.get(i).getId().toString());
if(!findMaterialByMaterialType(materialTypeByCondition.get(i).getOldId().toString())){
findAllSonMaterialType(materialTypeByCondition.get(i).getOldId().toString());
}else{
return true;
}
@ -249,10 +256,11 @@ public class MaterialTypeController {
}
int state = ((int)map.get("state"));
String id = (String) map.get("id");
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(ObjectFormatUtil.toInteger(id));
new Thread(new Runnable() {
@Override
public void run() {
UpdateSonState(id, state);
UpdateSonState(materialTypeById.getOldId().toString(), state);
}
}).start();
return CrudUtil.postHandle(materialTypeService.updateMaterialType(map), 1);
@ -273,9 +281,8 @@ public class MaterialTypeController {
for (int i = 0; i < materialTypeByCondition.size(); i++) {
MaterialType materialType = materialTypeByCondition.get(i);
int materialTypeId = materialType.getId();
Map<String,Object> newMap = new HashMap<>();
newMap.put("parentId",materialTypeId);
UpdateSonState(String.valueOf(materialTypeId),state);
Long oldId = materialType.getOldId();
UpdateSonState(String.valueOf(oldId),state);
Map<String,Object> map = new HashMap<>();
map.put("id",materialTypeId);
map.put("state",state);

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

@ -1019,10 +1019,12 @@ public class PageController {
@GetMapping("/materialType_detail")
public ModelAndView materialType_detail(Integer id) {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/materialtype/materialType_edit.html");
mv.setViewName("pages/materialtype/materialType_edit");
if (id != null) {
mv.addObject("record", materialTypeService.findMaterialTypeById(id));
mv.addObject("materialTypes", materialTypeService.findMaterialTypeAll());
MaterialType record = materialTypeService.findMaterialTypeById(id);
MaterialType parentType = materialTypeService.findMaterialTypeByOldId(record.getParentId());
mv.addObject("record", record);
mv.addObject("parentType", parentType);
} else {
throw new MyException("缺少必要参数!");
}
@ -1685,7 +1687,7 @@ public class PageController {
public ModelAndView applicationInByMaterial(HttpServletRequest request){
ModelAndView mv = new ModelAndView();
UserByPort userByPort = (UserByPort) request.getAttribute("userToken");
String scanQrCodeValue = redisTemplate.opsForValue().get("temporaryValueForMaterial"+userByPort.getNumber()).toString();
String scanQrCodeValue = (String)redisTemplate.opsForValue().get("temporaryValueForMaterial"+userByPort.getNumber()).toString();
redisTemplate.delete("temporaryValueForMaterial"+userByPort.getNumber());
JSONObject jsonObject = JSONObject.parseObject(scanQrCodeValue);
JSONArray mids = (JSONArray) jsonObject.get("mids");

2
src/main/java/com/dreamchaser/depository_manage/converter/ExcelMaterialCodeConverter.java

@ -44,7 +44,7 @@ public class ExcelMaterialCodeConverter implements Converter<Long> {
*/
@Override
public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
Material material = excelMaterialCodeConverter.materialService.findMaterialByCode(Long.valueOf(cellData.getStringValue()));
Material material = excelMaterialCodeConverter.materialService.findMaterialByCode(cellData.getStringValue());
if(material == null) {
throw new RuntimeException("没有该物料");
}

6
src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfo.java

@ -21,7 +21,7 @@ public class ExcelInfo {
/** 物料编号 */
@ExcelProperty("EAS编号")
private Integer id;
private Long id;
/** 物料名称 */
@ExcelProperty(value = "物料名称")
@ -29,7 +29,7 @@ public class ExcelInfo {
/** 物料种类id */
@ExcelProperty(value = "物料种类编码")
private Integer typeId;
private Long typeId;
/** 物料状态 */
@ExcelProperty(value = "状态",converter = ExcelStateInfoConverter.class)
@ -37,7 +37,7 @@ public class ExcelInfo {
/** 编码 */
@ExcelProperty("编码")
private Long code;
private String code;
/** 规格型号 */
@ExcelProperty("规格型号")

4
src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByInventory.java

@ -15,11 +15,11 @@ public class ExcelInfoByInventory {
/** 物料编号 */
@ExcelProperty("EAS编号")
private Integer id;
private Long id;
/** 存货编码 */
@ExcelProperty(value = "编码",converter = ExcelMaterialCodeConverter.class)
private Long code;
private String code;
/** 仓库名称 */
@ExcelProperty(value = "仓库编码",converter = ExcelDepositoryInfoConverter.class)

4
src/main/java/com/dreamchaser/depository_manage/entity/ExcelInfoByMT.java

@ -20,13 +20,13 @@ public class ExcelInfoByMT {
* 物料编码
*/
@ExcelProperty(value = "编码")
private Integer id;
private Long oldId;
/**
* 物料上级编码
*/
@ExcelProperty(value = "上级编码")
private Integer parentId;
private Long parentId;
/**
* 物料介绍

4
src/main/java/com/dreamchaser/depository_manage/entity/Material.java

@ -30,13 +30,13 @@ public class Material {
private Double amounts;
/** 物料种类id */
private Integer typeId;
private Long typeId;
/** 物料状态 */
private Integer state;
/** 存货编码 */
private BigInteger code;
private String code;
/** 规格型号 */
private String version;

4
src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndBarCode.java

@ -18,11 +18,11 @@ public class MaterialAndBarCode {
/**
* 条形码
*/
private BigInteger bmcode;
private String bmcode;
/**
* 物料编码
*/
private BigInteger mcode;
private String mcode;
/**
* 物料id
*/

91
src/main/java/com/dreamchaser/depository_manage/entity/MaterialType.java

@ -1,11 +1,14 @@
package com.dreamchaser.depository_manage.entity;
import lombok.Data;
/**
* material_type
*
* @author bianj
* @version 1.0.0 2021-05-20
*/
@Data
public class MaterialType {
/** 版本号 */
private static final long serialVersionUID = 5895240732960572981L;
@ -27,93 +30,11 @@ public class MaterialType {
/**
* 父级编号
*/
private Integer parentId;
/* This code was generated by TableGo tools, mark 1 end. */
/* This code was generated by TableGo tools, mark 2 begin. */
/**
* 获取类型id
*
* @return 类型id
*/
public Integer getId() {
return this.id;
}
/**
* 设置类型id
*
* @param id
* 类型id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取类型名称
*
* @return 类型名称
*/
public String getTname() {
return this.tname;
}
/**
* 设置类型名称
*
* @param tname
* 类型名称
*/
public void setTname(String tname) {
this.tname = tname;
}
/**
* 获取类型介绍
*
* @return 类型介绍
*/
public String getIntroduce() {
return this.introduce;
}
/**
* 设置类型介绍
*
* @param introduce
* 类型介绍
*/
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
private Long parentId;
/**
* 获取类型状态
* @return 类型状态
* 金蝶id
*/
public int getState() {
return state;
}
/**
* 设置类型状态
* @param state
*/
public void setState(int state) {
this.state = state;
}
public Integer getParentId() {
return parentId;
}
public void setParentId(Integer parentId) {
this.parentId = parentId;
}
private Long oldId;
/* This code was generated by TableGo tools, mark 2 end. */
}

3
src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java

@ -197,4 +197,7 @@ public interface MaterialMapper {
* @return
*/
Integer deleteBarCodeAndMaterial(Map<String,Object> map);
List<Material> findMaterialByType(Long oldId);
}

17
src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml

@ -13,7 +13,7 @@
<result column="price" property="price" jdbcType="DOUBLE" />
<result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="INTEGER"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -29,8 +29,8 @@
<result column="quantity" property="quantity" jdbcType="VARCHAR" />
<result column="price" property="price" jdbcType="VARCHAR" />
<result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="INTEGER"/>
<result column="state" property="state" jdbcType="VARCHAR" />
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -58,8 +58,8 @@
<result column="unit" property="unit" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="tname" property="tname" jdbcType="VARCHAR"/>
<result column="mcode" property="mcode" jdbcType="INTEGER"/>
<result column="bmcode" property="bmcode" jdbcType="INTEGER"/>
<result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="bmcode" property="bmcode" jdbcType="VARCHAR"/>
<result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mtid" property="mtid" jdbcType="INTEGER"/>
@ -313,6 +313,13 @@
where id = #{id}
</select>
<select id="findMaterialByType" resultMap="materialMap" parameterType="long">
select
<include refid="allColumns"/>
from material m
where m.type_id = #{oldId}
</select>
<!-- 根据主键查询数据 -->
<select id="findMaterialByIds" resultMap="materialMap" parameterType="list">

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

@ -35,6 +35,13 @@ public interface MaterialTypeMapper {
*/
MaterialType findMaterialTypeById(Integer id);
/**
* 根据id查询物料类型
* @param oldId 物料类型id
* @return 物料类型对象
*/
MaterialType findMaterialTypeByOldId(Long oldId);
/**
* 根据id查询物料名称
* @param id 物料类型id
@ -42,6 +49,14 @@ public interface MaterialTypeMapper {
*/
String findMaterialTypeNameById(Integer id);
/**
* 根据物料类型查询物料名称
* @param oldId 物料类型id
* @return 物料名称
*/
String findMaterialTypeNameByOldId(Long oldId);
/**
* 根据条件查询物料类型数目
* @param map 条件参数map
@ -117,6 +132,6 @@ public interface MaterialTypeMapper {
* @param parentId
* @return
*/
List<MaterialType> findMaterialTypeByParent(Integer parentId);
List<MaterialType> findMaterialTypeByParent(Long parentId);
}

34
src/main/java/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml

@ -9,10 +9,13 @@
<id column="id" property="id" jdbcType="INTEGER" />
<result column="tname" property="tname" jdbcType="VARCHAR" />
<result column="introduce" property="introduce" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="INTEGER"/>
<result column="parentId" property="parentId" jdbcType="INTEGER"/>
<result column="oldId" property="oldId" jdbcType="INTEGER"/>
</resultMap>
<!-- 表查询字段 -->
<sql id="allColumns">
mt.id, mt.tname, mt.introduce, mt.state,mt.parentId
mt.id, mt.tname, mt.introduce, mt.state,mt.parentId,mt.oldId
</sql>
<!-- This code was generated by TableGo tools, mark 2 end. -->
@ -46,6 +49,9 @@
<if test="parentId != null">
and mt.parentId = #{parentId}
</if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4
</select>
<!-- 根据条件参数查询数据列表 -->
@ -65,6 +71,9 @@
<if test="parentId != null">
and mt.parentId = #{parentId}
</if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4
<if test="begin != null and size != null">
@ -79,8 +88,15 @@
FROM material_type mt WHERE mt.id = #{id}
</select>
<!-- 根据物料类型id查询数据 -->
<select id="findMaterialTypeNameByOldId" resultType="string" parameterType="long">
SELECT
mt.tname
FROM material_type mt WHERE mt.oldId = #{oldId}
</select>
<!-- 根据父类查询数据 -->
<select id="findMaterialTypeByParent" resultMap="materialTypeMap" parameterType="int">
<select id="findMaterialTypeByParent" resultMap="materialTypeMap" parameterType="long">
SELECT
<include refid="allColumns" />
FROM material_type mt
@ -93,6 +109,13 @@
<include refid="allColumns" />
FROM material_type mt WHERE mt.id = #{id} and mt.state != 3 and mt.state != 4
</select>
<!-- 根据主键查询数据 -->
<select id="findMaterialTypeByOldId" resultMap="materialTypeMap" parameterType="long">
SELECT
<include refid="allColumns" />
FROM material_type mt WHERE mt.oldId = #{oldId} and mt.state != 3 and mt.state != 4
</select>
<!-- 根据主键查询数据
<select id="findMaterialTypeByIds" resultMap="materialTypeMap" parameterType="list">
SELECT
@ -107,12 +130,13 @@
<!-- 插入数据 -->
<insert id="insertMaterialType" parameterType="map">
INSERT INTO material_type (
id, tname, introduce,parentId
id, tname, introduce,parentId,oldId
) VALUES (
#{id},
#{tname},
#{introduce},
#{parentId}
#{parentId},
#{oldId}
)
</insert>
@ -218,6 +242,6 @@
<if test="oldState != null">
and state = #{oldState}
</if>
and state != 3 and mt.state != 4
and state != 3 and state != 4
</update>
</mapper>

2
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationModel.java

@ -38,7 +38,7 @@ public class ApplicationModel {
/**
* 物料编码
*/
private BigInteger code;
private String code;
/**
* 数量

2
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java

@ -25,7 +25,7 @@ public class ApplicationOutRecordMinP {
/**
* 物料编码
*/
private BigInteger mcode;
private String mcode;
/**
* 仓库id
*/

2
src/main/java/com/dreamchaser/depository_manage/pojo/MaterialP.java

@ -77,7 +77,7 @@ public class MaterialP {
/**
* 存货编码
*/
private BigInteger code;
private String code;
/**
* 规格型号

2
src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java

@ -23,7 +23,7 @@ public class SimpleApplicationOutMinRecordP {
/**
* 申请物料编码
*/
private BigInteger mcode;
private String mcode;
/**
* 订单编码

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

@ -70,7 +70,7 @@ public interface MaterialService {
* 根据编码获取对应物料
* @return
*/
Material findMaterialByCode(Long code);
Material findMaterialByCode(String code);
/**
* 查询所有的库存信息

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

@ -69,6 +69,12 @@ public interface MaterialTypeService {
* @return 对应记录
*/
MaterialType findMaterialTypeById(Integer id);
/**
* 根据OldId查询对应物料类型
* @param OldId
* @return 对应记录
*/
MaterialType findMaterialTypeByOldId(Long OldId);
/**
* 根据主键id将物料类型状态修改为删除

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

@ -169,8 +169,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/
@Override
public Integer insertApplicationOutRecord(Map<String, Object> map, UserByPort userToken) {
String placeId = (String) map.get("placeId");
if ("".equals(placeId) || "0".equals(placeId) || placeId == null) {
String placeId = "";
Object temp = map.get("placeId");
if(temp != null){
placeId = temp.toString();
}
if (placeId == null || "".equals(placeId) || "0".equals(placeId) ) {
map.put("placeId", 0);
}
Double quantity = Double.parseDouble((String) map.get("quantity"));
@ -272,7 +276,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Material materialById = materialMapper.findMaterialById(mid);
if (placeById.getMax() - placeById.getQuantity() > quantity) {
// 如果当前库位还能存放
// 入库
Integer integer = applicationIn(map);
if (integer != 1) {
@ -1743,7 +1746,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map<String,Object> param = new HashMap<>();
List<MaterialType> result = new ArrayList<>();
result.add(mt);
param.put("parentId",mt.getId());
param.put("parentId",mt.getOldId());
// 获取当前父类的子类
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param);
if(materialTypeByCondition.size() > 0){

4
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java

@ -275,7 +275,7 @@ public class DepositoryServiceImpl implements DepositoryService {
for (int i = 0; i < depositoryAndRole.size(); i++) {
RoleAndDepository roleAndDepository = depositoryAndRole.get(i);
// 如果重复则跳过
if (depositoryListId.get(i).compareTo(roleAndDepository.getDepositoryId()) == 0) {
if (depositoryListId.contains(roleAndDepository.getDepositoryId())) {
continue;
}
depositoryListId.add(roleAndDepository.getDepositoryId());
@ -558,4 +558,6 @@ public class DepositoryServiceImpl implements DepositoryService {
return flag;
}
}

32
src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.Future;
import static com.dreamchaser.depository_manage.utils.FileUtil.uploadFile;
@ -154,16 +155,17 @@ public class ExcelServiceImpl implements ExcelService {
for (int i = 0; i < excelVos.size(); i++) {
Map<String, Object> insert = new HashMap<>();
insert.put("id", excelVos.get(i).getId());
insert.put("tname", excelVos.get(i).getTname());
insert.put("introduce", excelVos.get(i).getIntroduce());
if (excelVos.get(i).getParentId() == null) {
ExcelInfoByMT info = excelVos.get(i);
insert.put("oldId", info.getOldId());
insert.put("tname", info.getTname());
insert.put("introduce", info.getIntroduce());
if (info.getParentId() == null) {
insert.put("materialTypeId", 0);
} else {
insert.put("materialTypeId", excelVos.get(i).getParentId());
insert.put("materialTypeId", info.getParentId());
}
materialTypeService.insertMaterialType(insert);
success.add(excelVos.get(i));
success.add(info);
}
log.info("【批量添加】批量添加数据:{}", JSON.toJSONString(excelVos));
@ -270,7 +272,7 @@ public class ExcelServiceImpl implements ExcelService {
// 4.通过线程池开启一个线程去执行数据库操作,主线程继续往下执行
// 4.1开启一个线程
TaskCenterUtil taskCenterUtil = TaskCenterUtil.getTaskCenterUtil();
taskCenterUtil.submitTask(() -> {
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> {
List<Object> success = new ArrayList<>();
Map<String, Object> returnResult = new HashMap<>();
for (int i = 0; i < excelVos.size(); i++) {
@ -285,7 +287,7 @@ public class ExcelServiceImpl implements ExcelService {
insert.put("code", materialByCode.getCode());
insert.put("unit", materialByCode.getUnit());
insert.put("texture", materialByCode.getTexture());
insert.put("tempPlaceCode",excelVos.get(i).getDepositoryCode());
insert.put("tempPlaceCode", excelVos.get(i).getDepositoryCode());
insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()) + materialByCode.getQuantity()));
// 如果模板中总金额未填写
if (excelVos.get(i).getAmounts() == null || "".equals(excelVos.get(i).getAmounts())) {
@ -315,7 +317,7 @@ public class ExcelServiceImpl implements ExcelService {
// 将该物料同时放入默认库位中
String placeCode = excelInfoByInventories.get(i).getDepositoryCode();
Boolean isNew = (Boolean) insert.get("isNew");
if(isNew) {
if (isNew) {
// 如果是新插入物料
if (placeCode == null || placeCode.isEmpty() || "0".equals(placeCode)) { // 如果没有输入库位
Map<String, Object> param = new HashMap<>();
@ -331,9 +333,9 @@ public class ExcelServiceImpl implements ExcelService {
placeService.addMaterialOnPlace(param);
} else {
// 如果输入的库位不是默认库位
Map<String,Object> param = new HashMap<>();
param.put("did",depositoryId);
param.put("code",placeCode);
Map<String, Object> param = new HashMap<>();
param.put("did", depositoryId);
param.put("code", placeCode);
// 获取要导入的库位
Place placeByCondition = placeService.findPlaceByCondition(param).get(0);
// 修改库位物料数量
@ -342,9 +344,9 @@ public class ExcelServiceImpl implements ExcelService {
placeService.UpdatePlace(placeByCondition);
// 如果没有对应关系
param.put("pid",placeByCondition.getId());
param.put("mid",insert.get("id"));
param.put("quantity",ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
param.put("pid", placeByCondition.getId());
param.put("mid", insert.get("id"));
param.put("quantity", ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
// 添加对应关系
placeService.addMaterialOnPlace(param);
}

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

@ -62,7 +62,21 @@ public class MaterialServiceImpl implements MaterialService {
map.put("price",price);
map.put("amounts",quantity * price);
}
materialMapper.addBarCodeAndMcode(map);
// 获取当前类型
if(map.containsKey("typeId")) {
Integer typeId = ObjectFormatUtil.toInteger(map.get("typeId").toString());
MaterialType materialTypeById = materialTypeMapper.findMaterialTypeById(typeId);
map.put("materialTypeId", materialTypeById.getOldId());
String code = materialTypeById.getOldId().toString();
List<Material> materialByType = materialMapper.findMaterialByType(materialTypeById.getOldId());
if (materialByType == null) {
materialByType = new ArrayList<>();
}
map.put("code", code + String.format("%04d", materialByType.size() + 1));
}
if(map.containsKey("barCode")){
materialMapper.addBarCodeAndMcode(map);
}
return materialMapper.insertMaterial(map);
}
@ -96,8 +110,8 @@ public class MaterialServiceImpl implements MaterialService {
map.put("price",price);
}
if(map.containsKey("materialTypeId")) {
Object materialTypeId = map.get("materialTypeId");
map.put("typeId", materialTypeId);
map.put("typeId", map.get("materialTypeId"));
map.remove("materialTypeId");
}
String barCode = (String) map.get("barCode");
if(!"0".equals(barCode)) {
@ -223,7 +237,7 @@ public class MaterialServiceImpl implements MaterialService {
* @return
*/
@Override
public Material findMaterialByCode(Long code) {
public Material findMaterialByCode(String code) {
Map<String,Object> map = new HashMap<>();
map.put("code",code);
Material material = materialMapper.findMaterialByCondition(map).get(0);
@ -363,7 +377,7 @@ public class MaterialServiceImpl implements MaterialService {
m.setDepositoryName(depositoryMapper.findDepositoryNameById(depositoryId));
m.setWarehouseManager(depositoryMapper.findUserNameByDepositoryId(depositoryId));
}
m.setTypeName(materialTypeMapper.findMaterialTypeNameById(material.getTypeId()));
m.setTypeName(materialTypeMapper.findMaterialTypeNameByOldId(material.getTypeId()));
result.add(m);
}
return result;
@ -557,7 +571,7 @@ public class MaterialServiceImpl implements MaterialService {
for (int i = 0; i < materialTypeNoParent.size(); i++) {
// 获取当前顶级类别
MaterialType mt = materialTypeNoParent.get(i);
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(),mname,adminorg);
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId(),mname,adminorg);
Map<String, Object> stringObjectMap = new HashMap<>();
if(childForMaterialTypeByParent != null) {
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent);
@ -583,7 +597,7 @@ public class MaterialServiceImpl implements MaterialService {
Map<String, Object> result = new HashMap<>();
MaterialType mt = materialTypeNoParent.get(i);
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> {
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(), mname, "");
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId(), mname, "");
Map<String, Object> stringObjectMap = new HashMap<>();
if (childForMaterialTypeByParent != null) {
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent);
@ -610,7 +624,7 @@ public class MaterialServiceImpl implements MaterialService {
if(mt != null) {
Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname());
map.put("id", mt.getId());
map.put("id", mt.getOldId());
map.put("children",children);
return map;
}
@ -623,21 +637,21 @@ public class MaterialServiceImpl implements MaterialService {
public List<Object> AddMaterialByType(MaterialType mt,String mname,String adminorg){
if(mt != null) {
Map<String, Object> param = new HashMap<>();
param.put("materialTypeId", mt.getId());
// 获取当前部门管理的仓库
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(adminorg);
List<Integer> dids = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
// 将仓库编号存储到列表中
dids.add(depository.getId());
}
param.put("materialTypeId", mt.getOldId());
List<Material> materialPByCondition = new ArrayList<>();
// List<Material> materialByDepositorys = new ArrayList<>();
if("".equals(adminorg)){
// 获取当前类别下的物料
materialPByCondition = materialMapper.findMaterialByCondition(param);
}else{
// 获取当前部门管理的仓库
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(adminorg);
// 获取当前仓库下的所有物料库存
List<Integer> dids = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
// 将仓库编号存储到列表中
dids.add(depository.getId());
}
param.put("list",dids);
materialPByCondition = materialMapper.findMaterialByDepositorysAndType(param);
}
@ -700,10 +714,9 @@ public class MaterialServiceImpl implements MaterialService {
}
// 根据类别id获取子类
public List<Object> findChildForMaterialTypeByParent(Integer id,String mname,String adminorg){
public List<Object> findChildForMaterialTypeByParent(Long id,String mname,String adminorg){
Map<String,Object> param = new HashMap<>();
List<Object> result = new ArrayList<>();
Map<String,Object> children = new HashMap<>();
param.put("parentId",id);
// 获取当前父类的子类
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param);
@ -711,7 +724,7 @@ public class MaterialServiceImpl implements MaterialService {
// 如果当前类别有子类
for (MaterialType mt : materialTypeByCondition) {
// 递归直至到最底层子类
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(),mname,adminorg);
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId(),mname,adminorg);
Map<String, Object> stringObjectMap = null;
if(childForMaterialTypeByParent == null) {
// 如果当前类别没有子类

30
src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialTypeServiceImpl.java

@ -7,6 +7,7 @@ import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -33,6 +34,20 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
map.put("parentId",map.get("materialTypeId"));
map.remove("materialTypeId");
}
Long parentId =Long.valueOf(map.get("parentId").toString());
MaterialType materialTypeById = materialTypeMapper.findMaterialTypeByOldId(parentId);
Integer size = 0;
String firstName = "";
if(materialTypeById == null){
List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(Long.valueOf("0"));
size = materialTypeByParent.size();
}else{
List<MaterialType> materialTypeByParent = materialTypeMapper.findMaterialTypeByParent(materialTypeById.getOldId());
size = materialTypeByParent.size();
firstName = materialTypeById.getOldId().toString();
map.put("parentId",materialTypeById.getOldId());
}
map.put("oldId",firstName+String.format("%02d",size+1));
return materialTypeMapper.insertMaterialType(map);
}
@ -130,6 +145,11 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
return materialTypeMapper.findMaterialTypeById(id);
}
@Override
public MaterialType findMaterialTypeByOldId(Long OldId) {
return materialTypeMapper.findMaterialTypeByOldId(OldId);
}
/**
* 根据主键id将物料类型状态修改为删除
* @param id
@ -170,7 +190,7 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
List<Object> list = new ArrayList<>();
for (int i = 0; i < materialTypeNoParent.size(); i++) {
MaterialType mt = materialTypeNoParent.get(i);
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId());
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId());
Map<String, Object> stringObjectMap = InitTreeMenus(mt,childForMaterialTypeByParent);
list.add(stringObjectMap);
}
@ -182,7 +202,7 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
if(mt != null) {
Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname());
map.put("id", mt.getId());
map.put("id", mt.getOldId());
map.put("children",children);
return map;
}
@ -204,17 +224,17 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
}
// 根据id获取子类
public List<Object> findChildForMaterialTypeByParent(Integer id){
public List<Object> findChildForMaterialTypeByParent(Long Oldid){
Map<String,Object> param = new HashMap<>();
List<Object> result = new ArrayList<>();
Map<String,Object> children = new HashMap<>();
param.put("parentId",id);
param.put("parentId",Oldid);
// 获取当前父类的子类
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param);
if(materialTypeByCondition.size() > 0){
for (int i = 0; i < materialTypeByCondition.size(); i++) {
MaterialType mt = materialTypeByCondition.get(i);
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId());
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId());
result.add(InitTreeMenus(mt,childForMaterialTypeByParent));
}
return result;

1
src/main/resources/templates/pages/application/application-in.html

@ -460,6 +460,7 @@
var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
var id = barCodeInput.id;
$("#"+id).remove();
$("#barCode").remove();
// barCodeInput.style = "display:none";
var idNumber = materialId.name.split("mid")[1];
var barCodeSelect = `

3
src/main/resources/templates/pages/application/application-in_scanQrCode.html

@ -70,9 +70,6 @@
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
提交成功
</div>
<div style="text-align: center;margin-top: 50px;">
<button class="layui-btn next">再填写一次</button>
</div>
</div>
</form>

32
src/main/resources/templates/pages/application/application-out.html

@ -404,8 +404,12 @@
var objId = parent.id.split("cardItem")[1];
var children = parent.childNodes[5];
var materialItem = children.childNodes[3].childNodes[1].childNodes;
var barCodeChildren = parent.childNodes[9];
var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3];
// 条形码条码
var barCodeItem = barCodeChildren.childNodes[3];
var req = {};
req.code = code;
req.type = "out";
@ -423,10 +427,34 @@
materialId.value = "";
obj.value = "";
$('#place'+objId).empty();
}else{
req.mid = d.id;
}else
{
materialName.value = d.mname;
materialId.value = d.id;
// 获取物料与条形码的对应关系
var materialAndBarCodeList = d["materialAndBarCodeList"];
if (materialAndBarCodeList.length > 0) {
// 如果有对应的条形码
var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
console.log(barCodeItem)
var id = barCodeInput.id;
$("#" + id).remove();
$("#barCode").remove();
// barCodeInput.style = "display:none";
var idNumber = materialId.name.split("mid")[1];
var barCodeSelect = `
<select id=` + "barCode" + idNumber + ` name=` + "barCode" + idNumber + `>
</select>`;
$("#" + barCodeImg.id).before(barCodeSelect);
form.render();
$.each(materialAndBarCodeList, function (index, item) {
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
}
}
});

10
src/main/resources/templates/pages/material/material-add.html

@ -58,19 +58,13 @@
name="version" lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">存货编码:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写存货编码" class="layui-input" id="code"
name="code" lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料类型:</label>
<div class="layui-input-block">
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly
lay-verify="required"/>
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="materialTypeId" class="layui-input" style="display: none" lay-verify="required"/>
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="typeId" class="layui-input" style="display: none" lay-verify="required"/>
</div>
</div>

5
src/main/resources/templates/pages/material/material-out.html

@ -335,12 +335,13 @@
layer.closeAll('loading'); //关闭loading
//如果上传成功
console.log(res);
var re = "";
for (let i = 0; i < res.data.errMsg.length; i++) {
var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>"
re += show
}
if(res.code == 200){
var re = ""
if(res.code === 200){
for (let i = 0; i < res.data.dataList.length; i++) {
var mname = res.data.dataList[i]["mname"];
var code = res.data.dataList[i]["code"] == null || res.data.dataList[i]["code"] == undefined ?"":res.data.dataList[i]["code"];

4
src/main/resources/templates/pages/material/selectType.html

@ -22,8 +22,8 @@
,data: []
,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩
,click: function(obj){
$("#openSonByMateralType",window.parent.document).val(obj.data.title)
$("#materialTypeId",window.parent.document).val(obj.data.id)
$("#openSonByMateralType",window.parent.document).val(obj.data.title);
$("#materialTypeId",window.parent.document).val(obj.data.id);
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);

22
src/main/resources/templates/pages/materialtype/materialType_edit.html

@ -34,10 +34,8 @@
<div class="layui-form-item">
<label class="layui-form-label">父级类型:</label>
<div class="layui-input-block">
<select name="parentId" >
<option value="">请选择类型</option>
<option th:each="materialType,iterStar:${materialTypes}" th:value="${materialType?.getId()}" th:text="${materialType?.getTname()}" th:selected="${materialType.getId() == record.getParentId()}" >顶级公司</option>
</select>
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly th:value="${parentType == null ?'': parentType.getTname()}" />
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="parentId" class="layui-input" th:value="${parentType == null ?'' :parentType.getOldId()}" style="display: none" />
</div>
</div>
<div class="layui-form-item" style="display: none">
@ -57,6 +55,22 @@
<script>
layui.use('form', function(){
var form = layui.form, $ = layui.$;
$('#openSonByMateralType').on('click', function(){
layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/selectType',
});
});
//提交
form.on('submit(formDemo)', function(data){
data = data.field

18
src/main/resources/templates/pages/materialtype/materialType_view.html

@ -110,7 +110,8 @@
defaultToolbar: ['filter', 'exports', 'print'],
cols: [ [
{type: "checkbox", width: 50},
{field: 'id', width: 100, title: '类型编号', sort: true},
{field: 'id', width: 100, title: 'id', sort: true},
{field: 'oldId', width: 100, title: '类型编号', sort: true},
{field: 'tname', width: 120, title: '类型名称'},
{field: 'introduce',width: 200,title: '类型介绍'},
{field:'state', title:'状态', minWidth: 80, templet: '#switchTpl'},
@ -122,6 +123,7 @@
skin: 'line',
done:function () {
$("[data-field='id']").css('display','none');
$("[data-field='oldId']").css('display','none');
}
});
@ -232,7 +234,7 @@
}
for (let i = 0; i < res.data.dataList.length; i++) {
var tname = res.data.dataList[i]["tname"];
var id = res.data.dataList[i]["id"];
var id = res.data.dataList[i]["oldId"];
var parentId = res.data.dataList[i]["parentId"] == null?"":res.data.dataList[i]["parentId"];
var introduce = res.data.dataList[i]["introduce"] == null?"":res.data.dataList[i]["introduce"];
var show = "<p style='color: #00FF00'>"+tname + " "+ id+" " +parentId+"成功" +"</p>"
@ -356,7 +358,7 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/findMaterialTypeByParentId?parentId='+data.id
content: '/findMaterialTypeByParentId?parentId='+data.oldId
});
$(window).on("resize", function () {
layer.full(index);
@ -433,12 +435,12 @@
//监听状态操作
form.on('switch(changeState)', function(obj){
var req = new Map
var req = new Map;
if(obj.elem.checked){
req["state"] = 1
req["state"] = 1;
}
req["id"] = this.value
var hasMaterial = false
req["id"] = this.value;
var hasMaterial = false;
if(req["state"] == undefined){ //如果禁用
$.ajax({
url:"/materialType/findMaterialByMaterialTypeId", // 判断该类型下是否有物品
@ -447,7 +449,7 @@
data:JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (data) {
hasMaterial = data.data
hasMaterial = data.data;
if(hasMaterial){ // 如果有物品
layer.confirm('该种类下还有物品,确定禁用?', {
btn: ['禁用','取消'] //按钮

17
src/test/java/com/dreamchaser/depository_manage/Test.java

@ -57,38 +57,31 @@ import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import org.xml.sax.InputSource;
@SpringBootTest
@RunWith(SpringRunner.class)
public class Test {
@Autowired
QyWxOperationService qyWxOperationService;
@Autowired
MaterialService materialService;
@Autowired
DepositoryService depositoryService;
@org.junit.Test
public void test1() throws AesException, IOException, ParserConfigurationException, SAXException {
List<Depository> depositoryByAdminorg = depositoryService.findDepositoryByAdminorg("102");
List<Object> objectList = materialService.InitTreeMenus("");
System.out.println(objectList);
}
}

17
target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml

@ -13,7 +13,7 @@
<result column="price" property="price" jdbcType="DOUBLE" />
<result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="INTEGER"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -29,8 +29,8 @@
<result column="quantity" property="quantity" jdbcType="VARCHAR" />
<result column="price" property="price" jdbcType="VARCHAR" />
<result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="INTEGER"/>
<result column="state" property="state" jdbcType="VARCHAR" />
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -58,8 +58,8 @@
<result column="unit" property="unit" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="tname" property="tname" jdbcType="VARCHAR"/>
<result column="mcode" property="mcode" jdbcType="INTEGER"/>
<result column="bmcode" property="bmcode" jdbcType="INTEGER"/>
<result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="bmcode" property="bmcode" jdbcType="VARCHAR"/>
<result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mtid" property="mtid" jdbcType="INTEGER"/>
@ -313,6 +313,13 @@
where id = #{id}
</select>
<select id="findMaterialByType" resultMap="materialMap" parameterType="long">
select
<include refid="allColumns"/>
from material m
where m.type_id = #{oldId}
</select>
<!-- 根据主键查询数据 -->
<select id="findMaterialByIds" resultMap="materialMap" parameterType="list">

34
target/classes/com/dreamchaser/depository_manage/mapper/MaterialTypeMapper.xml

@ -9,10 +9,13 @@
<id column="id" property="id" jdbcType="INTEGER" />
<result column="tname" property="tname" jdbcType="VARCHAR" />
<result column="introduce" property="introduce" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="INTEGER"/>
<result column="parentId" property="parentId" jdbcType="INTEGER"/>
<result column="oldId" property="oldId" jdbcType="INTEGER"/>
</resultMap>
<!-- 表查询字段 -->
<sql id="allColumns">
mt.id, mt.tname, mt.introduce, mt.state,mt.parentId
mt.id, mt.tname, mt.introduce, mt.state,mt.parentId,mt.oldId
</sql>
<!-- This code was generated by TableGo tools, mark 2 end. -->
@ -46,6 +49,9 @@
<if test="parentId != null">
and mt.parentId = #{parentId}
</if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4
</select>
<!-- 根据条件参数查询数据列表 -->
@ -65,6 +71,9 @@
<if test="parentId != null">
and mt.parentId = #{parentId}
</if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4
<if test="begin != null and size != null">
@ -79,8 +88,15 @@
FROM material_type mt WHERE mt.id = #{id}
</select>
<!-- 根据物料类型id查询数据 -->
<select id="findMaterialTypeNameByOldId" resultType="string" parameterType="long">
SELECT
mt.tname
FROM material_type mt WHERE mt.oldId = #{oldId}
</select>
<!-- 根据父类查询数据 -->
<select id="findMaterialTypeByParent" resultMap="materialTypeMap" parameterType="int">
<select id="findMaterialTypeByParent" resultMap="materialTypeMap" parameterType="long">
SELECT
<include refid="allColumns" />
FROM material_type mt
@ -93,6 +109,13 @@
<include refid="allColumns" />
FROM material_type mt WHERE mt.id = #{id} and mt.state != 3 and mt.state != 4
</select>
<!-- 根据主键查询数据 -->
<select id="findMaterialTypeByOldId" resultMap="materialTypeMap" parameterType="long">
SELECT
<include refid="allColumns" />
FROM material_type mt WHERE mt.oldId = #{oldId} and mt.state != 3 and mt.state != 4
</select>
<!-- 根据主键查询数据
<select id="findMaterialTypeByIds" resultMap="materialTypeMap" parameterType="list">
SELECT
@ -107,12 +130,13 @@
<!-- 插入数据 -->
<insert id="insertMaterialType" parameterType="map">
INSERT INTO material_type (
id, tname, introduce,parentId
id, tname, introduce,parentId,oldId
) VALUES (
#{id},
#{tname},
#{introduce},
#{parentId}
#{parentId},
#{oldId}
)
</insert>
@ -218,6 +242,6 @@
<if test="oldState != null">
and state = #{oldState}
</if>
and state != 3 and mt.state != 4
and state != 3 and state != 4
</update>
</mapper>

1
target/classes/templates/pages/application/application-in.html

@ -460,6 +460,7 @@
var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
var id = barCodeInput.id;
$("#"+id).remove();
$("#barCode").remove();
// barCodeInput.style = "display:none";
var idNumber = materialId.name.split("mid")[1];
var barCodeSelect = `

3
target/classes/templates/pages/application/application-in_scanQrCode.html

@ -70,9 +70,6 @@
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
提交成功
</div>
<div style="text-align: center;margin-top: 50px;">
<button class="layui-btn next">再填写一次</button>
</div>
</div>
</form>

32
target/classes/templates/pages/application/application-out.html

@ -404,8 +404,12 @@
var objId = parent.id.split("cardItem")[1];
var children = parent.childNodes[5];
var materialItem = children.childNodes[3].childNodes[1].childNodes;
var barCodeChildren = parent.childNodes[9];
var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3];
// 条形码条码
var barCodeItem = barCodeChildren.childNodes[3];
var req = {};
req.code = code;
req.type = "out";
@ -423,10 +427,34 @@
materialId.value = "";
obj.value = "";
$('#place'+objId).empty();
}else{
req.mid = d.id;
}else
{
materialName.value = d.mname;
materialId.value = d.id;
// 获取物料与条形码的对应关系
var materialAndBarCodeList = d["materialAndBarCodeList"];
if (materialAndBarCodeList.length > 0) {
// 如果有对应的条形码
var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
console.log(barCodeItem)
var id = barCodeInput.id;
$("#" + id).remove();
$("#barCode").remove();
// barCodeInput.style = "display:none";
var idNumber = materialId.name.split("mid")[1];
var barCodeSelect = `
<select id=` + "barCode" + idNumber + ` name=` + "barCode" + idNumber + `>
</select>`;
$("#" + barCodeImg.id).before(barCodeSelect);
form.render();
$.each(materialAndBarCodeList, function (index, item) {
$("#barCode" + idNumber).append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素
});
form.render();
}
}
}
});

34
target/classes/templates/pages/chart/chart-in_back.html

@ -284,7 +284,7 @@
legend: {},
tooltip: {
trigger: 'axis',
showContent: false
showContent: true
},
dataset: {
source: []
@ -293,21 +293,6 @@
yAxis: {gridIndex: 0},
grid: {top: '55%'},
series: [
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{
type: 'pie',
id: 'pie',
radius: '30%',
center: ['50%', '25%'],
label: {
formatter: '{b}: {@8月} ({d}%)'
},
encode: {
itemName: 'product',
value: '8月',
tooltip: '8月'
}
}
]
};
@ -329,6 +314,7 @@
success: function (result) {
layer.close(this.layerIndex);
if (result.code === 0) {
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
@ -387,10 +373,14 @@
}
for (let i = 0; i < result.data.depository_data.mapData.mapDataList.length; i++) {
optionMap.dataset.source.push(result.data.depository_data.mapData.mapDataList[i])
optionMap.series.push({type: 'line', smooth: true, seriesLayoutBy: 'row'})
optionMap.dataset.source.push(result.data.depository_data.mapData.mapDataList[i]);
if(i < result.data.depository_data.mapData.mapDataList.length - 1) {
optionMap.series.push({type: 'line', smooth: true, seriesLayoutBy: 'row'})
}
}
var month = new Date().getMonth() + 1;
optionMap.series.push(
{
type: 'pie',
@ -398,12 +388,12 @@
radius: '30%',
center: ['50%', '25%'],
label: {
formatter: '{b}: {@8月} ({d}%)'
formatter: '{b}: {@'+month+'月} ({d}%)'
},
encode: {
itemName: 'product',
value: '8月',
tooltip: '8月'
value: month+'月',
tooltip: month+'月'
}
}
);
@ -470,7 +460,7 @@
echartsMap.setOption(optionMap);
}
}
})
});
// echarts 窗口缩放自适应

10
target/classes/templates/pages/material/material-add.html

@ -58,19 +58,13 @@
name="version" lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">存货编码:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写存货编码" class="layui-input" id="code"
name="code" lay-verify="required"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">物料类型:</label>
<div class="layui-input-block">
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly
lay-verify="required"/>
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="materialTypeId" class="layui-input" style="display: none" lay-verify="required"/>
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="typeId" class="layui-input" style="display: none" lay-verify="required"/>
</div>
</div>

5
target/classes/templates/pages/material/material-out.html

@ -335,12 +335,13 @@
layer.closeAll('loading'); //关闭loading
//如果上传成功
console.log(res);
var re = "";
for (let i = 0; i < res.data.errMsg.length; i++) {
var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>"
re += show
}
if(res.code == 200){
var re = ""
if(res.code === 200){
for (let i = 0; i < res.data.dataList.length; i++) {
var mname = res.data.dataList[i]["mname"];
var code = res.data.dataList[i]["code"] == null || res.data.dataList[i]["code"] == undefined ?"":res.data.dataList[i]["code"];

4
target/classes/templates/pages/material/selectType.html

@ -22,8 +22,8 @@
,data: []
,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩
,click: function(obj){
$("#openSonByMateralType",window.parent.document).val(obj.data.title)
$("#materialTypeId",window.parent.document).val(obj.data.id)
$("#openSonByMateralType",window.parent.document).val(obj.data.title);
$("#materialTypeId",window.parent.document).val(obj.data.id);
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);

22
target/classes/templates/pages/materialtype/materialType_edit.html

@ -34,10 +34,8 @@
<div class="layui-form-item">
<label class="layui-form-label">父级类型:</label>
<div class="layui-input-block">
<select name="parentId" >
<option value="">请选择类型</option>
<option th:each="materialType,iterStar:${materialTypes}" th:value="${materialType?.getId()}" th:text="${materialType?.getTname()}" th:selected="${materialType.getId() == record.getParentId()}" >顶级公司</option>
</select>
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly th:value="${parentType == null ?'': parentType.getTname()}" />
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="parentId" class="layui-input" th:value="${parentType == null ?'' :parentType.getOldId()}" style="display: none" />
</div>
</div>
<div class="layui-form-item" style="display: none">
@ -57,6 +55,22 @@
<script>
layui.use('form', function(){
var form = layui.form, $ = layui.$;
$('#openSonByMateralType').on('click', function(){
layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/selectType',
});
});
//提交
form.on('submit(formDemo)', function(data){
data = data.field

18
target/classes/templates/pages/materialtype/materialType_view.html

@ -110,7 +110,8 @@
defaultToolbar: ['filter', 'exports', 'print'],
cols: [ [
{type: "checkbox", width: 50},
{field: 'id', width: 100, title: '类型编号', sort: true},
{field: 'id', width: 100, title: 'id', sort: true},
{field: 'oldId', width: 100, title: '类型编号', sort: true},
{field: 'tname', width: 120, title: '类型名称'},
{field: 'introduce',width: 200,title: '类型介绍'},
{field:'state', title:'状态', minWidth: 80, templet: '#switchTpl'},
@ -122,6 +123,7 @@
skin: 'line',
done:function () {
$("[data-field='id']").css('display','none');
$("[data-field='oldId']").css('display','none');
}
});
@ -232,7 +234,7 @@
}
for (let i = 0; i < res.data.dataList.length; i++) {
var tname = res.data.dataList[i]["tname"];
var id = res.data.dataList[i]["id"];
var id = res.data.dataList[i]["oldId"];
var parentId = res.data.dataList[i]["parentId"] == null?"":res.data.dataList[i]["parentId"];
var introduce = res.data.dataList[i]["introduce"] == null?"":res.data.dataList[i]["introduce"];
var show = "<p style='color: #00FF00'>"+tname + " "+ id+" " +parentId+"成功" +"</p>"
@ -356,7 +358,7 @@
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/findMaterialTypeByParentId?parentId='+data.id
content: '/findMaterialTypeByParentId?parentId='+data.oldId
});
$(window).on("resize", function () {
layer.full(index);
@ -433,12 +435,12 @@
//监听状态操作
form.on('switch(changeState)', function(obj){
var req = new Map
var req = new Map;
if(obj.elem.checked){
req["state"] = 1
req["state"] = 1;
}
req["id"] = this.value
var hasMaterial = false
req["id"] = this.value;
var hasMaterial = false;
if(req["state"] == undefined){ //如果禁用
$.ajax({
url:"/materialType/findMaterialByMaterialTypeId", // 判断该类型下是否有物品
@ -447,7 +449,7 @@
data:JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: function (data) {
hasMaterial = data.data
hasMaterial = data.data;
if(hasMaterial){ // 如果有物品
layer.confirm('该种类下还有物品,确定禁用?', {
btn: ['禁用','取消'] //按钮

Loading…
Cancel
Save