Commit 627a6294 authored by yff's avatar yff

反馈升级

parent a6da8cca
......@@ -254,14 +254,15 @@ public class GpfkController extends BaseController {
@RequestMapping(value = "/queryWoBomByWoid", method = RequestMethod.POST)
@ResponseBody
public Object getWoBomByWoid(@RequestBody JSONObject param) {
String woid = param.getString("woid");
// String woid = param.getString("woid");
String bzlx = param.getString("bzlx");
String wosn = param.getString("wosn");
if(StringUtils.isEmpty(woid)||StringUtils.isEmpty(wosn)){
if(StringUtils.isEmpty(bzlx)||StringUtils.isEmpty(wosn)){
setReturnMessage("条码不允许为空!");
return returnData();
}
List<WobomVO> wobomVOs= gpfkService.queryWobomByWo(woid,bzlx,wosn);
// List<WobomVO> wobomVOs= gpfkService.queryWobomByWo(woid,bzlx,wosn);
List<WobomVO> wobomVOs= gpfkService.queryWobomByWoUpgrade(wosn, bzlx);
if(wobomVOs != null){
return buildReturnData(wobomVOs);
}else{
......@@ -283,7 +284,7 @@ public class GpfkController extends BaseController {
@ResponseBody
public Object query(@RequestBody JSONObject param) {
FkCondition condition = JSONObject.toJavaObject(param, FkCondition.class);
FkVO gpfk = gpfkService.zpfk(condition);
FkVO gpfk = gpfkService.zpfkUpgrade(condition);
if(gpfk!=null) {
return buildReturnData(gpfk);
}
......@@ -294,7 +295,7 @@ public class GpfkController extends BaseController {
@ResponseBody
public Object jyfk(@RequestBody JSONObject param) {
FkCondition condition = JSONObject.toJavaObject(param, FkCondition.class);
FkVO gpfk =gpfkService.jyfk(condition);
FkVO gpfk =gpfkService.jyfkUpgrade(condition);
if(gpfk != null){
return buildReturnData(gpfk);
}else{
......@@ -306,7 +307,7 @@ public class GpfkController extends BaseController {
@ResponseBody
public Object wxfk(@RequestBody JSONObject param) {
FkCondition condition = JSONObject.toJavaObject(param, FkCondition.class);
FkVO gpfk =gpfkService.wxfk(condition);
FkVO gpfk =gpfkService.wxfkUpgrade(condition);
if(gpfk != null){
return buildReturnData(gpfk);
}else{
......
......@@ -20,6 +20,7 @@ import com.gavel.kwell.vo.GpfkCondition;
import com.gavel.kwell.vo.GpfkVO;
import com.gavel.kwell.vo.GphyCondition;
import com.gavel.kwell.vo.GpwxmxVO;
import com.gavel.kwell.vo.WlslItem;
import com.gavel.kwell.vo.WolinkInfoVO;
import com.gavel.kwell.vo.WosngzVO;
import com.gavel.persistence.sql.RecordSet;
......@@ -129,7 +130,6 @@ public interface GpfkDao extends BaseDao {
public List<Gphy> queryGphyByGpfkid(String mid);
public Wogylx getLastGx(Wogylx wogylx);
public double getNowGyFksl(Wogylx wogylx);
......@@ -140,4 +140,37 @@ public interface GpfkDao extends BaseDao {
public double checkIfContainsWobomWl(FkCondition fkCondition);
public double checkIfContainsGphywl(GphyCondition condition);
/**科威尔工票反馈sql */
/** ------------BEGIN工票反馈升级-----------------***/
/**获取该序列号标准工序最新的反馈相关信息 */
public FkVO queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(String wosnid,String bzgxid);
/**获取该序列号标准工序所有的反馈相关信息 */
public List<FkVO> queryWowithIfExistGpfkByWosnAndBzgxid(String wosnid,String bzgxid);
/**获取该序列号标准工序的订单相关信息包含最新反馈记录 */
public FkVO queryKwellWoBySnidUptoDate(String wosnid, String bzgx);
/**获取该序列号标准工序的订单相关信息包含最新反馈记录 */
public List<FkVO> queryKwellAllGpfkByWosnAndGxid(FkCondition condition);
/**查询当前订单序列号最新反馈记录 */
public GpfkVO queryGpfkByWosnUptoDate(String wosnid);
/**查询当前工序下一道工序*/
public Wogylx getNextGxUpdate(Wogylx wogylx);
/**查询当前工序上一道工序 */
public Wogylx getLastGx(Wogylx wogylx);
/**查询当前工序上一道工序 */
public double queryIfZpwc(String wosnid,String bzgx);
/**查询当前工序上一道工序 */
public List<WobomVO> queryWobomByWosnAndBzgx(String wosnid,String bzgx);
/**查询是否耗用了该物料编码 */
public double checkIfContainsGphywlUpgrade(GphyCondition condition);
/**查询是物料编码装配数量 */
public WlslItem queryKwellZpslGphy(GphyCondition condition);
/**查询是物料编码装配单位数量 */
public double queryWobomZpslByDjidAndWlidUpgrade(String wosncode,String bzgxid,String wlid);
/**查询当前订单序列号最新检验反馈记录 */
public GpfkVO queryJyGpfkByWosnUptoDate(String wosnid);
/** ------------END工票反馈升级-----------------***/
}
......@@ -28,6 +28,7 @@ import com.gavel.kwell.vo.GpfkCondition;
import com.gavel.kwell.vo.GpfkVO;
import com.gavel.kwell.vo.GphyCondition;
import com.gavel.kwell.vo.GpwxmxVO;
import com.gavel.kwell.vo.WlslItem;
import com.gavel.kwell.vo.WosngzVO;
import com.gavel.persistence.sql.RecordSet;
import com.gavel.persistence.sql.SqlMap;
......@@ -899,24 +900,38 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
return sqlMap.getRecordSet();
}
@Override
public GpfkVO queryDailyFkInfo(GpfkCondition condition){
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(c.GPFK_FKSL) as GPFK_FKSL, sum(c.GPFK_BHGSL) as GPFK_BHGSL ");
sqlMap.append("from GPFK c ");
sqlMap.append("left join WOGYLX ON WOGYLX_ID = GPFK_FKGX ");
sqlMap.append("left join BZGX ON BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 ");
sqlMap.append(" and EXISTS (select a.fkid FROM (select ISNULL(count(1),0) as sl,GPHY_MID as fkid ");
sqlMap.append(" from GPHY group by GPHY_MID) b left join ( select ISNULL(sum(wobom_dwyl),0) as sl ,GPFK_ID as fkid ");
sqlMap.append(" from GPFK 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 on a.fkid =b.fkid ");
sqlMap.append(" where 1 = 1 and a.sl<b.sl and c.GPFK_ID = a.fkid ) ");
sqlMap.append(" select sum(c.GPFK_FKSL) as GPFK_FKSL, sum(c.GPFK_BHGSL) as GPFK_BHGSL ");
sqlMap.append(" from GPFK c ");
sqlMap.append(" left join WOGYLX w ON w.WOGYLX_ID = c.GPFK_FKGX ");
sqlMap.append(" left join BZGX bb ON bb.BZGX_ID = w.WOGYLX_BZGXID ");
sqlMap.append(" where 1 = 1");
sqlMap.append(" and exists(");
sqlMap.append(" select a.sncode,a.bzgxid from ( ");
sqlMap.append(" select sum(IFNULL(wobom_dwyl,0)) as dwsl,wosn_code as sncode,bzgx_id as bzgxid ");
sqlMap.append(" from wosn ");
sqlMap.append(" left join wo on wo_id =wosn_woid ");
sqlMap.append(" left join wobom on wobom_woid = wo_id ");
sqlMap.append(" left join wogylx on wogylx_id = wobom_ffgx ");
sqlMap.append(" left join bzgx on bzgx_id = wogylx_bzgxid ");
sqlMap.append(" group by wosn_code,bzgx_id) a ");
sqlMap.append(" left join (");
sqlMap.append(" select IFNULL(count(1),0) as sl,GPFK_WOSNID as gwosn,bzgx_id as gbzgxid ");
sqlMap.append(" from GPHY ");
sqlMap.append(" left join GPFK on GPFK_ID = GPHY_MID ");
sqlMap.append(" left join wogylx on wogylx_id = GPFK_fkgx ");
sqlMap.append(" left join bzgx on bzgx_id = wogylx_bzgxid ");
sqlMap.append(" GROUP BY GPFK_WOSNID,bzgx_id) b ");
sqlMap.append(" on a.sncode = b.gwosn and a.bzgxid = b.gbzgxid ");
sqlMap.append(" where 1 = 1");
sqlMap.append(" and a.dwsl<= b.sl and c.GPFK_WOSNID =a.sncode and bb.BZGX_ID = a.bzgxid ) ");
if (StringUtils.isNotEmpty(condition.getGxid())){
sqlMap.append(" and BZGX_ID = :pFKGX ");
sqlMap.append(" and bb.BZGX_ID = :pFKGX ");
sqlMap.setParamValue("pFKGX",condition.getGxid());
}
if (StringUtils.isNotEmpty(condition.getBxid())){
......@@ -928,17 +943,9 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.setParamValue("pFKRID",condition.getFkrid());
}
if (condition.getYwrq() != null) {
sqlMap.append(" and c.GPFK_YWRQ = :pYWRQ ");
sqlMap.append(" and c.GPFK_YWRQ >= :pYWRQ ");
sqlMap.setParamValue("pYWRQ", condition.getYwrq());
}
// if (condition.getStart() != null) {
// sqlMap.append(" and GPFK_FKSJ >= :pFKSJS ");
// sqlMap.setParamValue("pFKSJS", DateUtils.beginOfDay(condition.getStart()));
// }
// if (condition.getEnd() != null) {
// sqlMap.append(" and GPFK_FKSJ <= :pFKSJE ");
// sqlMap.setParamValue("pFKSJE", DateUtils.endOfDay(condition.getEnd()));
// }
return sqlMap.queryEntity(GpfkVO.class);
}
......@@ -1241,9 +1248,11 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
sqlMap.append(" and WOSN_CODE = :pSNID ");
sqlMap.setParamValue("pSNID",snid);
sqlMap.append(" and BZGX_ID = :pBZGXID ");
sqlMap.setParamValue("pBZGXID",bzgx);
sqlMap.setParamValue(" pBZGXID ",bzgx);
return sqlMap.queryEntity(FkVO.class);
}
@Override
......@@ -1263,33 +1272,6 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
}
@Override
public Wogylx getLastGx(Wogylx wogylx) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 WOGYLX_ID, WOGYLX_WOID, WOGYLX_XH, WOGYLX_BZGXID, WOGYLX_GYLXID, ");
sqlMap.append(" WOGYLX_NAME, WOGYLX_GXLX, WOGYLX_GZZXID, WOGYLX_SBSL, WOGYLX_ZYRSL, ");
sqlMap.append(" WOGYLX_PDHS, WOGYLX_ZBHS, WOGYLX_JGHS, WOGYLX_ZYHS, WOGYLX_GJGX, ");
sqlMap.append(" WOGYLX_DWSJCL, WOGYLX_PCBS, WOGYLX_XQSL, WOGYLX_BZ, WOGYLX_CJRID, ");
sqlMap.append(" WOGYLX_CJR, WOGYLX_CJSJ, WOGYLX_WHRID, WOGYLX_WHR, WOGYLX_WHSJ, ");
sqlMap.append(" WOGYLX_SYSVERSION, GZZX_NAME, WOGYLX_GXBZ ");
sqlMap.append("from WOGYLX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" left join GZZX on GZZX_ID = BZGX_GZZXID ");
sqlMap.append("where 1 = 1 ");
sqlMap.append(" and isnull(WOGYLX_XH,0) <> 0 ");
if(StringUtils.isNotEmpty(wogylx.getGzzxid())){
sqlMap.append(" and BZGX_GZZXID = :pGZZXID ");
sqlMap.setParamValue("pGZZXID",wogylx.getGzzxid());
}
if(StringUtils.isNotEmpty(wogylx.getWoid())){
sqlMap.append(" and WOGYLX_WOID = :pWOID ");
sqlMap.setParamValue("pWOID",wogylx.getWoid());
}
sqlMap.append(" and WOGYLX_XH < :pXH ");
sqlMap.append("order by WOGYLX_XH desc");
sqlMap.setParamValue("pXH",wogylx.getXh());
return sqlMap.queryEntity(Wogylx.class);
}
@Override
......@@ -1404,5 +1386,382 @@ public class GpfkDaoImpl extends BaseDaoImpl implements GpfkDao {
return sqlMap.queryDouble();
}
@Override
public FkVO queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(String wosnid, String bzgxid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKSJ, GPFK_HGBZ, GPFK_FKSL, ");
sqlMap.append(" GPFK_HGSL, GPFK_BHGSL, GPFK_FKR, GPFK_FKGX, GPFK_BZ, ");
sqlMap.append(" GPFK_WHRID, GPFK_WHR, GPFK_WHSJ, GPFK_CJRID, GPFK_CJR, ");
sqlMap.append(" GPFK_CJSJ, GPFK_SYSVERSION, GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,WOGYLX_ID, ");
sqlMap.append(" BX_CODE, BX_NAME, BZGX_CODE, BZGX_NAME,WLXX_ID, ");
sqlMap.append(" WLXX_CODE, WLXX_NAME, WLXX_GG,WOSN_CODE,WO_DJID,WO_ID, ");
sqlMap.append(" GPFK_GFSL, GPFK_LFSL, GPFK_FXSL, GPFK_FGSL, GPFK_YWRQ, GPFK_HGDJ, WOSN_KHCODE");
sqlMap.append("from GPFK ");
sqlMap.append(" left join BX on BX_ID = GPFK_FKBX ");
sqlMap.append(" left join WOSN on WOSN_CODE = GPFK_WOSNID ");
sqlMap.append(" left join WO on WO_ID = WOSN_WOID ");
sqlMap.append(" left join WLXX on WLXX_ID = WO_WLID ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(bzgxid)){
sqlMap.append(" and BZGX_ID = :pBZGXID ");
sqlMap.setParamValue("pBZGXID",bzgxid);
}
if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid);
}
sqlMap.append("order by GPFK_FKSJ desc ");
return sqlMap.queryEntity(FkVO.class);
}
@Override
public List<FkVO> queryWowithIfExistGpfkByWosnAndBzgxid(String wosnid, String bzgxid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKSJ, GPFK_HGBZ, GPFK_FKSL, ");
sqlMap.append(" GPFK_HGSL, GPFK_BHGSL, GPFK_FKR, GPFK_FKGX, GPFK_BZ, ");
sqlMap.append(" GPFK_WHRID, GPFK_WHR, GPFK_WHSJ, GPFK_CJRID, GPFK_CJR, ");
sqlMap.append(" GPFK_CJSJ, GPFK_SYSVERSION, GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,WOGYLX_ID, ");
sqlMap.append(" BX_CODE, BX_NAME, BZGX_CODE, BZGX_NAME,WLXX_ID, ");
sqlMap.append(" WLXX_CODE, WLXX_NAME, WLXX_GG,WOSN_CODE,WO_DJID,WO_ID, ");
sqlMap.append(" GPFK_GFSL, GPFK_LFSL, GPFK_FXSL, GPFK_FGSL, GPFK_YWRQ, GPFK_HGDJ, WOSN_KHCODE ");
sqlMap.append(" from GPFK ");
sqlMap.append(" left join BX on BX_ID = GPFK_FKBX ");
sqlMap.append(" left join WOSN on WOSN_CODE = GPFK_WOSNID ");
sqlMap.append(" left join WO on WO_ID = WOSN_WOID ");
sqlMap.append(" left join WLXX on WLXX_ID = WO_WLID ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(bzgxid)){
sqlMap.append(" and BZGX_ID = :pBZGXID ");
sqlMap.setParamValue("pBZGXID",bzgxid);
}
if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid);
}
sqlMap.append("order by GPFK_FKSJ desc ");
return sqlMap.query(FkVO.class);
}
@Override
public FkVO queryKwellWoBySnidUptoDate(String wosnid, String bzgx) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 WO_ID,BZGX_CODE,WO_ZT,WLXX_CODE,WLXX_GG,WLXX_ID,WOSN_CODE,WOSN_ID,BZGX_ID,WOGYLX_ID,");
sqlMap.append(" BZGX_NAME,WLXX_GG,WO_DJID,BZGX_GXLX,WOSN_CODE,GPFK_ID ");
sqlMap.append("from WOSN ");
sqlMap.append(" left join WO on WO_ID=WOSN_WOID");
sqlMap.append(" left join WOGYLX on WOGYLX_WOID =WO_ID");
sqlMap.append(" left join GYLX on GYLX_ID = WOGYLX_GYLXID");
sqlMap.append(" left join BZGX on BZGX_ID =GYLX_BZGXID");
sqlMap.append(" left join WLXX on wlxx_id = wo_wlid");
sqlMap.append(" left join GPFK on GPFK_WOSNID = WOSN_CODE and GPFK_FKGX=WOGYLX_ID ");
sqlMap.append("where 1 = 1 ");
sqlMap.append(" and WOSN_CODE = :pSNID ");
sqlMap.setParamValue("pSNID",wosnid);
sqlMap.append(" and BZGX_ID = :pBZGXID ");
sqlMap.setParamValue("pBZGXID",bzgx);
sqlMap.append(" order by GPFK_FKSJ DESC ");
return sqlMap.queryEntity(FkVO.class);
}
@Override
public List<FkVO> queryKwellAllGpfkByWosnAndGxid(FkCondition condition){
SqlMap sqlMap = new SqlMap();
sqlMap.append("select GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKSJ, GPFK_HGBZ, GPFK_FKSL, ");
sqlMap.append(" GPFK_HGSL, GPFK_BHGSL, GPFK_FKR, GPFK_FKGX, GPFK_BZ, ");
sqlMap.append(" GPFK_WHRID, GPFK_WHR, GPFK_WHSJ, GPFK_CJRID, GPFK_CJR, ");
sqlMap.append(" GPFK_CJSJ, GPFK_SYSVERSION, GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,WOGYLX_ID, ");
sqlMap.append(" BX_CODE, BX_NAME, BZGX_CODE, BZGX_NAME,WLXX_ID, ");
sqlMap.append(" WLXX_CODE, WLXX_NAME, WLXX_GG,WOSN_CODE,WO_DJID,WO_ID, ");
sqlMap.append(" GPFK_GFSL, GPFK_LFSL, GPFK_FXSL, GPFK_FGSL, GPFK_YWRQ, GPFK_HGDJ, WOSN_KHCODE");
sqlMap.append("from GPFK ");
sqlMap.append(" left join BX on BX_ID = GPFK_FKBX ");
sqlMap.append(" left join WOSN on WOSN_CODE = GPFK_WOSNID ");
sqlMap.append(" left join WO on WO_ID = WOSN_WOID ");
sqlMap.append(" left join WLXX on WLXX_ID = WO_WLID ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getBzgxid())){
sqlMap.append(" and BZGX_ID = :pBZGXID ");
sqlMap.setParamValue("pBZGXID",condition.getBzgxid());
}
if (StringUtils.isNotEmpty(condition.getWogylx())){
sqlMap.append(" and WOGYLX_ID = :pWOGYLX ");
sqlMap.setParamValue("pWOGYLX",condition.getWogylx());
}
if (StringUtils.isNotEmpty(condition.getWosncode())){
sqlMap.append("and GPFK_WOSNID like :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", condition.getWosncode());
}
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.query(FkVO.class);
}
@Override
public GpfkVO queryGpfkByWosnUptoDate(String wosnid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKSJ, GPFK_HGBZ, GPFK_FKSL, ");
sqlMap.append(" GPFK_HGSL, GPFK_BHGSL, GPFK_FKR, GPFK_FKGX, GPFK_BZ, ");
sqlMap.append(" GPFK_WHRID, GPFK_WHR, GPFK_WHSJ, GPFK_CJRID, GPFK_CJR, ");
sqlMap.append(" GPFK_CJSJ, GPFK_SYSVERSION, GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,WOGYLX_ID, ");
sqlMap.append(" BX_CODE, BX_NAME, BZGX_CODE, BZGX_NAME,WLXX_ID, ");
sqlMap.append(" WLXX_CODE, WLXX_NAME, WLXX_GG,WOSN_CODE,WO_DJID,WO_ID, ");
sqlMap.append(" GPFK_GFSL, GPFK_LFSL, GPFK_FXSL, GPFK_FGSL, GPFK_YWRQ, GPFK_HGDJ, WOSN_KHCODE");
sqlMap.append("from GPFK ");
sqlMap.append(" left join BX on BX_ID = GPFK_FKBX ");
sqlMap.append(" left join WOSN on WOSN_CODE = GPFK_WOSNID ");
sqlMap.append(" left join WO on WO_ID = WOSN_WOID ");
sqlMap.append(" left join WLXX on WLXX_ID = WO_WLID ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid);
}
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.queryEntity(GpfkVO.class);
}
@Override
public Wogylx getLastGx(Wogylx wogylx) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 WOGYLX_ID, WOGYLX_WOID, WOGYLX_XH, WOGYLX_BZGXID, WOGYLX_GYLXID, ");
sqlMap.append(" WOGYLX_NAME, WOGYLX_GXLX, WOGYLX_GZZXID, WOGYLX_SBSL, WOGYLX_ZYRSL, ");
sqlMap.append(" WOGYLX_PDHS, WOGYLX_ZBHS, WOGYLX_JGHS, WOGYLX_ZYHS, WOGYLX_GJGX, ");
sqlMap.append(" WOGYLX_DWSJCL, WOGYLX_PCBS, WOGYLX_XQSL, WOGYLX_BZ, WOGYLX_CJRID, ");
sqlMap.append(" WOGYLX_CJR, WOGYLX_CJSJ, WOGYLX_WHRID, WOGYLX_WHR, WOGYLX_WHSJ, ");
sqlMap.append(" WOGYLX_SYSVERSION, GZZX_NAME, WOGYLX_GXBZ ");
sqlMap.append("from WOGYLX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" left join GZZX on GZZX_ID = BZGX_GZZXID ");
sqlMap.append("where 1 = 1 ");
sqlMap.append(" and isnull(WOGYLX_XH,0) <> 0 ");
if(StringUtils.isNotEmpty(wogylx.getGzzxid())){
sqlMap.append(" and BZGX_GZZXID = :pGZZXID ");
sqlMap.setParamValue("pGZZXID",wogylx.getGzzxid());
}
if(StringUtils.isNotEmpty(wogylx.getWoid())){
sqlMap.append(" and WOGYLX_WOID = :pWOID ");
sqlMap.setParamValue("pWOID",wogylx.getWoid());
}
sqlMap.append(" and WOGYLX_XH < :pXH ");
sqlMap.append("order by WOGYLX_XH desc");
sqlMap.setParamValue("pXH",wogylx.getXh());
return sqlMap.queryEntity(Wogylx.class);
}
@Override
public Wogylx getNextGxUpdate(Wogylx wogylx) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 WOGYLX_ID, WOGYLX_WOID, WOGYLX_XH, WOGYLX_BZGXID, WOGYLX_GYLXID, ");
sqlMap.append(" WOGYLX_NAME, WOGYLX_GXLX, WOGYLX_GZZXID, WOGYLX_SBSL, WOGYLX_ZYRSL, ");
sqlMap.append(" WOGYLX_PDHS, WOGYLX_ZBHS, WOGYLX_JGHS, WOGYLX_ZYHS, WOGYLX_GJGX, ");
sqlMap.append(" WOGYLX_DWSJCL, WOGYLX_PCBS, WOGYLX_XQSL, WOGYLX_BZ, WOGYLX_CJRID, ");
sqlMap.append(" WOGYLX_CJR, WOGYLX_CJSJ, WOGYLX_WHRID, WOGYLX_WHR, WOGYLX_WHSJ, ");
sqlMap.append(" WOGYLX_SYSVERSION, GZZX_NAME, WOGYLX_GXBZ ");
sqlMap.append("from WOGYLX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" left join GZZX on GZZX_ID = BZGX_GZZXID ");
sqlMap.append("where 1 = 1 ");
sqlMap.append(" and isnull(WOGYLX_XH,0) <> 0 ");
if(StringUtils.isNotEmpty(wogylx.getGzzxid())){
sqlMap.append(" and BZGX_GZZXID = :pGZZXID ");
sqlMap.setParamValue("pGZZXID",wogylx.getGzzxid());
}
if(StringUtils.isNotEmpty(wogylx.getWoid())){
sqlMap.append(" and WOGYLX_WOID = :pWOID ");
sqlMap.setParamValue("pWOID",wogylx.getWoid());
}
sqlMap.append(" and WOGYLX_XH > :pXH ");
sqlMap.append("order by WOGYLX_XH desc");
sqlMap.setParamValue("pXH",wogylx.getXh());
return sqlMap.queryEntity(Wogylx.class);
}
@Override
public double queryIfZpwc(String wosnid, String bzgx) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select e.sl-a.hysl from ( ");
sqlMap.append(" select sum(ISNULL(dwb.WOBOM_dwyl,0)) as sl,d.GPFK_WOSNID as dwosn,db.BZGX_ID AS dbzgx ");
sqlMap.append(" from GPFK d ");
sqlMap.append(" left join WOSN dwo on dwo.WOSN_CODE =GPFK_WOSNID ");
sqlMap.append(" LEFT JOIN WO dw ON dw.WO_ID = dwo.WOSN_WOID ");
sqlMap.append(" LEFT JOIN WOBOM dwb ON dwb.WOBOM_woid = dw.WO_ID and dwb.WOBOM_FFGX = d.gpfk_fkgx ");
sqlMap.append(" LEFT JOIN WOGYLX dwg ON dwg.WOGYLX_ID = d.GPFK_FKGX ");
sqlMap.append(" LEFT JOIN BZGX db ON db.BZGX_ID = dwg.WOGYLX_BZGXID ");
sqlMap.append(" GROUP BY d.GPFK_WOSNID,db.BZGX_ID ");
sqlMap.append(" ) e ");
sqlMap.append(" LEFT JOIN ( ");
sqlMap.append(" SELECT c.GPFK_WOSNID as cwosn,cb.BZGX_ID as cbzgx,COUNT(1) as hysl FROM GPHY ");
sqlMap.append(" LEFT JOIN GPFK c on c.GPFK_ID = GPHY_MID ");
sqlMap.append(" Left JOIN WOGYLX cw ON cw.WOGYLX_ID = c.GPFK_FKGX ");
sqlMap.append(" LEFT JOIN BZGX cb ON cb.BZGX_ID = cw.WOGYLX_BZGXID ");
sqlMap.append(" GROUP BY c.GPFK_WOSNID,cb.BZGX_ID ");
sqlMap.append(" ) a ON a.cwosn = e.dwosn and a.cbzgx = e.dbzgx ");
sqlMap.append(" where 1=1 ");
if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and a.cwosn = '" + wosnid+"'");
}
if (StringUtils.isNotEmpty(bzgx)){
sqlMap.append("and a.cbzgx = '" + bzgx+"'");
}
return sqlMap.queryInt();
}
@Override
public List<WobomVO> queryWobomByWosnAndBzgx(String wosnid, String bzgx) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select WOBOM_ID, WOBOM_XH, WOBOM_WOID, WOBOM_WLID, WOBOM_FFGX,");
sqlMap.append(" WOBOM_DWYL, WOBOM_XQSL, WOBOM_XQRQ, WOBOM_SHL, WOBOM_SHZ, WOBOM_FFYZ,");
sqlMap.append(" WOBOM_LLSL, WOBOM_CKSL, WOBOM_BZ, WOBOM_WHRID, WOBOM_WHR,");
sqlMap.append(" WOBOM_WHSJ, WOBOM_CJRID, WOBOM_CJR, WOBOM_CJSJ, WOBOM_SYSVERSION,");
sqlMap.append(" WLXX_CODE, WLXX_NAME, WLXX_GG, WOBOM_GJWL, WOBOM_ZT, WOBOM_DJLY,k.ZPSL as ZPSL,");
sqlMap.append(" WOGYLX_XH, WOGYLX_NAME, WOBOM_WLPH ");
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 WOSN on WOSN_WOID = WO_ID");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = WOBOM_FFGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" left join GPFK on GPFK_WOSNID = WOSN_CODE and GPFK_FKGX= WOGYLX_ID and GPFK_WOGYLX =WOGYLX_ID ");
sqlMap.append(" left join (select sum(GPHY_ZPSL) as ZPSL,GPFK_WOSNID,GPHY_WLID,GPHY_FKGX ");
sqlMap.append(" from GPHY ");
sqlMap.append(" left join GPFK ON GPFK_ID =GPHY_MID ");
sqlMap.append(" group by GPFK_WOSNID,GPHY_WLID ");
sqlMap.append(" ) k on k.GPHY_FKGX=WOBOM_FFGX and k.GPFK_WOSNID = WOSN_CODE and k.GPHY_WLID = WLXX_ID");
sqlMap.append("where 1=1");
if (StringUtils.isNotEmpty(bzgx)){
sqlMap.append(" and " + SqlUtil.getWhereSql("BZGX_ID", bzgx));
sqlMap.setParamValue("BZGX_ID", bzgx);
}
if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("WOSN_CODE", wosnid));
sqlMap.setParamValue("WOSN_CODE", wosnid);
}
sqlMap.append("order by WOBOM_XH, WLXX_CODE");
System.out.println(sqlMap.getSqlText());
return sqlMap.query(WobomVO.class);
}
public double checkIfContainsGphywlUpgrade(GphyCondition condition) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select count(1),GPFK_WOSNID,BZGX_ID ");
sqlMap.append(" from GPHY ");
sqlMap.append(" LEFT JOIN GPFK ON GPFK_ID = GPHY_MID ");
sqlMap.append(" LEFT JOIN WOGYLX ON WOGYLX_ID =GPFK_FKGX ");
sqlMap.append(" LEFT JOIN BZGX ON BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" LEFT JOIN WLXX ON WLXX_ID = GPHY_WLID ");
sqlMap.append(" where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getSnid())){
sqlMap.append(" and (GPHY_WLSNID like :pSnid or WLXX_CODE like :pSnid or WLXX_NAME like :pSnid) ");
sqlMap.setParamValueLike("pSnid", condition.getSnid());
}
if (StringUtils.isNotEmpty(condition.getWosncode())){
sqlMap.append(" and " + SqlUtil.getWhereSql("GPFK_WOSNID", condition.getWosncode()));
sqlMap.setParamValue("GPFK_WOSNID", condition.getMid());
}
if (StringUtils.isNotEmpty(condition.getBzgxid())){
sqlMap.append(" and " + SqlUtil.getWhereSql("BZGX_ID", condition.getWosncode()));
sqlMap.setParamValue("BZGX_ID", condition.getMid());
}
sqlMap.append(" GROUP BY GPFK_WOSNID,BZGX_ID ");
return sqlMap.queryDouble();
}
@Override
public WlslItem queryKwellZpslGphy(GphyCondition condition) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(GPHY_ZPSL) as zpsl, GPHY_WLID as wlid,GPFK_WOSNID as wosncode,BZGX_ID as bzgxid ");
sqlMap.append("from GPHY ");
sqlMap.append(" LEFT JOIN GPFK ON GPFK_ID = GPHY_MID ");
sqlMap.append(" LEFT JOIN WOGYLX ON WOGYLX_ID =GPFK_FKGX ");
sqlMap.append(" LEFT JOIN BZGX ON BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append(" LEFT JOIN WLXX ON WLXX_ID = GPHY_WLID ");
sqlMap.append("where 1 = 1 ");
if (StringUtils.isNotEmpty(condition.getWosncode())){
sqlMap.append(" and " + SqlUtil.getWhereSql("GPFK_WOSNID", condition.getWosncode()));
sqlMap.setParamValue("GPFK_WOSNID", condition.getMid());
}
if (StringUtils.isNotEmpty(condition.getBzgxid())){
sqlMap.append(" and " + SqlUtil.getWhereSql("BZGX_ID", condition.getWosncode()));
sqlMap.setParamValue("BZGX_ID", condition.getMid());
}
if (StringUtils.isNotEmpty(condition.getWlid())){
sqlMap.append(" and " + SqlUtil.getWhereSql("GPHY_WLID", condition.getWlid()));
sqlMap.setParamValue("GPHY_WLID", condition.getWlid());
}
sqlMap.append("group by GPHY_WLID,GPFK_WOSNID,BZGX_ID ");
return sqlMap.queryEntity(WlslItem.class);
}
@Override
public double queryWobomZpslByDjidAndWlidUpgrade(String wosncode, String bzgxid, String wlid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select WOBOM_DWYL ");
sqlMap.append("from WOBOM");
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_id =wobom_ffgx and wogylx_woid = WO_ID ");
sqlMap.append(" left join bzgx on bzgx_id = wogylx_bzgxid ");
sqlMap.append("where 1=1");
if (StringUtils.isNotEmpty(wosncode)){
sqlMap.append(" and " + SqlUtil.getWhereSql("WOSN_CODE", wosncode));
sqlMap.setParamValue("WOSN_CODE",wosncode);
}
if (StringUtils.isNotEmpty(bzgxid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("BZGX_ID",bzgxid));
sqlMap.setParamValue("BZGX_ID", bzgxid);
}
if (StringUtils.isNotEmpty(wlid)){
sqlMap.append(" and " + SqlUtil.getWhereSql("WOBOM_WLID", wlid));
sqlMap.setParamValue("WOBOM_WLID", wlid);
}
sqlMap.append(" group by WOSN_CODE,bzgx_id,wobom_wlid ");
return sqlMap.queryDouble();
}
@Override
public GpfkVO queryJyGpfkByWosnUptoDate(String wosnid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select top 1 GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKSJ, GPFK_HGBZ, GPFK_FKSL, ");
sqlMap.append(" GPFK_HGSL, GPFK_BHGSL, GPFK_FKR, GPFK_FKGX, GPFK_BZ, ");
sqlMap.append(" GPFK_WHRID, GPFK_WHR, GPFK_WHSJ, GPFK_CJRID, GPFK_CJR, ");
sqlMap.append(" GPFK_CJSJ, GPFK_SYSVERSION, GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,WOGYLX_ID, ");
sqlMap.append(" BX_CODE, BX_NAME, BZGX_CODE, BZGX_NAME,WLXX_ID, ");
sqlMap.append(" WLXX_CODE, WLXX_NAME, WLXX_GG,WOSN_CODE,WO_DJID,WO_ID, ");
sqlMap.append(" GPFK_GFSL, GPFK_LFSL, GPFK_FXSL, GPFK_FGSL, GPFK_YWRQ, GPFK_HGDJ, WOSN_KHCODE");
sqlMap.append("from GPFK ");
sqlMap.append(" left join BX on BX_ID = GPFK_FKBX ");
sqlMap.append(" left join WOSN on WOSN_CODE = GPFK_WOSNID ");
sqlMap.append(" left join WO on WO_ID = WOSN_WOID ");
sqlMap.append(" left join WLXX on WLXX_ID = WO_WLID ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where 1 = 1 and BZGX_GXLX ='JY' ");
if (StringUtils.isNotEmpty(wosnid)){
sqlMap.append("and GPFK_WOSNID like :pWOSNID ");
sqlMap.setParamValueLike("pWOSNID", wosnid);
}
sqlMap.append("order by GPFK_FKSJ desc, GPFK_FKGX ");
return sqlMap.queryEntity(GpfkVO.class);
}
}
......@@ -93,10 +93,9 @@ public class Gpfk extends BaseEntity {
@FieldMeta(fieldName = "GPFK_HGDJ", caption = "合格等级")
private String hgdj;
@FieldMeta(fieldName = "GPFK_WLID", caption = "物料编码")
private String wlid;
public String getWogylx() {
return wogylx;
......
......@@ -111,6 +111,13 @@ public interface GpfkService extends BaseEditService {
public FkVO jyfk(FkCondition fkCondition);
public FkVO wxfk(FkCondition fkCondition);
public FkVO zpfkUpgrade(FkCondition fkCondition);
public FkVO jyfkUpgrade(FkCondition fkCondition);
public FkVO wxfkUpgrade(FkCondition fkCondition);
public List<WobomVO> queryWobomByWoUpgrade(String wosn,String bzgx);
/** 科威尔mes工票反馈重写--end */
......
......@@ -49,6 +49,7 @@ import com.gavel.kwell.persistent.Gpwxmx;
import com.gavel.kwell.service.GpfkService;
import com.gavel.kwell.service.GphyService;
import com.gavel.kwell.utils.GpfkFklxEnum;
import com.gavel.kwell.utils.GpfkHgEnum;
import com.gavel.kwell.utils.HzGylxEnum;
import com.gavel.kwell.utils.SmCodeEnum;
import com.gavel.kwell.utils.SmCodeModel;
......@@ -62,6 +63,7 @@ import com.gavel.kwell.vo.GpbhgmxVO;
import com.gavel.kwell.vo.GpfkCondition;
import com.gavel.kwell.vo.GpfkVO;
import com.gavel.kwell.vo.GphyCondition;
import com.gavel.kwell.vo.WlslItem;
import com.gavel.kwell.vo.WosngzVO;
import com.gavel.kzzx.dao.UserDao;
import com.gavel.kzzx.persistent.User;
......@@ -86,7 +88,6 @@ import com.gavel.wo.vo.WobomVO;
@Transactional
public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService {
@Autowired
private GpfkDao gpfkDao;
......@@ -123,8 +124,6 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
@Autowired
private UserDao userDao;
@Autowired
private WlxxService wlxxService;
@Override
public void initService() {
......@@ -902,9 +901,12 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
}
return null;
}
@Override
public FkVO zpfk(FkCondition fkCondition) {
public FkVO jyfk(FkCondition fkCondition) {
if(StringUtils.isEmpty(fkCondition.getSncode())) {
throwReturnMessage("未扫描到条码,请重新确认!");
}
......@@ -928,6 +930,7 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
curFkVo.setSntype(snType);
Wogylx wogylx = gpfkDao.queryById(Wogylx.class, curFkVo.getWogylxid());
if(!NumberUtils.equals(wogylx.getXh(),0)){
Wogylx existLastWogylx = gpfkDao.getLastGx(wogylx);
......@@ -954,102 +957,113 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
if(!curFkVo.getWozt().equals("R")) {
throwReturnMessage("该订单未下达无法进行反馈,请重新确认!");
}
if(StringUtils.isNotEmpty(curFkVo.getId())) {
GphyCondition hyCondition =new GphyCondition();
hyCondition.setMid(curFkVo.getId());
curFkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
if(gphyDao.queryIfZpwc(hyCondition)==0) {
curFkVo.setZpbz(SmCodeEnum.OKBZ.getPrefix());
}
}
curFkVo.setSntype(snType);
return curFkVo;
}
else if(snType.equals(SmCodeEnum.WLID.getId())) {
String wlid = coderuleService.matchCodeByRule(fkCondition.getSncode());
fkCondition.setWlid(wlid);
if(gpfkDao.checkIfContainsWobomWl(fkCondition)<=0) {
throwReturnMessage("该订单下不存在该发放工序物料,请重新确认!");
}
else if(snType.equals(SmCodeEnum.OKBZ.getId())) {
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
FkVO gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
System.out.println("");
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(wlid);
gpfk.setWlid(curFkVo.getWlid());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgbz("Y");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
insert(gpfk);
gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
}
else {
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setHgbz("Y");
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
update(gpfk);
gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
}
GphyCondition hyCondition =new GphyCondition();
hyCondition.setMid(gpfkVo.getId());
hyCondition.setSnid(fkCondition.getSncode());
if( gpfkDao.checkIfContainsGphywl(hyCondition)>0) {
throwReturnMessage("该序列号已经被扫描");
FkVO newFkVo =gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
newFkVo.setSntype(snType);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, newFkVo.getWogylxid());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(newFkVo.getHgbz())&&newFkVo.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
return newFkVo;
}
else if(snType.equals(SmCodeEnum.NGBZ.getId())) {
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
if(gphyService.compareIsZpComplete(gpfkVo.getId(),wlid)) {
Gphy gphy = new Gphy();
gphy.setFkgx(gpfkVo.getFkgx());
gphy.setWlid(wlid);
gphy.setMid(gpfkVo.getId());
gphy.setWlsnid(fkCondition.getSncode());
gphy.setFkrid(UserInfoUtil.getId());
gphy.setFkr(UserInfoUtil.getUserName());
gphy.setFksj(DateUtils.getDateTime());
gphy.setZpsl(1.0);
gphy.setHylx("BOM");
gphyService.insert(gphy);
FkVO gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setHgbz("N");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
insert(gpfk);
}
if(gphyDao.queryIfZpwc(hyCondition)==0) {
curFkVo.setZpbz(SmCodeEnum.OKBZ.getPrefix());
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfkVo.getWogylx());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfkVo.getHgbz())&&gpfkVo.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
else {
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
gpfk.setHgbz("N");
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
update(gpfk);
}
gpfkVo.setSntype(SmCodeEnum.WLID.getId());
Wlxx cuwlxx = gpfkDao.queryById(Wlxx.class, wlid);
gpfkVo.setCurwlsncode(cuwlxx.getCode());
gpfkVo.setCurwlsnname(cuwlxx.getName());
return gpfkVo;
FkVO newFkVo =gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
newFkVo.setSntype(snType);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, newFkVo.getWogylxid());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(newFkVo.getHgbz())&&newFkVo.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
return newFkVo;
}
else {
throwReturnMessage("序列号类型错误,请重新确认!");
}
return fkVO;
return fkVO;
}
@Override
public FkVO jyfk(FkCondition fkCondition) {
public FkVO wxfk(FkCondition fkCondition) {
if(StringUtils.isEmpty(fkCondition.getSncode())) {
throwReturnMessage("未扫描到条码,请重新确认!");
}
......@@ -1103,6 +1117,7 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
if(StringUtils.isNotEmpty(curFkVo.getId())) {
curFkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
}
curFkVo.setSntype(snType);
return curFkVo;
}
else if(snType.equals(SmCodeEnum.OKBZ.getId())) {
......@@ -1112,7 +1127,6 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
FkVO gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
System.out.println("");
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
......@@ -1122,8 +1136,8 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgbz("Y");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setHgbz("Y");
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
insert(gpfk);
......@@ -1166,10 +1180,10 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setHgbz("N");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
insert(gpfk);
......@@ -1204,9 +1218,9 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
return fkVO;
}
@Override
public FkVO wxfk(FkCondition fkCondition) {
public FkVO zpfk(FkCondition fkCondition) {
if(StringUtils.isEmpty(fkCondition.getSncode())) {
throwReturnMessage("未扫描到条码,请重新确认!");
}
......@@ -1230,7 +1244,6 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
curFkVo.setSntype(snType);
Wogylx wogylx = gpfkDao.queryById(Wogylx.class, curFkVo.getWogylxid());
if(!NumberUtils.equals(wogylx.getXh(),0)){
Wogylx existLastWogylx = gpfkDao.getLastGx(wogylx);
......@@ -1257,32 +1270,382 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
if(!curFkVo.getWozt().equals("R")) {
throwReturnMessage("该订单未下达无法进行反馈,请重新确认!");
}
if(StringUtils.isNotEmpty(curFkVo.getId())) {
GphyCondition hyCondition =new GphyCondition();
hyCondition.setMid(curFkVo.getId());
curFkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
if(gphyDao.queryIfZpwc(hyCondition)==0) {
curFkVo.setZpbz(SmCodeEnum.OKBZ.getPrefix());
}
}
curFkVo.setSntype(snType);
return curFkVo;
}
else if(snType.equals(SmCodeEnum.OKBZ.getId())) {
else if(snType.equals(SmCodeEnum.WLID.getId())) {
String wlid = coderuleService.matchCodeByRule(fkCondition.getSncode());
fkCondition.setWlid(wlid);
if(gpfkDao.checkIfContainsWobomWl(fkCondition)<=0) {
throwReturnMessage("该订单下不存在该发放工序物料,请重新确认!");
}
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
FkVO gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setWlid(wlid);
gpfk.setYwrq(DateUtils.getDate());
gpfk.setFklx(GpfkFklxEnum.WO.getId());
insert(gpfk);
gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
}
else {
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
update(gpfk);
gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
}
GphyCondition hyCondition =new GphyCondition();
hyCondition.setMid(gpfkVo.getId());
hyCondition.setSnid(fkCondition.getSncode());
if( gpfkDao.checkIfContainsGphywl(hyCondition)>0) {
throwReturnMessage("该序列号已经被扫描");
}
if(gphyService.compareIsZpComplete(gpfkVo.getId(),wlid)) {
Gphy gphy = new Gphy();
gphy.setFkgx(gpfkVo.getFkgx());
gphy.setWlid(wlid);
gphy.setMid(gpfkVo.getId());
gphy.setWlsnid(fkCondition.getSncode());
gphy.setFkrid(UserInfoUtil.getId());
gphy.setFkr(UserInfoUtil.getUserName());
gphy.setFksj(DateUtils.getDateTime());
gphy.setZpsl(1.0);
gphy.setHylx("BOM");
gphyService.insert(gphy);
}
if(gphyDao.queryIfZpwc(hyCondition)==0) {
curFkVo.setZpbz(SmCodeEnum.OKBZ.getPrefix());
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfkVo.getWogylx());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfkVo.getHgbz())&&gpfkVo.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
}
gpfkVo.setSntype(SmCodeEnum.WLID.getId());
Wlxx cuwlxx = gpfkDao.queryById(Wlxx.class, wlid);
gpfkVo.setCurwlsncode(cuwlxx.getCode());
gpfkVo.setCurwlsnname(cuwlxx.getName());
return gpfkVo;
}
else {
throwReturnMessage("序列号类型错误,请重新确认!");
}
return fkVO;
}
/************ -------------------科威尔反馈升级--BEGIN--------- ******/
/** 判断当前物料号的上一道工序是否完成 */
public void checkLastBzgxIfComplete(FkVO curFkVo) {
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
Wogylx wogylx = gpfkDao.queryById(Wogylx.class, curFkVo.getWogylxid());
if(!NumberUtils.equals(wogylx.getXh(),0)){
Wogylx existLastWogylx = gpfkDao.getLastGx(wogylx);
if(existLastWogylx != null){
FkCondition fkCondition2 =new FkCondition();
fkCondition2.setWogylx(existLastWogylx.getId());
fkCondition2.setWosncode(curFkVo.getWosnCode());
fkCondition2.setBzgxid(existLastWogylx.getBzgxid());
FkVO gpfkVo2 = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(curFkVo.getWosnCode(), existLastWogylx.getBzgxid());
if(gpfkVo2!=null) {
if((existLastWogylx.getGxlx()).equals(YymkFKEnum.ZP.getId())) {
GphyCondition gphyCondition =new GphyCondition();
gphyCondition.setMid(gpfkVo2.getId());
if(gpfkDao.queryIfZpwc(curFkVo.getWosnCode(),existLastWogylx.getBzgxid())!=0) {
throwReturnMessage("上道工序未完成不能反馈此道工序,请重新确认!");
}
}
if((existLastWogylx.getGxlx()).equals(YymkFKEnum.JY.getId())) {
if(StringUtils.isNotEmpty(gpfkVo2.getHgbz())&&(gpfkVo2.getHgbz().equals("Y")||gpfkVo2.getHgdj().equals(GpfkHgEnum.JYHG.getId())||gpfkVo2.getHgdj().equals(GpfkHgEnum.WXHG.getId()))) {
}
else {
throwReturnMessage("上道工序检验不合格不能反馈此道工序,请重新确认!");
}
}
}
else {
throwReturnMessage("上道工序未完成不能反馈此道工序,请重新确认!");
}
}
}
if(!curFkVo.getWozt().equals("R")) {
throwReturnMessage("该订单未下达无法进行反馈,请重新确认!");
}
}
/** 判断下一道工序是否存在反馈记录 */
public void checkNextBzgxIfExistFk(FkVO curFkVo) {
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
Wogylx wogylx = gpfkDao.queryById(Wogylx.class, curFkVo.getWogylxid());
if(!NumberUtils.equals(wogylx.getXh(),0)){
Wogylx existNextWogylx = gpfkDao.getNextGxUpdate(wogylx);
if(existNextWogylx != null){
FkCondition fkCondition2 =new FkCondition();
fkCondition2.setWogylx(existNextWogylx.getId());
fkCondition2.setWosncode(curFkVo.getWosnCode());
fkCondition2.setBzgxid(existNextWogylx.getBzgxid());
List<FkVO> gpfkVo2 = gpfkDao.queryKwellAllGpfkByWosnAndGxid(fkCondition2);
if(gpfkVo2!=null&&gpfkVo2.size()>0) {
throwReturnMessage("下道工序已经存在反馈记录不能装配此道工序,请重新确认!");
}
}
}
if(!curFkVo.getWozt().equals("R")) {
throwReturnMessage("该订单未下达无法进行反馈,请重新确认!");
}
}
/** 判断下一道工序是否存在反馈记录 */
public boolean checkIsCurrentGx(FkVO curFkVo) {
boolean flag = false;
GpfkVO gpfk = gpfkDao.queryGpfkByWosnUptoDate(curFkVo.getWosnCode());
if((curFkVo!=null&&gpfk!=null&&StringUtils.isNotEmpty(gpfk.getFkgx())&&StringUtils.isNotEmpty(curFkVo.getWogylx())&&gpfk.getFkgx().equals(curFkVo.getWogylx())))
{
flag =true;
}
return flag;
}
/** 判断装配工序是否装配完成*/
public boolean checkIfZpCompleteByWosnAndBzgx(String wosnid,String bzgx) {
boolean flag = false;
if(gpfkDao.queryIfZpwc(wosnid, bzgx)==0) {
flag= true;
}
return flag;
}
/** 判断该物料是否装配完成*/
public void compareIsZpComplete(GphyCondition gphyCondition) {
WlslItem wlslItem =gpfkDao.queryKwellZpslGphy(gphyCondition);
if(wlslItem!=null) {
double dwyl =gpfkDao.queryWobomZpslByDjidAndWlidUpgrade(gphyCondition.getWosncode(),gphyCondition.getBzgxid(), gphyCondition.getWlid());
if(dwyl<=wlslItem.getZpsl()) {
throwReturnMessage("该物料装配完成");
}
}
}
/** 查询订单清单及已经装配数量 */
@Override
public List<WobomVO> queryWobomByWoUpgrade(String wosn,String bzgx) {
return gpfkDao.queryWobomByWosnAndBzgx(wosn,bzgx);
}
/**
* 装配反馈流程升级
*/
@Override
public FkVO zpfkUpgrade(FkCondition fkCondition) {
/*
* 基础判断 1.条码是否为空 2.前端是否传入标准工序 3.条码是否为已知类型条码
*/
if(StringUtils.isEmpty(fkCondition.getSncode())) {
throwReturnMessage("未扫描到条码,请重新确认!");
}
if(StringUtils.isEmpty(fkCondition.getBzgxid())) {
throwReturnMessage("扫描工序出错,请重新确认!");
}
String snType = checkSnType(fkCondition.getSncode());
if(StringUtils.isEmpty(snType)) {
throwReturnMessage("该条码为未知条码,请重新确认!");
}
FkVO fkVO = null;
if(snType.equals(SmCodeEnum.LOGOUT.getId())) {
fkVO = new FkVO();
fkVO.setSntype(snType);
}
else if(snType.equals(SmCodeEnum.WOSNID.getId())) {
GpfkCondition gpfkCondition = new GpfkCondition();
gpfkCondition.setWosnid(fkCondition.getSncode());
gpfkCondition.setBzgxid(fkCondition.getBzgxid());
FkVO curFkVo = gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getSncode(), fkCondition.getBzgxid());
checkLastBzgxIfComplete(curFkVo);
checkNextBzgxIfExistFk(curFkVo);
if(StringUtils.isNotEmpty(curFkVo.getId())) {
curFkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
if(checkIfZpCompleteByWosnAndBzgx(fkCondition.getSncode(), fkCondition.getBzgxid())) {
curFkVo.setZpbz(SmCodeEnum.OKBZ.getPrefix());
}
}
curFkVo.setSntype(snType);
return curFkVo;
}
else if(snType.equals(SmCodeEnum.WLID.getId())) {
String wlid = coderuleService.matchCodeByRule(fkCondition.getSncode());
fkCondition.setWlid(wlid);
if(gpfkDao.checkIfContainsWobomWl(fkCondition)<=0) {
throwReturnMessage("该订单下不存在该发放工序物料,请重新确认!");
}
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO curFkVo =gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
if(curFkVo==null) {
throwReturnMessage("该订单不存在对应工序,请重新确认!");
}
FkVO gpfkVo =null;
if(checkIsCurrentGx(curFkVo)) {
/* 本工序为当前工序*/
gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
update(gpfk);
gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
}
else {
/* 本工序不为最新工序 存在情况为该订单序列号去维修 */
Gpfk gpfk = new Gpfk();
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(wlid);
gpfk.setYwrq(DateUtils.getDate());
gpfk.setFklx(GpfkFklxEnum.WO.getId());
insert(gpfk);
gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
}
GphyCondition hyCondition =new GphyCondition();
hyCondition.setBzgxid(fkCondition.getBzgxid());
hyCondition.setWosncode(fkCondition.getWosncode());
hyCondition.setSnid(fkCondition.getSncode());
hyCondition.setWlid(wlid);
if( gpfkDao.checkIfContainsGphywl(hyCondition)>0) {
throwReturnMessage("该序列号已经被扫描");
}
compareIsZpComplete(hyCondition);
Gphy gphy = new Gphy();
gphy.setFkgx(gpfkVo.getFkgx());
gphy.setWlid(wlid);
gphy.setMid(gpfkVo.getId());
gphy.setWlsnid(fkCondition.getSncode());
gphy.setFkrid(UserInfoUtil.getId());
gphy.setFkr(UserInfoUtil.getUserName());
gphy.setFksj(DateUtils.getDateTime());
gphy.setZpsl(1.0);
gphy.setHylx("BOM");
gphyService.insert(gphy);
if(checkIfZpCompleteByWosnAndBzgx(fkCondition.getSncode(), fkCondition.getBzgxid())) {
curFkVo.setZpbz(SmCodeEnum.OKBZ.getPrefix());
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, gpfkVo.getWogylx());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(gpfkVo.getHgbz())&&gpfkVo.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
}
gpfkVo.setSntype(SmCodeEnum.WLID.getId());
Wlxx cuwlxx = gpfkDao.queryById(Wlxx.class, wlid);
gpfkVo.setCurwlsncode(cuwlxx.getCode());
gpfkVo.setCurwlsnname(cuwlxx.getName());
return gpfkVo;
}
else {
throwReturnMessage("序列号类型错误,请重新确认!");
}
return null;
}
@Override
public FkVO jyfkUpgrade(FkCondition fkCondition) {
/*
* 基础判断 1.条码是否为空 2.前端是否传入标准工序 3.条码是否为已知类型条码
*/
if(StringUtils.isEmpty(fkCondition.getSncode())) {
throwReturnMessage("未扫描到条码,请重新确认!");
}
if(StringUtils.isEmpty(fkCondition.getBzgxid())) {
throwReturnMessage("扫描工序出错,请重新确认!");
}
String snType = checkSnType(fkCondition.getSncode());
if(StringUtils.isEmpty(snType)) {
throwReturnMessage("该条码为未知条码,请重新确认!");
}
FkVO fkVO = null;
if(snType.equals(SmCodeEnum.LOGOUT.getId())) {
fkVO = new FkVO();
fkVO.setSntype(snType);
}
else if(snType.equals(SmCodeEnum.WOSNID.getId())) {
GpfkCondition gpfkCondition = new GpfkCondition();
gpfkCondition.setWosnid(fkCondition.getSncode());
gpfkCondition.setBzgxid(fkCondition.getBzgxid());
FkVO curFkVo = gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getSncode(), fkCondition.getBzgxid());
checkLastBzgxIfComplete(curFkVo);
checkNextBzgxIfExistFk(curFkVo);
if(StringUtils.isNotEmpty(curFkVo.getId())) {
curFkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
}
curFkVo.setSntype(snType);
return curFkVo;
}
else if(snType.equals(SmCodeEnum.OKBZ.getId())) {
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
FkVO curFkVo =gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgbz("Y");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
gpfk.setHgdj(GpfkHgEnum.JYHG.getId());
insert(gpfk);
}
else {
......@@ -1294,9 +1657,10 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setHgdj(GpfkHgEnum.JYHG.getId());
update(gpfk);
}
FkVO newFkVo =gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
FkVO newFkVo =gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
newFkVo.setSntype(snType);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, newFkVo.getWogylxid());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
......@@ -1313,22 +1677,23 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO gpfkVo = gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
FkVO gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
FkVO curFkVo =gpfkDao.queryKwellWoBySnid(fkCondition.getWosncode(), fkCondition.getBzgxid());
FkVO curFkVo =gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setHgbz("N");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
gpfk.setHgdj(GpfkHgEnum.JYBHG.getId());
insert(gpfk);
}
else {
......@@ -1340,12 +1705,102 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setHgdj(GpfkHgEnum.JYBHG.getId());
update(gpfk);
}
FkVO newFkVo =gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
newFkVo.setSntype(snType);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, newFkVo.getWogylxid());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(newFkVo.getHgbz())&&newFkVo.getHgbz().equals("N")) {
cancelPcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
cancelPcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
return newFkVo;
}
return null;
}
@Override
public FkVO wxfkUpgrade(FkCondition fkCondition) {
/*
* 基础判断 1.条码是否为空 2.前端是否传入标准工序 3.条码是否为已知类型条码
*/
if(StringUtils.isEmpty(fkCondition.getSncode())) {
throwReturnMessage("未扫描到条码,请重新确认!");
}
if(StringUtils.isEmpty(fkCondition.getBzgxid())) {
throwReturnMessage("扫描工序出错,请重新确认!");
}
String snType = checkSnType(fkCondition.getSncode());
if(StringUtils.isEmpty(snType)) {
throwReturnMessage("该条码为未知条码,请重新确认!");
}
FkVO fkVO = null;
if(snType.equals(SmCodeEnum.LOGOUT.getId())) {
fkVO = new FkVO();
fkVO.setSntype(snType);
}
else if(snType.equals(SmCodeEnum.WOSNID.getId())) {
GpfkCondition gpfkCondition = new GpfkCondition();
gpfkCondition.setWosnid(fkCondition.getSncode());
gpfkCondition.setBzgxid(fkCondition.getBzgxid());
FkVO curFkVo = gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getSncode(), fkCondition.getBzgxid());
checkLastBzgxIfComplete(curFkVo);
checkNextBzgxIfExistFk(curFkVo);
if(StringUtils.isNotEmpty(curFkVo.getId())) {
curFkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
}
curFkVo.setSntype(snType);
return curFkVo;
}
else if(snType.equals(SmCodeEnum.OKBZ.getId())) {
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
FkVO curFkVo =gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgbz("Y");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
insert(gpfk);
}
else {
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
gpfk.setHgbz("Y");
gpfk.setHgsl(1.0);
gpfk.setBhgsl(0.0);
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
update(gpfk);
}
GpfkVO jygpfkVo =gpfkDao.queryJyGpfkByWosnUptoDate(fkCondition.getWosncode());
if(jygpfkVo!=null) {
Gpfk jygpfk = new Gpfk();
EntityDataFactory.copyEntity(jygpfkVo, jygpfk);
jygpfk.setHgdj(GpfkHgEnum.WXHG.getId());
update(jygpfk);
}
FkVO newFkVo =gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
newFkVo.setSntype(snType);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, newFkVo.getWogylxid());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(newFkVo.getHgbz())&&newFkVo.getHgbz().equals("N")) {
updatePcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
......@@ -1355,12 +1810,54 @@ public class GpfkServiceImpl extends BaseEditServiceImpl implements GpfkService
}
return newFkVo;
}
else {
throwReturnMessage("序列号类型错误,请重新确认!");
else if(snType.equals(SmCodeEnum.NGBZ.getId())) {
if(StringUtils.isEmpty(fkCondition.getWosncode())) {
throwReturnMessage("该订单序列号未输入,请重新确认!");
}
FkVO gpfkVo = gpfkDao.queryWowithIfExistGpfkByWosnAndBzgxidInNewDate(fkCondition.getSncode(), fkCondition.getBzgxid());
if(gpfkVo==null) {
Gpfk gpfk = new Gpfk();
FkVO curFkVo =gpfkDao.queryKwellWoBySnidUptoDate(fkCondition.getWosncode(), fkCondition.getBzgxid());
gpfk.setWosnid(curFkVo.getWosnCode());
gpfk.setWogylx(curFkVo.getWogylxid());
gpfk.setFkgx(curFkVo.getWogylxid());
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
gpfk.setWlid(curFkVo.getWlid());
gpfk.setHgbz("N");
gpfk.setFklx(GpfkFklxEnum.WO.getId());
gpfk.setYwrq(DateUtils.getDate());
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
insert(gpfk);
}
else {
Gpfk gpfk = new Gpfk();
EntityDataFactory.copyEntity(gpfkVo, gpfk);
gpfk.setHgbz("N");
gpfk.setHgsl(0.0);
gpfk.setBhgsl(1.0);
gpfk.setFkrid(UserInfoUtil.getId());
gpfk.setFkr(UserInfoUtil.getUserName());
gpfk.setFksj(DateUtils.getDateTime());
update(gpfk);
}
FkVO newFkVo =gpfkDao.queryKwellGpfkByWosnAndGxid(fkCondition);
newFkVo.setSntype(snType);
Wogylx wogylx = (Wogylx) GavelSql.selectEntityByKey(Wogylx.class, newFkVo.getWogylxid());
if(wogylx!=null&&StringUtils.isNotEmpty(wogylx.getGxbz())&&(wogylx.getGxbz().equals("D")||wogylx.getGxbz().equals("M"))) {
if(StringUtils.isNotEmpty(newFkVo.getHgbz())&&newFkVo.getHgbz().equals("N")) {
cancelPcjh(wogylx.getWoid(),wogylx.getGxlx(),false);
}
else {
cancelPcjh(wogylx.getWoid(),wogylx.getGxlx(),true);
}
}
return newFkVo;
}
return fkVO;
return null;
}
/************ -------------------科威尔反馈升级--END--------- ******/
}
package com.gavel.kwell.utils;
import com.gavel.kzzx.model.GavelEnumModel;
import java.util.ArrayList;
import java.util.List;
public enum GpfkHgEnum {
JYHG("JYHG","检验合格"),
WXHG("WXHG", "维修合格"),
JYBHG("JYBHG","检验不合格");
private String id; //数据库存储
private String name;
GpfkHgEnum(String name, String id) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static List<GavelEnumModel> toList(){
List<GavelEnumModel> list = new ArrayList<>();
for (GpfkHgEnum e : GpfkHgEnum.values()) {
GavelEnumModel gavelEnumModel = new GavelEnumModel();
gavelEnumModel.setId(e.getId());
gavelEnumModel.setName(e.getName());
list.add(gavelEnumModel);
}
return list;
}
}
......@@ -25,8 +25,22 @@ public class GphyCondition extends BaseEntity {
private String fkid;
private String wosncode;
private String bzgxid;
public String getWosncode() {
return wosncode;
}
public void setWosncode(String wosncode) {
this.wosncode = wosncode;
}
public String getBzgxid() {
return bzgxid;
}
public void setBzgxid(String bzgxid) {
this.bzgxid = bzgxid;
}
public String getFkid() {
return fkid;
}
......
......@@ -3,9 +3,23 @@ package com.gavel.kwell.vo;
import java.io.Serializable;
public class WlslItem implements Serializable {
private static final long serialVersionUID = 1L;
private String wlid;
private String wosncode;
private String bzgxid;
private Double zpsl;
public String getWosncode() {
return wosncode;
}
public void setWosncode(String wosncode) {
this.wosncode = wosncode;
}
public String getBzgxid() {
return bzgxid;
}
public void setBzgxid(String bzgxid) {
this.bzgxid = bzgxid;
}
public String getWlid() {
return wlid;
}
......
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