diff --git a/src/main/java/com/dsic/gj_erp/GjErpApplication.java b/src/main/java/com/dsic/gj_erp/GjErpApplication.java
index 9da305f..8f66acc 100644
--- a/src/main/java/com/dsic/gj_erp/GjErpApplication.java
+++ b/src/main/java/com/dsic/gj_erp/GjErpApplication.java
@@ -22,7 +22,7 @@ import java.util.Properties;
@SpringBootApplication
@EnableSwagger2
//@EnableTransactionManagement
-@MapperScan({"com.dsic.gj_erp.mapper"})
+@MapperScan({"com.dsic.gj_erp.mapper","com.dsic.gj_erp.jszb.mapper"})
public class GjErpApplication {
public static void main(String[] args) {
diff --git a/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java b/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java
index 8b599de..66aaf97 100644
--- a/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java
+++ b/src/main/java/com/dsic/gj_erp/bean/jhgk/DmYdjh.java
@@ -436,11 +436,17 @@ public class DmYdjh implements Serializable {
public void setZtByZyjhzx(String type){
ZyjhzxEnum zyjhzxEnum = ZyjhzxEnum.valueOf(type);
- ZyjhzxEnum zt = ZyjhzxEnum.getEnumByCode(this.zt);
- if (zyjhzxEnum==null){
- throw new ServiceException(10001,"作业计划执行内容不存在");
+ //光电跳过划线,抛丸后直接进行切割流程
+ if ("17".equals(kw)&&zyjhzxEnum==ZyjhzxEnum.PWFK){
+ //this.zt=ZyjhzxEnum.HXFK.code;
+ }else{
+ ZyjhzxEnum zt = ZyjhzxEnum.getEnumByCode(this.zt);
+ if (zyjhzxEnum==null){
+ throw new ServiceException(10001,"作业计划执行内容不存在");
+ }
+ this.zt=zyjhzxEnum.computeCode<=zt.computeCode?zt.code:zyjhzxEnum.code;
}
- this.zt=zyjhzxEnum.computeCode<=zt.computeCode?zt.code:zyjhzxEnum.code;
+
}
@AllArgsConstructor
diff --git a/src/main/java/com/dsic/gj_erp/controller/jcsj/DmBzryController.java b/src/main/java/com/dsic/gj_erp/controller/jcsj/DmBzryController.java
index 917598b..6a34950 100644
--- a/src/main/java/com/dsic/gj_erp/controller/jcsj/DmBzryController.java
+++ b/src/main/java/com/dsic/gj_erp/controller/jcsj/DmBzryController.java
@@ -4,6 +4,7 @@ package com.dsic.gj_erp.controller.jcsj;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsic.gj_erp.annotation.AuthFunction;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.jcsj.DmBzry;
@@ -21,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
/**
*
@@ -62,16 +64,27 @@ public class DmBzryController {
public ResultBean getBzryUpdate(@RequestBody List t, HttpServletRequest request){
String bzry= (String) request.getAttribute("yhms");
String bzrq= DateUtil.format(DateUtil.date(), "yyyy/MM/dd");
+ List list = service.list();
+
t.forEach(e->{
- e.setXgrq(bzrq);
- e.setXgry(bzry);
- service.updateById(e);
+ e.setXgrq(bzrq);
+ e.setXgry(bzry);
+ if ("班长".equals(e.getPosition())){
+ e.setForeman("1");
+ }else{
+ Optional 班长 = list.stream().filter(item ->
+ StrUtil.isNotEmpty(item.getZyq()) && item.getZyq().equals(e.getZyq())
+ && StrUtil.isNotEmpty(item.getResourcesCode()) && item.getResourcesCode().equals(e.getResourcesCode())
+ && StrUtil.isNotEmpty(item.getPosition()) && item.getPosition().equals("班长")).findFirst();
+ 班长.ifPresent(it-> e.setForeman(it.getUserCode()));
+ }
+
+ service.updateById(e);
});
return new ResultBean();
}
-
@PostMapping(value = "/getryBase")
@Transactional(rollbackFor = Exception.class)
public ResultBean getryBase(@RequestBody Map mapp, HttpServletRequest request){
diff --git a/src/main/java/com/dsic/gj_erp/controller/kban/SCKbanController.java b/src/main/java/com/dsic/gj_erp/controller/kban/SCKbanController.java
index 3295c0f..cc36bb9 100644
--- a/src/main/java/com/dsic/gj_erp/controller/kban/SCKbanController.java
+++ b/src/main/java/com/dsic/gj_erp/controller/kban/SCKbanController.java
@@ -3,6 +3,8 @@ package com.dsic.gj_erp.controller.kban;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.dsic.gj_erp.bean.ResultBean;
@@ -25,8 +27,13 @@ public class SCKbanController {
@GetMapping("getYdjhByMonth")
public ResultBean> getYdjhByMonth(){
DateTime date=DateUtil.date();
+ String begin=DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
+ String end=DateUtil.endOfMonth(date).offsetNew(DateField.DAY_OF_YEAR,1).toString("yyyy/MM/dd");
List between = service.list(Wrappers.lambdaQuery()
- .between(DmYdjh::getQgfkrq, DateUtil.beginOfMonth(date).toString("yyyy/MM/dd"), DateUtil.endOfMonth(date).offsetNew(DateField.DAY_OF_YEAR,1).toString("yyyy/MM/dd")));
- return new ResultBean<>(between);
+ .select(DmYdjh::getKw,DmYdjh::getQgfkrq,DmYdjh::getZyq1,DmYdjh::getBcshzl,DmYdjh::getQgjhrq)
+ .between(DmYdjh::getQgfkrq, begin, end)
+ .or(it->it.between(DmYdjh::getQgjhrq,begin,end))
+ );
+ return new ResultBean<>(JSONArray.toJSONString(between));
}
}
diff --git a/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java b/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java
index 3eb0d45..b3cf825 100644
--- a/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java
+++ b/src/main/java/com/dsic/gj_erp/jszb/control/JszbController.java
@@ -1,11 +1,14 @@
package com.dsic.gj_erp.jszb.control;
import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsic.gj_erp.bean.ResultBean;
import com.dsic.gj_erp.bean.jhgk.YdjhImportNew;
+import com.dsic.gj_erp.exception.CustomException;
+import com.dsic.gj_erp.exception.ServiceException;
import com.dsic.gj_erp.jszb.entity.PartFlowInfo;
import com.dsic.gj_erp.jszb.excel.ExcelFlowInfoListener;
import com.dsic.gj_erp.jszb.service.FlowInfoService;
@@ -17,6 +20,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
@RestController
@RequestMapping("jszb")
@@ -34,8 +38,9 @@ public class JszbController {
public ResultBean> getFlowInfoList(String ch,String begin,String end) {
List list = flowInfoService.list(Wrappers.lambdaQuery()
.eq(PartFlowInfo::getCh, ch)
- .eq(StrUtil.isEmpty(end) && StrUtil.isNotEmpty(begin), PartFlowInfo::getFd, begin)
- .between(StrUtil.isAllNotEmpty(begin, end), PartFlowInfo::getFd, begin, end)
+ .eq(StrUtil.isEmpty(end) && StrUtil.isNotEmpty(begin), PartFlowInfo::getPl, begin)
+ .between(StrUtil.isAllNotEmpty(begin, end), PartFlowInfo::getPl, begin, end)
+ .orderByAsc(PartFlowInfo::getPl,PartFlowInfo::getFd)
);
return new ResultBean<>(list);
}
@@ -44,42 +49,34 @@ public class JszbController {
public ResultBean> importFLowInfo(@RequestParam("file") MultipartFile file) throws IOException {
ExcelFlowInfoListener objectListener = new ExcelFlowInfoListener();
EasyExcel.read(file.getInputStream(), PartFlowInfo.class, objectListener).sheet(0).headRowNumber(1).doRead();
+
List objList = objectListener.getObjectList();
+ List errors = objectListener.getErrors();
List updateList=new ArrayList<>();
objList.forEach(item->{
- PartFlowInfo one=null;
- if (StrUtil.isNotEmpty(item.getCh())){
- one = flowInfoService.getOne(Wrappers.lambdaQuery()
- .and(it->it.eq(PartFlowInfo::getCh, item.getCh())
- .or(it0->it0.eq(PartFlowInfo::getCh, item.getProject())))
- .and(it->it.eq(PartFlowInfo::getPartName, item.getPartName())
- .or(it0->it0.eq(PartFlowInfo::getPartName, item.getPartName0()))
- ));
- }
+ PartFlowInfo one = flowInfoService.getOne(Wrappers.lambdaQuery()
+ .eq(StrUtil.isNotEmpty(item.getCh()),PartFlowInfo::getCh, item.getCh())
+ .eq(StrUtil.isNotEmpty(item.getCh()),PartFlowInfo::getPartName,item.getPartName())
+ .eq(StrUtil.isNotEmpty(item.getProject()),PartFlowInfo::getCh,item.getProject())
+ .eq(StrUtil.isNotEmpty(item.getProject()),PartFlowInfo::getPartName,item.getPartName0())
+ );
- if (StrUtil.isNotEmpty(item.getProject())){
- one = flowInfoService.getOne(Wrappers.lambdaQuery()
- .eq(PartFlowInfo::getCh, item.getCh())
- .eq(PartFlowInfo::getPartName, item.getPartName())
- );
- }
-
- if (one==null){
+ if (ObjUtil.isEmpty(one)){
one = new PartFlowInfo();
}
- BeanUtil.copyProperties(item,one);
+ BeanUtil.copyProperties(item,one,"id");
if(item.getProject()!=null){
one.setCh(item.getProject());
+ one.setFd(item.getBlock());
one.setPartName(item.getPartName0());
}
-
updateList.add(one);
});
flowInfoService.saveOrUpdateBatch(updateList);
- return new ResultBean<>();
+ return new ResultBean<>(errors);
}
}
diff --git a/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java b/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java
index 1057b83..11f280d 100644
--- a/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java
+++ b/src/main/java/com/dsic/gj_erp/jszb/entity/PartFlowInfo.java
@@ -1,13 +1,18 @@
package com.dsic.gj_erp.jszb.entity;
+import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import com.dsic.gj_erp.jszb.excel.ExcelFlowInfoListener;
import lombok.Getter;
import lombok.Setter;
+import java.io.File;
+import java.util.List;
+
@Getter
@Setter
@TableName("part_flow_info")
@@ -19,7 +24,7 @@ public class PartFlowInfo {
@ExcelProperty("分段号")
private String fd;
@ExcelProperty("批量")
- private Integer pl;
+ private String pl;
@ExcelProperty("零件名称")
private String partName;
@ExcelProperty("种类")
@@ -27,7 +32,7 @@ public class PartFlowInfo {
@ExcelProperty("规格")
private String specification;
@ExcelProperty("数量")
- private Integer quantity;
+ private String quantity;
@ExcelProperty("材质")
private String material;
@ExcelProperty("特征")
@@ -60,47 +65,55 @@ public class PartFlowInfo {
@ExcelProperty("TYPE")
private String type0;
@ExcelProperty("P")
- private Integer p;
+ private String p;
@ExcelProperty("C")
- private Integer c;
+ private String c;
@ExcelProperty("S")
- private Integer s;
+ private String s;
@ExcelProperty("NP")
- private Integer np;
+ private String np;
@ExcelProperty("NC")
- private Integer nc;
+ private String nc;
@ExcelProperty("NS")
- private Integer ns;
+ private String ns;
@ExcelProperty("AREA")
- private Double area;
+ private String area;
@ExcelProperty("WEIGHT")
- private Double weight;
+ private String weight;
@ExcelProperty("CUTLEN")
- private Double cutLength;
+ private String cutLength;
@ExcelProperty("MARKLEN")
- private Double markLength;
+ private String markLength;
+
@ExcelProperty("X-SIZE")
- private Double xSize;
+ @TableField("x_size")
+ private String xxSize;//x-size
@ExcelProperty("Y-SIZE")
- private Double ySize;
+ @TableField("y_size")
+ private String yySize;//y-size
+
@ExcelProperty("OPTION")
- private String option;
+ private String option0;
@ExcelProperty("MPARTNAME")
- private String mPartName;
+ private String m_part_name;
@ExcelProperty("SPARTNAME")
- private String sPartName;
+ private String s_part_name;
@ExcelProperty("LOT")
private String lot;
@ExcelProperty("BAREA")
- private Double bArea;
+ @TableField("b_area")
+ private String bbArea;
@ExcelProperty("SANGLE")
- private Double sAngle;
+ @TableField("s_angle")
+ private String ssAngle;
@ExcelProperty("SSIZE-X")
- private Double sSizeX;
+ @TableField("s_size_x")
+ private String ssSizeX;
@ExcelProperty("SSIZE-Y")
- private Double sSizeY;
+ @TableField("s_size_y")
+ private String ssSizeY;
@ExcelProperty("GOID")
- private Double goid;
+ private String goid;
@ExcelProperty("DATE")
private String date;
@ExcelProperty("TIME")
@@ -122,7 +135,15 @@ public class PartFlowInfo {
@ExcelProperty("DIRECTION")
private String direction;
@ExcelProperty("ISMODIFY")
- private Integer isModify;
+ private String isModify;
@ExcelProperty("NESTNAME")
private String nestName;
+
+ public static void main(String[] args) {
+ ExcelFlowInfoListener objectListener = new ExcelFlowInfoListener();
+ EasyExcel.read(new File("E:\\文档\\润芃\\项目管理\\钢加\\生产管控\\实施相关\\2025年4月\\技术准备\\零件重量信息.xls"), PartFlowInfo.class, objectListener).sheet(0).headRowNumber(1).doRead();
+
+ List objList = objectListener.getObjectList();
+ System.out.println(objList);
+ }
}
diff --git a/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java b/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java
index 21f2025..2385229 100644
--- a/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java
+++ b/src/main/java/com/dsic/gj_erp/jszb/excel/ExcelFlowInfoListener.java
@@ -1,12 +1,15 @@
package com.dsic.gj_erp.jszb.excel;
+import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.dsic.gj_erp.jszb.entity.PartFlowInfo;
import lombok.Getter;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* Excel通用监听器
@@ -16,8 +19,22 @@ public class ExcelFlowInfoListener extends AnalysisEventListener {
@Getter
List objectList = new ArrayList<>();
+ Map map=new HashMap<>();
+
+ @Getter
+ List errors=new ArrayList<>();
+
@Override
public void invoke(PartFlowInfo excelDemo, AnalysisContext analysisContext) {
+ String partName=excelDemo.getPartName0()!=null?excelDemo.getPartName0():excelDemo.getPartName();
+ if (map.containsKey(partName)){
+ String error= StrUtil.format("存在重复数据,检查修改后单独导入即可,零件编号:{},已过滤该行",partName);
+ this.errors.add(error);
+ return;
+ }
+
+ map.put(partName,excelDemo);
+
objectList.add(excelDemo);
}
diff --git a/src/main/resources/mappers/jszb/JszbMapper.xml b/src/main/resources/mappers/jszb/JszbMapper.xml
new file mode 100644
index 0000000..75e24fa
--- /dev/null
+++ b/src/main/resources/mappers/jszb/JszbMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+