Merge branch 'master' of http://121.40.234.130:8899/root/wuHanXinRui
This commit is contained in:
@@ -148,4 +148,11 @@ public class MaterialParametersController {
|
||||
public ResponseEntity<Object> getSeries() {
|
||||
return new ResponseEntity<>(materialParametersService.getSeries(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/sync")
|
||||
@Log("同步")
|
||||
@ApiOperation("同步-产品系列")
|
||||
public ResponseEntity<Object> sync(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(materialParametersService.sync(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,4 +85,10 @@ public interface MaterialParametersService {
|
||||
* 查询基础分类-产品系列
|
||||
*/
|
||||
JSONArray getSeries();
|
||||
|
||||
/**
|
||||
* 同步
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONObject sync(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package org.nl.wms.basedata.master.service.impl;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -20,6 +21,7 @@ import org.nl.wms.basedata.master.service.MaterialParametersService;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.MaterialParametersDto;
|
||||
import org.nl.wms.basedata.master.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.basedata.pdm.service.impl.WastecchangeServiceImpl;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
@@ -290,6 +292,9 @@ public class MaterialParametersServiceImpl implements MaterialParametersService
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject queryMaterialParam(String material_id) {
|
||||
MaterialbaseDto materDto = materialbaseService.findById(Long.valueOf(material_id));
|
||||
|
||||
boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), material_id, null);
|
||||
|
||||
//根据物料类型判断是原辅料还是半成品
|
||||
String material_type_id = materDto.getMaterial_type_id() + "";
|
||||
String flag = "1";
|
||||
@@ -300,6 +305,12 @@ public class MaterialParametersServiceImpl implements MaterialParametersService
|
||||
flag = "2";
|
||||
}
|
||||
JSONObject json = WQL.getWO("QMD_ME_material_param01").addParam("flag", flag).addParam("material_id", material_id).process().uniqueResult(0);
|
||||
|
||||
if (is_pgf) {
|
||||
json.put("is_sync", "0");
|
||||
} else {
|
||||
json.put("is_sync", "1");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -318,4 +329,149 @@ public class MaterialParametersServiceImpl implements MaterialParametersService
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject sync(JSONObject whereJson) {
|
||||
/*
|
||||
* 1.PG粉碳平衡修正
|
||||
* 2.软废碳平衡修正
|
||||
*/
|
||||
WQLObject productMstTab = WQLObject.getWQLObject("MD_PD_ProductBOM"); // 产品bom单主表
|
||||
WQLObject productDtlTab = WQLObject.getWQLObject("MD_PD_ProductBOMDtl"); // 产品bom单明细表
|
||||
WQLObject wasTab = WQLObject.getWQLObject("PDM_BI_WasteCChange"); // 软废碳平衡修正表
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
|
||||
WQLObject extTab = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 成品物料扩展信息表
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 1.判断此物料是PG粉还是RF
|
||||
boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), whereJson.getString("material_id"), null);
|
||||
boolean is_rf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.RF.getCode(), whereJson.getString("material_id"), null);
|
||||
|
||||
String material_id = whereJson.getString("material_id");
|
||||
JSONObject jsonMater = materTab.query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
JSONObject jsonExtMater = extTab.query("material_id = '" + material_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonExtMater)) throw new BadRequestException("此PGF扩展属性不存在");
|
||||
|
||||
if (is_pgf) {
|
||||
/*
|
||||
* PG粉碳平衡修正:
|
||||
* 1.查询此PG粉产品bom明细表第一个碳化钨
|
||||
* 2.查询此碳化钨 软废碳平衡修正表获得全部软废类型的值
|
||||
* 3.查询软废:物料表,软废编码 = PG粉编码 + '-CF'
|
||||
* 4.依次修改16种软废类型的碳平衡
|
||||
* 软废碳平衡=pg粉碳平衡+CF修正值
|
||||
*/
|
||||
|
||||
// 1.查询此物料的产品bom明细表中第一个出现的碳化钨
|
||||
// 查主表
|
||||
JSONObject jsonProductMst = productMstTab.query("material_id = '" + material_id + "' and is_used = '1' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonProductMst)) throw new BadRequestException("此产品没有创建bom单或者已删除、未启用");
|
||||
// 查明细
|
||||
JSONArray productDtlArr = productDtlTab.query("bom_id = '" + jsonProductMst.getString("bom_id") + "' order by seqno ASC").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(productDtlArr)) throw new BadRequestException("此产品bom单暂无明细");
|
||||
|
||||
// 找出第一个碳化钨
|
||||
String thw_material_id = "";
|
||||
for (int i = 0; i < productDtlArr.size(); i++) {
|
||||
JSONObject jsonProductDtl = productDtlArr.getJSONObject(i);
|
||||
boolean is_thw = materialbaseService.isAlongMaterType(MaterOptTypeEnum.THW.getCode(), jsonProductDtl.getString("material_id"), null);
|
||||
|
||||
if (is_thw) {
|
||||
thw_material_id = jsonProductDtl.getString("material_id");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 2.查询此碳化钨 软废碳平衡修正表获得全部软废类型的值 并转化成数组(便于处理数据)
|
||||
JSONObject jsonThwMater = materTab.query("material_id = '" + thw_material_id + "'").uniqueResult(0);
|
||||
JSONObject jsonWas = wasTab.query("material_id = '" + thw_material_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonWas)) throw new BadRequestException("此碳化钨软废修正数据不存在:"+jsonThwMater.getString("material_code"));
|
||||
|
||||
// 将此碳化钨的软废类型转化为数组
|
||||
JSONArray wasArr = new WastecchangeServiceImpl().contentShift(jsonWas);
|
||||
|
||||
// 3.查询软废:物料表,软废编码 = PG粉编码 + '-CF' (以软废类型CF为例)
|
||||
for (int j = 0; j < wasArr.size(); j++) {
|
||||
JSONObject jsonWasDtl = wasArr.getJSONObject(j);
|
||||
|
||||
String rf_type_code = jsonMater.getString("material_code") +"-"+jsonWasDtl.getString("name");
|
||||
JSONObject jsonRfMater = materTab.query("material_code = '" + rf_type_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonRfMater)) {
|
||||
// 4.依次修改16种软废类型的碳平衡: 软废碳平衡=pg粉碳平衡+CF修正值
|
||||
JSONObject jsonRfExt = extTab.query("material_id = '" + jsonRfMater.getString("material_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonRfExt)) throw new BadRequestException("此软废扩展信息不存在:"+rf_type_code);
|
||||
|
||||
double rf_c_balance = NumberUtil.add(jsonExtMater.getDoubleValue("c_balance"), jsonWasDtl.getDoubleValue("value"));
|
||||
jsonRfExt.put("c_balance", String.valueOf(rf_c_balance));
|
||||
extTab.update(jsonRfExt);
|
||||
}
|
||||
}
|
||||
result.put("c_balance", "");
|
||||
}
|
||||
|
||||
if (is_rf) {
|
||||
/*
|
||||
* 软废粉碳平衡修正:
|
||||
* 1.找PG粉:查物料表: PG粉编码 = 此软废编码去掉最后一个'-'和后面的内容
|
||||
* 2.找碳化钨:此PG粉产品BOM明细第一个碳化钨
|
||||
* 3.找修正值:废类型为编码最后'-'后的内容 :如JZ16-P-A2-20-JY : 软废类型就是 JY
|
||||
* 查此碳化钨的软废修正表对应的软废类型:软废碳平衡=pg粉碳平衡+此软废修正值
|
||||
* 4.最后将计算后的值返回给页面
|
||||
*/
|
||||
|
||||
// 1.找PG粉:查物料表: PG粉编码 = 此软废编码去掉最后一个'-'和后面的内容
|
||||
String pg_material_code = jsonMater.getString("material_code").substring(0, jsonMater.getString("material_code").lastIndexOf("-"));
|
||||
JSONObject jsonPgfMater = materTab.query("material_code = '" + pg_material_code + "'").uniqueResult(0);
|
||||
|
||||
// 2.找碳化钨:此PG粉产品BOM明细第一个碳化钨
|
||||
// 查主表
|
||||
JSONObject jsonProductMst = productMstTab.query("material_id = '" + jsonPgfMater.getString("material_id") + "' and is_used = '1' and is_delete = '0'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonProductMst)) throw new BadRequestException("此产品没有创建bom单或者已删除、未启用"+pg_material_code);
|
||||
// 查明细
|
||||
JSONArray productDtlArr = productDtlTab.query("bom_id = '" + jsonProductMst.getString("bom_id") + "' order by seqno ASC").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(productDtlArr)) throw new BadRequestException("此产品bom单暂无明细"+pg_material_code);
|
||||
|
||||
// 找出第一个碳化钨
|
||||
String thw_material_id = "";
|
||||
for (int i = 0; i < productDtlArr.size(); i++) {
|
||||
JSONObject jsonProductDtl = productDtlArr.getJSONObject(i);
|
||||
boolean is_thw = materialbaseService.isAlongMaterType(MaterOptTypeEnum.THW.getCode(), jsonProductDtl.getString("material_id"), null);
|
||||
|
||||
if (is_thw) {
|
||||
thw_material_id = jsonProductDtl.getString("material_id");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 3.找修正值:废类型为编码最后'-'后的内容
|
||||
JSONObject jsonThwMater = materTab.query("material_id = '" + thw_material_id + "'").uniqueResult(0);
|
||||
JSONObject jsonWas = wasTab.query("material_id = '" + thw_material_id + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonWas)) throw new BadRequestException("此碳化钨软废修正数据不存在:"+jsonThwMater.getString("material_name"));
|
||||
|
||||
// 将此碳化钨的软废类型转化为数组
|
||||
JSONArray wasArr = new WastecchangeServiceImpl().contentShift(jsonWas);
|
||||
|
||||
String rf_type_code = jsonMater.getString("material_code").substring(jsonMater.getString("material_code").lastIndexOf("-")+1,jsonMater.getString("material_code").length());
|
||||
double value = 0;
|
||||
for (int j = 0; j < wasArr.size(); j++) {
|
||||
JSONObject jsonWasDtl = wasArr.getJSONObject(j);
|
||||
|
||||
if (StrUtil.equals(rf_type_code, jsonWasDtl.getString("name"))) {
|
||||
value = jsonWasDtl.getDoubleValue("value");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 软废碳平衡=pg粉碳平衡+此软废修正值
|
||||
JSONObject jsonPgfExt = extTab.query("material_id = '" + jsonPgfMater.getString("material_id") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonPgfExt)) throw new BadRequestException("此PG粉扩展属性不存在:"+pg_material_code);
|
||||
|
||||
double c_balance = NumberUtil.add(jsonPgfExt.getDoubleValue("c_balance"), value);
|
||||
result.put("c_balance", String.valueOf(c_balance));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
JSONObject jsonObject = WQL.getWO("QL_TEST_PERFORMANCEMST01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.assessor_date asc");
|
||||
JSONArray re = jsonObject.getJSONArray("content");
|
||||
// ===== 2.根据日期查出当天日期所有人员及分数
|
||||
for (int i = 0; i < re.size(); i++) {
|
||||
/* for (int i = 0; i < re.size(); i++) {
|
||||
JSONObject json = re.getJSONObject(i);
|
||||
JSONArray arr = WQLObject.getWQLObject("QL_TEST_PerformanceMst").query("assessor_date = '" + json.getString("assessor_date") + "'").getResultJSONArray(0);
|
||||
double total = 0; //总分
|
||||
@@ -256,6 +256,26 @@ public class PerformancemstServiceImpl implements PerformancemstService {
|
||||
total = total + json2.getDoubleValue("total_score");
|
||||
average = NumberUtil.div(total, arr.size());
|
||||
}
|
||||
//查询出有多少个员工 要用到它们的个数
|
||||
JSONArray jsonArr = WQL.getWO("QL_TEST_PERFORMANCEMST01").addParam("flag", "5").process().getResultJSONArray(0);
|
||||
json.put(String.valueOf(jsonArr.size() + 2), total);
|
||||
json.put(String.valueOf(jsonArr.size() + 1), average);
|
||||
are.add(json);
|
||||
}*/
|
||||
for (int i = 0; i < re.size(); i++) {
|
||||
JSONObject json = re.getJSONObject(i);
|
||||
JSONArray userArr = WQL.getWO("QL_TEST_PERFORMANCEMST01").addParam("flag", "7").addParam("assessor_date", json.getString("assessor_date")).process().getResultJSONArray(0);
|
||||
|
||||
double total = 0; //总分
|
||||
double average = 0; //平均分
|
||||
for (int j = 0; j < userArr.size(); j++) {
|
||||
JSONObject json2 = userArr.getJSONObject(j);
|
||||
json.put(String.valueOf(json2.getString("assessor_id")), json2.getString("total_score"));
|
||||
|
||||
total = total + json2.getDoubleValue("total_score");
|
||||
average = NumberUtil.div(total, userArr.size());
|
||||
}
|
||||
|
||||
//查询出有多少个员工 要用到它们的个数
|
||||
JSONArray jsonArr = WQL.getWO("QL_TEST_PERFORMANCEMST01").addParam("flag", "5").process().getResultJSONArray(0);
|
||||
json.put(String.valueOf(jsonArr.size() + 2), total);
|
||||
|
||||
@@ -157,5 +157,29 @@
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "7"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
mst.assessor_date,
|
||||
SUM(mst.total_score) AS total_score,
|
||||
mst.assessor_id
|
||||
FROM
|
||||
QL_TEST_PerformanceMst mst
|
||||
LEFT JOIN sys_user user ON mst.assessor_id = user.user_id
|
||||
|
||||
WHERE
|
||||
mst.status = '30'
|
||||
AND mst.is_delete = '0'
|
||||
|
||||
OPTION 输入.assessor_date <> ""
|
||||
mst.assessor_date = 输入.assessor_date
|
||||
ENDOPTION
|
||||
|
||||
GROUP BY mst.assessor_id
|
||||
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ public class DailyplanController {
|
||||
@GetMapping
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(dailyplanService.
|
||||
queryAll(whereJson,page),HttpStatus.OK);
|
||||
queryAll2(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/queryday")
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface DailyplanService {
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
Map<String,Object> queryAll2(Map whereJson);
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
|
||||
@@ -54,7 +54,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
|
||||
private final WorkOrdereService workOrdereService;
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
public Map<String, Object> queryAll2(Map whereJson) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
String material_code = map.get("material_code");
|
||||
@@ -62,8 +62,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
map.put("flag", "1");
|
||||
JSONObject jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.planstart_date,pp.plan_code");
|
||||
JSONArray json = jret.getJSONArray("content");
|
||||
JSONArray json = WQL.getWO("QPDM_PRODUCTDAILYPLAN").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONArray ja = new JSONArray();
|
||||
for(int i=0;i<json.size();i++){
|
||||
JSONObject jo = json.getJSONObject(i);
|
||||
@@ -82,6 +81,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
ja.add(jo);
|
||||
}
|
||||
Map<String, Object> jret = new HashMap<String, Object>();
|
||||
jret.put("content",ja);
|
||||
return jret;
|
||||
}
|
||||
@@ -210,15 +210,7 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
map.put("flag", "2");
|
||||
JSONArray jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
|
||||
.addParamMap(map).process().getResultJSONArray(0);
|
||||
if(jret.size()>0){
|
||||
JSONObject form = new JSONObject();
|
||||
form.put("rows",jret);
|
||||
form.put("query",whereJson);
|
||||
this.submit2(form);
|
||||
}
|
||||
jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
|
||||
JSONArray jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
|
||||
.addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
JSONArray ja = new JSONArray();
|
||||
@@ -413,7 +405,8 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
new_jo.put("workorder_qty",jo.getString("standard_weight"));
|
||||
new_jo.put("planstart_time",jo.getString("planstart_date").substring(0,10)+" 08:00:00");
|
||||
new_jo.put("planend_time",jo.getString("planend_date").substring(0,10)+" 23:59:59");
|
||||
new_jo.put("status","10");
|
||||
new_jo.put("status",jsonMst.getString("remark"));
|
||||
new_jo.put("remark","10");
|
||||
new_jo.put("create_mode","03");
|
||||
new_jo.put("source_bill_id",jo.getString("dailyplan_id"));
|
||||
new_jo.put("source_bill_type",jo.getString("workorder_type"));
|
||||
|
||||
@@ -127,15 +127,12 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
|
||||
json.put("create_time", now);
|
||||
json.put("sysdeptid", deptId);
|
||||
json.put("syscompanyid", deptId);
|
||||
String create_mode = json.getString("create_mode");
|
||||
if("01".equals(create_mode)){
|
||||
String planstart_time = json.getString("planstart_time");
|
||||
Date date = DateUtil.parse(planstart_time);
|
||||
int days = this.getDays(json.getString("material_id"));
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
|
||||
json.put("planend_time",planend_time+" 23:59:59");
|
||||
}
|
||||
String planstart_time = json.getString("planstart_time");
|
||||
Date date = DateUtil.parse(planstart_time);
|
||||
int days = this.getDays(json.getString("material_id"));
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
|
||||
json.put("planend_time",planend_time+" 23:59:59");
|
||||
mstTab.insert(json);
|
||||
this.updatePcsn(json);
|
||||
}
|
||||
@@ -176,15 +173,12 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
|
||||
this.updatePcsn(whereJson);
|
||||
}
|
||||
}
|
||||
String create_mode = whereJson.getString("create_mode");
|
||||
if("01".equals(create_mode)){
|
||||
String planstart_time = whereJson.getString("planstart_time");
|
||||
Date date = DateUtil.parse(planstart_time);
|
||||
int days = this.getDays(whereJson.getString("material_id"));
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
|
||||
whereJson.put("planend_time",planend_time+" 23:59:59");
|
||||
}
|
||||
String planstart_time = whereJson.getString("planstart_time");
|
||||
Date date = DateUtil.parse(planstart_time);
|
||||
int days = this.getDays(whereJson.getString("material_id"));
|
||||
Date planend_date = DateUtil.offsetDay(date,days-1);
|
||||
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
|
||||
whereJson.put("planend_time",planend_time+" 23:59:59");
|
||||
mstTab.update(whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
QUERY
|
||||
SELECT
|
||||
pp.*,
|
||||
ext.old_mark,
|
||||
@@ -94,8 +94,9 @@
|
||||
OPTION 输入.device_id <> ""
|
||||
pp.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
order by pp.planstart_date,pp.plan_code
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
|
||||
@@ -243,11 +243,16 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
jsonObject.put("fault_num", fault_num.getString("num"));
|
||||
|
||||
// 委外台数
|
||||
map.put("status", "30");
|
||||
map.put("flag", "10");
|
||||
JSONObject out_num = WQL.getWO("EM_DEVICEBIGSCREEN_01").addParamMap(map).process().uniqueResult(0);
|
||||
jsonObject.put("out_num", out_num.getString("num"));
|
||||
if (ObjectUtil.isEmpty(out_num)) {
|
||||
jsonObject.put("out_num", "0");
|
||||
} else {
|
||||
jsonObject.put("out_num", String.valueOf(out_num.size()));
|
||||
}
|
||||
|
||||
// 保养台数
|
||||
map.put("flag", "5");
|
||||
map.put("status", "40");
|
||||
JSONObject main_num = WQL.getWO("EM_DEVICEBIGSCREEN_01").addParamMap(map).process().uniqueResult(0);
|
||||
jsonObject.put("main_num", main_num.getString("num"));
|
||||
@@ -328,12 +333,23 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
|
||||
/*
|
||||
* 查询保养单明细
|
||||
*/
|
||||
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("em_bi_devicemaintenanceplandtl");
|
||||
JSONObject resultJson = new JSONObject();
|
||||
JSONObject resultData = new JSONObject();
|
||||
|
||||
JSONArray arr = WQL.getWO("EM_DEVICEBIGSCREEN_01").addParam("flag", "8").process().getResultJSONArray(0);
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject json = arr.getJSONObject(i);
|
||||
|
||||
// 明细数
|
||||
JSONArray jsonDtl = dtlTab.query("maint_plan_id = '" + json.getString("maint_plan_id") + "'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(jsonDtl)) {
|
||||
json.put("num", "0");
|
||||
} else {
|
||||
json.put("num", String.valueOf(jsonDtl.size()));
|
||||
}
|
||||
|
||||
// 保养倒计时: 计划日期 - 当前日期
|
||||
Date date1 = DateUtil.parse(DateUtil.today()); // 当前日期
|
||||
Date date2 = DateUtil.parse(json.getString("plan_time")); // 计划日期
|
||||
|
||||
@@ -193,15 +193,9 @@
|
||||
mst.real_start_date AS impl_time,
|
||||
mst.remark,
|
||||
mst.real_end_date,
|
||||
dtl.num
|
||||
mst.maint_plan_id
|
||||
FROM
|
||||
EM_BI_DeviceMaintenancePlanMst mst
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT count(*)AS num,d.maint_plan_id FROM EM_BI_DeviceMaintenancePlanDtl d
|
||||
LEFT JOIN EM_BI_DeviceMaintenancePlanMst m ON m.maint_plan_id = d.maint_plan_id
|
||||
GROUP BY d.maint_plan_dtl_id
|
||||
) AS dtl ON mst.maint_plan_id = dtl.maint_plan_id
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON mst.devicerecord_id = file.devicerecord_id
|
||||
LEFT JOIN sys_dept dept ON dept.dept_id = file.use_deptid
|
||||
WHERE
|
||||
@@ -227,3 +221,23 @@
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "10"
|
||||
QUERY
|
||||
SELECT
|
||||
count(mst.devicerecord_id) AS num
|
||||
FROM
|
||||
EM_BI_DeviceRepairMst mst
|
||||
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
|
||||
LEFT JOIN sys_dept dept ON dept.dept_id = file.use_deptid
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
AND dept.code = 输入.dept_code
|
||||
AND mst.invstatus = '04'
|
||||
|
||||
group by mst.devicerecord_id
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -128,7 +128,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
|
||||
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.invstatus,mst.input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,6 +110,12 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
// 归属部门
|
||||
String use_groupid = MapUtil.getStr(whereJson, "use_groupid");
|
||||
if (!StrUtil.isEmpty(use_groupid)) {
|
||||
String use_groupidIds = deptService.getChildIdStr(Long.parseLong(use_groupid));
|
||||
map.put("use_groupid", use_groupidIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIRREQUEST001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.create_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
输入.use_groupid TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -144,7 +145,9 @@
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.use_groupid <> ""
|
||||
d2.dept_id in 输入.use_groupid
|
||||
ENDOPTION
|
||||
OPTION 输入.deptIds <> ""
|
||||
d1.dept_id in 输入.deptIds
|
||||
ENDOPTION
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
LEFT JOIN sys_dept dept ON dept.dept_id = file.use_deptid
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND (mst.invstatus <> '99')
|
||||
AND mst.invstatus not in ('06','07','99')
|
||||
AND ( ISNULL( mst.source_bill_id ) OR mst.source_bill_type = 'WXJH' )
|
||||
|
||||
UNION
|
||||
@@ -368,6 +368,7 @@
|
||||
WHERE
|
||||
st.is_delete = '0'
|
||||
AND (st.status <> '99')
|
||||
AND mst.invstatus not in ('06','07','99')
|
||||
|
||||
UNION
|
||||
|
||||
@@ -416,7 +417,7 @@
|
||||
LEFT JOIN sys_dept dept ON dept.dept_id = file.use_deptid
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
AND (mst.invstatus <> '99')
|
||||
AND mst.invstatus not in ('04','05','99')
|
||||
|
||||
order by input_time DESC
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.service.DeptService;
|
||||
import org.nl.modules.system.service.impl.ParamServiceImpl;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
@@ -116,7 +117,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.invstatus,mst.input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -559,6 +560,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
|
||||
|
||||
@Override
|
||||
public Map<String, Object> query4(Map whereJson, Pageable page) {
|
||||
DeptService deptService = SpringContextHolder.getBean(DeptService.class);
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
@@ -585,12 +587,19 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
// 归属部门
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
if (!StrUtil.isEmpty(dept_id)) {
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> query5(Map whereJson, Pageable page) {
|
||||
DeptService deptService = SpringContextHolder.getBean(DeptService.class);
|
||||
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
|
||||
String class_idStr = MapUtil.getStr(whereJson, "class_idStr");
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
@@ -619,6 +628,12 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ
|
||||
String classIds = classstandardService.getAllChildIdStr(class_idStr);
|
||||
map.put("classIds", classIds);
|
||||
}
|
||||
// 归属部门
|
||||
String dept_id = MapUtil.getStr(whereJson, "dept_id");
|
||||
if (!StrUtil.isEmpty(dept_id)) {
|
||||
String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id));
|
||||
map.put("deptIds", deptIds);
|
||||
}
|
||||
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time DESC");
|
||||
return json;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.maint_object TYPEAS s_string
|
||||
输入.deptIds TYPEAS f_string
|
||||
|
||||
|
||||
[临时表]
|
||||
@@ -197,7 +198,7 @@
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
AND mst.maint_object = '02'
|
||||
AND mst.invstatus not in ('01')
|
||||
AND mst.invstatus in ('02','03')
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
@@ -324,7 +325,9 @@
|
||||
(mst.maint_code like 输入.maint_code or
|
||||
mst.maint_code like 输入.maint_code)
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.deptIds <> ""
|
||||
d2.dept_id in 输入.deptIds
|
||||
ENDOPTION
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
@@ -369,7 +372,7 @@
|
||||
mst.is_delete = '0'
|
||||
AND file.is_delete = '0'
|
||||
AND mst.maint_object = '01'
|
||||
AND mst.invstatus not in ('01')
|
||||
AND mst.invstatus in ('02','03')
|
||||
|
||||
OPTION 输入.device_code <> ""
|
||||
(file.device_code like 输入.device_code or
|
||||
@@ -384,7 +387,9 @@
|
||||
OPTION 输入.classIds <> ""
|
||||
class.class_id in 输入.classIds
|
||||
ENDOPTION
|
||||
|
||||
OPTION 输入.deptIds <> ""
|
||||
d2.dept_id in 输入.deptIds
|
||||
ENDOPTION
|
||||
OPTION 输入.maintenancecycle <> ""
|
||||
mst.maintenancecycle = 输入.maintenancecycle
|
||||
ENDOPTION
|
||||
|
||||
@@ -10,6 +10,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.pcs.Enum.ProcStatusEnum;
|
||||
import org.nl.wms.pcs.Enum.ReceiveStatusEnum;
|
||||
import org.nl.wms.st.core.service.StorPublicService;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -225,6 +227,10 @@ public class InbillServiceImpl {
|
||||
WQLObject dtl_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl");
|
||||
WQLObject dis_table = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
|
||||
WQLObject bucket_table = WQLObject.getWQLObject("md_pb_bucketrecord");
|
||||
WQLObject reMstTab = WQLObject.getWQLObject("PCS_RC_ReceiveMst"); //到货通知单主表
|
||||
WQLObject reDtlTab = WQLObject.getWQLObject("PCS_RC_ReceiveDtl"); //到货通知单明细表
|
||||
WQLObject procTab = WQLObject.getWQLObject("PCS_IF_PurchaseOrderProc"); //采购订单接口处理表
|
||||
WQLObject dtlTab = WQLObject.getWQLObject("QL_TEST_InspectionSheetDtl"); //质检单明细表
|
||||
String iostorinv_id = from.getString("iostorinv_id");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
@@ -280,11 +286,81 @@ public class InbillServiceImpl {
|
||||
bucket_table.update(bucket_map, "storagevehicle_code = '" + dis_row.getString("storagevehicle_code") + "' AND status = '02'");
|
||||
|
||||
//如果单据为原辅料入库,且为寄样合格,回写到货通知单
|
||||
|
||||
}
|
||||
mst_jo.put("bill_status", "99");
|
||||
mst_jo.put("confirm_optid", currentUserId);
|
||||
mst_jo.put("confirm_optname", nickName);
|
||||
mst_jo.put("confirm_time", now);
|
||||
if("000101".equals(bill_type)){
|
||||
//查询
|
||||
dtl_rows = dtl_table.query("iostorinv_id = '" + iostorinv_id + "' AND bill_status = '99'").getResultJSONArray(0);
|
||||
|
||||
for(int i=0; i<dtl_rows.size();i++){
|
||||
boolean flag = false;
|
||||
JSONObject jo = dtl_rows.getJSONObject(i);
|
||||
String quality_scode = jo.getString("quality_scode");
|
||||
if("01".equals(quality_scode)){//合格
|
||||
flag = true;
|
||||
}else if("00".equals(quality_scode)){//待检品
|
||||
String material_id = jo.getString("material_id");
|
||||
String pcsn = jo.getString("pcsn");
|
||||
JSONObject dtl = dtlTab.query("bill_status='99' and material_id='"+material_id+"' and pcsn='"+pcsn+"' and result='01'").uniqueResult(0);
|
||||
if(dtl!=null){
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(flag){
|
||||
JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + jo.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
if(jsonReDtl!=null){
|
||||
// 如果是合格或者是放行就存入 入库数
|
||||
jsonReDtl.put("instor_qty", jo.getDoubleValue("real_qty")+jsonReDtl.getDouble("instor_qty"));
|
||||
//判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中
|
||||
if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
} else {
|
||||
jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode());
|
||||
}
|
||||
reDtlTab.update(jsonReDtl);
|
||||
}
|
||||
|
||||
/*
|
||||
* 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成
|
||||
*/
|
||||
JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0);
|
||||
int flag2 = 0;
|
||||
for (int j = 0; j < reDtlArr.size(); j++) {
|
||||
JSONObject json1 = reDtlArr.getJSONObject(j);
|
||||
if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
flag2 = flag2 + 1;
|
||||
}
|
||||
}
|
||||
JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0);
|
||||
if (reDtlArr.size() == flag2) {
|
||||
jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode());
|
||||
jsonReMst.put("confirm_optid", currentUserId);
|
||||
jsonReMst.put("confirm_optname", nickName);
|
||||
jsonReMst.put("confirm_time", now);
|
||||
reMstTab.update(jsonReMst);
|
||||
}
|
||||
/*
|
||||
* 如果到货单主表状态为确认,则需要更新采购订单接口处理表
|
||||
*/
|
||||
if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) {
|
||||
JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0);
|
||||
// 到货数量 = 订单数量,为完成,否则为采购中
|
||||
if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode());
|
||||
} else {
|
||||
jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode());
|
||||
}
|
||||
procTab.update(jsonProc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//更新主表状态为99
|
||||
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
||||
}
|
||||
|
||||
@@ -225,11 +225,11 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService {
|
||||
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));
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.0000", value));
|
||||
} else if (value == 0){
|
||||
jsonResuft.put(inspection_item_id,"0.00");
|
||||
jsonResuft.put(inspection_item_id,"0.0000");
|
||||
} else {
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.00", value));
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.0000", value));
|
||||
}
|
||||
}
|
||||
// 根据物料批次查找理化单对应的项点
|
||||
@@ -239,11 +239,11 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService {
|
||||
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));
|
||||
jsonResuft.put(inspection_item_id,"0"+NumberUtil.decimalFormat("#.0000", value));
|
||||
} else if (value == 0){
|
||||
jsonResuft.put(inspection_item_id,"0.00");
|
||||
jsonResuft.put(inspection_item_id,"0.0000");
|
||||
} else {
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.00", value));
|
||||
jsonResuft.put(inspection_item_id,NumberUtil.decimalFormat("#.0000", value));
|
||||
}
|
||||
}
|
||||
array.add(jsonResuft);
|
||||
|
||||
Reference in New Issue
Block a user