| | |
| | | package com.zy.common.service.erp; |
| | | |
| | | import com.baomidou.mybatisplus.MybatisSqlSessionTemplate; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | * @param fInterID 单据内码 |
| | | */ |
| | | private List<InStockBillEntry> getInStockBillEntry(Integer fInterID) { |
| | | String sql = "select * from InStockBillEntry where 1=1 and FSourceBillNo!='' and FAuxCommitQty=0 and FInterID = " + fInterID; |
| | | // String sql = "select * from InStockBillEntry where 1=1 and FSourceBillNo!='' and FAuxCommitQty=0 and FInterID = " + fInterID; |
| | | String sql = "select * from InStockBillEntry where 1=1 and FAuxCommitQty=0 and FInterID = " + fInterID; |
| | | return erpSqlServer.select(sql, InStockBillEntry.class); |
| | | } |
| | | |
| | |
| | | * 提取中间表成品入库单据 |
| | | */ |
| | | public List<CPICMO> getReadyCPICMO() { |
| | | String sql = "select * from CPICMO where 1=1 and FSourceBillNo!='' and FAuxCommitQty=0 and Fflag_rw = 0"; |
| | | // String sql = "select * from CPICMO where 1=1 and FSourceBillNo!='' and FAuxCommitQty=0 and Fflag_rw = 0"; |
| | | String sql = "select * from CPICMO where 1=1 and FAuxCommitQty=0 and Fflag_rw = 0"; |
| | | return erpSqlServer.select(sql, CPICMO.class); |
| | | } |
| | | |
| | |
| | | return erpSqlServer.executeQueryCount(sql,"qty"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询erp中间表表体OutStockbillEntry数据 |
| | | * @param FInterID |
| | | * @return |
| | | */ |
| | | public List<OutStockBillEntry> syncOutStockDetail(Integer FInterID) { |
| | | return erpSqlServer.select("SELECT * FROM xtyasrs_dual.dbo.OutStockBillEntry where FSourceBillNo!='' and FAuxCommitQty=0 and FInterID=" + FInterID, OutStockBillEntry.class); |
| | | // String sql = "SELECT * FROM xtyasrs_dual.dbo.OutStockBillEntry where FSourceBillNo!='' and FAuxCommitQty=0 and FInterID=" + FInterID; |
| | | String sql = "SELECT * FROM xtyasrs_dual.dbo.OutStockBillEntry where FAuxCommitQty=0 and FInterID=" + FInterID; |
| | | return erpSqlServer.select(sql, OutStockBillEntry.class); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | if (complete) { |
| | | if (!completeCPakOut(FBillNo)) { |
| | | log.error("{}出库单标记完成失败", FBillNo); |
| | | } |
| | | int updateCount = jdbcTemplate.update("update OutStockbill set Fflag_finish=1 where FBillNo='" + FBillNo + "'"); |
| | | if(updateCount<=0){ |
| | | throw new CoolException("更新出库通知档完成标记失败[FBillNo="+FBillNo+"]"); |
| | | sql = "select * from OutStockbillEntry where 1=1 and FInterID = {1,number,#}"; |
| | | sql = MessageFormat.format(sql, Fnumber, FInterID); |
| | | List<OutStockBillEntry> select1 = erpSqlServer.select(sql, OutStockBillEntry.class); |
| | | if(select1.size()<=1){ |
| | | if (!completeCPakOut(FBillNo) ) { |
| | | log.error("{}出库单标记完成失败", FBillNo); |
| | | } |
| | | int updateCount = jdbcTemplate.update("update OutStockbill set Fflag_finish=1 where FBillNo='" + FBillNo + "'"); |
| | | if(updateCount<=0){ |
| | | throw new CoolException("更新出库通知档完成标记失败[FBillNo="+FBillNo+"]"); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | |
| | | return false; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | String msg = "incrementCPakOut成品增量出库失败[FInterID={0},Fnumber={1},FBillNo={2}]\n"; |
| | | msg = MessageFormat.format(msg,FInterID,Fnumber,FBillNo); |
| | | log.error(msg, e); |
| | | // e.printStackTrace(); |
| | | log.error("incrementCPakOut----" + sql); |
| | | return false; |
| | | } |