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

View File

@ -80,7 +80,7 @@ public class ZLotMaterialCompleteTransactionServiceImpl extends ServiceImpl<ZLot
mtrComTrans.setWarehouseCode(resultZLotMaterialCompleteTransaction.getWarehouseCode());
mtrComTrans.setStorageLocation(resultZLotMaterialCompleteTransaction.getStorageLocation());
mtrComTrans.setStorageBin(resultZLotMaterialCompleteTransaction.getStorageBin());
mtrComTrans.setErpInventory(resultZLotMaterialCompleteTransaction.getErpInventory());
mtrComTrans.setErpInventory(resultZLotMaterialCompleteTransaction.getWarehouseCode());
mtrComTrans.setMoveType("1"); // 移动日志(0:入库、2:销售出库)
mtrComTrans.setStatus(resultZLotMaterialCompleteTransaction.getStatus());
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.WmsStorageLocationMapper;
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.security.util.SecurityUtils;
import com.foreverwin.mom.wms.api.feign.RemoteWmsInventoryService;
import com.foreverwin.mom.wms.entity.Inventory;
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 lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
@ -99,7 +98,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
private final ResrceMapper resrceMapper;
private final RemotePrintService remotePrintService;
private final PrintService printService;
private final ZLotMaterialCompleteTransactionService zLotMaterialCompleteTransactionService;
private final ZLotMaterialConsumptionTransactionService zLotMaterialConsumptionTransactionService;
@ -262,21 +261,18 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
}
if ("E".equals(jsonObject.get("endOp"))) {
// 通过车间和产线查询存储位置
LambdaQueryWrapper<WmsStorageLocation> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(WmsStorageLocation::getSite, site);
queryWrapper.eq(WmsStorageLocation::getWorkCenterBo, WorkCenter.genHandle(site, resultZLotMaterialCompleteTransaction.getWorkCenter()));
queryWrapper.eq(WmsStorageLocation::getFabNoBo, FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo()));
List<WmsStorageLocation> wmsStorageLocationList = wmsStorageLocationMapper.selectList(queryWrapper);
if (CollectionUtils.isNotEmpty(wmsStorageLocationList)) {
resultZLotMaterialCompleteTransaction.setStorageLocation(wmsStorageLocationList.get(0).getStorageLocation());
List<ZLotMaterialCompleteTransaction> zLotMaterialCompleteTransactionList = baseMapper.readStorageLocationByFabNo(site, WorkCenter.genHandle(site, resultZLotMaterialCompleteTransaction.getWorkCenter()), FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo()));
if (CollectionUtils.isNotEmpty(zLotMaterialCompleteTransactionList)) {
resultZLotMaterialCompleteTransaction.setStorageLocation(zLotMaterialCompleteTransactionList.get(0).getStorageLocation());
resultZLotMaterialCompleteTransaction.setWarehouseCode(zLotMaterialCompleteTransactionList.get(0).getWarehouseCode());
resultZLotMaterialCompleteTransaction.setStorageBin(zLotMaterialCompleteTransactionList.get(0).getStorageBin());
} else {
// 有可能产线为空的情况
wmsStorageLocationList = wmsStorageLocationMapper.selectList(Wrappers.<WmsStorageLocation>lambdaQuery()
.eq(WmsStorageLocation::getSite, site)
.eq(WmsStorageLocation::getFabNoBo, FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo()))
);
if (CollectionUtils.isNotEmpty(wmsStorageLocationList)) {
resultZLotMaterialCompleteTransaction.setStorageLocation(wmsStorageLocationList.get(0).getStorageLocation());
zLotMaterialCompleteTransactionList = baseMapper.readStorageLocationByFabNo(site, null, FabBasis.genHandle(site, resultZLotMaterialCompleteTransaction.getFabNo()));
if (CollectionUtils.isNotEmpty(zLotMaterialCompleteTransactionList)) {
resultZLotMaterialCompleteTransaction.setStorageLocation(zLotMaterialCompleteTransactionList.get(0).getStorageLocation());
resultZLotMaterialCompleteTransaction.setWarehouseCode(zLotMaterialCompleteTransactionList.get(0).getWarehouseCode());
resultZLotMaterialCompleteTransaction.setStorageBin(zLotMaterialCompleteTransactionList.get(0).getStorageBin());
}
}
}
@ -373,6 +369,9 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
.eq(CustomFields::getFieldName, "IS_PRINT")
);
if (customFields != null && "Y".equals(customFields.getFieldValue())) {
if (StrUtil.isBlank(resultZLotMaterialCompleteTransaction.getFabNo())) {
throw BusinessException.build("根据设备【"+ resrce +"】未查询到车间!");
}
// 调用打印
for (String lotNo : lotNoList) {
OperationPrintRequest operationPrintRequest = new OperationPrintRequest();
@ -384,7 +383,7 @@ public class OperationOutServiceImpl extends ServiceImpl<OperationOutMapper, Ope
operationPrintRequest.setResource(resrce);
operationPrintRequest.setLotNo(lotNo);
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);
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 ROUND(wi.QTY_ON_HAND, 6) = 0
</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>