|
|
@ -2,6 +2,7 @@ package com.yxt.wms.biz.inventory.wmsinventoryallocatebill; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
@ -13,6 +14,9 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryallocatebilldetail.WmsInventoryAllocateBillDetailDtoNew; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryallocatebilldetail.WmsInventoryAllocateBillDetailService; |
|
|
|
import com.yxt.wms.biz.inventory.wmsinventoryallocatebilldetail.WmsInventoryAllocatebillDetailDetailsVoNew; |
|
|
|
import com.yxt.wms.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.wms.feign.portal.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.wms.utils.Rule; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -28,6 +32,8 @@ public class WmsInventoryAllocateBillService extends MybatisBaseService<WmsInven |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WmsInventoryAllocateBillDetailService wmsInventoryAllocateBillDetailService; |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
|
|
|
|
public ResultBean<PagerVo<WmsInventoryAllocateBillVo>> listPage(PagerQuery<WmsInventoryAllocateBillQuery> pq) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
@ -157,23 +163,38 @@ public class WmsInventoryAllocateBillService extends MybatisBaseService<WmsInven |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(WmsInventoryAllocateBillDtoNew dto) { |
|
|
|
public String saveOrUpdateDto(WmsInventoryAllocateBillDtoNew dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
List<WmsInventoryAllocateBillDetailDtoNew> wmsInventoryAllocateBillDetailNewList = dto.getWmsInventoryAllocateBillDetailNewList(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
//生成单据编号
|
|
|
|
String billNo = ""; |
|
|
|
String date = DateUtil.format(DateUtil.date(), "yyyyMM"); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(dto.getUseOrgSid()).getData(); |
|
|
|
billNo = "DB" + sysOrganizationVo.getOrgCode() + date; |
|
|
|
String i = baseMapper.selectNum(billNo); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(i)) { |
|
|
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(i).intValue()); |
|
|
|
} else { |
|
|
|
billNo = Rule.getBillNo(billNo, 0); |
|
|
|
} |
|
|
|
dto.setBillNo(billNo); |
|
|
|
dto.setCreateDate(DateUtil.today()); |
|
|
|
dto.setCreateOrgName(sysOrganizationVo.getName()); |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
for (WmsInventoryAllocateBillDetailDtoNew wmsInventoryAllocateBillDetailDtoNew : wmsInventoryAllocateBillDetailNewList) { |
|
|
|
wmsInventoryAllocateBillDetailDtoNew.setBillSid(sid); |
|
|
|
wmsInventoryAllocateBillDetailService.saveOrUpdateDto(wmsInventoryAllocateBillDetailDtoNew); |
|
|
|
} |
|
|
|
return; |
|
|
|
return sid; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
wmsInventoryAllocateBillDetailService.delByMainSid(dtoSid); |
|
|
|
for (WmsInventoryAllocateBillDetailDtoNew wmsInventoryAllocateBillDetailDtoNew : wmsInventoryAllocateBillDetailNewList) { |
|
|
|
wmsInventoryAllocateBillDetailDtoNew.setBillSid(dtoSid); |
|
|
|
wmsInventoryAllocateBillDetailService.saveOrUpdateDto(wmsInventoryAllocateBillDetailDtoNew); |
|
|
|
wmsInventoryAllocateBillDetailService.insertByDto(wmsInventoryAllocateBillDetailDtoNew); |
|
|
|
} |
|
|
|
return dtoSid; |
|
|
|
} |
|
|
|
|
|
|
|
public String insertByDto(WmsInventoryAllocateBillDtoNew dto) { |
|
|
@ -191,6 +212,7 @@ public class WmsInventoryAllocateBillService extends MybatisBaseService<WmsInven |
|
|
|
} |
|
|
|
|
|
|
|
public void allocation(WmsInventoryAllocateBillDtoNew dto) { |
|
|
|
|
|
|
|
String sid = saveOrUpdateDto(dto); |
|
|
|
baseMapper.updateState(sid); |
|
|
|
} |
|
|
|
} |
|
|
|