小料开单

This commit is contained in:
zds
2022-10-13 09:22:39 +08:00
parent fc84da7153
commit 5b6111a4fd
18 changed files with 3119 additions and 3 deletions

View File

@@ -18,9 +18,18 @@ import java.util.Date;
public class AutoDelLogTask {
public void run() {
WQLObject logTab = WQLObject.getWQLObject("sys_log");
String perNum = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("AUTO_DELETE_LOG").getValue();
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + Integer.valueOf(perNum) + " day))");
WQLObject sys_log = WQLObject.getWQLObject("sys_log");
WQLObject sys_quartz_log = WQLObject.getWQLObject("sys_quartz_log");
String delete_time = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("LOG_DELETE_TIME").getValue();
DateTime date = DateUtil.date();
DateTime date2 = DateUtil.offsetDay(date, -Integer.parseInt(delete_time));
String date3 = DateUtil.formatDate(date2);
sys_log.delete("1=1 and create_time<='"+date3+"'");
sys_quartz_log.delete("1=1 and create_time<='"+date3+"'");
log.info("自动清理日志执行成功...!");
}
}

View File

@@ -0,0 +1,106 @@
package org.nl.wms.pf.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.wms.pf.service.AcceptFormulaService;
import org.nl.wms.pf.service.AcceptMarkService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author Liuxy
* @date 2021-12-20
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "配粉BOM维护管理")
@RequestMapping("/api/acceptformula")
@Slf4j
public class AcceptFormulaController {
private final AcceptFormulaService acceptFormulaService;
@GetMapping
@Log("查询配粉BOM维护")
@ApiOperation("查询配粉BOM维护")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(acceptFormulaService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增配粉BOM维护")
@ApiOperation("新增配粉BOM维护")
public ResponseEntity<Object> create(@RequestBody Map whereJson) {
acceptFormulaService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改配粉BOM维护")
@ApiOperation("修改配粉BOM维护")
public ResponseEntity<Object> update(@RequestBody Map whereJson) {
acceptFormulaService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除配粉BOM维护")
@ApiOperation("删除配粉BOM维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
acceptFormulaService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/getDtl")
@Log("编辑时获取明细")
@ApiOperation("编辑时获取明细")
public ResponseEntity<Object> getDtl(@RequestParam Map whereJson) {
return new ResponseEntity<>(acceptFormulaService.getDtl(whereJson), HttpStatus.OK);
}
@Log("获取成型剂类别")
@ApiOperation("获取成型剂类别")
@GetMapping("/getBoms")
public ResponseEntity<Object> getBoms() {
return new ResponseEntity<>(acceptFormulaService.getBoms(),HttpStatus.OK);
}
@Log("获取成型剂类别")
@ApiOperation("获取成型剂类别")
@GetMapping("/getTHWs")
public ResponseEntity<Object> getTHWs() {
return new ResponseEntity<>(acceptFormulaService.getTHWs(),HttpStatus.OK);
}
@Log("获取成型剂类别")
@ApiOperation("获取成型剂类别")
@GetMapping("/getPCSNs")
public ResponseEntity<Object> getPCSNs(@RequestParam Map whereJson) {
return new ResponseEntity<>(acceptFormulaService.getPCSNs(whereJson),HttpStatus.OK);
}
@Log("获取成型剂类别")
@ApiOperation("获取成型剂类别")
@GetMapping("/getPCSN")
public ResponseEntity<Object> getPCSN(@RequestParam Map whereJson) {
return new ResponseEntity<>(acceptFormulaService.getPCSN(whereJson),HttpStatus.OK);
}
@Log("获取成型剂类别")
@ApiOperation("获取成型剂类别")
@GetMapping("/getBom")
public ResponseEntity<Object> getBom(@RequestParam Map whereJson) {
return new ResponseEntity<>(acceptFormulaService.getBom(whereJson),HttpStatus.OK);
}
@Log("获取成型剂类别")
@ApiOperation("获取成型剂类别")
@GetMapping("/createPcsn")
public ResponseEntity<Object> createPcsn() {
return new ResponseEntity<>(acceptFormulaService.createPcsn(),HttpStatus.OK);
}
}

View File

@@ -0,0 +1,70 @@
package org.nl.wms.pf.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.wms.pf.service.AcceptMarkService;
import org.nl.wms.pf.service.ProductbomService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author Liuxy
* @date 2021-12-20
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "配粉BOM维护管理")
@RequestMapping("/api/acceptmark")
@Slf4j
public class AcceptMarkController {
private final AcceptMarkService acceptMarkService;
@GetMapping
@Log("查询配粉BOM维护")
@ApiOperation("查询配粉BOM维护")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(acceptMarkService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@Log("新增配粉BOM维护")
@ApiOperation("新增配粉BOM维护")
public ResponseEntity<Object> create(@RequestBody Map whereJson) {
acceptMarkService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改配粉BOM维护")
@ApiOperation("修改配粉BOM维护")
public ResponseEntity<Object> update(@RequestBody Map whereJson) {
acceptMarkService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除配粉BOM维护")
@ApiOperation("删除配粉BOM维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
acceptMarkService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/getDtl")
@Log("编辑时获取明细")
@ApiOperation("编辑时获取明细")
public ResponseEntity<Object> getDtl(@RequestParam Map whereJson) {
return new ResponseEntity<>(acceptMarkService.getDtl(whereJson), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,98 @@
package org.nl.wms.pf.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.pf.service.dto.ProductbomDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author Liuxy
* @date 2021-12-20
**/
public interface AcceptFormulaService {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<ProductbomDto>
*/
List<ProductbomDto> queryAll(Map whereJson);
/**
* 根据ID查询
* @param bom_id ID
* @return Productbom
*/
JSONObject findById(Long bom_id);
/**
* 根据编码查询
* @param code code
* @return Productbom
*/
ProductbomDto findByCode(String code);
/**
* 创建
* @param whereJson /
*/
void create(Map whereJson);
/**
* 编辑
* @param whereJson /
*/
void update(Map whereJson);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 编辑时获取明细
* @param whereJson /
*/
JSONArray getDtl(Map whereJson);
/**
* 提交
*/
JSONArray getBoms();
/**
* 提交
*/
JSONArray getTHWs();
/**
* 提交
*/
JSONArray getPCSNs(Map whereJson);
/**
* 提交
*/
JSONObject getPCSN(Map whereJson);
/**
* 提交
*/
JSONObject getBom(Map whereJson);
/**
* 提交
*/
JSONObject createPcsn();
}

View File

@@ -0,0 +1,73 @@
package org.nl.wms.pf.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.pf.service.dto.ProductbomDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author Liuxy
* @date 2021-12-20
**/
public interface AcceptMarkService {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<ProductbomDto>
*/
List<ProductbomDto> queryAll(Map whereJson);
/**
* 根据ID查询
* @param bom_id ID
* @return Productbom
*/
JSONObject findById(Long bom_id);
/**
* 根据编码查询
* @param code code
* @return Productbom
*/
ProductbomDto findByCode(String code);
/**
* 创建
* @param whereJson /
*/
void create(Map whereJson);
/**
* 编辑
* @param whereJson /
*/
void update(Map whereJson);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 编辑时获取明细
* @param whereJson /
*/
JSONArray getDtl(Map whereJson);
}

View File

@@ -0,0 +1,304 @@
package org.nl.wms.pf.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
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.exception.BadRequestException;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wms.pf.service.AcceptFormulaService;
import org.nl.wms.pf.service.AcceptMarkService;
import org.nl.wms.pf.service.dto.ProductbomDto;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务实现
* @date 2021-12-20
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class AcceptFormulaServiceImpl implements AcceptFormulaService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_code = (String) whereJson.get("material_code");
HashMap<String, String> map = new HashMap<>();
if (!StrUtil.isEmpty(material_code)) {
//处理转义字符
if (material_code.contains("\\")) {
material_code = material_code.replace("\\", "\\\\\\");
}
map.put("material_code", "%"+material_code+"%");
}
String material_pcsn = (String) whereJson.get("material_pcsn");
if (!StrUtil.isEmpty(material_pcsn)) {
map.put("material_pcsn", "%"+material_pcsn+"%");
}
String formula_code = (String) whereJson.get("formula_code");
if (!StrUtil.isEmpty(formula_code)) {
map.put("formula_code", "%"+formula_code+"%");
}
String accept_pcsn = (String) whereJson.get("accept_pcsn");
if (!StrUtil.isEmpty(accept_pcsn)) {
map.put("accept_pcsn", "%"+accept_pcsn+"%");
}
String begin_time = map.get("begin_time");
if (StrUtil.isNotEmpty(begin_time)) {
map.put("begin_time", begin_time.substring(0,10)+" 00:00:00");
}
String end_time = map.get("end_time");
if (StrUtil.isNotEmpty(end_time)) {
map.put("end_time", end_time.substring(0,10)+" 23:59:59");
}
map.put("flag", "1");
JSONObject json = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time desc");
return json;
}
@Override
public List<ProductbomDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("md_pd_productbom");
JSONArray arr = wo.query().getResultJSONArray(0);
List<ProductbomDto> list = arr.toJavaList(ProductbomDto.class);
return list;
}
@Override
public JSONObject findById(Long mark_id) {
WQLObject wo = WQLObject.getWQLObject("QL_TEST_AcceptMark");
JSONObject json = wo.query("mark_id =" + mark_id + "").uniqueResult(0);
return json;
}
@Override
public ProductbomDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("QL_TEST_AcceptMark");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final ProductbomDto obj = json.toJavaObject(ProductbomDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(Map whereJson) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
Long deptId = currentUser.getDeptId();
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
// 主表
JSONObject jsonMst = new JSONObject();
jsonMst = (JSONObject) JSON.toJSON(whereJson);
whereJson.remove("tableData");
jsonMst.put("mark_id", IdUtil.getSnowflake(1, 1).nextId());
jsonMst.put("is_delete", "0");
jsonMst.put("remark", (String) whereJson.get("remark"));
JSONObject jonow = mstTab.query("is_delete='0' and mark_code='" + jsonMst.getString("mark_code") + "'").uniqueResult(0);
if (jonow != null) {
throw new BadRequestException("该牌号已存在!");
}
jsonMst.put("create_id", currentUserId);
jsonMst.put("create_name", nickName);
jsonMst.put("create_time", now);
jsonMst.put("update_optid", currentUserId);
jsonMst.put("update_optname", nickName);
jsonMst.put("update_time", now);
jsonMst.put("detail_count", jsonArr.size());
mstTab.insert(jsonMst);
// 明细表
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
jsonDtl.put("mark_id", jsonMst.getString("mark_id"));
jsonDtl.put("seqno", (i+1)+"");
jsonDtl.put("material_id", json.getString("material_id"));
jsonDtl.put("standard_rate", json.getString("standard_rate"));
dtlTab.insert(jsonDtl);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(Map whereJson) {
JSONObject entity = this.findById(Long.valueOf((String) whereJson.get("mark_id")));
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
// 主表
JSONObject jsonMst = new JSONObject();
whereJson.remove("tableData");
jsonMst = (JSONObject) JSON.toJSON(whereJson);
String mark_code = jsonMst.getString("mark_code");
String mark_id = jsonMst.getString("mark_id");
JSONObject oldJO = mstTab.query("mark_id <> '" + mark_id + "' and mark_code='"+mark_code+"'").uniqueResult(0);
if(oldJO !=null){
throw new BadRequestException("已存在相同牌号!");
}
JSONObject now = mstTab.query("mark_id = '" + mark_id + "'").uniqueResult(0);
//主表
now.put("mark_code", jsonMst.getString("mark_code"));
now.put("c_balance", jsonMst.getString("c_balance"));
now.put("liquid_rate", jsonMst.getString("liquid_rate"));
now.put("ball_rate", jsonMst.getString("ball_rate"));
now.put("ball_speed", jsonMst.getString("ball_speed"));
now.put("ball_time", jsonMst.getString("ball_time"));
now.put("remark", jsonMst.getString("remark"));
now.put("update_optid", currentUserId);
now.put("update_optname", nickName);
now.put("update_time", DateUtil.now());
//删明细
dtlTab.delete("mark_id = '" + mark_id + "'");
//明细表
now.put("detail_count", jsonArr.size() + "");
mstTab.update(now);
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
jsonDtl.put("mark_id", mark_id);
jsonDtl.put("seqno", (i+1)+"");
jsonDtl.put("material_id", json.getString("material_id"));
jsonDtl.put("standard_rate", json.getString("standard_rate"));
dtlTab.insert(jsonDtl);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
for (Long mark_id : ids) {
JSONObject param = new JSONObject();
param.put("mark_id", String.valueOf(mark_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
mstTab.update(param);
dtlTab.delete("mark_id='" + String.valueOf(mark_id) + "'");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONArray getDtl(Map whereJson) {
String mark_id = (String) whereJson.get("mark_id");
JSONArray jsonArr = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParam("flag", "2").addParam("mark_id", mark_id).process().getResultJSONArray(0);
return jsonArr;
}
@Override
public JSONArray getBoms() {
HashMap<String, String> map = new HashMap<>();
map.put("flag", "3");
JSONArray ret = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParamMap(map).process().getResultJSONArray(0);
return ret;
}
@Override
public JSONArray getTHWs() {
HashMap<String, String> map = new HashMap<>();
map.put("flag", "4");
JSONArray ret = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParamMap(map).process().getResultJSONArray(0);
return ret;
}
@Override
public JSONArray getPCSNs(Map whereJson) {
HashMap<String, String> map = new HashMap<>(whereJson);
map.put("flag", "5");
JSONArray ret = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParamMap(map).process().getResultJSONArray(0);
return ret;
}
@Override
public JSONObject getPCSN(Map whereJson) {
HashMap<String, String> map = new HashMap<>(whereJson);
map.put("flag", "6");
JSONArray ret = WQL.getWO("QMD_PD_ACCEPTFORMULA01").addParamMap(map).process().getResultJSONArray(0);
JSONObject jo = new JSONObject();
jo.put("CJZB00007","0");
jo.put("CJZB00001","0");
jo.put("CJZB00002","0");
jo.put("CJZB00006","0");
jo.put("CJZB00021","0");
jo.put("CJZB00020","0");
jo.put("CJZB00004","0");
if(ret.size() > 0){
for(int i=0;i<ret.size();i++){
JSONObject now = ret.getJSONObject(i);
String inspection_item_code = now.getString("inspection_item_code");
if("CJZB00001".equals(inspection_item_code)){
jo.put("CJZB00001",now.getString("value"));
}else if("CJZB00002".equals(inspection_item_code)){
jo.put("CJZB00002",now.getString("value"));
}else if("CJZB00006".equals(inspection_item_code)){
jo.put("CJZB00006",now.getString("value"));
}else if("CJZB00020".equals(inspection_item_code)){
jo.put("CJZB00020",now.getString("value"));
}else if("CJZB00021".equals(inspection_item_code)){
jo.put("CJZB00021",now.getString("value"));
}else if("CJZB00004".equals(inspection_item_code)){
jo.put("CJZB00004",now.getString("value"));
}else if("CJZB00007".equals(inspection_item_code)){
jo.put("CJZB00007",now.getString("value"));
}
}
}
return jo;
}
@Override
public JSONObject getBom(Map whereJson) {
HashMap<String, String> map = new HashMap<>(whereJson);
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
String mark_id = map.get("mark_id");
JSONObject jo = mstTab.query("mark_id='"+mark_id+"'").uniqueResult(0);
return jo;
}
@Override
public JSONObject createPcsn() {
JSONObject jo = new JSONObject();
String ACCEPT_PCSN = CodeUtil.getNewCode("ACCEPT_PCSN");
jo.put("accept_pcsn",ACCEPT_PCSN);
return jo;
}
}

View File

@@ -0,0 +1,209 @@
package org.nl.wms.pf.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
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.exception.BadRequestException;
import org.nl.modules.security.service.dto.JwtUserDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wms.common.util.DataAuthUtil;
import org.nl.wms.pf.service.AcceptMarkService;
import org.nl.wms.pf.service.ProductbomService;
import org.nl.wms.pf.service.dto.ProductbomDto;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务实现
* @date 2021-12-20
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class AcceptMarkServiceImpl implements AcceptMarkService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_code = (String) whereJson.get("material_code");
HashMap<String, String> map = new HashMap<>();
if (!StrUtil.isEmpty(material_code)) {
//处理转义字符
if (material_code.contains("\\")) {
material_code = material_code.replace("\\", "\\\\\\");
}
map.put("material_code", "%"+material_code+"%");
}
map.put("flag", "1");
JSONObject json = WQL.getWO("QMD_PD_ACCEPTMARK01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time desc");
return json;
}
@Override
public List<ProductbomDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("md_pd_productbom");
JSONArray arr = wo.query().getResultJSONArray(0);
List<ProductbomDto> list = arr.toJavaList(ProductbomDto.class);
return list;
}
@Override
public JSONObject findById(Long mark_id) {
WQLObject wo = WQLObject.getWQLObject("QL_TEST_AcceptMark");
JSONObject json = wo.query("mark_id =" + mark_id + "").uniqueResult(0);
return json;
}
@Override
public ProductbomDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("QL_TEST_AcceptMark");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
final ProductbomDto obj = json.toJavaObject(ProductbomDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(Map whereJson) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
Long deptId = currentUser.getDeptId();
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
// 主表
JSONObject jsonMst = new JSONObject();
jsonMst = (JSONObject) JSON.toJSON(whereJson);
whereJson.remove("tableData");
jsonMst.put("mark_id", IdUtil.getSnowflake(1, 1).nextId());
jsonMst.put("is_delete", "0");
jsonMst.put("remark", (String) whereJson.get("remark"));
JSONObject jonow = mstTab.query("is_delete='0' and mark_code='" + jsonMst.getString("mark_code") + "'").uniqueResult(0);
if (jonow != null) {
throw new BadRequestException("该牌号已存在!");
}
jsonMst.put("create_id", currentUserId);
jsonMst.put("create_name", nickName);
jsonMst.put("create_time", now);
jsonMst.put("update_optid", currentUserId);
jsonMst.put("update_optname", nickName);
jsonMst.put("update_time", now);
jsonMst.put("detail_count", jsonArr.size());
mstTab.insert(jsonMst);
// 明细表
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
jsonDtl.put("mark_id", jsonMst.getString("mark_id"));
jsonDtl.put("seqno", (i+1)+"");
jsonDtl.put("material_id", json.getString("material_id"));
jsonDtl.put("standard_rate", json.getString("standard_rate"));
dtlTab.insert(jsonDtl);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(Map whereJson) {
JSONObject entity = this.findById(Long.valueOf((String) whereJson.get("mark_id")));
if (entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
JSONArray jsonArr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("tableData")));
// 主表
JSONObject jsonMst = new JSONObject();
whereJson.remove("tableData");
jsonMst = (JSONObject) JSON.toJSON(whereJson);
String mark_code = jsonMst.getString("mark_code");
String mark_id = jsonMst.getString("mark_id");
JSONObject oldJO = mstTab.query("mark_id <> '" + mark_id + "' and mark_code='"+mark_code+"'").uniqueResult(0);
if(oldJO !=null){
throw new BadRequestException("已存在相同牌号!");
}
JSONObject now = mstTab.query("mark_id = '" + mark_id + "'").uniqueResult(0);
//主表
now.put("mark_code", jsonMst.getString("mark_code"));
now.put("c_balance", jsonMst.getString("c_balance"));
now.put("liquid_rate", jsonMst.getString("liquid_rate"));
now.put("ball_rate", jsonMst.getString("ball_rate"));
now.put("ball_speed", jsonMst.getString("ball_speed"));
now.put("ball_time", jsonMst.getString("ball_time"));
now.put("remark", jsonMst.getString("remark"));
now.put("update_optid", currentUserId);
now.put("update_optname", nickName);
now.put("update_time", DateUtil.now());
//删明细
dtlTab.delete("mark_id = '" + mark_id + "'");
//明细表
now.put("detail_count", jsonArr.size() + "");
mstTab.update(now);
for (int i = 0; i < jsonArr.size(); i++) {
JSONObject json = jsonArr.getJSONObject(i);
JSONObject jsonDtl = new JSONObject();
jsonDtl.put("bomdtl_id", IdUtil.getSnowflake(1, 1).nextId());
jsonDtl.put("mark_id", mark_id);
jsonDtl.put("seqno", (i+1)+"");
jsonDtl.put("material_id", json.getString("material_id"));
jsonDtl.put("standard_rate", json.getString("standard_rate"));
dtlTab.insert(jsonDtl);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_AcceptMark");
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_AcceptMarkBOM");
for (Long mark_id : ids) {
JSONObject param = new JSONObject();
param.put("mark_id", String.valueOf(mark_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
mstTab.update(param);
dtlTab.delete("mark_id='" + String.valueOf(mark_id) + "'");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONArray getDtl(Map whereJson) {
String mark_id = (String) whereJson.get("mark_id");
JSONArray jsonArr = WQL.getWO("QMD_PD_ACCEPTMARK01").addParam("flag", "2").addParam("mark_id", mark_id).process().getResultJSONArray(0);
return jsonArr;
}
}

View File

@@ -0,0 +1,171 @@
[交易说明]
交易名: 产品配粉BOM维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.material_code TYPEAS s_string
输入.material_pcsn TYPEAS s_string
输入.formula_code TYPEAS s_string
输入.mark_id TYPEAS s_string
输入.accept_pcsn TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.material_id TYPEAS s_string
输入.inspection_id TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
AcceptFormula.*,
mater.material_code,
mater.material_name,
AcceptMark.mark_code
FROM
QL_TEST_AcceptFormula AcceptFormula
LEFT JOIN MD_ME_MaterialBase mater ON AcceptFormula.material_id = mater.material_id
LEFT JOIN QL_TEST_AcceptMark AcceptMark ON AcceptMark.mark_id = AcceptFormula.mark_id
WHERE
AcceptFormula.is_delete = '0'
OPTION 输入.begin_time <> ""
AcceptFormula.create_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
AcceptFormula.create_time <= 输入.end_time
ENDOPTION
OPTION 输入.accept_pcsn <> ""
AcceptFormula.accept_pcsn like 输入.accept_pcsn
ENDOPTION
OPTION 输入.material_pcsn <> ""
AcceptFormula.material_pcsn like 输入.material_pcsn
ENDOPTION
OPTION 输入.formula_code <> ""
AcceptFormula.formula_code like 输入.formula_code
ENDOPTION
OPTION 输入.mark_id <> ""
AcceptFormula.mark_id = 输入.mark_id
ENDOPTION
OPTION 输入.material_code <> ""
(mater.material_code like 输入.material_code or mater.material_name like 输入.material_code)
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
AcceptMarkBOM.*,
mater.material_code,
mater.material_name
FROM
QL_TEST_AcceptMarkBOM AcceptMarkBOM
LEFT JOIN MD_ME_MaterialBase mater ON AcceptMarkBOM.material_id = mater.material_id
WHERE 1=1
and AcceptMarkBOM.mark_id = 输入.mark_id
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
AcceptMark.mark_id AS id ,
AcceptMark.mark_code AS code ,
AcceptMark.mark_code AS name
FROM
QL_TEST_AcceptMark AcceptMark
WHERE
1 = 1
AND AcceptMark.is_delete = '0'
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
materialbase.material_id AS id ,
materialbase.material_code AS code ,
materialbase.material_name AS name
FROM
md_me_materialbase materialbase
WHERE
1 = 1
AND materialbase.is_delete = '0'
AND materialbase.material_type_id = '1503644361664106496'
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
FactoryWarrantyMst.inspection_id AS id ,
FactoryWarrantyMst.pcsn AS code ,
FactoryWarrantyMst.inspection_code AS name
FROM
QL_TEST_FactoryWarrantyMst FactoryWarrantyMst
WHERE
1 = 1
AND FactoryWarrantyMst.is_delete = '0'
AND FactoryWarrantyMst.bill_status in ('99')
OPTION 输入.material_id <> ""
FactoryWarrantyMst.material_id = 输入.material_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "6"
QUERY
SELECT
FactoryWarrantyDtl.*,
inspectionitempoint.inspection_item_code,
inspectionitempoint.inspection_item_name
FROM
QL_TEST_FactoryWarrantyDtl FactoryWarrantyDtl
LEFT JOIN ql_test_inspectionitempoint inspectionitempoint ON FactoryWarrantyDtl.inspection_item_id = inspectionitempoint.inspection_item_id
WHERE
1 = 1
OPTION 输入.inspection_id <> ""
FactoryWarrantyDtl.inspection_id = 输入.inspection_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -0,0 +1,74 @@
[交易说明]
交易名: 产品配粉BOM维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.material_code TYPEAS s_string
输入.old_mark TYPEAS s_string
输入.is_used TYPEAS s_string
输入.mark_id TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
AcceptMark.*
FROM
QL_TEST_AcceptMark AcceptMark
WHERE
AcceptMark.is_delete = '0'
OPTION 输入.material_code <> ""
AcceptMark.mark_code like 输入.material_code
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
AcceptMarkBOM.*,
mater.material_code,
mater.material_name
FROM
QL_TEST_AcceptMarkBOM AcceptMarkBOM
LEFT JOIN MD_ME_MaterialBase mater ON AcceptMarkBOM.material_id = mater.material_id
WHERE 1=1
and AcceptMarkBOM.mark_id = 输入.mark_id
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -0,0 +1,73 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/acceptformula',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/acceptformula/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/acceptformula',
method: 'put',
data
})
}
export function getDtl(params) {
return request({
url: 'api/acceptformula/getDtl',
method: 'get',
params
})
}
export function getBoms() {
return request({
url: 'api/acceptformula/getBoms',
method: 'get'
})
}
export function getTHWs() {
return request({
url: 'api/acceptformula/getTHWs',
method: 'get'
})
}
export function getPCSNs(params) {
return request({
url: 'api/acceptformula/getPCSNs',
method: 'get',
params
})
}
export function getPCSN(params) {
return request({
url: 'api/acceptformula/getPCSN',
method: 'get',
params
})
}
export function getBom(params) {
return request({
url: 'api/acceptformula/getBom',
method: 'get',
params
})
}
export function createPcsn() {
return request({
url: 'api/acceptformula/createPcsn',
method: 'get'
})
}
export default { add, edit, del, getDtl, getBoms, getTHWs, getPCSNs, getPCSN, getBom, createPcsn }

View File

@@ -0,0 +1,35 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/acceptmark',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/acceptmark/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/acceptmark',
method: 'put',
data
})
}
export function getDtl(params) {
return request({
url: 'api/acceptmark/getDtl',
method: 'get',
params
})
}
export default { add, edit, del, getDtl }

View File

@@ -0,0 +1,495 @@
<template>
<el-dialog
style="padding-top: 0px;"
:title="crud.status.title"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
<el-form-item label="实验序号" prop="formula_code">
<el-input v-model="form.formula_code" placeholder="系统生成" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="物料" prop="material_id">
<el-select
v-model="form.material_id"
placeholder="物料"
style="width: 210px"
class="filter-item"
:disabled="crud.status.view > 0"
@change="storChange"
>
<el-option
v-for="item in THWs"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="批号" prop="inspection_id">
<el-select
v-model="form.inspection_id"
clearable
size="mini"
placeholder="批号"
class="filter-item"
@change="storChange2"
>
<el-option
v-for="item in PCSNs"
:key="item.id"
:label="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="生产厂家" prop="manufactor">
<el-input v-model="form.manufactor" placeholder="生产厂家" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="CT(%)" prop="CJZB00004">
<label slot="label">CT(%):</label>
<el-input-number
v-model="form.CJZB00004"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="Cr3C2" prop="CJZB00021">
<label slot="label">Cr3C2:</label>
<el-input-number
v-model="form.CJZB00021"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="氧含量" prop="CJZB00007">
<label slot="label">氧含量:</label>
<el-input-number
v-model="form.CJZB00007"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="VC(%)" prop="CJZB00020">
<label slot="label">VC(%):</label>
<el-input-number
v-model="form.CJZB00020"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="CF(%)" prop="CJZB00006">
<label slot="label">CF(%):</label>
<el-input-number
v-model="form.CJZB00006"
:controls="false"
:precision="0"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="FSSS(μm)" prop="CJZB00001">
<label slot="label">FSSS(μm):</label>
<el-input-number
v-model="form.CJZB00001"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="BET(/g)" prop="CJZB00002">
<label slot="label">BET(㎡/g):</label>
<el-input-number
v-model="form.CJZB00002"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
</el-form>
<el-form ref="form2" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
<el-form-item label="验收牌号" prop="mark_id">
<el-select
v-model="form.mark_id"
placeholder="验收牌号"
style="width: 210px"
class="filter-item"
:disabled="crud.status.view > 0"
@change="storChange3"
>
<el-option
v-for="item in boms"
:key="item.id"
:label="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="试验批号" prop="accept_pcsn">
<label slot="label">试验批号:</label>
<el-input v-model="form.accept_pcsn" style="width: 210px" disabled class="input-with-select">
<el-button slot="append" @click="createPcsn">生成</el-button>
</el-input>
</el-form-item>
<el-form-item label="试验重量(g)" prop="accept_qty">
<label slot="label">试验重量(g):</label>
<el-input-number
v-model="form.accept_qty"
:controls="false"
:precision="3"
:min="0"
style="width: 210px"
@change="storChange4"
/>
</el-form-item>
<el-form-item label="碳平衡" prop="c_balance">
<label slot="label">碳平衡:</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="溶剂量(ml)" prop="liquid_qty">
<label slot="label">溶剂量(ml):</label>
<el-input-number
v-model="form.liquid_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="合金球(KG)" prop="ball_qty">
<label slot="label">合金球(KG):</label>
<el-input-number
v-model="form.ball_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球磨转速(RPM)" prop="ball_speed">
<label slot="label">球磨转速(RPM):</label>
<el-input-number
v-model="form.ball_speed"
:controls="false"
:precision="0"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="研磨时间(H)" prop="ball_time">
<label slot="label">研磨时间(H):</label>
<el-input-number
v-model="form.ball_time"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="开单人" align="center">
<el-input v-model="form.create_name" placeholder="开单人" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="开单日期" align="center">
<el-input v-model="form.create_time" placeholder="开单人" style="width: 210px" disabled />
</el-form-item>
</el-form>
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertdtl"
>
开单计算
</el-button>
</span>
</div>
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="material_code" label="物料编码" align="center" />
<el-table-column prop="material_name" label="物料名称" align="center" />
<el-table-column prop="formula_qty" label="重量" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.formula_qty"
size="mini"
:controls="false"
:precision="4"
:max="100"
:min="0"
:disabled="scope.row.edit"
/>
</template>
</el-table-column>
<el-table-column prop="dtl_pcsn" label="批次" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.dtl_pcsn" placeholder="批次" />
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import Date from '@/utils/datetime'
const defaultForm = {
formula_code: '',
material_id: '',
inspection_id: '',
CJZB00001: 0,
CJZB00002: 0,
CJZB00006: 0,
CJZB00020: 0,
CJZB00021: 0,
CJZB00004: 0,
CJZB00007: 0,
mark_id: '',
create_name: '',
create_time: (new Date()).strftime('%F', 'zh'),
accept_pcsn: '',
accept_qty: 1000,
c_balance: 0,
ball_rate: 0,
liquid_rate: 0,
ball_qty: 0,
liquid_qty: 0,
ball_time: 0,
ball_speed: 0,
tableData: []
}
import crudacceptformula from '@/api/wms/pf/acceptformula'
import CRUD, { form, crud } from '@crud/crud'
export default {
name: 'AddDialog',
components: {},
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
dtlMaterShow: false,
nowrow: {},
nowindex: '',
boms: [],
THWs: [],
PCSNs: [],
rules: {
material_id: [
{ required: true, message: '物料不能为空', trigger: 'blur' }
],
inspection_id: [
{ required: true, message: '批号不能为空', trigger: 'blur' }
],
mark_id: [
{ required: true, message: '验收牌号不能为空', trigger: 'blur' }
],
accept_pcsn: [
{ required: true, message: '试验批号不能为空', trigger: 'blur' }
],
accept_qty: [
{ required: true, message: '试验重量不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
created() {
crudacceptformula.getBoms().then(res => {
this.boms = res
})
crudacceptformula.getTHWs().then(res => {
this.THWs = res
})
},
methods: {
[CRUD.HOOK.beforeSubmit]() {
if (!this.form.mark_id) {
this.crud.notify('验收牌号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!this.form.accept_pcsn) {
this.crud.notify('试验批号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.accept_qty <= 0) {
this.crud.notify('试验重量不能为0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.tableData.length === 0) {
this.crud.notify('开单明细不能为空', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
[CRUD.HOOK.afterToEdit]() {
// 编辑之后获取明细
crudacceptformula.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
this.form.tableData = res
})
},
storChange(row) {
crudacceptformula.getPCSNs({ 'material_id': row }).then(res => {
this.PCSNs = res
this.form.inspection_id = ''
this.form.CJZB00007 = '0'
this.form.CJZB00001 = '0'
this.form.CJZB00002 = '0'
this.form.CJZB00006 = '0'
this.form.CJZB00021 = '0'
this.form.CJZB00020 = '0'
this.form.CJZB00004 = '0'
})
},
storChange2(row) {
crudacceptformula.getPCSN({ 'inspection_id': row }).then(res => {
this.form.CJZB00007 = res.CJZB00007
this.form.CJZB00001 = res.CJZB00001
this.form.CJZB00002 = res.CJZB00002
this.form.CJZB00006 = res.CJZB00006
this.form.CJZB00021 = res.CJZB00021
this.form.CJZB00020 = res.CJZB00020
this.form.CJZB00004 = res.CJZB00004
})
},
storChange3(row) {
crudacceptformula.getBom({ 'mark_id': row }).then(res => {
this.form.c_balance = res.c_balance
this.form.ball_rate = res.ball_rate
this.form.liquid_rate = res.liquid_rate
this.form.ball_time = res.ball_time
this.form.ball_speed = res.ball_speed
this.form.ball_qty = this.form.ball_rate * this.form.accept_qty / 100.0
this.form.liquid_qty = this.form.liquid_rate * this.form.accept_qty / 100.0
})
},
storChange4(row) {
this.form.ball_qty = this.form.ball_rate * this.form.accept_qty / 100.0
this.form.liquid_qty = this.form.liquid_rate * this.form.accept_qty / 100.0
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
this.$emit('update:dialogShow', false)
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
if (parseFloat(row.standard_rate) <= 0) {
this.crud.notify('标准值必须大于0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.material_code) {
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
},
insertdtl() {
this.form.tableData.push({ material_id: '', material_code: '', material_name: '', standard_rate: '0', seqno: '', edit: false })
},
createPcsn() {
crudacceptformula.createPcsn().then(res => {
this.form.accept_pcsn = res.accept_pcsn
})
}
}
}
</script>
<style scoped>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,343 @@
<template>
<el-dialog
style="padding-top: 0px;"
:title="crud.status.title"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
<el-form-item label="实验序号" prop="formula_code">
<el-input v-model="form.formula_code" placeholder="系统生成" style="width: 210px" disabled>
</el-input>
</el-form-item>
<el-form-item label="物料" prop="material_id">
<el-select
v-model="form.material_id"
placeholder="物料"
style="width: 210px"
class="filter-item"
:disabled="crud.status.view > 0"
>
<el-option
v-for="item in THWs"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="批号" prop="inspection_id">
<el-select
v-model="form.inspection_id"
clearable
size="mini"
placeholder="批号"
class="filter-item"
>
<el-option
v-for="item in PCSNs"
:key="item.id"
:label="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="生产厂家" prop="manufactor">
<el-input v-model="form.manufactor" placeholder="生产厂家" style="width: 210px" disabled>
</el-input>
</el-form-item>
<el-form-item label="CT(%)" prop="c_balance">
<label slot="label">CT(%):</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="Cr3C2" prop="c_balance">
<label slot="label">Cr3C2:</label>
<el-input-number
v-model="form.liquid_rate"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="氧含量" prop="c_balance">
<label slot="label">氧含量:</label>
<el-input-number
v-model="form.ball_rate"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="VC(%)" prop="c_balance">
<label slot="label">VC(%):</label>
<el-input-number
v-model="form.ball_speed"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="CF(%)" prop="c_balance">
<label slot="label">CF(%):</label>
<el-input-number
v-model="form.ball_time"
:controls="false"
:precision="0"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="FSSS(μm)">
<label slot="label">FSSS(μm):</label>
<el-input-number
v-model="form.total_value"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="BET(/g)">
<label slot="label">BET(㎡/g):</label>
<el-input-number
v-model="form.total_value2"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="明细数">
<el-input v-model="form.tableData.length" :disabled="true" style="width: 210px;" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
</el-form-item>
</el-form>
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertdtl"
>
开单计算
</el-button>
</span>
</div>
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="material_code" label="物料编码" align="center" />
<el-table-column prop="material_name" label="物料名称" align="center" />
<el-table-column prop="standard_rate" label="标准值%" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.standard_rate"
size="mini"
:controls="false"
:precision="4"
:max="100"
:min="0"
:disabled="scope.row.edit"
/>
</template>
</el-table-column>
<el-table-column prop="seqno" label="顺序号" align="center" />
</el-table>
</el-dialog>
</template>
<script>
const defaultForm = {
formula_code: '',
material_id: '',
inspection_id: '',
c_balance: 0,
liquid_rate: 0,
ball_rate: 0,
ball_speed: 0,
ball_time: 0,
detail_count: 0,
manufactor: '',
total_value: 0,
total_value2: 0,
remark: '',
tableData: []
}
import crudacceptformula from '@/api/wms/pf/acceptformula'
import CRUD, { form, crud } from '@crud/crud'
export default {
name: 'AddDialog',
components: {},
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
dtlMaterShow: false,
nowrow: {},
boms: [],
THWs: [],
PCSNs: [],
nowindex: '',
rules: {
material_id: [
{ required: true, message: '牌号不能为空', trigger: 'blur' }
],
inspection_id: [
{ required: true, message: '批次不能为空', trigger: 'blur' }
],
c_balance: [
{ required: true, message: '碳平衡不能为空', trigger: 'blur' }
],
liquid_rate: [
{ required: true, message: '液料比不能为空', trigger: 'blur' }
],
ball_rate: [
{ required: true, message: '球料比不能为空', trigger: 'blur' }
],
ball_speed: [
{ required: true, message: '球磨转速不能为空', trigger: 'blur' }
],
ball_time: [
{ required: true, message: '研磨时间不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
created() {
crudacceptformula.getBoms().then(res => {
this.boms = res
})
crudacceptformula.getTHWs().then(res => {
this.THWs = res
})
crudacceptformula.getPCSNs().then(res => {
this.PCSNs = res
})
},
methods: {
[CRUD.HOOK.beforeSubmit]() {
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
[CRUD.HOOK.afterToEdit]() {
// 编辑之后获取明细
crudacceptformula.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
this.form.tableData = res
})
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
this.$emit('update:dialogShow', false)
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
if (parseFloat(row.standard_rate) <= 0) {
this.crud.notify('标准值必须大于0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.material_code) {
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
},
insertdtl() {
}
}
}
</script>
<style scoped>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,188 @@
<template>
<el-dialog
style="padding-top: 0px;"
title="小线实验牌号详情"
:visible.sync="dialogVisible"
append-to-body
fullscreen
@open="open"
@close="close"
>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="150px" label-suffix=":">
<el-form-item label="牌号" prop="mark_code">
<el-input v-model="form.mark_code" placeholder="牌号" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="碳平衡" prop="c_balance">
<label slot="label">碳平衡:</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="液料比" prop="c_balance">
<label slot="label">液料比:</label>
<el-input-number
v-model="form.liquid_rate"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球料比" prop="c_balance">
<label slot="label">球料比:</label>
<el-input-number
v-model="form.ball_rate"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球磨转速(RPM)" prop="c_balance">
<label slot="label">球磨转速(RPM):</label>
<el-input-number
v-model="form.ball_speed"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="研磨时间(H)" prop="c_balance">
<label slot="label">研磨时间(H):</label>
<el-input-number
v-model="form.ball_time"
:controls="false"
:precision="0"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="标准值合计(%)">
<label slot="label">标准值合计(%):</label>
<el-input-number
v-model="form.total_value"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="明细数">
<el-input v-model="tableData.length" disabled style="width: 210px;" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" disabled />
</el-form-item>
</el-form>
<el-table
ref="table"
:data="tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="material_code" label="物料编码" align="center" />
<el-table-column prop="material_name" label="物料名称" align="center" />
<el-table-column prop="standard_rate" label="标准值%" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.standard_rate"
size="mini"
:controls="false"
:precision="4"
:max="100"
:min="0"
disabled
/>
</template>
</el-table-column>
<el-table-column prop="seqno" label="顺序号" align="center" />
</el-table>
</el-dialog>
</template>
<script>
import { crud } from '@crud/crud'
import crudacceptmark from '@/api/wms/pf/acceptmark'
export default {
name: 'ViewDialog',
components: {},
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
data() {
return {
dialogVisible: false,
form: {},
tableData: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue) {
this.form = newValue
}
}
},
methods: {
open() {
// 编辑之后获取明细
crudacceptmark.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
this.tableData = res
// 计算合计值
let all = 0
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i]
row.edit = true
this.tableData.splice(i, 1, row)
all = all + parseFloat(row.standard_rate)
}
this.form.total_value = all
})
},
close() {
this.$emit('update:dialogShow', false)
this.form = {}
this.tableData = []
this.$emit('AddChanged')
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,217 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
size="mini"
label-width="80px"
label-suffix=":"
>
<el-form-item label="工令日期">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@input="onInput()"
@change="mytoQuery"
/>
</el-form-item>
<el-form-item label="碳化钨">
<el-input
v-model="query.material_code"
size="mini"
clearable
placeholder="请输入碳化钨编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="碳化钨批号">
<el-input
v-model="query.material_pcsn"
size="mini"
clearable
placeholder="请输入碳化钨批号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="实验序号">
<el-input
v-model="query.formula_code"
size="mini"
clearable
placeholder="请输入实验序号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="验收牌号">
<el-select
v-model="query.mark_id"
clearable
size="mini"
placeholder="验收牌号"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in boms"
:key="item.id"
:label="item.code"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="试验批号">
<el-input
v-model="query.accept_pcsn"
size="mini"
clearable
placeholder="请输入试验批号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
>
打印
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="45" />
<el-table-column v-permission="[]" label="操作" fixed="right" width="120px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
<el-table-column prop="formula_code" width="120px" label="实验序号" align="center">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.formula_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="material_code" label="碳化钨编码" width="120px" align="center" />
<el-table-column prop="material_name" label="碳化钨名称" width="120px" align="center" />
<el-table-column prop="material_pcsn" label="碳化钨批次" width="120px" align="center" />
<el-table-column prop="mark_code" label="验收牌号" width="120px" align="center" />
<el-table-column prop="accept_pcsn" label="试验批号" width="120px" align="center" />
<el-table-column prop="detail_count" label="明细数" align="center" min-width="60" />
<el-table-column prop="accept_qty" label="重量" align="center" min-width="80" :formatter="crud.formatNum3" />
<el-table-column prop="confirm_qty" label="开单重量" align="center" min-width="80" :formatter="crud.formatNum3" />
<el-table-column prop="remark" label="备注" align="center" min-width="135" />
<el-table-column prop="create_name" label="创建人" align="center" min-width="80" />
<el-table-column prop="create_time" label="创建时间" min-width="135" align="center" />
<el-table-column prop="update_optname" label="修改人" align="center" min-width="80" />
<el-table-column prop="update_time" label="修改时间" min-width="135" align="center" />
</el-table>
<!--分页组件-->
<pagination />
</div>
<AddDialog />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
</div>
</template>
<script>
import crudacceptformula from '@/api/wms/pf/acceptformula'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/pf/acceptformula/AddDialog'
import ViewDialog from '@/views/wms/pf/acceptformula/ViewDialog'
import Date from '@/utils/datetime'
export default {
name: 'Acceptformula',
components: { AddDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
title: '碳化钨小线验收试验',
url: 'api/acceptformula',
idField: 'formula_id',
sort: 'create_time desc',
crudMethod: { ...crudacceptformula },
optShow: {
add: true,
del: false,
edit: false,
reset: true
}
})
},
data() {
return {
permission: {
},
mstrow: {},
boms: [],
viewShow: false,
query_flag: true,
rules: {
}}
},
created() {
crudacceptformula.getBoms().then(res => {
this.boms = res
})
this.crud.query.createTime = [new Date(), new Date()]
},
methods: {
hand(value) {
this.crud.toQuery()
},
[CRUD.HOOK.beforeRefresh]() {
if (this.query_flag) {
this.crud.query.begin_time = (new Date()).strftime('%F', 'zh')
this.crud.query.end_time = (new Date()).strftime('%F', 'zh')
this.query_flag = false
}
},
onInput() {
this.$forceUpdate()
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
mytoQuery(array1) {
if (array1 === null) {
this.crud.query.begin_time = ''
this.crud.query.end_time = ''
} else {
this.crud.query.begin_time = array1[0]
this.crud.query.end_time = array1[1]
}
this.crud.toQuery()
},
querytable() {
this.crud.toQuery()
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,343 @@
<template>
<el-dialog
style="padding-top: 0px;"
:title="crud.status.title"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
<el-form-item label="牌号" prop="mark_code">
<el-input v-model="form.mark_code" placeholder="牌号" style="width: 210px" >
</el-input>
</el-form-item>
<el-form-item label="碳平衡" prop="c_balance">
<label slot="label">碳平衡:</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="0"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="液料比" prop="c_balance">
<label slot="label">液料比:</label>
<el-input-number
v-model="form.liquid_rate"
:controls="false"
:precision="3"
:min="0"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球料比" prop="c_balance">
<label slot="label">球料比:</label>
<el-input-number
v-model="form.ball_rate"
:controls="false"
:precision="3"
:min="0"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球磨转速(RPM)" prop="c_balance">
<label slot="label">球磨转速(RPM):</label>
<el-input-number
v-model="form.ball_speed"
:controls="false"
:precision="3"
:min="0"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="研磨时间(H)" prop="c_balance">
<label slot="label">研磨时间(H):</label>
<el-input-number
v-model="form.ball_time"
:controls="false"
:precision="0"
:min="0"
style="width: 210px"
/>
</el-form-item>
<el-form-item label="标准值合计(%)">
<label slot="label">标准值合计(%):</label>
<el-input-number
v-model="form.total_value"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="明细数">
<el-input v-model="form.tableData.length" :disabled="true" style="width: 210px;" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
</el-form-item>
</el-form>
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="crud.status.view > 0"
@click="insertdtl"
>
添加一行
</el-button>
</span>
</div>
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="material_code" label="物料编码" align="center">
<template slot-scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="queryDtlMater(scope.$index, scope.row)" />
</el-input>
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
</template>
</el-table-column>
<el-table-column prop="material_name" label="物料名称" align="center" />
<el-table-column prop="standard_rate" label="标准值%" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.standard_rate"
size="mini"
:controls="false"
:precision="4"
:max="100"
:min="0"
:disabled="scope.row.edit"
/>
</template>
</el-table-column>
<el-table-column prop="seqno" label="顺序号" align="center" />
<el-table-column v-if="crud.status.cu > 0" v-permission="['admin','productbom:edit','productbom:del']" align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="delOne(scope.$index, form.tableData)" />
<el-button v-show="!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button v-show="scope.row.edit" type="success" class="filter-item" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">完成</el-button>
</template>
</el-table-column>
</el-table>
<MaterDtl
:dialog-show.sync="dtlMaterShow"
:is-single="true"
:mater-opt-code="'04'"
@tableChanged2="tableChanged2"
/>
</el-dialog>
</template>
<script>
const defaultForm = {
mark_code: '',
c_balance: 0,
liquid_rate: 0,
ball_rate: 0,
ball_speed: 0,
ball_time: 0,
detail_count: 0,
material_code: '',
total_value: 0,
remark: '',
tableData: []
}
import crudacceptmark from '@/api/wms/pf/acceptmark'
import CRUD, { form, crud } from '@crud/crud'
import MaterDtl from '@/views/wms/pub/MaterDialog'
export default {
name: 'AddDialog',
components: { MaterDtl },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
data() {
return {
dialogVisible: false,
dtlMaterShow: false,
nowrow: {},
nowindex: '',
rules: {
mark_code: [
{ required: true, message: '牌号不能为空', trigger: 'blur' }
],
c_balance: [
{ required: true, message: '碳平衡不能为空', trigger: 'blur' }
],
liquid_rate: [
{ required: true, message: '液料比不能为空', trigger: 'blur' }
],
ball_rate: [
{ required: true, message: '球料比不能为空', trigger: 'blur' }
],
ball_speed: [
{ required: true, message: '球磨转速不能为空', trigger: 'blur' }
],
ball_time: [
{ required: true, message: '研磨时间不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
[CRUD.HOOK.beforeSubmit]() {
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.total_value < 100) {
this.crud.notify('标准合计值不足100', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
[CRUD.HOOK.afterToEdit]() {
// 编辑之后获取明细
crudacceptmark.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
this.form.tableData = res
// 计算合计值
let all = 0
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = true
this.form.tableData.splice(i, 1, row)
all = all + parseFloat(row.standard_rate)
}
this.form.total_value = all
})
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
this.$emit('update:dialogShow', false)
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
if (parseFloat(row.standard_rate) <= 0) {
this.crud.notify('标准值必须大于0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.material_code) {
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if ((this.form.total_value + parseFloat(row.standard_rate)) > 100) {
this.crud.notify('标准合计值不能超过100', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
this.form.total_value = 0
this.form.tableData.forEach((item) => {
if (item.edit) {
this.form.total_value = this.form.total_value + parseFloat(item.standard_rate)
}
})
},
insertdtl() {
this.form.tableData.push({ material_id: '', material_code: '', material_name: '', standard_rate: '0', seqno: '', edit: false })
},
delOne(index, rows) {
this.form.total_value = parseFloat(this.form.total_value) - parseFloat(rows[index].standard_rate)
if (this.form.total_value < 0) {
this.form.total_value = 0
}
rows.splice(index, 1)
},
queryDtlMater(index, row) {
this.dtlMaterShow = true
this.nowindex = index
this.nowrow = row
},
tableChanged2(row) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].material_id === row.material_id) {
this.crud.notify('不允许添加相同物料!')
return false
}
}
this.nowrow.material_id = row.material_id
this.nowrow.material_code = row.material_code
this.nowrow.material_name = row.material_name
this.nowrow.standard_rate = '0'
this.nowrow.edit = false
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
}
}
}
</script>
<style scoped>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,188 @@
<template>
<el-dialog
style="padding-top: 0px;"
title="小线实验牌号详情"
:visible.sync="dialogVisible"
append-to-body
fullscreen
@open="open"
@close="close"
>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="150px" label-suffix=":">
<el-form-item label="牌号" prop="mark_code">
<el-input v-model="form.mark_code" placeholder="牌号" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="碳平衡" prop="c_balance">
<label slot="label">碳平衡:</label>
<el-input-number
v-model="form.c_balance"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="液料比" prop="c_balance">
<label slot="label">液料比:</label>
<el-input-number
v-model="form.liquid_rate"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球料比" prop="c_balance">
<label slot="label">球料比:</label>
<el-input-number
v-model="form.ball_rate"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="球磨转速(RPM)" prop="c_balance">
<label slot="label">球磨转速(RPM):</label>
<el-input-number
v-model="form.ball_speed"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="研磨时间(H)" prop="c_balance">
<label slot="label">研磨时间(H):</label>
<el-input-number
v-model="form.ball_time"
:controls="false"
:precision="0"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="标准值合计(%)">
<label slot="label">标准值合计(%):</label>
<el-input-number
v-model="form.total_value"
:controls="false"
:precision="4"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="明细数">
<el-input v-model="tableData.length" disabled style="width: 210px;" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" disabled />
</el-form-item>
</el-form>
<el-table
ref="table"
:data="tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="material_code" label="物料编码" align="center" />
<el-table-column prop="material_name" label="物料名称" align="center" />
<el-table-column prop="standard_rate" label="标准值%" align="center">
<template slot-scope="scope">
<el-input-number
v-model="scope.row.standard_rate"
size="mini"
:controls="false"
:precision="4"
:max="100"
:min="0"
disabled
/>
</template>
</el-table-column>
<el-table-column prop="seqno" label="顺序号" align="center" />
</el-table>
</el-dialog>
</template>
<script>
import { crud } from '@crud/crud'
import crudacceptmark from '@/api/wms/pf/acceptmark'
export default {
name: 'ViewDialog',
components: {},
mixins: [crud()],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
data() {
return {
dialogVisible: false,
form: {},
tableData: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue) {
this.form = newValue
}
}
},
methods: {
open() {
// 编辑之后获取明细
crudacceptmark.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
this.tableData = res
// 计算合计值
let all = 0
for (let i = 0; i < this.tableData.length; i++) {
const row = this.tableData[i]
row.edit = true
this.tableData.splice(i, 1, row)
all = all + parseFloat(row.standard_rate)
}
this.form.total_value = all
})
},
close() {
this.$emit('update:dialogShow', false)
this.form = {}
this.tableData = []
this.$emit('AddChanged')
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>

View File

@@ -0,0 +1,120 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
size="mini"
label-width="80px"
label-suffix=":"
>
<el-form-item label="验收牌号">
<el-input
v-model="query.material_code"
size="mini"
clearable
placeholder="请输入验收牌号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission" />
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="45" />
<el-table-column v-permission="[]" label="操作" fixed="right" width="120px" align="center">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
/>
</template>
</el-table-column>
<el-table-column prop="mark_code" width="150px" label="牌号" align="center">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.mark_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="c_balance" label="碳平衡" width="90px" align="center" :formatter="crud.formatQlNum4" />
<el-table-column prop="liquid_rate" label="液料比" width="60" align="center" :formatter="crud.formatNum2" />
<el-table-column prop="ball_rate" label="球料比" width="60" align="center" :formatter="crud.formatNum2" />
<el-table-column prop="ball_speed" label="球磨转速(RPM)" width="120px" align="center" :formatter="crud.formatNum2" />
<el-table-column prop="ball_time" label="研磨时间(h)" width="90px" align="center" :formatter="crud.formatNum2" />
<el-table-column prop="detail_count" label="明细数" align="center" min-width="60" />
<el-table-column prop="remark" label="备注" align="center" min-width="135" />
<el-table-column prop="create_name" label="创建人" align="center" min-width="80" />
<el-table-column prop="create_time" label="创建时间" min-width="135" align="center" />
<el-table-column prop="update_optname" label="修改人" align="center" min-width="80" />
<el-table-column prop="update_time" label="修改时间" min-width="135" align="center" />
</el-table>
<!--分页组件-->
<pagination />
</div>
<AddDialog />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
</div>
</template>
<script>
import crudacceptmark from '@/api/wms/pf/acceptmark'
import CRUD, { presenter, header, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/pf/acceptmark/AddDialog'
import ViewDialog from '@/views/wms/pf/acceptmark/ViewDialog'
export default {
name: 'Acceptmark',
components: { AddDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
title: '小线实验牌号维护',
url: 'api/acceptmark',
idField: 'mark_id',
sort: 'create_time desc',
crudMethod: { ...crudacceptmark },
optShow: {
add: true,
del: false,
edit: false,
reset: true
}
})
},
data() {
return {
permission: {
},
mstrow: {},
viewShow: false,
rules: {
}}
},
methods: {
hand(value) {
this.crud.toQuery()
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
querytable() {
this.crud.toQuery()
}
}
}
</script>
<style scoped>
</style>