|
|
|
@ -10,6 +10,7 @@ import com.gaotao.modules.trans.service.TransDetailService; |
|
|
|
import com.gaotao.modules.trans.service.TransDetailSubService; |
|
|
|
import com.gaotao.modules.trans.service.TransHeaderService; |
|
|
|
import com.gaotao.modules.trans.service.TransNoControlService; |
|
|
|
import com.gaotao.modules.wms.dao.WmsPrintDao; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -49,6 +50,9 @@ public class LabelSplitMergeServiceImpl extends ServiceImpl<LabelSplitMergeMappe |
|
|
|
@Autowired |
|
|
|
private TransDetailSubService transDetailSubService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WmsPrintDao wmsPrintDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> getStockInfoByLabelCode(String labelCode, String site, String warehouseId) { |
|
|
|
logger.info("根据标签条码获取库存信息,标签条码: {}, 站点: {}, 仓库: {}", labelCode, site, warehouseId); |
|
|
|
@ -148,11 +152,34 @@ public class LabelSplitMergeServiceImpl extends ServiceImpl<LabelSplitMergeMappe |
|
|
|
// 5. 生成标签变动事务记录 |
|
|
|
generateSplitTransaction(site, buNo, warehouseId, originalLabelCode, newLabelCode, partNo, batchNo, splitQuantity, remainingQuantity, locationId); |
|
|
|
|
|
|
|
// 6. 获取打印参数列表(拆分需要打印两张标签:原标签和新标签) |
|
|
|
List<Map<String, Object>> printList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
// 原标签打印参数 |
|
|
|
Map<String, Object> printData1 = wmsPrintDao.callUspPartLabelTemplate( |
|
|
|
site, buNo, "*", "", "", "", partNo, "", originalLabelCode |
|
|
|
); |
|
|
|
if (printData1 != null) { |
|
|
|
printList.add(printData1); |
|
|
|
} |
|
|
|
|
|
|
|
// 新标签打印参数 |
|
|
|
Map<String, Object> printData2 = wmsPrintDao.callUspPartLabelTemplate( |
|
|
|
site, buNo, "*", "", "", "", partNo, "", newLabelCode |
|
|
|
); |
|
|
|
if (printData2 != null) { |
|
|
|
printList.add(printData2); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.warn("获取打印参数失败,不影响拆分操作", e); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("newLabelCode", newLabelCode); |
|
|
|
result.put("originalQuantity", originalQuantity); |
|
|
|
result.put("splitQuantity", splitQuantity); |
|
|
|
result.put("remainingQuantity", remainingQuantity); |
|
|
|
result.put("printList", printList); |
|
|
|
|
|
|
|
logger.info("标签拆分成功,原标签: {}, 新标签: {}, 拆分数量: {}", originalLabelCode, newLabelCode, splitQuantity); |
|
|
|
return result; |
|
|
|
@ -165,7 +192,7 @@ public class LabelSplitMergeServiceImpl extends ServiceImpl<LabelSplitMergeMappe |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public boolean mergeLabel(Map<String, Object> params) { |
|
|
|
public Map<String, Object> mergeLabel(Map<String, Object> params) { |
|
|
|
logger.info("开始标签合并,参数: {}", params); |
|
|
|
|
|
|
|
try { |
|
|
|
@ -215,8 +242,28 @@ public class LabelSplitMergeServiceImpl extends ServiceImpl<LabelSplitMergeMappe |
|
|
|
// 4. 生成标签变动事务记录 |
|
|
|
generateMergeTransaction(site, buNo, warehouseId, sourceLabelCode, targetLabelCode, partNo, batchNo, sourceQuantity, targetQuantity, mergedQuantity, locationId); |
|
|
|
|
|
|
|
// 5. 获取打印参数(合并只需要打印一张标签:源标签/合并后的标签) |
|
|
|
List<Map<String, Object>> printList = new ArrayList<>(); |
|
|
|
try { |
|
|
|
Map<String, Object> printData = wmsPrintDao.callUspPartLabelTemplate( |
|
|
|
site, buNo, "*", "", "", "", partNo, "", sourceLabelCode |
|
|
|
); |
|
|
|
if (printData != null) { |
|
|
|
printList.add(printData); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.warn("获取打印参数失败,不影响合并操作", e); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
result.put("success", true); |
|
|
|
result.put("sourceLabelCode", sourceLabelCode); |
|
|
|
result.put("targetLabelCode", targetLabelCode); |
|
|
|
result.put("mergedQuantity", mergedQuantity); |
|
|
|
result.put("printList", printList); |
|
|
|
|
|
|
|
logger.info("标签合并成功,源标签: {}, 目标标签: {}, 合并数量: {}", sourceLabelCode, targetLabelCode, sourceQuantity); |
|
|
|
return true; |
|
|
|
return result; |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("标签合并失败", e); |
|
|
|
|