Commit ad7b0f75 authored by yff's avatar yff

修改BUG

parent f3a790dc
......@@ -4,6 +4,7 @@ import com.gavel.common.BaseURL;
import com.gavel.common.base.BaseEditJSON;
import com.gavel.common.converter.DataConvert;
import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.service.GpfkService;
import com.gavel.kwell.vo.GpfkCondition;
import com.gavel.kwell.vo.GpfkVO;
......@@ -73,9 +74,9 @@ public class GphyController extends BaseController {
@ResponseBody
public Object query(@RequestBody JSONObject param) {
GphyCondition condition = JSONObject.toJavaObject(param, GphyCondition.class);
Integer code = gphyService.zpwl(condition);
if(code!=null&&code>0) {
return buildReturnData(code);
Gpfk gpfk = gphyService.zpwl(condition);
if(gpfk!=null) {
return buildReturnData(gpfk);
}
return ThreadContext.getReturnData();
}
......
......@@ -22,6 +22,7 @@ import com.gavel.common.base.controller.BaseController;
import com.gavel.common.converter.DataConvert;
import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.service.GpfkService;
import com.gavel.kwell.service.GphyService;
import com.gavel.persistence.sql.RecordSet;
import io.swagger.annotations.ApiOperation;
......@@ -33,6 +34,9 @@ public class WosngzController extends BaseController {
@Autowired
private GpfkService gpfkService;
@Autowired
private GphyService gphyService;
@ResourcePermissions()
@RequestMapping("/index")
public String index() {
......@@ -117,8 +121,9 @@ public class WosngzController extends BaseController {
setReturnMessage("工票信息不允许为空!");
return returnData();
}
List<GphyVO> gphyVOList = new ArrayList<>();
//List<GphyVO> gphyVOList = gpfkService.queryGphyListByGpid(gpfkid);
GphyCondition condition = new GphyCondition();
condition.setMid(gpfkid);
List<GphyVO> gphyVOList = gphyService.query(condition).getRecords();
return buildReturnData(gphyVOList, GphyVO.class);
}
......
......@@ -122,7 +122,7 @@ public interface GpfkDao extends BaseDao {
public GpfkVO queryKwellGpfkByWosnAndGxid(GpfkCondition condition);
public double queryWobomZpslByDjidAndWlid(String djid,String wlid);
public double queryWobomZpslByDjidAndWlid(String fkid,String wlid);
public List<Gphy> queryGphyByGpfkid(String mid);
......
......@@ -22,5 +22,7 @@ public interface GphyDao extends BaseDao {
public RecordSet<GphyVO> queryKwellZpGphy(GphyCondition condition);
public List<WlslItem> queryKwellZpslGphy(GphyCondition condition);
public WlslItem queryKwellZpslGphy(GphyCondition condition);
public int queryIfZpwc(GphyCondition condition);
}
......@@ -1102,9 +1102,9 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append(" left join WO on WO_ID = WOBOM_WOID");
sqlMap.append(" left join WOSN on WOSN_WOID = WO_ID");
sqlMap.append(" left join WOGYLX on WOGYLX_WOID = WO_ID ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID and BZGX_ID = WOBOM_FFGX");
sqlMap.append(" left join GPFK on GPFK_WOSNID = WOSN_CODE and GPFK_FKGX= BZGX_ID and GPFK_WOGYLX =WOGYLX_ID");
sqlMap.append(" left join (select sum(GPHY_ZPSL) as ZPSL,GPHY_MID,GPHY_WLID from GPHY group by GPHY_MID,GPHY_WLID) k on k.GPHY_MID = GPFK_ID and k.GPHY_WLID = WLXX_ID");
sqlMap.append(" left join (select sum(GPHY_ZPSL) as ZPSL,GPHY_MID,GPHY_WLID,GPHY_FKGX from GPHY group by GPHY_MID,GPHY_WLID) k on k.GPHY_FKGX=WOBOM_FFGX and k.GPHY_MID = GPFK_ID and k.GPHY_WLID = WLXX_ID");
sqlMap.append("where 1=1");
if (StringUtils.isNotEmpty(woid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("WO_ID", woid));
......@@ -1203,17 +1203,18 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
@Override
public double queryWobomZpslByDjidAndWlid(String djid,String wlid) {
public double queryWobomZpslByDjidAndWlid(String fkid,String wlid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(WOBOM_XQSL) ");
sqlMap.append("select WOBOM_DWYL ");
sqlMap.append("from WOBOM");
sqlMap.append(" left join WLXX on WLXX_ID = WOBOM_WLID");
sqlMap.append(" left join WO on WO_ID = WOBOM_WOID");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = WOBOM_FFGX ");
sqlMap.append(" left join WOSN on WOSN_WOID = WO_ID");
sqlMap.append(" left join GPFK on GPFK_WOSNID = WOSN_CODE and WOBOM_FFGX = GPFK_FKGX ");
sqlMap.append("where 1=1");
if (StringUtils.isNotEmpty(djid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("WO_DJID", djid));
sqlMap.setParamValue("WO_DJID", djid);
if (StringUtils.isNotEmpty(fkid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("GPFK_ID", fkid));
sqlMap.setParamValue("GPFK_ID", fkid);
}
if (StringUtils.isNotEmpty(wlid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("WOBOM_WLID", wlid));
......
package com.gavel.kwell.dao.impl;
import org.springframework.stereotype.Repository;
import com.gavel.common.base.dao.impl.BaseDaoImpl;
import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.dao.GphyDao;
......@@ -11,10 +13,6 @@ import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
import com.gavel.persistence.sql.SqlUtil;
import java.util.List;
import org.springframework.stereotype.Repository;
@Repository("gphyDao")
public class GphyDaoImpl extends BaseDaoImpl implements GphyDao {
......@@ -135,7 +133,7 @@ public class GphyDaoImpl extends BaseDaoImpl implements GphyDao {
}
@Override
public List<WlslItem> queryKwellZpslGphy(GphyCondition condition) {
public WlslItem queryKwellZpslGphy(GphyCondition condition) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(GPHY_ZPSL) as zpsl, GPHY_WLID as wlid ");
sqlMap.append("from GPHY ");
......@@ -149,7 +147,28 @@ public class GphyDaoImpl extends BaseDaoImpl implements GphyDao {
sqlMap.append(" and " + SqlUtil.getWhereSql("GPHY_WLID", condition.getWlid()));
sqlMap.setParamValue("GPHY_WLID", condition.getWlid());
}
return sqlMap.query(WlslItem.class);
return sqlMap.queryEntity(WlslItem.class);
}
@Override
public int queryIfZpwc(GphyCondition condition) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select isnull(a.sl,0)-b.sl FROM( select sum(wobom_dwyl) as sl ,GPFK_ID as fkid ");
sqlMap.append(" from GPFK ");
sqlMap.append(" left join WOBOM on WOBOM_FFGX =GPFK_fkgx ");
sqlMap.append(" left join WLXX on WLXX_ID = WOBOM_WLID ");
sqlMap.append(" left join WO on WO_ID = WOBOM_WOID ");
sqlMap.append(" left join WOSN on WOSN_WOID = WO_ID and WOSN_CODE =GPFK_WOSNID ");
sqlMap.append(" GROUP BY GPFK_ID ) a ");
sqlMap.append(" left join (select count(1) as sl,GPHY_MID as fkid ");
sqlMap.append(" from GPHY ");
sqlMap.append(" group by GPHY_MID) b on b.fkid =a.fkid ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getMid())){
sqlMap.append(" and " + SqlUtil.getWhereSql("b.fkid", condition.getMid()));
sqlMap.setParamValue("b.fkid", condition.getMid());
}
return sqlMap.queryInt();
}
......
......@@ -3,6 +3,7 @@ package com.gavel.kwell.service;
import java.util.List;
import com.gavel.common.base.service.BaseEditService;
import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.vo.GphyCondition;
import com.gavel.kwell.vo.GphyVO;
import com.gavel.kwell.vo.GphycxVO;
......@@ -23,10 +24,10 @@ public interface GphyService extends BaseEditService {
public void queryGphyWithOrGphy(GphyCondition condition);
public Integer zpwl(GphyCondition condition);
public Gpfk zpwl(GphyCondition condition);
public Integer compareIsZpComplete(String djid);
public boolean compareIsZpComplete(String fkid,String wlid);
public List<WlslItem> querywlzpsl(GphyCondition condition);
public WlslItem querywlzpsl(GphyCondition condition);
}
......@@ -76,6 +76,7 @@ import com.gavel.wo.vo.PcjhCondition;
import com.gavel.wo.vo.PcjhmxCondition;
import com.gavel.wo.vo.PcjhmxVO;
import com.gavel.wo.vo.WobomVO;
import com.gavel.wo.vo.WogylxVO;
@Service("gpfkService")
......@@ -161,7 +162,15 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
gphydao.batchDelete(gphymxList);
}
/** 排产计划删除 末道工序 、单道工序**/
// Wogylx bzgx = (Bzgx) GavelSql.selectEntityByKey(Bzgx.class, gpfk.getFkgx());
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfk.getWogylx());
if(StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfk.getHgbz())&&gpfk.getHgbz().equals("N")) {
cancelPcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
cancelPcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
}
}
......@@ -800,10 +809,12 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
if(SmCodeEnum.OKBZ.getId().equals(hgsn)) {
gpfk.setHgbz("Y");
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
}
else if(SmCodeEnum.NGBZ.getId().equals(hgsn)) {
gpfk.setHgbz("N");
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
}
......@@ -811,6 +822,15 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
throwReturnMessage(SmCodeEnum.ERROR_CODE);
}
Gpfk gpfkR = (Gpfk) update(gpfk);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfk.getWogylx());
if(StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfk.getHgbz())&&gpfk.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
return gpfkR;
}
......@@ -822,10 +842,12 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
if(SmCodeEnum.OKBZ.getId().equals(hgsn)) {
gpfk.setHgbz("Y");
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
}
else if(SmCodeEnum.NGBZ.getId().equals(hgsn)) {
gpfk.setHgbz("N");
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
}
......@@ -833,6 +855,15 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
throwReturnMessage(SmCodeEnum.ERROR_CODE);
}
Gpfk gpfkR = (Gpfk) update(gpfk);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfk.getWogylx());
if(StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfk.getHgbz())&&gpfk.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
return gpfkR;
}
......
......@@ -7,11 +7,15 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.sql.GavelSql;
import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.StringUtils;
import com.gavel.jcsj.service.CoderuleService;
import com.gavel.kwell.dao.GpfkDao;
import com.gavel.kwell.dao.GphyDao;
import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.persistent.Gphy;
import com.gavel.kwell.service.GpfkService;
import com.gavel.kwell.service.GphyService;
import com.gavel.kwell.utils.HzGylxEnum;
import com.gavel.kwell.vo.GphyCondition;
......@@ -19,25 +23,22 @@ import com.gavel.kwell.vo.GphyVO;
import com.gavel.kwell.vo.GphycxVO;
import com.gavel.kwell.vo.WlslItem;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.wo.persistent.Wogylx;
@Service("gphyService")
@Transactional
public class GphyServiceImpl extends BaseEditServiceImpl implements GphyService {
/**装配完成**/
private static final Integer COMPLETE_CODE =230;
/**装配成功**/
private static final Integer ZP_CODE =200;
/**相同序列号**/
private static final Integer SAME_CODE =100;
@Autowired
private GphyDao gphyDao;
@Autowired
private GpfkDao gpfkDao;
@Autowired
private GpfkService gpfkService;
@Autowired
private CoderuleService coderuleService;
......@@ -72,12 +73,9 @@ public class GphyServiceImpl extends BaseEditServiceImpl implements GphyService
}
@Override
public Integer zpwl(GphyCondition condition) {
List<GphyVO> gphyVO =gphyDao.queryKwellZpGphy(condition).getRecords();
if(gphyVO!=null&&gphyVO.size()>0) {
return SAME_CODE;
}
public Gpfk zpwl(GphyCondition condition) {
String wlid = coderuleService.matchCodeByRule(condition.getSnid());
if(compareIsZpComplete(condition.getFkid(),wlid)) {
Gphy gphy = new Gphy();
gphy.setFkgx(condition.getGxid());
gphy.setWlid(wlid);
......@@ -87,28 +85,39 @@ public class GphyServiceImpl extends BaseEditServiceImpl implements GphyService
gphy.setZpsl(1.0);
gphy.setHylx(HzGylxEnum.ZP.getId());
insert(gphy);
return compareIsZpComplete(condition.getMid());
}
Gpfk gpfk = gpfkDao.queryById(Gpfk.class, condition.getFkid());
if(gphyDao.queryIfZpwc(condition)!=0) {
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfk.getWogylx());
if(StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfk.getHgbz())&&gpfk.getHgbz().equals("N")) {
gpfkService.updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
gpfkService.updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
}
return gpfk;
}
@Override
public Integer compareIsZpComplete(String woid) {
public boolean compareIsZpComplete(String fkid,String wlid) {
GphyCondition condition =new GphyCondition();
condition.setMid(woid);
List<WlslItem> wlslItem =querywlzpsl(condition);
if(wlslItem!=null&&wlslItem.size()>0) {
for(int i=0;i<wlslItem.size();i++) {
double xqsl =gpfkDao.queryWobomZpslByDjidAndWlid(woid, wlslItem.get(i).getWlid());
if(xqsl!=wlslItem.get(i).getZpsl()) {
return ZP_CODE;
}
condition.setMid(fkid);
condition.setWlid(wlid);
WlslItem wlslItem =querywlzpsl(condition);
if(wlslItem!=null) {
double dwyl =gpfkDao.queryWobomZpslByDjidAndWlid(fkid, wlid);
if(dwyl<=wlslItem.getZpsl()) {
throwReturnMessage("该物料装配完成");
}
return COMPLETE_CODE;
}
return ZP_CODE;
return true;
}
@Override
public List<WlslItem> querywlzpsl(GphyCondition condition) {
public WlslItem querywlzpsl(GphyCondition condition) {
return gphyDao.queryKwellZpslGphy(condition);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment