Browse Source

完成库位相应功能

lwx_dev
erdanergou 3 years ago
parent
commit
285ee43629
  1. 79
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 62
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  3. 39
      src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndPlace.java
  4. 23
      src/main/java/com/dreamchaser/depository_manage/entity/TransferRecord.java
  5. 16
      src/main/java/com/dreamchaser/depository_manage/mapper/TransferRecordMapper.xml
  6. 142
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  7. 3
      src/main/java/com/dreamchaser/depository_manage/utils/CreateQrCodeUtil.java
  8. 14
      src/main/resources/templates/index.html
  9. 33
      src/main/resources/templates/pages/application/application-in.html
  10. 58
      src/main/resources/templates/pages/application/application-transfer.html
  11. 6
      src/main/resources/templates/pages/material/material-view.html
  12. 3
      src/main/resources/templates/pages/material/selectDepositoryByCard.html
  13. 12
      src/main/resources/templates/pages/place/place_edit.html
  14. 143
      src/main/resources/templates/pages/place/place_list_add.html
  15. 315
      src/main/resources/templates/pages/uniApp/scanQrCode.html
  16. 6
      src/main/resources/templates/pages/warehouse/warehouse_view.html
  17. 0
      target/classes/.restartTriggerFile
  18. BIN
      target/classes/META-INF/depository_manage (2).kotlin_module
  19. 16
      target/classes/com/dreamchaser/depository_manage/mapper/TransferRecordMapper.xml
  20. 14
      target/classes/templates/index.html
  21. 33
      target/classes/templates/pages/application/application-in.html
  22. 4
      target/classes/templates/pages/application/application-review.html
  23. 58
      target/classes/templates/pages/application/application-transfer.html
  24. 4
      target/classes/templates/pages/application/form-step-look_back.html
  25. 6
      target/classes/templates/pages/material/material-view.html
  26. 3
      target/classes/templates/pages/material/selectDepositoryByCard.html
  27. 12
      target/classes/templates/pages/place/place_edit.html
  28. 143
      target/classes/templates/pages/place/place_list_add.html
  29. 315
      target/classes/templates/pages/uniApp/scanQrCode.html
  30. 6
      target/classes/templates/pages/warehouse/warehouse_view.html

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

@ -109,22 +109,13 @@ public class DepositoryRecordController {
// 获取库位id // 获取库位id
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId")); Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId"));
if(placeId == -1) {// 如果插入到仓库 if(placeId == -1) {// 如果插入到仓库
integer += depositoryRecordService.applicationIn(map); map.put("placeId",0); // 到默认库位
integer += depositoryRecordService.applicationInPlace(map);
}else{ // 如果具体到库位 }else{ // 如果具体到库位
Integer flag = depositoryRecordService.applicationIn(map); Integer flag = depositoryRecordService.applicationInPlace(map);
if(flag != 1){ if(flag != -1){
return new RestResponse("",666,new StatusInfo("存储失败","请重新选择存储位")); integer += flag;
}else{
Integer applicationInPlace = depositoryRecordService.applicationInPlace(map);
if(applicationInPlace == 1){
integer += flag;
}else{
map.put("delete","in");
depositoryRecordService.deleteApplicaionInPlace(map);
return new RestResponse("",666,new StatusInfo("存储失败","超出最大存储量或该库位已有物品,请重新选择存储位"));
}
} }
} }
}else{ }else{
List<Object> errMsg = new ArrayList<>(); List<Object> errMsg = new ArrayList<>();
@ -141,54 +132,48 @@ public class DepositoryRecordController {
insert.put("code",map.get("code"+temp)); insert.put("code",map.get("code"+temp));
insert.put("price",map.get("price").toString()); insert.put("price",map.get("price").toString());
if(placeId == -1) { // 如果插入到仓库 if(placeId == -1) { // 如果插入到仓库
integer += depositoryRecordService.applicationIn(insert); insert.put("placeId",0);
successMsg.add(insert); Integer add = depositoryRecordService.applicationInPlace(insert);
if(add == -1){
errMsg.add(integer);
}else{
integer += add;
successMsg.add(insert);
}
}else{// 如果具体到库位 }else{// 如果具体到库位
Integer flag = depositoryRecordService.applicationIn(insert); insert.put("placeId",placeId);
if(flag != 1){ Integer flag = depositoryRecordService.applicationInPlace(insert);
if(flag == -1){
insert.put("err","存储失败,请重新选择存储位"); insert.put("err","存储失败,请重新选择存储位");
errMsg.add(insert); errMsg.add(insert);
}else{ }else{
insert.put("placeId",map.get("placeId"+temp)); integer += flag;
Integer applicationInPlace = depositoryRecordService.applicationInPlace(insert);
if(applicationInPlace == 1){
integer += flag;
successMsg.add(insert);
}else{
map.put("delete","in");
depositoryRecordService.deleteApplicaionInPlace(insert);
insert.put("err","存储失败,超出最大存储量或该库位已有物品");
errMsg.add(insert);
}
} }
} }
} }
Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId")); Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId"));
if(placeId == -1) {// 如果插入到仓库 if(placeId == -1) {// 如果插入到仓库
integer += depositoryRecordService.applicationIn(map); map.put("placeId",0);
successMsg.add(map); Integer add = depositoryRecordService.applicationInPlace(map);
if(add == -1){
errMsg.add(map);
}else {
integer+=add;
successMsg.add(map);
}
}else{ // 如果具体到库位 }else{ // 如果具体到库位
Integer flag = depositoryRecordService.applicationIn(map); Integer flag = depositoryRecordService.applicationInPlace(map);
if(flag != 1){ if(flag == -1){
map.put("err","存储失败,请重新选择存储位"); map.put("err","存储失败,请重新选择存储位");
errMsg.add(map); errMsg.add(map);
}else{ }else{
Integer applicationInPlace = depositoryRecordService.applicationInPlace(map); integer += flag;
if(applicationInPlace == 1){
integer += flag;
successMsg.add(map);
}else{
map.put("delete","in");
depositoryRecordService.deleteApplicaionInPlace(map);
map.put("err","存储失败,超出最大存储量或该库位已有物品");
errMsg.add(map);
}
} }
} }
result.put("err",errMsg); result.put("err",errMsg);
result.put("success",successMsg); result.put("success",successMsg);
} }
if (integer != 0 && params.size() < 1) { if (integer != 0 && params.size() < 1 && integer != -1) {
return CrudUtil.postHandle(integer, 1); return CrudUtil.postHandle(integer, 1);
}else if(integer != 0 && params.size() > 0){ }else if(integer != 0 && params.size() > 0){
if(integer == params.size() + 1){ if(integer == params.size() + 1){
@ -335,9 +320,9 @@ public class DepositoryRecordController {
@PutMapping("/transfer") @PutMapping("/transfer")
public RestResponse transfer(@RequestBody Map<String,Object> map, HttpServletRequest request){ public RestResponse transfer(@RequestBody Map<String,Object> map, HttpServletRequest request){
UserByPort userToken= (UserByPort) request.getAttribute("userToken"); UserByPort userToken= (UserByPort) request.getAttribute("userToken");
UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken); // UserByPort departmentHeadByUser = findDepartmentHeadByUser(userToken);
List<Integer> params = (List<Integer>) map.get("params"); List<Integer> params = (List<Integer>) map.get("params");
map.put("departmenthead",departmentHeadByUser.getId()); // map.put("departmenthead",departmentHeadByUser.getId());
map.put("applicantId",userToken.getId()); map.put("applicantId",userToken.getId());
map.put("toId",map.get("depositoryId")); map.put("toId",map.get("depositoryId"));
map.remove("depositoryId"); map.remove("depositoryId");
@ -348,7 +333,7 @@ public class DepositoryRecordController {
for (int i = 0; i < params.size(); i++) { for (int i = 0; i < params.size(); i++) {
Integer temp = params.get(i); Integer temp = params.get(i);
Map<String,Object> insert = new HashMap<>(); Map<String,Object> insert = new HashMap<>();
insert.put("departmenthead",departmentHeadByUser.getId()); // insert.put("departmenthead",departmentHeadByUser.getId());
insert.put("applicantId",userToken.getId()); insert.put("applicantId",userToken.getId());
insert.put("toId",map.get("depositoryId"+temp)); insert.put("toId",map.get("depositoryId"+temp));
insert.put("mid",map.get("mid"+temp)); insert.put("mid",map.get("mid"+temp));

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

@ -10,10 +10,7 @@ import com.dreamchaser.depository_manage.pojo.*;
import com.dreamchaser.depository_manage.security.bean.UserToken; import com.dreamchaser.depository_manage.security.bean.UserToken;
import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool;
import com.dreamchaser.depository_manage.service.*; import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.*;
import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.WordUtil;
import com.sun.org.apache.xpath.internal.operations.Mod; import com.sun.org.apache.xpath.internal.operations.Mod;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HTTP;
@ -444,10 +441,25 @@ public class PageController {
@GetMapping("material_view") @GetMapping("material_view")
public ModelAndView material_view(Integer id) { public ModelAndView material_view(Integer id,HttpServletRequest request) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/material/material-view"); mv.setViewName("pages/material/material-view");
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
if (id != null) { if (id != null) {
Material material = materialService.findMaterialById(id);
Map<String,Object> params = new HashMap<>();
params.put("mid",material.getId());
params.put("mname",material.getMname());
params.put("code",material.getCode());
params.put("version",material.getVersion());
String context = JSONObject.toJSONString(params);
String qrCode = "";
try {
qrCode = CreateQrCodeUtil.createQrCode(context, 200, 200);
} catch (IOException e) {
throw new MyException(e.getMessage());
}
mv.addObject("qrCode",qrCode);
mv.addObject("record", materialService.findMaterialAndTypeById(id)); mv.addObject("record", materialService.findMaterialAndTypeById(id));
mv.addObject("materialTypes", materialTypeService.findMaterialTypeAll()); mv.addObject("materialTypes", materialTypeService.findMaterialTypeAll());
} else { } else {
@ -809,6 +821,20 @@ public class PageController {
mv.setViewName("pages/warehouse/warehouse_view"); mv.setViewName("pages/warehouse/warehouse_view");
if (id != null) { if (id != null) {
Depository depositoryRecordById = depositoryService.findDepositoryRecordById(id); Depository depositoryRecordById = depositoryService.findDepositoryRecordById(id);
// 用于二维码存放数据
Map<String,Object> param = new HashMap<>();
param.put("code",depositoryRecordById.getCode());
param.put("id",depositoryRecordById.getId());
param.put("dname",depositoryRecordById.getDname());
param.put("introduce",depositoryRecordById.getIntroduce());
String context = JSONObject.toJSONString(param);
String qrCode = "";
try {
qrCode = CreateQrCodeUtil.createQrCode(context,200,200);
} catch (IOException e) {
e.printStackTrace();
}
mv.addObject("qrCode",qrCode);
mv.addObject("record", depositoryRecordById); mv.addObject("record", depositoryRecordById);
Integer cid = depositoryRecordById.getCid(); Integer cid = depositoryRecordById.getCid();
List<AdministrationP> postList = findCompanyBySuperior(cid.toString()); List<AdministrationP> postList = findCompanyBySuperior(cid.toString());
@ -846,6 +872,27 @@ public class PageController {
if (id != null) { if (id != null) {
mv.addObject("id", id); mv.addObject("id", id);
Place placeById = placeService.findPlaceById(id); Place placeById = placeService.findPlaceById(id);
// 用于二维码存放数据
Map<String,Object> param = new HashMap<>();
param.put("id",placeById.getId());
Depository depositoryRecordById = depositoryService.findDepositoryRecordById(placeById.getDid());
param.put("dname",depositoryRecordById.getDname());
param.put("code",depositoryRecordById.getCode() +"-"+placeById.getCode());
List<MaterialAndPlace> placeAndMaterialByPid = placeService.findPlaceAndMaterialByPid(placeById.getId());
StringBuilder mname = new StringBuilder();
for (int i = 0; i < placeAndMaterialByPid.size(); i++) {
Material materialById = materialService.findMaterialById(placeAndMaterialByPid.get(i).getMid());
mname.append(materialById.getMname()).append(", ");
}
param.put("mname",mname);
String context = JSONObject.toJSONString(param);
String qrCode = "";
try {
qrCode = CreateQrCodeUtil.createQrCode(context,200,200);
} catch (IOException e) {
e.printStackTrace();
}
mv.addObject("qrCode",qrCode);
mv.addObject("place", placeById); mv.addObject("place", placeById);
} else { } else {
throw new MyException("缺少必要参数!"); throw new MyException("缺少必要参数!");
@ -1362,4 +1409,9 @@ public class PageController {
return mv; return mv;
} }
@GetMapping("/scanQrCode")
public String scanQrCode(){
return "pages/uniApp/scanQrCode";
}
} }

39
src/main/java/com/dreamchaser/depository_manage/entity/MaterialAndPlace.java

@ -0,0 +1,39 @@
package com.dreamchaser.depository_manage.entity;
import lombok.Data;
@Data
public class MaterialAndPlace {
/**
* id
*/
private Integer id;
/**
* 物料id
*/
private Integer mid;
/**
* 库位id
*/
private Integer pid;
/**
* 当前库位所处仓库
*/
private Integer did;
/**
* 库位编码
*/
private String code;
/**
* 库位最大存储量
*/
private Integer max;
/**
* 库位最小存储量
*/
private Integer min;
/**
* 当前存放额度
*/
private Integer quantity;
}

23
src/main/java/com/dreamchaser/depository_manage/entity/TransferRecord.java

@ -35,6 +35,14 @@ public class TransferRecord implements java.io.Serializable {
* 申请人 * 申请人
*/ */
private Integer applicantId; private Integer applicantId;
/**
* 转出库位
*/
private Integer fromPlaceId;
/**
* 转入库位
*/
private Integer toPlaceId;
/* This code was generated by TableGo tools, mark 1 end. */ /* This code was generated by TableGo tools, mark 1 end. */
@ -121,5 +129,20 @@ public class TransferRecord implements java.io.Serializable {
this.applicantId = applicantId; this.applicantId = applicantId;
} }
public Integer getFromPlaceId() {
return fromPlaceId;
}
public void setFromPlaceId(Integer fromPlaceId) {
this.fromPlaceId = fromPlaceId;
}
public Integer getToPlaceId() {
return toPlaceId;
}
public void setToPlaceId(Integer toPlaceId) {
this.toPlaceId = toPlaceId;
}
/* This code was generated by TableGo tools, mark 2 end. */ /* This code was generated by TableGo tools, mark 2 end. */
} }

16
src/main/java/com/dreamchaser/depository_manage/mapper/TransferRecordMapper.xml

@ -12,10 +12,12 @@
<result column="mid" property="mid" jdbcType="INTEGER" /> <result column="mid" property="mid" jdbcType="INTEGER" />
<result column="applicantTime" property="applicantTime" jdbcType="INTEGER" /> <result column="applicantTime" property="applicantTime" jdbcType="INTEGER" />
<result column="applicantId" property="applicantId" jdbcType="INTEGER" /> <result column="applicantId" property="applicantId" jdbcType="INTEGER" />
<result column="from_place_id" property="fromPlaceId" jdbcType="INTEGER" />
<result column="to_place_id" property="toPlaceId" jdbcType="INTEGER" />
</resultMap> </resultMap>
<!-- 表查询字段 --> <!-- 表查询字段 -->
<sql id="allColumns"> <sql id="allColumns">
tr.id, tr.from_id, tr.to_id,tr.mid,tr.applicantTime,tr.applicantId tr.id, tr.from_id, tr.to_id,tr.mid,tr.applicantTime,tr.applicantId,tr.from_place_id,tr.to_place_id
</sql> </sql>
<!-- 查询所有 <!-- 查询所有
@ -46,6 +48,12 @@
<if test="applicantId != null"> <if test="applicantId != null">
and tr.applicantId = #{applicantId} and tr.applicantId = #{applicantId}
</if> </if>
<if test="fromPlaceId != null">
and tr.from_place_id = #{fromPlaceId}
</if>
<if test="toPlaceId != null">
and tr.to_place_id = #{toPlaceId}
</if>
</select> </select>
@ -67,7 +75,7 @@
<!-- 新增信息 --> <!-- 新增信息 -->
<insert id="addTransferRecord"> <insert id="addTransferRecord">
INSERT INTO transfer_record ( INSERT INTO transfer_record (
id, from_id, to_id,quantity,mid,applicantTime,applicantId id, from_id, to_id,quantity,mid,applicantTime,applicantId,from_place_id,to_place_id
) VALUES ( ) VALUES (
#{id}, #{id},
#{fromId}, #{fromId},
@ -75,7 +83,9 @@
#{quantity}, #{quantity},
#{mid}, #{mid},
#{applicantTime}, #{applicantTime},
#{applicantId} #{applicantId},
#{fromPlaceId},
#{toPlaceId}
) )
</insert> </insert>

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

@ -247,49 +247,46 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前物料基本信息 // 获取当前物料基本信息
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); Integer mid = ObjectFormatUtil.toInteger(map.get("mid"));
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
// 获取当前物料在当前仓库是否有库存记录 if(placeById.getMax() - placeById.getQuantity() > quantity){
Map<String, Object> param = new HashMap<>(); // 如果当前库位还能存放
param.put("code", materialById.getCode());
param.put("mname", materialById.getMname());
param.put("depositoryId", placeById.getDid());
List<Material> inventory = materialMapper.findInventory(param);
if (inventory.size() == 0) {
throw new MyException("未知错误,联系开发人员");
}
Material material = inventory.get(0);
if (placeById.getMid() != null) {
// 如果当前库位有物品
if (quantity > placeById.getMax() - placeById.getQuantity()) {
return -1;
}else {
// 添加库存
Map<String, Object> insert = new HashMap<>();
insert.put("mid",material.getId());
insert.put("pid", placeById.getId());
insert.put("quantity", quantity);
// 修改该库位容量
Map<String, Object> update = new HashMap<>();
update.put("id", placeById.getId());
update.put("quantity", quantity + placeById.getQuantity());
placeMapper.UpdatePlace(update);
return placeMapper.addMaterialOnPlace(insert);
}
} else { // 入库
if (quantity > placeById.getMax() - placeById.getQuantity()) { Integer integer = applicationIn(map);
if(integer != 1){
return -1; return -1;
} else {
Map<String, Object> update = new HashMap<>();
update.put("id", placeById.getId());
update.put("quantity", quantity + placeById.getQuantity());
placeMapper.UpdatePlace(update);
// 添加库存
Map<String, Object> insert = new HashMap<>();
insert.put("mid",material.getId());
insert.put("pid", placeById.getId());
insert.put("quantity", quantity);
return placeMapper.addMaterialOnPlace(insert);
} }
// 获取当前库存记录
Map<String, Object> param = new HashMap<>();
param.put("code", materialById.getCode());
param.put("mname", materialById.getMname());
if(placeId == 0){
param.put("depositoryId",map.get("depositoryId"));
}else {
param.put("depositoryId", placeById.getDid());
}
List<Material> inventory = materialMapper.findInventory(param);
Material material = inventory.get(0);
Map<String,Object> insert = new HashMap<>();
insert.put("mid",material.getId());
insert.put("pid",placeById.getId());
MaterialAndPlace placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(insert);
if(placeAndMaterialByMidAndPid == null){
// 如果没有当前记录
insert.put("quantity",quantity);
// 插入记录
placeMapper.addMaterialOnPlace(insert);
}else{
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + quantity);
// 修改数量
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
}
// 修改当前库位数量
placeById.setQuantity(placeById.getQuantity() + quantity);
return placeMapper.UpdatePlace(placeById);
}else{
return -1;
} }
} }
@ -361,6 +358,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("price", material.getPrice() * quantity * 100); map.put("price", material.getPrice() * quantity * 100);
map.put("istransfer", 1); map.put("istransfer", 1);
map.put("fromId", material.getDepositoryId()); map.put("fromId", material.getDepositoryId());
String fromPlaceId = (String) map.get("fromPlaceId");
String toPlaceId = (String) map.get("placeId");
if("".equals(fromPlaceId) || "0".equals(fromPlaceId)){
map.put("fromPlaceId",0);
}
map.put("toPlaceId",toPlaceId) ;
if("".equals(toPlaceId) || "0".equals(fromPlaceId)){
map.put("toPlaceId",0);
}
//清除主键 //清除主键
// depositoryRecordMapper.insertApplicationInRecord(map); // depositoryRecordMapper.insertApplicationInRecord(map);
transferRecordMapper.addTransferRecord(map); transferRecordMapper.addTransferRecord(map);
@ -368,6 +374,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("transferId", transferRecordByCondition.getId()); map.put("transferId", transferRecordByCondition.getId());
Depository depositoryRecordById = depositoryMapper.findDepositoryRecordById(material.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryRecordById(material.getDepositoryId());
map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber")); map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber"));
String placeId = (String) map.get("placeId");
if("".equals(placeId)){
map.put("placeId",0);
}
//清除主键 //清除主键
return depositoryRecordMapper.insertApplicationOutRecord(map); return depositoryRecordMapper.insertApplicationOutRecord(map);
} }
@ -382,6 +392,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Transactional @Transactional
public Integer review(Map<String, Object> map, Integer userid) { public Integer review(Map<String, Object> map, Integer userid) {
ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(map.get("id"))); ApplicationOutRecordP record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(map.get("id")));
Object id = map.get("id");
map.remove("id");
if (map.containsKey("departmentheadPass")) { if (map.containsKey("departmentheadPass")) {
String simpleTime = DateUtil.getSimpleTime(new Date()); String simpleTime = DateUtil.getSimpleTime(new Date());
map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime));
@ -399,7 +411,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else { } else {
map.put("state", "部门负责人审核未通过"); map.put("state", "部门负责人审核未通过");
} }
} else { }
else {
String simpleTime = DateUtil.getSimpleTime(new Date()); String simpleTime = DateUtil.getSimpleTime(new Date());
map.put("depositoryManagerTime", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("depositoryManagerTime", DateUtil.DateTimeToTimeStamp(simpleTime));
map.put("depositoryManager", userid); map.put("depositoryManager", userid);
@ -409,7 +422,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer depositoryManagerPass = (Integer) map.get("depositoryManagerPass"); Integer depositoryManagerPass = (Integer) map.get("depositoryManagerPass");
if (depositoryManagerPass == 1) { if (depositoryManagerPass == 1) {
boolean flag = true; boolean flag = true;
Integer istransfer = record.getIstransfer();
Integer placeId = record.getPlaceId(); Integer placeId = record.getPlaceId();
if(istransfer == 1){
TransferRecord transferRecordById = transferRecordMapper.findTransferRecordById(record.getTransferId());
placeId = transferRecordById.getFromPlaceId();// 获取转出库位
}
MaterialAndPlace placeAndMaterialByMidAndPid = null; MaterialAndPlace placeAndMaterialByMidAndPid = null;
if(placeId != 0){ if(placeId != 0){
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
@ -462,6 +480,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("state", "仓库管理员审核未通过"); map.put("state", "仓库管理员审核未通过");
} }
} }
map.put("id",id);
return depositoryRecordMapper.updateApplicationOutRecord(map); return depositoryRecordMapper.updateApplicationOutRecord(map);
} }
@ -472,6 +491,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
public void transferMaterial(Map<String, Object> map) { public void transferMaterial(Map<String, Object> map) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
// 获取转移详情
Integer transferId = ObjectFormatUtil.toInteger(map.get("transferId")); Integer transferId = ObjectFormatUtil.toInteger(map.get("transferId"));
TransferRecord transferRecor = transferRecordMapper.findTransferRecordById(transferId); TransferRecord transferRecor = transferRecordMapper.findTransferRecordById(transferId);
Integer mid = transferRecor.getMid(); Integer mid = transferRecor.getMid();
@ -480,10 +500,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
param.put("depositoryId", transferRecor.getToId()); param.put("depositoryId", transferRecor.getToId());
List<Material> materiallist = materialMapper.findMaterialByCondition(param); List<Material> materiallist = materialMapper.findMaterialByCondition(param);
if (materiallist.size() > 0) { if (materiallist.size() > 0) {
// 如果在该仓库
map.put("price",material.getPrice().toString());
map.put("depositoryId", transferRecor.getToId()); map.put("depositoryId", transferRecor.getToId());
applicationIn(map); map.put("placeId",transferRecor.getToPlaceId());
applicationInPlace(map);
map.put("mid", materiallist.get(0).getId()); map.put("mid", materiallist.get(0).getId());
} else { } else {
// 如果不在该仓库,插入一条新记录
Map<String, Object> insert = new HashMap<>(); Map<String, Object> insert = new HashMap<>();
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity")); Integer quantity = ObjectFormatUtil.toInteger(map.get("quantity"));
@ -499,6 +523,40 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
insert.put("amounts", quantity * materialById.getPrice()); insert.put("amounts", quantity * materialById.getPrice());
insert.put("depositoryCode", materialById.getDepositoryCode()); insert.put("depositoryCode", materialById.getDepositoryCode());
materialMapper.insertMaterial(insert); materialMapper.insertMaterial(insert);
// 查询该记录
Map<String,Object> temp = new HashMap<>();
temp.put("code",materialById.getCode());
temp.put("depositoryId",transferRecor.getToId());
temp.put("mname",materialById.getMname());
List<Material> inventoryList = materialMapper.findInventory(temp);
// 获取该库存记录
Material inventory = inventoryList.get(0);
Map<String,Object> fromPlaceTemp = new HashMap<>();
Map<String,Object> toPlaceTemp = new HashMap<>();
// 转入库位
Place toPlace = placeMapper.findPlaceById(transferRecor.getToPlaceId());
toPlace.setQuantity(toPlace.getQuantity() + quantity);
placeMapper.UpdatePlace(toPlace); // 修改转入库位额度
toPlaceTemp.put("mid",materialById.getId());
toPlaceTemp.put("pid",toPlace.getId());
toPlaceTemp.put("quantity",quantity);
// 获取转入物料具体所在库位
MaterialAndPlace toMaterialAndPlace = placeMapper.findPlaceAndMaterialByMidAndPid(toPlaceTemp);
if(toMaterialAndPlace == null){
placeMapper.addMaterialOnPlace(toPlaceTemp);
}
// 转出库位
Place fromPlace = placeMapper.findPlaceById(transferRecor.getFromPlaceId());
fromPlace.setQuantity(fromPlace.getQuantity() - quantity);
placeMapper.UpdatePlace(fromPlace); // 修改转出库位额度
fromPlaceTemp.put("mid",materialById.getId());
fromPlaceTemp.put("pid",toPlace.getId());
// 获取转出物料具体所在库位
MaterialAndPlace fromMaterialAndPlace = placeMapper.findPlaceAndMaterialByMidAndPid(fromPlaceTemp);
fromMaterialAndPlace.setQuantity(fromMaterialAndPlace.getQuantity() - quantity);
placeMapper.updateMaterialAndPlace(fromMaterialAndPlace);
} }
} }

3
src/main/java/com/dreamchaser/depository_manage/utils/CreateQrCodeUtil.java

@ -54,4 +54,7 @@ public class CreateQrCodeUtil {
} }
return null; return null;
} }
} }

