移位、制造叫料、制造移位、台车配料

main
FOAM 2025-11-14 15:50:13 +08:00
parent 20fa61bb34
commit bf1929bbc7
26 changed files with 418 additions and 240 deletions

View File

@ -123,6 +123,10 @@ public class Area extends BaseEntity implements Serializable {
@ApiModelProperty(value = "制造库位耗用") @ApiModelProperty(value = "制造库位耗用")
private Boolean bezz; private Boolean bezz;
@Column(name = "`betc`")
@ApiModelProperty(value = "台车库区")
private Boolean betc;
@Column(name = "`shdd`") @Column(name = "`shdd`")
@ApiModelProperty(value = "收货担当") @ApiModelProperty(value = "收货担当")
private String shdd; private String shdd;

View File

@ -131,6 +131,9 @@ public class Point extends BaseEntity implements Serializable {
@Column(name = "`glzkw`") @Column(name = "`glzkw`")
@ApiModelProperty(value = "关联总库位") @ApiModelProperty(value = "关联总库位")
private String glzkw; private String glzkw;
@Column(name = "`update_des`")
@ApiModelProperty(value = "更新描述")
private String updateDes;
public void copy(Point source){ public void copy(Point source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
} }

View File

@ -57,7 +57,9 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
List<BomAccount> queryBomUnique(Long area_id, Long item_id, Long poin_id); List<BomAccount> queryBomUnique(Long area_id, Long item_id, Long poin_id);
@Query(value = "SELECT IFNULL(sum(pc_qty),0) FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2 and b.z_point_id=?3", nativeQuery = true) @Query(value = "SELECT IFNULL(sum(pc_qty),0) FROM `base_bom_account` b where b.r_area_id=?1 and b.item_id=?2 and b.z_point_id=?3", nativeQuery = true)
Double getPcQty(Long area_id, Long item_id, Long point_id); Double getPcQty(Long area_id, Long item_id, Long point_id);
/**台车库位对应的bom*/
@Query(value = "SELECT * FROM `base_bom_account` b where b.station_type=:station_type", nativeQuery = true)
List<BomAccount> queryTchws(String station_type);
/**固定库位二维码解析*/ /**固定库位二维码解析*/
@Query(value = "SELECT * FROM `base_bom_account` b where b.item_id=:item_id and b.z_point_id=:z_point_id and b.bonded=:bonded", nativeQuery = true) @Query(value = "SELECT * FROM `base_bom_account` b where b.item_id=:item_id and b.z_point_id=:z_point_id and b.bonded=:bonded", nativeQuery = true)
List<BomAccount> queryEwmJx(Long item_id, Long z_point_id,String bonded); List<BomAccount> queryEwmJx(Long item_id, Long z_point_id,String bonded);
@ -134,4 +136,8 @@ public interface BomAccountRepository extends JpaRepository<BomAccount, Long>, J
@Query(value = "select v.tckw hw,v.jxs from bom_tckw_print_view v " +
"where (v.tckw=:tckw or :tckw is null) " +
" and (v.jxs LIKE CONCAT('%',:jx,'%') or :jx is null) ", nativeQuery = true)
List<BomPrint> queryTckwPrintAll(String tckw,String jx);
} }

View File

