拣货逻辑调整
parent
1bfbcf123f
commit
1eb8972a6a
|
|
@ -190,8 +190,12 @@ public class DateUtil {
|
||||||
}else if(day>28){
|
}else if(day>28){
|
||||||
z="29-31";
|
z="29-31";
|
||||||
}
|
}
|
||||||
|
if(month<=9){
|
||||||
|
return year+"-0"+month+"-"+z;
|
||||||
|
}else{
|
||||||
return year+"-"+month+"-"+z;
|
return year+"-"+month+"-"+z;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String formatChageDay(Date date, String type, int value) {
|
public static String formatChageDay(Date date, String type, int value) {
|
||||||
Calendar cal = new java.util.GregorianCalendar();
|
Calendar cal = new java.util.GregorianCalendar();
|
||||||
|
|
|
||||||
|
|
@ -62,39 +62,45 @@ public class ImportPointServiceImpl implements ImportPointService {
|
||||||
List<String> pointcodes = dataList.stream().map(PointImport::getCode).collect(Collectors.toList());
|
List<String> pointcodes = dataList.stream().map(PointImport::getCode).collect(Collectors.toList());
|
||||||
pointcodes = pointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
pointcodes = pointcodes.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
Map<String, Point> exitPointMap = validatePoint(pointcodes);
|
Map<String, Point> exitPointMap = validatePoint(pointcodes);
|
||||||
|
List<Point> pointAll=pointRepository.findAll();
|
||||||
//获取文件中所有的库区名称
|
for(Point p:pointAll){
|
||||||
List<String> areaNames = dataList.stream().map(PointImport::getAreaName).collect(Collectors.toList());
|
exitPointMap.put(p.getCode(),p);
|
||||||
areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
}
|
||||||
Map<String, Area> exitAreaMap = validateArea(areaNames);
|
//
|
||||||
|
// //获取文件中所有的库区名称
|
||||||
|
// List<String> areaNames = dataList.stream().map(PointImport::getAreaName).collect(Collectors.toList());
|
||||||
|
// areaNames = areaNames.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
|
// Map<String, Area> exitAreaMap = validateArea(areaNames);
|
||||||
|
|
||||||
for (PointImport data : dataList) {
|
for (PointImport data : dataList) {
|
||||||
|
log.info(data.getAreaName()+"===="+data.getCode());
|
||||||
Point point = exitPointMap.get(data.getCode());
|
Point point = exitPointMap.get(data.getCode());
|
||||||
if (point == null) {
|
point.setCode(data.getAreaName());
|
||||||
point=new Point();
|
// if (point == null) {
|
||||||
point.setCode(data.getCode());
|
// point=new Point();
|
||||||
point.setDept(UserUtils.getDept());
|
// point.setCode(data.getCode());
|
||||||
point.setCreateBy(SecurityUtils.getCurrentUsername());
|
// point.setDept(UserUtils.getDept());
|
||||||
point.setCreateTime(new Timestamp(new Date().getTime()));
|
// point.setCreateBy(SecurityUtils.getCurrentUsername());
|
||||||
point.setEnabled(Boolean.TRUE);
|
// point.setCreateTime(new Timestamp(new Date().getTime()));
|
||||||
}
|
// point.setEnabled(Boolean.TRUE);
|
||||||
point.setArea(exitAreaMap.get(data.getAreaName()));
|
// }
|
||||||
String lx = data.getType();
|
// point.setArea(exitAreaMap.get(data.getAreaName()));
|
||||||
if (lx.equals("材管库位")) {
|
// String lx = data.getType();
|
||||||
lx = BaseStatus.CH;
|
// if (lx.equals("材管库位")) {
|
||||||
} else if (lx.equals("制造库位")) {
|
// lx = BaseStatus.CH;
|
||||||
lx = BaseStatus.ZZKW;
|
// } else if (lx.equals("制造库位")) {
|
||||||
}else if (lx.equals("缓存库位")) {
|
// lx = BaseStatus.ZZKW;
|
||||||
lx = BaseStatus.HCKW;
|
// }else if (lx.equals("缓存库位")) {
|
||||||
}
|
// lx = BaseStatus.HCKW;
|
||||||
point.setType(lx);
|
// }
|
||||||
point.setBeatCode(data.getNs());
|
// point.setType(lx);
|
||||||
point.setDescription(data.getBqlx());
|
// point.setBeatCode(data.getNs());
|
||||||
point.setItemCode(data.getItemCode());
|
// point.setDescription(data.getBqlx());
|
||||||
point.setZflx(data.getZflx());
|
// point.setItemCode(data.getItemCode());
|
||||||
point.setBqlx(data.getBqlx());
|
// point.setZflx(data.getZflx());
|
||||||
point.setGlzkw(data.getGlzkw());
|
// point.setBqlx(data.getBqlx());
|
||||||
point.setInvMin(Integer.parseInt(data.getKcxx()));
|
// point.setGlzkw(data.getGlzkw());
|
||||||
|
// point.setInvMin(Integer.parseInt(data.getKcxx()));
|
||||||
pointRepository.save(point);
|
pointRepository.save(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,12 +131,12 @@ public class ImportPointServiceImpl implements ImportPointService {
|
||||||
// 根据模板类型进行不同的处理
|
// 根据模板类型进行不同的处理
|
||||||
List<String> requiredColumns = Arrays.asList(
|
List<String> requiredColumns = Arrays.asList(
|
||||||
"库位号",
|
"库位号",
|
||||||
"库区",
|
"库区"
|
||||||
"存储类型",
|
// "存储类型",
|
||||||
"品番",
|
// "品番",
|
||||||
"库存下限",
|
// "库存下限",
|
||||||
"纳所",
|
// "纳所",
|
||||||
"标签类型"
|
// "标签类型"
|
||||||
// ,
|
// ,
|
||||||
// "总分类型",
|
// "总分类型",
|
||||||
// "关联总库位"
|
// "关联总库位"
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public interface InventoryRepository extends JpaRepository<Inventory, Long>, Jpa
|
||||||
|
|
||||||
@Query(value = "SELECT * from data_inventory inv \n" +
|
@Query(value = "SELECT * from data_inventory inv \n" +
|
||||||
"left join base_point p on inv.point_id=p.id\n" +
|
"left join base_point p on inv.point_id=p.id\n" +
|
||||||
"WHERE inv.quantity>0 and p.type='CH' and inv.stock_code=:stockCode" , nativeQuery = true)
|
"WHERE inv.quantity-inv.queued_qty>0 and p.type='CH' and inv.stock_code=:stockCode" , nativeQuery = true)
|
||||||
List<Inventory> queryInvStockCode(String stockCode);
|
List<Inventory> queryInvStockCode(String stockCode);
|
||||||
|
|
||||||
@Query(value = "SELECT inv.* from data_inventory inv \n" +
|
@Query(value = "SELECT inv.* from data_inventory inv \n" +
|
||||||
|
|
|
||||||
|
|
@ -105,4 +105,8 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
||||||
*/
|
*/
|
||||||
@Query(value = "select * from data_task t where t.plan_qty>t.move_qty and t.pick_detail_id is not null and t.item_key_id=1? ", nativeQuery = true)
|
@Query(value = "select * from data_task t where t.plan_qty>t.move_qty and t.pick_detail_id is not null and t.item_key_id=1? ", nativeQuery = true)
|
||||||
List<Task> getItemKeyTask(Long id);
|
List<Task> getItemKeyTask(Long id);
|
||||||
|
|
||||||
|
@Query(value = "select * from data_task t where t.task_type='PICK' and t.move_qty<t.plan_qty \n" +
|
||||||
|
" and t.dst_stock_code is not null and t.bill_code is null and t.dst_stock_code=:stockCode ", nativeQuery = true)
|
||||||
|
List<Task> getStockTasks(String stockCode);
|
||||||
}
|
}
|
||||||
|
|
@ -389,7 +389,7 @@ public class AsnDetailController {
|
||||||
}
|
}
|
||||||
return new ResponseEntity("取消成功", HttpStatus.OK);
|
return new ResponseEntity("取消成功", HttpStatus.OK);
|
||||||
}
|
}
|
||||||
@Log("取消收货的操作")
|
@Log("的操作")
|
||||||
@ApiOperation("取消收货的操作")
|
@ApiOperation("取消收货的操作")
|
||||||
@PostMapping("/rkAndQxButtonQX")
|
@PostMapping("/rkAndQxButtonQX")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
|
|
@ -437,7 +437,7 @@ public class AsnDetailController {
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成库存日志
|
//生成库存日志
|
||||||
InventoryLog inventoryLog = invLogService.storeInventoryLog(BizStatus.RECEIVING_CANCEL, BizStatus.REDUCE, null, ad.getPoint().getArea(), inve.getItemKey(),
|
InventoryLog inventoryLog = invLogService.storeInventoryLog(BizStatus.RECEIVING_CANCEL, BizStatus.REDUCE, asn.getCode(), ad.getPoint().getArea(), inve.getItemKey(),
|
||||||
pointMapper.toEntity(inventoryDto.getPoint()) , dstPoint, ad.getStock(), ad.getStock(), ad.getReceivedQty(), ad.getReceivedQty(), null,null,BizStatus.ASN, ad.getId(), inventoryDto.getId(), ad.getRemark());
|
pointMapper.toEntity(inventoryDto.getPoint()) , dstPoint, ad.getStock(), ad.getStock(), ad.getReceivedQty(), ad.getReceivedQty(), null,null,BizStatus.ASN, ad.getId(), inventoryDto.getId(), ad.getRemark());
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,7 @@ public class PickDetailController {
|
||||||
@Log("修改pickDetail")
|
@Log("修改pickDetail")
|
||||||
@ApiOperation("修改pickDetail")
|
@ApiOperation("修改pickDetail")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
|
@Transactional
|
||||||
public ResponseEntity<Object> updatePickDetail(@Validated @RequestBody PickDetail resources) {
|
public ResponseEntity<Object> updatePickDetail(@Validated @RequestBody PickDetail resources) {
|
||||||
if(resources.getAllocatedQty()>0){
|
if(resources.getAllocatedQty()>0){
|
||||||
throw new BadRequestException("已出单,不能修改");
|
throw new BadRequestException("已出单,不能修改");
|
||||||
|
|
@ -188,6 +189,7 @@ public class PickDetailController {
|
||||||
@Log("删除pickDetail")
|
@Log("删除pickDetail")
|
||||||
@ApiOperation("删除pickDetail")
|
@ApiOperation("删除pickDetail")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
|
@Transactional
|
||||||
public ResponseEntity<Object> deletePickDetail(@RequestBody Long[] ids) {
|
public ResponseEntity<Object> deletePickDetail(@RequestBody Long[] ids) {
|
||||||
//删除时需判断是否有分配
|
//删除时需判断是否有分配
|
||||||
for(Long id:ids){
|
for(Long id:ids){
|
||||||
|
|
@ -207,6 +209,7 @@ public class PickDetailController {
|
||||||
@ApiOperation("制造叫料App")
|
@ApiOperation("制造叫料App")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
@DuplicateSubmission(5)
|
@DuplicateSubmission(5)
|
||||||
public ResponseEntity<Object> zzjlApp(@RequestBody CxjlDto cxjldto) throws Exception {
|
public ResponseEntity<Object> zzjlApp(@RequestBody CxjlDto cxjldto) throws Exception {
|
||||||
String ewm=cxjldto.getEwm();
|
String ewm=cxjldto.getEwm();
|
||||||
|
|
@ -223,6 +226,7 @@ public class PickDetailController {
|
||||||
if(point==null||!point.getType().equals("ZZKW")){
|
if(point==null||!point.getType().equals("ZZKW")){
|
||||||
throw new BadRequestException("制造库位错误");
|
throw new BadRequestException("制造库位错误");
|
||||||
}
|
}
|
||||||
|
//查询BOM,寻找收容数
|
||||||
cxjldto.setRk_id(point.getArea().getId());
|
cxjldto.setRk_id(point.getArea().getId());
|
||||||
cxjldto.setItem_id(item.getId());
|
cxjldto.setItem_id(item.getId());
|
||||||
cxjldto.setZzkw_id(point.getId());
|
cxjldto.setZzkw_id(point.getId());
|
||||||
|
|
@ -242,6 +246,10 @@ public class PickDetailController {
|
||||||
PickDetail pickDetail = pickDetailService.cxjlCreate(cxjldto);
|
PickDetail pickDetail = pickDetailService.cxjlCreate(cxjldto);
|
||||||
//自动分配
|
//自动分配
|
||||||
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), pickDetail.getPo(), BaseStatus.ZZJL);
|
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(), pickDetail.getPo(), BaseStatus.ZZJL);
|
||||||
|
int qh_qty=pickDetail.getOrderQty().intValue()-pickDetail.getAllocatedQty().intValue();
|
||||||
|
if(qh_qty>0){
|
||||||
|
throw new BadRequestException(pickDetail.getItem().getCode()+"库存缺货,仅有"+pickDetail.getAllocatedQty().intValue()+",请汇报上级");
|
||||||
|
}
|
||||||
}else if(type.equals("cxjl_003")){//制造入库APP
|
}else if(type.equals("cxjl_003")){//制造入库APP
|
||||||
//解析二维码内容
|
//解析二维码内容
|
||||||
String[] str=ewm.split("]");
|
String[] str=ewm.split("]");
|
||||||
|
|
@ -275,6 +283,7 @@ public class PickDetailController {
|
||||||
@ApiOperation("制造叫料")
|
@ApiOperation("制造叫料")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
@DuplicateSubmission(5)
|
@DuplicateSubmission(5)
|
||||||
public ResponseEntity<Object> zzjl(@RequestBody CxjlDto cxjldto) throws Exception {
|
public ResponseEntity<Object> zzjl(@RequestBody CxjlDto cxjldto) throws Exception {
|
||||||
PickDetail pickDetail=pickDetailService.cxjlCreate(cxjldto);
|
PickDetail pickDetail=pickDetailService.cxjlCreate(cxjldto);
|
||||||
|
|
@ -282,6 +291,10 @@ public class PickDetailController {
|
||||||
cxjldto.setBonded(bomAccount.getBonded());
|
cxjldto.setBonded(bomAccount.getBonded());
|
||||||
//自动分配
|
//自动分配
|
||||||
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(),pickDetail.getPo(),BaseStatus.ZZJL);
|
pickDetailService.allocate(pickDetail.getId(), pickDetail.getOrderQty() - pickDetail.getAllocatedQty(),pickDetail.getPo(),BaseStatus.ZZJL);
|
||||||
|
int qh_qty=pickDetail.getOrderQty().intValue()-pickDetail.getAllocatedQty().intValue();
|
||||||
|
if(qh_qty>0){
|
||||||
|
throw new BadRequestException(pickDetail.getItem().getCode()+"库存缺货,仅有"+pickDetail.getAllocatedQty().intValue()+",请汇报上级");
|
||||||
|
}
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,7 +354,7 @@ public class PickDetailController {
|
||||||
if(tasks.size()>=0){
|
if(tasks.size()>=0){
|
||||||
for(Task t:tasks){
|
for(Task t:tasks){
|
||||||
ZzjlPickDetail detail=new ZzjlPickDetail();
|
ZzjlPickDetail detail=new ZzjlPickDetail();
|
||||||
detail.setStock_code("");
|
detail.setStock_code(t.getDstStockCode()==null?"":t.getDstStockCode());
|
||||||
detail.setPoint_code(t.getSrcPoint().getCode());
|
detail.setPoint_code(t.getSrcPoint().getCode());
|
||||||
detail.setPch(t.getItemKey().getPropC1());
|
detail.setPch(t.getItemKey().getPropC1());
|
||||||
detail.setItem_code(t.getItemKey().getItem().getCode());
|
detail.setItem_code(t.getItemKey().getItem().getCode());
|
||||||
|
|
@ -349,25 +362,30 @@ public class PickDetailController {
|
||||||
detail.setBonded(pickDetail.getPropC2());
|
detail.setBonded(pickDetail.getPropC2());
|
||||||
detail.setQty(t.getPlanQty()+"");
|
detail.setQty(t.getPlanQty()+"");
|
||||||
detail_list.add(detail);
|
detail_list.add(detail);
|
||||||
view_type="02";
|
if(t.getDstStockCode()!=null){
|
||||||
view_name="现品票";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(tasks.size()==0){
|
|
||||||
List<XdInventory> invs= inventoryService.queryInvForPickDetail(pickDetail.getId());
|
|
||||||
for(XdInventory inv:invs) {
|
|
||||||
ZzjlPickDetail detail=new ZzjlPickDetail();
|
|
||||||
detail.setStock_code(inv.getStockCode());
|
|
||||||
detail.setPoint_code(inv.getPointCode());
|
|
||||||
detail.setPch(inv.getPropC1());
|
|
||||||
detail.setItem_code(inv.getItemCode());
|
|
||||||
detail.setItem_name(inv.getItemName());
|
|
||||||
detail.setBonded(inv.getBonded());
|
|
||||||
detail.setQty(inv.getInvQty());
|
|
||||||
detail_list.add(detail);
|
|
||||||
view_type="03";
|
view_type="03";
|
||||||
|
view_name="箱单号";
|
||||||
|
}else {
|
||||||
|
view_type = "02";
|
||||||
|
view_name = "现品票";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// if(tasks.size()==0){
|
||||||
|
// List<XdInventory> invs= inventoryService.queryInvForPickDetail(pickDetail.getId());
|
||||||
|
// for(XdInventory inv:invs) {
|
||||||
|
// ZzjlPickDetail detail=new ZzjlPickDetail();
|
||||||
|
// detail.setStock_code(inv.getStockCode());
|
||||||
|
// detail.setPoint_code(inv.getPointCode());
|
||||||
|
// detail.setPch(inv.getPropC1());
|
||||||
|
// detail.setItem_code(inv.getItemCode());
|
||||||
|
// detail.setItem_name(inv.getItemName());
|
||||||
|
// detail.setBonded(inv.getBonded());
|
||||||
|
// detail.setQty(inv.getInvQty());
|
||||||
|
// detail_list.add(detail);
|
||||||
|
// view_type="03";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
if(pickDetail.getBeXdPf()){
|
if(pickDetail.getBeXdPf()){
|
||||||
view_name="箱单(品番)";
|
view_name="箱单(品番)";
|
||||||
view_type="04";
|
view_type="04";
|
||||||
|
|
@ -393,11 +411,27 @@ public class PickDetailController {
|
||||||
}
|
}
|
||||||
PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
|
PickDetail pickDetail=pickDetailRepository.getById(zzjlPick.getDetail_id());
|
||||||
if(stock_code!=null&&(zzjlPick.getView_type().equals("03")||zzjlPick.getView_type().equals("04"))){
|
if(stock_code!=null&&(zzjlPick.getView_type().equals("03")||zzjlPick.getView_type().equals("04"))){
|
||||||
if(!pickDetail.getBeXdPf()){//箱单出库
|
if(!pickDetail.getBeXdPf()){//箱单出库,按照锁定箱单出库
|
||||||
|
//先把符合数据的箱单全部拣货完成,剩余的再挂靠拣货
|
||||||
|
List<Task> ts=taskRepository.getStockTasks(stock_code);
|
||||||
|
boolean no_exits=true;
|
||||||
|
for(Task task:ts) {
|
||||||
|
if (task.getPickDetail().getId().equals(pickDetail.getId())) {
|
||||||
|
no_exits = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(no_exits){
|
||||||
|
throw new BadRequestException( "扫描箱单号不正确");
|
||||||
|
}
|
||||||
|
for(Task task:ts){
|
||||||
|
pickTicketService.pickForTask(task.getId(), task.getSrcStockCode(), task.getPlanQty()-task.getMoveQty(), null, SecurityUtils.getCurrentUsername());
|
||||||
|
}
|
||||||
|
|
||||||
List<Inventory> invs = inventoryRepository.queryInvStockCode(stock_code);
|
List<Inventory> invs = inventoryRepository.queryInvStockCode(stock_code);
|
||||||
for (Inventory inv : invs) {
|
for (Inventory inv : invs) {
|
||||||
|
double ky_qty=inv.getQuantity()-inv.getQueuedQty();
|
||||||
//生成Task,生成出库扣减库存
|
//生成Task,生成出库扣减库存
|
||||||
Task task = taskService.storeTask(null,pickDetail,inv.getArea(),inv.getItemKey(),inv.getPoint(),null,inv.getQuantity(),inv.getStockCode());
|
Task task = taskService.storeTask(null,pickDetail,inv.getArea(),inv.getItemKey(),inv.getPoint(),null,ky_qty,inv.getStockCode());
|
||||||
task.setBillCode(pickDetail.getItem().getCode()+"关联箱单出库"+pickDetail.getId());
|
task.setBillCode(pickDetail.getItem().getCode()+"关联箱单出库"+pickDetail.getId());
|
||||||
task.setTaskType(BizStatus.XD_PICK);
|
task.setTaskType(BizStatus.XD_PICK);
|
||||||
taskRepository.save(task);
|
taskRepository.save(task);
|
||||||
|
|
@ -462,6 +496,7 @@ public class PickDetailController {
|
||||||
@Log("制造叫料分配审核")
|
@Log("制造叫料分配审核")
|
||||||
@ApiOperation("制造叫料分配审核")
|
@ApiOperation("制造叫料分配审核")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
public synchronized ResponseEntity<Object> allocatePickDetail(@RequestBody Long[] ids) throws Exception {
|
public synchronized ResponseEntity<Object> allocatePickDetail(@RequestBody Long[] ids) throws Exception {
|
||||||
List<Long> pickDetailIds = Arrays.asList(ids);
|
List<Long> pickDetailIds = Arrays.asList(ids);
|
||||||
Collections.sort(pickDetailIds);//升序排序
|
Collections.sort(pickDetailIds);//升序排序
|
||||||
|
|
@ -480,6 +515,7 @@ public class PickDetailController {
|
||||||
@Log("制造叫料取消分配")
|
@Log("制造叫料取消分配")
|
||||||
@ApiOperation("制造叫料取消分配")
|
@ApiOperation("制造叫料取消分配")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
public synchronized ResponseEntity<Object> cancelAllocatePickDetail(@RequestBody Long[] ids) throws Exception {
|
public synchronized ResponseEntity<Object> cancelAllocatePickDetail(@RequestBody Long[] ids) throws Exception {
|
||||||
List<Long> pickDetailIds = Arrays.asList(ids);
|
List<Long> pickDetailIds = Arrays.asList(ids);
|
||||||
Collections.sort(pickDetailIds);//升序排序
|
Collections.sort(pickDetailIds);//升序排序
|
||||||
|
|
@ -501,6 +537,7 @@ public class PickDetailController {
|
||||||
@Log("设变")
|
@Log("设变")
|
||||||
@ApiOperation("设变")
|
@ApiOperation("设变")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
public ResponseEntity<Object> sbPickdetail(@RequestBody HashMap<String,Object> map) {
|
public ResponseEntity<Object> sbPickdetail(@RequestBody HashMap<String,Object> map) {
|
||||||
Long pdId=Long.parseLong(map.get("pdId").toString());
|
Long pdId=Long.parseLong(map.get("pdId").toString());
|
||||||
Double sbQty=Double.parseDouble(map.get("sbQty").toString());
|
Double sbQty=Double.parseDouble(map.get("sbQty").toString());
|
||||||
|
|
@ -609,6 +646,7 @@ public class PickDetailController {
|
||||||
@Log("退拣")
|
@Log("退拣")
|
||||||
@ApiOperation("退拣")
|
@ApiOperation("退拣")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
public synchronized ResponseEntity<Object> pickBarBack(@RequestBody Long pickDetailId) throws Exception {
|
public synchronized ResponseEntity<Object> pickBarBack(@RequestBody Long pickDetailId) throws Exception {
|
||||||
//查询已完成的拣货任务
|
//查询已完成的拣货任务
|
||||||
List<Task> Tasks = taskService.getPickAllTask(pickDetailId);
|
List<Task> Tasks = taskService.getPickAllTask(pickDetailId);
|
||||||
|
|
@ -631,6 +669,7 @@ public class PickDetailController {
|
||||||
@ApiOperation("指示残-波次补料")
|
@ApiOperation("指示残-波次补料")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
|
@Transactional
|
||||||
public ResponseEntity<Object> autoBcbl(@RequestBody HashMap<String,Object> map) {
|
public ResponseEntity<Object> autoBcbl(@RequestBody HashMap<String,Object> map) {
|
||||||
BillType bt=billTypeRepository.findByName(BaseStatus.BT_BCBL);
|
BillType bt=billTypeRepository.findByName(BaseStatus.BT_BCBL);
|
||||||
if(bt==null){
|
if(bt==null){
|
||||||
|
|
|
||||||
|
|
@ -818,6 +818,7 @@ public class XppRecordController {
|
||||||
@Log("删除xppRecord")
|
@Log("删除xppRecord")
|
||||||
@ApiOperation("删除xppRecord")
|
@ApiOperation("删除xppRecord")
|
||||||
@PreAuthorize("@el.check('super:man')")
|
@PreAuthorize("@el.check('super:man')")
|
||||||
|
@Transactional
|
||||||
public ResponseEntity<Object> deleteXppRecord(@RequestBody Long[] ids) {
|
public ResponseEntity<Object> deleteXppRecord(@RequestBody Long[] ids) {
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
//查找对应的入库明细是否收货
|
//查找对应的入库明细是否收货
|
||||||
|
|
|
||||||
|
|
@ -55,13 +55,17 @@ public class InventoryLogQueryCriteria{
|
||||||
|
|
||||||
@Query(joinName = "itemKey>", propName="propC2",type = Query.Type.EQUAL)
|
@Query(joinName = "itemKey>", propName="propC2",type = Query.Type.EQUAL)
|
||||||
private String bonded;
|
private String bonded;
|
||||||
|
//
|
||||||
/** 源点位号 */
|
// /** 源点位号 */
|
||||||
@Query(type = Query.Type.EQUAL)
|
// @Query(type = Query.Type.EQUAL)
|
||||||
private String srcPointCode;
|
// private String srcPointCode;
|
||||||
|
|
||||||
@Query(joinName = "area",propName = "code",type = Query.Type.EQUAL)
|
@Query(joinName = "area",propName = "code",type = Query.Type.EQUAL)
|
||||||
private String areaCode;
|
private String areaCode;
|
||||||
|
/** 源库位 */
|
||||||
|
@Query(joinName = "srcPoint",propName = "code",type = Query.Type.INNER_LIKE)
|
||||||
|
private String srcPointCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -154,13 +154,15 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
||||||
if(asn!=null){
|
if(asn!=null){
|
||||||
xdh=asn.getCusCode();
|
xdh=asn.getCusCode();
|
||||||
}
|
}
|
||||||
Inventory inventory=inventoryService.getInventory(t.getItemKey(),xppRecord.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL,xdh);
|
Inventory inventory=inventoryService.getInventory(t.getItemKey(),srcPoint.getArea(),srcPoint,t.getAsnDetail().getPoint(),t.getArea().getDept(),BizStatus.RECEIVING_CANCEL,xdh);
|
||||||
if(inventory==null){
|
if(inventory==null){
|
||||||
throw new BadRequestException("找不到对应库存");
|
throw new BadRequestException("找不到对应库存");
|
||||||
}
|
}
|
||||||
if((inventory.getQuantity().intValue()- inventory.getQueuedQty().intValue())<t.getPlanQty().intValue()){
|
if(!inventory.getArea().getBexb()) {
|
||||||
|
if ((inventory.getQuantity().intValue() - inventory.getQueuedQty().intValue()) < t.getPlanQty().intValue()) {
|
||||||
throw new BadRequestException("库存不足");
|
throw new BadRequestException("库存不足");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
double srcQty= inventory.getQuantity();
|
double srcQty= inventory.getQuantity();
|
||||||
inventory.setQuantity(inventory.getQuantity()-t.getPlanQty());
|
inventory.setQuantity(inventory.getQuantity()-t.getPlanQty());
|
||||||
inventoryService.update(inventory);
|
inventoryService.update(inventory);
|
||||||
|
|
@ -172,7 +174,7 @@ public class AsnDetailServiceImpl implements AsnDetailService {
|
||||||
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,null,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(d!=null){
|
if(xppRecord!=null&&d!=null){
|
||||||
this.delete(d.getId());
|
this.delete(d.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
hql+=" and inv.itemKey.propC2='"+propC2+"'";
|
hql+=" and inv.itemKey.propC2='"+propC2+"'";
|
||||||
}
|
}
|
||||||
|
|
||||||
hql+= " order by inv.itemKey.propC1 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();
|
||||||
return inventoryList;
|
return inventoryList;
|
||||||
|
|
|
||||||
|
|
@ -147,23 +147,25 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
//扣主表的订单数量
|
//扣主表的订单数量
|
||||||
PickDetail detail = pickDetailRepository.getById(id);
|
PickDetail detail = pickDetailRepository.getById(id);
|
||||||
PickTicket pt=detail.getPickTicket();
|
PickTicket pt=detail.getPickTicket();
|
||||||
Boolean bcbl=Boolean.FALSE;
|
if(pt!=null) {
|
||||||
if(pt.getBillType().getName().equals(BaseStatus.BT_BCBL)){
|
Boolean bcbl = Boolean.FALSE;
|
||||||
bcbl=Boolean.TRUE;
|
if (pt.getBillType().getName().equals(BaseStatus.BT_BCBL)) {
|
||||||
|
bcbl = Boolean.TRUE;
|
||||||
}
|
}
|
||||||
if(detail.getAllocatedQty()+detail.getBcQty()>0){
|
if (detail.getAllocatedQty() + detail.getBcQty() > 0) {
|
||||||
throw new BadRequestException("已出单,不能删除");
|
throw new BadRequestException("已出单,不能删除");
|
||||||
}
|
}
|
||||||
if(bcbl){
|
if (bcbl) {
|
||||||
PickDetail oldDetail=pickDetailRepository.getById(detail.getSourceId());
|
PickDetail oldDetail = pickDetailRepository.getById(detail.getSourceId());
|
||||||
if(oldDetail!=null){
|
if (oldDetail != null) {
|
||||||
oldDetail.setBcQty(oldDetail.getBcQty()- detail.getOrderQty());
|
oldDetail.setBcQty(oldDetail.getBcQty() - detail.getOrderQty());
|
||||||
this.update(oldDetail);
|
this.update(oldDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pt.setOrderQuantity(pt.getOrderQuantity()-detail.getOrderQty());
|
pt.setOrderQuantity(pt.getOrderQuantity() - detail.getOrderQty());
|
||||||
// pickTicketService.update(pt);
|
// pickTicketService.update(pt);
|
||||||
pickTicketRepository.save(pt);
|
pickTicketRepository.save(pt);
|
||||||
|
}
|
||||||
pickDetailRepository.deleteById(id);
|
pickDetailRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,14 +230,15 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
double srs=item.getExtendD3();
|
double srs=item.getExtendD3();
|
||||||
Map<String,String> map=new HashMap<>();
|
Map<String,String> map=new HashMap<>();
|
||||||
for (Inventory inv : invs) {
|
for (Inventory inv : invs) {
|
||||||
if(inv.getStockCode()!=null&&pd.getPo()==null&&!type.equals(BaseStatus.QTCK)){
|
//推荐箱单功能暂时不使用,直接锁库
|
||||||
//回写推荐托盘即可
|
// if(inv.getStockCode()!=null&&pd.getPo()==null&&!type.equals(BaseStatus.QTCK)){
|
||||||
pd.setStatus(BizStatus.ALLOCATE);
|
// //回写推荐托盘即可
|
||||||
pd.setArea(inv.getArea());
|
// pd.setStatus(BizStatus.ALLOCATE);
|
||||||
pd.setCkPoint(inv.getPoint());
|
// pd.setArea(inv.getArea());
|
||||||
map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
|
// pd.setCkPoint(inv.getPoint());
|
||||||
continue;
|
// map.put(inv.getId()+"",inv.getStockCode()+"]"+inv.getItemKey().getPropC1()+"]"+inv.getPoint().getCode()+"]"+inv.getQuantity());
|
||||||
}
|
// continue;
|
||||||
|
// }
|
||||||
Point startPoint = inv.getPoint();//原库位
|
Point startPoint = inv.getPoint();//原库位
|
||||||
// String areaCode=BaseStatus.DEFAULT_AREA;
|
// String areaCode=BaseStatus.DEFAULT_AREA;
|
||||||
// Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
|
// Point endPoint = pointService.getPoint(null, null, BaseStatus.BHZC, areaCode);//目标库位
|
||||||
|
|
@ -288,6 +291,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
}
|
}
|
||||||
pd.setArea(inv.getArea());
|
pd.setArea(inv.getArea());
|
||||||
pd.setCkPoint(inv.getPoint());
|
pd.setCkPoint(inv.getPoint());
|
||||||
|
pd.setPo(inv.getStockCode());
|
||||||
pickDetailRepository.save(pd);
|
pickDetailRepository.save(pd);
|
||||||
Task task = taskService.storeTask(null,pd,inv.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
|
Task task = taskService.storeTask(null,pd,inv.getArea(),inv.getItemKey(),startPoint,endPoint,allocateQty,inv.getStockCode());
|
||||||
//修改占用数,写入日志
|
//修改占用数,写入日志
|
||||||
|
|
@ -304,6 +308,11 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
log.info("无库存。。。。");
|
log.info("无库存。。。。");
|
||||||
|
// if(!type.equals(BaseStatus.QTCK)) {
|
||||||
|
// throw new BadRequestException("无库存,请汇报上级!");
|
||||||
|
// }else{
|
||||||
|
// log.info("无库存。。。。");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new BadRequestException("已分配,请勿重复操作!");
|
throw new BadRequestException("已分配,请勿重复操作!");
|
||||||
|
|
@ -426,7 +435,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
" left join base_area a on a.id=d.area_id\n" +
|
" left join base_area a on a.id=d.area_id\n" +
|
||||||
" left join base_area s on s.id=d.sh_area_id\n" +
|
" left join base_area s on s.id=d.sh_area_id\n" +
|
||||||
" left join base_point ck_point on ck_point.id=d.ck_point_id\n" +
|
" left join base_point ck_point on ck_point.id=d.ck_point_id\n" +
|
||||||
" where 1=1 and d.type='ZZJL' and d.picked_qty=0 ";
|
" where 1=1 and d.type='ZZJL' and d.order_qty>0 and d.picked_qty<d.order_qty and d.status!='PICK_ALL' ";
|
||||||
|
|
||||||
if(areaName!=null&&!areaName.equals("")){
|
if(areaName!=null&&!areaName.equals("")){
|
||||||
if(areaName.equals("材管库位无库存")){
|
if(areaName.equals("材管库位无库存")){
|
||||||
|
|
@ -456,9 +465,9 @@ public class PickDetailServiceImpl implements PickDetailService {
|
||||||
String sql="SELECT IFNULL(ck_area.name,\"材管库位无库存\") area_name,sum(d.order_qty) order_qty,sum(d.allocated_qty) allocated_qty ,count(d.id) count_qty\n" +
|
String sql="SELECT IFNULL(ck_area.name,\"材管库位无库存\") area_name,sum(d.order_qty) order_qty,sum(d.allocated_qty) allocated_qty ,count(d.id) count_qty\n" +
|
||||||
"from data_pick_detail d\n" +
|
"from data_pick_detail d\n" +
|
||||||
"left join base_area ck_area on ck_Area.id=d.area_id\n" +
|
"left join base_area ck_area on ck_Area.id=d.area_id\n" +
|
||||||
"where d.picked_qty<d.order_qty and d.type='ZZJL' " +
|
"where d.picked_qty<d.order_qty and d.type='ZZJL' and d.order_qty>0 and d.status!='PICK_ALL'" +
|
||||||
"GROUP BY ck_area.name \n" +
|
" GROUP BY ck_area.name \n" +
|
||||||
"ORDER BY ck_area.name desc";
|
" ORDER BY ck_area.name desc";
|
||||||
Query query = entityManager.createNativeQuery(sql);
|
Query query = entityManager.createNativeQuery(sql);
|
||||||
List ts= query
|
List ts= query
|
||||||
.unwrap(SQLQuery.class)
|
.unwrap(SQLQuery.class)
|
||||||
|
|
|
||||||
|
|
@ -556,8 +556,12 @@ public class PickTicketServiceImpl implements PickTicketService {
|
||||||
inventoryService.update(dstInv); **/
|
inventoryService.update(dstInv); **/
|
||||||
pd.setPickedQty(pd.getPickedQty() + pickQty);
|
pd.setPickedQty(pd.getPickedQty() + pickQty);
|
||||||
if(pd.getPickedQty()>0){
|
if(pd.getPickedQty()>0){
|
||||||
|
pd.setStatus(BizStatus.PICKUP);
|
||||||
|
if(pd.getPickedQty()>=pd.getOrderQty()){
|
||||||
pd.setStatus(BizStatus.PICK_ALL);
|
pd.setStatus(BizStatus.PICK_ALL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pickDetailRepository.save(pd);
|
pickDetailRepository.save(pd);
|
||||||
if(pt!=null) {
|
if(pt!=null) {
|
||||||
//拣货数量
|
//拣货数量
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue