156 changed files with 11504 additions and 4316 deletions
@ -0,0 +1,75 @@ |
|||
package org.nl.acs.data.controller; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import org.nl.acs.data.domain.Materialbase; |
|||
import org.nl.acs.data.domain.MaterialbaseQuery; |
|||
import org.nl.acs.data.service.IMaterialbaseService; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.acs.point.domain.PointQuery; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 物料基本信息表 前端控制器 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-10 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/api/materialbase") |
|||
public class MaterialbaseController { |
|||
|
|||
@Autowired |
|||
private IMaterialbaseService materialbaseService; |
|||
|
|||
@GetMapping |
|||
@Log("查询物料管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:list')")
|
|||
public ResponseEntity<Object> query(MaterialbaseQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(materialbaseService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增物料管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody Materialbase entity) { |
|||
materialbaseService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改物料管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody Materialbase entity) { |
|||
materialbaseService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除物料管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
materialbaseService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/getBoxIvt") |
|||
@Log("查询所有物料") |
|||
|
|||
public ResponseEntity<Object> getBoxIvt() { |
|||
return new ResponseEntity<>(materialbaseService.getBoxIvt(), HttpStatus.OK); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,69 @@ |
|||
package org.nl.acs.data.domain; |
|||
|
|||
import java.math.BigDecimal; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.io.Serializable; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 物料基本信息表 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-10 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@TableName("materialbase") |
|||
@ApiModel(value="Materialbase对象", description="物料基本信息表") |
|||
public class Materialbase implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "物料标识") |
|||
@TableId |
|||
private String material_id; |
|||
|
|||
@ApiModelProperty(value = "物料编码") |
|||
private String material_code; |
|||
|
|||
@ApiModelProperty(value = "物料名称 ") |
|||
private String material_name; |
|||
|
|||
@ApiModelProperty(value = "基本计量单位") |
|||
private String base_unit_id; |
|||
|
|||
@ApiModelProperty(value = "创建人") |
|||
private Long create_id; |
|||
|
|||
@ApiModelProperty(value = "创建人姓名") |
|||
private String create_name; |
|||
|
|||
@ApiModelProperty(value = "创建时间") |
|||
private String create_time; |
|||
|
|||
@ApiModelProperty(value = "修改人") |
|||
private Long update_optid; |
|||
|
|||
@ApiModelProperty(value = "修改人姓名") |
|||
private String update_optname; |
|||
|
|||
@ApiModelProperty(value = "修改时间") |
|||
private String update_time; |
|||
|
|||
private float qty; |
|||
|
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package org.nl.acs.data.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class MaterialbaseQuery implements Serializable { |
|||
private String search; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package org.nl.acs.data.mapper; |
|||
|
|||
import org.nl.acs.data.domain.Materialbase; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* <p> |
|||
* 物料基本信息表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-10 |
|||
*/ |
|||
public interface MaterialbaseMapper extends BaseMapper<Materialbase> { |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
package org.nl.acs.data.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.fasterxml.jackson.core.JsonProcessingException; |
|||
import org.nl.acs.data.domain.Materialbase; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.data.domain.MaterialbaseQuery; |
|||
import org.nl.acs.data.mapper.MaterialbaseMapper; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.acs.point.domain.PointQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 物料基本信息表 服务类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-10 |
|||
*/ |
|||
public interface IMaterialbaseService extends IService<Materialbase> { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<SchBasePoint> |
|||
*/ |
|||
IPage<Materialbase> queryAll(MaterialbaseQuery whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(Materialbase entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(Materialbase entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
JSONArray getBoxIvt(); |
|||
|
|||
Materialbase findByCode(String code); |
|||
} |
@ -0,0 +1,115 @@ |
|||
package org.nl.acs.data.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.fasterxml.jackson.core.JsonProcessingException; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import org.nl.acs.data.domain.Materialbase; |
|||
import org.nl.acs.data.domain.MaterialbaseQuery; |
|||
import org.nl.acs.data.mapper.MaterialbaseMapper; |
|||
import org.nl.acs.data.service.IMaterialbaseService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 物料基本信息表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-10 |
|||
*/ |
|||
@Service |
|||
public class MaterialbaseServiceImpl extends ServiceImpl<MaterialbaseMapper, Materialbase> implements IMaterialbaseService { |
|||
|
|||
@Autowired |
|||
private MaterialbaseMapper materialbaseMapper; |
|||
|
|||
@Override |
|||
public IPage<Materialbase> queryAll(MaterialbaseQuery whereJson, PageQuery page) { |
|||
IPage<Materialbase> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
LambdaQueryWrapper<Materialbase> materialbaseLambdaQueryWrapper = Wrappers.lambdaQuery(Materialbase.class); |
|||
if (StrUtil.isNotEmpty(whereJson.getSearch())) { |
|||
materialbaseLambdaQueryWrapper.and(wrapper -> { |
|||
wrapper.like(StrUtil.isNotEmpty(whereJson.getSearch()), Materialbase::getMaterial_code, whereJson.getSearch()) |
|||
.or() |
|||
.like(StrUtil.isNotEmpty(whereJson.getSearch()), Materialbase::getMaterial_name, whereJson.getSearch()); |
|||
}); |
|||
} |
|||
pages = materialbaseMapper.selectPage(pages, materialbaseLambdaQueryWrapper); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(Materialbase entity) { |
|||
String material_code = entity.getMaterial_code(); |
|||
Materialbase materialbase = materialbaseMapper.selectOne(new LambdaQueryWrapper<Materialbase>().eq(Materialbase::getMaterial_code, material_code)); |
|||
if (ObjectUtil.isNotEmpty(materialbase)) { |
|||
throw new RuntimeException("存在相同的物料编码"); |
|||
} |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
entity.setMaterial_id(IdUtil.getSnowflake(1, 1).nextId()+""); |
|||
entity.setCreate_id(Long.getLong(currentUserId)); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_optid(Long.getLong(currentUserId)); |
|||
entity.setUpdate_optname(nickName); |
|||
entity.setUpdate_time(now); |
|||
materialbaseMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(Materialbase entity) { |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
entity.setUpdate_optname(nickName); |
|||
entity.setUpdate_time(now); |
|||
entity.setUpdate_optid(Long.getLong(currentUserId)); |
|||
materialbaseMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
materialbaseMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public JSONArray getBoxIvt() { |
|||
List<Materialbase> list = materialbaseMapper.selectList(null); |
|||
if (list != null){ |
|||
ObjectMapper objectMapper = new ObjectMapper(); |
|||
String value = null; |
|||
try { |
|||
value = objectMapper.writeValueAsString(list); |
|||
} catch (JsonProcessingException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return JSON.parseArray(value); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Materialbase findByCode(String code) { |
|||
LambdaQueryWrapper<Materialbase> wrapper = new LambdaQueryWrapper<Materialbase>().eq(Materialbase::getMaterial_code, code); |
|||
return materialbaseMapper.selectOne(wrapper); |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,4 @@ |
|||
package org.nl.acs.ext.wms.rest; |
|||
|
|||
public class AcsToSpxController { |
|||
} |
@ -0,0 +1,31 @@ |
|||
package org.nl.acs.ext.wms.rest; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.ext.wms.service.SpxToAcsService; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/spx") |
|||
@Slf4j |
|||
public class SpxToAcsController { |
|||
@Autowired |
|||
private SpxToAcsService spxToAcsService; |
|||
|
|||
@PostMapping("/task") |
|||
@Log(value = "ACS接收SPX任务") |
|||
@SaIgnore |
|||
public ResponseEntity<Object> createFromWms(@RequestBody String whereJson) { |
|||
return new ResponseEntity<>(spxToAcsService.crateTask(whereJson), HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,4 @@ |
|||
package org.nl.acs.ext.wms.service; |
|||
|
|||
public interface AcsToSpxService { |
|||
} |
@ -0,0 +1,7 @@ |
|||
package org.nl.acs.ext.wms.service; |
|||
|
|||
import java.util.Map; |
|||
|
|||
public interface SpxToAcsService { |
|||
Map<String, Object> crateTask(String whereJson); |
|||
} |
@ -0,0 +1,4 @@ |
|||
package org.nl.acs.ext.wms.service.impl; |
|||
|
|||
public class AcsToSpxServiceImpl { |
|||
} |
@ -0,0 +1,149 @@ |
|||
package org.nl.acs.ext.wms.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.ext.wms.service.SpxToAcsService; |
|||
import org.nl.acs.order.mapper.OrderMapper; |
|||
import org.nl.acs.order.service.OrderDetailService; |
|||
import org.nl.acs.order.service.OrderService; |
|||
import org.nl.acs.order.service.dto.OrderDetailDto; |
|||
import org.nl.acs.order.service.dto.OrderDto; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.acs.product.service.IProductService; |
|||
import org.nl.acs.product.service.IProductdtlService; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.common.utils.CodeUtil; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Optional; |
|||
|
|||
@Service |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class SpxToAcsServiceImpl implements SpxToAcsService { |
|||
|
|||
@Autowired |
|||
private OrderMapper orderMapper; |
|||
|
|||
@Autowired |
|||
private ISchBaseTaskService schBaseTaskService; |
|||
|
|||
@Autowired |
|||
private OrderDetailService orderDetailService; |
|||
|
|||
|
|||
@Override |
|||
public Map<String, Object> crateTask(String whereJson) { |
|||
try { |
|||
JSONArray datas = JSONArray.parseArray(whereJson); |
|||
JSONArray errArr = new JSONArray(); |
|||
String currentNickName = SecurityUtils.getCurrentNickName(); |
|||
String currentTime = DateUtil.now(); |
|||
if (datas.size() > 0) { |
|||
for (int i = 0; i < datas.size(); i++) { |
|||
processSingleTask(datas.getJSONObject(i), errArr, currentNickName, currentTime); |
|||
} |
|||
} |
|||
return buildResultJson(errArr); |
|||
} catch (Exception e) { |
|||
// 记录异常日志
|
|||
log.error("创建工单时发生异常: ", e); |
|||
JSONObject resultJson = new JSONObject(); |
|||
resultJson.put("status", HttpStatus.BAD_REQUEST.value()); |
|||
resultJson.put("message", "操作失败"); |
|||
return resultJson; |
|||
} |
|||
} |
|||
|
|||
|
|||
private void processSingleTask(JSONObject jsonObject, JSONArray errArr, String currentNickName, String currentTime) { |
|||
String id = jsonObject.getString("ID"); |
|||
if (orderMapper.selectById(id) != null) { |
|||
JSONObject jo = new JSONObject(); |
|||
jo.put("ID", id); |
|||
jo.put("message", "已存在对应工单"); |
|||
errArr.add(jo); |
|||
return; |
|||
} |
|||
String productionNr = jsonObject.getString("ProductionNr"); |
|||
String recipeName = jsonObject.getString("RecipeName"); |
|||
String recipeCode = jsonObject.getString("RecipeCode"); |
|||
Float quantity = jsonObject.getFloatValue("Quantity"); |
|||
if (quantity == null) { |
|||
quantity = 0.0f; |
|||
} |
|||
Integer lineID = jsonObject.getIntValue("LineID"); |
|||
if (lineID == null) { |
|||
lineID = 0; |
|||
} |
|||
String startTime = jsonObject.getString("StartTime"); |
|||
JSONArray components = Optional.ofNullable(jsonObject.getJSONArray("Components")).orElse(new JSONArray()); |
|||
List<OrderDetailDto> list = new ArrayList<>(); |
|||
// 工单明细表插入
|
|||
for (int j = 0; j < components.size(); j++) { |
|||
JSONObject jo = components.getJSONObject(j); |
|||
String product_code = jo.getString("ComponentNr"); |
|||
String componentName = jo.getString("ComponentName"); |
|||
Float quantity1 = jo.getFloatValue("Quantity"); |
|||
if (quantity1 == null) { |
|||
quantity1 = 0.0f; |
|||
} |
|||
String unit = jo.getString("Unit"); |
|||
OrderDetailDto orderDetailDto = new OrderDetailDto(); |
|||
orderDetailDto.setMaterial_id(IdUtil.getSnowflake(1, 1).nextId() + "") |
|||
.setSeq_no(j + 1) |
|||
.setMaterial_code(product_code) |
|||
.setWorkorder_id(id) |
|||
.setMfg_order_name(productionNr) |
|||
.setMaterial_name(componentName) |
|||
.setBase_unit_id(unit) |
|||
.setProductin_qty(quantity1) |
|||
.setCreate_by(currentNickName) |
|||
.setCreate_time(currentTime); |
|||
list.add(orderDetailDto); |
|||
} |
|||
orderDetailService.saveBatch(list); |
|||
// 插入工单表
|
|||
OrderDto dto = new OrderDto(); |
|||
dto.setWorkorder_id(id) |
|||
.setResource_name(String.valueOf(lineID)) |
|||
.setMfg_order_name(productionNr) |
|||
.setProduct_name(recipeCode) |
|||
.setDescription(recipeName) |
|||
.setDetail_count(list.size()) |
|||
.setTotal_qty(quantity) |
|||
.setCreate_time(currentTime) |
|||
.setStatus("0") |
|||
.setRealstart_time(startTime) |
|||
.setCreate_name(currentNickName); |
|||
orderMapper.insert(dto); |
|||
} |
|||
|
|||
private JSONObject buildResultJson(JSONArray errArr) { |
|||
JSONObject resultJson = new JSONObject(); |
|||
if (ObjectUtil.isEmpty(errArr)) { |
|||
resultJson.put("status", HttpStatus.OK.value()); |
|||
resultJson.put("message", "操作成功"); |
|||
} else { |
|||
resultJson.put("status", HttpStatus.BAD_REQUEST.value()); |
|||
resultJson.put("message", "操作失败"); |
|||
if (ObjectUtil.isNotEmpty(errArr)) { |
|||
resultJson.put("errArr", errArr); |
|||
} |
|||
} |
|||
return resultJson; |
|||
} |
|||
|
|||
|
|||
} |
@ -1,127 +1,127 @@ |
|||
package org.nl.acs.materialbase.domain; |
|||
|
|||
import org.nl.acs.common.base.CommonModel; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.FieldFill; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.bean.copier.CopyOptions; |
|||
|
|||
import javax.validation.constraints.*; |
|||
import java.math.BigDecimal; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@Accessors(chain = true) |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("acs_materialbase") |
|||
public class Materialbase extends CommonModel<Materialbase> implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
@TableId(type = IdType.ASSIGN_ID) |
|||
private String material_id; |
|||
|
|||
|
|||
@NotBlank |
|||
private String material_code; |
|||
|
|||
|
|||
@NotBlank |
|||
private String material_name; |
|||
|
|||
|
|||
private String material_spec; |
|||
|
|||
|
|||
private String material_model; |
|||
|
|||
|
|||
@NotBlank |
|||
private String base_unit_id; |
|||
|
|||
|
|||
private String print_no; |
|||
|
|||
|
|||
private String len_unit_id; |
|||
|
|||
|
|||
private BigDecimal length; |
|||
|
|||
|
|||
private BigDecimal width; |
|||
|
|||
|
|||
private BigDecimal height; |
|||
|
|||
|
|||
private String weight_unit_id; |
|||
|
|||
|
|||
private BigDecimal gross_weight; |
|||
|
|||
|
|||
private BigDecimal net_weight; |
|||
|
|||
|
|||
private String cubage_unit_id; |
|||
|
|||
|
|||
private BigDecimal cubage; |
|||
|
|||
|
|||
private BigDecimal outer_diameter; |
|||
|
|||
|
|||
private BigDecimal wall_thickness; |
|||
|
|||
|
|||
@NotBlank |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String create_by; |
|||
|
|||
|
|||
@NotBlank |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String create_time; |
|||
|
|||
|
|||
@TableField(fill = FieldFill.INSERT_UPDATE) |
|||
private String update_by; |
|||
|
|||
|
|||
@TableField(fill = FieldFill.INSERT_UPDATE) |
|||
private String update_time; |
|||
|
|||
|
|||
private String is_used_time; |
|||
|
|||
|
|||
@NotBlank |
|||
private String is_used; |
|||
|
|||
|
|||
@NotBlank |
|||
private String is_delete; |
|||
|
|||
public void copyFrom(Materialbase source) { |
|||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); |
|||
} |
|||
} |
|||
//package org.nl.acs.materialbase.domain;
|
|||
//
|
|||
//import org.nl.acs.common.base.CommonModel;
|
|||
//import com.baomidou.mybatisplus.annotation.TableName;
|
|||
//import com.baomidou.mybatisplus.annotation.FieldFill;
|
|||
//import com.baomidou.mybatisplus.annotation.TableField;
|
|||
//import com.baomidou.mybatisplus.annotation.TableId;
|
|||
//import com.baomidou.mybatisplus.annotation.IdType;
|
|||
//
|
|||
//import lombok.AllArgsConstructor;
|
|||
//import lombok.Builder;
|
|||
//import lombok.Data;
|
|||
//import lombok.NoArgsConstructor;
|
|||
//import lombok.EqualsAndHashCode;
|
|||
//import lombok.experimental.Accessors;
|
|||
//import cn.hutool.core.bean.BeanUtil;
|
|||
//import cn.hutool.core.bean.copier.CopyOptions;
|
|||
//
|
|||
//import javax.validation.constraints.*;
|
|||
//import java.math.BigDecimal;
|
|||
//import java.io.Serializable;
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// */
|
|||
//@Data
|
|||
//@Builder
|
|||
//@Accessors(chain = true)
|
|||
//@NoArgsConstructor
|
|||
//@AllArgsConstructor
|
|||
//@EqualsAndHashCode(callSuper = false)
|
|||
//@TableName("acs_materialbase")
|
|||
//public class Materialbase extends CommonModel<Materialbase> implements Serializable {
|
|||
// private static final long serialVersionUID = 1L;
|
|||
//
|
|||
//
|
|||
// @TableId(type = IdType.ASSIGN_ID)
|
|||
// private String material_id;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// private String material_code;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// private String material_name;
|
|||
//
|
|||
//
|
|||
// private String material_spec;
|
|||
//
|
|||
//
|
|||
// private String material_model;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// private String base_unit_id;
|
|||
//
|
|||
//
|
|||
// private String print_no;
|
|||
//
|
|||
//
|
|||
// private String len_unit_id;
|
|||
//
|
|||
//
|
|||
// private BigDecimal length;
|
|||
//
|
|||
//
|
|||
// private BigDecimal width;
|
|||
//
|
|||
//
|
|||
// private BigDecimal height;
|
|||
//
|
|||
//
|
|||
// private String weight_unit_id;
|
|||
//
|
|||
//
|
|||
// private BigDecimal gross_weight;
|
|||
//
|
|||
//
|
|||
// private BigDecimal net_weight;
|
|||
//
|
|||
//
|
|||
// private String cubage_unit_id;
|
|||
//
|
|||
//
|
|||
// private BigDecimal cubage;
|
|||
//
|
|||
//
|
|||
// private BigDecimal outer_diameter;
|
|||
//
|
|||
//
|
|||
// private BigDecimal wall_thickness;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// @TableField(fill = FieldFill.INSERT)
|
|||
// private String create_by;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// @TableField(fill = FieldFill.INSERT)
|
|||
// private String create_time;
|
|||
//
|
|||
//
|
|||
// @TableField(fill = FieldFill.INSERT_UPDATE)
|
|||
// private String update_by;
|
|||
//
|
|||
//
|
|||
// @TableField(fill = FieldFill.INSERT_UPDATE)
|
|||
// private String update_time;
|
|||
//
|
|||
//
|
|||
// private String is_used_time;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// private String is_used;
|
|||
//
|
|||
//
|
|||
// @NotBlank
|
|||
// private String is_delete;
|
|||
//
|
|||
// public void copyFrom(Materialbase source) {
|
|||
// BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
|||
// }
|
|||
//}
|
|||
|
@ -1,94 +1,94 @@ |
|||
package org.nl.acs.materialbase.rest; |
|||
|
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.acs.materialbase.domain.Materialbase; |
|||
import org.nl.acs.materialbase.service.MaterialbaseService; |
|||
import org.nl.acs.materialbase.service.dto.MaterialbaseDto; |
|||
import org.nl.acs.materialbase.service.dto.MaterialbaseQueryParam; |
|||
import org.springframework.data.domain.Pageable; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
|
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
**/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
|
|||
@RequestMapping("/api/materialbase") |
|||
public class MaterialbaseController { |
|||
|
|||
private final MaterialbaseService materialbaseService; |
|||
|
|||
/** |
|||
* 查询物料基本信息 |
|||
* @param query |
|||
* @param pageable |
|||
* @return |
|||
*/ |
|||
@GetMapping |
|||
@Log("查询物料基本信息") |
|||
|
|||
//@PreAuthorize("@el.check('materialbase:list')")
|
|||
public ResponseEntity query(MaterialbaseQueryParam query, Pageable pageable) { |
|||
return new ResponseEntity<>(materialbaseService.queryAll(query, pageable), HttpStatus.OK); |
|||
} |
|||
|
|||
/** |
|||
* 新增物料基本信息 |
|||
* @param resources |
|||
* @return |
|||
*/ |
|||
@PostMapping |
|||
@Log("新增物料基本信息") |
|||
|
|||
//@PreAuthorize("@el.check('materialbase:add')")
|
|||
public ResponseEntity create(@Validated @RequestBody MaterialbaseDto resources) { |
|||
return new ResponseEntity<>(materialbaseService.insert(resources), HttpStatus.CREATED); |
|||
} |
|||
|
|||
/** |
|||
* 修改物料基本信息 |
|||
* @param resources |
|||
* @return |
|||
*/ |
|||
@PutMapping |
|||
@Log("修改物料基本信息") |
|||
|
|||
//@PreAuthorize("@el.check('materialbase:edit')")
|
|||
public ResponseEntity update(@Validated @RequestBody MaterialbaseDto resources) { |
|||
materialbaseService.updateById(resources); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
/** |
|||
* 删除物料基本信息 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping |
|||
@Log("删除物料基本信息") |
|||
|
|||
//@PreAuthorize("@el.check('materialbase:del')")
|
|||
public ResponseEntity delete(@RequestBody Set<String> ids) { |
|||
materialbaseService.removeByIds(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
/* |
|||
@Log("导出物料基本信息") |
|||
|
|||
@GetMapping(value = "/download") |
|||
//@PreAuthorize("@el.check('materialbase:list')")
|
|||
public void download(HttpServletResponse response, MaterialbaseQueryParam query) throws IOException { |
|||
materialbaseService.download(materialbaseService.queryAll(query), response); |
|||
}*/ |
|||
|
|||
} |
|||
//package org.nl.acs.materialbase.rest;
|
|||
//
|
|||
//import org.nl.common.logging.annotation.Log;
|
|||
//import org.nl.acs.materialbase.domain.Materialbase;
|
|||
//import org.nl.acs.materialbase.service.MaterialbaseService;
|
|||
//import org.nl.acs.materialbase.service.dto.MaterialbaseDto;
|
|||
//import org.nl.acs.materialbase.service.dto.MaterialbaseQueryParam;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//import lombok.RequiredArgsConstructor;
|
|||
//import org.springframework.http.HttpStatus;
|
|||
//import org.springframework.http.ResponseEntity;
|
|||
//import org.springframework.validation.annotation.Validated;
|
|||
//import org.springframework.web.bind.annotation.*;
|
|||
//
|
|||
//
|
|||
//import java.util.Set;
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// **/
|
|||
//@RestController
|
|||
//@RequiredArgsConstructor
|
|||
//
|
|||
//@RequestMapping("/api/materialbase")
|
|||
//public class MaterialbaseController {
|
|||
//
|
|||
// private final MaterialbaseService materialbaseService;
|
|||
//
|
|||
// /**
|
|||
// * 查询物料基本信息
|
|||
// * @param query
|
|||
// * @param pageable
|
|||
// * @return
|
|||
// */
|
|||
// @GetMapping
|
|||
// @Log("查询物料基本信息")
|
|||
//
|
|||
// //@PreAuthorize("@el.check('materialbase:list')")
|
|||
// public ResponseEntity query(MaterialbaseQueryParam query, Pageable pageable) {
|
|||
// return new ResponseEntity<>(materialbaseService.queryAll(query, pageable), HttpStatus.OK);
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 新增物料基本信息
|
|||
// * @param resources
|
|||
// * @return
|
|||
// */
|
|||
// @PostMapping
|
|||
// @Log("新增物料基本信息")
|
|||
//
|
|||
// //@PreAuthorize("@el.check('materialbase:add')")
|
|||
// public ResponseEntity create(@Validated @RequestBody MaterialbaseDto resources) {
|
|||
// return new ResponseEntity<>(materialbaseService.insert(resources), HttpStatus.CREATED);
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 修改物料基本信息
|
|||
// * @param resources
|
|||
// * @return
|
|||
// */
|
|||
// @PutMapping
|
|||
// @Log("修改物料基本信息")
|
|||
//
|
|||
// //@PreAuthorize("@el.check('materialbase:edit')")
|
|||
// public ResponseEntity update(@Validated @RequestBody MaterialbaseDto resources) {
|
|||
// materialbaseService.updateById(resources);
|
|||
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
|||
// }
|
|||
//
|
|||
// /**
|
|||
// * 删除物料基本信息
|
|||
// * @param ids
|
|||
// * @return
|
|||
// */
|
|||
// @DeleteMapping
|
|||
// @Log("删除物料基本信息")
|
|||
//
|
|||
// //@PreAuthorize("@el.check('materialbase:del')")
|
|||
// public ResponseEntity delete(@RequestBody Set<String> ids) {
|
|||
// materialbaseService.removeByIds(ids);
|
|||
// return new ResponseEntity<>(HttpStatus.OK);
|
|||
// }
|
|||
//
|
|||
// /*
|
|||
// @Log("导出物料基本信息")
|
|||
//
|
|||
// @GetMapping(value = "/download")
|
|||
// //@PreAuthorize("@el.check('materialbase:list')")
|
|||
// public void download(HttpServletResponse response, MaterialbaseQueryParam query) throws IOException {
|
|||
// materialbaseService.download(materialbaseService.queryAll(query), response);
|
|||
// }*/
|
|||
//
|
|||
//}
|
|||
|
@ -1,89 +1,89 @@ |
|||
package org.nl.acs.materialbase.service; |
|||
|
|||
import org.nl.acs.common.base.PageInfo; |
|||
import org.nl.acs.common.base.CommonService; |
|||
import org.nl.acs.materialbase.domain.Materialbase; |
|||
import org.nl.acs.materialbase.service.dto.MaterialbaseDto; |
|||
import org.nl.acs.materialbase.service.dto.MaterialbaseQueryParam; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
*/ |
|||
public interface MaterialbaseService extends CommonService<Materialbase> { |
|||
|
|||
static final String CACHE_KEY = "materialbase"; |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param query 条件 |
|||
* @param pageable 分页参数 |
|||
* @return PageInfo<MaterialbaseDto> |
|||
*/ |
|||
PageInfo<MaterialbaseDto> queryAll(MaterialbaseQueryParam query, Pageable pageable); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param query 条件参数 |
|||
* @return List<MaterialbaseDto> |
|||
*/ |
|||
List<MaterialbaseDto> queryAll(MaterialbaseQueryParam query); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param id ID |
|||
* @return MaterialbaseDto |
|||
*/ |
|||
Materialbase getById(String id); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param id ID |
|||
* @return MaterialbaseDto |
|||
*/ |
|||
MaterialbaseDto findById(String id); |
|||
|
|||
/** |
|||
* 插入一条新数据。 |
|||
* @param resources |
|||
* @return |
|||
*/ |
|||
int insert(MaterialbaseDto resources); |
|||
|
|||
/** |
|||
* 根据id修改 |
|||
* @param resources |
|||
* @return |
|||
*/ |
|||
int updateById(MaterialbaseDto resources); |
|||
|
|||
/** |
|||
* 根据id删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
int removeById(String id); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
int removeByIds(Set<String> ids); |
|||
|
|||
/** |
|||
* 导出数据 |
|||
* @param all 待导出的数据 |
|||
* @param response / |
|||
* @throws IOException / |
|||
*/ |
|||
// void download(List<MaterialbaseDto> all, HttpServletResponse response) throws IOException;
|
|||
} |
|||
//package org.nl.acs.materialbase.service;
|
|||
//
|
|||
//import org.nl.acs.common.base.PageInfo;
|
|||
//import org.nl.acs.common.base.CommonService;
|
|||
//import org.nl.acs.materialbase.domain.Materialbase;
|
|||
//import org.nl.acs.materialbase.service.dto.MaterialbaseDto;
|
|||
//import org.nl.acs.materialbase.service.dto.MaterialbaseQueryParam;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//
|
|||
//import java.util.List;
|
|||
//import java.util.Set;
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// */
|
|||
//public interface MaterialbaseService extends CommonService<Materialbase> {
|
|||
//
|
|||
// static final String CACHE_KEY = "materialbase";
|
|||
//
|
|||
// /**
|
|||
// * 查询数据分页
|
|||
// *
|
|||
// * @param query 条件
|
|||
// * @param pageable 分页参数
|
|||
// * @return PageInfo<MaterialbaseDto>
|
|||
// */
|
|||
// PageInfo<MaterialbaseDto> queryAll(MaterialbaseQueryParam query, Pageable pageable);
|
|||
//
|
|||
// /**
|
|||
// * 查询所有数据不分页
|
|||
// *
|
|||
// * @param query 条件参数
|
|||
// * @return List<MaterialbaseDto>
|
|||
// */
|
|||
// List<MaterialbaseDto> queryAll(MaterialbaseQueryParam query);
|
|||
//
|
|||
// /**
|
|||
// * 根据ID查询
|
|||
// *
|
|||
// * @param id ID
|
|||
// * @return MaterialbaseDto
|
|||
// */
|
|||
// Materialbase getById(String id);
|
|||
//
|
|||
// /**
|
|||
// * 根据ID查询
|
|||
// *
|
|||
// * @param id ID
|
|||
// * @return MaterialbaseDto
|
|||
// */
|
|||
// MaterialbaseDto findById(String id);
|
|||
//
|
|||
// /**
|
|||
// * 插入一条新数据。
|
|||
// * @param resources
|
|||
// * @return
|
|||
// */
|
|||
// int insert(MaterialbaseDto resources);
|
|||
//
|
|||
// /**
|
|||
// * 根据id修改
|
|||
// * @param resources
|
|||
// * @return
|
|||
// */
|
|||
// int updateById(MaterialbaseDto resources);
|
|||
//
|
|||
// /**
|
|||
// * 根据id删除
|
|||
// * @param id
|
|||
// * @return
|
|||
// */
|
|||
// int removeById(String id);
|
|||
//
|
|||
// /**
|
|||
// * 多选删除
|
|||
// * @param ids
|
|||
// * @return
|
|||
// */
|
|||
// int removeByIds(Set<String> ids);
|
|||
//
|
|||
// /**
|
|||
// * 导出数据
|
|||
// * @param all 待导出的数据
|
|||
// * @param response /
|
|||
// * @throws IOException /
|
|||
// */
|
|||
// // void download(List<MaterialbaseDto> all, HttpServletResponse response) throws IOException;
|
|||
//}
|
|||
|
@ -1,104 +1,104 @@ |
|||
package org.nl.acs.materialbase.service.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import java.sql.Timestamp; |
|||
|
|||
|
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@Accessors(chain = true) |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@EqualsAndHashCode(callSuper = false) |
|||
public class MaterialbaseDto implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
|
|||
private String material_id; |
|||
|
|||
|
|||
private String material_code; |
|||
|
|||
|
|||
private String material_name; |
|||
|
|||
|
|||
private String material_spec; |
|||
|
|||
|
|||
private String material_model; |
|||
|
|||
|
|||
private String base_unit_id; |
|||
|
|||
|
|||
private String print_no; |
|||
|
|||
|
|||
private String len_unit_id; |
|||
|
|||
|
|||
private BigDecimal length; |
|||
|
|||
|
|||
private BigDecimal width; |
|||
|
|||
|
|||
private BigDecimal height; |
|||
|
|||
|
|||
private String weight_unit_id; |
|||
|
|||
|
|||
private BigDecimal gross_weight; |
|||
|
|||
|
|||
private BigDecimal net_weight; |
|||
|
|||
|
|||
private String cubage_unit_id; |
|||
|
|||
|
|||
private BigDecimal cubage; |
|||
|
|||
|
|||
private BigDecimal outer_diameter; |
|||
|
|||
|
|||
private BigDecimal wall_thickness; |
|||
|
|||
|
|||
private String create_by; |
|||
|
|||
|
|||
private String create_time; |
|||
|
|||
|
|||
private String update_by; |
|||
|
|||
|
|||
private String update_time; |
|||
|
|||
|
|||
private String is_used_time; |
|||
|
|||
|
|||
private String is_used; |
|||
|
|||
|
|||
private String is_delete; |
|||
} |
|||
//package org.nl.acs.materialbase.service.dto;
|
|||
//
|
|||
//import lombok.AllArgsConstructor;
|
|||
//import lombok.Builder;
|
|||
//import lombok.Data;
|
|||
//import lombok.NoArgsConstructor;
|
|||
//import lombok.EqualsAndHashCode;
|
|||
//import lombok.experimental.Accessors;
|
|||
//
|
|||
//import java.math.BigDecimal;
|
|||
//import java.io.Serializable;
|
|||
//import java.util.Date;
|
|||
//import java.sql.Timestamp;
|
|||
//
|
|||
//
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// */
|
|||
//@Data
|
|||
//@Builder
|
|||
//@Accessors(chain = true)
|
|||
//@NoArgsConstructor
|
|||
//@AllArgsConstructor
|
|||
//@EqualsAndHashCode(callSuper = false)
|
|||
//public class MaterialbaseDto implements Serializable {
|
|||
// private static final long serialVersionUID = 1L;
|
|||
//
|
|||
//
|
|||
// private String material_id;
|
|||
//
|
|||
//
|
|||
// private String material_code;
|
|||
//
|
|||
//
|
|||
// private String material_name;
|
|||
//
|
|||
//
|
|||
// private String material_spec;
|
|||
//
|
|||
//
|
|||
// private String material_model;
|
|||
//
|
|||
//
|
|||
// private String base_unit_id;
|
|||
//
|
|||
//
|
|||
// private String print_no;
|
|||
//
|
|||
//
|
|||
// private String len_unit_id;
|
|||
//
|
|||
//
|
|||
// private BigDecimal length;
|
|||
//
|
|||
//
|
|||
// private BigDecimal width;
|
|||
//
|
|||
//
|
|||
// private BigDecimal height;
|
|||
//
|
|||
//
|
|||
// private String weight_unit_id;
|
|||
//
|
|||
//
|
|||
// private BigDecimal gross_weight;
|
|||
//
|
|||
//
|
|||
// private BigDecimal net_weight;
|
|||
//
|
|||
//
|
|||
// private String cubage_unit_id;
|
|||
//
|
|||
//
|
|||
// private BigDecimal cubage;
|
|||
//
|
|||
//
|
|||
// private BigDecimal outer_diameter;
|
|||
//
|
|||
//
|
|||
// private BigDecimal wall_thickness;
|
|||
//
|
|||
//
|
|||
// private String create_by;
|
|||
//
|
|||
//
|
|||
// private String create_time;
|
|||
//
|
|||
//
|
|||
// private String update_by;
|
|||
//
|
|||
//
|
|||
// private String update_time;
|
|||
//
|
|||
//
|
|||
// private String is_used_time;
|
|||
//
|
|||
//
|
|||
// private String is_used;
|
|||
//
|
|||
//
|
|||
// private String is_delete;
|
|||
//}
|
|||
|
@ -1,20 +1,20 @@ |
|||
package org.nl.acs.materialbase.service.dto; |
|||
|
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.util.List; |
|||
import java.util.Date; |
|||
|
|||
import org.nl.common.annotation.Query; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
*/ |
|||
@Getter |
|||
@Setter |
|||
public class MaterialbaseQueryParam { |
|||
|
|||
} |
|||
//package org.nl.acs.materialbase.service.dto;
|
|||
//
|
|||
//import lombok.Getter;
|
|||
//import lombok.Setter;
|
|||
//
|
|||
//import java.util.List;
|
|||
//import java.util.Date;
|
|||
//
|
|||
//import org.nl.common.annotation.Query;
|
|||
//import org.springframework.format.annotation.DateTimeFormat;
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// */
|
|||
//@Getter
|
|||
//@Setter
|
|||
//public class MaterialbaseQueryParam {
|
|||
//
|
|||
//}
|
|||
|
@ -1,133 +1,133 @@ |
|||
package org.nl.acs.materialbase.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import lombok.AllArgsConstructor; |
|||
import org.nl.acs.common.base.PageInfo; |
|||
import org.nl.acs.common.base.QueryHelpMybatisPlus; |
|||
import org.nl.acs.common.base.impl.CommonServiceImpl; |
|||
import org.nl.acs.utils.ConvertUtil; |
|||
import org.nl.acs.utils.PageUtil; |
|||
import org.nl.acs.materialbase.domain.Materialbase; |
|||
import org.nl.acs.materialbase.service.MaterialbaseService; |
|||
import org.nl.acs.materialbase.service.dto.MaterialbaseDto; |
|||
import org.nl.acs.materialbase.service.dto.MaterialbaseQueryParam; |
|||
import org.nl.acs.materialbase.service.mapper.MaterialbaseMapper; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.*; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
// @CacheConfig(cacheNames = MaterialbaseService.CACHE_KEY)
|
|||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
|||
public class MaterialbaseServiceImpl extends CommonServiceImpl<MaterialbaseMapper, Materialbase> implements MaterialbaseService { |
|||
|
|||
private final MaterialbaseMapper materialbaseMapper; |
|||
|
|||
@Override |
|||
public PageInfo<MaterialbaseDto> queryAll(MaterialbaseQueryParam query, Pageable pageable) { |
|||
IPage<Materialbase> queryPage = PageUtil.toMybatisPage(pageable); |
|||
IPage<Materialbase> page = materialbaseMapper.selectPage(queryPage, QueryHelpMybatisPlus.getPredicate(query)); |
|||
return ConvertUtil.convertPage(page, MaterialbaseDto.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<MaterialbaseDto> queryAll(MaterialbaseQueryParam query) { |
|||
return ConvertUtil.convertList(materialbaseMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), MaterialbaseDto.class); |
|||
} |
|||
|
|||
@Override |
|||
public Materialbase getById(String id) { |
|||
return materialbaseMapper.selectById(id); |
|||
} |
|||
|
|||
@Override |
|||
|
|||
public MaterialbaseDto findById(String id) { |
|||
return ConvertUtil.convert(getById(id), MaterialbaseDto.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int insert(MaterialbaseDto resources) { |
|||
Materialbase entity = ConvertUtil.convert(resources, Materialbase.class); |
|||
return materialbaseMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int updateById(MaterialbaseDto resources) { |
|||
Materialbase entity = ConvertUtil.convert(resources, Materialbase.class); |
|||
int ret = materialbaseMapper.updateById(entity); |
|||
// delCaches(resources.id);
|
|||
return ret; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int removeByIds(Set<String> ids) { |
|||
// delCaches(ids);
|
|||
return materialbaseMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int removeById(String id) { |
|||
Set<String> set = new HashSet<>(1); |
|||
set.add(id); |
|||
return this.removeByIds(set); |
|||
} |
|||
|
|||
/* |
|||
private void delCaches(String id) { |
|||
redisUtils.delByKey(CACHE_KEY + "::id:", id); |
|||
} |
|||
|
|||
private void delCaches(Set<String> ids) { |
|||
for (String id: ids) { |
|||
delCaches(id); |
|||
} |
|||
}*/ |
|||
|
|||
/* |
|||
@Override |
|||
public void download(List<MaterialbaseDto> all, HttpServletResponse response) throws IOException { |
|||
List<Map<String, Object>> list = new ArrayList<>(); |
|||
for (MaterialbaseDto materialbase : all) { |
|||
Map<String,Object> map = new LinkedHashMap<>(); |
|||
map.put("物料编码", materialbase.getMaterialCode()); |
|||
map.put("物料名称 ", materialbase.getMaterialName()); |
|||
map.put("规格", materialbase.getMaterialSpec()); |
|||
map.put("型号", materialbase.getMaterialModel()); |
|||
map.put("基本计量单位", materialbase.getBaseUnitId()); |
|||
map.put("工程图号", materialbase.getPrintNo()); |
|||
map.put("长度单位", materialbase.getLenUnitId()); |
|||
map.put("物料长度", materialbase.getLength()); |
|||
map.put("物料宽度", materialbase.getWidth()); |
|||
map.put("物料高度", materialbase.getHeight()); |
|||
map.put("重量单位", materialbase.getWeightUnitId()); |
|||
map.put("物料毛重", materialbase.getGrossWeight()); |
|||
map.put("物料净重", materialbase.getNetWeight()); |
|||
map.put("体积单位", materialbase.getCubageUnitId()); |
|||
map.put("物料体积", materialbase.getCubage()); |
|||
map.put("外径", materialbase.getOuterDiameter()); |
|||
map.put("壁厚", materialbase.getWallThickness()); |
|||
map.put("创建者", materialbase.getCreateBy()); |
|||
map.put("创建时间", materialbase.getCreateTime()); |
|||
map.put("修改者", materialbase.getUpdateBy()); |
|||
map.put("修改时间", materialbase.getUpdateTime()); |
|||
map.put("启用时间", materialbase.getIsUsedTime()); |
|||
map.put("是否启用", materialbase.getIsUsed()); |
|||
map.put("是否删除", materialbase.getIsDelete()); |
|||
list.add(map); |
|||
} |
|||
FileUtil.downloadExcel(list, response); |
|||
}*/ |
|||
} |
|||
//package org.nl.acs.materialbase.service.impl;
|
|||
//
|
|||
//import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
//import lombok.AllArgsConstructor;
|
|||
//import org.nl.acs.common.base.PageInfo;
|
|||
//import org.nl.acs.common.base.QueryHelpMybatisPlus;
|
|||
//import org.nl.acs.common.base.impl.CommonServiceImpl;
|
|||
//import org.nl.acs.utils.ConvertUtil;
|
|||
//import org.nl.acs.utils.PageUtil;
|
|||
//import org.nl.acs.materialbase.domain.Materialbase;
|
|||
//import org.nl.acs.materialbase.service.MaterialbaseService;
|
|||
//import org.nl.acs.materialbase.service.dto.MaterialbaseDto;
|
|||
//import org.nl.acs.materialbase.service.dto.MaterialbaseQueryParam;
|
|||
//import org.nl.acs.materialbase.service.mapper.MaterialbaseMapper;
|
|||
//import org.springframework.stereotype.Service;
|
|||
//import org.springframework.transaction.annotation.Propagation;
|
|||
//import org.springframework.transaction.annotation.Transactional;
|
|||
//import org.springframework.data.domain.Pageable;
|
|||
//
|
|||
//import java.util.*;
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// */
|
|||
//@Service
|
|||
//@AllArgsConstructor
|
|||
//// @CacheConfig(cacheNames = MaterialbaseService.CACHE_KEY)
|
|||
//@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
|||
//public class MaterialbaseServiceImpl extends CommonServiceImpl<MaterialbaseMapper, Materialbase> implements MaterialbaseService {
|
|||
//
|
|||
// private final MaterialbaseMapper materialbaseMapper;
|
|||
//
|
|||
// @Override
|
|||
// public PageInfo<MaterialbaseDto> queryAll(MaterialbaseQueryParam query, Pageable pageable) {
|
|||
// IPage<Materialbase> queryPage = PageUtil.toMybatisPage(pageable);
|
|||
// IPage<Materialbase> page = materialbaseMapper.selectPage(queryPage, QueryHelpMybatisPlus.getPredicate(query));
|
|||
// return ConvertUtil.convertPage(page, MaterialbaseDto.class);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public List<MaterialbaseDto> queryAll(MaterialbaseQueryParam query) {
|
|||
// return ConvertUtil.convertList(materialbaseMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), MaterialbaseDto.class);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// public Materialbase getById(String id) {
|
|||
// return materialbaseMapper.selectById(id);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
//
|
|||
// public MaterialbaseDto findById(String id) {
|
|||
// return ConvertUtil.convert(getById(id), MaterialbaseDto.class);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public int insert(MaterialbaseDto resources) {
|
|||
// Materialbase entity = ConvertUtil.convert(resources, Materialbase.class);
|
|||
// return materialbaseMapper.insert(entity);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public int updateById(MaterialbaseDto resources) {
|
|||
// Materialbase entity = ConvertUtil.convert(resources, Materialbase.class);
|
|||
// int ret = materialbaseMapper.updateById(entity);
|
|||
// // delCaches(resources.id);
|
|||
// return ret;
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public int removeByIds(Set<String> ids) {
|
|||
// // delCaches(ids);
|
|||
// return materialbaseMapper.deleteBatchIds(ids);
|
|||
// }
|
|||
//
|
|||
// @Override
|
|||
// @Transactional(rollbackFor = Exception.class)
|
|||
// public int removeById(String id) {
|
|||
// Set<String> set = new HashSet<>(1);
|
|||
// set.add(id);
|
|||
// return this.removeByIds(set);
|
|||
// }
|
|||
//
|
|||
// /*
|
|||
// private void delCaches(String id) {
|
|||
// redisUtils.delByKey(CACHE_KEY + "::id:", id);
|
|||
// }
|
|||
//
|
|||
// private void delCaches(Set<String> ids) {
|
|||
// for (String id: ids) {
|
|||
// delCaches(id);
|
|||
// }
|
|||
// }*/
|
|||
//
|
|||
// /*
|
|||
// @Override
|
|||
// public void download(List<MaterialbaseDto> all, HttpServletResponse response) throws IOException {
|
|||
// List<Map<String, Object>> list = new ArrayList<>();
|
|||
// for (MaterialbaseDto materialbase : all) {
|
|||
// Map<String,Object> map = new LinkedHashMap<>();
|
|||
// map.put("物料编码", materialbase.getMaterialCode());
|
|||
// map.put("物料名称 ", materialbase.getMaterialName());
|
|||
// map.put("规格", materialbase.getMaterialSpec());
|
|||
// map.put("型号", materialbase.getMaterialModel());
|
|||
// map.put("基本计量单位", materialbase.getBaseUnitId());
|
|||
// map.put("工程图号", materialbase.getPrintNo());
|
|||
// map.put("长度单位", materialbase.getLenUnitId());
|
|||
// map.put("物料长度", materialbase.getLength());
|
|||
// map.put("物料宽度", materialbase.getWidth());
|
|||
// map.put("物料高度", materialbase.getHeight());
|
|||
// map.put("重量单位", materialbase.getWeightUnitId());
|
|||
// map.put("物料毛重", materialbase.getGrossWeight());
|
|||
// map.put("物料净重", materialbase.getNetWeight());
|
|||
// map.put("体积单位", materialbase.getCubageUnitId());
|
|||
// map.put("物料体积", materialbase.getCubage());
|
|||
// map.put("外径", materialbase.getOuterDiameter());
|
|||
// map.put("壁厚", materialbase.getWallThickness());
|
|||
// map.put("创建者", materialbase.getCreateBy());
|
|||
// map.put("创建时间", materialbase.getCreateTime());
|
|||
// map.put("修改者", materialbase.getUpdateBy());
|
|||
// map.put("修改时间", materialbase.getUpdateTime());
|
|||
// map.put("启用时间", materialbase.getIsUsedTime());
|
|||
// map.put("是否启用", materialbase.getIsUsed());
|
|||
// map.put("是否删除", materialbase.getIsDelete());
|
|||
// list.add(map);
|
|||
// }
|
|||
// FileUtil.downloadExcel(list, response);
|
|||
// }*/
|
|||
//}
|
|||
|
@ -1,14 +1,14 @@ |
|||
package org.nl.acs.materialbase.service.mapper; |
|||
|
|||
import org.nl.acs.common.base.CommonMapper; |
|||
import org.nl.acs.materialbase.domain.Materialbase; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
/** |
|||
* @author jiaolm |
|||
* @date 2023-05-09 |
|||
*/ |
|||
@Repository |
|||
public interface MaterialbaseMapper extends CommonMapper<Materialbase> { |
|||
|
|||
} |
|||
//package org.nl.acs.materialbase.service.mapper;
|
|||
//
|
|||
//import org.nl.acs.common.base.CommonMapper;
|
|||
//import org.nl.acs.materialbase.domain.Materialbase;
|
|||
//import org.springframework.stereotype.Repository;
|
|||
//
|
|||
///**
|
|||
// * @author jiaolm
|
|||
// * @date 2023-05-09
|
|||
// */
|
|||
//@Repository
|
|||
//public interface MaterialbaseMapper extends CommonMapper<Materialbase> {
|
|||
//
|
|||
//}
|
|||
|
@ -0,0 +1,8 @@ |
|||
package org.nl.acs.order.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.acs.order.service.dto.OrderDetailDto; |
|||
|
|||
|
|||
public interface OrderDetailMapper extends BaseMapper<OrderDetailDto> { |
|||
} |
@ -0,0 +1,20 @@ |
|||
package org.nl.acs.order.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.common.base.CommonMapper; |
|||
import org.nl.acs.order.service.dto.OrderDto; |
|||
import org.nl.acs.order.service.dto.OrderQuery; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Repository |
|||
public interface OrderMapper extends CommonMapper<OrderDto> { |
|||
|
|||
|
|||
List<OrderDto> findList(Map whereJson, Pageable page); |
|||
|
|||
IPage<OrderDto> selectPage(IPage<OrderDto> pages, OrderQuery query); |
|||
} |
@ -0,0 +1,43 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="org.nl.acs.order.mapper.OrderMapper"> |
|||
|
|||
<select id="findList" resultType="org.nl.acs.order.service.dto.OrderDto"> |
|||
select * from acs_workorder |
|||
<where> |
|||
<if test="query.resource_name != null"> |
|||
and resource_name = #{query.resource_name} |
|||
</if> |
|||
<if test="query.status != null"> |
|||
and status = #{query.status} |
|||
</if> |
|||
<if test="query.end_time != null"> |
|||
and create_time = #{query.end_time} |
|||
</if> |
|||
<if test="query.begin_time != null"> |
|||
and create_time = #{query.begin_time} |
|||
</if> |
|||
and is_delete = '0' |
|||
</where> |
|||
order by create_time DESC |
|||
</select> |
|||
<select id="selectPage" resultType="org.nl.acs.order.service.dto.OrderDto"> |
|||
select * from acs_workorder |
|||
<where> |
|||
<if test="query.resource_name != null"> |
|||
and resource_name = #{query.resource_name} |
|||
</if> |
|||
<if test="query.status != null"> |
|||
and status = #{query.status} |
|||
</if> |
|||
<if test="query.end_time != null"> |
|||
and create_time = #{query.end_time} |
|||
</if> |
|||
<if test="query.begin_time != null"> |
|||
and create_time = #{query.begin_time} |
|||
</if> |
|||
and is_delete = '0' |
|||
</where> |
|||
order by create_time DESC |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,96 @@ |
|||
package org.nl.acs.order.rest; |
|||
|
|||
import cn.hutool.core.map.MapUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.order.service.OrderService; |
|||
import org.nl.acs.order.service.dto.OrderDto; |
|||
import org.nl.acs.order.service.dto.OrderQuery; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/order") |
|||
@Slf4j |
|||
public class OrderController { |
|||
|
|||
private final OrderService orderService; |
|||
|
|||
@GetMapping |
|||
@Log("查询工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson,PageQuery page) { |
|||
String resource_name = MapUtil.getStr(whereJson, "resource_name"); |
|||
String status = MapUtil.getStr(whereJson, "status"); |
|||
String begin_time = MapUtil.getStr(whereJson, "begin_time"); |
|||
String end_time = MapUtil.getStr(whereJson, "end_time"); |
|||
OrderQuery query = new OrderQuery(); |
|||
query.setResource_name(resource_name); |
|||
query.setBegin_time(begin_time); |
|||
query.setEnd_time(end_time); |
|||
query.setStatus(status); |
|||
return new ResponseEntity<>(TableDataInfo.build(orderService.queryAll(query, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject whereJson) { |
|||
orderService.create(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody OrderDto dto) { |
|||
orderService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除工序工单") |
|||
|
|||
//@SaCheckPermission("@el.check('rawfoilworkorder:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody String[] ids) { |
|||
orderService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("强制完成") |
|||
|
|||
@PostMapping("/forceFinish") |
|||
public ResponseEntity<Object> forceFinish(@RequestBody JSONObject whereJson) { |
|||
orderService.forceFinish(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("开始") |
|||
|
|||
@PostMapping("/start") |
|||
public ResponseEntity<Object> start(@RequestBody JSONObject whereJson) { |
|||
orderService.start(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/getOutBillDtl") |
|||
@Log("查询明细") |
|||
|
|||
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson) { |
|||
return new ResponseEntity<>(orderService.getOutBillDtl(whereJson), HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
package org.nl.acs.order.rest; |
|||
|
|||
import org.nl.acs.order.service.OrderDetailService; |
|||
import org.nl.acs.order.service.dto.OrderDetailDto; |
|||
import org.nl.acs.order.service.dto.OrderDetailQuery; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Set; |
|||
|
|||
@RestController |
|||
@RequestMapping("/orderDetail") |
|||
public class OrderDetailController { |
|||
@Autowired |
|||
private OrderDetailService orderDetailService; |
|||
|
|||
@GetMapping |
|||
@Log("查询物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:list')")
|
|||
public ResponseEntity<Object> query(OrderDetailQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(orderDetailService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody OrderDetailDto dto) { |
|||
orderDetailService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody OrderDetailDto dto) { |
|||
orderDetailService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
orderDetailService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
package org.nl.acs.order.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.order.service.dto.OrderDetailDto; |
|||
import org.nl.acs.order.service.dto.OrderDetailQuery; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.acs.product.domain.ProductdtlQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.Set; |
|||
|
|||
public interface OrderDetailService extends IService<OrderDetailDto> { |
|||
|
|||
IPage<Productdtl> queryAll(OrderDetailQuery whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(OrderDetailDto entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(OrderDetailDto entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
} |
@ -0,0 +1,94 @@ |
|||
package org.nl.acs.order.service; |
|||
|
|||
import cn.hutool.json.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.common.base.CommonService; |
|||
import org.nl.acs.order.service.dto.OrderDto; |
|||
import org.nl.acs.order.service.dto.OrderQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
public interface OrderService extends CommonService<OrderDto> { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param query 条件 |
|||
* @param pageable 分页参数 |
|||
* @return Map<String, Object> |
|||
*/ |
|||
IPage<OrderDto> queryAll(OrderQuery query, PageQuery pageable); |
|||
|
|||
/** |
|||
* 查询所有数据不分页 |
|||
* |
|||
* @param whereJson 条件参数 |
|||
* @return List<RawfoilworkorderDto> |
|||
*/ |
|||
List<OrderDto> queryAll(Map whereJson); |
|||
|
|||
/** |
|||
* 根据ID查询 |
|||
* |
|||
* @param workorder_id ID |
|||
* @return Rawfoilworkorder |
|||
*/ |
|||
OrderDto findById(Long workorder_id); |
|||
|
|||
/** |
|||
* 根据编码查询 |
|||
* |
|||
* @param code code |
|||
* @return Rawfoilworkorder |
|||
*/ |
|||
OrderDto findByCode(String code); |
|||
|
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void create(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param dto / |
|||
*/ |
|||
void update(OrderDto dto); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(String[] ids); |
|||
|
|||
/** |
|||
* 强制确认 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void forceFinish(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 称重 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void start(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 查询工单明细 |
|||
* |
|||
* @param whereJson / |
|||
* @return |
|||
*/ |
|||
JSONArray getOutBillDtl(Map whereJson); |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package org.nl.acs.order.service.dto; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@TableName("acs_orderdetail") |
|||
@ApiModel(value="Acs_orderdetail对象", description="工单明细表") |
|||
public class OrderDetailDto implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "物料标识") |
|||
@TableId |
|||
private String material_id; |
|||
|
|||
@ApiModelProperty(value = "工单标识") |
|||
private String workorder_id; |
|||
|
|||
@ApiModelProperty(value = "工单编码") |
|||
private String mfg_order_name; |
|||
|
|||
@ApiModelProperty(value = "明细序号") |
|||
private int seq_no; |
|||
|
|||
@ApiModelProperty(value = "物料编码") |
|||
private String material_code; |
|||
|
|||
@ApiModelProperty(value = "物料名称") |
|||
private String material_name; |
|||
|
|||
@ApiModelProperty(value = "物料重量") |
|||
private float productin_qty; |
|||
|
|||
@ApiModelProperty(value = "单位") |
|||
private String base_unit_id; |
|||
|
|||
@ApiModelProperty(value = "创建者") |
|||
private String create_by; |
|||
|
|||
@ApiModelProperty(value = "创建时间") |
|||
private String create_time; |
|||
|
|||
@ApiModelProperty(value = "修改者") |
|||
private String update_by; |
|||
|
|||
@ApiModelProperty(value = "修改时间") |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
} |
@ -0,0 +1,9 @@ |
|||
package org.nl.acs.order.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class OrderDetailQuery { |
|||
private String blurry; |
|||
private String material_id; |
|||
} |
@ -0,0 +1,124 @@ |
|||
package org.nl.acs.order.service.dto; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
|||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
|||
import lombok.*; |
|||
import lombok.experimental.Accessors; |
|||
import org.nl.acs.common.base.CommonModel; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
@Builder |
|||
@Accessors(chain = true) |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("acs_workorder") |
|||
public class OrderDto extends CommonModel<OrderDto> implements Serializable { |
|||
/** 工单标识 */ |
|||
/** |
|||
* 防止精度丢失 |
|||
*/ |
|||
@TableId |
|||
private String workorder_id; |
|||
|
|||
|
|||
/** |
|||
* 机台编码 |
|||
*/ |
|||
private String resource_name; |
|||
|
|||
/** |
|||
* 工单编号 |
|||
*/ |
|||
private String mfg_order_name; |
|||
|
|||
/** |
|||
* 产品编码 |
|||
*/ |
|||
private String product_name; |
|||
|
|||
/** |
|||
* 产品名称 |
|||
*/ |
|||
private String description; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 产品总重量 |
|||
*/ |
|||
private float total_qty; |
|||
|
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private String realstart_time; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private String realend_time; |
|||
|
|||
/** |
|||
* 状态 |
|||
*/ |
|||
private String status; |
|||
|
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_id; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_optid; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_optname; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private String is_delete; |
|||
|
|||
|
|||
/** |
|||
* 点位编码 |
|||
*/ |
|||
private String point_code; |
|||
|
|||
/** |
|||
* 明细数量 |
|||
*/ |
|||
private int detail_count; |
|||
} |
@ -0,0 +1,17 @@ |
|||
package org.nl.acs.order.service.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class OrderQuery implements Serializable { |
|||
private String status; |
|||
private String begin_time; |
|||
private String end_time; |
|||
private String resource_name; |
|||
} |
@ -0,0 +1,37 @@ |
|||
package org.nl.acs.order.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.acs.order.mapper.OrderDetailMapper; |
|||
import org.nl.acs.order.service.OrderDetailService; |
|||
import org.nl.acs.order.service.dto.OrderDetailDto; |
|||
import org.nl.acs.order.service.dto.OrderDetailQuery; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Set; |
|||
|
|||
@Service |
|||
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetailDto> implements OrderDetailService { |
|||
|
|||
@Override |
|||
public IPage<Productdtl> queryAll(OrderDetailQuery whereJson, PageQuery page) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void create(OrderDetailDto entity) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void update(OrderDetailDto entity) { |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
|
|||
} |
|||
} |
@ -0,0 +1,275 @@ |
|||
package org.nl.acs.order.service.impl; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.map.MapUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.json.JSONUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.github.pagehelper.Page; |
|||
import com.github.pagehelper.PageHelper; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.poi.ss.formula.functions.T; |
|||
import org.nl.acs.common.base.impl.CommonServiceImpl; |
|||
import org.nl.acs.data.domain.Materialbase; |
|||
import org.nl.acs.data.service.IMaterialbaseService; |
|||
import org.nl.acs.order.mapper.OrderDetailMapper; |
|||
import org.nl.acs.order.mapper.OrderMapper; |
|||
import org.nl.acs.order.service.OrderService; |
|||
import org.nl.acs.order.service.dto.OrderDetailDto; |
|||
import org.nl.acs.order.service.dto.OrderDto; |
|||
import org.nl.acs.order.service.dto.OrderQuery; |
|||
import org.nl.acs.product.domain.Product; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.acs.sch.task.service.WorkService; |
|||
import org.nl.acs.sch.task.service.dao.Work; |
|||
import org.nl.acs.sch.task.service.dao.mapper.WorkMapper; |
|||
import org.nl.acs.task.domain.Task; |
|||
import org.nl.acs.utils.PageUtil; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.CodeUtil; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
@Slf4j |
|||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
|||
public class OrderServiceImpl extends CommonServiceImpl<OrderMapper, OrderDto> implements OrderService { |
|||
@Autowired |
|||
private OrderMapper orderMapper; |
|||
|
|||
@Autowired |
|||
private OrderDetailMapper orderDetailMapper; |
|||
|
|||
@Autowired |
|||
private WorkService workService; |
|||
|
|||
@Autowired |
|||
private IMaterialbaseService materialbaseService; |
|||
|
|||
|
|||
@Override |
|||
public IPage<OrderDto> queryAll(OrderQuery query, PageQuery page) { |
|||
IPage<OrderDto> pages = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page.getPage() + 1, page.getSize()); |
|||
pages = orderMapper.selectPage(pages, query); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public List<OrderDto> queryAll(Map whereJson) { |
|||
List<OrderDto> list = orderMapper.findList(whereJson, null); |
|||
if (CollUtil.isNotEmpty(list)) { |
|||
return list; |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public OrderDto findById(Long workorder_id) { |
|||
return orderMapper.selectById(workorder_id); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public OrderDto findByCode(String code) { |
|||
LambdaQueryWrapper<OrderDto> wrapper = new LambdaQueryWrapper<OrderDto>() |
|||
.eq(OrderDto::getMfg_order_name, code); |
|||
return orderMapper.selectOne(wrapper); |
|||
} |
|||
|
|||
@Override |
|||
public void create(JSONObject map) { |
|||
JSONArray rows = map.getJSONArray("tableData"); |
|||
map.remove("tableData"); |
|||
OrderDto orderDto = orderMapper.selectById(MapUtil.getStr(map, "workorder_id")); |
|||
if (orderDto != null) { |
|||
throw new BadRequestException("工单已存在!"); |
|||
} |
|||
OrderDto dto = new OrderDto(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId() + ""); |
|||
dto.setMfg_order_name(CodeUtil.getNewCode("ORDER_NO")); |
|||
dto.setProduct_name(CodeUtil.getNewCode("PRODUCT_CODE")); |
|||
dto.setResource_name("A"); |
|||
//todo 后期确定名称需要修改
|
|||
dto.setDescription("1"); |
|||
dto.setStatus("0"); |
|||
dto.setCreate_name(nickName); |
|||
dto.setCreate_time(now); |
|||
dto.setDetail_count(rows.size()); |
|||
//处理工单明细
|
|||
float qtySum = this.insertDtlByRows(dto, rows); |
|||
dto.setTotal_qty(qtySum); |
|||
orderMapper.insert(dto); |
|||
} |
|||
|
|||
private float insertDtlByRows(OrderDto entity, JSONArray rows) { |
|||
float sum = 0; |
|||
for (int i = 0; i < rows.size(); i++) { |
|||
JSONObject json = rows.getJSONObject(i); |
|||
OrderDetailDto orderDetailDto = new OrderDetailDto(); |
|||
orderDetailDto.setMaterial_id(IdUtil.getSnowflake(1, 1).nextId() + "") |
|||
.setSeq_no(i) |
|||
.setMaterial_code(CodeUtil.getNewCode("MATERIAL_NO")) |
|||
.setWorkorder_id(entity.getWorkorder_id()) |
|||
.setMfg_order_name(entity.getMfg_order_name()) |
|||
.setMaterial_name(json.getString("material_name")) |
|||
.setBase_unit_id(json.getString("base_unit_id")) |
|||
.setProductin_qty(json.getFloatValue("qty")) |
|||
.setCreate_by(SecurityUtils.getCurrentNickName()) |
|||
.setCreate_time(DateUtil.now()) |
|||
.setUpdate_by(SecurityUtils.getCurrentNickName()) |
|||
.setUpdate_time(DateUtil.now()); |
|||
orderDetailMapper.insert(orderDetailDto); |
|||
String jsonString = json.getString("qty"); |
|||
float qty = Float.parseFloat(jsonString); |
|||
sum += qty; |
|||
} |
|||
return sum; |
|||
} |
|||
|
|||
@Override |
|||
public void update(OrderDto dto) { |
|||
OrderDto orderDto = orderMapper.selectById(dto.getWorkorder_id()); |
|||
if (orderDto == null) { |
|||
throw new BadRequestException("工单不存在!"); |
|||
} |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
dto.setUpdate_time(now); |
|||
dto.setUpdate_optid(currentUserId); |
|||
dto.setUpdate_optname(nickName); |
|||
orderMapper.updateById(dto); |
|||
} |
|||
|
|||
@Transactional |
|||
@Override |
|||
public void deleteAll(String[] ids) { |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
// 批量查询
|
|||
List<OrderDto> orderDtos = orderMapper.selectBatchIds(Arrays.asList(ids)); |
|||
|
|||
if (CollUtil.isEmpty(orderDtos)) { |
|||
log.warn("未找到对应的工单,无需删除"); |
|||
return; |
|||
} |
|||
|
|||
// 批量查询
|
|||
List<String> mfgOrderNames = orderDtos.stream().map(OrderDto::getMfg_order_name).collect(Collectors.toList()); |
|||
List<OrderDetailDto> orderDetailDtos = orderDetailMapper.selectList(new LambdaQueryWrapper<OrderDetailDto>().in(OrderDetailDto::getMfg_order_name, mfgOrderNames)); |
|||
|
|||
for (OrderDto dto : orderDtos) { |
|||
if (dto == null) { |
|||
log.warn("工单 {} 不存在", dto.getWorkorder_id()); |
|||
continue; |
|||
} |
|||
|
|||
dto.setIs_delete("1"); |
|||
dto.setUpdate_optid(currentUserId); |
|||
dto.setUpdate_optname(nickName); |
|||
dto.setUpdate_time(now); |
|||
|
|||
for (OrderDetailDto orderDetailDto : orderDetailDtos) { |
|||
if (orderDetailDto.getMfg_order_name().equals(dto.getMfg_order_name())) { |
|||
orderDetailDto.setIs_delete("1"); |
|||
orderDetailDto.setUpdate_by(nickName); |
|||
orderDetailDto.setUpdate_time(now); |
|||
orderDetailMapper.updateById(orderDetailDto); |
|||
} |
|||
} |
|||
orderMapper.updateById(dto); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void forceFinish(JSONObject whereJson) { |
|||
String workorder_id = whereJson.getString("workorder_id"); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String currentUsername = SecurityUtils.getCurrentUsername(); |
|||
OrderDto orderDto = orderMapper.selectById(workorder_id); |
|||
orderDto.setStatus("2"); |
|||
orderDto.setRealend_time(DateUtil.now()); |
|||
orderDto.setUpdate_optid(currentUserId); |
|||
orderDto.setUpdate_optname(currentUsername); |
|||
orderDto.setUpdate_time(DateUtil.now()); |
|||
orderMapper.updateById(orderDto); |
|||
} |
|||
|
|||
@Override |
|||
public void start(JSONObject whereJson) { |
|||
String workorder_id = whereJson.getString("workorder_id"); |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String currentUsername = SecurityUtils.getCurrentUsername(); |
|||
OrderDto orderDto = orderMapper.selectById(workorder_id); |
|||
orderDto.setStatus("1"); |
|||
orderDto.setRealstart_time(DateUtil.now()); |
|||
orderDto.setUpdate_optid(currentUserId); |
|||
orderDto.setUpdate_optname(currentUsername); |
|||
orderDto.setUpdate_time(DateUtil.now()); |
|||
//生成配料任务
|
|||
List<OrderDetailDto> list = orderDetailMapper.selectList(Wrappers.lambdaQuery(OrderDetailDto.class).eq(OrderDetailDto::getWorkorder_id, workorder_id)); |
|||
List<Work> works = new ArrayList<>(); |
|||
for (int i = 0; i < list.size(); i++) { |
|||
OrderDetailDto orderDetailDto = list.get(i); |
|||
String material_code = orderDetailDto.getMaterial_code(); |
|||
Materialbase materialbase = materialbaseService.findByCode(material_code); |
|||
if (materialbase == null) { |
|||
throw new BadRequestException("不存在物料编码为" + material_code + "的物料!"); |
|||
} |
|||
int count = (int) Math.ceil((double) orderDetailDto.getProductin_qty() / materialbase.getQty()); |
|||
Work work = new Work(); |
|||
work.setWork_id(IdUtil.getSnowflake(1, 1).nextId() + "") |
|||
.setWork_code(CodeUtil.getNewCode("WORK_CODE")) |
|||
.setStatus("0") |
|||
.setSeq_no(orderDetailDto.getSeq_no()) |
|||
.setMfg_order_name(orderDetailDto.getMfg_order_name()) |
|||
.setMaterial_code(orderDetailDto.getMaterial_code()) |
|||
.setMaterial_name(orderDetailDto.getMaterial_name()) |
|||
.setResource_name(orderDto.getResource_name()) |
|||
.setRequire_num(count) |
|||
.setRemain_num(count) |
|||
.setQty(orderDetailDto.getProductin_qty()) |
|||
.setCreate_by(currentUsername) |
|||
.setCreate_time(DateUtil.now()) |
|||
.setUpdate_by(currentUsername) |
|||
.setUpdate_time(DateUtil.now()); |
|||
works.add(work); |
|||
} |
|||
workService.saveBatch(works); |
|||
orderMapper.updateById(orderDto); |
|||
} |
|||
|
|||
@Override |
|||
public cn.hutool.json.JSONArray getOutBillDtl(Map whereJson) { |
|||
List<OrderDetailDto> list = orderDetailMapper.selectList(Wrappers.lambdaQuery(OrderDetailDto.class).eq(OrderDetailDto::getWorkorder_id, whereJson.get("workorder_id"))); |
|||
if (list != null) { |
|||
return JSONUtil.parseArray(list); |
|||
} |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
package org.nl.acs.point.controller; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.acs.point.domain.PointQuery; |
|||
import org.nl.acs.point.service.IAcsPointService; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 点位基础表 前端控制器 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-27 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/api/point") |
|||
public class AcsPointController { |
|||
@Autowired |
|||
private IAcsPointService pointService; |
|||
|
|||
@GetMapping |
|||
@Log("查询点位管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:list')")
|
|||
public ResponseEntity<Object> query(PointQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(pointService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增点位管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody AcsPoint entity) { |
|||
pointService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改点位管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody AcsPoint entity) { |
|||
pointService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除点位管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
pointService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("启动与禁用") |
|||
@PostMapping("/changeUsed") |
|||
public ResponseEntity<Object> changeUsedOn(@RequestBody JSONObject jsonObject) { |
|||
pointService.changeUsed(jsonObject); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@PostMapping("/getPointList") |
|||
@Log("获取区域下拉框") |
|||
//@SaCheckPermission("@el.check('schBaseRegion:list')")
|
|||
public ResponseEntity<Object> getPointList(@RequestBody(required = false) AcsPoint region) { |
|||
return new ResponseEntity<>(pointService.getPointList(region), HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("锁定与解锁") |
|||
@PostMapping("/changeLock") |
|||
public ResponseEntity<Object> changeLock(@RequestBody JSONObject points) { |
|||
pointService.changeLock(points); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
} |
@ -0,0 +1,66 @@ |
|||
package org.nl.acs.point.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.io.Serializable; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.*; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 点位基础表 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-27 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@TableName("acs_point") |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
@ApiModel(value="AcsPoint对象", description="点位基础表") |
|||
public class AcsPoint implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@TableId(type = IdType.ASSIGN_ID) |
|||
private String point_code; |
|||
|
|||
@ApiModelProperty(value = "点位名称") |
|||
private String point_name; |
|||
|
|||
@ApiModelProperty(value = "点位状态") |
|||
private String point_status; |
|||
|
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
|
|||
@ApiModelProperty(value = "是否启用") |
|||
private Boolean is_used; |
|||
|
|||
@ApiModelProperty(value = "创建人") |
|||
private String create_id; |
|||
|
|||
@ApiModelProperty(value = "创建人") |
|||
private String create_name; |
|||
|
|||
@ApiModelProperty(value = "创建时间") |
|||
private String create_time; |
|||
|
|||
@ApiModelProperty(value = "修改人") |
|||
private String update_id; |
|||
|
|||
@ApiModelProperty(value = "修改人") |
|||
private String update_name; |
|||
|
|||
@ApiModelProperty(value = "修改时间") |
|||
private String update_time; |
|||
|
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package org.nl.acs.point.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class PointQuery implements Serializable { |
|||
private String blurry; |
|||
private String point_status; |
|||
private Boolean is_used; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package org.nl.acs.point.mapper; |
|||
|
|||
|
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* 点位基础表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-27 |
|||
*/ |
|||
@Repository |
|||
public interface AcsPointMapper extends BaseMapper<AcsPoint> { |
|||
|
|||
/** |
|||
* 批量禁用启用 |
|||
* |
|||
* @param pointCodes |
|||
* @param used |
|||
*/ |
|||
void batchChangeUsed(List<String> pointCodes, Boolean used); |
|||
} |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.acs.point.mapper.AcsPointMapper"> |
|||
|
|||
|
|||
|
|||
<update id="batchChangeUsed"> |
|||
UPDATE acs_point |
|||
SET is_used = #{used} |
|||
<where> |
|||
point_code IN |
|||
<foreach collection="pointCodes" item="code" separator="," open="(" close=")"> |
|||
#{code} |
|||
</foreach> |
|||
</where> |
|||
</update> |
|||
</mapper> |
@ -0,0 +1,76 @@ |
|||
package org.nl.acs.point.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.point.domain.PointQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 点位基础表 服务类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-27 |
|||
*/ |
|||
public interface IAcsPointService extends IService<AcsPoint> { |
|||
|
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<SchBasePoint> |
|||
*/ |
|||
IPage<AcsPoint> queryAll(PointQuery whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(AcsPoint entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(AcsPoint entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
/** |
|||
* 改变启用状态 |
|||
* |
|||
* @param jsonObject |
|||
*/ |
|||
void changeUsed(JSONObject jsonObject); |
|||
|
|||
/** |
|||
* 获取点位 |
|||
* |
|||
* @param region |
|||
* @return |
|||
*/ |
|||
List<AcsPoint> getPointList(AcsPoint region); |
|||
|
|||
/** |
|||
* 解锁/上锁 |
|||
* |
|||
* @param points |
|||
*/ |
|||
void changeLock(JSONObject points); |
|||
|
|||
AcsPoint findByCode(String code); |
|||
} |
@ -0,0 +1,132 @@ |
|||
package org.nl.acs.point.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.lang.Assert; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.acs.point.domain.PointQuery; |
|||
import org.nl.acs.point.mapper.AcsPointMapper; |
|||
import org.nl.acs.point.service.IAcsPointService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 点位基础表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-27 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class AcsPointServiceImpl extends ServiceImpl<AcsPointMapper, AcsPoint> implements IAcsPointService { |
|||
|
|||
@Autowired |
|||
private AcsPointMapper pointMapper; |
|||
|
|||
@Override |
|||
public IPage<AcsPoint> queryAll(PointQuery whereJson, PageQuery page) { |
|||
IPage<AcsPoint> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
LambdaQueryWrapper<AcsPoint> acsPointLambdaQueryWrapper = Wrappers.lambdaQuery(AcsPoint.class); |
|||
acsPointLambdaQueryWrapper.eq(StrUtil.isNotEmpty(whereJson.getPoint_status()), AcsPoint::getPoint_status, whereJson.getPoint_status()); |
|||
acsPointLambdaQueryWrapper.eq(ObjectUtil.isNotNull(whereJson.getIs_used()), AcsPoint::getIs_used, whereJson.getIs_used()); |
|||
if (StrUtil.isNotEmpty(whereJson.getBlurry())) { |
|||
acsPointLambdaQueryWrapper.and(wrapper -> { |
|||
wrapper.like(StrUtil.isNotEmpty(whereJson.getBlurry()), AcsPoint::getPoint_code, whereJson.getBlurry()) |
|||
.or() |
|||
.like(StrUtil.isNotEmpty(whereJson.getBlurry()), AcsPoint::getPoint_name, whereJson.getBlurry()); |
|||
}); |
|||
} |
|||
pages = pointMapper.selectPage(pages, acsPointLambdaQueryWrapper); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(AcsPoint entity) { |
|||
String point_code = entity.getPoint_code(); |
|||
AcsPoint pointObj = pointMapper.selectById(point_code); |
|||
if (ObjectUtil.isNotEmpty(pointObj) && !pointObj.getPoint_code().equals(entity.getPoint_code())) { |
|||
throw new BadRequestException("存在相同的点位编码"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
entity.setCreate_id(currentUserId); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
pointMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(AcsPoint entity) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
pointMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
// 真删除
|
|||
pointMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public void changeUsed(JSONObject jsonObject) { |
|||
// 不可能为空
|
|||
JSONArray data = jsonObject.getJSONArray("data"); |
|||
Boolean used = jsonObject.getBoolean("used"); |
|||
Assert.notNull(data, "数据为空!"); |
|||
Assert.notNull(used, "数据为空!"); |
|||
List<AcsPoint> schBasePoints = JSONArray.parseArray(JSONArray.toJSONString(data), AcsPoint.class); |
|||
// 获取所有pointCode
|
|||
List<String> pointCodes = schBasePoints.stream() |
|||
.map(AcsPoint::getPoint_code) |
|||
.collect(Collectors.toList()); |
|||
pointMapper.batchChangeUsed(pointCodes, used); |
|||
} |
|||
|
|||
@Override |
|||
public List<AcsPoint> getPointList(AcsPoint region) { |
|||
if (ObjectUtil.isEmpty(region)) { |
|||
return this.list(); |
|||
} |
|||
return pointMapper.selectList(new LambdaQueryWrapper<>()); |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public void changeLock(JSONObject points) { |
|||
} |
|||
|
|||
@Override |
|||
public AcsPoint findByCode(String code) { |
|||
return pointMapper.selectOne(new LambdaQueryWrapper<AcsPoint>().eq(AcsPoint::getPoint_code, code)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,75 @@ |
|||
package org.nl.acs.product.controller; |
|||
|
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.acs.point.domain.PointQuery; |
|||
import org.nl.acs.product.domain.Product; |
|||
import org.nl.acs.product.domain.ProductQuery; |
|||
import org.nl.acs.product.service.IProductService; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方主表 前端控制器 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-29 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/api/product") |
|||
public class ProductController { |
|||
|
|||
@Autowired |
|||
private IProductService productService; |
|||
|
|||
@GetMapping |
|||
@Log("查询配方管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:list')")
|
|||
public ResponseEntity<Object> query(ProductQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(productService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增配方管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject whereJson) { |
|||
productService.create(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改配方管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:edit')")
|
|||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) { |
|||
productService.update(whereJson); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除配方管理") |
|||
//@SaCheckPermission("@el.check('schBasePoint:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
productService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/getOutBillDtl") |
|||
@Log("查询明细") |
|||
|
|||
public ResponseEntity<Object> getOutBillDtl(@RequestParam Map whereJson) { |
|||
return new ResponseEntity<>(productService.getOutBillDtl(whereJson), HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,71 @@ |
|||
package org.nl.acs.product.controller; |
|||
|
|||
|
|||
|
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.acs.product.domain.ProductdtlQuery; |
|||
import org.nl.acs.product.service.IProductdtlService; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方明细表 前端控制器 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-08 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/productdtl") |
|||
public class ProductdtlController { |
|||
|
|||
@Autowired |
|||
private IProductdtlService productdtlService; |
|||
|
|||
@GetMapping |
|||
@Log("查询物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:list')")
|
|||
public ResponseEntity<Object> query(ProductdtlQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(productdtlService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody Productdtl dto) { |
|||
productdtlService.create(dto); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody Productdtl dto) { |
|||
productdtlService.update(dto); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除物料") |
|||
|
|||
//@PreAuthorize("@el.check('Materialbase:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
productdtlService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,70 @@ |
|||
package org.nl.acs.product.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方主表 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-29 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@TableName("product") |
|||
@ApiModel(value="Product对象", description="配方主表") |
|||
public class Product implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "产品标识") |
|||
@TableId |
|||
private String product_id; |
|||
|
|||
@ApiModelProperty(value = "产品编号") |
|||
private String product_code; |
|||
|
|||
@ApiModelProperty(value = "总重量") |
|||
private float total_qty; |
|||
|
|||
@ApiModelProperty(value = "明细数量") |
|||
private int detail_count; |
|||
|
|||
@ApiModelProperty(value = "备注") |
|||
private String remark; |
|||
|
|||
@ApiModelProperty(value = "创建者") |
|||
private String create_by; |
|||
|
|||
@ApiModelProperty(value = "创建时间") |
|||
private String create_time; |
|||
|
|||
@ApiModelProperty(value = "修改者") |
|||
private String update_by; |
|||
|
|||
@ApiModelProperty(value = "修改时间") |
|||
private String update_time; |
|||
|
|||
@ApiModelProperty(value = "是否删除") |
|||
private String is_delete; |
|||
|
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package org.nl.acs.product.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class ProductQuery implements Serializable { |
|||
private String product_code; |
|||
} |
@ -0,0 +1,69 @@ |
|||
package org.nl.acs.product.domain; |
|||
|
|||
import java.math.BigDecimal; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import java.io.Serializable; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方明细表 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-29 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@TableName("productdtl") |
|||
@ApiModel(value="Productdtl对象", description="配方明细表") |
|||
public class Productdtl implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "产品明细标识") |
|||
@TableId |
|||
private String productdtl_id; |
|||
|
|||
@ApiModelProperty(value = "产品标识") |
|||
private String product_id; |
|||
|
|||
@ApiModelProperty(value = "明细序号") |
|||
private int seq_no; |
|||
|
|||
@ApiModelProperty(value = "物料标识") |
|||
private String material_id; |
|||
|
|||
@ApiModelProperty(value = "物料编码") |
|||
private String material_code; |
|||
|
|||
@ApiModelProperty(value = "物料占比") |
|||
private String material_proportion; |
|||
|
|||
@ApiModelProperty(value = "物料单桶重量") |
|||
private String productin_qty; |
|||
|
|||
@ApiModelProperty(value = "创建者") |
|||
private String create_by; |
|||
|
|||
@ApiModelProperty(value = "创建时间") |
|||
private String create_time; |
|||
|
|||
@ApiModelProperty(value = "修改者") |
|||
private String update_by; |
|||
|
|||
@ApiModelProperty(value = "修改时间") |
|||
private String update_time; |
|||
|
|||
@ApiModelProperty(value = "物料编码") |
|||
private String material_name; |
|||
|
|||
|
|||
} |
@ -0,0 +1,9 @@ |
|||
package org.nl.acs.product.domain; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ProductdtlQuery { |
|||
private String blurry; |
|||
private String productdtl_id; |
|||
} |
@ -0,0 +1,16 @@ |
|||
package org.nl.acs.product.mapper; |
|||
|
|||
import org.nl.acs.product.domain.Product; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方主表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-29 |
|||
*/ |
|||
public interface ProductMapper extends BaseMapper<Product> { |
|||
|
|||
} |
@ -0,0 +1,5 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="org.nl.acs.product.mapper.ProductMapper"> |
|||
|
|||
</mapper> |
@ -0,0 +1,16 @@ |
|||
package org.nl.acs.product.mapper; |
|||
|
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方明细表 Mapper 接口 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-08 |
|||
*/ |
|||
public interface ProductdtlMapper extends BaseMapper<Productdtl> { |
|||
|
|||
} |
@ -0,0 +1,55 @@ |
|||
package org.nl.acs.product.service; |
|||
|
|||
import cn.hutool.json.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.product.domain.Product; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.product.domain.ProductQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方主表 服务类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-29 |
|||
*/ |
|||
public interface IProductService extends IService<Product> { |
|||
|
|||
IPage<Product> queryAll(ProductQuery whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void create(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param whereJson / |
|||
*/ |
|||
void update(JSONObject whereJson); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
|
|||
/** |
|||
* 查询配方明细 |
|||
* |
|||
* @param whereJson / |
|||
* @return |
|||
*/ |
|||
JSONArray getOutBillDtl(Map whereJson); |
|||
} |
@ -0,0 +1,45 @@ |
|||
package org.nl.acs.product.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.product.domain.Product; |
|||
import org.nl.acs.product.domain.ProductQuery; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.product.domain.ProductdtlQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方明细表 服务类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-08 |
|||
*/ |
|||
public interface IProductdtlService extends IService<Productdtl> { |
|||
|
|||
IPage<Productdtl> queryAll(ProductdtlQuery whereJson, PageQuery page); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(Productdtl entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(Productdtl entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
} |
@ -0,0 +1,156 @@ |
|||
package org.nl.acs.product.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.map.MapUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import cn.hutool.json.JSONUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.nl.acs.product.domain.Product; |
|||
import org.nl.acs.product.domain.ProductQuery; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.acs.product.mapper.ProductMapper; |
|||
import org.nl.acs.product.mapper.ProductdtlMapper; |
|||
import org.nl.acs.product.service.IProductService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.CodeUtil; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方主表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-09-29 |
|||
*/ |
|||
@Service |
|||
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService { |
|||
|
|||
@Autowired |
|||
private ProductMapper productMapper; |
|||
@Autowired |
|||
private ProductdtlMapper productdtlMapper; |
|||
|
|||
@Override |
|||
public IPage<Product> queryAll(ProductQuery whereJson, PageQuery page) { |
|||
IPage<Product> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
LambdaQueryWrapper<Product> wrapper = Wrappers.lambdaQuery(Product.class); |
|||
wrapper.eq(StrUtil.isNotEmpty(whereJson.getProduct_code()), Product::getProduct_code, whereJson.getProduct_code()); |
|||
pages = productMapper.selectPage(pages, wrapper); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void create(JSONObject map) { |
|||
JSONArray rows = map.getJSONArray("tableData"); |
|||
map.remove("tableData"); |
|||
Product product = productMapper.selectById(MapUtil.getStr(map, "product_code")); |
|||
if (ObjectUtil.isNotEmpty(product) && !product.getProduct_code().equals(MapUtil.getStr(map, "product_code"))) { |
|||
throw new BadRequestException("存在相同的产品编码"); |
|||
} |
|||
|
|||
Product entity = new Product(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setProduct_id(IdUtil.getSnowflake(1, 1).nextId() + ""); |
|||
entity.setProduct_code(CodeUtil.getNewCode("PRODUCT_CODE")); |
|||
entity.setCreate_by(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_by(nickName); |
|||
entity.setUpdate_time(now); |
|||
entity.setDetail_count(rows.size()); |
|||
//调用明细处理方法
|
|||
float qtySum = this.insertDtlByRows(entity, rows); |
|||
entity.setTotal_qty(qtySum); |
|||
|
|||
productMapper.insert(entity); |
|||
} |
|||
|
|||
private float insertDtlByRows(Product entity, JSONArray rows) { |
|||
|
|||
|
|||
float sum = 0; |
|||
for (int i = 0; i < rows.size(); i++) { |
|||
JSONObject json = rows.getJSONObject(i); |
|||
String jsonString = json.getString("qty"); |
|||
float qty = Float.parseFloat(jsonString); |
|||
sum += qty; |
|||
} |
|||
|
|||
//定义返回数据
|
|||
for (int i = 0; i < rows.size(); i++) { |
|||
JSONObject json = rows.getJSONObject(i); |
|||
Productdtl productdtl = new Productdtl(); |
|||
String jsonString = json.getString("qty"); |
|||
float qty = Float.parseFloat(jsonString); |
|||
float percentage = qty / sum; |
|||
productdtl.setMaterial_proportion(String.valueOf(percentage)); |
|||
productdtl.setProductdtl_id(IdUtil.getSnowflake(1, 1).nextId() + "") |
|||
.setSeq_no(i) |
|||
.setMaterial_id(json.getString("material_id")) |
|||
.setMaterial_code(json.getString("material_code")) |
|||
.setProduct_id(entity.getProduct_id()) |
|||
.setCreate_by(SecurityUtils.getCurrentNickName()) |
|||
.setProductin_qty(json.getString("qty")) |
|||
.setCreate_time(DateUtil.now()) |
|||
.setMaterial_name(json.getString("material_name")) |
|||
.setUpdate_by(SecurityUtils.getCurrentNickName()) |
|||
.setUpdate_time(DateUtil.now()); |
|||
productdtlMapper.insert(productdtl); |
|||
} |
|||
return sum; |
|||
} |
|||
|
|||
@Override |
|||
public void update(JSONObject whereJson) { |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
String product_id = (String) whereJson.get("product_id"); |
|||
Product product = productMapper.selectById(product_id); |
|||
if (product == null) { |
|||
throw new BadRequestException("不存在此产品配方"); |
|||
} |
|||
productdtlMapper.deleteBatchIds(productdtlMapper.selectList(Wrappers.lambdaQuery(Productdtl.class).eq(Productdtl::getProduct_id, product_id))); |
|||
//获取明细
|
|||
JSONArray rows = whereJson.getJSONArray("tableData"); |
|||
this.insertDtlByRows(product, rows); |
|||
product.setUpdate_by(nickName); |
|||
product.setUpdate_time(now); |
|||
productMapper.update(product, Wrappers.lambdaQuery(Product.class).eq(Product::getProduct_id, product_id)); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void deleteAll(Set<String> ids) { |
|||
productMapper.deleteBatchIds(ids); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public cn.hutool.json.JSONArray getOutBillDtl(Map whereJson) { |
|||
List<Productdtl> list = productdtlMapper.selectList(Wrappers.lambdaQuery(Productdtl.class).eq(Productdtl::getProduct_id, whereJson.get("product_id"))); |
|||
if (list != null) { |
|||
return JSONUtil.parseArray(list); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,83 @@ |
|||
package org.nl.acs.product.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import org.nl.acs.product.domain.Productdtl; |
|||
import org.nl.acs.product.domain.ProductdtlQuery; |
|||
import org.nl.acs.product.mapper.ProductMapper; |
|||
import org.nl.acs.product.mapper.ProductdtlMapper; |
|||
import org.nl.acs.product.service.IProductdtlService; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* <p> |
|||
* 配方明细表 服务实现类 |
|||
* </p> |
|||
* |
|||
* @author tuqiang |
|||
* @since 2024-10-08 |
|||
*/ |
|||
@Service |
|||
public class ProductdtlServiceImpl extends ServiceImpl<ProductdtlMapper, Productdtl> implements IProductdtlService { |
|||
|
|||
@Autowired |
|||
private ProductdtlMapper productdtlMapper; |
|||
|
|||
@Override |
|||
public IPage<Productdtl> queryAll(ProductdtlQuery whereJson, PageQuery page) { |
|||
IPage<Productdtl> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
LambdaQueryWrapper<Productdtl> productdtlLambdaQueryWrapper = Wrappers.lambdaQuery(Productdtl.class); |
|||
productdtlLambdaQueryWrapper.eq(StrUtil.isNotEmpty(whereJson.getProductdtl_id()), Productdtl::getProductdtl_id, whereJson.getProductdtl_id()); |
|||
if (StrUtil.isNotEmpty(whereJson.getBlurry())) { |
|||
productdtlLambdaQueryWrapper.and(wrapper -> { |
|||
wrapper.like(StrUtil.isNotEmpty(whereJson.getBlurry()), Productdtl::getProduct_id, whereJson.getBlurry()) |
|||
.or() |
|||
.like(StrUtil.isNotEmpty(whereJson.getBlurry()), Productdtl::getMaterial_code, whereJson.getBlurry()); |
|||
}); |
|||
} |
|||
pages = productdtlMapper.selectPage(pages, productdtlLambdaQueryWrapper); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(Productdtl entity) { |
|||
String productdtl_id = entity.getProductdtl_id(); |
|||
Productdtl productdtlObj = productdtlMapper.selectById(productdtl_id); |
|||
if (ObjectUtil.isNotEmpty(productdtlObj) && !productdtlObj.getProductdtl_id().equals(entity.getProductdtl_id())) { |
|||
throw new BadRequestException("存在相同的配方明细id"); |
|||
} |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_time(now); |
|||
entity.setCreate_by(nickName); |
|||
entity.setUpdate_by(nickName); |
|||
productdtlMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(Productdtl entity) { |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_time(now); |
|||
entity.setUpdate_by(nickName); |
|||
productdtlMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
productdtlMapper.deleteBatchIds(ids); |
|||
} |
|||
} |
@ -0,0 +1,78 @@ |
|||
package org.nl.acs.sch.region.controller; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.region.service.ISchBaseRegionService; |
|||
import org.nl.acs.sch.region.service.dao.SchBaseRegion; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
|
|||
@RequestMapping("/api/schBaseRegion") |
|||
public class SchBaseRegionController { |
|||
@Autowired |
|||
private ISchBaseRegionService regionService; |
|||
|
|||
@GetMapping |
|||
@Log("查询区域管理") |
|||
//@SaCheckPermission("@el.check('schBaseRegion:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(regionService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增区域管理") |
|||
//@SaCheckPermission("@el.check('schBaseRegion:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody SchBaseRegion entity) { |
|||
regionService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改区域管理") |
|||
//@SaCheckPermission("@el.check('schBaseRegion:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody SchBaseRegion entity) { |
|||
regionService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除区域管理") |
|||
//@SaCheckPermission("@el.check('schBaseRegion:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
regionService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/getRegionList") |
|||
@Log("获取区域下拉框") |
|||
//@SaCheckPermission("@el.check('schBaseRegion:list')")
|
|||
public ResponseEntity<Object> getRegionList(@RequestBody(required = false) SchBaseRegion region) { |
|||
return new ResponseEntity<>(regionService.getRegionList(region), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/getPointStatusSelectById") |
|||
@Log("获取点位状态下拉框") |
|||
//@SaCheckPermission("region:add")
|
|||
public ResponseEntity<Object> getPointStatusSelectById(@RequestBody String region_id) { |
|||
return new ResponseEntity<>(regionService.getPointStatusSelectById(region_id), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/getPointTypeSelectById") |
|||
@Log("获取点位类型下拉框") |
|||
|
|||
//@SaCheckPermission("region:add")
|
|||
public ResponseEntity<Object> getPointTypeSelectById(@RequestBody String region_id) { |
|||
return new ResponseEntity<>(regionService.getPointTypeSelectById(region_id), HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,67 @@ |
|||
package org.nl.acs.sch.region.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.sch.region.service.dao.SchBaseRegion; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
public interface ISchBaseRegionService extends IService<SchBaseRegion> { |
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<SchBaseRegion> |
|||
*/ |
|||
IPage<SchBaseRegion> queryAll(Map whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(SchBaseRegion entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(SchBaseRegion entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
/** |
|||
* 区域下拉框 |
|||
* |
|||
* @param region 区域 |
|||
* @return / |
|||
*/ |
|||
List<SchBaseRegion> getRegionList(SchBaseRegion region); |
|||
|
|||
/** |
|||
* 获取点位状态下拉框 |
|||
* |
|||
* @param regionId / |
|||
* @return / |
|||
*/ |
|||
JSONArray getPointStatusSelectById(String regionId); |
|||
|
|||
/** |
|||
* 获取点位类型下拉框 |
|||
* |
|||
* @param regionId / |
|||
* @return / |
|||
*/ |
|||
JSONArray getPointTypeSelectById(String regionId); |
|||
} |
@ -0,0 +1,59 @@ |
|||
package org.nl.acs.sch.region.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("sch_base_region") |
|||
public class SchBaseRegion implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@TableId(value = "region_code", type = IdType.NONE) |
|||
|
|||
private String region_code; |
|||
|
|||
|
|||
private String region_name; |
|||
|
|||
|
|||
private String point_type_explain; |
|||
|
|||
|
|||
private String point_status_explain; |
|||
|
|||
|
|||
private Boolean is_has_workder; |
|||
|
|||
|
|||
private String workshop_code; |
|||
|
|||
|
|||
private String remark; |
|||
|
|||
|
|||
private String create_id; |
|||
|
|||
|
|||
private String create_name; |
|||
|
|||
|
|||
private String create_time; |
|||
|
|||
|
|||
private String update_id; |
|||
|
|||
|
|||
private String update_name; |
|||
|
|||
|
|||
private String update_time; |
|||
|
|||
|
|||
private Integer order_seq; |
|||
} |
@ -0,0 +1,7 @@ |
|||
package org.nl.acs.sch.region.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.acs.sch.region.service.dao.SchBaseRegion; |
|||
|
|||
public interface SchBaseRegionMapper extends BaseMapper<SchBaseRegion> { |
|||
} |
@ -0,0 +1,79 @@ |
|||
package org.nl.acs.sch.region.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
|
|||
public class SchBaseRegionDto implements Serializable { |
|||
/** |
|||
* 区域编码 |
|||
*/ |
|||
private String region_code; |
|||
|
|||
/** |
|||
* 区域名称 |
|||
*/ |
|||
private String region_name; |
|||
|
|||
/** |
|||
* 点位类型说明 |
|||
*/ |
|||
private String point_type_explain; |
|||
|
|||
/** |
|||
* 点位状态说明 |
|||
*/ |
|||
private String point_status_explain; |
|||
|
|||
/** |
|||
* 是否创建工单 |
|||
*/ |
|||
private Boolean is_has_workder; |
|||
|
|||
/** |
|||
* 车间编码 |
|||
*/ |
|||
private String workshop_code; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_id; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_id; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_name; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 顺和号 |
|||
*/ |
|||
private Integer order_seq; |
|||
} |
@ -0,0 +1,130 @@ |
|||
package org.nl.acs.sch.region.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.region.service.ISchBaseRegionService; |
|||
import org.nl.acs.sch.region.service.dao.SchBaseRegion; |
|||
import org.nl.acs.sch.region.service.dao.mapper.SchBaseRegionMapper; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class SchBaseRegionServiceImpl extends ServiceImpl<SchBaseRegionMapper, SchBaseRegion> implements ISchBaseRegionService { |
|||
|
|||
@Autowired |
|||
private SchBaseRegionMapper schBaseRegionMapper; |
|||
|
|||
@Override |
|||
public IPage<SchBaseRegion> queryAll(Map whereJson, PageQuery page) { |
|||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code")) ? whereJson.get("workshop_code").toString() : null; |
|||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null; |
|||
Boolean is_has_workder = ObjectUtil.isNotEmpty(whereJson.get("is_has_workder")) ? Boolean.valueOf(whereJson.get("is_has_workder").toString()) : null; |
|||
LambdaQueryWrapper<SchBaseRegion> lam = new LambdaQueryWrapper<>(); |
|||
lam.eq(ObjectUtil.isNotEmpty(workshop_code), SchBaseRegion::getWorkshop_code, workshop_code) |
|||
.eq(ObjectUtil.isNotEmpty(is_has_workder), SchBaseRegion::getIs_has_workder, is_has_workder) |
|||
.like(ObjectUtil.isNotEmpty(blurry), SchBaseRegion::getRegion_code, blurry) |
|||
.or(ObjectUtil.isNotEmpty(blurry), la -> la.like(SchBaseRegion::getRegion_name, blurry)) |
|||
.orderByAsc(SchBaseRegion::getOrder_seq); |
|||
IPage<SchBaseRegion> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
schBaseRegionMapper.selectPage(pages, lam); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(SchBaseRegion entity) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
entity.setCreate_id(currentUserId); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
schBaseRegionMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(SchBaseRegion entity) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
|
|||
schBaseRegionMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
// 真删除
|
|||
schBaseRegionMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public List<SchBaseRegion> getRegionList(SchBaseRegion region) { |
|||
return schBaseRegionMapper.selectList(new LambdaQueryWrapper<SchBaseRegion>() |
|||
.eq(ObjectUtil.isNotEmpty(region), SchBaseRegion::getIs_has_workder, true) |
|||
.orderByAsc(SchBaseRegion::getOrder_seq)); |
|||
} |
|||
|
|||
@Override |
|||
public JSONArray getPointStatusSelectById(String regionId) { |
|||
/** |
|||
* label,value |
|||
*/ |
|||
SchBaseRegion schBaseRegion = schBaseRegionMapper.selectById(regionId); |
|||
JSONArray res = new JSONArray(); |
|||
String pointStatusExplain = schBaseRegion.getPoint_status_explain(); |
|||
if (ObjectUtil.isEmpty(pointStatusExplain)) { |
|||
return res; |
|||
} |
|||
String[] explain = pointStatusExplain.split(","); |
|||
for (int i = 0; i < explain.length; i++) { |
|||
String[] status = explain[i].split("-"); |
|||
JSONObject point_status = new JSONObject(); |
|||
point_status.put("label", status[1]); |
|||
point_status.put("value", status[0]); |
|||
res.add(point_status); |
|||
} |
|||
return res; |
|||
} |
|||
|
|||
@Override |
|||
public JSONArray getPointTypeSelectById(String regionId) { |
|||
/** |
|||
* label,value |
|||
*/ |
|||
SchBaseRegion schBaseRegion = schBaseRegionMapper.selectById(regionId); |
|||
JSONArray res = new JSONArray(); |
|||
String pointTypeExplain = schBaseRegion.getPoint_type_explain(); |
|||
if (ObjectUtil.isEmpty(pointTypeExplain)) { |
|||
return res; |
|||
} |
|||
String[] explain = pointTypeExplain.split(","); |
|||
for (int i = 0; i < explain.length; i++) { |
|||
String[] types = explain[i].split("-"); |
|||
JSONObject point_type = new JSONObject(); |
|||
point_type.put("label", types[1]); |
|||
point_type.put("value", types[0]); |
|||
res.add(point_type); |
|||
} |
|||
return res; |
|||
} |
|||
} |
@ -0,0 +1,75 @@ |
|||
package org.nl.acs.sch.task.controller; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dto.SchBaseTaskQuery; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
|
|||
@RequestMapping("/api/schBaseTask") |
|||
public class SchBaseTaskController { |
|||
@Autowired |
|||
private ISchBaseTaskService schBaseTaskService; |
|||
|
|||
@GetMapping |
|||
@Log("查询任务管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:list')")
|
|||
public ResponseEntity<Object> query(SchBaseTaskQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增任务管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody SchBaseTask entity) { |
|||
schBaseTaskService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改任务管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody SchBaseTask entity) { |
|||
schBaseTaskService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除任务管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
schBaseTaskService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@GetMapping("/taskStatusList") |
|||
@Log("任务状态下拉框") |
|||
@SaIgnore |
|||
//@SaCheckPermission("@el.check('schBaseTask:list')")
|
|||
public ResponseEntity<Object> getTaskStatusList() { |
|||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskService.getTaskStatusList()), HttpStatus.OK); |
|||
} |
|||
|
|||
@PutMapping("/operation") |
|||
@Log("任务操作") |
|||
//@SaCheckPermission("task:edit")
|
|||
public ResponseEntity<Object> update(@RequestBody Map<String, Object> map) { |
|||
schBaseTaskService.operation(map); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,62 @@ |
|||
package org.nl.acs.sch.task.controller; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
|
|||
@RequestMapping("/api/schBaseTaskconfig") |
|||
public class SchBaseTaskconfigController { |
|||
@Autowired |
|||
private ISchBaseTaskconfigService schBaseTaskconfigService; |
|||
|
|||
@GetMapping |
|||
@Log("查询任务配置") |
|||
//@SaCheckPermission("@el.check('schBaseTaskconfig:list')")
|
|||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(schBaseTaskconfigService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增任务配置") |
|||
//@SaCheckPermission("@el.check('schBaseTaskconfig:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody SchBaseTaskconfig entity) { |
|||
schBaseTaskconfigService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改任务配置") |
|||
//@SaCheckPermission("@el.check('schBaseTaskconfig:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody SchBaseTaskconfig entity) { |
|||
schBaseTaskconfigService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除任务配置") |
|||
//@SaCheckPermission("@el.check('schBaseTaskconfig:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
schBaseTaskconfigService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping("/getTaskConfigList") |
|||
@Log("获取下拉框") |
|||
public ResponseEntity<Object> getTaskConfigList() { |
|||
return new ResponseEntity<>(schBaseTaskconfigService.getTaskConfigList(), HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,86 @@ |
|||
package org.nl.acs.sch.task.controller; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.task.service.WorkService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dao.Work; |
|||
import org.nl.acs.sch.task.service.dto.SchBaseTaskQuery; |
|||
import org.nl.acs.sch.task.service.dto.WorkQuery; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Set; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
|
|||
@RequestMapping("/api/work") |
|||
public class WorkController { |
|||
@Autowired |
|||
private WorkService workService; |
|||
|
|||
@GetMapping |
|||
@Log("查询配料作业管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:list')")
|
|||
public ResponseEntity<Object> query(WorkQuery whereJson, PageQuery page) { |
|||
return new ResponseEntity<>(TableDataInfo.build(workService.queryAll(whereJson, page)), HttpStatus.OK); |
|||
} |
|||
|
|||
@PostMapping |
|||
@Log("新增配料作业管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:add')")
|
|||
public ResponseEntity<Object> create(@Validated @RequestBody Work entity) { |
|||
workService.create(entity); |
|||
return new ResponseEntity<>(HttpStatus.CREATED); |
|||
} |
|||
|
|||
@PutMapping |
|||
@Log("修改配料作业管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:edit')")
|
|||
public ResponseEntity<Object> update(@Validated @RequestBody Work entity) { |
|||
workService.update(entity); |
|||
return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
|||
} |
|||
|
|||
@Log("删除配料作业管理") |
|||
//@SaCheckPermission("@el.check('schBaseTask:del')")
|
|||
@DeleteMapping |
|||
public ResponseEntity<Object> delete(@RequestBody Set<String> ids) { |
|||
workService.deleteAll(ids); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("下发配料作业") |
|||
@PostMapping(value = "/send/{id}") |
|||
public ResponseEntity<Object> send(@RequestBody String id) throws Exception { |
|||
workService.send(id); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("补发配料作业") |
|||
@PostMapping(value = "/reSend") |
|||
public ResponseEntity<Object> reSend(@RequestBody Work dto) throws Exception { |
|||
workService.reSend(dto); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("完成配料作业") |
|||
@PostMapping(value = "/finish/{id}") |
|||
public ResponseEntity<Object> finish(@RequestBody String id) throws Exception { |
|||
workService.finish(id); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("确认配料作业") |
|||
@PostMapping(value = "/confirm/{id}") |
|||
public ResponseEntity<Object> confirm(@RequestBody String id) throws Exception { |
|||
workService.confirm(id); |
|||
return new ResponseEntity<>(HttpStatus.OK); |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
package org.nl.acs.sch.task.service; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dto.SchBaseTaskQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
public interface ISchBaseTaskService extends IService<SchBaseTask> { |
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<SchBaseTask> |
|||
*/ |
|||
IPage<SchBaseTask> queryAll(SchBaseTaskQuery whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(SchBaseTask entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(SchBaseTask entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
/** |
|||
* 任务申请 |
|||
* |
|||
* @param param / |
|||
*/ |
|||
void apply(JSONObject param); |
|||
|
|||
/** |
|||
* 获取任务状态下拉框 |
|||
* |
|||
* @return / |
|||
*/ |
|||
JSONArray getTaskStatusList(); |
|||
|
|||
/** |
|||
* 任务操作 |
|||
* |
|||
* @param param 参数 |
|||
*/ |
|||
void operation(Map<String, Object> param); |
|||
|
|||
/** |
|||
* 获取任务数据 |
|||
* |
|||
* @param taskCode 任务编码 |
|||
* @return / |
|||
*/ |
|||
SchBaseTask getByCode(String taskCode); |
|||
} |
@ -0,0 +1,44 @@ |
|||
package org.nl.acs.sch.task.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
public interface ISchBaseTaskconfigService extends IService<SchBaseTaskconfig> { |
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<SchBaseTaskconfig> |
|||
*/ |
|||
IPage<SchBaseTaskconfig> queryAll(Map whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(SchBaseTaskconfig entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(SchBaseTaskconfig entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
List<SchBaseTaskconfig> getTaskConfigList(); |
|||
} |
@ -0,0 +1,52 @@ |
|||
package org.nl.acs.sch.task.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dao.Work; |
|||
import org.nl.acs.sch.task.service.dto.WorkQuery; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
|
|||
import java.util.Set; |
|||
|
|||
public interface WorkService extends IService<Work> { |
|||
/** |
|||
* 查询数据分页 |
|||
* |
|||
* @param whereJson 条件 |
|||
* @param pageable 分页参数 |
|||
* @return IPage<SchBaseTask> |
|||
*/ |
|||
IPage<Work> queryAll(WorkQuery whereJson, PageQuery pageable); |
|||
|
|||
/** |
|||
* 创建 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void create(Work entity); |
|||
|
|||
/** |
|||
* 编辑 |
|||
* |
|||
* @param entity / |
|||
*/ |
|||
void update(Work entity); |
|||
|
|||
/** |
|||
* 多选删除 |
|||
* |
|||
* @param ids / |
|||
*/ |
|||
void deleteAll(Set<String> ids); |
|||
|
|||
void send(String id); |
|||
|
|||
void reSend(Work dto); |
|||
|
|||
void finish(String id); |
|||
|
|||
void confirm(String id); |
|||
|
|||
Work findByCode(String work_code); |
|||
} |
@ -0,0 +1,124 @@ |
|||
package org.nl.acs.sch.task.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("sch_base_task") |
|||
public class SchBaseTask implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@TableId(value = "task_id", type = IdType.NONE) |
|||
|
|||
private String task_id; |
|||
|
|||
|
|||
private String task_code; |
|||
|
|||
|
|||
private String task_status; |
|||
|
|||
|
|||
private String config_code; |
|||
|
|||
|
|||
private String point_code1; |
|||
|
|||
|
|||
private String point_code2; |
|||
|
|||
|
|||
private String point_code3; |
|||
|
|||
|
|||
private String point_code4; |
|||
|
|||
|
|||
private String group_id; |
|||
|
|||
|
|||
private String vehicle_type; |
|||
|
|||
|
|||
private Integer vehicle_qty; |
|||
|
|||
|
|||
private String vehicle_code; |
|||
|
|||
|
|||
private String vehicle_code2; |
|||
|
|||
|
|||
private String handle_status; |
|||
|
|||
|
|||
private String car_no; |
|||
|
|||
|
|||
private Long task_group_id; |
|||
|
|||
|
|||
private BigDecimal task_group_seq; |
|||
|
|||
|
|||
private String finished_type; |
|||
|
|||
|
|||
private String create_mode; |
|||
|
|||
|
|||
private String acs_trace_id; |
|||
|
|||
|
|||
private String request_param; |
|||
|
|||
|
|||
private String response_param; |
|||
|
|||
|
|||
private String workshop_code; |
|||
|
|||
|
|||
private String ext_group_data; |
|||
|
|||
|
|||
private String remark; |
|||
|
|||
|
|||
private Boolean is_delete; |
|||
|
|||
|
|||
private String create_id; |
|||
|
|||
|
|||
private String create_name; |
|||
|
|||
|
|||
private String create_time; |
|||
|
|||
|
|||
private String update_id; |
|||
|
|||
|
|||
private String update_name; |
|||
|
|||
/** |
|||
* 工单号 |
|||
*/ |
|||
private String mfg_order_name; |
|||
|
|||
|
|||
private String update_time; |
|||
@TableField(exist = false) |
|||
private String config_name; |
|||
@TableField(exist = false) |
|||
private String task_name; |
|||
} |
@ -0,0 +1,146 @@ |
|||
package org.nl.acs.sch.task.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@TableName("sch_base_taskconfig") |
|||
public class SchBaseTaskconfig implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@TableId(value = "config_id", type = IdType.NONE) |
|||
|
|||
private String config_id; |
|||
|
|||
|
|||
private String config_code; |
|||
|
|||
|
|||
private String config_name; |
|||
|
|||
|
|||
private String route_plan_code; |
|||
|
|||
|
|||
private String task_qf_type; |
|||
|
|||
|
|||
private String acs_task_type; |
|||
|
|||
|
|||
private String task_name; |
|||
|
|||
|
|||
private String task_type; |
|||
|
|||
|
|||
private String task_direction; |
|||
|
|||
|
|||
private String priority; |
|||
|
|||
|
|||
private Integer task_create_max_num; |
|||
|
|||
|
|||
private Integer task_issue_max_num; |
|||
|
|||
|
|||
private Boolean is_auto_issue; |
|||
|
|||
|
|||
private String start_region_str; |
|||
|
|||
|
|||
private String next_region_str; |
|||
|
|||
|
|||
private String start_point_pre; |
|||
|
|||
|
|||
private String next_region_pre; |
|||
|
|||
|
|||
private Boolean is_check_workorder; |
|||
|
|||
|
|||
private Boolean is_check_start_lock; |
|||
|
|||
|
|||
private Boolean is_immediate_create; |
|||
|
|||
|
|||
private Boolean is_check_next_lock; |
|||
|
|||
|
|||
private Boolean is_start_auto; |
|||
|
|||
|
|||
private Boolean is_next_auto; |
|||
|
|||
|
|||
private Boolean is_lock_start; |
|||
|
|||
|
|||
private Boolean is_lock_next; |
|||
|
|||
|
|||
private String request_param; |
|||
|
|||
|
|||
private String response_param; |
|||
|
|||
|
|||
private Boolean is_group_congrol_issue_seq; |
|||
|
|||
|
|||
private BigDecimal unfinish_notify_time; |
|||
|
|||
|
|||
private String sql_param; |
|||
|
|||
|
|||
private String workshop_code; |
|||
|
|||
|
|||
private String remark; |
|||
|
|||
|
|||
private Boolean is_used; |
|||
|
|||
|
|||
private Boolean is_delete; |
|||
|
|||
|
|||
private String create_id; |
|||
|
|||
|
|||
private String create_name; |
|||
|
|||
|
|||
private String create_time; |
|||
|
|||
|
|||
private String update_id; |
|||
|
|||
|
|||
private String update_name; |
|||
|
|||
|
|||
private String update_time; |
|||
|
|||
@TableField(exist = false) |
|||
private List<String> start_region_strs; |
|||
|
|||
@TableField(exist = false) |
|||
private List<String> next_region_strs; |
|||
} |
@ -0,0 +1,83 @@ |
|||
package org.nl.acs.sch.task.service.dao; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
import lombok.NoArgsConstructor; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = false) |
|||
@Accessors(chain = true) |
|||
@TableName("work") |
|||
public class Work implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@TableId |
|||
private String work_id; |
|||
|
|||
private String work_code; |
|||
|
|||
|
|||
/* |
|||
* 物料编码 |
|||
*/ |
|||
private String material_code; |
|||
|
|||
/* |
|||
* 工单编码 |
|||
*/ |
|||
private String mfg_order_name; |
|||
|
|||
|
|||
/* |
|||
* 物料名称 |
|||
*/ |
|||
private String material_name; |
|||
|
|||
/* |
|||
* 任务配置编码 |
|||
*/ |
|||
private String resource_name; |
|||
|
|||
private int seq_no; |
|||
|
|||
private float qty; |
|||
|
|||
/* |
|||
* 剩余桶数 |
|||
*/ |
|||
private int remain_num; |
|||
|
|||
/* |
|||
* 需求桶数 |
|||
*/ |
|||
private int require_num; |
|||
|
|||
private String status; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_by; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_by; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package org.nl.acs.sch.task.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dto.SchBaseTaskQuery; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface SchBaseTaskMapper extends BaseMapper<SchBaseTask> { |
|||
|
|||
IPage<SchBaseTask> selectPageLeftJoin(IPage<SchBaseTask> pages, SchBaseTaskQuery whereJson, List<String> collect); |
|||
} |
@ -0,0 +1,44 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="org.nl.acs.sch.task.service.dao.mapper.SchBaseTaskMapper"> |
|||
<select id="selectPageLeftJoin" resultType="org.nl.acs.sch.task.service.dao.SchBaseTask"> |
|||
SELECT |
|||
t.*, |
|||
tc.config_name, |
|||
tc.task_name |
|||
FROM |
|||
`sch_base_task` t |
|||
LEFT JOIN sch_base_taskconfig tc ON tc.config_code = t.config_code |
|||
<where> |
|||
<if test="whereJson.task_code != null"> |
|||
AND t.task_code = #{whereJson.task_code} |
|||
</if> |
|||
<if test="whereJson.config_code != null"> |
|||
AND t.config_code = #{whereJson.config_code} |
|||
</if> |
|||
<if test="whereJson.point_code != null"> |
|||
AND (t.point_code1 LIKE '%${whereJson.point_code}%' |
|||
OR t.point_code2 LIKE '%${whereJson.point_code}%') |
|||
</if> |
|||
<if test="whereJson.unFinished != null"> |
|||
AND t.task_status <![CDATA[<=]]> #{whereJson.unFinished} |
|||
</if> |
|||
<if test="whereJson.vehicle_code != null"> |
|||
AND t.vehicle_code = #{whereJson.vehicle_code} |
|||
</if> |
|||
<if test="whereJson.end_time != null"> |
|||
AND t.create_time <![CDATA[<=]]> #{whereJson.end_time} |
|||
</if> |
|||
<if test="whereJson.begin_time != null"> |
|||
AND t.create_time <![CDATA[>=]]> #{whereJson.begin_time} |
|||
</if> |
|||
<if test="collect != null and collect != ''"> |
|||
AND t.task_status IN |
|||
<foreach collection="collect" item="code" separator="," open="(" close=")"> |
|||
#{code} |
|||
</foreach> |
|||
</if> |
|||
</where> |
|||
ORDER BY t.create_time DESC |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,7 @@ |
|||
package org.nl.acs.sch.task.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTaskconfig; |
|||
|
|||
public interface SchBaseTaskconfigMapper extends BaseMapper<SchBaseTaskconfig> { |
|||
} |
@ -0,0 +1,13 @@ |
|||
package org.nl.acs.sch.task.service.dao.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import org.nl.acs.sch.task.service.dao.Work; |
|||
import org.nl.acs.sch.task.service.dto.WorkQuery; |
|||
import org.springframework.stereotype.Repository; |
|||
|
|||
@Repository |
|||
public interface WorkMapper extends BaseMapper<Work> { |
|||
|
|||
IPage<Work> selectPageLeftJoin(IPage<Work> pages, WorkQuery whereJson); |
|||
} |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="org.nl.acs.sch.task.service.dao.mapper.WorkMapper"> |
|||
<select id="selectPageLeftJoin" resultType="org.nl.acs.sch.task.service.dao.Work"> |
|||
SELECT |
|||
work.work_id, |
|||
work.work_code, |
|||
work.material_code, |
|||
work.mfg_order_name, |
|||
work.material_name, |
|||
work.resource_name, |
|||
work.seq_no, |
|||
work.qty, |
|||
work.remain_num, |
|||
work.require_num, |
|||
work.status, |
|||
work.create_by, |
|||
work.create_time, |
|||
work.update_by, |
|||
work.update_time |
|||
FROM work LEFT JOIN acs_workorder wo ON work.mfg_order_name = wo.mfg_order_name |
|||
<where> |
|||
<if test="whereJson.status != null"> |
|||
AND work.status = #{whereJson.status} |
|||
</if> |
|||
<if test="whereJson.blurry != null"> |
|||
AND (work.resource_name like #{whereJson.blurry} or work.mfg_order_name like #{whereJson.blurry}) |
|||
</if> |
|||
AND wo.status != '2' |
|||
</where> |
|||
ORDER BY work.seq_no asc |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,171 @@ |
|||
package org.nl.acs.sch.task.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
public class SchBaseTaskDto implements Serializable { |
|||
/** |
|||
* 任务标识 |
|||
*/ |
|||
private String task_id; |
|||
|
|||
/** |
|||
* 任务编码 |
|||
*/ |
|||
private String task_code; |
|||
|
|||
|
|||
/** |
|||
* 任务状态 |
|||
*/ |
|||
private String task_status; |
|||
|
|||
/** |
|||
* 配置编码 |
|||
*/ |
|||
private String config_code; |
|||
|
|||
/** |
|||
* 点位1 |
|||
*/ |
|||
private String point_code1; |
|||
|
|||
/** |
|||
* 点位2 |
|||
*/ |
|||
private String point_code2; |
|||
|
|||
/** |
|||
* 点位3 |
|||
*/ |
|||
private String point_code3; |
|||
|
|||
/** |
|||
* 点位4 |
|||
*/ |
|||
private String point_code4; |
|||
|
|||
|
|||
private String group_id; |
|||
|
|||
/** |
|||
* 载具类型 |
|||
*/ |
|||
private String vehicle_type; |
|||
|
|||
/** |
|||
* 载具数量 |
|||
*/ |
|||
private BigDecimal vehicle_qty; |
|||
|
|||
/** |
|||
* 载具编码 |
|||
*/ |
|||
private String vehicle_code; |
|||
|
|||
/** |
|||
* 处理状态 |
|||
*/ |
|||
private String handle_status; |
|||
|
|||
/** |
|||
* 车号 |
|||
*/ |
|||
private String car_no; |
|||
|
|||
|
|||
/** |
|||
* 任务组标识 |
|||
*/ |
|||
private Long task_group_id; |
|||
|
|||
/** |
|||
* 任务组顺序号 |
|||
*/ |
|||
private BigDecimal task_group_seq; |
|||
|
|||
/** |
|||
* 任务完成类型 |
|||
*/ |
|||
private String finished_type; |
|||
|
|||
/** |
|||
* 生成方式 |
|||
*/ |
|||
private String create_mode; |
|||
|
|||
/** |
|||
* 链路标识 |
|||
*/ |
|||
private String acs_trace_id; |
|||
|
|||
/** |
|||
* 生成任务的请求参数 |
|||
*/ |
|||
private String request_param; |
|||
|
|||
/** |
|||
* 下发任务的请求参数 |
|||
*/ |
|||
private String response_param; |
|||
|
|||
/** |
|||
* 车间编码 |
|||
*/ |
|||
private String workshop_code; |
|||
|
|||
/** |
|||
* 额外组盘信息 |
|||
*/ |
|||
private String ext_group_data; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private Boolean is_delete; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_id; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_id; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_name; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
|
|||
/** |
|||
* 工单号 |
|||
*/ |
|||
private String mfg_order_name; |
|||
|
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package org.nl.acs.sch.task.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class SchBaseTaskQuery implements Serializable { |
|||
private String task_code; |
|||
private String vehicle_code; |
|||
private String point_code; |
|||
private String begin_time; |
|||
private String end_time; |
|||
private String more_task_status; |
|||
private String unFinished; |
|||
|
|||
private String config_code; |
|||
} |
@ -0,0 +1,209 @@ |
|||
package org.nl.acs.sch.task.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
public class SchBaseTaskconfigDto implements Serializable { |
|||
/** |
|||
* 配置标识 |
|||
*/ |
|||
private String config_id; |
|||
|
|||
/** |
|||
* 配置编码 |
|||
*/ |
|||
private String config_code; |
|||
|
|||
/** |
|||
* 配置名称 |
|||
*/ |
|||
private String config_name; |
|||
|
|||
/** |
|||
* 路由编码 |
|||
*/ |
|||
private String route_plan_code; |
|||
|
|||
/** |
|||
* 任务取放类型 |
|||
*/ |
|||
private String task_qf_type; |
|||
|
|||
/** |
|||
* acs任务类型 |
|||
*/ |
|||
private String acs_task_type; |
|||
|
|||
/** |
|||
* 任务名字 |
|||
*/ |
|||
private String task_name; |
|||
|
|||
/** |
|||
* 任务类型 |
|||
*/ |
|||
private String task_type; |
|||
|
|||
/** |
|||
* 优先级 |
|||
*/ |
|||
private String priority; |
|||
|
|||
/** |
|||
* 任务方向 |
|||
**/ |
|||
private String task_direction; |
|||
|
|||
/** |
|||
* 允许最大任务生成数 |
|||
*/ |
|||
private Integer task_create_max_num; |
|||
|
|||
/** |
|||
* 允许最大任务下发数 |
|||
*/ |
|||
private Integer task_issue_max_num; |
|||
|
|||
/** |
|||
* 是否自动下发 |
|||
*/ |
|||
private Boolean is_auto_issue; |
|||
|
|||
/** |
|||
* 起点区域配置 |
|||
*/ |
|||
private String start_region_str; |
|||
|
|||
/** |
|||
* 终点区域配置 |
|||
*/ |
|||
private String next_region_str; |
|||
|
|||
/** |
|||
* 起点点位前缀 |
|||
*/ |
|||
private String start_point_pre; |
|||
|
|||
/** |
|||
* 终点点位前缀 |
|||
*/ |
|||
private String next_region_pre; |
|||
|
|||
/** |
|||
* 是否校验工单 |
|||
*/ |
|||
private Boolean is_check_workorder; |
|||
|
|||
/** |
|||
* 是否判断起点锁定 |
|||
*/ |
|||
private Boolean is_check_start_lock; |
|||
|
|||
/** |
|||
* 是否立即创建 |
|||
*/ |
|||
private Boolean is_immediate_create; |
|||
|
|||
/** |
|||
* 是否判断终点锁定 |
|||
*/ |
|||
private Boolean is_check_next_lock; |
|||
|
|||
/** |
|||
* 是否起点自动 |
|||
*/ |
|||
private Boolean is_start_auto; |
|||
|
|||
/** |
|||
* 是否终点自动 |
|||
*/ |
|||
private Boolean is_next_auto; |
|||
|
|||
/** |
|||
* 是否锁定起点 |
|||
*/ |
|||
private Boolean is_lock_start; |
|||
|
|||
/** |
|||
* 是否锁定终点 |
|||
*/ |
|||
private Boolean is_lock_next; |
|||
|
|||
/** |
|||
* 生成任务的请求参数 |
|||
*/ |
|||
private String request_param; |
|||
|
|||
/** |
|||
* 下发任务的请求参数 |
|||
*/ |
|||
private String response_param; |
|||
|
|||
/** |
|||
* 是否按组控制下发顺序 |
|||
*/ |
|||
private Boolean is_group_congrol_issue_seq; |
|||
|
|||
/** |
|||
* 任务未完成通知时间数 |
|||
*/ |
|||
private BigDecimal unfinish_notify_time; |
|||
|
|||
/** |
|||
* sql配置 |
|||
*/ |
|||
private String sql_param; |
|||
|
|||
/** |
|||
* 车间编码 |
|||
*/ |
|||
private String workshop_code; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private String remark; |
|||
|
|||
/** |
|||
* 是否启用 |
|||
*/ |
|||
private Boolean is_used; |
|||
|
|||
/** |
|||
* 是否删除 |
|||
*/ |
|||
private Boolean is_delete; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_id; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_name; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_id; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_name; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
} |
@ -0,0 +1,8 @@ |
|||
package org.nl.acs.sch.task.service.dto; |
|||
|
|||
|
|||
import org.nl.acs.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.common.domain.query.BaseQuery; |
|||
|
|||
public class SchBaseTaskconfigQuery extends BaseQuery<SchBaseTaskconfig> { |
|||
} |
@ -0,0 +1,69 @@ |
|||
package org.nl.acs.sch.task.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class WorkDto implements Serializable { |
|||
private String work_id; |
|||
|
|||
private String work_code; |
|||
|
|||
/* |
|||
* 物料编码 |
|||
*/ |
|||
private String material_code; |
|||
|
|||
/* |
|||
* 工单编码 |
|||
*/ |
|||
private String mfg_order_name; |
|||
|
|||
|
|||
/* |
|||
* 物料名称 |
|||
*/ |
|||
private String material_name; |
|||
|
|||
/* |
|||
* 任务配置编码 |
|||
*/ |
|||
private String resource_name; |
|||
|
|||
private int seq_no; |
|||
|
|||
private float qty; |
|||
|
|||
/* |
|||
* 剩余桶数 |
|||
*/ |
|||
private String remain_num; |
|||
|
|||
/* |
|||
* 需求桶数 |
|||
*/ |
|||
private String require_num; |
|||
|
|||
private String status; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String create_by; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private String create_time; |
|||
|
|||
/** |
|||
* 修改人 |
|||
*/ |
|||
private String update_by; |
|||
|
|||
/** |
|||
* 修改时间 |
|||
*/ |
|||
private String update_time; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package org.nl.acs.sch.task.service.dto; |
|||
|
|||
import lombok.Data; |
|||
import org.nl.acs.sch.task.service.dao.Work; |
|||
import org.nl.common.domain.query.BaseQuery; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class WorkQuery implements Serializable { |
|||
private String blurry; |
|||
private String status; |
|||
} |
@ -0,0 +1,170 @@ |
|||
package org.nl.acs.sch.task.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.lang.Assert; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dao.mapper.SchBaseTaskMapper; |
|||
import org.nl.acs.sch.task.service.dao.mapper.SchBaseTaskconfigMapper; |
|||
import org.nl.acs.sch.task.service.dto.SchBaseTaskQuery; |
|||
import org.nl.acs.sch.task_manage.AbstractTask; |
|||
import org.nl.acs.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.acs.sch.task_manage.task.tasks.TaskFactory; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class SchBaseTaskServiceImpl extends ServiceImpl<SchBaseTaskMapper, SchBaseTask> implements ISchBaseTaskService { |
|||
@Autowired |
|||
private SchBaseTaskMapper schBaseTaskMapper; |
|||
@Autowired |
|||
private SchBaseTaskconfigMapper schBaseTaskconfigMapper; |
|||
|
|||
@Autowired |
|||
private TaskFactory taskFactory; |
|||
|
|||
@Override |
|||
public IPage<SchBaseTask> queryAll(SchBaseTaskQuery whereJson, PageQuery page) { |
|||
List<String> collect = ObjectUtil.isNotEmpty(whereJson.getMore_task_status()) |
|||
? Arrays.stream(whereJson.getMore_task_status().split(",")).collect(Collectors.toList()) : null; |
|||
if (collect != null) { |
|||
if (collect.contains(TaskStatus.UNFINISHED.getCode())) { |
|||
collect = null; |
|||
whereJson.setUnFinished(TaskStatus.EXECUTING.getCode()); |
|||
} |
|||
} |
|||
IPage<SchBaseTask> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
pages = schBaseTaskMapper.selectPageLeftJoin(pages, whereJson, collect); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(SchBaseTask entity) { |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
Assert.notNull(entity.getTask_status(), "任务状态不能为空!"); |
|||
|
|||
entity.setTask_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
entity.setTask_code(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
entity.setCreate_id(currentUserId); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
schBaseTaskMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(SchBaseTask entity) { |
|||
SchBaseTask dto = schBaseTaskMapper.selectById(entity.getTask_code()); |
|||
if (dto == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
|
|||
schBaseTaskMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
// 真删除
|
|||
schBaseTaskMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public void apply(JSONObject param) { |
|||
/** |
|||
* 参数:设备编号(确定的点), 任务类型, 载具编码 |
|||
* hint: 根据任务类型来判断校验 |
|||
*/ |
|||
String configCode = param.getString("config_code"); |
|||
// 校验设备编码
|
|||
AbstractTask task = taskFactory.getTask(configCode); |
|||
// 执行创建任务
|
|||
task.apply(param); |
|||
} |
|||
|
|||
@Override |
|||
public JSONArray getTaskStatusList() { |
|||
TaskStatus[] values = TaskStatus.values(); |
|||
JSONArray arr = new JSONArray(); |
|||
for (TaskStatus value : values) { |
|||
JSONObject json = new JSONObject(); |
|||
json.put("code", value.getCode()); |
|||
json.put("name", value.getName()); |
|||
arr.add(json); |
|||
} |
|||
return arr; |
|||
} |
|||
|
|||
@Override |
|||
public void operation(Map<String, Object> param) { |
|||
String task_code = ObjectUtil.isNotEmpty(param.get("task_code")) ? param.get("task_code").toString() : null; |
|||
String method_name = ObjectUtil.isNotEmpty(param.get("method_name")) ? param.get("method_name").toString() : null; |
|||
String config_code = ObjectUtil.isNotEmpty(param.get("config_code")) ? param.get("config_code").toString() : null; |
|||
if (ObjectUtil.isEmpty(task_code) || ObjectUtil.isEmpty(method_name) || ObjectUtil.isEmpty(config_code)) { |
|||
throw new BadRequestException("操作失败"); |
|||
} |
|||
// 根据标识找到任务
|
|||
SchBaseTask taskOne = this.getByCode(task_code); |
|||
if (Integer.parseInt(taskOne.getTask_status()) >= Integer.parseInt(TaskStatus.FINISHED.getCode())) { |
|||
throw new BadRequestException("任务已完成或已取消!"); |
|||
} |
|||
// 根据配置去工厂类获得类对象
|
|||
String processing_class = config_code; |
|||
String message = ""; |
|||
// 根据任务类型获取对应的任务操作类
|
|||
AbstractTask abstractTask = taskFactory.getTask(processing_class); |
|||
// 调用每个任务类的method_name()强制结束方法
|
|||
JSONObject result; |
|||
switch (method_name) { |
|||
case "immediateNotifyAcs": |
|||
//
|
|||
break; |
|||
// 强制完成
|
|||
case "forceFinish": |
|||
abstractTask.forceFinish(task_code); |
|||
break; |
|||
case "cancel": |
|||
abstractTask.cancel(task_code); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public SchBaseTask getByCode(String taskCode) { |
|||
LambdaQueryWrapper<SchBaseTask> lam = new QueryWrapper<SchBaseTask>().lambda(); |
|||
lam.eq(SchBaseTask::getTask_code, taskCode); |
|||
return this.getOne(lam); |
|||
} |
|||
} |
@ -0,0 +1,131 @@ |
|||
package org.nl.acs.sch.task.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTaskconfig; |
|||
import org.nl.acs.sch.task.service.dao.mapper.SchBaseTaskconfigMapper; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.Set; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class SchBaseTaskconfigServiceImpl extends ServiceImpl<SchBaseTaskconfigMapper, SchBaseTaskconfig> implements ISchBaseTaskconfigService { |
|||
|
|||
@Autowired |
|||
private SchBaseTaskconfigMapper schBaseTaskconfigMapper; |
|||
|
|||
@Override |
|||
public IPage<SchBaseTaskconfig> queryAll(Map whereJson, PageQuery page) { |
|||
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? whereJson.get("blurry").toString() : null; |
|||
String workshop_code = ObjectUtil.isNotEmpty(whereJson.get("workshop_code")) ? whereJson.get("workshop_code").toString() : null; |
|||
LambdaQueryWrapper<SchBaseTaskconfig> lam = new LambdaQueryWrapper<>(); |
|||
lam.like(ObjectUtil.isNotEmpty(blurry), SchBaseTaskconfig::getConfig_name, blurry) |
|||
.or(ObjectUtil.isNotEmpty(blurry), la -> la.like( SchBaseTaskconfig::getConfig_code, blurry)) |
|||
.eq(ObjectUtil.isNotEmpty(workshop_code), SchBaseTaskconfig::getWorkshop_code, workshop_code); |
|||
IPage<SchBaseTaskconfig> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
schBaseTaskconfigMapper.selectPage(pages, lam); |
|||
pages.getRecords().forEach(config -> { |
|||
if (ObjectUtil.isNotEmpty(config.getStart_region_str())) { |
|||
config.setStart_region_strs(Arrays.asList(config.getStart_region_str().split(","))); |
|||
} |
|||
if (ObjectUtil.isNotEmpty(config.getNext_region_str())) { |
|||
config.setNext_region_strs(Arrays.asList(config.getNext_region_str().split(","))); |
|||
} |
|||
}); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(SchBaseTaskconfig entity) { |
|||
SchBaseTaskconfig schBaseTaskconfig = schBaseTaskconfigMapper.selectOne(new LambdaQueryWrapper<SchBaseTaskconfig>().eq(SchBaseTaskconfig::getConfig_code, entity.getConfig_code())); |
|||
if (ObjectUtil.isNotEmpty(schBaseTaskconfig)) { |
|||
throw new BadRequestException("任务配置【" + entity.getConfig_code() + "】已存在!"); |
|||
} |
|||
|
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
|
|||
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs())) { |
|||
throw new BadRequestException("起点区域和终点区域不能同时为空!"); |
|||
} |
|||
|
|||
if (ObjectUtil.isNotEmpty(entity.getStart_region_strs())) { |
|||
// 起点区域配置
|
|||
String startRegion = String.join(",", entity.getStart_region_strs()); |
|||
entity.setStart_region_str(startRegion); |
|||
} |
|||
|
|||
if (ObjectUtil.isNotEmpty(entity.getNext_region_strs())) { |
|||
// 终点区域配置
|
|||
String nextRegion = String.join(",", entity.getNext_region_strs()); |
|||
entity.setNext_region_str(nextRegion); |
|||
} |
|||
|
|||
entity.setConfig_id(IdUtil.getSnowflake(1, 1).nextIdStr()); |
|||
entity.setCreate_id(currentUserId); |
|||
entity.setCreate_name(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
schBaseTaskconfigMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(SchBaseTaskconfig entity) { |
|||
SchBaseTaskconfig dto = schBaseTaskconfigMapper.selectById(entity.getConfig_id()); |
|||
if (dto == null) { |
|||
throw new BadRequestException("被删除或无权限,操作失败!"); |
|||
} |
|||
if (ObjectUtil.isAllEmpty(entity.getStart_region_strs(), entity.getNext_region_strs())) { |
|||
throw new BadRequestException("起点区域和终点区域不能同时为空!"); |
|||
} |
|||
|
|||
if (ObjectUtil.isNotEmpty(entity.getStart_region_strs())) { |
|||
// 起点区域配置
|
|||
String startRegion = String.join(",", entity.getStart_region_strs()); |
|||
entity.setStart_region_str(startRegion); |
|||
} |
|||
|
|||
if (ObjectUtil.isNotEmpty(entity.getNext_region_strs())) { |
|||
// 终点区域配置
|
|||
String nextRegion = String.join(",", entity.getNext_region_strs()); |
|||
entity.setNext_region_str(nextRegion); |
|||
} |
|||
String currentUserId = SecurityUtils.getCurrentUserId(); |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_id(currentUserId); |
|||
entity.setUpdate_name(nickName); |
|||
entity.setUpdate_time(now); |
|||
|
|||
schBaseTaskconfigMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
// 真删除
|
|||
schBaseTaskconfigMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public List<SchBaseTaskconfig> getTaskConfigList() { |
|||
return this.list(); |
|||
} |
|||
} |
@ -0,0 +1,199 @@ |
|||
package org.nl.acs.sch.task.service.impl; |
|||
|
|||
import cn.hutool.core.date.DateUtil; |
|||
import cn.hutool.core.util.IdUtil; |
|||
import cn.hutool.core.util.ObjectUtil; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.common.base.CommonFinalParam; |
|||
import org.nl.acs.order.service.OrderService; |
|||
import org.nl.acs.order.service.dto.OrderDto; |
|||
import org.nl.acs.point.domain.AcsPoint; |
|||
import org.nl.acs.point.service.IAcsPointService; |
|||
import org.nl.acs.sch.task.service.WorkService; |
|||
import org.nl.acs.sch.task.service.dao.SchBaseTask; |
|||
import org.nl.acs.sch.task.service.dao.Work; |
|||
import org.nl.acs.sch.task.service.dao.mapper.WorkMapper; |
|||
import org.nl.acs.sch.task.service.dto.WorkQuery; |
|||
import org.nl.acs.sch.task_manage.task.core.TaskStatus; |
|||
import org.nl.acs.task.service.TaskService; |
|||
import org.nl.acs.task.service.dto.TaskDto; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.nl.common.utils.CodeUtil; |
|||
import org.nl.common.utils.SecurityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Set; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements WorkService { |
|||
@Autowired |
|||
private WorkMapper workMapper; |
|||
@Autowired |
|||
private TaskService taskService; |
|||
@Autowired |
|||
private OrderService orderService; |
|||
@Autowired |
|||
private IAcsPointService acsPointService; |
|||
|
|||
@Override |
|||
public IPage<Work> queryAll(WorkQuery whereJson, PageQuery page) { |
|||
// IPage<Work> pages = new Page<>(page.getPage() + 1, page.getSize());
|
|||
// LambdaQueryWrapper<Work> workLambdaQueryWrapper = Wrappers.lambdaQuery(Work.class);
|
|||
// workLambdaQueryWrapper.eq(StrUtil.isNotEmpty(whereJson.getStatus()), Work::getStatus, whereJson.getStatus())
|
|||
// .lt(Work::getStatus, CommonFinalParam.TWO);
|
|||
// if (StrUtil.isNotEmpty(whereJson.getBlurry())) {
|
|||
// workLambdaQueryWrapper.and(wrapper -> {
|
|||
// wrapper.like(StrUtil.isNotEmpty(whereJson.getBlurry()), Work::getResource_name, whereJson.getBlurry())
|
|||
// .or()
|
|||
// .like(StrUtil.isNotEmpty(whereJson.getBlurry()), Work::getMfg_order_name, whereJson.getBlurry());
|
|||
// });
|
|||
// }
|
|||
// pages = workMapper.selectPage(pages, workLambdaQueryWrapper);
|
|||
// return pages;
|
|||
IPage<Work> pages = new Page<>(page.getPage() + 1, page.getSize()); |
|||
pages = workMapper.selectPageLeftJoin(pages, whereJson); |
|||
return pages; |
|||
} |
|||
|
|||
@Override |
|||
public void create(Work entity) { |
|||
String work_id = entity.getWork_id(); |
|||
Work workObj = workMapper.selectById(work_id); |
|||
if (ObjectUtil.isNotEmpty(workObj) && !workObj.getWork_id().equals(entity.getWork_id())) { |
|||
throw new BadRequestException("存在相同的任务id"); |
|||
} |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setWork_id(IdUtil.getSnowflake(1, 1).nextId() + ""); |
|||
entity.setWork_code(CodeUtil.getNewCode("WORK_CODE")); |
|||
entity.setStatus("0"); |
|||
entity.setCreate_by(nickName); |
|||
entity.setCreate_time(now); |
|||
entity.setUpdate_by(nickName); |
|||
entity.setUpdate_time(now); |
|||
workMapper.insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void update(Work entity) { |
|||
String nickName = SecurityUtils.getCurrentNickName(); |
|||
String now = DateUtil.now(); |
|||
entity.setUpdate_by(nickName); |
|||
entity.setUpdate_time(now); |
|||
workMapper.updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAll(Set<String> ids) { |
|||
// 真删除
|
|||
workMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public void send(String id) { |
|||
Work work = workMapper.selectById(id); |
|||
if (ObjectUtil.isEmpty(work)) { |
|||
throw new BadRequestException("不存在该配料任务"); |
|||
} |
|||
String mfg_order_name = work.getMfg_order_name(); |
|||
List<Work> works = workMapper.selectList(Wrappers.lambdaQuery(Work.class).eq(Work::getMfg_order_name, mfg_order_name).eq(Work::getStatus, TaskStatus.EXECUTING.getCode())); |
|||
if (works.size() != 0) { |
|||
throw new BadRequestException("该工单已有配料任务正在执行中,请勿重复下发"); |
|||
} |
|||
work.setStatus(TaskStatus.EXECUTING.getCode()); |
|||
workMapper.updateById(work); |
|||
} |
|||
|
|||
@Override |
|||
public void reSend(Work dto) { |
|||
Work work = workMapper.selectById(dto.getWork_id()); |
|||
if (ObjectUtil.isEmpty(work)) { |
|||
throw new BadRequestException("不存在该配料任务"); |
|||
} |
|||
work.setRemain_num(work.getRemain_num() + dto.getRequire_num()); |
|||
work.setRequire_num(work.getRequire_num() + dto.getRequire_num()); |
|||
workMapper.updateById(work); |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void finish(String id) { |
|||
Work work = workMapper.selectById(id); |
|||
if (ObjectUtil.isEmpty(work)) { |
|||
throw new BadRequestException("不存在该配料任务"); |
|||
} |
|||
work.setStatus(TaskStatus.FINISHED.getCode()); |
|||
workMapper.updateById(work); |
|||
OrderDto dto = orderService.findByCode(work.getMfg_order_name()); |
|||
List<Work> works = workMapper.selectList(Wrappers.lambdaQuery(Work.class).eq(Work::getMfg_order_name, work.getMfg_order_name()).eq(Work::getStatus, TaskStatus.FINISHED.getCode())); |
|||
// 工单所有配料任务都完成,则工单状态改为已完成
|
|||
if (works.size() == dto.getDetail_count()) { |
|||
dto.setStatus(CommonFinalParam.FINISHED); |
|||
orderService.update(dto); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void confirm(String id) { |
|||
Work work = workMapper.selectOne(Wrappers.lambdaQuery(Work.class).eq(Work::getWork_id, id)); |
|||
if (ObjectUtil.isEmpty(work)) { |
|||
throw new BadRequestException("该配料任务不存在!"); |
|||
} |
|||
if (StrUtil.equals(CommonFinalParam.FINISHED, work.getStatus())) { |
|||
throw new BadRequestException("该配料任务已完成!"); |
|||
} |
|||
String resource_name = work.getResource_name(); |
|||
TaskDto taskDto = new TaskDto(); |
|||
taskDto.setStart_device_code("T1"); |
|||
taskDto.setNext_device_code(resource_name); |
|||
taskDto.setTask_type(CommonFinalParam.TYPE_THREE); |
|||
taskDto.setAgv_system_type(CommonFinalParam.TWO); |
|||
AcsPoint point = acsPointService.findByCode("T1"); |
|||
if (ObjectUtil.isEmpty(point)) { |
|||
throw new BadRequestException("不存在T1点位"); |
|||
} |
|||
if (!point.getIs_used().booleanValue() || point.getPoint_status().equals(CommonFinalParam.ONE)) { |
|||
throw new BadRequestException("T1点位被占用"); |
|||
} |
|||
try { |
|||
taskService.create(taskDto); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
work.setRemain_num(work.getRemain_num() - 1); |
|||
//当前数量为0,则修改状态为已完成
|
|||
if (work.getRemain_num() == 0) { |
|||
work.setStatus(TaskStatus.FINISHED.getCode()); |
|||
} |
|||
workMapper.updateById(work); |
|||
String mfg_order_name = work.getMfg_order_name(); |
|||
OrderDto dto = orderService.findByCode(mfg_order_name); |
|||
List<Work> works = workMapper.selectList(Wrappers.lambdaQuery(Work.class).eq(Work::getMfg_order_name, mfg_order_name).eq(Work::getStatus, TaskStatus.FINISHED.getCode())); |
|||
// 工单所有配料任务都完成,则工单状态改为已完成
|
|||
if (works.size() == dto.getDetail_count()) { |
|||
dto.setStatus(CommonFinalParam.FINISHED); |
|||
orderService.update(dto); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public Work findByCode(String work_code) { |
|||
LambdaQueryWrapper<Work> wrapper = new LambdaQueryWrapper<Work>() |
|||
.eq(Work::getWork_code, work_code); |
|||
return workMapper.selectOne(wrapper); |
|||
} |
|||
} |
@ -0,0 +1,45 @@ |
|||
package org.nl.acs.sch.task_manage; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.point.service.IAcsPointService; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskService; |
|||
import org.nl.acs.sch.task.service.ISchBaseTaskconfigService; |
|||
import org.nl.common.exception.BadRequestException; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @author ldjun |
|||
* @version 1.0 |
|||
* @date 2023年05月16日 16:42 |
|||
* @desc 任务抽象父类,申请任务的相关率先判断以及生成,接着到子类执行任务的创建,最后统一通过定时任务去下发到ACS |
|||
*/ |
|||
@Slf4j |
|||
@Component |
|||
public abstract class AbstractTask { |
|||
@Autowired |
|||
private ISchBaseTaskService taskService; |
|||
@Autowired |
|||
private ISchBaseTaskconfigService taskConfigService; |
|||
@Autowired |
|||
private IAcsPointService pointService; |
|||
|
|||
public void apply(JSONObject param) throws BadRequestException { |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 强制结束完成任务 |
|||
* |
|||
* @param task_code |
|||
*/ |
|||
public abstract void forceFinish(String task_code); |
|||
|
|||
/** |
|||
* 取消任务,货物搬回原点 |
|||
* |
|||
* @param task_code |
|||
*/ |
|||
public abstract void cancel(String task_code); |
|||
} |
@ -0,0 +1,4 @@ |
|||
package org.nl.acs.sch.task_manage; |
|||
|
|||
public class AcsTaskDto { |
|||
} |
@ -0,0 +1,4 @@ |
|||
package org.nl.acs.sch.task_manage; |
|||
|
|||
public class AutoCreateTask { |
|||
} |
@ -0,0 +1,168 @@ |
|||
package org.nl.acs.sch.task_manage; |
|||
|
|||
public class GeneralDefinition { |
|||
/** |
|||
* 默认密码 |
|||
*/ |
|||
public static final String DEFAULT_PASSWORD = "123456"; |
|||
/** |
|||
* 盐值加密 |
|||
*/ |
|||
public static final String SALT = "salt"; |
|||
/** |
|||
* 转义点 |
|||
*/ |
|||
public static final String ESCAPE_DOT = "\\."; |
|||
/** |
|||
* 点 |
|||
*/ |
|||
public static final String DOT = "."; |
|||
/** |
|||
* 日期变量 |
|||
*/ |
|||
public static final String DATE_FORMAT = "yyyy-MM-dd"; |
|||
/** |
|||
* 时间变量 |
|||
*/ |
|||
public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
|||
/** |
|||
* 未知 |
|||
*/ |
|||
public static final String UNKNOWN = "-"; |
|||
// 统一编码定义
|
|||
/** |
|||
* 窑自动任务开启 |
|||
*/ |
|||
public static final String AUTO_KILN_CALL = "auto_kiln_call"; |
|||
// 是否
|
|||
/** |
|||
* 是/正确/可用... |
|||
*/ |
|||
public static final String YES = "1"; |
|||
/** |
|||
* 否/错误/不可用... |
|||
*/ |
|||
public static final String NO = "0"; |
|||
// 载具类型
|
|||
/** |
|||
* 料盅 |
|||
*/ |
|||
public static final String MATERIAL_CUP = "LZ"; |
|||
/** |
|||
* 钢托盘 |
|||
*/ |
|||
public static final String STEEL_TRAY = "GTP"; |
|||
// 账号定义
|
|||
/** |
|||
* acs系统 |
|||
*/ |
|||
public static final String ACS_ID = "2"; |
|||
/** |
|||
* acs系统 |
|||
*/ |
|||
public static final String ACS_NAME = "ACS系统"; |
|||
/** |
|||
* mes系统 |
|||
*/ |
|||
public static final String MES_ID = "3"; |
|||
/** |
|||
* mes系统 |
|||
*/ |
|||
public static final String MES_NAME = "MES系统"; |
|||
// 点位类型
|
|||
/** |
|||
* 设备位 |
|||
*/ |
|||
public static final String DEVICE_POINT = "1"; |
|||
/** |
|||
* 对接位 |
|||
*/ |
|||
public static final String DOCKING_POINT = "2"; |
|||
/** |
|||
* 检测位 |
|||
*/ |
|||
public static final String CHECK_POINT = "4"; |
|||
// 出入口
|
|||
/** |
|||
* 入口 |
|||
**/ |
|||
public static final String ENTRANCE = "1"; |
|||
/** |
|||
* 出口 |
|||
**/ |
|||
public static final String EXIT = "2"; |
|||
// 任务生产方式
|
|||
/** |
|||
* 自动创建 |
|||
**/ |
|||
public static final String AUTO_CREATION = "1"; |
|||
/** |
|||
* ACS创建 |
|||
**/ |
|||
public static final String ACS_CREATION = "2"; |
|||
// 请求方向
|
|||
/** |
|||
* ACS->LMS |
|||
**/ |
|||
public static final String ACS_LMS = "1"; |
|||
/** |
|||
* LMS->ACS |
|||
**/ |
|||
public static final String LMS_ACS = "2"; |
|||
/** |
|||
* MES->LMS |
|||
**/ |
|||
public static final String MES_LMS = "3"; |
|||
/** |
|||
* LMS->MES |
|||
**/ |
|||
public static final String LMS_MES = "4"; |
|||
// 区域定义
|
|||
/** |
|||
* 料盅睏料线区域 |
|||
*/ |
|||
public static final String LZKLX = "LZKLX"; |
|||
/** |
|||
* 干燥窑区域 |
|||
*/ |
|||
public static final String GZY = "GZY"; |
|||
// 特殊: 1-缓存输送线入口,2-缓存输送线出口,3-上输送线,4-下输送线
|
|||
/** |
|||
* 上输送线 |
|||
*/ |
|||
public static final String UPPER_CONVEYOR_LINE = "3"; |
|||
/** |
|||
* 下输送线 |
|||
*/ |
|||
public static final String LOWER_CONVEYOR_LINE = "4"; |
|||
// 参数名称
|
|||
/** |
|||
* 是否连接 |
|||
*/ |
|||
public static final String IS_CONNECT_ACS = "is_connect_acs"; |
|||
/** |
|||
* ACS路径 |
|||
*/ |
|||
public static final String ACS_URL = "acs_url"; |
|||
/** |
|||
* 是否连接 |
|||
*/ |
|||
public static final String IS_CONNECT_MES = "is_connect_mes"; |
|||
/** |
|||
* MES路径 |
|||
*/ |
|||
public static final String MES_URL = "mes_url"; |
|||
// 完成/取消
|
|||
/** |
|||
* 任务完成 |
|||
*/ |
|||
public static final String TASK_FINISH = "任务完成"; |
|||
/** |
|||
* 任务取消 |
|||
*/ |
|||
public static final String TASK_CANCEL = "任务取消"; |
|||
/** |
|||
* 区域 - 分拣 |
|||
*/ |
|||
public static final String AREA_FJ = "FJ"; |
|||
} |
@ -0,0 +1,67 @@ |
|||
package org.nl.acs.sch.task_manage.task.core; |
|||
|
|||
public enum TaskStatus { |
|||
/** |
|||
* 申请 |
|||
*/ |
|||
APPLY("1", "申请", "申请"), |
|||
/** |
|||
* 创建完成 |
|||
*/ |
|||
CREATED("2", "创建完成", "创建完成"), |
|||
/** |
|||
* 下发 |
|||
*/ |
|||
ISSUED("3", "下发", "下发"), |
|||
/** |
|||
* 执行中 |
|||
*/ |
|||
EXECUTING("1", "执行中", "执行中"), |
|||
/** |
|||
* 完成 |
|||
*/ |
|||
FINISHED("2", "完成", "完成"), |
|||
/** |
|||
* 已取消 |
|||
*/ |
|||
CANCELED("6", "已取消", "已取消"), |
|||
/** |
|||
* 未完成 |
|||
*/ |
|||
UNFINISHED("7", "未完成", "未完成"); |
|||
|
|||
|
|||
TaskStatus(String code, String name, String desc) { |
|||
this.code = code; |
|||
this.name = name; |
|||
this.desc = desc; |
|||
} |
|||
|
|||
private String code; |
|||
private String name; |
|||
private String desc; |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getDesc() { |
|||
return desc; |
|||
} |
|||
|
|||
public void setDesc(String desc) { |
|||
this.desc = desc; |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
package org.nl.acs.sch.task_manage.task.tasks; |
|||
|
|||
import org.nl.acs.sch.task_manage.AbstractTask; |
|||
import org.springframework.beans.BeansException; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.config.BeanPostProcessor; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @author ldjun |
|||
* @version 3.0 |
|||
* @date 2023年05月16日 16:42 |
|||
* @desc 2.0 采用获取注解来标识任务类型,并通过扫描和反射的方式来获取任务实例 |
|||
* 3.0 采用获取所有bean对象判断是否为AbstractTask |
|||
*/ |
|||
@Component |
|||
public class TaskFactory implements BeanPostProcessor { |
|||
private final Map<String, AbstractTask> taskMap; |
|||
|
|||
@Autowired |
|||
public TaskFactory() { |
|||
taskMap = new HashMap<>(); |
|||
} |
|||
|
|||
@Override |
|||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { |
|||
if (bean instanceof AbstractTask) { |
|||
taskMap.put(beanName, (AbstractTask) bean); |
|||
} |
|||
return bean; |
|||
} |
|||
|
|||
public AbstractTask getTask(String taskType) { |
|||
if (taskType == null) { |
|||
return null; |
|||
} |
|||
return taskMap.get(taskType); |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
package org.nl.hand.controller; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.nl.acs.sch.task.service.dto.WorkQuery; |
|||
import org.nl.common.base.TableDataInfo; |
|||
import org.nl.common.domain.query.PageQuery; |
|||
import org.nl.common.logging.annotation.Log; |
|||
import org.nl.hand.service.HandService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.http.HttpStatus; |
|||
import org.springframework.http.ResponseEntity; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @Author: tq |
|||
* @Description: 手持接口 |
|||
* @Date: 2024/10/15 |
|||
*/ |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
|
|||
@RequestMapping("/api/hand") |
|||
@SaIgnore |
|||
public class HandController { |
|||
@Autowired |
|||
private HandService handService; |
|||
|
|||
@PostMapping |
|||
@Log("配料作业查询") |
|||
public ResponseEntity<Object> query() { |
|||
return new ResponseEntity<>(handService.query(), HttpStatus.OK); |
|||
} |
|||
|
|||
@Log("确认配料作业") |
|||
@PostMapping(value = "/confirm") |
|||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) { |
|||
return new ResponseEntity<>(handService.confirm(whereJson),HttpStatus.OK); |
|||
} |
|||
} |
@ -1,4 +1,4 @@ |
|||
package org.nl.hand.rest; |
|||
package org.nl.hand.controller; |
|||
|
|||
import cn.dev33.satoken.annotation.SaIgnore; |
|||
import cn.dev33.satoken.secure.SaSecureUtil; |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue