Forráskód Böngészése

xwh提交代码,增加单个运单下架和取消库位号功能,波次下架还没改

xwh 4 éve
szülő
commit
1c1a286bb8

+ 40 - 11
wms-core-service/src/main/java/com/lote/wms/outstock/outshelf/service/impl/OutInventoryAllocationServiceImpl.java

@@ -1,11 +1,14 @@
 package com.lote.wms.outstock.outshelf.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
+import com.lote.wms.base.warehouse.dao.LocationMapper;
+import com.lote.wms.base.warehouse.entity.queryvo.LocationQueryVo;
+import com.lote.wms.base.warehouse.entity.resultvo.LocationResultVo;
+import com.lote.wms.common.core.db.DataAccessHolder;
 import org.mybatis.plugin.model.Pager;
 import org.mybatis.plugin.util.PagerUtil;
 import org.slf4j.Logger;
@@ -46,6 +49,9 @@ public class OutInventoryAllocationServiceImpl implements OutInventoryAllocation
 	@Autowired
 	private OutInventoryAllocationMapper outInventoryAllocationMapper;
 
+	@Autowired
+	private LocationMapper locationMapper;
+
 	@Resource
 	private OutOrderService outOrderService;
 
@@ -64,6 +70,8 @@ public class OutInventoryAllocationServiceImpl implements OutInventoryAllocation
 	@Resource
 	private InventoryService inventoryService;
 
+
+
 	private static final Logger logger = LoggerFactory.getLogger(OutInventoryAllocationServiceImpl.class);
 
 	public OutInventoryAllocation add(OutInventoryAllocation record) {
@@ -156,10 +164,10 @@ public class OutInventoryAllocationServiceImpl implements OutInventoryAllocation
 			message.setMsg("出库单Id不能为空,请先提交出库单号");
 			return message;
 		}
