Commit 85400dd1 by 李小惠

Merge branch 'develop' of http://gitlab.sothing.top/843502640/jyzb_platformV2 into develop-lxh

parents f9f2b7e3 7a67f435
...@@ -79,7 +79,7 @@ public class BussinessInventoryController { ...@@ -79,7 +79,7 @@ public class BussinessInventoryController {
//盘库申请 //盘库申请
@PostMapping("/UploadStock") @PostMapping("/UploadStock")
@ApiOperation("上传盘点记录") @ApiOperation("上传盘点记录")
public ApiRes<Bool> UploadStock (@RequestBody UploadInventoryReq req){ public ApiRes<Boolean> UploadStock (@RequestBody UploadInventoryReq req){
//判断是否有工作流id,如果有则将状态进行修改 //判断是否有工作流id,如果有则将状态进行修改
return ApiRes.success(BussinessInventoryService.UploadStock(req)); return ApiRes.success(BussinessInventoryService.UploadStock(req));
} }
......
...@@ -120,11 +120,7 @@ public class BussinessInventory implements Serializable { ...@@ -120,11 +120,7 @@ public class BussinessInventory implements Serializable {
*/ */
@TableField(value = "add_num") @TableField(value = "add_num")
private Integer addNum; private Integer addNum;
/**
*
*/
@TableField(value = "state")
private Integer state;
/** /**
* *
*/ */
......
package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import java.io.Serializable;
import java.util.Date;
@TableName(value ="bussiness_inventory_detail")
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class InventoryDetail implements Serializable {
/**
* id
*/
@TableId(value = "id")
@Id
private Long id;
/**
* 盘点表主键
*/
@TableField(value = "inventory_id")
private Long inventoryId;
/**
* 装备类型id
*/
@TableField(value = "type_id")
private String typeId;
/**
* 装备类型名称
*/
@TableField(value = "type_name")
private String typeName;
/**
* 装备号型id
*/
@TableField(value = "size_id")
private String sizeId;
/**
* 装备号型名称
*/
@TableField(value = "size_name")
private String sizeName;
/**
* 在库数(包含报废区)
*/
@TableField(value = "stock_number")
private Integer stockNumber;
/**
* 修正后的在库数量
*/
@TableField(value = "fix_number")
private Integer fixNumber;
/**
* 差距数量
*/
@TableField(value = "num")
private Integer num;
/**
* 状态.0正常,1盈余,2亏损
*/
@TableField(value = "state")
private Integer state;
/**
* 创建时间
*/
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime;
/**
* 更新时间
*/
@TableField(value = "update_time",fill = FieldFill.UPDATE)
private Date updateTime;
private static final long serialVersionUID = 1L;
}
...@@ -30,5 +30,5 @@ public interface BussinessInventoryService extends IService<BussinessInventory> ...@@ -30,5 +30,5 @@ public interface BussinessInventoryService extends IService<BussinessInventory>
BussinessInventoryDto GetDetailById(BussinessInventoryReq req); BussinessInventoryDto GetDetailById(BussinessInventoryReq req);
Bool UploadStock(UploadInventoryReq req); Boolean UploadStock(UploadInventoryReq req);
} }
...@@ -70,6 +70,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -70,6 +70,8 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
@Resource @Resource
private PubOrgService orgService; private PubOrgService orgService;
@Resource @Resource
private WarehouseInventoryService warehouseInventoryService;
@Resource
private InventorySummaryService inventorySummaryService; private InventorySummaryService inventorySummaryService;
@Resource @Resource
private OrderNumService orderNumService; private OrderNumService orderNumService;
...@@ -84,6 +86,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -84,6 +86,7 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
Warehouse warehouse= warehouseService.getById(req.getWarehouseId()); Warehouse warehouse= warehouseService.getById(req.getWarehouseId());
PubOrg pubOrg=orgService.getById(req.getOrgId()); PubOrg pubOrg=orgService.getById(req.getOrgId());
BeanPlusUtil.copyProperties(req,BI); BeanPlusUtil.copyProperties(req,BI);
BI.setWarehouseName(warehouse.getName()); BI.setWarehouseName(warehouse.getName());
if (StringUtils.isNotBlank(pubOrg.getDName()) ) if (StringUtils.isNotBlank(pubOrg.getDName()) )
{ {
...@@ -304,36 +307,77 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor ...@@ -304,36 +307,77 @@ public class BussinessInventoryServiceImpl extends ServiceImpl<BussinessInventor
BeanPlusUtil.copyProperties(inventory,BIDTO); BeanPlusUtil.copyProperties(inventory,BIDTO);
for (BussinessDetail detail : details) { for (BussinessDetail detail : details) {
EquipmentListDto eqDto = new EquipmentListDto(); EquipmentListDto eqDto = new EquipmentListDto();
// 这里假设 BeanPlusUtil 是你的工具类,使用它进行属性复制
BeanPlusUtil.copyProperties(detail, eqDto); BeanPlusUtil.copyProperties(detail, eqDto);
eqDtoList.add(eqDto); eqDtoList.add(eqDto);
} }
BIDTO.setState(inventory.getResult());
BIDTO.setEquipmentList(eqDtoList); BIDTO.setEquipmentList(eqDtoList);
return BIDTO; return BIDTO;
} }
@Override @Override
public Bool UploadStock(UploadInventoryReq req) { @Transactional(rollbackFor = Exception.class)
public Boolean UploadStock(UploadInventoryReq req) {
//更新之前先把库存表的epc备份 //更新之前先把库存表的epc备份
BussinessInventory BI= this.getById(req.getOrderId()); BussinessInventory BI= this.getById(req.getOrderId());
String type= BI.getInventoryType().toString(); String type= BI.getInventoryType().toString();
InventorySumReq sumreq=new InventorySumReq(); InventorySumReq sumreq=new InventorySumReq();
String epcList="";
List<WarehouseInventory> details=new ArrayList<>();
if (type.equals("0")) if (type.equals("0"))
{ {
List<String> typeIds = Arrays.asList(BI.getRules().split(","));
sumreq.setTypeIds(typeIds); details = warehouseInventoryService.list(
new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
);
} else if (type.equals("1"))//按装备类型盘点 } else if (type.equals("1"))//按装备类型盘点
{ {
List<String> sizeIds = Arrays.asList(BI.getRules().split(",")); List<String> typeIds = Arrays.asList(BI.getRules().split(","));
sumreq.setSizeIds(sizeIds); details = warehouseInventoryService.list(
new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
.and(qw -> typeIds.forEach(typeId -> qw.or().eq(WarehouseInventory::getTypeId, typeId)))
);
} }
else if (type.equals("2"))//按号型盘点 else if (type.equals("2"))//按号型盘点
{ {
List<String> sizeIds = Arrays.asList(BI.getRules().split(",")); List<String> sizeIds = Arrays.asList(BI.getRules().split(","));
sumreq.setSizeIds(sizeIds); details = warehouseInventoryService.list(
new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getLocationId, BI.getWarehouseId())
.and(qw -> sizeIds.forEach(size -> qw.or().eq(WarehouseInventory::getSizeId, size)))
);
}
for (WarehouseInventory detail : details) {
String epc = detail.getEpc();
if (epc != null && !epc.isEmpty()) {
if (!epcList.isEmpty()) {
epcList += ",";
}
epcList += epc;
}
} }
List<InventorySummary> SumResult = inventorySummaryService.getEquipmentInfoList(sumreq); // 去除最后一个逗号
return null; if (epcList.endsWith(",")) {
epcList = epcList.substring(0, epcList.length() - 1);
}
BI.setEpcBack(epcList);
//将上报的数据传入数据库存储
BeanPlusUtil.copyProperties(req,BI);
List<BussinessDetail> Bussinessdetails=new ArrayList<>();
for (EquipmentListDto detail : req.getEquipmentList()) {
BussinessDetail eqDto = new BussinessDetail();
BeanPlusUtil.copyProperties(detail, eqDto);
eqDto.setInventoryId(Long.valueOf(req.getOrderId()));
Bussinessdetails.add(eqDto);
}
BI.setResult(req.getState());
BI.setInventoryState("running");
this.updateById(BI);
bussinessInventoryDetailService.saveBatch(Bussinessdetails);
return true;
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论