diff --git a/src/main/java/com/gaotao/common/utils/SqlUtils.java b/src/main/java/com/gaotao/common/utils/SqlUtils.java index ef634e4..40b9066 100644 --- a/src/main/java/com/gaotao/common/utils/SqlUtils.java +++ b/src/main/java/com/gaotao/common/utils/SqlUtils.java @@ -2,10 +2,6 @@ package com.gaotao.common.utils; import com.gaotao.common.exception.RRException; import lombok.extern.slf4j.Slf4j; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; -import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/src/main/java/com/gaotao/modules/pda/dao/impl/RollDaoImpl.java b/src/main/java/com/gaotao/modules/pda/dao/impl/RollDaoImpl.java index 8a36103..e4610a6 100644 --- a/src/main/java/com/gaotao/modules/pda/dao/impl/RollDaoImpl.java +++ b/src/main/java/com/gaotao/modules/pda/dao/impl/RollDaoImpl.java @@ -211,7 +211,7 @@ public class RollDaoImpl implements RollDao { sql.append("WHERE"); sql.append(" PartNo = :partNo AND Site =:site AND Status_DB =:status_DB"); sql.append(" AND RollDate <= dateadd(DAY, CAST(dbo.get_sys_config_value('rollOutDateCheck') AS INT), "); - sql.append(" (SELECT MIN(RollDate) FROM C_RollInfo WHERE PartNo = #{partno} and Status_DB = 'I')) "); + sql.append(" (SELECT MIN(RollDate) FROM C_RollInfo WHERE PartNo = :partNo and Status_DB = 'I')) "); diff --git a/src/main/resources/mapper/finishedProduct/BoxLabelPrintDao.xml b/src/main/resources/mapper/finishedProduct/BoxLabelPrintDao.xml index afc9a75..1c2bf4f 100644 --- a/src/main/resources/mapper/finishedProduct/BoxLabelPrintDao.xml +++ b/src/main/resources/mapper/finishedProduct/BoxLabelPrintDao.xml @@ -11,7 +11,8 @@ - + diff --git a/src/main/resources/static/pda/js/productwarehouse/packingout.js b/src/main/resources/static/pda/js/productwarehouse/packingout.js index 4e00960..3603b81 100644 --- a/src/main/resources/static/pda/js/productwarehouse/packingout.js +++ b/src/main/resources/static/pda/js/productwarehouse/packingout.js @@ -41,29 +41,52 @@ function getPickingList() { $("#roll_table").html(''); if (data.code == 0) { pick = data.data; + var bool = true if (pick) { pick.forEach((item, index) => { - var str = '' + - '' + - '' + - '' + - '' + item.orderNo + '' + - '' + - '' + item.partNo + '' + - '' + - '' + item.orderQty + '' + - '' + - '' + item.pickedQty + '' + - ''; + var str = '' + if (item.orderQty == item.pickedQty) { + if (partCss == item.partNo) { + bool = false + } + str = '' + + '' + + '' + + '' + + '' + item.orderNo + '' + + '' + + '' + item.partNo + '' + + '' + + '' + item.orderQty + '' + + '' + + '' + item.pickedQty + '' + + ''; + } else { + str = '' + + '' + + '' + + '' + + '' + item.orderNo + '' + + '' + + '' + item.partNo + '' + + '' + + '' + item.orderQty + '' + + '' + + '' + item.pickedQty + '' + + ''; + } $("#roll_table").append(str); }) $("#rollNo").focus(); - if (data.msg != 'success'){ + if (data.msg != 'success') { layer.alert(data.msg); + } - if (partCss){ - $('#'+partCss+ ' th').css("background-color","#99CC9AFF") + if (partCss && bool) { + + $('#' + partCss + ' th').css("background-color", "#99CC9AFF") } } else { layer.alert('该卷不存在'); @@ -80,13 +103,14 @@ function getPickingList() { if (data.code == 500) { layer.alert(data.msg); } - if (data.code == 300){ + if (data.code == 300) { layer.confirm(data.msg + '
是否前往拆箱页面', { btn: ['确定', '取消'] // 按钮 - }, ()=> { - window.location.href = "/pda/productwarehouse/boxingManage?menuId=188&token="+$.cookie("token")+"&superiorId=121" - },()=>{}) + }, () => { + window.location.href = "/pda/productwarehouse/boxingManage?menuId=188&token=" + $.cookie("token") + "&superiorId=121" + }, () => { + }) } if (data.code == 401) { layer.alert('用户身份已过期'); @@ -96,11 +120,8 @@ function getPickingList() { error: function (data) { } }); - - } - function getRollInfo(rollNo) { let roll = { "rollNo": rollNo, @@ -118,8 +139,8 @@ function getRollInfo(rollNo) { }, success: function (data) { if (data.code == 0) { - if (lastTimeRoll){ - if (lastTimeRoll.partno != data.roll.partno){ + if (lastTimeRoll) { + if (lastTimeRoll.partno != data.roll.partno) { layer.alert("友情提示: 本次扫描卷,料号与上次不是同一料号") } } @@ -218,10 +239,10 @@ function boxing() { }, success: function (data) { if (data.code == 0) { - if (data.sealingNumber == 0 ) { + if (data.sealingNumber == 0) { layer.alert('请扫入卷再装箱'); } else { - pickingPrint(data.sealingNumber,data.boxNo) + pickingPrint(data.sealingNumber, data.boxNo) } } if (data.code == 500) { @@ -310,7 +331,7 @@ function getPrintFile(customerId) { } // 装箱完成调用打印 -function pickingPrint(pickingNumber,boxNo) { +function pickingPrint(pickingNumber, boxNo) { var reoprt = $('#reoprtId').val(); console.log(reoprt) var split = reoprt.split(":"); @@ -326,7 +347,7 @@ function pickingPrint(pickingNumber,boxNo) { partNo: partNo1, pickingNumber: pickingNumber, isCustomer: isCustomer, - boxNo:boxNo + boxNo: boxNo } $.ajax({ url: "/packing/printPacking", @@ -395,7 +416,7 @@ function delivery() { } // 打印卷标签 -function print(val){ +function print(val) { var rollPrintList = val if (rollPrintList.length <= 0) { return; diff --git a/src/test/java/com/gaotao/RedisTest.java b/src/test/java/com/gaotao/RedisTest.java index ca90992..20647dd 100644 --- a/src/test/java/com/gaotao/RedisTest.java +++ b/src/test/java/com/gaotao/RedisTest.java @@ -1,8 +1,13 @@ package com.gaotao; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; import com.gaotao.common.utils.RandomUtil; import com.gaotao.common.utils.RedisUtils; import com.gaotao.modules.sys.entity.SysUserEntity; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.builder.ToStringBuilder; import org.junit.Test; import org.junit.runner.RunWith; @@ -10,21 +15,120 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.*; + +import static cn.hutool.core.thread.ThreadUtil.sleep; + @RunWith(SpringRunner.class) @SpringBootTest +@Slf4j public class RedisTest { - @Autowired - private RedisUtils redisUtils; + @Autowired + private RedisUtils redisUtils; + + @Test + public void contextLoads() { + String uuid = RandomUtil.getOrderNoByAtomic("1", "OC"); + + SysUserEntity user = new SysUserEntity(); + user.setEmail("qqq@qq.com"); + redisUtils.set("user", user); + + System.out.println(ToStringBuilder.reflectionToString(redisUtils.get("user", SysUserEntity.class))); + } + + @Test + public void thread() { + + StringBuffer s1 = new StringBuffer(); + StringBuffer s2 = new StringBuffer(); + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("大头",new JSONObject().put("fdsafdas","范德萨发大水")); + System.out.println(jsonObject); + - @Test - public void contextLoads() { - String uuid = RandomUtil.getOrderNoByAtomic("1","OC"); - SysUserEntity user = new SysUserEntity(); - user.setEmail("qqq@qq.com"); - redisUtils.set("user", user); + /** + *(1)corePoolSize:核心线程数,线程池中始终存活的线程数。 + * (2)maximumPoolSize: 最大线程数,线程池中允许的最大线程数。 + * (3)keepAliveTime: 存活时间,线程没有任务执行时最多保持多久时间会终止。 + * (4)unit: 单位,参数keepAliveTime的时间单位,7种可选。 + * - TimeUnit.DAYS 天 + * - TimeUnit.HOURS 小时 + * - TimeUnit.MINUTES 分 + * - TimeUnit.SECONDS 秒 + * - TimeUnit.MILLISECONDS 毫秒 + * - TimeUnit.MICROSECONDS 微妙 + * - TimeUnit.NANOSECONDS 纳秒 + * (5)workQueue: 一个阻塞队列,用来存储等待执行的任务,均为线程安全,7种可选。 + * - ArrayBlockingQueue 一个由数组结构组成的有界阻塞队列。 + * - LinkedBlockingQueue 一个由链表结构组成的有界阻塞队列。 + * - SynchronousQueue 一个不存储元素的阻塞队列,即直接提交给线程不保持它们。 + * - PriorityBlockingQueue 一个支持优先级排序的无界阻塞队列。 + * - DelayQueue 一个使用优先级队列实现的无界阻塞队列,只有在延迟期满时才能从中提取元素。 + * - LinkedTransferQueue 一个由链表结构组成的无界阻塞队列。与SynchronousQueue类似,还含有非阻塞方法。 + * - LinkedBlockingDeque 一个由链表结构组成的双向阻塞队列。 + * 较常用的是LinkedBlockingQueue和Synchronous。线程池的排队策略与BlockingQueue有关。 + * (6)threadFactory: 线程工厂,主要用来创建线程,默及正常优先级、非守护线程。 + * (7)handler:拒绝策略,拒绝处理任务时的策略,4种可选,默认为AbortPolicy。 + * - AbortPolicy 拒绝并抛出异常。 + * - CallerRunsPolicy 重试提交当前的任务,即再次调用运行该任务的execute()方法。 + * - DiscardOldestPolicy 抛弃队列头部(最旧)的一个任务,并执行当前任务。 + * - DiscardPolicy 抛弃当前任务。 + */ + ExecutorService executorService = new ThreadPoolExecutor(2, 10, + 1, TimeUnit.MINUTES, new ArrayBlockingQueue<>(5, true), + Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy()); + executorService.execute(() -> { + // 获取线程名称,默认格式:pool-1-thread-1 + synchronized (s1) { + s1.append("a"); + s2.append("1"); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + synchronized (s2) { + System.out.println("s2执行中"); + s1.append("b"); + s2.append("2"); + + System.out.println(s1); + System.out.println(s2); + } + } + }); + executorService.execute(() -> { + // 获取线程名称,默认格式:pool-1-thread-1 + synchronized (s2) { + s1.append("c"); + s2.append("3"); + + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + + } + + synchronized (s1) { + s1.append("d"); + s2.append("4"); + + System.out.println(s1); + System.out.println(s2); + } + } + }); + + } - System.out.println(ToStringBuilder.reflectionToString(redisUtils.get("user", SysUserEntity.class))); - } } + +