Commit a30195b9 by 李小惠

出入库,记账,调试bug

parent 3a5ec6bd
...@@ -39,4 +39,9 @@ public class OrderDetailDto implements Serializable { ...@@ -39,4 +39,9 @@ public class OrderDetailDto implements Serializable {
private Integer actualNum; private Integer actualNum;
private BigDecimal price; private BigDecimal price;
/**
* 在库数
*/
private Integer stockNumber;
} }
...@@ -42,5 +42,5 @@ public class PolicemanDto { ...@@ -42,5 +42,5 @@ public class PolicemanDto {
private List<PoliceFingerDto> fingersList; private List<PoliceFingerDto> fingersList;
private String fileContent; private String fileContent;
private String userId; private Long userId;
} }
\ No newline at end of file
...@@ -25,6 +25,11 @@ public class InventorySumReq extends BaseRequest { ...@@ -25,6 +25,11 @@ public class InventorySumReq extends BaseRequest {
* 位置信息 * 位置信息
*/ */
private String locationName; private String locationName;
/**
* 位置类型(0仓库,1单警柜)
*/
private String locationType;
/** /**
* 类型ID * 类型ID
*/ */
...@@ -42,4 +47,15 @@ public class InventorySumReq extends BaseRequest { ...@@ -42,4 +47,15 @@ public class InventorySumReq extends BaseRequest {
*/ */
private String sizeName; private String sizeName;
/**
* 排序规则
*/
private String order;
/**
* 排序列
*/
private String column;
} }
...@@ -118,4 +118,6 @@ public class LogSummaryReq extends BaseRequest { ...@@ -118,4 +118,6 @@ public class LogSummaryReq extends BaseRequest {
*/ */
private List<LogDetailReq> logList; private List<LogDetailReq> logList;
private String typeId;
} }
...@@ -91,6 +91,13 @@ public class InventoryController { ...@@ -91,6 +91,13 @@ public class InventoryController {
return ApiRes.success(inventorySummaryService.getEquipmentInfo(req)); return ApiRes.success(inventorySummaryService.getEquipmentInfo(req));
} }
//根据组织机构id/单警柜id/仓库id查询出库存汇总数量以及金额
@PostMapping("/getTotalNumberAndPrice")
@ApiOperation("查询总金额以及各个汇总数量")
public ApiRes<List<InventorySummary>> getTotalNumberAndPrice(@RequestBody InventorySumReq req){
return ApiRes.success(inventorySummaryService.getTotalNumberAndPrice(req));
}
//根据组织机构/单警柜id/仓库id查询每件装备细信的详息(返回结果是List) //根据组织机构/单警柜id/仓库id查询每件装备细信的详息(返回结果是List)
@PostMapping("/") @PostMapping("/")
...@@ -195,9 +202,9 @@ public class InventoryController { ...@@ -195,9 +202,9 @@ public class InventoryController {
return ApiRes.success(inventoryService.GetListEquipment(req)); return ApiRes.success(inventoryService.GetListEquipment(req));
} }
//根据条件查询仓库下的所有装备信息(业务状态,在库状态,仓库id,超期状态) //根据条件查询仓库/单警柜下的所有装备信息(业务状态,在库状态,仓库id,超期状态)
@PostMapping("/GetDetailByTerms") @PostMapping("/GetDetailByTerms")
@ApiOperation("根据条件查询仓库下的所有装备信息") @ApiOperation("根据条件查询仓库/单警柜下的所有装备信息")
public ApiRes<PageResult<InventoryDto>> GetDetailByTerms(@RequestBody @Validated(ValidationApi.export.class) InventoryReq req){ public ApiRes<PageResult<InventoryDto>> GetDetailByTerms(@RequestBody @Validated(ValidationApi.export.class) InventoryReq req){
return ApiRes.success(inventoryService.GetDetailByTerms(req)); return ApiRes.success(inventoryService.GetDetailByTerms(req));
} }
...@@ -225,8 +232,8 @@ public class InventoryController { ...@@ -225,8 +232,8 @@ public class InventoryController {
//装备出入库记录(根据单据id) //装备出入库记录(根据单据id)
@PostMapping("/ShowInOutRecordsByOrder") @PostMapping("/ShowInOutRecordsByOrder")
@ApiOperation("出入库单据查询展示") @ApiOperation("出入库单据查询展示")
public ApiRes<PageResult<LogSummary>> ShowInOutRecordsPage(@RequestBody @Validated(ValidationApi.detail.class) LogSummaryReq req){ public ApiRes<PageResult<LogSummary>> ShowInOutRecordsByOrder(@RequestBody @Validated(ValidationApi.detail.class) LogSummaryReq req){
return ApiRes.success(inventoryService.ShowInOutRecordsPage(req)); return ApiRes.success(inventoryService.ShowInOutRecordsByOrder(req));
} }
...@@ -234,7 +241,7 @@ public class InventoryController { ...@@ -234,7 +241,7 @@ public class InventoryController {
@PostMapping("/ShowInOutRecordsByItems") @PostMapping("/ShowInOutRecordsByItems")
@ApiOperation("出入库记录条件查询展示") @ApiOperation("出入库记录条件查询展示")
public ApiRes<PageResult<LogSummary>> ShowInOutRecordsByItems(@RequestBody @Validated(ValidationApi.detail.class) LogSummaryReq req){ public ApiRes<PageResult<LogSummary>> ShowInOutRecordsByItems(@RequestBody @Validated(ValidationApi.detail.class) LogSummaryReq req){
return ApiRes.success(inventoryService.ShowInOutRecordsPage(req)); return ApiRes.success(inventoryService.ShowInOutRecordsByItems(req));
} }
//通过装备id查询某一件装备的出入库记录 //通过装备id查询某一件装备的出入库记录
...@@ -244,9 +251,20 @@ public class InventoryController { ...@@ -244,9 +251,20 @@ public class InventoryController {
return ApiRes.success(inventoryService.getInOutRecords(req)); return ApiRes.success(inventoryService.getInOutRecords(req));
} }
// @PostMapping("/test") @PostMapping("/test")
// public ApiRes<Boolean> test(@RequestBody RabbitMqOrderReq req){ public ApiRes<Boolean> test(@RequestBody InventorySumReq req){
// return ApiRes.success(inventoryService.test(req)); System.out.println("req = " + req);
// } return ApiRes.success(true);
}
@PostMapping("/EquipmentStatistics")
@ApiOperation("装备数量数据统计")
public ApiRes<List<InventorySummary>> EquipmentStatistics(@RequestBody InventorySumReq req){
return ApiRes.success(inventorySummaryService.EquipmentStatistics(req));
}
} }
...@@ -146,6 +146,12 @@ public class Inventory implements Serializable { ...@@ -146,6 +146,12 @@ public class Inventory implements Serializable {
private String locationId ; private String locationId ;
/** /**
* 位置名称
*/
@TableField(exist = false)
private String locationName ;
/**
* 是否遗失 * 是否遗失
*/ */
@TableField(value = "lost_flag") @TableField(value = "lost_flag")
......
...@@ -134,6 +134,27 @@ public class InventorySummary implements Serializable { ...@@ -134,6 +134,27 @@ public class InventorySummary implements Serializable {
private Integer expireNumber; private Integer expireNumber;
/** /**
* 报废数量
*/
@ApiModelProperty(value = "报废数量")
@TableField("broken_number")
private Integer brokenNumber;
/**
* 临近报废数量
*/
@ApiModelProperty(value = "临近报废数量")
@TableField("near_broken_number")
private Integer nearBrokenNumber;
/**
* 使用中数量(领用和借用)
*/
@ApiModelProperty(value = "使用中数量(领用和借用)")
@TableField("use_number")
private Integer useNumber;
/**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
......
package com.junmp.jyzb.entity; package com.junmp.jyzb.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -16,6 +17,7 @@ public class LogDetail implements Serializable { ...@@ -16,6 +17,7 @@ public class LogDetail implements Serializable {
/** /**
* 出入库明细ID * 出入库明细ID
*/ */
private Long id; private Long id;
/** /**
* 出入库汇总id * 出入库汇总id
...@@ -35,6 +37,12 @@ public class LogDetail implements Serializable { ...@@ -35,6 +37,12 @@ public class LogDetail implements Serializable {
private String orderMainId; private String orderMainId;
/** /**
* 单据编号
*/
@TableField(value = "order_code")
private String orderCode;
/**
* 业务类型 * 业务类型
*/ */
@TableField(value = "bussiness_type") @TableField(value = "bussiness_type")
...@@ -89,6 +97,18 @@ public class LogDetail implements Serializable { ...@@ -89,6 +97,18 @@ public class LogDetail implements Serializable {
private Integer equipmentType; private Integer equipmentType;
/** /**
* 位置id(存放单警柜id或者是仓库id)
*/
@TableField(value = "location_id")
private String locationId;
/**
* 位置名称(单警柜,仓库)
*/
@TableField(value = "location_name")
private String locationName;
/**
* 箱门id * 箱门id
*/ */
@TableField(value = "cabinetbox_id") @TableField(value = "cabinetbox_id")
......
...@@ -39,6 +39,11 @@ public class LogSummary implements Serializable { ...@@ -39,6 +39,11 @@ public class LogSummary implements Serializable {
*/ */
@TableField(value = "order_main_id") @TableField(value = "order_main_id")
private String orderMainId; private String orderMainId;
/**
* 单据编号
*/
@TableField(value = "order_code")
private String orderCode;
/** /**
* 设备标识 * 设备标识
...@@ -52,17 +57,7 @@ public class LogSummary implements Serializable { ...@@ -52,17 +57,7 @@ public class LogSummary implements Serializable {
@TableField(value = "device_type") @TableField(value = "device_type")
private Integer deviceType; private Integer deviceType;
/**
* 位置id(存放单警柜id或者是仓库id)
*/
@TableField(value = "location_id")
private String locationId;
/**
* 位置名称(单警柜,仓库)
*/
@TableField(value = "location_name")
private String locationName;
/** /**
* 所属位置(0仓库1单警柜) * 所属位置(0仓库1单警柜)
...@@ -127,6 +122,12 @@ public class LogSummary implements Serializable { ...@@ -127,6 +122,12 @@ public class LogSummary implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private List<LogDetail> logDetailList; private List<LogDetail> logDetailList;
/**
* 出入状态
*/
@TableField(value = "out_in_state")
private String outInState;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -76,7 +76,7 @@ public class Policeman implements Serializable { ...@@ -76,7 +76,7 @@ public class Policeman implements Serializable {
private Integer state; private Integer state;
@TableField(value = "user_id",updateStrategy = FieldStrategy.IGNORED) @TableField(value = "user_id",updateStrategy = FieldStrategy.IGNORED)
private Long UserId; private Long userId;
/** /**
* 0表示警员,1表示辅警 * 0表示警员,1表示辅警
......
...@@ -26,10 +26,10 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -26,10 +26,10 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
boolean deleteAllMsg(); boolean deleteAllMsg();
//根据单警柜统计装备信息 //根据单警柜统计装备信息
boolean SetCabinetInventory(); boolean SetCabinetInventory(@Param("brokenNumberDays") Integer brokenNumberDays);
//根据仓库统计装备信息 //根据仓库统计装备信息
boolean SetWarehouseInventory(); boolean SetWarehouseInventory(@Param("brokenNumberDays") Integer brokenNumberDays);
List<InventoryDto> EqsBySearchType(InventoryReq req); List<InventoryDto> EqsBySearchType(InventoryReq req);
...@@ -60,5 +60,5 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -60,5 +60,5 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
IPage<InventorySummary> EqsByCabinetBoxIdPage(Page<InventorySummary> page, String id); IPage<InventorySummary> EqsByCabinetBoxIdPage(Page<InventorySummary> page, String id);
boolean insertInventorySummary(@Param("req") BatchEditingInvsReq req); boolean insertInventorySummary(@Param("req") BatchEditingInvsReq req,@Param("brokenNumberDays")Integer brokenNumberDays);
} }
\ No newline at end of file
...@@ -19,10 +19,14 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> { ...@@ -19,10 +19,14 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> {
//根据仓库id删除装备汇总信息 //根据仓库id删除装备汇总信息
boolean deleteByWarehouse(@Param("list") List<WarehouseDto> allWarehouse); boolean deleteByWarehouse(@Param("list") List<WarehouseDto> allWarehouse);
boolean getSumByWarehouse(@Param("list") List<WarehouseDto> allWarehouse); boolean getSumByWarehouse(@Param("list") List<WarehouseDto> allWarehouse,@Param("brokenNumberDays")Integer brokenNumberDays);
//根据单警柜删除装备汇总信息 //根据单警柜删除装备汇总信息
boolean deleteByCabinet(@Param("cabinetId") String cabinetId); boolean deleteByCabinet(@Param("cabinetId") String cabinetId);
boolean getSumByCabinet(@Param("cabinetId") String cabinetId); boolean getSumByCabinet(@Param("cabinetId") String cabinetId,@Param("brokenNumberDays")Integer brokenNumberDays);
InventorySummary getTotalNumberAndPrice(@Param("req") InventorySumReq req);
InventorySummary EquipmentStatistics(@Param("req") InventorySumReq req);
} }
\ No newline at end of file
...@@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Param;
* @Entity com.junmp.jyzb.entity.LogSummary * @Entity com.junmp.jyzb.entity.LogSummary
*/ */
public interface LogSummaryMapper extends BaseMapper<LogSummary> { public interface LogSummaryMapper extends BaseMapper<LogSummary> {
IPage<LogSummary> ShowInOutRecordsPage(Page<LogSummary> page, @Param("req") LogSummaryReq req); IPage<LogSummary> ShowInOutRecordsByOrder(Page<LogSummary> page, @Param("req") LogSummaryReq req);
IPage<LogSummary> ShowInOutRecordsByWarehouse(Page<LogSummary> page,@Param("req") LogSummaryReq req); IPage<LogSummary> ShowInOutRecordsByWarehouse(Page<LogSummary> page,@Param("req") LogSummaryReq req);
IPage<LogSummary> ShowInOutRecordsByCabinet(Page<LogSummary> page,@Param("req") LogSummaryReq req); IPage<LogSummary> ShowInOutRecordsByCabinet(Page<LogSummary> page,@Param("req") LogSummaryReq req);
// IPage<LogSummary> ShowInOutRecordsPage(Page<LogSummary> page,@Param("req") LogSummaryReq req); // IPage<LogSummary> ShowInOutRecordsPage(Page<LogSummary> page,@Param("req") LogSummaryReq req);
......
...@@ -21,15 +21,22 @@ public class OrderMQReceiver { ...@@ -21,15 +21,22 @@ public class OrderMQReceiver {
@Resource @Resource
private InventorySummaryService inventorySummaryService; private InventorySummaryService inventorySummaryService;
@RabbitListener(queues = "11111")//监听队列名 @RabbitListener(queues = "orderResult")//监听队列名
private void a(RabbitMqOrderReq req, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){ private void a(RabbitMqOrderReq req, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag){
try { try {
System.out.println("req = " + req); System.out.println("req = " + req);
//将消息进行消费 //将消息进行消费
Boolean result = inventorySummaryService.processInventoryRecords(req); Boolean result = inventorySummaryService.processInventoryRecords(req);
Long ordId;
if (req.getOrderMainReq().getOrderType().equals("in")){
ordId=req.getOrderMainReq().getEndOrgId();
}else {
ordId=req.getOrderMainReq().getStartOrgId();
}
Boolean aBoolean = inventorySummaryService.updateSummaryInsByOrder(ordId);
System.out.println("result = " + result); System.out.println("result = " + result);
if (result){ if (result && aBoolean){
// 手动确认消息 // 手动确认消息
channel.basicAck(deliveryTag, false); channel.basicAck(deliveryTag, false);
}else { }else {
......
...@@ -88,8 +88,10 @@ public interface InventoryService extends IService<Inventory> { ...@@ -88,8 +88,10 @@ public interface InventoryService extends IService<Inventory> {
PageResult<LogDetail> getInOutRecords(InventoryReq req); PageResult<LogDetail> getInOutRecords(InventoryReq req);
//根据单据获取出入库记录 //根据单据获取出入库记录
PageResult<LogSummary> ShowInOutRecordsPage(LogSummaryReq req); PageResult<LogSummary> ShowInOutRecordsByOrder(LogSummaryReq req);
PageResult<LogSummary> ShowInOutRecordsByItems(LogSummaryReq req); PageResult<LogSummary> ShowInOutRecordsByItems(LogSummaryReq req);
boolean test(RabbitMqOrderReq req); boolean test(RabbitMqOrderReq req);
} }
...@@ -21,7 +21,15 @@ public interface InventorySummaryService extends IService<InventorySummary> { ...@@ -21,7 +21,15 @@ public interface InventorySummaryService extends IService<InventorySummary> {
//处理本地主机返回单据结果 //处理本地主机返回单据结果
Boolean processInventoryRecords(RabbitMqOrderReq req); Boolean processInventoryRecords(RabbitMqOrderReq req);
//对summary表中数据进行重新计算装备信息汇总
Boolean updateSummaryInsByOrder(Long orgId);
//处理单警柜返回单据结果 //处理单警柜返回单据结果
Boolean cabinetInOutRecords(CabinetInOutRecordsReq req); Boolean cabinetInOutRecords(CabinetInOutRecordsReq req);
//根据组织机构id/单警柜id/仓库id查询出库存汇总数量以及金额
List<InventorySummary> getTotalNumberAndPrice(InventorySumReq req);
//计算装备总数(装备数量数据统计)
List<InventorySummary> EquipmentStatistics(InventorySumReq req);
} }
...@@ -52,13 +52,20 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl ...@@ -52,13 +52,20 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl
public String AddBussinessOrder(UpdateBusFormReq req) { public String AddBussinessOrder(UpdateBusFormReq req) {
BusForm busForm = new BusForm(); BusForm busForm = new BusForm();
BeanUtil.copyProperties(req,busForm); BeanUtil.copyProperties(req,busForm);
OrderNum orderNum = stocktakeService.setOrderCode(req.getBussinessType(), req.getOrgId());
String codeValue=String.format("%04d",orderNum.getNum()); if (ObjectUtil.isNull(req.getId())){
busForm.setBussinessCode(orderNum.getBussinessType()+"-"+orderNum.getYear()+"-"+ String id= UUID.randomUUID().toString();
LocalDateTime.now().getMonth().getValue()+"-"+LocalDateTime.now().getDayOfMonth()+"-"+codeValue); busForm.setId(id);
//设置单据号
OrderNum orderNum = stocktakeService.setOrderCode(req.getBussinessType(), req.getOrgId());
String codeValue=String.format("%04d",orderNum.getNum());
busForm.setBussinessCode(orderNum.getBussinessType()+orderNum.getYear()+
String.format("%02d",LocalDateTime.now().getMonth().getValue())+
String.format("%02d",LocalDateTime.now().getDayOfMonth())+codeValue);
}
busForm.setCreateTime(DateTimeUtil.getCurrentDateTime()); busForm.setCreateTime(DateTimeUtil.getCurrentDateTime());
String id= UUID.randomUUID().toString();
busForm.setId(id);
//执行工作流 //执行工作流
if (req.getExamineState().equals("working")) if (req.getExamineState().equals("working"))
{ {
...@@ -69,16 +76,15 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl ...@@ -69,16 +76,15 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl
startProcessInstanceDTO.setUserId(req.getUserId()); startProcessInstanceDTO.setUserId(req.getUserId());
String ProcessInstanceId= FlowInstanceService.startProcessInstanceById(startProcessInstanceDTO); String ProcessInstanceId= FlowInstanceService.startProcessInstanceById(startProcessInstanceDTO);
busForm.setProcessId(ProcessInstanceId); busForm.setProcessId(ProcessInstanceId);
this.save(busForm);
} }
if (req.getExamineState().equals("none")){//如果是草稿
if(ObjectUtil.isNotNull(req.getId())){ if(ObjectUtil.isNotNull(req.getId())){
//已经是一个草稿,在点击提交的时候只需要更新即可,因为数据库中已经存在该单据 //已经是一个草稿,在点击提交的时候只需要更新即可,因为数据库中已经存在该单据
updateById(busForm); updateById(busForm);
}else { }else {
//保存 //保存
this.save(busForm); this.save(busForm);
}
} }
return busForm.getId(); return busForm.getId();
} }
...@@ -119,7 +125,7 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl ...@@ -119,7 +125,7 @@ public class BusFormServiceImpl extends ServiceImpl<BusFormMapper, BusForm> impl
.eq(ObjectUtil.isNotNull(req.getBussinessType()), BusForm::getBussinessType, req.getBussinessType()) .eq(ObjectUtil.isNotNull(req.getBussinessType()), BusForm::getBussinessType, req.getBussinessType())
//审核状态 //审核状态
.eq(ObjectUtil.isNotNull(req.getExamineState()) && !req.getExamineState().trim().isEmpty(), BusForm::getExamineState, req.getExamineState()) .eq(ObjectUtil.isNotNull(req.getExamineState()) && !req.getExamineState().trim().isEmpty(), BusForm::getExamineState, req.getExamineState())
// //仓库id
.eq(ObjectUtil.isNotNull(req.getWarehouseId()), BusForm::getWarehouseId, req.getWarehouseId()) .eq(ObjectUtil.isNotNull(req.getWarehouseId()), BusForm::getWarehouseId, req.getWarehouseId())
.eq(ObjectUtil.isNotNull(req.getOrgId()),BusForm::getOrgId,req.getOrgId()) .eq(ObjectUtil.isNotNull(req.getOrgId()),BusForm::getOrgId,req.getOrgId())
.ge(ObjectUtil.isNotNull(req.getStartTime()), BusForm::getCreateTime, req.getStartTime()) .ge(ObjectUtil.isNotNull(req.getStartTime()), BusForm::getCreateTime, req.getStartTime())
......
...@@ -55,13 +55,16 @@ public class StocktakeServiceImpl extends ServiceImpl<StocktakeMapper, Stocktake ...@@ -55,13 +55,16 @@ public class StocktakeServiceImpl extends ServiceImpl<StocktakeMapper, Stocktake
Stocktake stocktake = new Stocktake(); Stocktake stocktake = new Stocktake();
BeanPlusUtil.copyProperties(req,stocktake); BeanPlusUtil.copyProperties(req,stocktake);
//设置单号 //设置单号
OrderNum orderNum = setOrderCode(req.getBussinessType(),req.getOrgId()); if (ObjectUtil.isNull(stocktake.getOrderCode())){
String codeValue=String.format("%04d",orderNum.getNum()); OrderNum orderNum = setOrderCode(req.getBussinessType(),req.getOrgId());
stocktake.setOrderCode(orderNum.getBussinessType()+"-"+orderNum.getYear()+"-"+ String codeValue=String.format("%04d",orderNum.getNum());
LocalDateTime.now().getMonth().getValue()+"-"+LocalDateTime.now().getDayOfMonth()+"-"+codeValue); stocktake.setOrderCode(orderNum.getBussinessType()+orderNum.getYear()+
String.format("%02d",LocalDateTime.now().getMonth().getValue())+
String.format("%02d",LocalDateTime.now().getDayOfMonth())+codeValue);
}
stocktake.setCreateTime(DateTimeUtil.getCurrentDateTime()); stocktake.setCreateTime(DateTimeUtil.getCurrentDateTime());
stocktake.setApplyTime(DateTimeUtil.getCurrentDateTime()); stocktake.setApplyTime(DateTimeUtil.getCurrentDateTime());
this.save(stocktake);
//执行工作流 //执行工作流
if (req.getExamineState().equals("working")) if (req.getExamineState().equals("working"))
{ {
...@@ -73,6 +76,7 @@ public class StocktakeServiceImpl extends ServiceImpl<StocktakeMapper, Stocktake ...@@ -73,6 +76,7 @@ public class StocktakeServiceImpl extends ServiceImpl<StocktakeMapper, Stocktake
String ProcessInstanceId= FlowInstanceService.startProcessInstanceById(startProcessInstanceDTO); String ProcessInstanceId= FlowInstanceService.startProcessInstanceById(startProcessInstanceDTO);
stocktake.setProcessId(ProcessInstanceId); stocktake.setProcessId(ProcessInstanceId);
} }
this.save(stocktake);
return stocktake.getId(); return stocktake.getId();
} }
......
...@@ -68,10 +68,21 @@ ...@@ -68,10 +68,21 @@
</if> </if>
</select> </select>
<delete id="deleteByCabinet" parameterType="java.lang.String">
delete from base_inventory_summary where locationId = #{cabinetId}
</delete>
<insert id="getSumByCabinet"> <insert id="getSumByCabinet">
INSERT INTO base_inventory_summary (id,org_id_int,org_name,type_id, type_name,size_id,size_name,location_id,location_name,number,unit_price,price,stock_number, outbound_number,destruction_number,expire_number,location_type,create_time,update_time) INSERT INTO base_inventory_summary (id,org_id_int,org_name,type_id, type_name,size_id,size_name,location_id,location_name,
number,unit_price,price,stock_number, outbound_number,destruction_number,expire_number,
broken_number,use_number,near_broken_number,location_type,create_time,update_time)
select select
MAX(t.id) as id,t.orgId,t.orgName,t.type_id,t.typeName,t.size_id,t.sizeName,t.locationId,t.locationName,sum(t.number) as number,t.unitPrice,sum(t.price)as price,sum(t.stockNumber)as stockNumber,sum(t.outboundNumber)as outboundNumber,sum(t.destructionNumber)as destructionNumber,sum(t.expireNumber)as expireNumber,t.location_type,NOW(),NOW() MAX(t.id) as id,t.orgId,t.orgName,t.type_id,t.typeName,t.size_id,t.sizeName,t.locationId,t.locationName,sum(t.number) as number,
t.unitPrice,sum(t.price)as price,sum(t.stockNumber)as stockNumber,sum(t.outboundNumber)as outboundNumber,
sum(t.destructionNumber)as destructionNumber,sum(t.expireNumber)as expireNumber,sum(t.brokenNumber)as brokenNumber,
sum(t.useNumber)as useNumber,sum(t.nearBrokenNumber)as nearBrokenNumber,t.location_type,NOW(),NOW()
FROM FROM
(SELECT (SELECT
UUID() as id, UUID() as id,
...@@ -84,13 +95,18 @@ ...@@ -84,13 +95,18 @@
t.name as typeName, t.name as typeName,
bi.size_id, bi.size_id,
s.name as sizeName, s.name as sizeName,
count(*) as number, SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END)+SUM(CASE WHEN location_state = 'out' and bi.state!='destory' THEN 1 ELSE 0 END) as number,
bi.price as unitPrice, bi.price as unitPrice,
sum(bi.price) as price, sum(bi.price) as price,
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber, SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber,
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS outboundNumber, SUM(CASE WHEN location_state = 'out' and bi.state!='destory' THEN 1 ELSE 0 END) AS outboundNumber,
sum(case when bi.state = 'destory' then 1 else 0 end) as destructionNumber, sum(case when bi.state = 'destory' then 1 else 0 end) as destructionNumber,
sum(case when bi.warranty_period=0 then 0 when DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH) &lt; NOW() then 1 else 0 end )as expireNumber, sum(case when bi.warranty_period=0 then 0 when DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH) &gt; NOW() then 1 else 0 end )as expireNumber,
sum(case when bi.state ='broken' and bi.location_state='in' then 1 else 0 end)as brokenNumber,
sum(case when bi.bussiness_state = 'borrow' and bi.location_state='out' then 1
when bi.bussiness_state = 'take' and bi.location_state='out' then 1 else 0 end)as useNumber,
sum(case when bi.warranty_period=0 then 0 when DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH) &lt; NOW()
and DATEDIFF(DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH),NOW()) &lt; #{brokenNumberDays} then 1 else 0 end)as nearBrokenNumber,
bi.location_type bi.location_type
FROM base_inventory bi FROM base_inventory bi
join base_cabinet_box bcb on bi.location_id = bcb.id join base_cabinet_box bcb on bi.location_id = bcb.id
...@@ -105,22 +121,55 @@ ...@@ -105,22 +121,55 @@
</insert> </insert>
<select id="getTotalNumberAndPrice" resultType="com.junmp.jyzb.entity.InventorySummary">
select sum(number) as number,sum(price)as price,sum(stock_number)as stockNumber,
sum(outbound_number)as outboundNumber,sum(destruction_number)as destructionNumber,
sum(expire_number)as expireNumber,sum(broken_number)as brokenNumber,max(location_type)
FROM base_inventory_summary where 1=1
<if test="req.orgId != null and req.orgId != ''">
and org_id_int=#{req.orgId}
</if>
<if test="req.locationId !=null and req.locationId != ''">
and location_id=#{req.locationId}
</if>
<if test="req.sizeId != null and req.sizeId != ''">
and size_id=#{req.sizeId}
</if>
<if test="req.TypeId != null and req.typeId != ''">
and type_id=#{req.typeId}
</if>
<if test="req.locationType != null and req.locationType != ''">
and location_type=#{req.locationType}
</if>
</select>
<select id="EquipmentStatistics" resultType="com.junmp.jyzb.entity.InventorySummary"
parameterType="com.junmp.jyzb.api.bean.query.InventorySumReq">
select sum(number) as number,sum(price)as price,sum(stock_number)as stockNumber,
sum(outbound_number)as outboundNumber,sum(destruction_number)as destructionNumber,
sum(expire_number)as expireNumber,sum(broken_number)as brokenNumber,
sum(near_broken_number)as nearBrokenNumber,sum(use_number)as useNumber
FROM base_inventory_summary where org_id_int=#{req.orgId}
</select>
<delete id="deleteByWarehouse" <delete id="deleteByWarehouse"
parameterType="com.junmp.jyzb.api.bean.dto.WarehouseDto"> parameterType="com.junmp.jyzb.api.bean.dto.WarehouseDto">
delete from base_inventory_summary_type2 delete from base_inventory_summary
where location_id in where location_id in
<foreach collection="list" item="item" open="(" separator="," close=")"> <foreach collection="list" item="item" open="(" separator="," close=")">
#{item.id} #{item.id}
</foreach> </foreach>
</delete> </delete>
<delete id="deleteByCabinet" parameterType="java.lang.String">
delete from base_inventory_summary_type2 where locationId = #{cabinetId}
</delete>
<insert id="getSumByWarehouse">
INSERT INTO base_inventory_summary_type2 (id,org_id_int,org_name,location_id,location_name,type_id, type_name,size_id,size_name,number,unit_price,price, stock_number, outbound_number,destruction_number,expire_number,location_type,create_time,update_time) <insert id="getSumByWarehouse" >
INSERT INTO base_inventory_summary (id,org_id_int,org_name,location_id,location_name,type_id, type_name,size_id,
size_name,number,unit_price,price, stock_number, outbound_number,destruction_number,
expire_number,broken_number,use_number,near_broken_number,location_type,create_time,update_time)
select select
MAX(t.id) as id,t.orgId,t.orgName,t.locationId,MAX(t.locationName),t.type_id,t.typeName,t.size_id,t.sizeName,sum(t.number) as number,t.unitPrice,sum(t.price)as price,sum(t.stockNumber)as stockNumber,sum(t.outboundNumber)as outboundNumber,sum(t.destructionNumber)as destructionNumber,sum(t.destructionNumber) as expireNumber,t.location_type,NOW(),NOW() MAX(t.id) as id,t.orgId,t.orgName,t.locationId,MAX(t.locationName),t.type_id,t.typeName,t.size_id,t.sizeName,
sum(t.number) as number,t.unitPrice,sum(t.price)as price,sum(t.stockNumber)as stockNumber,sum(t.outboundNumber)as outboundNumber,
sum(t.destructionNumber)as destructionNumber,sum(t.destructionNumber) as expireNumber,sum(t.brokenNumber) as brokenNumber,
sum(t.useNumber)as useNumber,sum(t.nearBrokenNumber)as nearBrokenNumber,t.location_type,NOW(),NOW()
FROM FROM
(SELECT (SELECT
UUID() as id, UUID() as id,
...@@ -132,14 +181,18 @@ ...@@ -132,14 +181,18 @@
t.name as typeName, t.name as typeName,
bi.size_id, bi.size_id,
s.name as sizeName, s.name as sizeName,
count(*) as number, SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END)+SUM(CASE WHEN location_state = 'out' and bi.state!='destory' THEN 1 ELSE 0 END) as number,
Max(bi.price) as unitPrice, bi.price as unitPrice,
sum(bi.price) as price, sum(bi.price) as price,
SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber, SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS stockNumber,
count(*) - SUM(CASE WHEN location_state = 'in' THEN 1 ELSE 0 END) AS outboundNumber, SUM(CASE WHEN location_state = 'out' and bi.state!='destory' THEN 1 ELSE 0 END) AS outboundNumber,
sum(case when bi.state = 'destory' then 1 else 0 end) as destructionNumber, sum(case when bi.state = 'destory' then 1 else 0 end) as destructionNumber,
sum(case when bi.warranty_period=0 then 0 when DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH) &lt; NOW() then 1 sum(case when bi.warranty_period=0 then 0 when DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH) &gt; NOW() then 1 else 0 end )as expireNumber,
else 0 end )as expireNumber, sum(case when bi.state ='broken' and bi.location_state='in' then 1 else 0 end)as brokenNumber,
sum(case when bi.bussiness_state = 'borrow' and bi.location_state='out' then 1
when bi.bussiness_state = 'take' and bi.location_state='out' then 1 else 0 end)as useNumber,
sum(case when bi.warranty_period=0 then 0 when DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH) &lt; NOW()
and DATEDIFF(DATE_ADD(bi.production_date,INTERVAL bi.warranty_period MONTH),NOW()) &lt; #{brokenNumberDays} then 1 else 0 end)as nearBrokenNumber,
bi.location_type bi.location_type
FROM base_inventory bi FROM base_inventory bi
join base_warehouse bw on bi.location_id = bw.id join base_warehouse bw on bi.location_id = bw.id
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
picture,equipment_List,create_time, picture,equipment_List,create_time,
update_time,update_user,create_user update_time,update_user,create_user
</sql> </sql>
<select id="ShowInOutRecordsPage" resultType="com.junmp.jyzb.entity.LogSummary"> <select id="ShowInOutRecordsByOrder" resultType="com.junmp.jyzb.entity.LogSummary">
select * from base_log_summary ls select * from base_log_summary ls
where ls.org_id = #{req.orgId} and ls.order_main_id=#{req.orderMainId} where ls.org_id = #{req.orgId} and ls.order_main_id=#{req.orderMainId}
</select> </select>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
select * FROM bussiness_order_main WHERE order_type=#{req.orderType} select * FROM bussiness_order_main WHERE order_type=#{req.orderType}
<if test="req.typeId != null and req.typeId != ''"> <if test="req.typeId != null and req.typeId != ''">
and id in( and id in(
SELECT order_id FROM bussiness_order_detail WHERE equipment_type = #{req.typeId}) SELECT order_id FROM bussiness_order_detail WHERE type_id = #{req.typeId})
</if> </if>
<if test="null != req.bussinessType and '' != req.bussinessType "> <if test="null != req.bussinessType and '' != req.bussinessType ">
and bussiness_type = #{req.bussinessType} and bussiness_type = #{req.bussinessType}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论