Browse Source

实现打印功能

lwx_dev
erdanergou 3 years ago
parent
commit
991ec33c92
  1. 5
      src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java
  2. 6
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  3. 1
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  4. 46
      src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java
  5. 2
      src/main/java/com/dreamchaser/depository_manage/mapper/SplitUnitMapper.xml
  6. 8
      src/main/java/com/dreamchaser/depository_manage/service/SplitUnitService.java
  7. 45
      src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java
  8. 21
      src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java
  9. 248
      src/main/resources/static/js/JcPrinter/index_Demo.js
  10. 122
      src/main/resources/static/js/JcPrinter/jcPrinterSdk_api_third.js
  11. 15
      src/main/resources/templates/pages/JcPrinter/PrinterIndex.html
  12. 5
      src/main/resources/templates/pages/application/application-in.html
  13. 4
      src/main/resources/templates/pages/application/application-out.html
  14. 42
      src/main/resources/templates/pages/application/application-out_back.html
  15. 2
      src/main/resources/templates/pages/application/application_multi.html
  16. 2
      src/main/resources/templates/pages/application/form-step-look_minRecordOut.html
  17. 2
      src/main/resources/templates/pages/group/applicationOutForGroup.html
  18. 4
      src/main/resources/templates/pages/place/place_edit.html
  19. 93
      src/main/resources/templates/pages/split/split-out.html
  20. 7
      src/main/resources/templates/pages/stockTaking/stockTaking.html
  21. 4
      src/main/resources/templates/pages/warehouse/warehouse_view.html
  22. 2
      target/classes/com/dreamchaser/depository_manage/mapper/SplitUnitMapper.xml
  23. 248
      target/classes/static/js/JcPrinter/index_Demo.js
  24. 122
      target/classes/static/js/JcPrinter/jcPrinterSdk_api_third.js
  25. 15
      target/classes/templates/pages/JcPrinter/PrinterIndex.html
  26. 5
      target/classes/templates/pages/application/application-in.html
  27. 4
      target/classes/templates/pages/application/application-out.html
  28. 42
      target/classes/templates/pages/application/application-out_back.html
  29. 2
      target/classes/templates/pages/application/application_multi.html
  30. 2
      target/classes/templates/pages/application/form-step-look_minRecordOut.html
  31. 2
      target/classes/templates/pages/group/applicationOutForGroup.html
  32. 4
      target/classes/templates/pages/place/place_edit.html
  33. 93
      target/classes/templates/pages/split/split-out.html
  34. 4
      target/classes/templates/pages/warehouse/warehouse_view.html

5
src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java

@ -635,6 +635,8 @@ public class GroupController {
List<GroupInfo> groupInfoByGid = groupService.findGroupInfoByGid(gid); List<GroupInfo> groupInfoByGid = groupService.findGroupInfoByGid(gid);
// 用于标志该数量是否合法 // 用于标志该数量是否合法
boolean flag = true; boolean flag = true;
// 用于存储不符合数量的物料名称
String mname = "";
for (GroupInfo groupInfo : groupInfoByGid) { for (GroupInfo groupInfo : groupInfoByGid) {
// 获取具体信息 // 获取具体信息
@ -656,8 +658,9 @@ public class GroupController {
// 如果概述了不合法 // 如果概述了不合法
flag = false; flag = false;
} }
mname = groupInfo.getMname();
} }
return new RestResponse(flag); return new RestResponse(flag,200,new StatusInfo(mname,mname));
} else { } else {
throw new MyException("缺少必要参数"); throw new MyException("缺少必要参数");
} }

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

@ -1833,8 +1833,10 @@ public class MaterialController {
public RestResponse updateQrCodeType(@RequestBody Map<String,Object> map){ public RestResponse updateQrCodeType(@RequestBody Map<String,Object> map){
// 获取转换类型 // 获取转换类型
String type = (String) map.get("type"); String type = (String) map.get("type");
String mcode = (String) map.get("mcode");
int result = 0; int result = 0;
if(!"noMaterial".equals(mcode)){
if("qTb".equals(type)){ if("qTb".equals(type)){
// 如果是二维码转条形码 // 如果是二维码转条形码
result = materialService.qrCodeToBarCode(map); result = materialService.qrCodeToBarCode(map);
@ -1842,6 +1844,8 @@ public class MaterialController {
// 如果是条形码转二维码 // 如果是条形码转二维码
result = materialService.barCodeToQrCode(map); result = materialService.barCodeToQrCode(map);
} }
}
return CrudUtil.putHandle(1,result); return CrudUtil.putHandle(1,result);
} }

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

@ -2281,6 +2281,7 @@ public class PageController {
if (flag == 1) { if (flag == 1) {
// 如果是物料 // 如果是物料
// 获取当前对应物料
// 获取当前对应物料 // 获取当前对应物料
Material materialById = materialService.findMaterialById(mid); Material materialById = materialService.findMaterialById(mid);
// 获取当前物料对应的码值 // 获取当前物料对应的码值

46
src/main/java/com/dreamchaser/depository_manage/controller/SplitController.java

@ -31,6 +31,7 @@ public class SplitController {
/** /**
* 用于添加一条拆单记录 * 用于添加一条拆单记录
*
* @param map 待添加数据 * @param map 待添加数据
* @param request * @param request
* @return * @return
@ -47,6 +48,7 @@ public class SplitController {
/** /**
* 用于根据条件查询拆单记录 * 用于根据条件查询拆单记录
*
* @param map 待查询条件 * @param map 待查询条件
* @param request * @param request
* @return * @return
@ -59,6 +61,7 @@ public class SplitController {
/** /**
* 根据条件删除对应的拆单记录 * 根据条件删除对应的拆单记录
*
* @param map 待删除数据 * @param map 待删除数据
* @return * @return
*/ */
@ -100,6 +103,7 @@ public class SplitController {
/** /**
* 根据条件修改拆单信息 * 根据条件修改拆单信息
*
* @param map 待修改数据 * @param map 待修改数据
* @return * @return
*/ */
@ -135,4 +139,46 @@ public class SplitController {
} }
return new RestResponse(0); return new RestResponse(0);
} }
/**
* 用于查找当前禁用的拆单是否正在使用
*
* @param map
* @return
*/
@PostMapping("/findAllSplitInfoForbidden")
public RestResponse findAllSplitInfoForbidden(@RequestBody Map<String, Object> map) {
if (map.containsKey("id")) {
// 获取当前要禁用的拆单
Integer sid = ObjectFormatUtil.toInteger(map.get("id"));
// 判断当前拆单是否可以禁用
boolean sonSplitInfoByParentId = findSonSplitInfoByParentId(sid, true);
return new RestResponse(sonSplitInfoByParentId);
} else {
throw new MyException("缺少必要参数");
}
}
/**
* 获取当前拆单的子拆单
* @param parentId 待查询父级id
* @param flag 标志位
* @return
*/
boolean findSonSplitInfoByParentId(Integer parentId,boolean flag){
// 获取当前的子拆单
SplitInfo splitInfoByParentId = splitUnitService.findSplitInfoByParentId(parentId);
boolean allSplitInfoForbidden = splitUnitService.findAllSplitInfoForbidden(parentId);
if(splitInfoByParentId == null){
// 如果不存在
return allSplitInfoForbidden;
}else{
// 如果存在
// 获取当前拆单是否可以禁用
return findSonSplitInfoByParentId(splitInfoByParentId.getId(),flag && allSplitInfoForbidden);
}
}
} }

2
src/main/java/com/dreamchaser/depository_manage/mapper/SplitUnitMapper.xml

@ -86,7 +86,7 @@
select select
<include refid="splitInfoAllColumns"/> <include refid="splitInfoAllColumns"/>
from `split` s from `split` s
where s.mid = #{mid} where s.mid = #{mid} and s.state = 1
</select> </select>

8
src/main/java/com/dreamchaser/depository_manage/service/SplitUnitService.java

@ -148,4 +148,12 @@ public interface SplitUnitService {
* @return * @return
*/ */
SplitInfo findSplitInfoByParentId(Integer parentId); SplitInfo findSplitInfoByParentId(Integer parentId);
/**
* 用于查找当前拆单是否正在使用
* @param sid 待查询id
* @return
*/
boolean findAllSplitInfoForbidden(Integer sid);
} }

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

@ -964,10 +964,14 @@ public class MaterialServiceImpl implements MaterialService {
map.put("barCode", barCode); map.put("barCode", barCode);
map.put("codeFlag", 1); map.put("codeFlag", 1);
List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(map); List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(map);
MaterialAndBarCode materialAndBarCode = null;
if (materialByBarCodeByCondition.size() > 0) { if (materialByBarCodeByCondition.size() > 0) {
return materialByBarCodeByCondition.get(0); materialAndBarCode = materialByBarCodeByCondition.get(0);
}else{
map.put("qrCode",barCode);
materialAndBarCode = materialMapper.findMaterialAndBarCodeByQrCode(map);
} }
return null; return materialAndBarCode;
} }
/** /**
@ -1002,8 +1006,16 @@ public class MaterialServiceImpl implements MaterialService {
@Override @Override
public MaterialAndBarCode findMaterialByBarCodeByBarCodeAndDepositoryId(Map<String, Object> map) { public MaterialAndBarCode findMaterialByBarCodeByBarCodeAndDepositoryId(Map<String, Object> map) {
List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(map); List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(map);
MaterialAndBarCode materialAndBarCode = null;
if (materialByBarCodeByCondition.size() > 0) { if (materialByBarCodeByCondition.size() > 0) {
MaterialAndBarCode materialAndBarCode = materialByBarCodeByCondition.get(0); materialAndBarCode = materialByBarCodeByCondition.get(0);
} else {
map.put("qrCode", map.get("barCode"));
materialAndBarCode = materialMapper.findMaterialAndBarCodeByQrCode(map);
}
if (materialAndBarCode != null) {
if (materialAndBarCode.getIid() != null) { if (materialAndBarCode.getIid() != null) {
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid());
if (inventoryByMid != null) { if (inventoryByMid != null) {
@ -1014,9 +1026,8 @@ public class MaterialServiceImpl implements MaterialService {
} else { } else {
materialAndBarCode.setPrice(0.0); materialAndBarCode.setPrice(0.0);
} }
return materialAndBarCode;
} }
return null; return materialAndBarCode;
} }
/** /**
@ -1074,7 +1085,16 @@ public class MaterialServiceImpl implements MaterialService {
*/ */
@Override @Override
public String findMaterialCodeByQrCode(String qrCode) { public String findMaterialCodeByQrCode(String qrCode) {
return qrCodeMapper.findMaterialCodeByQrCode(qrCode); String code = qrCodeMapper.findMaterialCodeByQrCode(qrCode);
if(code == null){
Map<String,Object> map = new HashMap<>();
map.put("qrCode",qrCode);
MaterialAndBarCode materialAndBarCodeByQrCode = materialMapper.findMaterialAndBarCodeByQrCode(map);
if(materialAndBarCodeByQrCode != null){
code = materialAndBarCodeByQrCode.getMcode();
}
}
return code;
} }
/** /**
@ -1455,8 +1475,7 @@ public class MaterialServiceImpl implements MaterialService {
// 获取当前父级 // 获取当前父级
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId());
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo);
} } else {
else{
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100));
paramForNewMap.put("realQuantity", String.valueOf(dispose)); paramForNewMap.put("realQuantity", String.valueOf(dispose));
paramForNewMap.put("quantity", String.valueOf(dispose)); paramForNewMap.put("quantity", String.valueOf(dispose));
@ -1476,8 +1495,7 @@ public class MaterialServiceImpl implements MaterialService {
// 修改库存数量 // 修改库存数量
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); splitUnitMapper.updateSplitInventory(splitInventoryForAfter);
} }
} } else {
else{
// 如果不存在转移后的拆单库存记录 // 如果不存在转移后的拆单库存记录
// 定义用于添加拆单库存记录 // 定义用于添加拆单库存记录
@ -1515,8 +1533,7 @@ public class MaterialServiceImpl implements MaterialService {
splitUnitMapper.addSplitInventory(insertForSplitInventory); splitUnitMapper.addSplitInventory(insertForSplitInventory);
} }
} }
} } else {
else{
// 如果转移后的当前库位不存在该物料 // 如果转移后的当前库位不存在该物料
@ -1564,8 +1581,6 @@ public class MaterialServiceImpl implements MaterialService {
} }
} }
} }
@ -2447,6 +2462,7 @@ public class MaterialServiceImpl implements MaterialService {
/** /**
* 用于将当前二维码转为条形码 * 用于将当前二维码转为条形码
*
* @param map 具体转换数据 * @param map 具体转换数据
* @return * @return
*/ */
@ -2471,6 +2487,7 @@ public class MaterialServiceImpl implements MaterialService {
/** /**
* 用于将当前条形码转为二维码 * 用于将当前条形码转为二维码
*
* @param map 具体转换数据 * @param map 具体转换数据
* @return * @return
*/ */

21
src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java

@ -488,6 +488,25 @@ public class SplitUnitServiceImpl implements SplitUnitService {
return splitUnitMapper.findSplitInfoByParentId(parentId); return splitUnitMapper.findSplitInfoByParentId(parentId);
} }
/**
* 用于查找当前拆单是否正在使用
* @param sid 待查询id
* @return
*/
@Override
public boolean findAllSplitInfoForbidden(Integer sid) {
// 获取当前拆单记录所拥有的库存记录
List<SplitInventory> splitInventoryBySid = splitUnitMapper.findSplitInventoryBySid(sid);
for (SplitInventory splitInventory :
splitInventoryBySid) {
if (Integer.compare(splitInventory.getOutQuantity(), 0) != 0) {
// 如果当前库存还未使用完成
return false;
}
}
return true;
}
/** /**
* 用于拆单库存处理记录的修改 * 用于拆单库存处理记录的修改
* *
@ -763,7 +782,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
} }
/** /**
* 根据物料id查询对应的拆单记录 * 根据物料id查询对应的拆单记录(启用中)
* *
* @param mid 待查询物料id * @param mid 待查询物料id
* @return * @return

248
src/main/resources/static/js/JcPrinter/index_Demo.js

@ -70,8 +70,10 @@ var app = new Vue({
formLabelWidth: "120px", formLabelWidth: "120px",
options: [], options: [],
tags: [], tags: [],
isBarCode:false,
isInit: false, isInit: false,
versionInit: false, versionInit: false,
isVersion:false,
isInitApi: false, isInitApi: false,
isDraw: false, isDraw: false,
isEditTag: false, isEditTag: false,
@ -118,7 +120,7 @@ var app = new Vue({
// 初始化型号 // 初始化型号
DrawLableVersionTextParam: { DrawLableVersionTextParam: {
"x": 10.0, "x": 10.0,
"y": 10.0, "y": 8.0,
"height": 10, "height": 10,
"width": 50, "width": 50,
"value": document.getElementById("version").value, "value": document.getElementById("version").value,
@ -208,60 +210,8 @@ var app = new Vue({
// 初始化打印服务 // 初始化打印服务
let instance = getInstance(); let instance = getInstance();
if (!instance) { if (!instance) {
this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
}
else{
getAllPrinters((data) => {
// 返回值规范化
let arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
this.$alert('打印机获取失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
// 如果成功获取
// 当前的所有打印设备
allPrinters = JSON.parse(arrParse.resultAck.info);
// 所有名称
let allPrintersName = Object.keys(allPrinters);
// 所有对应值
let allPrintersValue = Object.values(allPrinters);
// 用于存储当前下拉框列表
this.options = [];
// 将其保存到数据中供前端展示
for (i = 0; i < allPrintersName.length; i++) {
// 设置新对象
let newopt = {};
// 设置标题
newopt.label = allPrintersName[i];
// 设置值
newopt.value = allPrintersValue[i];
// 添加对象
this.options.push(newopt)
}
// 选中打印机(默认选中第一个)
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => {
// 设置sdk状态为true
initSdkStatus = true;
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
// 如果失败 // 如果失败
this.$alert('打印设备连接失败,请重试', '提示', { this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
// 关闭当前页 // 关闭当前页
@ -269,13 +219,6 @@ var app = new Vue({
parent.layer.close(index); parent.layer.close(index);
} }
}); });
} else if (isJSON(arrParse.resultAck.info)) {
//选择成功,打印机连接成功
console.log(data)
}
}))
}
})
} }
}, },
methods: { methods: {
@ -314,7 +257,16 @@ var app = new Vue({
getAllPrinters(data => { getAllPrinters(data => {
// 返回结果规范化 // 返回结果规范化
let arrParse = JSON.parse(JSON.stringify(data)); let arrParse = JSON.parse(JSON.stringify(data));
if (isJSON(arrParse.resultAck.info)) { if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') {
this.$alert('打印机获取失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
// 获取所有打印设备 // 获取所有打印设备
allPrinters = JSON.parse(arrParse.resultAck.info); allPrinters = JSON.parse(arrParse.resultAck.info);
// 所有设备名称 // 所有设备名称
@ -337,7 +289,7 @@ var app = new Vue({
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => { selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => {
// 返回结果规范化 // 返回结果规范化
var arrParse = JSON.parse(JSON.stringify(data)); var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) { if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') {
this.$alert('打印设备选择失败,请重试', '提示', { this.$alert('打印设备选择失败,请重试', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
@ -432,7 +384,7 @@ var app = new Vue({
} else { } else {
// 展示生成按钮 // 展示生成按钮
this.isInit = true; this.isInit = true;
let version = $("#version").val() let version = $("#version").val();
if ("noMaterial" !== version) { if ("noMaterial" !== version) {
this.versionInit = true; this.versionInit = true;
} }
@ -496,6 +448,7 @@ var app = new Vue({
this.tags.push(this.DrawLableVersionTextParam) this.tags.push(this.DrawLableVersionTextParam)
} }
this.dialogDrawLableVersionTextParam = false; this.dialogDrawLableVersionTextParam = false;
this.isVersion = true;
this.isDraw = true this.isDraw = true
}, },
// 一维码 // 一维码
@ -504,42 +457,17 @@ var app = new Vue({
this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height); this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height);
this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x); this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x);
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y); this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y);
if(this.versionInit){ this.DrawLableBarCodeParam.textHeight = Number(this.DrawLableBarCodeParam.textHeight);
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + 10; if (this.isVersion) {
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
} }
this.DrawLableBarCodeParam.name = "条形码"; this.DrawLableBarCodeParam.name = "条形码";
// 发送请求将其变成条形码
let req = {};
req.qrCode = this.DrawLableBarCodeParam.value;
req.mcode = $("#materialCode").val();
req.type = "qTb";
$.ajax({
url: "/material/updateQrCodeType",
type: "post",
dataType: "json",
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: result => {
DrawLableBarCode(this.DrawLableBarCodeParam, res => {
var arrParse = JSON.parse(JSON.stringify(res));
//⼀维码绘制失败,退出绘制
if (arrParse.resultAck.result !== 0) {
this.$message({ // 发起提示
message: '绘制失败,请重试',
type: 'warning'
});
}
});
}
});
if (this.isEditTag) { if (this.isEditTag) {
this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam); this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam);
} else { } else {
this.tags.push(this.DrawLableBarCodeParam) this.tags.push(this.DrawLableBarCodeParam)
} }
this.isBarCode = true;
this.dialogDrawLableBarCodeParam = false; this.dialogDrawLableBarCodeParam = false;
this.isDraw = true this.isDraw = true
}, },
@ -551,39 +479,17 @@ var app = new Vue({
this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x); this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x);
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y); this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y);
this.DrawLableQrCodeParam.name = "二维码"; this.DrawLableQrCodeParam.name = "二维码";
let req = {}; if (this.isVersion) {
req.qrCode = this.DrawLableQrCodeParam.value; this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
req.mcode = $("#materialCode").val();
req.type = "bTq";
$.ajax({
url: "/material/updateQrCodeType",
type: "post",
dataType: "json",
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: result => {
DrawLableQrCode(this.DrawLableQrCodeParam, res => {
var arrParse = JSON.parse(JSON.stringify(res));
//⼀维码绘制失败,退出绘制
if (arrParse.resultAck.result !== 0) {
this.$message({ // 发起提示
message: '绘制失败,请重试',
type: 'warning'
});
}
});
} }
});
if (this.isEditTag) { if (this.isEditTag) {
this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam); this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam);
} else { } else {
this.tags.push(this.DrawLableQrCodeParam) this.tags.push(this.DrawLableQrCodeParam)
} }
this.dialogDrawLableQrCodeParam = false; this.dialogDrawLableQrCodeParam = false;
this.isDraw = true this.isDraw = true;
this.isBarCode = false;
}, },
DragList(List) { DragList(List) {
List.forEach(res => { List.forEach(res => {
@ -704,20 +610,19 @@ var app = new Vue({
}); });
return; return;
} }
// 为了防止打印时未生成对应图像事先初始化 // 为了防止打印时未生成对应图像事先初始化
// 初始化画板 // 初始化画板
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
if (this.isBarCode) {
if (this.dialogDrawLableBarCodeParam) {
// 如果打印条形码 // 如果打印条形码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){ if (this.isVersion) {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{ InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => { this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -736,8 +641,14 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}) }))
}))
}))
} else { } else {
// 不打印型号
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => { this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -756,14 +667,17 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}))
}))
} }
}
}) else {
} else {
// 如果打印二维码 // 如果打印二维码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){ if (this.isVersion) {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{ InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => { this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -782,9 +696,14 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}) }))
}else{ }))
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => { }))
}
else {
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableQrCodeApiDemo(this.DrawLableQrCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
startJob(parseInt(density), parseInt(paperType), parseInt(printMode), totalCount, function (data) { startJob(parseInt(density), parseInt(paperType), parseInt(printMode), totalCount, function (data) {
@ -802,13 +721,12 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}))
}))
} }
})
} }
}))
}, },
/** /**
@ -857,52 +775,68 @@ var app = new Vue({
pageIndex++; pageIndex++;
setTimeout(function () { setTimeout(function () {
// 初始化画板 // 初始化画板
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
if (this.dialogDrawLableBarCodeParam) {
// 添加名称 if (this.isBarCode) {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{ // 如果绘制条形码
if(self.versionInit){
if (self.isVersion) {
// 如果绘制型号 // 如果绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
// 添加型号 // 添加型号
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam,(data)=>{ self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam, (data => {
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => { self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}) }))
}))
}))
} else { } else {
// 如果不绘制型号 // 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => { self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}))
}))
} }
}) }
else {
// 如果绘制二维码
} else {
// 添加名称
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{
// 如果绘制型号 // 如果绘制型号
if(self.versionInit){ if (self.isVersion) {
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
// 添加型号 // 添加型号
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam,(data)=>{ self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam, (data => {
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => { self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}) }))
}else{ }))
}))
}
else {
// 如果不绘制型号 // 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => { self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}))
}))
} }
})
} }
// 提交数据
}))// 提交数据
}, 500); }, 500);
} }
}); });

122
src/main/resources/static/js/JcPrinter/jcPrinterSdk_api_third.js

@ -17,8 +17,10 @@ var MessageList = {};
function sendMsg(msg, callback) { function sendMsg(msg, callback) {
// console.log('sendMsg', msg.apiName); // console.log('sendMsg', msg.apiName);
MessageList[msg.apiName] = callback; MessageList[msg.apiName] = callback;
var data = JSON.stringify(msg); var data = JSON.stringify(msg);
var tryTimes = 10; var tryTimes = 10;
for (var i = 0; i < tryTimes; i++) { for (var i = 0; i < tryTimes; i++) {
if (g_websocket.readyState === 1) { if (g_websocket.readyState === 1) {
g_websocket.send(data); g_websocket.send(data);
@ -33,23 +35,15 @@ function getInstance() {
if ('WebSocket' in window) { if ('WebSocket' in window) {
g_websocket = websocketLifePeriod(); g_websocket = websocketLifePeriod();
} else { } else {
this.$alert('不支持websocket,请重试', '提示', { console.log('unsupported websocket');
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
//return false; //return false;
g_websocket = null; g_websocket = null;
return false; return false;
} }
});
}
//保持在线(开启定时任务,每3秒执行一次) //保持在线
setInterval(function () { setInterval(function () {
if (g_websocket.readyState === 2 || g_websocket.readyState === 3) { if (g_websocket.readyState === 2 || g_websocket.readyState === 3) {
// 如果等待或者断开
getInstance(); getInstance();
} }
}, 3000); }, 3000);
@ -60,10 +54,9 @@ function getInstance() {
//1.1.1 打开链接及回调 //1.1.1 打开链接及回调
function websocketLifePeriod() { function websocketLifePeriod() {
let websocket; var websocket;
// 37989端口为jcPrinter.exe使用的端口
websocket = new WebSocket('ws://127.0.0.1:37989'); websocket = new WebSocket('ws://127.0.0.1:37989');
websocket.binaryType = 'arraybuffer'; //websocket.binaryType = 'arraybuffer';
websocket.onerror = function (evt) {//since there is an error, sockets will close so... websocket.onerror = function (evt) {//since there is an error, sockets will close so...
sok.onclose = function (e) { sok.onclose = function (e) {
console.log("WebSocket Error: ", e); console.log("WebSocket Error: ", e);
@ -89,10 +82,8 @@ function websocketLifePeriod() {
//1.1.2 websocket连接回调 //1.1.2 websocket连接回调
function connectCallback(e) { function connectCallback(e) {
ackJsonData = ''; ackJsonData = '';
console.log('websocket connect success'); console.log('success');
// 设置连接状态为true
websocketConnectStatus=true; websocketConnectStatus=true;
// 初始化
init(); init();
} }
@ -126,7 +117,6 @@ function readCallback(e) {
//接口回调 //接口回调
if (!!MessageList[arrParse.apiName]) { if (!!MessageList[arrParse.apiName]) {
MessageList[arrParse.apiName](arrParse); MessageList[arrParse.apiName](arrParse);
} }
@ -138,31 +128,32 @@ function readCallback(e) {
deviceStatus=false; deviceStatus=false;
} }
}else{ }else{
if (arrParse['resultAck']['callback'] !== undefined) { if (arrParse['resultAck']['callback'] != undefined) {
callbackName = arrParse['resultAck']['callback']['name']; callbackName = arrParse['resultAck']['callback']['name'];
if (callbackName === 'onConnectSuccess') { if (callbackName == 'onConnectSuccess') {
var printerName = arrParse['resultAck']['callback']['printerName']; var printerName = arrParse['resultAck']['callback']['printerName'];
onConnectSuccess(printerName); onConnectSuccess(printerName);
} else if (callbackName === 'onDisConnect') { } else if (callbackName == 'onDisConnect') {
var printerName = arrParse['resultAck']['callback']['printerName']; var printerName = arrParse['resultAck']['callback']['printerName'];
onDisConnect(printerName); onDisConnect(printerName);
} else if (callbackName === 'onCoverStatusChange') { } else if (callbackName == 'onCoverStatusChange') {
var coverStatus = arrParse['resultAck']['callback']['coverStatus']; var coverStatus = arrParse['resultAck']['callback']['coverStatus'];
onCoverStatusChange(coverStatus); onCoverStatusChange(coverStatus);
} else if (callbackName === 'onElectricityChange') { } else if (callbackName == 'onElectricityChange') {
var powerLever = arrParse['resultAck']['callback']['powerLever']; var powerLever = arrParse['resultAck']['callback']['powerLever'];
onElectricityChange(powerLever); onElectricityChange(powerLever);
} else if (callbackName === 'onPaperStatusChange') { } else if (callbackName == 'onPaperStatusChange') {
var paperStatus = arrParse['resultAck']['callback']['paperStatus']; var paperStatus = arrParse['resultAck']['callback']['paperStatus'];
onPaperStatusChange(paperStatus); onPaperStatusChange(paperStatus);
} else if (callbackName === 'onPrintPageCompleted') { } else if (callbackName == 'onPrintPageCompleted') {
onPrintPageCompleted(); onPrintPageCompleted();
} else if (callbackName === 'onPrintProgress') { } else if (callbackName == 'onPrintProgress') {
onPrintProgress(); onPrintProgress();
} else if (callbackName === 'onAbnormalResponse') { } else if (callbackName == 'onAbnormalResponse') {
onAbnormalResponse(); onAbnormalResponse();
} else { }
else {
console.log('unknow callback api!'); console.log('unknow callback api!');
} }
} }
@ -171,7 +162,6 @@ function readCallback(e) {
ackJsonData = ''; ackJsonData = '';
} }
} }
//1.1.5 错误回调 //1.1.5 错误回调
function errorCallback(e) { function errorCallback(e) {
//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件 //如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
@ -180,77 +170,24 @@ function errorCallback(e) {
//封装初始化SDK/获取打印机列表/选择打印机 //封装初始化SDK/获取打印机列表/选择打印机
function init() { function init() {
// 初始化sdk
initSdk(this.initSdkParam, function (data) { initSdk(this.initSdkParam, function (data) {
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data)); var arrParse = JSON.parse(JSON.stringify(data));
if (arrParse.resultAck.result !== 0) { if (arrParse.resultAck.result != 0) {
// 如果初始化失败
this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
return; return;
} }
// 获取所有打印设备
getAllPrinters((data) => { getAllPrinters(function (data) {
// 返回值规范化 var arrParse = JSON.parse(JSON.stringify(data));
let arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result ) { if (!arrParse.resultAck.result ) {
this.$alert('打印机获取失败,请重试', '提示', { return;
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) { } else if (isJSON(arrParse.resultAck.info)) {
// 如果成功获取 allPrinters = JSON.parse(arrParse.resultAck.info)
// 当前的所有打印设备
allPrinters = JSON.parse(arrParse.resultAck.info);
// 所有名称
let allPrintersName = Object.keys(allPrinters); let allPrintersName = Object.keys(allPrinters);
// 所有对应值
let allPrintersValue = Object.values(allPrinters); let allPrintersValue = Object.values(allPrinters);
// 用于存储当前下拉框列表
this.options = [];
// 将其保存到数据中供前端展示
for (i = 0; i < allPrintersName.length; i++) {
// 设置新对象
let newopt = {};
// 设置标题
newopt.label = allPrintersName[i];
// 设置值
newopt.value = allPrintersValue[i];
// 添加对象
this.options.push(newopt)
}
// 选中打印机(默认选中第一个)
selectPrinter(allPrintersName[0],parseInt(allPrintersValue[0]),(data=>{ selectPrinter(allPrintersName[0],parseInt(allPrintersValue[0]),(data=>{
// 设置sdk状态为true
initSdkStatus=true; initSdkStatus=true;
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
// 如果失败
this.$alert('打印设备连接失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
//选择成功,打印机连接成功
console.log(data)
}
})) }))
} }
}) })
@ -569,9 +506,9 @@ function InitDrawingBoard(json, callbackFunction) {
apiName: 'InitDrawingBoard', apiName: 'InitDrawingBoard',
parameter: json parameter: json
}; };
console.log("画布宽度:" + json.width); // console.log("宽度:" + json.width)
console.log("画布高度:" + json.height); // console.log("高度:" + json.height)
console.log("画布旋转角度:" + json.rotate); // console.log("旋转角度:" + json.rotate)
sendMsg(jsonObj, callbackFunction); sendMsg(jsonObj, callbackFunction);
} }
@ -651,6 +588,7 @@ function initSdk(json, callbackFunction) {
apiName: 'initSdk', apiName: 'initSdk',
parameter: json parameter: json
}; };
sendMsg(jsonObj, callbackFunction); sendMsg(jsonObj, callbackFunction);
} }

15
src/main/resources/templates/pages/JcPrinter/PrinterIndex.html

@ -12,12 +12,12 @@
<input style="display:none;" id="materialCode" th:value="${mcode}"> <input style="display:none;" id="materialCode" th:value="${mcode}">
<input style="display:none;" id="name" th:value="${name}"> <input style="display:none;" id="name" th:value="${name}">
<input style="display:none;" id="version" th:value="${version}"> <input style="display:none;" id="version" th:value="${version}">
<div class="title"> <!-- <div class="title">-->
<H2>刷新</H2> <!-- <H2>刷新</H2>-->
<div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div> <!-- <div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div>-->
</div> <!-- </div>
<br>
<br> <br>
<br>-->
<div class="link"> <div class="link">
<H2>打印设备</H2> <H2>打印设备</H2>
<el-row> <el-row>
@ -31,7 +31,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="12"><el-button @click="refreshPrinters()" type="primary">重新获取</el-button></el-col> <el-col :span="12"><el-button @click="refreshPrinters()" type="primary">获取打印设备</el-button></el-col>
</el-row> </el-row>
</div> </div>
<br> <br>
@ -164,6 +164,9 @@
<el-option label="旋转270度" :value="270"></el-option> <el-option label="旋转270度" :value="270"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文本高度" :label-width="formLabelWidth">
<el-input type="number" v-model="DrawLableBarCodeParam.textHeight" ></el-input>
</el-form-item>
<el-form-item label="文本位置" :label-width="formLabelWidth"> <el-form-item label="文本位置" :label-width="formLabelWidth">
<el-select v-model="DrawLableBarCodeParam.textPosition" placeholder="请选择文本位置"> <el-select v-model="DrawLableBarCodeParam.textPosition" placeholder="请选择文本位置">
<el-option label="下方显示" :value="0"></el-option> <el-option label="下方显示" :value="0"></el-option>

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

@ -961,7 +961,7 @@
var req = {}; var req = {};
req.qrCode = result; req.qrCode = result;
req.codeFlag = 2; req.codeFlag = 2;
$("#qrCode" + objIdNumber).val(result); $("#qrCode" + obj.id.split("qrCodeImg")[1]).val(result);
$.ajax({ $.ajax({
url: "/material/qywxApplicationInScanQrCode", url: "/material/qywxApplicationInScanQrCode",
type: "post", type: "post",
@ -1051,6 +1051,7 @@
}) })
} }
}) })
}; };
@ -1198,7 +1199,7 @@
parent.wx.scanQRCode({ parent.wx.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) { success: function (res) {
// 回调 // 回调
var result = res.resultStr;//当needResult为1时返回处理结果 var result = res.resultStr;//当needResult为1时返回处理结果

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

@ -1325,7 +1325,7 @@
parent.wx.scanQRCode({ parent.wx.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) { success: function (res) {
// 回调 // 回调
var result = res.resultStr;//当needResult为1时返回处理结果 var result = res.resultStr;//当needResult为1时返回处理结果
@ -1467,7 +1467,7 @@
var flag = res.data; var flag = res.data;
if (!flag) { // 如果当前数目不合适 if (!flag) { // 如果当前数目不合适
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { layer.msg("当前组合中"+res.statusInfo.message+"的库存数量不足", {icon: 0, time: 1000}, function () {
$("#quantityForGroup" + id).val(""); $("#quantityForGroup" + id).val("");
}); });

42
src/main/resources/templates/pages/application/application-out_back.html

@ -69,12 +69,6 @@
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" 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">
@ -155,20 +149,6 @@
step = layui.step; step = layui.step;
var temp = {}; var temp = {};
temp.mid = $("#mid").val(); temp.mid = $("#mid").val();
$.ajax({
url: "/place/findPlaceByMid",
type: "post",
dataType: 'json',
data: JSON.stringify(temp),
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();
}
});
$("#code").blur(function () { $("#code").blur(function () {
@ -190,20 +170,9 @@
$("#mid").val(""); $("#mid").val("");
} else { } else {
req.mid = d.id; req.mid = d.id;
let unitItem = $("#unit");
$.ajax({ unitItem.empty();
url: "/place/findPlaceByMid", unitItem.append(new Option(d.unit, "-1"));
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));//往下拉菜单里添加元素
});
$("#unit").empty();
$("#unit").append(new Option(d.unit, "-1"));
$.each(d.splitInfoList, function (index, item) { $.each(d.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit)); $("#unit").append(new Option(item.newUnit, item.newUnit));
}); });
@ -211,11 +180,8 @@
$("#mid").val(d.id); $("#mid").val(d.id);
form.render(); form.render();
} }
});
}
} }
}); })
}); });
$("#mname").blur(function () { $("#mname").blur(function () {

2
src/main/resources/templates/pages/application/application_multi.html

@ -93,8 +93,8 @@
{field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'code',width: 200,title: '存货编码',sort: true},
{title: '所处位置', width: 200, templet: '#selectLocation', align: "center"}, {title: '所处位置', width: 200, templet: '#selectLocation', align: "center"},
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{field: 'price', width: 150, title: '单价',edit:'price'}, {field: 'price', width: 150, title: '单价',edit:'price'},
{field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'}, {field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} {title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}

2
src/main/resources/templates/pages/application/form-step-look_minRecordOut.html

@ -56,7 +56,7 @@
</tr> </tr>
<tr> <tr>
<td>库位编码</td> <td>库位编码</td>
<td id="placeCode" th:text="${recordMinP.getPlaceCode()}">外芯仓库</td> <td id="placeCode" th:text="${recordMinP.getPlaceCode() =='0000'?'默认库位':recordMinP.getPlaceCode()}">外芯仓库</td>
</tr> </tr>
<tr> <tr>
<td>出库人员</td> <td>出库人员</td>

2
src/main/resources/templates/pages/group/applicationOutForGroup.html

@ -732,7 +732,7 @@
var flag = res.data; var flag = res.data;
if (!flag) { // 如果当前数目不合适 if (!flag) { // 如果当前数目不合适
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { layer.msg("当前组合中"+res.statusInfo.message+"的库存数量不足", {icon: 0, time: 500}, function () {
$("#quantityForGroup" + id).val(""); $("#quantityForGroup" + id).val("");
}); });

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

@ -60,7 +60,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">
<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="生成"/>
<div id="codeItem" style="display:none;"> <div id="codeItem" style="display:none;">
<img id="qrCode" > <img id="qrCode" >
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button> <button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
@ -171,7 +171,7 @@
skin: 'layui-layer-rim', skin: 'layui-layer-rim',
maxmin: true, maxmin: true,
shadeClose: true, //点击遮罩关闭层 shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'], area: ['80%', '80%'],
move: '.layui-layer-title', move: '.layui-layer-title',
fixed: false, fixed: false,
content: '/printCode?mid='+$("#placeId").val()+'&flag=3', content: '/printCode?mid='+$("#placeId").val()+'&flag=3',

93
src/main/resources/templates/pages/split/split-out.html

@ -127,7 +127,7 @@
{field: 'shelfLife', width: 150, title: '保质期'}, {field: 'shelfLife', width: 150, title: '保质期'},
{field: 'productionPlace', width: 150, title: '产地'}, {field: 'productionPlace', width: 150, title: '产地'},
{field: 'remark', width: 150, title: '备注'}, {field: 'remark', width: 150, title: '备注'},
{field: 'sstate', title: '状态', minWidth: 80, templet: '#switchTpl'}, {field: 'sstate', title: '状态', minWidth: 100, templet: '#switchTpl'},
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"} {title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}
] ]
], ],
@ -333,7 +333,8 @@
req.id = data.id; req.id = data.id;
layer.confirm('该操作会造成不可逆后果,是否继续?', { layer.confirm('该操作会造成不可逆后果,是否继续?', {
btn: ['继续', '取消'] //按钮 btn: ['继续', '取消'] //按钮
}, function () { },
function () {
$.ajax({ $.ajax({
url: '/split/realDeleteSplit', url: '/split/realDeleteSplit',
dataType: 'json', dataType: 'json',
@ -368,9 +369,8 @@
url: '/split/split_out', url: '/split/split_out',
page: { page: {
curr: 1 curr: 1
}, }
where: {"parentId": parentId} },'data');
});
}); });
} }
}); });
@ -378,10 +378,43 @@
//监听状态操作 //监听状态操作
form.on('switch(changeState)', function (obj) { form.on('switch(changeState)', function (obj) {
var req = new Map; var req = new Map;
req["id"] = this.value;
if (obj.elem.checked) { if (obj.elem.checked) {
req["state"] = 1 req["state"] = 1;
$.ajax({
url: "/split/split_edit",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("修改成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function () {
window.location = '/split_out'
})
} }
req["id"] = this.value; }
})
}else{
$.ajax({
url: "/split/findAllSplitInfoForbidden",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
success: function (data) {
data = data.data;
if(data){
$.ajax({ $.ajax({
url: "/split/split_edit", url: "/split/split_edit",
type: 'post', type: 'post',
@ -406,6 +439,52 @@
} }
} }
}) })
}else{
layer.confirm('该拆单正在使用中,是否禁用?', {
btn: ['继续', '取消'] //按钮
}, function () {
$.ajax({
url: "/split/split_edit",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("修改成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function () {
window.location = '/split_out'
})
}
}
})
}, function () {
// 执行重加载
table.reload('currentTableId', {
url: '/split/split_out',
page: {
curr: 1
}
},'data');
});
}
}
})
}
}); });
}); });
</script> </script>

7
src/main/resources/templates/pages/stockTaking/stockTaking.html

@ -1193,7 +1193,7 @@
parent.wx.scanQRCode({ parent.wx.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) { success: function (res) {
// 回调 // 回调
var result = res.resultStr;//当needResult为1时返回处理结果 var result = res.resultStr;//当needResult为1时返回处理结果
@ -1260,6 +1260,7 @@
// 获取物料与条形码的对应关系 // 获取物料与条形码的对应关系
var materialAndBarCodeList = data["materialAndBarCodeList"]; var materialAndBarCodeList = data["materialAndBarCodeList"];
var idNumber = materialId.name.split("mid")[1]; var idNumber = materialId.name.split("mid")[1];
$("#barCode" + idNumber).empty();
if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) {
var barCodeInput = barCodeItem.childNodes[1].childNodes[1]; var barCodeInput = barCodeItem.childNodes[1].childNodes[1];
var barCodeImg = barCodeItem.childNodes[1].childNodes[3]; var barCodeImg = barCodeItem.childNodes[1].childNodes[3];
@ -1315,7 +1316,7 @@
parent.wx.scanQRCode({ parent.wx.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) { success: function (res) {
// 回调 // 回调
var result = res.resultStr;//当needResult为1时返回处理结果 var result = res.resultStr;//当needResult为1时返回处理结果
@ -1377,6 +1378,7 @@
textureChildren.childNodes[3].childNodes[1].value = material.texture === null || material.texture === undefined ? '' : material.texture; textureChildren.childNodes[3].childNodes[1].value = material.texture === null || material.texture === undefined ? '' : material.texture;
versionChildren.childNodes[3].childNodes[1].value = material.version === null || material.version === undefined ? '' : material.version; versionChildren.childNodes[3].childNodes[1].value = material.version === null || material.version === undefined ? '' : material.version;
inventoryChildren.childNodes[3].childNodes[1].value = material.quantity; inventoryChildren.childNodes[3].childNodes[1].value = material.quantity;
$("#barCode" + id).empty();
$("#barCode" + id).append(new Option(result, 0));//往下拉菜单里添加元素 $("#barCode" + id).append(new Option(result, 0));//往下拉菜单里添加元素
var shelfLife = material.shelfLife; var shelfLife = material.shelfLife;
if (shelfLife !== null && shelfLife !== undefined) { if (shelfLife !== null && shelfLife !== undefined) {
@ -1445,7 +1447,6 @@
}) })
} }
}); });
} else { } else {
layer.msg("请先选择盘点位置或负责人", { layer.msg("请先选择盘点位置或负责人", {
icon: 0, icon: 0,

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

@ -89,7 +89,7 @@
<img id="qrCode" > <img id="qrCode" >
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button> <button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
</div> </div>
<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="生成"/>
</div> </div>
</div> </div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
@ -122,7 +122,7 @@
dataType:'json', dataType:'json',
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success:function(d){ success:function(d){
if(data.value != "") { if(data.value !== "") {
$('#adminorg').empty(); $('#adminorg').empty();
$('#adminorg').append(new Option("请选择部门", "")); $('#adminorg').append(new Option("请选择部门", ""));
$.each(d.data, function (index, item) { $.each(d.data, function (index, item) {

2
target/classes/com/dreamchaser/depository_manage/mapper/SplitUnitMapper.xml

@ -86,7 +86,7 @@
select select
<include refid="splitInfoAllColumns"/> <include refid="splitInfoAllColumns"/>
from `split` s from `split` s
where s.mid = #{mid} where s.mid = #{mid} and s.state = 1
</select> </select>

248
target/classes/static/js/JcPrinter/index_Demo.js

@ -70,8 +70,10 @@ var app = new Vue({
formLabelWidth: "120px", formLabelWidth: "120px",
options: [], options: [],
tags: [], tags: [],
isBarCode:false,
isInit: false, isInit: false,
versionInit: false, versionInit: false,
isVersion:false,
isInitApi: false, isInitApi: false,
isDraw: false, isDraw: false,
isEditTag: false, isEditTag: false,
@ -118,7 +120,7 @@ var app = new Vue({
// 初始化型号 // 初始化型号
DrawLableVersionTextParam: { DrawLableVersionTextParam: {
"x": 10.0, "x": 10.0,
"y": 10.0, "y": 8.0,
"height": 10, "height": 10,
"width": 50, "width": 50,
"value": document.getElementById("version").value, "value": document.getElementById("version").value,
@ -208,60 +210,8 @@ var app = new Vue({
// 初始化打印服务 // 初始化打印服务
let instance = getInstance(); let instance = getInstance();
if (!instance) { if (!instance) {
this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
}
else{
getAllPrinters((data) => {
// 返回值规范化
let arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
this.$alert('打印机获取失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
// 如果成功获取
// 当前的所有打印设备
allPrinters = JSON.parse(arrParse.resultAck.info);
// 所有名称
let allPrintersName = Object.keys(allPrinters);
// 所有对应值
let allPrintersValue = Object.values(allPrinters);
// 用于存储当前下拉框列表
this.options = [];
// 将其保存到数据中供前端展示
for (i = 0; i < allPrintersName.length; i++) {
// 设置新对象
let newopt = {};
// 设置标题
newopt.label = allPrintersName[i];
// 设置值
newopt.value = allPrintersValue[i];
// 添加对象
this.options.push(newopt)
}
// 选中打印机(默认选中第一个)
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => {
// 设置sdk状态为true
initSdkStatus = true;
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
// 如果失败 // 如果失败
this.$alert('打印设备连接失败,请重试', '提示', { this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
// 关闭当前页 // 关闭当前页
@ -269,13 +219,6 @@ var app = new Vue({
parent.layer.close(index); parent.layer.close(index);
} }
}); });
} else if (isJSON(arrParse.resultAck.info)) {
//选择成功,打印机连接成功
console.log(data)
}
}))
}
})
} }
}, },
methods: { methods: {
@ -314,7 +257,16 @@ var app = new Vue({
getAllPrinters(data => { getAllPrinters(data => {
// 返回结果规范化 // 返回结果规范化
let arrParse = JSON.parse(JSON.stringify(data)); let arrParse = JSON.parse(JSON.stringify(data));
if (isJSON(arrParse.resultAck.info)) { if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') {
this.$alert('打印机获取失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
// 获取所有打印设备 // 获取所有打印设备
allPrinters = JSON.parse(arrParse.resultAck.info); allPrinters = JSON.parse(arrParse.resultAck.info);
// 所有设备名称 // 所有设备名称
@ -337,7 +289,7 @@ var app = new Vue({
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => { selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => {
// 返回结果规范化 // 返回结果规范化
var arrParse = JSON.parse(JSON.stringify(data)); var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) { if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') {
this.$alert('打印设备选择失败,请重试', '提示', { this.$alert('打印设备选择失败,请重试', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
callback: action => { callback: action => {
@ -432,7 +384,7 @@ var app = new Vue({
} else { } else {
// 展示生成按钮 // 展示生成按钮
this.isInit = true; this.isInit = true;
let version = $("#version").val() let version = $("#version").val();
if ("noMaterial" !== version) { if ("noMaterial" !== version) {
this.versionInit = true; this.versionInit = true;
} }
@ -496,6 +448,7 @@ var app = new Vue({
this.tags.push(this.DrawLableVersionTextParam) this.tags.push(this.DrawLableVersionTextParam)
} }
this.dialogDrawLableVersionTextParam = false; this.dialogDrawLableVersionTextParam = false;
this.isVersion = true;
this.isDraw = true this.isDraw = true
}, },
// 一维码 // 一维码
@ -504,42 +457,17 @@ var app = new Vue({
this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height); this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height);
this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x); this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x);
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y); this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y);
if(this.versionInit){ this.DrawLableBarCodeParam.textHeight = Number(this.DrawLableBarCodeParam.textHeight);
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + 10; if (this.isVersion) {
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
} }
this.DrawLableBarCodeParam.name = "条形码"; this.DrawLableBarCodeParam.name = "条形码";
// 发送请求将其变成条形码
let req = {};
req.qrCode = this.DrawLableBarCodeParam.value;
req.mcode = $("#materialCode").val();
req.type = "qTb";
$.ajax({
url: "/material/updateQrCodeType",
type: "post",
dataType: "json",
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: result => {
DrawLableBarCode(this.DrawLableBarCodeParam, res => {
var arrParse = JSON.parse(JSON.stringify(res));
//⼀维码绘制失败,退出绘制
if (arrParse.resultAck.result !== 0) {
this.$message({ // 发起提示
message: '绘制失败,请重试',
type: 'warning'
});
}
});
}
});
if (this.isEditTag) { if (this.isEditTag) {
this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam); this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam);
} else { } else {
this.tags.push(this.DrawLableBarCodeParam) this.tags.push(this.DrawLableBarCodeParam)
} }
this.isBarCode = true;
this.dialogDrawLableBarCodeParam = false; this.dialogDrawLableBarCodeParam = false;
this.isDraw = true this.isDraw = true
}, },
@ -551,39 +479,17 @@ var app = new Vue({
this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x); this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x);
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y); this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y);
this.DrawLableQrCodeParam.name = "二维码"; this.DrawLableQrCodeParam.name = "二维码";
let req = {}; if (this.isVersion) {
req.qrCode = this.DrawLableQrCodeParam.value; this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
req.mcode = $("#materialCode").val();
req.type = "bTq";
$.ajax({
url: "/material/updateQrCodeType",
type: "post",
dataType: "json",
data: JSON.stringify(req),
contentType: "application/json;charset=utf-8",
success: result => {
DrawLableQrCode(this.DrawLableQrCodeParam, res => {
var arrParse = JSON.parse(JSON.stringify(res));
//⼀维码绘制失败,退出绘制
if (arrParse.resultAck.result !== 0) {
this.$message({ // 发起提示
message: '绘制失败,请重试',
type: 'warning'
});
}
});
} }
});
if (this.isEditTag) { if (this.isEditTag) {
this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam); this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam);
} else { } else {
this.tags.push(this.DrawLableQrCodeParam) this.tags.push(this.DrawLableQrCodeParam)
} }
this.dialogDrawLableQrCodeParam = false; this.dialogDrawLableQrCodeParam = false;
this.isDraw = true this.isDraw = true;
this.isBarCode = false;
}, },
DragList(List) { DragList(List) {
List.forEach(res => { List.forEach(res => {
@ -704,20 +610,19 @@ var app = new Vue({
}); });
return; return;
} }
// 为了防止打印时未生成对应图像事先初始化 // 为了防止打印时未生成对应图像事先初始化
// 初始化画板 // 初始化画板
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
if (this.isBarCode) {
if (this.dialogDrawLableBarCodeParam) {
// 如果打印条形码 // 如果打印条形码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){ if (this.isVersion) {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{ InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => { this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -736,8 +641,14 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}) }))
}))
}))
} else { } else {
// 不打印型号
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => { this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -756,14 +667,17 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}))
}))
} }
}
}) else {
} else {
// 如果打印二维码 // 如果打印二维码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){ if (this.isVersion) {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{ InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => { this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -782,9 +696,14 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}) }))
}else{ }))
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => { }))
}
else {
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableQrCodeApiDemo(this.DrawLableQrCodeParam, (data => {
// 提交数据 // 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount); var totalCount = parseInt(pageCount) * parseInt(quantityCount);
startJob(parseInt(density), parseInt(paperType), parseInt(printMode), totalCount, function (data) { startJob(parseInt(density), parseInt(paperType), parseInt(printMode), totalCount, function (data) {
@ -802,13 +721,12 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
}); });
})) }))
}))
}))
} }
})
} }
}))
}, },
/** /**
@ -857,52 +775,68 @@ var app = new Vue({
pageIndex++; pageIndex++;
setTimeout(function () { setTimeout(function () {
// 初始化画板 // 初始化画板
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
if (this.dialogDrawLableBarCodeParam) {
// 添加名称 if (this.isBarCode) {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{ // 如果绘制条形码
if(self.versionInit){
if (self.isVersion) {
// 如果绘制型号 // 如果绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
// 添加型号 // 添加型号
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam,(data)=>{ self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam, (data => {
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => { self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}) }))
}))
}))
} else { } else {
// 如果不绘制型号 // 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => { self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}))
}))
} }
}) }
else {
// 如果绘制二维码
} else {
// 添加名称
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{
// 如果绘制型号 // 如果绘制型号
if(self.versionInit){ if (self.isVersion) {
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
// 添加型号 // 添加型号
self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam,(data)=>{ self.DrawLableTextVersionNameApiDemo(self.DrawLableVersionTextParam, (data => {
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => { self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}) }))
}else{ }))
}))
}
else {
// 如果不绘制型号 // 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => { self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount); self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
})) }))
}))
}))
} }
})
} }
// 提交数据
}))// 提交数据
}, 500); }, 500);
} }
}); });

122
target/classes/static/js/JcPrinter/jcPrinterSdk_api_third.js

@ -17,8 +17,10 @@ var MessageList = {};
function sendMsg(msg, callback) { function sendMsg(msg, callback) {
// console.log('sendMsg', msg.apiName); // console.log('sendMsg', msg.apiName);
MessageList[msg.apiName] = callback; MessageList[msg.apiName] = callback;
var data = JSON.stringify(msg); var data = JSON.stringify(msg);
var tryTimes = 10; var tryTimes = 10;
for (var i = 0; i < tryTimes; i++) { for (var i = 0; i < tryTimes; i++) {
if (g_websocket.readyState === 1) { if (g_websocket.readyState === 1) {
g_websocket.send(data); g_websocket.send(data);
@ -33,23 +35,15 @@ function getInstance() {
if ('WebSocket' in window) { if ('WebSocket' in window) {
g_websocket = websocketLifePeriod(); g_websocket = websocketLifePeriod();
} else { } else {
this.$alert('不支持websocket,请重试', '提示', { console.log('unsupported websocket');
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
//return false; //return false;
g_websocket = null; g_websocket = null;
return false; return false;
} }
});
}
//保持在线(开启定时任务,每3秒执行一次) //保持在线
setInterval(function () { setInterval(function () {
if (g_websocket.readyState === 2 || g_websocket.readyState === 3) { if (g_websocket.readyState === 2 || g_websocket.readyState === 3) {
// 如果等待或者断开
getInstance(); getInstance();
} }
}, 3000); }, 3000);
@ -60,10 +54,9 @@ function getInstance() {
//1.1.1 打开链接及回调 //1.1.1 打开链接及回调
function websocketLifePeriod() { function websocketLifePeriod() {
let websocket; var websocket;
// 37989端口为jcPrinter.exe使用的端口
websocket = new WebSocket('ws://127.0.0.1:37989'); websocket = new WebSocket('ws://127.0.0.1:37989');
websocket.binaryType = 'arraybuffer'; //websocket.binaryType = 'arraybuffer';
websocket.onerror = function (evt) {//since there is an error, sockets will close so... websocket.onerror = function (evt) {//since there is an error, sockets will close so...
sok.onclose = function (e) { sok.onclose = function (e) {
console.log("WebSocket Error: ", e); console.log("WebSocket Error: ", e);
@ -89,10 +82,8 @@ function websocketLifePeriod() {
//1.1.2 websocket连接回调 //1.1.2 websocket连接回调
function connectCallback(e) { function connectCallback(e) {
ackJsonData = ''; ackJsonData = '';
console.log('websocket connect success'); console.log('success');
// 设置连接状态为true
websocketConnectStatus=true; websocketConnectStatus=true;
// 初始化
init(); init();
} }
@ -126,7 +117,6 @@ function readCallback(e) {
//接口回调 //接口回调
if (!!MessageList[arrParse.apiName]) { if (!!MessageList[arrParse.apiName]) {
MessageList[arrParse.apiName](arrParse); MessageList[arrParse.apiName](arrParse);
} }
@ -138,31 +128,32 @@ function readCallback(e) {
deviceStatus=false; deviceStatus=false;
} }
}else{ }else{
if (arrParse['resultAck']['callback'] !== undefined) { if (arrParse['resultAck']['callback'] != undefined) {
callbackName = arrParse['resultAck']['callback']['name']; callbackName = arrParse['resultAck']['callback']['name'];
if (callbackName === 'onConnectSuccess') { if (callbackName == 'onConnectSuccess') {
var printerName = arrParse['resultAck']['callback']['printerName']; var printerName = arrParse['resultAck']['callback']['printerName'];
onConnectSuccess(printerName); onConnectSuccess(printerName);
} else if (callbackName === 'onDisConnect') { } else if (callbackName == 'onDisConnect') {
var printerName = arrParse['resultAck']['callback']['printerName']; var printerName = arrParse['resultAck']['callback']['printerName'];
onDisConnect(printerName); onDisConnect(printerName);
} else if (callbackName === 'onCoverStatusChange') { } else if (callbackName == 'onCoverStatusChange') {
var coverStatus = arrParse['resultAck']['callback']['coverStatus']; var coverStatus = arrParse['resultAck']['callback']['coverStatus'];
onCoverStatusChange(coverStatus); onCoverStatusChange(coverStatus);
} else if (callbackName === 'onElectricityChange') { } else if (callbackName == 'onElectricityChange') {
var powerLever = arrParse['resultAck']['callback']['powerLever']; var powerLever = arrParse['resultAck']['callback']['powerLever'];
onElectricityChange(powerLever); onElectricityChange(powerLever);
} else if (callbackName === 'onPaperStatusChange') { } else if (callbackName == 'onPaperStatusChange') {
var paperStatus = arrParse['resultAck']['callback']['paperStatus']; var paperStatus = arrParse['resultAck']['callback']['paperStatus'];
onPaperStatusChange(paperStatus); onPaperStatusChange(paperStatus);
} else if (callbackName === 'onPrintPageCompleted') { } else if (callbackName == 'onPrintPageCompleted') {
onPrintPageCompleted(); onPrintPageCompleted();
} else if (callbackName === 'onPrintProgress') { } else if (callbackName == 'onPrintProgress') {
onPrintProgress(); onPrintProgress();
} else if (callbackName === 'onAbnormalResponse') { } else if (callbackName == 'onAbnormalResponse') {
onAbnormalResponse(); onAbnormalResponse();
} else { }
else {
console.log('unknow callback api!'); console.log('unknow callback api!');
} }
} }
@ -171,7 +162,6 @@ function readCallback(e) {
ackJsonData = ''; ackJsonData = '';
} }
} }
//1.1.5 错误回调 //1.1.5 错误回调
function errorCallback(e) { function errorCallback(e) {
//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件 //如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
@ -180,77 +170,24 @@ function errorCallback(e) {
//封装初始化SDK/获取打印机列表/选择打印机 //封装初始化SDK/获取打印机列表/选择打印机
function init() { function init() {
// 初始化sdk
initSdk(this.initSdkParam, function (data) { initSdk(this.initSdkParam, function (data) {
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data)); var arrParse = JSON.parse(JSON.stringify(data));
if (arrParse.resultAck.result !== 0) { if (arrParse.resultAck.result != 0) {
// 如果初始化失败
this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
return; return;
} }
// 获取所有打印设备
getAllPrinters((data) => { getAllPrinters(function (data) {
// 返回值规范化 var arrParse = JSON.parse(JSON.stringify(data));
let arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result ) { if (!arrParse.resultAck.result ) {
this.$alert('打印机获取失败,请重试', '提示', { return;
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) { } else if (isJSON(arrParse.resultAck.info)) {
// 如果成功获取 allPrinters = JSON.parse(arrParse.resultAck.info)
// 当前的所有打印设备
allPrinters = JSON.parse(arrParse.resultAck.info);
// 所有名称
let allPrintersName = Object.keys(allPrinters); let allPrintersName = Object.keys(allPrinters);
// 所有对应值
let allPrintersValue = Object.values(allPrinters); let allPrintersValue = Object.values(allPrinters);
// 用于存储当前下拉框列表
this.options = [];
// 将其保存到数据中供前端展示
for (i = 0; i < allPrintersName.length; i++) {
// 设置新对象
let newopt = {};
// 设置标题
newopt.label = allPrintersName[i];
// 设置值
newopt.value = allPrintersValue[i];
// 添加对象
this.options.push(newopt)
}
// 选中打印机(默认选中第一个)
selectPrinter(allPrintersName[0],parseInt(allPrintersValue[0]),(data=>{ selectPrinter(allPrintersName[0],parseInt(allPrintersValue[0]),(data=>{
// 设置sdk状态为true
initSdkStatus=true; initSdkStatus=true;
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
// 如果失败
this.$alert('打印设备连接失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
//选择成功,打印机连接成功
console.log(data)
}
})) }))
} }
}) })
@ -569,9 +506,9 @@ function InitDrawingBoard(json, callbackFunction) {
apiName: 'InitDrawingBoard', apiName: 'InitDrawingBoard',
parameter: json parameter: json
}; };
console.log("画布宽度:" + json.width); // console.log("宽度:" + json.width)
console.log("画布高度:" + json.height); // console.log("高度:" + json.height)
console.log("画布旋转角度:" + json.rotate); // console.log("旋转角度:" + json.rotate)
sendMsg(jsonObj, callbackFunction); sendMsg(jsonObj, callbackFunction);
} }
@ -651,6 +588,7 @@ function initSdk(json, callbackFunction) {
apiName: 'initSdk', apiName: 'initSdk',
parameter: json parameter: json
}; };
sendMsg(jsonObj, callbackFunction); sendMsg(jsonObj, callbackFunction);
} }

15
target/classes/templates/pages/JcPrinter/PrinterIndex.html

@ -12,12 +12,12 @@
<input style="display:none;" id="materialCode" th:value="${mcode}"> <input style="display:none;" id="materialCode" th:value="${mcode}">
<input style="display:none;" id="name" th:value="${name}"> <input style="display:none;" id="name" th:value="${name}">
<input style="display:none;" id="version" th:value="${version}"> <input style="display:none;" id="version" th:value="${version}">
<div class="title"> <!-- <div class="title">-->
<H2>刷新</H2> <!-- <H2>刷新</H2>-->
<div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div> <!-- <div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div>-->
</div> <!-- </div>
<br>
<br> <br>
<br>-->
<div class="link"> <div class="link">
<H2>打印设备</H2> <H2>打印设备</H2>
<el-row> <el-row>
@ -31,7 +31,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="12"><el-button @click="refreshPrinters()" type="primary">重新获取</el-button></el-col> <el-col :span="12"><el-button @click="refreshPrinters()" type="primary">获取打印设备</el-button></el-col>
</el-row> </el-row>
</div> </div>
<br> <br>
@ -164,6 +164,9 @@
<el-option label="旋转270度" :value="270"></el-option> <el-option label="旋转270度" :value="270"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="文本高度" :label-width="formLabelWidth">
<el-input type="number" v-model="DrawLableBarCodeParam.textHeight" ></el-input>
</el-form-item>
<el-form-item label="文本位置" :label-width="formLabelWidth"> <el-form-item label="文本位置" :label-width="formLabelWidth">
<el-select v-model="DrawLableBarCodeParam.textPosition" placeholder="请选择文本位置"> <el-select v-model="DrawLableBarCodeParam.textPosition" placeholder="请选择文本位置">
<el-option label="下方显示" :value="0"></el-option> <el-option label="下方显示" :value="0"></el-option>

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

@ -961,7 +961,7 @@
var req = {}; var req = {};
req.qrCode = result; req.qrCode = result;
req.codeFlag = 2; req.codeFlag = 2;
$("#qrCode" + objIdNumber).val(result); $("#qrCode" + obj.id.split("qrCodeImg")[1]).val(result);
$.ajax({ $.ajax({
url: "/material/qywxApplicationInScanQrCode", url: "/material/qywxApplicationInScanQrCode",
type: "post", type: "post",
@ -1051,6 +1051,7 @@
}) })
} }
}) })
}; };
@ -1198,7 +1199,7 @@
parent.wx.scanQRCode({ parent.wx.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) { success: function (res) {
// 回调 // 回调
var result = res.resultStr;//当needResult为1时返回处理结果 var result = res.resultStr;//当needResult为1时返回处理结果

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

@ -1325,7 +1325,7 @@
parent.wx.scanQRCode({ parent.wx.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success: function (res) { success: function (res) {
// 回调 // 回调
var result = res.resultStr;//当needResult为1时返回处理结果 var result = res.resultStr;//当needResult为1时返回处理结果
@ -1467,7 +1467,7 @@
var flag = res.data; var flag = res.data;
if (!flag) { // 如果当前数目不合适 if (!flag) { // 如果当前数目不合适
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { layer.msg("当前组合中"+res.statusInfo.message+"的库存数量不足", {icon: 0, time: 1000}, function () {
$("#quantityForGroup" + id).val(""); $("#quantityForGroup" + id).val("");
}); });

42
target/classes/templates/pages/application/application-out_back.html

@ -69,12 +69,6 @@
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" 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">
@ -155,20 +149,6 @@
step = layui.step; step = layui.step;
var temp = {}; var temp = {};
temp.mid = $("#mid").val(); temp.mid = $("#mid").val();
$.ajax({
url: "/place/findPlaceByMid",
type: "post",
dataType: 'json',
data: JSON.stringify(temp),
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();
}
});
$("#code").blur(function () { $("#code").blur(function () {
@ -190,20 +170,9 @@
$("#mid").val(""); $("#mid").val("");
} else { } else {
req.mid = d.id; req.mid = d.id;
let unitItem = $("#unit");
$.ajax({ unitItem.empty();
url: "/place/findPlaceByMid", unitItem.append(new Option(d.unit, "-1"));
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));//往下拉菜单里添加元素
});
$("#unit").empty();
$("#unit").append(new Option(d.unit, "-1"));
$.each(d.splitInfoList, function (index, item) { $.each(d.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit)); $("#unit").append(new Option(item.newUnit, item.newUnit));
}); });
@ -211,11 +180,8 @@
$("#mid").val(d.id); $("#mid").val(d.id);
form.render(); form.render();
} }
});
}
} }
}); })
}); });
$("#mname").blur(function () { $("#mname").blur(function () {

2
target/classes/templates/pages/application/application_multi.html

@ -93,8 +93,8 @@
{field: 'code',width: 200,title: '存货编码',sort: true}, {field: 'code',width: 200,title: '存货编码',sort: true},
{title: '所处位置', width: 200, templet: '#selectLocation', align: "center"}, {title: '所处位置', width: 200, templet: '#selectLocation', align: "center"},
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{title: '计量单位', width: 200, templet: '#changeUnit', align: "center"}, {title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{field: 'price', width: 150, title: '单价',edit:'price'}, {field: 'price', width: 150, title: '单价',edit:'price'},
{field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'}, {field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'},
{title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"} {title: '操作', minWidth: 250, toolbar: '#currentTableBar', align: "center"}

2
target/classes/templates/pages/application/form-step-look_minRecordOut.html

@ -56,7 +56,7 @@
</tr> </tr>
<tr> <tr>
<td>库位编码</td> <td>库位编码</td>
<td id="placeCode" th:text="${recordMinP.getPlaceCode()}">外芯仓库</td> <td id="placeCode" th:text="${recordMinP.getPlaceCode() =='0000'?'默认库位':recordMinP.getPlaceCode()}">外芯仓库</td>
</tr> </tr>
<tr> <tr>
<td>出库人员</td> <td>出库人员</td>

2
target/classes/templates/pages/group/applicationOutForGroup.html

@ -732,7 +732,7 @@
var flag = res.data; var flag = res.data;
if (!flag) { // 如果当前数目不合适 if (!flag) { // 如果当前数目不合适
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { layer.msg("当前组合中"+res.statusInfo.message+"的库存数量不足", {icon: 0, time: 500}, function () {
$("#quantityForGroup" + id).val(""); $("#quantityForGroup" + id).val("");
}); });

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

@ -60,7 +60,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">
<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="生成"/>
<div id="codeItem" style="display:none;"> <div id="codeItem" style="display:none;">
<img id="qrCode" > <img id="qrCode" >
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button> <button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
@ -171,7 +171,7 @@
skin: 'layui-layer-rim', skin: 'layui-layer-rim',
maxmin: true, maxmin: true,
shadeClose: true, //点击遮罩关闭层 shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'], area: ['80%', '80%'],
move: '.layui-layer-title', move: '.layui-layer-title',
fixed: false, fixed: false,
content: '/printCode?mid='+$("#placeId").val()+'&flag=3', content: '/printCode?mid='+$("#placeId").val()+'&flag=3',

93
target/classes/templates/pages/split/split-out.html

@ -127,7 +127,7 @@
{field: 'shelfLife', width: 150, title: '保质期'}, {field: 'shelfLife', width: 150, title: '保质期'},
{field: 'productionPlace', width: 150, title: '产地'}, {field: 'productionPlace', width: 150, title: '产地'},
{field: 'remark', width: 150, title: '备注'}, {field: 'remark', width: 150, title: '备注'},
{field: 'sstate', title: '状态', minWidth: 80, templet: '#switchTpl'}, {field: 'sstate', title: '状态', minWidth: 100, templet: '#switchTpl'},
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"} {title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}
] ]
], ],
@ -333,7 +333,8 @@
req.id = data.id; req.id = data.id;
layer.confirm('该操作会造成不可逆后果,是否继续?', { layer.confirm('该操作会造成不可逆后果,是否继续?', {
btn: ['继续', '取消'] //按钮 btn: ['继续', '取消'] //按钮
}, function () { },
function () {
$.ajax({ $.ajax({
url: '/split/realDeleteSplit', url: '/split/realDeleteSplit',
dataType: 'json', dataType: 'json',
@ -368,9 +369,8 @@
url: '/split/split_out', url: '/split/split_out',
page: { page: {
curr: 1 curr: 1
}, }
where: {"parentId": parentId} },'data');
});
}); });
} }
}); });
@ -378,10 +378,43 @@
//监听状态操作 //监听状态操作
form.on('switch(changeState)', function (obj) { form.on('switch(changeState)', function (obj) {
var req = new Map; var req = new Map;
req["id"] = this.value;
if (obj.elem.checked) { if (obj.elem.checked) {
req["state"] = 1 req["state"] = 1;
$.ajax({
url: "/split/split_edit",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("修改成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function () {
window.location = '/split_out'
})
} }
req["id"] = this.value; }
})
}else{
$.ajax({
url: "/split/findAllSplitInfoForbidden",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
success: function (data) {
data = data.data;
if(data){
$.ajax({ $.ajax({
url: "/split/split_edit", url: "/split/split_edit",
type: 'post', type: 'post',
@ -406,6 +439,52 @@
} }
} }
}) })
}else{
layer.confirm('该拆单正在使用中,是否禁用?', {
btn: ['继续', '取消'] //按钮
}, function () {
$.ajax({
url: "/split/split_edit",
type: 'post',
dataType: 'json',
contentType: "application/json;charset=utf-8",
data: JSON.stringify(req),
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (data) {
layer.close(this.layerIndex);
if (data.status >= 300) {
layer.msg(data.statusInfo.message);//失败的表情
} else {
layer.msg("修改成功", {
icon: 6,//成功的表情
time: 500 //1秒关闭(如果不配置,默认是3秒)
}, function () {
window.location = '/split_out'
})
}
}
})
}, function () {
// 执行重加载
table.reload('currentTableId', {
url: '/split/split_out',
page: {
curr: 1
}
},'data');
});
}
}
})
}
}); });
}); });
</script> </script>

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

@ -89,7 +89,7 @@
<img id="qrCode" > <img id="qrCode" >
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button> <button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
</div> </div>
<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="生成"/>
</div> </div>
</div> </div>
<div class="layui-form-item" style="display: none"> <div class="layui-form-item" style="display: none">
@ -122,7 +122,7 @@
dataType:'json', dataType:'json',
contentType: "application/json;charset=utf-8", contentType: "application/json;charset=utf-8",
success:function(d){ success:function(d){
if(data.value != "") { if(data.value !== "") {
$('#adminorg').empty(); $('#adminorg').empty();
$('#adminorg').append(new Option("请选择部门", "")); $('#adminorg').append(new Option("请选择部门", ""));
$.each(d.data, function (index, item) { $.each(d.data, function (index, item) {

Loading…
Cancel
Save