14
src/main/resources/templates/index.html

@ -153,12 +153,22 @@
pageAnim: true, // iframe窗口动画 pageAnim: true, // iframe窗口动画
maxTabNum: 20, // 最大的tab打开数量 maxTabNum: 20, // 最大的tab打开数量
}; };
options.iniUrl= "/index/menus?uid="+uid // 初始化接口 options.iniUrl= "/index/menus?uid="+uid; // 初始化接口
miniAdmin.render(options); miniAdmin.render(options);
$("#scan").on("click",function () { $("#scan").on("click",function () {
alert("扫一扫") layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/scanQrCode',
})
}); });

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

@ -186,22 +186,27 @@
success: function (data) { success: function (data) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (data.status >= 300) { if (data.status >= 300) {
// layer.msg(data.statusInfo.detail);//失败的表情 console.log(data)
var d = data.data; var d = data.data;
var err = d["err"]; if(d === ""){
var success = d["success"]; layer.msg(data.statusInfo.detail);
var errMsg = ""; }else{
for (let i = 0; i < err.length; i++) { var err = d["err"];
errMsg += "物料编码: " var success = d["success"];
errMsg += err[i]["code"]; var errMsg = "";
for (let i = 0; i < err.length; i++) {
errMsg += "物料编码: "
errMsg += err[i]["code"];
}
errMsg += "添加失败,请选择新仓库或库位";
layer.msg(errMsg,{
icon:5,
time:1000
},function () {
step.next('#stepForm');
});
} }
errMsg += "添加失败,请选择新仓库或库位";
layer.msg(errMsg,{
icon:1,
time:500
},function () {
step.next('#stepForm');
});
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {
icon: 6,//成功的表情 icon: 6,//成功的表情

58
src/main/resources/templates/pages/application/application-transfer.html

@ -59,6 +59,12 @@
class="layui-input" lay-verify="required"> class="layui-input" lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">所处库位:</label>
<div class="layui-input-block">
<select name="fromPlaceId" id="place"></select>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -66,11 +72,15 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">转入仓库:</label> <label class="layui-form-label">仓库:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository" readonly onclick="openDepositoryTree(this)" <input type="text" placeholder="请选择仓库" class="layui-input"
id="openSonByDepository" readonly onclick="openDepositoryTree(this)"
lay-verify="required"/> lay-verify="required"/>
<input type="text" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" lay-verify="required"/> <input type="text" name="depositoryId" class="layui-input" id="depositoryId"
style="display: none" lay-verify="required"/>
<input type="text" name="placeId" class="layui-input" id="placeId"
style="display: none" lay-verify="required"/>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -234,6 +244,12 @@
class="layui-input" lay-verify="required"> class="layui-input" lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">所处库位:</label>
<div class="layui-input-block">
<select name=`+"placeId"+NewIdNumber +` id="place"></select>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -305,10 +321,14 @@
var materialItem = children.childNodes[3].childNodes[1].childNodes; var materialItem = children.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
var req = {};
req.code = code;
req.type = "out";
$.ajax({ $.ajax({
url: "/material/findMatrialByCode?code=" + code, url: "/material/findMatrialByCode",
type: "get", type: "get",
dataType: 'json', dataType: 'json',
data:req,
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (d) { success: function (d) {
var d = d.data; var d = d.data;
@ -318,8 +338,23 @@
materialId.value = ""; materialId.value = "";
obj.value = ""; obj.value = "";
}else{ }else{
materialName.value = d.mname; req.mid = d.id;
materialId.value = d.id; $.ajax({
url: "/place/findPlaceByMid",
type: "post",
dataType: 'json',
data:JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success:function (res) {
$('#place').empty();
$.each(res.data, function (index, item) {
$('#place').append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素
});
form.render();
materialName.value = d.mname;
materialId.value = d.id;
}
});
} }
} }
}); });
@ -344,7 +379,7 @@
maxmin: true, maxmin: true,
shadeClose: true, //点击遮罩关闭层 shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'], area: ['70%', '70%'],
content: '/selectMaterialByCard?mname='+mname+'&type=1&clickObj='+parentId, content: '/selectMaterialByCard?mname='+mname+'&type=2&clickObj='+parentId,
move : '.layui-layer-title', move : '.layui-layer-title',
fixed:false, fixed:false,
end: function () { end: function () {
@ -355,11 +390,18 @@
dataType: 'json', dataType: 'json',
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (d) { success: function (d) {
var code = d.data.code; var material = d.data.materialById;
var placeList = d.data.placeList;
var code = material.code;
if(code === undefined){ if(code === undefined){
code = ""; code = "";
} }
codeValue.value = code; codeValue.value = code;
$('#place').empty();
$.each(placeList, function (index, item) {
$('#place').append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素
});
form.render();
} }
}); });

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

