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);
// 用于标志该数量是否合法
boolean flag = true;
// 用于存储不符合数量的物料名称
String mname = "";
for (GroupInfo groupInfo : groupInfoByGid) {
// 获取具体信息
@ -656,8 +658,9 @@ public class GroupController {
// 如果概述了不合法
flag = false;
}
mname = groupInfo.getMname();
}
return new RestResponse(flag);
return new RestResponse(flag,200,new StatusInfo(mname,mname));
} else {
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){
// 获取转换类型
String type = (String) map.get("type");
String mcode = (String) map.get("mcode");
int result = 0;
if(!"noMaterial".equals(mcode)){
if("qTb".equals(type)){
// 如果是二维码转条形码
result = materialService.qrCodeToBarCode(map);
@ -1842,6 +1844,8 @@ public class MaterialController {
// 如果是条形码转二维码
result = materialService.barCodeToQrCode(map);
}
}
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) {
// 如果是物料
// 获取当前对应物料
// 获取当前对应物料
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 request
* @return
@ -47,6 +48,7 @@ public class SplitController {
/**
* 用于根据条件查询拆单记录
*
* @param map 待查询条件
* @param request
* @return
@ -59,6 +61,7 @@ public class SplitController {
/**
* 根据条件删除对应的拆单记录
*
* @param map 待删除数据
* @return
*/
@ -100,6 +103,7 @@ public class SplitController {
/**
* 根据条件修改拆单信息
*
* @param map 待修改数据
* @return
*/
@ -135,4 +139,46 @@ public class SplitController {
}
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
<include refid="splitInfoAllColumns"/>
from `split` s
where s.mid = #{mid}
where s.mid = #{mid} and s.state = 1
</select>

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

@ -148,4 +148,12 @@ public interface SplitUnitService {
* @return
*/
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("codeFlag", 1);
List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(map);
MaterialAndBarCode materialAndBarCode = null;
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
public MaterialAndBarCode findMaterialByBarCodeByBarCodeAndDepositoryId(Map<String, Object> map) {
List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(map);
MaterialAndBarCode materialAndBarCode = null;
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) {
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid());
if (inventoryByMid != null) {
@ -1014,9 +1026,8 @@ public class MaterialServiceImpl implements MaterialService {
} else {
materialAndBarCode.setPrice(0.0);
}
return materialAndBarCode;
}
return null;
return materialAndBarCode;
}
/**
@ -1074,7 +1085,16 @@ public class MaterialServiceImpl implements MaterialService {
*/
@Override
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());
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo);
}
else{
} else {
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100));
paramForNewMap.put("realQuantity", String.valueOf(dispose));
paramForNewMap.put("quantity", String.valueOf(dispose));
@ -1476,8 +1495,7 @@ public class MaterialServiceImpl implements MaterialService {
// 修改库存数量
splitUnitMapper.updateSplitInventory(splitInventoryForAfter);
}
}
else{
} else {
// 如果不存在转移后的拆单库存记录
// 定义用于添加拆单库存记录
@ -1515,8 +1533,7 @@ public class MaterialServiceImpl implements MaterialService {
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 具体转换数据
* @return
*/
@ -2471,6 +2487,7 @@ public class MaterialServiceImpl implements MaterialService {
/**
* 用于将当前条形码转为二维码
*
* @param map 具体转换数据
* @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);
}
/**
* 用于查找当前拆单是否正在使用
* @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
* @return

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

@ -70,8 +70,10 @@ var app = new Vue({
formLabelWidth: "120px",
options: [],
tags: [],
isBarCode:false,
isInit: false,
versionInit: false,
isVersion:false,
isInitApi: false,
isDraw: false,
isEditTag: false,
@ -118,7 +120,7 @@ var app = new Vue({
// 初始化型号
DrawLableVersionTextParam: {
"x": 10.0,
"y": 10.0,
"y": 8.0,
"height": 10,
"width": 50,
"value": document.getElementById("version").value,
@ -208,60 +210,8 @@ var app = new Vue({
// 初始化打印服务
let instance = getInstance();
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: '确定',
callback: action => {
// 关闭当前页
@ -269,13 +219,6 @@ var app = new Vue({
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
//选择成功,打印机连接成功
console.log(data)
}
}))
}
})
}
},
methods: {
@ -314,7 +257,16 @@ var app = new Vue({
getAllPrinters(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);
// 所有设备名称
@ -337,7 +289,7 @@ var app = new Vue({
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => {
// 返回结果规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') {
this.$alert('打印设备选择失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
@ -432,7 +384,7 @@ var app = new Vue({
} else {
// 展示生成按钮
this.isInit = true;
let version = $("#version").val()
let version = $("#version").val();
if ("noMaterial" !== version) {
this.versionInit = true;
}
@ -496,6 +448,7 @@ var app = new Vue({
this.tags.push(this.DrawLableVersionTextParam)
}
this.dialogDrawLableVersionTextParam = false;
this.isVersion = true;
this.isDraw = true
},
// 一维码
@ -504,42 +457,17 @@ var app = new Vue({
this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height);
this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x);
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y);
if(this.versionInit){
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + 10;
this.DrawLableBarCodeParam.textHeight = Number(this.DrawLableBarCodeParam.textHeight);
if (this.isVersion) {
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
}
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) {
this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam);
} else {
this.tags.push(this.DrawLableBarCodeParam)
}
this.isBarCode = true;
this.dialogDrawLableBarCodeParam = false;
this.isDraw = true
},
@ -551,39 +479,17 @@ var app = new Vue({
this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x);
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y);
this.DrawLableQrCodeParam.name = "二维码";
let req = {};
req.qrCode = this.DrawLableQrCodeParam.value;
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.isVersion) {
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
}
});
if (this.isEditTag) {
this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam);
} else {
this.tags.push(this.DrawLableQrCodeParam)
}
this.dialogDrawLableQrCodeParam = false;
this.isDraw = true
this.isDraw = true;
this.isBarCode = false;
},
DragList(List) {
List.forEach(res => {
@ -704,20 +610,19 @@ var app = new Vue({
});
return;
}
// 为了防止打印时未生成对应图像事先初始化
// 初始化画板
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
if (this.dialogDrawLableBarCodeParam) {
if (this.isBarCode) {
// 如果打印条形码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{
if (this.isVersion) {
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -736,8 +641,14 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
});
}))
})
}))
}))
}))
} else {
// 不打印型号
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -756,14 +667,17 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
});
}))
}))
}))
}
})
} else {
}
else {
// 如果打印二维码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{
if (this.isVersion) {
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -782,9 +696,14 @@ var app = new Vue({
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);
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);
});
}))
}))
}))
}
})
}
}))
},
/**
@ -857,52 +775,68 @@ var app = new Vue({
pageIndex++;
setTimeout(function () {
// 初始化画板
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
if (this.dialogDrawLableBarCodeParam) {
// 添加名称
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{
if(self.versionInit){
if (this.isBarCode) {
// 如果绘制条形码
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.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
}))
})
}))
}))
}))
} else {
// 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => {
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.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
}))
})
}else{
}))
}))
}))
}
else {
// 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
}))
}))
}))
}
})
}
}))// 提交数据
// 提交数据
}, 500);
}
});

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

@ -17,8 +17,10 @@ var MessageList = {};
function sendMsg(msg, callback) {
// console.log('sendMsg', msg.apiName);
MessageList[msg.apiName] = callback;
var data = JSON.stringify(msg);
var tryTimes = 10;
for (var i = 0; i < tryTimes; i++) {
if (g_websocket.readyState === 1) {
g_websocket.send(data);
@ -33,23 +35,15 @@ function getInstance() {
if ('WebSocket' in window) {
g_websocket = websocketLifePeriod();
} else {
this.$alert('不支持websocket,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
console.log('unsupported websocket');
//return false;
g_websocket = null;
return false;
}
});
}
//保持在线(开启定时任务,每3秒执行一次)
//保持在线
setInterval(function () {
if (g_websocket.readyState === 2 || g_websocket.readyState === 3) {
// 如果等待或者断开
getInstance();
}
}, 3000);
@ -60,10 +54,9 @@ function getInstance() {
//1.1.1 打开链接及回调
function websocketLifePeriod() {
let websocket;
// 37989端口为jcPrinter.exe使用的端口
var websocket;
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...
sok.onclose = function (e) {
console.log("WebSocket Error: ", e);
@ -89,10 +82,8 @@ function websocketLifePeriod() {
//1.1.2 websocket连接回调
function connectCallback(e) {
ackJsonData = '';
console.log('websocket connect success');
// 设置连接状态为true
console.log('success');
websocketConnectStatus=true;
// 初始化
init();
}
@ -126,7 +117,6 @@ function readCallback(e) {
//接口回调
if (!!MessageList[arrParse.apiName]) {
MessageList[arrParse.apiName](arrParse);
}
@ -138,31 +128,32 @@ function readCallback(e) {
deviceStatus=false;
}
}else{
if (arrParse['resultAck']['callback'] !== undefined) {
if (arrParse['resultAck']['callback'] != undefined) {
callbackName = arrParse['resultAck']['callback']['name'];
if (callbackName === 'onConnectSuccess') {
if (callbackName == 'onConnectSuccess') {
var printerName = arrParse['resultAck']['callback']['printerName'];
onConnectSuccess(printerName);
} else if (callbackName === 'onDisConnect') {
} else if (callbackName == 'onDisConnect') {
var printerName = arrParse['resultAck']['callback']['printerName'];
onDisConnect(printerName);
} else if (callbackName === 'onCoverStatusChange') {
} else if (callbackName == 'onCoverStatusChange') {
var coverStatus = arrParse['resultAck']['callback']['coverStatus'];
onCoverStatusChange(coverStatus);
} else if (callbackName === 'onElectricityChange') {
} else if (callbackName == 'onElectricityChange') {
var powerLever = arrParse['resultAck']['callback']['powerLever'];
onElectricityChange(powerLever);
} else if (callbackName === 'onPaperStatusChange') {
} else if (callbackName == 'onPaperStatusChange') {
var paperStatus = arrParse['resultAck']['callback']['paperStatus'];
onPaperStatusChange(paperStatus);
} else if (callbackName === 'onPrintPageCompleted') {
} else if (callbackName == 'onPrintPageCompleted') {
onPrintPageCompleted();
} else if (callbackName === 'onPrintProgress') {
} else if (callbackName == 'onPrintProgress') {
onPrintProgress();
} else if (callbackName === 'onAbnormalResponse') {
} else if (callbackName == 'onAbnormalResponse') {
onAbnormalResponse();
} else {
}
else {
console.log('unknow callback api!');
}
}
@ -171,7 +162,6 @@ function readCallback(e) {
ackJsonData = '';
}
}
//1.1.5 错误回调
function errorCallback(e) {
//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
@ -180,77 +170,24 @@ function errorCallback(e) {
//封装初始化SDK/获取打印机列表/选择打印机
function init() {
// 初始化sdk
initSdk(this.initSdkParam, function (data) {
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (arrParse.resultAck.result !== 0) {
// 如果初始化失败
this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
if (arrParse.resultAck.result != 0) {
return;
}
// 获取所有打印设备
getAllPrinters((data) => {
// 返回值规范化
let arrParse = JSON.parse(JSON.stringify(data));
getAllPrinters(function (data) {
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);
}
});
return;
} else if (isJSON(arrParse.resultAck.info)) {
// 如果成功获取
// 当前的所有打印设备
allPrinters = JSON.parse(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('打印设备连接失败,请重试', '提示', {
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',
parameter: json
};
console.log("画布宽度:" + json.width);
console.log("画布高度:" + json.height);
console.log("画布旋转角度:" + json.rotate);
// console.log("宽度:" + json.width)
// console.log("高度:" + json.height)
// console.log("旋转角度:" + json.rotate)
sendMsg(jsonObj, callbackFunction);
}
@ -651,6 +588,7 @@ function initSdk(json, callbackFunction) {
apiName: 'initSdk',
parameter: json
};
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="name" th:value="${name}">
<input style="display:none;" id="version" th:value="${version}">
<div class="title">
<H2>刷新</H2>
<div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div>
</div>
<br>
<!-- <div class="title">-->
<!-- <H2>刷新</H2>-->
<!-- <div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div>-->
<!-- </div>
<br>
<br>-->
<div class="link">
<H2>打印设备</H2>
<el-row>
@ -31,7 +31,7 @@
</el-option>
</el-select>
</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>
</div>
<br>
@ -164,6 +164,9 @@
<el-option label="旋转270度" :value="270"></el-option>
</el-select>
</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-select v-model="DrawLableBarCodeParam.textPosition" placeholder="请选择文本位置">
<el-option label="下方显示" :value="0"></el-option>

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

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

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

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

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

@ -69,12 +69,6 @@
class="layui-input" lay-verify="required">
</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">
<label class="layui-form-label">物料数量:</label>
<div class="layui-input-block">
@ -155,20 +149,6 @@
step = layui.step;
var temp = {};
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 () {
@ -190,20 +170,9 @@
$("#mid").val("");
} else {
req.mid = 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));//往下拉菜单里添加元素
});
$("#unit").empty();
$("#unit").append(new Option(d.unit, "-1"));
let unitItem = $("#unit");
unitItem.empty();
unitItem.append(new Option(d.unit, "-1"));
$.each(d.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit));
});
@ -211,11 +180,8 @@
$("#mid").val(d.id);
form.render();
}
});
}
}
});
})
});
$("#mname").blur(function () {

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

@ -93,8 +93,8 @@
{field: 'code',width: 200,title: '存货编码',sort: true},
{title: '所处位置', width: 200, templet: '#selectLocation', align: "center"},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{title: '计量单位', width: 200, templet: '#changeUnit', align: "center"},
{field: 'quantity', width: 150, title: '数量',edit:'quantity'},
{field: 'price', width: 150, title: '单价',edit:'price'},
{field: 'applyRemark', width: 150, title: '备注说明',edit:'applyRemark'},
{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>
<td>库位编码</td>
<td id="placeCode" th:text="${recordMinP.getPlaceCode()}">外芯仓库</td>
<td id="placeCode" th:text="${recordMinP.getPlaceCode() =='0000'?'默认库位':recordMinP.getPlaceCode()}">外芯仓库</td>
</tr>
<tr>
<td>出库人员</td>

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

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

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

@ -60,7 +60,7 @@
<div class="layui-form-item">
<label class="layui-form-label">打印码</label>
<div class="layui-input-inline">
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="createQrCode()" value="生成二维码"/>
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="createQrCode()" value="生成"/>
<div id="codeItem" style="display:none;">
<img id="qrCode" >
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
@ -171,7 +171,7 @@
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
area: ['80%', '80%'],
move: '.layui-layer-title',
fixed: false,
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: 'productionPlace', 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"}
]
],
@ -333,7 +333,8 @@
req.id = data.id;
layer.confirm('该操作会造成不可逆后果,是否继续?', {
btn: ['继续', '取消'] //按钮
}, function () {
},
function () {
$.ajax({
url: '/split/realDeleteSplit',
dataType: 'json',
@ -368,9 +369,8 @@
url: '/split/split_out',
page: {
curr: 1
},
where: {"parentId": parentId}
});
}
},'data');
});
}
});
@ -378,10 +378,43 @@
//监听状态操作
form.on('switch(changeState)', function (obj) {
var req = new Map;
req["id"] = this.value;
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({
url: "/split/split_edit",
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>

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

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

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

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

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

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

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

@ -70,8 +70,10 @@ var app = new Vue({
formLabelWidth: "120px",
options: [],
tags: [],
isBarCode:false,
isInit: false,
versionInit: false,
isVersion:false,
isInitApi: false,
isDraw: false,
isEditTag: false,
@ -118,7 +120,7 @@ var app = new Vue({
// 初始化型号
DrawLableVersionTextParam: {
"x": 10.0,
"y": 10.0,
"y": 8.0,
"height": 10,
"width": 50,
"value": document.getElementById("version").value,
@ -208,60 +210,8 @@ var app = new Vue({
// 初始化打印服务
let instance = getInstance();
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: '确定',
callback: action => {
// 关闭当前页
@ -269,13 +219,6 @@ var app = new Vue({
parent.layer.close(index);
}
});
} else if (isJSON(arrParse.resultAck.info)) {
//选择成功,打印机连接成功
console.log(data)
}
}))
}
})
}
},
methods: {
@ -314,7 +257,16 @@ var app = new Vue({
getAllPrinters(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);
// 所有设备名称
@ -337,7 +289,7 @@ var app = new Vue({
selectPrinter(allPrintersName[0], parseInt(allPrintersValue[0]), (data => {
// 返回结果规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (!arrParse.resultAck.result) {
if (!arrParse.resultAck.result || arrParse.resultAck.result === 'false') {
this.$alert('打印设备选择失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
@ -432,7 +384,7 @@ var app = new Vue({
} else {
// 展示生成按钮
this.isInit = true;
let version = $("#version").val()
let version = $("#version").val();
if ("noMaterial" !== version) {
this.versionInit = true;
}
@ -496,6 +448,7 @@ var app = new Vue({
this.tags.push(this.DrawLableVersionTextParam)
}
this.dialogDrawLableVersionTextParam = false;
this.isVersion = true;
this.isDraw = true
},
// 一维码
@ -504,42 +457,17 @@ var app = new Vue({
this.DrawLableBarCodeParam.height = Number(this.DrawLableBarCodeParam.height);
this.DrawLableBarCodeParam.x = Number(this.DrawLableBarCodeParam.x);
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y);
if(this.versionInit){
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + 10;
this.DrawLableBarCodeParam.textHeight = Number(this.DrawLableBarCodeParam.textHeight);
if (this.isVersion) {
this.DrawLableBarCodeParam.y = Number(this.DrawLableBarCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
}
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) {
this.$set(this.tags, this.editIndex, this.DrawLableBarCodeParam);
} else {
this.tags.push(this.DrawLableBarCodeParam)
}
this.isBarCode = true;
this.dialogDrawLableBarCodeParam = false;
this.isDraw = true
},
@ -551,39 +479,17 @@ var app = new Vue({
this.DrawLableQrCodeParam.x = Number(this.DrawLableQrCodeParam.x);
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y);
this.DrawLableQrCodeParam.name = "二维码";
let req = {};
req.qrCode = this.DrawLableQrCodeParam.value;
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.isVersion) {
this.DrawLableQrCodeParam.y = Number(this.DrawLableQrCodeParam.y) + (Number(this.DrawLableVersionTextParam.y) * 0.8);
}
});
if (this.isEditTag) {
this.$set(this.tags, this.editIndex, this.DrawLableQrCodeParam);
} else {
this.tags.push(this.DrawLableQrCodeParam)
}
this.dialogDrawLableQrCodeParam = false;
this.isDraw = true
this.isDraw = true;
this.isBarCode = false;
},
DragList(List) {
List.forEach(res => {
@ -704,20 +610,19 @@ var app = new Vue({
});
return;
}
// 为了防止打印时未生成对应图像事先初始化
// 初始化画板
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
if (this.dialogDrawLableBarCodeParam) {
if (this.isBarCode) {
// 如果打印条形码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{
if (this.isVersion) {
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -736,8 +641,14 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
});
}))
})
}))
}))
}))
} else {
// 不打印型号
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableBarCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -756,14 +667,17 @@ var app = new Vue({
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, intPageCount, intQuantityCount);
});
}))
}))
}))
}
})
} else {
}
else {
// 如果打印二维码
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam,(data)=>{
if(this.versionInit){
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam,(data)=>{
if (this.isVersion) {
InitDrawingBoard(this.InitDrawingBoardParam, (data1 => {
this.DrawLableTextNameApiDemo(this.DrawLableNameTextParam, (data => {
this.DrawLableTextVersionNameApiDemo(this.DrawLableVersionTextParam, (data => {
this.DrawLableQrCodeApiDemo(this.DrawLableBarCodeParam, (data => {
// 提交数据
var totalCount = parseInt(pageCount) * parseInt(quantityCount);
@ -782,9 +696,14 @@ var app = new Vue({
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);
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);
});
}))
}))
}))
}
})
}
}))
},
/**
@ -857,52 +775,68 @@ var app = new Vue({
pageIndex++;
setTimeout(function () {
// 初始化画板
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
if (this.dialogDrawLableBarCodeParam) {
// 添加名称
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam,(data)=>{
if(self.versionInit){
if (this.isBarCode) {
// 如果绘制条形码
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.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
}))
})
}))
}))
}))
} else {
// 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableBarCodeApiDemo(self.DrawLableBarCodeParam, (data => {
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.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
}))
})
}else{
}))
}))
}))
}
else {
// 如果不绘制型号
InitDrawingBoard(self.InitDrawingBoardParam, (data1 => {
self.DrawLableTextNameApiDemo(self.DrawLableNameTextParam, (data => {
self.DrawLableQrCodeApiDemo(self.DrawLableQrCodeParam, (data => {
self.sendCommitJob(self.DrawLableTextParamDemo, pageIndex, pageCount, quantityCount);
}))
}))
}))
}
})
}
}))// 提交数据
// 提交数据
}, 500);
}
});

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

@ -17,8 +17,10 @@ var MessageList = {};
function sendMsg(msg, callback) {
// console.log('sendMsg', msg.apiName);
MessageList[msg.apiName] = callback;
var data = JSON.stringify(msg);
var tryTimes = 10;
for (var i = 0; i < tryTimes; i++) {
if (g_websocket.readyState === 1) {
g_websocket.send(data);
@ -33,23 +35,15 @@ function getInstance() {
if ('WebSocket' in window) {
g_websocket = websocketLifePeriod();
} else {
this.$alert('不支持websocket,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
console.log('unsupported websocket');
//return false;
g_websocket = null;
return false;
}
});
}
//保持在线(开启定时任务,每3秒执行一次)
//保持在线
setInterval(function () {
if (g_websocket.readyState === 2 || g_websocket.readyState === 3) {
// 如果等待或者断开
getInstance();
}
}, 3000);
@ -60,10 +54,9 @@ function getInstance() {
//1.1.1 打开链接及回调
function websocketLifePeriod() {
let websocket;
// 37989端口为jcPrinter.exe使用的端口
var websocket;
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...
sok.onclose = function (e) {
console.log("WebSocket Error: ", e);
@ -89,10 +82,8 @@ function websocketLifePeriod() {
//1.1.2 websocket连接回调
function connectCallback(e) {
ackJsonData = '';
console.log('websocket connect success');
// 设置连接状态为true
console.log('success');
websocketConnectStatus=true;
// 初始化
init();
}
@ -126,7 +117,6 @@ function readCallback(e) {
//接口回调
if (!!MessageList[arrParse.apiName]) {
MessageList[arrParse.apiName](arrParse);
}
@ -138,31 +128,32 @@ function readCallback(e) {
deviceStatus=false;
}
}else{
if (arrParse['resultAck']['callback'] !== undefined) {
if (arrParse['resultAck']['callback'] != undefined) {
callbackName = arrParse['resultAck']['callback']['name'];
if (callbackName === 'onConnectSuccess') {
if (callbackName == 'onConnectSuccess') {
var printerName = arrParse['resultAck']['callback']['printerName'];
onConnectSuccess(printerName);
} else if (callbackName === 'onDisConnect') {
} else if (callbackName == 'onDisConnect') {
var printerName = arrParse['resultAck']['callback']['printerName'];
onDisConnect(printerName);
} else if (callbackName === 'onCoverStatusChange') {
} else if (callbackName == 'onCoverStatusChange') {
var coverStatus = arrParse['resultAck']['callback']['coverStatus'];
onCoverStatusChange(coverStatus);
} else if (callbackName === 'onElectricityChange') {
} else if (callbackName == 'onElectricityChange') {
var powerLever = arrParse['resultAck']['callback']['powerLever'];
onElectricityChange(powerLever);
} else if (callbackName === 'onPaperStatusChange') {
} else if (callbackName == 'onPaperStatusChange') {
var paperStatus = arrParse['resultAck']['callback']['paperStatus'];
onPaperStatusChange(paperStatus);
} else if (callbackName === 'onPrintPageCompleted') {
} else if (callbackName == 'onPrintPageCompleted') {
onPrintPageCompleted();
} else if (callbackName === 'onPrintProgress') {
} else if (callbackName == 'onPrintProgress') {
onPrintProgress();
} else if (callbackName === 'onAbnormalResponse') {
} else if (callbackName == 'onAbnormalResponse') {
onAbnormalResponse();
} else {
}
else {
console.log('unknow callback api!');
}
}
@ -171,7 +162,6 @@ function readCallback(e) {
ackJsonData = '';
}
}
//1.1.5 错误回调
function errorCallback(e) {
//如果出现连接、处理、接收、发送数据失败的时候触发onerror事件
@ -180,77 +170,24 @@ function errorCallback(e) {
//封装初始化SDK/获取打印机列表/选择打印机
function init() {
// 初始化sdk
initSdk(this.initSdkParam, function (data) {
// 返回值规范化
var arrParse = JSON.parse(JSON.stringify(data));
if (arrParse.resultAck.result !== 0) {
// 如果初始化失败
this.$alert('初始化打印服务失败,请重试', '提示', {
confirmButtonText: '确定',
callback: action => {
// 关闭当前页
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
});
if (arrParse.resultAck.result != 0) {
return;
}
// 获取所有打印设备
getAllPrinters((data) => {
// 返回值规范化
let arrParse = JSON.parse(JSON.stringify(data));
getAllPrinters(function (data) {
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);
}
});
return;
} else if (isJSON(arrParse.resultAck.info)) {
// 如果成功获取
// 当前的所有打印设备
allPrinters = JSON.parse(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('打印设备连接失败,请重试', '提示', {
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',
parameter: json
};
console.log("画布宽度:" + json.width);
console.log("画布高度:" + json.height);
console.log("画布旋转角度:" + json.rotate);
// console.log("宽度:" + json.width)
// console.log("高度:" + json.height)
// console.log("旋转角度:" + json.rotate)
sendMsg(jsonObj, callbackFunction);
}
@ -651,6 +588,7 @@ function initSdk(json, callbackFunction) {
apiName: 'initSdk',
parameter: json
};
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="name" th:value="${name}">
<input style="display:none;" id="version" th:value="${version}">
<div class="title">
<H2>刷新</H2>
<div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div>
</div>
<br>
<!-- <div class="title">-->
<!-- <H2>刷新</H2>-->
<!-- <div><el-button @click="initSdkApi()" type="primary">SDK初始化</el-button></div>-->
<!-- </div>
<br>
<br>-->
<div class="link">
<H2>打印设备</H2>
<el-row>
@ -31,7 +31,7 @@
</el-option>
</el-select>
</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>
</div>
<br>
@ -164,6 +164,9 @@
<el-option label="旋转270度" :value="270"></el-option>
</el-select>
</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-select v-model="DrawLableBarCodeParam.textPosition" placeholder="请选择文本位置">
<el-option label="下方显示" :value="0"></el-option>

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

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

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

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

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

@ -69,12 +69,6 @@
class="layui-input" lay-verify="required">
</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">
<label class="layui-form-label">物料数量:</label>
<div class="layui-input-block">
@ -155,20 +149,6 @@
step = layui.step;
var temp = {};
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 () {
@ -190,20 +170,9 @@
$("#mid").val("");
} else {
req.mid = 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));//往下拉菜单里添加元素
});
$("#unit").empty();
$("#unit").append(new Option(d.unit, "-1"));
let unitItem = $("#unit");
unitItem.empty();
unitItem.append(new Option(d.unit, "-1"));
$.each(d.splitInfoList, function (index, item) {
$("#unit").append(new Option(item.newUnit, item.newUnit));
});
@ -211,11 +180,8 @@
$("#mid").val(d.id);
form.render();
}
});
}
}
});
})
});
$("#mname").blur(function () {

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

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

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

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

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

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

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

@ -60,7 +60,7 @@
<div class="layui-form-item">
<label class="layui-form-label">打印码</label>
<div class="layui-input-inline">
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="createQrCode()" value="生成二维码"/>
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="createQrCode()" value="生成"/>
<div id="codeItem" style="display:none;">
<img id="qrCode" >
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
@ -171,7 +171,7 @@
skin: 'layui-layer-rim',
maxmin: true,
shadeClose: true, //点击遮罩关闭层
area: ['70%', '70%'],
area: ['80%', '80%'],
move: '.layui-layer-title',
fixed: false,
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: 'productionPlace', 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"}
]
],
@ -333,7 +333,8 @@
req.id = data.id;
layer.confirm('该操作会造成不可逆后果,是否继续?', {
btn: ['继续', '取消'] //按钮
}, function () {
},
function () {
$.ajax({
url: '/split/realDeleteSplit',
dataType: 'json',
@ -368,9 +369,8 @@
url: '/split/split_out',
page: {
curr: 1
},
where: {"parentId": parentId}
});
}
},'data');
});
}
});
@ -378,10 +378,43 @@
//监听状态操作
form.on('switch(changeState)', function (obj) {
var req = new Map;
req["id"] = this.value;
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({
url: "/split/split_edit",
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>

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

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

Loading…
Cancel
Save