Browse Source

1.mysql同步redis15数据库

2.物料查询PC端列表增加显示条形码数字和图片PC端,图片可点击放大查看
3.物料查询手机端详情默认显示条形码图片,增加复制条形码按钮.
4.物料查询只有手机端的详情页点击修改按钮进入编辑页面才能看到之前生成的二维码数据,系统不再生成二维码,用户可在此界面将其删除.此界面的删除功能已经修复,可以正常使用.界面中新增生成按钮,点击生成则首先弹窗提醒用户该物料无条形码可扫描录入时可以生成,生成是将本物料的物料编码作为物料的条形码.是否确定生成?
5.库存查询搜索条件中增加一个开关(不显示库存总数为0),开启时不显示库存总数为0,关闭时还是显示(默认开启),pc手机端均已增加.
6.库存查询列表中库存总数申请总数表头增加排序功能(pc端)
liwx
liwenxuan 2 years ago
parent
commit
1db41cd326
  1. 91
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  2. 26
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  3. 21
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/MaterialMapper.java
  4. 176
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/MaterialMapper.xml
  5. 7
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/QrCodeMapper.java
  6. 8
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/QrCodeMapper.xml
  7. 10
      src/main/java/com/dreamchaser/depository_manage/entity/Material.java
  8. 4
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndBarCode.java
  9. 179
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialWithBarCode.java
  10. 9
      src/main/java/com/dreamchaser/depository_manage/service/MaterialService.java
  11. 49
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  12. 17
      src/main/resources/templates/pages/depository/table-stock.html
  13. 11
      src/main/resources/templates/pages/depository/table-stock_mobile.html
  14. 31
      src/main/resources/templates/pages/material/material-out.html
  15. 1
      src/main/resources/templates/pages/material/material-out_mobile.html
  16. 51
      src/main/resources/templates/pages/material/material-view.html
  17. 58
      src/main/resources/templates/pages/materialBarCode/materialBarCode_out.html
  18. 2
      src/main/resources/templates/pages/warehouse/depository-out.html

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

