瀏覽代碼

Merge branch 'master' of xwh/wms into master

肖文浩 4 年之前
父節點
當前提交
ff817843d6

+ 1 - 1
wms-core-service/src/main/java/com/lote/wms/outstock/outshelf/dao/OutInventoryAllocationMapper.java

@@ -36,7 +36,7 @@ public interface OutInventoryAllocationMapper {
 			@Param("isFinished") String isFinished);
 
 	List<OutInventoryAllocation> listByWaveIdAndLocationCodeAndBarcode(@Param("outWaveId") String outWaveId,
-			@Param("locationCode") String locationCode, @Param("barcode") String barcode);
+			 @Param("barcode") String barcode);
 
 	Integer sumQty(InventoryQueryVo vo);
 

+ 1 - 2
wms-core-service/src/main/java/com/lote/wms/outstock/outshelf/service/OutInventoryAllocationService.java

@@ -65,11 +65,10 @@ public interface OutInventoryAllocationService {
 	 * 根据波次 货位号 条码查询
 	 * 
 	 * @param waveId
-	 * @param locationCode
 	 * @param barcode
 	 * @return
 	 */
-	List<OutInventoryAllocation> listForWaveOutShelf(String waveId, String locationCode, String barcode);
+	List<OutInventoryAllocation> listForWaveOutShelf(String waveId, String barcode);
 
 	List<OutInventoryAllocation> listByWaveId(String waveId);
 

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

@@ -316,8 +316,8 @@ public class OutInventoryAllocationServiceImpl implements OutInventoryAllocation
 	}
 
 	@Override
