Merge branch 'master' of http://121.40.234.130:8899/root/wuHanXinRui
This commit is contained in:
@@ -436,7 +436,7 @@ public class PhysicalMstServiceImpl implements PhysicalMstService {
|
||||
JSONObject JsonValue = phyDtlTab.query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + inspection_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(JsonValue)) num = num + 1;
|
||||
}
|
||||
if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
||||
// if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
||||
|
||||
/*
|
||||
* 理化报告是否有效: 有效更新一级质检单以及一系列操作,
|
||||
|
||||
@@ -16,10 +16,12 @@ 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.utils.SpringContextHolder;
|
||||
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
import org.nl.wms.ql.Enum.QlBillStatusEnum;
|
||||
import org.nl.wms.ql.service.InspectionsheetmstService;
|
||||
import org.nl.wms.ql.service.PhysicalMstService;
|
||||
import org.nl.wms.ql.service.WorkproceduremstService;
|
||||
import org.nl.wms.ql.service.dto.WorkproceduremstDto;
|
||||
import org.nl.wql.WQL;
|
||||
@@ -338,8 +340,12 @@ public class WorkproceduremstServiceImpl implements WorkproceduremstService {
|
||||
public void confirm(JSONObject whereJson) {
|
||||
String workprocedure_uuid = whereJson.getString("workprocedure_uuid");
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_WorkProcedureMst"); // 工序质检单主表
|
||||
WQLObject sheetMstTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetMst"); // 质检单主表
|
||||
WQLObject sheetDtlTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetDtl"); // 质检单明细表
|
||||
WQLObject phyMstTab = WQLObject.getWQLObject("QL_TEST_PhysicalMst"); // 理化报告主表
|
||||
WQLObject workTaskTab = WQLObject.getWQLObject("PDM_BI_WorkTask"); // 工令工序任务表
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
@@ -358,9 +364,8 @@ public class WorkproceduremstServiceImpl implements WorkproceduremstService {
|
||||
JSONObject JsonValue = WQLObject.getWQLObject("QL_TEST_WorkProcedureDtl").query("inspection_item_id = '" + inspection_item_id + "' and inspection_id = '" + whereJson.getString("inspection_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(JsonValue)) num = num + 1;
|
||||
}
|
||||
if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
||||
// if (itemArr.size() != num) throw new BadRequestException("所有项点必须有值");
|
||||
|
||||
WQLObject mstTab = WQLObject.getWQLObject("QL_TEST_WorkProcedureMst");
|
||||
JSONObject jsonMst = mstTab.query("inspection_id = '" + whereJson.getString("inspection_id") + "'").uniqueResult(0);
|
||||
jsonMst.put("bill_status",QlBillStatusEnum.FINISH.getCode());
|
||||
jsonMst.put("confirm_optid",currentUserId);
|
||||
@@ -385,6 +390,40 @@ public class WorkproceduremstServiceImpl implements WorkproceduremstService {
|
||||
jsonSheetMst.put("confirm_optname", nickName);
|
||||
jsonSheetMst.put("confirm_time", now);
|
||||
sheetMstTab.update(jsonSheetMst);
|
||||
/*
|
||||
* 如果此工令工序任务下的所有工序质检单都为不合格:
|
||||
* 判断条件:此工令工序任务必须为完成状态。
|
||||
* 1.如果存在理化报告则确认理化报告为不合格,
|
||||
* 2.确认一级质检单为不合格
|
||||
*/
|
||||
// 1. 查询是否存在此物料、此批次、此工序、并且已完成的工序任务
|
||||
String material_id = jsonMst.getString("material_id");
|
||||
String pcsn = jsonMst.getString("pcsn");
|
||||
JSONObject jsonWorkTask = workTaskTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn + "' and workprocedure_id = '" + workprocedure_uuid + "' and status = '99'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonWorkTask)) {
|
||||
// 2.不为空则查出此工序任务下的所有 工序质检单,判断所有的质检单是否都为不合格
|
||||
JSONArray mstArr = mstTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn + "' and workprocedure_uuid = '" + workprocedure_uuid + "'").getResultJSONArray(0);
|
||||
int flag = 0;
|
||||
for (int i = 0; i < mstArr.size(); i++) {
|
||||
JSONObject json = mstArr.getJSONObject(i);
|
||||
if (StrUtil.equals(json.getString("result"), "02")) {
|
||||
flag += 1;
|
||||
}
|
||||
}
|
||||
if (flag == mstArr.size()) {
|
||||
// 3.都不合格则判断此物料、批次是否存在理化报告;存在则确认理化报告
|
||||
JSONObject jsonPhyMst = phyMstTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn + "' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonPhyMst)) {
|
||||
// 4.不为空、确认理化报告
|
||||
jsonPhyMst.put("result", "02");
|
||||
jsonPhyMst.put("grade", jsonMst.getString("grade"));
|
||||
jsonPhyMst.put("bill_status", QlBillStatusEnum.TEST_LABORATORY.getCode());
|
||||
phyMstTab.update(jsonPhyMst);
|
||||
SpringContextHolder.getBean(PhysicalMstService.class).confirm(jsonPhyMst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,8 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -38,4 +40,10 @@ public class RawUatWcQueryController {
|
||||
public ResponseEntity<Object> getHeader(@PathVariable String material_type_id) {
|
||||
return new ResponseEntity<>(rawUatWcQueryService.getHeader(material_type_id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
rawUatWcQueryService.download(whereJson, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package org.nl.wms.statistics.service;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -24,4 +26,6 @@ public interface RawUatWcQueryService {
|
||||
* 获取表头
|
||||
*/
|
||||
JSONArray getHeader( String material_type_id);
|
||||
|
||||
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.statistics.service.PhysicalQueryService;
|
||||
import org.nl.wms.statistics.service.RawUatWcQueryService;
|
||||
@@ -17,8 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -167,4 +169,110 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService {
|
||||
jonsResuftArr.add(jsonResuft9);
|
||||
return jonsResuftArr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("begin_time", MapUtil.getStr(whereJson,"begin_time"));
|
||||
map.put("end_time", MapUtil.getStr(whereJson,"end_time"));
|
||||
map.put("receive_code", MapUtil.getStr(whereJson,"receive_code"));
|
||||
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", "%"+pcsn+"%");
|
||||
map.put("bill_status", MapUtil.getStr(whereJson,"bill_status"));
|
||||
if (!ObjectUtil.isEmpty(material_code)) {
|
||||
//处理转义字符
|
||||
if (material_code.contains("\\"))material_code=material_code.replace("\\","\\\\\\");
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
if (!StrUtil.isEmpty(material_type_id)) {
|
||||
map.put("material_type_id", material_type_id);
|
||||
String classIds = classstandardService.getChildIdStr(material_type_id);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONArray content = WQL.getWO("RaUatWc_query_01").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONArray array = new JSONArray();
|
||||
for (int i = 0; i < content.size(); i++) {
|
||||
JSONObject jsonObject = content.getJSONObject(i);
|
||||
String pcsn1 = jsonObject.getString("pcsn");
|
||||
String material_id = jsonObject.getString("material_id");
|
||||
String result = jsonObject.getString("result");
|
||||
JSONObject jsonResuft = new JSONObject();
|
||||
jsonResuft.put("1", jsonObject.getString("material_code"));
|
||||
jsonResuft.put("2", jsonObject.getString("material_name"));
|
||||
jsonResuft.put("3", jsonObject.getString("pcsn"));
|
||||
jsonResuft.put("4",NumberUtil.decimalFormat("#.000", jsonObject.getDoubleValue("receive_qty")));
|
||||
// 厂家
|
||||
|
||||
JSONObject jsonSuup = WQL.getWO("RaUatWc_query_01").addParam("flag", "6").addParam("pcsn", pcsn1).addParam("material_id", material_id).process().uniqueResult(0);
|
||||
jsonResuft.put("5", jsonSuup.getString("supp_name"));
|
||||
|
||||
jsonResuft.put("remark", jsonObject.getString("remark"));
|
||||
jsonResuft.put("biz_date", jsonObject.getString("biz_date"));
|
||||
if (StrUtil.equals(result, "01")) {
|
||||
jsonResuft.put("result", "合格");
|
||||
} else if (StrUtil.equals(result, "02")) {
|
||||
jsonResuft.put("result", "不合格");
|
||||
} else if (StrUtil.equals(result, "03")) {
|
||||
jsonResuft.put("result", "紧急放行");
|
||||
}
|
||||
// 根据物料批次查找厂家质保书对应的项点
|
||||
JSONArray jsonFaArr = WQL.getWO("RaUatWc_query_01").addParam("flag", "3").addParam("pcsn", pcsn1).addParam("material_id", material_id).process().getResultJSONArray(0);
|
||||
for (int j = 0; j < jsonFaArr.size(); j++) {
|
||||
JSONObject jsonItem = jsonFaArr.getJSONObject(j);
|
||||
String inspection_item_id = jsonItem.getString("inspection_item_id");
|
||||
double value = jsonItem.getDoubleValue("value");
|
||||
if (value > 0 && value < 1){
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.00", value));
|
||||
} else if (value == 0){
|
||||
jsonResuft.put(inspection_item_id,"0.00");
|
||||
} else {
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.00", value));
|
||||
}
|
||||
}
|
||||
// 根据物料批次查找理化单对应的项点
|
||||
JSONArray jsonPhyArr = WQL.getWO("RaUatWc_query_01").addParam("flag", "4").addParam("pcsn", pcsn1).addParam("material_id", material_id).process().getResultJSONArray(0);
|
||||
for (int k = 0; k < jsonPhyArr.size(); k++) {
|
||||
JSONObject jsonItem = jsonPhyArr.getJSONObject(k);
|
||||
String inspection_item_id = jsonItem.getString("inspection_item_id");
|
||||
double value = jsonItem.getDoubleValue("value");
|
||||
if (value > 0 && value < 1) {
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.00", value));
|
||||
} else if (value == 0){
|
||||
jsonResuft.put(inspection_item_id,"0.00");
|
||||
} else {
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.00", value));
|
||||
}
|
||||
}
|
||||
array.add(jsonResuft);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject json = array.getJSONObject(i);
|
||||
Map<String, Object> map_dtl = new LinkedHashMap<>();
|
||||
map_dtl.put("物料编码",json.getString("1"));
|
||||
map_dtl.put("物料名称",json.getString("2"));
|
||||
map_dtl.put("批号",json.getString("3"));
|
||||
map_dtl.put("重量",json.getString("4"));
|
||||
map_dtl.put("厂家",json.getString("5"));
|
||||
JSONArray jsonArr = WQL.getWO("RaUatWc_query_01").addParam("flag", "5").process().getResultJSONArray(0);
|
||||
for (int j = 0; j < jsonArr.size(); j++) {
|
||||
JSONObject jsonObject = jsonArr.getJSONObject(j);
|
||||
map_dtl.put(jsonObject.getString("inspection_item_name"),"");
|
||||
|
||||
String inspection_item_id = jsonObject.getString("inspection_item_id");
|
||||
if (ObjectUtil.isNotEmpty(json.getString(inspection_item_id))) {
|
||||
map_dtl.put(jsonObject.getString("inspection_item_name"),json.getString(inspection_item_id));
|
||||
}
|
||||
}
|
||||
map_dtl.put("工艺实验处理意见",json.getString("remark"));
|
||||
map_dtl.put("工艺报告日期",json.getString("biz_date"));
|
||||
map_dtl.put("总结论",json.getString("result"));
|
||||
list.add(map_dtl);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,12 +475,14 @@ export default {
|
||||
const data = this.form1.tableData
|
||||
var flag = 0
|
||||
for (var row of data) {
|
||||
if (!row.value) {
|
||||
flag = flag + 1
|
||||
if (row.up_limit !== '') {
|
||||
if (!row.value) {
|
||||
flag = flag + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果检测值一项都没填则提示是否继续
|
||||
if (flag === data.length) {
|
||||
// 如果检测值有一项没填则提示是否继续 (在上限下限有值的情况下)
|
||||
if (flag > 0) {
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -481,12 +481,14 @@ export default {
|
||||
const data = this.form1.tableData
|
||||
var flag = 0
|
||||
for (var row of data) {
|
||||
if (!row.value) {
|
||||
flag = flag + 1
|
||||
if (row.up_limit !== '') {
|
||||
if (!row.value) {
|
||||
flag = flag + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
// 如果检测值一项都没填则提示是否继续
|
||||
if (flag === data.length) {
|
||||
// 如果检测值有一项没填则提示是否继续 (在上限下限有值的情况下)
|
||||
if (flag > 0) {
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
@@ -270,6 +270,39 @@ export default {
|
||||
count() {
|
||||
},
|
||||
sure() {
|
||||
const msg = '是否继续!'
|
||||
|
||||
const rows = this.form.tableData
|
||||
var flag = 0
|
||||
for (var row of rows) {
|
||||
if (row.up_limit !== '') {
|
||||
if (!row.value) {
|
||||
flag = flag + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
const data = this.form
|
||||
if (flag > 0) {
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudWorkproceduremst.sure(data).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('录入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
crudWorkproceduremst.sure(data).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('录入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
}
|
||||
},
|
||||
sure2() {
|
||||
const rows = this.form.tableData
|
||||
var flag = 0
|
||||
for (var row of rows) {
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产负责人" prop="product_person_name">
|
||||
<el-form-item label="生产配合人" prop="product_person_name">
|
||||
<el-input v-model="form.product_person_name" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@@ -74,7 +74,18 @@
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="downdtl"
|
||||
>
|
||||
导出Excel
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
@@ -105,6 +116,8 @@ import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
import crudInspectionsheetmst from '@/api/wms/ql/inspectionsheetmst'
|
||||
import {download} from "@/api/data";
|
||||
import {downloadFile} from "@/utils";
|
||||
|
||||
export default {
|
||||
name: 'RawUatCbQuery',
|
||||
@@ -160,6 +173,17 @@ export default {
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
downdtl() {
|
||||
if (this.currentRow !== null) {
|
||||
crud.downloadLoading = true
|
||||
download('/api/rawUatWcQuery/download', this.crud.query).then(result => {
|
||||
downloadFile(result, '原材料碳化钨', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user