代码更新
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
|
||||
package org.nl.wms.basedata.pdm.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import oracle.ucp.proxy.annotation.Post;
|
||||
import org.nl.wms.basedata.pdm.service.WastecchangeService;
|
||||
import org.nl.wms.basedata.pdm.service.dto.WastecchangeDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @date 2022-10-13
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "软废碳平衡修正维护管理")
|
||||
@RequestMapping("/api/wastecchange")
|
||||
@Slf4j
|
||||
public class WastecchangeController {
|
||||
|
||||
private final WastecchangeService wastecchangeService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询软废碳平衡修正维护")
|
||||
@ApiOperation("查询软废碳平衡修正维护")
|
||||
//@PreAuthorize("@el.check('wastecchange:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(wastecchangeService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增软废碳平衡修正维护")
|
||||
@ApiOperation("新增软废碳平衡修正维护")
|
||||
//@PreAuthorize("@el.check('wastecchange:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody WastecchangeDto dto) {
|
||||
wastecchangeService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改软废碳平衡修正维护")
|
||||
@ApiOperation("修改软废碳平衡修正维护")
|
||||
//@PreAuthorize("@el.check('wastecchange:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody WastecchangeDto dto) {
|
||||
wastecchangeService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除软废碳平衡修正维护")
|
||||
@ApiOperation("删除软废碳平衡修正维护")
|
||||
//@PreAuthorize("@el.check('wastecchange:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
wastecchangeService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("确认")
|
||||
@ApiOperation("确认")
|
||||
@PostMapping("/confirm")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
wastecchangeService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
package org.nl.wms.basedata.pdm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.basedata.pdm.service.dto.WastecchangeDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-10-13
|
||||
**/
|
||||
public interface WastecchangeService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
* @param whereJson 条件参数
|
||||
* @return List<WastecchangeDto>
|
||||
*/
|
||||
List<WastecchangeDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
*
|
||||
* @param change_id ID
|
||||
* @return Wastecchange
|
||||
*/
|
||||
WastecchangeDto findById(Long change_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
*
|
||||
* @param code code
|
||||
* @return Wastecchange
|
||||
*/
|
||||
WastecchangeDto findByCode(String code);
|
||||
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void create(WastecchangeDto dto);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param dto /
|
||||
*/
|
||||
void update(WastecchangeDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 确认
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void confirm(JSONObject whereJson);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package org.nl.wms.basedata.pdm.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
/**
|
||||
* @description /
|
||||
* @author liuxy
|
||||
* @date 2022-10-13
|
||||
**/
|
||||
@Data
|
||||
public class WastecchangeDto implements Serializable {
|
||||
|
||||
/** 记录标识 */
|
||||
/** 防止精度丢失 */
|
||||
@JsonSerialize(using= ToStringSerializer.class)
|
||||
private Long change_id;
|
||||
|
||||
/** 物料标识 */
|
||||
private Long material_id;
|
||||
|
||||
/** 工艺类型 */
|
||||
private String tech_type;
|
||||
|
||||
/** CF */
|
||||
private BigDecimal cf_qty;
|
||||
|
||||
/** YZ */
|
||||
private BigDecimal yz_qty;
|
||||
|
||||
/** CX */
|
||||
private BigDecimal cx_qty;
|
||||
|
||||
/** YC */
|
||||
private BigDecimal yc_qty;
|
||||
|
||||
/** JY */
|
||||
private BigDecimal jy_qty;
|
||||
|
||||
/** LT */
|
||||
private BigDecimal lt_qty;
|
||||
|
||||
/** SJ */
|
||||
private BigDecimal sj_qty;
|
||||
|
||||
/** YS */
|
||||
private BigDecimal ys_qty;
|
||||
|
||||
/** DS */
|
||||
private BigDecimal ds_qty;
|
||||
|
||||
/** CQX */
|
||||
private BigDecimal cqx_qty;
|
||||
|
||||
/** XQX */
|
||||
private BigDecimal xqx_qty;
|
||||
|
||||
/** QX */
|
||||
private BigDecimal qx_qty;
|
||||
|
||||
/** JCF */
|
||||
private BigDecimal jcf_qty;
|
||||
|
||||
/** TB */
|
||||
private BigDecimal tb_qty;
|
||||
|
||||
/** YCR */
|
||||
private BigDecimal ycr_qty;
|
||||
|
||||
/** GZ */
|
||||
private BigDecimal gz_qty;
|
||||
|
||||
/** 创建人 */
|
||||
private Long create_id;
|
||||
|
||||
/** 创建人姓名 */
|
||||
private String create_name;
|
||||
|
||||
/** 创建时间 */
|
||||
private String create_time;
|
||||
}
|
||||
@@ -0,0 +1,387 @@
|
||||
|
||||
package org.nl.wms.basedata.pdm.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.poi.util.StringUtil;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
|
||||
import org.nl.wms.basedata.pdm.service.WastecchangeService;
|
||||
import org.nl.wms.basedata.pdm.service.dto.WastecchangeDto;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wql.core.bean.ResultBean;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
||||
/**
|
||||
* @author liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-10-13
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WastecchangeServiceImpl implements WastecchangeService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String material_code = MapUtil.getStr(whereJson, "material_code");
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", "%" + material_code + "%");
|
||||
map.put("class_ids", MaterOptTypeEnum.THW.getClass_idStr());
|
||||
|
||||
JSONObject json = WQL.getWO("PDM_WASTECCHANGE").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mater.material_code ASC");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WastecchangeDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_wastecchange");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(WastecchangeDto.class);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WastecchangeDto findById(Long change_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_wastecchange");
|
||||
JSONObject json = wo.query("change_id = '" + change_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(WastecchangeDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WastecchangeDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_wastecchange");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(json)) {
|
||||
return json.toJavaObject(WastecchangeDto.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(WastecchangeDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setChange_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_wastecchange");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(WastecchangeDto dto) {
|
||||
WastecchangeDto entity = this.findById(dto.getChange_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_wastecchange");
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_wastecchange");
|
||||
for (Long change_id : ids) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("change_id", String.valueOf(change_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", now);
|
||||
wo.update(param);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void confirm(JSONObject whereJson) {
|
||||
/*
|
||||
* 修改软废碳平衡
|
||||
* 1找软废:软废类型为:负压脱蜡 则根据条件:
|
||||
* a.粉料牌号包含 "新"、 软废编码包含软废类型后缀 例如:软废编码 like "-F"、 未删除且启用
|
||||
* b.查询此软废的产品bom表的明细中是否包含此碳化钨
|
||||
* 2.找软废对应的PG粉
|
||||
* a.软废编码去掉 "-CF"
|
||||
* 3.修改软废碳平衡:
|
||||
* a.软废碳平衡=PG粉碳平衡+CF软废修正值
|
||||
* 4.若工艺为氢气脱蜡:软废粉料牌号为不包含"新",其它都一样
|
||||
*/
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
WQLObject extTab = WQLObject.getWQLObject("MD_ME_ProducMaterialExt");
|
||||
WQLObject wasTab = WQLObject.getWQLObject("PDM_BI_WasteCChange");
|
||||
|
||||
// 1.将16中软废类型 放到一个数组当中
|
||||
JSONArray rf_arr = this.contentShift(whereJson);
|
||||
// 2.找软废
|
||||
String tech_type = whereJson.getString("tech_type");
|
||||
|
||||
for (int i = 0; i < rf_arr.size(); i++) {
|
||||
JSONObject json_rf_type = rf_arr.getJSONObject(i);
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "2");
|
||||
map.put("material_id", whereJson.getString("material_id"));
|
||||
map.put("code", "%-" + json_rf_type.getString("name"));
|
||||
|
||||
JSONArray jsonRfArr = new JSONArray();
|
||||
|
||||
if (StrUtil.equals(tech_type, "01")) {
|
||||
// 负压脱蜡
|
||||
jsonRfArr = WQL.getWO("PDM_WASTECCHANGE").addParamMap(map).process().getResultJSONArray(0);
|
||||
} else {
|
||||
// 氢气脱蜡
|
||||
map.put("flag", "3");
|
||||
jsonRfArr = WQL.getWO("PDM_WASTECCHANGE").addParamMap(map).process().getResultJSONArray(0);
|
||||
}
|
||||
|
||||
// 根据软废找到PG粉
|
||||
for (int j = 0; j < jsonRfArr.size(); j++) {
|
||||
JSONObject json = jsonRfArr.getJSONObject(j);
|
||||
String materiai_code = json.getString("material_code");
|
||||
String pg_code = materiai_code.substring(0, materiai_code.indexOf("-" + json_rf_type.getString("name")));
|
||||
|
||||
JSONObject jsonMater_cp = materTab.query("material_code = '" + pg_code + "'").uniqueResult(0);
|
||||
JSONObject jsonExt_cp = extTab.query("material_id = '" + jsonMater_cp.getString("material_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonExt_cp)) throw new BadRequestException("PG粉扩展属性不存在" + pg_code);
|
||||
|
||||
// 修改软废碳平衡:软废碳平衡=PG粉碳平衡+CF软废修正值
|
||||
double rf_c_balance = NumberUtil.add(jsonExt_cp.getDoubleValue("c_balance"), json_rf_type.getDoubleValue("value"));
|
||||
|
||||
JSONObject jsonExt_rf = extTab.query("material_id = '" + json.getString("material_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonExt_rf))
|
||||
throw new BadRequestException("软废扩展属性不存在" + jsonExt_rf.getString("material_code"));
|
||||
jsonExt_rf.put("c_balance", rf_c_balance);
|
||||
extTab.update(jsonExt_rf);
|
||||
}
|
||||
}
|
||||
// 3.插入软废碳平衡修正表
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
|
||||
// 先删除在插入
|
||||
JSONObject jsonObject = wasTab.query("material_id = '" + whereJson.getString("material_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonObject)) wasTab.delete("material_id = '"+whereJson.getString("material_id")+"'");
|
||||
|
||||
JSONObject jsonWas = new JSONObject();
|
||||
jsonWas.put("change_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
jsonWas.put("material_id", whereJson.getString("material_id"));
|
||||
jsonWas.put("tech_type", whereJson.getString("tech_type"));
|
||||
jsonWas.put("cf_qty", whereJson.getDoubleValue("cf_qty"));
|
||||
jsonWas.put("yz_qty", whereJson.getDoubleValue("yz_qty"));
|
||||
jsonWas.put("cx_qty", whereJson.getDoubleValue("cx_qty"));
|
||||
jsonWas.put("yc_qty", whereJson.getDoubleValue("yc_qty"));
|
||||
jsonWas.put("jy_qty", whereJson.getDoubleValue("jy_qty"));
|
||||
jsonWas.put("lt_qty", whereJson.getDoubleValue("lt_qty"));
|
||||
jsonWas.put("sj_qty", whereJson.getDoubleValue("sj_qty"));
|
||||
jsonWas.put("ys_qty", whereJson.getDoubleValue("ys_qty"));
|
||||
jsonWas.put("ds_qty", whereJson.getDoubleValue("ds_qty"));
|
||||
jsonWas.put("cqx_qty", whereJson.getDoubleValue("cqx_qty"));
|
||||
jsonWas.put("xqx_qty", whereJson.getDoubleValue("xqx_qty"));
|
||||
jsonWas.put("qx_qty", whereJson.getDoubleValue("qx_qty"));
|
||||
jsonWas.put("jcf_qty", whereJson.getDoubleValue("jcf_qty"));
|
||||
jsonWas.put("tb_qty", whereJson.getDoubleValue("tb_qty"));
|
||||
jsonWas.put("ycr_qty", whereJson.getDoubleValue("ycr_qty"));
|
||||
jsonWas.put("gz_qty", whereJson.getDoubleValue("gz_qty"));
|
||||
jsonWas.put("create_id", currentUserId);
|
||||
jsonWas.put("create_name", nickName);
|
||||
jsonWas.put("create_time", DateUtil.now());
|
||||
wasTab.insert(jsonWas);
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONArray contentShift(JSONObject json) {
|
||||
JSONArray array = new JSONArray();
|
||||
|
||||
JSONObject json_CF = new JSONObject();
|
||||
json_CF.put("name", "CF");
|
||||
if (ObjectUtil.isEmpty(json.getString("cf_qty"))) {
|
||||
json_CF.put("value", "0");
|
||||
} else {
|
||||
json_CF.put("value", json.getString("cf_qty"));
|
||||
}
|
||||
array.add(json_CF);
|
||||
|
||||
JSONObject json_YZ = new JSONObject();
|
||||
json_YZ.put("name", "YZ");
|
||||
if (ObjectUtil.isEmpty(json.getString("yz_qty"))) {
|
||||
json_YZ.put("value", "0");
|
||||
} else {
|
||||
json_YZ.put("value", json.getString("yz_qty"));
|
||||
}
|
||||
array.add(json_YZ);
|
||||
|
||||
JSONObject json_CX = new JSONObject();
|
||||
json_CX.put("name", "CX");
|
||||
if (ObjectUtil.isEmpty(json.getString("cx_qty"))) {
|
||||
json_CX.put("value", "0");
|
||||
} else {
|
||||
json_CX.put("value", json.getString("cx_qty"));
|
||||
}
|
||||
array.add(json_CX);
|
||||
|
||||
JSONObject json_YC = new JSONObject();
|
||||
json_YC.put("name", "YC");
|
||||
if (ObjectUtil.isEmpty(json.getString("yc_qty"))) {
|
||||
json_YC.put("value", "0");
|
||||
} else {
|
||||
json_YC.put("value", json.getString("yc_qty"));
|
||||
}
|
||||
array.add(json_YC);
|
||||
|
||||
JSONObject json_JY = new JSONObject();
|
||||
json_JY.put("name", "JY");
|
||||
if (ObjectUtil.isEmpty(json.getString("jy_qty"))) {
|
||||
json_JY.put("value", "0");
|
||||
} else {
|
||||
json_JY.put("value", json.getString("jy_qty"));
|
||||
}
|
||||
array.add(json_JY);
|
||||
|
||||
JSONObject json_LT = new JSONObject();
|
||||
json_LT.put("name", "LT");
|
||||
if (ObjectUtil.isEmpty(json.getString("lt_qty"))) {
|
||||
json_LT.put("value", "0");
|
||||
} else {
|
||||
json_LT.put("value", json.getString("lt_qty"));
|
||||
}
|
||||
array.add(json_LT);
|
||||
|
||||
JSONObject json_SJ = new JSONObject();
|
||||
json_SJ.put("name", "SJ");
|
||||
if (ObjectUtil.isEmpty(json.getString("sj_qty"))) {
|
||||
json_SJ.put("value", "0");
|
||||
} else {
|
||||
json_SJ.put("value", json.getString("sj_qty"));
|
||||
}
|
||||
array.add(json_SJ);
|
||||
|
||||
JSONObject json_YS = new JSONObject();
|
||||
json_YS.put("name", "YS");
|
||||
if (ObjectUtil.isEmpty(json.getString("ys_qty"))) {
|
||||
json_YS.put("value", "0");
|
||||
} else {
|
||||
json_YS.put("value", json.getString("ys_qty"));
|
||||
}
|
||||
array.add(json_YS);
|
||||
|
||||
JSONObject json_DS = new JSONObject();
|
||||
json_DS.put("name", "DS");
|
||||
if (ObjectUtil.isEmpty(json.getString("ds_qty"))) {
|
||||
json_DS.put("value", "0");
|
||||
} else {
|
||||
json_DS.put("value", json.getString("ds_qty"));
|
||||
}
|
||||
array.add(json_DS);
|
||||
|
||||
JSONObject json_CQX = new JSONObject();
|
||||
json_CQX.put("name", "CQX");
|
||||
if (ObjectUtil.isEmpty(json.getString("cqx_qty"))) {
|
||||
json_CQX.put("value", "0");
|
||||
} else {
|
||||
json_CQX.put("value", json.getString("cqx_qty"));
|
||||
}
|
||||
array.add(json_CQX);
|
||||
|
||||
JSONObject json_XQX = new JSONObject();
|
||||
json_XQX.put("name", "XQX");
|
||||
if (ObjectUtil.isEmpty(json.getString("xqx_qty"))) {
|
||||
json_XQX.put("value", "0");
|
||||
} else {
|
||||
json_XQX.put("value", json.getString("xqx_qty"));
|
||||
}
|
||||
array.add(json_XQX);
|
||||
|
||||
JSONObject json_QX = new JSONObject();
|
||||
json_QX.put("name", "QX");
|
||||
if (ObjectUtil.isEmpty(json.getString("qx_qty"))) {
|
||||
json_QX.put("value", "0");
|
||||
} else {
|
||||
json_QX.put("value", json.getString("qx_qty"));
|
||||
}
|
||||
array.add(json_QX);
|
||||
|
||||
JSONObject json_JCF = new JSONObject();
|
||||
json_JCF.put("name", "JCF");
|
||||
if (ObjectUtil.isEmpty(json.getString("jcf_qty"))) {
|
||||
json_JCF.put("value", "0");
|
||||
} else {
|
||||
json_JCF.put("value", json.getString("jcf_qty"));
|
||||
}
|
||||
array.add(json_JCF);
|
||||
|
||||
JSONObject json_TB = new JSONObject();
|
||||
json_TB.put("name", "TB");
|
||||
if (ObjectUtil.isEmpty(json.getString("tb_qty"))) {
|
||||
json_TB.put("value", "0");
|
||||
} else {
|
||||
json_TB.put("value", json.getString("tb_qty"));
|
||||
}
|
||||
array.add(json_TB);
|
||||
|
||||
JSONObject json_YCR = new JSONObject();
|
||||
json_YCR.put("name", "YCR");
|
||||
if (ObjectUtil.isEmpty(json.getString("ycr_qty"))) {
|
||||
json_YCR.put("value", "0");
|
||||
} else {
|
||||
json_YCR.put("value", json.getString("ycr_qty"));
|
||||
}
|
||||
array.add(json_YCR);
|
||||
|
||||
JSONObject json_GZ = new JSONObject();
|
||||
json_GZ.put("name", "GZ");
|
||||
if (ObjectUtil.isEmpty(json.getString("gz_qty"))) {
|
||||
json_GZ.put("value", "0");
|
||||
} else {
|
||||
json_GZ.put("value", json.getString("gz_qty"));
|
||||
}
|
||||
array.add(json_GZ);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
[交易说明]
|
||||
交易名: 软废碳平衡修正维护分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.class_ids TYPEAS f_string
|
||||
输入.material_id TYPEAS s_string
|
||||
输入.code TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mater.material_code,
|
||||
mater.material_id,
|
||||
mater.material_name,
|
||||
mater.material_model,
|
||||
chan.change_id,
|
||||
chan.tech_type,
|
||||
chan.cf_qty,
|
||||
chan.yz_qty,
|
||||
chan.cx_qty,
|
||||
chan.yc_qty,
|
||||
chan.jy_qty,
|
||||
chan.lt_qty,
|
||||
chan.sj_qty,
|
||||
chan.ys_qty,
|
||||
chan.ds_qty,
|
||||
chan.cqx_qty,
|
||||
chan.xqx_qty,
|
||||
chan.qx_qty,
|
||||
chan.jcf_qty,
|
||||
chan.tb_qty,
|
||||
chan.ycr_qty,
|
||||
chan.gz_qty,
|
||||
chan.create_id,
|
||||
chan.create_name,
|
||||
chan.create_time
|
||||
FROM
|
||||
md_me_materialbase mater
|
||||
LEFT JOIN PDM_BI_WasteCChange chan ON mater.material_id = chan.material_id
|
||||
WHERE
|
||||
mater.is_delete = '0'
|
||||
AND mater.is_used = '1'
|
||||
|
||||
OPTION 输入.class_ids <> ""
|
||||
mater.material_type_id = 输入.class_ids
|
||||
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
|
||||
mater.*,
|
||||
ext.old_mark
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
b.bom_id,
|
||||
a.bom_code,
|
||||
a.material_code,
|
||||
a.material_id
|
||||
FROM
|
||||
MD_PD_ProductBOMDtl b
|
||||
LEFT JOIN MD_PD_ProductBOM a ON a.bom_id = b.bom_id
|
||||
WHERE
|
||||
a.is_used = "1"
|
||||
AND a.is_delete = '0'
|
||||
AND b.material_id = 输入.material_id
|
||||
GROUP BY b.bom_id
|
||||
) AS bomDtl
|
||||
LEFT JOIN md_me_materialbase mater on mater.material_id = bomDtl.material_id
|
||||
LEFT JOIN MD_ME_ProducMaterialExt ext ON mater.material_id = ext.material_id
|
||||
|
||||
WHERE
|
||||
mater.is_delete = '0'
|
||||
AND mater.is_used = '1'
|
||||
AND ext.old_mark like "%新%"
|
||||
AND mater.material_code like 输入.code
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
mater.*,
|
||||
ext.old_mark
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
b.bom_id,
|
||||
a.bom_code,
|
||||
a.material_code,
|
||||
a.material_id
|
||||
FROM
|
||||
MD_PD_ProductBOMDtl b
|
||||
LEFT JOIN MD_PD_ProductBOM a ON a.bom_id = b.bom_id
|
||||
WHERE
|
||||
a.is_used = "1"
|
||||
AND a.is_delete = '0'
|
||||
AND b.material_id = 输入.material_id
|
||||
GROUP BY b.bom_id
|
||||
) AS bomDtl
|
||||
LEFT JOIN md_me_materialbase mater on mater.material_id = bomDtl.material_id
|
||||
LEFT JOIN MD_ME_ProducMaterialExt ext ON mater.material_id = ext.material_id
|
||||
|
||||
WHERE
|
||||
mater.is_delete = '0'
|
||||
AND mater.is_used = '1'
|
||||
AND ext.old_mark not like "%新%"
|
||||
AND mater.material_code like 输入.code
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Binary file not shown.
@@ -809,8 +809,7 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
// String pre_fas = NumberUtil.mul(masterbucket_qty, NumberUtil.div(jsonQM06.getString("value"), "100").toString()).toString();
|
||||
// oneMap.put("pre_fas", NumberUtil.round(pre_fas, 2).toString());
|
||||
//
|
||||
// double liquid_rate = jsonMaterExt.getDoubleValue("liquid_rate");
|
||||
// String put_fas = NumberUtil.mul(jsonMst.getDoubleValue("masterbucket_qty"), liquid_rate, NumberUtil.div(jsonQM06.getString("value"), "100")).toString();
|
||||
// String put_fas = NumberUtil.mul(jsonMst.getDoubleValue("masterbucket_qty"), NumberUtil.div(jsonQM06.getString("value"), "100")).toString();
|
||||
// oneMap.put("put_fas", NumberUtil.round(put_fas, 2).toString());
|
||||
//
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user