160 changed files with 5516 additions and 1107 deletions
@ -0,0 +1,20 @@ |
|||||
|
package com.dreamchaser.depository_manage.config; |
||||
|
|
||||
|
import org.redisson.Redisson; |
||||
|
import org.redisson.api.RedissonClient; |
||||
|
import org.redisson.config.Config; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
|
||||
|
@Configuration |
||||
|
public class RedissionConfig { |
||||
|
|
||||
|
@Bean |
||||
|
public RedissonClient redisson() throws IOException { |
||||
|
// 本例子使用的是yaml格式的配置文件,读取使用Config.fromYAML,如果是Json文件,则使用Config.fromJSON
|
||||
|
Config config = Config.fromYAML(RedissionConfig.class.getClassLoader().getResource("redisson-config.yml")); |
||||
|
return Redisson.create(config); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,154 @@ |
|||||
|
package com.dreamchaser.depository_manage.controller; |
||||
|
|
||||
|
import com.dreamchaser.depository_manage.entity.Depository; |
||||
|
import com.dreamchaser.depository_manage.entity.Material; |
||||
|
import com.dreamchaser.depository_manage.entity.Place; |
||||
|
import com.dreamchaser.depository_manage.exception.MyException; |
||||
|
import com.dreamchaser.depository_manage.pojo.MaterialP; |
||||
|
import com.dreamchaser.depository_manage.pojo.PlaceP; |
||||
|
import com.dreamchaser.depository_manage.pojo.RestResponse; |
||||
|
import com.dreamchaser.depository_manage.service.DepositoryService; |
||||
|
import com.dreamchaser.depository_manage.service.MaterialService; |
||||
|
import com.dreamchaser.depository_manage.service.PlaceService; |
||||
|
import com.dreamchaser.depository_manage.utils.CrudUtil; |
||||
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/place") |
||||
|
public class PlaceController { |
||||
|
@Autowired |
||||
|
PlaceService placeService; |
||||
|
|
||||
|
@Autowired |
||||
|
MaterialService materialService; |
||||
|
|
||||
|
@Autowired |
||||
|
DepositoryService depositoryService; |
||||
|
|
||||
|
/** |
||||
|
* 根据条件查询库位 |
||||
|
* |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/findPlace") |
||||
|
public RestResponse findMaterial(@RequestParam Map<String, Object> map) { |
||||
|
List<Place> placeByCondition = placeService.findPlaceByCondition(map); |
||||
|
List<PlaceP> placePList = new ArrayList<>(); |
||||
|
for (int i = 0; i < placeByCondition.size(); i++) { |
||||
|
Place place = placeByCondition.get(i); |
||||
|
PlaceP placeP = new PlaceP(place); |
||||
|
Integer depositoryId = place.getDid(); |
||||
|
Integer mid = place.getMid(); |
||||
|
Depository depositoryById = depositoryService.findDepositoryRecordById(depositoryId); |
||||
|
if(mid != null) { |
||||
|
Material materialById = materialService.findMaterialById(mid); |
||||
|
placeP.setMname(materialById.getMname()); |
||||
|
} |
||||
|
placeP.setDepositoryName(depositoryById.getDname()); |
||||
|
placeP.setDepositoryCode(depositoryById.getCode()); |
||||
|
placePList.add(placeP); |
||||
|
} |
||||
|
return new RestResponse(placePList, placeService.findPlaceCountByCondition(map), 200); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/addPlace") |
||||
|
public RestResponse insertPlace(@RequestBody Map<String, Object> map) { |
||||
|
String type = (String) map.get("type"); |
||||
|
Map<String, Object> insert = new HashMap<>(); |
||||
|
Integer success = 0; |
||||
|
if ("one".equals(type)) { |
||||
|
Integer place_x = ObjectFormatUtil.toInteger(map.get("place_x")); |
||||
|
Integer place_y = ObjectFormatUtil.toInteger(map.get("place_y")); |
||||
|
Integer place_z = ObjectFormatUtil.toInteger(map.get("place_z")); |
||||
|
String min = (String) map.get("min"); |
||||
|
String max = (String) map.get("max"); |
||||
|
String code = String.format("%02d", place_x) + String.format("%02d", place_y) + String.format("%02d", place_z); |
||||
|
insert.put("x", place_x); |
||||
|
insert.put("y", place_y); |
||||
|
insert.put("z", place_z); |
||||
|
insert.put("code", code); |
||||
|
insert.put("did", map.get("depositoryId")); |
||||
|
if (!"".equals(min)) { |
||||
|
insert.put("min", map.get("min")); |
||||
|
} else { |
||||
|
insert.put("min", 0); |
||||
|
} |
||||
|
if (!"".equals(max)) { |
||||
|
insert.put("max", map.get("max")); |
||||
|
} else { |
||||
|
insert.put("max", 0); |
||||
|
} |
||||
|
insert.put("state",1); |
||||
|
success += placeService.InsertPlace(insert); |
||||
|
} else { |
||||
|
|
||||
|
} |
||||
|
if ("one".equals(type)) { |
||||
|
return CrudUtil.postHandle(success, 1); |
||||
|
} else { |
||||
|
return new RestResponse(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 将库位状态改为删除 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/deletePlace") |
||||
|
public RestResponse deletePlace(@RequestBody Map<String,Object> map){ |
||||
|
if (map.containsKey("id")){ |
||||
|
Integer id= ObjectFormatUtil.toInteger(map.get("id")); |
||||
|
return CrudUtil.deleteHandle(placeService.changeStateToDeletedById(id),1); |
||||
|
}else if (map.containsKey("ids")){ |
||||
|
List<Integer> ids=(List<Integer>) map.get("ids"); |
||||
|
return CrudUtil.deleteHandle(placeService.changeStateToDeletedByIds(ids),ids.size()); |
||||
|
}else { |
||||
|
throw new MyException("所需请求参数缺失!"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改库位信息 |
||||
|
*/ |
||||
|
@PostMapping("/place_edit") |
||||
|
public RestResponse placeEdit(@RequestBody Map<String,Object> map){ |
||||
|
if(map.containsKey("state")){ |
||||
|
map.put("state",1); |
||||
|
}else{ |
||||
|
map.put("state",2); |
||||
|
} |
||||
|
Map<String, Object> update = new HashMap<>(); |
||||
|
Integer place_x = ObjectFormatUtil.toInteger(map.get("place_x")); |
||||
|
Integer place_y = ObjectFormatUtil.toInteger(map.get("place_y")); |
||||
|
Integer place_z = ObjectFormatUtil.toInteger(map.get("place_z")); |
||||
|
String min = (String) map.get("min"); |
||||
|
String max = (String) map.get("max"); |
||||
|
String code = String.format("%02d", place_x) + String.format("%02d", place_y) + String.format("%02d", place_z); |
||||
|
update.put("x", place_x); |
||||
|
update.put("y", place_y); |
||||
|
update.put("z", place_z); |
||||
|
update.put("code", code); |
||||
|
update.put("did", map.get("depositoryId")); |
||||
|
if (!"".equals(min)) { |
||||
|
update.put("min", map.get("min")); |
||||
|
} else { |
||||
|
update.put("min", 0); |
||||
|
} |
||||
|
if (!"".equals(max)) { |
||||
|
update.put("max", map.get("max")); |
||||
|
} else { |
||||
|
update.put("max", 0); |
||||
|
} |
||||
|
update.put("id",map.get("id")); |
||||
|
return CrudUtil.postHandle(placeService.UpdatePlace(update),1); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,40 @@ |
|||||
|
package com.dreamchaser.depository_manage.converter; |
||||
|
|
||||
|
import com.alibaba.excel.converters.Converter; |
||||
|
import com.alibaba.excel.enums.CellDataTypeEnum; |
||||
|
import com.alibaba.excel.metadata.GlobalConfiguration; |
||||
|
import com.alibaba.excel.metadata.data.ReadCellData; |
||||
|
import com.alibaba.excel.metadata.data.WriteCellData; |
||||
|
import com.alibaba.excel.metadata.property.ExcelContentProperty; |
||||
|
import com.dreamchaser.depository_manage.entity.MaterialType; |
||||
|
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 用于物料分类上级编码 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class ExcelMTParentIdConverter implements Converter<Integer> { |
||||
|
@Override |
||||
|
public Class supportJavaTypeKey() { |
||||
|
return Integer.class; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CellDataTypeEnum supportExcelTypeKey() { |
||||
|
return CellDataTypeEnum.STRING; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { |
||||
|
Integer data = 0; |
||||
|
if(cellData.getStringValue() != null){ |
||||
|
data = ObjectFormatUtil.toInteger(cellData.getStringValue()); |
||||
|
} |
||||
|
return data; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
package com.dreamchaser.depository_manage.converter; |
||||
|
|
||||
|
import com.alibaba.excel.converters.Converter; |
||||
|
import com.alibaba.excel.converters.ReadConverterContext; |
||||
|
import com.alibaba.excel.enums.CellDataTypeEnum; |
||||
|
import com.alibaba.excel.metadata.GlobalConfiguration; |
||||
|
import com.alibaba.excel.metadata.data.ReadCellData; |
||||
|
import com.alibaba.excel.metadata.property.ExcelContentProperty; |
||||
|
import com.dreamchaser.depository_manage.entity.Depository; |
||||
|
import com.dreamchaser.depository_manage.entity.Material; |
||||
|
import com.dreamchaser.depository_manage.service.DepositoryService; |
||||
|
import com.dreamchaser.depository_manage.service.MaterialService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import javax.annotation.PostConstruct; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 用于物料分类上级编码 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class ExcelMaterialCodeConverter implements Converter<Long> { |
||||
|
|
||||
|
@Autowired |
||||
|
private MaterialService materialService; |
||||
|
|
||||
|
private static ExcelMaterialCodeConverter excelMaterialCodeConverter; |
||||
|
@Override |
||||
|
public Class<?> supportJavaTypeKey() { |
||||
|
return Long.class; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public CellDataTypeEnum supportExcelTypeKey() { |
||||
|
return CellDataTypeEnum.STRING; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 这里读的时候会调用 |
||||
|
* |
||||
|
* @param |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Long convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception { |
||||
|
Material material = excelMaterialCodeConverter.materialService.findMaterialByCode(Long.valueOf(cellData.getStringValue())); |
||||
|
if(material == null) { |
||||
|
throw new RuntimeException("没有该物料"); |
||||
|
} |
||||
|
return Long.valueOf(cellData.getStringValue()); |
||||
|
} |
||||
|
|
||||
|
@PostConstruct |
||||
|
public void init(){ |
||||
|
excelMaterialCodeConverter = this; |
||||
|
excelMaterialCodeConverter.materialService = this.materialService; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package com.dreamchaser.depository_manage.converter; |
||||
|
|
||||
|
import com.alibaba.excel.converters.AutoConverter; |
||||
|
import com.alibaba.excel.converters.Converter; |
||||
|
|
||||
|
import java.lang.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* Excel导入必填校验注解 |
||||
|
* |
||||
|
*/ |
||||
|
@Target(ElementType.FIELD) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
@Inherited |
||||
|
public @interface ExcelValid { |
||||
|
String message() default "非空字段必填"; |
||||
|
/** |
||||
|
* Index of column |
||||
|
* |
||||
|
* Read or write it on the index of column, If it's equal to -1, it's sorted by Java class. |
||||
|
* |
||||
|
* priority: index > order > default sort |
||||
|
* |
||||
|
* @return Index of column |
||||
|
*/ |
||||
|
int index() default -1; |
||||
|
|
||||
|
/** |
||||
|
* Defines the sort order for an column. |
||||
|
* |
||||
|
* priority: index > order > default sort |
||||
|
* |
||||
|
* @return Order of column |
||||
|
*/ |
||||
|
int order() default Integer.MAX_VALUE; |
||||
|
|
||||
|
/** |
||||
|
* Force the current field to use this converter. |
||||
|
* |
||||
|
* @return Converter |
||||
|
*/ |
||||
|
Class<? extends Converter<?>> converter() default AutoConverter.class; |
||||
|
|
||||
|
/** |
||||
|
* |
||||
|
* default @see com.alibaba.excel.util.TypeUtil if default is not meet you can set format |
||||
|
* |
||||
|
* @return Format string |
||||
|
* @deprecated please use {@link com.alibaba.excel.annotation.format.DateTimeFormat} |
||||
|
*/ |
||||
|
@Deprecated |
||||
|
String format() default ""; |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.dreamchaser.depository_manage.entity; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import com.dreamchaser.depository_manage.converter.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 用于库存excel表的导入 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
public class ExcelInfoByInventory { |
||||
|
|
||||
|
/** 物料编号 */ |
||||
|
@ExcelProperty("EAS编号") |
||||
|
private Integer id; |
||||
|
|
||||
|
/** 存货编码 */ |
||||
|
@ExcelProperty(value = "编码",converter = ExcelMaterialCodeConverter.class) |
||||
|
private Long code; |
||||
|
|
||||
|
/** 仓库名称 */ |
||||
|
@ExcelProperty(value = "仓库编码",converter = ExcelDepositoryInfoConverter.class) |
||||
|
@ExcelValid(message = "仓库编码未填写") |
||||
|
private Integer depositoryId; |
||||
|
|
||||
|
/** 物料名称 */ |
||||
|
@ExcelProperty("物料名称") |
||||
|
private String mname; |
||||
|
|
||||
|
/** 数量 */ |
||||
|
@ExcelProperty(value = "数量") |
||||
|
@ExcelValid(message = "数量未填写") |
||||
|
private String quantity; |
||||
|
|
||||
|
/** 总金额 */ |
||||
|
@ExcelProperty("总金额") |
||||
|
private String amounts; |
||||
|
|
||||
|
/** 单价 */ |
||||
|
@ExcelProperty("单价") |
||||
|
@ExcelValid(message = "单价未填写") |
||||
|
private String price; |
||||
|
|
||||
|
/** 仓库编码 */ |
||||
|
@ExcelProperty("库位码") |
||||
|
private String depositoryCode; |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.dreamchaser.depository_manage.entity; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import com.dreamchaser.depository_manage.converter.ExcelDepositoryInfoConverter; |
||||
|
import com.dreamchaser.depository_manage.converter.ExcelMTParentIdConverter; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 用于物料类型excel表的导入 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
public class ExcelInfoByMT { |
||||
|
/** 分类名称 */ |
||||
|
@ExcelProperty(value = "分类名称") |
||||
|
private String tname; |
||||
|
|
||||
|
/** |
||||
|
* 物料编码 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "编码") |
||||
|
private Integer id; |
||||
|
|
||||
|
/** |
||||
|
* 物料上级编码 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "上级编码") |
||||
|
private Integer parentId; |
||||
|
|
||||
|
/** |
||||
|
* 物料介绍 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "介绍") |
||||
|
private String introduce; |
||||
|
} |
||||
@ -0,0 +1,57 @@ |
|||||
|
package com.dreamchaser.depository_manage.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 库位 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class Place { |
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
private Integer id; |
||||
|
|
||||
|
/** |
||||
|
* 行 |
||||
|
*/ |
||||
|
private Integer x; |
||||
|
/** |
||||
|
* 列 |
||||
|
*/ |
||||
|
private Integer y; |
||||
|
/** |
||||
|
* 层 |
||||
|
*/ |
||||
|
private Integer z; |
||||
|
|
||||
|
/** |
||||
|
* 存放物料id |
||||
|
*/ |
||||
|
private Integer mid; |
||||
|
|
||||
|
/** |
||||
|
* 该库位所处仓库 |
||||
|
*/ |
||||
|
private Integer did; |
||||
|
|
||||
|
/** |
||||
|
* 库位编码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 当前库位最少数目 |
||||
|
*/ |
||||
|
private Integer min; |
||||
|
|
||||
|
/** |
||||
|
* 当前库位最多数目 |
||||
|
*/ |
||||
|
private Integer max; |
||||
|
|
||||
|
/** |
||||
|
* 当前库位状态 |
||||
|
*/ |
||||
|
private Integer state; |
||||
|
} |
||||
@ -0,0 +1,35 @@ |
|||||
|
package com.dreamchaser.depository_manage.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigInteger; |
||||
|
|
||||
|
@Data |
||||
|
public class materialOnly { |
||||
|
/** 存储id */ |
||||
|
private Integer id; |
||||
|
|
||||
|
/** 物料名称 */ |
||||
|
private String mname; |
||||
|
|
||||
|
|
||||
|
/** 物料种类id */ |
||||
|
private Integer typeId; |
||||
|
|
||||
|
/** 物料状态 */ |
||||
|
private Integer state; |
||||
|
|
||||
|
/** 存货编码 */ |
||||
|
private BigInteger code; |
||||
|
|
||||
|
/** 规格型号 */ |
||||
|
private String version; |
||||
|
|
||||
|
/** 计量单位 */ |
||||
|
private String unit; |
||||
|
|
||||
|
/** 材质 */ |
||||
|
private String texture; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,88 @@ |
|||||
|
package com.dreamchaser.depository_manage.mapper; |
||||
|
|
||||
|
import com.dreamchaser.depository_manage.entity.Place; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Repository |
||||
|
@Mapper |
||||
|
public interface PlaceMapper { |
||||
|
/** |
||||
|
* 查找所有库位 |
||||
|
* @return |
||||
|
*/ |
||||
|
List<Place> findPlaceAll(); |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询库位 |
||||
|
* @return |
||||
|
*/ |
||||
|
Place findPlaceById(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 根据条件查找库位 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
List<Place> findPlaceByCondition(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 查找符合条件的库位数 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer findPlaceCountByCondition(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 根据条件修改库位 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer UpdatePlace(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 根据条件修改库位 |
||||
|
* @param place |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer UpdatePlace(Place place); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据主键删除库位 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer DelPlace(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 插入一条库位信息 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer InsertPlace(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 根据仓库编号查找库位 |
||||
|
* @param did |
||||
|
* @return |
||||
|
*/ |
||||
|
List<Place> findPlaceByDid(Integer did); |
||||
|
|
||||
|
/** |
||||
|
* 根据id将库位状态改为删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer changeStateToDeletedById(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 根据批量id将库位状态改为删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer changeStateToDeletedByIds(List<Integer> ids); |
||||
|
} |
||||
@ -0,0 +1,204 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<!-- notice --> |
||||
|
<mapper namespace="com.dreamchaser.depository_manage.mapper.PlaceMapper"> |
||||
|
<!-- This code was generated by TableGo tools, mark 1 begin. --> |
||||
|
<!-- 字段映射 --> |
||||
|
<resultMap id="placeMap" type="com.dreamchaser.depository_manage.entity.Place"> |
||||
|
<id column="id" property="id" jdbcType="INTEGER" /> |
||||
|
<result column="x" property="x" jdbcType="INTEGER" /> |
||||
|
<result column="y" property="y" jdbcType="INTEGER" /> |
||||
|
<result column="z" property="z" jdbcType="INTEGER" /> |
||||
|
<result column="mid" property="mid" jdbcType="INTEGER" /> |
||||
|
<result column="did" property="did" jdbcType="INTEGER" /> |
||||
|
<result column="code" property="code" jdbcType="VARCHAR" /> |
||||
|
<result column="min" property="min" jdbcType="INTEGER" /> |
||||
|
<result column="max" property="max" jdbcType="INTEGER" /> |
||||
|
<result column="state" property="state" jdbcType="INTEGER" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 表查询字段 --> |
||||
|
<sql id="allColumns"> |
||||
|
p.id,p.x,p.y,p.z,p.code,p.mid,p.did,p.min,p.max,p.state |
||||
|
</sql> |
||||
|
|
||||
|
<!-- 查询所有 --> |
||||
|
<select id="findPlaceAll" resultMap="placeMap"> |
||||
|
SELECT |
||||
|
<include refid="allColumns" /> |
||||
|
FROM place p |
||||
|
where p.state != 3 |
||||
|
</select> |
||||
|
|
||||
|
<!-- 根据条件参数查询列表 --> |
||||
|
<select id="findPlaceByCondition" resultMap="placeMap" parameterType="map"> |
||||
|
SELECT |
||||
|
<include refid="allColumns" /> |
||||
|
FROM place p WHERE 1 = 1 |
||||
|
<if test="id != null and id != ''"> |
||||
|
and p.id = #{id} |
||||
|
</if> |
||||
|
<if test="x != null and x != ''"> |
||||
|
AND p.x = #{x} |
||||
|
</if> |
||||
|
<if test="y != null and y != ''"> |
||||
|
AND p.y = #{y} |
||||
|
</if> |
||||
|
<if test="z != null and z != ''"> |
||||
|
AND p.z = #{z} |
||||
|
</if> |
||||
|
<if test="code != null and code != ''"> |
||||
|
AND p.code = #{code} |
||||
|
</if> |
||||
|
<if test="mid != null and mid != ''"> |
||||
|
AND p.mid = #{mid} |
||||
|
</if> |
||||
|
<if test="did != null and did != ''"> |
||||
|
AND p.did = #{did} |
||||
|
</if> |
||||
|
<if test="max != null and max != ''"> |
||||
|
AND p.max = #{max} |
||||
|
</if> |
||||
|
<if test="min != null and min != ''"> |
||||
|
AND p.min = #{min} |
||||
|
</if> |
||||
|
<if test="state != null and state != ''"> |
||||
|
and p.state = #{state} |
||||
|
</if> |
||||
|
and p.state != 3 |
||||
|
<if test="begin != null and size != null"> |
||||
|
LIMIT #{begin},#{size} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
<select id="findPlaceCountByCondition" parameterType="map" resultType="int"> |
||||
|
SELECT |
||||
|
count(*) |
||||
|
FROM place p WHERE 1 = 1 |
||||
|
<if test="id != null and id != ''"> |
||||
|
and p.id = #{id} |
||||
|
</if> |
||||
|
<if test="x != null and x != ''"> |
||||
|
AND p.x = #{x} |
||||
|
</if> |
||||
|
<if test="y != null and y != ''"> |
||||
|
AND p.y = #{y} |
||||
|
</if> |
||||
|
<if test="z != null and z != ''"> |
||||
|
AND p.z = #{z} |
||||
|
</if> |
||||
|
<if test="mid != null and mid != ''"> |
||||
|
AND p.mid = #{mid} |
||||
|
</if> |
||||
|
<if test="did != null and did != ''"> |
||||
|
AND p.did = #{did} |
||||
|
</if> |
||||
|
<if test="max != null and max != ''"> |
||||
|
AND p.max = #{max} |
||||
|
</if> |
||||
|
<if test="min != null and min != ''"> |
||||
|
AND p.min = #{min} |
||||
|
</if> |
||||
|
<if test="state != null and state != ''"> |
||||
|
and p.state = #{state} |
||||
|
</if> |
||||
|
and p.state != 3 |
||||
|
</select> |
||||
|
|
||||
|
<select id="findPlaceByDid" parameterType="int" resultMap="placeMap"> |
||||
|
SELECT |
||||
|
<include refid="allColumns" /> |
||||
|
FROM place p WHERE 1 = 1 and p.did = #{did} |
||||
|
</select> |
||||
|
|
||||
|
<!-- 根据主键查询信息 --> |
||||
|
<select id="findPlaceById" resultMap="placeMap" parameterType="int"> |
||||
|
SELECT |
||||
|
<include refid="allColumns" /> |
||||
|
FROM place p WHERE p.id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<!-- 新增信息 --> |
||||
|
<insert id="InsertPlace"> |
||||
|
INSERT INTO place ( |
||||
|
id,x,y,z,code, mid,did,min,max,state |
||||
|
) VALUES ( |
||||
|
#{id}, |
||||
|
#{x}, |
||||
|
#{y}, |
||||
|
#{z}, |
||||
|
#{code}, |
||||
|
#{mid}, |
||||
|
#{did}, |
||||
|
#{min}, |
||||
|
#{max}, |
||||
|
#{state} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
<!-- 修改信息 --> |
||||
|
<update id="UpdatePlace"> |
||||
|
UPDATE place |
||||
|
<set> |
||||
|
<if test="x != null"> |
||||
|
x = #{x}, |
||||
|
</if> |
||||
|
<if test="y != null"> |
||||
|
y = #{y}, |
||||
|
</if> |
||||
|
<if test="z != null"> |
||||
|
z = #{z}, |
||||
|
</if> |
||||
|
<if test="code != null"> |
||||
|
code = #{code}, |
||||
|
</if> |
||||
|
<if test="mid != null"> |
||||
|
mid = #{mid}, |
||||
|
</if> |
||||
|
<if test="did != null"> |
||||
|
did = #{did}, |
||||
|
</if> |
||||
|
<if test="min != null"> |
||||
|
min = #{min}, |
||||
|
</if> |
||||
|
<if test="max != null"> |
||||
|
max = #{max}, |
||||
|
</if> |
||||
|
<if test="state != null and state !=''"> |
||||
|
state = #{state} |
||||
|
</if> |
||||
|
</set> |
||||
|
WHERE id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- 根据主键删除 --> |
||||
|
<delete id="DelPlace" parameterType="int"> |
||||
|
DELETE FROM place WHERE id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
|
||||
|
<!-- 根据主键批量将状态改为删除--> |
||||
|
<update id="changeStateToDeletedByIds" parameterType="list"> |
||||
|
update place |
||||
|
<set> |
||||
|
state = 3 |
||||
|
</set> |
||||
|
where id in |
||||
|
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<!-- 根据主键将状态改为删除--> |
||||
|
<update id="changeStateToDeletedById" parameterType="int"> |
||||
|
UPDATE place |
||||
|
<set> |
||||
|
state = 3 |
||||
|
</set> |
||||
|
WHERE id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,30 @@ |
|||||
|
package com.dreamchaser.depository_manage.pojo; |
||||
|
|
||||
|
import java.math.BigInteger; |
||||
|
|
||||
|
public class MaterialOnlyP { |
||||
|
/** 存储id */ |
||||
|
private Integer id; |
||||
|
|
||||
|
/** 物料名称 */ |
||||
|
private String mname; |
||||
|
|
||||
|
|
||||
|
/** 物料种类id */ |
||||
|
private Integer typeId; |
||||
|
|
||||
|
/** 物料状态 */ |
||||
|
private Integer state; |
||||
|
|
||||
|
/** 存货编码 */ |
||||
|
private BigInteger code; |
||||
|
|
||||
|
/** 规格型号 */ |
||||
|
private String version; |
||||
|
|
||||
|
/** 计量单位 */ |
||||
|
private String unit; |
||||
|
|
||||
|
/** 材质 */ |
||||
|
private String texture; |
||||
|
} |
||||
@ -0,0 +1,105 @@ |
|||||
|
package com.dreamchaser.depository_manage.pojo; |
||||
|
|
||||
|
import com.dreamchaser.depository_manage.entity.Place; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class PlaceP { |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
private Integer id; |
||||
|
|
||||
|
/** |
||||
|
* 行 |
||||
|
*/ |
||||
|
private Integer x; |
||||
|
/** |
||||
|
* 列 |
||||
|
*/ |
||||
|
private Integer y; |
||||
|
/** |
||||
|
* 层 |
||||
|
*/ |
||||
|
private Integer z; |
||||
|
|
||||
|
/** |
||||
|
* 存放物料id |
||||
|
*/ |
||||
|
private Integer mid; |
||||
|
|
||||
|
/** |
||||
|
* 该库位所处仓库 |
||||
|
*/ |
||||
|
private Integer did; |
||||
|
|
||||
|
/** |
||||
|
* 库位编码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 当前库位最少数目 |
||||
|
*/ |
||||
|
private Integer min; |
||||
|
|
||||
|
/** |
||||
|
* 当前库位最多数目 |
||||
|
*/ |
||||
|
private Integer max; |
||||
|
|
||||
|
/** |
||||
|
* 当前库位状态 |
||||
|
*/ |
||||
|
private Integer state; |
||||
|
|
||||
|
/** |
||||
|
* 物料名称 |
||||
|
*/ |
||||
|
private String mname; |
||||
|
|
||||
|
/** |
||||
|
* 物料编码 |
||||
|
*/ |
||||
|
private String mcode; |
||||
|
|
||||
|
/** |
||||
|
* 仓库编码 |
||||
|
*/ |
||||
|
private String depositoryCode; |
||||
|
/** |
||||
|
* 仓库名称 |
||||
|
*/ |
||||
|
private String depositoryName; |
||||
|
|
||||
|
public PlaceP(Integer id, Integer x, Integer y, Integer z, Integer mid, Integer did, String code, Integer min, Integer max, Integer state, String mname, String mcode, String depositoryCode, String depositoryName) { |
||||
|
this.id = id; |
||||
|
this.x = x; |
||||
|
this.y = y; |
||||
|
this.z = z; |
||||
|
this.mid = mid; |
||||
|
this.did = did; |
||||
|
this.code = code; |
||||
|
this.min = min; |
||||
|
this.max = max; |
||||
|
this.state = state; |
||||
|
this.mname = mname; |
||||
|
this.mcode = mcode; |
||||
|
this.depositoryCode = depositoryCode; |
||||
|
this.depositoryName = depositoryName; |
||||
|
} |
||||
|
|
||||
|
public PlaceP(Place p){ |
||||
|
this.id = p.getId(); |
||||
|
this.x = p.getX(); |
||||
|
this.y = p.getY(); |
||||
|
this.z = p.getZ(); |
||||
|
this.mid = p.getMid(); |
||||
|
this.did = p.getDid(); |
||||
|
this.code = p.getCode(); |
||||
|
this.min = p.getMin(); |
||||
|
this.max = p.getMax(); |
||||
|
this.state = p.getState(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
package com.dreamchaser.depository_manage.service; |
||||
|
|
||||
|
import com.dreamchaser.depository_manage.entity.Place; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
public interface PlaceService { |
||||
|
/** |
||||
|
* 查找所有库位 |
||||
|
* @return |
||||
|
*/ |
||||
|
List<Place> findPlaceAll(); |
||||
|
|
||||
|
/** |
||||
|
* 根据条件查找库位 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
List<Place> findPlaceByCondition(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 查找符合条件的库位数 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer findPlaceCountByCondition(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 根据条件修改库位 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer UpdatePlace(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 根据条件修改库位 |
||||
|
* @param place |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer UpdatePlace(Place place); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据主键删除库位 |
||||
|
* @param pid |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer DelPlace(Integer pid); |
||||
|
|
||||
|
/** |
||||
|
* 插入一条库位信息 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer InsertPlace(Map<String,Object> map); |
||||
|
|
||||
|
/** |
||||
|
* 根据仓库编号查找库位 |
||||
|
* @param did |
||||
|
* @return |
||||
|
*/ |
||||
|
List<Place> findPlaceByDid(Integer did); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据id查询库位 |
||||
|
* @return |
||||
|
*/ |
||||
|
Place findPlaceById(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 根据id将库位状态改为删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer changeStateToDeletedById(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 根据批量id将库位状态改为删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
Integer changeStateToDeletedByIds(List<Integer> ids); |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,136 @@ |
|||||
|
package com.dreamchaser.depository_manage.service.impl; |
||||
|
|
||||
|
import com.dreamchaser.depository_manage.entity.Place; |
||||
|
import com.dreamchaser.depository_manage.mapper.PlaceMapper; |
||||
|
import com.dreamchaser.depository_manage.service.PlaceService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
public class PlaceServiceImpl implements PlaceService { |
||||
|
|
||||
|
@Autowired |
||||
|
PlaceMapper placeMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查找所有库位 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<Place> findPlaceAll() { |
||||
|
return placeMapper.findPlaceAll(); |
||||
|
} |
||||
|
/** |
||||
|
* 根据条件查找库位 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<Place> findPlaceByCondition(Map<String, Object> map) { |
||||
|
Map<String,Object> condition = new HashMap<>(); |
||||
|
if(map.containsKey("place_x")){ |
||||
|
condition.put("x",map.get("place_x")); |
||||
|
} |
||||
|
if(map.containsKey("place_y")){ |
||||
|
condition.put("y",map.get("place_y")); |
||||
|
} |
||||
|
if(map.containsKey("place_z")){ |
||||
|
condition.put("z",map.get("place_z")); |
||||
|
} |
||||
|
if(map.containsKey("code")){ |
||||
|
condition.put("code",map.get("code")); |
||||
|
} |
||||
|
if(map.containsKey("state")){ |
||||
|
condition.put("state",map.get("state")); |
||||
|
} |
||||
|
return placeMapper.findPlaceByCondition(condition); |
||||
|
} |
||||
|
/** |
||||
|
* 查找符合条件的库位数 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer findPlaceCountByCondition(Map<String, Object> map) { |
||||
|
return placeMapper.findPlaceCountByCondition(map); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据条件修改库位 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer UpdatePlace(Map<String, Object> map) { |
||||
|
return placeMapper.UpdatePlace(map); |
||||
|
} |
||||
|
/** |
||||
|
* 根据条件修改库位 |
||||
|
* @param place |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer UpdatePlace(Place place) { |
||||
|
return placeMapper.UpdatePlace(place); |
||||
|
} |
||||
|
/** |
||||
|
* 根据主键删除库位 |
||||
|
* @param pid |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer DelPlace(Integer pid) { |
||||
|
return placeMapper.DelPlace(pid); |
||||
|
} |
||||
|
/** |
||||
|
* 插入一条库位信息 |
||||
|
* @param map |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer InsertPlace(Map<String, Object> map) { |
||||
|
return placeMapper.InsertPlace(map); |
||||
|
} |
||||
|
/** |
||||
|
* 根据仓库编号查找库位 |
||||
|
* @param did |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<Place> findPlaceByDid(Integer did) { |
||||
|
return placeMapper.findPlaceByDid(did); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id查询库位 |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Place findPlaceById(Integer id) { |
||||
|
return placeMapper.findPlaceById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据id将库位状态改为删除 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer changeStateToDeletedById(Integer id) { |
||||
|
return placeMapper.changeStateToDeletedById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据批量id将库位状态改为删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public Integer changeStateToDeletedByIds(List<Integer> ids) { |
||||
|
return placeMapper.changeStateToDeletedByIds(ids); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
package com.dreamchaser.depository_manage.utils; |
||||
|
|
||||
|
import com.alibaba.excel.context.AnalysisContext; |
||||
|
import com.alibaba.excel.exception.ExcelDataConvertException; |
||||
|
import com.alibaba.excel.metadata.data.ReadCellData; |
||||
|
import com.alibaba.excel.read.metadata.holder.ReadSheetHolder; |
||||
|
import com.dreamchaser.depository_manage.converter.ExcelValid; |
||||
|
import com.dreamchaser.depository_manage.exception.MyException; |
||||
|
|
||||
|
import java.lang.reflect.Field; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Objects; |
||||
|
|
||||
|
public class ExcelInValid { |
||||
|
|
||||
|
/** |
||||
|
* Excel导入字段校验 |
||||
|
* |
||||
|
* @param object 校验的JavaBean 其属性须有自定义注解 |
||||
|
* @author linmaosheng |
||||
|
*/ |
||||
|
public static void valid(Object object, AnalysisContext context) { |
||||
|
ReadSheetHolder readSheetHolder = context.readSheetHolder(); |
||||
|
Field[] fields = object.getClass().getDeclaredFields(); |
||||
|
ReadCellData<?> tempCellData = readSheetHolder.getTempCellData(); |
||||
|
for (Field field : fields) { |
||||
|
field.setAccessible(true); |
||||
|
//属性的值
|
||||
|
Object fieldValue = null; |
||||
|
try { |
||||
|
fieldValue = field.get(object); |
||||
|
} catch (IllegalAccessException e) { |
||||
|
throw new ExcelDataConvertException(context.readRowHolder().getRowIndex(), tempCellData.getColumnIndex() + 1,null,null,"必填字段为空"); |
||||
|
} |
||||
|
//是否包含必填校验注解
|
||||
|
boolean isExcelValid = field.isAnnotationPresent(ExcelValid.class); |
||||
|
if (isExcelValid && Objects.isNull(fieldValue)) { |
||||
|
throw new ExcelDataConvertException(context.readRowHolder().getRowIndex(), tempCellData.getColumnIndex() + 1,null,null,"必填字段为空"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
#Redisson配置 |
||||
|
singleServerConfig: |
||||
|
address: "redis://127.0.0.1:6379" |
||||
|
clientName: null |
||||
|
database: 7 #选择使用哪个数据库0~15 |
||||
|
idleConnectionTimeout: 10000 |
||||
|
pingTimeout: 1000 |
||||
|
connectTimeout: 10000 |
||||
|
timeout: 3000 |
||||
|
retryAttempts: 3 |
||||
|
retryInterval: 1500 |
||||
|
reconnectionTimeout: 3000 |
||||
|
failedAttempts: 3 |
||||
|
subscriptionsPerConnection: 5 |
||||
|
subscriptionConnectionMinimumIdleSize: 1 |
||||
|
subscriptionConnectionPoolSize: 50 |
||||
|
connectionMinimumIdleSize: 32 |
||||
|
connectionPoolSize: 64 |
||||
|
dnsMonitoringInterval: 5000 |
||||
|
#dnsMonitoring: false |
||||
|
|
||||
|
threads: 0 |
||||
|
nettyThreads: 0 |
||||
|
codec: |
||||
|
class: "org.redisson.codec.JsonJacksonCodec" |
||||
|
transportMode: "NIO" |
||||
|
After Width: | Height: | Size: 6.1 KiB |
@ -0,0 +1,210 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<fieldset class="table-search-fieldset"> |
||||
|
<legend>物料创建</legend> |
||||
|
<div class="layui-fluid"> |
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-body" style="padding-top: 40px;"> |
||||
|
<div> |
||||
|
<form class="layui-form" |
||||
|
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" lay-filter="form1"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料名称:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写物料名称" class="layui-input" |
||||
|
name="mname" 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" |
||||
|
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" |
||||
|
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="openSonByDepository" readonly |
||||
|
lay-verify="required"/> |
||||
|
<input type="text" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" 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"/> |
||||
|
|
||||
|
</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" |
||||
|
name="depositoryCode" 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" |
||||
|
name="texture" 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" |
||||
|
name="unit" 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" value="0" |
||||
|
name="price"/> |
||||
|
</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" value="0" |
||||
|
name="quantity"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" lay-submit lay-filter="formStep"> |
||||
|
 创建物料  |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
<hr> |
||||
|
</div> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
|
||||
|
<script> |
||||
|
var data; |
||||
|
layui.use(['form', 'layer','dropdown','tree'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
dropdown = layui.dropdown, |
||||
|
tree = layui.tree, |
||||
|
layer = layui.layer; |
||||
|
|
||||
|
|
||||
|
$('#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', |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
$('#openSonByDepository').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: '/selectDepository?type=2', |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
form.on('submit(formStep)', function (data) { |
||||
|
$.ajax({ |
||||
|
url: "/material/material_add", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(data.field), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("添加成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
window.location="/material_add" |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
complete: function () { |
||||
|
form.val("form1", { |
||||
|
"mname": "",// "name": "value" |
||||
|
"depositoryId": "", |
||||
|
"materialTypeId": "", |
||||
|
"texture":"" |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
form.on('select(depositoryId)',function (data){ |
||||
|
$.ajax({ |
||||
|
url:"/repository/findDepositoryByParent?parentId="+data.value, |
||||
|
type:'get', |
||||
|
dataType:'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success:function(d){ |
||||
|
console.log(d.data) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,494 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<fieldset class="table-search-fieldset"> |
||||
|
<legend>搜索信息</legend> |
||||
|
<div style="margin: 10px 10px 10px 10px"> |
||||
|
<form class="layui-form layui-form-pane" action=""> |
||||
|
<div class="layui-form-item"> |
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">仓库</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<!--<select name="depositoryId" > |
||||
|
<option value="" selected>请选择仓库</option> |
||||
|
<option th:each="depository,iterStar:${depositories}" th:value="${depository?.getId()}" th:text="${depository?.getDname()}" >外芯仓库</option> |
||||
|
</select>--> |
||||
|
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository" readonly /> |
||||
|
<input type="text" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">种类</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<!--<select name="materialTypeId" > |
||||
|
<option value="" selected>请选择物料类型</option> |
||||
|
<option th:each="materialType,iterStar:${materialTypes}" th:value="${materialType?.getId()}" th:text="${materialType?.getTname()}" >芯片类</option> |
||||
|
</select>--> |
||||
|
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" readonly /> |
||||
|
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="materialTypeId" class="layui-input" style="display: none" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">物料名称</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="mname" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">状态</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<select name="state"> |
||||
|
<option value="">请选择状态</option> |
||||
|
<option value="1">启用</option> |
||||
|
<option value="2">禁用</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
||||
|
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">二维码</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<!-- <input type="text" th:value="${record.depository.getDname()}" name="dname" required lay-verify="required" autocomplete="off" class="layui-input" readonly="readonly">--> |
||||
|
<img src="" id="qrCode"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 状态展示--> |
||||
|
<script type="text/html" id="switchTpl"> |
||||
|
<input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="changeState" {{ d.state == 1 ? 'checked' : '' }} > |
||||
|
</script> |
||||
|
|
||||
|
<script type="text/html" id="toolbarDemo"> |
||||
|
<div class="layui-btn-container"> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 添加</button> |
||||
|
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除</button> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" id="u_fileUpload" lay-event="import">导入数据</button> |
||||
|
</div> |
||||
|
</script> |
||||
|
|
||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
||||
|
|
||||
|
<script type="text/html" id="currentTableBar"> |
||||
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="detail">详情</a> |
||||
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a> |
||||
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" th:style="'display:'+${display}" lay-event="realDelete">彻底删除</a> |
||||
|
</script> |
||||
|
|
||||
|
<script id="selectManager" type="text/html"> |
||||
|
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="manager">仓管员</a> |
||||
|
</script> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
layui.use(['form', 'table','upload'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
table = layui.table, |
||||
|
upload = layui.upload; |
||||
|
|
||||
|
$('#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', |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
$('#openSonByDepository').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: '/selectDepository?type=2', |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
table.render({ |
||||
|
elem: "#currentTableId", |
||||
|
url: '/material/material', |
||||
|
parseData: function (res) { //res 即为原始返回的数据 |
||||
|
return { |
||||
|
"status": res.status, //解析接口状态 |
||||
|
"message": res.statusInfo.message, //解析提示文本 |
||||
|
"count": res.count, //解析数据长度 |
||||
|
"data": res.data //解析数据列表 |
||||
|
}; |
||||
|
}, |
||||
|
request: { |
||||
|
pageName: 'page', //页码的参数名称,默认:page |
||||
|
limitName: 'size' //每页数据量的参数名,默认:limit |
||||
|
}, |
||||
|
where: { |
||||
|
type:"0" |
||||
|
}, |
||||
|
response: { |
||||
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
||||
|
,statusCode: 200 //规定成功的状态码,默认:0 |
||||
|
,msgName: 'message' //规定状态信息的字段名称,默认:msg |
||||
|
,countName: 'count' //规定数据总数的字段名称,默认:count |
||||
|
,dataName: 'data' //规定数据列表的字段名称,默认:data |
||||
|
}, |
||||
|
toolbar: '#toolbarDemo', |
||||
|
defaultToolbar: ['filter', 'exports', 'print'], |
||||
|
cols: [ [ |
||||
|
{type: "checkbox", width: 50}, |
||||
|
{field: 'code',width: 150,title: '存货编码',sort: true}, |
||||
|
{field: 'id', width: 100, title: 'EAS编号',hidden:true}, |
||||
|
{field: 'mname', width: 120, title: '物料名称', sort: false}, |
||||
|
{field: 'typeName',width: 150,title: '物料种类'}, |
||||
|
{field: 'version',width: 200,title: '规格型号',sort: false}, |
||||
|
{field: 'texture',width: 100,title: '材质'}, |
||||
|
{field: 'unit',width: 150,title: '计量单位'}, |
||||
|
{field: 'depositoryCode',width: 250,title: '仓库编码',sort: true}, |
||||
|
{field: "depositoryName",width: 120,title: "仓库名称"}, |
||||
|
{field: 'quantity',width: 120,title:'数量',sort: true}, |
||||
|
{field: 'price',width: 150,title: '单价',sort: true}, |
||||
|
{field: 'amounts',width: 180,title: '总金额',sort: true}, |
||||
|
{field: 'state', title:'状态', minWidth: 80, templet: '#switchTpl'}, |
||||
|
{title: '仓管员', minWidth: 80, templet: '#selectManager' ,align: "center"}, |
||||
|
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"} |
||||
|
]], |
||||
|
limits: [10, 15, 20, 25, 50], |
||||
|
limit: 10, |
||||
|
page: true, |
||||
|
skin: 'line', |
||||
|
done:function () { |
||||
|
$("[data-field='id']").css('display','none'); |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 监听搜索操作 |
||||
|
form.on('submit(data-search-btn)', function (data) { |
||||
|
var req={}; |
||||
|
data=data.field; |
||||
|
req.type=1; |
||||
|
if (data.mname!==''){ |
||||
|
req.mname=data.mname; |
||||
|
} |
||||
|
if(data.depositoryId!== ''){ |
||||
|
req.depositoryId = data.depositoryId; |
||||
|
} |
||||
|
if(data.materialTypeId !=''){ |
||||
|
req.materialTypeId = data.materialTypeId; |
||||
|
} |
||||
|
if(data.state != ''){ |
||||
|
req.state = data.state; |
||||
|
} |
||||
|
|
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/material/material', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where: req |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
/** |
||||
|
* toolbar监听事件 |
||||
|
*/ |
||||
|
table.on('toolbar(currentTableFilter)', function (obj) { |
||||
|
if (obj.event === 'add') { // 监听添加操作 |
||||
|
var index = layer.open({ |
||||
|
title: '申请提交', |
||||
|
type: 2, |
||||
|
shade: 0.2, |
||||
|
maxmin: true, |
||||
|
shadeClose: true, |
||||
|
area: ['100%', '100%'], |
||||
|
content: '/material_add', |
||||
|
}); |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index); |
||||
|
}); |
||||
|
} |
||||
|
else if (obj.event === 'delete') { // 监听删除操作 |
||||
|
var checkStatus = table.checkStatus('currentTableId') |
||||
|
, data = checkStatus.data; |
||||
|
var req={}; |
||||
|
req.ids=[]; |
||||
|
for (i=0,len=data.length;i<len;i++){ |
||||
|
req.ids[i]=data[i].id; |
||||
|
} |
||||
|
if(req.ids.length > 0) { |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url: '/material/material_del', |
||||
|
dataType: 'json', |
||||
|
type: 'POST', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/material/material', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
else{ |
||||
|
layer.msg("未选中记录,请确认!"); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
else if(obj.event === 'createQrCode'){ |
||||
|
$.ajax({ |
||||
|
url:"/material/createQrCode?mid=3", |
||||
|
dataType: 'json', |
||||
|
type: 'get', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success:function (data) { |
||||
|
if(data.status != 200){ |
||||
|
layer.msg(data.statusInfo.messgae) |
||||
|
}else{ |
||||
|
$("#qrCode").attr("src",data.data); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
var upLoader = upload.render({ |
||||
|
elem:"#u_fileUpload", // 绑定元素 |
||||
|
url:'/excel/importExcel', // 上传接口 |
||||
|
accept:'file', // 允许上传的格式, |
||||
|
exts:'xls|xlsx|csv', |
||||
|
done:function(res){ |
||||
|
//如果上传成功 |
||||
|
console.log(res) |
||||
|
if(res.code == 200){ |
||||
|
var re = "" |
||||
|
for (let i = 0; i < res.data.dataList.length; i++) { |
||||
|
var mname = res.data.dataList[i]["mname"] |
||||
|
var code = res.data.dataList[i]["code"] |
||||
|
var version = res.data.dataList[i]["version"] |
||||
|
var texture = res.data.dataList[i]["texture"] |
||||
|
var price = res.data.dataList[i]["price"] |
||||
|
var quantity = res.data.dataList[i]["quantity"] |
||||
|
var unit = res.data.dataList[i]["unit"] |
||||
|
var show = "<p style='color: #00FF00'>"+mname + " "+ version+" " +code+" "+texture +" "+price +" "+quantity +" "+unit +":成功" +"</p>" |
||||
|
re += show |
||||
|
} |
||||
|
for (let i = 0; i < res.data.errMsg.length; i++) { |
||||
|
var show = "<p style='color: #ff211e'>"+res.data.errMsg[i] + ":错误"+"</p>" |
||||
|
re += show |
||||
|
} |
||||
|
layer.open({ |
||||
|
type: 1, |
||||
|
skin: 'layui-layer-rim', //加上边框 |
||||
|
area: ['500px', '500px'], //宽高 |
||||
|
content: re |
||||
|
}) |
||||
|
}else{ |
||||
|
layer.msg(res.msg) |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
error:function (){ |
||||
|
var demoText = $('#demoText'); |
||||
|
demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>'); |
||||
|
demoText.find('.demo-reload').on('click', function(){ |
||||
|
upLoader.upload() |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
//监听表格复选框选择 |
||||
|
table.on('checkbox(currentTableFilter)', function (obj) { |
||||
|
console.log(obj) |
||||
|
}); |
||||
|
|
||||
|
table.on('tool(currentTableFilter)', function (obj) { |
||||
|
let data = obj.data; |
||||
|
|
||||
|
if (obj.event === 'detail') { |
||||
|
var index = layer.open({ |
||||
|
title: '仓库信息详情', |
||||
|
type: 2, |
||||
|
shade: 0.2, |
||||
|
maxmin: true, |
||||
|
shadeClose: true, |
||||
|
area: ['100%', '100%'], |
||||
|
content: '/material_view?id='+data.id, |
||||
|
}); |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index); |
||||
|
}); |
||||
|
return false; |
||||
|
} |
||||
|
else if (obj.event === 'delete') { |
||||
|
var req={}; |
||||
|
req.id=data.id; |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url: '/material/material_del', |
||||
|
dataType:'json', |
||||
|
type:'POST', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data:JSON.stringify(req), |
||||
|
beforeSend:function () { |
||||
|
this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] }); |
||||
|
}, |
||||
|
success:function(data){ |
||||
|
layer.close(this.layerIndex); |
||||
|
if(data.status >= 300){ |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
}else{ |
||||
|
obj.del(); |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
} |
||||
|
else if (obj.event == 'realDelete'){ //彻底删除 |
||||
|
var req={}; |
||||
|
req.id=data.id; |
||||
|
layer.confirm('该操作会造成不可逆后果,是否继续?', { |
||||
|
btn: ['继续','取消'] //按钮 |
||||
|
}, function(){ |
||||
|
$.ajax({ |
||||
|
url: '/material/realDeleteMaterial', |
||||
|
dataType:'json', |
||||
|
type:'POST', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data:JSON.stringify(req), |
||||
|
beforeSend:function () { |
||||
|
this.layerIndex = layer.load(0, { shade: [0.5, '#393D49'] }); |
||||
|
}, |
||||
|
success:function(data){ |
||||
|
layer.close(this.layerIndex); |
||||
|
if(data.status >= 300){ |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
}else{ |
||||
|
obj.del(); |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
},function (){ |
||||
|
// 执行重加载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/repository/warehouseRecord', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where: {"parentId":parentId} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
else if (obj.event == 'manager'){ |
||||
|
|
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: '仓管员信息', |
||||
|
shadeClose: true, |
||||
|
shade: false, |
||||
|
maxmin: true, //开启最大化最小化按钮 |
||||
|
area: ['893px', '600px'], |
||||
|
content: '/ManagerViewByMid?id='+data.id |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
//监听状态操作 |
||||
|
form.on('switch(changeState)', function(obj){ |
||||
|
var req = new Map |
||||
|
if(obj.elem.checked){ |
||||
|
req["state"] = 1 |
||||
|
} |
||||
|
req["id"] = this.value |
||||
|
console.log(JSON.stringify(req)) |
||||
|
$.ajax({ |
||||
|
url: "/material/material_edit", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("修改成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
},function(){ |
||||
|
window.location='/material_out' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,140 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<fieldset class="table-search-fieldset"> |
||||
|
<legend>库位创建</legend> |
||||
|
<div class="layui-fluid"> |
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-body" style="padding-top: 40px;"> |
||||
|
<div> |
||||
|
<form class="layui-form" |
||||
|
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" lay-filter="form1"> |
||||
|
<input style="display: none" th:value="${depositoryId}" name="depositoryId" id="depositoryID"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">库位行:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写行数" class="layui-input" |
||||
|
name="place_x" 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" |
||||
|
name="place_y" 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" |
||||
|
name="place_z" 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" |
||||
|
name="max" 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" |
||||
|
name="min" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" lay-submit lay-filter="formStep"> |
||||
|
 创建库位  |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
<hr> |
||||
|
</div> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
|
||||
|
<script> |
||||
|
var data; |
||||
|
|
||||
|
layui.use(['form', 'layer','dropdown','tree'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
layer = layui.layer; |
||||
|
|
||||
|
var depositoryId = $("#depositoryId").val(); |
||||
|
form.on('submit(formStep)', function (data) { |
||||
|
var req = data.field; |
||||
|
req.type = "one"; |
||||
|
$.ajax({ |
||||
|
url: "/place/addPlace", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("添加成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
window.location="/insertPlace?depositoryId="+depositoryId |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
complete: function () { |
||||
|
form.val("form1", { |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
form.on('select(depositoryId)',function (data){ |
||||
|
$.ajax({ |
||||
|
url:"/repository/findDepositoryByParent?parentId="+data.value, |
||||
|
type:'get', |
||||
|
dataType:'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success:function(d){ |
||||
|
console.log(d.data) |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,131 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<fieldset class="table-search-fieldset"> |
||||
|
<legend>库位创建</legend> |
||||
|
<div class="layui-fluid"> |
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-body" style="padding-top: 40px;"> |
||||
|
<div> |
||||
|
<form class="layui-form" |
||||
|
style="margin: 0 auto;max-width: 700px;padding-top: 100px; padding-bottom: 200px" lay-filter="form1"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">库位行:</label> |
||||
|
<input th:value="${place.getId()}" name = "id" type="text" style="display: none"> |
||||
|
<input th:value="${place.getDid()}" id="depositoryId" name = "did" type="text" style="display: none"> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写行数" class="layui-input" th:value="${place.getX()}" |
||||
|
name="place_x" 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" th:value="${place.getY()}" |
||||
|
name="place_y" 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" th:value="${place.getZ()}" |
||||
|
name="place_z" 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" th:value="${place.getMax()}" |
||||
|
name="max" 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" th:value="${place.getMin()}" |
||||
|
name="min" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" lay-submit lay-filter="formStep"> |
||||
|
 提交  |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
<hr> |
||||
|
</div> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
|
||||
|
<script> |
||||
|
var data; |
||||
|
|
||||
|
layui.use(['form', 'layer','dropdown','tree'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
layer = layui.layer; |
||||
|
|
||||
|
var depositoryId = $("#depositoryId").val(); |
||||
|
form.on('submit(formStep)', function (data) { |
||||
|
var req = data.field; |
||||
|
req.type = "one"; |
||||
|
$.ajax({ |
||||
|
url: "/place/place_edit", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("修改成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
var index = parent.layer.getFrameIndex(window.name); |
||||
|
parent.layer.close(index);//关闭当前页 |
||||
|
window.location='/warehouseByParentId?parentId='+depositoryId; |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
complete: function () { |
||||
|
form.val("form1", { |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue