Browse Source

其它入库标签打印

master
han\hanst 9 months ago
parent
commit
5d2bab1d87
  1. 8
      src/main/java/com/gaotao/modules/inspection/service/impl/InspectionInboundServiceImpl.java
  2. 15
      src/main/java/com/gaotao/modules/warehouse/controller/IfsInventoryInitController.java
  3. 12
      src/main/java/com/gaotao/modules/warehouse/entity/dto/CreateHuRequestDto.java
  4. 7
      src/main/java/com/gaotao/modules/warehouse/service/IfsInventoryInitService.java
  5. 87
      src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java
  6. 5
      src/main/resources/mapper/warehouse/WarehouseMapper.xml

8
src/main/java/com/gaotao/modules/inspection/service/impl/InspectionInboundServiceImpl.java

@ -643,7 +643,7 @@ public class InspectionInboundServiceImpl implements InspectionInboundService {
String processType = mapTransactionCodeToProcessType(ifsHistory.getTransactionCode());
// 只处理不合格的记录有退货报废或换货数量的
BigDecimal unqualifiedQty = getUnqualifiedQtyFromIfs(ifsHistory);
BigDecimal unqualifiedQty = getUnqualifiedQtyFromIfs(ifsHistory,ifsHistory.getTransactionCode());
if (unqualifiedQty != null && unqualifiedQty.compareTo(BigDecimal.ZERO) > 0) {
UnqualifiedInspectionDto dto = new UnqualifiedInspectionDto();
@ -706,16 +706,16 @@ public class InspectionInboundServiceImpl implements InspectionInboundService {
/**
* 从IFS历史数据中获取不合格数量
*/
private BigDecimal getUnqualifiedQtyFromIfs(IfsInspectionHistoryDto ifsHistory) {
private BigDecimal getUnqualifiedQtyFromIfs(IfsInspectionHistoryDto ifsHistory,String transactionCode) {
BigDecimal qty = BigDecimal.ZERO;
// 退货数量
if (ifsHistory.getSourceQtyReturn() != null && ifsHistory.getSourceQtyReturn() > 0) {
if (transactionCode.equals("RETWORK")&&ifsHistory.getSourceQtyReturn() != null && ifsHistory.getSourceQtyReturn() > 0) {
qty = qty.add(BigDecimal.valueOf(ifsHistory.getSourceQtyReturn()));
}
// 报废数量
if (ifsHistory.getSourceQtyScrapped() != null && ifsHistory.getSourceQtyScrapped() > 0) {
if (transactionCode.equals("INVSCRAP")&&ifsHistory.getSourceQtyScrapped() != null && ifsHistory.getSourceQtyScrapped() > 0) {
qty = qty.add(BigDecimal.valueOf(ifsHistory.getSourceQtyScrapped()));
}

15
src/main/java/com/gaotao/modules/warehouse/controller/IfsInventoryInitController.java

@ -60,4 +60,19 @@ public class IfsInventoryInitController {
return R.error("修改已打印数量失败: " + e.getMessage());
}
}
/**
* 创建其它入库HandlingUnitinStockFlag='X'
* @param request 创建HU请求
* @return 创建的HU ID列表
*/
@PostMapping("/createOtherInboundHandlingUnits")
public R createOtherInboundHandlingUnits(@RequestBody CreateHuRequestDto request) {
try {
List<String> unitIds = ifsInventoryInitService.createOtherInboundHandlingUnits(request);
return R.ok().put("unitIds", unitIds);
} catch (Exception e) {
return R.error("创建其它入库HandlingUnit失败: " + e.getMessage());
}
}
}

12
src/main/java/com/gaotao/modules/warehouse/entity/dto/CreateHuRequestDto.java

@ -2,7 +2,9 @@ package com.gaotao.modules.warehouse.entity.dto;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 创建HandlingUnit请求DTO
@ -19,5 +21,13 @@ public class CreateHuRequestDto {
private String locationId; // 库位
private BigDecimal perPackageQty; // 单包装数量
private Integer packageCount; // 包装数
private String umid;
private String umid; // 单位
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date manufactureDate; // 生产日期
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expiredDate; // 失效日期
private String remark; // 备注
}

7
src/main/java/com/gaotao/modules/warehouse/service/IfsInventoryInitService.java

@ -30,4 +30,11 @@ public interface IfsInventoryInitService {
* @param request 修改请求
*/
void updatePrintQty(InventoryStock request);
/**
* 创建其它入库HandlingUnitinStockFlag='X'
* @param request 创建HU请求
* @return 创建的HU ID列表
*/
List<String> createOtherInboundHandlingUnits(CreateHuRequestDto request);
}

87
src/main/java/com/gaotao/modules/warehouse/service/impl/IfsInventoryInitServiceImpl.java

@ -195,4 +195,91 @@ public class IfsInventoryInitServiceImpl implements IfsInventoryInitService {
request.getNewPrintQty()
);
}
@Override
@Transactional
public List<String> createOtherInboundHandlingUnits(CreateHuRequestDto request) {
List<String> unitIds = new ArrayList<>();
// 根据包装数创建多个HandlingUnit
for (int i = 0; i < request.getPackageCount(); i++) {
// 生成处理单元ID
String unitId = handlingUnitIdGeneratorService.generateUnitId(request.getSite());
// 创建HandlingUnit对象
HandlingUnit handlingUnit = new HandlingUnit();
handlingUnit.setUnitId(unitId);
handlingUnit.setSite(request.getSite());
handlingUnit.setUnitType("ROLL");
handlingUnit.setUnitTypeDb("ROLL");
handlingUnit.setPartNo(request.getPartNo());
handlingUnit.setPartDesc(request.getPartDesc());
handlingUnit.setQty(request.getPerPackageQty());
handlingUnit.setBatchNo(request.getBatchNo());
handlingUnit.setLocationId(request.getLocationId());
handlingUnit.setWarehouseId(request.getWarehouseId());
handlingUnit.setWdr(request.getWdr());
handlingUnit.setStatus("ACTIVE");
handlingUnit.setStatusDb("ACTIVE");
handlingUnit.setFreezeFlag("N");
handlingUnit.setMergedFlag("N");
handlingUnit.setInStockFlag("X"); // 其它入库设置为未入库状态
handlingUnit.setCreatedDate(new Date());
handlingUnit.setCreatedBy("SYSTEM");
handlingUnit.setSourceType("OTHER_INBOUND");
handlingUnit.setSourceRef("其它入库");
handlingUnit.setOriginalQty(request.getPerPackageQty());
handlingUnit.setReceiveDate(new Date());
// 根据料号和单位计算长宽
BigDecimal width = null;
BigDecimal length = null;
String partNo = request.getPartNo();
if (partNo != null && partNo.contains("-")) {
// 如果料号带尾缀比如70001234-0250那么width就是250
String[] parts = partNo.split("-");
String suffix = parts[parts.length - 1];
try {
int widthVal = Integer.parseInt(suffix);
width = BigDecimal.valueOf(widthVal);
} catch (NumberFormatException e) {
// 默认1000
}
}
// length就是数量乘以1000再除以width
if (width!=null && width.compareTo(BigDecimal.ZERO) > 0) {
length = request.getPerPackageQty().multiply(BigDecimal.valueOf(1000))
.divide(width, 2, java.math.RoundingMode.HALF_UP);
}
handlingUnit.setWidth(width);
handlingUnit.setLength(length);
// 设置生产日期和失效日期
if (request.getManufactureDate() != null) {
handlingUnit.setManufactureDate(request.getManufactureDate());
}
if (request.getExpiredDate() != null) {
handlingUnit.setExpiredDate(request.getExpiredDate());
}
handlingUnit.setUmId(request.getUmid());
// 设置备注
if (request.getRemark() != null && !request.getRemark().trim().isEmpty()) {
handlingUnit.setRemark(request.getRemark());
} else {
handlingUnit.setRemark("其它入库创建");
}
// 保存HandlingUnit
handlingUnitService.save(handlingUnit);
unitIds.add(unitId);
}
return unitIds;
}
}

5
src/main/resources/mapper/warehouse/WarehouseMapper.xml

@ -446,7 +446,10 @@
<!-- 根据仓库ID获取site信息 -->
<select id="getSiteByWarehouseId" resultType="string">
SELECT site FROM warehouse WHERE WareHouseID = #{warehouseId} LIMIT 1
SELECT TOP 1 site
FROM warehouse
WHERE WareHouseID = #{warehouseId}
</select>
</mapper>
Loading…
Cancel
Save