改配件申请100%
This commit is contained in:
parent
ed6140bbd9
commit
3c3c173ff6
@ -256,9 +256,11 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
sois.stream().filter(i -> i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> {
|
sois.stream().filter(i -> i.getGoodsId().equals(wares.getId())).findFirst().ifPresent(repairSoiByWares -> {
|
||||||
if (so.getSoType().equals("02")){
|
if (so.getSoType().equals("02")){
|
||||||
wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
wares.setStock(item.getStock().add(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
||||||
}else {
|
|
||||||
wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
|
||||||
}
|
}
|
||||||
|
// 采购改了入库逻辑,不能在这里扣库存
|
||||||
|
// else {
|
||||||
|
// wares.setStock(item.getStock().subtract(BigDecimal.valueOf(repairSoiByWares.getGoodsCount())));
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
newWares.add(wares);
|
newWares.add(wares);
|
||||||
});
|
});
|
||||||
|
@ -60,7 +60,7 @@ public class DlTicketWares extends TenantBaseDO {
|
|||||||
/** 维修顾问name(system_user的nickname) */
|
/** 维修顾问name(system_user的nickname) */
|
||||||
private String adviserName;
|
private String adviserName;
|
||||||
|
|
||||||
/** 状态:01待审批、02已审批、03已驳回,ticket_wares_status */
|
/** 状态:01待审批、02已审批,ticket_wares_status */
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 备注 */
|
/** 备注 */
|
||||||
|
@ -1244,20 +1244,21 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
|||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public boolean syncTicketWaresToTicket(String id) {
|
public boolean syncTicketWaresToTicket(String id) {
|
||||||
// 先查满足条件的申请表
|
// 先查满足条件的申请表---配件申请表现在只有待审批和已审批,并且其子表的数据也可能同时有两种情况
|
||||||
ArrayList<String> status = new ArrayList<>();
|
// ArrayList<String> status = new ArrayList<>();
|
||||||
status.add("01"); // 待审核
|
// status.add("01"); // 待审核
|
||||||
status.add("05"); // 已驳回
|
// status.add("05"); // 已驳回
|
||||||
// 查工单所有已通过的配件申请单
|
// 查工单所有已通过的配件申请单----这里直接查全部
|
||||||
List<DlTicketWares> list = ticketWaresService.list(new LambdaQueryWrapper<DlTicketWares>().and(item -> {
|
List<DlTicketWares> list = ticketWaresService.list(new LambdaQueryWrapper<DlTicketWares>().and(item -> {
|
||||||
item.eq(DlTicketWares::getTicketId, id)
|
item.eq(DlTicketWares::getTicketId, id);
|
||||||
.notIn(DlTicketWares::getStatus, status);
|
// .notIn(DlTicketWares::getStatus, status);
|
||||||
}));
|
}));
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
// 查配件申请表的所有已领取数量小于申请数量的子表信息
|
// 查配件申请表的所有已领取数量小于申请数量的子表信息----这里需要加上一个条件,得是审核通过的才行
|
||||||
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
List<String> ids = list.stream().map(DlTicketWares::getId).collect(Collectors.toList());
|
||||||
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
List<DlTwItem> twItems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().and(item -> {
|
||||||
item.in(DlTwItem::getTwId, ids)
|
item.in(DlTwItem::getTwId, ids)
|
||||||
|
.eq(DlTwItem::getWaresStatus, "1")
|
||||||
.apply("wares_already_count < wares_count");
|
.apply("wares_already_count < wares_count");
|
||||||
}));
|
}));
|
||||||
if (CollectionUtil.isNotEmpty(twItems)) {
|
if (CollectionUtil.isNotEmpty(twItems)) {
|
||||||
|
@ -9,6 +9,7 @@ import cn.iocoder.yudao.common.SoStatusEnum;
|
|||||||
import cn.iocoder.yudao.common.TicketsItemStatusEnum;
|
import cn.iocoder.yudao.common.TicketsItemStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
||||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||||
@ -138,7 +139,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
}
|
}
|
||||||
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
} else if (userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||||
// 维修仓库管理员
|
// 维修仓库管理员
|
||||||
reqVO.setStatus(null);
|
|
||||||
reqVO.setUserRole(5);
|
reqVO.setUserRole(5);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@ -212,7 +212,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
.map(item -> {
|
.map(item -> {
|
||||||
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
|
DlTwItem twItem = BeanUtil.toBean(item, DlTwItem.class);
|
||||||
twItem.setTwId(ticketWares.getId());
|
twItem.setTwId(ticketWares.getId());
|
||||||
twItem.setWaresStatus("0");
|
twItem.setWaresStatus("");
|
||||||
|
twItem.setWaresAlreadyCount(0);
|
||||||
return twItem;
|
return twItem;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
@ -260,115 +261,87 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
public void auditTicketWares(DlTicketWaresRespVO respVO) {
|
public void auditTicketWares(DlTicketWaresRespVO respVO) {
|
||||||
// 设置单据状态
|
// 取出前端传的单据状态,这里是前端传的,只有两个,01通过,02驳回
|
||||||
//配件申请单id
|
|
||||||
String mainId = respVO.getId();
|
|
||||||
//单据状态 02 通过 05驳回
|
|
||||||
String status = respVO.getStatus();
|
String status = respVO.getStatus();
|
||||||
//配件信息
|
// 取出前端操作的配件申请表的子项id
|
||||||
List<DlRepairTitem> repairItemList = respVO.getWares();
|
List<String> twItemIds = respVO.getItems().stream().map(DlTwItem::getId).collect(Collectors.toList());
|
||||||
DlTicketWares updateObj = this.getById(mainId);
|
// 查所有的子项
|
||||||
String ticketMainId = updateObj.getTicketId();
|
List<DlTwItem> twItems = twItemService.listByIds(twItemIds);
|
||||||
updateObj.setStatus(status);
|
// 取所有的配件信息
|
||||||
this.updateById(updateObj);
|
List<String> wareIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
|
||||||
// 如果是通过并且是领料就还需要把配件信息加入到工单中
|
List<RepairWares> repairWares = repairWaresService.listByIds(wareIds);
|
||||||
if (ObjectUtil.isNotEmpty(status) && status.equals("02")) {
|
// 更新配件申请表子表
|
||||||
// 更新维修工单
|
List<DlTwItem> newTwitems = twItemIds.stream().map(item -> {
|
||||||
if(null!=respVO.getRepairWaresList()){
|
DlTwItem twItem = new DlTwItem();
|
||||||
repairItemList= new ArrayList<>();
|
twItem.setId(item);
|
||||||
//走的是更新配件库价格
|
twItem.setWaresStatus(status.equals("01") ? "1" : "0");
|
||||||
Map<String,BigDecimal> updateMap = respVO.getRepairWaresList().stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getPrice));
|
twItem.setHandleId(SecurityFrameworkUtils.getLoginUserId());
|
||||||
//更新配件库的价格
|
twItem.setHandleName(SecurityFrameworkUtils.getLoginUserNickname());
|
||||||
List<RepairWares> updateWaresList = new ArrayList<>();
|
return twItem;
|
||||||
//去库里面查需要的配件
|
}).collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<DlTwItem> queryWrapper = new LambdaQueryWrapper<DlTwItem>()
|
twItemService.updateBatchById(newTwitems);
|
||||||
.eq(DlTwItem::getTwId, mainId);
|
// 更新配件申请主表
|
||||||
List<DlTwItem> applyList = twItemService.list(queryWrapper);
|
List<DlTwItem> allTwitems = twItemService.list(new LambdaQueryWrapper<DlTwItem>().in(DlTwItem::getTwId, respVO.getId()));
|
||||||
if (!applyList.isEmpty()) {
|
List<DlTwItem> passTwitems = allTwitems.stream().filter(item -> item.getWaresStatus().equals("1") || item.getWaresStatus().equals("0")).collect(Collectors.toList());
|
||||||
//查配件库
|
boolean isStatus = CollectionUtil.isNotEmpty(passTwitems) && passTwitems.size() == allTwitems.size();
|
||||||
List<RepairWares> waresList = repairWaresService.listByIds(applyList.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()));
|
if (isStatus) {
|
||||||
Map<String, RepairWares> waresMap = waresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
|
baseMapper.update(new LambdaUpdateWrapper<DlTicketWares>().set(DlTicketWares::getStatus, "02").eq(DlTicketWares::getId, respVO.getId()));
|
||||||
//组装工单子表数据
|
}
|
||||||
for (DlTwItem item : applyList) {
|
// 更新维修工单子表
|
||||||
DlRepairTitem repairTitem = new DlRepairTitem();
|
if (status.equals("01")) {
|
||||||
repairTitem.setTicketId(ticketMainId);
|
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
|
||||||
repairTitem.setItemCount(item.getWaresCount());
|
List<DlRepairTitem> titems = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
|
||||||
repairTitem.setItemName(item.getWaresName());
|
i.in(DlRepairTitem::getTicketId, ticketWares.getTicketId())
|
||||||
repairTitem.setItemUnit(waresMap.get(item.getWaresId()).getUnit());
|
.eq(DlRepairTitem::getItemType, "02");
|
||||||
//取前端传过来的销售价格
|
}));
|
||||||
repairTitem.setItemPrice(updateMap.get(item.getId()));
|
// 要修改的
|
||||||
//默认不打折为1
|
List<DlRepairTitem> updateTitems = titems.stream().filter(item -> wareIds.contains(item.getPartId())).collect(Collectors.toList());
|
||||||
repairTitem.setItemDiscount(new BigDecimal(1));
|
// 修改
|
||||||
repairTitem.setItemMoney(new BigDecimal(repairTitem.getItemCount()).multiply(repairTitem.getItemPrice()));
|
if (CollectionUtil.isNotEmpty(updateTitems)) {
|
||||||
//类型是配件
|
List<DlRepairTitem> newTitems = updateTitems.stream().map(item -> {
|
||||||
repairTitem.setItemType("02");
|
DlRepairTitem titem = new DlRepairTitem();
|
||||||
repairTitem.setPartId(item.getWaresId());
|
titem.setId(item.getId());
|
||||||
repairTitem.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
|
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getPartId())).findFirst().orElse(null);
|
||||||
repairItemList.add(repairTitem);
|
if (twItem != null) {
|
||||||
//组装配件库更新价格
|
titem.setItemCount(item.getItemCount() + twItem.getWaresCount());
|
||||||
RepairWares update = new RepairWares();
|
titem.setItemMoney(item.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(item.getItemDiscount()));
|
||||||
update.setId(item.getWaresId());
|
|
||||||
update.setPrice(updateMap.get(item.getId()));
|
|
||||||
updateWaresList.add(update);
|
|
||||||
}
|
}
|
||||||
}
|
return titem;
|
||||||
if(!updateWaresList.isEmpty()){
|
|
||||||
repairWaresService.updateBatchById(updateWaresList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 更新维修工单子表----需要合并相同的配件,故修改
|
|
||||||
// 先查维修工单的子表中的配件相关的信息
|
|
||||||
List<DlRepairTitem> oldTitem = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> i.eq(DlRepairTitem::getTicketId, ticketMainId).eq(DlRepairTitem::getItemType, "02")));
|
|
||||||
// 过滤出新申请的配件里面有没有已经存在于工单子表的
|
|
||||||
List<String> waresIds = oldTitem.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
|
|
||||||
List<DlRepairTitem> already = repairItemList.stream().filter(item -> waresIds.contains(item.getPartId())).collect(Collectors.toList());
|
|
||||||
// 更新已经存在的配件
|
|
||||||
if (CollectionUtil.isNotEmpty(already)) {
|
|
||||||
List<DlRepairTitem> updateItems = new ArrayList<>();
|
|
||||||
already.forEach(item -> {
|
|
||||||
DlRepairTitem titem = oldTitem.stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().orElse(null);
|
|
||||||
if (titem != null) {
|
|
||||||
DlRepairTitem newItem = new DlRepairTitem();
|
|
||||||
newItem.setId(titem.getId());
|
|
||||||
newItem.setItemCount(titem.getItemCount() + item.getItemCount());
|
|
||||||
// 如果设置了折扣就用,没有就是1
|
|
||||||
BigDecimal itemDiscount = titem.getItemDiscount() == null ? new BigDecimal(1) : titem.getItemDiscount();
|
|
||||||
// titem取价格、newItem取数量
|
|
||||||
newItem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(newItem.getItemCount())).multiply(itemDiscount));
|
|
||||||
updateItems.add(newItem);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (CollectionUtil.isNotEmpty(updateItems)) {
|
|
||||||
repairTitemService.updateBatchById(updateItems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 新增维修工单中没有的配件
|
|
||||||
List<DlRepairTitem> newItems = repairItemList.stream().filter(item -> !waresIds.contains(item.getPartId())).collect(Collectors.toList());
|
|
||||||
newItems.forEach(item -> {
|
|
||||||
// 主表id
|
|
||||||
item.setTicketId(ticketMainId);
|
|
||||||
// 类型为配件
|
|
||||||
item.setItemType("02");
|
|
||||||
// 状态为未领料
|
|
||||||
item.setItemStatus(TicketsItemStatusEnum.WAITING_RECEIVE.getCode());
|
|
||||||
});
|
|
||||||
repairTitemService.saveBatch(newItems);
|
|
||||||
|
|
||||||
// 重新计算工单
|
|
||||||
boolean flag = repairTicketsService.computeTicket(ticketMainId);
|
|
||||||
if (!flag) {
|
|
||||||
throw exception0(500, "系统异常");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新仓库
|
|
||||||
if (CollectionUtil.isNotEmpty(repairItemList)){
|
|
||||||
List<RepairWares> updateWares = repairItemList.stream().map(item -> {
|
|
||||||
RepairWares wares = new RepairWares();
|
|
||||||
wares.setId(item.getPartId());
|
|
||||||
wares.setPrice(item.getItemPrice());
|
|
||||||
return wares;
|
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
repairWaresService.updateBatchById(updateWares);
|
repairTitemService.updateBatchById(newTitems);
|
||||||
|
}
|
||||||
|
// 要新增的
|
||||||
|
if (updateTitems.size() < wareIds.size()) {
|
||||||
|
List<String> titemIds = updateTitems.stream().map(DlRepairTitem::getPartId).collect(Collectors.toList());
|
||||||
|
List<RepairWares> newWares = repairWares.stream().filter(item -> !titemIds.contains(item.getId())).collect(Collectors.toList());
|
||||||
|
// 新增
|
||||||
|
List<DlRepairTitem> newTitems = newWares.stream().map(item -> {
|
||||||
|
DlRepairTitem titem = new DlRepairTitem();
|
||||||
|
titem.setTicketId(ticketWares.getTicketId());
|
||||||
|
titem.setItemType("02");
|
||||||
|
titem.setItemName(item.getName());
|
||||||
|
DlTwItem twItem = allTwitems.stream().filter(i -> i.getWaresId().equals(item.getId())).findFirst().orElse(null);
|
||||||
|
titem.setItemCount(twItem != null ? twItem.getWaresCount() : 0);
|
||||||
|
titem.setItemUnit(item.getUnit());
|
||||||
|
titem.setItemPrice(item.getPrice() != null ? item.getPrice() : BigDecimal.ZERO);
|
||||||
|
titem.setItemDiscount(BigDecimal.ONE);
|
||||||
|
titem.setItemMoney(titem.getItemPrice().multiply(BigDecimal.valueOf(titem.getItemCount())).multiply(titem.getItemDiscount()));
|
||||||
|
titem.setRepairIds(String.valueOf(ticketWares.getRepairId()));
|
||||||
|
titem.setRepairNames(ticketWares.getRepairName());
|
||||||
|
titem.setSaleId(ticketWares.getAdviserId());
|
||||||
|
titem.setSaleName(ticketWares.getAdviserName());
|
||||||
|
titem.setPartId(item.getId());
|
||||||
|
titem.setItemStatus("04");
|
||||||
|
titem.setRemark(twItem != null ? twItem.getRemark() : null);
|
||||||
|
return titem;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
repairTitemService.saveBatch(newTitems);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新维修工单主表
|
||||||
|
boolean flag = repairTicketsService.computeTicket(ticketWares.getTicketId());
|
||||||
|
if (!flag) {
|
||||||
|
throw exception0(500, "重新计算工单错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送通过的消息给仓库
|
// 发送通过的消息给仓库
|
||||||
@ -378,14 +351,12 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
|
ids.forEach(id -> repairWorkerService.sentMessage(id, "您有新的配件申请单需要处理"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果是驳回,通知维修工
|
// 通知维修工
|
||||||
if (status.equals("05")) {
|
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
|
||||||
// 发送没有通过的消息给员工
|
repairWorkerService.sentMessage(ticketWares.getRepairId(), "您有新的配件申请单" + (status.equals("01") ? "审批通过了" : "被驳回了"));
|
||||||
DlTicketWares ticketWares = baseMapper.selectById(respVO.getId());
|
|
||||||
repairWorkerService.sentMessage(ticketWares.getRepairId(), "您的配件申请单被驳回了");
|
|
||||||
}
|
|
||||||
//插入记录
|
//插入记录
|
||||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(),null,RecordTypeEnum.SPPJSQD.getCode(),"审批配件申请单",null);
|
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, RecordTypeEnum.SPPJSQD.getCode(), "审批配件申请单", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -450,14 +421,14 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
}));
|
}));
|
||||||
// 要操作的库存数据
|
// 要操作的库存数据
|
||||||
List<RepairWares> wares = repairWaresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
|
List<RepairWares> wares = repairWaresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
|
||||||
Map<String,String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId,RepairWares::getName));
|
Map<String, String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName));
|
||||||
String remarkStr="";
|
String remarkStr = "";
|
||||||
for(DlRepairSoi item:respVO.getRepairSois()){
|
for (DlRepairSoi item : respVO.getRepairSois()) {
|
||||||
//组装通知领取配件的文字
|
//组装通知领取配件的文字
|
||||||
if(!"".equals(remarkStr)){
|
if (!"".equals(remarkStr)) {
|
||||||
remarkStr +=";";
|
remarkStr += ";";
|
||||||
}
|
}
|
||||||
remarkStr += waresNameMap.get(item.getGoodsId())+"x"+item.getGoodsCount();
|
remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount();
|
||||||
}
|
}
|
||||||
if (type.equals("02")) { // 领料
|
if (type.equals("02")) { // 领料
|
||||||
// 构造新数据
|
// 构造新数据
|
||||||
@ -472,8 +443,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
Integer waresAlreadyCount = item.getWaresAlreadyCount() == null ? 0 : item.getWaresAlreadyCount();
|
Integer waresAlreadyCount = item.getWaresAlreadyCount() == null ? 0 : item.getWaresAlreadyCount();
|
||||||
// 取本来的已领取数量+本次要领取的数量
|
// 取本来的已领取数量+本次要领取的数量
|
||||||
dlTwItem.setWaresAlreadyCount(repairSoi.getGoodsCount() + waresAlreadyCount);
|
dlTwItem.setWaresAlreadyCount(repairSoi.getGoodsCount() + waresAlreadyCount);
|
||||||
// 如果已领取数量等于申请数量,那这个配件就是领料完了,为01已领料,反之不变
|
// 如果已领取数量等于申请数量,那这个配件就是领料完了,为01已领料,反之不变----这里不变了
|
||||||
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
|
// dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "01" : item.getWaresStatus());
|
||||||
});
|
});
|
||||||
return dlTwItem;
|
return dlTwItem;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
@ -501,8 +472,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
// 取本来的已领取数量-本次要退料的数量
|
// 取本来的已领取数量-本次要退料的数量
|
||||||
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount());
|
dlTwItem.setWaresAlreadyCount(item.getWaresAlreadyCount() - repairSoi.getGoodsCount());
|
||||||
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
|
// dlTwItem.setWaresStatus(repairSoi.getGoodsCount().equals(item.getWaresCount()) ? "04" : item.getWaresStatus());
|
||||||
// 如果可领料数量等于申请数量,那这个配件就是退料完了,为03已退料,反之不变
|
// 如果可领料数量等于申请数量,那这个配件就是退料完了,为03已退料,反之不变---这里也不变了
|
||||||
dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0");
|
// dlTwItem.setWaresStatus(item.getWaresCount().equals(dlTwItem.getWaresAlreadyCount()) ? "1" : "0");
|
||||||
});
|
});
|
||||||
return dlTwItem;
|
return dlTwItem;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
@ -542,8 +513,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
// }
|
// }
|
||||||
//插入记录
|
//插入记录
|
||||||
//最后记录操作日志--创建工单
|
//最后记录操作日志--创建工单
|
||||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type)?RecordTypeEnum.TZLL.getCode():RecordTypeEnum.TZTL.getCode(),
|
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type) ? RecordTypeEnum.TZLL.getCode() : RecordTypeEnum.TZTL.getCode(),
|
||||||
("02".equals(type)?"通知领料":"通知退料")+",配件明细:"+remarkStr, null);
|
("02".equals(type) ? "通知领料" : "通知退料") + ",配件明细:" + remarkStr, null);
|
||||||
// 通知维修工
|
// 通知维修工
|
||||||
// 查维修工的userId
|
// 查维修工的userId
|
||||||
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");
|
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");
|
||||||
@ -559,7 +530,6 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
@Override
|
@Override
|
||||||
@DSTransactional
|
@DSTransactional
|
||||||
public void repairPassTicketWares(DlTicketWaresRespVO respVO) {
|
public void repairPassTicketWares(DlTicketWaresRespVO respVO) {
|
||||||
// todo
|
|
||||||
// // 更新领料申请子表
|
// // 更新领料申请子表
|
||||||
// twItemService.updateBatchById(respVO.getItems());
|
// twItemService.updateBatchById(respVO.getItems());
|
||||||
// // 更新领料申请表
|
// // 更新领料申请表
|
||||||
|
@ -23,7 +23,7 @@ public class DlTicketWaresReqVO extends DlTicketWares {
|
|||||||
/** 角色 */
|
/** 角色 */
|
||||||
private Integer userRole;
|
private Integer userRole;
|
||||||
|
|
||||||
/** 查看可以退料的数据时为tru */
|
/** 查看可以退料的数据时为true */
|
||||||
private Boolean isBack;
|
private Boolean isBack;
|
||||||
|
|
||||||
/** 查看待审核的数据时为true */
|
/** 查看待审核的数据时为true */
|
||||||
|
@ -48,14 +48,14 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="getPage" resultMap="BaseResultMap">
|
<select id="getPage" resultMap="BaseResultMap">
|
||||||
<include refid="Base_SQL" />
|
<include refid="Base_SQL"/>
|
||||||
<if test="map.query != null and map.query != ''">
|
<if test="map.query != null and map.query != ''">
|
||||||
and (
|
and (
|
||||||
dtw.no like concat('%', #{map.query}, '%')
|
dtw.no like concat('%', #{map.query}, '%')
|
||||||
or
|
or
|
||||||
drt.ticket_no like concat('%', #{map.query}, '%')
|
drt.ticket_no like concat('%', #{map.query}, '%')
|
||||||
or
|
or
|
||||||
dtw.license_number like concat('%', #{map.query}, '%')
|
dtw.license_number like concat('%', #{map.query}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="map.licenseNumber != null and map.licenseNumber != ''">
|
<if test="map.licenseNumber != null and map.licenseNumber != ''">
|
||||||
@ -72,25 +72,23 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="map.userIds != null and map.userIds.size > 0">
|
<if test="map.userIds != null and map.userIds.size > 0">
|
||||||
and (
|
and (
|
||||||
dtw.repair_id in
|
dtw.repair_id in
|
||||||
<foreach collection="map.userIds" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="map.userIds" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="map.userRole != null">
|
<if test="map.userRole != null">
|
||||||
and (
|
and exists (
|
||||||
<choose>
|
select 1 from dl_tw_item dti where dti.tw_id = dtw.id and dti.deleted = '0'
|
||||||
<when test="map.userRole == 5 and map.isToBeReviewed">
|
<choose>
|
||||||
dtw.status = '01'
|
<when test="map.userRole == 5 and map.isBack == false">
|
||||||
</when>
|
and (dti.wares_count > dti.wares_already_count and dti.wares_status = '1')
|
||||||
<when test="map.userRole == 5 and map.isBack == null">
|
</when>
|
||||||
dtw.status not in ('01', '05', '03')
|
<when test="map.userRole == 5 and map.isBack == true">
|
||||||
</when>
|
and (dti.wares_already_count > 0 and dti.wares_status = '1')
|
||||||
<when test="map.userRole == 5 and map.isBack">
|
</when>
|
||||||
dtw.status in ('03', '04')
|
</choose>
|
||||||
</when>
|
|
||||||
</choose>
|
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="map.adviserId != null and map.adviserId != ''">
|
<if test="map.adviserId != null and map.adviserId != ''">
|
||||||
|
Loading…
Reference in New Issue
Block a user