|
@@ -18,17 +18,17 @@ import com.github.zuihou.business.record.entity.EquRecord;
|
|
|
import com.github.zuihou.business.record.service.EquRecordService;
|
|
|
import com.github.zuihou.business.util.CommonUtil;
|
|
|
import com.github.zuihou.common.util.DateUtil;
|
|
|
+import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
|
|
|
import com.github.zuihou.utils.DateUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.LocalTime;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -50,6 +50,7 @@ public class OpsAppApi {
|
|
|
@Autowired
|
|
|
private MaterialService materialService;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 设备列表接口
|
|
|
*
|
|
@@ -61,7 +62,7 @@ public class OpsAppApi {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
IPage<ProductionResource> page = params.buildPage();
|
|
|
LbqWrapper<ProductionResource> queryWrap = Wraps.lbQ();
|
|
|
- ProductionResource productionResource = BeanUtil.toBean(params, ProductionResource.class);
|
|
|
+ ProductionResource productionResource = BeanUtil.toBean(params.getModel(), ProductionResource.class);
|
|
|
queryWrap.eq(ProductionResource::getStatus,"1").orderByDesc(ProductionResource::getCreateTime);
|
|
|
IPage<ProductionResource> list = productionTenantResourceService.pageList(page, queryWrap);
|
|
|
return R.success(list);
|
|
@@ -115,7 +116,7 @@ public class OpsAppApi {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
IPage<Order> page = params.buildPage();
|
|
|
QueryWrap<Order> orderQueryWrap = new QueryWrap<>();
|
|
|
- Order order = BeanUtil.toBean(params, Order.class);
|
|
|
+ Order order = BeanUtil.toBean(params.getModel(), Order.class);
|
|
|
if(params.getMap().containsKey("createTime_st")){
|
|
|
LocalDateTime startTime = DateUtils.getStartTime(params.getMap().get("createTime_st").toString());
|
|
|
orderQueryWrap.geHeader("create_time", startTime);
|
|
@@ -153,72 +154,51 @@ public class OpsAppApi {
|
|
|
return R.success(orderList.getRecords().size()>0? orderList.getRecords().get(0) : Order.builder().build());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 今日订单接口
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/todayOrders")
|
|
|
- public R<List<Order>> todayOrders(@RequestParam("equId") Long equId) {
|
|
|
- BaseContextHandler.setTenant("0000");
|
|
|
- QueryWrap<Order> orderQueryWrap = new QueryWrap<>();
|
|
|
- orderQueryWrap.eq("order_equ_id", equId);
|
|
|
-
|
|
|
- LocalDateTime startTime = LocalDateTime.of(LocalDate.now(), LocalTime.MIN);
|
|
|
- LocalDateTime endTime = LocalDateTime.of(LocalDate.now(), LocalTime.MAX);
|
|
|
- orderQueryWrap.between("create_time", startTime, endTime);
|
|
|
- List<Order> list = orderService.list(orderQueryWrap);
|
|
|
- return R.success(list);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 近七日订单接口
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @GetMapping("/sevenDaysOrders")
|
|
|
- public R<List<Order>> sevenDaysOrders(@RequestParam("equId") Long equId) {
|
|
|
- BaseContextHandler.setTenant("0000");
|
|
|
- QueryWrap<Order> orderQueryWrap = new QueryWrap<>();
|
|
|
- orderQueryWrap.eq("order_equ_id", equId);
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- LocalDateTime sevenAgo = now.minusDays(7);
|
|
|
- orderQueryWrap.between("create_time", sevenAgo, now);
|
|
|
- List<Order> list = orderService.list(orderQueryWrap);
|
|
|
- return R.success(list);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 料筒查询接口
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/barrelList")
|
|
|
- public R<IPage<EquBarrel>> barrelList(@RequestParam("equId") Long equId) {
|
|
|
+ public R<IPage<EquBarrel>> barrelList(@RequestParam("equId") Long equId, @RequestParam("barrelType") String barrelType) {
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
QueryWrap<EquBarrel> equBarrelQueryWrap = new QueryWrap<>();
|
|
|
- equBarrelQueryWrap.eq("equ_id",equId);
|
|
|
+ equBarrelQueryWrap.eq("equ_id", equId);
|
|
|
+ if(StringUtils.isNotEmpty(barrelType)){
|
|
|
+ //equBarrelQueryWrap.in("barrel_type", new String[]{"4","5"});
|
|
|
+ equBarrelQueryWrap.gt("barrel_type", 3);
|
|
|
+ }else{
|
|
|
+ //equBarrelQueryWrap.in("barrel_type", new String[]{"1","2", "3"});
|
|
|
+ equBarrelQueryWrap.le("barrel_type", 3);
|
|
|
+ }
|
|
|
Page<EquBarrel> page = new Page<>(1L,10);
|
|
|
- //List<EquBarrel> list = equBarrelService.list(equBarrelQueryWrap);
|
|
|
IPage<EquBarrel> list = equBarrelService.pageList(page, equBarrelQueryWrap);
|
|
|
return R.success(list);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 原料修正日志记录
|
|
|
+ *
|
|
|
+ * @param params
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/recordList")
|
|
|
public R<IPage<EquRecord>> recordList(@RequestBody PageParams<EquRecord> params){
|
|
|
BaseContextHandler.setTenant("0000");
|
|
|
IPage<EquRecord> page = params.buildPage();
|
|
|
LbqWrapper<EquRecord> recordQueryWrap = Wraps.lbQ();
|
|
|
- EquRecord equRecord = BeanUtil.toBean(params, EquRecord.class);
|
|
|
+ EquRecord equRecord = BeanUtil.toBean(params.getModel(), EquRecord.class);
|
|
|
+ if(StringUtil.isNotEmpty(equRecord.getBarrelType())){
|
|
|
+ recordQueryWrap.gt(EquRecord::getBarrelType, "3");
|
|
|
+ }else{
|
|
|
+ recordQueryWrap.le(EquRecord::getBarrelType, "3");
|
|
|
+ }
|
|
|
recordQueryWrap.eq(EquRecord::getEquId, equRecord.getEquId()).orderByDesc(EquRecord::getCreateTime);
|
|
|
IPage<EquRecord> list = equRecordService.pageList(page, recordQueryWrap);
|
|
|
return R.success(list);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@GetMapping("/equMaterialList")
|
|
|
public R<List<Material>> equMaterialList(@RequestParam("mtType") String mtType){
|
|
|
BaseContextHandler.setTenant("0000");
|
|
@@ -272,7 +252,23 @@ public class OpsAppApi {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 换料接口
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/cupRecordSave")
|
|
|
+ public R<Boolean> cupRecordSave(@RequestBody EquRecord equRecord) {
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ LambdaUpdateWrapper<EquBarrel> updateWrapper = new LambdaUpdateWrapper();
|
|
|
+ updateWrapper.set(EquBarrel::getMtrResidue, equRecord.getSpecs()).set(EquBarrel::getExprTime, equRecord.getDate())
|
|
|
+ .eq(EquBarrel::getId, equRecord.getMaterialId());
|
|
|
+ Boolean bool = equBarrelService.update(null, updateWrapper);
|
|
|
+ if(bool){
|
|
|
+ bool = equRecordService.save(equRecord);
|
|
|
+ }
|
|
|
+ return R.success(bool);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|