@ -17,6 +17,7 @@ package com.youchain.basicdata.rest;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.youchain.DuplicateSubmission.DuplicateSubmission;
import com.youchain.annotation.AnonymousAccess; import com.youchain.annotation.AnonymousAccess;
import com.youchain.annotation.Log; import com.youchain.annotation.Log;
import com.youchain.basicdata.domain.*; import com.youchain.basicdata.domain.*;
@ -30,9 +31,7 @@ import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.*; import com.youchain.basicdata.service.dto.*;
import com.youchain.basicdata.service.impl.TableConfigServiceImpl; import com.youchain.basicdata.service.impl.TableConfigServiceImpl;
import com.youchain.basicdata.service.mapstruct.BomAccountMapper; import com.youchain.basicdata.service.mapstruct.BomAccountMapper;
import com.youchain.businessdata.returnJson.BomPrint; import com.youchain.businessdata.returnJson.*;
import com.youchain.businessdata.returnJson.BomPrint_BiaoQian;
import com.youchain.businessdata.returnJson.BomPrint_BiaoQian2;
import com.youchain.utils.*; import com.youchain.utils.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.core.utils.JsonUtil; import net.dreamlu.mica.core.utils.JsonUtil;
@ -41,6 +40,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@ -119,109 +119,17 @@ public class BomAccountController {
return new ResponseEntity<>(list,HttpStatus.OK); return new ResponseEntity<>(list,HttpStatus.OK);
} }
// @GetMapping("/bomPrintBiaoQianList/{dxw}") @GetMapping("/queryBomPrintListTC")
// @Log("获取Bom中库位标签") @Log("查询台车标签")
// @ApiOperation("获取Bom中库位标签") @ApiOperation("查询台车标签")
// @AnonymousAccess
// public ResponseEntity<Object> bomPrintBiaoQianList(@PathVariable("dxw") String dxw){
// RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
// String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+dxw);
// //log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json);
// List<BomPrint_BiaoQian2> list= JSONUtil.toList(json, BomPrint_BiaoQian2.class);
// List<BomPrint_BiaoQian> list2=new ArrayList<>();
// for(BomPrint_BiaoQian2 l:list){
// BomPrint_BiaoQian bq=new BomPrint_BiaoQian();
// String code=l.getCode().substring(0,5)+"-"+l.getCode().substring(5,l.getCode().length());
// bq.setNs(l.getNs()+"/"+code);
// bq.setCode(code);
// String hw=l.getHw();
// hw=hw.substring(0,3)+"-"+hw.substring(3,hw.length());
// bq.setHw(hw);
// bq.setPm(l.getPm());
// bq.setEwm(l.getId()+"]"+l.getCode()+"]"+l.getNs()+"]"+l.getBonded()+"]"+l.getHw());
// bq.setBonded(l.getBonded());
// bq.setSrs(l.getSrs());
// bq.setXz(l.getXz());
// bq.setSupplier(l.getSupplier());
// bq.setId(l.getId());
// bq.setJxs(l.getJxs() == null ? null :
// Arrays.stream(l.getJxs().split(";"))
// .map(s -> s.length() > 16 ? s.substring(0, 16) : s)
// .toArray(String[]::new));
// bq.setTyls(l.getTyls()==null?null:l.getTyls().split(";"));
// list2.add(bq);
// }
// return new ResponseEntity<>( list2,HttpStatus.OK);
// }
@GetMapping("/bomPrintBiaoQianListold/{dxw}")
@Log("获取Bom中库位标签")
@ApiOperation("获取Bom中库位标签")
@AnonymousAccess @AnonymousAccess
public ResponseEntity<Object> bomPrintBiaoQianListold(@PathVariable("dxw") String dxw){ public ResponseEntity<Object> queryBomPrintListTC(BomAccountQueryCriteria criteria){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class); RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
String json=(String)redisUtils.get(SecurityUtils.getCurrentUsername()+dxw); redisUtils.del(SecurityUtils.getCurrentUsername()+"_BiaoQian_TC");
//log.info(SecurityUtils.getCurrentUsername()+dxw+"-----"+json); List<BomPrint> list=bomAccountService.queryTckwPrintAll(criteria);
List<BomPrint_BiaoQian2> list= JSONUtil.toList(json, BomPrint_BiaoQian2.class); redisUtils.set(SecurityUtils.getCurrentUsername()+"_BiaoQian_TC",JsonUtil.toJson(list));
HashMap<String ,List<BomPrint_BiaoQian2>> map=new HashMap<>();
List<String> sortList=new ArrayList<>();
for(BomPrint_BiaoQian2 l:list){
String key=l.getCode()+"]"+l.getNs()+"]"+l.getBonded()+"]"+l.getHw();
if(map.containsKey(key)){
List<BomPrint_BiaoQian2> list2=map.get(key);
list2.add(l);
map.put(key,list2);
}else{
List<BomPrint_BiaoQian2> list2=new ArrayList<>();
list2.add(l);
map.put(key,list2);
sortList.add(key);
}
}
List<BomPrint_BiaoQian> list2=new ArrayList<>();
// for (String key : map.keySet()) {
for(String key:sortList){
log.info(key);
List<BomPrint_BiaoQian2> bqs=map.get(key);
BomPrint_BiaoQian bq=new BomPrint_BiaoQian();
BomPrint_BiaoQian2 l=bqs.get(0);
String code=l.getCode().substring(0,5)+"-"+l.getCode().substring(5,l.getCode().length());
bq.setNs(l.getNs()+"/"+code);
bq.setCode(code);
String hw=l.getHw();
hw=hw.substring(0,3)+"-"+hw.substring(3,hw.length());
bq.setHw(hw);
bq.setPm(l.getPm());
bq.setEwm(key);
bq.setBonded(l.getBonded());
bq.setSrs(l.getSrs());
bq.setXz(l.getXz());
bq.setSupplier(l.getSupplier());
bq.setId(l.getId());
String[] jxs=new String[bqs.size()];
String[] tyls=new String[bqs.size()];
for(int i=0;i<bqs.size();i++){
jxs[i]=bqs.get(i).getJxs();
tyls[i]=bqs.get(i).getTyls();
}
bq.setJxs(jxs);
bq.setTyls(tyls);
list2.add(bq);
}
// list2.sort(Comparator.comparing((BomPrint_BiaoQian item) -> {
// String[] parts = item.getHw().split("-");
// // 将前后部分都转换为整数进行比较
// int firstPart = Integer.parseInt(parts[0]);
// int secondPart = Integer.parseInt(parts[1]);
// // 先比较前部分,再比较后部分
// return firstPart * 1000 + secondPart;
// }));
redisUtils.set(SecurityUtils.getCurrentUsername()+"_BiaoQian_X",JsonUtil.toJson(list));
return new ResponseEntity<>(list,HttpStatus.OK); return new ResponseEntity<>(list,HttpStatus.OK);
} }
@GetMapping("/queryBomPrintList") @GetMapping("/queryBomPrintList")
@Log("查询Bom标签") @Log("查询Bom标签")
@ApiOperation("查询Bom标签") @ApiOperation("查询Bom标签")
@ -304,6 +212,39 @@ public class BomAccountController {
return new ResponseEntity<>(map2,HttpStatus.OK); return new ResponseEntity<>(map2,HttpStatus.OK);
} }
@GetMapping("/queryBomTckwPrintList")
@Log("查询Bom台车标签")
@ApiOperation("查询Bom台车标签")
@AnonymousAccess
public ResponseEntity<Object> queryBomTckwPrintList(BomAccountQueryCriteria criteria,Pageable pageable){
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
redisUtils.del(SecurityUtils.getCurrentUsername()+BaseStatus.TCBQ);
List<BomPrint> list=bomAccountService.queryTckwPrintAll(criteria);
List<BomPrint_BiaoQian> list_bq=new ArrayList<>();
for(BomPrint p:list){
String key=p.getHw();
String jx=p.getJxs();
String[] jxs=jx.split(",");
BomPrint_BiaoQian bq=new BomPrint_BiaoQian();
bq.setCode(key);
bq.setHw(key);
bq.setJxs(jxs);
bq.setJx(jx);
list_bq.add(bq);
}
redisUtils.set(SecurityUtils.getCurrentUsername()+BaseStatus.TCBQ,JsonUtil.toJson(list_bq));
Map<String,Object> map2=new HashMap<>();
int pageNum=pageable.getPageNumber();//当前页
int pageSize=pageable.getPageSize();//条数
List<BomPrint_BiaoQian> result = list_bq.stream()
.skip((pageNum)*pageSize) // 跳过前100个
.limit(pageSize) // 取100个101-200行
.collect(Collectors.toList());
map2.put("content",result);
map2.put("totalElements",list_bq.size());
return new ResponseEntity<>(map2,HttpStatus.OK);
}
@GetMapping("/bomPrintBiaoQianList/{dxw}") @GetMapping("/bomPrintBiaoQianList/{dxw}")
@Log("获取Bom中库位标签") @Log("获取Bom中库位标签")
@ApiOperation("获取Bom中库位标签") @ApiOperation("获取Bom中库位标签")
@ -389,4 +330,40 @@ public class BomAccountController {
bomAccountService.deleteAll(ids); bomAccountService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@PostMapping("/tcOut")
@Log("台车配料出库")
@ApiOperation("台车配料出库")
@PreAuthorize("@el.check('super:man')")
@Transactional
@DuplicateSubmission(10)
public ResponseEntity<Object> tcOut(@Validated @RequestBody String[] tckws){
for (String tckw : tckws) {
bomAccountService.tcCount(tckw);
}
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/tcOutApp")
@Log("台车配料出库App")
@ApiOperation("台车配料出库")
@PreAuthorize("@el.check('super:man')")
@Transactional
@DuplicateSubmission(10)
public ResponseEntity<Object> tcOutApp( @RequestBody HashMap map){
String tckw=map.get("tckw")==null?null:map.get("tckw").toString();
bomAccountService.tcCount(tckw);
return new ResponseEntity<>("配料成功", HttpStatus.OK);
}
@PostMapping("/tcOutList")
@Log("制造叫料拣货列表")
@ApiOperation("制造叫料拣货列表")
@AnonymousAccess
public ResponseEntity<Object> tcOutList(@RequestBody HashMap map) throws Exception {
String tckw=map.get("tckw")==null?null:map.get("tckw").toString();
//查询叫料返回数据
List<TcOutList> list=bomAccountService.queryTckwList(tckw);
return new ResponseEntity<>(list,HttpStatus.OK);
}
} }

View File

