fix(工序出站):调用打印

This commit is contained in:
liaohechuan 2024-11-25 17:25:34 +08:00
parent 1d8fb1e3f1
commit c58ad9efcb
5 changed files with 39 additions and 18 deletions

View File

@ -4,6 +4,7 @@ import com.foreverwin.iep.dynamic.annotation.EnableDynamicRegister;
import com.foreverwin.mom.common.feign.annotation.EnableMomFeignClients; import com.foreverwin.mom.common.feign.annotation.EnableMomFeignClients;
import com.foreverwin.mom.common.security.annotation.EnableMomResourceServer; import com.foreverwin.mom.common.security.annotation.EnableMomResourceServer;
import com.foreverwin.mom.common.swagger.annotation.EnableMomSwagger2; import com.foreverwin.mom.common.swagger.annotation.EnableMomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@ -21,6 +22,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@EnableMomResourceServer @EnableMomResourceServer
@SpringBootApplication(scanBasePackages = {"com.foreverwin.mom", "com.foreverwin.iep","com.foreverwin.nlv", "cn.hutool.extra.spring"}) @SpringBootApplication(scanBasePackages = {"com.foreverwin.mom", "com.foreverwin.iep","com.foreverwin.nlv", "cn.hutool.extra.spring"})
@EnableAsync @EnableAsync
@MapperScan(basePackages={"com.foreverwin.**.mapper"})
public class MesCoreApp { public class MesCoreApp {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(MesCoreApp.class); SpringApplication springApplication = new SpringApplication(MesCoreApp.class);

View File

@ -80,7 +80,7 @@ public class ZLotMaterialCompleteTransactionServiceImpl extends ServiceImpl<ZLot
mtrComTrans.setWarehouseCode(resultZLotMaterialCompleteTransaction.getWarehouseCode()); mtrComTrans.setWarehouseCode(resultZLotMaterialCompleteTransaction.getWarehouseCode());
mtrComTrans.setStorageLocation(resultZLotMaterialCompleteTransaction.getStorageLocation()); mtrComTrans.setStorageLocation(resultZLotMaterialCompleteTransaction.getStorageLocation());
mtrComTrans.setStorageBin(resultZLotMaterialCompleteTransaction.getStorageBin()); mtrComTrans.setStorageBin(resultZLotMaterialCompleteTransaction.getStorageBin());
mtrComTrans.setErpInventory(resultZLotMaterialCompleteTransaction.getErpInventory()); mtrComTrans.setErpInventory(resultZLotMaterialCompleteTransaction.getWarehouseCode());
mtrComTrans.setMoveType("1"); // 移动日志(0:入库、2:销售出库) mtrComTrans.setMoveType("1"); // 移动日志(0:入库、2:销售出库)
mtrComTrans.setStatus(resultZLotMaterialCompleteTransaction.getStatus()); mtrComTrans.setStatus(resultZLotMaterialCompleteTransaction.getStatus());
mtrComTrans.setDateMfg(resultZLotMaterialCompleteTransaction.getDateMfg()); mtrComTrans.setDateMfg(resultZLotMaterialCompleteTransaction.getDateMfg());

View File

@ -35,13 +35,12 @@ import com.foreverwin.iep.wms.entity.WmsStorageLocation;
import com.foreverwin.iep.wms.mapper.EqpFeedingMapper; import com.foreverwin.iep.wms.mapper.EqpFeedingMapper;
import com.foreverwin.iep.wms.mapper.WmsStorageLocationMapper; import com.foreverwin.iep.wms.mapper.WmsStorageLocationMapper;
import com.foreverwin.iep.wms.service.EqpFeedingService; import com.foreverwin.iep.wms.service.EqpFeedingService;
import com.foreverwin.mom.common.core.constant.SecurityConstants;
import com.foreverwin.mom.common.core.exception.BusinessException; import com.foreverwin.mom.common.core.exception.BusinessException;
import com.foreverwin.mom.common.security.util.SecurityUtils; import com.foreverwin.mom.common.security.util.SecurityUtils;
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService; import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService;
import com.foreverwin.mom.wms.entity.Inventory; import com.foreverwin.mom.wms.entity.Inventory;
import com.foreverwin.nlv.print.dto.OperationPrintRequest; import com.foreverwin.nlv.print.dto.OperationPrintRequest;
import com.foreverwin.nlv.print.feign.RemotePrintService; import com.foreverwin.nlv.print.service.PrintService;
import io.seata.spring.annotation.GlobalTransactional; import io.seata.spring.annotation.GlobalTransactional;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -99,7 +98,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
private final ResrceMapper resrceMapper; private final ResrceMapper resrceMapper;
private final RemotePrintService remotePrintService; private final PrintService printService;
private final ZLotMaterialCompleteTransactionService zLotMaterialCompleteTransactionService; private final ZLotMaterialCompleteTransactionService zLotMaterialCompleteTransactionService;
private final ZLotMaterialConsumptionTransactionService zLotMaterialConsumptionTransactionService; private final ZLotMaterialConsumptionTransactionService zLotMaterialConsumptionTransactionService;
@ -262,21 +261,18 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
} }
if ("E".equals(jsonObject.get("endOp"))) { if ("E".equals(jsonObject.get("endOp"))) {
// 通过车间和产线查询存储位置 // 通过车间和产线查询存储位置
LambdaQueryWrapper<WmsStorageLocation> queryWrapper = Wrappers.lambdaQuery(); List<ZLotMaterialCompleteTransaction> zLotMaterialCompleteTransactionList = baseMapper.readStorageLocationByFabNo(site, WorkCenter.genHandle(site, resultZLotMaterialCompleteTransaction.getWorkCenter()), FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo()));
queryWrapper.eq(WmsStorageLocation::getSite, site); if (CollectionUtils.isNotEmpty(zLotMaterialCompleteTransactionList)) {
queryWrapper.eq(WmsStorageLocation::getWorkCenterBo, WorkCenter.genHandle(site, resultZLotMaterialCompleteTransaction.getWorkCenter())); resultZLotMaterialCompleteTransaction.setStorageLocation(zLotMaterialCompleteTransactionList.get(0).getStorageLocation());
queryWrapper.eq(WmsStorageLocation::getFabNoBo, FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo())); resultZLotMaterialCompleteTransaction.setWarehouseCode(zLotMaterialCompleteTransactionList.get(0).getWarehouseCode());
List<WmsStorageLocation> wmsStorageLocationList = wmsStorageLocationMapper.selectList(queryWrapper); resultZLotMaterialCompleteTransaction.setStorageBin(zLotMaterialCompleteTransactionList.get(0).getStorageBin());
if (CollectionUtils.isNotEmpty(wmsStorageLocationList)) {
resultZLotMaterialCompleteTransaction.setStorageLocation(wmsStorageLocationList.get(0).getStorageLocation());
} else { } else {
// 有可能产线为空的情况 // 有可能产线为空的情况
wmsStorageLocationList = wmsStorageLocationMapper.selectList(Wrappers.<WmsStorageLocation>lambdaQuery() zLotMaterialCompleteTransactionList = baseMapper.readStorageLocationByFabNo(site, null, FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo()));
.eq(WmsStorageLocation::getSite, site) if (CollectionUtils.isNotEmpty(zLotMaterialCompleteTransactionList)) {
.eq(WmsStorageLocation::getFabNoBo, FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo())) resultZLotMaterialCompleteTransaction.setStorageLocation(zLotMaterialCompleteTransactionList.get(0).getStorageLocation());
); resultZLotMaterialCompleteTransaction.setWarehouseCode(zLotMaterialCompleteTransactionList.get(0).getWarehouseCode());
if (CollectionUtils.isNotEmpty(wmsStorageLocationList)) { resultZLotMaterialCompleteTransaction.setStorageBin(zLotMaterialCompleteTransactionList.get(0).getStorageBin());
resultZLotMaterialCompleteTransaction.setStorageLocation(wmsStorageLocationList.get(0).getStorageLocation());
} }
} }
} }
@ -373,6 +369,9 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
.eq(CustomFields::getFieldName, "IS_PRINT") .eq(CustomFields::getFieldName, "IS_PRINT")
); );
if (customFields != null && "Y".equals(customFields.getFieldValue())) { if (customFields != null && "Y".equals(customFields.getFieldValue())) {
if (StrUtil.isBlank(resultZLotMaterialCompleteTransaction.getFabNo())) {
throw BusinessException.build("根据设备【"+ resrce +"】未查询到车间!");
}
// 调用打印 // 调用打印
for (String lotNo : lotNoList) { for (String lotNo : lotNoList) {
OperationPrintRequest operationPrintRequest = new OperationPrintRequest(); OperationPrintRequest operationPrintRequest = new OperationPrintRequest();
@ -384,7 +383,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
operationPrintRequest.setResource(resrce); operationPrintRequest.setResource(resrce);
operationPrintRequest.setLotNo(lotNo); operationPrintRequest.setLotNo(lotNo);
operationPrintRequest.setShopOrder(shopOrder); operationPrintRequest.setShopOrder(shopOrder);
remotePrintService.remoteDoOperationPrint(operationPrintRequest, SecurityConstants.FROM_IN); printService.doOperationPrint(operationPrintRequest);
} }
} }

View File

@ -44,4 +44,6 @@ public interface OperationOutMapper extends MomBaseMapper<OperationOutDTO> {
String getWmsInventoryBo(@Param("site") String site, @Param("materialLot") String materialLot); String getWmsInventoryBo(@Param("site") String site, @Param("materialLot") String materialLot);
void insertWmsInventoryLog(@Param("uuid") String uuid, @Param("site") String site, @Param("wmsInventoryBo") String wmsInventoryBo, @Param("nowLocalDateTime") String nowLocalDateTime, @Param("user") String user); void insertWmsInventoryLog(@Param("uuid") String uuid, @Param("site") String site, @Param("wmsInventoryBo") String wmsInventoryBo, @Param("nowLocalDateTime") String nowLocalDateTime, @Param("user") String user);
List<ZLotMaterialCompleteTransaction> readStorageLocationByFabNo(@Param("site") String site, @Param("workCenterBo") String workCenterBo, @Param("fabNoBo") String fabNoBo);
} }

View File

@ -371,4 +371,22 @@
and wi.INVENTORY_ID = #{materialLot} and wi.INVENTORY_ID = #{materialLot}
and ROUND(wi.QTY_ON_HAND, 6) = 0 and ROUND(wi.QTY_ON_HAND, 6) = 0
</select> </select>
<!--通过车间和产线查询存储位置-->
<select id="readStorageLocationByFabNo"
resultType="com.foreverwin.iep.prd.entity.ZLotMaterialCompleteTransaction">
select
wsl.STORAGE_LOCATION,
ww.WAREHOUSE as WAREHOUSE_CODE,
wsb.STORAGE_BIN
from
wms.wms_storage_location wsl
left join wms.wms_warehouse ww on ww.SITE = wsl.SITE and ww.HANDLE = wsl.WAREHOUSE_BO
left join wms.wms_storage_bin wsb on wsb.SITE = wsl.SITE and wsb.STORAGE_LOCATION_BO = wsl.HANDLE
where
wsl.SITE = #{site}
and wsl.WORK_CENTER_BO = #{workCenterBo}
and wsl.FAB_NO_BO = #{fabNoBo}
and wsl.IS_DEFAULT = 'Y'
</select>
</mapper> </mapper>