123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- package com.steerinfo.dil.service.impl;
- import com.steerinfo.dil.mapper.WmspGridMaterialMapper;
- import com.steerinfo.dil.mapper.WmspInboundResultMapper;
- import com.steerinfo.dil.model.WmspGridMaterial;
- import com.steerinfo.dil.model.WmspInboundResult;
- import com.steerinfo.dil.service.IWmsInboundResultService;
- import com.steerinfo.dil.util.IDUtils;
- import com.steerinfo.dil.util.Liushuih;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.math.BigDecimal;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- /**
- * @author luobang
- * @create 2021-09-06 18:12
- */
- @Service
- public class WmsInboundResultServiceImpl implements IWmsInboundResultService {
- @Autowired
- WmspInboundResultMapper wmspInboundResultMapper;
- @Autowired
- WmspGridMaterialMapper wmspGridMaterialMapper;
- /**
- * 1.展示入库实绩所有信息
- * @param mapValue
- * @return
- */
- @Override
- public List<Map<String,Object>> getInboundResult(Map<String, Object> mapValue){
- List<Map<String, Object>> maps = wmspInboundResultMapper.selectWmsInboundResult(mapValue);
- return maps;
- }
- // 展示入库统计信息
- @Override
- public List<Map<String, Object>> getWmsInboundResultStatistics(Map<String, Object> mapValue, Integer warehouseId) {
- List<Map<String, Object>> maps = wmspInboundResultMapper.getWmsInboundResultStatistics(mapValue,warehouseId);
- return null;
- }
- @Override
- public List<Map<String,Object>> getInboundResults(Map<String, Object> mapValue){
- List<Map<String, Object>> maps = wmspInboundResultMapper.selectWmsInboundResults(mapValue);
- return maps;
- }
- /**
- * 1.展示入库实绩所有信息
- * @param mapValue
- * @return
- */
- @Override
- public List<Map<String,Object>> getWmsReservedResult(Map<String, Object> mapValue){
- List<Map<String, Object>> maps = wmspInboundResultMapper.selectWmsReservedResult(mapValue);
- return maps;
- }
- /**
- * 2.展示退库实绩所有信息
- * @param mapValue
- * @return
- */
- @Override
- public List<Map<String,Object>> getReboundResult(Map<String, Object> mapValue){
- List<Map<String, Object>> maps = wmspInboundResultMapper.selectWmsReboundResult(mapValue);
- return maps;
- }
- /**
- * 2.展示倒库主表实绩所有信息
- * @param mapValue
- * @return
- */
- @Override
- public List<Map<String,Object>> getIvboundResult(Map<String, Object> mapValue){
- List<Map<String, Object>> maps = wmspInboundResultMapper.selectWmsIvboundResult(mapValue);
- return maps;
- }
- @Override
- public List<Map<String,Object>> getIvboundMaterial(Map<String, Object> mapValue){
- List<Map<String, Object>> maps = wmspInboundResultMapper.selectWmsIvboundMaterialResult(mapValue);
- return maps;
- }
- @Override
- public List<Map<String, Object>> selectScanResultByIboundResultId(Map<String, Object> map) {
- return wmspInboundResultMapper.selectScanResultByIboundResultId(map);
- }
- /**
- * 2.获取最大ID数
- * @return
- */
- @Override
- public int count() {
- if (wmspInboundResultMapper.getCount()==null){
- return 0;
- }
- return wmspInboundResultMapper.getCount().intValue();
- }
- /**
- * 3.新增入库实绩
- * @param wmspInboundResult
- * @return
- */
- @Override
- public Integer insertWmsInboundResult(WmspInboundResult wmspInboundResult) {
- return wmspInboundResultMapper.insertSelective(wmspInboundResult);
- }
- /**
- * 更新退库实绩表
- * @param map9
- * @return
- */
- @Override
- public Integer updateReboundResult(Map<String, Object> map9) {
- return wmspInboundResultMapper.updateReboundResult(map9);
- }
- @Override
- public String selectWarehouseName(BigDecimal bigDecimal) {
- return wmspInboundResultMapper.selectWarehouseName(bigDecimal);
- }
- @Override
- public WmspInboundResult initAndWmspInboundResult(Integer complete, Integer resultNumber,BigDecimal personnelWorkshopid,BigDecimal inboundGroupId,String userName, BigDecimal distributeId, BigDecimal gridId, Map<String, Object> item) {
- WmspInboundResult wmspInboundResult=new WmspInboundResult();
- //1、给实绩属性赋值
- int orderNumber = count();
- // 主键ID
- wmspInboundResult.setInboundId(IDUtils.createIDYMD(String.valueOf(orderNumber)));
- //批次ID与批次绑定关系
- wmspInboundResult.setInboundDistributeId(distributeId);
- //分组
- wmspInboundResult.setInboundGroupId(inboundGroupId);
- //入库类型
- wmspInboundResult.setInboundType(new BigDecimal(0));
- //入库单/退库单/倒库单编号(WRKD-年月日-8位数的顺序号)
- String number= Liushuih.generateNextNumber("WRKD-", "yyyyMMdd-", 8, orderNumber);
- wmspInboundResult.setInboundNumber(number);
- //仓储网格
- wmspInboundResult.setGridId(gridId);
- //入库单是否下发:0:未下发;1:下发中; 2:已下发 3:已经接收
- wmspInboundResult.setResultStatus(new BigDecimal(1));
- //物资ID
- wmspInboundResult.setMaterialId(new BigDecimal(item.get("materialId").toString()));
- //仓库id
- wmspInboundResult.setPersonnelWorkshopid(personnelWorkshopid);
- //入库是否完成(0:未完成,1:已完成)
- wmspInboundResult.setInboundIscomplete(new BigDecimal(complete));
- //逻辑删除:1:删除;0:未删除
- wmspInboundResult.setResultDeleted(new BigDecimal(0));
- //入库日期
- wmspInboundResult.setInboundTime(new Date());
- //记录创建人
- wmspInboundResult.setInsertUsername(userName);
- //记录创建时间
- wmspInboundResult.setInsertTime(new Date());
- //创建序号
- wmspInboundResult.setResultNumber(new BigDecimal(resultNumber));
- //插入
- int status = wmspInboundResultMapper.insertSelective(wmspInboundResult);
- return status>0?wmspInboundResult:null;
- }
- @Override
- public Map<String,Object> selectInboundResultByGroupId(BigDecimal groupId) {
- return wmspInboundResultMapper.selectInboundResultByGroupId(groupId);
- }
- @Override
- public BigDecimal getGrid(String distributeId, int i) {
- return wmspInboundResultMapper.getGrid(distributeId,i);
- }
- @Override
- public int updateInboundStatus(BigDecimal distributeId) {
- return wmspInboundResultMapper.updateInboundStatus(distributeId);
- }
- // 根据出库的resultId修改入库实绩的逻辑删除状态和仓储网格的状态
- @Override
- public int updateInboundGridStatus(Integer resultId) {
- int i=0;
- // 根据出库的resultId获取当前的吊刚工扫描结果
- List<Map<String ,Object>> resultMaterial = wmspInboundResultMapper.getResultMaterialByResultId(resultId);
- for (Map<String, Object> map1: resultMaterial){
- String material = (String) map1.get("resultMaterial");
- // 根据扫描吊牌得到的物资唯一编码修改对应的入库实绩状态和仓储网格状态
- List<Map<String ,Object>> list =wmspInboundResultMapper.getInboundResult(material);
- for (Map<String, Object> map:list){
- BigDecimal inboundId = (BigDecimal) map.get("inboundId");
- BigDecimal grmId = (BigDecimal) map.get("gmId");
- // 创建入库实绩实体类
- WmspInboundResult wmspInboundResult = new WmspInboundResult();
- wmspInboundResult.setInboundId(inboundId);
- wmspInboundResult.setResultDeleted(new BigDecimal(1));
- i+= wmspInboundResultMapper.updateByPrimaryKeySelective(wmspInboundResult);
- // 创建仓储网格实体类
- WmspGridMaterial wmspGridMaterial = new WmspGridMaterial();
- wmspGridMaterial.setGmId(grmId);
- wmspGridMaterial.setDeleted(new BigDecimal(1));
- i+= wmspGridMaterialMapper.updateByPrimaryKeySelective(wmspGridMaterial);
- }
- }
- return i;
- }
- @Override
- public int getTypeMaterilaId(BigDecimal materialId) {
- return wmspInboundResultMapper.getTypeMaterilaId(materialId);
- }
- @Override
- public int updateStatusByMaterilaId(BigDecimal materialId) {
- return wmspInboundResultMapper.updateStatusByMaterilaId(materialId);
- }
- @Override
- public int updateStatusByMaterialId(BigDecimal materialId) {
- return wmspInboundResultMapper.updateStatusByMaterialId(materialId);
- }
- // 根据对应的入库实绩id修改入库状态为预留
- @Override
- public int changeReserved(List<Map<String, Object>> mapList) {
- int i=0;
- // 对mapList遍历,找到所有的入库id
- for (Map<String,Object> map:mapList){
- // 找到状态,判断其是属于入库转预留还是预留转入库,0表示入库转预留,1表示预留转入库
- Integer status= (Integer) map.get("status");
- Long inboundIds= (Long) map.get("inboundId");
- BigDecimal inboundId = new BigDecimal(inboundIds) ;
- // 创建入库实体类
- WmspInboundResult wmspInboundResult = new WmspInboundResult();
- wmspInboundResult.setInboundId(inboundId);
- wmspInboundResult.setInboundTime(new Date());
- wmspInboundResult.setInsertTime(new Date());
- if (status == 0){
- // 将入库状态改为预留状态
- wmspInboundResult.setInboundIscomplete(new BigDecimal(2));
- }else if (status == 1){
- // 将预留状态改为入库状态
- wmspInboundResult.setInboundIscomplete(new BigDecimal(1));
- }
- i+= wmspInboundResultMapper.updateByPrimaryKeySelective(wmspInboundResult);
- }
- return i;
- }
- }
|