@ -22,6 +22,7 @@ import com.youchain.basicdata.service.dto.BomAccountDto;
import com.youchain.basicdata.service.dto.BomAccountPointDto; import com.youchain.basicdata.service.dto.BomAccountPointDto;
import com.youchain.basicdata.service.dto.BomAccountQueryCriteria; import com.youchain.basicdata.service.dto.BomAccountQueryCriteria;
import com.youchain.businessdata.returnJson.BomPrint; import com.youchain.businessdata.returnJson.BomPrint;
import com.youchain.businessdata.returnJson.TcOutList;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@ -54,6 +55,7 @@ public interface BomAccountService {
List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria,String dxw); List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria,String dxw);
List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria); List<BomPrint> queryPrintAll(BomAccountQueryCriteria criteria);
List<BomPrint> queryTckwPrintAll(BomAccountQueryCriteria criteria);
/** /**
* ID * ID
@ -138,4 +140,27 @@ public interface BomAccountService {
*/ */
void updateBatch(Long areaId); void updateBatch(Long areaId);
/***
*
* @param tckw
* @return
*/
List<TcOutList> queryTckwList(String tckw) ;
/***
*
* @param tckw
*/
void tcCount(String tckw);
/**
* Bom
* @param bs
* @param orderQty
* @param logType
* @param billCode
* @param refObjId
* @param description
*/
void bomInvDeal(List<BomAccount> bs,double orderQty,String logType,String billCode,Long refObjId,String description);
} }

View File

@ -91,7 +91,8 @@ public class AreaDto implements Serializable {
/** 制造库位耗用 */ /** 制造库位耗用 */
private Boolean bezz; private Boolean bezz;
/** 台车库区 */
private Boolean betc;
/**收货担当*/ /**收货担当*/
private String shdd; private String shdd;
/**工厂*/ /**工厂*/

View File

@ -45,7 +45,7 @@ public class BomAccountQueryCriteria{
private Boolean rAreaBexb; private Boolean rAreaBexb;
@Query(propName = "code",joinName = "cArea",type = Query.Type.INNER_LIKE) @Query(propName = "code",joinName = "cArea",type = Query.Type.INNER_LIKE)
private String cAreaCode; private String cAreaCode;
@Query(propName = "code",joinName = "zPoint",type = Query.Type.INNER_LIKE) @Query(propName = "code",joinName = "zPoint",type = Query.Type.RIGHT_LIKE)
private String zPointCode; private String zPointCode;
/** 精确 */ /** 精确 */
@Query @Query

View File

@ -105,4 +105,6 @@ public class PointDto implements Serializable {
/** 修改时间 */ /** 修改时间 */
private Timestamp updateTime; private Timestamp updateTime;
private String updateDes;
} }

View File

@ -21,17 +21,27 @@ import cn.hutool.json.JSONUtil;
import cn.hutool.log.Log; import cn.hutool.log.Log;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.youchain.appupdate.ReturnJson.RLocLayout; import com.youchain.appupdate.ReturnJson.RLocLayout;
import com.youchain.basicdata.domain.BigItem; import com.youchain.basicdata.domain.*;
import com.youchain.basicdata.domain.BomAccount; import com.youchain.basicdata.repository.AreaRepository;
import com.youchain.basicdata.domain.BomAccountLog;
import com.youchain.basicdata.domain.Item;
import com.youchain.basicdata.repository.ItemRepository; import com.youchain.basicdata.repository.ItemRepository;
import com.youchain.basicdata.repository.PointRepository;
import com.youchain.basicdata.service.BomAccountLogService; import com.youchain.basicdata.service.BomAccountLogService;
import com.youchain.basicdata.service.PointService; import com.youchain.basicdata.service.PointService;
import com.youchain.basicdata.service.dto.*; import com.youchain.basicdata.service.dto.*;
import com.youchain.businessdata.domain.Inventory;
import com.youchain.businessdata.domain.InventoryLog;
import com.youchain.businessdata.domain.ItemKey;
import com.youchain.businessdata.domain.Spareparts;
import com.youchain.businessdata.returnJson.BomPrint; import com.youchain.businessdata.returnJson.BomPrint;
import com.youchain.businessdata.returnJson.TcOutList;
import com.youchain.businessdata.returnJson.ZzjlPickList;
import com.youchain.businessdata.service.InventoryLogService;
import com.youchain.businessdata.service.InventoryService;
import com.youchain.businessdata.service.ItemKeyService;
import com.youchain.exception.BadRequestException;
import com.youchain.modules.system.domain.Dict; import com.youchain.modules.system.domain.Dict;
import com.youchain.modules.system.domain.DictDetail; import com.youchain.modules.system.domain.DictDetail;
import com.youchain.modules.system.service.DictDetailService;
import com.youchain.modules.system.service.dto.DictDto; import com.youchain.modules.system.service.dto.DictDto;
import com.youchain.modules.system.service.dto.DictQueryCriteria; import com.youchain.modules.system.service.dto.DictQueryCriteria;
import com.youchain.modules.system.service.impl.DictDetailServiceImpl; import com.youchain.modules.system.service.impl.DictDetailServiceImpl;
@ -51,6 +61,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import java.sql.Timestamp;
import java.util.*; import java.util.*;
import java.io.IOException; import java.io.IOException;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
@ -70,12 +81,17 @@ import javax.servlet.http.HttpServletResponse;
public class BomAccountServiceImpl implements BomAccountService { public class BomAccountServiceImpl implements BomAccountService {
private final BomAccountRepository bomAccountRepository; private final BomAccountRepository bomAccountRepository;
private final PointRepository pointRepository;
private final AreaRepository areaRepository;
private final ItemRepository itemRepository; private final ItemRepository itemRepository;
private final BomAccountMapper bomAccountMapper; private final BomAccountMapper bomAccountMapper;
private final PointService pointService; private final PointService pointService;
private final EntityManager entityManager; private final EntityManager entityManager;
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
private final BomAccountLogService bomAccountLogService; private final BomAccountLogService bomAccountLogService;
private final InventoryService inventoryService;
private final InventoryLogService inventoryLogService;
private final ItemKeyService itemKeyService;
@Override @Override
// @Cacheable(key = "'queryALL1:' + #p0") // @Cacheable(key = "'queryALL1:' + #p0")
@ -112,6 +128,12 @@ public class BomAccountServiceImpl implements BomAccountService {
} }
public List<BomPrint> queryTckwPrintAll(BomAccountQueryCriteria criteria){
List<BomPrint> bomPrints=bomAccountRepository.queryTckwPrintAll(criteria.getTckw(),criteria.getBigItemCode());
return bomPrints;
}
@Override @Override
@Transactional @Transactional
@Cacheable(key = "'id:' + #p0") @Cacheable(key = "'id:' + #p0")
@ -349,4 +371,120 @@ public class BomAccountServiceImpl implements BomAccountService {
} }
public List<TcOutList> queryTckwList(String tckw) {
List<BomAccount> bs = bomAccountRepository.queryTchws(tckw);
List<TcOutList> list =new ArrayList<>();
for(BomAccount ba:bs){
TcOutList tc=new TcOutList();
tc.setItem_code(ba.getItem().getCode());
tc.setItem_name(ba.getItem().getName());
tc.setBig_item_code(ba.getBigItem().getCode());
tc.setBig_item_name(ba.getBigItem().getName());
tc.setBonded(ba.getBonded());
tc.setOrder_qty(ba.getSingles());
tc.setPoint_code(ba.getZPoint().getCode());
list.add(tc);
}
return list;
}
@Transactional
public void tcCount(String tckw){
List<BomAccount> bs = bomAccountRepository.queryTchws(tckw);
if (bs.size() <= 0) {
throw new BadRequestException(tckw + "未查到对应BOM工位清单");
}
this.bomInvDeal(bs,1d,BizStatus.TC_OUT,tckw,null,"台车配料出库");
}
//根据BOM进行库存扣减
public void bomInvDeal(List<BomAccount> bs,double orderQty,String logType,String billCode,Long refObjId,String description){
Area tcArea=areaRepository.getByCode(BaseStatus.DEFAULT_TC_AREA);
for(BomAccount ba:bs){
if(ba.getZPoint()==null){
throw new BadRequestException(ba.getItem().getCode()+"维护制造库位");
}
if(!ba.getZPoint().getType().equals(BaseStatus.ZZKW)){
throw new BadRequestException(ba.getZPoint().getCode()+"库位类型错误");
}
double qty=orderQty*ba.getSingles();
//扣除线边库存
List<Inventory> inventorys=inventoryService.getXbHyInv(ba.getItem(),ba.getRArea(),ba.getZPoint(),"耗用");
if(inventorys.size()>0){
int num=0;
for(Inventory inv:inventorys){
if(qty<=0){
break;
}
num++;
if(num<inventorys.size()&&inv.getQuantity()<=0){
continue;
}
double srcQty=inv.getQuantity();
double hyQty=0;
if(inv.getQuantity()>qty||num==inventorys.size()){
hyQty=qty;
qty-=hyQty;
}else{
hyQty=inv.getQuantity();
qty-=hyQty;
}
inv.setQuantity(inv.getQuantity()-hyQty);
inventoryService.update(inv);
InventoryLog log= inventoryLogService.storeInventoryLog(logType,BizStatus.REDUCE,billCode,ba.getRArea(),inv.getItemKey(),
inv.getPoint(),inv.getPoint(),null,null,srcQty,hyQty,null,null,ba.getBigItem().getCode(),
refObjId,inv.getId(),description);
log.setZzkw(ba.getZPoint());
inventoryLogService.update(log);
}
}else{
// Point point=ba.getCArea().getPoint();
Point point=pointService.findEntityById(ba.getRArea().getPointId());
if(point==null){
throw new BadRequestException(ba.getRArea().getCode()+"库区无对应待投料库位");
}
ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null,ba.getBonded());
Inventory inventory = new Inventory();
inventory.setItemKey(itemKey);
inventory.setPoint(ba.getZPoint());
inventory.setPointCode(ba.getZPoint().getCode());
// inventory.setZzkw(ba.getZPoint());
inventory.setDept(UserUtils.getDept());
inventory.setArea(ba.getRArea());
inventory.setQuantity(-qty);
inventoryService.create(inventory);
InventoryLog log=inventoryLogService.storeInventoryLog(logType,BizStatus.REDUCE,billCode,ba.getRArea(),inventory.getItemKey(),
inventory.getPoint(),inventory.getPoint(),null,null,0d,qty,null,null,ba.getBigItem().getCode(),
refObjId,inventory.getId(),description);
// log.setZzkw(ba.getZPoint());
inventoryLogService.update(log);
}
ItemKey dstItemKey = itemKeyService.getItemKey(ba.getItem(), null,ba.getBonded());
//台车出库,创建台车库位
if(logType.equals(BizStatus.TC_OUT)) {
Point dstPoint=pointRepository.findByCode(ba.getTckw());
if (dstPoint==null){
dstPoint=new Point();
dstPoint.setDept(ba.getZPoint().getDept());
dstPoint.setCode(ba.getTckw());
dstPoint.setName(ba.getTckw());
dstPoint.setType(BaseStatus.HCKW);
dstPoint.setArea(tcArea);
pointRepository.save(dstPoint);
}else{
dstPoint.setArea(tcArea);
dstPoint.setType(BaseStatus.HCKW);
pointRepository.save(dstPoint);
}
Inventory dstInventory = inventoryService.getInventory(dstItemKey, tcArea, dstPoint, dstPoint, dstPoint.getDept(), BizStatus.TC_RK, null);
double srcQty = dstInventory.getQuantity();
dstInventory.setQuantity(dstInventory.getQuantity() + orderQty*ba.getSingles());
inventoryService.update(dstInventory);
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.TC_RK, BizStatus.ADD, billCode, tcArea, dstItemKey, dstInventory.getPoint(), dstInventory.getPoint(), null, null, srcQty, qty+0d, null, null,
ba.getBigItem().getCode(), ba.getId(), dstInventory.getId(), "台车配料入库");
inventoryLogService.update(inventoryLog);
}
}
}
} }

View File

@ -171,6 +171,7 @@ public class ImportPointServiceImpl implements ImportPointService {
Map<String, String> bqTypeMap = new HashMap<>(); Map<String, String> bqTypeMap = new HashMap<>();
bqTypeMap.put("中大物标签","中大物标签"); bqTypeMap.put("中大物标签","中大物标签");
bqTypeMap.put("小物标签","小物标签"); bqTypeMap.put("小物标签","小物标签");
bqTypeMap.put("自由货位标签","自由货位标签");
for (PointImport data : dataList) { for (PointImport data : dataList) {
String code=data.getCode(); String code=data.getCode();
String areaName=data.getAreaName(); String areaName=data.getAreaName();
@ -180,6 +181,7 @@ public class ImportPointServiceImpl implements ImportPointService {
String ns= data.getNs(); String ns= data.getNs();
String bqlx= data.getBqlx(); String bqlx= data.getBqlx();
Point point = pointIdMap.get(data.getId()); Point point = pointIdMap.get(data.getId());
point.setUpdateDes("");
if(point==null){ if(point==null){
throw new BadRequestException("库位不存在"); throw new BadRequestException("库位不存在");
} }
@ -188,6 +190,7 @@ public class ImportPointServiceImpl implements ImportPointService {
if(point2!=null){ if(point2!=null){
throw new BadRequestException(code+"库位已存在,不能重复更新"); throw new BadRequestException(code+"库位已存在,不能重复更新");
} }
point.setUpdateDes(point.getCode()+"update"+code+"\n");
point.setCode(code); point.setCode(code);
} }
if(headersMap.containsKey("库区")) { if(headersMap.containsKey("库区")) {
@ -195,6 +198,7 @@ public class ImportPointServiceImpl implements ImportPointService {
if(area==null){ if(area==null){
throw new BadRequestException("库区不存在"); throw new BadRequestException("库区不存在");
} }
point.setUpdateDes(point.getArea().getCode()+"update"+areaName+"\n");
point.setArea(area); point.setArea(area);
} }
if(headersMap.containsKey("存储类型")) { if(headersMap.containsKey("存储类型")) {

View File

@ -82,7 +82,7 @@ public class CountMoveDetailRecord extends BaseEntity implements Serializable
private String srcStockCode; private String srcStockCode;
@Column(name = "`plan_qty`") @Column(name = "`plan_qty`")
@ApiModelProperty(value = "计划数量") @ApiModelProperty(value = "")
private Double planQty; private Double planQty;
@OneToOne @OneToOne

View File

@ -50,7 +50,7 @@ public class BomAccountImport {
@ExcelProperty("收容数") @ExcelProperty("收容数")
private String srs; private String srs;
@ExcelProperty("台车库位") @ExcelProperty("工程(台车库位)")
private String tckw; private String tckw;
@ExcelProperty("大小物") @ExcelProperty("大小物")

View File

@ -84,4 +84,9 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
" and inv.point_id=:point_id and inv.item_key_id=:item_key_id and p.type=:point_type and inv.stock_code=:stockCode" , nativeQuery = true) " and inv.point_id=:point_id and inv.item_key_id=:item_key_id and p.type=:point_type and inv.stock_code=:stockCode" , nativeQuery = true)
List<Inventory> queryInvPdXd(long point_id,Long item_key_id,String point_type,String stockCode); List<Inventory> queryInvPdXd(long point_id,Long item_key_id,String point_type,String stockCode);
@Query(value = "SELECT * FROM data_inventory inv " +
"left join base_point p on inv.point_id=p.id " +
" WHERE inv.point_id=:point_id and inv.item_key_id=:item_key_id and inv.stock_code=:stockCode" , nativeQuery = true)
List<Inventory> queryInvXdMove(long point_id,Long item_key_id,String stockCode);
} }

View File

@ -23,6 +23,7 @@ import com.youchain.businessdata.service.CountPlanService;
import com.youchain.businessdata.service.CountRecordService; import com.youchain.businessdata.service.CountRecordService;
import com.youchain.businessdata.service.InventoryService; import com.youchain.businessdata.service.InventoryService;
import com.youchain.businessdata.service.dto.CountDetailQueryCriteria; import com.youchain.businessdata.service.dto.CountDetailQueryCriteria;
import com.youchain.exception.BadRequestException;
import com.youchain.exception.handler.ApiError; import com.youchain.exception.handler.ApiError;
import com.youchain.exception.handler.ApiResult; import com.youchain.exception.handler.ApiResult;
import com.youchain.utils.BaseStatus; import com.youchain.utils.BaseStatus;
@ -129,6 +130,9 @@ public class CountDetailController {
for(CountDetail d:details){ for(CountDetail d:details){
List<Inventory> invs=inventoryService.getInvForPlan(p.getType(),d.getArea().getId(), null,null); List<Inventory> invs=inventoryService.getInvForPlan(p.getType(),d.getArea().getId(), null,null);
for(Inventory inv:invs){ for(Inventory inv:invs){
if(inv.getQueuedQty()>0){
throw new BadRequestException(d.getItem().getCode()+"包含占用数,不能移位");
}
inv.setQueuedQty(inv.getQuantity()); inv.setQueuedQty(inv.getQuantity());
inventoryService.update(inv); inventoryService.update(inv);
countRecordService.createCountRecord(d,inv); countRecordService.createCountRecord(d,inv);

View File

@ -278,16 +278,21 @@ public class InventoryController {
throw new BadRequestException("没有对应的库存"); throw new BadRequestException("没有对应的库存");
} }
if (type.equals("xd_move_002")) { if (type.equals("xd_move_002")) {
String ewm=xdMoveReq.getEwm(); String pointCode=xdMoveReq.getEwm();
String[] str=ewm.split("]"); String[] str=pointCode.split("]");
String pointCode=null; String gdItemCode=null;
if(str.length>=3) {//固定库位标签 if(str.length>=3) {//固定库位标签
pointCode = str[3]; pointCode = str[3];
}else { gdItemCode= str[0];
pointCode=ewm;
} }
Point point = pointRepository.findByCode(pointCode); Point dstPoint=pointRepository.findByCode(pointCode);
xdMoveReq.setPointId(point.getId()); if(dstPoint==null){
throw new BadRequestException(pointCode + "库位不存在");
}
if(gdItemCode==null){
gdItemCode=dstPoint.getItemCode();
}
xdMoveReq.setPointId(dstPoint.getId());
xdMoveReq.setStockCode(stockCode); xdMoveReq.setStockCode(stockCode);
this.xdMoveInv(xdMoveReq); this.xdMoveInv(xdMoveReq);
} }
@ -360,11 +365,11 @@ public class InventoryController {
if(srcPoint==null||dstPoint==null) { if(srcPoint==null||dstPoint==null) {
throw new BadRequestException("请扫描库位"); throw new BadRequestException("请扫描库位");
} }
if(!srcPoint.getType().equals(BaseStatus.ZZKW)&&!srcPoint.getType().equals(BaseStatus.HCKW)&&(srcPoint.getArea().getName()).indexOf("盘点")<0) { if(!srcPoint.getType().equals(BaseStatus.ZZKW)&&(srcPoint.getArea().getName()).indexOf("盘点")<0&&(srcPoint.getArea().getName()).indexOf("临时")<=-1) {
throw new BadRequestException(srcPoint.getCode()+"该功能仅限于制造库位或缓存库位或盘点库位"); throw new BadRequestException(srcPoint.getCode()+"该功能仅限于制造库位或临时库位或盘点库位");
} }
if(!dstPoint.getType().equals(BaseStatus.ZZKW)&&!dstPoint.getType().equals(BaseStatus.HCKW)&&(dstPoint.getArea().getName()).indexOf("盘点")<0) { if(!dstPoint.getType().equals(BaseStatus.ZZKW)&&(dstPoint.getArea().getName()).indexOf("盘点")<0&&(dstPoint.getArea().getName()).indexOf("临时")<0) {
throw new BadRequestException(dstPoint.getCode()+"该功能仅限于制造库位或缓存库位或盘点库位"); throw new BadRequestException(dstPoint.getCode()+"该功能仅限于制造库位或临时库位或盘点库位");
} }
BomAccount bomAccount=bs.get(0); BomAccount bomAccount=bs.get(0);
Item item=bomAccount.getItem(); Item item=bomAccount.getItem();
@ -381,15 +386,15 @@ public class InventoryController {
double srcQty = srcInventory.getQuantity(); double srcQty = srcInventory.getQuantity();
srcInventory.setQuantity(srcInventory.getQuantity() - move_qty); srcInventory.setQuantity(srcInventory.getQuantity() - move_qty);
inventoryService.update(srcInventory); inventoryService.update(srcInventory);
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "制造入库APP", srcPoint.getArea(), itemKey, srcInventory.getPoint(), srcInventory.getPoint(), null, null, srcQty, move_qty + 0d, null, null, InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.REDUCE, "制造移位APP", srcPoint.getArea(), itemKey, srcInventory.getPoint(), srcInventory.getPoint(), null, null, srcQty, move_qty + 0d, null, null,
BizStatus.ZZKW_TL, null, srcInventory.getId(), "制造移位APP"); BizStatus.ZZKW_MOVE, null, srcInventory.getId(), "制造移位APP");
Inventory dstInventory = inventoryService.getInventory(itemKey, dstPoint.getArea(), dstPoint, dstPoint, dstPoint.getDept(), BizStatus.MOVE, null); Inventory dstInventory = inventoryService.getInventory(itemKey, dstPoint.getArea(), dstPoint, dstPoint, dstPoint.getDept(), BizStatus.MOVE, null);
double srcQty2 = dstInventory.getQuantity(); double srcQty2 = dstInventory.getQuantity();
dstInventory.setQuantity(dstInventory.getQuantity() + move_qty); dstInventory.setQuantity(dstInventory.getQuantity() + move_qty);
inventoryService.update(dstInventory); inventoryService.update(dstInventory);
InventoryLog dstInventoryLog = inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "制造入库APP", dstPoint.getArea(), itemKey, dstInventory.getPoint(), dstInventory.getPoint(), null, null, srcQty2, move_qty + 0d, null, null, InventoryLog dstInventoryLog = inventoryLogService.storeInventoryLog(BizStatus.MOVE, BizStatus.ADD, "制造移位APP", dstPoint.getArea(), itemKey, dstInventory.getPoint(), dstInventory.getPoint(), null, null, srcQty2, move_qty + 0d, null, null,
BizStatus.ZZKW_TL, null, dstInventory.getId(), "制造移位APP"); BizStatus.ZZKW_MOVE, null, dstInventory.getId(), "制造移位APP");
} }
@ -407,29 +412,47 @@ public class InventoryController {
if(!point.getType().equals("CH")) { if(!point.getType().equals("CH")) {
throw new BadRequestException("库位类型需为材管库位"); throw new BadRequestException("库位类型需为材管库位");
} }
List<Inventory> invs=inventoryRepository.queryInvStockCode(xdMoveReq.getStockCode()); List<Inventory> srcInvs=inventoryRepository.queryInvStockCode(xdMoveReq.getStockCode());
if(invs.size()<=0){ if(srcInvs.size()<=0){
throw new BadRequestException("没有对应的库存"); throw new BadRequestException("没有对应的库存");
} }
for(Inventory inventory:invs){ for(Inventory srcInventory:srcInvs){
double srcQty=inventory.getQuantity(); double srcQty=srcInventory.getQuantity();
Point srcPoint=inventory.getPoint(); Point srcPoint=srcInventory.getPoint();
if(inventory.getQueuedQty()>0){ if(srcInventory.getQueuedQty()>0){
throw new BadRequestException("已锁定,不能移位"); throw new BadRequestException("已占用,不能移位");
} }
if(point.getId().equals(inventory.getPoint().getId())){ if(point.getId().equals(srcInventory.getPoint().getId())){
throw new BadRequestException("库位相同,不能移位"); throw new BadRequestException("库位相同,不能移位");
} }
if(point.getItemCode()!=null&&!point.getItemCode().equals("")){ if(point.getItemCode()!=null&&!point.getItemCode().equals("")){
if(!point.getItemCode().equals(inventory.getItemKey().getItem().getCode())){ if(!point.getItemCode().equals(srcInventory.getItemKey().getItem().getCode())){
throw new BadRequestException("库位品番"+point.getItemCode()+"不一致,不能移位"); throw new BadRequestException("库位品番"+point.getItemCode()+"不一致,不能移位");
} }
} }
inventory.setArea(point.getArea()); Long invId=srcInventory.getId();
inventory.setPoint(point); //查找目标库存
inventoryRepository.save(inventory); List<Inventory> dstInvs=inventoryRepository.queryInvXdMove(point.getId(),srcInventory.getItemKey().getId(),xdMoveReq.getStockCode());
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.XD_MOVE, BizStatus.REDUCE, "箱单移位", point.getArea(), inventory.getItemKey(), srcPoint, point, null, null, srcQty, inventory.getQuantity(), xdMoveReq.getStockCode(), null, if(dstInvs.size()>0) {
BizStatus.ZZKW_TL, null, inventory.getId(), "箱单移位"); for (Inventory dstInventory : dstInvs) {
dstInventory.setArea(point.getArea());
dstInventory.setPoint(point);
dstInventory.setPointCode(point.getCode());
dstInventory.setQuantity(srcQty);
inventoryRepository.save(dstInventory);
invId=dstInventory.getId();
}
srcInventory.setQuantity(0d);
inventoryRepository.save(srcInventory);
}else{
//如果没有直接将现有数据换成该目标库位
srcInventory.setArea(point.getArea());
srcInventory.setPoint(point);
srcInventory.setPointCode(point.getCode());
inventoryRepository.save(srcInventory);
}
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.XD_MOVE, BizStatus.REDUCE, "箱单移位", point.getArea(), srcInventory.getItemKey(), srcPoint, point, null, null, srcQty, srcInventory.getQuantity(), xdMoveReq.getStockCode(), null,
BizStatus.XD_MOVE, null, invId, "箱单移位");
} }
return new ResponseEntity<>("操作成功",HttpStatus.OK); return new ResponseEntity<>("操作成功",HttpStatus.OK);
} }