@ -14,6 +14,7 @@ import com.dreamchaser.depository_manage.utils.CrudUtil;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.redisson.misc.Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -69,7 +70,23 @@ public class MaterialController {
map.put("materialTypeIds", childForMaterialTypeByParent);
map.remove("materialTypeId");
}
List<Material> materialPByCondition = materialService.findMaterialPByConditionForTable(map);
List<MaterialWithBarCode> materialPByCondition = materialService.findMaterialPWithBarCodeByConditionForTable(map);
for(MaterialWithBarCode item :materialPByCondition){//物料查询电脑端列表不显示barCodeFlag=2的(二维码)
// System.out.println(item.getBarCode());
if(item.getBarCode()!=null){
if(item.getBarCodeFlag().equals("2")){
item.setBarCode("");
}else{
try {
Map<String,String> barCodeImgObjMap = (Map<String,String>)RestResponse.CreateBarCode(item.getBarCode(), item.getMname()).getData();
item.setQrCode64(barCodeImgObjMap.get("qrCode"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return new RestResponse(materialPByCondition, materialService.findCountByCondition(map), 200);
}
@ -187,9 +204,13 @@ public class MaterialController {
}
}
if(map.get("excludeZeroSwitch")==null){//默认不显示库存为0
map.put("excludeZeroSwitch","1");
}
list = materialService.findInventory(map);
total = materialService.findInventoryCount(map);
//如果开了隐藏开关,在此循环过滤掉库存为0的
return new RestResponse(list, total, 200);
}
@ -771,9 +792,10 @@ public class MaterialController {
// 构造物料二维码
@PostMapping("/createQrCode")
public RestResponse createQrCode(@RequestBody Map<String, Object> map) {
@PostMapping("/createQrCodeOld")
public RestResponse createQrCodeOld(@RequestBody Map<String, Object> map) {
// 通过雪花算法计算随机数
Snowflake snowflake = new Snowflake(10, 10, true);
String qrCode = snowflake.nextIdStr();
@ -799,6 +821,42 @@ public class MaterialController {
}
/**
* 生成物料条码(将物料编号作为条形码数字)
* 查询是否已有flag=1的barCode
* 如果有就不能生成
* 没有则生成flag=1的barCode
* @param map
* @return
*/
@PostMapping("/createQrCode")
public RestResponse createQrCode(@RequestBody Map<String, Object> map) {
String qrCode = "";
Long mid = ObjectFormatUtil.toLong(map.get("mid"));
Material material = materialService.findMaterialById(mid);
String qrCodeByMcode = materialService.findQrCodeByMcodeFlag1(material.getCode());
if (qrCodeByMcode == null) {//
Map<String, Object> param = new HashMap<>();
param.put("mcode", material.getCode());
param.put("qrCode", material.getCode());
materialService.addQrCodeByMaterial(param);
} else {//已经有了条码
qrCode = qrCodeByMcode;
}
try {
// 二维码保存信息
return RestResponse.CreateBarCode(qrCode, material.getMname());
} catch (IOException e) {
return new RestResponse("err: " + e.getMessage(), 678, new StatusInfo("失败", "请联系开发人员"));
}
}
// 将扫描结果数据暂存到redis中
@PostMapping("/temporaryValue")
public RestResponse temporaryValue(@RequestBody Map<String, Object> map, HttpServletRequest request) {
@ -1527,6 +1585,31 @@ public class MaterialController {
}
}
// 删除条形码与物料编码的对应关系
@PostMapping("/delBarCodeByMaterialAndFlag")
public RestResponse delBarCodeByMaterialAndFlag(@RequestBody Map<String, Object> map, HttpServletRequest request) {
Integer res = 0;
if (map.containsKey("ids")) {
//List ids = ObjectFormatUtil.objToList(map.get("ids"),Integer.class);
List<HashMap> toDelList = (List<HashMap>) map.get("ids");
for (HashMap delItem : toDelList) {
HashMap<String, Object> map1 = new HashMap<>();
map1.put("id", delItem.get("id"));
map1.put("flag", delItem.get("flag"));
res += materialService.delBarCodeByMaterial(map1);
}
return CrudUtil.deleteHandle(res, toDelList.size());
} else if (map.containsKey("id")) {
res += materialService.delBarCodeByMaterial(map);
return CrudUtil.deleteHandle(res, 1);
} else {
throw new MyException("所需请求参数缺失!");
}
}
// 用于盘点时获取物料
@PostMapping("/findMaterialForTaking")
public RestResponse findMaterialForTaking(@RequestBody Map<String, Object> map, HttpServletRequest request) {

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

@ -729,8 +729,32 @@ public class PageController {
mv.addObject("display", "none");
}
List<MaterialAndBarCode> materialByBarCodeByCondition = materialService.findMaterialByBarCodeByCondition(map);
mv.addObject("record", materialService.findMaterialAndTypeById(id));
Material materialWithBase64 = materialService.findMaterialAndTypeById(id);
//mv.addObject("record", materialService.findMaterialAndTypeById(id));
mv.addObject("barCodeList", materialByBarCodeByCondition);
//在此添加图片对象,(flag=1的)
String qrCode = "";
if(materialByBarCodeByCondition.size()==0){//没有flag=1的barCode数据
}else{//有
for(MaterialAndBarCode m:materialByBarCodeByCondition){
if(m.getFlag()==1){//
qrCode = m.getBmcode();
break;
}
}
try {
Map<String,String> barCodeImgObjMap = (Map<String,String>)RestResponse.CreateBarCode(qrCode, material.getMname()).getData();
materialWithBase64.setQrCode64(barCodeImgObjMap.get("qrCode"));
materialWithBase64.setQrCodeValue(barCodeImgObjMap.get("codeValue"));
//mv.addObject("barCodeImgObj", barCodeImgObj);
} catch (IOException e) {
e.printStackTrace();
}
}
mv.addObject("record", materialWithBase64);
} else {
throw new MyException("缺少必要参数!");
}

21
src/main/java/com/dreamchaser/depository_manage/depository_mapper/MaterialMapper.java

@ -131,6 +131,14 @@ public interface MaterialMapper {
*/
List<Material> findMaterialByCondition(Map<String, Object> map);
/**
* 根据条件查询符合条件的库存信息(带条形码)
*
* @param map 条件map
* @return 符合条件的库存信息
*/
List<MaterialWithBarCode> findMaterialWithBarCodeByCondition(Map<String, Object> map);
/**
* 根据条件查询物料总数
@ -329,17 +337,28 @@ public interface MaterialMapper {
*/
Integer findMaterialByDepositoryCount(Map<String, Object> map);
/**
* 通过条形码获取物料信息(带flag)
*
* @param map
* @return
*/
//List<MaterialAndBarCode> findMaterialByBarCodeByCondition(Map<String, Object> map);
List<MaterialAndBarCode> findMaterialWithFlagByBarCodeByCondition(Map<String, Object> map);
/**
* 通过条形码获取物料信息
*
* @param map
* @return
*/
List<MaterialAndBarCode> findMaterialByBarCodeByCondition(Map<String, Object> map);
List<MaterialAndBarCode> findMaterialByBarCodeByCondition(Map<String, Object> map);
Material findMaterialByCode(String code);
/**
* 通过条件获取条形码与物料的对应关系数量
*

176
src/main/java/com/dreamchaser/depository_manage/depository_mapper/MaterialMapper.xml

@ -28,6 +28,30 @@
<result column="tname" property="typeName" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="materialMapWithBarCode" type="com.dreamchaser.depository_manage.entity.MaterialWithBarCode">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="depository_id" property="depositoryId" jdbcType="BIGINT"/>
<result column="mname" property="mname" jdbcType="VARCHAR"/>
<result column="quantity" property="quantity" jdbcType="BIGINT"/>
<result column="price" property="price" jdbcType="BIGINT"/>
<result column="type_id" property="materialTypeId" jdbcType="BIGINT"/>
<result column="state" property="state" jdbcType="INTEGER"/>
<result column="code" property="code" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="amounts" property="amounts" jdbcType="INTEGER"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/>
<result column="texture" property="texture" jdbcType="VARCHAR"/>
<result column="number_of_temporary" property="numberOfTemporary" jdbcType="BIGINT"/>
<result column="producedDate" property="producedDate" jdbcType="INTEGER"/>
<result column="shelfLife" property="shelfLife" jdbcType="INTEGER"/>
<result column="productionPlace" property="productionPlace" jdbcType="VARCHAR"/>
<result column="brand" property="brand" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="barCode" property="barCode" jdbcType="VARCHAR"/>
<result column="flag" property="barCodeFlag" jdbcType="VARCHAR"/>
<result column="tname" property="typeName" jdbcType="VARCHAR"/>
</resultMap>
<!-- 字段映射 -->
<resultMap id="InventoryMap" type="com.dreamchaser.depository_manage.entity.Inventory">
@ -122,6 +146,25 @@
</resultMap>
<!-- 条形码与物料对应(带flag)-->
<resultMap id="BarCodeAndMaterialWithFlagMap" type="com.dreamchaser.depository_manage.entity.MaterialAndBarCode">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="price" property="price" jdbcType="BIGINT"/>
<result column="texture" property="texture" jdbcType="VARCHAR"/>
<result column="mname" property="mname" jdbcType="VARCHAR"/>
<result column="unit" property="unit" jdbcType="VARCHAR"/>
<result column="version" property="version" jdbcType="VARCHAR"/>
<result column="tname" property="tname" jdbcType="VARCHAR"/>
<result column="mcode" property="mcode" jdbcType="VARCHAR"/>
<result column="bmcode" property="bmcode" jdbcType="VARCHAR"/>
<result column="mid" property="mid" jdbcType="BIGINT"/>
<result column="iid" property="iid" jdbcType="BIGINT"/>
<result column="mtid" property="mtid" jdbcType="BIGINT"/>
<result column="mtid" property="mtid" jdbcType="BIGINT"/>
<result column="codeFlag" property="flag" jdbcType="INTEGER"/>
</resultMap>
<!-- 表查询字段 -->
<sql id="allColumns">
m.id, m.depository_id, m.mname, m.quantity, m.price, m.type_id,m.state,m.code ,m.version ,m.amounts ,m.unit ,m.texture,m.depositoryCode,m.number_of_temporary,m.shelfLife,m.producedDate,m.productionPlace,m.brand,m.remark
@ -136,6 +179,10 @@
<sql id="allColumnsAndTypeNameOnView">
id,depository_id,mname,quantity,price,type_id,state,tname,dname,version ,unit ,texture,code,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark
</sql>
<!-- 表查询字段,包括物料类型 用于视图 liwenxuan-->
<sql id="allColumnsAndTypeNameOnView1">
findMaterial.id,depository_id,mname,quantity,price,type_id,state,tname,dname,version ,unit ,texture,code,depositoryCode,producedDate,shelfLife,productionPlace,brand,remark,barCode,qrcodeandmaterial.flag
</sql>
<!-- 表查询字段,包括物料类型 用于库存视图-->
<sql id="allColumnsAndTypeNameOnViewByInventory">
id,mid,depositoryId,mname,quantity,price,mtid,mstate,tname,dname,version ,unit ,
@ -151,6 +198,11 @@
<sql id="materialAndBarCode">
id,bmcode,mcode,mid,depositoryId,mname,mtid,version,texture,unit,tname,price,shelfLife
</sql>
<!-- 表查询字段,用于查询物料与条形码视图-->
<sql id="materialAndBarCodeWithFlag">
id,bmcode,mcode,mid,depositoryId,mname,mtid,version,texture,unit,tname,price,shelfLife,codeFlag
</sql>
<!-- 查询所有数据的条数 -->
<select id="findCount" resultType="integer">
SELECT count(*)
@ -219,8 +271,6 @@
</if>
</select>
<!-- 根据条件参数查询数据列表 -->
<select id="findMaterialByCondition" resultMap="materialMap" parameterType="map">
SELECT
@ -281,6 +331,68 @@
</if>
</select>
<!-- 根据条件参数查询数据列表 -->
<select id="findMaterialWithBarCodeByCondition" resultMap="materialMapWithBarCode" parameterType="map">
SELECT
<include refid="allColumnsAndTypeNameOnView1"/>
from findMaterial left join qrcodeandmaterial on findMaterial.code = qrcodeandmaterial.mcode
where 1 = 1
<if test="mid != null">
and findMaterial.id = #{mid}
</if>
<if test="mname != null and mname != ''">
AND mname LIKE CONCAT('%', #{mname}, '%')
</if>
<if test="version != null">
and version LIKE concat('%',#{version},'%')
</if>
<if test="quantity != null">
AND quantity = #{quantity}
</if>
<if test="price != null">
AND price = #{price}
</if>
<if test="materialTypeId != null">
AND type_id = #{materialTypeId}
</if>
<if test="materialTypeIds != null and materialTypeIds != ''">
and type_id in
<foreach collection="materialTypeIds" index="index" item="mtId" open="(" separator="," close=")">
#{mtId}
</foreach>
</if>
<if test="state != null and state != ''">
And state = #{state}
</if>
<if test="code != null and code != '' ">
and code = #{code}
</if>
<if test="shelfLife != null">
and #{shelfLife} >= shelfLife
</if>
<if test="producedDate != null">
and producedDate >= #{producedDate}
</if>
<if test="productionPlace != null and productionPlace !=''">
and productionPlace = #{productionPlace}
</if>
<if test="brand != '' and brand != null">
and brand LIKE CONCAT('%', #{brand}, '%')
</if>
<if test="remark != '' and remark != null">
and remark LIKE CONCAT('%', #{remark}, '%')
</if>
<if test="state != null and state != ''">
and state = #{state}
</if>
and depository_id is null
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
</select>
<!-- 根据物料id查询所有物料与生产日期的对应-->
<select id="findMaterialAndProducedDateByMid" resultMap="MaterialAndProducedDate" parameterType="long">
select
@ -367,6 +479,9 @@
<if test="remark != '' and remark != null">
and remark LIKE CONCAT('%', #{remark}, '%')
</if>
<if test='excludeZeroSwitch != "" and excludeZeroSwitch != null and excludeZeroSwitch.equals("1")'>
and quantity > 0
</if>
<if test="begin != null and size != null">
LIMIT #{begin},#{size}
</if>
@ -613,6 +728,10 @@
<if test="productionPlace != null and productionPlace !=''">
and productionPlace = #{productionPlace}
</if>
<if test='excludeZeroSwitch != "" and excludeZeroSwitch != null and excludeZeroSwitch.equals("1")'>
and quantity > 0
</if>
<if test="brand != '' and brand != null">
and brand LIKE CONCAT('%', #{brand}, '%')
</if>
@ -725,6 +844,57 @@
group by bmcode
</select>
<!-- 根据条形码查询物料-->
<select id="findMaterialWithFlagByBarCodeByCondition" resultMap="BarCodeAndMaterialWithFlagMap" parameterType="map">
select
<include refid="materialAndBarCodeWithFlag"/>
from materialandbarcode
where 1 = 1
<if test="barCode != null and barCode != ''">
and bmcode = #{barCode}
</if>
<if test="mcode != null and mcode != ''">
and mcode = #{mcode}
</if>
<if test="mid != null">
and mid = #{mid}
</if>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="depositoryId != null and depositoryId != ''">
and depositoryId = #{depositoryId}
</if>
<if test="mname != null and mname != ''">
AND mname LIKE CONCAT('%', #{mname}, '%')
</if>
<if test="typeId != null">
and mtid = #{typeId}
</if>
<if test="tname != null and tname != ''">
AND tname LIKE CONCAT('%', #{tname}, '%')
</if>
<if test="shelfLife != null">
and #{shelfLife} >= shelfLife
</if>
<if test="producedDate != null">
and producedDate >= #{producedDate}
</if>
<if test="productionPlace != null and productionPlace !=''">
and productionPlace = #{productionPlace}
</if>
<if test="brand != '' and brand != null">
and brand LIKE CONCAT('%', #{brand}, '%')
</if>
<if test="remark != '' and remark != null">
and remark LIKE CONCAT('%', #{remark}, '%')
</if>
<if test="codeFlag != '' and codeFlag != null">
and codeFlag = #{codeFlag}
</if>
group by bmcode
</select>
<!-- 根据物料编码code查询对应的二维码-->
<select id="findMaterialByBarCodeByMcode" resultMap="BarCodeAndMaterialMap" parameterType="String">
select
@ -1075,7 +1245,7 @@
<if test="id != null and id != ''">
and id = #{id}
</if>
and flag = 1
and flag = #{flag}
</delete>

7
src/main/java/com/dreamchaser/depository_manage/depository_mapper/QrCodeMapper.java

@ -30,6 +30,13 @@ public interface QrCodeMapper {
*/
String selectQrCodeByMcode(String mcode);
/**
* 通过物料编码获取对应的二维码信息
* @param mcode
* @return
*/
String selectQrCodeByMcodeFlag1(String mcode);
/**
* 根据二维码获取对应的物料编码
* @param qrCode

8
src/main/java/com/dreamchaser/depository_manage/depository_mapper/QrCodeMapper.xml

@ -52,7 +52,7 @@
#{id},
#{qrCode},
#{mcode},
2
1
)
</insert>
@ -75,6 +75,12 @@
where mcode = #{mcode} and flag = 2
</select>
<select id="selectQrCodeByMcodeFlag1" parameterType="string" resultType="string">
select barCode
from qrcodeandmaterial
where mcode = #{mcode} and flag = 1
</select>
<select id="findMaterialCodeByQrCode" parameterType="string" resultType="string">
select mcode

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

@ -151,6 +151,16 @@ public class Material implements Serializable {
*/
private String showShelfLife;
/**
* base64条码图片
*/
private String qrCode64;
/**
* 条码数字
*/
private String qrCodeValue;
/**
* 该物料对应的拆单记录
*/

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

@ -86,5 +86,9 @@ public class MaterialAndBarCode {
* 用于暂存当前物料存在的仓库
*/
private List<Depository> depositoryList;
/**
* 条码/二维码
*/
private Integer flag;
}

179
src/main/java/com/dreamchaser/depository_manage/entity/MaterialWithBarCode.java

@ -0,0 +1,179 @@
package com.dreamchaser.depository_manage.entity;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
/**
* 产品信息记录库存(material)
*
* @author Dreamchaser
* @version 1.0.0 2021-05-20
*/
@Data
public class MaterialWithBarCode implements Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = 4604245526757565755L;
/**
* 存储id
*/
private Long id;
/**
* 仓库id
*/
private Long depositoryId;
/**
* 物料名称
*/
private String mname;
/**
* 数量
*/
private Long quantity;
/**
* 总金额
*/
private Double amounts;
/**
* 物料种类id
*/
private Long materialTypeId;
/**
* 物料状态
*/
private Integer state;
/**
* 存货编码
*/
private String code;
/**
* 规格型号
*/
private String version;
/**
* 单价
*/
private Double price;
/**
* 类型名称
*/
private String typeName;
/**
* 物料编码与条形码的对应关系
*/
private List<MaterialAndBarCode> materialAndBarCodeList;
/**
* 物料类型
*/
private MaterialType materialType;
/**
* 所属仓库
*/
private Depository depository;
/**
* 计量单位
*/
private String unit;
/**
* 材质
*/
private String texture;
/**
* 仓库编码
*/
private String depositoryCode;
/**
* 库位编码
*/
private String placeCode;
/**
* 暂存额度
*/
private Integer numberOfTemporary;
/**
* 生产日期
*/
private Long producedDate;
/**
* 保质期
*/
private Long shelfLife;
/**
* 产地
*/
private String productionPlace;
/**
* 生产日期
*/
private String brand;
/**
* 备注
*/
private String remark;
/**
* 条形码
*/
private String barCode;
/**
* 条形码flag
*/
private String barCodeFlag;
/**
* 生产日期
*/
private String showProducedDate;
/**
* 保质期
*/
private String showShelfLife;
/**
* base64条码图片
*/
private String qrCode64;
/**
* 该物料对应的拆单记录
*/
private List<SplitInfo> splitInfoList;
/**
* 用于暂存该物料所在的仓库
*/
private List<Depository> depositoryList;
}

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

@ -60,6 +60,13 @@ public interface MaterialService {
List<Material> findMaterialPByConditionForTable(Map<String, Object> map);
/**
* 根据条件查询符合条件的物料信息用于表格展示
* @param map 条件map
* @return 符合条件的物料信息
*/
List<MaterialWithBarCode> findMaterialPWithBarCodeByConditionForTable(Map<String, Object> map);
/**
* 根据物料名与物料规格型号查询对应的物料
* @param map
@ -340,6 +347,8 @@ public interface MaterialService {
*/
String findQrCodeByMcode(String Mcode);
String findQrCodeByMcodeFlag1(String Mcode);
/**
* 根据二维码获取对应的物料编码
* @param qrCode

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

@ -288,6 +288,42 @@ public class MaterialServiceImpl implements MaterialService {
return materialByCondition;
}
/**
* 根据条件查询符合条件的物料信息用于表格展示
*
* @param map 条件map
* @return 符合条件的物料信息
*/
@Override
public List<MaterialWithBarCode> findMaterialPWithBarCodeByConditionForTable(Map<String, Object> map) {
Integer size = 15, page = 1;
if (map.containsKey("size")) {
size = ObjectFormatUtil.toInteger(map.get("size"));
map.put("size", size);
}
if (map.containsKey("page")) {
page = ObjectFormatUtil.toInteger(map.get("page"));
map.put("begin", (page - 1) * size);
}
Object state = 1;
if (map.containsKey("state")) {
state = map.get("state");
}
map.put("state", state);
List<MaterialWithBarCode> materialByCondition = materialMapper.findMaterialWithBarCodeByCondition(map);
for (MaterialWithBarCode material : materialByCondition
) {
if (material.getPrice() != null) {
material.setPrice(material.getPrice() / 100);
}
if (material.getBrand() == null) {
material.setBrand("");
}
}
return materialByCondition;
}
/**
* 根据物料名与物料规格型号查询对应的物料
*
@ -1240,7 +1276,7 @@ public class MaterialServiceImpl implements MaterialService {
*/
@Override
public List<MaterialAndBarCode> findMaterialByBarCodeByCondition(Map<String, Object> map) {
return materialMapper.findMaterialByBarCodeByCondition(map);
return materialMapper.findMaterialWithFlagByBarCodeByCondition(map);
}
/**
@ -1336,6 +1372,17 @@ public class MaterialServiceImpl implements MaterialService {
@Override
public String findQrCodeByMcode(String Mcode) {
return qrCodeMapper.selectQrCodeByMcode(Mcode);
}//
/**
* 根据物料编码获取与二维码的对应关系
*
* @param Mcode
* @return
*/
@Override
public String findQrCodeByMcodeFlag1(String Mcode) {
return qrCodeMapper.selectQrCodeByMcodeFlag1(Mcode);
}
/**

17
src/main/resources/templates/pages/depository/table-stock.html

@ -68,6 +68,13 @@
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">隐藏0库存</label>
<div class="layui-input-block">
<input type="checkbox" checked name="excludeZeroSwitch" lay-skin="switch" lay-filter="excludeZeroSwitchFilter" value="1" lay-text="已隐藏|未隐藏">
</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> 搜 索
@ -219,8 +226,8 @@
{field: 'version', width: 200, title: '规格型号'},
{field: 'typeName', width: 200, title: '物料类型', hide: true},
{field: "unit", title: '计量单位', width: 100, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 100, title: '库存总数'},
{field: 'numberOfTemporary', width: 100, title: '申请总数'},
{field: 'quantity', width: 110, title: '库存总数',sort: true},
{field: 'numberOfTemporary', width: 110, title: '申请总数',sort: true},
{field: 'depositoryName', width: 200, title: '仓库名称'},
{field: 'depositoryCode', width: 200, title: '仓库编码', hide: true},
// {title: '所处库位', width: 200, templet: '#changePlace', align: "center"},
@ -376,10 +383,16 @@
if (data.version !== '') {
req.version = data.version.trim();
}
if (data.excludeZeroSwitch !== undefined) {//1-开关打开-隐藏; 0-开关关闭-显示
req.excludeZeroSwitch = data.excludeZeroSwitch;
}else{
req.excludeZeroSwitch = '0';
}
if (data.materialTypeId !== '') {
req.materialTypeId = data.materialTypeId;
}
reqForPublic = req;
//console.log(reqForPublic)
//执行搜索重载
table.reloadData('currentTableId', {
url: '/material/findInventory',

11
src/main/resources/templates/pages/depository/table-stock_mobile.html

@ -82,6 +82,12 @@
placeholder="请填写物料型号"/>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">隐藏0库存</label>
<div class="layui-input-block">
<input type="checkbox" checked name="excludeZeroSwitch" lay-skin="switch" lay-filter="excludeZeroSwitchFilter" value="1" lay-text="已隐藏|未隐藏">
</div>
</div>
<div class="layui-inline">
<button type="submit" class="layui-btn layui-btn-primary" lay-submit
@ -253,6 +259,11 @@
if (data.materialTypeId !== '') {
req.materialTypeId = data.materialTypeId;
}
if (data.excludeZeroSwitch !== undefined) {//1-开关打开-隐藏; 0-开关关闭-显示
req.excludeZeroSwitch = data.excludeZeroSwitch;
}else{
req.excludeZeroSwitch = '0';
}
updateFlow(req);
//执行搜索重载
return false;

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

@ -116,6 +116,14 @@
<script id="materialCode" type="text/html">
<a id="{{d.id}}" onclick="showDetail(this)">{{d.code}}</a>
</script>
<script id="barCode" type="text/html">
<a id="{{d.barCode}}" >{{d.barCode}}</a>
</script>
<script id="barCode64" type="text/html">
<img src="{{d.qrCode64}}" onclick="showImg(this)">
</script>
<script type="text/html" id="currentTableBar">
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" th:style="'display:'+${display}"
lay-event="delete">删除</a>
@ -140,6 +148,9 @@
function showDetail() {
}
function showImg(){
}
function closeShowDataMessage() {
@ -236,6 +247,8 @@
{field: 'unit', width: 150, title: '计量单位'},
{field: 'state', title: '状态', minWidth: 100, templet: '#switchTpl'},
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"},
{title: '条型码', width: 210, templet: '#barCode'},
{title: '条型码图片', width: 210, templet: '#barCode64'},
{field: 'texture', width: 100, title: '材质'},
{field: 'brand', width: 150, title: '品牌'},
{field: 'shelfLife', width: 150, title: '保质期'},
@ -774,6 +787,24 @@
});
return false;
}
showImg= function (obj) {
var imgSrc = obj.getAttribute('src');
layer.open({
type: 1,
skin: 'ayui-layer-nobg',
maxHeight: 960,
closeBtn: 0,
title: false,
shadeClose: true, //开启遮罩关闭
content: '<img style="height: 100%" src="' + imgSrc + '" />'
});
}
});
</script>

1
src/main/resources/templates/pages/material/material-out_mobile.html

@ -250,6 +250,7 @@
showDetail = function (obj) {
console.log(obj);
var index = layer.open({
title: '物料信息详情',
type: 2,

51
src/main/resources/templates/pages/material/material-view.html

@ -130,11 +130,17 @@
<div class="layui-form-item">
<label class="layui-form-label">打印码</label>
<div class="layui-input-inline">
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal"
onclick="createQrCode()" value="生成"/>
<!--<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal"
onclick="createQrCode()" value="生成"/>-->
<img id="barCode" th:src="${record.getQrCode64()}" ><!--<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCA-->
<div id="codeItem" style="display:none;">
<img id="barCode">
<!--<img id="barCode">-->
<input id ="inCopy" type="text" style="display:none;" th:value="${record.getQrCodeValue()}">
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
<button id="copy" type="button" onclick="copyBarCode()" class="layui-btn">复制条形码</button>
</div>
</div>
@ -142,7 +148,7 @@
<div class="layui-form-item">
<label class="layui-form-label">条形码</label>
<div class="layui-input-block">
<input class="layui-btn layui-btn-warm" type="button" onclick="checkBarCode()" value="查看">
<input class="layui-btn layui-btn-warm" type="button" onclick="checkBarCode()" value="修改">
</div>
</div>
<div class="layui-form-item">
@ -167,7 +173,9 @@
</div>
</form>
<script src="/static/lib/layui-v2.8.6/layui.js" charset="utf-8"></script>
<script>
function changeQrCodeState() {
}
@ -183,13 +191,32 @@
}
function copyBarCode(){
}
// 用于标志是否为第一次提交
let flagForForm = false;
var barCode = [];
var flag = false;
layui.use(['form', 'laydate'], function () {
var form = layui.form, laydate = layui.laydate, $ = layui.$;
//页面一打开就执行弹层
layer.ready(function(){
//layer.msg('很高兴一开场就见到你');
var imgsrc = $("#barCode").attr("src");
if(imgsrc.length>10){
$("#codeItem").show();
}
});
let display = $("#priceItem").css("display");
if (display === "none") {
$("#mname").attr("readonly", "readonly");
@ -295,6 +322,22 @@
})
};
copyBarCode = function () {//实现点击复制
var copyipt = document.createElement("input");
var text = "需要复制的内容";
text = $("#inCopy").val()
copyipt.setAttribute("value", text);
document.body.appendChild(copyipt);
copyipt.select();
document.execCommand("copy");
document.body.removeChild(copyipt);
layer.msg('已复制');
};
createQrCode = function () {
var mid = $("#mid").val();
var req = {};

58
src/main/resources/templates/pages/materialBarCode/materialBarCode_out.html

@ -22,8 +22,10 @@
<input style="display: none" id="barCodeList">
<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 data-add-btn" lay-event="add"> 添加</button>
<button class="layui-btn layui-btn-sm layui-btn-normal data-delete-btn" lay-event="create" onclick="createQrCode()"> 生成</button>
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除</button>
</div>
</script>
@ -54,6 +56,46 @@
upload = layui.upload;
var mid = $("#mid").val();
createQrCode = function () {
var indexConfirm = layer.confirm('物料无条形码可扫描录入时可以生成,生成是将本物料的物料编码作为物料的条形码.是否确定生成?', {icon: 3}, function(){
//layer.msg('点击确定的回调', {icon: 1});
var req = {};
req.mid = mid;
$.ajax({
url: "/material/createQrCode",
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 (d) {
var data = d.data;
if(data.codeValue!=""){
alert("已有条形码,如需更换请先删除!")
}
layer.close(this.layerIndex);
table.reloadData('currentTableId', {
url: '/material/findMaterialBarCode',
page: {
curr: 1
},
where: {"mid": mid}
});
}
})
layer.close(indexConfirm);
}, function(){
});
}
table.render({
elem: "#currentTableId",
url: '/material/findMaterialBarCode',
@ -91,7 +133,7 @@
{field: 'version', width: 200, title: '规格型号', sort: false},
{field: 'texture', width: 100, title: '材质'},
{field: 'unit', width: 150, title: '计量单位'},
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}
/*{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}*/
]
],
limits: [10, 15, 20, 25, 50,100],
@ -204,13 +246,21 @@
, data = checkStatus.data;
var req = {};
req.ids = [];
//console.log(data);
for (i = 0, len = data.length; i < len; i++) {
req.ids[i] = data[i].id;
//liwenxuan
var delItem = {};
delItem.id = data[i].id;
delItem.flag = data[i].flag;
req.ids.push(delItem);
//req.ids[i] = data[i].id;
}
if (req.ids.length > 0) {
console.log(req)
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) {
$.ajax({
url: '/material/delBarCodeByMaterial',
url: '/material/delBarCodeByMaterialAndFlag',
dataType: 'json',
type: 'POST',
contentType: "application/json;charset=utf-8",

2
src/main/resources/templates/pages/warehouse/depository-out.html

@ -150,7 +150,7 @@
{field: 'cname', width: 200, title: '所处公司'},
{field: 'adminorgName', width: 150, title: '所属部门'},
{field: 'address', width: 120, title: '仓库地址'},
{field: 'introduce', width: 200, title: '仓库介绍11111'},
{field: 'introduce', width: 200, title: '仓库介绍'},
{field: 'maxNumber', width: 200, title: '最大存储量', sort: true},
{field: 'minNumber', width: 200, title: '最小存储量', sort: true},
{field: 'state', title: '状态', minWidth: 80, templet: '#switchTpl'},

Loading…
Cancel
Save