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. 49
      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. 32
      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("quantity",quantity.toString());
map.put("price",map.get("price").toString()); map.put("price",map.get("price").toString());
map.put("applicantId",userToken.getId()); 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"); String type = (String) map.get("type");
Integer success = 0; Integer success = 0;
if("in".equals(type)){ 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){ public RestResponse realDeleteMaterialType(@RequestBody Map<String,Object> map){
if (map.containsKey("id")){ if (map.containsKey("id")){
Integer id= ObjectFormatUtil.toInteger(map.get("id")); Integer id= ObjectFormatUtil.toInteger(map.get("id"));
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(id);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
RealDeleteSonDepository(id.toString()); RealDeleteSonDepository(materialTypeById.getOldId().toString());
} }
}).start(); }).start();
return CrudUtil.deleteHandle(materialTypeService.deleteMaterialTypeById(id),1); return CrudUtil.deleteHandle(materialTypeService.deleteMaterialTypeById(id),1);
}else if (map.containsKey("ids")){ }else if (map.containsKey("ids")){
List<Integer> ids=(List<Integer>) map.get("ids"); List<Integer> ids=(List<Integer>) map.get("ids");
for (int i = 0; i < ids.size(); i++) { 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() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
RealDeleteSonDepository(id); RealDeleteSonDepository(materialTypeById.getOldId().toString());
} }
}).start(); }).start();
} }
@ -108,9 +110,10 @@ public class MaterialTypeController {
// 获取当前仓库所有子仓库 // 获取当前仓库所有子仓库
List<MaterialType> materialTypeByCondition = materialTypeService.findMaterialTypeByCondition(param); List<MaterialType> materialTypeByCondition = materialTypeService.findMaterialTypeByCondition(param);
for (int i = 0; i < materialTypeByCondition.size(); i++) { for (int i = 0; i < materialTypeByCondition.size(); i++) {
Integer id = materialTypeByCondition.get(i).getId(); // 获取当前物料id MaterialType materialType = materialTypeByCondition.get(i);
RealDeleteSonDepository(id.toString()); // 递归查询物料类型 Long oldId = materialType.getOldId();// 获取当前物料id
materialTypeService.deleteMaterialTypeById(id); // 删除物料类型 RealDeleteSonDepository(oldId.toString()); // 递归查询物料类型
materialTypeService.deleteMaterialTypeById(materialType.getId()); // 删除物料类型
} }
} }
@ -123,21 +126,23 @@ public class MaterialTypeController {
public RestResponse deleteMaterialType(@RequestBody Map<String,Object> map){ public RestResponse deleteMaterialType(@RequestBody Map<String,Object> map){
if (map.containsKey("id")){ if (map.containsKey("id")){
Integer id= ObjectFormatUtil.toInteger(map.get("id")); Integer id= ObjectFormatUtil.toInteger(map.get("id"));
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(id);
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
UpdateSonState(id.toString(),3); UpdateSonState(materialTypeById.getOldId().toString(),3);
} }
}).start(); }).start();
return CrudUtil.deleteHandle(materialTypeService.changeStateToDeletedById(id),1); return CrudUtil.deleteHandle(materialTypeService.changeStateToDeletedById(id),1);
}else if (map.containsKey("ids")){ }else if (map.containsKey("ids")){
List<Integer> ids=(List<Integer>) map.get("ids"); List<Integer> ids=(List<Integer>) map.get("ids");
for (int i = 0; i < ids.size(); i++) { 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() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
UpdateSonState(id,3); UpdateSonState(materialTypeById.getOldId().toString(),3);
} }
}).start(); }).start();
} }
@ -172,11 +177,13 @@ public class MaterialTypeController {
Boolean allSonDepository = false; Boolean allSonDepository = false;
if(map.containsKey("id")){ if(map.containsKey("id")){
Integer materialTypeId = ObjectFormatUtil.toInteger(map.get("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")){ }else if(map.containsKey("ids")){
List<Integer> ids = (List<Integer>) map.get("ids"); List<Integer> ids = (List<Integer>) map.get("ids");
for (int i = 0; i < ids.size(); i++) { 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){ if(allSonDepository){
break; break;
} }
@ -210,8 +217,8 @@ public class MaterialTypeController {
} }
List<MaterialType> materialTypeByCondition = materialTypeService.findMaterialTypeByCondition(param); List<MaterialType> materialTypeByCondition = materialTypeService.findMaterialTypeByCondition(param);
for (int i = 0; i < materialTypeByCondition.size(); i++) { for (int i = 0; i < materialTypeByCondition.size(); i++) {
if(!findMaterialByMaterialType(materialTypeByCondition.get(i).getId().toString())){ if(!findMaterialByMaterialType(materialTypeByCondition.get(i).getOldId().toString())){
findAllSonMaterialType(materialTypeByCondition.get(i).getId().toString()); findAllSonMaterialType(materialTypeByCondition.get(i).getOldId().toString());
}else{ }else{
return true; return true;
} }
@ -249,10 +256,11 @@ public class MaterialTypeController {
} }
int state = ((int)map.get("state")); int state = ((int)map.get("state"));
String id = (String) map.get("id"); String id = (String) map.get("id");
MaterialType materialTypeById = materialTypeService.findMaterialTypeById(ObjectFormatUtil.toInteger(id));
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
UpdateSonState(id, state); UpdateSonState(materialTypeById.getOldId().toString(), state);
} }
}).start(); }).start();
return CrudUtil.postHandle(materialTypeService.updateMaterialType(map), 1); return CrudUtil.postHandle(materialTypeService.updateMaterialType(map), 1);
@ -273,9 +281,8 @@ public class MaterialTypeController {
for (int i = 0; i < materialTypeByCondition.size(); i++) { for (int i = 0; i < materialTypeByCondition.size(); i++) {
MaterialType materialType = materialTypeByCondition.get(i); MaterialType materialType = materialTypeByCondition.get(i);
int materialTypeId = materialType.getId(); int materialTypeId = materialType.getId();
Map<String,Object> newMap = new HashMap<>(); Long oldId = materialType.getOldId();
newMap.put("parentId",materialTypeId); UpdateSonState(String.valueOf(oldId),state);
UpdateSonState(String.valueOf(materialTypeId),state);
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("id",materialTypeId); map.put("id",materialTypeId);
map.put("state",state); 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") @GetMapping("/materialType_detail")
public ModelAndView materialType_detail(Integer id) { public ModelAndView materialType_detail(Integer id) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/materialtype/materialType_edit.html"); mv.setViewName("pages/materialtype/materialType_edit");
if (id != null) { if (id != null) {
mv.addObject("record", materialTypeService.findMaterialTypeById(id)); MaterialType record = materialTypeService.findMaterialTypeById(id);
mv.addObject("materialTypes", materialTypeService.findMaterialTypeAll()); MaterialType parentType = materialTypeService.findMaterialTypeByOldId(record.getParentId());
mv.addObject("record", record);
mv.addObject("parentType", parentType);
} else { } else {
throw new MyException("缺少必要参数!"); throw new MyException("缺少必要参数!");
} }
@ -1685,7 +1687,7 @@ public class PageController {
public ModelAndView applicationInByMaterial(HttpServletRequest request){ public ModelAndView applicationInByMaterial(HttpServletRequest request){
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
UserByPort userByPort = (UserByPort) request.getAttribute("userToken"); 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()); redisTemplate.delete("temporaryValueForMaterial"+userByPort.getNumber());
JSONObject jsonObject = JSONObject.parseObject(scanQrCodeValue); JSONObject jsonObject = JSONObject.parseObject(scanQrCodeValue);
JSONArray mids = (JSONArray) jsonObject.get("mids"); 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 @Override
public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { 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) { if(material == null) {
throw new RuntimeException("没有该物料"); throw new RuntimeException("没有该物料");
} }

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

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

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

@ -15,11 +15,11 @@ public class ExcelInfoByInventory {
/** 物料编号 */ /** 物料编号 */
@ExcelProperty("EAS编号") @ExcelProperty("EAS编号")
private Integer id; private Long id;
/** 存货编码 */ /** 存货编码 */
@ExcelProperty(value = "编码",converter = ExcelMaterialCodeConverter.class) @ExcelProperty(value = "编码",converter = ExcelMaterialCodeConverter.class)
private Long code; private String code;
/** 仓库名称 */ /** 仓库名称 */
@ExcelProperty(value = "仓库编码",converter = ExcelDepositoryInfoConverter.class) @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 = "编码") @ExcelProperty(value = "编码")
private Integer id; private Long oldId;
/** /**
* 物料上级编码 * 物料上级编码
*/ */
@ExcelProperty(value = "上级编码") @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; private Double amounts;
/** 物料种类id */ /** 物料种类id */
private Integer typeId; private Long typeId;
/** 物料状态 */ /** 物料状态 */
private Integer state; private Integer state;
/** 存货编码 */ /** 存货编码 */
private BigInteger code; private String code;
/** 规格型号 */ /** 规格型号 */
private String version; 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 * 物料id
*/ */

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

@ -1,11 +1,14 @@
package com.dreamchaser.depository_manage.entity; package com.dreamchaser.depository_manage.entity;
import lombok.Data;
/** /**
* material_type * material_type
* *
* @author bianj * @author bianj
* @version 1.0.0 2021-05-20 * @version 1.0.0 2021-05-20
*/ */
@Data
public class MaterialType { public class MaterialType {
/** 版本号 */ /** 版本号 */
private static final long serialVersionUID = 5895240732960572981L; private static final long serialVersionUID = 5895240732960572981L;
@ -27,93 +30,11 @@ public class MaterialType {
/** /**
* 父级编号 * 父级编号
*/ */
private Integer parentId; private Long 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;
}
/** /**
* 获取类型介绍 * 金蝶id
*
* @return 类型介绍
*/ */
public String getIntroduce() { private Long oldId;
return this.introduce;
}
/**
* 设置类型介绍
*
* @param introduce
* 类型介绍
*/
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
/**
* 获取类型状态
* @return 类型状态
*/
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;
}
/* This code was generated by TableGo tools, mark 2 end. */ /* 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 * @return
*/ */
Integer deleteBarCodeAndMaterial(Map<String,Object> map); 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="price" property="price" jdbcType="DOUBLE" />
<result column="type_id" property="typeId" jdbcType="INTEGER" /> <result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" 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="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/> <result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/> <result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -29,8 +29,8 @@
<result column="quantity" property="quantity" jdbcType="VARCHAR" /> <result column="quantity" property="quantity" jdbcType="VARCHAR" />
<result column="price" property="price" jdbcType="VARCHAR" /> <result column="price" property="price" jdbcType="VARCHAR" />
<result column="type_id" property="typeId" jdbcType="INTEGER" /> <result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" /> <result column="state" property="state" jdbcType="VARCHAR" />
<result column="code" property="code" jdbcType="INTEGER"/> <result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/> <result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/> <result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/> <result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -58,8 +58,8 @@
<result column="unit" property="unit" jdbcType="VARCHAR"/> <result column="unit" property="unit" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/> <result column="version" property="version" jdbcType="VARCHAR"/>
<result column="tname" property="tname" jdbcType="VARCHAR"/> <result column="tname" property="tname" jdbcType="VARCHAR"/>
<result column="mcode" property="mcode" jdbcType="INTEGER"/> <result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="bmcode" property="bmcode" jdbcType="INTEGER"/> <result column="bmcode" property="bmcode" jdbcType="VARCHAR"/>
<result column="mid" property="mid" jdbcType="INTEGER"/> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mtid" property="mtid" jdbcType="INTEGER"/> <result column="mtid" property="mtid" jdbcType="INTEGER"/>
@ -313,6 +313,13 @@
where id = #{id} where id = #{id}
</select> </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"> <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); MaterialType findMaterialTypeById(Integer id);
/**
* 根据id查询物料类型
* @param oldId 物料类型id
* @return 物料类型对象
*/
MaterialType findMaterialTypeByOldId(Long oldId);
/** /**
* 根据id查询物料名称 * 根据id查询物料名称
* @param id 物料类型id * @param id 物料类型id
@ -42,6 +49,14 @@ public interface MaterialTypeMapper {
*/ */
String findMaterialTypeNameById(Integer id); String findMaterialTypeNameById(Integer id);
/**
* 根据物料类型查询物料名称
* @param oldId 物料类型id
* @return 物料名称
*/
String findMaterialTypeNameByOldId(Long oldId);
/** /**
* 根据条件查询物料类型数目 * 根据条件查询物料类型数目
* @param map 条件参数map * @param map 条件参数map
@ -117,6 +132,6 @@ public interface MaterialTypeMapper {
* @param parentId * @param parentId
* @return * @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" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="tname" property="tname" jdbcType="VARCHAR" /> <result column="tname" property="tname" jdbcType="VARCHAR" />
<result column="introduce" property="introduce" 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> </resultMap>
<!-- 表查询字段 --> <!-- 表查询字段 -->
<sql id="allColumns"> <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> </sql>
<!-- This code was generated by TableGo tools, mark 2 end. --> <!-- This code was generated by TableGo tools, mark 2 end. -->
@ -46,6 +49,9 @@
<if test="parentId != null"> <if test="parentId != null">
and mt.parentId = #{parentId} and mt.parentId = #{parentId}
</if> </if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4 and mt.state != 3 and mt.state != 4
</select> </select>
<!-- 根据条件参数查询数据列表 --> <!-- 根据条件参数查询数据列表 -->
@ -65,6 +71,9 @@
<if test="parentId != null"> <if test="parentId != null">
and mt.parentId = #{parentId} and mt.parentId = #{parentId}
</if> </if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4 and mt.state != 3 and mt.state != 4
<if test="begin != null and size != null"> <if test="begin != null and size != null">
@ -79,8 +88,15 @@
FROM material_type mt WHERE mt.id = #{id} FROM material_type mt WHERE mt.id = #{id}
</select> </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 SELECT
<include refid="allColumns" /> <include refid="allColumns" />
FROM material_type mt FROM material_type mt
@ -93,6 +109,13 @@
<include refid="allColumns" /> <include refid="allColumns" />
FROM material_type mt WHERE mt.id = #{id} and mt.state != 3 and mt.state != 4 FROM material_type mt WHERE mt.id = #{id} and mt.state != 3 and mt.state != 4
</select> </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 id="findMaterialTypeByIds" resultMap="materialTypeMap" parameterType="list">
SELECT SELECT
@ -107,12 +130,13 @@
<!-- 插入数据 --> <!-- 插入数据 -->
<insert id="insertMaterialType" parameterType="map"> <insert id="insertMaterialType" parameterType="map">
INSERT INTO material_type ( INSERT INTO material_type (
id, tname, introduce,parentId id, tname, introduce,parentId,oldId
) VALUES ( ) VALUES (
#{id}, #{id},
#{tname}, #{tname},
#{introduce}, #{introduce},
#{parentId} #{parentId},
#{oldId}
) )
</insert> </insert>
@ -218,6 +242,6 @@
<if test="oldState != null"> <if test="oldState != null">
and state = #{oldState} and state = #{oldState}
</if> </if>
and state != 3 and mt.state != 4 and state != 3 and state != 4
</update> </update>
</mapper> </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 * 仓库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 * @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 对应记录 * @return 对应记录
*/ */
MaterialType findMaterialTypeById(Integer id); MaterialType findMaterialTypeById(Integer id);
/**
* 根据OldId查询对应物料类型
* @param OldId
* @return 对应记录
*/
MaterialType findMaterialTypeByOldId(Long OldId);
/** /**
* 根据主键id将物料类型状态修改为删除 * 根据主键id将物料类型状态修改为删除

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

@ -169,8 +169,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
@Override @Override
public Integer insertApplicationOutRecord(Map<String, Object> map, UserByPort userToken) { public Integer insertApplicationOutRecord(Map<String, Object> map, UserByPort userToken) {
String placeId = (String) map.get("placeId"); String placeId = "";
if ("".equals(placeId) || "0".equals(placeId) || placeId == null) { Object temp = map.get("placeId");
if(temp != null){
placeId = temp.toString();
}
if (placeId == null || "".equals(placeId) || "0".equals(placeId) ) {
map.put("placeId", 0); map.put("placeId", 0);
} }
Double quantity = Double.parseDouble((String) map.get("quantity")); Double quantity = Double.parseDouble((String) map.get("quantity"));
@ -272,7 +276,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
if (placeById.getMax() - placeById.getQuantity() > quantity) { if (placeById.getMax() - placeById.getQuantity() > quantity) {
// 如果当前库位还能存放 // 如果当前库位还能存放
// 入库 // 入库
Integer integer = applicationIn(map); Integer integer = applicationIn(map);
if (integer != 1) { if (integer != 1) {
@ -1743,7 +1746,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map<String,Object> param = new HashMap<>(); Map<String,Object> param = new HashMap<>();
List<MaterialType> result = new ArrayList<>(); List<MaterialType> result = new ArrayList<>();
result.add(mt); result.add(mt);
param.put("parentId",mt.getId()); param.put("parentId",mt.getOldId());
// 获取当前父类的子类 // 获取当前父类的子类
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param); List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param);
if(materialTypeByCondition.size() > 0){ 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++) { for (int i = 0; i < depositoryAndRole.size(); i++) {
RoleAndDepository roleAndDepository = depositoryAndRole.get(i); RoleAndDepository roleAndDepository = depositoryAndRole.get(i);
// 如果重复则跳过 // 如果重复则跳过
if (depositoryListId.get(i).compareTo(roleAndDepository.getDepositoryId()) == 0) { if (depositoryListId.contains(roleAndDepository.getDepositoryId())) {
continue; continue;
} }
depositoryListId.add(roleAndDepository.getDepositoryId()); depositoryListId.add(roleAndDepository.getDepositoryId());
@ -558,4 +558,6 @@ public class DepositoryServiceImpl implements DepositoryService {
return flag; 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.io.File;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.Future;
import static com.dreamchaser.depository_manage.utils.FileUtil.uploadFile; 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++) { for (int i = 0; i < excelVos.size(); i++) {
Map<String, Object> insert = new HashMap<>(); Map<String, Object> insert = new HashMap<>();
insert.put("id", excelVos.get(i).getId()); ExcelInfoByMT info = excelVos.get(i);
insert.put("tname", excelVos.get(i).getTname()); insert.put("oldId", info.getOldId());
insert.put("introduce", excelVos.get(i).getIntroduce()); insert.put("tname", info.getTname());
if (excelVos.get(i).getParentId() == null) { insert.put("introduce", info.getIntroduce());
if (info.getParentId() == null) {
insert.put("materialTypeId", 0); insert.put("materialTypeId", 0);
} else { } else {
insert.put("materialTypeId", excelVos.get(i).getParentId()); insert.put("materialTypeId", info.getParentId());
} }
materialTypeService.insertMaterialType(insert); materialTypeService.insertMaterialType(insert);
success.add(excelVos.get(i)); success.add(info);
} }
log.info("【批量添加】批量添加数据:{}", JSON.toJSONString(excelVos)); log.info("【批量添加】批量添加数据:{}", JSON.toJSONString(excelVos));
@ -270,7 +272,7 @@ public class ExcelServiceImpl implements ExcelService {
// 4.通过线程池开启一个线程去执行数据库操作,主线程继续往下执行 // 4.通过线程池开启一个线程去执行数据库操作,主线程继续往下执行
// 4.1开启一个线程 // 4.1开启一个线程
TaskCenterUtil taskCenterUtil = TaskCenterUtil.getTaskCenterUtil(); TaskCenterUtil taskCenterUtil = TaskCenterUtil.getTaskCenterUtil();
taskCenterUtil.submitTask(() -> { Future<Object> objectFuture = taskCenterUtil.submitTask(() -> {
List<Object> success = new ArrayList<>(); List<Object> success = new ArrayList<>();
Map<String, Object> returnResult = new HashMap<>(); Map<String, Object> returnResult = new HashMap<>();
for (int i = 0; i < excelVos.size(); i++) { for (int i = 0; i < excelVos.size(); i++) {
@ -285,7 +287,7 @@ public class ExcelServiceImpl implements ExcelService {
insert.put("code", materialByCode.getCode()); insert.put("code", materialByCode.getCode());
insert.put("unit", materialByCode.getUnit()); insert.put("unit", materialByCode.getUnit());
insert.put("texture", materialByCode.getTexture()); 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())); insert.put("quantity", String.valueOf(ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()) + materialByCode.getQuantity()));
// 如果模板中总金额未填写 // 如果模板中总金额未填写
if (excelVos.get(i).getAmounts() == null || "".equals(excelVos.get(i).getAmounts())) { 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(); String placeCode = excelInfoByInventories.get(i).getDepositoryCode();
Boolean isNew = (Boolean) insert.get("isNew"); Boolean isNew = (Boolean) insert.get("isNew");
if(isNew) { if (isNew) {
// 如果是新插入物料 // 如果是新插入物料
if (placeCode == null || placeCode.isEmpty() || "0".equals(placeCode)) { // 如果没有输入库位 if (placeCode == null || placeCode.isEmpty() || "0".equals(placeCode)) { // 如果没有输入库位
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
@ -331,9 +333,9 @@ public class ExcelServiceImpl implements ExcelService {
placeService.addMaterialOnPlace(param); placeService.addMaterialOnPlace(param);
} else { } else {
// 如果输入的库位不是默认库位 // 如果输入的库位不是默认库位
Map<String,Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("did",depositoryId); param.put("did", depositoryId);
param.put("code",placeCode); param.put("code", placeCode);
// 获取要导入的库位 // 获取要导入的库位
Place placeByCondition = placeService.findPlaceByCondition(param).get(0); Place placeByCondition = placeService.findPlaceByCondition(param).get(0);
// 修改库位物料数量 // 修改库位物料数量
@ -342,9 +344,9 @@ public class ExcelServiceImpl implements ExcelService {
placeService.UpdatePlace(placeByCondition); placeService.UpdatePlace(placeByCondition);
// 如果没有对应关系 // 如果没有对应关系
param.put("pid",placeByCondition.getId()); param.put("pid", placeByCondition.getId());
param.put("mid",insert.get("id")); param.put("mid", insert.get("id"));
param.put("quantity",ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity())); param.put("quantity", ObjectFormatUtil.toInteger(excelVos.get(i).getQuantity()));
// 添加对应关系 // 添加对应关系
placeService.addMaterialOnPlace(param); placeService.addMaterialOnPlace(param);
} }

49
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("price",price);
map.put("amounts",quantity * price); map.put("amounts",quantity * price);
} }
// 获取当前类型
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); materialMapper.addBarCodeAndMcode(map);
}
return materialMapper.insertMaterial(map); return materialMapper.insertMaterial(map);
} }
@ -96,8 +110,8 @@ public class MaterialServiceImpl implements MaterialService {
map.put("price",price); map.put("price",price);
} }
if(map.containsKey("materialTypeId")) { if(map.containsKey("materialTypeId")) {
Object materialTypeId = map.get("materialTypeId"); map.put("typeId", map.get("materialTypeId"));
map.put("typeId", materialTypeId); map.remove("materialTypeId");
} }
String barCode = (String) map.get("barCode"); String barCode = (String) map.get("barCode");
if(!"0".equals(barCode)) { if(!"0".equals(barCode)) {
@ -223,7 +237,7 @@ public class MaterialServiceImpl implements MaterialService {
* @return * @return
*/ */
@Override @Override
public Material findMaterialByCode(Long code) { public Material findMaterialByCode(String code) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("code",code); map.put("code",code);
Material material = materialMapper.findMaterialByCondition(map).get(0); Material material = materialMapper.findMaterialByCondition(map).get(0);
@ -363,7 +377,7 @@ public class MaterialServiceImpl implements MaterialService {
m.setDepositoryName(depositoryMapper.findDepositoryNameById(depositoryId)); m.setDepositoryName(depositoryMapper.findDepositoryNameById(depositoryId));
m.setWarehouseManager(depositoryMapper.findUserNameByDepositoryId(depositoryId)); m.setWarehouseManager(depositoryMapper.findUserNameByDepositoryId(depositoryId));
} }
m.setTypeName(materialTypeMapper.findMaterialTypeNameById(material.getTypeId())); m.setTypeName(materialTypeMapper.findMaterialTypeNameByOldId(material.getTypeId()));
result.add(m); result.add(m);
} }
return result; return result;
@ -557,7 +571,7 @@ public class MaterialServiceImpl implements MaterialService {
for (int i = 0; i < materialTypeNoParent.size(); i++) { for (int i = 0; i < materialTypeNoParent.size(); i++) {
// 获取当前顶级类别 // 获取当前顶级类别
MaterialType mt = materialTypeNoParent.get(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<>(); Map<String, Object> stringObjectMap = new HashMap<>();
if(childForMaterialTypeByParent != null) { if(childForMaterialTypeByParent != null) {
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent);
@ -583,7 +597,7 @@ public class MaterialServiceImpl implements MaterialService {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
MaterialType mt = materialTypeNoParent.get(i); MaterialType mt = materialTypeNoParent.get(i);
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> { 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<>(); Map<String, Object> stringObjectMap = new HashMap<>();
if (childForMaterialTypeByParent != null) { if (childForMaterialTypeByParent != null) {
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent);
@ -610,7 +624,7 @@ public class MaterialServiceImpl implements MaterialService {
if(mt != null) { if(mt != null) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname()); map.put("title", mt.getTname());
map.put("id", mt.getId()); map.put("id", mt.getOldId());
map.put("children",children); map.put("children",children);
return map; return map;
} }
@ -623,21 +637,21 @@ public class MaterialServiceImpl implements MaterialService {
public List<Object> AddMaterialByType(MaterialType mt,String mname,String adminorg){ public List<Object> AddMaterialByType(MaterialType mt,String mname,String adminorg){
if(mt != null) { if(mt != null) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("materialTypeId", mt.getId()); param.put("materialTypeId", mt.getOldId());
// 获取当前部门管理的仓库
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(adminorg);
List<Integer> dids = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
// 将仓库编号存储到列表中
dids.add(depository.getId());
}
List<Material> materialPByCondition = new ArrayList<>(); List<Material> materialPByCondition = new ArrayList<>();
// List<Material> materialByDepositorys = new ArrayList<>(); // List<Material> materialByDepositorys = new ArrayList<>();
if("".equals(adminorg)){ if("".equals(adminorg)){
// 获取当前类别下的物料 // 获取当前类别下的物料
materialPByCondition = materialMapper.findMaterialByCondition(param); materialPByCondition = materialMapper.findMaterialByCondition(param);
}else{ }else{
// 获取当前部门管理的仓库
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(adminorg);
// 获取当前仓库下的所有物料库存 // 获取当前仓库下的所有物料库存
List<Integer> dids = new ArrayList<>();
for (Depository depository : depositoryByAdminorg) {
// 将仓库编号存储到列表中
dids.add(depository.getId());
}
param.put("list",dids); param.put("list",dids);
materialPByCondition = materialMapper.findMaterialByDepositorysAndType(param); materialPByCondition = materialMapper.findMaterialByDepositorysAndType(param);
} }
@ -700,10 +714,9 @@ public class MaterialServiceImpl implements MaterialService {
} }
// 根据类别id获取子类 // 根据类别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<>(); Map<String,Object> param = new HashMap<>();
List<Object> result = new ArrayList<>(); List<Object> result = new ArrayList<>();
Map<String,Object> children = new HashMap<>();
param.put("parentId",id); param.put("parentId",id);
// 获取当前父类的子类 // 获取当前父类的子类
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param); List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param);
@ -711,7 +724,7 @@ public class MaterialServiceImpl implements MaterialService {
// 如果当前类别有子类 // 如果当前类别有子类
for (MaterialType mt : materialTypeByCondition) { 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; Map<String, Object> stringObjectMap = null;
if(childForMaterialTypeByParent == 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -33,6 +34,20 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
map.put("parentId",map.get("materialTypeId")); map.put("parentId",map.get("materialTypeId"));
map.remove("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); return materialTypeMapper.insertMaterialType(map);
} }
@ -130,6 +145,11 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
return materialTypeMapper.findMaterialTypeById(id); return materialTypeMapper.findMaterialTypeById(id);
} }
@Override
public MaterialType findMaterialTypeByOldId(Long OldId) {
return materialTypeMapper.findMaterialTypeByOldId(OldId);
}
/** /**
* 根据主键id将物料类型状态修改为删除 * 根据主键id将物料类型状态修改为删除
* @param id * @param id
@ -170,7 +190,7 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
for (int i = 0; i < materialTypeNoParent.size(); i++) { for (int i = 0; i < materialTypeNoParent.size(); i++) {
MaterialType mt = materialTypeNoParent.get(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); Map<String, Object> stringObjectMap = InitTreeMenus(mt,childForMaterialTypeByParent);
list.add(stringObjectMap); list.add(stringObjectMap);
} }
@ -182,7 +202,7 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
if(mt != null) { if(mt != null) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("title", mt.getTname()); map.put("title", mt.getTname());
map.put("id", mt.getId()); map.put("id", mt.getOldId());
map.put("children",children); map.put("children",children);
return map; return map;
} }
@ -204,17 +224,17 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
} }
// 根据id获取子类 // 根据id获取子类
public List<Object> findChildForMaterialTypeByParent(Integer id){ public List<Object> findChildForMaterialTypeByParent(Long Oldid){
Map<String,Object> param = new HashMap<>(); Map<String,Object> param = new HashMap<>();
List<Object> result = new ArrayList<>(); List<Object> result = new ArrayList<>();
Map<String,Object> children = new HashMap<>(); Map<String,Object> children = new HashMap<>();
param.put("parentId",id); param.put("parentId",Oldid);
// 获取当前父类的子类 // 获取当前父类的子类
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param); List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param);
if(materialTypeByCondition.size() > 0){ if(materialTypeByCondition.size() > 0){
for (int i = 0; i < materialTypeByCondition.size(); i++) { for (int i = 0; i < materialTypeByCondition.size(); i++) {
MaterialType mt = materialTypeByCondition.get(i); MaterialType mt = materialTypeByCondition.get(i);
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId()); List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId());
result.add(InitTreeMenus(mt,childForMaterialTypeByParent)); result.add(InitTreeMenus(mt,childForMaterialTypeByParent));
} }
return result; return result;

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

@ -460,6 +460,7 @@
var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
var id = barCodeInput.id; var id = barCodeInput.id;
$("#"+id).remove(); $("#"+id).remove();
$("#barCode").remove();
// barCodeInput.style = "display:none"; // barCodeInput.style = "display:none";
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
var barCodeSelect = ` 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 style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
提交成功 提交成功
</div> </div>
<div style="text-align: center;margin-top: 50px;">
<button class="layui-btn next">再填写一次</button>
</div>
</div> </div>
</form> </form>

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

@ -404,8 +404,12 @@
var objId = parent.id.split("cardItem")[1]; var objId = parent.id.split("cardItem")[1];
var children = parent.childNodes[5]; var children = parent.childNodes[5];
var materialItem = children.childNodes[3].childNodes[1].childNodes; var materialItem = children.childNodes[3].childNodes[1].childNodes;
var barCodeChildren = parent.childNodes[9];
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 条形码条码
var barCodeItem = barCodeChildren.childNodes[3];
var req = {}; var req = {};
req.code = code; req.code = code;
req.type = "out"; req.type = "out";
@ -423,10 +427,34 @@
materialId.value = ""; materialId.value = "";
obj.value = ""; obj.value = "";
$('#place'+objId).empty(); $('#place'+objId).empty();
}else{
req.mid = d.id; }else
{
materialName.value = d.mname; materialName.value = d.mname;
materialId.value = d.id; 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"/> name="version" lay-verify="required"/>
</div> </div>
</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"> <div class="layui-form-item">
<label class="layui-form-label">物料类型:</label> <label class="layui-form-label">物料类型:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly <input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly
lay-verify="required"/> 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>
</div> </div>

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

@ -335,12 +335,13 @@
layer.closeAll('loading'); //关闭loading layer.closeAll('loading'); //关闭loading
//如果上传成功 //如果上传成功
console.log(res);
var re = "";
for (let i = 0; i < res.data.errMsg.length; i++) { for (let i = 0; i < res.data.errMsg.length; i++) {
var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>" var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>"
re += show re += show
} }
if(res.code == 200){ if(res.code === 200){
var re = ""
for (let i = 0; i < res.data.dataList.length; i++) { for (let i = 0; i < res.data.dataList.length; i++) {
var mname = res.data.dataList[i]["mname"]; 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"]; 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: [] ,data: []
,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩 ,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩
,click: function(obj){ ,click: function(obj){
$("#openSonByMateralType",window.parent.document).val(obj.data.title) $("#openSonByMateralType",window.parent.document).val(obj.data.title);
$("#materialTypeId",window.parent.document).val(obj.data.id) $("#materialTypeId",window.parent.document).val(obj.data.id);
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index); parent.layer.close(index);

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

@ -34,10 +34,8 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">父级类型:</label> <label class="layui-form-label">父级类型:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="parentId" > <input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly th:value="${parentType == null ?'': parentType.getTname()}" />
<option value="">请选择类型</option> <input type="text" id="materialTypeId" placeholder="请选择物料类型" name="parentId" class="layui-input" th:value="${parentType == null ?'' :parentType.getOldId()}" style="display: none" />
<option th:each="materialType,iterStar:${materialTypes}" th:value="${materialType?.getId()}" th:text="${materialType?.getTname()}" th:selected="${materialType.getId() == record.getParentId()}" >顶级公司</option>
</select>
</div> </div>
</div> </div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
@ -57,6 +55,22 @@
<script> <script>
layui.use('form', function(){ layui.use('form', function(){
var form = layui.form, $ = layui.$; 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){ form.on('submit(formDemo)', function(data){
data = data.field data = data.field

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

@ -110,7 +110,8 @@
defaultToolbar: ['filter', 'exports', 'print'], defaultToolbar: ['filter', 'exports', 'print'],
cols: [ [ cols: [ [
{type: "checkbox", width: 50}, {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: 'tname', width: 120, title: '类型名称'},
{field: 'introduce',width: 200,title: '类型介绍'}, {field: 'introduce',width: 200,title: '类型介绍'},
{field:'state', title:'状态', minWidth: 80, templet: '#switchTpl'}, {field:'state', title:'状态', minWidth: 80, templet: '#switchTpl'},
@ -122,6 +123,7 @@
skin: 'line', skin: 'line',
done:function () { done:function () {
$("[data-field='id']").css('display','none'); $("[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++) { for (let i = 0; i < res.data.dataList.length; i++) {
var tname = res.data.dataList[i]["tname"]; 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 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 introduce = res.data.dataList[i]["introduce"] == null?"":res.data.dataList[i]["introduce"];
var show = "<p style='color: #00FF00'>"+tname + " "+ id+" " +parentId+"成功" +"</p>" var show = "<p style='color: #00FF00'>"+tname + " "+ id+" " +parentId+"成功" +"</p>"
@ -356,7 +358,7 @@
maxmin: true, maxmin: true,
shadeClose: true, shadeClose: true,
area: ['100%', '100%'], area: ['100%', '100%'],
content: '/findMaterialTypeByParentId?parentId='+data.id content: '/findMaterialTypeByParentId?parentId='+data.oldId
}); });
$(window).on("resize", function () { $(window).on("resize", function () {
layer.full(index); layer.full(index);
@ -433,12 +435,12 @@
//监听状态操作 //监听状态操作
form.on('switch(changeState)', function(obj){ form.on('switch(changeState)', function(obj){
var req = new Map var req = new Map;
if(obj.elem.checked){ if(obj.elem.checked){
req["state"] = 1 req["state"] = 1;
} }
req["id"] = this.value req["id"] = this.value;
var hasMaterial = false var hasMaterial = false;
if(req["state"] == undefined){ //如果禁用 if(req["state"] == undefined){ //如果禁用
$.ajax({ $.ajax({
url:"/materialType/findMaterialByMaterialTypeId", // 判断该类型下是否有物品 url:"/materialType/findMaterialByMaterialTypeId", // 判断该类型下是否有物品
@ -447,7 +449,7 @@
data:JSON.stringify(req), data:JSON.stringify(req),
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (data) { success: function (data) {
hasMaterial = data.data hasMaterial = data.data;
if(hasMaterial){ // 如果有物品 if(hasMaterial){ // 如果有物品
layer.confirm('该种类下还有物品,确定禁用?', { layer.confirm('该种类下还有物品,确定禁用?', {
btn: ['禁用','取消'] //按钮 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.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.*;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
@SpringBootTest @SpringBootTest
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
public class Test { public class Test {
@Autowired
QyWxOperationService qyWxOperationService;
@Autowired @Autowired
MaterialService materialService; MaterialService materialService;
@Autowired
DepositoryService depositoryService;
@org.junit.Test @org.junit.Test
public void test1() throws AesException, IOException, ParserConfigurationException, SAXException { 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="price" property="price" jdbcType="DOUBLE" />
<result column="type_id" property="typeId" jdbcType="INTEGER" /> <result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" 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="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/> <result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/> <result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -29,8 +29,8 @@
<result column="quantity" property="quantity" jdbcType="VARCHAR" /> <result column="quantity" property="quantity" jdbcType="VARCHAR" />
<result column="price" property="price" jdbcType="VARCHAR" /> <result column="price" property="price" jdbcType="VARCHAR" />
<result column="type_id" property="typeId" jdbcType="INTEGER" /> <result column="type_id" property="typeId" jdbcType="INTEGER" />
<result column="state" property="state" jdbcType="INTEGER" /> <result column="state" property="state" jdbcType="VARCHAR" />
<result column="code" property="code" jdbcType="INTEGER"/> <result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/> <result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="DOUBLE"/> <result column="amounts" property="amounts" jdbcType="DOUBLE"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/> <result column="unit" property="unit" jdbcType="VARCHAR"/>
@ -58,8 +58,8 @@
<result column="unit" property="unit" jdbcType="VARCHAR"/> <result column="unit" property="unit" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/> <result column="version" property="version" jdbcType="VARCHAR"/>
<result column="tname" property="tname" jdbcType="VARCHAR"/> <result column="tname" property="tname" jdbcType="VARCHAR"/>
<result column="mcode" property="mcode" jdbcType="INTEGER"/> <result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="bmcode" property="bmcode" jdbcType="INTEGER"/> <result column="bmcode" property="bmcode" jdbcType="VARCHAR"/>
<result column="mid" property="mid" jdbcType="INTEGER"/> <result column="mid" property="mid" jdbcType="INTEGER"/>
<result column="mtid" property="mtid" jdbcType="INTEGER"/> <result column="mtid" property="mtid" jdbcType="INTEGER"/>
@ -313,6 +313,13 @@
where id = #{id} where id = #{id}
</select> </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"> <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" /> <id column="id" property="id" jdbcType="INTEGER" />
<result column="tname" property="tname" jdbcType="VARCHAR" /> <result column="tname" property="tname" jdbcType="VARCHAR" />
<result column="introduce" property="introduce" 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> </resultMap>
<!-- 表查询字段 --> <!-- 表查询字段 -->
<sql id="allColumns"> <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> </sql>
<!-- This code was generated by TableGo tools, mark 2 end. --> <!-- This code was generated by TableGo tools, mark 2 end. -->
@ -46,6 +49,9 @@
<if test="parentId != null"> <if test="parentId != null">
and mt.parentId = #{parentId} and mt.parentId = #{parentId}
</if> </if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4 and mt.state != 3 and mt.state != 4
</select> </select>
<!-- 根据条件参数查询数据列表 --> <!-- 根据条件参数查询数据列表 -->
@ -65,6 +71,9 @@
<if test="parentId != null"> <if test="parentId != null">
and mt.parentId = #{parentId} and mt.parentId = #{parentId}
</if> </if>
<if test="oldId != null">
and mt.oldId = #{oldId}
</if>
and mt.state != 3 and mt.state != 4 and mt.state != 3 and mt.state != 4
<if test="begin != null and size != null"> <if test="begin != null and size != null">
@ -79,8 +88,15 @@
FROM material_type mt WHERE mt.id = #{id} FROM material_type mt WHERE mt.id = #{id}
</select> </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 SELECT
<include refid="allColumns" /> <include refid="allColumns" />
FROM material_type mt FROM material_type mt
@ -93,6 +109,13 @@
<include refid="allColumns" /> <include refid="allColumns" />
FROM material_type mt WHERE mt.id = #{id} and mt.state != 3 and mt.state != 4 FROM material_type mt WHERE mt.id = #{id} and mt.state != 3 and mt.state != 4
</select> </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 id="findMaterialTypeByIds" resultMap="materialTypeMap" parameterType="list">
SELECT SELECT
@ -107,12 +130,13 @@
<!-- 插入数据 --> <!-- 插入数据 -->
<insert id="insertMaterialType" parameterType="map"> <insert id="insertMaterialType" parameterType="map">
INSERT INTO material_type ( INSERT INTO material_type (
id, tname, introduce,parentId id, tname, introduce,parentId,oldId
) VALUES ( ) VALUES (
#{id}, #{id},
#{tname}, #{tname},
#{introduce}, #{introduce},
#{parentId} #{parentId},
#{oldId}
) )
</insert> </insert>
@ -218,6 +242,6 @@
<if test="oldState != null"> <if test="oldState != null">
and state = #{oldState} and state = #{oldState}
</if> </if>
and state != 3 and mt.state != 4 and state != 3 and state != 4
</update> </update>
</mapper> </mapper>

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

@ -460,6 +460,7 @@
var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
var id = barCodeInput.id; var id = barCodeInput.id;
$("#"+id).remove(); $("#"+id).remove();
$("#barCode").remove();
// barCodeInput.style = "display:none"; // barCodeInput.style = "display:none";
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
var barCodeSelect = ` 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 style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;">
提交成功 提交成功
</div> </div>
<div style="text-align: center;margin-top: 50px;">
<button class="layui-btn next">再填写一次</button>
</div>
</div> </div>
</form> </form>

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

@ -404,8 +404,12 @@
var objId = parent.id.split("cardItem")[1]; var objId = parent.id.split("cardItem")[1];
var children = parent.childNodes[5]; var children = parent.childNodes[5];
var materialItem = children.childNodes[3].childNodes[1].childNodes; var materialItem = children.childNodes[3].childNodes[1].childNodes;
var barCodeChildren = parent.childNodes[9];
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
// 条形码条码
var barCodeItem = barCodeChildren.childNodes[3];
var req = {}; var req = {};
req.code = code; req.code = code;
req.type = "out"; req.type = "out";
@ -423,10 +427,34 @@
materialId.value = ""; materialId.value = "";
obj.value = ""; obj.value = "";
$('#place'+objId).empty(); $('#place'+objId).empty();
}else{
req.mid = d.id; }else
{
materialName.value = d.mname; materialName.value = d.mname;
materialId.value = d.id; 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();
}
} }
} }
}); });

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

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

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

@ -58,19 +58,13 @@
name="version" lay-verify="required"/> name="version" lay-verify="required"/>
</div> </div>
</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"> <div class="layui-form-item">
<label class="layui-form-label">物料类型:</label> <label class="layui-form-label">物料类型:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly <input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly
lay-verify="required"/> 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>
</div> </div>

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

@ -335,12 +335,13 @@
layer.closeAll('loading'); //关闭loading layer.closeAll('loading'); //关闭loading
//如果上传成功 //如果上传成功
console.log(res);
var re = "";
for (let i = 0; i < res.data.errMsg.length; i++) { for (let i = 0; i < res.data.errMsg.length; i++) {
var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>" var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>"
re += show re += show
} }
if(res.code == 200){ if(res.code === 200){
var re = ""
for (let i = 0; i < res.data.dataList.length; i++) { for (let i = 0; i < res.data.dataList.length; i++) {
var mname = res.data.dataList[i]["mname"]; 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"]; 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: [] ,data: []
,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩 ,onlyIconControl: true //是否仅允许节点左侧图标控制展开收缩
,click: function(obj){ ,click: function(obj){
$("#openSonByMateralType",window.parent.document).val(obj.data.title) $("#openSonByMateralType",window.parent.document).val(obj.data.title);
$("#materialTypeId",window.parent.document).val(obj.data.id) $("#materialTypeId",window.parent.document).val(obj.data.id);
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index); parent.layer.close(index);

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

@ -34,10 +34,8 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">父级类型:</label> <label class="layui-form-label">父级类型:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select name="parentId" > <input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly th:value="${parentType == null ?'': parentType.getTname()}" />
<option value="">请选择类型</option> <input type="text" id="materialTypeId" placeholder="请选择物料类型" name="parentId" class="layui-input" th:value="${parentType == null ?'' :parentType.getOldId()}" style="display: none" />
<option th:each="materialType,iterStar:${materialTypes}" th:value="${materialType?.getId()}" th:text="${materialType?.getTname()}" th:selected="${materialType.getId() == record.getParentId()}" >顶级公司</option>
</select>
</div> </div>
</div> </div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
@ -57,6 +55,22 @@
<script> <script>
layui.use('form', function(){ layui.use('form', function(){
var form = layui.form, $ = layui.$; 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){ form.on('submit(formDemo)', function(data){
data = data.field data = data.field

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

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

Loading…
Cancel
Save