|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.dsic.gj_erp.controller.pgd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -14,12 +15,16 @@ import com.dsic.gj_erp.bean.kc.SlKc;
|
|
|
|
|
import com.dsic.gj_erp.bean.pgd.PgdPwjh;
|
|
|
|
|
import com.dsic.gj_erp.bean.pgd.PgdSljh;
|
|
|
|
|
import com.dsic.gj_erp.bean.pgd.PgdTzjh;
|
|
|
|
|
import com.dsic.gj_erp.bean.sy.Dm_zhbmp;
|
|
|
|
|
import com.dsic.gj_erp.dao.sy.Dm_zhbmpRepository;
|
|
|
|
|
import com.dsic.gj_erp.exception.CustomException;
|
|
|
|
|
import com.dsic.gj_erp.mapper.kc.ImCkwpkwpMapper;
|
|
|
|
|
import com.dsic.gj_erp.service.fd.DmCzjbbService;
|
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmYdjhService;
|
|
|
|
|
import com.dsic.gj_erp.service.kc.ImCkwpkwpService;
|
|
|
|
|
import com.dsic.gj_erp.service.pgd.PgdSljhService;
|
|
|
|
|
import com.dsic.gj_erp.service.sy.SYService;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
@ -58,7 +63,96 @@ public class PgdSljhController {
|
|
|
|
|
@Autowired
|
|
|
|
|
DmCzjbbService dmCzjbbService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
SYService syService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
Dm_zhbmpRepository dm_zhbmpRepository;
|
|
|
|
|
|
|
|
|
|
@PostMapping("/slPrint")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultBean slPrint(HttpServletRequest req, @RequestBody List<SlKc> list) throws Exception, CustomException {
|
|
|
|
|
//ls_lsh = F_GETPJH("MM",'00',"MSMS")
|
|
|
|
|
String id = syService.f_getpjh("MM", "00", "MSMS");
|
|
|
|
|
//dw_1.object.sllsh[ll_ii] = ls_lsh
|
|
|
|
|
//dw_1.object.dyry[ll_ii] = gs_user
|
|
|
|
|
//dw_1.object.dyrq[ll_ii] = ls_datetime
|
|
|
|
|
List<DmYdjh>ydupList=new ArrayList<>();
|
|
|
|
|
List<ImCkwpkwp>ckupList=new ArrayList<>();
|
|
|
|
|
for(SlKc slKc: list){
|
|
|
|
|
if(StringUtils.isBlank(slKc.getSllsh())){
|
|
|
|
|
ImCkwpkwp imCkwpkwp = new ImCkwpkwp();
|
|
|
|
|
imCkwpkwp.setCkh(slKc.getCKH());
|
|
|
|
|
imCkwpkwp.setWph(slKc.getWPH());
|
|
|
|
|
imCkwpkwp.setKwh(slKc.getKWH());
|
|
|
|
|
imCkwpkwp.setNbsbm(slKc.getNBSBM());
|
|
|
|
|
imCkwpkwp.setSllsh(id);
|
|
|
|
|
imCkwpkwp.setDyrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd HH:mm"));
|
|
|
|
|
imCkwpkwp.setDyry((String) req.getAttribute("yhms"));
|
|
|
|
|
ckupList.add(imCkwpkwp);
|
|
|
|
|
// slKc.setDyrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd"));
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(slKc.getYdid())){
|
|
|
|
|
DmYdjh ydjh =new DmYdjh();
|
|
|
|
|
// 库存主键 没存
|
|
|
|
|
ydjh.setId(slKc.getYdid());
|
|
|
|
|
ydjh.setZt("11");
|
|
|
|
|
ydupList.add(ydjh);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dmYdjhService.updateBatchById(ydupList);
|
|
|
|
|
imCkwpkwpService.updateBatchByMultiId(ckupList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Dm_zhbmp> qgkws = dm_zhbmpRepository.findByBMLB("QGKW");
|
|
|
|
|
List<Dm_zhbmp> zylxs = dm_zhbmpRepository.findByBMLB("zylx");
|
|
|
|
|
List<Dm_zhbmp> pwwzs = dm_zhbmpRepository.findByBMLB("pwwz");
|
|
|
|
|
List<Dm_zhbmp> dhql = dm_zhbmpRepository.findByBMLB("DHQL");
|
|
|
|
|
List<Dm_zhbmp> wpzts = dm_zhbmpRepository.findByBMLB("WPZT");
|
|
|
|
|
|
|
|
|
|
Map<String, String> qgKwMap = qgkws.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> zylxMap = zylxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> pwwzMap = pwwzs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> dhqlMap = dhql.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Map<String, String> wpztMap = wpzts.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
Integer sh=1;
|
|
|
|
|
for(SlKc slKc: list){
|
|
|
|
|
slKc.setXh(sh);
|
|
|
|
|
sh++;
|
|
|
|
|
slKc.setZYLX(zylxMap.get(slKc.getZYLX()));
|
|
|
|
|
slKc.setSLDW(qgKwMap.get(slKc.getSLDW()));
|
|
|
|
|
slKc.setWPZT(wpztMap.get(slKc.getWPZT()));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
int ceil = (int) (Math.ceil((double) list.size() / 40));
|
|
|
|
|
List<SlKc> slKcList= new ArrayList<>();
|
|
|
|
|
if(ceil>1){
|
|
|
|
|
for(int i=0;i<ceil;i++){
|
|
|
|
|
SlKc slKc =new SlKc();
|
|
|
|
|
slKc.setDyrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd"));
|
|
|
|
|
if (ceil - i == 1){
|
|
|
|
|
slKc.setList(list.subList(i*40,list.size()));
|
|
|
|
|
}else{
|
|
|
|
|
int num =i*40+40;
|
|
|
|
|
|
|
|
|
|
slKc.setList(list.subList(i*40,num));
|
|
|
|
|
}
|
|
|
|
|
slKcList.add(slKc);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
SlKc slKc =new SlKc();
|
|
|
|
|
slKc.setDyrq(DateUtil.format(DateUtil.date(), "yyyy/MM/dd"));
|
|
|
|
|
slKc.setList(list);
|
|
|
|
|
slKcList.add(slKc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultBean(slKcList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@PostMapping("/getKcAndSljh")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultBean getKcAndSljh(HttpServletRequest req, @RequestBody Map map) throws Exception, CustomException {
|
|
|
|
@ -80,24 +174,57 @@ public class PgdSljhController {
|
|
|
|
|
qw.eq("isnull(ZT,'')","11");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DmYdjh> ydjhs = dmYdjhService.list(qw);
|
|
|
|
|
// List<DmYdjh> ydjhs = dmYdjhService.list(qw);
|
|
|
|
|
// 查询上料计划
|
|
|
|
|
Map retrunMap =new HashMap();
|
|
|
|
|
retrunMap.put("slkcs",slkcs);
|
|
|
|
|
retrunMap.put("ydjhs",ydjhs);
|
|
|
|
|
retrunMap.put("ydjhs",null);
|
|
|
|
|
return new ResultBean(retrunMap);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/getKcAndSljh1")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultBean getKcAndSljh1(HttpServletRequest req, @RequestBody Map map) throws Exception, CustomException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询库存
|
|
|
|
|
//List<SlKc> slkcs = imCkwpkwpMapper.slxxKcList(map);
|
|
|
|
|
|
|
|
|
|
QueryWrapper<DmYdjh> qw =new QueryWrapper<>();
|
|
|
|
|
qw.eq(StrUtil.isNotEmpty((String)map.get("xqdcch")),"dc_ch",(String)map.get("xqdcch"));
|
|
|
|
|
qw.eq(StrUtil.isNotEmpty((String)map.get("xqpl")),"dc_pl",(String)map.get("xqpl"));
|
|
|
|
|
// 库存标识 不等于 01 没有匹配上
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(map.get("rqopt").equals("01")){
|
|
|
|
|
qw.eq("isnull(ZT,'')","2");
|
|
|
|
|
}else if(map.get("rqopt").equals("02")) {
|
|
|
|
|
qw.eq("isnull(ZT,'')","2").ne("isnull(slkcdw,'')","");
|
|
|
|
|
}else if(map.get("rqopt").equals("03")) {
|
|
|
|
|
qw.eq("isnull(ZT,'')","11");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DmYdjh> ydjhs = dmYdjhService.list(qw);
|
|
|
|
|
// 查询上料计划
|
|
|
|
|
|
|
|
|
|
return new ResultBean(ydjhs);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/getydjhByid")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultBean getydjhByid(HttpServletRequest req, @RequestBody Map map) throws Exception, CustomException {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询库存
|
|
|
|
|
DmYdjh id = dmYdjhService.getById((String)map.get("id"));
|
|
|
|
|
return new ResultBean(id);
|
|
|
|
|
List<DmYdjh> list = dmYdjhService.list(new QueryWrapper<DmYdjh>().eq("id", (String) map.get("id")));
|
|
|
|
|
|
|
|
|
|
return new ResultBean(list);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -124,7 +251,7 @@ public class PgdSljhController {
|
|
|
|
|
}
|
|
|
|
|
String cjs1=cjs;
|
|
|
|
|
DmYdjh dmYdjh = ydjhs.stream()
|
|
|
|
|
.filter(fst -> fst.getDcCh().equalsIgnoreCase(slKc.getDCCH())
|
|
|
|
|
.filter(fst -> fst.getDcCh().equalsIgnoreCase(slKc.getDCCH()) &&StringUtils.isNotBlank(fst.getWpgg())
|
|
|
|
|
&& fst.getWpgg().equalsIgnoreCase(slKc.getWPGG())
|
|
|
|
|
&& (fst.getWpxh().equalsIgnoreCase(slKc.getWPXH())
|
|
|
|
|
|| (cjs1 + fst.getWpxh()).equalsIgnoreCase(slKc.getWPXH()))
|
|
|
|
@ -140,8 +267,8 @@ public class PgdSljhController {
|
|
|
|
|
dmYdjh.setSlxhth(slKc.getGCDDH());
|
|
|
|
|
dmYdjh.setSlhth(slKc.getDcFd());
|
|
|
|
|
dmYdjh.setSlwlh(slKc.getWPH());
|
|
|
|
|
dmYdjh.setZt("11");
|
|
|
|
|
dmYdjh.setKcbs("01");
|
|
|
|
|
dmYdjh.setSlycldw((Integer) map.get("dw"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ImCkwpkwp imCkwpkwp =new ImCkwpkwp();
|
|
|
|
|
// imCkwpkwp.setCkh(slKc.getCKH());
|
|
|
|
@ -156,11 +283,13 @@ public class PgdSljhController {
|
|
|
|
|
ydupList.add(dmYdjh);
|
|
|
|
|
// ckupList.add(imCkwpkwp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
slKc.setZYLX(getLx(dmYdjh.getLqlb(), dmYdjh.getZl()));
|
|
|
|
|
slKc.setZYCH(dmYdjh.getDcCh());
|
|
|
|
|
slKc.setZYPL(dmYdjh.getDcPl());
|
|
|
|
|
slKc.setZYLX(dmYdjh.getZl());
|
|
|
|
|
// slKc.setZYLX(dmYdjh.getZl());
|
|
|
|
|
slKc.setSLDW(dmYdjh.getKw());
|
|
|
|
|
slKc.setDHH(dmYdjh.getSljhrq());
|
|
|
|
|
//slKc.setPwwz(dmYdjh.getKw());
|
|
|
|
|
slKc.setYdid(dmYdjh.getId());
|
|
|
|
|
ydjhs.remove(dmYdjh); // 从列表中移除找到的元素
|
|
|
|
|
ckupList.add(slKc);
|
|
|
|
@ -176,7 +305,7 @@ public class PgdSljhController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("kcAdnSlZx")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void kcAdnSlZx(HttpServletRequest req, @RequestBody Map map) throws Exception, CustomException {
|
|
|
|
|
public ResultBean kcAdnSlZx(HttpServletRequest req, @RequestBody Map map) throws Exception, CustomException {
|
|
|
|
|
|
|
|
|
|
String str= JSON.toJSONString(map.get("data1"));
|
|
|
|
|
List<SlKc> slKcs= JSONObject.parseArray(str, SlKc.class);
|
|
|
|
@ -198,12 +327,15 @@ public class PgdSljhController {
|
|
|
|
|
imCkwpkwp.setZypl(slKc.getZYPL());
|
|
|
|
|
imCkwpkwp.setZylx(slKc.getZYLX());
|
|
|
|
|
imCkwpkwp.setSldw(slKc.getSLDW());
|
|
|
|
|
imCkwpkwp.setPwwz(slKc.getPwwz());
|
|
|
|
|
imCkwpkwp.setBz(slKc.getBZ());
|
|
|
|
|
imCkwpkwp.setDhh(slKc.getDHH());
|
|
|
|
|
ckupList.add(imCkwpkwp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
imCkwpkwpService.updateBatchByMultiId(ckupList);
|
|
|
|
|
dmYdjhService.updateBatchById(ydjhs);
|
|
|
|
|
|
|
|
|
|
return new ResultBean();
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -269,5 +401,60 @@ public class PgdSljhController {
|
|
|
|
|
// return new ResultBean();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getLx(String lqlb ,String zl){
|
|
|
|
|
// 1000 数中大
|
|
|
|
|
// 1001 数小
|
|
|
|
|
// 1002 数中
|
|
|
|
|
// 1003 数大
|
|
|
|
|
// 1004 数曲
|
|
|
|
|
|
|
|
|
|
// 1005 手小
|
|
|
|
|
// 1006 手中
|
|
|
|
|
// 1007 手大
|
|
|
|
|
// 1008 手中大
|
|
|
|
|
// 1009 焊接机器人肘板 --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 1010 手工
|
|
|
|
|
// 1020 数控
|
|
|
|
|
if("1010".equals(lqlb)){
|
|
|
|
|
if("1110".equals(zl)){ //数中大
|
|
|
|
|
return "1000";
|
|
|
|
|
}
|
|
|
|
|
if("1010".equals(zl)){ //数小
|
|
|
|
|
return "1001";
|
|
|
|
|
}
|
|
|
|
|
if("1020".equals(zl)){ //数中
|
|
|
|
|
return "1002";
|
|
|
|
|
}
|
|
|
|
|
if("1060".equals(zl)){ //数大
|
|
|
|
|
return "1003";
|
|
|
|
|
}
|
|
|
|
|
if("4207".equals(zl)||"1090".equals(zl)){ //数大
|
|
|
|
|
return "1004";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if("1020".equals(lqlb)){
|
|
|
|
|
if("1110".equals(zl)){ //手中大
|
|
|
|
|
return "1008";
|
|
|
|
|
}
|
|
|
|
|
if("1010".equals(zl)){ //数小
|
|
|
|
|
return "1005";
|
|
|
|
|
}
|
|
|
|
|
if("1020".equals(zl)){ //数中
|
|
|
|
|
return "1006";
|
|
|
|
|
}
|
|
|
|
|
if("1060".equals(zl)){ //数大
|
|
|
|
|
return "1007";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if("4230".equals(zl)){ //焊接机器人肘板
|
|
|
|
|
return "1009";
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|