|
@ -1,12 +1,15 @@ |
|
|
package com.yxt.anrui.as.biz.asbusrepairinventorybill; |
|
|
package com.yxt.anrui.as.biz.asbusrepairinventorybill; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.yxt.anrui.as.api.asbusrepairbill.AsBusrepairBill; |
|
|
import com.yxt.anrui.as.api.asbusrepairbill.AsBusrepairBillDetailsVo; |
|
|
import com.yxt.anrui.as.api.asbusrepairbill.AsBusrepairBillDetailsVo; |
|
|
import com.yxt.anrui.as.api.asbusrepairbill.SitemVo; |
|
|
import com.yxt.anrui.as.api.asbusrepairbill.SitemVo; |
|
|
|
|
|
import com.yxt.anrui.as.api.asbusrepairbillnode.AsBusrepairBillNode; |
|
|
import com.yxt.anrui.as.api.asbusrepairinventorybill.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairinventorybill.*; |
|
|
import com.yxt.anrui.as.api.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetail; |
|
|
import com.yxt.anrui.as.api.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetail; |
|
|
import com.yxt.anrui.as.api.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetailSDto; |
|
|
import com.yxt.anrui.as.api.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetailSDto; |
|
@ -16,6 +19,7 @@ import com.yxt.anrui.as.api.enums.AsBillTypeEnum; |
|
|
import com.yxt.anrui.as.api.utils.AsRule; |
|
|
import com.yxt.anrui.as.api.utils.AsRule; |
|
|
import com.yxt.anrui.as.api.utils.domain.AsBillNo; |
|
|
import com.yxt.anrui.as.api.utils.domain.AsBillNo; |
|
|
import com.yxt.anrui.as.biz.asbusrepairbill.AsBusrepairBillService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairbill.AsBusrepairBillService; |
|
|
|
|
|
import com.yxt.anrui.as.biz.asbusrepairbillnode.AsBusrepairBillNodeService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetailService; |
|
|
import com.yxt.anrui.as.biz.asbusrepairinventorybilldetail.AsBusrepairInventorybillDetailService; |
|
|
import com.yxt.anrui.as.feign.portal.privilege.PrivilegeQuery; |
|
|
import com.yxt.anrui.as.feign.portal.privilege.PrivilegeQuery; |
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
import com.yxt.anrui.as.feign.portal.sysorganization.SysOrganizationFeign; |
|
@ -67,6 +71,9 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
private WmsInventoryFeign wmsInventoryFeign; |
|
|
private WmsInventoryFeign wmsInventoryFeign; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private SysUserFeign sysUserFeign; |
|
|
private SysUserFeign sysUserFeign; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AsBusrepairBillNodeService asBusrepairBillNodeService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 维修出/退库分页列表 |
|
|
* 维修出/退库分页列表 |
|
|
* |
|
|
* |
|
@ -399,6 +406,9 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
if (StringUtils.isNotBlank(data.getCustomerOrg())) { |
|
|
if (StringUtils.isNotBlank(data.getCustomerOrg())) { |
|
|
vo.setCustomerOrg(data.getCustomerOrg()); |
|
|
vo.setCustomerOrg(data.getCustomerOrg()); |
|
|
} |
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(data.getRegisterRemarks())) { |
|
|
|
|
|
vo.setRegisterRemarks(data.getRegisterRemarks()); |
|
|
|
|
|
} |
|
|
List<SitemVo> sitemVos = data.getSitemVos(); |
|
|
List<SitemVo> sitemVos = data.getSitemVos(); |
|
|
List<SitemsVo> sitemsVos = new ArrayList<>(); |
|
|
List<SitemsVo> sitemsVos = new ArrayList<>(); |
|
|
if (!sitemVos.isEmpty()) { |
|
|
if (!sitemVos.isEmpty()) { |
|
@ -428,7 +438,7 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
if (null != goodsDetail.getCount()) { |
|
|
if (null != goodsDetail.getCount()) { |
|
|
goodsDetailsVo.setOutboundCount(goodsDetail.getCount().toString()); |
|
|
goodsDetailsVo.setOutboundCount(goodsDetail.getCount().toString()); |
|
|
} |
|
|
} |
|
|
goodsDetailsVo.setCount(""); |
|
|
goodsDetailsVo.setCount("0"); |
|
|
list.add(goodsDetailsVo); |
|
|
list.add(goodsDetailsVo); |
|
|
} |
|
|
} |
|
|
vo.setDetailList(list); |
|
|
vo.setDetailList(list); |
|
@ -446,7 +456,7 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
|
|
|
|
|
|
public ResultBean<String> selOutBoundCountBySitemSid(String sourceBillSid, String busTypeKey, String goodsID, String sitemSid) { |
|
|
public ResultBean<String> selOutBoundCountBySitemSid(String sourceBillSid, String busTypeKey, String goodsID, String sitemSid) { |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
String count = baseMapper.selOutBoundCountBySitemSid(sourceBillSid, busTypeKey, goodsID,sitemSid); |
|
|
String count = baseMapper.selOutBoundCountBySitemSid(sourceBillSid, busTypeKey, goodsID, sitemSid); |
|
|
return rb.success().setData(count); |
|
|
return rb.success().setData(count); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -518,4 +528,116 @@ public class AsBusrepairInventorybillService extends MybatisBaseService<AsBusrep |
|
|
List<AsBusrepairinventoryExportVo> list = baseMapper.exportExcel(qw); |
|
|
List<AsBusrepairinventoryExportVo> list = baseMapper.exportExcel(qw); |
|
|
return list; |
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<AsBusrepairBillVo> listPage(PagerQuery<AsBusrepairBillQuery> pagerQuery) { |
|
|
|
|
|
AsBusrepairBillQuery query = pagerQuery.getParams(); |
|
|
|
|
|
QueryWrapper<AsBusrepairBill> qw = new QueryWrapper<>(); |
|
|
|
|
|
if (query != null) { |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
|
|
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
|
|
privilegeQuery.setOrgPath(query.getOrgPath()); |
|
|
|
|
|
privilegeQuery.setMenuUrl(query.getMenuUrl()); |
|
|
|
|
|
privilegeQuery.setUserSid(query.getUserSid()); |
|
|
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
|
|
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
|
|
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
|
|
String orgSidPath = query.getOrgPath(); |
|
|
|
|
|
orgSidPath = orgSidPath + "/"; |
|
|
|
|
|
int i1 = orgSidPath.indexOf("/"); |
|
|
|
|
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
|
|
|
|
|
int i3 = orgSidPath.indexOf("/", i2 + 1); |
|
|
|
|
|
int i4 = orgSidPath.indexOf("/", i3 + 1); |
|
|
|
|
|
String orgLevelKey = defaultIdReltBean.getData(); |
|
|
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i1); |
|
|
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
|
|
qw.like("a.orgSidPath", orgSidPath); |
|
|
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
|
|
qw.eq("a.createBySid", query.getUserSid()); |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<AsBusrepairBillVo> p = new PagerVo<>(); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
PagerVo<AsBusrepairBillVo> p = new PagerVo<>(); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//单据编号
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getBillNo())) { |
|
|
|
|
|
qw.like("a.billNo", query.getBillNo()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getBillType())) { |
|
|
|
|
|
qw.like("a.billType", query.getBillType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getRepairState())) { |
|
|
|
|
|
if (query.getRepairState().equals("维修中")) { |
|
|
|
|
|
qw.eq("a.repairState", 1); |
|
|
|
|
|
} else if (query.getRepairState().equals("维修完成")) { |
|
|
|
|
|
qw.eq("a.repairState", 2); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//单据日期开始时间-单据日期结束时间
|
|
|
|
|
|
qw.apply(StringUtils.isNotBlank(query.getCreateTimeStart()), "date_format (a.entryTime,'%Y-%m-%d') >= date_format('" + query.getCreateTimeStart() + "','%Y-%m-%d')"). |
|
|
|
|
|
apply(StringUtils.isNotBlank(query.getCreateTimeEnd()), "date_format (a.entryTime,'%Y-%m-%d') <= date_format('" + query.getCreateTimeEnd() + "','%Y-%m-%d')" |
|
|
|
|
|
); |
|
|
|
|
|
//维修工单编号
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getSubject())) { |
|
|
|
|
|
qw.eq("a.subject", query.getSubject()); |
|
|
|
|
|
} |
|
|
|
|
|
//业务类型
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getCustomerName())) { |
|
|
|
|
|
qw.like("a.customerName", query.getCustomerName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getVehMark())) { |
|
|
|
|
|
qw.like("v.vehMark", query.getVehMark()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(query.getVinNo())) { |
|
|
|
|
|
qw.like("v.vinNo", query.getVinNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (query.getCompleteState().equals("0")) { |
|
|
|
|
|
qw.apply("a.completeState = 0 \n" + |
|
|
|
|
|
"\t\tAND a.repairState > 0 \n" + |
|
|
|
|
|
"\tAND (a.SUBJECT = '保外' OR ( a.SUBJECT = '保内' AND (a.oldIsReclaim = 1 OR a.isGoOut = 1)))"); |
|
|
|
|
|
} else if (query.getCompleteState().equals("1")) { |
|
|
|
|
|
qw.eq("a.completeState", 1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
IPage<AsBusrepairBill> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
|
|
IPage<AsBusrepairBillVo> pagging = baseMapper.listPage(page, qw); |
|
|
|
|
|
PagerVo<AsBusrepairBillVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean saveConfirm(ConfirmDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
String sid = dto.getSid(); |
|
|
|
|
|
AsBusrepairBill asBusrepairBill = asBusrepairBillService.fetchBySid(dto.getSid()); |
|
|
|
|
|
asBusrepairBill.setNodeCode(4); |
|
|
|
|
|
asBusrepairBill.setNodeName("竣工"); |
|
|
|
|
|
asBusrepairBill.setNodeTime(new DateTime()); |
|
|
|
|
|
asBusrepairBill.setCompleteState(1); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRemarks())) { |
|
|
|
|
|
asBusrepairBill.setOutboundRemarks(dto.getRemarks()); |
|
|
|
|
|
} |
|
|
|
|
|
asBusrepairBillService.updateById(asBusrepairBill); |
|
|
|
|
|
//新增工单环节信息
|
|
|
|
|
|
AsBusrepairBillNode billNode = new AsBusrepairBillNode(); |
|
|
|
|
|
billNode.setBillSid(sid); |
|
|
|
|
|
// billNode.setCreateByName(dto.getOperator());
|
|
|
|
|
|
billNode.setNodeName("竣工"); |
|
|
|
|
|
// billNode.setCreateBySid(dto.getOperatorSid());
|
|
|
|
|
|
billNode.setNodeCode("4"); |
|
|
|
|
|
asBusrepairBillNodeService.insert(billNode); |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|