Browse Source

2025-12-23

pda其他入库提交时调用打印
master
fengyuan_yang 3 weeks ago
parent
commit
0b5cc1b9a6
  1. 10
      src/main/java/com/gaotao/modules/otherInbound/controller/OtherInboundController.java
  2. 4
      src/main/java/com/gaotao/modules/otherInbound/service/OtherInboundService.java
  3. 50
      src/main/java/com/gaotao/modules/otherInbound/service/impl/OtherInboundServiceImpl.java
  4. 9
      src/main/resources/mapper/base/BaseMapper.xml
  5. 2
      src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml

10
src/main/java/com/gaotao/modules/otherInbound/controller/OtherInboundController.java

@ -202,6 +202,7 @@ public class OtherInboundController extends AbstractController {
* 2. 更改inbound_notification_head状态入库状态已入库
* 3. 将inventory_stock表中的标签状态改为"在库"数量=实际入库数量
* 4. 生成入库事务记录
* 5. 返回打印参数列表每个标签调用UspPartLabelTemplate获取
*/
@PostMapping("/confirmOtherInbound")
@ApiOperation("确认其他入库")
@ -226,11 +227,12 @@ public class OtherInboundController extends AbstractController {
// 获取当前登录用户
String userName = getUser().getUsername();
// 调用存储过程GetSaveLabelVerification
boolean success = otherInboundService.confirmOtherInboundByProcedure(site, buNo, inboundNo, locationCode, documentType, userName);
// 调用存储过程GetSaveLabelVerification返回包含打印数据的结果
Map<String, Object> result = otherInboundService.confirmOtherInboundByProcedure(site, buNo, inboundNo, locationCode, documentType, userName);
if (success) {
return R.ok("入库成功");
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return R.ok("入库成功").put("printList", result.get("printList"));
} else {
return R.error("入库失败");
}

4
src/main/java/com/gaotao/modules/otherInbound/service/OtherInboundService.java

@ -79,9 +79,9 @@ public interface OtherInboundService {
* @param locationCode 库位号
* @param documentType 单据类型
* @param userName 当前登录用户
* @return 处理结果
* @return 处理结果包含success和printList
*/
boolean confirmOtherInboundByProcedure(String site, String buNo, String inboundNo,
Map<String, Object> confirmOtherInboundByProcedure(String site, String buNo, String inboundNo,
String locationCode, String documentType, String userName);
/**

50
src/main/java/com/gaotao/modules/otherInbound/service/impl/OtherInboundServiceImpl.java

@ -13,6 +13,7 @@ import com.gaotao.modules.trans.entity.*;
import com.gaotao.modules.trans.service.*;
import com.gaotao.modules.trans.service.TransNoControlService;
import com.gaotao.modules.erp.service.ErpInterfaceService;
import com.gaotao.modules.wms.dao.WmsPrintDao;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -65,6 +66,9 @@ public class OtherInboundServiceImpl implements OtherInboundService {
@Autowired
private ErpInterfaceService erpInterfaceService;
@Autowired
private WmsPrintDao wmsPrintDao;
@Override
public void validateLabelWithOtherInbound(String site, String buNo, String inboundNo, String materialCode,
Double actualQty, String batchNo, String warehouseId,
@ -140,12 +144,17 @@ public class OtherInboundServiceImpl implements OtherInboundService {
@Override
@Transactional(rollbackFor = Exception.class)
public boolean confirmOtherInboundByProcedure(String site, String buNo, String inboundNo,
public Map<String, Object> confirmOtherInboundByProcedure(String site, String buNo, String inboundNo,
String locationCode, String documentType, String userName) {
logger.info("调用GetSaveLabelVerification存储过程确认入库,站点: {}, 入库单: {}, 库位: {}, 单据类型: {}, 用户: {}",
site, inboundNo, locationCode, documentType, userName);
Map<String, Object> returnResult = new HashMap<>();
try {
// 先获取已扫描标签列表用于打印
List<Map<String, Object>> scannedLabels = getScannedLabelList(site, buNo, inboundNo, documentType);
// 调用存储过程 GetSaveLabelVerification参考采购入库功能
// 10个参数
List<Object> params = new ArrayList<>();
@ -177,7 +186,44 @@ public class OtherInboundServiceImpl implements OtherInboundService {
}
logger.info("GetSaveLabelVerification存储过程调用成功,入库单: {}", inboundNo);
return true;
// 获取打印参数
List<Map<String, Object>> printList = new ArrayList<>();
if (scannedLabels != null && !scannedLabels.isEmpty()) {
for (Map<String, Object> label : scannedLabels) {
try {
String rollNo = (String) label.get("labelCode");
String materialCode = (String) label.get("materialCode");
// 调用存储过程UspPartLabelTemplate获取打印参数
Map<String, Object> printData = wmsPrintDao.callUspPartLabelTemplate(
site, // site
buNo, // buNo
"*", // menuID - PDA功能传 "*"
"", // relatedOrderNo - 关联单号
"", // relatedOrderLineNo - 关联单号行号传空字符串
inboundNo, // documentNo - 入库单号
materialCode, // PartNo - 物料编码
"", // LabelNo - 标签模版编码传空字符串由存储过程返回
rollNo // RollNo - 标签条码
);
if (printData != null) {
printList.add(printData);
logger.info("获取标签 {} 的打印参数成功", rollNo);
} else {
logger.warn("获取标签 {} 的打印参数失败,跳过", rollNo);
}
} catch (Exception e) {
logger.warn("获取标签打印参数失败: {}", e.getMessage());
}
}
}
returnResult.put("success", true);
returnResult.put("printList", printList);
return returnResult;
} catch (Exception e) {
logger.error("调用GetSaveLabelVerification存储过程失败,入库单: {}", inboundNo, e);
throw new RuntimeException(e.getMessage(), e);

9
src/main/resources/mapper/base/BaseMapper.xml

@ -1994,9 +1994,14 @@
<!--查询标签的客制化配置信息-->
<select id="getUserLabelPrinters" parameterType="UserLabelPrinterData" resultType="UserLabelPrinterData">
SELECT rfp.UserID userId, ssu.user_display userDisplay, rfp.ReportID labelNo, rfl.Reportfile labelName,
SELECT
rfp.UserID userId,
ssu.user_display userDisplay,
rfp.ReportID labelNo,
rfl.Reportfile labelName,
rfl.ReportType labelClass,
rfp.NewPrinterName printerName, rfp.IPAddress ipAddress
rfp.NewPrinterName printerName,
rfp.IPAddress ipAddress
FROM ReportFileList_UserPrinter rfp
LEFT JOIN sys_user ssu ON ssu.username = rfp.UserID
LEFT JOIN ReportFileList rfl ON rfl.ReportID = rfp.ReportID

2
src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml

@ -79,7 +79,7 @@
)
</if>
</where>
ORDER BY a.created_date DESC;
ORDER BY a.created_date DESC
</select>
<insert id="saveOutboundNotification" parameterType="com.gaotao.modules.outboundNotification.entity.vo.OutboundNotificationHeadVo">

Loading…
Cancel
Save