@ -62,7 +62,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">二维码</label> <label class="layui-form-label">二维码</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<img src="" id="qrCode" onclick="changeQrCodeState()"> <img src="" id="qrCode" th:src="${qrCode}">
</div> </div>
</div> </div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
@ -128,10 +128,6 @@
return false; return false;
}); });
function changeQrCodeState() {
var mid = $("#id").val();
}
}); });
</script> </script>

3
src/main/resources/templates/pages/material/selectDepositoryByCard.html

@ -52,7 +52,7 @@
if(!flag) { if(!flag) {
depositoryName.value = obj.data.title; depositoryName.value = obj.data.title;
depositoryId.value = obj.data.id; depositoryId.value = obj.data.id;
placeId.value = -1; placeId.value = 0;
}else{ }else{
var did = dataId.split("-"); var did = dataId.split("-");
$.ajax({ $.ajax({
@ -64,6 +64,7 @@
depositoryName.value = d.data.dname +"-"+ obj.data.title; depositoryName.value = d.data.dname +"-"+ obj.data.title;
} }
}); });
console.log(did)
depositoryId.value = did[0]; depositoryId.value = did[0];
placeId.value = did[1]; placeId.value = did[1];
} }

12
src/main/resources/templates/pages/place/place_edit.html

@ -13,7 +13,7 @@
<div class="layuimini-container"> <div class="layuimini-container">
<div class="layuimini-main"> <div class="layuimini-main">
<fieldset class="table-search-fieldset"> <fieldset class="table-search-fieldset">
<legend>库位创建</legend> <legend>库位详情</legend>
<div class="layui-fluid"> <div class="layui-fluid">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body" style="padding-top: 40px;"> <div class="layui-card-body" style="padding-top: 40px;">
@ -29,13 +29,13 @@
name="place_x" lay-verify="required"/> name="place_x" lay-verify="required"/>
</div> </div>
</div> </div>
<div class="layui-form-item"> <!--<div class="layui-form-item">
<label class="layui-form-label">库位列:</label> <label class="layui-form-label">库位列:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" placeholder="请填写列数" class="layui-input" th:value="${place.getY()}" <input type="text" placeholder="请填写列数" class="layui-input" th:value="${place.getY()}"
name="place_y" lay-verify="required"/> name="place_y" lay-verify="required"/>
</div> </div>
</div> </div>-->
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">库位层:</label> <label class="layui-form-label">库位层:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -57,6 +57,12 @@
name="min" lay-verify="required"/> name="min" lay-verify="required"/>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">二维码</label>
<div class="layui-input-inline">
<img src="" id="qrCode" th:src="${qrCode}">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formStep"> <button class="layui-btn" lay-submit lay-filter="formStep">

