1
0
Pārlūkot izejas kodu

xwh修改复核装箱功能

xwh 4 gadi atpakaļ
vecāks
revīzija
3f8563be51

+ 4 - 0
wms-core-service/src/main/java/com/lote/wms/outstock/boxed/dao/OutBoxedItemMapper.java

@@ -2,6 +2,8 @@ package com.lote.wms.outstock.boxed.dao;
 
 import com.lote.wms.outstock.boxed.entity.OutBoxedItem;
 import com.lote.wms.outstock.boxed.entity.OutBoxedItemCriteria;
+import org.apache.ibatis.annotations.Param;
+
 import java.util.List;
 
 public interface OutBoxedItemMapper {
@@ -18,4 +20,6 @@ public interface OutBoxedItemMapper {
     int countByCondition(OutBoxedItemCriteria condition);
 
     int updateByPrimaryKeySelective(OutBoxedItem record);
+
+    List<OutBoxedItem> selectByOutOrderNo(@Param("orderNo") String orderNo);
 }

+ 3 - 0
wms-core-service/src/main/java/com/lote/wms/outstock/boxed/dao/OutBoxedMapper.java

@@ -53,4 +53,7 @@ public interface OutBoxedMapper {
 	 */
 	List<OutBoxed> selectUnPacketByOrderId(@Param(value = "outOrderId") String outOrderId);
 
+	List<OutBoxed> selectOutBoxedByOrderId(@Param("outOrderId") String outOrderId);
+
+	List<OutBoxed> selectOutBoxedByOrderIdAndBoxNo(@Param("outOrderId") String outOrderId,@Param("boxNo") String boxNo);
 }

+ 5 - 0
wms-core-service/src/main/java/com/lote/wms/outstock/boxed/service/OutBoxedItemService.java

@@ -1,6 +1,7 @@
 package com.lote.wms.outstock.boxed.service;
 
 import java.util.List;
+import java.util.Map;
 
 import org.mybatis.plugin.model.Pager;
 
@@ -53,4 +54,8 @@ public interface OutBoxedItemService {
 	 * @return
 	 */
 	List<OutBoxedItem> listByOrderIdAndBarcode(String id, String barcode);
+
+	Message submitBarcodeByShow(OutBoxedItemQueryVo vo, User user);
+
+	Message export(Map<String, Object> map);
 }

+ 285 - 13
wms-core-service/src/main/java/com/lote/wms/outstock/boxed/service/impl/OutBoxedItemServiceImpl.java

@@ -1,10 +1,18 @@
 package com.lote.wms.outstock.boxed.service.impl;
 
-import java.util.Date;
-import java.util.List;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
 
 import javax.annotation.Resource;
 
+import com.lote.wms.common.config.SystemConfig;
+import com.lote.wms.common.utils.FileServerClient;
+import com.lote.wms.common.utils.POIExcelUtil;
+import com.lote.wms.inventory.check.entity.InventoryCheckDetail;
+import com.lote.wms.inventory.inventory.entity.Inventory;
+import com.lote.wms.outstock.order.entity.OutOrderItem;
+import org.apache.poi.ss.usermodel.Sheet;
 import org.mybatis.plugin.model.Pager;
 import org.mybatis.plugin.util.PagerUtil;
 import org.slf4j.Logger;
@@ -62,6 +70,10 @@ public class OutBoxedItemServiceImpl implements OutBoxedItemService {
 	@Resource
 	private OutOrderItemService outOrderItemService;
 
+	@Resource
+	private SystemConfig systemConfig;
+
+
 	private static final Logger logger = LoggerFactory.getLogger(OutBoxedItemServiceImpl.class);
 
 	public OutBoxedItem add(OutBoxedItem record) {
@@ -110,8 +122,8 @@ public class OutBoxedItemServiceImpl implements OutBoxedItemService {
 		message.setSuccess(false);
 		String orderId = vo.getOutOrderId();
 		String orderNo = vo.getOutOrderNo();// 也可能是跟踪单号
-		String boxId = vo.getBoxId();
-		String boxNo = vo.getBoxNo();
+//		String boxId = vo.getBoxId();
+//		String boxNo = vo.getBoxNo();
 		vo.setBarcode((vo.getBarcode()));
 		String barcode = vo.getBarcode();
 
@@ -177,14 +189,15 @@ public class OutBoxedItemServiceImpl implements OutBoxedItemService {
 			return message;
 		}
 
-		OutBoxed outBoxed = outBoxedService.get(boxId);
-		if (outBoxed == null) {
-			message.setMsg("箱子不存在,id:" + boxId + ",请重新进入装箱");
-			return message;
-		}
+		// 箱子后面称重打单的时候再添加
+//		OutBoxed outBoxed = outBoxedService.get(boxId);
+//		if (outBoxed == null) {
+//			message.setMsg("箱子不存在,id:" + boxId + ",请重新进入装箱");
+//			return message;
+//		}
 		// 更新商品数量
-		outBoxed.setQuantity(outBoxed.getQuantity() + productQty);
-		outBoxedService.update(outBoxed);
+//		outBoxed.setQuantity(outBoxed.getQuantity() + productQty);
+//		outBoxedService.update(outBoxed);
 
 		// 从下架记录表
 		OutBoxedItem boxedItem = new OutBoxedItem();
@@ -193,8 +206,15 @@ public class OutBoxedItemServiceImpl implements OutBoxedItemService {
 		boxedItem.setOutOrderNo(order.getOrderNo1());
 		boxedItem.setOutOrderId(orderId);
 
-		boxedItem.setBoxId(boxId);
-		boxedItem.setBoxNo(boxNo);
+
+		List<OutBoxed> boxedList = outBoxedService.listByOrderId(orderId);
+		// 如果称重后再取消装箱记录,就有可能没装箱就有箱子,就得提前录入
+		if (boxedList != null && boxedList.size()==1){
+			OutBoxed box = boxedList.get(0);
+			boxedItem.setBoxId(box.getId());
+			boxedItem.setBoxNo(box.getBoxNo());
+		}
+
 
 		boxedItem.setBarcode(barcode);
 		boxedItem.setSku(outShelfVo.getSku());
@@ -217,6 +237,8 @@ public class OutBoxedItemServiceImpl implements OutBoxedItemService {
 		if (isFinished) {
 			message.setMsg("出库单号:" + orderNo + ",完成装箱,请操作下一单");
 			message.setExtend(isFinished);
+			// 普通复核装箱,如果完成 创建出一个没箱号的箱子
+			initOutBoxedAndItem(order,user);
 		}
 		message.setSuccess(true);
 		return message;
@@ -292,4 +314,254 @@ public class OutBoxedItemServiceImpl implements OutBoxedItemService {
 		return list;
 	}
 
+
+
+
+	private void initOutBoxedAndItem(OutOrder order, User user){
+		List<OutBoxed> boxedList = outBoxedService.listByOrderId(order.getId());
+		if (boxedList == null || boxedList.size()==0){
+			OutBoxed box = new OutBoxed();
+			box.setId(IdWorkerAide.nextId());
+			box.setBoxNo("");
+
+			box.setCustomerId(order.getCustomerId());
+			box.setCustomerCode(order.getCustomerCode());
+
+			box.setWarehouseCode(order.getWarehouseCode());
+			box.setWarehouseId(order.getWarehouseId());
+
+			box.setOutOrderId(order.getId());
+			box.setOutOrderNo(order.getOrderNo1());
+
+			box.setShipwayCode(order.getShipwayCode());
+			box.setShipwayName(order.getShipwayName());
+
+			box.setCreatedByUserCode(user.getCode());
+			box.setCreatedByUserId(user.getId());
+			box.setCreatedTime(new Date());
+			int productQty = 0;
+			List<OutOrderItem> itemList = outOrderItemService.listByOrderId(order.getId());
+			for (OutOrderItem item : itemList) {
+				productQty += item.getQuantity();
+			}
+			box.setQuantity(productQty);
+			outBoxedService.add(box);
+
+			OutBoxedItemCriteria criteria = new OutBoxedItemCriteria();
+			criteria.setLimit(-1);
+			criteria.setOrderByClause("created_time desc");
+			Criteria cri = criteria.createCriteria();
+			cri.andOutOrderIdEqualTo(order.getId());
+			List<OutBoxedItem> list = outBoxedItemMapper.selectByConditionList(criteria);
+			for (OutBoxedItem outBoxedItem : list) {
+				outBoxedItem.setBoxId(box.getId());
+				update(outBoxedItem);
+			}
+		}
+
+
+	}
+
+	@Override
+	public Message submitBarcodeByShow(OutBoxedItemQueryVo vo, User user) {
+		Message message = new Message();
+		message.setSuccess(false);
+		String orderId = vo.getOutOrderId();
+		String orderNo = vo.getOutOrderNo();// 也可能是跟踪单号
+		String boxId = vo.getBoxId();
+		String boxNo = vo.getBoxNo();
+		vo.setBarcode((vo.getBarcode()));
+		String barcode = vo.getBarcode();
+
+		Integer productQty = vo.getProductQty();
+
+		if (productQty < 1) {
+			message.setMsg("装箱数量必须大于等于1");
+			return message;
+		}
+		if (StringUtil.isEmpty(orderNo)) {
+			message.setMsg("出库单号不能为空");
+			return message;
+		}
+		OutOrder order = outOrderService.get(orderId);
+		if (order == null) {
+			message.setMsg("订单id不存在,请重新扫描提交出库单号");
+			return message;
+		}
+
+		if (StringUtil.isEqual(order.getIsHoldUp(), BaseConstant.Y)) {
+			message.setMsg("出库单已拦截,不可装箱");
+
+			outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_BOXED, null, message.getMsg(), false);
+			return message;
+		}
+		if (StringUtil.isEqual(order.getStatusCode(), OutOrderStatusEnum.CANCELED.getCode())
+				|| StringUtil.isEqual(order.getIsCancel(), BaseConstant.Y)) {
+			message.setMsg("出库单已取消,不可装箱");
+
+			outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_BOXED, null, message.getMsg(), false);
+			return message;
+		}
+
+		Integer sumOrderItemQty = outOrderItemService.sumQtyByOrderId(orderId);
+		Integer sumOutShelfQty = outShelfService.sumQtyByOrderId(orderId);
+		if (sumOutShelfQty > sumOrderItemQty) {
+			message.setMsg("该订单下架商品总数量超过订单预报商品总数量,请联系技术并提供订单号");
+			return message;
+		}
+
+		// 验证条码
+		OutShelfResultVo outShelfVo = outShelfService.getForOutBox(orderId, barcode);
+		if (outShelfVo == null) {
+			message.setMsg("出库单号:" + orderNo + ",条码:" + barcode + "无下架记录");
+
+			outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_BOXED, null, message.getMsg(), false);
+			return message;
+		}
+
+		// 待装箱数量
+		int waitBoxQty = outShelfVo.getTotalQty() - outShelfVo.getBoxedQty();
+		if (waitBoxQty <= 0) {
+			// 如果已装箱 已经大于待装箱...
+			message.setMsg("出库单号:" + orderNo + ",条码:" + barcode + "待装箱数量为:" + waitBoxQty + ",请删除装箱记录,重新装箱");
+			outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_BOXED, null, message.getMsg(), false);
+			return message;
+		}
+
+		if (productQty > waitBoxQty) {// 提交下架数量大于已装箱数量
+			message.setMsg("出库单号:" + orderNo + ",条码:" + barcode + "待装箱数量为:" + waitBoxQty);
+
+			outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_BOXED, null, message.getMsg(), false);
+			return message;
+		}
+
+		OutBoxed outBoxed = outBoxedService.get(boxId);
+		if (outBoxed == null) {
+			message.setMsg("箱子不存在,id:" + boxId + ",请重新进入装箱");
+			return message;
+		}
+		// 更新商品数量
+		outBoxed.setQuantity(outBoxed.getQuantity() + productQty);
+		outBoxedService.update(outBoxed);
+
+		// 从下架记录表
+		OutBoxedItem boxedItem = new OutBoxedItem();
+		boxedItem.setId(IdWorkerAide.nextId());
+
+		boxedItem.setOutOrderNo(order.getOrderNo1());
+		boxedItem.setOutOrderId(orderId);
+
+		boxedItem.setBoxId(boxId);
+		boxedItem.setBoxNo(boxNo);
+
+		boxedItem.setBarcode(barcode);
+		boxedItem.setSku(outShelfVo.getSku());
+		boxedItem.setQuantity(productQty);
+
+		boxedItem.setQualityName(outShelfVo.getQualityName());
+		boxedItem.setQualityCode(outShelfVo.getQualityCode());
+		boxedItem.setBatchNo(outShelfVo.getBatchNo());
+
+		boxedItem.setCreatedByUserCode(user.getCode());
+		boxedItem.setCreatedByUserId(user.getId());
+		boxedItem.setCreatedTime(new Date());
+		add(boxedItem);
+
+		message.setMsg("装箱成功,条码:" + barcode + ",数量:" + productQty);
+		outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_BOXED, null, message.getMsg(), true);
+
+		// 处理订单状态更新
+		boolean isFinished = handleStatus(order, user);
+		if (isFinished) {
+			message.setMsg("出库单号:" + orderNo + ",完成装箱,请点击重置按钮操作下一单或导出复核装箱明细");
+			message.setExtend(isFinished);
+		}
+		message.setSuccess(true);
+		return message;
+	}
+
+	@Override
+	public Message export(Map<String, Object> map) {
+		String orderNo = (String) map.get("outOrderNo");
+		Message selectOrder = outOrderService.selectByNo(orderNo);
+		if (!selectOrder.isSuccess()) {
+			return selectOrder;
+		}
+
+		OutOrder order = (OutOrder) selectOrder.getExtend();
+		// 只有装箱完成的才可以导出
+		if (!StringUtil.isEquals(order.getStatusCode(), OutOrderStatusEnum.BOXCOMPLETE.getCode())) {
+			return Message.fail("只有已装箱的订单可以操作导出!");
+		}
+		String headCnStrList[] = new String[] { "序号", "出库单号", "货主代码", "仓库代码", "出库类型", "运输方式", "跟踪单号", "箱号", "sku",
+				"商品条码","批次号","品质等级名称","商品数量","创建时间" };
+		Sheet sheet = null;
+		List<String> headCnList = Arrays.asList(headCnStrList);
+		try {
+			sheet = POIExcelUtil.createSheet("复核装箱明细", headCnList);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+
+		List<OutBoxedItem> outBoxedItemList = outBoxedItemMapper.selectByOutOrderNo(order.getOrderNo1());
+		if (Objects.isNull(outBoxedItemList) || outBoxedItemList.size()==0){
+			return Message.fail("该出库单无明细");
+		}
+
+		// 转换成行
+		List<String[]> row = parseRow(outBoxedItemList,order, headCnList);
+		// 保存到excel中
+		POIExcelUtil.addRows(sheet, row);
+
+
+		// 保存到临时文件返回路径 TODO
+		try {
+			// 随机生成文件
+			String fileName = UUID.randomUUID().toString() + ".xlsx";
+			File tempFile = new File(systemConfig.getRuntimeFileDir() + "/outstock/");
+			if (!tempFile.exists()) {
+				tempFile.mkdirs();
+			}
+			String fileNameAndPath = systemConfig.getRuntimeFileDir() + "/outstock/" + fileName;
+			POIExcelUtil.saveToFile(sheet, fileNameAndPath);
+
+			// 上传文件服务器
+			String downUrl = FileServerClient.fileUpload(systemConfig.getFileServerUrl(), fileNameAndPath);
+			return Message.success(downUrl);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return Message.fail("系统异常,请稍后重试!");
+
+	}
+
+	private List<String[]> parseRow(List<OutBoxedItem> outBoxedItemList, OutOrder order, List<String> headCnList) {
+		List<String[]> rows = new ArrayList<>();
+		int number=1;
+		//String headCnStrList[] = new String[] { "序号", "出库单号", "货主代码", "仓库代码", "出库类型", "运输方式", "跟踪单号", "箱号", "sku",
+		//				"商品条码","批次号","品质等级名称","商品数量","创建时间" };
+		for (OutBoxedItem outBoxedItem : outBoxedItemList) {
+			String[] row = new String[headCnList.size()];
+			row[0] = String.valueOf(number++);
+			row[1] = order.getOrderNo1();
+			row[2] = order.getCustomerCode();
+			row[3] = order.getWarehouseCode();
+			row[4] = order.getTypeName();
+			row[5] = order.getShipwayName();
+			row[6] = order.getTrackingNo1();
+			row[7] = outBoxedItem.getBoxNo();
+			row[8] = outBoxedItem.getSku();
+			row[9] = outBoxedItem.getBarcode();
+			row[10] = outBoxedItem.getBatchNo();
+			row[11] = outBoxedItem.getQualityName();
+			row[12] = outBoxedItem.getQuantity().toString();
+			row[13] = outBoxedItem.getCreatedTime().toString();
+			rows.add(row);
+		}
+		return rows;
+	}
+
+
 }

+ 32 - 17
wms-core-service/src/main/java/com/lote/wms/outstock/boxed/service/impl/OutBoxedServiceImpl.java

@@ -11,6 +11,7 @@ import com.lote.wms.outstock.boxed.dao.OutBoxedMapper;
 import com.lote.wms.outstock.boxed.entity.OutBoxed;
 import com.lote.wms.outstock.boxed.entity.OutBoxedCriteria;
 import com.lote.wms.outstock.boxed.entity.OutBoxedCriteria.Criteria;
+import com.lote.wms.outstock.boxed.entity.OutBoxedItem;
 import com.lote.wms.outstock.boxed.entity.queryvo.OutBoxedQueryVo;
 import com.lote.wms.outstock.boxed.service.OutBoxedItemService;
 import com.lote.wms.outstock.boxed.service.OutBoxedService;
@@ -281,10 +282,10 @@ public class OutBoxedServiceImpl implements OutBoxedService {
 			message.setMsg("箱号不能为空");
 			return message;
 		}
-		if (StringUtil.isEmpty(boxId)) {
-			message.setMsg("箱子id不能为空,请先在箱子号码输入框按回车提交箱号");
-			return message;
-		}
+//		if (StringUtil.isEmpty(boxId)) {
+//			message.setMsg("箱子id不能为空,请先在箱子号码输入框按回车提交箱号");
+//			return message;
+//		}
 		OutOrder order = outOrderService.get(orderId);
 		if (order == null) {
 			message.setMsg("订单id不存在,请先在出库单号输入框按回车提交订单号");
@@ -312,22 +313,36 @@ public class OutBoxedServiceImpl implements OutBoxedService {
 			return message;
 		}
 		// 验证箱子
-		OutBoxed outBoxed = get(boxId);
-		if (outBoxed == null) {
-			message.setMsg("箱子id不存在,请先输入正确箱号在箱号输入框按回车");
+		List<OutBoxed> outBoxedList = outBoxedMapper.selectOutBoxedByOrderIdAndBoxNo(vo.getOutOrderId(),vo.getBoxNo());
+		if (outBoxedList != null &&outBoxedList.size()>0) {
+			for (OutBoxed outBoxed : outBoxedList) {
+				outBoxed.setBoxNo(vo.getBoxNo());
+				// 更新箱子重量
+				outBoxed.setRealWeight(realWeight);
+				outBoxed.setWeighTime(new Date());
+				outBoxed.setWeighByUserCode(user.getCode());
+				outBoxed.setVolumeWeight(volumeWeight);
+				outBoxed.setBillingWeight(billingWeight);
+				outBoxed.setLength(length);
+				outBoxed.setWidth(width);
+				outBoxed.setHeight(height);
+				update(outBoxed);
+
+				// 更新箱子明细里的箱号
+				List<OutBoxedItem> outBoxedItemList = outBoxedItemService.listByBoxId(outBoxed.getId());
+				if (outBoxedItemList!=null && outBoxedItemList.size()>0){
+					for (OutBoxedItem outBoxedItem : outBoxedItemList) {
+						outBoxedItem.setBoxNo(outBoxed.getBoxNo());
+						outBoxedItemService.update(outBoxedItem);
+					}
+				}
+			}
+		}else{
+			message.setMsg("箱子未初始化,请先复核装箱");
 			return message;
 		}
 
-		// 更新箱子重量
-		outBoxed.setRealWeight(realWeight);
-		outBoxed.setWeighTime(new Date());
-		outBoxed.setWeighByUserCode(user.getCode());
-		outBoxed.setVolumeWeight(volumeWeight);
-		outBoxed.setBillingWeight(billingWeight);
-		outBoxed.setLength(length);
-		outBoxed.setWidth(width);
-		outBoxed.setHeight(height);
-		update(outBoxed);
+
 
 		String msg = "箱号:" + boxNo + ",实重:" + realWeight;
 		outOrderLogService.addLog(order, user, OutOrderOpTypeEnum.OUT_WEIGH, null, msg, true);

+ 9 - 3
wms-core-service/src/main/resources/mybatis/mapper/outstock/boxed/OutBoxedItemMapper.xml

@@ -49,8 +49,8 @@
     </where>
   </sql>
   <sql id="Base_Column_List" >
-    id, box_id, box_no, out_order_id, out_order_no, sku, barcode, batch_no, quality_code, 
-    quality_name, quantity, created_time, created_by_user_id, created_by_user_code, extend1, 
+    id, box_id as boxId, box_no as boxNo, out_order_id as outOrderId, out_order_no as outOrderNo, sku, barcode, batch_no as batchNo, quality_code as qualityCode,
+    quality_name as qualityName, quantity, created_time as createdTime, created_by_user_id as createdByUserId, created_by_user_code as createdByUserCode, extend1,
     extend2
   </sql>
   <select id="selectByConditionList" resultMap="BaseResultMap" parameterType="com.lote.wms.outstock.boxed.entity.OutBoxedItemCriteria" >
@@ -195,7 +195,13 @@
       <include refid="Condition_Where_Clause" />
     </if>
   </select>
-  <update id="updateByPrimaryKeySelective" parameterType="com.lote.wms.outstock.boxed.entity.OutBoxedItem" >
+    <select id="selectByOutOrderNo" resultType="com.lote.wms.outstock.boxed.entity.OutBoxedItem">
+
+    select
+      <include refid="Base_Column_List" />
+     from out_boxed_item where out_order_no=#{orderNo};
+    </select>
+    <update id="updateByPrimaryKeySelective" parameterType="com.lote.wms.outstock.boxed.entity.OutBoxedItem" >
     update out_boxed_item
     <set >
       <if test="boxId != null" >

+ 13 - 0
wms-core-service/src/main/resources/mybatis/mapper/outstock/boxed/OutBoxedMapper.xml

@@ -412,4 +412,17 @@
     	and out_order_id = #{outOrderId} 
     	and (packet_no is null or packet_no ='')
   </select>
+  <select id="selectOutBoxedByOrderId" resultType="com.lote.wms.outstock.boxed.entity.OutBoxed">
+    select
+    <include refid="Base_Column_List" />
+    from out_boxed where
+     out_order_id = #{outOrderId}
+  </select>
+    <select id="selectOutBoxedByOrderIdAndBoxNo" resultType="com.lote.wms.outstock.boxed.entity.OutBoxed">
+      select
+      <include refid="Base_Column_List" />
+      from out_boxed where
+      out_order_id = #{outOrderId}
+      and (box_no=#{boxNo} or box_no='')
+    </select>
 </mapper>

+ 1 - 1
wms-operate/src/main/java/com/lote/wms/controller/operate/base/product/ProductBarcodeController.java

@@ -169,7 +169,7 @@ public class ProductBarcodeController extends AbstractController {
 	/**
 	 * 更新商品条码
 	 * 
-	 * @param product
+	 * @param productBarcode
 	 * @return
 	 */
 	@RequestMapping(value = "/upd")

+ 29 - 4
wms-operate/src/main/java/com/lote/wms/controller/operate/outstock/boxed/OutBoxedItemController.java

@@ -11,13 +11,11 @@ import com.lote.wms.outstock.boxed.service.OutBoxedItemService;
 import com.lote.wms.user.user.entity.User;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Map;
 
 @RequestMapping("/outstock/boxedItem")
 @RestController
@@ -64,4 +62,31 @@ public class OutBoxedItemController extends AbstractController {
 		return MessageToResultAdapt.toResult(message);
 	}
 
+
+	/**
+	 * 出库装箱界面(展示出区版本)
+	 *
+	 * 提交条码 装箱
+	 *
+	 * @param orderNo
+	 * @return
+	 */
+	@RequestMapping(value = "/submitBarcodeByShow", method = RequestMethod.POST)
+	public Result submitBarcodeByShow(@RequestBody OutBoxedItemQueryVo vo) {
+		Message message = outBoxedItemService.submitBarcodeByShow(vo, getUser());
+		return MessageToResultAdapt.toResult(message);
+	}
+
+
+	/**
+	 * 展示出区符合装箱导出
+	 * @param map
+	 * @return
+	 */
+	@ResponseBody
+	@RequestMapping("export")
+	public Result export(@RequestBody Map<String,Object> map) {
+		return MessageToResultAdapt.toResult(outBoxedItemService.export(map));
+	}
+
 }

+ 2 - 1
wms-operate/src/main/java/com/lote/wms/controller/operate/outstock/boxed/OutWeighController.java

@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @RequestMapping("/outstock/weigh")
 @RestController
@@ -56,7 +57,7 @@ public class OutWeighController extends AbstractController {
 	@RequestMapping("getByOrderIdAndBoxNo")
 	@ResponseBody
 	public Result getByOrderIdAndBoxNo(@RequestBody OutBoxed param) {
-		OutBoxed outBoxed = outBoxedService.getByOrderIdAndBoxNo(param);
+		List<OutBoxed> outBoxed = outBoxedService.listByOrderId(param.getOutOrderId());
 		if (outBoxed != null) {
 			return Result.success(outBoxed);
 		}

+ 24 - 23
wms-operate/src/main/resources/static/ui/js/outstock/boxed/outBoxed/main.js

@@ -106,7 +106,7 @@ function submitOutOrderNo(){
         	refreshItems();
         	
         	//进入箱子操作
-        	nextBox();
+			nextBarcode();
         },
         error: function () {
         	$.iMessager.alert('注意', '网络断开或服务器发生异常', 'messager-warning');
@@ -163,27 +163,27 @@ function submitBarcode(){
 	
 	 var outOrderNo = $('#outOrderNo').val();
 	 var outOrderId = $('#outOrderId').val();
-	 var boxNo = $('#boxNo').val();
-	 var boxId = $('#boxId').val();
-	 var boxNo_hide = $("#boxNo_hide").val();
+	 // var boxNo = $('#boxNo').val();
+	 // var boxId = $('#boxId').val();
+	 // var boxNo_hide = $("#boxNo_hide").val();
 	 var barcode = $("#barcode").val();
 	 var productQty = $("#productQty").val();
 	 
-	 if(boxNo==''){
-		 isSubmintIng = false;
-		 $.iMessager.alert('注意', '箱号不能为空', 'messager-warning');
-		 return;
-	 }
-	 if(boxId==''){
-		 isSubmintIng = false;
-		 $.iMessager.alert('注意', '请先在箱号输入框按回车提交箱号', 'messager-warning');
-		 return;
-	 }
-	 if(boxNo != boxNo_hide){
-		 isSubmintIng = false;
-		 $.iMessager.alert('注意', '请先在箱号输入框按回车提交箱号', 'messager-warning');
-		 return;
-	 }
+	 // if(boxNo==''){
+		//  isSubmintIng = false;
+		//  $.iMessager.alert('注意', '箱号不能为空', 'messager-warning');
+		//  return;
+	 // }
+	 // if(boxId==''){
+		//  isSubmintIng = false;
+		//  $.iMessager.alert('注意', '请先在箱号输入框按回车提交箱号', 'messager-warning');
+		//  return;
+	 // }
+	 // if(boxNo != boxNo_hide){
+		//  isSubmintIng = false;
+		//  $.iMessager.alert('注意', '请先在箱号输入框按回车提交箱号', 'messager-warning');
+		//  return;
+	 // }
 	 if(productQty==''){
 		 isSubmintIng = false;
 		 $.iMessager.alert('注意', '商品数量不能为空', 'messager-warning');
@@ -200,7 +200,8 @@ function submitBarcode(){
 		 return;
 	 }
 	 
-	 var formData = {outOrderId:outOrderId,outOrderNo:outOrderNo,boxNo:boxNo,boxId:boxId,barcode:barcode,productQty:productQty};
+	 // var formData = {outOrderId:outOrderId,outOrderNo:outOrderNo,boxNo:boxNo,boxId:boxId,barcode:barcode,productQty:productQty};
+	var formData = {outOrderId:outOrderId,outOrderNo:outOrderNo,barcode:barcode,productQty:productQty};
 	 $.iMessager.progress({text: '正在提交中....'});
 	 $.ajax({
         type: 'POST',
@@ -313,9 +314,9 @@ function cleanAll(){
 	$("#warehouseCode").val("");
 	$("#statusName").val("");
 	
-	$("#boxNo").val("");
-	$("#boxId").val("");
-	
+	// $("#boxNo").val("");
+	// $("#boxId").val("");
+	//
 	$("#barcode").val("");
 	$("#productQty").val("1");
 	

+ 33 - 2
wms-operate/src/main/resources/static/ui/js/outstock/boxed/showOutBoxed/main.js

@@ -204,7 +204,7 @@ function submitBarcode(){
 	 $.iMessager.progress({text: '正在提交中....'});
 	 $.ajax({
         type: 'POST',
-        url: '/outstock/boxedItem/submitBarcode',
+        url: '/outstock/boxedItem/submitBarcodeByShow',
         contentType: "application/json; charset=utf-8",
         data: JSON.stringify(formData),
         success: function (result) {
@@ -219,7 +219,8 @@ function submitBarcode(){
         	
         	if(result.data){//完成装箱
         		//下一个订单
-        		cleanAll();
+        		// cleanAll();
+				exportDetail();
         		return;
         	}
         	
@@ -325,6 +326,36 @@ function cleanAll(){
 	$("#outOrderNo").focus();
 }
 
+//导出复核装箱明细
+function exportDetail(){
+
+	var outOrderNo = $('#outOrderNo').val();
+	if(outOrderNo=='' || outOrderNo==null){
+		$.iMessager.alert('注意', '订单号不能为空', 'messager-warning');
+		return
+	}
+	var exportDataStr = JSON.stringify({outOrderNo:outOrderNo});
+	$.iMessager.progress({text: '正在导出中....'});
+	//执行下载
+	$.ajax({
+		method:"POST",
+		url: "/outstock/boxedItem/export",
+		data: exportDataStr,
+		dataType:"json",
+		contentType:"application/json",
+		success: function(result){
+			$.iMessager.progress('close');
+			if(result.code !=0 ){// 如果result不是成功
+				$.iMessager.alert('操作提示', result.msg, 'messager-info');
+				return;
+			}
+
+			$.iMessager.show({title: '温馨提示',msg:'正在下载文件:'+ result.msg,timeout:4000}); // 右下角提示信息
+			window.open(result.msg)
+		}
+	});
+}
+
 //生成箱子号码
 function genBoxNo(){
 	//获取完整的日期  

+ 19 - 19
wms-operate/src/main/resources/static/ui/views/outstock/boxed/outBoxed/main.html

@@ -112,25 +112,25 @@
 			</tr>
 		</table>
 
-		<div class="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" id="boxNo" placeholder="输入后请按回车,建议编号1,2,3.." >
-					<input type="text" class="form-control wd220" id="boxNo_hide" style="display: none;" >
-					<input type="text" id="boxId" style="display: none;">
-				</th>
+<!--		<div class="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" id="boxNo" placeholder="输入后请按回车,建议编号1,2,3.." >-->
+<!--					<input type="text" class="form-control wd220" id="boxNo_hide" style="display: none;" >-->
+<!--					<input type="text" id="boxId" style="display: none;">-->
+<!--				</th>-->
 
-				<th colspan="2" style="width:340px;">
-					<div class="wd120" style="font-size: 5mm; font-family: Tahoma;display: inline-block;line-height: 30px;">
-						<input class="mycheckbox" type="checkbox" style="" onchange="saveCheckBox('autoNextBox')" id="autoNextBox" checked>自动生成
-					</div>
-				</th>
-			</tr>
-		</table>
+<!--				<th colspan="2" style="width:340px;">-->
+<!--					<div class="wd120" style="font-size: 5mm; font-family: Tahoma;display: inline-block;line-height: 30px;">-->
+<!--						<input class="mycheckbox" type="checkbox" style="" onchange="saveCheckBox('autoNextBox')" id="autoNextBox" checked>自动生成-->
+<!--					</div>-->
+<!--				</th>-->
+<!--			</tr>-->
+<!--		</table>-->
 
 		<div class="badge badge-success" style="width:120px;font-weight: bold; color: white;background-color: #669533;margin-top:-10px;">3扫描商品</div>
 		<table class="table wd750" style="margin-top: 0px;padding-bottom: 0px;">
@@ -167,7 +167,7 @@
 			<table  class="table"  style="margin-top: 0px;margin-left:8px;width:734px; height: auto;" rules="all" border="1px" >
 	 			<thead>
 	 				<tr>
-	 					<th colspan="5" style="color: red;font-weight: bold;font-size: 7pt;text-align: left;height:7px;line-height:7px">下架商品的复核装箱情况</th>
+	 					<th colspan="6" style="color: red;font-weight: bold;font-size: 7pt;text-align: left;height:7px;line-height:7px">下架商品的复核装箱情况</th>
 	 				</tr>
 					<tr style="height: 8px;">
 		 				<th><div style="text-align: left;font-size: 8pt;width:140px;height: 8px;line-height: 8px">商品SKU</div></th>

+ 3 - 0
wms-operate/src/main/resources/static/ui/views/outstock/boxed/showOutBoxed/main.html

@@ -193,6 +193,9 @@
 					<a class="btn  btn-danger"  style="cursor:pointer;" onclick="cleanAll()">
 						<i class="fa fa-times">&nbsp;</i>重置
 					</a>
+					<a class="btn  btn-success" style="cursor:pointer;" onclick="exportDetail()">
+						<i class="fa fa-download">&nbsp;</i>导出
+					</a>
 				</th>
 			</tr>
 		</table>