出库-替换分配库存
parent
086f825430
commit
ee5596c7c3
|
|
@ -383,9 +383,9 @@ public class PointServiceImpl implements PointService {
|
|||
if (point==null){
|
||||
point=new Point();
|
||||
point.setDept(UserUtils.getDept());
|
||||
c=c+1;
|
||||
}else {
|
||||
b=b+1;
|
||||
}else {
|
||||
c=c+1;
|
||||
}
|
||||
if (code!=null) point.setCode(code);
|
||||
if (name!=null) point.setName(name);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ import lombok.Data;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.sql.Timestamp;
|
||||
|
|
@ -62,6 +65,7 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "`item_key_id`")
|
||||
@ApiModelProperty(value = "点位")
|
||||
@NotFound(action= NotFoundAction.IGNORE)
|
||||
private ItemKey itemKey;
|
||||
|
||||
@Column(name = "`storage_date`")
|
||||
|
|
@ -108,6 +112,7 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "`src_point_id`")
|
||||
@ApiModelProperty(value = "源点位")
|
||||
@NotFound(action= NotFoundAction.IGNORE)
|
||||
private Point srcPoint;
|
||||
|
||||
@Column(name = "`src_point_code`")
|
||||
|
|
@ -117,6 +122,7 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "`src_stock_id`")
|
||||
@ApiModelProperty(value = "源容器")
|
||||
@NotFound(action= NotFoundAction.IGNORE)
|
||||
private Stock srcStock;
|
||||
|
||||
@Column(name = "`src_stock_code`")
|
||||
|
|
@ -126,6 +132,7 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "`dst_point_id`")
|
||||
@ApiModelProperty(value = "点位")
|
||||
@NotFound(action= NotFoundAction.IGNORE)
|
||||
private Point dstPoint;
|
||||
|
||||
@Column(name = "`dst_point_code`")
|
||||
|
|
@ -135,6 +142,7 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "`dst_stock_id`")
|
||||
@ApiModelProperty(value = "目标容器")
|
||||
@NotFound(action= NotFoundAction.IGNORE)
|
||||
private Stock dstStock;
|
||||
|
||||
@Column(name = "`dst_stock_code`")
|
||||
|
|
@ -149,6 +157,37 @@ public class InventoryLog extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "目标数量")
|
||||
private Double dstQty=0d;
|
||||
|
||||
@Column(name = "`item_code`")
|
||||
@ApiModelProperty(value = "物料代码")
|
||||
private String itemCode;
|
||||
|
||||
@Column(name = "`item_name`")
|
||||
@ApiModelProperty(value = "物理名称")
|
||||
private String itemName;
|
||||
@Column(name = "`prop_c1`")
|
||||
@ApiModelProperty(value = "批次号")
|
||||
private String propC1;
|
||||
|
||||
@Column(name = "`prop_c2`")
|
||||
@ApiModelProperty(value = "字符")
|
||||
private String propC2;
|
||||
|
||||
@Column(name = "`prop_c3`")
|
||||
@ApiModelProperty(value = "系统单号")
|
||||
private String propC3;
|
||||
|
||||
@Column(name = "`prop_c4`")
|
||||
@ApiModelProperty(value = "厂家供货码")
|
||||
private String propC4;
|
||||
|
||||
@Column(name = "`prop_c5`")
|
||||
@ApiModelProperty(value = "供货数量")
|
||||
private String propC5;
|
||||
|
||||
@Column(name = "`prop_c6`")
|
||||
@ApiModelProperty(value = "流水号")
|
||||
private String propC6;
|
||||
|
||||
public void copy(InventoryLog source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ public class ItemKey extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "工单号")
|
||||
private String orderNumber;
|
||||
|
||||
@Column(name = "`enabled`")
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private Boolean enabled=true;
|
||||
|
||||
public int getIntPropC5() {
|
||||
int decimalNumber = Integer.parseInt(propC5, 16);
|
||||
return decimalNumber;
|
||||
|
|
|
|||
|
|
@ -58,4 +58,10 @@ public interface PickDetailRepository extends JpaRepository<PickDetail, Long>, J
|
|||
List<PickDetail> findByPick(Long id);
|
||||
@Query(value = "select pd from PickDetail pd where pd.pick.id=?1 and pd.allocatedQty>0", nativeQuery = false)
|
||||
List<PickDetail> findByPickAllocated(Long id);
|
||||
/** 查询 出库单未完成的明细*/
|
||||
@Query(value = "select pd from PickDetail pd where pd.pick.id=?1 and pd.allocatedQty>pd.pickedQty")
|
||||
List<PickDetail> findByQtyAllGtPick(Long id);
|
||||
/** 查询拣货和分配中的 全部出库明细*/
|
||||
@Query(value = "select pd from PickDetail pd where pd.status in ('PICKUP','ALLOCATE')")
|
||||
List<PickDetail> getPickDetail();
|
||||
}
|
||||
|
|
@ -31,4 +31,6 @@ import java.util.List;
|
|||
public interface PickRepository extends JpaRepository<Pick, Long>, JpaSpecificationExecutor<Pick> {
|
||||
@Query(value = "select p from Pick p where p.relatedBill2=?1")
|
||||
Pick findByCode(String relatedBill2);
|
||||
@Query(value = "select p from Pick p")
|
||||
List<Pick> getPickList();
|
||||
}
|
||||
|
|
@ -101,4 +101,6 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat
|
|||
List<Map<String,Object>> findBySumPlanQty(String taskStatus,int beSkip,String goodType);
|
||||
@Query(value = "select t from Task t where t.taskStatus =?1 and t.beSkip=?2 and t.taskType=?3")
|
||||
List<Task> findByItemType(String taskStatus, int beSkip, String goodType);
|
||||
|
||||
Task findByPickDetailAndItem(Long id, String sku);
|
||||
}
|
||||
|
|
@ -89,8 +89,7 @@ public class AsnController {
|
|||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getAsnList")
|
||||
@Log("加载出库单下拉框")
|
||||
@ApiOperation("加载出库单下拉框")
|
||||
@Log("加载入库单下拉框")
|
||||
@PreAuthorize("@el.check('asn:del')")
|
||||
public ResponseEntity<Object> getAsnList() {
|
||||
return new ResponseEntity<>(asnService.getAsnList(),HttpStatus.OK);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package com.youchain.businessdata.rest;
|
|||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.businessdata.domain.Pick;
|
||||
import com.youchain.businessdata.repository.PickRepository;
|
||||
import com.youchain.businessdata.service.PickService;
|
||||
import com.youchain.businessdata.service.dto.PickQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
|
|
@ -44,6 +45,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class PickController {
|
||||
|
||||
private final PickService pickService;
|
||||
private final PickRepository pickRepository;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
|
|
@ -100,4 +102,10 @@ public class PickController {
|
|||
ApiResult apiResult = pickService.allocate(ids);
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/getPickList")
|
||||
@Log("加载出库单下拉框")
|
||||
@PreAuthorize("@el.check('asn:del')")
|
||||
public ResponseEntity<Object> getPickList() {
|
||||
return new ResponseEntity<>(pickRepository.getPickList(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ import com.youchain.businessdata.domain.PickDetail;
|
|||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.inputJson.IPPickDetail;
|
||||
import com.youchain.businessdata.inputJson.IScanPut;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.service.InventoryLogService;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
|
|
@ -74,6 +75,7 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
|||
public class PickDetailController {
|
||||
|
||||
private final PickDetailService pickDetailService;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final TaskService taskService;
|
||||
|
||||
|
||||
|
|
@ -132,7 +134,7 @@ public class PickDetailController {
|
|||
}
|
||||
|
||||
@PostMapping("/cancelAllocate")
|
||||
@Log("取消分配")
|
||||
@Log("出库明细-取消分配")
|
||||
@AnonymousAccess
|
||||
public synchronized ResponseEntity<Object> cancelAllocate(@RequestBody Long[] ids) throws Exception {
|
||||
ApiResult apiResult = pickDetailService.cancelAllocate(ids);
|
||||
|
|
@ -148,6 +150,12 @@ public class PickDetailController {
|
|||
List<RPTaskList> t=taskService.queryTaskApp(null);
|
||||
return new ResponseEntity<>(t,HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getPickDetail")
|
||||
@Log("人工出库-加载出库明细")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> getPickDetail(){
|
||||
return new ResponseEntity<>(pickDetailRepository.getPickDetail(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/pickingApp")
|
||||
@Log("APP拣货确认")
|
||||
|
|
@ -159,7 +167,7 @@ public class PickDetailController {
|
|||
}
|
||||
|
||||
@PostMapping("/picking")
|
||||
@Log("拣货")
|
||||
@Log("出库-单品拣货")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> picking(@RequestBody Long[] ids){
|
||||
// pick_in(pickDetailId);
|
||||
|
|
|
|||
|
|
@ -18,13 +18,23 @@ package com.youchain.businessdata.rest;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.annotation.AnonymousAccess;
|
||||
import com.youchain.annotation.Log;
|
||||
import com.youchain.basicdata.service.dto.PointDto;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.basicdata.service.dto.PointQueryCriteria;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.domain.PickDetail;
|
||||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.businessdata.service.PickDetailService;
|
||||
import com.youchain.businessdata.service.TaskService;
|
||||
import com.youchain.businessdata.service.dto.TaskQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.BizStatus;
|
||||
import com.youchain.utils.UserUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.util.StandardSessionIdGenerator;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -32,10 +42,12 @@ import lombok.RequiredArgsConstructor;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
|
@ -52,6 +64,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class TaskController {
|
||||
|
||||
private final TaskService taskService;
|
||||
private final TaskRepository taskRepository;
|
||||
private final InventoryService inventoryService;
|
||||
private final PickDetailRepository pickDetailRepository;
|
||||
private final PickDetailService pickDetailService;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final PointRepository pointRepository;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
|
|
@ -77,7 +95,7 @@ public class TaskController {
|
|||
return new ResponseEntity<>(ApiResult.success(apiResult.getMessage(),apiResult.getData()), HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/devanRfid")
|
||||
@ApiOperation("人工出库-解析RFID关联的库存信息")
|
||||
@ApiOperation("人工出库,人工入库-解析RFID关联的库存信息")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> devanRfid(@RequestBody String data){
|
||||
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||
|
|
@ -91,7 +109,48 @@ public class TaskController {
|
|||
}
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
@PostMapping("/picking")
|
||||
@Log("人工出库-拣货确认")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> picking(@RequestBody String data){
|
||||
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||
|
||||
// String rfid=jsonObject.getString("RFID");
|
||||
|
||||
Long taskId=jsonObject.getLong("taskId");
|
||||
ApiResult apiResult;
|
||||
/** 通过RFID获取Task后出库*/
|
||||
apiResult = taskService.picking(new Long[]{taskId});
|
||||
return new ResponseEntity<>(apiResult, HttpStatus.valueOf(apiResult.getStatus()));
|
||||
}
|
||||
/** 人工出库-解析RFID关联的(未分配)库存信息*/
|
||||
@PostMapping("/replaceInv")
|
||||
@Log("出库-替换分配库存")
|
||||
@AnonymousAccess
|
||||
@Transactional
|
||||
public ApiResult replaceInv(@RequestBody String data) {
|
||||
System.out.println("接收:"+data);
|
||||
JSONObject jsonObject=JSONObject.parseObject(data);
|
||||
Long invId=jsonObject.getLong("invId");
|
||||
Long taskId=jsonObject.getLong("taskId");
|
||||
Task task=taskRepository.getById(taskId);
|
||||
PickDetail pickDetail=task.getPickDetail();
|
||||
Inventory inventory=inventoryRepository.getById(invId);//实际出库 库存
|
||||
ApiResult apiResult;
|
||||
/** 取消分配库存 */
|
||||
apiResult = pickDetailService.cancelAllocate(pickDetail.getId(),inventory.getQuantity());
|
||||
if (apiResult.getStatus()!=200){
|
||||
return apiResult;
|
||||
}
|
||||
/** 重新分配 */
|
||||
Point point=pointRepository.findByCode(pickDetail.getPropC5());
|
||||
List<Inventory> inventoryList= Arrays.asList(inventory);
|
||||
apiResult = pickDetailService.allocate(pickDetail, UserUtils.getDept(), inventory.getQuantity(),0,point,inventoryList);
|
||||
if (apiResult!=null){
|
||||
return apiResult;
|
||||
}
|
||||
return ApiResult.fail(200,"操作成功",null);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/queryAsnTask")
|
||||
@Log("查询task")
|
||||
|
|
|
|||
|
|
@ -18,10 +18,12 @@ package com.youchain.businessdata.service;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.businessdata.domain.Inventory;
|
||||
import com.youchain.businessdata.domain.PickDetail;
|
||||
import com.youchain.businessdata.service.dto.PickDetailDto;
|
||||
import com.youchain.businessdata.service.dto.PickDetailQueryCriteria;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -86,9 +88,10 @@ public interface PickDetailService {
|
|||
void download(List<PickDetailDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 分配
|
||||
* 出库-明细分配
|
||||
*/
|
||||
ApiResult allocate(Long[] ids);
|
||||
ApiResult allocate(PickDetail pickDetail, Dept dept, Double quantity, Integer agvFlag, Point endPoint, List<Inventory> inventoryList);
|
||||
|
||||
/**
|
||||
* 整出分配
|
||||
|
|
@ -102,8 +105,9 @@ public interface PickDetailService {
|
|||
|
||||
/**
|
||||
* 取消分配
|
||||
* quantity 取消数量
|
||||
*/
|
||||
ApiResult cancelAllocate(long id,double quantity) ;
|
||||
ApiResult cancelAllocate(long pdId,double cancelQuantity) ;
|
||||
ApiResult cancelAllocate(Long[] ids);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -151,5 +151,6 @@ public interface TaskService {
|
|||
|
||||
ApiResult devanRfidAsn(String rfid);
|
||||
|
||||
/** 人工出库-解析RFID关联的库存信息*/
|
||||
ApiResult devanRfidPT(String rfid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,20 +15,11 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service.dto;
|
||||
|
||||
import com.youchain.base.BaseEntity;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.businessdata.domain.ItemKey;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import com.youchain.annotation.Query;
|
||||
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author huojin
|
||||
|
|
@ -39,7 +30,10 @@ public class InventoryQueryCriteria{
|
|||
|
||||
/*@Query(joinName = "itemKey>item>", propName="code" ,type = Query.Type.INNER_LIKE)
|
||||
private String itemCode;*/
|
||||
|
||||
@Query(joinName = "itemKey>item", propName="id",type = Query.Type.EQUAL)
|
||||
private String itemId;
|
||||
@Query(type = Query.Type.EQUAL)
|
||||
private Double queuedQty;
|
||||
@Query(joinName = "itemKey>item>", propName="name",type = Query.Type.INNER_LIKE)
|
||||
private String itemName;
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,16 @@ public class InventoryLogServiceImpl implements InventoryLogService {
|
|||
}else if(incDec== BizStatus.REDUCE){
|
||||
log.setDstQty(srcQty-occurQty);
|
||||
}
|
||||
if (itemKey!=null){
|
||||
log.setItemCode(itemKey.getItem().getCode());
|
||||
log.setItemName(itemKey.getItem().getName());
|
||||
log.setPropC1(itemKey.getPropC1());
|
||||
log.setPropC2(itemKey.getPropC2());
|
||||
log.setPropC3(itemKey.getPropC3());
|
||||
log.setPropC4(itemKey.getPropC4());
|
||||
log.setPropC5(itemKey.getPropC5());
|
||||
log.setPropC6(itemKey.getPropC6());
|
||||
}
|
||||
log.setOccurTime(new Timestamp(System.currentTimeMillis()));
|
||||
log.setRefObj(refObj);
|
||||
log.setRefObjId(refObjId);
|
||||
|
|
|
|||
|
|
@ -19,15 +19,12 @@ import com.youchain.basicdata.domain.Point;
|
|||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.businessdata.domain.*;
|
||||
import com.youchain.businessdata.repository.ItemKeyRepository;
|
||||
import com.youchain.businessdata.repository.PickDetailRepository;
|
||||
import com.youchain.businessdata.repository.TaskRepository;
|
||||
import com.youchain.businessdata.repository.*;
|
||||
import com.youchain.businessdata.service.InventoryLogService;
|
||||
import com.youchain.businessdata.service.dto.*;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.businessdata.service.mapstruct.InventoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -60,6 +57,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
private final PickDetailRepository pickDetailRepository;
|
||||
private final EntityManager entityManager;
|
||||
private final ItemKeyRepository itemKeyRepository;
|
||||
private final PickRepository pickRepository;
|
||||
private final TaskRepository taskRepository;
|
||||
private final PointRepository pointRepository;
|
||||
|
||||
|
|
@ -266,10 +264,21 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
pickDetail.setStatus(BizStatus.PICK_ALL);
|
||||
}
|
||||
pickDetailRepository.save(pickDetail);
|
||||
/** 更新出库单状态 -*/
|
||||
List<PickDetail> pickDetailList=pickDetailRepository.findByQtyAllGtPick(pickDetail.getPick().getId());
|
||||
if (pickDetailList.size()==0){
|
||||
Pick pick=pickDetail.getPick();
|
||||
pick.setStatus(BizStatus.PICK_ALL);
|
||||
pickRepository.save(pick);
|
||||
}
|
||||
/** 添加库存日志,删除库存*/
|
||||
Inventory inventory=task.getInventory();
|
||||
inventoryLogService.storeInventoryLog(BizStatus.PICK_DOWN,BizStatus.REDUCE,inventory.getItemKey().getPropC3(),inventory.getItemKey(),task.getSrcPoint(),task.getDstPoint(),null,null,inventory.getQuantity(),task.getMoveQty(), task.getItemKey().getPropC6(),null,inventory.getId(),"");
|
||||
inventoryRepository.delete(inventory);
|
||||
// 失效ItemKey
|
||||
ItemKey itemKey=inventory.getItemKey();
|
||||
itemKey.setEnabled(false);
|
||||
itemKeyRepository.save(itemKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ItemKey getItemKey(Item item, String propC1, String propC2, String propC3, String propC4, String propC5, String propC6,String propC7) {
|
||||
ItemKey itemKey;
|
||||
itemKey = itemKeyRepository.getByItemKey(item.getId(),propC1,propC2,propC3,propC4,propC5,propC6);
|
||||
|
|
|
|||
|
|
@ -178,11 +178,24 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
if (pickDetail.getOrderQty() > pickDetail.getAllocatedQty()) {
|
||||
List<Inventory> inventoryList = inventoryRepository.queryInventory(item.getId());
|
||||
if (inventoryList.size() > 0) {
|
||||
double allocateQty = 0;//分配数量
|
||||
double unQty = quantity;//订单数量
|
||||
ApiResult apiResult = allocate(pickDetail, dept, quantity, agvFlag, endPoint, inventoryList);
|
||||
if (apiResult != null) return apiResult;
|
||||
}
|
||||
else {
|
||||
return ApiResult.fail(500, item.getCode() + "料号,无库存", "");
|
||||
}
|
||||
}else {
|
||||
return ApiResult.fail(500, "已分配", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ApiResult allocate(PickDetail pickDetail, Dept dept, Double quantity, Integer agvFlag, Point endPoint, List<Inventory> inventoryList) {
|
||||
double allocateQty;//待分配数量
|
||||
double unQty = quantity;//订单总量
|
||||
for (Inventory inv : inventoryList) {
|
||||
Point startPoint = inv.getPoint();//原库位
|
||||
if (unQty == 0) {
|
||||
if (unQty <= 0) {
|
||||
break;
|
||||
}
|
||||
//整托分配
|
||||
|
|
@ -227,12 +240,6 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
taskRepository.save(task);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return ApiResult.fail(500, item.getCode() + "料号,无库存", "");
|
||||
}
|
||||
}else {
|
||||
return ApiResult.fail(500, "已分配", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -371,12 +378,16 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ApiResult cancelAllocate(long id, double quantity){
|
||||
public ApiResult cancelAllocate(long id, double cancelQuantity){
|
||||
|
||||
PickDetailDto pickDetailDto = findById(id);
|
||||
PickDetail pd = toEntity(pickDetailDto);
|
||||
List<Task> Tasks = taskRepository.getPickNotAllTask(id);
|
||||
for (Task task : Tasks) {
|
||||
if (cancelQuantity<=0){
|
||||
break;
|
||||
}
|
||||
cancelQuantity=cancelQuantity-task.getPlanQty();
|
||||
//根据Task找到对应的库存
|
||||
Inventory inv = inventoryRepository.findById(task.getInventory().getId()).get();
|
||||
inv.setQueuedQty(inv.getQueuedQty() - task.getPlanQty());
|
||||
|
|
@ -411,7 +422,7 @@ public class PickDetailServiceImpl implements PickDetailService {
|
|||
ApiResult apiResult=new ApiResult();
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
PickDetail pickDetail=pickDetailRepository.getById(ids[i]);
|
||||
apiResult = cancelAllocate(pickDetail.getId(), pickDetail.getOrderQty());
|
||||
apiResult = cancelAllocate(pickDetail.getId(), pickDetail.getAllocatedQty());
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ public class TaskServiceImpl implements TaskService {
|
|||
List<AsnDetail> asnDetailList = asnDetailRepository.findByAsnAndItem(asn.getRelatedBill1(),sku);
|
||||
double orderQty=0;
|
||||
for (int i = 0; i < asnDetailList.size(); i++) {
|
||||
orderQty=orderQty+asnDetailList.get(i).getOrderQty();
|
||||
orderQty=orderQty+(asnDetailList.get(i).getOrderQty()-asnDetailList.get(i).getReceivedQty());
|
||||
}
|
||||
data.put("lineNos",asnDetailList.size());
|
||||
data.put("RFID",rfid);
|
||||
|
|
@ -580,26 +580,31 @@ public class TaskServiceImpl implements TaskService {
|
|||
if (inventory==null){
|
||||
return ApiResult.fail(500,"库存异常",null);
|
||||
}
|
||||
|
||||
if (inventory.getQueuedQty()<=0){
|
||||
// 未分配
|
||||
data.put("sku",sku);
|
||||
data.put("RFID",rfid);
|
||||
data.put("invId",inventory.getId());
|
||||
return ApiResult.fail(201,"库存未进行分配,请选择需要出库出库单",data);
|
||||
}else {
|
||||
// 已分配
|
||||
data.put("sku",sku);
|
||||
data.put("RFID",rfid);
|
||||
data.put("invId",inventory.getId());
|
||||
data.put("receivedQty",inventory.getQueuedQty());
|
||||
/** 查询关联Task任务*/
|
||||
List<Task> taskList=taskRepository.findByItemKey(itemKey.getId(), BizStatus.ALLOCATE);
|
||||
if (taskList.size()!=1){
|
||||
return ApiResult.fail(500,"Task异常",null);
|
||||
}
|
||||
Task task=taskList.get(0);
|
||||
PickDetail pickDetail=task.getPickDetail();
|
||||
Pick pick=pickDetail.getPick();
|
||||
if (inventory.getQueuedQty()<=0){
|
||||
// 未占用库存 询问是否更改出库库存
|
||||
}else {
|
||||
// 已占用库存 推荐库存
|
||||
data.put("relatedBill1",pick.getRelatedBill1());
|
||||
data.put("relatedBill2",pick.getRelatedBill2());
|
||||
data.put("billType",pick.getBillType());
|
||||
data.put("sku",sku);
|
||||
data.put("lineNo",pickDetail.getLineNo());
|
||||
data.put("RFID",rfid);
|
||||
data.put("pdId",pickDetail.getId());
|
||||
data.put("taskId",task.getId());
|
||||
data.put("orderQty",pickDetail.getOrderQty());
|
||||
data.put("receivedQty",inventory.getQueuedQty());
|
||||
data.put("orderQty",pickDetail.getAllocatedQty()-pickDetail.getPickedQty());
|
||||
}
|
||||
}else if (item.getGoodType().equals(BizStatus.BCP)){
|
||||
|
||||
|
|
@ -611,4 +616,5 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
return ApiResult.fail(200, "操作成功", data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue