This commit is contained in:
hongchao 2025-08-13 17:29:35 +08:00
commit c1c827008e
37 changed files with 556 additions and 43 deletions

View File

@ -48,4 +48,13 @@ public class TypeTreeNode {
@ApiModelProperty(value = "协议id")
private Long agreementId;
@ApiModelProperty(value = "领料方式 0材料领料 1工器具领料 2数据同步")
private Integer leaseStyle;
@ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType;
@ApiModelProperty(value = "是否检验0不检验1检验")
private String isCheck;
}

View File

@ -108,6 +108,9 @@ public class LeaseOutDetails extends BaseEntity {
@ApiModelProperty(value = "协议id")
private Long agreementId;
@ApiModelProperty(value = "项目部协议id")
private Long projectUnitAgreementId;
@ApiModelProperty(value = "是否完成 (0:未完成 1:已完成)")
private Integer isFinished;
@ -140,6 +143,9 @@ public class LeaseOutDetails extends BaseEntity {
@ApiModelProperty(value = "领料id")
private Integer leaseUnitId;
@ApiModelProperty(value = "领料单位是否为班组")
private Boolean leaseUnitIsTeam;
@ApiModelProperty(value = "领料工程id")
private Integer leaseProjectId;

View File

@ -92,6 +92,14 @@ public class AppOcrController extends BaseController {
return appOcrService.getOcrCode(bean);
}
@ApiOperation(value = "获取ocr编码")
@PreventRepeatSubmit
@PostMapping("/getOcrCodeTwo")
public AjaxResult getOcrCodeTwo(@RequestBody MachineOcrBean bean)
{
return appOcrService.getOcrCodeTwo(bean);
}
@ApiOperation(value = "推送设备至第三方入库")
@PreventRepeatSubmit
@PostMapping("/addDeviceNumber")

View File

@ -61,4 +61,11 @@ public interface AppOcrService {
* @return
*/
AjaxResult addDeviceNumber(MachineOcrBean bean);
/**
* 获取ocr编码
* @param bean
* @return
*/
AjaxResult getOcrCodeTwo(MachineOcrBean bean);
}

View File

@ -263,6 +263,23 @@ public class AppOcrServiceImpl implements AppOcrService {
return AjaxResult.success(js);
}
@Override
public AjaxResult getOcrCodeTwo(MachineOcrBean bean) {
String url = "http://10.138.55.102:10000/api_gqj/pre";
JSONObject js = null;
try {
System.out.println("ocr-base64数据:" + bean.getImage());
String jsonStr = JSONObject.toJSONString(bean);
String data = HttpHelper.sendHttpPostForToken(url, jsonStr);
System.out.println("ocr返回数据:" + data);
js = JSONObject.parseObject(data);
} catch (Exception e) {
e.printStackTrace();
log.error("获取OCR编码失败:" + e.getMessage());
}
return AjaxResult.success(js);
}
/**
* 推送设备至第三方入库
* @param bean

View File

@ -39,6 +39,9 @@ public class BackApplyInfo implements Serializable {
@ApiModelProperty(value = "协议id")
private Long agreementId;
@ApiModelProperty(value = "材料站协议id")
private Long clzAgreementId;
@ApiModelProperty(value = "任务类型")
private Integer taskType;

View File

@ -49,6 +49,13 @@ public class BmAgreementInfo extends BaseEntity
@NotNull(message = "往来单位id不能为空")
private Long unitId;
/**
* 往来单位所属项目部ID
*/
@NotNull(message = "所属项目部ID不能为空")
@ApiModelProperty(value = "所属项目部ID")
private Long projectUnitId;
/**
* 往来单位
*/

View File

@ -62,6 +62,11 @@ public interface BmAgreementInfoMapper
public int selectNumByMonth(Date nowDate);
/**
* 查询单位类型是内部单位/外部单位
* @param agreementId
* @return
*/
String getProtocol(String agreementId);
/**

View File

@ -119,6 +119,10 @@ public class MaterialBackApplyDetails extends BaseEntity {
@ApiModelProperty(value = "数据所属组织")
private Long companyId;
/** 领用方式 */
@ApiModelProperty(value = "领用方式 2数据同步")
private Integer leaseStyle;
/**
* 附件列表
*/

View File

@ -416,6 +416,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
TmTaskAgreement tmTaskAgreement = new TmTaskAgreement(tmTask.getTaskId(), dto.getBackApplyInfo().getAgreementId());
tmTaskAgreement.setCreateTime(DateUtils.getNowDate());
tmTaskAgreement.setCreateBy(createBy);
// 增加任务和协议关联表数据
taskAgreementMapper.insertTmTaskAgreement(tmTaskAgreement);
backApplyInfo.setTaskId(tmTask.getTaskId());
backApplyInfo.setBackStyle("1");
@ -443,7 +444,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
//对提交的退料详情数量进行校验
for (MaterialBackApplyDetails backApplyDetails : dto.getBackApplyDetailsList()) {
if (backApplyDetails.getNum() != null && backApplyDetails.getPreNum() != null) {
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum())<0 ) {
if (backApplyDetails.getNum().compareTo(backApplyDetails.getPreNum()) < 0) {
return AjaxResult.error(backApplyDetails.getTypeName() + "退料数量不能大于预退数量,请重新填写!");
}
}
@ -851,6 +852,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
* @return
*/
private int saveBackApplyDetails(String createBy, MaterialBackApplyRequestVo dto, MaterialBackApplyInfo backApplyInfo, int result) {
// 循环退料详情
for (MaterialBackApplyDetails details : dto.getBackApplyDetailsList()) {
details.setCode(backApplyInfo.getCode());
details.setParentId(backApplyInfo.getId());
@ -862,15 +864,18 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
result += materialBackInfoMapper.insertBackApplyDetails(details);
// 处理附件
result = saveBmFileInfo(details, backApplyInfo.getId(), result);
// 判断是否为编码设备并处理附件
Integer isBack = dto.getBackApplyInfo().getIsBack();
details.setIsFinished(isBack);
result = saveMaCodeBmFileInfo(createBy, isBack, details, backApplyInfo.getId(), result);
if (isBack == 1) {
// 更新任务表及退料申请表状态
result += updateTaskAndBackInfo(backApplyInfo);
// 更新结算表
backApplyInfo.setTypeId(details.getTypeId().toString());
// 查询材料站的退料明细
List<MaterialBackApplyInfo> allList = materialBackInfoMapper.selectBackDetails(backApplyInfo);
if (CollectionUtils.isNotEmpty(allList)) {
List<MaterialBackApplyInfo> newList = new ArrayList<>();
@ -892,6 +897,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
}
}
}
// 更新材料站的结算协议表
int res = updateSlt4Bean(backApplyInfo, newList);
// 检查机具是否领料
if (res == 0) {
@ -979,9 +985,6 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
result += bmFileInfoMapper.insertBmFileInfo(bmFileInfo);
}
}
if (isBack == 1) {
result += machineMapper.updateStatus(maCodeDto.getMaId(), MaMachineStatusEnum.IN_STORE.getStatus());
}
}
} else {
// 如果 MaCodeList 为空只插入 CheckDetails

View File

@ -1319,7 +1319,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (!CollectionUtils.isEmpty(bean.getAgreementIdList())) {
for (Long agreementId : bean.getAgreementIdList()) {
backApplyInfo.setAgreementId(agreementId);
listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
listL4 = mapper.getUseTypeClzTree(backApplyInfo);
if (!CollectionUtils.isEmpty(listL4)) {
listL4 = listL4.stream()
.filter(item -> StringUtils.isNotBlank(item.getMaterialName()) && StringUtils.isNotBlank(item.getTypeName()))
@ -1380,8 +1380,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
// 获取要减去的值默认值为BigDecimal.ZERO
BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO);
// 计算新值处理num为null的情况若业务允许
BigDecimal currentNum = Optional.ofNullable(node.getNum())
.orElse(BigDecimal.ZERO);
BigDecimal currentNum = Optional.ofNullable(node.getNum()).orElse(BigDecimal.ZERO);
BigDecimal newNum = currentNum.subtract(subtractNum);
if (newNum.compareTo(BigDecimal.ZERO) == 0) {
iterator.remove();

View File

@ -1,6 +1,7 @@
package com.bonus.material.common.domain.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@ -8,6 +9,7 @@ import java.util.List;
* @author 10488
*/
@Data
@Accessors(chain = true)
public class SelectDto {
/** 参数id*/

View File

@ -283,4 +283,11 @@ public interface SelectMapper {
* @return
*/
BmUnit selectUnitByLeaseId(BmUnit bmUnit);
/**
* 获取部门项目
* @param backApplyInfo
* @return
*/
List<TypeTreeNode> getUseTypeClzTree(BackApplyInfo backApplyInfo);
}

View File

@ -507,6 +507,14 @@ public class SelectServiceImpl implements SelectService {
List<TypeTreeNode> listL3 = new ArrayList<>();
List<TypeTreeNode> listL21 = new ArrayList<>();
try {
// 判断单位是否为班组如果为班组的话把材料站的领用数据也查询出来
if (bean.getUnitId() != null && bean.getProId() != null) {
List<AgreementVo> clzAgreementInfos = mapper.getAgreementInfoByIdBack(new SelectDto().setProId(bean.getProId()).setUnitId(Math.toIntExact(bean.getUnitId())));
// 如果在材料站该单位有签署协议说明该单位是班组
if (CollectionUtils.isNotEmpty(clzAgreementInfos)) {
bean.setClzAgreementId(Long.valueOf(clzAgreementInfos.get(0).getAgreementId()));
}
}
// 先查第四层类型
listL4 = mapper.getUseTypeTreeL4(bean);
if (CollectionUtils.isNotEmpty(listL4)) {

View File

@ -193,6 +193,12 @@ public class LeaseApplyDetails extends BaseEntity {
@ApiModelProperty(value = "编号")
private String code;
@ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType;
@ApiModelProperty(value = "是否检验0不检验1检验")
private String isCheck;
@ApiModelProperty(value = "领料物资名称汇总")
private String maTypeNames;
public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) {

View File

@ -1,6 +1,5 @@
package com.bonus.material.lease.mapper;
import java.util.Date;
import java.util.List;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseConfirmSign;
@ -75,6 +74,33 @@ public interface LeaseApplyInfoMapper {
*/
int deleteLeaseApplyInfoByIds(Long[] ids);
/**
* 查询领料任务的单位类型是否是班组
* @param leaseId 领料任务id
* @return 领料单位类型
*/
Long selectLeaseApplyInfoIsTeam(Long leaseId);
/**
* 根据单位id查询单位类型
*/
Long selectUnitTypeByUnitId(Long unitId);
/**
* 查询领料任务的单位ID
* @param leaseId 领料任务id
* @return 单位ID
*/
Long selectLeaseApplyInfoUnitIdByLeaseId(Long leaseId);
/**
* 根据班组ID和工程ID查询挂靠的项目部的协议id
* @param teamId 班组单位id
* @param projectId 工程id
* @return 挂靠的项目部协议id
*/
Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") Integer teamId, @Param("projectId") Integer projectId);
String getTaskId(Long parentId);
/** 设置审批人为默认的董班长 --防止代码冲突 **/

View File

@ -1273,6 +1273,22 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
@Override
public AjaxResult leaseOut(LeaseOutRequestVo leaseOutRequestVo) {
for (LeaseOutDetails bean : leaseOutRequestVo.getLeaseOutDetailsList()) {
if (Objects.isNull(bean)) {
continue;
}
// 默认设置领料单位为非班组
bean.setLeaseUnitIsTeam(false);
// 根据现在的领料发布出库单位ID来判断类型是否是班组
if (bean.getLeaseUnitId() != null) {
// 查询单位类型
Long leaseUnitTypeId = leaseApplyInfoMapper.selectUnitTypeByUnitId(Long.valueOf(bean.getLeaseUnitId()));
if (leaseUnitTypeId != null && Objects.equals(leaseUnitTypeId, 1731L)) {
System.out.println("发布出库的领料单位是班组,Yes");
bean.setLeaseUnitIsTeam(true);
} else {
System.out.println("发布出库的领料单位不是班组,No");
}
}
AjaxResult ajaxResult = leaseOutDetailsService.leaseOut(bean);
if (ajaxResult.isError()) {
return ajaxResult;

View File

@ -205,6 +205,27 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
// 5插入结算记录
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
record.setTaskId(taskId);
// 判断如果是班组领料则插入原本项目部的协议结算记录
if (record.getLeaseUnitIsTeam() != null && record.getLeaseUnitIsTeam()) {
// 暂存现在出库的班组单位ID
Integer thisOutId = record.getLeaseUnitId();
// 查询班组挂靠的项目部协议ID
Long projectUnitAgreementId = leaseApplyInfoMapper.selectProjectUnitAgreementIdByTeamAndProject(record.getLeaseUnitId(), record.getLeaseProjectId());
if (projectUnitAgreementId != null && projectUnitAgreementId > 0L) {
record.setProjectUnitAgreementId(projectUnitAgreementId);
} else {
return AjaxResult.error("出库失败,没有找到班组所属项目部协议信息");
}
// 查询申请领料的项目部单位ID
Long originLeaseUnitId = leaseApplyInfoMapper.selectLeaseApplyInfoUnitIdByLeaseId(record.getParentId());
record.setLeaseUnitId(Math.toIntExact(originLeaseUnitId));
// 插入项目部领料的结算记录
int inserts = insSltInfo(taskId, record);
System.out.println("插入原本项目部领料结算记录" + (inserts > 0 ? "成功" : "失败"));
// 恢复出库班组单位ID
record.setLeaseUnitId(thisOutId);
record.setLeaseUnitIsTeam(false);
}
res = insSltInfo(taskId, record);
if (res == 0) {
throw new RuntimeException("出库失败,插入结算记录失败");
@ -230,8 +251,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
if (task == null) {
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId());
String taskCode = genderTaskCode(thisMonthMaxOrder);
TmTask tmTask = new TmTask();
tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(),
TmTask tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(),
LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(),
null, thisMonthMaxOrder + 1, taskCode);
tmTask.setCreateTime(DateUtils.getNowDate());
@ -261,6 +281,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
bmAgreementInfo.setUnitId(tbTeam.getId());
} else {
bmAgreementInfo.setUnitId(bmTeam.getId());
// 修改班组信息
bmTeamMapper.update(tbTeam);
}
// 先根据班组和工程id查询若存在则直接返回不存在则新增
@ -313,6 +334,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
throw new Exception("更新clz_lease_apply_details表数据失败");
}
} else {
// 走新增
record.setPreNum(record.getOutNum());
record.setAlNum(record.getOutNum());
res = materialLeaseInfoMapper.insertLeaseApplyDetails(record);
@ -357,7 +379,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
}
} catch (Exception e) {
log.error(e.getMessage());
return AjaxResult.error("出库失败");
return AjaxResult.error("出库失败" + e.getMessage());
}
return AjaxResult.success("出库成功");
}
@ -758,21 +780,35 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
return res;
}
/**
* 插入结算信息
* @param taskId 任务id
* @param record 出库记录
*/
public int insSltInfo(String taskId, LeaseOutDetails record) {
int res = 0;
SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record);
// 根据发布批次查询结算协议信息
SltAgreementInfo sltAgreementInfo;
// 判断是否是班组领用
sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record);
if (sltAgreementInfo != null) {
BigDecimal num = sltAgreementInfo.getNum();
BigDecimal outNum = record.getOutNum();
sltAgreementInfo.setNum(num.add(outNum));
res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo);
record.setAgreementId(sltAgreementInfo.getAgreementId());
if (!record.getLeaseUnitIsTeam()) {
record.setAgreementId(sltAgreementInfo.getAgreementId());
}
} else {
String agreementId = " ";
agreementId = tmTaskAgreementMapper.getAgreementId(taskId);
String agreementId = tmTaskAgreementMapper.getAgreementId(taskId);
// 根据发布批次查询协议ID🆔
if (StringUtils.isNotBlank(record.getPublishTask())) {
agreementId = tmTaskAgreementMapper.selectAgreementId(record.getPublishTask());
}
if (record.getLeaseUnitIsTeam()) {
agreementId = String.valueOf(record.getProjectUnitAgreementId());
}
// 查询单位类型内部单位/外部单位
String protocol = bmAgreementInfoMapper.getProtocol(agreementId);
Type maType = typeMapper.getMaType(record.getTypeId());
if (StringUtils.isEmpty(protocol)) {
@ -787,7 +823,9 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
}
}
res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType);
record.setAgreementId(Long.valueOf(agreementId));
if (!record.getLeaseUnitIsTeam()) {
record.setAgreementId(Long.valueOf(agreementId));
}
}
return res;
}

View File

@ -127,7 +127,11 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
if (CollectionUtil.isEmpty(leaseApplyRequestVo.getLeaseApplyDetailsList())) {
return AjaxResult.error("请先添加领用任务物资明细");
}
// 根据单号查询此单号是否已经存在
List<LeaseApplyInfo> codeInfo = tmTaskMapper.selectLeaseApplyInfoByTaskNo(leaseApplyRequestVo.getLeaseApplyInfo().getCode());
if (CollectionUtil.isNotEmpty(codeInfo)) {
return AjaxResult.error("此业务单号已经存在,请叉掉后重新提交");
}
LeaseApplyInfo leaseApplyInfo = leaseApplyRequestVo.getLeaseApplyInfo();
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
Date nowDate = DateUtils.getNowDate();
@ -465,6 +469,10 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
}
if(!deptName.equals("")){
int thisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE_APPLY.getTaskTypeId());
int lzThisMonthMaxOrder = tmTaskMapper.getMonthMaxOrderByDate(DateUtils.getCurrentYear(), DateUtils.getCurrentMonth(), TmTaskTypeEnum.TM_TASK_LEASE.getTaskTypeId());
if (StringUtils.isBlank(leaseDeptInfo.getCompanySX())) {
thisMonthMaxOrder = Math.max(thisMonthMaxOrder, lzThisMonthMaxOrder);
}
taskCode = genderTaskCodeTwo(thisMonthMaxOrder,leaseDeptInfo.getCompanySX());
leaseDeptInfo.setTaskCode(taskCode);
}
@ -589,7 +597,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
if (0==sysWorkflowNode.getNodeSignType()){
//当前节点已经审核需要修改节点值
if (SysWorkflowRecordHistoryList.get(0) != null) {
// todo 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询
// 固定的人员id 修改成 判断人员/角色 如果是人员的话要进行二次查询
// String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
// leaseApplyInfoNew.setNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
// leaseApplyInfoNew.setConfigValue(configValueNew);

View File

@ -303,6 +303,16 @@ public class MachineController extends BaseController {
return machineService.getHisByCode(machine);
}
/**
* 根据qrcode查询机具历史信息-New查询安全工器具和工器具
* @param machine
* @return
*/
@GetMapping("/getHisByCodeNew")
public AjaxResult getHisByCodeNew(Machine machine) {
return machineService.getHisByCodeNew(machine);
}
/**
* 根据类型id获取编码
* @param machine

View File

@ -316,4 +316,9 @@ public class Machine extends BaseEntity {
private List<String> projectIdList;
private String supplierId;
/**
* 1-工器具2-安全工器具
*/
private int jiJuType;
}

View File

@ -188,4 +188,11 @@ public interface MachineMapper
* @return
*/
List<Machine> getInfoByTypeId(Machine machine);
/**
* 根据编码查询机具信息
* @param machine
* @return
*/
List<Machine> getHisByCodeNew(Machine machine);
}

