库存条码查询添加打印以及拆批、合批、采购到货拆批打印增加供应商批次和生产日期
This commit is contained in:
parent
97c2a7ae28
commit
cd644f9f27
@ -38,7 +38,6 @@ public class BarCodeQueryController {
|
||||
@GetMapping("/labelPrint")
|
||||
public R labelRePrint(String inventoryId, String printer, boolean isSecrecy) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
|
||||
return R.ok(/*barCodeQueryService.labelPrint(site, inventoryDto.getInventoryId(), inventoryDto.getPrinter())*/);
|
||||
return R.ok(barCodeQueryService.labelPrint(site, inventoryId, printer, isSecrecy));
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.iep.smd.entity.FabBasis;
|
||||
import com.foreverwin.iep.smd.entity.WorkCenter;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
@ -155,6 +157,12 @@ public class WmsStorageLocationController {
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('wms_storage_location_add')")
|
||||
public R save(@RequestBody StorageLocationDto storageLocationDto) {
|
||||
if(StringUtils.isNotEmpty(storageLocationDto.getFabNo())){
|
||||
storageLocationDto.setFabNoBo(FabBasis.genHandle(storageLocationDto.getSite(),storageLocationDto.getFabNo()));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(storageLocationDto.getWorkCenter())){
|
||||
storageLocationDto.setWorkCenterBo(WorkCenter.genHandle(storageLocationDto.getSite(),storageLocationDto.getWorkCenter()));
|
||||
}
|
||||
return R.ok(storageLocationService.save(storageLocationDto));
|
||||
}
|
||||
|
||||
@ -169,6 +177,12 @@ public class WmsStorageLocationController {
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wms_storage_location_edit')")
|
||||
public R updateById(@RequestBody StorageLocationDto storageLocationDto) {
|
||||
if(StringUtils.isNotEmpty(storageLocationDto.getFabNo())){
|
||||
storageLocationDto.setFabNoBo(FabBasis.genHandle(storageLocationDto.getSite(),storageLocationDto.getFabNo()));
|
||||
}
|
||||
if(StringUtils.isNotEmpty(storageLocationDto.getWorkCenter())){
|
||||
storageLocationDto.setWorkCenterBo(WorkCenter.genHandle(storageLocationDto.getSite(),storageLocationDto.getWorkCenter()));
|
||||
}
|
||||
return R.ok(storageLocationService.updateById(storageLocationDto));
|
||||
}
|
||||
|
||||
|
||||
@ -1,30 +1,28 @@
|
||||
package com.foreverwin.mom.wms.service.impl;
|
||||
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.constant.MaterialTypeEnum;
|
||||
import com.foreverwin.mom.wms.dto.BarCodeQueryDto;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsInventoryMapper;
|
||||
import com.foreverwin.mom.wms.service.BarCodeQueryService;
|
||||
import com.foreverwin.mom.wms.service.WmsCustomFieldsService;
|
||||
import com.foreverwin.mom.wms.service.WmsItemService;
|
||||
import com.foreverwin.mom.wms.util.StringUtil;
|
||||
import com.foreverwin.nlv.print.feign.RemotePrintService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class BarCodeQueryServiceLmpl implements BarCodeQueryService {
|
||||
|
||||
private final ZWmsInventoryMapper inventoryMapper;
|
||||
private final WmsItemService itemService;
|
||||
private final WmsCustomFieldsService customFieldsService;
|
||||
private final RemotePrintService remotePrintService;
|
||||
|
||||
@Override
|
||||
public BarCodeQueryDto getObjByInventoryId(String inventoryId, boolean isSecrecy) {
|
||||
@ -46,58 +44,41 @@ public class BarCodeQueryServiceLmpl implements BarCodeQueryService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String labelPrint(String site, String inventoryId, String printer, boolean isSecrecy) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
BarCodeQueryDto objByInventory = inventoryMapper.getObjByInventory(site, inventoryId, isSecrecy);
|
||||
if (objByInventory == null) {
|
||||
throw BusinessException.build("条码" + inventoryId + "不存在");
|
||||
}
|
||||
String item = objByInventory.getItem();
|
||||
Item selectCurrent = itemService.selectCurrent(site, item);
|
||||
String customItemType = customFieldsService.getCustomFieldsValue(selectCurrent.getHandle(), "CUSTOM_ITEM_TYPE");
|
||||
if (StringUtil.isEmpty(customItemType)) {
|
||||
throw BusinessException.build("物料自定义物料类型未维护");
|
||||
}
|
||||
String printScenario;
|
||||
if (MaterialTypeEnum.ROH.getCode().equals(customItemType)) {
|
||||
printScenario = Constant.PRINT_SCENARIO_ROH;
|
||||
} else if (MaterialTypeEnum.FERT.getCode().equals(customItemType)) {
|
||||
printScenario = Constant.PRINT_SCENARIO_FERT;
|
||||
} else if (MaterialTypeEnum.VERP.getCode().equals(customItemType)) {
|
||||
printScenario = Constant.PRINT_SCENARIO_VERP;
|
||||
BarCodeQueryDto barCodeQueryDto = this.getObjByInventoryId(inventoryId, isSecrecy);
|
||||
if (barCodeQueryDto == null) {
|
||||
throw BusinessException.build("库存条码" + barCodeQueryDto.getInventoryId() + "已不存在");
|
||||
} else {
|
||||
throw BusinessException.build("不支持的物料类型");
|
||||
}
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
Map<String, Object> printData = new HashMap<>();
|
||||
printData.put("inventoryId", inventoryId);
|
||||
printData.put("item", item);
|
||||
String description = selectCurrent.getDescription();
|
||||
if (StringUtil.isEmpty(description)) {
|
||||
description = "FIELD_EMPTY";
|
||||
}
|
||||
printData.put("itemDescription", description);
|
||||
String batchNo = objByInventory.getBatchNo();
|
||||
if (StringUtil.isEmpty(batchNo)) {
|
||||
batchNo = "FIELD_EMPTY";
|
||||
}
|
||||
printData.put("batch", batchNo);
|
||||
printData.put("qty", objByInventory.getQtyOnHand().stripTrailingZeros().toPlainString());
|
||||
printData.put("createDate", objByInventory.getCreateTime());
|
||||
|
||||
String vendorBatchNo = objByInventory.getVendorBatchNo();
|
||||
if (StringUtil.isEmpty(vendorBatchNo)) {
|
||||
vendorBatchNo = "FIELD_EMPTY";
|
||||
}
|
||||
printData.put("vendorBatch", vendorBatchNo);
|
||||
String productionDate = objByInventory.getProductionDate();
|
||||
if (StringUtil.isEmpty(productionDate)) {
|
||||
productionDate = "FIELD_EMPTY";
|
||||
List<JSONObject> printData = new ArrayList<>();
|
||||
// 添加打印参数
|
||||
JSONObject paramMap = new JSONObject();
|
||||
if (isSecrecy) {
|
||||
paramMap.put("UUID", inventoryId);
|
||||
paramMap.put("QTY", barCodeQueryDto.getQtyOnHand());
|
||||
paramMap.put("CODE", inventoryId);
|
||||
} else {
|
||||
paramMap.put("ITEM", barCodeQueryDto.getItem());
|
||||
paramMap.put("DES", barCodeQueryDto.getItemDescription());
|
||||
paramMap.put("DATE", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
paramMap.put("BATCH", barCodeQueryDto.getBatchNo());
|
||||
paramMap.put("QTY", barCodeQueryDto.getQtyOnHand());
|
||||
paramMap.put("INV_ID", inventoryId);
|
||||
paramMap.put("DOCUMENT_NO", "");
|
||||
paramMap.put("CODE", inventoryId);
|
||||
paramMap.put("VENDOR_BATCH", barCodeQueryDto.getVendorBatchNo());
|
||||
paramMap.put("PRO_DATE", barCodeQueryDto.getProductionDate());
|
||||
}
|
||||
printData.put("prodDate", productionDate);
|
||||
|
||||
mapList.add(printData);
|
||||
// PrintResult printResult = printService.doPrintForHorizon2(site, user, "", inventoryId, 1, inventoryId, printScenario, mapList, printer);
|
||||
return "打印未开发";
|
||||
printData.add(paramMap);
|
||||
for (JSONObject jsonObject : printData) {
|
||||
jsonObject.put("LABEL_QTY", 1);
|
||||
jsonObject.put("PRINT_NAME", printer);
|
||||
jsonObject.put("QUEUE_NAME", "");
|
||||
jsonObject.put("TEMPLATE", isSecrecy ? "RAM_LABEL_002.lab" : "RAM_LABEL_001.lab");
|
||||
remotePrintService.remotePrintSaveLog(jsonObject);
|
||||
}
|
||||
return "打印成功";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2106,6 +2106,8 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
paramMap.put("INV_ID", inventoryId);
|
||||
paramMap.put("DOCUMENT_NO", documentNo);
|
||||
paramMap.put("CODE", inventoryId);
|
||||
paramMap.put("VENDOR_BATCH", parentInventory.getVendorBatchNo());
|
||||
paramMap.put("PRO_DATE", parentInventory.getProductionDate());
|
||||
printData.add(paramMap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,6 +456,8 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
paramMap.put("INV_ID", inventoryId);
|
||||
paramMap.put("DOCUMENT_NO", documentNo);
|
||||
paramMap.put("CODE", inventoryId);
|
||||
paramMap.put("VENDOR_BATCH", inventory.getVendorBatchNo());
|
||||
paramMap.put("PRO_DATE", inventory.getProductionDate());
|
||||
}
|
||||
printData.add(paramMap);
|
||||
}
|
||||
@ -505,6 +507,8 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
paramMap.put("INV_ID", parentInventory.getInventoryId());
|
||||
paramMap.put("DOCUMENT_NO", documentNo);
|
||||
paramMap.put("CODE", parentInventory.getInventoryId());
|
||||
paramMap.put("VENDOR_BATCH", parentInventory.getVendorBatchNo());
|
||||
paramMap.put("PRO_DATE", parentInventory.getProductionDate());
|
||||
}
|
||||
printData.add(paramMap);
|
||||
}
|
||||
@ -627,6 +631,8 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
paramMap.put("INV_ID", inventoryId);
|
||||
paramMap.put("DOCUMENT_NO", "");
|
||||
paramMap.put("CODE", inventoryId);
|
||||
paramMap.put("VENDOR_BATCH", inventory.getVendorBatchNo());
|
||||
paramMap.put("PRO_DATE", inventory.getProductionDate());
|
||||
}
|
||||
|
||||
printData.add(paramMap);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user