优化
This commit is contained in:
@@ -227,6 +227,7 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject PDM_BI_WorkOrder = WQLObject.getWQLObject("PDM_BI_WorkOrder");
|
||||
WQLObject PDM_BI_Formula = WQLObject.getWQLObject("PDM_BI_Formula");
|
||||
WQLObject PDM_BI_WorkTask = WQLObject.getWQLObject("PDM_BI_WorkTask");
|
||||
WQLObject PDM_BI_WorkTaskJob = WQLObject.getWQLObject("PDM_BI_WorkTaskJob");
|
||||
WQLObject PDM_BI_ProduceProcessRoute = WQLObject.getWQLObject("pdm_bi_productprocessroute");
|
||||
@@ -256,6 +257,11 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
|
||||
if (jsonMst == null) {
|
||||
throw new BadRequestException(jo.getString("workorder_code") + "当前工令记录状态异常,操作失败!");
|
||||
}
|
||||
|
||||
JSONObject Formula = PDM_BI_Formula.query("workorder_id ='" + jo.getString("workorder_id") + "' and is_delete = '0' and is_audit='0' ").uniqueResult(0);
|
||||
if (Formula != null) {
|
||||
throw new BadRequestException(jo.getString("workorder_code") + "工令对应配方未审核,操作失败!");
|
||||
}
|
||||
String nowStatus = jsonMst.getString("status");
|
||||
JSONObject Route = PDM_BI_ProduceProcessRoute.query("is_delete='0' and productprocess_status='20' and material_id='" + jsonMst.getString("material_id") + "'").uniqueResult(0);
|
||||
if (Route == null) {
|
||||
|
||||
@@ -58,6 +58,14 @@ public class FormulaController {
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(formulaService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/audit")
|
||||
@Log("保存")
|
||||
@ApiOperation("保存")
|
||||
public ResponseEntity<Object> audit(@RequestBody JSONObject whereJson){
|
||||
formulaService.audit(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/cancel")
|
||||
@Log("保存")
|
||||
@ApiOperation("保存")
|
||||
|
||||
@@ -25,6 +25,11 @@ public interface FormulaService {
|
||||
* @param whereJson /
|
||||
*/
|
||||
void cancel(JSONObject whereJson);
|
||||
/**
|
||||
* 编辑
|
||||
* @param whereJson /
|
||||
*/
|
||||
void audit(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
|
||||
@@ -66,6 +66,10 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
if (StrUtil.isNotEmpty(workorder_code)) {
|
||||
map.put("workorder_code", "%" + workorder_code + "%");
|
||||
}
|
||||
String formula_code = map.get("formula_code");
|
||||
if (StrUtil.isNotEmpty(formula_code)) {
|
||||
map.put("formula_code", "%" + formula_code + "%");
|
||||
}
|
||||
String pcsn = map.get("pcsn");
|
||||
if (StrUtil.isNotEmpty(pcsn)) {
|
||||
map.put("pcsn", "%" + pcsn + "%");
|
||||
@@ -145,6 +149,30 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void audit(JSONObject whereJson) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
WQLObject PDM_BI_Formula = WQLObject.getWQLObject("PDM_BI_Formula");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
for(int i=0;i<rows.size();i++){
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
String formula_id = jo.getString("formula_id");
|
||||
JSONObject jo_old = PDM_BI_Formula.query("is_delete='0' and formula_id ='"+formula_id+"' and status='20'").uniqueResult(0);
|
||||
if(jo_old ==null){
|
||||
throw new BadRequestException("当前配方 "+jo.getString("formula_code")+"非提交状态,不可审核!");
|
||||
}
|
||||
jo_old.put("is_audit","1");
|
||||
jo_old.put("audit_id",currentUserId);
|
||||
jo_old.put("audit_name",nickName);
|
||||
jo_old.put("audit_time",now);
|
||||
PDM_BI_Formula.update(jo_old);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit(JSONObject whereJson) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.formula_id TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.is_audit TYPEAS s_string
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
@@ -75,6 +76,9 @@
|
||||
OPTION 输入.status <> ""
|
||||
Formula.status = 输入.status
|
||||
ENDOPTION
|
||||
OPTION 输入.is_audit <> ""
|
||||
Formula.is_audit = 输入.is_audit
|
||||
ENDOPTION
|
||||
OPTION 输入.formula_code <> ""
|
||||
Formula.formula_code like 输入.formula_code
|
||||
ENDOPTION
|
||||
|
||||
Reference in New Issue
Block a user