修改工厂日历接口数据格式

修改工序CD保存等参数格式
master
xiaoning 10 months ago
parent ed078e2a53
commit cb554996ae

@ -2,6 +2,8 @@ package com.dsic.gj_erp.controller.jcsj;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.jcsj.EmGcrl;
import com.dsic.gj_erp.bean.jcsj.EmSbcnp;
@ -12,7 +14,10 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
@ -32,15 +37,23 @@ public class EmGcrlController {
@ApiOperation(value = "查询")
@PostMapping(value = "/getList")
public ResultBean getList(@RequestBody JSONObject json) {
List<EmGcrl> emGcrls= emGcrlService.getList(json);
return new ResultBean(emGcrls);
// List<EmGcrl> emGcrls= emGcrlService.getList(json);
List<EmGcrl> emGcrls=emGcrlService.list(new QueryWrapper<EmGcrl>().orderByAsc("gl"));
Map<String,List<EmGcrl>> years= emGcrls.stream().collect(Collectors.groupingBy(EmGcrl::getNf));
List<String> restDays= emGcrls.stream().filter(l->l.getXxr().equals("0")).map(EmGcrl::getGl).collect(Collectors.toList());
int nextYear=Integer.parseInt(emGcrls.get(emGcrls.size()-1).getNf())+1;
Map map=new HashMap();
map.put("years",years.keySet());
map.put("restDays",restDays);
map.put("nextYear",nextYear);
return new ResultBean(map);
}
@ApiOperation(value = "批量修改")
@PostMapping(value = "/update")
public ResultBean update(@RequestBody List<EmGcrl> emGcrls) {
emGcrlService.update(emGcrls);
public ResultBean update(@RequestBody EmGcrl emGcrl) {
emGcrlService.update(new UpdateWrapper<EmGcrl>().set("xxr",emGcrl.getXxr()).eq("gl",emGcrl.getGl()));
return new ResultBean();
}

@ -12,6 +12,7 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Semaphore;
@RestController
@ -101,11 +102,20 @@ public class 三月滚动排产控制器 {
}
@PostMapping("saveGxcd")
public ResultBean<?> CD(@RequestBody CD _CD){
_CD.save(_CD);
public ResultBean<?> CD(@RequestBody List<CD> _CD){
for (CD CD : _CD) {
_CD.save(CD);
}
return new ResultBean<>();
}
@PostMapping("removeGxcd")
public ResultBean<?> CD(@RequestBody List<CD> _CD){
for (CD CD : _CD) {
_CD.remove(CD.getGx().name());
}
return new ResultBean<>();
}
@GetMapping("getSbcnAll")
public ResultBean<?> (){
Object o = _.get();
@ -113,14 +123,18 @@ public class 三月滚动排产控制器 {
}
@PostMapping("saveSbcn")
public ResultBean<?> (@RequestBody _){
_.save(_);
public ResultBean<?> (@RequestBody List<> _){
for ( : _) {
_.save();
}
return new ResultBean<>();
}
@GetMapping("remove")
public ResultBean<?> (String code){
_.remove(code);
@PostMapping("remove")
public ResultBean<?> (@RequestBody List<> _){
for ( : _) {
_.remove(.getCode());
}
return new ResultBean<>();
}
}

@ -68,17 +68,19 @@ public class EmGcrlServiceImpl extends ServiceImpl<EmGcrlMapper, EmGcrl> impleme
@Override
public void generate(String nf) {
List<EmGcrl> emGcrlRepositoryByNf=emGcrlRepository.findByNf(nf);
if (ObjectUtil.isEmpty(emGcrlRepositoryByNf)){
Integer intNF=Integer.parseInt(nf);
LocalDate startDate = LocalDate.of(intNF, 1, 1); // 起始日期2022年1月1日
LocalDate endDate = LocalDate.of(intNF, 12, 31); // 结束日期2022年12月31日
List<EmGcrl> saveList=new ArrayList<>();
LocalDate currentDate = startDate;
String gzr="";
while (currentDate.isBefore(endDate) || currentDate.isEqual(endDate)) {
EmGcrl emGcrl=new EmGcrl();
emGcrl.setNf(nf);
// List<EmGcrl> emGcrlRepositoryByNf=emGcrlRepository.findByNf(nf);
nf=this.getOne(new QueryWrapper<EmGcrl>().select("top 1 * ").orderByDesc("nf")).getNf();
// nf=(Integer.parseInt(nf)+1)+"";
// if (ObjectUtil.isEmpty(emGcrlRepositoryByNf)){
Integer intNF=Integer.parseInt(nf)+1;
LocalDate startDate = LocalDate.of(intNF, 1, 1); // 起始日期2022年1月1日
LocalDate endDate = LocalDate.of(intNF, 12, 31); // 结束日期2022年12月31日
List<EmGcrl> saveList=new ArrayList<>();
LocalDate currentDate = startDate;
String gzr="";
while (currentDate.isBefore(endDate) || currentDate.isEqual(endDate)) {
EmGcrl emGcrl=new EmGcrl();
emGcrl.setNf(intNF+"");
String gl = currentDate.format(DateTimeFormatter.ofPattern("yyyy/MM/dd"));
emGcrl.setGl(gl);
// WeekFields weekFields = WeekFields.of(Locale.getDefault());
@ -112,6 +114,6 @@ public class EmGcrlServiceImpl extends ServiceImpl<EmGcrlMapper, EmGcrl> impleme
currentDate = currentDate.plusDays(1); // 增加一天,处理下一个日期
}
saveBatch(saveList);
}
// }
}
}

Loading…
Cancel
Save