View File

@ -732,11 +732,20 @@ public class XppRecordController {
Set<Long> ids=iPut.getIds(); Set<Long> ids=iPut.getIds();
String pointCode=iPut.getPointCode(); String pointCode=iPut.getPointCode();
if(pointCode==null||pointCode.equals("")){ if(pointCode==null||pointCode.equals("")){
return new ResponseEntity<>("移位库位必填", BAD_REQUEST); throw new BadRequestException("移位库位必填");
}
String[] str=pointCode.split("]");
String gdItemCode=null;
if(str.length>=3) {//固定库位标签
pointCode = str[3];
gdItemCode= str[0];
} }
Point dstPoint=pointService.getPoint(pointCode,null,null,null); Point dstPoint=pointService.getPoint(pointCode,null,null,null);
if(dstPoint==null){ if(dstPoint==null){
return new ResponseEntity<>(dstPoint + "库位不存在", BAD_REQUEST); throw new BadRequestException(pointCode + "库位不存在");
}
if(gdItemCode==null){
gdItemCode=dstPoint.getItemCode();
} }
Area dstArea=dstPoint.getArea(); Area dstArea=dstPoint.getArea();
Point zzkw=null; Point zzkw=null;
@ -750,6 +759,9 @@ public class XppRecordController {
if(!xppRecord.getStatus().equals(BizStatus.PUTAWAY)){ if(!xppRecord.getStatus().equals(BizStatus.PUTAWAY)){
throw new BadRequestException(itemCode+"现品票状态不正确"); throw new BadRequestException(itemCode+"现品票状态不正确");
} }
if(gdItemCode!=null&&!gdItemCode.equals("")&&!itemCode.equals(gdItemCode)){
throw new BadRequestException("品番"+itemCode+"和库位固定品番"+gdItemCode+"不匹配");
}
ItemKey ik = xppRecord.getItemKey(); ItemKey ik = xppRecord.getItemKey();
Point srcPoint=xppRecord.getInvPoint(); Point srcPoint=xppRecord.getInvPoint();
Area srcArea=srcPoint.getArea(); Area srcArea=srcPoint.getArea();

View File

@ -30,36 +30,4 @@ public interface BomPrint {
String getBqlx(); String getBqlx();
// private String ns;
//
// @ExcelProperty("箱种")
// private String xz;
//
// @ExcelProperty("品名")
// private String pm;
//
// @ExcelProperty("供应商")
// private String supplier;
//
// @ExcelProperty("货位")
// private String hw;
//
// @ExcelProperty("收容数")
// private String srs;
//
// @ExcelProperty("大小物")
// private String dxw;
//
// @ExcelProperty("税别")
// private String bonded;
//
// @ExcelProperty("机型")
// private String jxs;
//
// @ExcelProperty("台用量")
// private String tyls;
//
// @ExcelProperty("二维码")
// private String ewm;
} }

View File

@ -0,0 +1,26 @@
package com.youchain.businessdata.returnJson;
import lombok.Data;
import java.sql.Timestamp;
@Data
public class TcOutList {
/**序号*/
Long bom_id;
/**品番*/
String item_code;
/**品名*/
String item_name;
/**货位*/
String point_code;
/**数量*/
int order_qty;
/**税别*/
String bonded;
/**机型代码*/
String big_item_code;
/**机型名称*/
String big_item_name;
}

View File

@ -90,6 +90,9 @@ public class InventoryQueryCriteria{
@Query(joinName = "area",propName = "bexb",type = Query.Type.EQUAL) @Query(joinName = "area",propName = "bexb",type = Query.Type.EQUAL)
private Boolean bexb; private Boolean bexb;
@Query(joinName = "area",propName = "betc",type = Query.Type.EQUAL)
private Boolean betc;
/** 模糊 */ /** 模糊 */
@Query(type = Query.Type.INNER_LIKE) @Query(type = Query.Type.INNER_LIKE)
private String stockCode; private String stockCode;

View File

@ -171,7 +171,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
asn.setReceivedQuantity(asn.getReceivedQuantity()-t.getPlanQty()); asn.setReceivedQuantity(asn.getReceivedQuantity()-t.getPlanQty());
} }
InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_CANCEL,BizStatus.REDUCE,null,t.getArea(),t.getItemKey(),t.getDstPoint(),t.getSrcPoint(),null,null,srcQty,t.getPlanQty(), InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_CANCEL,BizStatus.REDUCE,t.getBillCode(),t.getArea(),t.getItemKey(),t.getDstPoint(),t.getSrcPoint(),null,null,srcQty,t.getPlanQty(),
null,ewm, BizStatus.ASN,inventory.getId(),inventory.getId(),"取消上架"); null,ewm, BizStatus.ASN,inventory.getId(),inventory.getId(),"取消上架");
taskRepository.delete(t); taskRepository.delete(t);
if(xppRecord!=null&&d!=null){ if(xppRecord!=null&&d!=null){
@ -281,12 +281,15 @@ public class AsnDetailServiceImpl implements AsnDetailService {
// }else{ // }else{
// pc1=DateUtil.dateYmdz(); // pc1=DateUtil.dateYmdz();
// } // }
if(!area.getBexb()){ // if(!area.getBexb()){
pc1=DateUtil.dateYmdz(); // pc1=DateUtil.dateYmdz();
} // }
if(point==null){ if(point==null){
throw new BadRequestException("请选择入库库位"); throw new BadRequestException("请选择入库库位");
} }
if(point.getType().equals(BaseStatus.CH)){//材管库位入库需要批次
pc1=DateUtil.dateYmdz();
}
double unRecQty=d.getOrderQty() - d.getReceivedQty(); double unRecQty=d.getOrderQty() - d.getReceivedQty();
if ( recQty<=unRecQty) { if ( recQty<=unRecQty) {
//现品票确认将任务id回写到现品票表中 //现品票确认将任务id回写到现品票表中

View File

@ -120,6 +120,9 @@ public class CountMoveServiceImpl implements CountMoveService {
List<Inventory> inventoryList=inventoryRepository.queryInventoryArea(countMove.getSrcArea().getId()); List<Inventory> inventoryList=inventoryRepository.queryInventoryArea(countMove.getSrcArea().getId());
for(Inventory inv:inventoryList) { for(Inventory inv:inventoryList) {
ItemKey itemKey = inv.getItemKey(); ItemKey itemKey = inv.getItemKey();
if(inv.getQueuedQty()>0){
throw new BadRequestException(itemKey.getItem().getCode()+"包含占用数,不能移位");
}
// if(inv.getStockCode()==null) {//非箱单库存根据纳入数调整库存数 // if(inv.getStockCode()==null) {//非箱单库存根据纳入数调整库存数
// int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId()); // int nrs = xppRecordRepository.queryXppItemKeyPointNrs(itemKey.getId(), inv.getPoint().getId());
// if (inv.getQueuedQty() > 0) { // if (inv.getQueuedQty() > 0) {
@ -245,7 +248,7 @@ public class CountMoveServiceImpl implements CountMoveService {
log.info("xppRecordListAll:"); log.info("xppRecordListAll:");
List<XppRecord> xppRecordListAll = new ArrayList<>(); List<XppRecord> xppRecordListAll = new ArrayList<>();
if(!countMove.getSrcArea().getBexb()) { if(!countMove.getSrcArea().getBexb()) {
xppRecordRepository.queryXppItemKeyPoint2(); xppRecordListAll= xppRecordRepository.queryXppItemKeyPoint2();
} }
Map<String,List<XppRecord>> map_xppRecord=new HashMap<>(); Map<String,List<XppRecord>> map_xppRecord=new HashMap<>();
log.info("xppRecordListAll:"+xppRecordListAll.size()); log.info("xppRecordListAll:"+xppRecordListAll.size());
@ -293,8 +296,12 @@ public class CountMoveServiceImpl implements CountMoveService {
key2+=inv.getStockCode(); key2+=inv.getStockCode();
} }
if (inv.getQueuedQty() > 0) { if (inv.getQueuedQty() > 0) {
throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数"); //throw new BadRequestException(itemKey.getItem().getCode() + "包含占用数");
d.setRemark("包含占用数,不能移位!");
countMoveDetailRepository.save(d);
continue;
} }
List<XppRecord> xppRecordList =new ArrayList<>(); List<XppRecord> xppRecordList =new ArrayList<>();
if(map_xppRecord!=null&&map_xppRecord.size()>0) { if(map_xppRecord!=null&&map_xppRecord.size()>0) {
xppRecordList=map_xppRecord.get(key2); xppRecordList=map_xppRecord.get(key2);

View File

@ -182,6 +182,7 @@ public class InventoryServiceImpl implements InventoryService {
hql+=" and inv.itemKey.propC2='"+propC2+"'"; hql+=" and inv.itemKey.propC2='"+propC2+"'";
} }
hql+=" and inv.area.code not like '%盘点%'"; hql+=" and inv.area.code not like '%盘点%'";
hql+=" and inv.area.code not like '%临时%'";
hql+= " order by inv.itemKey.propC1 asc,inv.stockCode asc "; hql+= " order by inv.itemKey.propC1 asc,inv.stockCode asc ";
Query query = entityManager.createQuery(hql); Query query = entityManager.createQuery(hql);
List<Inventory> inventoryList = query.getResultList(); List<Inventory> inventoryList = query.getResultList();
@ -364,7 +365,7 @@ public class InventoryServiceImpl implements InventoryService {
inventory = inventoryList.get(0); inventory = inventoryList.get(0);
} else { } else {
//创建Inventory //创建Inventory
if (type.equals(BizStatus.ZZKW_MOVE) ||type.equals(BizStatus.ZZKW_TL) ||type.equals(BizStatus.RECEIVING_UP) || type.equals(BizStatus.MOVE)||type.equals(BizStatus.PICK_DOWN)||type.equals(BizStatus.PICK_CANCEL)||type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.COUNT_MOVE)||type.equals(BizStatus.YK_JS)) { if (type.equals(BizStatus.ZZKW_MOVE) ||type.equals(BizStatus.ZZKW_TL) ||type.equals(BizStatus.RECEIVING_UP) || type.equals(BizStatus.MOVE)||type.equals(BizStatus.PICK_DOWN)||type.equals(BizStatus.PICK_CANCEL)||type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.COUNT_MOVE)||type.equals(BizStatus.YK_JS)||type.equals(BizStatus.TC_RK)) {
inventory = new Inventory(); inventory = new Inventory();
inventory.setItemKey(itemKey); inventory.setItemKey(itemKey);
inventory.setPoint(point); inventory.setPoint(point);

View File

@ -479,7 +479,7 @@ public class PickTicketServiceImpl implements PickTicketService {
throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于分配数量"); throw new BadRequestException(HttpStatus.NOT_FOUND, "拣货数量大于分配数量");
} }
} }
Boolean isCf= Boolean.FALSE; Boolean isCf= Boolean.FALSE;//是否超发
double cfQty=0; double cfQty=0;
if (pickQty > (task.getPlanQty() - task.getMoveQty())) { if (pickQty > (task.getPlanQty() - task.getMoveQty())) {
fpQty = task.getPlanQty() - task.getMoveQty(); fpQty = task.getPlanQty() - task.getMoveQty();

View File

@ -145,63 +145,7 @@ public class SparepartsServiceImpl implements SparepartsService {
if (bs.size() <= 0) { if (bs.size() <= 0) {
throw new BadRequestException(s.getBigItemId().getCode() + "未查到"+kyQz+"对应BOM工位清单"); throw new BadRequestException(s.getBigItemId().getCode() + "未查到"+kyQz+"对应BOM工位清单");
} }
for(BomAccount ba:bs){ bomAccountService.bomInvDeal(bs,s.getOrderQuantity(),BizStatus.XB_HY,s.getBigItemId().getCode(),s.getId(),"零件耗用");
if(ba.getZPoint()==null){
throw new BadRequestException(ba.getItem().getCode()+"维护制造库位");
}
double qty=s.getOrderQuantity()*ba.getSingles();
//扣除线边库存
List<Inventory> inventorys=inventoryService.getXbHyInv(ba.getItem(),ba.getRArea(),ba.getZPoint(),"耗用");
if(inventorys.size()>0){
int num=0;
for(Inventory inv:inventorys){
if(qty<=0){
break;
}
num++;
if(num<inventorys.size()&&inv.getQuantity()<=0){
continue;
}
double srcQty=inv.getQuantity();
double hyQty=0;
if(inv.getQuantity()>qty||num==inventorys.size()){
hyQty=qty;
qty-=hyQty;
}else{
hyQty=inv.getQuantity();
qty-=hyQty;
}
inv.setQuantity(inv.getQuantity()-hyQty);
inventoryService.update(inv);
InventoryLog log= inventoryLogService.storeInventoryLog(BizStatus.XB_HY,BizStatus.REDUCE,ba.getBigItem().getCode(),ba.getRArea(),inv.getItemKey(),
inv.getPoint(),inv.getPoint(),null,null,srcQty,hyQty,null,null,s.getBigItemId().getCode(),
s.getId(),inv.getId(),"零件耗用");
log.setZzkw(ba.getZPoint());
inventoryLogService.update(log);
}
}else{
// Point point=ba.getCArea().getPoint();
Point point=pointService.findEntityById(ba.getRArea().getPointId());
if(point==null){
throw new BadRequestException(ba.getRArea().getCode()+"库区无对应待投料库位");
}
ItemKey itemKey=itemKeyService.getItemKey(ba.getItem(),null,ba.getBonded());
Inventory inventory = new Inventory();
inventory.setItemKey(itemKey);
inventory.setPoint(ba.getZPoint());
inventory.setPointCode(ba.getZPoint().getCode());
// inventory.setZzkw(ba.getZPoint());
inventory.setDept(UserUtils.getDept());
inventory.setArea(ba.getRArea());
inventory.setQuantity(-qty);
inventoryService.create(inventory);
InventoryLog log=inventoryLogService.storeInventoryLog(BizStatus.XB_HY,BizStatus.REDUCE,ba.getBigItem().getCode(),ba.getRArea(),inventory.getItemKey(),
inventory.getPoint(),inventory.getPoint(),null,null,0d,qty,null,null,s.getBigItemId().getCode(),
s.getId(),inventory.getId(),"零件耗用");
// log.setZzkw(ba.getZPoint());
inventoryLogService.update(log);
}
}
s.setStatus(BizStatus.CONSUME); s.setStatus(BizStatus.CONSUME);
s.setHyBy(SecurityUtils.getCurrentUsername()); s.setHyBy(SecurityUtils.getCurrentUsername());
s.setHyTime(new Timestamp(new Date().getTime())); s.setHyTime(new Timestamp(new Date().getTime()));

View File

@ -63,6 +63,12 @@ public interface BaseStatus {
*/ */
public static String DEFAULT_AREA = "CGK"; public static String DEFAULT_AREA = "CGK";
/**
*
*/
public static String DEFAULT_TC_AREA = "TCK";
public static String AREA_S = "S仓"; public static String AREA_S = "S仓";
public static String AREA_A = "A仓"; public static String AREA_A = "A仓";
@ -142,5 +148,11 @@ public interface BaseStatus {
*/ */
public static String ZDWBQ = "_ZDWBQ"; public static String ZDWBQ = "_ZDWBQ";
/**
* -
*/
public static String TCBQ= "_TCBQ";
} }

View File

@ -183,6 +183,11 @@ public class BizStatus {
* -线 * -线
*/ */
public static String XB_HY = "XB_HY"; public static String XB_HY = "XB_HY";
/**
* -
*/
public static String TC_OUT = "TC_OUT";
/** /**
* - * -
*/ */
@ -247,6 +252,11 @@ public class BizStatus {
*/ */
public static String ZZKW_TL = "ZZKW_TL"; public static String ZZKW_TL = "ZZKW_TL";
/**
*
*/
public static String TC_RK = "TC_RK";
/** /**
* *
*/ */
@ -258,7 +268,7 @@ public class BizStatus {
public static String ZZKW_RK = "ZZKW_RK"; public static String ZZKW_RK = "ZZKW_RK";
/** /**
* *
*/ */
public static String XD_MOVE = "XD_MOVE"; public static String XD_MOVE = "XD_MOVE";
/** /**