-	public List<OutInventoryAllocation> listForWaveOutShelf(String waveId, String locationCode, String barcode) {
-		return outInventoryAllocationMapper.listByWaveIdAndLocationCodeAndBarcode(waveId, locationCode, barcode);
+	public List<OutInventoryAllocation> listForWaveOutShelf(String waveId, String barcode) {
+		return outInventoryAllocationMapper.listByWaveIdAndLocationCodeAndBarcode(waveId, barcode);
 	}
 
 	@Override

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

@@ -1,23 +1,11 @@
 package com.lote.wms.outstock.outshelf.service.impl;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-import javax.annotation.Resource;
-
 import com.lote.wms.base.product.dao.ProductMapper;
 import com.lote.wms.base.product.entity.Product;
 import com.lote.wms.base.product.entity.queryvo.ProductQueryVo;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.mybatis.plugin.model.Pager;
-import org.mybatis.plugin.util.PagerUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Service;
-
+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.config.SystemConfig;
 import com.lote.wms.common.constants.BaseConstant;
 import com.lote.wms.common.core.db.DataAccessHolder;
@@ -25,13 +13,7 @@ import com.lote.wms.common.core.db.IdWorkerAide;
 import com.lote.wms.common.exception.ServiceException;
 import com.lote.wms.common.model.Message;
 import com.lote.wms.common.service.ILockService;
-import com.lote.wms.common.utils.BeanUtil;
-import com.lote.wms.common.utils.DateUtil;
-import com.lote.wms.common.utils.FileServerClient;
-import com.lote.wms.common.utils.LockUtil;
-import com.lote.wms.common.utils.NumberUtil;
-import com.lote.wms.common.utils.POIExcelUtil;
-import com.lote.wms.common.utils.StringUtil;
+import com.lote.wms.common.utils.*;
 import com.lote.wms.inventory.inventory.entity.Inventory;
 import com.lote.wms.inventory.inventory.entity.enums.InventoryOpTypeEnum;
 import com.lote.wms.inventory.inventory.entity.expand.InventoryVo;
@@ -60,6 +42,19 @@ import com.lote.wms.outstock.wave.entity.enums.OutWaveStatusEnum;
 import com.lote.wms.outstock.wave.service.OutWaveItemService;
 import com.lote.wms.outstock.wave.service.OutWaveService;
 import com.lote.wms.user.user.entity.User;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.mybatis.plugin.model.Pager;
+import org.mybatis.plugin.util.PagerUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
 
 @Service("outShelfService")
 public class OutShelfServiceImpl implements OutShelfService {
@@ -70,6 +65,9 @@ public class OutShelfServiceImpl implements OutShelfService {
 	@Autowired
 	private ProductMapper productMapper;
 
+	@Autowired
+	private LocationMapper locationMapper;
+
 	@Resource
 	private OutInventoryAllocationService outInventoryAllocationService;
 
@@ -642,23 +640,54 @@ public class OutShelfServiceImpl implements OutShelfService {
 				return Message.fail("该波次被其他线程锁定!");
 			}
 			// 1.查询波次
+			boolean isExist = outWaveService.isExist(vo.getWaveNo());
+			if (!isExist) {
+				// 如果波次号不存在,判断运单是否存在
+				Message message = outOrderService.selectByNo(vo.getWaveNo());
+				if (!message.isSuccess()) {
+					return Message.fail("该波次单号或运单号不存在");
+				}
+				OutOrder order = (OutOrder) message.getExtend();
+				vo.setWaveNo(order.getWaveNo());
+			}
 			OutWave outWave = outWaveService.getByWaveNo(vo.getWaveNo());
 			if (outWave == null) {
-				return Message.fail("波次号码不存在!");
+				return Message.fail("波次号不存在");
 			}
 			if (StringUtil.isEqual(outWave.getStatusCode(), OutWaveStatusEnum.FINISH.getCode())) {
 				return Message.fail("该波次已经完成下架!");
 			}
 			// 2.根据波次, 货位号 商品条码查询预下架信息
-			String locationCode = vo.getLocationCode();
+//			String locationCode = vo.getLocationCode();
 			String barcode = vo.getBarcode();
 			String waveId = outWave.getId();
-			List<OutInventoryAllocation> list = outInventoryAllocationService.listForWaveOutShelf(waveId, locationCode,
+			List<OutInventoryAllocation> list = outInventoryAllocationService.listForWaveOutShelf(waveId,
 					barcode);
 			if (list.size() <= 0) {
-				return Message.fail("库位号或商品条码错误,请核对拣货单!");
+				return Message.fail("商品条码错误,请核对拣货单!");
 			}
 
+			// 把list按动线号排序
+			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()));
+				}
+			});
+
 			// 验证波次内订单状态
 			for (OutInventoryAllocation allocation : list) {
 				String outOrderId = allocation.getOutOrderId();
@@ -706,10 +735,13 @@ public class OutShelfServiceImpl implements OutShelfService {
 			handleWaveStatusForOutShelf(outWave, user, isFinished);// 更新波次单状态
 
 			Message message = Message.success("下架成功");
+			HashMap<String,Object> map = new HashMap<>();
+			map.put("allocationList",list);
 			if (isFinished) {
 				message.setMsg("波次:" + outWave.getWaveNo() + ",已完成下架,请操作下一个波次");
-				message.setExtend("3"); // 1:该库位的该条码完成 ,2:该库位完成,3: 整个波次完成
+				map.put("flag","3");// 1:该库位的该条码完成 ,2:该库位完成,3: 整个波次完成
 			}
+			message.setExtend(map);
 			return message;
 		} finally {
 			waveLockService.unlock(vo.getWaveNo());

+ 7 - 2
wms-core-service/src/main/java/com/lote/wms/outstock/wave/service/impl/OutWaveServiceImpl.java

@@ -279,8 +279,13 @@ public class OutWaveServiceImpl implements OutWaveService {
 	public Message isAllowOutShelf(String waveNo) {
 		boolean isExist = isExist(waveNo);
 		if (!isExist) {
-			return Message.fail("该波次单号不存在");
-
+			// 如果波次号不存在,判断运单是否存在
+			Message message = outOrderService.selectByNo(waveNo);
+			if(!message.isSuccess()){
+				return Message.fail("该波次单号或运单号不存在");
+			}
+			OutOrder order = (OutOrder) message.getExtend();
+			waveNo = order.getWaveNo();
 		}
 		OutWave outWave = getByWaveNo(waveNo);
 		if (StringUtil.isEqual(outWave.getStatusCode(), OutWaveStatusEnum.FINISH.getCode())) {

+ 1 - 1
wms-core-service/src/main/resources/mybatis/mapper/outstock/outshelf/OutInventoryAllocationMapper.xml

@@ -538,7 +538,7 @@
     from out_inventory_allocation
 		where out_order_id in (
         	select out_order_id from out_wave_item  where out_wave_id=#{outWaveId}
-    	) and location_Code = #{locationCode} and barcode=#{barcode}
+    	)  and barcode=#{barcode}
   </select>
   
   <select id="countLocationCodeById" >

+ 16 - 15
wms-operate/src/main/resources/static/ui/js/outstock/outshelf/outShelf/wave.js

@@ -15,13 +15,13 @@ $("#waveNo").blur(function(){
 });
 
 // 库位号回车
-$('#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) {
@@ -72,7 +72,7 @@ function submitWaveNo(){
 			$("#customerCode").val(wave.customerCode);
 			$("#statusName").val(wave.statusName);
 			
-			$('#locationCode').focus();
+			$('#barcode').focus();
 		},
 		error : function() {
 			$.iMessager.progress('close');
@@ -129,6 +129,7 @@ function submitOutShelf() {
 		data : JSON.stringify(jsonData),
 		contentType : "application/json",
 		success : function(result) {
+			console.log(result)
 			isSubmintIng = false;
 			$.iMessager.progress('close');
 
@@ -142,14 +143,14 @@ function submitOutShelf() {
 			});
 
 			
-			refreshItems();
+			refreshItems(result.data.allocationList[0].locationCode);
 
-			if (result.data == '3') {// 订单完成下架
+			if (result.data.flag == '3') {// 订单完成下架
 				cleanAll();
 				return;
 			} else {
 				// 下一个库位  -- 拆分为下一个条码还是库位
-				nextLocationCode();
+				nextBarcode();
 			}
 		},
 		error : function() {
@@ -161,18 +162,18 @@ function submitOutShelf() {
 	});
 }
 
-function nextLocationCode() {
+function nextBarcode() {
 	// 下架完之后清空
 	$(".allowClear").each(function() {
 		$(this).val("")
 	})
-	$('#locationCode').focus();
+	$('#barcode').focus();
 }
 
 // 刷新显示已下架明细
-function refreshItems() {
+function refreshItems(locationCode) {
 	var waveNo = $("#waveNo").val();
-	var locationCode = $('#locationCode').val();
+	// var locationCode = $('#locationCode').val();
 	var barcode = $('#barcode').val();
 	var quantity = $("#productQty").val();
 

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

@@ -68,7 +68,7 @@
 					<span class="btn btn-default wd120">波次单号</span>
 				</th>
 				<th class="wd220">
-					<input type="text" class="form-control wd220" id="waveNo" placeholder="输入后请按回车">
+					<input type="text" class="form-control wd220" id="waveNo" placeholder="输入波次单号或运单号后请按回车">
 				</th>
 				<th colspan="2">
 					&nbsp;
@@ -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;">