View File

@ -133,4 +133,11 @@ public interface IMachineService
* @return
*/
List<Machine> getInfoByTypeId(Machine machine);
/**
* 根据编码查询机具历史信息-New查询安全工器具和工器具
* @param machine
* @return
*/
AjaxResult getHisByCodeNew(Machine machine);
}

View File

@ -433,6 +433,79 @@ public class MachineServiceImpl implements IMachineService
}
@Override
public AjaxResult getHisByCodeNew(Machine machine) {
try {
List<Machine> result = new ArrayList<>();
List<Machine> maList = machineMapper.getHisByCodeNew(machine);
if (CollectionUtils.isNotEmpty(maList)){
if(maList.size() == 1){
Machine baseInfo = maList.get(0);
if (baseInfo.getJiJuType()==2){
machine.setMaId(baseInfo.getMaId());
machine.setMaCode(baseInfo.getMaCode());
//2根据二维码查询初次入库时间
Machine inTime = machineMapper.getInTimeByQrcode(machine);
//服务工程次数检验次数
Machine serviceNum = machineMapper.getServiceNumByQrcode(machine);
//更换配件次数
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
//报废时间
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
//3根据机具id查询领退工程
Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
if (inTime != null){
Integer taskId = inTime.getTaskId();
if(taskId != null){
baseInfo.setInTime(inTime.getInTime()+"(新购)");
}else{
baseInfo.setInTime(inTime.getInTime());
}
}
if(serviceNum != null){
baseInfo.setServiceNum(serviceNum.getServiceNum());
}else{
baseInfo.setServiceNum(0);
}
if(checkNum != null){
baseInfo.setCheckNum(checkNum.getCheckNum());
}else{
baseInfo.setCheckNum(0);
}
if (scrapTime != null){
baseInfo.setScrapTime(scrapTime.getScrapTime());
}else{
baseInfo.setScrapTime("暂无");
}
if(leaseInfo != null){
baseInfo.setLeaseTime(leaseInfo.getLeaseTime());
baseInfo.setLeaseUnit(leaseInfo.getLeaseUnit());
baseInfo.setLeaseProject(leaseInfo.getLeaseProject());
baseInfo.setBackTime(leaseInfo.getBackTime());
baseInfo.setBackUnit(leaseInfo.getBackUnit());
baseInfo.setBackProject(leaseInfo.getBackProject());
}
result.add(baseInfo);
return success(result);
} else {
result.add(baseInfo);
return success(result);
}
} else {
return success(maList);
}
}else{
return error("暂无该设备信息");
}
} catch (Exception e) {
e.printStackTrace();
return error("暂无该设备信息");
}
}
/**
* 编码铭牌信息
* @param machine
@ -454,4 +527,5 @@ public class MachineServiceImpl implements IMachineService
return machineMapper.getInfoByTypeId(machine);
}
}

View File

@ -713,8 +713,6 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
typeMapper.updateType(type);
}
// 批量插入详情数据
// 将purchaseCheckDetailsList的status全部设置为2
purchaseCheckDetailsList.forEach(o -> o.setStatus(PurchaseTaskStatusEnum.TO_CHECK.getStatus()));
final int count = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckDetailsList);
if (0 < count) {
return AjaxResult.success("新增任务成功");
@ -1091,10 +1089,55 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
try {
final Long[] ids = {purchaseCheckDto.getPurchaseCheckInfo().getId()};
purchaseCheckDetailsMapper.deleteDetails(ids);
insertPurchaseCheckDetails(purchaseCheckDto.getPurchaseCheckDetailsList(), purchaseCheckDto.getPurchaseCheckInfo().getTaskId());
insertPurchaseCheckDetailsInfo(purchaseCheckDto.getPurchaseCheckDetailsList(), purchaseCheckDto.getPurchaseCheckInfo().getTaskId());
return purchaseCheckInfoMapper.updatePurchaseCheckInfo(purchaseCheckDto.getPurchaseCheckInfo());
} catch (final Exception e) {
throw new ServiceException("错误信息描述");
}
}
/**
* 批量插入新购验收任务详情
* @param purchaseCheckDetailsList
* @param taskId
* @return
*/
private int insertPurchaseCheckDetailsInfo(List<PurchaseCheckDetails> purchaseCheckDetailsList, Long taskId) {
int count = 0;
if (!CollectionUtils.isEmpty(purchaseCheckDetailsList)) {
for (PurchaseCheckDetails details : purchaseCheckDetailsList) {
details.setTaskId(taskId);
details.setStatus(Objects.equals(PurchaseTaskStatusEnum.TO_CHECK_AFTER_REJECT.getStatus(), details.getStatus()) ?
PurchaseTaskStatusEnum.TO_CHECK.getStatus() :
PurchaseTaskStatusEnum.TO_NOTICE.getStatus());
details.setInputStatus("0");
final List<BmFileInfo> bmFileInfos = details.getBmFileInfos();
if (!CollectionUtils.isEmpty(bmFileInfos)) {
bmFileInfos.forEach(o -> {
o.setTaskId(taskId);
o.setModelId(details.getTypeId());
o.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
o.setCreateTime(DateUtils.getNowDate());
});
bmFileInfoMapper.insertBmFileInfos(bmFileInfos);
}
Type type = new Type();
type.setTypeId(details.getTypeId());
type.setUpdateTime(DateUtils.getNowDate());
type.setUpdateBy(SecurityUtils.getLoginUser().getUserid().toString());
type.setBuyPrice(details.getPurchaseTaxPrice());
type.setNotTaxPrice(details.getPurchasePrice());
Type maType = typeMapper.getMaType(details.getTypeId());
if (maType != null && (maType.getRentPrice() == null || maType.getRentPrice().compareTo(BigDecimal.ZERO) == 0)) {
type.setRentPrice(details.getRentPrice());
}
typeMapper.updateType(type);
}
// 批量插入详情数据
// 将purchaseCheckDetailsList的status全部设置为2
purchaseCheckDetailsList.forEach(o -> o.setStatus(PurchaseTaskStatusEnum.TO_CHECK.getStatus()));
count = purchaseCheckDetailsMapper.insertPurchaseCheckDetailsList(purchaseCheckDetailsList);
}
return count;
}
}

