|
|
@ -35,116 +35,47 @@ public class WmsInventoryAllocateBillService extends MybatisBaseService<WmsInven |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
|
|
|
|
public ResultBean<PagerVo<WmsInventoryAllocateBillVo>> listPage(PagerQuery<WmsInventoryAllocateBillQuery> pq) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
WmsInventoryAllocateBillQuery query = pq.getParams(); |
|
|
|
QueryWrapper<WmsInventoryAllocateBill> qw = new QueryWrapper<>(); |
|
|
|
if (StringUtils.isNotBlank(query.getName())) { |
|
|
|
qw.like("rackName", query.getName()); |
|
|
|
} |
|
|
|
|
|
|
|
IPage<WmsInventoryAllocateBill> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<WmsInventoryAllocateBillVo> pagging = baseMapper.listPage(page, qw); |
|
|
|
PagerVo<WmsInventoryAllocateBillVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
List<WmsInventoryAllocateBillVo> records = pagging.getRecords(); |
|
|
|
return rb.success().setData(p); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PagerVo<WmsInventoryAllocateBillVoNew> listPageVo(PagerQuery<WmsInventoryAllocateBillQueryNew> pq) { |
|
|
|
WmsInventoryAllocateBillQueryNew query = pq.getParams(); |
|
|
|
QueryWrapper<WmsInventoryAllocateBill> qw = new QueryWrapper<>(); |
|
|
|
IPage<WmsInventoryAllocateBill> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<WmsInventoryAllocateBillVoNew> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<WmsInventoryAllocateBillVoNew> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 入库 |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
// public ResultBean<WmsInventoryAllocateBill> warehousing(WmsInventoryAllocateBillDto dto) {
|
|
|
|
// ResultBean rb = ResultBean.fireFail();
|
|
|
|
// WmsInventoryAllocateBill wmsInventory=baseMapper.selectOne(new QueryWrapper<WmsInventoryAllocateBill>().eq("goodsSid",dto.getGoodsSid()).eq("warehouseSid",dto.getWarehouseSid()));
|
|
|
|
// if(null==wmsInventory){
|
|
|
|
// WmsInventoryAllocateBill wms=new WmsInventoryAllocateBill();
|
|
|
|
// BeanUtil.copyProperties(dto,wms,"sid","id");
|
|
|
|
// wms.setFirstInDate(new Date());
|
|
|
|
// baseMapper.insert(wms);
|
|
|
|
// return rb.success().setData(wms);
|
|
|
|
// }else{
|
|
|
|
// wmsInventory.setCount(String.valueOf(Double.valueOf(dto.getCount())+Double.valueOf(wmsInventory.getCount())));
|
|
|
|
// baseMapper.updateById(wmsInventory);
|
|
|
|
// }
|
|
|
|
// return rb.success().setData(wmsInventory);
|
|
|
|
// }
|
|
|
|
|
|
|
|
/** |
|
|
|
* 出库 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean<WmsInventoryAllocateBill> outWarehousing(WmsInventoryAllocateBillDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
WmsInventoryAllocateBill wmsInventory = baseMapper.selectOne(new QueryWrapper<WmsInventoryAllocateBill>().eq("goodsSid", dto.getGoodsSid()).eq("warehouseSid", dto.getWarehouseSid())); |
|
|
|
double exisInventory = Double.valueOf(wmsInventory.getCount()); |
|
|
|
double out = Double.valueOf(dto.getCount()); |
|
|
|
if (null == wmsInventory) { |
|
|
|
return rb.setMsg("此仓库没有相应的商品库存"); |
|
|
|
if (StringUtils.isNotBlank(query.getOutOrgName())){ |
|
|
|
qw.like("createOrgName",query.getOutOrgName()); |
|
|
|
} |
|
|
|
if (exisInventory < -out) { |
|
|
|
return rb.setMsg("库存不足"); |
|
|
|
if (StringUtils.isNotBlank(query.getDeptName())){ |
|
|
|
qw.like("deptName",query.getDeptName()); |
|
|
|
} |
|
|
|
wmsInventory.setCount(String.valueOf(exisInventory + out)); |
|
|
|
baseMapper.updateById(wmsInventory); |
|
|
|
return rb.success().setData(wmsInventory); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<String> saveOrUpdate(WmsInventoryAllocateBillDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String sid = ""; |
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
sid = dto.getSid(); |
|
|
|
WmsInventoryAllocateBill wmsWarehouseRack = fetchBySid(dto.getSid()); |
|
|
|
BeanUtil.copyProperties(dto, wmsWarehouseRack, "id", "sid"); |
|
|
|
baseMapper.updateById(wmsWarehouseRack); |
|
|
|
} else { |
|
|
|
WmsInventoryAllocateBill wmsWarehouseRack = new WmsInventoryAllocateBill(); |
|
|
|
sid = wmsWarehouseRack.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, wmsWarehouseRack, "id", "sid"); |
|
|
|
wmsWarehouseRack.setCreateTime(new DateTime()); |
|
|
|
baseMapper.insert(wmsWarehouseRack); |
|
|
|
if (StringUtils.isNotBlank(query.getCreateByName())){ |
|
|
|
qw.like("createByName",query.getCreateByName()); |
|
|
|
} |
|
|
|
return rb.success().setMsg("成功"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<WmsInventoryAllocateBillVo> initialization(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
WmsInventoryAllocateBillVo vo = baseMapper.initialization(sid); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean delete(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
WmsInventoryAllocateBill wmsWarehouseRack = fetchBySid(sid); |
|
|
|
if (null != wmsWarehouseRack) { |
|
|
|
baseMapper.deleteById(wmsWarehouseRack.getId()); |
|
|
|
if (StringUtils.isNotBlank(query.getBillNo())){ |
|
|
|
qw.like("billNo",query.getBillNo()); |
|
|
|
} |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean updateIsEnable(String sid, String isEnable) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
WmsInventoryAllocateBill wmsWarehouseRack = fetchBySid(sid); |
|
|
|
if (null != wmsWarehouseRack) { |
|
|
|
wmsWarehouseRack.setIsEnable(Integer.parseInt(isEnable)); |
|
|
|
baseMapper.updateById(wmsWarehouseRack); |
|
|
|
if (StringUtils.isNotBlank(query.getOutPlatName())){ |
|
|
|
qw.like("outPlatName",query.getOutPlatName()); |
|
|
|
} |
|
|
|
return rb.success().setMsg("成功"); |
|
|
|
if (StringUtils.isNotBlank(query.getInOrgName())){ |
|
|
|
qw.like("inOrgName",query.getInOrgName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getInPlatName())){ |
|
|
|
qw.like("inPlatName",query.getInPlatName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getConfirmName())){ |
|
|
|
qw.like("confirmName",query.getConfirmName()); |
|
|
|
} |
|
|
|
String createStartTime = query.getCreateStartTime(); |
|
|
|
String createEndTime = query.getCreateEndTime(); |
|
|
|
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(createStartTime), "date_format (createTime,'%Y-%m-%d') >= date_format('" + createStartTime + "','%Y-%m-%d')"). |
|
|
|
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(createEndTime), "date_format (createTime,'%Y-%m-%d') <= date_format('" + createEndTime + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
String finishStartTime = query.getFinishStartTime(); |
|
|
|
String finishEndTime = query.getFinishEndTime(); |
|
|
|
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(finishStartTime), "date_format (finishTime,'%Y-%m-%d') >= date_format('" + finishStartTime + "','%Y-%m-%d')"). |
|
|
|
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(finishEndTime), "date_format (finishTime,'%Y-%m-%d') <= date_format('" + finishEndTime + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
IPage<WmsInventoryAllocateBill> page = PagerUtil.queryToPage(pq); |
|
|
|
IPage<WmsInventoryAllocateBillVoNew> pagging = baseMapper.selectPageVo(page, qw); |
|
|
|
PagerVo<WmsInventoryAllocateBillVoNew> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public WmsInventoryAllocateBillDetailsVoNew fetchDetailsVoBySid(String sid) { |
|
|
@ -184,7 +115,7 @@ public class WmsInventoryAllocateBillService extends MybatisBaseService<WmsInven |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
for (WmsInventoryAllocateBillDetailDtoNew wmsInventoryAllocateBillDetailDtoNew : wmsInventoryAllocateBillDetailNewList) { |
|
|
|
wmsInventoryAllocateBillDetailDtoNew.setBillSid(sid); |
|
|
|
wmsInventoryAllocateBillDetailService.saveOrUpdateDto(wmsInventoryAllocateBillDetailDtoNew); |
|
|
|
wmsInventoryAllocateBillDetailService.insertByDto(wmsInventoryAllocateBillDetailDtoNew); |
|
|
|
} |
|
|
|
return sid; |
|
|
|
} |
|
|
|