IDEMPIERE-3514 Production: Could not save MA for Production line
This commit is contained in:
parent
267fab419a
commit
43300bdfc2
|
@ -114,17 +114,21 @@ public class MProductionLine extends X_M_ProductionLine {
|
||||||
}
|
}
|
||||||
Timestamp dateMPolicy = date;
|
Timestamp dateMPolicy = date;
|
||||||
if(getM_AttributeSetInstance_ID()>0){
|
if(getM_AttributeSetInstance_ID()>0){
|
||||||
Timestamp t = MStorageOnHand.getDateMaterialPolicy(getM_Product_ID(), getM_AttributeSetInstance_ID(), get_TrxName());
|
Timestamp t = MStorageOnHand.getDateMaterialPolicy(getM_Product_ID(), getM_AttributeSetInstance_ID(), getM_Locator_ID(), get_TrxName());
|
||||||
if (t != null)
|
if (t != null)
|
||||||
dateMPolicy = t;
|
dateMPolicy = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
dateMPolicy = Util.removeTime(dateMPolicy);
|
dateMPolicy = Util.removeTime(dateMPolicy);
|
||||||
MProductionLineMA lineMA = new MProductionLineMA( this,
|
//for reversal, keep the ma copy from original trx
|
||||||
asi.get_ID(), getMovementQty(),dateMPolicy);
|
if (reversalId <= 0 )
|
||||||
if ( !lineMA.save(get_TrxName()) ) {
|
{
|
||||||
log.log(Level.SEVERE, "Could not save MA for " + toString());
|
MProductionLineMA lineMA = new MProductionLineMA( this,
|
||||||
errorString.append("Could not save MA for " + toString() + "\n" );
|
asi.get_ID(), getMovementQty(),dateMPolicy);
|
||||||
|
if ( !lineMA.save(get_TrxName()) ) {
|
||||||
|
log.log(Level.SEVERE, "Could not save MA for " + toString());
|
||||||
|
errorString.append("Could not save MA for " + toString() + "\n" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MTransaction matTrx = new MTransaction (getCtx(), getAD_Org_ID(),
|
MTransaction matTrx = new MTransaction (getCtx(), getAD_Org_ID(),
|
||||||
"P+",
|
"P+",
|
||||||
|
|
|
@ -1035,7 +1035,8 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
||||||
*
|
*
|
||||||
* @param M_Product_ID
|
* @param M_Product_ID
|
||||||
* @param M_AttributeSetInstance_ID
|
* @param M_AttributeSetInstance_ID
|
||||||
* @return
|
* @param trxName
|
||||||
|
* @return datempolicy timestamp
|
||||||
*/
|
*/
|
||||||
public static Timestamp getDateMaterialPolicy(int M_Product_ID, int M_AttributeSetInstance_ID,String trxName){
|
public static Timestamp getDateMaterialPolicy(int M_Product_ID, int M_AttributeSetInstance_ID,String trxName){
|
||||||
|
|
||||||
|
@ -1068,6 +1069,49 @@ public class MStorageOnHand extends X_M_StorageOnHand
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
} //getDateMaterialPolicy
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param M_Product_ID
|
||||||
|
* @param M_AttributeSetInstance_ID
|
||||||
|
* @param M_Locator_ID
|
||||||
|
* @param trxName
|
||||||
|
* @return datempolicy timestamp
|
||||||
|
*/
|
||||||
|
public static Timestamp getDateMaterialPolicy(int M_Product_ID, int M_AttributeSetInstance_ID, int M_Locator_ID, String trxName){
|
||||||
|
|
||||||
|
if (M_Product_ID <= 0 || M_AttributeSetInstance_ID <= 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
String sql = "SELECT dateMaterialPolicy FROM M_StorageOnHand WHERE M_Product_ID=? and M_AttributeSetInstance_ID=? AND M_Locator_ID=?";
|
||||||
|
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
|
pstmt.setInt(1, M_Product_ID);
|
||||||
|
pstmt.setInt(2, M_AttributeSetInstance_ID);
|
||||||
|
pstmt.setInt(3, M_Locator_ID);
|
||||||
|
|
||||||
|
rs = pstmt.executeQuery();
|
||||||
|
if (rs.next())
|
||||||
|
{
|
||||||
|
return rs.getTimestamp(1);
|
||||||
|
}
|
||||||
|
} catch (SQLException ex)
|
||||||
|
{
|
||||||
|
s_log.log(Level.SEVERE, sql, ex);
|
||||||
|
|
||||||
|
}finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
} //getDateMaterialPolicy
|
} //getDateMaterialPolicy
|
||||||
} // MStorageOnHand
|
} // MStorageOnHand
|
||||||
|
|
Loading…
Reference in New Issue