View File

@ -330,7 +330,6 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
}
for (SltAgreementInfo lose : loseList) {
if (lose.getAgreementId().equals(sltInfo.getAgreementId().toString())) {
//TODO 上面已经set过值这里为什么还要set值
relation.setAgreementId(String.valueOf(lose.getAgreementId()));
relation.setProjectName(lose.getProjectName());
relation.setUnitName(lose.getUnitName());

View File

@ -3,6 +3,7 @@ package com.bonus.material.task.mapper;
import java.util.Date;
import java.util.List;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.basic.domain.BmUnit;
@ -137,4 +138,11 @@ public interface TmTaskMapper {
* @return
*/
BmUnit selectBmUnitInfo(BackApplyInfo backApplyInfo);
/**
* 根据任务编号查询任务信息
* @param code
* @return
*/
List<LeaseApplyInfo> selectLeaseApplyInfoByTaskNo(String code);
}

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="agreementCode" column="agreement_code" />
<result property="signTime" column="sign_time" />
<result property="unitId" column="unit_id" />
<result property="projectUnitId" column="project_unit_id" />
<result property="unitName" column="unit_name" />
<result property="createBy" column="create_by" />
<result property="leaseDay" column="lease_day" />
@ -28,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBmAgreementInfoList" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" resultMap="BmAgreementInfoResult">
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,bai.branch_project as branchProIdsStr
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBmAgreementInfoByAgreementId" parameterType="Long" resultMap="BmAgreementInfoResult">
SELECT bai.agreement_id, bai.agreement_code , contract_code,sign_time,
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
bu.unit_id, bai.project_unit_id, bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol,tta.task_id,bai.branch_project as branchProIdsStr
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
@ -74,14 +75,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" useGeneratedKeys="true" keyProperty="agreementId">
insert into bm_agreement_info (agreement_code, sign_time, unit_id,
insert into bm_agreement_info (agreement_code, sign_time, unit_id, project_unit_id,
project_id, create_by, lease_day,
plan_start_time, contract_code, auth_person,
phone, create_time, update_by,
update_time, remark, company_id, protocol,
branch_project
)
values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER},
values (#{agreementCode,jdbcType=VARCHAR}, #{signTime,jdbcType=VARCHAR}, #{unitId,jdbcType=INTEGER}, #{projectUnitId,jdbcType=INTEGER},
#{projectId,jdbcType=INTEGER}, #{createBy,jdbcType=VARCHAR}, #{leaseDay,jdbcType=INTEGER},
#{planStartTime,jdbcType=TIMESTAMP}, #{contractCode,jdbcType=VARCHAR}, #{authPerson,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
@ -113,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="agreementCode != null">agreement_code = #{agreementCode},</if>
<if test="signTime != null">sign_time = #{signTime},</if>
<if test="unitId != null">unit_id = #{unitId},</if>
<if test="projectUnitId != null">project_unit_id = #{projectUnitId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="leaseDay != null">lease_day = #{leaseDay},</if>

View File

@ -556,8 +556,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
WHERE
sai.end_time IS NULL
AND sai.back_id IS NULL
sai.`status` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
AND sai.`is_slt` = '0'
<if test="typeId != null">
AND sai.type_id = #{typeId}
</if>
@ -707,12 +709,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectInFo" resultType="com.bonus.material.basic.domain.UseStorageInfo">
SELECT
create_time as outTime,
GROUP_CONCAT( DISTINCT create_by ) AS creator
lod.create_time AS outTime,
GROUP_CONCAT(DISTINCT
CASE
WHEN lod.create_by REGEXP '^[0-9]+$' THEN su.nick_name -- 如果是纯数字,使用昵称
ELSE lod.create_by -- 否则直接使用create_by的值
END
) AS creator
FROM
lease_out_details
WHERE parent_id = #{leaseId}
GROUP BY parent_id
lease_out_details lod
LEFT JOIN sys_user su ON lod.create_by = su.user_id
WHERE lod.parent_id = #{leaseId}
GROUP BY lod.parent_id
LIMIT 1
</select>

View File

@ -663,11 +663,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.unit_value as unitValue,
mt.manage_type as manageType,
SUM(sai.num) AS num,
mt.LEVEL as level
mt.LEVEL as level,
clai.lease_style as leaseStyle
FROM
ma_type mt
LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id
WHERE
sai.STATUS = '0' and sai.agreement_id = #{agreementId}
GROUP BY

View File

@ -216,13 +216,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.LEVEL as level
FROM
ma_type mt
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
WHERE
sai.STATUS = '0' and sai.agreement_id = #{agreementId}
GROUP BY
mt.type_id
HAVING num> 0
HAVING
num > 0
<if test="clzAgreementId != null and clzAgreementId != 0">
union all
SELECT
mt.type_id as typeId,
mt1.type_name as materialName,
mt.type_name as typeName,
mt.parent_id as parentId,
mt.unit_name as unitName,
mt.unit_value as unitValue,
mt.manage_type as manageType,
SUM( IF(sai.agreement_id = #{clzAgreementId} AND sai.STATUS = '0', sai.num, 0) ) AS num,
mt.LEVEL as level
FROM
ma_type mt
LEFT JOIN clz_slt_agreement_info sai ON mt.type_id = sai.type_id
LEFT JOIN clz_lease_apply_info clai ON sai.lease_id = clai.id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
WHERE
sai.STATUS = '0' and clai.lease_style != 2
GROUP BY
mt.type_id
HAVING
num> 0
</if>
</select>
<select id="getUseTypeTreeL3" resultType="com.bonus.common.biz.domain.TypeTreeNode">
@ -753,6 +780,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
team_id as unitId
FROM pro_authorize_info
WHERE lease_id = #{leaseId}
limit 1
</select>
<select id="getBackDeviceTypeTree" resultType="com.bonus.common.biz.domain.TreeNode">
SELECT mt.type_id AS id,
@ -819,4 +847,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE bu.del_flag = '0'
and bzgl_bz.project_id = #{externalId}
</select>
<select id="getUseTypeClzTree" resultType="com.bonus.common.biz.domain.TypeTreeNode">
SELECT
mt.type_id as typeId,
mt1.type_name as materialName,
mt.type_name as typeName,
mt.parent_id as parentId,
mt.unit_name as unitName,
mt.unit_value as unitValue,
mt.manage_type as manageType,
SUM(sai.num) AS num,
mt.LEVEL as level,
mt.jiju_type as jijuType,
mt.is_check as isCheck
FROM
ma_type mt
LEFT JOIN slt_agreement_info sai ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id and mt1.del_flag = '0'
WHERE
sai.STATUS = '0' and sai.agreement_id = #{agreementId}
GROUP BY
mt.type_id
HAVING
num > 0
</select>
</mapper>

View File

@ -451,7 +451,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lad.update_by as updateBy,
lad.update_time as updateTime,
lad.remark as remark,
lad.company_id as companyId
lad.company_id as companyId,
mt.jiju_type as jijuType,
mt.is_check as isCheck
from lease_apply_details lad
left join
ma_type mt on lad.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0'
@ -605,7 +607,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.storage_num, 0)
END as storageNum
END as storageNum,
mt.jiju_type as jijuType,
mt.is_check as isCheck
FROM
lease_publish_details lpd
LEFT JOIN ma_type mt ON lpd.new_type = mt.type_id

View File

@ -824,4 +824,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sys_user
where user_name = #{cno}
</select>
<select id="selectLeaseApplyInfoIsTeam" resultType="java.lang.Long">
select
bu.type_id as typeId
from
lease_apply_info lai
left join bm_unit bu on lai.unit_id = bu.unit_id
where
lai.id = #{leaseId}
</select>
<select id="selectLeaseApplyInfoUnitIdByLeaseId" resultType="java.lang.Long">
select
lai.unit_id as unitId
from
lease_apply_info lai
where
lai.id = #{leaseId}
</select>
<select id="selectUnitTypeByUnitId" resultType="java.lang.Long">
select type_id as typeId
from bm_unit
where unit_id = #{unitId}
</select>
<select id="selectProjectUnitAgreementIdByTeamAndProject" resultType="java.lang.Long">
SELECT
baii.agreement_id AS projectUnitAgreementId
FROM
bm_agreement_info bai
LEFT JOIN bm_agreement_info baii ON baii.unit_id = bai.project_unit_id AND baii.project_id = #{projectId}
WHERE
bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
</select>
</mapper>

View File

@ -392,8 +392,8 @@
case tt.task_status
when 0 then '待审核'
when 6 then '审核中'
when 3 then '已驳回'
when 2 then '已完成'
when 3 then '已完成'
when 2 then '已驳回'
when 5 then '待提交'
end as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,

View File

@ -75,7 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ma.inspect_man as inspectMan,
ma.inspect_status as inspectStatus,
ma.phone as phone,
mt.jiju_type as jijuType,
mt.jiju_type as jiJuType,
mt.is_check as isCheck,
CASE
WHEN RIGHT(ma.ma_code, 4) REGEXP '^[0-9]{4}$' THEN CAST(RIGHT(ma.ma_code, 4) AS UNSIGNED)
@ -578,7 +578,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mm.type_id as typeId,
sd.dict_label as maStatus,
mm.qr_code as qrCode,
mm.ma_vender as maVender,
msi.supplier as maVender,
mm.out_fac_time as outFacTime,
mm.out_fac_code as outFacCode,
mm.assets_code as assetsCode,
@ -591,6 +591,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN sys_dict_data sd on mm.ma_status = sd.dict_value and sd.dict_type = "ma_machine_status"
LEFT JOIN ma_supplier_info msi on msi.supplier_id = mm.ma_vender
where mm.qr_code = #{qrCode}
</select>
@ -786,4 +787,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and wsi.ma_code LIKE CONCAT('%',#{maCode},'%')
</if>
</select>
<select id="getHisByCodeNew" resultType="com.bonus.material.ma.domain.Machine">
(
SELECT
mm.ma_id as maId,
mt2.type_name as maName,
mt.type_name as maModel,
mm.ma_code as maCode,
mm.qr_code as qrCode,
mm.type_id as typeId,
sd.dict_label as maStatus,
mm.ma_vender as maVender,
mm.out_fac_time as outFacTime,
mm.out_fac_code as outFacCode,
mm.assets_code as assetsCode,
mm.check_man as checkMan,
mm.this_check_time as thisCheckTime,
mm.next_check_time as nextCheckTime,
mm.in_out_num as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value AND sd.dict_type = 'ma_machine_status'
WHERE
1=1
<if test="maCode != null"> and mm.ma_code LIKE CONCAT('%',#{maCode}, '%') </if>
<if test="maId != null">and mm.ma_id = #{maId}</if>
LIMIT 100
)
UNION ALL
(
SELECT
wmi.id as maId,
mt2.type_name as maName,
mt.type_name as maModel,
wmi.ma_code as maCode,
wmi.qr_code as qrCode,
wmi.model_id as typeId,
'' as maStatus,
wmi.supplier as maVender,
'' as outFacTime,
'' as outFacCode,
'' as assetsCode,
wmi.check_man as checkMan,
wmi.this_check_time as thisCheckTime,
wmi.next_check_time as nextCheckTime,
'' as inOutNum,
mt.jiju_type as jiJuType,
mt.is_check as isCheck
FROM ws_ma_info wmi
LEFT JOIN ma_type mt ON mt.type_id = wmi.model_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
WHERE
1=1
<if test="maCode != null"> and wmi.ma_code LIKE CONCAT('%',#{maCode}, '%')</if>
<if test="maId != null">and wmi.id = #{maId}</if>
LIMIT 100
)
</select>
</mapper>

View File

@ -177,6 +177,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="publishTask != null and publishTask != ''">
AND publish_task = #{publishTask}
</if>
<if test="leaseUnitIsTeam">
AND agreement_id = #{projectUnitAgreementId}
</if>
<if test="!leaseUnitIsTeam">
AND agreement_id = #{agreementId}
</if>
AND
DATE(start_time) = CURDATE();
</select>

View File

@ -215,4 +215,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
unit_id = #{unitId}
</select>
<select id="selectLeaseApplyInfoByTaskNo" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
SELECT
task_id as taskId,
code as code
FROM
tm_task
WHERE
code = #{code}
</select>
</mapper>