parent
f1e82844fe
commit
3f3ceff67a
22 changed files with 650 additions and 36 deletions
@ -0,0 +1,114 @@ |
||||
package org.springblade.desk.produce.pojo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.util.Date; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 移交记录 实体类 |
||||
* @author BladeX |
||||
*/ |
||||
@Data |
||||
@TableName("MES_HANDOVER_RECORD") |
||||
@Schema(description = "HandoverRecord对象") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class HandoverRecord extends BaseEntity { |
||||
|
||||
/** |
||||
* 入库单 |
||||
*/ |
||||
public static Short HR_TYPE_IN_WAREHOUSE = 0; |
||||
/** |
||||
* 转工单 |
||||
*/ |
||||
public static Short HR_TYPE_TRANSFER = 1; |
||||
/** |
||||
* 待移交 |
||||
*/ |
||||
public static Integer RUN_STATUS_WAIT = 1; |
||||
/** |
||||
* 完成 |
||||
*/ |
||||
public static Integer RUN_STATUS_COMPLETE = 2; |
||||
public static Map<Short, String> hrTypeMap = new HashMap<Short, String>(2); |
||||
public static Map<Integer, String> runStatusMap = new HashMap<Integer, String>(2); |
||||
|
||||
static { |
||||
hrTypeMap.put(HR_TYPE_IN_WAREHOUSE, "入库单"); |
||||
hrTypeMap.put(HR_TYPE_TRANSFER, "转工单"); |
||||
} |
||||
|
||||
static { |
||||
runStatusMap.put(RUN_STATUS_WAIT, "待移交"); |
||||
runStatusMap.put(RUN_STATUS_COMPLETE, "完成"); |
||||
} |
||||
|
||||
@Schema(description = "单号") |
||||
private String hrCode; |
||||
|
||||
@Schema(description = "移交类型") |
||||
private Short hrType; |
||||
|
||||
@Schema(description = "车间Id") |
||||
private Long woId; |
||||
|
||||
@Schema(description = "车间订单号") |
||||
private String woCode; |
||||
|
||||
@Schema(description = "零件号") |
||||
private String partCode; |
||||
|
||||
@Schema(description = "路线卡号") |
||||
private String cardNo; |
||||
|
||||
@Schema(description = "生产标识") |
||||
private String prodIdent; |
||||
|
||||
@Schema(description = "批次号") |
||||
private String batchNo; |
||||
|
||||
@Schema(description = "移交部门") |
||||
private String handoverUnit; |
||||
|
||||
@Schema(description = "移交数量") |
||||
private Double handoverQty; |
||||
|
||||
@Schema(description = "一级工序(B号)") |
||||
private String roamNo; |
||||
|
||||
@Schema(description = "接收部门") |
||||
private String recDept; |
||||
|
||||
@Schema(description = "备注") |
||||
private String memo; |
||||
|
||||
@Schema(description = "打印时间") |
||||
private Date printTime; |
||||
|
||||
@Schema(description = "打印标记") |
||||
private Integer printFlag; |
||||
|
||||
@Schema(description = "外协交件单号") |
||||
private String deliverKey; |
||||
|
||||
@TableField(exist = false) |
||||
@Schema(description = "移交类型") |
||||
private String hrTypeName; |
||||
|
||||
@TableField(exist = false) |
||||
@Schema(description = "状态") |
||||
private String statusName; |
||||
|
||||
@TableField(exist = false) |
||||
@Schema(description = "移交人员") |
||||
private String createName; |
||||
|
||||
|
||||
} |
||||
@ -0,0 +1,152 @@ |
||||
package org.springblade.desk.produce.pojo.vo; |
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
|
||||
import java.time.LocalDateTime; |
||||
|
||||
/** |
||||
* 入库单打印模型 视图实体类 |
||||
* |
||||
* @author litao |
||||
* @since 2026-2-27 |
||||
*/ |
||||
@Data |
||||
public class PrintWarehousingVO { |
||||
|
||||
/** |
||||
* 入库单号 |
||||
*/ |
||||
@Schema(description = "入库单号") |
||||
private String hrCode; |
||||
/** |
||||
* 工作单号 生产订单计划单号 |
||||
*/ |
||||
@Schema(description = "工作单号 生产订单计划单号") |
||||
private String poCode; |
||||
/** |
||||
* 车间单号 |
||||
*/ |
||||
@Schema(description = "车间单号") |
||||
private String woCode; |
||||
/** |
||||
* 计划部门 生产订单使用部门 |
||||
*/ |
||||
@Schema(description = "计划部门 生产订单使用部门") |
||||
private String useDept; |
||||
/** |
||||
* 镀钟 生产订单 |
||||
*/ |
||||
@Schema(description = "镀钟 生产订单") |
||||
private String plate; |
||||
/** |
||||
* 生产标识 生产订单 |
||||
*/ |
||||
@Schema(description = "生产标识") |
||||
private String prodIdent; |
||||
/** |
||||
* 型别 生产订单产品型号 |
||||
*/ |
||||
@Schema(description = "产品型号") |
||||
private String productTypePart; |
||||
/** |
||||
* 零件号 生产订单 |
||||
*/ |
||||
@Schema(description = "零件号") |
||||
private String partCode; |
||||
/** |
||||
* 名称 生产订单 |
||||
*/ |
||||
@Schema(description = "名称") |
||||
private String partName; |
||||
/** |
||||
* 产品系列 pj_bom |
||||
*/ |
||||
@Schema(description = "产品系列") |
||||
private String productType; |
||||
/** |
||||
* 原编码 pj_bom |
||||
*/ |
||||
@Schema(description = "原编码") |
||||
private String oldCode; |
||||
/** |
||||
* 计划数量 生产订单加工数量 |
||||
*/ |
||||
@Schema(description = "计划数量") |
||||
private String makeQty; |
||||
/** |
||||
* 重量 镀前镀后 |
||||
*/ |
||||
@Schema(description = "重量") |
||||
private Double weight; |
||||
/** |
||||
* 批次号 车间订单 |
||||
*/ |
||||
@Schema(description = "批次号") |
||||
private String batchNo; |
||||
/** |
||||
* 提交数量 移交记录移交数量 |
||||
*/ |
||||
@Schema(description = "提交数量") |
||||
private String handoverQty; |
||||
/** |
||||
* 车间提交人 移交记录移交人 |
||||
*/ |
||||
@Schema(description = "车间提交人") |
||||
private String createMan; |
||||
/** |
||||
* 计划员 生产订单 |
||||
*/ |
||||
@Schema(description = "计划员") |
||||
private String planUser; |
||||
/** |
||||
* 使用部门 |
||||
*/ |
||||
@Schema(description = "使用部门") |
||||
private String recDept; |
||||
/** |
||||
* 制表日期 |
||||
*/ |
||||
@Schema(description = "制表日期") |
||||
private String tableDate; |
||||
/** |
||||
* 备注 |
||||
*/ |
||||
@Schema(description = "备注") |
||||
private String memo; |
||||
/** |
||||
* 保管员 |
||||
*/ |
||||
@Schema(description = "保管员") |
||||
private String custodian; |
||||
/** |
||||
* 委托车间 |
||||
*/ |
||||
@Schema(description = "委托车间") |
||||
private String entrustDept; |
||||
/** |
||||
* 废品数 |
||||
*/ |
||||
@Schema(description = "废品数") |
||||
private String scrapQty = "0"; |
||||
/** |
||||
* 试验数 |
||||
*/ |
||||
@Schema(description = "试验数") |
||||
private String testQty = "0"; |
||||
/** |
||||
* 消耗数 |
||||
*/ |
||||
@Schema(description = "消耗数") |
||||
private String useQty = "0"; |
||||
/** |
||||
* 类型 |
||||
*/ |
||||
@Schema(description = "类型") |
||||
private Short hrType; |
||||
/** |
||||
* 工艺路线 |
||||
*/ |
||||
@Schema(description = "工艺路线") |
||||
private String primaryCraft; |
||||
} |
||||
@ -0,0 +1,15 @@ |
||||
package org.springblade.desk.produce.mapper; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.desk.produce.pojo.entity.HandoverRecord; |
||||
|
||||
/** |
||||
* 移交记录 Mapper 接口 |
||||
* |
||||
* @author BladeX |
||||
*/ |
||||
public interface HandoverRecordMapper extends BaseMapper<HandoverRecord> { |
||||
|
||||
Double getPaSumWeight(Long id); |
||||
} |
||||
@ -0,0 +1,8 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.desk.produce.mapper.HandoverRecordMapper"> |
||||
|
||||
<select id="getPaSumWeight" resultType="java.lang.Double"> |
||||
select nvl(sum(a.weight),0) from MES_PLATE_AROUND a where a.wp_id in ( select b.wp_id from MES_WORK_ORDER b where b.yo_id = #{id} ) |
||||
</select> |
||||
</mapper> |
||||
@ -0,0 +1,17 @@ |
||||
package org.springblade.desk.produce.service; |
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.desk.produce.pojo.entity.HandoverRecord; |
||||
import org.springblade.desk.produce.pojo.vo.PrintWarehousingVO; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 移交记录 服务类 |
||||
* |
||||
* @author BladeX |
||||
*/ |
||||
public interface IHandoverRecordService extends BaseService<HandoverRecord> { |
||||
|
||||
List<PrintWarehousingVO> handoverRecordPrint(List<Long> longList); |
||||
} |
||||
@ -0,0 +1,134 @@ |
||||
package org.springblade.desk.produce.service.impl; |
||||
|
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang3.time.DateFormatUtils; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.secure.utils.AuthUtil; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.StringUtil; |
||||
import org.springblade.desk.order.pojo.entity.YieldOrder; |
||||
import org.springblade.desk.order.service.IYieldOrderService; |
||||
import org.springblade.desk.produce.mapper.HandoverRecordMapper; |
||||
import org.springblade.desk.produce.pojo.entity.HandoverRecord; |
||||
import org.springblade.desk.produce.pojo.entity.WorkOrder; |
||||
import org.springblade.desk.produce.pojo.vo.PrintWarehousingVO; |
||||
import org.springblade.desk.produce.service.IHandoverRecordService; |
||||
import org.springblade.desk.produce.service.IWorkOrderService; |
||||
import org.springblade.desk.produce.service.IWorkPlanService; |
||||
import org.springblade.erpdata.feign.IErpDataProduceClient; |
||||
import org.springblade.system.cache.UserCache; |
||||
import org.springblade.system.feign.IUserClient; |
||||
import org.springblade.system.pojo.entity.User; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.util.CollectionUtils; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 移交记录 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2025-11-28 |
||||
*/ |
||||
@Slf4j |
||||
@Service |
||||
@RequiredArgsConstructor |
||||
public class HandoverRecordServiceImpl extends BaseServiceImpl<HandoverRecordMapper, HandoverRecord> implements IHandoverRecordService { |
||||
|
||||
private final IWorkOrderService prWorkOrderService; |
||||
|
||||
private final IYieldOrderService yieldOrderService; |
||||
|
||||
private final IWorkPlanService workPlanService; |
||||
|
||||
private final IErpDataProduceClient erpDataProduceClient; |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public List<PrintWarehousingVO> handoverRecordPrint(List<Long> longList) { |
||||
if (CollectionUtils.isEmpty(longList)) { |
||||
return null; |
||||
} |
||||
List<PrintWarehousingVO> list = new ArrayList<>(); |
||||
HandoverRecord hr; |
||||
PrintWarehousingVO printWarehousing; |
||||
YieldOrder yo; |
||||
Double totalWeight; |
||||
Date date = new Date(); |
||||
for (Long i : longList) { |
||||
hr = this.getById(i); |
||||
// 保存打印时间、更新打印标记
|
||||
hr.setPrintTime(date); |
||||
hr.setPrintFlag(1); |
||||
|
||||
printWarehousing = new PrintWarehousingVO(); |
||||
printWarehousing.setHrCode(hr.getHrCode()); |
||||
printWarehousing.setHrType(hr.getHrType()); |
||||
printWarehousing.setWoCode(hr.getWoCode()); |
||||
printWarehousing.setUseDept(hr.getRecDept()); |
||||
printWarehousing.setProdIdent(hr.getProdIdent()); |
||||
printWarehousing.setPartCode(hr.getPartCode()); |
||||
printWarehousing.setBatchNo(hr.getBatchNo()); |
||||
printWarehousing.setHandoverQty(String.valueOf(hr.getHandoverQty())); |
||||
printWarehousing.setRecDept(hr.getRecDept()); |
||||
User user = UserCache.getUser(hr.getCreateUser()); |
||||
printWarehousing.setCreateMan(user != null ? user.getRealName() : ""); |
||||
printWarehousing.setTableDate(DateFormatUtils.format(hr.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); |
||||
printWarehousing.setMemo(hr.getMemo()); |
||||
|
||||
// 打印结束最后一道工序
|
||||
WorkOrder wo = prWorkOrderService.getById(hr.getWoId()); |
||||
printWarehousing.setScrapQty(wo.getScrapQty().toString()); |
||||
printWarehousing.setTestQty(wo.getTestQty().toString()); |
||||
//手动创建的在打票时改为已交接
|
||||
yo = yieldOrderService.getById(wo.getYoId()); |
||||
prWorkOrderService.updateStatus(Collections.singletonList(wo.getId()), WorkOrder.RUN_STATUS_COMPLETED, AuthUtil.getUserId(), ""); |
||||
// 如果不是第一次打印,保存第一次打印时间
|
||||
if (wo.getPutStoreTime() != null) { |
||||
workPlanService.workPlanEnd(wo.getWpId(), wo.getPutStoreTime(), wo.getMakeQty()); |
||||
} else { |
||||
workPlanService.workPlanEnd(wo.getWpId(), new Date(), wo.getMakeQty()); |
||||
} |
||||
|
||||
printWarehousing.setPoCode(yo.getYpCode()); |
||||
printWarehousing.setMakeQty(String.valueOf(yo.getYpQty())); |
||||
printWarehousing.setPlate(yo.getPlate()); |
||||
printWarehousing.setPartName(yo.getPartName()); |
||||
printWarehousing.setPlanUser(yo.getPlanUser()); |
||||
printWarehousing.setProductTypePart(yo.getProductType()); |
||||
printWarehousing.setPrimaryCraft(yo.getPrimaryCraft()); |
||||
//zxh 20241212 保管员取值根据是否更改接受部门增加分支
|
||||
if (hr.getRecDept().matches("[0-9]+")) { |
||||
// 2025-07-23 线上迁移
|
||||
log.info("getCustodianByRecDept开始时间{}", System.currentTimeMillis()); |
||||
// String custodianByRecDept = this.getCustodianByRecDept(yo.getPartCode(), hr.getRecDept());
|
||||
// 2025-07-23 线上迁移
|
||||
log.info("getCustodianByRecDept结束时间{}", System.currentTimeMillis()); |
||||
// printWarehousing.setCustodian(custodianByRecDept);
|
||||
} else { |
||||
printWarehousing.setCustodian(yo.getCustodian()); |
||||
} |
||||
|
||||
// 委托车间
|
||||
printWarehousing.setEntrustDept(yo.getEntrustDept()); |
||||
//zxh 20241212 更改入库单中产品系列取值
|
||||
printWarehousing.setProductType(yo.getProductType()); |
||||
// 重量合计
|
||||
totalWeight = baseMapper.getPaSumWeight(yo.getId()); |
||||
printWarehousing.setWeight(totalWeight != 0 ? totalWeight : null); |
||||
|
||||
list.add(printWarehousing); |
||||
} |
||||
return list; |
||||
} |
||||
|
||||
private String getCustodianByRecDept(String partCode, String recDept) { |
||||
R<String> byPartCode = erpDataProduceClient.getCustodianByRecDept(partCode, recDept); |
||||
return byPartCode.getData(); |
||||
} |
||||
} |
||||
@ -0,0 +1,50 @@ |
||||
package org.springblade.desk.produce.wrapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.desk.produce.pojo.entity.HandoverRecord; |
||||
import org.springblade.desk.produce.pojo.entity.WorkOrder; |
||||
import org.springblade.desk.produce.pojo.enums.WorkOrderEnum; |
||||
import org.springblade.desk.produce.pojo.vo.WorkOrderVO; |
||||
import org.springblade.system.cache.UserCache; |
||||
import org.springblade.system.pojo.entity.User; |
||||
|
||||
import java.util.List; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* 移交记录 包装类,返回视图层所需的字段 |
||||
* |
||||
* @since 2026-1-19 |
||||
*/ |
||||
public class HandoverRecordWrapper extends BaseEntityWrapper<HandoverRecord, HandoverRecord> { |
||||
|
||||
public static HandoverRecordWrapper build() { |
||||
return new HandoverRecordWrapper(); |
||||
} |
||||
|
||||
@Override |
||||
public HandoverRecord entityVO(HandoverRecord handoverRecord) { |
||||
HandoverRecord handoverRecordVO = Objects.requireNonNull(BeanUtil.copyProperties(handoverRecord, HandoverRecord.class)); |
||||
// User createUser = UserCache.getUser(workOrderVO.getCreateUser());
|
||||
// User updateUser = UserCache.getUser(workOrderVO.getUpdateUser());
|
||||
// workOrderVO.setCreateUserName(createUser.getName());
|
||||
// workOrderVO.setUpdateUserName(updateUser.getName());
|
||||
return handoverRecordVO; |
||||
} |
||||
|
||||
public IPage<HandoverRecord> listHandoverRecordVO(IPage<HandoverRecord> pages) { |
||||
List<HandoverRecord> handoverRecords = pages.getRecords(); |
||||
for (HandoverRecord handoverRecord : handoverRecords) { |
||||
handoverRecord.setHrTypeName(HandoverRecord.hrTypeMap.get(handoverRecord.getHrType())); |
||||
handoverRecord.setStatusName(HandoverRecord.runStatusMap.get(handoverRecord.getStatus())); |
||||
User user = UserCache.getUser(handoverRecord.getCreateUser()); |
||||
handoverRecord.setCreateName(user != null ? user.getRealName() : ""); |
||||
} |
||||
pages.setRecords(handoverRecords); |
||||
return pages; |
||||
} |
||||
|
||||
|
||||
} |
||||
Loading…
Reference in new issue