143
src/main/resources/templates/pages/place/place_list_add.html

@ -0,0 +1,143 @@
<!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_start_x" lay-verify="required"/>
</div>
<label class="layui-form-label">结束行:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写行数" class="layui-input"
name="place_end_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_start_y" lay-verify="required"/>
</div>
<label class="layui-form-label">结束列:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写列数" class="layui-input"
name="place_end_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_start_z" lay-verify="required"/>
</div>
<label class="layui-form-label">结束层:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写层数" class="layui-input"
name="place_end_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">
&emsp;创建库位&emsp;
</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 = "list";
$.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="/insertListPlace?depositoryId="+depositoryId
});
}
},
complete: function () {
form.val("form1", {
})
}
});
return false;
});
});
</script>
</body>
</html>

315
src/main/resources/templates/pages/uniApp/scanQrCode.html

@ -0,0 +1,315 @@
<template>
<div class="page-scan">
<div class="base-line">
<div class="pullWrap">
<div class="topTitle">
<div class="pullTitle">
<div class="pullName">二维码绑定</div>
<!-- 绑定状态图标 -->
<img class="left-icon" src="/static/img/noBind.svg" alt="" v-if="!dataObj.qrCodeId">
<img class="left-icon" src="/static/img/binded.svg" alt="" v-else>
<div class="right-part">
<input :disabled="dataObj.qrCodeId" type="text" v-model="dataObj.qrCodeId" placeholder="请输入二维码ID" v-if="dataObj.qrCodeId">
<input type="text" v-model="scanTextData.scanText" placeholder="请输入二维码ID" v-else>
<img src="/static/img/scan.svg" alt="" v-if="!dataObj.qrCodeId">
<span @click="toScanCode" v-if="!dataObj.qrCodeId">扫码填入</span>
<span v-if="dataObj.qrCodeId">解绑</span>
</div>
</div>
</div>
</div>
</div>
<!-- 扫描盒子 -->
<div class="scan-box" v-if="scanTextData.showScanBox">
<div class="scan-cacel" @click="cancelScan" v-show="scanTextData.showScanBoxInfo">
<!-- <img src="" alt=""> -->
取消
</div>
<video ref="video" id="video" class="scan-video" v-show="scanTextData.showScanBoxInfo" autoplay></video>
<div class="scan-img" v-show="scanTextData.showScanBoxInfo">
<div class="scan-frame">
<span class="left-t"></span>
<span class="right-t"></span>
<span class="left-b"></span>
<span class="right-b"></span>
<span class="cross-line"></span>
</div>
</div>
<!-- <img src="/static/img/scan.svg" alt="" v-show="scanTextData.showScanBoxInfo"> -->
<div class="scan-tip" v-show="scanTextData.showScanBoxInfo"> {{scanTextData.tipMsg}} </div>
</div>
</div>
</template>
<script>
import { BrowserMultiFormatReader } from '@zxing/library';
let scanTextData = {
loadingShow: false,
codeReader: null,
scanText: '',
vin: null,
tipMsg: '将二维码置于屏幕中,即可识别',
tipShow: false
}
export default {
name: 'scanCodePage',
data() {
return {
scanTextData:{
loadingShow: false,
codeReader: null,
scanText: '',
vin: null,
tipMsg: '将二维码置于屏幕中,即可识别',
tipShow: false,
showScanBox:false,
showScanBoxInfo:false,
},
hasBind:false
}
},
methods: {
toScanCode(){
console.log('识别二维码',this.dataObj)
scanTextData.codeReader = new BrowserMultiFormatReader();
this.scanTextData.showScanBox = true
this.openScan();
},
cancelScan(){
//识别完停止使用摄像头
let thisVideo = document.getElementById("video");
thisVideo.srcObject.getTracks()[0].stop()
scanTextData.codeReader.reset(); // 重置
this.scanTextData.showScanBox = false
setTimeout(()=>{
this.scanTextData.showScanBoxInfo = false
},1000)
},
async openScan() {
scanTextData.codeReader.getVideoInputDevices().then((videoInputDevices) => {
scanTextData.tipShow = true;
scanTextData.tipMsg = '正在调用摄像头...';
console.log('videoInputDevices', videoInputDevices);
// 默认获取第一个摄像头设备id
let firstDeviceId = videoInputDevices[0].deviceId;
// 获取第一个摄像头设备的名称
const videoInputDeviceslablestr = JSON.stringify(videoInputDevices[0].label);
if (videoInputDevices.length > 1) {
// 判断是否后置摄像头
if (videoInputDeviceslablestr.indexOf('back') > -1) {
firstDeviceId = videoInputDevices[0].deviceId;
} else {
firstDeviceId = videoInputDevices[1].deviceId;
}
}
this.decodeFromInputVideoFunc(firstDeviceId);
}).catch(err => {
scanTextData.tipShow = false;
console.error(err);
});
},
decodeFromInputVideoFunc(firstDeviceId) {
scanTextData.codeReader.reset(); // 重置
scanTextData.scanText = '';
scanTextData.codeReader.decodeFromInputVideoDeviceContinuously(firstDeviceId, 'video', (result, err) => {
scanTextData.tipMsg = '将二维码置于屏幕中,即可识别';
scanTextData.scanText = '';
setTimeout(()=>{
this.scanTextData.showScanBoxInfo = true
},1000)
if (result) {
console.log('扫描结果', result.text);
if (result.text) {
console.log('扫描结果11', result.text);
this.scanTextData.showScanBox = false
this.scanTextData.showScanBoxInfo = false
this.scanTextData.scanText = result.text
//这里扫描出结果可以调用你想要的方法
//识别完停止使用摄像头
let thisVideo = document.getElementById("video");
thisVideo.srcObject.getTracks()[0].stop()
scanTextData.codeReader.reset(); // 重置
}
}else{
// console.log('没出来?',result,err)
}
if (err && !(err)) {
scanTextData.tipMsg = '识别失败';
setTimeout(() => {
scanTextData.tipShow = false;
}, 2000)
console.error(err);
}
});
},
},
props:['dataObj']
}
</script>
<style scoped lang="scss">
.pullWrap {
width: 100%;
height: 100px;
padding-top: 50px;
background: #fff;
}
.topTitle {
width: 100%;
position: relative;
}
.pullTitle {
display: flex;
height: 80px;
line-height: 80px;
margin-top: -40px;
background: #fff;
align-items: center;
justify-content: space-between;
}
.pullName{
font-size: 30px;
color: rgba(0,0,0,0.85);
}
img{
width: 40px;
height: 40px;
}
.left-icon{
margin:0 15px;
}
span{
text-decoration: underline;
text-decoration-color: #42a5ff;
color: #42a5ff;
margin-left: 5px;
}
.right-part {
flex: 1;
display: flex;
align-items: center;
justify-content: space-around;
border-bottom: 1px solid #e5e5e5;
overflow: hidden;
text-overflow: ellipsis;
}
input{
border:none;
flex: 1;
}
.scan-index-bar{
background-image: linear-gradient( -45deg, #42a5ff ,#59cfff);
}
.van-nav-bar__title{
color: #fff !important;
}
.scan-box {
position: fixed;
top: 0;
left: 0;
z-index: 5;
height: 100%;
width: 100vw;
}
.scan-cacel{
position: absolute;
top: 30px;
left: 30px;
z-index: 9;
color: #fff;
font-size: 35px;
}
.scan-video{
height: 100vh;
width: 100vw;
object-fit:cover;
}
.scan-img {
width: 500px;
height: 500px;
position: fixed;
top: 40%;
left: 50%;
margin-top: -200px;
margin-left: -250px;
z-index: 6;
}
.scan-frame {
width: 100%;
height: 100%;
position: relative;
}
.left-t,.right-t,.left-b,.right-b{
position: absolute;
width: 80px;
height: 80px;
}
.left-t{
top: 0;
left: 0;
border-top:2px solid #17B1B7;
border-left:2px solid #17B1B7;
}
.right-t{
top: 0;
right: 0;
border-top:2px solid #17B1B7;
border-right:2px solid #17B1B7;
}
.left-b{
bottom: 0;
left: 0;
border-bottom:2px solid #17B1B7;
border-left:2px solid #17B1B7;
}
.right-b{
bottom: 0;
right: 0;
border-bottom:2px solid #17B1B7;
border-right:2px solid #17B1B7;
}
.cross-line{
width: 600px;
height: 10px;
background: linear-gradient(to right, rgba(255, 255, 255, 0),#5DDDD3,rgba(255,255,255,0));
position: absolute;
top: 0;
left: -50px;
animation: identifier_p 5s infinite;
}
@keyframes identifier_p {
0%{
top: 0%;
}
50%{
top: 100%;
}
100%{
top: 0;
}
}
.scan-tip{
width: 100vw;
text-align: center;
margin-bottom: 10vh;
color: white;
font-size: 5vw;
position: absolute;
bottom: 50px;
left: 0;
color: #fff;
}
.page-scan{
overflow-y: hidden;
// background-color: #363636;
}
</style>

6
src/main/resources/templates/pages/warehouse/warehouse_view.html

@ -82,6 +82,12 @@
<input type="text" th:value="${record.getMinNumber()}" name="minNumber" required lay-verify="required" autocomplete="off" class="layui-input"> <input type="text" th:value="${record.getMinNumber()}" name="minNumber" required lay-verify="required" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">二维码</label>
<div class="layui-input-inline">
<img src="" id="qrCode" th:src="${qrCode}">
</div>
</div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
<label class="layui-form-label">状态</label> <label class="layui-form-label">状态</label>
<div class="layui-input-block"> <div class="layui-input-block">

0
target/classes/.restartTriggerFile

BIN
target/classes/META-INF/depository_manage (2).kotlin_module

Binary file not shown.

16
target/classes/com/dreamchaser/depository_manage/mapper/TransferRecordMapper.xml

@ -12,10 +12,12 @@
<result column="mid" property="mid" jdbcType="INTEGER" /> <result column="mid" property="mid" jdbcType="INTEGER" />
<result column="applicantTime" property="applicantTime" jdbcType="INTEGER" /> <result column="applicantTime" property="applicantTime" jdbcType="INTEGER" />
<result column="applicantId" property="applicantId" jdbcType="INTEGER" /> <result column="applicantId" property="applicantId" jdbcType="INTEGER" />
<result column="from_place_id" property="fromPlaceId" jdbcType="INTEGER" />
<result column="to_place_id" property="toPlaceId" jdbcType="INTEGER" />
</resultMap> </resultMap>
<!-- 表查询字段 --> <!-- 表查询字段 -->
<sql id="allColumns"> <sql id="allColumns">
tr.id, tr.from_id, tr.to_id,tr.mid,tr.applicantTime,tr.applicantId tr.id, tr.from_id, tr.to_id,tr.mid,tr.applicantTime,tr.applicantId,tr.from_place_id,tr.to_place_id
</sql> </sql>
<!-- 查询所有 <!-- 查询所有
@ -46,6 +48,12 @@
<if test="applicantId != null"> <if test="applicantId != null">
and tr.applicantId = #{applicantId} and tr.applicantId = #{applicantId}
</if> </if>
<if test="fromPlaceId != null">
and tr.from_place_id = #{fromPlaceId}
</if>
<if test="toPlaceId != null">
and tr.to_place_id = #{toPlaceId}
</if>
</select> </select>
@ -67,7 +75,7 @@
<!-- 新增信息 --> <!-- 新增信息 -->
<insert id="addTransferRecord"> <insert id="addTransferRecord">
INSERT INTO transfer_record ( INSERT INTO transfer_record (
id, from_id, to_id,quantity,mid,applicantTime,applicantId id, from_id, to_id,quantity,mid,applicantTime,applicantId,from_place_id,to_place_id
) VALUES ( ) VALUES (
#{id}, #{id},
#{fromId}, #{fromId},
@ -75,7 +83,9 @@
#{quantity}, #{quantity},
#{mid}, #{mid},
#{applicantTime}, #{applicantTime},
#{applicantId} #{applicantId},
#{fromPlaceId},
#{toPlaceId}
) )
</insert> </insert>

14
target/classes/templates/index.html

@ -153,12 +153,22 @@
pageAnim: true, // iframe窗口动画 pageAnim: true, // iframe窗口动画
maxTabNum: 20, // 最大的tab打开数量 maxTabNum: 20, // 最大的tab打开数量
}; };
options.iniUrl= "/index/menus?uid="+uid // 初始化接口 options.iniUrl= "/index/menus?uid="+uid; // 初始化接口
miniAdmin.render(options); miniAdmin.render(options);
$("#scan").on("click",function () { $("#scan").on("click",function () {
alert("扫一扫") layer.open({
type: 2,
title: '弹窗内容',
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
move : '.layui-layer-title',
fixed:false,
content: '/scanQrCode',
})
}); });

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