-		if (StringUtil.isEmpty(vo.getLocationCode())) {
-			message.setMsg("库位号码不能为空");
-			return message;
-		}
+//		if (StringUtil.isEmpty(vo.getLocationCode())) {
+//			message.setMsg("库位号码不能为空");
+//			return message;
+//		}
 		if (StringUtil.isEmpty(vo.getBarcode())) {
 			message.setMsg("商品条码不能为空");
 			return message;
@@ -170,17 +178,38 @@ public class OutInventoryAllocationServiceImpl implements OutInventoryAllocation
 		Criteria cri = criteria.createCriteria();
 		cri.andOutOrderIdEqualTo(vo.getOutOrderId());
 		cri.andBarcodeEqualTo(vo.getBarcode().trim());
-		cri.andLocationCodeEqualTo(vo.getLocationCode().trim());
+//		cri.andLocationCodeEqualTo(vo.getLocationCode().trim());
 		List<OutInventoryAllocation> list = outInventoryAllocationMapper.selectByConditionList(criteria);
 		if (list.size() == 0) {
-			String msg = "该订单没有库位:" + vo.getLocationCode() + ",条码:" + vo.getBarcode() + "待下架";
+			String msg = "该订单没有条码:" + vo.getBarcode() + "待下架";
 			message.setMsg(msg);
 			return message;
 		}
-		List<OutInventoryAllocation> newList = new ArrayList<OutInventoryAllocation>();
+
+		for (OutInventoryAllocation allocation : list) {
+			String locationCode = allocation.getLocationCode(); // 当前商品的库位号
+			LocationQueryVo locationQueryVo = new LocationQueryVo();
+			locationQueryVo.setWarehouseCode(allocation.getWarehouseCode());
+			locationQueryVo.setCode(locationCode);
+			locationQueryVo.setZoneCode(allocation.getZoneCode());
+			List<LocationResultVo> locationResultVoList = locationMapper.selectByVoList(locationQueryVo);
+			if (Objects.nonNull(locationResultVoList) && locationResultVoList.size()==1){
+				allocation.setExtend5(locationResultVoList.get(0).getLineNumber().toString()); // 使用个临时字段存动线号
+			}
+		}
+
+		// 对list进行按动线号排序,越小越优先
+		Collections.sort(list, new Comparator<OutInventoryAllocation>() {
+			@Override
+			public int compare(OutInventoryAllocation o1, OutInventoryAllocation o2) {
+				return Integer.compare(Integer.valueOf(o2.getExtend5()==null?"0":o2.getExtend5()),Integer.valueOf(o1.getExtend5()==null?"0":o1.getExtend5()));
+			}
+		});
+
+		List<OutInventoryAllocation> newList = new ArrayList<>();
 		for (OutInventoryAllocation temp : list) {
 			if (temp.getOutQuantity() >= temp.getQuantity()) {
-				message.setMsg("该库位和条码已完成下架");
+				message.setMsg("该条码已完成下架");
 				continue;
 			}
 			newList.add(temp);

+ 13 - 13
wms-core-service/src/main/java/com/lote/wms/outstock/outshelf/service/impl/OutShelfServiceImpl.java

@@ -234,10 +234,10 @@ public class OutShelfServiceImpl implements OutShelfService {
 				message.setMsg("商品条码不能为空!");
 				return message;
 			}
-			if (StringUtil.isEmpty(vo.getLocationCode())) {
-				message.setMsg("实际库位不能为空!");
-				return message;
-			}
+//			if (StringUtil.isEmpty(vo.getLocationCode())) {
+//				message.setMsg("实际库位不能为空!");
+//				return message;
+//			}
 			if (vo.getQuantity() <= 0) {
 				message.setMsg("下架数量必须大于0!");
 				return message;
@@ -254,7 +254,7 @@ public class OutShelfServiceImpl implements OutShelfService {
 			// 预分配id
 			String allocationId = vo.getAllocationId();
 			String barcode = vo.getBarcode().trim();
-			String locationCode = vo.getLocationCode().trim();
+//			String locationCode = vo.getLocationCode().trim();
 			Integer quantity = vo.getQuantity();// 本次下架数量
 
 			OutOrder order = outOrderService.getForWms(outOrderId);
@@ -300,12 +300,12 @@ public class OutShelfServiceImpl implements OutShelfService {
 				message.setMsg("订单id和库存分配不匹配!请重新提交订单号");
 				return message;
 			}
-			if (!StringUtil.isEqualIgnoreCase(allocation.getLocationCode(), locationCode)) {
-				message.setMsg("请重新在库位输入框按回车提交库位");
-				outOrderLogService.addLog(order, user, typeEnum, null, message.getMsg(), false);
-				return message;
-			}
-			locationCode = allocation.getLocationCode();// 更正大小写
+//			if (!StringUtil.isEqualIgnoreCase(allocation.getLocationCode(), locationCode)) {
+//				message.setMsg("请重新在库位输入框按回车提交库位");
+//				outOrderLogService.addLog(order, user, typeEnum, null, message.getMsg(), false);
+//				return message;
+//			}
+//			locationCode = allocation.getLocationCode();// 更正大小写
 
 			if (!StringUtil.isEqualIgnoreCase(allocation.getBarcode(), barcode)) {
 				message.setMsg("请重新在商品条码输入框按回车提交条码");
@@ -404,10 +404,10 @@ public class OutShelfServiceImpl implements OutShelfService {
 			}
 
 			// 2019-03-20 - 给前端返回该库位是否还有商品条码未下架
-			boolean locationisFinished = outInventoryAllocationService.isFinished(outOrderId, locationCode);
+			boolean locationisFinished = outInventoryAllocationService.isFinished(outOrderId, allocation.getLocationCode());
 			if (locationisFinished) {
 				// 该库位完成下架
-				message.setMsg("该库位已下架完成,请到下一个库位");
+				message.setMsg("该条形码["+allocation.getBarcode()+"]的库位["+allocation.getLocationCode()+"]已下架完成,请到下一个库位");
 				message.setExtend("2");
 			} else {
 				// 代表该库位还有其他条码未完成下架

+ 18 - 14
wms-operate/src/main/resources/static/ui/js/outstock/outshelf/outShelf/single.js

@@ -31,13 +31,13 @@ $(function(){
         submitOutOrderNo();
     });
 	
-    //库位号回车
-    $('#locationCode').keyup(function (event) {
-    	if (event.keyCode != "13") {return false;}
-    	$("#locationCode").val(trimStr($("#locationCode").val()));
-    	
-    	$('#barcode').focus();
-    });
+    // //库位号回车
+    // $('#locationCode').keyup(function (event) {
+    // 	if (event.keyCode != "13") {return false;}
+    // 	$("#locationCode").val(trimStr($("#locationCode").val()));
+    //
+    // 	$('#barcode').focus();
+    // });
     
     //条码回车
     $('#barcode').keyup(function (event) {
@@ -85,8 +85,11 @@ function submitOutOrderNo(){
         	$("#statusName").css('color','black');
         	
         	//进入下架操作
-        	$("#locationCode").focus();
-        	
+        	// $("#barcode").focus();
+
+        	// 清空输入框
+			nextBarcode();
+
         	//刷新显示下架详情
         	refreshItems();
         },
@@ -101,13 +104,13 @@ function submitBarcode(){
 	var outOrderNo = $('#outOrderNo').val();
 	var outOrderId=$("#outOrderId").val();
 	var barcode= $('#barcode').val();
-	var locationCode=$('#locationCode').val();
+	// var locationCode=$('#locationCode').val();
 	
 	var jsonData={};
 	
 	jsonData.outOrderNo=outOrderNo;
 	jsonData.outOrderId=outOrderId;
-	jsonData.locationCode=locationCode;
+	// jsonData.locationCode=locationCode;
 	jsonData.barcode=barcode;
     //查询是否存在  会显示数量
 	$.ajax({
@@ -154,7 +157,7 @@ function submitOutShelf(){
 	var outOrderId=$("#outOrderId").val();
 	var outOrderNo = $('#outOrderNo').val();
 	var allocationId=$('#allocationId').val();
-	var locationCode=$('#locationCode').val();
+	// var locationCode=$('#locationCode').val();
 	var barcode= $('#barcode').val();
 	var productQty=$("#productQty").val();
 	
@@ -163,7 +166,7 @@ function submitOutShelf(){
 	jsonData.outOrderNo=outOrderNo;
 	jsonData.quantity=productQty;
 	jsonData.allocationId=allocationId;
-	jsonData.locationCode=locationCode;
+	// jsonData.locationCode=locationCode;
 	
 	jsonData.barcode=barcode;
 	
@@ -193,7 +196,7 @@ function submitOutShelf(){
         	
         	if(result.data=='2'){//下架成功
         		//下一个库位
-            	nextLocation();
+				nextBarcode();
             	refreshItems();
         		return;
         	}
@@ -257,6 +260,7 @@ function cleanAll(){
 	$("input").each(function(){
 		$(this).val("")
 	})
+	$("#itemList").empty();
 	$('#outOrderNo').focus();
 }
 

+ 15 - 15
wms-operate/src/main/resources/static/ui/views/outstock/outshelf/outShelf/single.html

@@ -111,21 +111,21 @@
 			</tr>
 		</table>
 
-		<div class="pull-left badge badge-success" style="width:120px;font-weight: bold; color: white;background-color: #669533;">2扫描库位</div>			
-		<table class="table wd750" style="margin-top: 0px;padding-bottom: 0px;">
-			<tr>
-				<th class="wd120" style="padding-bottom: 0px;">
-					<span class="btn btn-default wd120">库位号码</span>
-				</th>
-				<th class="wd220" style="padding-bottom: 0px;">
-					<input type="text" class="form-control wd220 allowClear" id="locationCode" placeholder="输入后请按回车">
-				</th>
-				<th colspan="2">
-					&nbsp;
-				</th>
-				 	
-			</tr>
-		</table>
+<!--		<div class="pull-left badge badge-success" style="width:120px;font-weight: bold; color: white;background-color: #669533;">2扫描库位</div>			-->
+<!--		<table class="table wd750" style="margin-top: 0px;padding-bottom: 0px;">-->
+<!--			<tr>-->
+<!--				<th class="wd120" style="padding-bottom: 0px;">-->
+<!--					<span class="btn btn-default wd120">库位号码</span>-->
+<!--				</th>-->
+<!--				<th class="wd220" style="padding-bottom: 0px;">-->
+<!--					<input type="text" class="form-control wd220 allowClear" id="locationCode" placeholder="输入后请按回车">-->
+<!--				</th>-->
+<!--				<th colspan="2">-->
+<!--					&nbsp;-->
+<!--				</th>-->
+<!--				 	-->
+<!--			</tr>-->
+<!--		</table>-->
 							
 		<div class="pull-left badge badge-success" style="width:120px;font-weight: bold; color: white;background-color: #669533;">3扫描商品</div>			
 		<table class="table wd750" style="margin-top: 0px;padding-bottom: 0px;">