diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/rest/StPointIvtController.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/rest/StPointIvtController.java new file mode 100644 index 000000000..8355f0d0f --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/rest/StPointIvtController.java @@ -0,0 +1,57 @@ +package org.nl.b_lms.pdm.ivt.rest; + + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.b_lms.pdm.ivt.service.StPointIvtService; +import org.nl.b_lms.pdm.ivt.service.dto.StPointIvtDto; +import org.nl.modules.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; + +/*** +* @Auther:Zhouz +* @Date:2024/1/16 +* @Description:表处工序 + */ +@RestController +@RequiredArgsConstructor + +@RequestMapping("/api/stpointivt") +@Slf4j +public class StPointIvtController { + + private final StPointIvtService stpointivtService; + + @GetMapping + @Log("查询表处点位库存") + public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(stpointivtService.queryAll(whereJson, page), HttpStatus.OK); + } + + @PostMapping + @Log("新增表处点位库存") + public ResponseEntity create(@Validated @RequestBody StPointIvtDto dto) { + stpointivtService.create(dto); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改表处点位库存") + public ResponseEntity update(@Validated @RequestBody StPointIvtDto dto) { + stpointivtService.update(dto); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @Log("删除表处点位库存") + @DeleteMapping + public ResponseEntity delete(@RequestBody Long[] ids) { + stpointivtService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/StPointIvtService.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/StPointIvtService.java new file mode 100644 index 000000000..2d9fb7e77 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/StPointIvtService.java @@ -0,0 +1,70 @@ +package org.nl.b_lms.pdm.ivt.service; + +import org.nl.b_lms.pdm.ivt.service.dto.StPointIvtDto; +import org.springframework.data.domain.Pageable; + +import java.util.List; +import java.util.Map; + +/*** + * @Auther:Zhouz + * @Date:2024/1/16 + * @Description:表处工序 + */ +public interface StPointIvtService { + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map queryAll(Map whereJson, Pageable page); + + /** + * 查询所有数据不分页 + * + * @param whereJson 条件参数 + * @return List + */ + List queryAll(Map whereJson); + + /** + * 根据ID查询 + * + * @param point_id ID + * @return Sbpointivt + */ + StPointIvtDto findById(Long point_id); + + /** + * 根据编码查询 + * + * @param code code + * @return Sbpointivt + */ + StPointIvtDto findByCode(String code); + + + /** + * 创建 + * + * @param dto / + */ + void create(StPointIvtDto dto); + + /** + * 编辑 + * + * @param dto / + */ + void update(StPointIvtDto dto); + + /** + * 多选删除 + * + * @param ids / + */ + void deleteAll(Long[] ids); +} \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/dto/StPointIvtDto.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/dto/StPointIvtDto.java new file mode 100644 index 000000000..cbad07de8 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/dto/StPointIvtDto.java @@ -0,0 +1,103 @@ +package org.nl.b_lms.pdm.ivt.service.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author lyd + * @description / + * @date 2022-10-10 + **/ +@Data +public class StPointIvtDto implements Serializable { + + /** 点位标识 */ + /** + * 防止精度丢失 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long point_id; + + /** + * 点位编码 + */ + private String point_code; + + /** + * 生产区域 + */ + private String product_area; + + /** + * 表处上料位轴编码 + */ + private String up_scroll; + + /** + * 表处上料位母卷号 + */ + private String up_pcsn; + + /** + * 表处下料位轴编码 + */ + private String down_scroll; + + /** + * 表处下料位母卷号 + */ + private String down_pcsn; + + /** + * 位置 + */ + private String point_location; + + /** + * 外部编码 + */ + private String ext_code; + + /** + * 备注 + */ + private String remark; + + /** + * 是否启用 + */ + private String is_used; + + /** + * 创建人 + */ + private String create_id; + + /** + * 创建人 + */ + private String create_name; + + /** + * 创建时间 + */ + private String create_time; + + /** + * 修改人 + */ + private String update_optid; + + /** + * 修改人 + */ + private String update_optname; + + /** + * 修改时间 + */ + private String update_time; +} diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/impl/StPointIvtServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/impl/StPointIvtServiceImpl.java new file mode 100644 index 000000000..aa459185c --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/service/impl/StPointIvtServiceImpl.java @@ -0,0 +1,145 @@ +package org.nl.b_lms.pdm.ivt.service.impl; + + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.b_lms.pdm.ivt.service.StPointIvtService; +import org.nl.b_lms.pdm.ivt.service.dto.StPointIvtDto; +import org.nl.common.utils.SecurityUtils; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.wql.WQL; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.WqlUtil; +import org.nl.wms.basedata.st.service.impl.UserAreaServiceImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/*** + * @Auther:Zhouz + * @Date:2024/1/16 + * @Description:表处工序 + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class StPointIvtServiceImpl implements StPointIvtService { + + @Override + public Map queryAll(Map whereJson, Pageable page) { + //获取人员对应的区域 + UserAreaServiceImpl userAreaService = new UserAreaServiceImpl(); + String in_area_id = userAreaService.getInArea(); + JSONObject map = new JSONObject(); + map.put("flag", "1"); + if (!ObjectUtil.isNull(whereJson.get("point_code"))) { + map.put("point_code", "%" + whereJson.get("point_code") + "%"); + } + map.put("product_area", whereJson.get("product_area")); + map.put("is_used", whereJson.get("is_used")); + if (ObjectUtil.isNotEmpty(in_area_id)) { + map.put("in_area_id", in_area_id); + } + JSONObject json = WQL.getWO("ST_IVT_STPOINTIVT").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "product_area,point_code"); + return json; + } + + @Override + public List queryAll(Map whereJson) { + WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt"); + JSONArray arr = wo.query().getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(arr)) { + return arr.toJavaList(StPointIvtDto.class); + } + return null; + } + + @Override + public StPointIvtDto findById(Long point_id) { + WQLObject wo = WQLObject.getWQLObject("st_ivt_stpointivt"); + JSONObject json = wo.query("point_id = '" + point_id + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)) { + return json.toJavaObject(StPointIvtDto.class); + } + return null; + } + + @Override + public StPointIvtDto findByCode(String code) { + WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt"); + JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(json)) { + return json.toJavaObject(StPointIvtDto.class); + } + return null; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(StPointIvtDto dto) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + + dto.setPoint_id(IdUtil.getSnowflake(1, 1).nextId()); + dto.setCreate_id(currentUserId); + dto.setCreate_name(nickName); + dto.setUpdate_optid(currentUserId); + dto.setUpdate_optname(nickName); + dto.setUpdate_time(now); + dto.setCreate_time(now); + + WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.insert(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(StPointIvtDto dto) { + StPointIvtDto entity = this.findById(dto.getPoint_id()); + if (entity == 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); + + WQLObject wo = WQLObject.getWQLObject("st_ivt_stpointivt"); + JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto)); + wo.update(json); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(Long[] ids) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + + WQLObject wo = WQLObject.getWQLObject("st_ivt_sbpointivt"); + for (Long point_id : ids) { + JSONObject param = new JSONObject(); + param.put("point_id", String.valueOf(point_id)); + param.put("is_delete", "1"); + param.put("update_optid", currentUserId); + param.put("update_optname", nickName); + param.put("update_time", now); + wo.update(param); + } + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/wql/ST_IVT_STPOINTIVT.wql b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/wql/ST_IVT_STPOINTIVT.wql new file mode 100644 index 000000000..a17dd5281 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/pdm/ivt/wql/ST_IVT_STPOINTIVT.wql @@ -0,0 +1,64 @@ +[交易说明] + 交易名: 生箔点位库存 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.point_code TYPEAS s_string + 输入.product_area TYPEAS s_string + 输入.is_used TYPEAS s_string + 输入.mes_used TYPEAS s_string + 输入.in_area_id TYPEAS f_string + + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + IF 输入.flag = "1" + PAGEQUERY + SELECT + st.* + FROM + st_ivt_stpointivt st + WHERE + st.product_area in 输入.in_area_id + OPTION 输入.point_code <> "" + point_code LIKE 输入.point_code + ENDOPTION + OPTION 输入.product_area <> "" + product_area = 输入.product_area + ENDOPTION + OPTION 输入.is_used <> "" + is_used = 输入.is_used + ENDOPTION + ENDSELECT + ENDPAGEQUERY + ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index cb8667c23..70ab7aa96 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue b/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue new file mode 100644 index 000000000..070477eb9 --- /dev/null +++ b/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/index.vue @@ -0,0 +1,222 @@ + + + + + diff --git a/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/stpointivt.js b/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/stpointivt.js new file mode 100644 index 000000000..ee971891b --- /dev/null +++ b/lms/nladmin-ui/src/views/b_lms/pdm/ivt/stpointivt/stpointivt.js @@ -0,0 +1,27 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/stpointivt', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/stpointivt/', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/stpointivt', + method: 'put', + data + }) +} + +export default { add, edit, del } diff --git a/lms/nladmin-ui/src/views/wms/basedata/product/userArea/index.vue b/lms/nladmin-ui/src/views/wms/basedata/product/userArea/index.vue index 8899abc9b..556cca129 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/product/userArea/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/product/userArea/index.vue @@ -115,7 +115,7 @@ export default { level: 3, currentId: 0, menuLoading: false, showButton: false, menus: [], menuIds: [], depts: [], deptDatas: [], // 多选时使用 - tableData: [{ 'product_area': 'A1' }, { 'product_area': 'A2' }, { 'product_area': 'A3' }, { 'product_area': 'A4' }, { 'product_area': 'LK' }], + tableData: [{ 'product_area': 'A1' }, { 'product_area': 'A2' }, { 'product_area': 'A3' }, { 'product_area': 'A4' }, { 'product_area': 'LK' }, { 'product_area': 'B1' }, { 'product_area': 'B2' }, { 'product_area': 'B3' }, { 'product_area': 'B4' }], currentRow: null, permission: { add: ['admin', 'roles:add'],