@ -186,22 +186,27 @@
success: function (data) { success: function (data) {
layer.close(this.layerIndex); layer.close(this.layerIndex);
if (data.status >= 300) { if (data.status >= 300) {
// layer.msg(data.statusInfo.detail);//失败的表情 console.log(data)
var d = data.data; var d = data.data;
var err = d["err"]; if(d === ""){
var success = d["success"]; layer.msg(data.statusInfo.detail);
var errMsg = ""; }else{
for (let i = 0; i < err.length; i++) { var err = d["err"];
errMsg += "物料编码: " var success = d["success"];
errMsg += err[i]["code"]; var errMsg = "";
for (let i = 0; i < err.length; i++) {
errMsg += "物料编码: "
errMsg += err[i]["code"];
}
errMsg += "添加失败,请选择新仓库或库位";
layer.msg(errMsg,{
icon:5,
time:1000
},function () {
step.next('#stepForm');
});
} }
errMsg += "添加失败,请选择新仓库或库位";
layer.msg(errMsg,{
icon:1,
time:500
},function () {
step.next('#stepForm');
});
} else { } else {
layer.msg("申请提交成功", { layer.msg("申请提交成功", {
icon: 6,//成功的表情 icon: 6,//成功的表情

4
target/classes/templates/pages/application/application-review.html

@ -39,6 +39,10 @@
<td>仓库名称</td> <td>仓库名称</td>
<td id="depositoryName" th:text="${record.getDepositoryName()}">外芯仓库</td> <td id="depositoryName" th:text="${record.getDepositoryName()}">外芯仓库</td>
</tr> </tr>
<tr>
<td>所处库位</td>
<td id="placeId" th:text="${record.getPCode()}"></td>
</tr>
<tr> <tr>
<td>数量</td> <td>数量</td>
<td id="quantity" th:text="${record.getQuantity()}">数量</td> <td id="quantity" th:text="${record.getQuantity()}">数量</td>

58
target/classes/templates/pages/application/application-transfer.html

@ -59,6 +59,12 @@
class="layui-input" lay-verify="required"> class="layui-input" lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">所处库位:</label>
<div class="layui-input-block">
<select name="fromPlaceId" id="place"></select>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -66,11 +72,15 @@
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">转入仓库:</label> <label class="layui-form-label">仓库:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" placeholder="请选择仓库" class="layui-input" id="openSonByDepository" readonly onclick="openDepositoryTree(this)" <input type="text" placeholder="请选择仓库" class="layui-input"
id="openSonByDepository" readonly onclick="openDepositoryTree(this)"
lay-verify="required"/> lay-verify="required"/>
<input type="text" name="depositoryId" class="layui-input" id="depositoryId" style="display: none" lay-verify="required"/> <input type="text" name="depositoryId" class="layui-input" id="depositoryId"
style="display: none" lay-verify="required"/>
<input type="text" name="placeId" class="layui-input" id="placeId"
style="display: none" lay-verify="required"/>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -234,6 +244,12 @@
class="layui-input" lay-verify="required"> class="layui-input" lay-verify="required">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">所处库位:</label>
<div class="layui-input-block">
<select name=`+"placeId"+NewIdNumber +` id="place"></select>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">物料数量:</label> <label class="layui-form-label">物料数量:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -305,10 +321,14 @@
var materialItem = children.childNodes[3].childNodes[1].childNodes; var materialItem = children.childNodes[3].childNodes[1].childNodes;
var materialName = materialItem[1]; var materialName = materialItem[1];
var materialId = materialName.parentNode.parentNode.childNodes[3]; var materialId = materialName.parentNode.parentNode.childNodes[3];
var req = {};
req.code = code;
req.type = "out";
$.ajax({ $.ajax({
url: "/material/findMatrialByCode?code=" + code, url: "/material/findMatrialByCode",
type: "get", type: "get",
dataType: 'json', dataType: 'json',
data:req,
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (d) { success: function (d) {
var d = d.data; var d = d.data;
@ -318,8 +338,23 @@
materialId.value = ""; materialId.value = "";
obj.value = ""; obj.value = "";
}else{ }else{
materialName.value = d.mname; req.mid = d.id;
materialId.value = d.id; $.ajax({
url: "/place/findPlaceByMid",
type: "post",
dataType: 'json',
data:JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success:function (res) {
$('#place').empty();
$.each(res.data, function (index, item) {
$('#place').append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素
});
form.render();
materialName.value = d.mname;
materialId.value = d.id;
}
});
} }
} }
}); });
@ -344,7 +379,7 @@
maxmin: true, maxmin: true,
shadeClose: true, //点击遮罩关闭层 shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'], area: ['70%', '70%'],
content: '/selectMaterialByCard?mname='+mname+'&type=1&clickObj='+parentId, content: '/selectMaterialByCard?mname='+mname+'&type=2&clickObj='+parentId,
move : '.layui-layer-title', move : '.layui-layer-title',
fixed:false, fixed:false,
end: function () { end: function () {
@ -355,11 +390,18 @@
dataType: 'json', dataType: 'json',
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success: function (d) { success: function (d) {
var code = d.data.code; var material = d.data.materialById;
var placeList = d.data.placeList;
var code = material.code;
if(code === undefined){ if(code === undefined){
code = ""; code = "";
} }
codeValue.value = code; codeValue.value = code;
$('#place').empty();
$.each(placeList, function (index, item) {
$('#place').append(new Option(item.depositoryName+"-"+item.code, item.id));//往下拉菜单里添加元素
});
form.render();
} }
}); });

4
target/classes/templates/pages/application/form-step-look_back.html

@ -38,6 +38,10 @@
<td>仓库名称</td> <td>仓库名称</td>
<td id="depositoryName" th:text="${record.getDepositoryName()}">外芯仓库</td> <td id="depositoryName" th:text="${record.getDepositoryName()}">外芯仓库</td>
</tr> </tr>
<tr>
<td>所处库位</td>
<td id="placeCode" th:text="${record.getPCode()}">0000</td>
</tr>
<tr> <tr>
<td>数量</td> <td>数量</td>
<td id="quantity" th:text="${record.getQuantity()}">409</td> <td id="quantity" th:text="${record.getQuantity()}">409</td>

6
target/classes/templates/pages/material/material-view.html

@ -62,7 +62,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">二维码</label> <label class="layui-form-label">二维码</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<img src="" id="qrCode" onclick="changeQrCodeState()"> <img src="" id="qrCode" th:src="${qrCode}">
</div> </div>
</div> </div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
@ -128,10 +128,6 @@
return false; return false;
}); });
function changeQrCodeState() {
var mid = $("#id").val();
}
}); });
</script> </script>

3
target/classes/templates/pages/material/selectDepositoryByCard.html

@ -52,7 +52,7 @@
if(!flag) { if(!flag) {
depositoryName.value = obj.data.title; depositoryName.value = obj.data.title;
depositoryId.value = obj.data.id; depositoryId.value = obj.data.id;
placeId.value = -1; placeId.value = 0;
}else{ }else{
var did = dataId.split("-"); var did = dataId.split("-");
$.ajax({ $.ajax({
@ -64,6 +64,7 @@
depositoryName.value = d.data.dname +"-"+ obj.data.title; depositoryName.value = d.data.dname +"-"+ obj.data.title;
} }
}); });
console.log(did)
depositoryId.value = did[0]; depositoryId.value = did[0];
placeId.value = did[1]; placeId.value = did[1];
} }

12
target/classes/templates/pages/place/place_edit.html

@ -13,7 +13,7 @@
<div class="layuimini-container"> <div class="layuimini-container">
<div class="layuimini-main"> <div class="layuimini-main">
<fieldset class="table-search-fieldset"> <fieldset class="table-search-fieldset">
<legend>库位创建</legend> <legend>库位详情</legend>
<div class="layui-fluid"> <div class="layui-fluid">
<div class="layui-card"> <div class="layui-card">
<div class="layui-card-body" style="padding-top: 40px;"> <div class="layui-card-body" style="padding-top: 40px;">
@ -29,13 +29,13 @@
name="place_x" lay-verify="required"/> name="place_x" lay-verify="required"/>
</div> </div>
</div> </div>
<div class="layui-form-item"> <!--<div class="layui-form-item">
<label class="layui-form-label">库位列:</label> <label class="layui-form-label">库位列:</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="text" placeholder="请填写列数" class="layui-input" th:value="${place.getY()}" <input type="text" placeholder="请填写列数" class="layui-input" th:value="${place.getY()}"
name="place_y" lay-verify="required"/> name="place_y" lay-verify="required"/>
</div> </div>
</div> </div>-->
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">库位层:</label> <label class="layui-form-label">库位层:</label>
<div class="layui-input-block"> <div class="layui-input-block">
@ -57,6 +57,12 @@
name="min" lay-verify="required"/> name="min" lay-verify="required"/>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">二维码</label>
<div class="layui-input-inline">
<img src="" id="qrCode" th:src="${qrCode}">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formStep"> <button class="layui-btn" lay-submit lay-filter="formStep">

143
target/classes/templates/pages/place/place_list_add.html

@ -0,0 +1,143 @@
<!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_start_x" lay-verify="required"/>
</div>
<label class="layui-form-label">结束行:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写行数" class="layui-input"
name="place_end_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_start_y" lay-verify="required"/>
</div>
<label class="layui-form-label">结束列:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写列数" class="layui-input"
name="place_end_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_start_z" lay-verify="required"/>
</div>
<label class="layui-form-label">结束层:</label>
<div class="layui-input-block">
<input type="text" placeholder="请填写层数" class="layui-input"
name="place_end_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">
&emsp;创建库位&emsp;
</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 = "list";
$.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="/insertListPlace?depositoryId="+depositoryId
});
}
},
complete: function () {
form.val("form1", {
})
}
});
return false;
});
});
</script>
</body>
</html>

315
target/classes/templates/pages/uniApp/scanQrCode.html

@ -0,0 +1,315 @@
<template>
<div class="page-scan">
<div class="base-line">
<div class="pullWrap">
<div class="topTitle">
<div class="pullTitle">
<div class="pullName">二维码绑定</div>
<!-- 绑定状态图标 -->
<img class="left-icon" src="/static/img/noBind.svg" alt="" v-if="!dataObj.qrCodeId">
<img class="left-icon" src="/static/img/binded.svg" alt="" v-else>
<div class="right-part">
<input :disabled="dataObj.qrCodeId" type="text" v-model="dataObj.qrCodeId" placeholder="请输入二维码ID" v-if="dataObj.qrCodeId">
<input type="text" v-model="scanTextData.scanText" placeholder="请输入二维码ID" v-else>
<img src="/static/img/scan.svg" alt="" v-if="!dataObj.qrCodeId">
<span @click="toScanCode" v-if="!dataObj.qrCodeId">扫码填入</span>
<span v-if="dataObj.qrCodeId">解绑</span>
</div>
</div>
</div>
</div>
</div>
<!-- 扫描盒子 -->
<div class="scan-box" v-if="scanTextData.showScanBox">
<div class="scan-cacel" @click="cancelScan" v-show="scanTextData.showScanBoxInfo">
<!-- <img src="" alt=""> -->
取消
</div>
<video ref="video" id="video" class="scan-video" v-show="scanTextData.showScanBoxInfo" autoplay></video>
<div class="scan-img" v-show="scanTextData.showScanBoxInfo">
<div class="scan-frame">
<span class="left-t"></span>
<span class="right-t"></span>
<span class="left-b"></span>
<span class="right-b"></span>
<span class="cross-line"></span>
</div>
</div>
<!-- <img src="/static/img/scan.svg" alt="" v-show="scanTextData.showScanBoxInfo"> -->
<div class="scan-tip" v-show="scanTextData.showScanBoxInfo"> {{scanTextData.tipMsg}} </div>
</div>
</div>
</template>
<script>
import { BrowserMultiFormatReader } from '@zxing/library';
let scanTextData = {
loadingShow: false,
codeReader: null,
scanText: '',
vin: null,
tipMsg: '将二维码置于屏幕中,即可识别',
tipShow: false
}
export default {
name: 'scanCodePage',
data() {
return {
scanTextData:{
loadingShow: false,
codeReader: null,
scanText: '',
vin: null,
tipMsg: '将二维码置于屏幕中,即可识别',
tipShow: false,
showScanBox:false,
showScanBoxInfo:false,
},
hasBind:false
}
},
methods: {
toScanCode(){
console.log('识别二维码',this.dataObj)
scanTextData.codeReader = new BrowserMultiFormatReader();
this.scanTextData.showScanBox = true
this.openScan();
},
cancelScan(){
//识别完停止使用摄像头
let thisVideo = document.getElementById("video");
thisVideo.srcObject.getTracks()[0].stop()
scanTextData.codeReader.reset(); // 重置
this.scanTextData.showScanBox = false
setTimeout(()=>{
this.scanTextData.showScanBoxInfo = false
},1000)
},
async openScan() {
scanTextData.codeReader.getVideoInputDevices().then((videoInputDevices) => {
scanTextData.tipShow = true;
scanTextData.tipMsg = '正在调用摄像头...';
console.log('videoInputDevices', videoInputDevices);
// 默认获取第一个摄像头设备id
let firstDeviceId = videoInputDevices[0].deviceId;
// 获取第一个摄像头设备的名称
const videoInputDeviceslablestr = JSON.stringify(videoInputDevices[0].label);
if (videoInputDevices.length > 1) {
// 判断是否后置摄像头
if (videoInputDeviceslablestr.indexOf('back') > -1) {
firstDeviceId = videoInputDevices[0].deviceId;
} else {
firstDeviceId = videoInputDevices[1].deviceId;
}
}
this.decodeFromInputVideoFunc(firstDeviceId);
}).catch(err => {
scanTextData.tipShow = false;
console.error(err);
});
},
decodeFromInputVideoFunc(firstDeviceId) {
scanTextData.codeReader.reset(); // 重置
scanTextData.scanText = '';
scanTextData.codeReader.decodeFromInputVideoDeviceContinuously(firstDeviceId, 'video', (result, err) => {
scanTextData.tipMsg = '将二维码置于屏幕中,即可识别';
scanTextData.scanText = '';
setTimeout(()=>{
this.scanTextData.showScanBoxInfo = true
},1000)
if (result) {
console.log('扫描结果', result.text);
if (result.text) {
console.log('扫描结果11', result.text);
this.scanTextData.showScanBox = false
this.scanTextData.showScanBoxInfo = false
this.scanTextData.scanText = result.text
//这里扫描出结果可以调用你想要的方法
//识别完停止使用摄像头
let thisVideo = document.getElementById("video");
thisVideo.srcObject.getTracks()[0].stop()
scanTextData.codeReader.reset(); // 重置
}
}else{
// console.log('没出来?',result,err)
}
if (err && !(err)) {
scanTextData.tipMsg = '识别失败';
setTimeout(() => {
scanTextData.tipShow = false;
}, 2000)
console.error(err);
}
});
},
},
props:['dataObj']
}
</script>
<style scoped lang="scss">
.pullWrap {
width: 100%;
height: 100px;
padding-top: 50px;
background: #fff;
}
.topTitle {
width: 100%;
position: relative;
}
.pullTitle {
display: flex;
height: 80px;
line-height: 80px;
margin-top: -40px;
background: #fff;
align-items: center;
justify-content: space-between;
}
.pullName{
font-size: 30px;
color: rgba(0,0,0,0.85);
}
img{
width: 40px;
height: 40px;
}
.left-icon{
margin:0 15px;
}
span{
text-decoration: underline;
text-decoration-color: #42a5ff;
color: #42a5ff;
margin-left: 5px;
}
.right-part {
flex: 1;
display: flex;
align-items: center;
justify-content: space-around;
border-bottom: 1px solid #e5e5e5;
overflow: hidden;
text-overflow: ellipsis;
}
input{
border:none;
flex: 1;
}
.scan-index-bar{
background-image: linear-gradient( -45deg, #42a5ff ,#59cfff);
}
.van-nav-bar__title{
color: #fff !important;
}
.scan-box {
position: fixed;
top: 0;
left: 0;
z-index: 5;
height: 100%;
width: 100vw;
}
.scan-cacel{
position: absolute;
top: 30px;
left: 30px;
z-index: 9;
color: #fff;
font-size: 35px;
}
.scan-video{
height: 100vh;
width: 100vw;
object-fit:cover;
}
.scan-img {
width: 500px;
height: 500px;
position: fixed;
top: 40%;
left: 50%;
margin-top: -200px;
margin-left: -250px;
z-index: 6;
}
.scan-frame {
width: 100%;
height: 100%;
position: relative;
}
.left-t,.right-t,.left-b,.right-b{
position: absolute;
width: 80px;
height: 80px;
}
.left-t{
top: 0;
left: 0;
border-top:2px solid #17B1B7;
border-left:2px solid #17B1B7;
}
.right-t{
top: 0;
right: 0;
border-top:2px solid #17B1B7;
border-right:2px solid #17B1B7;
}
.left-b{
bottom: 0;
left: 0;
border-bottom:2px solid #17B1B7;
border-left:2px solid #17B1B7;
}
.right-b{
bottom: 0;
right: 0;
border-bottom:2px solid #17B1B7;
border-right:2px solid #17B1B7;
}
.cross-line{
width: 600px;
height: 10px;
background: linear-gradient(to right, rgba(255, 255, 255, 0),#5DDDD3,rgba(255,255,255,0));
position: absolute;
top: 0;
left: -50px;
animation: identifier_p 5s infinite;
}
@keyframes identifier_p {
0%{
top: 0%;
}
50%{
top: 100%;
}
100%{
top: 0;
}
}
.scan-tip{
width: 100vw;
text-align: center;
margin-bottom: 10vh;
color: white;
font-size: 5vw;
position: absolute;
bottom: 50px;
left: 0;
color: #fff;
}
.page-scan{
overflow-y: hidden;
// background-color: #363636;
}
</style>

6
target/classes/templates/pages/warehouse/warehouse_view.html

@ -82,6 +82,12 @@
<input type="text" th:value="${record.getMinNumber()}" name="minNumber" required lay-verify="required" autocomplete="off" class="layui-input"> <input type="text" th:value="${record.getMinNumber()}" name="minNumber" required lay-verify="required" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">二维码</label>
<div class="layui-input-inline">
<img src="" id="qrCode" th:src="${qrCode}">
</div>
</div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
<label class="layui-form-label">状态</label> <label class="layui-form-label">状态</label>
<div class="layui-input-block"> <div class="layui-input-block">

Loading…
Cancel
Save