拆托-拆分库存
parent
de24babbc7
commit
80922c0dc9
|
|
@ -62,6 +62,7 @@ public class Inventory extends BaseEntity implements Serializable {
|
|||
@OneToOne
|
||||
@JoinColumn(name = "`point_id`")
|
||||
@ApiModelProperty(value = "点位")
|
||||
@NotFound(action= NotFoundAction.IGNORE)
|
||||
private Point point;
|
||||
|
||||
@Column(name = "`point_code`")
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ import com.youchain.businessdata.service.dto.InventoryDto;
|
|||
import com.youchain.businessdata.service.dto.InventoryQueryCriteria;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
|
|
@ -105,6 +107,9 @@ public interface InventoryService {
|
|||
*/
|
||||
Inventory asnAddInventory(List<Map<String,Object>> taskListMap);
|
||||
|
||||
@Transactional
|
||||
Inventory getInventory(Double qty, Long ikID, Long pointId, String logType);
|
||||
|
||||
/**
|
||||
* 出库完成 删除库存
|
||||
* @param taskList
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package com.youchain.businessdata.service.impl;
|
||||
|
||||
import com.sun.jna.platform.win32.WinDef;
|
||||
import com.youchain.basicdata.domain.Item;
|
||||
import com.youchain.basicdata.domain.Point;
|
||||
import com.youchain.basicdata.domain.Stock;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
|
|
@ -42,9 +40,6 @@ import java.util.Map;
|
|||
import java.io.IOException;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
|
@ -222,17 +217,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
String taskIds=taskMap.get("taskIds")+"";
|
||||
Long ikID=Long.valueOf(taskMap.get("ikID")+"");
|
||||
Long pointId=Long.valueOf(taskMap.get("pointId")+"");
|
||||
Inventory inventory =new Inventory();
|
||||
inventory.setQuantity(qty);
|
||||
ItemKey itemKey=itemKeyRepository.getById(ikID);
|
||||
inventory.setItemKey(itemKey);
|
||||
Point point=pointRepository.getById(pointId);
|
||||
inventory.setPoint(point);
|
||||
inventory.setDept(UserUtils.getDept());
|
||||
inventory.setStatus(BizStatus.OPEN);
|
||||
inventoryRepository.save(inventory);
|
||||
//添加库存日志
|
||||
inventoryLogService.storeInventoryLog(BizStatus.RECEIVING_UP,BizStatus.ADD,itemKey.getPropC3(),itemKey,null,inventory.getPoint(),null,null,0d,inventory.getQuantity(), itemKey.getPropC6(),null,inventory.getId(),"");
|
||||
Inventory inventory = getInventory(qty, ikID, pointId,BizStatus.RECEIVING_UP);
|
||||
|
||||
String[] arrTaskIds=taskIds.split(",");
|
||||
for (int j = 0; j < arrTaskIds.length; j++) {
|
||||
|
|
@ -245,6 +230,25 @@ public class InventoryServiceImpl implements InventoryService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
public Inventory getInventory(Double qty, Long ikID, Long pointId, String logType) {
|
||||
Inventory inventory =new Inventory();
|
||||
inventory.setQuantity(qty);
|
||||
ItemKey itemKey=itemKeyRepository.getById(ikID);
|
||||
inventory.setItemKey(itemKey);
|
||||
if (pointId!=null) {
|
||||
Point point=pointRepository.getById(pointId);
|
||||
inventory.setPoint(point);
|
||||
}
|
||||
inventory.setDept(UserUtils.getDept());
|
||||
inventory.setStatus(BizStatus.OPEN);
|
||||
inventoryRepository.save(inventory);
|
||||
//添加库存日志
|
||||
inventoryLogService.storeInventoryLog(logType,BizStatus.ADD,itemKey.getPropC3(),itemKey,null,inventory.getPoint(),null,null,0d,inventory.getQuantity(), itemKey.getPropC6(),null,inventory.getId(),"");
|
||||
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pickDelInventory(List<Task> taskList) {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ package com.youchain.businessdata.service.impl;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
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.ItemKey;
|
||||
import com.youchain.businessdata.domain.Task;
|
||||
import com.youchain.businessdata.repository.InventoryRepository;
|
||||
import com.youchain.businessdata.service.InventoryService;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.PageUtil;
|
||||
import com.youchain.utils.QueryHelp;
|
||||
import com.youchain.utils.ValidationUtil;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.businessdata.repository.ItemKeyRepository;
|
||||
import com.youchain.businessdata.service.ItemKeyService;
|
||||
|
|
@ -54,6 +54,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
public class ItemKeyServiceImpl implements ItemKeyService {
|
||||
|
||||
private final ItemKeyRepository itemKeyRepository;
|
||||
private final InventoryRepository inventoryRepository;
|
||||
private final InventoryService inventoryService;
|
||||
private final ItemKeyMapper itemKeyMapper;
|
||||
private final EntityManager entityManager;
|
||||
|
||||
|
|
@ -208,12 +210,26 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
|
||||
JSONObject data=new JSONObject();
|
||||
data.put("textPropC6",arrPropC6);
|
||||
data.put("text1PropC6",arr1PropC6);
|
||||
data.put("text2PropC6",arr2PropC6);
|
||||
StringBuffer sb1PropC6 = getStringBuffer(arr1PropC6);
|
||||
StringBuffer sb2PropC6 = getStringBuffer(arr2PropC6);
|
||||
data.put("text1PropC6",sb1PropC6);
|
||||
data.put("text2PropC6",sb2PropC6);
|
||||
System.out.println("返回:"+data);
|
||||
return ApiResult.fail(200, "操作成功", data);
|
||||
}
|
||||
|
||||
private static StringBuffer getStringBuffer(List<String> arr1PropC6) {
|
||||
StringBuffer sb1PropC6=new StringBuffer();
|
||||
for (int i = 0; i < arr1PropC6.size(); i++) {
|
||||
if (sb1PropC6.length()<1){
|
||||
sb1PropC6.append(arr1PropC6.get(i));
|
||||
}else {
|
||||
sb1PropC6.append(","+ arr1PropC6.get(i));
|
||||
}
|
||||
}
|
||||
return sb1PropC6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult devanPropC6(JSONObject req) {
|
||||
String startPropC6=req.getString("startPropC6");
|
||||
|
|
@ -237,8 +253,32 @@ public class ItemKeyServiceImpl implements ItemKeyService {
|
|||
|
||||
@Override
|
||||
public ApiResult devanning(JSONObject req) {
|
||||
System.out.println("req:"+req);
|
||||
return null;
|
||||
JSONArray invIds=req.getJSONArray("invIds");//invIds
|
||||
String text1PropC6=req.getString("text1PropC6");
|
||||
String text2PropC6=req.getString("text2PropC6");
|
||||
for (int i = 0; i < invIds.size(); i++) {
|
||||
Long invId=invIds.getLong(i);
|
||||
Inventory startInventory=inventoryRepository.getById(invId);
|
||||
//拆托后-库位位置
|
||||
Point startPoint=startInventory.getPoint();
|
||||
Point endPoint=null;
|
||||
//拆托后-库存数量
|
||||
Integer startQuan = text1PropC6.split(",").length;
|
||||
Integer endQuan = text2PropC6.split(",").length;
|
||||
//拆托后-RFID票
|
||||
ItemKey startItemKey=startInventory.getItemKey();
|
||||
ItemKey endItemKey=getItemKey(startItemKey.getItem(), startItemKey.getPropC1(), startItemKey.getPropC2(), startItemKey.getPropC3(), startItemKey.getPropC4(), String.format("%04X", endQuan)+"", text2PropC6);
|
||||
//更新原来的RFID票
|
||||
startItemKey.setPropC5(String.format("%04X", startQuan)+"");
|
||||
startItemKey.setPropC6(text1PropC6);
|
||||
itemKeyRepository.save(startItemKey);
|
||||
//更新原库存
|
||||
startInventory.setQuantity(Double.valueOf(startQuan));
|
||||
inventoryRepository.save(startInventory);
|
||||
//生成拆托库存
|
||||
Inventory inventory = inventoryService.getInventory(Double.valueOf(endQuan), endItemKey.getId(), null, BizStatus.MODIFY_LOT);
|
||||
}
|
||||
return ApiResult.fail(200, "操作成功", null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public interface BizStatus {
|
|||
*/
|
||||
public static String INVENTORY_ADJUST = "INVENTORY_ADJUST";
|
||||
/**
|
||||
* 库存日志-批次调整
|
||||
* 库存日志-拆托
|
||||
*/
|
||||
public static String MODIFY_LOT = "MODIFY_LOT";
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue