修改
This commit is contained in:
@@ -39,6 +39,14 @@ public class DailyplanController {
|
||||
return new ResponseEntity<>(dailyplanService.
|
||||
queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/query2")
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
public ResponseEntity<Object> query2(@RequestParam Map whereJson){
|
||||
return new ResponseEntity<>(dailyplanService.
|
||||
queryAll(whereJson),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping
|
||||
@Log("新增工令")
|
||||
@ApiOperation("新增工令")
|
||||
@@ -46,13 +54,6 @@ public class DailyplanController {
|
||||
dailyplanService.create(json);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
@GetMapping("/mouthtask")
|
||||
public ResponseEntity<Object> mouthtask(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(dailyplanService.
|
||||
queryAll2(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改工令")
|
||||
@@ -84,19 +85,6 @@ public class DailyplanController {
|
||||
dailyplanService.submit2(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("获取明细list")
|
||||
@ApiOperation("获取Bom明细list")
|
||||
@GetMapping("/getDevices")
|
||||
public ResponseEntity<Object> getDevices(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(dailyplanService.getDevices(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取明细list")
|
||||
@ApiOperation("获取Bom明细list")
|
||||
@GetMapping("/getCapacitytes")
|
||||
public ResponseEntity<Object> getCapacitytes(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(dailyplanService.getCapacitytes(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
|
||||
@@ -25,14 +25,6 @@ public interface DailyplanService {
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll2(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 创建
|
||||
* @param json /
|
||||
@@ -44,7 +36,7 @@ public interface DailyplanService {
|
||||
* @param whereJson 条件参数
|
||||
* @return List<ProductplanprocDto>
|
||||
*/
|
||||
List<ProductplanprocDto> queryAll(Map whereJson);
|
||||
JSONArray queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
@@ -72,11 +64,6 @@ public interface DailyplanService {
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导入月计划表格
|
||||
* @param id /
|
||||
*/
|
||||
void importExcel(String id);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
@@ -88,17 +75,6 @@ public interface DailyplanService {
|
||||
*/
|
||||
void submit2(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getDevices(Map whereJson);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getCapacitytes(Map whereJson);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param whereJson
|
||||
|
||||
@@ -81,29 +81,30 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll2(Map whereJson, Pageable page) {
|
||||
public JSONArray queryAll(Map whereJson) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
String material_code = map.get("material_code");
|
||||
if (StrUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
|
||||
String task_code = map.get("task_code");
|
||||
if (StrUtil.isNotEmpty(task_code)) {
|
||||
map.put("task_code", "%" + task_code + "%");
|
||||
}
|
||||
map.put("flag", "2");
|
||||
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.input_time desc");
|
||||
return json;
|
||||
}
|
||||
JSONArray jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN")
|
||||
.addParamMap(map).process().getResultJSONArray(0);
|
||||
|
||||
@Override
|
||||
public List<ProductplanprocDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<ProductplanprocDto> list = arr.toJavaList(ProductplanprocDto.class);
|
||||
return list;
|
||||
JSONArray ja = new JSONArray();
|
||||
for(int i=0;i<jret.size();i++){
|
||||
JSONObject jo = jret.getJSONObject(i);
|
||||
String planend_date = jo.getString("planend_date");
|
||||
Date date = DateUtil.parse(planend_date);
|
||||
|
||||
String plan_finish_date = jo.getString("plan_finish_date");
|
||||
Date date2 = DateUtil.parse(plan_finish_date);
|
||||
long days = (int) DateUtil.between(date2,date, DateUnit.DAY);
|
||||
jo.put("day_num",days);
|
||||
ja.add(jo);
|
||||
}
|
||||
return ja;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,13 +214,17 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
MPS_BD_ProductDailyPlan.delete("dailyplan_id='"+dailyplan_id+"'");
|
||||
String plan_id = jo.getString("plan_id");
|
||||
if (StrUtil.isNotEmpty(plan_id)) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", "1");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + plan_id + "'");
|
||||
|
||||
JSONArray ja = MPS_BD_ProductDailyPlan.query("plan_id='"+plan_id+"'").getResultJSONArray(0);
|
||||
if(ja.size() == 0){
|
||||
if (StrUtil.isNotEmpty(plan_id)) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", "1");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + plan_id + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,85 +275,6 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String id) {
|
||||
WQLObject planProcTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
|
||||
//根据路径获取表格里的记录
|
||||
String path = json.getString("path");
|
||||
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet().doReadSync();
|
||||
listMap.remove(0);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
Map<String, Object> map = listMap.get(i);
|
||||
|
||||
String plan_code = String.valueOf(map.get(0));
|
||||
String plan_month = String.valueOf(map.get(1));
|
||||
String plan_org_code = String.valueOf(map.get(2));
|
||||
String plan_org_name = String.valueOf(map.get(3));
|
||||
String material_code = String.valueOf(map.get(4));
|
||||
String product_type_name = String.valueOf(map.get(5));
|
||||
Long product_weight = Long.valueOf((String) map.get(6));
|
||||
String plan_finish_date = String.valueOf(map.get(7));
|
||||
String remark = String.valueOf(map.get(8));
|
||||
//校验数据准确性
|
||||
JSONObject jsonTab = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "2").addParam("code", plan_org_code).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonTab)) {
|
||||
throw new BadRequestException("没有此【" + plan_org_name + "】单位");
|
||||
}
|
||||
JSONObject jsonMater = materTab.query("material_code = '" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) {
|
||||
throw new BadRequestException("没有此【" + material_code + "】物料");
|
||||
}
|
||||
//月生产计划接口处理表数据
|
||||
ProductplanprocDto dto = new ProductplanprocDto();
|
||||
dto.setPlan_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setPlan_code(plan_code);
|
||||
dto.setPlan_month(plan_month);
|
||||
dto.setPlan_org_code(plan_org_code);
|
||||
dto.setPlan_org_name(plan_org_name);
|
||||
dto.setMaterial_id(jsonMater.getLong
|
||||
("material_id"));
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(jsonMater.getString("material_name"));
|
||||
dto.setMaterial_spec(jsonMater.getString("material_spec"));
|
||||
dto.setProduct_type_name(product_type_name);
|
||||
|
||||
MaterialbaseDto materDto = materialbaseService.findById(jsonMater.getLong
|
||||
("material_id"));
|
||||
dto.setWeight_unit_name(materDto.getBase_unit_name());
|
||||
dto.setWeight_unit_id(materDto.getBase_unit_id());
|
||||
|
||||
dto.setProduct_weight(BigDecimal.valueOf(product_weight));
|
||||
dto.setFact_weight(BigDecimal.valueOf(product_weight));
|
||||
dto.setPlan_finish_date(plan_finish_date);
|
||||
dto.setInput_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setInput_optname(SecurityUtils.getNickName());
|
||||
dto.setInput_time(DateUtil.now());
|
||||
dto.setIs_proc("0");
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setRemark(remark);
|
||||
dto.setTask_code(CodeUtil.getNewCode("PCS_TASK_CODE"));
|
||||
//判断表里有没有此条记录
|
||||
JSONObject jsonObject = planProcTab.query("plan_org_code = '" + plan_org_code + "' and plan_month = '" + plan_month + "' and material_code ='" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
} else {
|
||||
if (!StrUtil.equals(jsonObject.getString("is_proc"), "2")) {
|
||||
continue;
|
||||
} else {
|
||||
//如果是生成状态则将当前记录删除,在重新插入
|
||||
planProcTab.delete(jsonObject);
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit2(JSONObject form) {
|
||||
@@ -508,22 +434,6 @@ public class DailyplanServiceImpl implements DailyplanService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getDevices(Map json) {
|
||||
HashMap<String, String> map = new HashMap<>(json);
|
||||
map.put("flag", "3");
|
||||
JSONArray ret = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).process().getResultJSONArray(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getCapacitytes(Map json) {
|
||||
HashMap<String, String> map = new HashMap<>(json);
|
||||
map.put("flag", "4");
|
||||
JSONArray ret = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).process().getResultJSONArray(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
|
||||
@@ -135,42 +135,11 @@
|
||||
OPTION 输入.device_id <> ""
|
||||
pp.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
order by pp.planstart_date desc
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
deviceinfo.device_id AS id,
|
||||
deviceinfo.device_code AS CODE,
|
||||
deviceinfo.device_name AS NAME
|
||||
FROM
|
||||
em_bi_deviceinfo deviceinfo
|
||||
WHERE
|
||||
1 = 1
|
||||
AND deviceinfo.is_active = '1'
|
||||
AND deviceinfo.is_delete = '0'
|
||||
AND deviceinfo.workprocedure_code = 'GX003'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
capacitytemplatemst.captemplate_id AS id,
|
||||
capacitytemplatemst.captemplate_code AS CODE,
|
||||
capacitytemplatemst.captemplate_name AS NAME
|
||||
FROM
|
||||
mps_bd_capacitytemplatemst capacitytemplatemst
|
||||
WHERE
|
||||
1 = 1
|
||||
AND capacitytemplatemst.is_used = '1'
|
||||
AND capacitytemplatemst.is_delete = '0'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user